MCPcopy Create free account
hub / github.com/apache/arrow / leave_Module

Method leave_Module

python/scripts/update_stub_docstrings.py:103–119  ·  view source on GitHub ↗
(self, original_node, updated_node)

Source from the content-addressed store, hash-verified

101 return f"{self.base_namespace}.{name}" if self.base_namespace else name
102
103 def leave_Module(self, original_node, updated_node):
104 new_body = []
105 clone_matcher = m.SimpleStatementLine(
106 body=[m.Assign(value=m.Call(func=m.Name(value="_clone_signature"))),
107 m.ZeroOrMore()]
108 )
109 for stmt in updated_node.body:
110 new_body.append(stmt)
111 if m.matches(stmt, clone_matcher):
112 name = stmt.body[0].targets[0].target.value
113 if self.base_namespace:
114 name = f"{self.base_namespace}.{name}"
115 docstring = _get_docstring(name, self.module, 0)
116 if docstring:
117 new_body.append(libcst.SimpleStatementLine(
118 body=[libcst.Expr(value=libcst.SimpleString(docstring))]))
119 return updated_node.with_changes(body=new_body)
120
121 def visit_ClassDef(self, node):
122 self.stack.append(node.name.value)

Callers

nothing calls this directly

Calls 3

_get_docstringFunction · 0.85
CallMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected