Fix type annotation for resolve_types() (#1141)

This commit is contained in:
Hynek Schlawack 2023-06-04 11:27:09 +02:00 committed by GitHub
parent 747b9ded2f
commit ecdb117407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1 @@
The type annotation for `attrs.resolve_types()` is now correct.

View File

@ -69,8 +69,7 @@ _ValidatorArgType = Union[_ValidatorType[_T], Sequence[_ValidatorType[_T]]]
class AttrsInstance(AttrsInstance_, Protocol):
pass
_A = TypeVar("_A", bound=AttrsInstance)
# _make --
_A = TypeVar("_A", bound=type[AttrsInstance])
class _Nothing(enum.Enum):
NOTHING = enum.auto()

View File

@ -468,3 +468,8 @@ if attrs.has(foo) or attr.has(foo):
@attrs.define(unsafe_hash=True)
class Hashable:
pass
def test(cls: type) -> None:
if attr.has(cls):
attr.resolve_types(cls)