Modules names to replace cw with
(self, cw: str, prefix: str = "")
| 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 |