We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ca6ce8c commit 70b7f88Copy full SHA for 70b7f88
changelog.d/997.change.rst
@@ -0,0 +1,2 @@
1
+``attrs.has()`` is now a ``TypeGuard`` for ``AttrsInstance``.
2
+That means that type checkers know a class is an instance of an ``attrs`` class if you check it using ``attrs.has()`` (or ``attr.has()``) first.
tests/typing_example.py
@@ -418,7 +418,6 @@ def accessing_from_attrs() -> None:
418
attrs.cmp_using
419
420
421
-def has_typeguard() -> None:
422
- foo = object
423
- if attrs.has(foo):
424
- foo.__attrs_attrs__
+foo = object
+if attrs.has(foo) or attr.has(foo):
+ foo.__attrs_attrs__
0 commit comments