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

Method parse_star

Tools/clinic/libclinic/dsl_parser.py:1164–1188  ·  view source on GitHub ↗

Parse keyword-only parameter marker '*'. The 'version' parameter signifies the future version from which the marker will take effect (None means it is already in effect).

(self, function: Function, version: VersionTuple | None)

Source from the content-addressed store, hash-verified

1162 )
1163
1164 def parse_star(self, function: Function, version: VersionTuple | None) -> None:
1165 """Parse keyword-only parameter marker '*'.
1166
1167 The 'version' parameter signifies the future version from which
1168 the marker will take effect (None means it is already in effect).
1169 """
1170 if not self.expecting_parameters:
1171 fail("Encountered '*' when not expecting parameters")
1172
1173 if version is None:
1174 self.check_previous_star()
1175 self.check_remaining_star()
1176 self.keyword_only = True
1177 else:
1178 if self.keyword_only:
1179 fail(f"Function {function.name!r}: '* [from ...]' must precede '*'")
1180 if self.deprecated_positional:
1181 if self.deprecated_positional == version:
1182 fail(f"Function {function.name!r} uses '* [from "
1183 f"{version[0]}.{version[1]}]' more than once.")
1184 if self.deprecated_positional < version:
1185 fail(f"Function {function.name!r}: '* [from "
1186 f"{version[0]}.{version[1]}]' must precede '* [from "
1187 f"{self.deprecated_positional[0]}.{self.deprecated_positional[1]}]'")
1188 self.deprecated_positional = version
1189
1190 def parse_opening_square_bracket(self, function: Function) -> None:
1191 """Parse opening parameter group symbol '['."""

Callers 1

state_parameterMethod · 0.95

Calls 3

check_previous_starMethod · 0.95
check_remaining_starMethod · 0.95
failFunction · 0.90

Tested by

no test coverage detected