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 f7e4e91 commit 689a0e6Copy full SHA for 689a0e6
1 file changed
src/attr/_make.py
@@ -304,26 +304,14 @@ def _has_own_attribute(cls, attrib_name):
304
"""
305
Check whether *cls* defines *attrib_name* (and doesn't just inherit it).
306
307
- attr = getattr(cls, attrib_name, _SENTINEL)
308
- if attr is _SENTINEL:
309
- return False
310
-
311
- for base_cls in cls.__mro__[1:]:
312
- a = getattr(base_cls, attrib_name, None)
313
- if attr is a:
314
315
316
- return True
+ return attrib_name in cls.__dict__
317
318
319
def _get_annotations(cls):
320
321
Get annotations for *cls*.
322
323
- if _has_own_attribute(cls, "__annotations__"):
324
- return cls.__annotations__
325
326
- return {}
+ return cls.__dict__.get("__annotations__", {})
327
328
329
def _collect_base_attrs(cls, taken_attr_names):
0 commit comments