Return all members of an object as (name, value) pairs sorted by name without triggering dynamic lookup via the descriptor protocol, __getattr__ or __getattribute__. Optionally, only return members that satisfy a given predicate. Note: this function may not be able to retrieve all m
(object, predicate=None)
| 523 | return _getmembers(object, predicate, getattr) |
| 524 | |
| 525 | def getmembers_static(object, predicate=None): |
| 526 | """Return all members of an object as (name, value) pairs sorted by name |
| 527 | without triggering dynamic lookup via the descriptor protocol, |
| 528 | __getattr__ or __getattribute__. Optionally, only return members that |
| 529 | satisfy a given predicate. |
| 530 | |
| 531 | Note: this function may not be able to retrieve all members |
| 532 | that getmembers can fetch (like dynamically created attributes) |
| 533 | and may find members that getmembers can't (like descriptors |
| 534 | that raise AttributeError). It can also return descriptor objects |
| 535 | instead of instance members in some cases. |
| 536 | """ |
| 537 | return _getmembers(object, predicate, getattr_static) |
| 538 | |
| 539 | Attribute = namedtuple('Attribute', 'name kind defining_class object') |
| 540 |
nothing calls this directly
no test coverage detected
searching dependent graphs…