a
    0fu                     @   s"  U d Z ddlZddlZddlZddlZddlmZ ddlm	Z	m
Z
mZmZmZ ddlmZ ddlmZmZmZmZmZ ddlmZ ddlmZ dd	lmZ dd
lmZmZ ddlmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z' e(e)Z*ee
e+ddddZ,ee+ef eedddZ-dAee.ddddZ/e
e+e+e+dddZ0e
e+e+e+dddZ1G dd  d e
Z2ee
d!d"d#d#d$d%Z3ed&e
f e4d'< ee
d(d)d*dd+d,Z5ed&e
f e4d)< ee
d-d.d*dd/d,Z6ed&e
f e4d.< ee
d0d1d2d*dd3d,Z7ed&e
f e4d4< ee
d5d6d*d7d%Z8ed&e
f e4d6< ee
d8d9d:d;Z9ed&e
f e4d9< ee
d<d=d>d?dd@d,Z:ed&e
f e4d>< ee
dAdBd*ddCd,Z;ed&e
f e4dB< ee
dDdEdFd*dGd%Z<ed&e
f e4dF< ee
dHdIdJd?ddKd,Z=ed&e
f e4dJ< ee
dLdMdNg dOdPdQdRZ>ed&e
f e4dM< ee2dSdTdUdVdWdWdXdYZ?ed&e
f e4dV< ee
dZd[d*dd\d,Z@ed&e
f e4d[< ee
d]d^g d_d`dadbZAed&e
f e4d^< ee
dcdddedfdgdhZBed&e
f e4dd< ee
didjdkdldmdhZCed&e
f e4dj< ee
dndodpdqdrdsdtduZDed&e
f e4dq< e
dvdwdxZEee2dydzdWdWd{d|ZFed&e
f e4dz< ee2d}d~dWddWddZGed&e
f e4d~< ee
ddddde!jHddZIed&e
f e4d< e
dvddZJee
ddd*ddd,ZKed&e
f e4d< e
dvddZLe
dvddZMe
dvddZNe
dvddZOe
dvddZPe
e+e+eddddZQee2ddddddWde deQddZRed&e
f e4d< ee
edddZSe
e+e+eddddZTe
e+e+eddddZUe
dvddZVe
dvddZWee
dddddddZXed&e
f e4d< e+eeeYd&f ee+ f dddZZe
e+e+eddddZ[ee
dddde[dededd	Z\ed&e
f e4d< ee
ddddddZ]ed&e
f e4d< ee
dddddddZ^ed&e
f e4d< eddŜddǄZ_ee#dȜddʄZ`e
dvdd̄Zaee2ddeddWddЍZbed&e
f e4d< e
e+e+eddќddӄZcee
dddecdd֍Zded&e
f e4d< ee
dddd*ddd,Zeed&e
f e4d< ee
ddd*dd%Zfed&e
f e4d< ee
dddddd,Zged&e
f e4d< ee
ddd*ddd,Zhed&e
f e4d< e
e+e+eddќddZiee
ddd*ddd,Zjee4d< ee
dddeide	dZkee4d< e
e+e+eddddZlee
ddde+delddd	Zmed&e
f e4d< ee
ddddddZned&e
f e4d< ee
ddddd dZoed&e
f e4d< ee
dd*dddZped&e
f e4d< ee
dd*dddZqed&e
f e4d< ee
d	d
d*ddd,Zred&e
f e4d
< ee
dddddgddZsed&e
f e4d< e
e+e+eddddZtee
dddetdddZued&e
f e4d< ee
ddd*ddd,Zved&e
f e4d< ee2ddWdWdddZwed&e
f e4d < eddȜd!d"Zxee2d#d$dd%d&d'd(Zyed&e
f e4d)< ee
d*d+d*dd,d,Zzed&e
f e4d+< d-d.gZ{ee
d/d0d1dg d2ge{ d3d4Z|ed&e
f e4d5< ee
d6d7d1dg d8d9gd:d4Z}ed&e
f e4d;< d<e3e5e6e7e9e:e<e=e?e@eAeBeCeDeEeMeFeGebedere;eze|e}gd=Z~ee+ef e4d>< d?eIeJeKeLgd=Zee+ef e4d@< dS (B  aC  
shared options and groups

The principle here is to define options once, but *not* instantiate them
globally. One reason being that options with action='append' can carry state
between parses. pip parses general options twice internally, and shouldn't
pass on state. To be consistent, all options will follow this design.
    N)partial)SUPPRESS_HELPOptionOptionGroupOptionParserValues)dedent)AnyCallableDictOptionalTuplecanonicalize_name)ConfigOptionParser)CommandError)USER_CACHE_DIRget_src_prefix)FormatControl)PyPI)TargetPython)STRONG_HASHES)	strtobool)parseroptionmsgreturnc                 C   s0   | d| }t d| }| | dS )z
    Raise an option parsing error using parser.error().

    Args:
      parser: an OptionParser instance.
      option: an Option instance.
      msg: the error text.
    z error:  N)textwrapfilljoinspliterror)r   r   r    r#   U/var/www/ai-form-bot/venv/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.pyraise_option_error$   s    	r%   )groupr   r   c                 C   s,   t || d }| d D ]}||  q|S )z
    Return an OptionGroup object
    group  -- assumed to be dict with 'name' and 'options' keys
    parser -- an optparse Parser
    nameoptions)r   
add_option)r&   r   option_groupr   r#   r#   r$   make_option_group2   s    r+   F)r(   check_targetr   c                 C   sh   t | j| j| j| jg}tt dh}| j|ko6| j }|rH|rHt	d|rd| j
sd|rd| jsdt	ddS )zFunction for determining if custom platform options are allowed.

    :param options: The OptionParser options.
    :param check_target: Whether or not to check if --target is being used.
    z:all:zWhen restricting platform and interpreter constraints using --python-version, --platform, --abi, or --implementation, either --no-deps must be set, or --only-binary=:all: must be set and --no-binary must not be set (or must be set to :none:).zfCan not use any platform or abi specific options unless installing via '--target' or using '--dry-run'N)anypython_version	platformsabisimplementationr   setformat_controlignore_dependenciesr   dry_run
target_dir)r(   r,   dist_restriction_setbinary_onlysdist_dependencies_allowedr#   r#   r$   check_dist_restriction>   s&    	r:   )r   optvaluer   c                 C   s   t j|S N)ospath
expanduserr   r;   r<   r#   r#   r$   _path_option_checkf   s    rB   c                 C   s   t |S r=   r   rA   r#   r#   r$   _package_name_option_checkj   s    rC   c                   @   s0   e Zd Zejd Zej Zeed< eed< dS )	PipOption)r?   package_namerE   r?   N)	__name__
__module____qualname__r   TYPESTYPE_CHECKERcopyrC   rB   r#   r#   r#   r$   rD   n   s   

rD   z-hz--helphelpz
Show help.)destactionrL   .help_z--debug
debug_mode
store_truezbLet unhandled exceptions propagate outside the main subroutine, instead of logging them to stderr.rM   rN   defaultrL   z
--isolatedisolated_modezSRun pip in an isolated mode, ignoring environment variables and user configuration.z--require-virtualenvz--require-venvrequire_venvzMAllow pip to only run in a virtual environment; exit with an error otherwise.require_virtualenvz--break-system-packagesoverride_externally_managedz=Allow pip to modify an EXTERNALLY-MANAGED Python installationz--pythonpythonz.Run pip with the specified Python interpreter.)rM   rL   z-vz	--verboseverbosecountzDGive more output. Option is additive, and can be used up to 3 times.z
--no-colorno_colorzSuppress colored output.z-Vz	--versionversionzShow version and exit.z-qz--quietquietzGive less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).z--progress-barprogress_barchoice)onoffrawr`   zLSpecify whether the progress bar should be used [on, off, raw] (default: on))rM   typechoicesrS   rL   z--logz
--log-filez--local-loglogr?   z Path to a verbose appending log.)rM   metavarrc   rL   z
--no-inputno_inputzDisable prompting for input.z--keyring-providerkeyring_provider)autodisabledimport
subprocessri   zEnable the credential lookup via the keyring library if user input is allowed. Specify which mechanism to use [disabled, import, subprocess]. (default: disabled))rM   rd   rS   rL   z--proxyproxystr zESpecify a proxy in the form scheme://[user:passwd@]proxy.server:port.)rM   rc   rS   rL   z	--retriesretriesint   zRMaximum number of retries each connection should attempt (default %default times).z	--timeoutz--default-timeoutsectimeoutfloat   z2Set the socket timeout (default %default seconds).)rf   rM   rc   rS   rL   )r   c                
   C   s   t dddg dg ddddS )	Nz--exists-actionexists_actionr_   )siwbaappendrN   zYDefault action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.)rM   rc   rd   rS   rN   rf   rL   r   r#   r#   r#   r$   rw   +  s    rw   z--certcertzPath to PEM-encoded CA certificate bundle. If provided, overrides the default. See 'SSL Certificate Verification' in pip documentation for more information.)rM   rc   rf   rL   z--client-certclient_certzkPath to SSL client certificate, a single file containing the private key and the certificate in PEM format.)rM   rc   rS   rf   rL   z-iz--index-urlz
--pypi-url	index_urlURLzBase URL of the Python Package Index (default %default). This should point to a repository compliant with PEP 503 (the simple repository API) or a local directory laid out in the same format.)rM   rf   rS   rL   c                   C   s   t ddddg ddS )Nz--extra-index-urlextra_index_urlsr   r}   zmExtra URLs of package indexes to use in addition to --index-url. Should follow the same rules as --index-url.rM   rf   rN   rS   rL   r~   r#   r#   r#   r$   extra_index_urlb  s    r   z
--no-indexno_indexzAIgnore package index (only looking at --find-links URLs instead).c                	   C   s   t ddddg dddS )Nz-fz--find-links
find_linksr}   urla  If a URL or path to an html file, then parse for links to archives such as sdist (.tar.gz) or wheel (.whl) files. If a local path or file:// URL that's a directory, then look for archives in the directory listing. Links to VCS project URLs are not supported.rM   rN   rS   rf   rL   r~   r#   r#   r#   r$   r   y  s    r   c                   C   s   t ddddg ddS )Nz--trusted-hosttrusted_hostsr}   HOSTNAMEz]Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS.)rM   rN   rf   rS   rL   r~   r#   r#   r#   r$   trusted_host  s    r   c                	   C   s   t ddddg dddS )Nz-cz--constraintconstraintsr}   filez\Constrain versions using the given constraints file. This option can be used multiple times.r   r~   r#   r#   r#   r$   r     s    r   c                	   C   s   t ddddg dddS )Nz-rz--requirementrequirementsr}   r   zQInstall from the given requirements file. This option can be used multiple times.r   r~   r#   r#   r#   r$   r     s    r   c                	   C   s   t ddddg dddS )Nz-ez
--editable	editablesr}   zpath/urlzkInstall a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url.r   r~   r#   r#   r#   r$   editable  s    r   )r   opt_strr<   r   r   c                 C   s    t j|}t|j| j| d S r=   )r>   r?   abspathsetattrvaluesrM   )r   r   r<   r   r#   r#   r$   _handle_src  s    r   z--srcz--sourcez--source-dirz--source-directorysrc_dirdircallbackzDirectory to check out editable projects into. The default in a virtualenv is "<venv path>/src". The default for global installs is "<current dir>/src".)rM   rc   rf   rS   rN   r   rL   src)r   r   r   c                 C   s   t | |jS )zGet a format_control object.)getattrrM   )r   r   r#   r#   r$   _get_format_control  s    r   c                 C   s"   t |j| }t||j|j d S r=   )r   r   r   handle_mutual_excludes	no_binaryonly_binaryr   r   r<   r   existingr#   r#   r$   _handle_no_binary  s    r   c                 C   s"   t |j| }t||j|j d S r=   )r   r   r   r   r   r   r   r#   r#   r$   _handle_only_binary  s    r   c               	   C   s$   t t t } tdddtd| ddS )Nz--no-binaryr3   r   rn   av  Do not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either ":all:" to disable all binary packages, ":none:" to empty the set (notice the colons), or one or more package names with commas between them (no colons). Note that some packages are tricky to compile and may fail to install when this option is used on them.rM   rN   r   rc   rS   rL   )r   r2   r   r   r3   r#   r#   r$   r     s    r   c               	   C   s$   t t t } tdddtd| ddS )Nz--only-binaryr3   r   rn   aK  Do not use source packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either ":all:" to disable all source packages, ":none:" to empty the set, or one or more package names with commas between them. Packages without binary distributions will fail to install when this option is used on them.r   )r   r2   r   r   r   r#   r#   r$   r     s    r   z
--platformr/   platformr}   zOnly use wheels compatible with <platform>. Defaults to the platform of the running system. Use this option multiple times to specify multiple platforms supported by the target interpreter.r   )r<   r   c                 C   s   | sdS |  d}t|dkr"dS t|dkrV|d } t| dkrV| d | dd g}ztdd	 |D }W n ty   Y d
S 0 |dfS )z
    Convert a version string like "3", "37", or "3.7.3" into a tuple of ints.

    :return: A 2-tuple (version_info, error_msg), where `error_msg` is
        non-None if and only if there was a parsing error.
    )NN.   )r#   z'at most three version parts are allowed   r   Nc                 s   s   | ]}t |V  qd S r=   )rq   ).0partr#   r#   r$   	<genexpr>:      z*_convert_python_version.<locals>.<genexpr>)r#   z$each version part must be an integer)r!   lentuple
ValueError)r<   partsversion_infor#   r#   r$   _convert_python_version$  s    
r   c                 C   s>   t |\}}|dur2d|d| }t|| |d ||j_dS )z3
    Handle a provided --python-version value.
    Nz invalid --python-version value: z: r   r   )r   r%   r   r.   )r   r   r<   r   r   	error_msgr   r#   r#   r$   _handle_python_versionA  s
    r   z--python-versionr.   a      The Python interpreter version to use for wheel and "Requires-Python"
    compatibility checks. Defaults to a version derived from the running
    interpreter. The version can be specified using up to three dot-separated
    integers (e.g. "3" for 3.0.0, "3.7" for 3.7.0, or "3.7.3"). A major-minor
    version can also be given as a string without dots (e.g. "37" for 3.7.0).
    )rM   rf   rN   r   rc   rS   rL   z--implementationr1   zOnly use wheels compatible with Python implementation <implementation>, e.g. 'pp', 'jy', 'cp',  or 'ip'. If not specified, then the current interpreter implementation is used.  Use 'py' to force implementation-agnostic wheels.z--abir0   abiaL  Only use wheels compatible with Python abi <abi>, e.g. 'pypy_41'. If not specified, then the current interpreter abi tag is used. Use this option multiple times to specify multiple abis supported by the target interpreter. Generally you will need to specify --implementation, --platform, and --python-version when using this option.)cmd_optsr   c                 C   s4   |  t  |  t  |  t  |  t  d S r=   )r)   r/   r.   r1   r0   )r   r#   r#   r$   add_target_python_options  s    r   )r(   r   c                 C   s   t | j| j| j| jd}|S )N)r/   py_version_infor0   r1   )r   r/   r.   r0   r1   )r(   target_pythonr#   r#   r$   make_target_python  s    r   c                   C   s   t ddddddS )Nz--prefer-binaryprefer_binaryrQ   FzSPrefer binary packages over source packages, even if the source packages are newer.rR   r~   r#   r#   r#   r$   r     s    r   z--cache-dir	cache_dirzStore the cache data in <dir>.)rM   rS   rf   rc   rL   )r   r;   r<   r   r   c              
   C   sX   |durLzt | W n6 tyJ } zt|| t|d W Y d}~n
d}~0 0 d|j_dS )z
    Process a value provided for the --no-cache-dir option.

    This is an optparse.Option callback for the --no-cache-dir option.
    Nr   F)r   r   r%   rn   r   r   )r   r;   r<   r   excr#   r#   r$   _handle_no_cache_dir  s    (	r   z--no-cache-dirzDisable the cache.)rM   rN   r   rL   no_cachez	--no-depsz--no-dependenciesr4   z#Don't install package dependencies.no_depsz--ignore-requires-pythonignore_requires_pythonz'Ignore the Requires-Python information.z--no-build-isolationbuild_isolationstore_falseTzDisable isolation when building a modern source distribution. Build dependencies specified by PEP 518 must be already installed if this option is used.no_build_isolationz--check-build-dependenciescheck_build_depsz1Check the build dependencies when PEP517 is used.c                 C   s\   |durd}t || |d d}tdd |D sPdd| d	}t || |d d
|j_dS )z
    Process a value provided for the --no-use-pep517 option.

    This is an optparse.Option callback for the no_use_pep517 option.
    Na0  A value was passed for --no-use-pep517,
        probably using either the PIP_NO_USE_PEP517 environment variable
        or the "no-use-pep517" config file option. Use an appropriate value
        of the PIP_USE_PEP517 environment variable or the "use-pep517"
        config file option instead.
        r   )
setuptoolswheelc                 s   s   | ]}t j|V  qd S r=   )	importlibutil	find_spec)r   packager#   r#   r$   r     r   z(_handle_no_use_pep517.<locals>.<genexpr>z2It is not possible to use --no-use-pep517 without z and z installed.F)r%   allr    r   
use_pep517)r   r;   r<   r   r   packagesr#   r#   r$   _handle_no_use_pep517  s    r   z--use-pep517r   z^Use PEP 517 for building source distributions (use --no-use-pep517 to force legacy behaviour).z--no-use-pep517)rM   rN   r   rS   rL   no_use_pep517c                 C   s   | d\}}}|dkr*|d| d t|j| j}|d u rTi }t|j| j| ||v rt|| trz|| | q|| |g||< n|||< d S )N=Arguments to z must be of the form KEY=VAL)		partitionr"   r   r   rM   r   
isinstancelistr}   )r   r   r<   r   keysepvalrM   r#   r#   r$   _handle_config_settings5  s    r   z-Cz--config-settingsconfig_settingssettingszConfiguration settings to be passed to the PEP 517 build backend. Settings take the form KEY=VALUE. Use multiple --config-settings options to pass multiple keys to the backend.)rM   rc   rN   r   rf   rL   z--build-optionbuild_optionsr(   z9Extra arguments to be supplied to 'setup.py bdist_wheel'.)rM   rf   rN   rL   z--global-optionglobal_optionszcExtra global options to be supplied to the setup.py call before the install or bdist_wheel command.)rM   rN   rf   rL   z
--no-cleanz!Don't clean up build directories.)rN   rS   rL   no_cleanz--prezYInclude pre-release and development versions. By default, pip only finds stable versions.prez--disable-pip-version-checkdisable_pip_version_checkz{Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.z--root-user-actionroot_user_actionwarnignorezBAction if pip is run as a root user [warn, ignore] (default: warn))rM   rS   rd   rL   c                 C   s   |j jsi |j _z|dd\}}W n$ tyH   |d| d Y n0 |tvrj|d|dt |j j|g 	| dS )zkGiven a value spelled "algo:digest", append the digest to a list
    pointed to in a dict by the algo name.:r   r   zE must be a hash name followed by a value, like --hash=sha256:abcde...z&Allowed hash algorithms for {} are {}.z, N)
r   hashesr!   r   r"   r   formatr    
setdefaultr}   )r   r   r<   r   algodigestr#   r#   r$   _handle_merge_hash  s    


r   z--hashr   stringzgVerify that the package's archive matches this hash before installing. Example: --hash=sha256:abcdef...)rM   rN   r   rc   rL   hashz--require-hashesrequire_hasheszRequire a hash to check each requirement against, for repeatable installs. This option is implied when any package in a requirements file has a --hash option.z--pathz^Restrict to the specified installation path for listing packages (can be used multiple times).)rM   rc   rN   rL   	list_pathc                 C   s   | j r| js| jrtdd S )Nz2Cannot combine '--path' with '--user' or '--local')r?   userlocalr   )r(   r#   r#   r$   check_list_path_option  s    r   z	--excludeexcludesr   rE   z)Exclude specified package from the output)rM   rN   rf   rc   rL   list_excludez--no-python-version-warningno_python_version_warningz>Silence deprecation warnings for upcoming unsupported Pythons.
truststorezno-binary-enable-wheel-cachez--use-featurefeatures_enabledfeaturez	fast-depsz<Enable new functionality, that may be backward incompatible.)rM   rf   rN   rS   rd   rL   use_new_featurez--use-deprecateddeprecated_features_enabledzlegacy-resolverzlegacy-certszDEnable deprecated functionality, that will be removed in the future.use_deprecated_featurezGeneral Options)r'   r(   general_groupzPackage Index Optionsindex_group)F)__doc__importlib.utilr   loggingr>   r   	functoolsr   optparser   r   r   r   r   r   typingr	   r
   r   r   r   Zpip._vendor.packaging.utilsr   pip._internal.cli.parserr   pip._internal.exceptionsr   pip._internal.locationsr   r   #pip._internal.models.format_controlr   pip._internal.models.indexr   "pip._internal.models.target_pythonr   pip._internal.utils.hashesr   pip._internal.utils.miscr   	getLoggerrF   loggerrn   r%   r+   boolr:   rB   rC   rD   rO   __annotations__rP   rT   rV   rW   rX   rY   r[   r\   r]   r^   re   rg   rh   rm   rp   rt   rw   r   r   
simple_urlr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r/   rq   r   r   r.   r1   r0   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ZALWAYS_ENABLED_FEATURESr   r   r   r   r#   r#   r#   r$   <module>   s  
(	
		

	

$	
#
	
	

 