Wrap inspect.classify_class_attrs, with fixup for data descriptors and bound methods.
(object)
| 285 | return not name.startswith('_') |
| 286 | |
| 287 | def 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 | |
| 300 | def sort_attributes(attrs, object): |
| 301 | 'Sort the attrs list in-place by _fields and then alphabetically by name' |
no test coverage detected
searching dependent graphs…