MCPcopy
hub / github.com/igrek51/wat / _iter_attributes

Function _iter_attributes

wat/inspection/inspection.py:109–125  ·  view source on GitHub ↗
(obj, config: InspectConfig)

Source from the content-addressed store, hash-verified

107
108
109def _iter_attributes(obj, config: InspectConfig) -> Iterable[InspectAttribute]:
110 for key in dir(obj):
111 dunder = key.startswith('__') and key.endswith('__')
112 if dunder and not config.dunder:
113 continue
114 private = key.startswith('_') and not dunder
115 try:
116 value = getattr(obj, key)
117 except BaseException as e:
118 value = e
119 _callable = callable(value)
120 signature = _get_callable_signature(key, value) if _callable else None
121 doc = _get_doc(value, long=config.long) if _callable else None
122 yield InspectAttribute(
123 name=key, value=value, type=type(value), callable=_callable, dunder=dunder,
124 private=private, signature=signature, doc=doc,
125 )
126
127
128def _get_callable_signature(name: str, obj) -> str:

Callers 1

_yield_inspect_linesFunction · 0.85

Calls 3

_get_callable_signatureFunction · 0.85
_get_docFunction · 0.85
InspectAttributeClass · 0.85

Tested by

no test coverage detected