JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_file.cpython-39.opt-1.pyc

a

[��f
D�@sUdZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZddlmZddlmZmZddlmZddlmZdd	lmZdd
lmZddlm Z e	r�ddlm!Z!dd
l"m#Z#dgZ$e
ee%e&fZ'ee&gee&effZ(e�)dej*�Z+e�)d�Z,e�)d�Z-ej.ej/ej0ej1ej2ej3ej4ej5ej6ej7ej8ej9ej:ej;gZ<eedej=fe>d<ej?ej@ejAgZBeedej=fe>d<dd�eBD�ZCGdd�d�ZDGdd�d�ZEdBe&eedeejeFeeDd�dd�ZGe&e'd�d d!�ZHdCeEeejeDd"�d#d$�ZIdDee&e%edeejeedd%�d&d'�ZJdEeEeejedeeeeDd(�d)d*�ZKGd+d,�d,�ZLede(d-�d.d/�ZMe&ee&e&fd0�d1d2�ZNGd3d4�d4eO�ZPejQd5�d6d7�ZRe'e'd8�d9d:�ZSe'e'd8�d;d<�ZTe'e'd8�d=d>�ZUe&eee&e&fd?�d@dA�ZVdS)Fz
Requirements file parsing
�N)�Values)	�
TYPE_CHECKING�Any�Callable�Dict�Iterable�Iterator�List�Optional�Tuple)�
cmdoptions)�InstallationError�RequirementsFileParseError)�SearchScope)�
PipSession)�raise_for_status)�auto_decode)�get_url_scheme)�NoReturn)�
PackageFinder�parse_requirementsz^(http|https|file):z(^|\s+)#.*$z#(?P<var>\$\{(?P<name>[A-Z0-9_]+)\}).�SUPPORTED_OPTIONS�SUPPORTED_OPTIONS_REQcCsg|]}t|�j��qS�)�str�dest)�.0�orr�>/usr/lib/python3.9/site-packages/pip/_internal/req/req_file.py�
<listcomp>N�rc	@s8eZdZdeeeeeeeefeedd�dd�ZdS)�ParsedRequirementN)�requirement�is_editable�
comes_from�
constraint�options�line_source�returncCs(||_||_||_||_||_||_dS�N)r"r#r$r&r%r')�selfr"r#r$r%r&r'rrr�__init__Rs	zParsedRequirement.__init__)NN)	�__name__�
__module__�__qualname__r�boolr
rrr+rrrrr!Qs��r!c@s$eZdZeeeeedd�dd�ZdS)�
ParsedLineN)�filename�lineno�args�optsr%r(cCsZ||_||_||_||_|r0d|_d|_||_n&|jrPd|_d|_|jd|_nd|_dS)NTFr)r1r2r4r%�is_requirementr#r"Z	editables)r*r1r2r3r4r%rrrr+dszParsedLine.__init__)r,r-r.r�intrr/r+rrrrr0cs�r0Fr)r1�session�finderr&r%r(c	csFt|�}t||�}|�||�D]"}t||||d�}|dur|VqdS)aqParse a requirements file and yield ParsedRequirement instances.

    :param filename:    Path or url of requirements file.
    :param session:     PipSession instance.
    :param finder:      Instance of pip.index.PackageFinder.
    :param options:     cli options.
    :param constraint:  If true, parsing a constraint file rather than
        requirements file.
    )r&r8r7N)�get_line_parser�RequirementsFileParser�parse�handle_line)	r1r7r8r&r%�line_parser�parserZparsed_line�
parsed_reqrrrr~s
�)�contentr(cCs,t|��dd�}t|�}t|�}t|�}|S)zxSplit, filter, and join lines, and return a line iterator

    :param content: the content of the requirements file
    �)�start)�	enumerate�
splitlines�
join_lines�ignore_comments�expand_env_variables)r@�
lines_enumrrr�
preprocess�s
rI)�liner&r(cCs�d�|jrdnd|j|j�}|jr8t|j|j||jd�S|rJt�||j	�i}t
D],}||j	jvrR|j	j|rR|j	j|||<qRd|j�d|j��}t|j|j||j||d�SdS)Nz{} {} (line {})z-cz-r)r"r#r$r%�line � of )r"r#r$r%r&r')�formatr%r1r2r#r!r"rZcheck_install_build_globalr4�SUPPORTED_OPTIONS_REQ_DEST�__dict__)rJr&Zline_comes_fromZreq_optionsrr'rrr�handle_requirement_line�s6���rP)r4r1r2r8r&r7r(cs8�r4|jr|j�_|jr4�j��fdd�|jD��|�r4|j}|j}|jrT|jg}|jdurbg}|jrt|�|j�|jr�|jd}tj	�
tj	�|��}	tj	�|	|�}
tj	�
|
�r�|
}|�|�|r�|�|�t||d�}||_|jr�|��|jr�|��|�r4|j�pgD]$}d|�d|��}
|j||
d��qdS)	Nc3s|]}|�jvr|VqdSr))�features_enabled)r�f�r&rr�	<genexpr>�sz%handle_option_line.<locals>.<genexpr>Tr)�
find_links�
index_urlsrKrL)�source)�require_hashesrQ�extendrUrV�	index_url�no_indexZextra_index_urls�os�path�dirname�abspath�join�exists�appendZupdate_index_urlsr�search_scope�preZset_allow_all_prereleases�
prefer_binaryZset_prefer_binaryZ
trusted_hostsZadd_trusted_host)r4r1r2r8r&r7rUrV�valueZreq_dirZrelative_to_reqs_filerc�hostrWrrSr�handle_option_line�sL	�



�rh)rJr&r8r7r(cCs4|jrt||�}|St|j|j|j|||�dSdS)aHandle a single parsed requirements line; This can result in
    creating/yielding requirements, or updating the finder.

    :param line:        The parsed line to be processed.
    :param options:     CLI options.
    :param finder:      The finder - updated by non-requirement lines.
    :param session:     The session - updated by non-requirement lines.

    Returns a ParsedRequirement object if the line is a requirement line,
    otherwise returns None.

    For lines that contain requirements, the only options that have an effect
    are from SUPPORTED_OPTIONS_REQ, and they are scoped to the
    requirement. Other options from SUPPORTED_OPTIONS may be present, but are
    ignored.

    For lines that do not contain requirements, the only options that have an
    effect are from SUPPORTED_OPTIONS. Options from SUPPORTED_OPTIONS_REQ may
    be present, but are ignored. These lines may contain multiple options
    (although our docs imply only one is supported), and all our parsed and
    affect the finder.
    N)r5rPrhr4r1r2)rJr&r8r7r?rrrr<s
�r<c@s`eZdZeedd�dd�Zeeee	d�dd�Z
eeee	d�dd	�Zeeee	d�d
d�ZdS)r:N)r7r=r(cCs||_||_dSr))�_session�_line_parser)r*r7r=rrrr+<szRequirementsFileParser.__init__)r1r%r(ccs|�||�EdHdS)z*Parse a given file, yielding parsed lines.N)�_parse_and_recurse)r*r1r%rrrr;DszRequirementsFileParser.parseccs�|�||�D]�}|js�|jjs&|jjr�|jjr@|jjd}d}n|jjd}d}t�|�rjtj�	||�}n t�|�s�t
j�t
j�
|�|�}|�||�EdHq|VqdS)NrFT)�_parse_filer5r4�requirements�constraints�	SCHEME_RE�search�urllibr;�urljoinr\r]r`r^rk)r*r1r%rJZreq_pathZnested_constraintrrrrkHs(��


�z)RequirementsFileParser._parse_and_recurseccs�t||j�\}}t|�}|D]l\}}z|�|�\}}	Wn>tyt}
z&d|�d|
j��}t|��WYd}
~
n
d}
~
00t||||	|�VqdS)NzInvalid requirement: �
)�get_file_contentrirIrj�OptionParsingError�msgrr0)r*r1r%�_r@rH�line_numberrJ�args_strr4�ervrrrrlgs�z"RequirementsFileParser._parse_file)
r,r-r.r�
LineParserr+rr/rr0r;rkrlrrrrr:;s��r:)r8r(cs ttttfd��fdd�}|S)N�rJr(csJt�}|��}d|_�r �j|_t|�\}}|�t�|�|�\}}||fSr))�build_parserZget_default_valuesrZZformat_control�break_args_options�
parse_args�shlex�split)rJr>�defaultsryZoptions_strr4rw�r8rr�
parse_line~sz#get_line_parser.<locals>.parse_line)rrr)r8r�rr�rr9}sr9r|cCsf|�d�}g}|dd�}|D]2}|�d�s6|�d�r<qRq|�|�|�d�qd�|�d�|�fS)z�Break up the line into an args and options string.  We only want to shlex
    (and then optparse) the options, not the args.  args can contain markers
    which are corrupted by shlex.
    � N�-z--r)r��
startswithrb�popr`)rJ�tokensr3r&�tokenrrrr~�s

r~c@seZdZedd�dd�ZdS)ruN)rvr(cCs
||_dSr))rv�r*rvrrrr+�szOptionParsingError.__init__)r,r-r.rr+rrrrru�sru)r(cCsJtjdd�}tt}|D]}|�}|�|�qttdd�dd�}||_|S)z7
    Return a parser for parsing requirement lines
    F)Zadd_help_optionr)r*rvr(cSst|��dSr))rur�rrr�parser_exit�sz!build_parser.<locals>.parser_exit)�optparse�OptionParserrrZ
add_optionrr�exit)r>Zoption_factoriesZoption_factory�optionr�rrrr}�sr})rHr(ccs�d}g}|D]v\}}|�d�r(t�|�rjt�|�r:d|}|r^|�|�|d�|�fVg}q�||fVq|sr|}|�|�d��q|r�|d�|�fVdS)z�Joins a line ending in '' with the previous line (except when following
    comments).  The joined line takes on the index of the first line.
    N�\r��)�endswith�
COMMENT_RE�matchrbr`�strip)rHZprimary_line_numberZnew_linerxrJrrrrE�s 

rEccs4|D]*\}}t�d|�}|��}|r||fVqdS)z1
    Strips comments and filter empty lines.
    r�N)r��subr�)rHrxrJrrrrF�s
rFccsL|D]B\}}t�|�D]$\}}t�|�}|s.q|�||�}q||fVqdS)a�Replace all environment variables that can be retrieved via `os.getenv`.

    The only allowed format for environment variables defined in the
    requirement file is `${MY_VARIABLE_1}` to ensure two things:

    1. Strings that contain a `$` aren't accidentally (partially) expanded.
    2. Ensure consistency across platforms for requirement files.

    These points are the result of a discussion on the `github pull
    request #3514 <https://github.com/pypa/pip/pull/3514>`_.

    Valid characters in variable names follow the `POSIX standard
    <http://pubs.opengroup.org/onlinepubs/9699919799/>`_ and are limited
    to uppercase letter, digits and the `_` (underscore).
    N)�
ENV_VAR_RE�findallr\�getenv�replace)rHrxrJZenv_varZvar_namerfrrrrG�s
rG)�urlr7r(c
Cs�t|�}|dvr.|�|�}t|�|j|jfSz:t|d��}t|���}Wd�n1s\0YWn2ty�}zt	d|����WYd}~n
d}~00||fS)aGets the content of a file; it may be a filename, file: URL, or
    http: URL.  Returns (location, content).  Content is unicode.
    Respects # -*- coding: declarations on the retrieved files.

    :param url:         File path or url.
    :param session:     PipSession instance.
    )�http�https�file�rbNz"Could not open requirements file: )
r�getrr��text�openr�read�OSErrorr
)r�r7�schemeZresprRr@�excrrrrts
.$rt)NNF)N)NNN)NNN)W�__doc__r�r\�rer��urllib.parserqr�typingrrrrrrr	r
rZpip._internal.clirZpip._internal.exceptionsr
rZ!pip._internal.models.search_scoperZpip._internal.network.sessionrZpip._internal.network.utilsrZpip._internal.utils.encodingrZpip._internal.utils.urlsrrZ"pip._internal.index.package_finderr�__all__r6rZReqFileLinesr{�compile�Iror�r�rZZextra_index_urlr[rnrmZeditablerUZ	no_binaryZonly_binaryrerXrdZtrusted_hostZuse_new_featurerZOption�__annotations__Zinstall_optionsZglobal_options�hashrrNr!r0r/rrIrPrhr<r:r9r~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