MCPcopy Index your code
hub / github.com/python/cpython / classify_class_attrs

Function classify_class_attrs

Lib/pydoc.py:287–298  ·  view source on GitHub ↗

Wrap inspect.classify_class_attrs, with fixup for data descriptors and bound methods.

(object)

Source from the content-addressed store, hash-verified

285 return not name.startswith('_')
286
287def classify_class_attrs(object):
288 """Wrap inspect.classify_class_attrs, with fixup for data descriptors and bound methods."""
289 results = []
290 for (name, kind, cls, value) in inspect.classify_class_attrs(object):
291 if inspect.isdatadescriptor(value):
292 kind = 'data descriptor'
293 if isinstance(value, property) and value.fset is None:
294 kind = 'readonly property'
295 elif kind == 'method' and _is_bound_method(value):
296 kind = 'static method'
297 results.append((name, kind, cls, value))
298 return results
299
300def sort_attributes(attrs, object):
301 'Sort the attrs list in-place by _fields and then alphabetically by name'

Callers 2

docclassMethod · 0.70
docclassMethod · 0.70

Calls 2

_is_bound_methodFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…