mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Enable nearly all pyupgrade rules (except on test cases) (#11499)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -28,6 +28,7 @@ select = [
|
||||
"B", # flake8-bugbear
|
||||
"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
|
||||
@@ -40,14 +41,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.per-file-ignores]
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user