MCPcopy Index your code
hub / github.com/python/cpython / _rewrite_star_unpack

Function _rewrite_star_unpack

Lib/annotationlib.py:1117–1124  ·  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

1115
1116
1117def _rewrite_star_unpack(arg):
1118 """If the given argument annotation expression is a star unpack e.g. `'*Ts'`
1119 rewrite it to a valid expression.
1120 """
1121 if arg.lstrip().startswith("*"):
1122 return f"({arg},)[0]" # E.g. (*Ts,)[0] or (*tuple[int, int],)[0]
1123 else:
1124 return arg
1125
1126
1127def _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

Used in the wild real call sites across dependent graphs

searching dependent graphs…