a *eg@sdZddlZddlZddlZddlmZddlmZmZm Z ddl m Z ddl m Z ddlmZer|ddlmZdd lmZeeZe d d d d ZGdddeZdeddddZGddde eZdS)a& Contains command classes which may interact with an index / the network. Unlike its sister module, req_command, this module still uses lazy imports so commands which don't always hit the network (e.g. list w/o --outdated or --uptodate) don't need waste time importing PipSession and friends. N)Values) TYPE_CHECKINGListOptional)certifi)Command)CommandContextMixIn) SSLContext PipSessionr returncCstjdkrtddSz ddl}WntyBtdYdS0zddlm}WntyrtdYdS0| |j }| t |S)N) z7Disabling truststore because Python version isn't 3.10+rz1Disabling truststore since ssl support is missing) truststorez5Disabling truststore because platform isn't supported)sys version_infologgerdebugssl ImportErrorwarning pip._vendorrr PROTOCOL_TLS_CLIENTload_verify_locationsrwhere)rrctxrI/usr/local/lib/python3.9/site-packages/pip/_internal/cli/index_command.py_create_truststore_ssl_contexts         rcspeZdZdZddfdd Zeeeee dddZ ed dd d Z deee ee d d d dZ ZS)SessionCommandMixinzE A class mixin for command classes needing _build_session(). Nr cstd|_dS)N)super__init___session)self __class__rrr"7s zSessionCommandMixin.__init__optionsr cCsLg}t|dds*t|dd}|r*||t|dd}|rD|||pJdS)z7Return a list of index urls from user-provided options.no_indexF index_urlNextra_index_urls)getattrappendextend)clsr( index_urlsurlurlsrrr_get_index_urls;s     z#SessionCommandMixin._get_index_urlsr cCs0|jdur*||||_|jdus*J|jS)zGet a default-managed session.N)r# enter_context_build_session)r$r(rrrget_default_sessionIs z'SessionCommandMixin.get_default_session)r(retriestimeoutr cCsddlm}|j}|r&tj|s&Jd|jvr8t}nd}||rPtj|dnd|dur^|n|j |j | ||d}|j r|j |_ |jr|j|_ |js|r|dur|n|j|_|jr|j|jd|_d|_|j |j_|j|j_|S)Nrr z legacy-certszhttp-v2)cacher7 trusted_hostsr0 ssl_context)httphttpsF)pip._internal.network.sessionr cache_dirospathisabsdeprecated_features_enabledrjoinr7r:r3certverify client_certr8proxyproxies trust_envno_inputauth promptingZkeyring_provider)r$r(r7r8r r?r;sessionrrrr5Ss6      z"SessionCommandMixin._build_session)NN)__name__ __module__ __qualname____doc__r" classmethodrrrstrr3r6intr5 __classcell__rrr%rr 2s  r r )rNr(r cCsddlm}|||dS)Nr)pip_self_version_check)!pip._internal.self_outdated_checkrW)rNr(checkrrr_pip_self_version_checks rZc@s eZdZdZeddddZdS)IndexGroupCommandz Abstract base class for commands with the index_group options. This also corresponds to the commands that permit the pip version check. Nr'cCst|dsJ|js|jrdSzJ|j|dtd|jd}|t||Wdn1s\0YWn*tyt dtj ddd Yn0dS) z Do the pip version check if not disabled. This overrides the default behavior of not doing the check. r)Nr)r7r8z6There was an error checking the latest version of pip.zSee below for errorT)exc_info) hasattrdisable_pip_version_checkr)r5minr8rZ Exceptionrrr)r$r(rNrrrhandle_pip_version_checks  ,  z*IndexGroupCommand.handle_pip_version_check)rOrPrQrRrrbrrrrr[sr[)rRloggingr@roptparsertypingrrrrrpip._internal.cli.base_commandr!pip._internal.cli.command_contextrrr r>r getLoggerrOrrr rZr[rrrrs        T