(self, node)
| 59 | break |
| 60 | |
| 61 | def visit_ClassDef(self, node): |
| 62 | for dec in node.decorator_list: |
| 63 | if "define_aliases" in ast.unparse(dec): |
| 64 | parents = [] |
| 65 | if hasattr(node, "parent"): |
| 66 | parent = node.parent |
| 67 | while hasattr(parent, "parent") and not isinstance( |
| 68 | parent, ast.Module |
| 69 | ): |
| 70 | parents.insert(0, parent.name) |
| 71 | parent = parent.parent |
| 72 | aliases = ast.literal_eval(dec.args[0]) |
| 73 | # Written as a regex rather than two lines to avoid unused entries |
| 74 | # for setters on items with only a getter |
| 75 | for substitutions in aliases.values(): |
| 76 | parts = self.context + parents + [node.name] |
| 77 | for a in substitutions: |
| 78 | if not (self._is_already_allowed([*parts, f"get_{a}"]) and |
| 79 | self._is_already_allowed([*parts, f"set_{a}"])): |
| 80 | self.output.write("\\.".join([*parts, f"[gs]et_{a}\n"])) |
| 81 | for child in ast.iter_child_nodes(node): |
| 82 | self.visit(child) |
| 83 | |
| 84 | |
| 85 | existing_allowed = [] |
nothing calls this directly
no test coverage detected