Viewing File: /usr/lib/python3.6/site-packages/pip/req/__pycache__/req_file.cpython-36.pyc

3

aj.@sxdZddlmZddlZddlZddlZddlZddlZddlZddl	m
Zddlm
Z
ddlZddlmZddlmZddlmZdd	lmZdd
lmZdgZejdejZejd
Zejejejej ej!ej"ej#ej$ej%ej&ej'ej(ej)ej*ej+ej,ej-ej.ej/ej0ej1gZ2ej3ej4ej5gZ6dde6DZ7d ddZ8ddZ9d!ddZ:ddZ;ddZ<ddZ=ddZ>ddZ?dS)"z
Requirements file parsing
)absolute_importN)parse)filterfalse)get_file_content)InstallRequirement)RequirementsFileParseError)RemovedInPip10Warning)
cmdoptionsparse_requirementsz^(http|https|file):z(^|\s)+#.*$cCsg|]}|jqS)dest).0orr/usr/lib/python3.6/req_file.py
<listcomp>=srFccsp|dkrtdt|||d\}}t||}	x>|	D]6\}
}t|||
||||||d	}x|D]
}
|
VqZWq2WdS)aParse 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
    NzCparse_requirements() missing 1 required keyword argument: 'session')
comes_fromsession)
constraint)	TypeErrorr
preprocessprocess_line)filenamefinderroptionsrrwheel_cache_content
lines_enumline_numberlineZreq_iterreqrrrr
@s



cCs.t|jdd}t|}t|}t||}|S)zSplit, filter, and join lines, and return a line iterator

    :param content: the content of the requirements file
    :param options: cli options
    )start)	enumerate
splitlines
join_linesignore_comments
skip_regex)rrrrrrras

rc		cs
t}	|	j}
d|
_|r |j|
_t|\}}tjdkr@|jd}|	jt	j
||
\}
}d|r`dnd||f}|r|rz|jnd	}|rtj
||
i}x.tD]&}||
jkr|
j|r|
j|||<qWtj||||||d
Vn(|
jr&|r|jnd	}|r|jnd}tj|
jd|||||dVn|
js6|
jr|
jrN|
jd}d	}n|
jd}d
}tj|rvtj||}n"tj|stjjtjj||}t|||||||d}	x|	D]}|VqWn>|
j r|
j |_ n*|r|
j!rt"j#dt$|
j%r
t"j#dt$|
j&rt"j#dt$|
jr0|
jg|_'|
j(d	krPd	|_(t)j*j+|j|
j,d
krbg|_'|
j-rx|j'j.|
j-|
j/r|
j/d}tjjtjj0|}tjj||}tjj1|r|}|j/j2||
j3rd
|_4|
j5rd
|_5|
j6r|j7j.dd|
j6DdS)a#Process a single requirements line; This can result in creating/yielding
    requirements, or updating the finder.

    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.

    :param constraint: If True, parsing a constraints file.
    :param options: OptionParser options that we may update
    Nutf8z%s %s (line %s)z-cz-rF)risolatedrrr)rrdefault_vcsr,rT)rrz--allow-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.z--allow-all-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.z--allow-unverified has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.css|]}d|dfVqdS)*Nr)r
hostrrr	<genexpr>szprocess_line.<locals>.<genexpr>)r(r)r*)8build_parserZget_default_values	index_urlZformat_controlbreak_args_optionssysversion_infoencode
parse_argsshlexsplitZ
isolated_moder	Zcheck_install_build_globalSUPPORTED_OPTIONS_REQ_DEST__dict__rZ	from_lineZ	editablesr-Z
from_editablerequirementsconstraints	SCHEME_REsearchurllib_parseZurljoinospathjoindirnamer
require_hashesallow_externalwarningswarnrallow_all_externalZallow_unverifiedZ
index_urls	use_wheelpipindexZfmt_ctl_no_use_wheelno_indexZextra_index_urlsextend
find_linksabspathexistsappendpreZallow_all_prereleasesprocess_dependency_linksZ
trusted_hostsZsecure_origins)rrrrrrrrrparserZdefaultsZargs_strZoptions_strZoptsrZline_comes_fromr,Zreq_optionsrr-Zreq_pathZnested_constraintr valueZreq_dirZrelative_to_reqs_filerrrrns










rcCsh|jd}g}|dd}x8|D]0}|jds8|jdr<Pq |j||jdq Wdj|dj|fS)zBreak 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)r9
startswithrRpoprC)rtokensargsrtokenrrrr3s


r3cCsDtjdd}tt}x|D]}|}|j|qWdd}||_|S)z7
    Return a parser for parsing requirement lines
    F)Zadd_help_optioncSst|dS)N)r)selfmsgrrrparser_exitsz!build_parser.<locals>.parser_exit)optparseZOptionParserSUPPORTED_OPTIONSSUPPORTED_OPTIONS_REQZ
add_optionexit)rUZoption_factoriesZoption_factoryZoptionr`rrrr1s
r1ccsd}g}x|D]x\}}|jds,tj|rntj|r>d|}|rb|j||dj|fVg}q||fVq|sv|}|j|jdqW|r|dj|fVdS)zJoins a line ending in '' with the previous line (except when following
    comments).  The joined line takes on the index of the first line.
    N\rW)endswith
COMMENT_REmatchrRrCstrip)rZprimary_line_numberZnew_linerrrrrr%"s 

r%ccs8x2|D]*\}}tjd|}|j}|r||fVqWdS)z1
    Strips comments and filter empty lines.
    rfN)rhsubrj)rrrrrrr&?s
r&cs2|r
|jnd}|r.tj|tfdd|}|S)zs
    Skip lines that match '--skip-requirements-regex' pattern

    Note: the regex pattern is only built once
    Ncsj|dS)Nr!)r?)e)patternrr<lambda>Tszskip_regex.<locals>.<lambda>)Zskip_requirements_regexrecompiler)rrr'r)rmrr'Js

r')NNNNFN)NNNNNF)@__doc__Z
__future__rrAror8r4rarGZpip._vendor.six.moves.urllibrr@Zpip._vendor.six.movesrrKZpip.downloadrZpip.req.req_installrZpip.exceptionsrZpip.utils.deprecationrr	__all__rpIr>rhr=Zeditabler<rMr2rOZextra_index_urlrFrIZno_allow_externalZallow_unsafeZno_allow_unsaferJZno_use_wheelZalways_unzipZ	no_binaryZonly_binaryrSrTZtrusted_hostrErbZinstall_optionsZglobal_optionshashrcr:r
rrr3r1r%r&r'rrrr<module>sn

 


Back to Directory File Manager