当前位置: 首页>>代码示例>>Python>>正文


Python markers.Marker方法代码示例

本文整理汇总了Python中pip._vendor.packaging.markers.Marker方法的典型用法代码示例。如果您正苦于以下问题:Python markers.Marker方法的具体用法?Python markers.Marker怎么用?Python markers.Marker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pip._vendor.packaging.markers的用法示例。


在下文中一共展示了markers.Marker方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __and__

# 需要导入模块: from pip._vendor.packaging import markers [as 别名]
# 或者: from pip._vendor.packaging.markers import Marker [as 别名]
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) 
开发者ID:frostming,项目名称:pdm,代码行数:10,代码来源:markers.py

示例2: __rand__

# 需要导入模块: from pip._vendor.packaging import markers [as 别名]
# 或者: from pip._vendor.packaging.markers import Marker [as 别名]
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) 
开发者ID:frostming,项目名称:pdm,代码行数:9,代码来源:markers.py

示例3: __or__

# 需要导入模块: from pip._vendor.packaging import markers [as 别名]
# 或者: from pip._vendor.packaging.markers import Marker [as 别名]
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) 
开发者ID:frostming,项目名称:pdm,代码行数:10,代码来源:markers.py

示例4: __ror__

# 需要导入模块: from pip._vendor.packaging import markers [as 别名]
# 或者: from pip._vendor.packaging.markers import Marker [as 别名]
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) 
开发者ID:frostming,项目名称:pdm,代码行数:9,代码来源:markers.py

示例5: __eq__

# 需要导入模块: from pip._vendor.packaging import markers [as 别名]
# 或者: from pip._vendor.packaging.markers import Marker [as 别名]
def __eq__(self, other: Any) -> bool:
        if not isinstance(other, PackageMarker):
            return False
        return str(self) == str(other) 
开发者ID:frostming,项目名称:pdm,代码行数:6,代码来源:markers.py

示例6: split_marker_extras

# 需要导入模块: from pip._vendor.packaging import markers [as 别名]
# 或者: from pip._vendor.packaging.markers import Marker [as 别名]
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 
开发者ID:frostming,项目名称:pdm,代码行数:35,代码来源:markers.py

示例7: match_markers

# 需要导入模块: from pip._vendor.packaging import markers [as 别名]
# 或者: from pip._vendor.packaging.markers import Marker [as 别名]
def match_markers(self):
        if self.markers is not None:
            return Marker(self.markers).evaluate()
        else:
            return True 
开发者ID:awemulya,项目名称:kobo-predict,代码行数:7,代码来源:req_install.py

示例8: __init__

# 需要导入模块: from pip._vendor.packaging import markers [as 别名]
# 或者: from pip._vendor.packaging.markers import Marker [as 别名]
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 
开发者ID:pantsbuild,项目名称:pex,代码行数:13,代码来源:constructors.py


注:本文中的pip._vendor.packaging.markers.Marker方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。