本文整理汇总了Python中pip._internal.pep425tags.Pep425Tag方法的典型用法代码示例。如果您正苦于以下问题:Python pep425tags.Pep425Tag方法的具体用法?Python pep425tags.Pep425Tag怎么用?Python pep425tags.Pep425Tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pip._internal.pep425tags
的用法示例。
在下文中一共展示了pep425tags.Pep425Tag方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tags
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def get_tags(self):
# type: () -> List[Pep425Tag]
"""
Return the supported PEP 425 tags to check wheel candidates against.
The tags are returned in order of preference (most preferred first).
"""
if self._valid_tags is None:
tags = get_supported(
version_info=self._given_py_version_info,
platforms=self.platforms,
abi=self.abi,
impl=self.implementation,
)
self._valid_tags = tags
return self._valid_tags
示例2: __init__
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def __init__(
self,
project_name, # type: str
supported_tags, # type: List[Pep425Tag]
specifier, # type: specifiers.BaseSpecifier
prefer_binary=False, # type: bool
allow_all_prereleases=False, # type: bool
hashes=None, # type: Optional[Hashes]
):
# type: (...) -> None
"""
:param supported_tags: The PEP 425 tags supported by the target
Python in order of preference (most preferred first).
"""
self._allow_all_prereleases = allow_all_prereleases
self._hashes = hashes
self._prefer_binary = prefer_binary
self._project_name = project_name
self._specifier = specifier
self._supported_tags = supported_tags
示例3: get
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def get(
self,
link, # type: Link
package_name, # type: Optional[str]
supported_tags, # type: List[Pep425Tag]
):
# type: (...) -> Link
retval = self._wheel_cache.get(
link=link,
package_name=package_name,
supported_tags=supported_tags,
)
if retval is not link:
return retval
return self._ephem_cache.get(
link=link,
package_name=package_name,
supported_tags=supported_tags,
)
示例4: support_index_min
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def support_index_min(self, tags):
# type: (List[Pep425Tag]) -> int
"""
Return the lowest index that one of the wheel's file_tag combinations
achieves in the given list of supported tags.
For example, if there are 8 supported tags and one of the file tags
is first in the list, then return 0.
:param tags: the PEP 425 tags to check the wheel against, in order
with most preferred first.
:raises ValueError: If none of the wheel's file tags match one of
the supported tags.
"""
return min(tags.index(tag) for tag in self.file_tags if tag in tags)
示例5: get_tags
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def get_tags(self):
# type: () -> List[Pep425Tag]
"""
Return the supported PEP 425 tags to check wheel candidates against.
The tags are returned in order of preference (most preferred first).
"""
if self._valid_tags is None:
# Pass versions=None if no py_version_info was given since
# versions=None uses special default logic.
py_version_info = self._given_py_version_info
if py_version_info is None:
versions = None
else:
versions = [version_info_to_nodot(py_version_info)]
tags = get_supported(
versions=versions,
platform=self.platform,
abi=self.abi,
impl=self.implementation,
)
self._valid_tags = tags
return self._valid_tags
示例6: get
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def get(
self,
link, # type: Link
package_name, # type: Optional[str]
supported_tags, # type: List[Pep425Tag]
):
# type: (...) -> Link
candidates = []
for wheel_name in self._get_candidates(link, package_name):
try:
wheel = Wheel(wheel_name)
except InvalidWheelFilename:
continue
if not wheel.supported(supported_tags):
# Built for a different python/arch/etc
continue
candidates.append(
(wheel.support_index_min(supported_tags), wheel_name)
)
if not candidates:
return link
return self._link_for_candidate(link, min(candidates)[1])
示例7: support_index_min
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def support_index_min(self, tags=None):
# type: (Optional[List[Pep425Tag]]) -> Optional[int]
"""
Return the lowest index that one of the wheel's file_tag combinations
achieves in the supported_tags list e.g. if there are 8 supported tags,
and one of the file tags is first in the list, then return 0. Returns
None is the wheel is not supported.
"""
if tags is None: # for mock
tags = pep425tags.get_supported()
indexes = [tags.index(c) for c in self.file_tags if c in tags]
return min(indexes) if indexes else None
示例8: supported
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def supported(self, tags=None):
# type: (Optional[List[Pep425Tag]]) -> bool
"""Is this wheel supported on this system?"""
if tags is None: # for mock
tags = pep425tags.get_supported()
return bool(set(tags).intersection(self.file_tags))
示例9: __init__
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def __init__(
self,
valid_tags, # type: List[Pep425Tag]
prefer_binary=False # type: bool
):
# type: (...) -> None
self._prefer_binary = prefer_binary
self._valid_tags = valid_tags
示例10: support_index_min
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def support_index_min(self, tags):
# type: (List[Pep425Tag]) -> int
"""Return the lowest index that one of the wheel's file_tag combinations
achieves in the given list of supported tags.
For example, if there are 8 supported tags and one of the file tags
is first in the list, then return 0.
:param tags: the PEP 425 tags to check the wheel against, in order
with most preferred first.
:raises ValueError: If none of the wheel's file tags match one of
the supported tags.
"""
return min(tags.index(tag) for tag in self.file_tags if tag in tags)
示例11: supported
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def supported(self, tags):
# type: (List[Pep425Tag]) -> bool
"""Return whether the wheel is compatible with one of the given tags.
:param tags: the PEP 425 tags to check the wheel against.
"""
return not self.file_tags.isdisjoint(tags)
示例12: __init__
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def __init__(
self,
platforms=None, # type: Optional[List[str]]
py_version_info=None, # type: Optional[Tuple[int, ...]]
abi=None, # type: Optional[str]
implementation=None, # type: Optional[str]
):
# type: (...) -> None
"""
:param platforms: A list of platform strings or None. If None,
searches for packages that are supported by the current system.
Otherwise, will find packages that can be built on the platforms
passed in. These packages will only be downloaded for
distribution: they will not be built locally.
:param py_version_info: An optional tuple of ints representing the
Python version information to use (e.g. `sys.version_info[:3]`).
This can have length 1, 2, or 3 when provided.
:param abi: A string or None. This is passed to pep425tags.py's
get_supported() function as is.
:param implementation: A string or None. This is passed to
pep425tags.py's get_supported() function as is.
"""
# Store the given py_version_info for when we call get_supported().
self._given_py_version_info = py_version_info
if py_version_info is None:
py_version_info = sys.version_info[:3]
else:
py_version_info = normalize_version_info(py_version_info)
py_version = '.'.join(map(str, py_version_info[:2]))
self.abi = abi
self.implementation = implementation
self.platforms = platforms
self.py_version = py_version
self.py_version_info = py_version_info
# This is used to cache the return value of get_tags().
self._valid_tags = None # type: Optional[List[Pep425Tag]]
示例13: supported
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def supported(self, tags):
# type: (List[Pep425Tag]) -> bool
"""
Return whether the wheel is compatible with one of the given tags.
:param tags: the PEP 425 tags to check the wheel against.
"""
return not self.file_tags.isdisjoint(tags)
示例14: __init__
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import Pep425Tag [as 别名]
def __init__(
self,
platform=None, # type: Optional[str]
py_version_info=None, # type: Optional[Tuple[int, ...]]
abi=None, # type: Optional[str]
implementation=None, # type: Optional[str]
):
# type: (...) -> None
"""
:param platform: A string or None. If None, searches for packages
that are supported by the current system. Otherwise, will find
packages that can be built on the platform passed in. These
packages will only be downloaded for distribution: they will
not be built locally.
:param py_version_info: An optional tuple of ints representing the
Python version information to use (e.g. `sys.version_info[:3]`).
This can have length 1, 2, or 3 when provided.
:param abi: A string or None. This is passed to pep425tags.py's
get_supported() function as is.
:param implementation: A string or None. This is passed to
pep425tags.py's get_supported() function as is.
"""
# Store the given py_version_info for when we call get_supported().
self._given_py_version_info = py_version_info
if py_version_info is None:
py_version_info = sys.version_info[:3]
else:
py_version_info = normalize_version_info(py_version_info)
py_version = '.'.join(map(str, py_version_info[:2]))
self.abi = abi
self.implementation = implementation
self.platform = platform
self.py_version = py_version
self.py_version_info = py_version_info
# This is used to cache the return value of get_tags().
self._valid_tags = None # type: Optional[List[Pep425Tag]]