@@ -28,6 +28,7 @@ select = [
28
28
" B" , # flake8-bugbear
29
29
" FA" , # flake8-future-annotations
30
30
" I" , # isort
31
+ " UP" , # pyupgrade
31
32
# Only enable rules that have safe autofixes:
32
33
" F401" , # Remove unused imports
33
34
" PYI009" , # use `...`, not `pass`, in empty class bodies
@@ -40,14 +41,21 @@ select = [
40
41
" PYI032" , # use `object`, not `Any`, as the second parameter to `__eq__`
41
42
" PYI055" , # multiple `type[T]` usages in a union
42
43
" PYI058" , # use `Iterator` as the return type for `__iter__` methods
43
- " UP004" , # Remove explicit `object` inheritance
44
- " UP006" , # PEP-585 autofixes
45
- " UP007" , # PEP-604 autofixes
46
- " UP013" , # Class-based syntax for TypedDicts
47
- " UP014" , # Class-based syntax for NamedTuples
48
- " UP019" , # Use str over typing.Text
49
- " UP035" , # import from typing, not typing_extensions, wherever possible
50
- " UP039" , # don't use parens after a class definition with no bases
44
+ ]
45
+ ignore = [
46
+ # Slower and more verbose https://github.com/astral-sh/ruff/issues/7871
47
+ " UP038" , # Use `X | Y` in `isinstance` call instead of `(X, Y)`
48
+ ]
49
+
50
+ [tool .ruff .lint .per-file-ignores ]
51
+ # Disable "modernization" rules with autofixes from test cases as they often
52
+ # deliberately contain code that might not be considered idiomatic or modern
53
+ # These can be run manually once in a while
54
+ "**/test_cases/**/*.py" = [" UP" ]
55
+ # Generated protobuf files:
56
+ # TODO: Re-run sync_tensorflow_protobuf_stubs.sh with this rule enabled to remove this entry
57
+ "*_pb2.pyi" = [
58
+ " UP036" , # Version block is outdated for minimum Python version
51
59
]
52
60
53
61
[tool .ruff .lint .per-file-ignores ]
0 commit comments