Skip to content
Merged
24 changes: 16 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ exclude = [
select = [
"FA", # flake8-future-annotations
"I", # isort
"UP", # pyupgrade
# Only enable rules that have safe autofixes:
"F401", # Remove unused imports
"PYI009", # use `...`, not `pass`, in empty class bodies
Expand All @@ -39,14 +40,21 @@ select = [
"PYI032", # use `object`, not `Any`, as the second parameter to `__eq__`
"PYI055", # multiple `type[T]` usages in a union
"PYI058", # use `Iterator` as the return type for `__iter__` methods
"UP004", # Remove explicit `object` inheritance
"UP006", # PEP-585 autofixes
"UP007", # PEP-604 autofixes
"UP013", # Class-based syntax for TypedDicts
"UP014", # Class-based syntax for NamedTuples
"UP019", # Use str over typing.Text
"UP035", # import from typing, not typing_extensions, wherever possible
"UP039", # don't use parens after a class definition with no bases
]
ignore = [
# Slower and more verbose https://github.com/astral-sh/ruff/issues/7871
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
]

[tool.ruff.lint.per-file-ignores]
# Disable "modernization" rules with autofixes from test cases as they often
# deliberately contain code that might not be considered idiomatic or modern
# These can be run manually once in a while
"**/test_cases/**/*.py" = ["UP"]
# Generated protobuf files:
# TODO: Re-run sync_tensorflow_protobuf_stubs.sh with this rule enabled to remove this entry
"*_pb2.pyi" = [
"UP036", # Version block is outdated for minimum Python version
]

[tool.ruff.lint.isort]
Expand Down
5 changes: 4 additions & 1 deletion stubs/six/six/moves/builtins.pyi
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
from builtins import *
# flake8: noqa: NQA102 # https://github.com/plinss/flake8-noqa/issues/22
# six explicitly re-exports builtins. Normally this is something we'd want to avoid.
# But this is specifically a compatibility package.
from builtins import * # noqa: UP029