
    c              
         d Z ddlmZ ddlZddlmZ ddl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ZdZdZd Z d Z! e! ee ed           ee ed          d           dOdZ"dPdZ#d Z$d Z%	 dQdZ& ee&ej'        ej(        ej)        ej*        ej+        ej,        ej-        fe.          Z/ ee&ej(        ej'        ej)        ej*        ej+        ej,        ej-        fe0          Z1 ee&ej)        ej(        ej'        ej*        ej,        fe2          Z3 ee&ej*        ej(        ej'        ej)        ej*        ej,        fe4          Z5d Z6dRdSd!Z7dRdSd"Z8d# Z9dRdSd$Z:dRdSd%Z;dRdSd&Z<	 dRdTd*Z=dRdSd+Z>dRdSd,Z?dRdSd-Z@dRdSd.ZAdOd/ZBdRdSd0ZCdRdSd1ZDdRdSd2ZEdRdSd3ZFdRdSd4ZGdRdSd5ZHdRdSd6ZI	 dRdUd8ZJdVd9ZK	 dRdWd;ZL e#e>d            e#e8d<            e#e<d=            e#e=d>            e#e:d?            e#e;d@            e#e/dA            e#e3dB            e#e1dC            e#e7dD            e#e5dE            e#e?dF            e#e@dG            e#eDdH            e#eCdI            e#eFdJ            e#eGdK            e#eHdL            e#eIdM            e            M                    ejN         eeA          eB            e            M                    ejO         eeJ          dN             e            M                    ejO         eeL          eK           dS )Xz#Astroid hooks for various builtins.    )annotationsN)Iterator)partial)	argumentshelpersinference_tipnodesobjectsutil)AstroidBuilder)InferenceContext)AstroidTypeErrorAttributeInferenceErrorInferenceErrorMroErrorUseInferenceDefault)AstroidManager)scoped_nodesz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}
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        Elib/python3.11/site-packages/astroid/brain/brain_builtin_inference.py_extend_string_classr&   n   s    ;;f;%%D.**++88>>zJD.."" # #" &-' 	6*4FM+&*0
&+&"# #    c                    t                      j        }|                                 D ]\  }} |||                    d S N)r   builtins_moduleitems)class_transformsbuiltin_ast
class_name	transforms       r%   _extend_builtinsr0   |   sR     ""2K!1!7!7!9!9 + +
I	+j)****+ +r'   zb'')r"   r   z'')bytesstrreturn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)rootr    
isinstancefuncr	   Namer   Assignlentargets
AssignName	Attributeattrnameexpr)nodebuiltin_names     r%   _builtin_filter_predicaterJ      sQ   IIKK$ ty%*-- INf$	
 t{EL11 #$$) t{*1-u/?@@ K"'+??  u$)UZ(( TY^|-K t$)U_-- 
I*, .49>5:66.	#v-	

 5r'   Nonec                     dd fd}t                                          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.
    NcontextInferenceContext | Nonec                     | |          }|rD|j         s| |_         |j        | j        |_        t          |d          r|j        | j        |_        t	          |g          S )NrM   r   )r   r   hasattrr   iter)rH   rM   resultr/   s      r%   _transform_wrapperz6register_builtin_transform.<locals>._transform_wrapper   s{    4111 	4= % !%} , $ v|,, 41B 4$(O!VH~~r'   )rI   r)   rM   rN   )r   register_transformr	   Callr   r   rJ   )r/   rI   rT   s   `  r%   register_builtin_transformrX      sr          " ''
()))EEE    r'   c                   | j         }|s
 |            S t          | j                   dk    rt                      |\  } ||          }|sf	 t          |                    |                    }n!# t
          t          f$ r}t          |d }~ww xY w|t          j        u rt           ||          }|r|t          j        u rt          |S )Nr8   rP   )	argsrB   r   nextinferr   StopIterationr   Uninferable)	rH   rM   	node_typer/   rZ   argtransformedinferredexcs	            r%   _container_generic_inferencerd      s    9D y{{
49~~ $!###FS)C..K *	/CIIgI6677HH. 	/ 	/ 	/%3.	/t'' 	&%%i)) "+)99 "!!s   #A0 0BB		Bc                   t          | |          r| S t          | |          rt          d | j        D                       rd | j        D             }ng }| j        D ]H}|st          j        ||          }|r+t          j        ||          }|                    |           Int          | t
          j                  r>t          d | j	        D                       st                      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)   r>   r	   Const.0elts     r%   	<genexpr>z/_container_generic_transform.<locals>.<genexpr>   s.      @@z#u{++@@@@@@r'   c                    g | ]	}|j         
S  valueri   s     r%   
<listcomp>z0_container_generic_transform.<locals>.<listcomp>   s    222#CI222r'   rP   )originalrp   c              3  V   K   | ]$}t          |d          t          j                  V  %dS )r   Nrg   ri   s     r%   rl   z/_container_generic_transform.<locals>.<genexpr>   s2      HHs:c!fek22HHHHHHr'   c                (    g | ]}|d          j         S )r   ro   )rj   items     r%   rq   z0_container_generic_transform.<locals>.<listcomp>   s    444$Q444r'   )elts)r>   allrv   r   
safe_inferr	   EvaluatedObjectappendDictr+   r   rh   rp   r2   r1   from_elements)	r`   rM   klass	iterables
build_eltsrv   elementrb   evaluated_objects	            r%   _container_generic_transformr      s    #u 
#y!! @@sx@@@@@ 	222222DD D8 2 2 "-gwGGG 2','<!(( ( ($ KK 01112 
C	$	$ HHciHHHHH 	(%'''44#)444	C	%	% *SYe*M*M yJJt$4$4555r'   c                X    t          t          ||||          }t          | |||          S )N)rM   r}   r~   r   )r   r   rd   )rH   rM   r}   r~   r   transform_funcs         r%   _infer_builtin_containerr      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)   )r>   r	   ListTupleSet)ns    r%   is_iterablez_get_elts.<locals>.is_iterable7  s    !ej%+uyABBBr'      r   )r[   r\   r   r]   r   r>   r	   r{   r+   rv   rB   r   rh   r@   rz   tuple)r`   rM   r   rb   rc   r+   rk   s          r%   	_get_eltsr   6  sL   C C C+		'**++M* + + +!s*+(EJ'' $	X		 $= 	* 	*C
 ;s## ,)+++38}}! ,)+++chqkEKej+QRR ,)+++LLsx))))	* "###Ls   "( AAArM   rN   c                   t           j                            | |          }|                                s|                                rt
          |j        }t          |j        	                                          }|s|st          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                  }|                    |           |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.
    rP   c                @    g | ]\  }}t          j        |          |fS rn   r	   rh   rj   keyrp   s      r%   rq   zinfer_dict.<locals>.<listcomp>m  s+    DDDzsE%+c""E*DDDr'   r8   r   c                @    g | ]\  }}t          j        |          |fS rn   r   r   s      r%   rq   zinfer_dict.<locals>.<listcomp>q  s+    CCCjc5S!!5)CCCr'   r   r   r   )r   CallSite	from_callhas_invalid_argumentshas_invalid_keywordsr   positional_argumentslistkeyword_argumentsr+   r	   r{   rB   r   r   r   r   postinit)	rH   rM   callrZ   kwargsr+   rv   keysrp   s	            r%   
infer_dictr   S  sh    ''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?4;t{  E 
NN5Lr'   c                   t          | j                  dk    rt          |                                 }t	          |t
          j                  st          |j        dvrt          t          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          j        u s|t          j        u 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.
    r8   )classmethodr$   r   r   rP   N)mro_pointermro_type
self_classscope)rB   rZ   r   r   r>   r	   FunctionDefr6   r   get_wrapping_classinstantiate_classr[   r\   r   r]   r   r^   r
   Superr   )rH   rM   r   clsr   r   rc   	super_objs           r%   infer_superr   ~  s    49~~ "!!JJLLEeU.// "!!z22 "!!

)%
0
0C9 / :& 	/HH,,..HH	/ty|11'1BBCCKK. 	/ 	/ 	/%3.	/	/DIaL..w.??@@HH. 	/ 	/ 	/%3.	/ d&& "(d6F*F "!!(s%  I Is0   &.C C3&C..C37.D& &E7D??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          j        u s|t          j        u rt          j        t          j        fS t          |t          j                  ot          |j        t                    }|st          ||j        fS )N)r      r   rP   r8   )rB   rZ   r   r[   r\   r   r]   r   r^   r>   r	   rh   rp   r2   )rH   rM   objattrrc   	is_strings         r%   _infer_getattr_argsr     s   
49~~V# "!!+49Q<%%g%6677DIaL&&w&7788M* + + +!s*+ d 2$$*:": 2 !1114--M*TZ2M2MI "!!
?s   AA< <BBBc                   t          | |          \  }}|t          j        u s|t          j        u 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.
    igetattrrP   r   r   N)r   r   r^   rQ   r[   r   r]   r   r   rB   rZ   r\   r   )rH   rM   r   r   rc   s        r%   infer_getattrr     s    $D'22ICt 4##  sJ'' 
 3CLLwL77888>+BC 3 3 3ty>>Q 	33DIaL..w.??@@@@@!>2 3 3 3)s23		3 	33 s6   #A1 1/C5!-CC5C/"C**C//C54C5c                h   	 t          | |          \  }}|t          j        u s|t          j        u 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.
    getattrrP   FT)	r   r   r^   rQ   r   r   r   r	   rh   )rH   rM   r   r   s       r%   infer_hasattrr     s    "'g66	T4##	$t''	$ 3	**	$
 ##D'****      " " " "{5!!!!!" ;ts   A
A% A% %B=BBc                j   t          | j                  dk    rt          | j        d         }	 t          |                    |                    }n## t
          t          f$ r t          j        cY S w xY w|t          j        u 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.
    r8   r   rP   )rB   rZ   r   r[   r\   r   r]   r   r^   r	   rh   callable)rH   rM   argumentrb   s       r%   infer_callabler     s     49~~ "!!y|H w7788M*       4##  ;x((**+++s   #A A21A2rH   
nodes.Call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.
    r8   r   rP   N)functionr    r   r   r   doc_node)bodyrZ   r   )rB   rZ   r   r[   r\   r   r]   r>   r	   r   Lambdar
   Propertyr    r   r   r   r   )rH   rM   getterrb   rc   	prop_funcs         r%   infer_propertyr     s    49~~ "!!Yq\F+W5566M* + + +!s*+ h!2EL ABB "!! ]{?  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          j
        u rt          j
        S |                    |          }|t          j
        u rt          j
        S t          j        |          S )zUnderstand bool calls.r8   Fr   rP   )rB   rZ   r   r	   rh   r[   r\   r   r]   r   r^   
bool_value)rH   rM   r   rb   r   s        r%   
infer_boolr   >  s    
49~~ "!!9 "{5!!!y|H w7788M*       4##  $$W$55JT%%  ;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*.r8   r   )rB   rZ   r   r   object_typerH   rM   s     r%   
infer_typer   U  s6    
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 ]j}|r|t          j        u rt          t          |t          j
                  st          t          |j        t          d          t          f          st          kt          |          dk     r)|                    dgdt          |          z
  z             t          j        | j        | j        | j                  } |j        |  |S )zUnderstand `slice` calls.r   r   rP   c                &    g | ]} |          S rn   rn   )rj   r`   
infer_funcs     r%   rq   zinfer_slice.<locals>.<listcomp>d  s!    ,,,JJsOO,,,r'   N)r   r   r   )rZ   rB   r   r   r   rx   r   r^   r>   r	   rh   rp   r6   intextendSlicer   r   r   r   )rH   rM   rZ   r`   
slice_noder   s        @r%   infer_slicer   ]  sU   9Ds4yy " " " "A " " " "!!+W===J,,,,t,,,D & & 	&cT-- 	&%%#u{++ 	&%%#)d4jj#%677 	&%%	& 4yy1} .TFa#d))m,---{tt{  J Jr'   c                F    t          |                                 f          S r)   )rR   r   r   s     r%   _infer_object__new__decoratorr   x  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	   r>   rE   	as_stringOBJECT_DUNDER_NEW)rH   	decorators     r%   #_infer_object__new__decorator_checkr   ~  sb    
 ? u_*  	i11 	""$$(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
    rP   z2TypeError: issubclass() takes no keyword argumentsr   Expected two arguments, got NzTypeError: arg 1 must be classTypeError: )r   r   r   r   r   rB   r   r[   r\   r   r]   r>   r	   ClassDef_class_or_tuple_to_containerr   object_issubclassr   r2   r   rh   )	callnoderM   r   obj_nodeclass_or_tuple_nodeobj_typerc   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c                f   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          j        u rt          t!          j        |          S )zInfer isinstance calls.

    :param nodes.Call callnode: an isinstance call
    :rtype nodes.Const: Boolean Const value of isinstance call

    :raises UseInferenceDefault: If the node cannot be inferred
    rP   z2TypeError: isinstance() takes no keyword argumentsr   r   Nr   )r   r   r   r   r   rB   r   r   r   r   object_isinstancer   r2   r   r   r^   r	   rh   )r   rM   r   r   r   r   rc   isinstance_bools           r%   infer_isinstancer     so    ''''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*+$** "!!;'''s<   ?B 
B(B##B(,C 
D C--D:DDc                `   	 t          |                                         }n$# t          $ r}t          |           |d }~ww xY wt	          |t
          j                  rF	 fd|j        D             }n$# t          $ r}t          |           |d }~ww xY wd |D             }n|g}|S )NrP   r   c                V    g | ]%}t          |                                         &S )rP   )r[   r\   )rj   rH   rM   s     r%   rq   z0_class_or_tuple_to_container.<locals>.<listcomp>  s<       6:TZZZ0011  r'   c                    g | ]}||S r)   rn   )rj   
klass_nodes     r%   rq   z0_class_or_tuple_to_container.<locals>.<listcomp>  s-     
 
 
%J

 
 
r'   )r[   r\   r]   r   r>   r	   r   rv   )rH   rM   
node_inferer   s    `   r%   r   r     s   @$**W*5566

 @ @ @$888a?@ *ek** '	D   >Ho  OO  	D 	D 	D dG<<<!C	D
 
)8
 
 
 &,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
    rP   z/TypeError: len() must take no keyword argumentsr8   z=TypeError: len() must take exactly one argument ({len}) given)rB   N)r   r   r   r   r   rB   r   r   r	   rh   r   
object_lenr   r   r2   )rH   rM   r   argument_noderc   s        r%   	infer_lenr     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
    rP   z/TypeError: str() must take no keyword arguments N)
r   r   r   r   r   r	   rh   r   r   r2   )rH   rM   r   rc   s       r%   	infer_strr     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          j        u 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
    rP   /TypeError: int() must take no keyword argumentsr   N)r   r   r   r   r   r   r[   r\   r   r]   r2   r   r^   r>   r	   rh   rp   r   
ValueError)rH   rM   r   first_valuerc   actual_values         r%   	infer_intr    sY    ''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 $** 	&%%k5;// 	-JSz5
 5
 	-&";#455 & & &{1~~%%%&;|,,,;q>>s*   .A0 0B#BB#7D D-,D-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                  }|                    |            |S )Nr   )r	   r{   r   r   r   r   )elementsnew_noderH   s     r%   _build_dict_with_elementsz6infer_dict_fromkeys.<locals>._build_dict_with_elementsH  sA    :t{4;
 
 
 	(###r'   rP   r  >   r8   r   z5TypeError: Needs between 1 and 2 positional argumentsNr   c                    g | ]}|fS rn   rn   rj   r   defaults     r%   rq   z'infer_dict_fromkeys.<locals>.<listcomp>i  s    JJJg1JJJr'   c                <    g | ]}t          j        |          fS rn   r   r  s     r%   rq   z'infer_dict_fromkeys.<locals>.<listcomp>n  s5     
 
 
07U[!!7+
 
 
r'   c                    g | ]}|fS rn   rn   r  s     r%   rq   z'infer_dict_fromkeys.<locals>.<listcomp>y  s    FFFg1FFFr'   )r   r   r   r   r   rB   r   r	   rh   r[   r\   r   r]   r   r^   r>   r   r   r   rv   rp   r2   r1   r{   itered)rH   rM   r
  r   valuesinferred_valuesaccepted_iterable_elementsr  r   elements_with_valuer   r   r  s   `           @r%   infer_dict_fromkeysr  =  s        ''g'>>D U!"STTT
4$%%V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;// 3JU|5 5 3
 
 
 
;J;P
 
 
 )(222/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[nodes.NodeNG]c                    t          | j        t          j                  sJ t	          j        | j        j                            |                    \  }}t          d |D                       r|S t                      )NrP   c              3     K   | ]@}t          |t          j        t          j        t          j        t
          j        f          V  Ad S r)   )r>   r	   r{   r   r   r
   	FrozenSet)rj   inferred_nodes     r%   rl   z%_infer_copy_method.<locals>.<genexpr>  sY          	EJ
EIw?PQ	
 	
     r'   )
r>   r?   r	   rE   	itertoolsteerG   r\   rw   r   )rH   rM   inferred_originferred_copys       r%   _infer_copy_methodr    s     di11111#,=1E1Eg1E1V1V#W#W M=
   +	      


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)r>   r?   r	   rE   rF   rG   r@   r   rx   rh   rp   r2   )rH   rp   s     r%   _is_str_format_callr!    s    di11 9Kx9W u$).%*-- "49>22	eU[))Jjc.J.JJr'   .Iterator[nodes.Const | type[util.Uninferable]]c                   t           j                            |           }t          | j        j        t          j                  r;t          j	        | j        j                  }|t          t          j        g          S n| j        j        }|j        }fd|j        D             }t          d |D                       st          t          j        g          S d |D             }fd|j                                        D             }t          d |                                D                       st          t          j        g          S d |                                D             }	  |j        |i |}	nC# t(          t*          t,          t.          t0          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.rP   Nc                :    g | ]}t          j        |          S rn   r   rx   )rj   irM   s     r%   rq   z*_infer_str_format_call.<locals>.<listcomp>  s3       +,1g&&  r'   c              3  J   K   | ]}t          |t          j                  V  d S r)   rg   rj   r&  s     r%   rl   z)_infer_str_format_call.<locals>.<genexpr>  s.      GGaz!U[))GGGGGGr'   c                    g | ]	}|j         
S rn   ro   r(  s     r%   rq   z*_infer_str_format_call.<locals>.<listcomp>  s    BBBQWBBBr'   c                B    i | ]\  }}|t          j        |          S rn   r%  )rj   kvrM   s      r%   
<dictcomp>z*_infer_str_format_call.<locals>.<dictcomp>  s9       .2a7a))  r'   c              3  J   K   | ]}t          |t          j                  V  d S r)   rg   r(  s     r%   rl   z)_infer_str_format_call.<locals>.<genexpr>  s.      MMaz!U[))MMMMMMr'   c                $    i | ]\  }}||j         S rn   ro   )rj   r+  r,  s      r%   r-  z*_infer_str_format_call.<locals>.<dictcomp>  s     %V%V%VTQa%V%V%Vr'   )r   r   r   r>   r?   rG   r	   r@   r   rx   rR   r   r^   rp   r   rw   r   r+   r  r   AttributeError
IndexErrorKeyError	TypeErrorr  const_factory)
rH   rM   r   rp   format_templateinferred_positional
pos_valuesinferred_keywordkeyword_valuesformatted_strings
    `        r%   _infer_str_format_callr;    s    ''g'>>D$).%*-- $+$6ty~$F$F 	,)*+++	, 	kO   040I   GG3FGGGGG (T%&'''BB.ABBBJ   6:6L6R6R6T6T   MM3C3J3J3L3LMMMMM (T%&'''%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   0E> >=F>=F>superr   propertyr   rQ   r   setr   r<   	frozensetr6   slicer>   
issubclassrB   r2   r   zdict.fromkeysc                `    t          | j        t          j                  o| j        j        dk    S )Ncopy)r>   r?   r	   rE   rF   )rH   s    r%   <lambda>rD    s)    DIu77 %	f$ r'   )r3   r4   )r3   rK   )NNNr)   rU   )rH   r   rM   rN   r3   r   )rH   r   rM   rN   r3   r  )rH   r   r3   r4   )rH   r   rM   rN   r3   r"  )P__doc__
__future__r   r  collections.abcr   	functoolsr   astroidr   r   r   r	   r
   r   astroid.builderr   astroid.contextr   astroid.exceptionsr   r   r   r   r   astroid.managerr   astroid.nodesr   r   	STR_CLASSBYTES_CLASSr&   r0   rJ   rX   rd   r   r   r   r   r   r  	DictItemsDictKeys
DictValuesr   infer_tupler   
infer_listr>  	infer_setr?  infer_frozensetr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r!  r;  rV   r   rW   rn   r'   r%   <module>rX     sh  
 * ) " " " " " "     $ $ $ $ $ $       K K K K K K K K K K K K K K K K * * * * * * , , , , , ,              + * * * * * & & & & & &$ (	V$N# # #+ + +  -KNNNw+)DIII      :   >  ,6 6 6B ;?N N N N g
+
	    W
*	   
 G
)z5;(97;KL	  	 '

z5;	73DgFVW	    :( ( ( ( (V4 4 4 4 4n  0    8    6, , , , ,. :>! ! ! ! !H# # # # #.6 6 6 6 6    6- - - - -   (( (( (( (( ((V"( "( "( "( "(J    25 5 5 5 5.5 5 5 5 5     @@) @) @) @) @)H :>          
K 
K 
K 
K :>'9 '9 '9 '9 '9V  :v . . .  ; 0 0 0  >: 6 6 6  >: 6 6 6  =) 4 4 4  =) 4 4 4  ; 0 0 0  9e , , ,  :v . . .  :v . . .  ?K 8 8 8  :v . . .  ; 0 0 0  +\ : : :  +\ : : :  9e , , ,  9e , , ,  9e , , ,  . @ @ @    # #	NM/00'      # #	JM$%%% %      # #	J4557J    r'   