MCPcopy Index your code
hub / github.com/RustPython/RustPython / as_ast_node

Method as_ast_node

scripts/update_lib/patch_spec.py:72–81  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

70 return ast.Attribute(value=ast.Name(id=UT), attr=self.ut_method)
71
72 def as_ast_node(self) -> ast.Attribute | ast.Call:
73 if not self.ut_method.has_args():
74 return self._attr_node
75
76 args = []
77 if self.cond:
78 args.append(ast.parse(self.cond).body[0].value)
79 args.append(ast.Constant(value=self._reason))
80
81 return ast.Call(func=self._attr_node, args=args, keywords=[])
82
83 def as_decorator(self) -> str:
84 unparsed = ast.unparse(self.as_ast_node())

Callers 1

as_decoratorMethod · 0.95

Calls 3

has_argsMethod · 0.80
appendMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected