Python pip._vendor.packaging.markers.Marker() Examples
The following are 12
code examples of pip._vendor.packaging.markers.Marker().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pip._vendor.packaging.markers
, or try the search function
.
Example #1
Source File: markers.py From pdm with MIT License | 5 votes |
def __and__(self, other: Optional[PackageMarker]) -> "Marker": """Intersect the two markers.""" if other is None or self == other: return self lhs = f"({self})" if "or" in self._markers else str(self) rhs = f"({other})" if "or" in other._markers else str(other) marker_str = f"{lhs} and {rhs}" return type(self)(marker_str)
Example #2
Source File: markers.py From pdm with MIT License | 5 votes |
def __rand__(self, other: Optional[PackageMarker]) -> "Marker": if other is None or self == other: return self rhs = f"({self})" if "or" in self._markers else str(self) lhs = f"({other})" if "or" in other._markers else str(other) marker_str = f"{lhs} and {rhs}" return type(self)(marker_str)
Example #3
Source File: markers.py From pdm with MIT License | 5 votes |
def __or__(self, other: Optional[PackageMarker]) -> "Marker": """Union the two markers.""" if None in (self, other): return None if self == other: return self marker_str = f"{self} or {other}" return type(self)(marker_str)
Example #4
Source File: markers.py From pdm with MIT License | 5 votes |
def __ror__(self, other: Optional[PackageMarker]) -> "Marker": if None in (self, other): return None if self == other: return self marker_str = f"{other} or {self}" return type(self)(marker_str)
Example #5
Source File: markers.py From pdm with MIT License | 5 votes |
def __eq__(self, other: Any) -> bool: if not isinstance(other, PackageMarker): return False return str(self) == str(other)
Example #6
Source File: markers.py From pdm with MIT License | 5 votes |
def split_marker_extras( marker: PackageMarker, ) -> Tuple[Sequence[str], Optional[Marker]]: """An element can be stripped from the marker only if all parts are connected with `and` operater. The rest part are returned as a string or `None` if all are stripped. :param marker: the input marker string :returns: an iterable of (op, value) pairs together with the stripped part. """ if "or" in marker._markers: if "and" in marker._markers or any( not isinstance(p, tuple) or p[0].value != "extra" for p in marker._markers if p != "or" ): return [], marker result = [] bare_markers = [m for m in marker._markers if m not in ("and", "or")] for m in bare_markers[:]: if not isinstance(m, tuple): continue if m[0].value == "extra": if m[1].value == "==": result.append(m[2].value) elif m[1].value == "in": result.extend(v.strip() for v in m[2].value.split(",")) bare_markers.remove(m) new_markers = join_list_with(bare_markers, "and") if not new_markers: return result, None marker._markers = new_markers return result, marker
Example #7
Source File: req_install.py From kobo-predict with BSD 2-Clause "Simplified" License | 5 votes |
def match_markers(self): if self.markers is not None: return Marker(self.markers).evaluate() else: return True
Example #8
Source File: constructors.py From pex with Apache License 2.0 | 5 votes |
def __init__( self, requirement, # type: Optional[Requirement] link, # type: Optional[Link] markers, # type: Optional[Marker] extras, # type: Set[str] ): self.requirement = requirement self.link = link self.markers = markers self.extras = extras
Example #9
Source File: req_install.py From Financial-Portfolio-Flask with MIT License | 5 votes |
def match_markers(self): if self.markers is not None: return Marker(self.markers).evaluate() else: return True
Example #10
Source File: constructors.py From rules_pip with MIT License | 5 votes |
def __init__( self, requirement, # type: Optional[Requirement] link, # type: Optional[Link] markers, # type: Optional[Marker] extras, # type: Set[str] ): self.requirement = requirement self.link = link self.markers = markers self.extras = extras
Example #11
Source File: req_install.py From syntheticmass with Apache License 2.0 | 5 votes |
def match_markers(self): if self.markers is not None: return Marker(self.markers).evaluate() else: return True
Example #12
Source File: constructors.py From CogAlg with MIT License | 5 votes |
def __init__( self, requirement, # type: Optional[Requirement] link, # type: Optional[Link] markers, # type: Optional[Marker] extras, # type: Set[str] ): self.requirement = requirement self.link = link self.markers = markers self.extras = extras