Compute matches when text is a simple name. Return a list of all keywords, built-in functions and names currently defined in self.namespace or self.global_namespace that match.
(self, text)
| 651 | return None |
| 652 | |
| 653 | def global_matches(self, text): |
| 654 | """Compute matches when text is a simple name. |
| 655 | |
| 656 | Return a list of all keywords, built-in functions and names currently |
| 657 | defined in self.namespace or self.global_namespace that match. |
| 658 | |
| 659 | """ |
| 660 | matches = [] |
| 661 | match_append = matches.append |
| 662 | n = len(text) |
| 663 | for lst in [keyword.kwlist, |
| 664 | builtin_mod.__dict__.keys(), |
| 665 | self.namespace.keys(), |
| 666 | self.global_namespace.keys()]: |
| 667 | for word in lst: |
| 668 | if word[:n] == text and word != "__builtins__": |
| 669 | match_append(word) |
| 670 | |
| 671 | snake_case_re = re.compile(r"[^_]+(_[^_]+)+?\Z") |
| 672 | for lst in [self.namespace.keys(), |
| 673 | self.global_namespace.keys()]: |
| 674 | shortened = {"_".join([sub[0] for sub in word.split('_')]) : word |
| 675 | for word in lst if snake_case_re.match(word)} |
| 676 | for word in shortened.keys(): |
| 677 | if word[:n] == text and word != "__builtins__": |
| 678 | match_append(shortened[word]) |
| 679 | return matches |
| 680 | |
| 681 | def attr_matches(self, text): |
| 682 | """Compute matches when text contains a dot. |
no outgoing calls
no test coverage detected