(cls: type[object])
| 375 | |
| 376 | |
| 377 | def get_class_descriptors(cls: type[object]) -> Sequence[str]: |
| 378 | import inspect # Lazy import for minor startup speed win |
| 379 | |
| 380 | # Maintain a cache of type -> attributes defined by descriptors in the class |
| 381 | # (that is, attributes from __slots__ and C extension classes) |
| 382 | if cls not in fields_cache: |
| 383 | members = inspect.getmembers( |
| 384 | cls, lambda o: inspect.isgetsetdescriptor(o) or inspect.ismemberdescriptor(o) |
| 385 | ) |
| 386 | fields_cache[cls] = [x for x, y in members if x != "__weakref__" and x != "__dict__"] |
| 387 | return fields_cache[cls] |
| 388 | |
| 389 | |
| 390 | def replace_object_state( |
no outgoing calls
no test coverage detected
searching dependent graphs…