MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / classify_class_attrs

Function classify_class_attrs

tools/python-3.11.9-amd64/Lib/pydoc.py:313–324  ·  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

311 return not name.startswith('_')
312
313def classify_class_attrs(object):
314 """Wrap inspect.classify_class_attrs, with fixup for data descriptors and bound methods."""
315 results = []
316 for (name, kind, cls, value) in inspect.classify_class_attrs(object):
317 if inspect.isdatadescriptor(value):
318 kind = 'data descriptor'
319 if isinstance(value, property) and value.fset is None:
320 kind = 'readonly property'
321 elif kind == 'method' and _is_bound_method(value):
322 kind = 'static method'
323 results.append((name, kind, cls, value))
324 return results
325
326def sort_attributes(attrs, object):
327 '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