@@ -28,6 +28,7 @@ select = [
2828 " B" , # flake8-bugbear
2929 " FA" , # flake8-future-annotations
3030 " I" , # isort
31+ " UP" , # pyupgrade
3132 # Only enable rules that have safe autofixes:
3233 " F401" , # Remove unused imports
3334 " PYI009" , # use `...`, not `pass`, in empty class bodies
@@ -40,14 +41,21 @@ select = [
4041 " PYI032" , # use `object`, not `Any`, as the second parameter to `__eq__`
4142 " PYI055" , # multiple `type[T]` usages in a union
4243 " 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
5159]
5260
5361[tool .ruff .lint .per-file-ignores ]
0 commit comments