Skip to content

Commit 98991d2

Browse files
committed
Update ruff to 0.9
1 parent f5376ac commit 98991d2

File tree

6 files changed

+470
-458
lines changed

6 files changed

+470
-458
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
# Ruff version.
4-
rev: v0.6.6
4+
rev: v0.9.5
55
hooks:
66
# Run the linter.
77
- id: ruff

Pipfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pytest = "*"
1717
pytest-cov = "*"
1818
PyYAML = "*"
1919
rdflib = "*"
20-
ruff = "*"
20+
ruff = "~=0.9"
2121
setuptools = ">=42.0"
2222
Sphinx = "*"
2323
sphinx_rtd_theme = "*"

Pipfile.lock

+450-438
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nutree/tree.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1022,9 +1022,9 @@ def _self_check(self) -> Literal[True]:
10221022
# assert node._data_id == self.calc_data_id(node.data), node
10231023
assert node._data_id in self._nodes_by_data_id, node
10241024
assert node._node_id == id(node), f"{node}: {node._node_id} != {id(node)}"
1025-
assert (
1026-
node._children is None or len(node._children) > 0
1027-
), f"{node}: {node._children}"
1025+
assert node._children is None or len(node._children) > 0, (
1026+
f"{node}: {node._children}"
1027+
)
10281028

10291029
assert len(self._node_by_id) == len(node_list)
10301030

nutree/tree_generator.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ class Randomizer(ABC):
4343
"""
4444

4545
def __init__(self, *, probability: float = 1.0) -> None:
46-
assert (
47-
isinstance(probability, float) and 0.0 <= probability <= 1.0
48-
), f"probality must be in the range [0.0 .. 1.0]: {probability}"
46+
assert isinstance(probability, float) and 0.0 <= probability <= 1.0, (
47+
f"probality must be in the range [0.0 .. 1.0]: {probability}"
48+
)
4949
self.probability = probability
5050

5151
def _skip_value(self) -> bool:
@@ -84,9 +84,9 @@ def __init__(
8484
none_value: Any = None,
8585
) -> None:
8686
super().__init__(probability=probability)
87-
assert type(min_val) is type(
88-
max_val
89-
), f"min_val and max_val must be of the same type: {min_val}, {max_val}"
87+
assert type(min_val) is type(max_val), (
88+
f"min_val and max_val must be of the same type: {min_val}, {max_val}"
89+
)
9090
self.is_float = isinstance(min_val, float)
9191
self.min = min_val
9292
self.max = max_val
@@ -129,19 +129,19 @@ def __init__(
129129
) -> None:
130130
super().__init__(probability=probability)
131131
assert isinstance(min_dt, date), f"min_dt must be a date: {min_dt}"
132-
assert isinstance(
133-
max_dt, (date, int)
134-
), f"max_dt must be a date or int: {max_dt}"
132+
assert isinstance(max_dt, (date, int)), (
133+
f"max_dt must be a date or int: {max_dt}"
134+
)
135135

136136
if isinstance(max_dt, int):
137137
self.delta_days = max_dt
138138
max_dt = min_dt + timedelta(days=self.delta_days)
139139
else:
140140
self.delta_days = (max_dt - min_dt).days
141141

142-
assert (
143-
max_dt > min_dt
144-
), f"max_dt must be greater than min_dt: {min_dt}, {max_dt}"
142+
assert max_dt > min_dt, (
143+
f"max_dt must be greater than min_dt: {min_dt}, {max_dt}"
144+
)
145145

146146
self.min = min_dt
147147
self.max = max_dt

tests/test_objects.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,9 @@ class FrozenItem:
285285

286286
assert isinstance(dict_node.data, FrozenItem)
287287
assert dict_node.data is item, "dataclass should be stored as reference"
288-
assert (
289-
dict_node.price == 12.34
290-
), "should support attribute access via forwardinging"
288+
assert dict_node.price == 12.34, (
289+
"should support attribute access via forwardinging"
290+
)
291291
with pytest.raises(AttributeError):
292292
_ = dict_node.foo
293293

0 commit comments

Comments
 (0)