+
    eD>                     *   R t ^ RIHt ^ RIHtHtHt ^ RIHtH	t	H
t
 ^ RIHt ^ RIHtHt ^ RIHt ^ RIHtHt ^ RIHtHt ^ R	IHtHtHt ^ R
IHt ^ RIHt ^ RI H!t!H"t" ^ RI#H$t$  ! R R]4      t% ! R R]4      t& ! R R4      t' ! R R]']]	R7      t(R# )a  
Like described in the :mod:`parso.python.tree` module,
there's a need for an ast like module to represent the states of parsed
modules.

But now there are also structures in Python that need a little bit more than
that. An ``Instance`` for example is only a ``Class`` before it is
instantiated. This class represents these cases.

So, why is there also a ``Class`` class here? Well, there are decorators and
they change classes in Python 3.

Representation modules also define "magic methods". Those methods look like
``py__foo__`` and are typically mappable to the Python equivalents ``__call__``
and others. Here's a list:

====================================== ========================================
**Method**                             **Description**
-------------------------------------- ----------------------------------------
py__call__(arguments: Array)           On callable objects, returns types.
py__bool__()                           Returns True/False/None; None means that
                                       there's no certainty.
py__bases__()                          Returns a list of base classes.
py__iter__()                           Returns a generator of a set of types.
py__class__()                          Returns the class of an instance.
py__simple_getitem__(index: int/str)   Returns a a set of types of the index.
                                       Can raise an IndexError/KeyError.
py__getitem__(indexes: ValueSet)       Returns a a set of types of the index.
py__file__()                           Only on modules. Returns None if does
                                       not exist.
py__package__() -> List[str]           Only on modules. For the import system.
py__path__()                           Only on modules. For the import system.
py__get__(call_object)                 Only on instances. Simulates
                                       descriptors.
py__doc__()                            Returns the docstring for a value.
====================================== ========================================

)debug)get_cached_parent_scopeexpr_is_dottedfunction_is_property)inference_state_method_cacheCachedMetaClass&inference_state_method_generator_cache)compiled)LazyKnownValuesLazyTreeValue)ParserTreeFilter)TreeNameDefinition	ValueName)unpack_arglistValuesArguments)ValueSetiterator_to_value_set	NO_VALUESClassContext)FunctionAndClassBase)LazyGenericManagerTupleGenericManager)plugin_managerc                   X   a a ] tR t^9t oV 3R lt]R 4       t]V 3R l4       tRt	Vt
V ;t# )	ClassNamec                >   < \         SV `  W24       W@n        Wn        R # N)super__init___apply_decorators_class_value)selfclass_value	tree_namename_contextapply_decorators	__class__s   &&&&&</usr/lib/python3/dist-packages/jedi/inference/value/klass.pyr   ClassName.__init__:   s    1!1'    c              #    "   ^ RI Hp V! V P                  P                  V P                  V P                  4      pV F@  pV P
                  '       d(   VP                  RV P                  R7       Rj  xL
  K<  Vx  KB  	  R#  L5i)    )tree_name_to_valuesN)instancer#   )jedi.inference.syntax_treer-   parent_contextinference_stater$   r    	py__get__r!   )r"   r-   inferredresult_values   &   r(   inferClassName.infer?   ss      	C&//1D1DdnnV %L%%%'114TM^M^1___""	 %_s   A0B2B3Bc                   < \         SV `  pVR 8X  d4   V P                  P                  4       pVf   V# \	        V4      '       d   R# V# )functionproperty)r   api_typer$   get_definitionr   )r"   type_
definitionr'   s   &  r(   r:   ClassName.api_typeL   sG     J668J!#J// "r*   )r    r!   )__name__
__module____qualname____firstlineno__r   r   r5   r9   r:   __static_attributes____classdictcell____classcell__r'   __classdict__s   @@r(   r   r   9   s7     (
 
# 
#   r*   r   c                   T   a a ] tR t^]t oRV 3R lltR tR tR tV 3R ltRt	Vt
V ;t# )ClassFilterc                b   < \         SV `  VP                  4       VVVR 7       Wn        WPn        R# ))until_positionorigin_scopeN)r   r   
as_contextr!   _is_instance)r"   r#   node_contextrK   rL   is_instancer'   s   &&&&&&r(   r   ClassFilter.__init__^   s7    ""$l)% 	 	

 ('r*   c           
         V Uu. uF5  p\        V P                  VV P                  V P                  '       * R 7      NK7  	  up# u upi ))r#   r$   r%   r&   )r   r!   _node_contextrN   )r"   namesnames   && r(   _convert_namesClassFilter._convert_namesh   sS      
  $  --!//%)%6%6!6	
  
 	
 
s   ;Ac                    V P                   pVe;   WP                  8X  g   WP                  8X  d   R# \        V P                  V4      pK>  R# )NTF)_origin_scope_parser_scoper0   r   _parso_cache_node)r"   nodes   & r(   _equals_origin_scope ClassFilter._equals_origin_scoper   sB    !!)))T5H5H-H*4+A+A4HDr*   c                    VP                   P                  R 4      '       * ;'       g4    VP                   P                  R 4      ;'       g    V P                  4       # )__)value
startswithendswithr]   )r"   rU   s   &&r(   _access_possibleClassFilter._access_possiblez   sM    ::((.. + +$**2E2Ed2K + +((*	+r*   c                   < \         SV `  V4      pV Uu. uF  q P                  V4      '       g   K  VNK  	  up# u upi r   )r   _filterrd   )r"   rT   rU   r'   s   && r(   rg   ClassFilter._filter   s6    &!&F*?*?*EFFFs   ;;)r!   rN   )NNNF)r?   r@   rA   rB   r   rV   r]   rd   rg   rC   rD   rE   rF   s   @@r(   rI   rI   ]   s%     (
+
G Gr*   rI   c                      a  ] tR t^t o R tR tR tR t]R 4       t	R t
]! 4       R 4       tRR
 ltR tR tRR lt]! R	R7      R 4       tR tR tR tRtV tR# )
ClassMixinc                    R # T r"   s   &r(   is_classClassMixin.is_class       r*   c                    R # rl   rm   rn   s   &r(   is_class_mixinClassMixin.is_class_mixin   rq   r*   c                    ^ RI Hp ^ RIHp V P	                  4       '       d   \        V! V 4      .4      # \        V! V P                  V P                  W4      .4      # )r,   )TreeInstance)	TypedDict)jedi.inference.valuerv   jedi.inference.gradual.typingrw   is_typeddictr   r1   r0   )r"   	argumentsrv   rw   s   &&  r(   
py__call__ClassMixin.py__call__   sM    5;Yt_-..d&:&:D<O<OQUabccr*   c                D    \         P                  ! V P                  R 4      # )type)r	   builtin_from_namer1   rn   s   &r(   py__class__ClassMixin.py__class__   s    ))$*>*>GGr*   c                @    \        W P                  P                  4      # r   )r   	tree_noderU   rn   s   &r(   rU   ClassMixin.name   s    ~~2233r*   c                .    V P                   P                  # r   )rU   string_namern   s   &r(   
py__name__ClassMixin.py__name__   s    yy$$$r*   c              #  <  "   V .pV x  V P                  4        FR  pVP                  4        F;  p VP                  pV! 4        F   pWQ9  g   K  VP                  V4       Vx  K"  	  K=  	  KT  	  R#   \         d     \
        P                  ! R Y4        Kk  i ; i5i)z$Super class of %s is not a class: %sN)py__bases__r5   	py__mro__appendAttributeErrorr   warning)r"   mrolazy_clscls
mro_methodcls_news   &     r(   r   ClassMixin.py__mro__   s     f
 ((*H  ~~'*!$J $.<"-JJw/")M $0' ( + & U	 MM"H$TUs-   .BA2B#B2#BBBBNFc              #    "   V'       d2   V P                  4       pV'       d   V P                  WR4       R j  xL
  V P                  4        FS  pVP                  4       '       d   VP	                  VR7       R j  xL
  K5  \        WP                  4       VVR7      x  KU  	  V'       g   V'       d   ^ RIHp V! V P                  R4      p\        V\        4      '       g   Q hW8w  dd   \        . 4      p	VP                  V	4       FA  p
V
P	                  4       p\        VR 4       \        VR 4       \        VR 4      pVf   Q hVx  KC  	  R # R # R # R #  EL L5i)N)rP   )rO   rL   rP   )r   r   )get_metaclassesget_metaclass_filtersr   is_compiledget_filtersrI   rM   jedi.inference.compiledr   r1   
isinstance
ClassValuer   r|   next)r"   rL   rP   include_metaclassesinclude_type_when_classmetaclassesr   r   r<   argsr.   instance_filtersxs   &&&&&        r(   r   ClassMixin.get_filters   s+    ..0K55kOOO>>#C  ??{?CCC!~~'7!- + 	 $ 6A%d&:&:FCEeZ0000} 'r* % 0 0 6H'/';';'=$)40)40-t4A=(=G !7 	  7{ P Ds4    EEEAE:E;/E+E3B!EEc                $   V P                  4       pV'       d   V P                  V4      pV'       d   V# \        . 4      pV P                  V4      P	                  R 4      pVP                  4        Uu. uF  qUP                  V 4      NK  	  up# u upi )r   )r   get_metaclass_signaturesr   r|   py__getattribute__get_signaturesbind)r"   r   sigsr   
init_funcssigs   &     r(   r   ClassMixin.get_signatures   sy     **,00=Dr"__T*==jI
*4*C*C*EF*E3*EFFFs   1Bc                    \        V 4      # r   r   rn   s   &r(   _as_contextClassMixin._as_context   s    D!!r*   c                `    V'       d   R V P                  4       ,          # V P                  4       # )zType[%s])r   )r"   add_class_infos   &&r(   get_type_hintClassMixin.get_type_hint   s$     111  r*   defaultc                n   ^ RI Hp V P                  4        F  p\        V\        4      '       g    R# VP
                  p\        V4      '       g    R# VP                  4        F6  p\        WA4      '       d     R#  VP                  pV! 4       '       d     R# K8  	  K  	  R#   \         d       R# i ; i)r,   )TypedDictClassFT)
ry   r   r   r   r   datar   r5   rz   r   )r"   r   r   r   r   methods   &     r(   rz   ClassMixin.is_typeddict   s     	A((*Hh66 I "),,~~'c22	$ --F xx#   ( +.  & ! !	!s   <B##B43B4c                   a aa ^ RI Ho V'       g#   \        P                  ! R4       \	        S .4      # \	        VVV 3R lV 4       4      # )r,   GenericClassz:Class indexes inferred to nothing. Returning class insteadc           	   3   `   <"   T F#  pS! S\        SP                  VR 7      4      x  K%  	  R# 5i))context_of_indexindex_valueN)r   context).0r   r   contextualized_noder"   s   & r(   	<genexpr>+ClassMixin.py__getitem__.<locals>.<genexpr>  s=      	
  / "%8%@%@ +   /s   +.)jedi.inference.gradual.baser   r   r   r   )r"   index_value_setr   r   s   f&f@r(   py__getitem__ClassMixin.py__getitem__  s?    <MMVWTF## 	
  /	
 	
 		
r*   c                2    ^ RI Hp V! V \        V4      4      # )r,   r   )r   r   r   )r"   generics_tupler   s   && r(   with_genericsClassMixin.with_generics#  s    </
 	
r*   c                   a a ^ RI Hp V V3R lpS'       d+   \        V! S \        \	        V! 4       4      4      4      .4      # \        S 04      # )r,   r   c               3     <"   SP                  4        F)  p SP                  V P                  4       \        4      x  K+  	  R# 5i)a  
The TypeVars in the resulting classes have sometimes different names
and we need to check for that, e.g. a signature can be:

def iter(iterable: Iterable[_T]) -> Iterator[_T]: ...

However, the iterator is defined as Iterator[_T_co], which means it has
a different type var name.
N)list_type_varsgetr   r   )type_varr"   type_var_dicts    r(   remap_type_vars3ClassMixin.define_generics.<locals>.remap_type_vars-  s7      !//1#''(;(;(=yII 2s   A A)r   r   r   r   tuple)r"   r   r   r   s   ff  r(   define_genericsClassMixin.define_generics*  sL    <	J \#E/*;$<=    r*   rm   )NFTTrl   )r?   r@   rA   rB   ro   rs   r|   r   r9   rU   r   r   r   r   r   r   r   r   rz   r   r   r   rC   rD   rG   s   @r(   rj   rj      s     dH 4 4% ,-* .*@ DG"!
 "%0 1:
 
   r*   rj   c                      a  ] tR tRt o Rt]! 4       R 4       tR t]! R
R7      R 4       t]	P                  ! 4       R 4       t]! ]R7      R 4       t]	P                  ! 4       R	 4       tR
tV tR# )r   iB  classc                    . pV P                   P                  4       pVf   . # \        V4       FH  w  r4V'       d   K  ^ RIHp V! V P
                  V4       F  pWa9  g   K  VP                  V4       K  	  KJ  	  V# )N)find_unknown_type_vars)r   get_super_arglistr   !jedi.inference.gradual.annotationr   r0   r   )r"   foundargliststarsr\   r   r   s   &      r(   r   ClassValue.list_type_varsE  sn    ..224?I)'2KEP243F3FM(LL* N 3 r*   c                    V P                   P                  4       pV'       d.   ^ RIHp VP	                  V P
                  V P                  V4      # R# )r,   )r{   N)r   r   jedi.inferencer{   TreeArgumentsr1   r0   )r"   r   r{   s   &  r(   _get_bases_argumentsClassValue._get_bases_argumentsW  s?    ..2240**4+?+?ATATV]^^r*   r   c                h   V P                  4       pVe4   VP                  4        UUu. uF  w  r#Ve   K  VNK  	  pppV'       d   V# V P                  4       R8X  d#   V P                  P	                  4       '       d   . # \        V P                  P                  P                  R4      4      .# u uppi )Nobject)	r   unpackr   r0   is_builtins_moduler
   r1   builtins_moduler   )r"   r   keyra   lsts   &    r(   r   ClassValue.py__bases__^  s    ((*+/;;=H=ZSC55=CH
??(''::<<I  00CCHM
  	 Is
   B.B.c                4    \         P                  ! R V4       . # )zUnprocessed metaclass %s)r   r   )r"   r   rP   s   &&&r(   r    ClassValue.get_metaclass_filtersm  s    0+>	r*   c                   V P                  4       pVef   VP                  4        UUu. uF  w  r#VR8X  g   K  VNK  	  ppp\        P                  ! R V 4       4      p\        R V 4       4      pV'       d   V# V P	                  4        FP  pVP                  4        F9  pVP                  4       '       g   K  VP                  4       pV'       g   K5  Vu u # 	  KR  	  \        # u uppi )N	metaclassc              3   @   "   T F  qP                  4       x  K  	  R # 5ir   )r5   )r   
lazy_values   & r(   r   -ClassValue.get_metaclasses.<locals>.<genexpr>w  s     ,TRSJ-=-=-?-?RSs   c              3   T   "   T F  qP                  4       '       g   K  Vx  K   	  R # 5ir   )ro   )r   ms   & r(   r   r   x  s     "JkZZ\11ks   (
()	r   r   r   	from_setsr   r5   ro   r   r   )r"   r   r   ra   r   r   	lazy_basevaluess   &       r(   r   ClassValue.get_metaclassesr  s    ((*)-M:3#:LAM",,,TRS,TTK""Jk"JJK""))+I"*>>##"224Fv%	 + ,  Ns
   C$C$c                    . # r   rm   )r"   r   s   &&r(   r   #ClassValue.get_metaclass_signatures  s    	r*   rm   N)r?   r@   rA   rB   r:   r   r   r   r   r   decorater   r   r   r   rC   rD   r   s   @r(   r   r   B  s     H!# $" ""- .   ")4 5"  r*   r   )r   N))__doc__jedir   jedi.parser_utilsr   r   r   jedi.inference.cacher   r   r   r   r	   jedi.inference.lazy_valuer
   r   jedi.inference.filtersr   jedi.inference.namesr   r   jedi.inference.argumentsr   r   jedi.inference.base_valuer   r   r   jedi.inference.contextr   jedi.inference.value.functionr   jedi.inference.gradual.genericsr   r   jedi.pluginsr   r   rI   rj   r   rm   r*   r(   <module>r     s   %L  + + # D 3 > D  / > S '!" !H$G" $GN{  { |D1_ Dr*   