(obj: Any)
| 2988 | |
| 2989 | @staticmethod |
| 2990 | def _get_keys(obj: Any) -> list[Any]: |
| 2991 | # Objects can define their own completions by defining an |
| 2992 | # _ipy_key_completions_() method. |
| 2993 | method = get_real_method(obj, '_ipython_key_completions_') |
| 2994 | if method is not None: |
| 2995 | return method() |
| 2996 | |
| 2997 | # Special case some common in-memory dict-like types |
| 2998 | if isinstance(obj, dict) or _safe_isinstance(obj, "pandas", "DataFrame"): |
| 2999 | try: |
| 3000 | return list(obj.keys()) |
| 3001 | except Exception: |
| 3002 | return [] |
| 3003 | elif _safe_isinstance(obj, "pandas", "core", "indexing", "_LocIndexer"): |
| 3004 | try: |
| 3005 | return list(obj.obj.keys()) |
| 3006 | except Exception: |
| 3007 | return [] |
| 3008 | elif _safe_isinstance(obj, 'numpy', 'ndarray') or\ |
| 3009 | _safe_isinstance(obj, 'numpy', 'void'): |
| 3010 | return obj.dtype.names or [] |
| 3011 | return [] |
| 3012 | |
| 3013 | @context_matcher() |
| 3014 | def dict_key_matcher(self, context: CompletionContext) -> SimpleMatcherResult: |
no test coverage detected