ó
ïRec @ sÊ d Z d d l Z d d l Z d d l 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 e r« d d l m Z m Z m Z m Z n d „ Z d
„ Z d „ Z d S( sB Logic that powers autocompletion installed by ``pip completion``.
iÿÿÿÿN( t chain( t create_main_parser( t
commands_dictt create_command( t get_installed_distributions( t MYPY_CHECK_RUNNING( t Anyt Iterablet Listt Optionalc C s% d t j k r d St j d j ƒ d } t t j d ƒ } y | | d } Wn t k
rh d } n Xt ƒ } t t ƒ } g } d } x$ | D] } | | k r‘ | } Pq‘ q‘ W| d k r*| d k rÙ t j
d ƒ n | d k oò | j d
ƒ } | rŽg } | j ƒ }
xO t
d t ƒ D]> } | j j |
ƒ r| j | d k r| j | j ƒ qqW| rŽx | D] } | GHqlWt j
d ƒ qŽn t | ƒ } xZ | j j D]L }
|
j t j k r§x1 |
j |
j D] } | j | |
j f ƒ qÐWq§q§Wg | d | d !D] } | j d ƒ d
^ q } g | D]$ \ } } | | k r/| | f ^ q/} g | D]' \ } } | j | ƒ r`| | f ^ q`} t | | | j j ƒ } | rÜt | | ƒ } g | D] } | d
f ^ qÁ} n x5| D]@ } | d
} | d r| d
d d k r| d 7} n | GHqãWnê g | j D] } | j ^ q4} | j | j ƒ t j | ƒ } | j d
ƒ r´xj | D]/ }
|
j t j k r~| |
j |
j 7} q~q~Wn0 t | | | ƒ } | rät t | | ƒ ƒ } n d j g | D] } | j | ƒ rñ| ^ qñƒ GHt j
d ƒ d S( s? Entry Point for completion of main and subcommand options.
t PIP_AUTO_COMPLETENt
COMP_WORDSi t
COMP_CWORDt t helpt showt uninstallt -t
local_onlyt =i i s --t ( R R (! t ost environt splitt intt
IndexErrorR t listR t Nonet syst exitt
startswitht lowerR t Truet keyt appendR t parsert option_list_allR t optparset
SUPPRESS_HELPt
_long_optst _short_optst nargst get_path_completion_typet auto_complete_pathst
option_groupst option_listR t
from_iterablet join( t cwordst cwordt currentR# t subcommandst optionst subcommand_namet wordt should_list_installedt installedt lct distt
subcommandt optt opt_strt xt prev_optst vt kt completion_typet pathst patht optiont opt_labelt it optst flattened_opts( ( s /builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/cli/autocompletion.pyt autocomplete s~
%
!114"
0c C sÌ | d k s$ | | d j d ƒ r( d Sx | D]• } | j t j k rM q/ n xt t | ƒ j d ƒ D]] } | | d j d ƒ d | k rc | j s¶ t d „ | j j d ƒ Dƒ ƒ rÀ | j Sqc qc Wq/ Wd S( sL Get the type of path completion (``file``, ``dir``, ``path`` or None)
:param cwords: same as the environmental variable ``COMP_WORDS``
:param cword: same as the environmental variable ``COMP_CWORD``
:param opts: The available options to check
:return: path completion type (``file``, ``dir``, ``path`` or None)
i R t /R i c s s | ] } | d k Vq d S( RD t filet dirN( RD RL RM ( ( t .0R> ( ( s /builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/cli/autocompletion.pys