MCPcopy Index your code
hub / github.com/python/mypy / get_class_descriptors

Function get_class_descriptors

mypy/util.py:377–387  ·  view source on GitHub ↗
(cls: type[object])

Source from the content-addressed store, hash-verified

375
376
377def 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
390def replace_object_state(

Callers 3

snapshotMethod · 0.90
collect_memory_statsFunction · 0.90
replace_object_stateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…