mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
114 lines
2.9 KiB
TOML
114 lines
2.9 KiB
TOML
[tool.black]
|
|
line_length = 130
|
|
target_version = ["py310"]
|
|
skip_magic_trailing_comma = true
|
|
# Exclude protobuf files because they have long line lengths
|
|
# Ideally, we could configure Black to allow longer line lengths
|
|
# for just these files, but doesn't seem possible yet.
|
|
force-exclude = ".*_pb2.pyi"
|
|
|
|
[tool.ruff]
|
|
line-length = 130
|
|
# Oldest supported Python version
|
|
target-version = "py38"
|
|
fix = true
|
|
exclude = [
|
|
# virtual environment
|
|
".env",
|
|
".venv",
|
|
"env",
|
|
# cache directories, etc.:
|
|
".git",
|
|
".mypy_cache",
|
|
".pytype",
|
|
]
|
|
|
|
[tool.ruff.lint]
|
|
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
|
|
"PYI010", # function bodies must be empty
|
|
"PYI012", # class bodies must not contain `pass`
|
|
"PYI013", # non-empty class bodies must not contain `...`
|
|
"PYI016", # duplicate union member
|
|
"PYI020", # quoted annotations are always unnecessary in stubs
|
|
"PYI025", # always alias `collections.abc.Set` as `AbstractSet` when importing it
|
|
"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
|
|
]
|
|
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"]
|
|
"*.pyi" = [
|
|
# Most flake8-bugbear rules don't apply for third-party stubs like typeshed,
|
|
# B033 could be slightly useful but Ruff doesn't have per-file select
|
|
"B", # flake8-bugbear
|
|
]
|
|
|
|
[tool.ruff.lint.isort]
|
|
split-on-trailing-comma = false
|
|
combine-as-imports = true
|
|
extra-standard-library = [
|
|
"_typeshed",
|
|
"typing_extensions",
|
|
# Extra modules not recognized by Ruff/isort
|
|
"_ast",
|
|
"_bisect",
|
|
"_bootlocale",
|
|
"_codecs",
|
|
"_collections_abc",
|
|
"_compat_pickle",
|
|
"_compression",
|
|
"_csv",
|
|
"_ctypes",
|
|
"_curses",
|
|
"_decimal",
|
|
"_dummy_thread",
|
|
"_dummy_threading",
|
|
"_heapq",
|
|
"_imp",
|
|
"_json",
|
|
"_locale",
|
|
"_lsprof",
|
|
"_markupbase",
|
|
"_msi",
|
|
"_operator",
|
|
"_osx_support",
|
|
"_posixsubprocess",
|
|
"_py_abc",
|
|
"_pydecimal",
|
|
"_random",
|
|
"_sitebuiltins",
|
|
"_socket",
|
|
"_stat",
|
|
"_thread",
|
|
"_threading_local",
|
|
"_tkinter",
|
|
"_tracemalloc",
|
|
"_warnings",
|
|
"_weakref",
|
|
"_weakrefset",
|
|
"_winapi",
|
|
"genericpath",
|
|
"opcode",
|
|
"pyexpat",
|
|
]
|
|
known-first-party = ["parse_metadata", "utils"]
|
|
|
|
[tool.typeshed]
|
|
pyright_version = "1.1.350"
|
|
oldest_supported_python = "3.8"
|