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

Method parse_version

Tools/clinic/libclinic/dsl_parser.py:1151–1162  ·  view source on GitHub ↗

Parse Python version in `[from ...]` marker.

(self, thenceforth: str)

Source from the content-addressed store, hash-verified

1149 )
1150
1151 def parse_version(self, thenceforth: str) -> VersionTuple:
1152 """Parse Python version in `[from ...]` marker."""
1153 assert isinstance(self.function, Function)
1154
1155 try:
1156 major, minor = thenceforth.split(".")
1157 return int(major), int(minor)
1158 except ValueError:
1159 fail(
1160 f"Function {self.function.name!r}: expected format '[from major.minor]' "
1161 f"where 'major' and 'minor' are integers; got {thenceforth!r}"
1162 )
1163
1164 def parse_star(self, function: Function, version: VersionTuple | None) -> None:
1165 """Parse keyword-only parameter marker '*'.

Callers 1

state_parameterMethod · 0.95

Calls 2

failFunction · 0.90
splitMethod · 0.45

Tested by

no test coverage detected