(self, path: str, prefix: str)
| 174 | return [attr for attr in attributes if attr.isidentifier()], action |
| 175 | |
| 176 | def _find_attributes(self, path: str, prefix: str) -> tuple[list[str], CompletionAction | None]: |
| 177 | path = self._resolve_relative_path(path) # type: ignore[assignment] |
| 178 | if path is None: |
| 179 | return [], None |
| 180 | |
| 181 | imported_module = sys.modules.get(path) |
| 182 | if not imported_module: |
| 183 | if path in self._failed_imports: # Do not propose to import again |
| 184 | return [], None |
| 185 | imported_module = self._maybe_import_module(path) |
| 186 | if not imported_module: |
| 187 | return [], self._get_import_completion_action(path) |
| 188 | try: |
| 189 | module_attributes = dir(imported_module) |
| 190 | except Exception: |
| 191 | module_attributes = [] |
| 192 | return [attr_name for attr_name in module_attributes |
| 193 | if self.is_suggestion_match(attr_name, prefix)], None |
| 194 | |
| 195 | def is_suggestion_match(self, module_name: str, prefix: str) -> bool: |
| 196 | if prefix: |
no test coverage detected