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

Function _rewrite_star_unpack

Lib/annotationlib.py:1104–1111  ·  view source on GitHub ↗

If the given argument annotation expression is a star unpack e.g. `'*Ts'` rewrite it to a valid expression.

(arg)

Source from the content-addressed store, hash-verified

1102
1103
1104def _rewrite_star_unpack(arg):
1105 """If the given argument annotation expression is a star unpack e.g. `'*Ts'`
1106 rewrite it to a valid expression.
1107 """
1108 if arg.lstrip().startswith("*"):
1109 return f"({arg},)[0]" # E.g. (*Ts,)[0] or (*tuple[int, int],)[0]
1110 else:
1111 return arg
1112
1113
1114def _get_and_call_annotate(obj, format):

Callers 2

__forward_code__Method · 0.85
get_annotationsFunction · 0.85

Calls 2

startswithMethod · 0.45
lstripMethod · 0.45

Tested by

no test coverage detected