MCPcopy Index your code
hub / github.com/ipython/ipython / attr_matches

Method attr_matches

IPython/core/completer.py:1190–1203  ·  view source on GitHub ↗

Compute matches when text contains a dot. Assuming the text is of the form NAME.NAME....[NAME], and is evaluatable in self.namespace or self.global_namespace, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class

(self, text)

Source from the content-addressed store, hash-verified

1188 return matches
1189
1190 def attr_matches(self, text):
1191 """Compute matches when text contains a dot.
1192
1193 Assuming the text is of the form NAME.NAME....[NAME], and is
1194 evaluatable in self.namespace or self.global_namespace, it will be
1195 evaluated and its attributes (as revealed by dir()) are used as
1196 possible completions. (For class instances, class members are
1197 also considered.)
1198
1199 WARNING: this can still invoke arbitrary C code, if an object
1200 with a __getattr__ hook is evaluated.
1201
1202 """
1203 return self._attr_matches(text)[0]
1204
1205 # we simple attribute matching with normal identifiers.
1206 _ATTR_MATCH_RE = re.compile(r"(.+)\.(\w*)$")

Callers 2

completeMethod · 0.95
python_matchesMethod · 0.80

Calls 1

_attr_matchesMethod · 0.95

Tested by

no test coverage detected