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

Method find_attributes

Lib/_pyrepl/_module_completer.py:169–174  ·  view source on GitHub ↗

Find all attributes of module 'path' that start with 'prefix'.

(self, path: str, prefix: str)

Source from the content-addressed store, hash-verified

167 and module_info.module_finder.path == self._stdlib_path)
168
169 def find_attributes(self, path: str, prefix: str) -> tuple[list[str], CompletionAction | None]:
170 """Find all attributes of module 'path' that start with 'prefix'."""
171 attributes, action = self._find_attributes(path, prefix)
172 # Filter out invalid attribute names
173 # (for example those containing dashes that cannot be imported with 'import')
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]

Callers 1

completeMethod · 0.95

Calls 2

_find_attributesMethod · 0.95
isidentifierMethod · 0.80

Tested by

no test coverage detected