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


Python req.InstallRequirement方法代碼示例

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


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

示例1: parse_requirements

# 需要導入模塊: from pip._internal import req [as 別名]
# 或者: from pip._internal.req import InstallRequirement [as 別名]
def parse_requirements(
    filename,  # type: str
    finder=None,  # type: Optional[PackageFinder]
    comes_from=None,  # type: Optional[str]
    options=None,  # type: Optional[optparse.Values]
    session=None,  # type: Optional[PipSession]
    constraint=False,  # type: bool
    wheel_cache=None,  # type: Optional[WheelCache]
    use_pep517=None  # type: Optional[bool]
):
    # type: (...) -> Iterator[InstallRequirement]
    """Parse a requirements file and yield InstallRequirement instances.

    :param filename:    Path or url of requirements file.
    :param finder:      Instance of pip.index.PackageFinder.
    :param comes_from:  Origin description of requirements.
    :param options:     cli options.
    :param session:     Instance of pip.download.PipSession.
    :param constraint:  If true, parsing a constraint file rather than
        requirements file.
    :param wheel_cache: Instance of pip.wheel.WheelCache
    :param use_pep517:  Value of the --use-pep517 option.
    """
    if session is None:
        raise TypeError(
            "parse_requirements() missing 1 required keyword argument: "
            "'session'"
        )

    _, content = get_file_content(
        filename, comes_from=comes_from, session=session
    )

    lines_enum = preprocess(content, options)

    for line_number, line in lines_enum:
        req_iter = process_line(line, filename, line_number, finder,
                                comes_from, options, session, wheel_cache,
                                use_pep517=use_pep517, constraint=constraint)
        for req in req_iter:
            yield req 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:43,代碼來源:req_file.py

示例2: parse_requirements

# 需要導入模塊: from pip._internal import req [as 別名]
# 或者: from pip._internal.req import InstallRequirement [as 別名]
def parse_requirements(
    filename,  # type: str
    session,  # type: PipSession
    finder=None,  # type: Optional[PackageFinder]
    comes_from=None,  # type: Optional[str]
    options=None,  # type: Optional[optparse.Values]
    constraint=False,  # type: bool
    wheel_cache=None,  # type: Optional[WheelCache]
    use_pep517=None  # type: Optional[bool]
):
    # type: (...) -> Iterator[InstallRequirement]
    """Parse a requirements file and yield InstallRequirement instances.

    :param filename:    Path or url of requirements file.
    :param session:     PipSession instance.
    :param finder:      Instance of pip.index.PackageFinder.
    :param comes_from:  Origin description of requirements.
    :param options:     cli options.
    :param constraint:  If true, parsing a constraint file rather than
        requirements file.
    :param wheel_cache: Instance of pip.wheel.WheelCache
    :param use_pep517:  Value of the --use-pep517 option.
    """
    skip_requirements_regex = (
        options.skip_requirements_regex if options else None
    )
    line_parser = get_line_parser(finder)
    parser = RequirementsFileParser(
        session, line_parser, comes_from, skip_requirements_regex
    )

    for parsed_line in parser.parse(filename, constraint):
        req = handle_line(
            parsed_line, finder, options, session, wheel_cache, use_pep517
        )
        if req is not None:
            yield req 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:39,代碼來源:req_file.py

示例3: __init__

# 需要導入模塊: from pip._internal import req [as 別名]
# 或者: from pip._internal.req import InstallRequirement [as 別名]
def __init__(self, req):
        # type: (InstallRequirement) -> None
        super(AbstractDistribution, self).__init__()
        self.req = req 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:6,代碼來源:base.py


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