MCPcopy Create free account
hub / github.com/nodejs/node / __init__

Method __init__

tools/gyp/pylib/packaging/markers.py:193–216  ·  view source on GitHub ↗
(self, marker: str)

Source from the content-addressed store, hash-verified

191
192class Marker:
193 def __init__(self, marker: str) -> None:
194 # Note: We create a Marker object without calling this constructor in
195 # packaging.requirements.Requirement. If any additional logic is
196 # added here, make sure to mirror/adapt Requirement.
197 try:
198 self._markers = _normalize_extra_values(_parse_marker(marker))
199 # The attribute `_markers` can be described in terms of a recursive type:
200 # MarkerList = List[Union[Tuple[Node, ...], str, MarkerList]]
201 #
202 # For example, the following expression:
203 # python_version > "3.6" or (python_version == "3.6" and os_name == "unix")
204 #
205 # is parsed into:
206 # [
207 # (<Variable('python_version')>, <Op('>')>, <Value('3.6')>),
208 # 'and',
209 # [
210 # (<Variable('python_version')>, <Op('==')>, <Value('3.6')>),
211 # 'or',
212 # (<Variable('os_name')>, <Op('==')>, <Value('unix')>)
213 # ]
214 # ]
215 except ParserSyntaxError as e:
216 raise InvalidMarker(str(e)) from e
217
218 def __str__(self) -> str:
219 return _format_marker(self._markers)

Callers

nothing calls this directly

Calls 4

_normalize_extra_valuesFunction · 0.85
_parse_markerFunction · 0.85
InvalidMarkerClass · 0.85
strFunction · 0.85

Tested by

no test coverage detected