Skip to content

Commit 0fa140c

Browse files
committed
lint: update ruff config
1 parent c429828 commit 0fa140c

3 files changed

Lines changed: 9 additions & 15 deletions

File tree

optree/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
]
127127

128128

129-
PyTreeDef = PyTreeSpec # alias
129+
PyTreeDef: TypeAlias = PyTreeSpec # alias
130130

131131
T = TypeVar('T')
132132
S = TypeVar('S')

pyproject.toml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,23 +228,15 @@ typing-modules = ["optree.typing"]
228228
"__init__.py" = [
229229
"F401", # unused-import
230230
]
231-
"optree/typing.py" = [
232-
"E402", # module-import-not-at-top-of-file
233-
"F722", # forward-annotation-syntax-error
234-
"F811", # redefined-while-unused
235-
]
236231
"setup.py" = [
237232
"D", # pydocstyle
238-
"ANN", # flake8-annotations
239233
]
240234
"tests/**/*.py" = [
241235
"D", # pydocstyle
242236
"ANN", # flake8-annotations
243237
"S", # flake8-bandit
244-
"BLE", # flake8-blind-except
245238
"SIM", # flake8-simplify
246239
"INP001", # flake8-no-pep420
247-
"E402", # module-import-not-at-top-of-file
248240
]
249241
"docs/source/conf.py" = [
250242
"D", # pydocstyle
@@ -253,7 +245,6 @@ typing-modules = ["optree.typing"]
253245
]
254246
".github/workflows/**/*.py" = [
255247
"D", # pydocstyle
256-
"ANN", # flake8-annotations
257248
]
258249

259250
[tool.ruff.lint.isort]

tests/test_prefix_errors.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,11 +527,14 @@ def shuffle_dictionary(x):
527527
namespace=namespace,
528528
)
529529
assert shuffled_treespec.is_prefix(shuffled_suffix_treespec)
530-
() == optree.prefix_errors( # noqa: B015
531-
shuffled_tree,
532-
shuffled_suffix_tree,
533-
none_is_leaf=none_is_leaf,
534-
namespace=namespace,
530+
assert (
531+
optree.prefix_errors(
532+
shuffled_tree,
533+
shuffled_suffix_tree,
534+
none_is_leaf=none_is_leaf,
535+
namespace=namespace,
536+
)
537+
== []
535538
)
536539

537540

0 commit comments

Comments
 (0)