Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 773b493

Browse files
authored
Enable more PYI autofixes (#13315)
1 parent 7178fa3 commit 773b493

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,20 @@ select = [
5757
"PYI014", # Only simple default values allowed for arguments
5858
"PYI015", # Only simple default values allowed for assignments
5959
"PYI016", # Duplicate union member `{}`
60+
"PYI019", # Methods like `{method_name}` should return `Self` instead of a custom `TypeVar`
6061
"PYI020", # Quoted annotations should not be included in stubs
6162
"PYI025", # Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
6263
# "PYI026", Waiting for this mypy bug to be fixed: https://github.com/python/mypy/issues/16581
6364
"PYI030", # Multiple literal members in a union. Use a single literal, e.g. `Literal[{}]`
6465
"PYI032", # Prefer `object` to `Any` for the second parameter to `{method_name}`
66+
"PYI034", # `__new__` methods usually return self at runtime
6567
"PYI036", # Star-args in `{method_name}` should be annotated with `object`
6668
"PYI044", # `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics
6769
"PYI055", # Multiple `type[T]` usages in a union. Combine them into one, e.g., `type[{union_str}]`.
6870
"PYI058", # Use `{return_type}` as the return value for simple `{method}` methods
71+
# "PYI061", # TODO: Enable when out of preview
6972
"PYI062", # Duplicate literal member `{}`
73+
"PYI064", # `Final[Literal[{literal}]]` can be replaced with a bare Final
7074
]
7175
extend-safe-fixes = [
7276
"UP036", # Remove unnecessary `sys.version_info` blocks

stdlib/typing_extensions.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Since this module defines "Self" it is not recognized by Ruff as typing_extensions.Self
2+
# ruff: noqa: PYI034
13
import abc
24
import sys
35
import typing

0 commit comments

Comments
 (0)