MCPcopy Index your code
hub / github.com/ipython/ipython / _safe_getattr

Function _safe_getattr

IPython/lib/pretty.py:127–136  ·  view source on GitHub ↗

Safe version of getattr. Same as getattr, but will return ``default`` on any Exception, rather than raising.

(obj, attr, default=None)

Source from the content-addressed store, hash-verified

125_re_pattern_type = type(re.compile(''))
126
127def _safe_getattr(obj, attr, default=None):
128 """Safe version of getattr.
129
130 Same as getattr, but will return ``default`` on any Exception,
131 rather than raising.
132 """
133 try:
134 return getattr(obj, attr, default)
135 except Exception:
136 return default
137
138def _sorted_for_pprint(items):
139 """

Callers 5

prettyMethod · 0.85
_in_deferred_typesMethod · 0.85
_default_pprintFunction · 0.85
_type_pprintFunction · 0.85
_function_pprintFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…