
    ^ji                        d Z ddlZddlZddlmZ ddl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mZ dd
lmZmZmZmZmZ ddlmZmZ ddlmZ ddl m!Z!m"Z"m#Z# ddl$m%Z% ddlm&Z& ddl'm(Z(m)Z)m*Z* ddl+m,Z, ddl-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3 dZ4dZ5d Z6d Z7	 	 	 dtdZ8 e8dd      d        Z9 e8d      d        Z: e8d      dud       Z; e8d       d!        Z< G d" d#e      Z= e8d$d%      d&        Z> G d' d(e.      Z? e8d)dd*      d+        Z@ e8d,dd-      d.        ZA G d/ d0e      ZB e8d)      d1        ZC G d2 d3e      ZD G d4 d5e      ZE G d6 d7e      ZF e8d)dd*      d8        ZG G d9 d:e.e      ZH e8d;d<      d=        ZId> ZJ G d? d@e      ZK G dA dBeK      ZL G dC dDe3      ZM G dE dFe      ZNdG ZOdH ZP e8dI      dJ        ZQ e8dK      dL        ZRdM ZSdN ZT G dO dPe      ZU e8d;      dQ        ZV G dR dSe      ZW G dT dUee%      ZX e8dVdd*      dW        ZYdX ZZ e8dVd<      dY        Z[ eZej                  j                         eZej                  j                         eZej                  j                        e[dZZ`e;e<e>e@eAe9e:eCeGeId[
eQeQd\d] d^ d_d`eJieOePeVdadbeQidceRiddeYideeQidf dg eTdhdieTidjeSie`e`dkZadl Zb G dm dne      Zc G do dpe      Zd G dq dre      Zeds Zfy)va  
Implementations of standard library functions, because it's not possible to
understand them with Jedi.

To add a new implementation, create a function and add it to the
``_implemented`` dict at the bottom of this module.

Note that this module exists only to implement very specific functionality in
the standard library. The usual way to understand the standard library is the
compiled module that returns the types for C-builtins.
    N)debug)safe_property)get_str_or_none)iterate_argument_clinic
ParamIssuerepack_with_argument_clinicAbstractArgumentsTreeArgumentsWrapper)analysis)compiled)AnonymousMethodExecutionContextMethodExecutionContext)ContextualizedNode	NO_VALUESValueSetValueWrapperLazyValueWrapper)
ClassValueModuleValue)	Decoratee)DataclassWrapperDataclassDecoratorDataclassTransformer)FunctionMixin)iterable)LazyTreeValueLazyKnownValueLazyKnownValues)	ValueName)AttributeOverwritepublish_methodParserTreeFilter
DictFilter)SignatureWrappera  _property = property
_tuple = tuple
from operator import itemgetter as _itemgetter
from collections import OrderedDict

class {typename}(tuple):
    __slots__ = ()

    _fields = {field_names!r}

    def __new__(_cls, {arg_list}):
        'Create new instance of {typename}({arg_list})'
        return _tuple.__new__(_cls, ({arg_list}))

    @classmethod
    def _make(cls, iterable, new=tuple.__new__, len=len):
        'Make a new {typename} object from a sequence or iterable'
        result = new(cls, iterable)
        if len(result) != {num_fields:d}:
            raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result))
        return result

    def _replace(_self, **kwds):
        'Return a new {typename} object replacing specified fields with new values'
        result = _self._make(map(kwds.pop, {field_names!r}, _self))
        if kwds:
            raise ValueError('Got unexpected field names: %r' % list(kwds))
        return result

    def __repr__(self):
        'Return a nicely formatted representation string'
        return self.__class__.__name__ + '({repr_fmt})' % self

    def _asdict(self):
        'Return a new OrderedDict which maps field names to their values.'
        return OrderedDict(zip(self._fields, self))

    def __getnewargs__(self):
        'Return self as a plain tuple.  Used by copy and pickle.'
        return tuple(self)

    # These methods were added by Jedi.
    # __new__ doesn't really work with Jedi. So adding this to nametuples seems
    # like the easiest way.
    def __init__(self, {arg_list}):
        'A helper function for namedtuple.'
        self.__iterable = ({arg_list})

    def __iter__(self):
        for i in self.__iterable:
            yield i

    def __getitem__(self, y):
        return self.__iterable[y]

{field_defs}
zW    {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}')
c                       fd}|S )Nc                      fd}	  j                   j                  } j                  }||j                         rd}n*|!|j	                         r|j                         }n |       S  j                         s j                         r |       S 	 t        |   |   } | |      S # t        $ r	 Y  |       S w xY w# t        $ r	 Y  |       S w xY w)Nc                              S )N	arguments )r)   callbackvalues   L/opt/ringagent/.cad-venv/lib/python3.12/site-packages/jedi/plugins/stdlib.pycallz&execute.<locals>.wrapper.<locals>.calln   s    EY77    builtins)r)   r+   )namestring_nameparent_contextis_builtins_module	is_module
py__name__is_bound_methodis_instance_implementedKeyErrorAttributeError)r,   r)   r.   obj_namepmodule_namefuncr+   s   ``     r-   wrapperzexecute.<locals>.wrapperm   s    	8	Gzz--H $$A}!5!5!7(1;;=llnv$$&%*;*;*= vG#K0: EYFF   v	'  	, v/	s#   C B, ,	B>=B>	CCr*   )r+   r@   s   ` r-   executerA   l   s    > Nr/   c                     	 t        |j                               |   \  }}|j                         S # t        $ r	 t        cY S w xY wN)listunpackinfer
IndexErrorr   )inference_stater)   indexkey
lazy_values        r-   _follow_paramrL      sK    "y//1259Z !!  s   1 AAc                 &      fd}|S )zL
    Works like Argument Clinic (PEP 436), to validate function params.
    c                        fd}|S )Nc                 Z   	 t        t        | j                  |            }t        j                  d| z  d       i }
r|j                  |d<   r| |d<   r| j                  |d<   r||d<   	r||d<    |i |}t        j                  d	|d       |S # t        $ r	 t        cY S w xY w)
Nzbuiltin start %sMAGENTA)colorcontextr,   rH   r)   r+   zbuiltin end: %s)tupler   rH   r   r   r   dbgrR   )r,   r)   r+   argskwargsresultclinic_stringr?   want_argumentswant_callbackwant_contextwant_inference_state
want_values         r-   r@   z+argument_clinic.<locals>.f.<locals>.wrapper   s    !4))9mE F
 II(50	BF$-$5$5y!"'w#,1,A,A()&/{#%-z"4*6*FII'yAM#  !  !s    B B*)B*r*   )r?   r@   rX   rY   rZ   r[   r\   r]   s   ` r-   fzargument_clinic.<locals>.f   s    	 	. r/   r*   )rX   r]   r[   rY   r\   rZ   r^   s   `````` r-   argument_clinicr_      s     2 Hr/   ziterator[, default], /T)r\   c                 F    || j                  d      j                         z  S )N__next__py__getattribute__execute_with_values)	iteratorsdefaultsrH   s      r-   builtins_nextrg      s#     i22:>RRTTTr/   c                 @    | j                  d      j                         S )N__iter__rb   )iterators_or_callablesrf   s     r-   builtins_iterrk      s     "44Z@TTVVr/   zobject, name[, default], /c                     | D ]@  }|D ]9  }t        |      }|t        j                  d       &|j                  |      c c S  B t        S )Nzgetattr called without str)r   r   warningrc   r   )objectsnamesrf   r,   r1   strings         r-   builtins_getattrrq      sZ      8 	8D$T*F~:;//77	88 r/   zobject[, bases, dict], /c                 6    |s|rt         S | j                         S rC   )r   py__class__)rn   basesdictss      r-   builtins_typerv      s    ""$$r/   c                   *    e Zd ZdZd Zd Zd ZddZy)SuperInstancez-To be used like the object ``super`` returns.c                      || _         || _        y rC   )rH   	_instance)selfrH   instances      r-   __init__zSuperInstance.__init__   s    .!r/   c                 R    | j                   j                         j                         S rC   )rz   rs   py__bases__r{   s    r-   
_get_baseszSuperInstance._get_bases   s    ~~))+7799r/   c                     | j                         d   j                         j                         }|s| j                  S t	        t        |            S )Nr   )r   rF   rd   rz   nextiter)r{   objss     r-   _get_wrapped_valuez SuperInstance._get_wrapped_value   sC     #))+??A >>!DJr/   Nc              #      K   | j                         D ]>  }|j                         j                         D ]  }|j                         D ]  }|   @ y wrC   )r   rF   rd   get_filters)r{   origin_scopebr,   r^   s        r-   r   zSuperInstance.get_filters   sW     " 	A668 **, AG	s   AArC   )__name__
__module____qualname____doc__r}   r   r   r   r*   r/   r-   rx   rx      s    7": r/   rx   z[type[, value]], /)r[   c                     d }t        |t              r|j                  }nt        |t              r|j                  }|t        S t        t        |j                  |      h      S rC   )
isinstancer   r|   r   r   r   rx   rH   )typesrn   rR   r|   s       r-   builtins_superr      sZ    H':;##	G3	4##]8#;#;XFGHHr/   c                   B     e Zd Z fdZddZ ed      d        Z xZS )ReversedObjectc                 2    t         |   |       || _        y rC   )superr}   
_iter_list)r{   reversed_obj	iter_list	__class__s      r-   r}   zReversedObject.__init__  s    &#r/   c                     | j                   S rC   )r   )r{   contextualized_nodes     r-   
py__iter__zReversedObject.py__iter__  s    r/   ra   c                 N    t        j                  d | j                  D              S )Nc              3   <   K   | ]  }|j                           y wrC   rF   .0rK   s     r-   	<genexpr>z'ReversedObject._next.<locals>.<genexpr>  s      "
#-J"
   )r   	from_setsr   r{   r)   s     r-   _nextzReversedObject._next  s&    !! "
15"
 
 	
r/   rC   )r   r   r   r}   r   r!   r   __classcell__r   s   @r-   r   r     s&    $ J
  
r/   r   zsequence, /r]   rY   c           
         t        |j                               \  }}d }t        |t              r t	        |j
                  |j                        }t        | j                  |            }|j                  j                  j                  d      j                         \  }t        t        |t        t        |                  g      S )NIterator)r   rE   r   r   r   rR   datarD   iteraterH   typing_modulerc   rd   r   r   reversed)	sequencesr,   r)   rJ   rK   cnorderedseqs           r-   builtins_reversedr     s    
 9++-.OC	B*m,
 2 2JOOD9$$R()G   ..AA*MaacDC^Chw.?)@ABCCr/   zvalue, type, /)rY   r\   c                 $   t               }| D ]N  }|j                         }	 |j                   t	        |j                               |D ]  }|j                         r|j                  |v        (|j                  j                  dk(  rl|j                         j                         rNt        j                  d |j                         D              }|j                  t        fd|D                     t	        |j!                               d   \  }	}
t#        |
t$              s|
j&                  }d|z  }t)        j                  |
j*                  d||        Q t        fd	|D              S # t        $ r t        ddg      }Y  -w xY w)
NTFrS   c              3   <   K   | ]  }|j                           y wrC   r   r   s     r-   r   z&builtins_isinstance.<locals>.<genexpr>;  s!      -" $$&-r   c              3   &   K   | ]  }|v  
 y wrC   r*   )r   clsmros     r-   r   z&builtins_isinstance.<locals>.<genexpr>?  s     $CCSCZ$Cs      z[TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types, not %s.ztype-error-isinstancec              3   \   K   | ]#  }t        j                  t        |             % y wrC   )r   builtin_from_namestr)r   r   rH   s     r-   r   z&builtins_isinstance.<locals>.<genexpr>I  s*       	""?CF;s   ),)setrs   r   r;   rD   	py__mro__is_classaddr1   r2   get_root_contextr4   r   r   r   anyrE   r   r   r   r   rR   )rn   r   r)   rH   bool_resultsor   
cls_or_tupclasses_rK   nodemessager   s      `         @r-   builtins_isinstancer   %  sw   5L ]mmo	OO 3==?# 	]J""$  s!23,,7"335HHJ",, -&0&8&8&:-    $C7$C!CD $Y%5%5%7 8 ;:j-8%??D(*45G LL!3!35LdT[\%	]]B    ;  	 e}-L	s   E55FFc                       e Zd Zd Zy)StaticMethodObjectc                 .    t        | j                  g      S rC   )r   _wrapped_valuer{   r|   class_values      r-   	py__get__zStaticMethodObject.py__get__P  s    ,,-..r/   Nr   r   r   r   r*   r/   r-   r   r   O  s    /r/   r   c                 &    t        d | D              S )Nc              3   2   K   | ]  }t        |        y wrC   )r   )r   r^   s     r-   r   z(builtins_staticmethod.<locals>.<genexpr>V  s     =a&q)=   r   )	functionss    r-   builtins_staticmethodr   T  s    =9===r/   c                   $     e Zd Z fdZd Z xZS )ClassMethodObjectc                 2    t         |   |       || _        y rC   r   r}   	_function)r{   class_method_objfunctionr   s      r-   r}   zClassMethodObject.__init__Z  s    )*!r/   c           
          t        | j                  j                  d      D cg c]  }t        ||| j                         c}      S c c}w )N__get__)r   r   rc   ClassMethodGetr   )r{   r|   r   r   s       r-   r   zClassMethodObject.py__get__^  sH    ..AA)L
 7K@
  	 
s   A)r   r   r   r}   r   r   r   s   @r-   r   r   Y  s    "r/   r   c                   *     e Zd Z fdZd Zd Z xZS )r   c                 @    t         |   |       || _        || _        y rC   )r   r}   _classr   )r{   
get_methodklassr   r   s       r-   r}   zClassMethodGet.__init__f  s    $!r/   c                     | j                   j                         D cg c]  }|j                  | j                          c}S c c}w rC   )r   get_signaturesbind)r{   sigs     r-   r   zClassMethodGet.get_signaturesk  s0    48NN4Q4Q4STS(TTTs   "Ac                 `    | j                   j                  t        | j                  |            S rC   )r   rA   ClassMethodArgumentsr   r   s     r-   
py__call__zClassMethodGet.py__call__n  s#    ~~%%&:4;;	&RSSr/   )r   r   r   r}   r   r   r   r   s   @r-   r   r   e  s    "
UTr/   r   c                   &     e Zd Z fdZddZ xZS )r   c                 2    t         |   |       || _        y rC   )r   r}   r   )r{   r   r)   r   s      r-   r}   zClassMethodArguments.__init__s  s    #r/   c              #      K   d t        | j                        f | j                  j                  |      D ]  }|  y wrC   )r   r   _wrapped_argumentsrE   )r{   r?   valuess      r-   rE   zClassMethodArguments.unpackw  s?     N4;;///--44T: 	FL	s   ?ArC   )r   r   r   r}   rE   r   r   s   @r-   r   r   r  s    r/   r   c                 L     t         fd|j                  |      D              S )Nc              3   D   K   | ]  }D ]  }t        ||         y wrC   )r   )r   class_method_objectr   r   s      r-   r   z'builtins_classmethod.<locals>.<genexpr>  s6      !  	-x88    r(   r   r   )r   r,   r)   s   `  r-   builtins_classmethodr   }  s+     #(#3#3i#3#H  r/   c                   p     e Zd ZdZ fdZd Z ed       ed       ed      d                      Z xZS )PropertyObjectpropertyc                 2    t         |   |       || _        y rC   r   )r{   property_objr   r   s      r-   r}   zPropertyObject.__init__  s    &!r/   c                 T    |t        | g      S | j                  j                  |      S rC   )r   r   rd   r   s      r-   r   zPropertyObject.py__get__  s*    TF##~~11(;;r/   deletergettersetterc                     t        | h      S rC   r   r   s     r-   _return_selfzPropertyObject._return_self  s     r/   )	r   r   r   api_typer}   r   r!   r  r   r   s   @r-   r   r     sE    H"<
 IHH     r/   r   func, /)rZ   c                 6     t         fd |       D              S )Nc              3   D   K   | ]  }D ]  }t        ||         y wrC   )r   )r   property_valuer   r   s      r-   r   z$builtins_property.<locals>.<genexpr>  s5      !  	~x00r   r   )r   r+   s   ` r-   builtins_propertyr    s     &j  r/   c                    | j                   }d}t        ||d      D ]  }t        |      }||} n t        ||d      }|st        S t	        |      d   }t        |      }	|	!|	j                  dd      j                         }
npt        |t        j                        rP|j                         D cg c]"  }|j                         D ]  }t        |       $ }
}}|
D cg c]  }||	 }
}nt        S t        j                  |t        |
      t        |
      t!        t        |
            j                  dd      dd dd	j#                  d
 t%        |
      D                    }|j&                  j)                  |      }t+        |j-                               }t/        ||t1        j2                  |d            j5                         }t7        t9        |||      g      S c c}}w c c}w )z
    Implementation of the namedtuple function.

    This has to be done by processing the namedtuple class template and
    inferring the result.

    jedi_unknown_namedtupler   r   , ' 
c              3   P   K   | ]  \  }}t         j                  ||          yw))rI   r1   N)_NAMEDTUPLE_FIELD_TEMPLATEformat)r   rI   r1   s      r-   r   z)collections_namedtuple.<locals>.<genexpr>  s/      C!, 8>>UQU>V Cs   $&)typenamefield_names
num_fieldsarg_listrepr_fmt
field_defsT)keepends)
code_lines)rH   rL   r   r   rD   replacesplitr   r   Sequencer   rF   _NAMEDTUPLE_CLASS_TEMPLATEr  rS   lenreprjoin	enumerategrammarparser   iter_classdefsr   parsosplit_lines
as_contextr   r   )r,   r)   r+   rH   r1   cxparam_values_fieldsrp   fieldsrK   vr^   codemodulegenerated_classr3   s                     r-   collections_namedtupler7    s    ++O %D?Iq9 A=D	 !)Q?L< #GW%FS)//1	GX..	/ &002
%%'
  A

 

 $5q}!55 &,,&Mv;eFm$,,S"5a;99 C09&0AC C - D $$**40F60023O $$TD9 jl 
 ZQRSS9

 6s   0'G G&&G&c                   >     e Zd Zd fd	Zd Zd Zd Zd Zd Z xZ	S )PartialObjectc                 @    t         |   |       || _        || _        y rC   )r   r}   
_argumentsrz   )r{   actual_valuer)   r|   r   s       r-   r}   zPartialObject.__init__  s    &#!r/   c                     t        |d      \  }}||!t        j                  d| j                         y |j	                         S )N)NNz(Partial should have a proper function %s)r   r   rm   r;  rF   )r{   unpacked_argumentsrJ   rK   s       r-   _get_functionszPartialObject._get_functions  sB    1<@Z?j0MMDdooV!!r/   c                 6   | j                   j                         }| j                  |      }|g S d}| j                  d}t	               }|D ]  \  }}||dz  }|j                  |         |j                         D cg c]  }t        |||       c}S c c}w )Nr   r   )r;  rE   r?  rz   r   r   r   PartialSignature)r{   r>  funcs	arg_countkeysrJ   r   ss           r-   r   zPartialObject.get_signatures  s    !__335##$67=I	>>%Iu( 	FC{Q			
 ?D>R>R>TU It4UUUs   ?Bc                     | j                  | j                  j                               }|t        S |j	                  t        | j                  || j                              S rC   )r?  r;  rE   r   rA   MergedPartialArgumentsrz   )r{   r)   rB  s      r-   r   zPartialObject.py__call__  sO    ##DOO$:$:$<==}}"4??It~~N
 	
r/   c                     | j                  | j                  j                               }|y|D ]  }|j                         c S  y)z
        In CPython partial does not replace the docstring. However we are still
        imitating it here, because we want this docstring to be worth something
        for the user.
        r  )r?  r;  rE   	py__doc__)r{   	callables	callable_s      r-   rI  zPartialObject.py__doc__  sK     ''(>(>(@A	" 	)I&&((	)r/   c                     t        | g      S rC   r   r   s      r-   r   zPartialObject.py__get__  s    r/   rC   )
r   r   r   r}   r?  r   r   rI  r   r   r   s   @r-   r9  r9    s"    "
"V"
 r/   r9  c                       e Zd Zd Zy)PartialMethodObjectc                 t    |t        | g      S t        t        | j                  | j                  |      g      S rC   )r   r9  r   r;  r   s      r-   r   zPartialMethodObject.py__get__  s6    TF##t':':DOOXVWXXr/   Nr   r*   r/   r-   rN  rN    s    Yr/   rN  c                   &     e Zd Z fdZddZ xZS )rA  c                 @    t         |   |       || _        || _        y rC   )r   r}   _skipped_arg_count_skipped_arg_set)r{   wrapped_signatureskipped_arg_countskipped_arg_setr   s       r-   r}   zPartialSignature.__init__  s!    *+"3 /r/   c                     | j                   j                         | j                  d  }|D cg c]  }|j                  | j                  vs| c}S c c}w rC   )_wrapped_signatureget_param_namesrR  r2   rS  )r{   resolve_starsro   ns       r-   rY  z PartialSignature.get_param_names!  sI    ''779$:Q:Q:RS OaAMM9N9N$NOOOs   A
A)F)r   r   r   r}   rY  r   r   s   @r-   rA  rA    s    0
Pr/   rA  c                       e Zd ZddZddZy)rG  Nc                 .    || _         || _        || _        y rC   )_partial_arguments_call_argumentsrz   )r{   partial_argumentscall_argumentsr|   s       r-   r}   zMergedPartialArguments.__init__'  s    "3-!r/   c              #     K   | j                   j                  |      }t        |d        | j                  d t	        | j                        f |D ]  }|  | j
                  j                  |      D ]  }|  y wrC   )r^  rE   r   rz   r   r_  )r{   funcdefunpackedkey_lazy_values       r-   rE   zMergedPartialArguments.unpack,  s     **11': 	Xt>>%t~~666& 	!N  	!"2299'B 	!N  	!s   A=A?rC   )r   r   r   r}   rE   r*   r/   r-   rG  rG  &  s    "

!r/   rG  c                 J    t        fd| j                        D              S )Nc              3   6   K   | ]  }t        |        y wrC   )r9  r   r|   r)   s     r-   r   z$functools_partial.<locals>.<genexpr>:  s        	h	*   r   r,   r)   r+   s    ` r-   functools_partialrk  9  (     ((3  r/   c                 J    t        fd| j                        D              S )Nc              3   6   K   | ]  }t        |        y wrC   )rN  rh  s     r-   r   z*functools_partialmethod.<locals>.<genexpr>A  s        	Hi0ri  r   rj  s    ` r-   functools_partialmethodro  @  rl  r/   zfirst, /c                     | S rC   r*   )firstss    r-   _return_first_paramrr  G  s    Mr/   r   c                 :    t        j                  d | D              S )Nc              3   f   K   | ])  }|j                         D ]  }|j                           + y wrC   )r   rF   )r   sequencerK   s      r-   r   z!_random_choice.<locals>.<genexpr>N  s?      "--/  	s   /1)r   r   )r   s    r-   _random_choicerv  L  s"     !  r/   c                    t        | j                  |d      D ]a  }|j                         r6t        | t              r| j
                  nd}t        t        ||      g      c S t        t	        | |d      g      c S  t        S )z
    Decorator entry points for dataclass.

    1. dataclass decorator declaration with parameters
    2. dataclass semantics on a class from a dataclass(-like) decorator
    r   Tr)   default_init)	rL   rH   r   r   r   init_param_moder   r   r   )r,   r)   r+   r.  should_generate_inits        r-   
_dataclassr|  U  s     500)Q? ::<
 e%78 %%  ! -a1EFGHH &"+%) 0 r/   c                 J   t        | j                  |d      D ]  }|j                         r|| j                  j                  dk(  xr$ t        | t               xr t        | t               }|rt        t        |      g      c S | j                  }t        t        ||      g      c S |j                         rt        t        | |d      g      c S t        | t              r.t        t        | || j                  j                        g      c S t        | g      c S  t        S )aU  
    Decorator entry points for dataclass_transform.

    1. dataclass-like decorator instantiation from a dataclass_transform decorator
    2. dataclass_transform decorator declaration with parameters
    3. dataclass-like decorator declaration with parameters
    4. dataclass-like semantics on a class from a dataclass-like decorator
    r   dataclass_transformTrx  )rL   rH   r   r1   r2   r   r   r   r   r   rz  r   is_functionr   r   )r,   r)   r+   r.  is_dataclass_transformr{  s         r-   _dataclass_transformr  w  s.    500)Q? 3%::<

&&*?? > #5)44> #5*<== # &!5a!8 9:: (-'<'<$!1!5I!J KLL]]_ &"+%)  ui( &"+%*%9%9%I%I  UG$$g3%h r/   c                   :     e Zd Z fdZ ed      d        Z xZS )ItemGetterCallablec                 2    t         |   |       || _        y rC   )r   r}   _args_value_set)r{   r|   args_value_setr   s      r-   r}   zItemGetterCallable.__init__  s    "-r/   zitem, /c                    t         }| j                  D ]  }t        |j                               }t	        |      dk(  r'||j                  |d   j                         d       z  }Q|t        t        j                  | j                  j                  |D cg c]+  }t        |j                  |j                         d             - c}      g      z  } |S c c}w )Nr   r   )r   r  rD   r   r$  get_itemrF   r   r   FakeListr   rH   r   )r{   item_value_set	value_set
args_valuelazy_valuesrK   s         r-   r   zItemGetterCallable.py__call__  s    	.. 	Jz4467K;1$^44[^5I5I5KTRR	Xx'8'8''77 +6& ((?(?
@P@P@RTX(YZ( '  		 s   0C)r   r   r   r}   r   r   r   r   s   @r-   r  r    s!    . !+ ,r/   r  c                 &    t        d | D              S )Nc              3   2   K   | ]  }t        |        y wrC   )WrapsCallable)r   r?   s     r-   r   z#_functools_wraps.<locals>.<genexpr>  s     :DM$':r   r   )rB  s    r-   _functools_wrapsr    s    :E:::r/   c                   (    e Zd Z ed      d        Zy)r  r  c           	      f    t        |D ch c]  }t        || j                         c}      S c c}w rC   )r   Wrappedr   )r{   rB  r?   s      r-   r   zWrapsCallable.py__call__  s(    Nt':':;NOONs   .N)r   r   r   r   r   r*   r/   r-   r  r    s     !+P ,Pr/   r  c                   4     e Zd Z fdZed        Zd Z xZS )r  c                 2    t         |   |       || _        y rC   )r   r}   _original_function)r{   r?   original_functionr   s      r-   r}   zWrapped.__init__  s    "3r/   c                 .    | j                   j                  S rC   )r  r1   r   s    r-   r1   zWrapped.name  s    &&+++r/   c                     | gS rC   r*   r   s    r-   get_signature_functionszWrapped.get_signature_functions  s	    vr/   )r   r   r   r}   r   r1   r  r   r   s   @r-   r  r    s!    4 , ,r/   r  z*args, /c           	      p    t        |j                  |      D cg c]  }t        ||        c}      S c c}w rC   )r   r   r  )r  r,   r)   r|   s       r-   _operator_itemgetterr    s<    ((3 	8^4   s   3c                 4     t        ddd       fd       }|S )Nz	string, /Tr   c                 \      fd}t         |             }|r|S |j                  |      S )Nc               3      K   D ]:  } t        |       }| |      }t        j                  | j                  |       < y wrC   )r   r   create_simple_objectrH   )r,   rE  r?   stringss     r-   r   z?_create_string_input_function.<locals>.wrapper.<locals>.iterate  sI       R#E*=QA"778M8MqQQ	Rs
   A-Ar   )r  r,   r)   r   r   r?   s   `    r-   r@   z._create_string_input_function.<locals>.wrapper  s0    	R ')$M	**r/   )r_   r?   r@   s   ` r-   _create_string_input_functionr    s&    [T$G
+ H
+ Nr/   c                    t        |       dk(  rd}| \  }d}|j                         D ]u  }|j                         }t        |      dk7  r  |       S t        t	        t        |                  }|  |       S |s|t        j                  j                  z  }||z  }d}w t        t        j                  |j                  |      g      S  |       S )Nr   r  TF)r$  r   rF   r   r   r   ospathsepr   r   r  rH   )args_setr+   rp   ru  is_firstrK   string_valuesrE  s           r-   _os_path_joinr    s    
8}	"--/ 	_J&,,.M=!Q& :  T-%8 9:Ay : "''++%aKFH	_ X::8;S;SU[\]^^:r/   )dirnameabspathrelpathr&  )
getattrtyper   r   r   r   r   staticmethodclassmethodr   )copydeepcopyc                     t         S rC   r   rj  s      r-   <lambda>r  1  s    9 r/   c                     t         S rC   r  rj  s      r-   r  r  2  s    I r/   )loadloads
namedtuple)partialpartialmethodwrapsproxychoice
itemgetterabstractmethodc                     t         S rC   r  rj  s      r-   r  r  N  s    Y r/   c                     t         S rC   r  rj  s      r-   r  r  Q  s    	 r/   )_aliasruntime_checkabler~  r~  	dataclass)r0   r  jsoncollections	functools_weakrefrandomoperatorabctypingtyping_extensionsdataclasses	posixpathntpathc                       fd}|S )Nc                 `   |D ]  }|j                         dk(  s|j                         j                         dk(  s9t        | j                               }t	        |j                         D ci c]#  }|j                  t        | |      j                  % c}      gc S   | ||      S c c}w )NEnumMetaenum)r3   )	r6   r   r"   r-  r#   r   r2   EnumInstancer1   )r   metaclassesr8   	metaclassfilter_r1   r?   s         r-   r@   z&get_metaclass_filters.<locals>.wrapperc  s    $ 	I##%3!224??AVK*#..:JK" ' 0$ $$l3&=&B&BB$   		 Ck22	$s   .(B+
r*   r  s   ` r-   get_metaclass_filtersr  b  s    	3 Nr/   c                   0    e Zd Zd Zed        Zd ZddZy)r  c                 x    |j                   | _         || _        || _        | j                  j                  | _        y rC   )rH   _cls_name	tree_name	tree_node)r{   r   r1   s      r-   r}   zEnumInstance.__init__q  s/    "22	
--r/   c                 B    t        | | j                  j                        S rC   )r   r  r  r   s    r-   r1   zEnumInstance.namew  s    tzz3344r/   c                    | j                   j                  }|j                  d      r|j                  d      s| j                   j                  dk(  rY| j                   j                         }|rt        t        |            S | j                  j                  j                  d      \  }|S | j                  j                         \  }|S )N__r   object)r  r2   
startswithendswithr  rF   r   r   rH   builtins_modulerc   r  rd   )r{   r[  inferredr   r,   s        r-   r   zEnumInstance._get_wrapped_value{  s    JJ""<<!**T"2djj6I6IZ6Wzz'')HDN++%%55HHRBAH..0r/   Nc              #     K   t        t        t        j                  | j                  | j
                  j                        j                  | j
                               | j                         j                         D ]  }|  y w)N)r1   r,   )
r#   dictr   r  rH   r  r2   r1   r   r   )r{   r   r^   s      r-   r   zEnumInstance.get_filters  so     ..t/C/CTZZE[E[\aa**
  	 ((*668 	AG	s   BB	rC   )r   r   r   r}   r   r1   r   r   r*   r/   r-   r  r  p  s%    . 5 5
r/   r  c                       e Zd Zd Zy)TupleClassWrapperc                 V    | j                   j                         j                  ||      S rC   )rH   typing_tuplepy__getitem__r{   index_value_setr   s      r-   r  zTupleClassWrapper.py__getitem__  s*    ##002@@
 	
r/   Nr   r   r   r  r*   r/   r-   r  r        
r/   r  c                       e Zd Zd Zy)TypeClassWrapperc                 V    | j                   j                         j                  ||      S rC   )rH   typing_typer  r  s      r-   r  zTypeClassWrapper.py__getitem__  s*    ##//1??
 	
r/   Nr  r*   r/   r-   r  r    r  r/   r  c                       fd}|S )Nc                 6   |j                   dk(  rZ|j                         rJ|j                         dv r8t        t	        j
                  | t        j                  j                        h      S |j                   dk(  rD|j                         r4|j                         dk(  r! | ||      \  }t        t        |      g      S |j                   dk(  rD|j                         r4|j                         dk(  r! | ||      \  }t        t        |      g      S  | ||      S )Nr  )r  r  rS   r0   r  )r,   r5   r6   r   r   r  r  r  r  r  r  )rH   rR   r  tupr?   s       r-   r@   z$tree_name_to_values.<locals>.wrapper  s    ??e#%%'G,>,>,@D[,[--orww{{K   ??g%%%'G,>,>,@J,N)<DC.s3455??f$%%'G,>,>,@J,N)<DC-c2344OWi88r/   r*   r  s   ` r-   tree_name_to_valuesr    s    9 Nr/   )FFFFFrC   )gr   r+  r  jedir   jedi.inference.utilsr   jedi.inference.helpersr   jedi.inference.argumentsr   r   r   r	   r
   jedi.inferencer   r   jedi.inference.value.instancer   r   jedi.inference.base_valuer   r   r   r   r   jedi.inference.valuer   r   jedi.inference.value.decoratorr   jedi.inference.value.klassr   r   r   jedi.inference.value.functionr   r   jedi.inference.lazy_valuer   r   r   jedi.inference.namesr   jedi.inference.filtersr    r!   r"   r#   jedi.inference.signaturer$   r#  r  rA   rL   r_   rg   rk   rq   rv   rx   r   r   r   r   r   r   r   r   r   r   r   r  r7  r9  rN  rA  rG  rk  ro  rr  rv  r|  r  r  r  r  r  r  r  r  r  r  r  r  _path_overridesr9   r  r  r  r  r  r*   r/   r-   <module>r     sV  
  	  . 2I I # #<8 8 8 4 
 8 )  *! ! 59 v 
 F" CH?D"' F )EU FU )*W +W
 -.
 /
 +,% -%$ 0 %D9I :I
' 
 4ED FD$ !$TR& S&R/ /
 >  >	 	
T\ 
T/  4E F '  & $/ 07Tt5 L 5 pY- YP' P!. !&    D=@ 0 ; ;PL P
lM 
 TB C  40 1, -RWW__=,RWW__=,RWW__=	 $%)-+% $'
 ==
 	, %0! 	$ 	. 	* 	- ? J3
 	3 	Z !@F# B
 

| 
r/   