MCPcopy Index your code
hub / github.com/python/cpython / _get_safe___dir__

Function _get_safe___dir__

Lib/traceback.py:1714–1724  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

1712
1713
1714def _get_safe___dir__(obj):
1715 # Use obj.__dir__() to avoid a TypeError when calling dir(obj).
1716 # See gh-131001 and gh-139933.
1717 # Also filters out lazy imports to avoid triggering module loading.
1718 try:
1719 d = obj.__dir__()
1720 except TypeError: # when obj is a class
1721 d = type(obj).__dir__(obj)
1722 return sorted(
1723 x for x in d if isinstance(x, str) and not _is_lazy_import(obj, x)
1724 )
1725
1726
1727def _compute_suggestion_error(exc_value, tb, wrong_name):

Callers 1

Calls 2

_is_lazy_importFunction · 0.85
__dir__Method · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…