当前位置: 首页>>代码示例>>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;未经允许,请勿转载。