MCPcopy Create free account
hub / github.com/python/cpython / global_matches

Method global_matches

Lib/_pyrepl/fancycompleter.py:65–84  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

63 return rlcompleter.Completer._callable_postfix(self, val, word)
64
65 def global_matches(self, text):
66 names = rlcompleter.Completer.global_matches(self, text)
67 prefix = commonprefix(names)
68 if prefix and prefix != text:
69 return [prefix]
70
71 names.sort()
72 values = []
73 for name in names:
74 clean_name = name.rstrip(': ')
75 if keyword.iskeyword(clean_name) or keyword.issoftkeyword(clean_name):
76 values.append(None)
77 else:
78 try:
79 values.append(eval(name, self.namespace))
80 except Exception:
81 values.append(None)
82 if self.use_colors and names:
83 return self.colorize_matches(names, values)
84 return names
85
86 def attr_matches(self, text):
87 try:

Calls 5

colorize_matchesMethod · 0.95
commonprefixFunction · 0.70
sortMethod · 0.45
rstripMethod · 0.45
appendMethod · 0.45