當前位置: 首頁>>代碼示例>>Python>>正文


Python specifiers.BaseSpecifier方法代碼示例

本文整理匯總了Python中pip._vendor.packaging.specifiers.BaseSpecifier方法的典型用法代碼示例。如果您正苦於以下問題:Python specifiers.BaseSpecifier方法的具體用法?Python specifiers.BaseSpecifier怎麽用?Python specifiers.BaseSpecifier使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pip._vendor.packaging.specifiers的用法示例。


在下文中一共展示了specifiers.BaseSpecifier方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: from_specifier

# 需要導入模塊: from pip._vendor.packaging import specifiers [as 別名]
# 或者: from pip._vendor.packaging.specifiers import BaseSpecifier [as 別名]
def from_specifier(
        cls,
        candidates,     # type: List[InstallationCandidate]
        specifier,      # type: specifiers.BaseSpecifier
        prereleases,    # type: Optional[bool]
        evaluator,      # type: CandidateEvaluator
    ):
        # type: (...) -> FoundCandidates
        versions = {
            str(v) for v in specifier.filter(
                # We turn the version object into a str here because otherwise
                # when we're debundled but setuptools isn't, Python will see
                # packaging.version.Version and
                # pkg_resources._vendor.packaging.version.Version as different
                # types. This way we'll use a str as a common data interchange
                # format. If we stop using the pkg_resources provided specifier
                # and start using our own, we can drop the cast to str().
                (str(c.version) for c in candidates),
                prereleases=prereleases,
            )
        }
        return cls(candidates, versions, evaluator) 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:24,代碼來源:index.py

示例2: find_candidates

# 需要導入模塊: from pip._vendor.packaging import specifiers [as 別名]
# 或者: from pip._vendor.packaging.specifiers import BaseSpecifier [as 別名]
def find_candidates(
        self,
        project_name,       # type: str
        specifier=None,     # type: Optional[specifiers.BaseSpecifier]
    ):
        """Find matches for the given project and specifier.

        If given, `specifier` should implement `filter` to allow version
        filtering (e.g. ``packaging.specifiers.SpecifierSet``).

        Returns a `FoundCandidates` instance.
        """
        if specifier is None:
            specifier = specifiers.SpecifierSet()
        return FoundCandidates.from_specifier(
            self.find_all_candidates(project_name),
            specifier=specifier,
            prereleases=(self.allow_all_prereleases or None),
            evaluator=self.candidate_evaluator,
        ) 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:22,代碼來源:index.py

示例3: __init__

# 需要導入模塊: from pip._vendor.packaging import specifiers [as 別名]
# 或者: from pip._vendor.packaging.specifiers import BaseSpecifier [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 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:22,代碼來源:package_finder.py

示例4: make_candidate_evaluator

# 需要導入模塊: from pip._vendor.packaging import specifiers [as 別名]
# 或者: from pip._vendor.packaging.specifiers import BaseSpecifier [as 別名]
def make_candidate_evaluator(
        self,
        project_name,    # type: str
        specifier=None,  # type: Optional[specifiers.BaseSpecifier]
        hashes=None,     # type: Optional[Hashes]
    ):
        # type: (...) -> CandidateEvaluator
        """Create a CandidateEvaluator object to use.
        """
        candidate_prefs = self._candidate_prefs
        return CandidateEvaluator.create(
            project_name=project_name,
            target_python=self._target_python,
            prefer_binary=candidate_prefs.prefer_binary,
            allow_all_prereleases=candidate_prefs.allow_all_prereleases,
            specifier=specifier,
            hashes=hashes,
        ) 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:20,代碼來源:package_finder.py

示例5: find_best_candidate

# 需要導入模塊: from pip._vendor.packaging import specifiers [as 別名]
# 或者: from pip._vendor.packaging.specifiers import BaseSpecifier [as 別名]
def find_best_candidate(
        self,
        project_name,       # type: str
        specifier=None,     # type: Optional[specifiers.BaseSpecifier]
        hashes=None,        # type: Optional[Hashes]
    ):
        # type: (...) -> BestCandidateResult
        """Find matches for the given project and specifier.

        :param specifier: An optional object implementing `filter`
            (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable
            versions.

        :return: A `BestCandidateResult` instance.
        """
        candidates = self.find_all_candidates(project_name)
        candidate_evaluator = self.make_candidate_evaluator(
            project_name=project_name,
            specifier=specifier,
            hashes=hashes,
        )
        return candidate_evaluator.compute_best_candidate(candidates) 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:24,代碼來源:package_finder.py

示例6: __init__

# 需要導入模塊: from pip._vendor.packaging import specifiers [as 別名]
# 或者: from pip._vendor.packaging.specifiers import BaseSpecifier [as 別名]
def __init__(
        self,
        project_name,         # type: str
        supported_tags,       # type: List[Tag]
        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 
開發者ID:ali5h,項目名稱:rules_pip,代碼行數:22,代碼來源:package_finder.py

示例7: find_candidates

# 需要導入模塊: from pip._vendor.packaging import specifiers [as 別名]
# 或者: from pip._vendor.packaging.specifiers import BaseSpecifier [as 別名]
def find_candidates(
        self,
        project_name,       # type: str
        specifier=None,     # type: Optional[specifiers.BaseSpecifier]
        hashes=None,        # type: Optional[Hashes]
    ):
        # type: (...) -> FoundCandidates
        """Find matches for the given project and specifier.

        :param specifier: An optional object implementing `filter`
            (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable
            versions.

        :return: A `FoundCandidates` instance.
        """
        candidates = self.find_all_candidates(project_name)
        candidate_evaluator = self.make_candidate_evaluator(
            project_name=project_name,
            specifier=specifier,
            hashes=hashes,
        )
        return candidate_evaluator.make_found_candidates(candidates) 
開發者ID:V1EngineeringInc,項目名稱:V1EngineeringInc-Docs,代碼行數:24,代碼來源:index.py

示例8: create

# 需要導入模塊: from pip._vendor.packaging import specifiers [as 別名]
# 或者: from pip._vendor.packaging.specifiers import BaseSpecifier [as 別名]
def create(
        cls,
        project_name,         # type: str
        target_python=None,   # type: Optional[TargetPython]
        prefer_binary=False,  # type: bool
        allow_all_prereleases=False,  # type: bool
        specifier=None,       # type: Optional[specifiers.BaseSpecifier]
        hashes=None,          # type: Optional[Hashes]
    ):
        # type: (...) -> CandidateEvaluator
        """Create a CandidateEvaluator object.

        :param target_python: The target Python interpreter to use when
            checking compatibility. If None (the default), a TargetPython
            object will be constructed from the running Python.
        :param specifier: An optional object implementing `filter`
            (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable
            versions.
        :param hashes: An optional collection of allowed hashes.
        """
        if target_python is None:
            target_python = TargetPython()
        if specifier is None:
            specifier = specifiers.SpecifierSet()

        supported_tags = target_python.get_tags()

        return cls(
            project_name=project_name,
            supported_tags=supported_tags,
            specifier=specifier,
            prefer_binary=prefer_binary,
            allow_all_prereleases=allow_all_prereleases,
            hashes=hashes,
        ) 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:37,代碼來源:package_finder.py

示例9: create

# 需要導入模塊: from pip._vendor.packaging import specifiers [as 別名]
# 或者: from pip._vendor.packaging.specifiers import BaseSpecifier [as 別名]
def create(
        cls,
        project_name,         # type: str
        target_python=None,   # type: Optional[TargetPython]
        prefer_binary=False,  # type: bool
        allow_all_prereleases=False,  # type: bool
        specifier=None,       # type: Optional[specifiers.BaseSpecifier]
        hashes=None,          # type: Optional[Hashes]
    ):
        # type: (...) -> CandidateEvaluator
        """Create a CandidateEvaluator object.

        :param target_python: The target Python interpreter to use when
            checking compatibility. If None (the default), a TargetPython
            object will be constructed from the running Python.
        :param hashes: An optional collection of allowed hashes.
        """
        if target_python is None:
            target_python = TargetPython()
        if specifier is None:
            specifier = specifiers.SpecifierSet()

        supported_tags = target_python.get_tags()

        return cls(
            project_name=project_name,
            supported_tags=supported_tags,
            specifier=specifier,
            prefer_binary=prefer_binary,
            allow_all_prereleases=allow_all_prereleases,
            hashes=hashes,
        ) 
開發者ID:V1EngineeringInc,項目名稱:V1EngineeringInc-Docs,代碼行數:34,代碼來源:index.py


注:本文中的pip._vendor.packaging.specifiers.BaseSpecifier方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。