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

Method as_decorator

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

Source from the content-addressed store, hash-verified

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())
85 # ast.unparse uses single quotes; convert to double quotes for ruff compatibility
86 unparsed = _single_to_double_quotes(unparsed)
87
88 if not self.ut_method.has_args():
89 unparsed = f"{unparsed} # {self._reason}"
90
91 return f"@{unparsed}"
92
93
94def _single_to_double_quotes(s: str) -> str:

Callers 4

_iter_patch_linesFunction · 0.80

Calls 3

as_ast_nodeMethod · 0.95
_single_to_double_quotesFunction · 0.85
has_argsMethod · 0.80