Skip to content

Commit 4112159

Browse files
chore: use ruff to import annotations (#1042)
* configure ruff to import annotations * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 8290c4c commit 4112159

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+75
-54
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
- id: black
2424

2525
- repo: https://github.com/astral-sh/ruff-pre-commit
26-
rev: v0.1.4
26+
rev: v0.1.6
2727
hooks:
2828
- id: ruff
2929
args: [--fix, --show-fixes]

dev/example-objects.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Use this to make an example ROOT file for src/uproot/models/TH.py and src/uproot/models/TGraph.py.
33
"""
4+
from __future__ import annotations
45

56
import numpy as np
67
import ROOT

dev/make-models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Use this to make src/uproot/models/TH.py and src/uproot/models/TGraph.py.
33
"""
4+
from __future__ import annotations
45

56
import numpy as np
67

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ select = [
141141
]
142142
src = ["src"]
143143

144+
[tool.ruff.lint]
145+
isort.required-imports = ["from __future__ import annotations"]
146+
144147
[tool.ruff.mccabe]
145148
max-complexity = 100
146149

src/uproot/_awkward_forth.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44
This module defines utilities for adding components to the forth reader.
55
"""
6+
from __future__ import annotations
67

78
import numpy as np
89

src/uproot/behavior.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Behaviors are defined by specially named classes in specially named modules
66
that get auto-detected by :doc:`uproot.behavior.behavior_of`.
77
"""
8-
8+
from __future__ import annotations
99

1010
import pkgutil
1111

src/uproot/behaviors/RooCurve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
This module defines the behaviors of ``RooCurve``.
55
"""
6-
6+
from __future__ import annotations
77

88
import numpy
99

src/uproot/behaviors/RooHist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
This module defines the behaviors of ``RooHist``.
55
"""
6-
6+
from __future__ import annotations
77

88
import numpy
99

src/uproot/behaviors/TAxis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
This module defines the behaviors of ``TAxis``, an axis of a histogram or profile plot.
55
"""
6-
6+
from __future__ import annotations
77

88
import numpy
99

src/uproot/behaviors/TBranch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
See :doc:`uproot.models.TBranch` for deserialization of the ``TBranch``
1111
objects themselves.
1212
"""
13+
from __future__ import annotations
1314

1415
import queue
1516
import re

0 commit comments

Comments
 (0)