(o: object)
| 37 | |
| 38 | |
| 39 | def get_edge_candidates(o: object) -> Iterator[tuple[object, object]]: |
| 40 | # use getattr because mypyc expects dict, not mappingproxy |
| 41 | if "__getattribute__" in getattr(type(o), "__dict__"): # noqa: B009 |
| 42 | return |
| 43 | if type(o) not in COLLECTION_TYPE_BLACKLIST: |
| 44 | for attr in dir(o): |
| 45 | try: |
| 46 | if attr not in ATTR_BLACKLIST and hasattr(o, attr) and not isproperty(o, attr): |
| 47 | e = getattr(o, attr) |
| 48 | if type(e) not in ATOMIC_TYPE_BLACKLIST: |
| 49 | yield attr, e |
| 50 | except AssertionError: |
| 51 | pass |
| 52 | if isinstance(o, Mapping): |
| 53 | yield from o.items() |
| 54 | elif isinstance(o, Iterable) and not isinstance(o, str): |
| 55 | for i, e in enumerate(o): |
| 56 | yield i, e |
| 57 | |
| 58 | |
| 59 | def get_edges(o: object) -> Iterator[tuple[object, object]]: |
no test coverage detected
searching dependent graphs…