MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / visit_ClassDef

Method visit_ClassDef

tools/stubtest.py:61–82  ·  view source on GitHub ↗
(self, node)

Source from the content-addressed store, hash-verified

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
85existing_allowed = []

Callers

nothing calls this directly

Calls 4

_is_already_allowedMethod · 0.95
valuesMethod · 0.80
joinMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected