
    5 f?              
         d Z ddlmZ ddlZddlmZmZ ddlmZ ddl	m
Z
mZmZmZmZmZmZ ddlmZ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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) e
rddl*m+Z+ eej,        ej-        ej.        ej/        f         Z0eee1         ee2         ee3         ee4         f         Z5eej6        ej7        ej8        ej,        f         Z9dZ:dZ;dZ<dYdZ=d Z>d Z?d Z@dZdZAd[dZBd\d'ZCd]d0ZDd^d2ZE eeEejF        ej7        ej8        ej,        ej-        ej.        ej/        fe13          ZG eeEej7        ejF        ej8        ej,        ej-        ej.        ej/        fe23          ZH eeEej8        ej7        ejF        ej,        ej.        fe33          ZI eeEej,        ej7        ejF        ej8        ej,        ej.        fe43          ZJd4 ZKd_d`d6ZL	 d_dad8ZMd9 ZNd_dbd:ZOd_dbd;ZPd_dbd<ZQ	 d_dcd>ZRd_dbd?ZSd_dbd@ZTd_dbdAZU	 d_dddFZVdZdGZWd_dbdHZX	 d_dedKZY	 d_dfdNZZd_dbdOZ[d_dbdPZ\d_dbdQZ]d_dbdRZ^	 d_dgdTZ_dhdUZ`	 d_didWZad[dXZbdS )jz#Astroid hooks for various builtins.    )annotationsN)CallableIterable)partial)TYPE_CHECKINGAnyIteratorNoReturnTypeUnioncast)	argumentshelpersinference_tipnodesobjectsutil)AstroidBuilder)InferenceContext)AstroidTypeErrorAttributeInferenceErrorInferenceErrorMroErrorUseInferenceDefault)AstroidManager)scoped_nodes)ConstFactoryResultInferenceResultSuccessfulInferenceResult)Instancezobject.__new__a  
class whatever(object):
    def join(self, iterable):
        return {rvalue}
    def replace(self, old, new, count=None):
        return {rvalue}
    def format(self, *args, **kwargs):
        return {rvalue}
    def encode(self, encoding='ascii', errors=None):
        return b''
    def decode(self, encoding='ascii', errors=None):
        return u''
    def capitalize(self):
        return {rvalue}
    def title(self):
        return {rvalue}
    def lower(self):
        return {rvalue}
    def upper(self):
        return {rvalue}
    def swapcase(self):
        return {rvalue}
    def index(self, sub, start=None, end=None):
        return 0
    def find(self, sub, start=None, end=None):
        return 0
    def count(self, sub, start=None, end=None):
        return 0
    def strip(self, chars=None):
        return {rvalue}
    def lstrip(self, chars=None):
        return {rvalue}
    def rstrip(self, chars=None):
        return {rvalue}
    def rjust(self, width, fillchar=None):
        return {rvalue}
    def center(self, width, fillchar=None):
        return {rvalue}
    def ljust(self, width, fillchar=None):
        return {rvalue}
a  
class whatever(object):
    def join(self, iterable):
        return {rvalue}
    def replace(self, old, new, count=None):
        return {rvalue}
    def decode(self, encoding='ascii', errors=None):
        return u''
    def capitalize(self):
        return {rvalue}
    def title(self):
        return {rvalue}
    def lower(self):
        return {rvalue}
    def upper(self):
        return {rvalue}
    def swapcase(self):
        return {rvalue}
    def index(self, sub, start=None, end=None):
        return 0
    def find(self, sub, start=None, end=None):
        return 0
    def count(self, sub, start=None, end=None):
        return 0
    def strip(self, chars=None):
        return {rvalue}
    def lstrip(self, chars=None):
        return {rvalue}
    def rstrip(self, chars=None):
        return {rvalue}
    def rjust(self, width, fillchar=None):
        return {rvalue}
    def center(self, width, fillchar=None):
        return {rvalue}
    def ljust(self, width, fillchar=None):
        return {rvalue}
returnr
   c                     t                      N)r        [/var/www/equiseq/venv/lib/python3.11/site-packages/astroid/brain/brain_builtin_inference.py_use_defaultr'      s    


r%   c                H   |                     |          }t          t                                                    |          d         }|                                D ]B}| |_        d|_        d|_        d|j        v r| g|j        d<   |g| j        |j	        <   | |_        CdS )z-Function to extend builtin str/unicode class.)rvaluewhateverN	__class__)
formatr   r   string_build	mymethodsparentlineno
col_offsetlocalsname)
class_nodecoder)   fakemethods        r&   _extend_string_classr8      s    ;;f;%%D.**++88>>zJD.."" # #" &-''*4FM+&*0
&+&"# #r%   c                    t                      j        }|                                 D ]\  }} |||                    d S r#   )r   builtins_moduleitems)class_transformsbuiltin_ast
class_name	transforms       r&   _extend_builtinsr@      sR     ""2K!1!7!7!9!9 + +
I	+j)****+ +r%   c                     t          t          t          t          d          t          t          t          d          d           dS )z"Called by astroid_bootstrapping().zb'')r5   r)   z'')bytesstrN)r@   r   r8   BYTES_CLASS	STR_CLASSr$   r%   r&   on_bootstraprF      sN    1ERRR/iMMM	
 	
    r%   boolc                   |dk    r|                                  j        dk    rt          | j        t          j                  r| j        j        dk    rt          | j        t          j                  rbt          | j        j	                  dk    rEt          | j        j	        d         t          j
                  r| j        j	        d         j        dv rdS t          | j        t          j                  r| j        j        |k    rdS t          | j        t          j                  rI| j        j        dk    o8t          | j        j        t          j                  o| j        j        j        d	k    S dS )
Ntypere   r   >   MatchPatternFTfromkeysdict)rootr3   
isinstancefuncr   Namer/   Assignlentargets
AssignName	Attributeattrnameexpr)nodebuiltin_names     r&   _builtin_filter_predicater]      s9   IIKK$$ty%*-- %INf$$t{EL11 %#$$))t{*1-u/?@@ *K"'+??? u$)UZ(( TY^|-K-Kt$)U_-- 
I*, .49>5:66.	#v-	

 5r%   managerr   Nonec                    	 ddfd
}|                      t          j        t          |          t	          t
          |                     dS )zRegister a new transform function for the given *builtin_name*.

    The transform function must accept two parameters, a node and
    an optional context.
    Nr[   
nodes.CallcontextInferenceContext | Nonekwargsr   r!   r	   c                     | |          }|rD|j         s| |_         |j        | j        |_        t          |d          r|j        | j        |_        t	          |g          S )Nrb   r1   )r/   r0   hasattrr1   iter)r[   rb   rd   resultr?   s       r&   _transform_wrapperz6register_builtin_transform.<locals>._transform_wrapper   sy     4111 	4= % !%}$ $ v|,, 41B1J$(O!VH~~r%   )r\   r#   )r[   ra   rb   rc   rd   r   r!   r	   )register_transformr   Callr   r   r]   )r^   r?   r\   rj   s    `  r&   register_builtin_transformrm      sr     >B      & 
()))EEE    r%   r[   ra   rb   rc   	node_typetype[nodes.BaseContainer]r?   ACallable[[SuccessfulInferenceResult], nodes.BaseContainer | None]nodes.BaseContainerc                   | j         }|s) || j        | j        | j        | j        | j                  S t          | j                   dk    rt                      |\  } ||          }|sr	 t          |	                    |                    }n!# t          t          f$ r}t          |d }~ww xY wt          |t          j                  rt           ||          }|rt          |t          j                  rt          |S )Nr0   r1   r/   
end_linenoend_col_offsetrK   rf   )argsr0   r1   r/   rt   ru   rU   r   nextinferr   StopIterationrQ   r   UninferableBase)	r[   rb   rn   r?   rv   argtransformedinferredexcs	            r&   _container_generic_inferencer      s#    9D 
y;;.
 
 
 	
 49~~!###FS)C..K *	/CIIgI6677HH. 	/ 	/ 	/%3.	/h 455 	&%%i)) "*[$2FGG "!!s   +#B B- B((B-r{   r   klass	iterables>tuple[type[nodes.BaseContainer] | type[ContainerObjects], ...]
build_eltsBuiltContainersnodes.BaseContainer | Nonec                   t          | |          r| S t          | |          rt          t          t          j        t
          f         |           } t          d | j        D                       rd | j        D             }ng }| j        D ]H}|st          j	        ||          }|r+t          j
        ||          }|                    |           Inqt          | t          j                  rd | j        D             }nEt          | t          j                  r)t          | j        t           t"          f          r| j        }nd S |                     ||                    S )Nc              3  J   K   | ]}t          |t          j                  V  d S r#   )rQ   r   Const.0elts     r&   	<genexpr>z/_container_generic_transform.<locals>.<genexpr>  s.      @@z#u{++@@@@@@r%   c                L    g | ]!}t          t          j        |          j        "S r$   )r   r   r   valuer   s     r&   
<listcomp>z0_container_generic_transform.<locals>.<listcomp>  s'    EEESDc**0EEEr%   rf   )originalr   c                    g | ]=}t          |d          t          j                  r|d          j        nt	                      >S )r   )rQ   r   r   r   r'   )r   items     r&   r   z0_container_generic_transform.<locals>.<listcomp>,  sK     
 
 
 (Q==QDGMM<>>
 
 
r%   )elts)rQ   r   r   r   BaseContainerContainerObjectsallr   r   
safe_inferEvaluatedObjectappendDictr;   r   r   rC   rB   from_elements)	r{   rb   r   r   r   r   elementr}   evaluated_objects	            r&   _container_generic_transformr     s    #u 
#y!! 5,.>>?EE@@sx@@@@@ 	2EECHEEEDD D8 2 2 ?7GDDD 2','<!(( ( ($ KK 01112 
C	$	$ 	
 
	
 
 
 
C	%	% *SYe*M*M ytJJt$4$4555r%   7tuple[type[nodes.NodeNG] | type[ContainerObjects], ...]c                X    t          t          ||||          }t          | |||          S )N)rb   r   r   r   )r   r   r   )r[   rb   r   r   r   transform_funcs         r&   _infer_builtin_containerr   7  s=     $  N (gunMMMr%   )r   r   r   c                   d }	 t          |                     |                    }n!# t          t          f$ r}t          |d }~ww xY wt          |t          j                  r|j        }n ||          rg }|j	        D ]} ||          st	                      t          |j	                  dk    rt	                      t          |j	        d         t          j        t          j        t          j        f          st	                      |                    t          |j	                             nt	                      |S )Nc                d    t          | t          j        t          j        t          j        f          S r#   )rQ   r   ListTupleSet)ns    r&   is_iterablez_get_elts.<locals>.is_iterablev  s    !ej%+uyABBBr%      r   )rw   rx   r   ry   r   rQ   r   r   r;   r   rU   r   r   rS   r   tuple)r{   rb   r   r}   r~   r;   r   s          r&   	_get_eltsr   u  sJ   C C C+		'**++M* + + +!s*+(EJ'' $	X		 $= 	* 	*C
 ;s## ,)+++38}}!!)+++chqkEKej+QRR ,)+++LLsx))))	* "###Ls   "( AAA
nodes.Dictc                   t           j                            | |          }|                                s|                                rt
          |j        }t          |j        	                                          }|s4|s2t          j        | j        | j        | j        | j        | j                  S |r|sd |D             }nut#          |          dk    r*|r(t%          |d         |          }d |D             }||z   }n8t#          |          dk    rt%          |d         |          }nt                      t          j        | j        | j        | j        | j        | j                  }|                    |           |S )aC  Try to infer a dict call to a Dict node.

    The function treats the following cases:

        * dict()
        * dict(mapping)
        * dict(iterable)
        * dict(iterable, **kwargs)
        * dict(mapping, **kwargs)
        * dict(**kwargs)

    If a case can't be inferred, we'll fallback to default inference.
    rf   rs   c                @    g | ]\  }}t          j        |          |fS r$   r   r   r   keyr   s      r&   r   zinfer_dict.<locals>.<listcomp>  s+    DDDzsE%+c""E*DDDr%   rK   r   c                @    g | ]\  }}t          j        |          |fS r$   r   r   s      r&   r   zinfer_dict.<locals>.<listcomp>  s+    CCCjc5S!!5)CCCr%   r1   r0   r/   rt   ru   )r   CallSite	from_callhas_invalid_argumentshas_invalid_keywordsr   positional_argumentslistkeyword_argumentsr;   r   r   r0   r1   r/   rt   ru   rU   r   postinit)	r[   rb   callrv   rd   r;   r   keysr   s	            r&   
infer_dictr     s    ''g'>>D!!## "t'@'@'B'B "!!$D$(..0011F  
 
z;;.
 
 
 	
  $d $DDVDDD	TaFa'**CCFCCCt	Ta$q'7++!###J?{{?*  E 
NN5Lr%   objects.Superc                P   t          | j                  dk    rt          |                                 }t	          |t
          j                  st          |j        dvrt          t          j	        |          }|J | j        s%|}|j        dk    r|}n|
                                }n	 t          | j        d                             |                    }n!# t          t          f$ r}t          |d}~ww xY w	 t          | j        d                             |                    }n!# t          t          f$ r}t          |d}~ww xY wt	          |t          j                  st	          |t          j                  rt          t#          j        |||||           }| |_        |S )a  Understand super calls.

    There are some restrictions for what can be understood:

        * unbounded super (one argument form) is not understood.

        * if the super call is not inside a function (classmethod or method),
          then the default inference will be used.

        * if the super arguments can't be inferred, the default inference
          will be used.
    rK   )classmethodr7   Nr   r   rf   )mro_pointermro_type
self_classscoper   )rU   rv   r   r   rQ   r   FunctionDefrI   r   get_wrapping_classinstantiate_classrw   rx   r   ry   r   rz   r   Superr/   )r[   rb   r   clsr   r   r~   	super_objs           r&   infer_superr     s    49~~!!JJLLEeU.// "!!z222!!

)%
0
0C???9 / :&&HH,,..HH	/ty|11'1BBCCKK. 	/ 	/ 	/%3.	/	/DIaL..w.??@@HH. 	/ 	/ 	/%3.	/ +t344 "
$&9 9 " "!  I Is0   *.C C7*C22C7;.D* *E;EEc                ^   t          | j                  dvrt          	 t          | j        d                             |                    }t          | j        d                             |                    }n!# t
          t          f$ r}t          |d }~ww xY wt          |t          j	                  st          |t          j	                  rt          j
        t          j
        fS t          |t          j                  ot          |j        t                    }|st          ||j        fS )N)r      r   rf   rK   )rU   rv   r   rw   rx   r   ry   rQ   r   rz   Uninferabler   r   r   rC   )r[   rb   objattrr~   	is_strings         r&   _infer_getattr_argsr     s   
49~~V##!!+49Q<%%g%6677DIaL&&w&7788M* + + +!s*+ #t+,, 2
4AU0V0V 2 !1114--M*TZ2M2MI "!!
?s   AA< <BBBc                .   t          | |          \  }}t          |t          j                  s*t          |t          j                  st	          |d          st          j        S 	 t          |                    ||                    S # t          t          t          f$ rm t          | j                  dk    rR	 t          | j        d                             |                    cY S # t          t          f$ r}t          |d}~ww xY wY nw xY wt          )zUnderstand getattr calls.

    If one of the arguments is an Uninferable object, then the
    result will be an Uninferable object. Otherwise, the normal attribute
    lookup will be done.
    igetattrrf   r   r   N)r   rQ   r   rz   rg   r   rw   r   ry   r   r   rU   rv   rx   r   )r[   rb   r   r   r~   s        r&   infer_getattrr      s%    $D'22IC3,-- dD011  sJ'' 
 3CLLwL77888>+BC 3 3 3ty>>Q3DIaL..w.??@@@@@!>2 3 3 3)s23	 3 s6   %#B	 	/D9-C)&D)D:DDDDc                   	 t          | |          \  }}t          |t          j                  s*t          |t          j                  st	          |d          st          j        S |                    ||           n;# t          $ r t          j        cY S t          $ r t          j
        d          cY S w xY wt          j
        d          S )aM  Understand hasattr calls.

    This always guarantees three possible outcomes for calling
    hasattr: Const(False) when we are sure that the object
    doesn't have the intended attribute, Const(True) when
    we know that the object has the attribute and Uninferable
    when we are unsure of the outcome of the function call.
    getattrrf   FT)r   rQ   r   rz   rg   r   r   r   r   r   r   )r[   rb   r   r   s       r&   infer_hasattrr   <  s    "'g66	TsD011	$$ 455	$ 3	**	$
 ##D'****      " " " "{5!!!!!" ;ts   A"A= %A= =B5B54B5c                   t          | j                  dk    rt          | j        d         }	 t          |                    |                    }n## t
          t          f$ r t          j        cY S w xY wt          |t          j
                  rt          j        S t          j        |                                          S )zUnderstand callable calls.

    This follows Python's semantics, where an object
    is callable if it provides an attribute __call__,
    even though that attribute is something which can't be
    called.
    rK   r   rf   )rU   rv   r   rw   rx   r   ry   r   r   rQ   rz   r   r   callable)r[   rb   argumentr}   s       r&   infer_callabler   W  s     49~~!!y|H w7788M*       (D011  ;x((**+++s   #A A21A2objects.Propertyc           	        t          | j                  dk     rt          | j        d         }	 t          |                    |                    }n!# t
          t          f$ r}t          |d}~ww xY wt          |t          j	        t          j
        f          st          t          j        ||j        | j        | j                  }| |_        |                    g |j        t%          |dd                     |S )zxUnderstand `property` class.

    This only infers the output of `property`
    call, not the arguments themselves.
    rK   r   rf   N)functionr3   r0   r1   doc_node)bodyrv   r   )rU   rv   r   rw   rx   r   ry   rQ   r   r   Lambdar   Propertyr3   r0   r1   r/   r   r   )r[   rb   getterr}   r~   	prop_funcs         r&   infer_propertyr   m  s	    49~~!!Yq\F+W5566M* + + +!s*+ h!2EL ABB "!! ]{?	  I I]:t44    
 s   #A A0#A++A0c                   t          | j                  dk    rt          | j        st          j        d          S | j        d         }	 t          |                    |                    }n## t          t          f$ r t          j
        cY S w xY wt          |t          j                  rt          j
        S |                    |          }t          |t          j                  rt          j
        S t          j        |          S )zUnderstand bool calls.rK   Fr   rf   )rU   rv   r   r   r   rw   rx   r   ry   r   r   rQ   rz   
bool_value)r[   rb   r   r}   r   s        r&   
infer_boolr     s    
49~~!!9 "{5!!!y|H w7788M*       (D011  $$W$55J*d233  ;z"""s   	#A- -BBc                    t          | j                  dk    rt          t          j        | j        d         |          S )z+Understand the one-argument form of *type*.rK   r   )rU   rv   r   r   object_typer[   rb   s     r&   
infer_typer     s4    
49~~!!ty|W555r%   c                   | j         }dt          |          cxk     rdk    s	n t          t          t          j        |          fd|D             }|D ]v}|rt          |t          j                  rt          t          |t          j	                  st          t          |j
        t          d          t          f          st          wt          |          dk     r)|                    dgdt          |          z
  z             t          j        | j        | j        | j        | j        | j                  } |j        |  |S )zUnderstand `slice` calls.r   r   rf   c                &    g | ]} |          S r$   r$   )r   r{   
infer_funcs     r&   r   zinfer_slice.<locals>.<listcomp>  s!    ,,,JJsOO,,,r%   Nrs   )rv   rU   r   r   r   r   rQ   rz   r   r   r   rI   intextendSlicer0   r1   r/   rt   ru   r   )r[   rb   rv   r{   
slice_noder   s        @r&   infer_slicer     sS   9Ds4yyA!!':::J,,,,t,,,D & & 	&jd&:;; 	&%%#u{++ 	&%%#)d4jj#%677 	&%%	& 4yy1}}TFa#d))m,---{?{?*  J Jr%   nodes.ClassDefrd   r   Iterator[Instance]c                F    t          |                                 f          S r#   )rh   r   )r[   rb   rd   s      r&   _infer_object__new__decoratorr     s!    
 ''))+,,,r%   c                    | j         sdS | j         j        D ]<}t          |t          j                  r |                                t
          k    r dS =dS )zfPredicate before inference_tip.

    Check if the given ClassDef has an @object.__new__ decorator
    FT)
decoratorsr   rQ   rX   	as_stringOBJECT_DUNDER_NEW)r[   	decorators     r&   #_infer_object__new__decorator_checkr    s`    
 ? u_*  	i11 	""$$(999tt5r%   c                   t           j                            | |          }|j        rt	          d          t          |j                  dk    r$t	          dt          |j                             |j        \  }}	 t          |                    |                    }n!# t          t          f$ r}t          |d}~ww xY wt          |t          j                  st	          d          	 t          ||          }n# t          $ r}t          |d}~ww xY w	 t          j        |||          }nG# t"          $ r%}t	          dt%          |          z             |d}~wt&          $ r}t          |d}~ww xY wt          j        |          S )a  Infer issubclass() calls.

    :param nodes.Call callnode: an `issubclass` call
    :param InferenceContext context: the context for the inference
    :rtype nodes.Const: Boolean Const value of the `issubclass` call
    :raises UseInferenceDefault: If the node cannot be inferred
    rf   z2TypeError: issubclass() takes no keyword argumentsr   Expected two arguments, got NzTypeError: arg 1 must be classTypeError: )r   r   r   r   r   rU   r   rw   rx   r   ry   rQ   r   ClassDef_class_or_tuple_to_containerr   object_issubclassr   rC   r   r   )	callnoderb   r   obj_nodeclass_or_tuple_nodeobj_typer~   class_containerissubclass_bools	            r&   infer_issubclassr    s    ''''BBD X!"VWWW
4$%%**!K3t/H+I+IKK
 
 	
 %)$=!H!+w7788M* + + +!s*+h// D!"BCCC+6
 
 
  + + +!s*++!3HowWW E E E!-#c((":;;D + + +!s*+;'''sT   ?#B# #C4B<<C.D   
D
DDD2 2
E6< EE6)E11E6r  nodes.Constc                ~   t           j                            | |          }|j        rt	          d          t          |j                  dk    r$t	          dt          |j                             |j        \  }}	 t          ||          }n# t          $ r}t          |d}~ww xY w	 t          j
        |||          }nG# t          $ r%}t	          dt          |          z             |d}~wt          $ r}t          |d}~ww xY wt          |t          j                  rt          t#          j        |          S )zInfer isinstance calls.

    :param nodes.Call callnode: an isinstance call
    :raises UseInferenceDefault: If the node cannot be inferred
    rf   z2TypeError: isinstance() takes no keyword argumentsr   r  Nr  )r   r   r   r   r   rU   r   r  r   r   object_isinstancer   rC   r   rQ   r   rz   r   r   )r  rb   r   r	  r
  r  r~   isinstance_bools           r&   infer_isinstancer    sr    ''''BBD X!"VWWW
4$%%**!K3t/H+I+IKK
 
 	
 %)$=!H!+6
 
 
  + + +!s*++!3HowWW E E E!-#c((":;;D + + +!s*+/4#788 "!!;'''s<   ?B 
B(B##B(,C 
D C--D:DDr   list[InferenceResult]c                F   	 t          |                                         }n$# t          $ r}t          |           |d }~ww xY wt	          |t
          j                  r9	 fd|j        D             }n'# t          $ r}t          |           |d }~ww xY w|g}|S )Nrf   r   c                V    g | ]%}t          |                                         &S )rf   )rw   rx   )r   r[   rb   s     r&   r   z0_class_or_tuple_to_container.<locals>.<listcomp>E  s<       6:TZZZ0011  r%   )rw   rx   ry   r   rQ   r   r   r   )r[   rb   
node_inferer  s    `   r&   r  r  7  s    @$**W*5566

 @ @ @$888a?@ *ek** '	D   >Ho  OO  	D 	D 	D dG<<<!C	D &,s,   #' 
AAA&A: :
BBBc                   t           j                            | |          }|j        rt	          d          t          |j                  dk    r5t	          d                    t          |j                                      |j        \  }	 t          j	        t          j        ||                    S # t          t          f$ r"}t	          t          |                    |d}~ww xY w)zInfer length calls.

    :param nodes.Call node: len call to infer
    :param context.InferenceContext: node context
    :rtype nodes.Const: a Const node with the inferred length, if possible
    rf   z/TypeError: len() must take no keyword argumentsrK   z=TypeError: len() must take exactly one argument ({len}) given)rU   N)r   r   r   r   r   rU   r   r,   r   r   r   
object_lenr   r   rC   )r[   rb   r   argument_noder~   s        r&   	infer_lenr  O  s     ''g'>>D U!"STTT
4$%%**!"Fs4+D'E'EFFF
 
 	
 /O]5{7-mWMMMNNNn- 5 5 5!#c((++45s   'B7 7C*C%%C*c                   t           j                            | |          }|j        rt	          d          	 t          j        d          S # t          t          f$ r"}t	          t          |                    |d}~ww xY w)zInfer str() calls.

    :param nodes.Call node: str() call to infer
    :param context.InferenceContext: node context
    :rtype nodes.Const: a Const containing an empty string
    rf   z/TypeError: str() must take no keyword arguments N)
r   r   r   r   r   r   r   r   r   rC   )r[   rb   r   r~   s       r&   	infer_strr  f  s     ''g'>>D U!"STTT5{2n- 5 5 5!#c((++45s   A B A;;B c                   t           j                            | |          }|j        rt	          d          |j        r	 t          |j        d                             |                    }n6# t          t          f$ r"}t	          t          |                    |d}~ww xY wt          |t          j                  rt          t          |t          j                  rot          |j        t"          t          f          rN	 t#          |j                  }n$# t$          $ r t          j        d          cY S w xY wt          j        |          S t          j        d          S )zInfer int() calls.

    :param nodes.Call node: int() call to infer
    :param context.InferenceContext: node context
    :rtype nodes.Const: a Const containing the integer value of the int() call
    rf   /TypeError: int() must take no keyword argumentsr   N)r   r   r   r   r   r   rw   rx   r   ry   rC   rQ   r   rz   r   r   r   r   
ValueError)r[   rb   r   first_valuer~   actual_values         r&   	infer_intr%  v  s^    ''g'>>D U!"STTT  -	9t8;AA'ARRSSKK. 	9 	9 	9%c#hh//S8	9 k4#788 	&%%k5;// 	-JSz5
 5
 	-&";#455 & & &{1~~%%%&;|,,,;q>>s*   .A0 0B#BB#D D98D9c                d     fd}t           j                             |          }|j        rt	          d          t          |j                  dvrt	          d          t          j        d          |j        d         }	 t          |
                    |                    }n"# t          t          f$ r  |g           cY S w xY w|t          j        u r |g           S t          j        f}t          |t          j        t          j        t          j        f          rB|j        }|D ]}t          ||          s |g           c S  fd|D             }	 ||	          S t          |t          j                  r?t          |j        t*          t,          f          rfd	|j        D             }	 ||	          S t          |t          j                  rO|                                }
|
D ]}t          ||          s |g           c S  fd
|
D             }	 ||	          S  |g           S )a[  Infer dict.fromkeys.

    :param nodes.Call node: dict.fromkeys() call to infer
    :param context.InferenceContext context: node context
    :rtype nodes.Dict:
        a Dictionary containing the values that astroid was able to infer.
        In case the inference failed for any reason, an empty dictionary
        will be inferred instead.
    c                    t          j        j        j        j        j        j                  }|                    |            |S )Nr   )r   r   r1   r0   r/   rt   ru   r   )elementsnew_noder[   s     r&   _build_dict_with_elementsz6infer_dict_fromkeys.<locals>._build_dict_with_elements  sN    :;;.
 
 
 	(###r%   rf   r!  >   rK   r   z5TypeError: Needs between 1 and 2 positional argumentsNr   c                    g | ]}|fS r$   r$   r   r   defaults     r&   r   z'infer_dict_fromkeys.<locals>.<listcomp>  s    JJJg1JJJr%   c                <    g | ]}t          j        |          fS r$   r   r,  s     r&   r   z'infer_dict_fromkeys.<locals>.<listcomp>  s5     
 
 
07U[!!7+
 
 
r%   c                    g | ]}|fS r$   r$   r,  s     r&   r   z'infer_dict_fromkeys.<locals>.<listcomp>  s    FFFg1FFFr%   )r   r   r   r   r   rU   r   r   r   rw   rx   r   ry   r   r   rQ   r   r   r   r   r   rC   rB   r   itered)r[   rb   r*  r   valuesinferred_valuesaccepted_iterable_elementsr(  r   elements_with_valuer   r   r-  s   `           @r&   infer_dict_fromkeysr5    s   	 	 	 	 	 ''g'>>D U!"STTT
4$%%V33!C
 
 	
 k$G&q)F-v||G|<<==M* - - -((,,,,,-$***((,,, #(+/EJ	5;#GHH >"' 	5 	5Gg'ABB 500444445 KJJJJJJ(()<===/5;// >JU|5 5 >
 
 
 
;J;P
 
 
 )()<===/5:.. >%%'' 	5 	5Cc#=>> 500444445 GFFFFFF(()<=== %$R(((s   #B* *C	C	Iterator[CopyResult]c                .   t          | j        t          j                  sJ t	          j        | j        j                            |                    \  }}t          d |D                       r t          t          t                   |          S t          )Nrf   c              3     K   | ]@}t          |t          j        t          j        t          j        t
          j        f          V  Ad S r#   )rQ   r   r   r   r   r   	FrozenSet)r   inferred_nodes     r&   r   z%_infer_copy_method.<locals>.<genexpr>  sY          	EJ
EIw?PQ	
 	
     r%   )rQ   rR   r   rX   	itertoolsteerZ   rx   r   r   r	   
CopyResultr   )r[   rb   rd   inferred_originferred_copys        r&   _infer_copy_methodr@    s     di11111#,=1E1Eg1E1V1V#W#W M=
   +	     9 HZ(-888
r%   c                j   t          | j        t          j                  r| j        j        dk    sdS t          | j        j        t          j                  rt          j        | j        j                  }n| j        j        }t          |t          j	                  ot          |j
        t                    S )zCatch calls to str.format().r,   F)rQ   rR   r   rX   rY   rZ   rS   r   r   r   r   rC   )r[   r   s     r&   _is_str_format_callrB    s    di11 9Kx9W9Wu$).%*-- 	//	eU[))Jjc.J.JJr%   3Iterator[ConstFactoryResult | util.UninferableBase]c                D   t           j                            | |          }t          | j        t
          j        t
          j        t
          j        f          sJ t          | j        j	        t
          j
                  rWt          j        | j        j	                  x}rt          |t
          j                  st          t          j        g          S |}nKt          | j        j	        t
          j                  r| j        j	        }nt          t          j        g          S |j        }g }|j        D ]b}t          j        ||          }	t          |	t
          j                  st          t          j        g          c S |                    |	           cd |D             }
i }|j                                        D ]U\  }}t          j        ||          }	t          |	t
          j                  st          t          j        g          c S |	||<   Vd |                                D             }	  |j        |
i |}nC# t,          t.          t0          t2          t4          f$ r t          t          j        g          cY S w xY wt          t          j        |          g          S )z?Return a Const node based on the template and passed arguments.rf   c                    g | ]	}|j         
S r$   r   )r   is     r&   r   z*_infer_str_format_call.<locals>.<listcomp>  s    BBBQWBBBr%   c                $    i | ]\  }}||j         S r$   rF  )r   kvs      r&   
<dictcomp>z*_infer_str_format_call.<locals>.<dictcomp>!  s     %V%V%VTQa%V%V%Vr%   )r   r   r   rQ   rR   r   rX   
AssignAttrDelAttrrZ   rS   r   r   r   rh   r   r   r   r   r   r;   r,   AttributeError
IndexErrorKeyError	TypeErrorr"  const_factory)r[   rb   rd   r   r}   r   format_templateinferred_positionalrG  one_inferred
pos_valuesinferred_keywordrI  rJ  keyword_valuesformatted_strings                   r&   _infer_str_format_callrZ    s    ''g'>>Ddi%/53CU]!STTTTT $).%*-- 	( ODIN;;; 	,JekE
 E
 	, )*+++	DINEK	0	0 (	T%&'''kO .0& 1 1q'22,44 	,)*+++++""<0000BB.ABBBJ 02&,,.. + +1q'22,44 	,)*+++++*%V%V=M=S=S=U=U%V%V%VN(1?1:PPPJ)ZH ( ( (
 T%&'''''( $%5667888s   /H= ==I=<I=c                   t          | t          d           t          | t          d           t          | t          d           t          | t          d           t          | t
          d           t          | t          d           t          | t          d           t          | t          d           t          | t          d	           t          | t          d
           t          | t          d           t          | t          d           t          | t          d           t          | t          d           t          | t          d           t          | t           d           t          | t"          d           t          | t$          d           t          | t&          d           |                     t*          j        t/          t0                    t2                     |                     t*          j        t/          t6                    d            |                     t*          j        t/          t8                    t:                     d S )NrG   superr   propertyr   rg   r   setr   rO   	frozensetrI   slicerQ   
issubclassrU   rC   r   zdict.fromkeysc                `    t          | j        t          j                  o| j        j        dk    S )Ncopy)rQ   rR   r   rX   rY   )r[   s    r&   <lambda>zregister.<locals>.<lambda>O  s)    Z	5?;; )I&( r%   )rm   r   r   r   r   r   r   infer_tuple	infer_set
infer_listr   infer_frozensetr   r   r  r  r  r  r%  r5  rk   r   r  r   r   r  rl   r@  rZ  rB  )r^   s    r&   registerri  /  s   w
F;;;wW===w
CCCw
CCCwyAAAwyAAAwW===w	5999w
F;;;w
F;;;wEEEw
F;;;wW===w(8,GGGw(8,GGGw	5999w	5999w	5999w(;_MMM 344+   
())	) 	)   
,--    r%   )r!   r
   )r!   rG   )r^   r   r!   r_   )
r[   ra   rb   rc   rn   ro   r?   rp   r!   rq   )r{   r   rb   rc   r   ro   r   r   r   r   r!   r   )r[   ra   rb   rc   r   ro   r   r   r   r   r!   rq   r#   )r[   ra   rb   rc   r!   r   )r[   ra   rb   rc   r!   r   )rb   rc   )r[   ra   rb   rc   r!   r   )r[   r   rb   rc   rd   r   r!   r   )r  ra   rb   rc   r!   r  )r[   r   rb   rc   r!   r  )r[   ra   rb   rc   rd   r   r!   r6  )r[   ra   r!   rG   )r[   ra   rb   rc   rd   r   r!   rC  )c__doc__
__future__r   r;  collections.abcr   r   	functoolsr   typingr   r   r	   r
   r   r   r   astroidr   r   r   r   r   r   astroid.builderr   astroid.contextr   astroid.exceptionsr   r   r   r   r   astroid.managerr   astroid.nodesr   astroid.typingr   r   r   astroid.basesr    r9  	DictItemsDictKeys
DictValuesr   r   r   r^  r_  r   r   r   r   r=  r   rE   rD   r'   r8   r@   rF   r]   rm   r   r   r   r   re  rg  rf  rh  r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r%  r5  r@  rB  rZ  ri  r$   r%   r&   <module>rz     s^  
 * ) " " " " " "     . . . . . . . .       L L L L L L L L L L L L L L L L L L K K K K K K K K K K K K K K K K * * * * * * , , , , , ,              + * * * * * & & & & & &           '&&&&&&  KJIO 	J	J	I
 % (	V$N       # # #+ + +     :       F   B%6 %6 %6 %6PN N N N& g
+
	    W
*	   
 G
)z5;(97;KL	  	 '

z5;	73DgFVW	    :3 3 3 3 3n :>= = = = =@  0    8    6, , , , ,. :>" " " " "J# # # # #.6 6 6 6 6    @ >B- - - - -   (( (( (( (( ((X >B"( "( "( "( "(L ?C    05 5 5 5 5.5 5 5 5 5     @D) D) D) D) D)P :>     
K 
K 
K 
K :>29 29 29 29 29j( ( ( ( ( (r%   