MCPcopy Index your code
hub / github.com/bpython/bpython / module_matches

Method module_matches

bpython/importcompletion.py:89–101  ·  view source on GitHub ↗

Modules names to replace cw with

(self, cw: str, prefix: str = "")

Source from the content-addressed store, hash-verified

87 )
88
89 def module_matches(self, cw: str, prefix: str = "") -> set[str]:
90 """Modules names to replace cw with"""
91
92 full = f"{prefix}.{cw}" if prefix else cw
93 matches = (
94 name
95 for name in self.modules
96 if (name.startswith(full) and name.find(".", len(full)) == -1)
97 )
98 if prefix:
99 return {match[len(prefix) + 1 :] for match in matches}
100 else:
101 return set(matches)
102
103 def attr_matches(
104 self, cw: str, prefix: str = "", only_modules: bool = False

Callers 1

completeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected