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


Python index.HTMLPage方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: from pip._internal import index [as 別名]
# 或者: from pip._internal.index import HTMLPage [as 別名]
def __init__(self, url, comes_from=None, requires_python=None):
        # type: (str, Optional[Union[str, HTMLPage]], Optional[str]) -> None
        """
        url:
            url of the resource pointed to (href of the link)
        comes_from:
            instance of HTMLPage where the link was found, or string.
        requires_python:
            String containing the `Requires-Python` metadata field, specified
            in PEP 345. This may be specified by a data-requires-python
            attribute in the HTML link tag, as described in PEP 503.
        """

        # url can be a UNC windows share
        if url.startswith('\\\\'):
            url = path_to_url(url)

        self.url = url
        self.comes_from = comes_from
        self.requires_python = requires_python if requires_python else None

        super(Link, self).__init__(
            key=(self.url),
            defining_class=Link
        ) 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:27,代碼來源:link.py

示例2: get_patched_download_http_url

# 需要導入模塊: from pip._internal import index [as 別名]
# 或者: from pip._internal.index import HTMLPage [as 別名]
def get_patched_download_http_url(orig_download_http_url, index_urls):
    def pipfaster_download_http_url(link, *args, **kwargs):
        file_path, content_type = orig_download_http_url(link, *args, **kwargs)
        if link.is_wheel:
            for index_url in index_urls:
                if (
                        # pip <18.1
                        isinstance(link.comes_from, HTMLPage) and
                        link.comes_from.url.startswith(index_url)
                ) or (
                        # pip >= 18.1
                        isinstance(link.comes_from, (str, type(''))) and
                        link.comes_from.startswith(index_url)
                ):
                    _store_wheel_in_cache(file_path, index_url)
                    break
        return file_path, content_type
    return pipfaster_download_http_url 
開發者ID:Yelp,項目名稱:venv-update,代碼行數:20,代碼來源:pip_faster.py

示例3: __init__

# 需要導入模塊: from pip._internal import index [as 別名]
# 或者: from pip._internal.index import HTMLPage [as 別名]
def __init__(
        self,
        url,                   # type: str
        comes_from=None,       # type: Optional[Union[str, HTMLPage]]
        requires_python=None,  # type: Optional[str]
        yanked_reason=None,    # type: Optional[Text]
    ):
        # type: (...) -> None
        """
        :param url: url of the resource pointed to (href of the link)
        :param comes_from: instance of HTMLPage where the link was found,
            or string.
        :param requires_python: String containing the `Requires-Python`
            metadata field, specified in PEP 345. This may be specified by
            a data-requires-python attribute in the HTML link tag, as
            described in PEP 503.
        :param yanked_reason: the reason the file has been yanked, if the
            file has been yanked, or None if the file hasn't been yanked.
            This is the value of the "data-yanked" attribute, if present, in
            a simple repository HTML link. If the file has been yanked but
            no reason was provided, this should be the empty string. See
            PEP 592 for more information and the specification.
        """

        # url can be a UNC windows share
        if url.startswith('\\\\'):
            url = path_to_url(url)

        self._parsed_url = urllib_parse.urlsplit(url)
        # Store the url as a private attribute to prevent accidentally
        # trying to set a new value.
        self._url = url

        self.comes_from = comes_from
        self.requires_python = requires_python if requires_python else None
        self.yanked_reason = yanked_reason

        super(Link, self).__init__(key=url, defining_class=Link) 
開發者ID:V1EngineeringInc,項目名稱:V1EngineeringInc-Docs,代碼行數:40,代碼來源:link.py


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