(obj)
| 1712 | |
| 1713 | |
| 1714 | def _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 | |
| 1727 | def _compute_suggestion_error(exc_value, tb, wrong_name): |
no test coverage detected
searching dependent graphs…