当前位置: 首页>>代码示例>>Python>>正文


Python compat.unescape方法代码示例

本文整理汇总了Python中pip._vendor.distlib.compat.unescape方法的典型用法代码示例。如果您正苦于以下问题:Python compat.unescape方法的具体用法?Python compat.unescape怎么用?Python compat.unescape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pip._vendor.distlib.compat的用法示例。


在下文中一共展示了compat.unescape方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: iter_links

# 需要导入模块: from pip._vendor.distlib import compat [as 别名]
# 或者: from pip._vendor.distlib.compat import unescape [as 别名]
def iter_links(self):
        # type: () -> Iterable[Link]
        """Yields all links in the page"""
        document = html5lib.parse(
            self.content,
            transport_encoding=_get_encoding_from_headers(self.headers),
            namespaceHTMLElements=False,
        )
        base_url = _determine_base_url(document, self.url)
        for anchor in document.findall(".//a"):
            if anchor.get("href"):
                href = anchor.get("href")
                url = _clean_link(urllib_parse.urljoin(base_url, href))
                pyrequire = anchor.get('data-requires-python')
                pyrequire = unescape(pyrequire) if pyrequire else None
                yield Link(url, self.url, requires_python=pyrequire) 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:18,代码来源:index.py

示例2: links

# 需要导入模块: from pip._vendor.distlib import compat [as 别名]
# 或者: from pip._vendor.distlib.compat import unescape [as 别名]
def links(self):
        """Yields all links in the page"""
        for anchor in self.parsed.findall(".//a"):
            if anchor.get("href"):
                href = anchor.get("href")
                url = self.clean_link(
                    urllib_parse.urljoin(self.base_url, href)
                )
                pyrequire = anchor.get('data-requires-python')
                pyrequire = unescape(pyrequire) if pyrequire else None
                yield Link(url, self, requires_python=pyrequire) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:13,代码来源:index.py

示例3: _create_link_from_element

# 需要导入模块: from pip._vendor.distlib import compat [as 别名]
# 或者: from pip._vendor.distlib.compat import unescape [as 别名]
def _create_link_from_element(
    anchor,    # type: HTMLElement
    page_url,  # type: str
    base_url,  # type: str
):
    # type: (...) -> Optional[Link]
    """
    Convert an anchor element in a simple repository page to a Link.
    """
    href = anchor.get("href")
    if not href:
        return None

    url = _clean_link(urllib_parse.urljoin(base_url, href))
    pyrequire = anchor.get('data-requires-python')
    pyrequire = unescape(pyrequire) if pyrequire else None

    yanked_reason = anchor.get('data-yanked')
    if yanked_reason:
        # This is a unicode string in Python 2 (and 3).
        yanked_reason = unescape(yanked_reason)

    link = Link(
        url,
        comes_from=page_url,
        requires_python=pyrequire,
        yanked_reason=yanked_reason,
    )

    return link 
开发者ID:pantsbuild,项目名称:pex,代码行数:32,代码来源:collector.py

示例4: iter_links

# 需要导入模块: from pip._vendor.distlib import compat [as 别名]
# 或者: from pip._vendor.distlib.compat import unescape [as 别名]
def iter_links(self):
        """Yields all links in the page"""
        document = html5lib.parse(
            self.content,
            transport_encoding=_get_encoding_from_headers(self.headers),
            namespaceHTMLElements=False,
        )
        base_url = _determine_base_url(document, self.url)
        for anchor in document.findall(".//a"):
            if anchor.get("href"):
                href = anchor.get("href")
                url = _clean_link(urllib_parse.urljoin(base_url, href))
                pyrequire = anchor.get('data-requires-python')
                pyrequire = unescape(pyrequire) if pyrequire else None
                yield Link(url, self.url, requires_python=pyrequire) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:17,代码来源:index.py


注:本文中的pip._vendor.distlib.compat.unescape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。