MCPcopy Index your code
hub / github.com/bpython/bpython / hasattr_safe

Function hasattr_safe

bpython/inspection.py:396–401  ·  view source on GitHub ↗
(obj: Any, name: str)

Source from the content-addressed store, hash-verified

394
395
396def hasattr_safe(obj: Any, name: str) -> bool:
397 try:
398 getattr_safe(obj, name)
399 return True
400 except AttributeError:
401 return False

Callers 1

_getpydocspecFunction · 0.85

Calls 1

getattr_safeFunction · 0.85

Tested by

no test coverage detected