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


Python util.Inf方法代碼示例

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


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

示例1: verifiable

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import Inf [as 別名]
def verifiable(self):
        """
        Returns True if this link can be verified after download, False if it
        cannot, and None if we cannot determine.
        """
        trusted = self.trusted or getattr(self.comes_from, "trusted", None)
        if trusted is not None and trusted:
            # This link came from a trusted source. It *may* be verifiable but
            #   first we need to see if this page is operating under the new
            #   API version.
            try:
                api_version = getattr(self.comes_from, "api_version", None)
                api_version = int(api_version)
            except (ValueError, TypeError):
                api_version = None

            if api_version is None or api_version <= 1:
                # This link is either trusted, or it came from a trusted,
                #   however it is not operating under the API version 2 so
                #   we can't make any claims about if it's safe or not
                return

            if self.hash:
                # This link came from a trusted source and it has a hash, so we
                #   can consider it safe.
                return True
            else:
                # This link came from a trusted source, using the new API
                #   version, and it does not have a hash. It is NOT verifiable
                return False
        elif trusted is not None:
            # This link came from an untrusted source and we cannot trust it
            return False


# An object to represent the "link" for the installed version of a requirement.
# Using Inf as the url makes it sort higher. 
開發者ID:sugarguo,項目名稱:Flask_Blog,代碼行數:39,代碼來源:index.py

示例2: __init__

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import Inf [as 別名]
def __init__(self, url, comes_from=None, internal=None, trusted=None):
        self.url = url
        self.comes_from = comes_from
        self.internal = internal
        self.trusted = trusted

        # Set whether it's a wheel
        self.wheel = None
        if url != Inf and self.splitext()[1] == wheel_ext:
            self.wheel = Wheel(self.filename) 
開發者ID:pbrf,項目名稱:dymo-m10-python,代碼行數:12,代碼來源:index.py


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