o
    ~#ge                     @   s@  d Z ddlZddlZddl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 ddlmZmZ ddlmZmZmZmZ dd	lmZmZmZmZm Z m!Z!m"Z" dd
l#m$Z$ ddl%m&Z&m'Z' ddl(m)Z)m*Z* ddl+m,Z- ddl+m.Z.m/Z/ ddl0m1Z1 dgZ2e3e4Z5G dd deZ6dS )z(Base Command class, and related routines    N)Values)AnyCallableListOptionalTuple)
cmdoptions)CommandContextMixIn)ConfigOptionParserUpdatingDefaultsHelpFormatter)ERRORPREVIOUS_BUILD_DIR_ERRORUNKNOWN_ERRORVIRTUALENV_NOT_FOUND)
BadCommandCommandErrorDiagnosticPipErrorInstallationErrorNetworkConnectionErrorPreviousBuildDirErrorUninstallationError)check_path_owner)BrokenStdoutLoggingErrorsetup_logging)get_prognormalize_path)TempDirectoryTypeRegistry)global_tempdir_managertempdir_registry)running_under_virtualenvCommandc                	       s   e Zd ZU dZeed< dZeed< ddedededd	f fd
dZdddZ	de
dd	fddZde
dee defddZdee dee
ee f fddZdee defddZdee defddZ  ZS )r     usageFignore_require_venvnamesummaryisolatedreturnNc              	      s   t    || _|| _t| jt  d| t d|| j|d| _	d | _
| j  d}t| j	|| _ttj| j	}| j	| |   d S )N F)r"   prog	formatteradd_help_optionr$   descriptionr&   z Options)super__init__r$   r%   r
   r"   r   r   __doc__parserr   
capitalizeoptparseOptionGroupcmd_optsr   make_option_groupgeneral_groupadd_option_groupadd_options)selfr$   r%   r&   optgroup_namegen_opts	__class__ /var/www/static.ux5.de/https/Moving-Object-Detection-with-OpenCV/env/lib/python3.10/site-packages/pip/_internal/cli/base_command.pyr.   /   s*   

zCommand.__init__c                 C   s   d S Nr>   )r9   r>   r>   r?   r8   M      zCommand.add_optionsoptionsc                 C   s   t |drJ dS )zf
        This is a no-op so that commands by default do not do the pip version
        check.
        no_indexN)hasattr)r9   rB   r>   r>   r?   handle_pip_version_checkP   s   z Command.handle_pip_version_checkargsc                 C   s   t r@   )NotImplementedError)r9   rB   rF   r>   r>   r?   runY   rA   zCommand.runc                 C   s   | j |S r@   )r0   
parse_argsr9   rF   r>   r>   r?   rI   \   s   zCommand.parse_argsc                 C   sV   z%|    | |W  d    W t  S 1 sw   Y  W t  d S t  w r@   )main_context_mainloggingshutdownrJ   r>   r>   r?   main`   s   

zCommand.mainc              	      s>  |  t | _|  t  | |\}}|j|j | _t| j|j|j	d |j
r-dtjd< |jr9d|jtjd< |jrL| jsLt sLtd tt |jrdt|j|_t|jsdtd|j d |_d|jv rntd	 d
tdtf dtdtf f fdd}z|js|| j}n| j}|||W |  | S |  | w )N)	verbosityno_coloruser_log_file1PIP_NO_INPUTr(   PIP_EXISTS_ACTIONz2Could not find an activated virtualenv (required).zThe directory '%s' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.z2020-resolverz--use-feature=2020-resolver no longer has any effect, since it is now the default dependency resolver in pip. This will become an error in pip 21.0.run_func.r'   c                    s&   t  dtdtf fdd}|S )NrF   r'   c                     s  z|  }t |tsJ |W S  ty/ } ztd| tjddd tW  Y d }~S d }~w tyP } ztt	| tjddd t
W  Y d }~S d }~w ttttfyu } ztt	| tjddd tW  Y d }~S d }~w ty } ztd| tjddd tW  Y d }~S d }~w ty   tdtjd  tjkrtjtjd t Y S  ty   td tjddd t Y S  ty   tjd	dd t Y S w )
Nz[present-diagnostic] %szException information:T)exc_infoz%sz ERROR: Pipe to stdout was broken)filezOperation cancelled by userz
Exception:)
isinstanceintr   loggererrordebugr   r   criticalstrr   r   r   r   r   r   r   printsysstderrrM   DEBUG	traceback	print_excKeyboardInterruptBaseExceptionr   )rF   statusexc)level_numberrV   r>   r?   exc_logging_wrapper   sT   

zLCommand._main.<locals>.intercepts_unhandled_exc.<locals>.exc_logging_wrapper)	functoolswrapsr   rZ   )rV   rk   rj   )rV   r?   intercepts_unhandled_exc   s   0z/Command._main.<locals>.intercepts_unhandled_exc)!enter_contextr   r   rI   verbosequietrP   r   rQ   logno_inputosenvironexists_actionjoinrequire_venvr#   r   r[   r^   ra   exitr   	cache_dirr   r   warningfeatures_enabledr   rZ   
debug_moderH   rE   )r9   rF   rB   ro   rH   r>   rn   r?   rL   g   sP   







6
zCommand._main)F)r'   N)__name__
__module____qualname__r"   r_   __annotations__r#   boolr.   r8   r   rE   r   rZ   rH   r   rI   rO   rL   __classcell__r>   r>   r<   r?   r    +   s   
  
	")7r/   rl   rM   logging.configr2   ru   ra   rd   r   typingr   r   r   r   r   pip._internal.clir   !pip._internal.cli.command_contextr	   pip._internal.cli.parserr
   r   pip._internal.cli.status_codesr   r   r   r   pip._internal.exceptionsr   r   r   r   r   r   r   pip._internal.utils.filesystemr   pip._internal.utils.loggingr   r   pip._internal.utils.miscr   r   pip._internal.utils.temp_dirr   TempDirRegistryr   r   pip._internal.utils.virtualenvr   __all__	getLoggerr   r[   r    r>   r>   r>   r?   <module>   s0    $	
