MCPcopy Create free account
hub / github.com/ipython/ipython / python_matches

Method python_matches

IPython/core/completer.py:1408–1428  ·  view source on GitHub ↗

Match attributes or global python names

(self, text)

Source from the content-addressed store, hash-verified

1406 return []
1407
1408 def python_matches(self, text):
1409 """Match attributes or global python names"""
1410 if "." in text:
1411 try:
1412 matches = self.attr_matches(text)
1413 if text.endswith('.') and self.omit__names:
1414 if self.omit__names == 1:
1415 # true if txt is _not_ a __ name, false otherwise:
1416 no__name = (lambda txt:
1417 re.match(r'.*\.__.*?__',txt) is None)
1418 else:
1419 # true if txt is _not_ a _ name, false otherwise:
1420 no__name = (lambda txt:
1421 re.match(r'\._.*?',txt[txt.rindex('.'):]) is None)
1422 matches = filter(no__name, matches)
1423 except NameError:
1424 # catches <undefined attributes>.<tab>
1425 matches = []
1426 else:
1427 matches = self.global_matches(text)
1428 return matches
1429
1430 def _default_arguments_from_docstring(self, doc):
1431 """Parse the first line of docstring for call signature.

Callers

nothing calls this directly

Calls 2

attr_matchesMethod · 0.80
global_matchesMethod · 0.80

Tested by

no test coverage detected