
    e?              
      4   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jX                  ejZ                  ej\                  ej^                  f   Z0eee1   ee2   ee3   ee4   f   Z5eejl                  ejn                  ejp                  ejX                  f   Z9dZ:dZ;dZ<d4dZ=d Z>d Z?d Z@d5dZA	 	 	 	 d6dZB	 	 	 	 	 	 	 	 	 	 d7dZC	 	 	 	 	 	 	 	 	 	 	 	 d8dZD	 	 	 	 	 	 	 	 	 	 	 	 d9dZE eeEej                  ejn                  ejp                  ejX                  ejZ                  ej\                  ej^                  fe1      ZG eeEejn                  ej                  ejp                  ejX                  ejZ                  ej\                  ej^                  fe2      ZH eeEejp                  ejn                  ej                  ejX                  ej\                  fe3      ZI eeEejX                  ejn                  ej                  ejp                  ejX                  ej\                  fe4      ZJd ZKd:d;dZL	 d:	 	 	 	 	 d<dZMd ZNd:d=d ZOd:d=d!ZPd:d=d"ZQ	 d:	 	 	 	 	 d>d#ZRd:d=d$ZSd:d=d%ZTd:d=d&ZU	 d:	 	 	 	 	 	 	 d?d'ZVd5d(ZWd:d=d)ZX	 d:	 	 	 	 	 d@d*ZY	 d:	 	 	 	 	 dAd+ZZd:d=d,Z[d:d=d-Z\d:d=d.Z]d:d=d/Z^	 d:	 	 	 	 	 	 	 dBd0Z_dCd1Z`	 d:	 	 	 	 	 	 	 dDd2Zad6d3Zby)Ez#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}
c                     t               N)r        G/usr/lib/python3/dist-packages/astroid/brain/brain_builtin_inference.py_use_defaultr&      s    

r$   c                D   |j                  |      }t        t                     j                  |      d   }|j	                         D ]V  }| |_        d|_        d|_        d|j                  v r| g|j                  d<   |g| j                  |j                  <   | |_        X y)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_classr7      s    ;;f;%D.*+88>zJD.." #" &--'*4FMM+&*0
&++&"#r$   c                r    t               j                  }| j                         D ]  \  }} |||           y r"   )r   builtins_moduleitems)class_transformsbuiltin_ast
class_name	transforms       r%   _extend_builtinsr?      s:     "22K!1!7!7!9 +
I+j)*+r$   c                 p    t        t        t        t        d      t        t        t        d      d       y)z"Called by astroid_bootstrapping().zb'')r4   r(   z'')bytesstrN)r?   r   r7   BYTES_CLASS	STR_CLASSr#   r$   r%   on_bootstraprE      s)    1ER/iM	
r$   c                   |dk(  r| j                         j                  dk(  rt        | j                  t        j
                        r| j                  j                  dk(  rt        | j                  t        j                        ryt        | j                  j                        dk(  rWt        | j                  j                  d   t        j                        r&| j                  j                  d   j                  dv ryt        | j                  t        j
                        r| j                  j                  |k(  ryt        | j                  t        j                        rn| j                  j                  dk(  xrS t        | j                  j                  t        j
                        xr# | j                  j                  j                  d	k(  S y)
Ntypere   r   >   MatchPatternFTfromkeysdict)rootr2   
isinstancefuncr   Namer.   Assignlentargets
AssignName	Attributeattrnameexpr)nodebuiltin_names     r%   _builtin_filter_predicater[      s3   IIK$tyy%**-IINNf$t{{ELL1##$)t{{**1-u/?/?@KK"''+?? $))UZZ(TYY^^|-K$))U__-II*, .499>>5::6.		##v-	

 r$   c                    	 d	 	 	 	 	 	 	 dfd}| j                  t        j                  t        |      t	        t
        |             y)zRegister a new transform function for the given *builtin_name*.

    The transform function must accept two parameters, a node and
    an optional context.
    Nc                     | |      }|rY|j                   s| |_         |j                  | j                  |_        t        |d      r|j                  | j                  |_        t	        |g      S )Ncontextr0   )r.   r/   hasattrr0   iter)rY   r_   kwargsresultr>   s       r%   _transform_wrapperz6register_builtin_transform.<locals>._transform_wrapper   sh     41== !%}}$ $ v|,1B1B1J$(OO!VH~r$   )rZ   r"   )rY   
nodes.Callr_   InferenceContext | Nonerb   r   returnr	   )register_transformr   Callr   r   r[   )managerr>   rZ   rd   s    `  r%   register_builtin_transformrk      sY     >B#:MP	& 

())Er$   c                   | j                   }|s? || j                  | j                  | j                  | j                  | j
                        S t        | j                         dkD  r
t               |\  } ||      }|sD	 t        |j                  |            }t        |t        j                        rt         ||      }|rt        |t        j                        rt        |S # t        t        f$ r}t        |d }~ww xY w)Nr/   r0   r.   
end_linenoend_col_offsetrI   r^   )argsr/   r0   r.   rn   ro   rS   r   nextinferr   StopIterationrO   r   UninferableBase)	rY   r_   	node_typer>   rp   argtransformedinferredexcs	            r%   _container_generic_inferencerz      s     99D;;;;..
 	
 499~!##FSC.K	/CIIgI67H h 4 45%%)*[$2F2FG!! . 	/%3.	/s   ?C& &D5C<<Dc                   t        | |      r| S t        | |      rt        t        t        j                  t
        f   |       } t        d | j                  D              r=| j                  D cg c]&  }t        t        j                  |      j                  ( }}n	g }| j                  D ]G  }|st        j                  ||      }|s t        j                  ||      }	|j                  |	       I nt        | t        j                        rN| j                  D 
cg c]8  }
t        |
d   t        j                        r|
d   j                  n	t!               : }}
nHt        | t        j                        r-t        | j                  t"        t$        f      r| j                  }ny |j'                   ||            S c c}w c c}
w )Nc              3  P   K   | ]  }t        |t        j                           y wr"   )rO   r   Const).0elts     r%   	<genexpr>z/_container_generic_transform.<locals>.<genexpr>  s     @z#u{{+@s   $&r^   )originalvaluer   )elts)rO   r   r   r   BaseContainerContainerObjectsallr   r}   r   r   
safe_inferEvaluatedObjectappendDictr:   r&   rB   rA   from_elements)rv   r_   klass	iterables
build_eltsr   r   elementrx   evaluated_objectitems              r%   _container_generic_transformr     sp    #u
#y!5,,.>>?E@sxx@@<?HHESDc*00EDE D88 2??7GD','<'<!(($ KK 012 
C	$ 		
 (Q=DGMM<>Q
 
 
C	%*SYYe*MyyJt$455/ F
s   ,+F<=Gc                F    t        t        ||||      }t        | |||      S )N)r_   r   r   r   )r   r   rz   )rY   r_   r   r   r   transform_funcs         r%   _infer_builtin_containerr   7  s0     $N (gunMMr$   )r   r   r   c                h   d }	 t        | j                  |            }t        |t        j                        r|j                  }|S  ||      rg }|j                  D ]  } ||      s
t	               t        |j                        dk7  r
t	               t        |j                  d   t        j                  t        j                  t        j                  f      s
t	               |j                  t        |j                                |S t	               # t        t        f$ r}t        |d }~ww xY w)Nc                t    t        | t        j                  t        j                  t        j                  f      S r"   )rO   r   ListTupleSet)ns    r%   is_iterablez_get_elts.<locals>.is_iterablev  s"    !ejj%++uyyABBr$      r   )rq   rr   r   rs   r   rO   r   r   r:   r   rS   r   r}   rQ   r   tuple)rv   r_   r   rx   ry   r:   r   s          r%   	_get_eltsr   u  s   C+		'*+ (EJJ'" L! 
X	== 	*C
 s#)++388}!)++chhqkEKKejj+QR)++LLsxx)	* L "##' M* +!s*+s   D D1%D,,D1c                   t         j                  j                  | |      }|j                         s|j	                         rt
        |j                  }t        |j                  j                               }|sN|sLt        j                  | j                  | j                  | j                  | j                  | j                         S |r,|s*|D cg c]  \  }}t        j"                  |      |f }}}nvt%        |      dk(  r@|r>t'        |d   |      }|D cg c]  \  }}t        j"                  |      |f }	}}||	z   }n(t%        |      dk(  rt'        |d   |      }n
t               t        j                  | j                  | j                  | j                  | j                  | j                         }|j)                  |       |S c c}}w c c}}w )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.
    r^   rm   rI   r   r0   r/   r.   rn   ro   )r   CallSite	from_callhas_invalid_argumentshas_invalid_keywordsr   positional_argumentslistkeyword_argumentsr:   r   r   r/   r0   r.   rn   ro   r}   rS   r   postinit)
rY   r_   callrp   rb   keyr   r:   r   keyss
             r%   
infer_dictr     s    ''g'>D!!#t'@'@'B!!$$D$((..01F zz;;;;..
 	
 d=CDzsE%++c"E*DD	TaFa'*<BCjc5S!5)CCt	Ta$q'7+!##JJ??{{{{??**E 
NN5L% E Ds   !G
!Gc                0   t        | j                        dk(  rt        | j                         }t	        |t
        j                        st        |j                  dvrt        t        j                  |      }|J | j                  s%|}|j                  dk(  r|}nc|j                         }nR	 t        | j                  d   j                  |            }	 t        | j                  d   j                  |            }t	        |t        j                         st	        |t        j                         rt        t#        j$                  |||||       }| |_        |S # t        t        f$ r}t        |d}~ww xY w# t        t        f$ r}t        |d}~ww xY w)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.
    rI   )classmethodr6   Nr   r   r^   )mro_pointermro_type
self_classscoper   )rS   rp   r   r   rO   r   FunctionDefrG   r   get_wrapping_classinstantiate_classrq   rr   r   rs   r   rt   r   Superr.   )rY   r_   r   clsr   r   ry   	super_objs           r%   infer_superr     su    499~!!JJLEeU../!!zz22!!

)
)%
0C??99 ::&H,,.H	/tyy|11'1BCK	/DIIaL..w.?@H +t334
$&&9 "!I I+ . 	/%3.	/ . 	/%3.	/s0   .(E (E: E7+E22E7:F	FFc                Z   t        | j                        dvrt        	 t        | j                  d   j	                  |            }t        | j                  d   j	                  |            }t        |t        j                        st        |t        j                        r t        j                  t        j                  fS t        |t        j                        xr t        |j                  t              }|st        ||j                  fS # t
        t        f$ r}t        |d }~ww xY w)N)r      r   r^   rI   )rS   rp   r   rq   rr   r   rs   rO   r   rt   Uninferabler   r}   r   rB   )rY   r_   objattrry   	is_strings         r%   _infer_getattr_argsr     s    
499~V#!!+499Q<%%g%67DIIaL&&w&78 #t++,
4AUAU0V !1!1114-M*TZZ2MI!!

? M* +!s*+s   AD D*D%%D*c                   t        | |      \  }}t        |t        j                        s&t        |t        j                        st	        |d      st        j
                  S 	 t        |j                  ||            S # t        t        t        f$ ri t        | j                        dk(  rI	 t        | j                  d   j                  |            cY S # t        t        f$ r}t        |d}~ww xY wY t        w xY w)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.
    igetattrr^   r   r   N)r   rO   r   rt   r`   r   rq   r   rs   r   r   rS   rp   rr   r   )rY   r_   r   r   ry   s        r%   infer_getattrr      s     $D'2IC3,,-dD001sJ'3CLLwL788>+BC 3tyy>Q3DIIaL..w.?@@!>2 3)s23	  3s6   !A= =,C:*'CC:C/#C**C//C:9C:c                   	 t        | |      \  }}t        |t        j                        s&t        |t        j                        st	        |d      st        j
                  S |j                  ||       t        j                  d      S # t        $ r t        j
                  cY S t        $ r t        j                  d      cY S w xY w)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.
    getattrr^   FT)r   rO   r   rt   r`   r   r   r   r   r   r}   )rY   r_   r   r   s       r%   infer_hasattrr   <  s    "'g6	TsD001$ 4 453	*###D'* ;;t   " "{{5!!"s   AB	 !B	 	C$CCc                x   t        | j                        dk7  rt        | j                  d   }	 t        |j	                  |            }t        |t        j                        rt        j                  S t        j                  |j                               S # t
        t        f$ r t        j                  cY S w xY w)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.
    rI   r   r^   )rS   rp   r   rq   rr   r   rs   r   r   rO   rt   r   r}   callable)rY   r_   argumentrx   s       r%   infer_callabler   W  s     499~!!yy|H w78 (D001;;x((*++	 M*   s   B B98B9c           	        t        | j                        dk  rt        | j                  d   }	 t        |j	                  |            }t        |t        j                  t        j                  f      st        t        j                  ||j                  | j                  | j                        }| |_        |j#                  g |j                  t%        |dd             |S # t
        t        f$ r}t        |d}~ww xY w)zxUnderstand `property` class.

    This only infers the output of `property`
    call, not the arguments themselves.
    rI   r   r^   N)functionr2   r/   r0   doc_node)bodyrp   r   )rS   rp   r   rq   rr   r   rs   rO   r   r   Lambdar   Propertyr2   r/   r0   r.   r   r   )rY   r_   getterrx   ry   	prop_funcs         r%   infer_propertyr   m  s     499~!!YYq\F+W56 h!2!2ELL AB!!  ]]{{??	I I]]:t4  
 ' M* +!s*+s   C# #C>2C99C>c                   t        | j                        dkD  rt        | j                  st        j                  d      S | j                  d   }	 t        |j                  |            }t        |t        j                        rt        j                  S |j                  |      }t        |t        j                        rt        j                  S t        j                  |      S # t        t        f$ r t        j                  cY S w xY w)zUnderstand bool calls.rI   Fr   r^   )rS   rp   r   r   r}   rq   rr   r   rs   r   r   rO   rt   
bool_value)rY   r_   r   rx   r   s        r%   
infer_boolr     s    
499~!!99{{5!!yy|H w78 (D001$$W$5J*d223;;z"" M*   s   C& &DDc                    t        | j                        dk7  rt        t        j                  | j                  d   |      S )z+Understand the one-argument form of *type*.rI   r   )rS   rp   r   r   object_typerY   r_   s     r%   
infer_typer     s3    
499~!!tyy|W55r$   c                   | j                   }dt        |      cxk  r
dk  st         t        t        t        j
                  |      }|D cg c]
  } ||       }}|D ]o  }|rt        |t        j                        rt        t        |t        j                        st        t        |j                  t        d      t        f      rkt         t        |      dk  r!|j                  dgdt        |      z
  z         t        j                  | j                  | j                   | j"                  | j$                  | j&                        } |j(                  |  |S c c}w )zUnderstand `slice` calls.r   r   r^   Nrm   )rp   rS   r   r   r   r   rO   rt   r   r}   r   rG   intextendSlicer/   r0   r.   rn   ro   r   )rY   r_   rp   
infer_funcrv   
slice_nodes         r%   infer_slicer     s$   99Ds4yA!! !!':J'+,JsO,D, &jd&:&:;%%#u{{+%%#))d4j#%67%%& 4y1}TFa#d)m,-{{??{{??**J J+ -s   Ec                6    t        | j                         f      S r"   )ra   r   )rY   r_   rb   s      r%   _infer_object__new__decoratorr     s    
 '')+,,r$   c                    | j                   sy| j                   j                  D ]6  }t        |t        j                        s|j	                         t
        k(  s6 y y)zfPredicate before inference_tip.

    Check if the given ClassDef has an @object.__new__ decorator
    FT)
decoratorsr   rO   rV   	as_stringOBJECT_DUNDER_NEW)rY   	decorators     r%   #_infer_object__new__decorator_checkr     sO    
 ??__** 	i1""$(99 r$   c                   t         j                  j                  | |      }|j                  rt	        d      t        |j                        dk7  r!t	        dt        |j                               |j                  \  }}	 t        |j                  |            }t        |t        j                        st	        d      	 t        ||      }	 t        j                   |||      }t        j(                  |      S # t        t        f$ r}t        |d}~ww xY w# t        $ r}t        |d}~ww xY w# t"        $ r}t	        dt%        |      z         |d}~wt&        $ r}t        |d}~ww xY w)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
    r^   z2TypeError: issubclass() takes no keyword argumentsr   Expected two arguments, got NzTypeError: arg 1 must be classTypeError: )r   r   r   r   r   rS   r   rq   rr   r   rs   rO   r   ClassDef_class_or_tuple_to_containerr   object_issubclassr   rB   r   r}   )	callnoder_   r   obj_nodeclass_or_tuple_nodeobj_typery   class_containerissubclass_bools	            r%   infer_issubclassr     sb    ''''BD!"VWW
4$$%*!*3t/H/H+I*JK
 	
 %)$=$=!H!+w78 h/!"BCC+6

+!33HowW
 ;;''' M* +!s*+  +!s*+  E!-#c(":;D +!s*+sT   C= D D3 =DDD	D0$D++D03	E,<EE, E''E,c                `   t         j                  j                  | |      }|j                  rt	        d      t        |j                        dk7  r!t	        dt        |j                               |j                  \  }}	 t        ||      }	 t        j                  |||      }t        |t        j                         rt        t#        j$                  |      S # t        $ r}t        |d}~ww xY w# t        $ r}t	        dt        |      z         |d}~wt        $ r}t        |d}~ww xY w)zInfer isinstance calls.

    :param nodes.Call callnode: an isinstance call
    :raises UseInferenceDefault: If the node cannot be inferred
    r^   z2TypeError: isinstance() takes no keyword argumentsr   r   Nr   )r   r   r   r   r   rS   r   r   r   r   object_isinstancer   rB   r   rO   r   rt   r   r}   )r   r_   r   r   r   r   ry   isinstance_bools           r%   infer_isinstancer     s$    ''''BD!"VWW
4$$%*!*3t/H/H+I*JK
 	
 %)$=$=!H!+6

+!33HowW
 /4#7#78!!;;''  +!s*+  E!-#c(":;D +!s*+s<   C C4 	C1%C,,C14	D-=DD-!D((D-c                h   	 t        | j                  |            }t	        |t
        j                        r5	 |j                  D  cg c]  } t        | j                  |             }} |S |g}|S # t        $ r}t        | |      |d }~ww xY wc c} w # t        $ r}t         |      |d }~ww xY w)Nr^   r   )rq   rr   rs   r   rO   r   r   r   )rY   r_   
node_inferer   s        r%   r   r   7  s    @$**W*56

 *ekk*	D>Hoo6:TZZZ01O   &,  @$8a?@  	D dG<!C	Ds@   A1 B "B(B 1	B:BBB 	B1B,,B1c                   t         j                  j                  | |      }|j                  rt	        d      t        |j                        dk7  r.t	        dj                  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
    r^   z/TypeError: len() must take no keyword argumentsrI   z=TypeError: len() must take exactly one argument ({len}) given)rS   N)r   r   r   r   r   rS   r   r+   r   r}   r   
object_lenr   r   rB   )rY   r_   r   argument_nodery   s        r%   	infer_lenr  O  s     ''g'>D!"STT
4$$%*!"Fs4+D+D'EFF
 	
 //O]5{{7--mWMNNn- 5!#c(+45s   )B8 8C!CC!c                    t         j                  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
    r^   z/TypeError: str() must take no keyword arguments N)
r   r   r   r   r   r   r}   r   r   rB   )rY   r_   r   ry   s       r%   	infer_strr  f  sm     ''g'>D!"STT5{{2n- 5!#c(+45s   A A8A33A8c                   t         j                  j                  | |      }|j                  rt	        d      |j
                  r	 t        |j
                  d   j                  |            }t        |t        j                        rt        t        |t        j                        rKt        |j                   t"        t        f      r+	 t#        |j                         }t        j                  |      S t        j                  d      S # t        t        f$ r}t	        t        |            |d}~ww xY w# t$        $ r t        j                  d      cY S w xY w)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
    r^   /TypeError: int() must take no keyword argumentsr   N)r   r   r   r   r   r   rq   rr   r   rs   rB   rO   r   rt   r   r}   r   r   
ValueError)rY   r_   r   first_valuery   actual_values         r%   	infer_intr  v  s    ''g'>D!"STT  	9t88;AA'ARSK k4#7#78%%k5;;/JSz5
&";#4#45 ;;|,,;;q> . 	9%c#h/S8	9  &{{1~%&s*   (D 	D4 D1D,,D14EEc                     fd}t         j                  j                   |      }|j                  rt	        d      t        |j                        dvrt	        d      t        j                  d      }|j                  d   }	 t        |j                  |            }|t        j                  u r |g       S t        j                  f}t        |t        j                   t        j"                  t        j$                  f      rB|j&                  }|D ]  }	t        |	|      r |g       c S  |D 	cg c]  }	|	|f }
}	 ||
      S t        |t        j                        rVt        |j(                  t*        t,        f      r6|j(                  D 	cg c]  }	t        j                  |	      |f }
}	 ||
      S t        |t        j.                        rF|j1                         }|D ]  }t        ||      r |g       c S  |D 	cg c]  }	|	|f }
}	 ||
      S  |g       S # t        t        f$ r  |g       cY S w xY wc c}	w c c}	w c c}	w )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                        }|j                  |        |S )Nr   )r   r   r0   r/   r.   rn   ro   r   )elementsnew_noderY   s     r%   _build_dict_with_elementsz6infer_dict_fromkeys.<locals>._build_dict_with_elements  sK    ::;;;;..
 	(#r$   r^   r  >   rI   r   z5TypeError: Needs between 1 and 2 positional argumentsNr   )r   r   r   r   r   rS   r   r   r}   rq   rr   r   rs   r   r   rO   r   r   r   r   r   rB   rA   r   itered)rY   r_   r  r   defaultvaluesinferred_valuesaccepted_iterable_elementsr  r   elements_with_valuer   r   s   `            r%   infer_dict_fromkeysr    sC   	 ''g'>D!"STT
4$$%V3!C
 	
 kk$G&&q)F-v||G|<= $***(,, #(++/EJJ		5;;#GH"'' 	5Gg'AB044	5
 BJJg1JJ()<==/5;;/JU|5 <K;P;P
07U[[!7+
 
 ))<==/5::.%%' 	5Cc#=>044	5
 BFFg1FF()<== %R((E M* -(,,- K

 Gs$   H 2H<IIH98H9c                $   t        | j                  t        j                        sJ t	        j
                  | j                  j                  j                  |            \  }}t        d |D              rt        t        t           |      S t        )Nr^   c              3     K   | ]L  }t        |t        j                  t        j                  t        j                  t
        j                  f       N y wr"   )rO   r   r   r   r   r   	FrozenSet)r~   inferred_nodes     r%   r   z%_infer_copy_method.<locals>.<genexpr>  s?        	EJJ

EIIw?P?PQ	
s   AA)rO   rP   r   rV   	itertoolsteerX   rr   r   r   r	   
CopyResultr   )rY   r_   rb   inferred_originferred_copys        r%   _infer_copy_methodr!    sv     dii111#,==1E1Eg1E1V#W M=
  +	  HZ(-88
r$   c                   t        | j                  t        j                        r| j                  j                  dk(  syt        | j                  j
                  t        j                        r*t        j                  | j                  j
                        }n| j                  j
                  }t        |t        j                        xr t        |j                  t              S )zCatch calls to str.format().r+   F)rO   rP   r   rV   rW   rX   rQ   r   r   r}   r   rB   )rY   r   s     r%   _is_str_format_callr#    s    dii19K9Kx9W$))..%**-		/		eU[[)Jjc.JJr$   c                   t         j                  j                  | |      }t        | j                  t
        j                  t
        j                  t
        j                  f      sJ t        | j                  j                  t
        j                        rbt        j                  | j                  j                        x}rt        |t
        j                        st        t        j                  g      S |}n_t        | j                  j                  t
        j                        r| j                  j                  }nt        t        j                  g      S |j                   }g }|j"                  D ]_  }t        j                  ||      }	t        |	t
        j                        st        t        j                  g      c S |j%                  |	       a |D cg c]  }|j                    }
}i }|j&                  j)                         D ]V  \  }}t        j                  ||      }	t        |	t
        j                        st        t        j                  g      c S |	||<   X |j)                         D ci c]  \  }}||j                    }}}	  |j*                  |
i |}t        t        j6                  |      g      S c c}w c c}}w # t,        t.        t0        t2        t4        f$ r t        t        j                  g      cY S w xY w)z?Return a Const node based on the template and passed arguments.r^   )r   r   r   rO   rP   r   rV   
AssignAttrDelAttrrX   rQ   r   r   r}   ra   r   r   r   r   r   r:   r+   AttributeError
IndexErrorKeyError	TypeErrorr  const_factory)rY   r_   rb   r   rx   r   format_templateinferred_positionalione_inferred
pos_valuesinferred_keywordkvkeyword_valuesformatted_strings                   r%   _infer_str_format_callr6    sh    ''g'>Ddii%//53C3CU]]!STTT $))..%**- OODIINN;;;JekkE
 ))*++	DIINNEKK	0		T%%&''kkO .0&& 1q'2,4))*++""<0	1 /BBQWWBJB 02&&,,. +1q'2,4))*++*	+ >N=S=S=U%VTQaj%VN%V(1?11:PP $$%56788+ C &W J)ZH (
 T%%&''(s   J?3KK
 
8LL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       | j)                  t*        j,                  t/        t0              t2               | j)                  t*        j4                  t/        t6              d        | j)                  t*        j4                  t/        t8              t:               y )Nboolsuperr   propertyr   r`   r   setr   rM   	frozensetrG   slicerO   
issubclassrS   rB   r   zdict.fromkeysc                    t        | j                  t        j                        xr | j                  j                  dk(  S )Ncopy)rO   rP   r   rV   rW   )rY   s    r%   <lambda>zregister.<locals>.<lambda>O  s/    Z		5??; )II&( r$   )rk   r   r   r   r   r   r   infer_tuple	infer_set
infer_listr   infer_frozensetr   r   r   r   r  r  r  r  rh   r   r   r   r   r   ri   r!  r6  r#  )rj   s    r%   registerrF  /  sT   w
F;wW=w
Cw
CwyAwyAwW=w	59w
F;w
F;wEw
F;wW=w(8,Gw(8,Gw	59w	59w	59w(;_M 34+ 

()	) 

,-r$   )rg   r
   )rg   r8  )rj   r   rg   None)
rY   re   r_   rf   ru   type[nodes.BaseContainer]r>   zACallable[[SuccessfulInferenceResult], nodes.BaseContainer | None]rg   nodes.BaseContainer)rv   r   r_   rf   r   rH  r   z>tuple[type[nodes.BaseContainer] | type[ContainerObjects], ...]r   BuiltContainersrg   znodes.BaseContainer | None)rY   re   r_   rf   r   rH  r   z7tuple[type[nodes.NodeNG] | type[ContainerObjects], ...]r   rJ  rg   rI  r"   )rY   re   r_   rf   rg   z
nodes.Dict)rY   re   r_   rf   rg   zobjects.Super)r_   rf   )rY   re   r_   rf   rg   zobjects.Property)rY   znodes.ClassDefr_   rf   rb   r   rg   zIterator[Instance])r   re   r_   rf   rg   znodes.Const)rY   r   r_   rf   rg   zlist[InferenceResult])rY   re   r_   rf   rb   r   rg   zIterator[CopyResult])rY   re   rg   r8  )rY   re   r_   rf   rb   r   rg   z3Iterator[ConstFactoryResult | util.UninferableBase])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    r  	DictItemsDictKeys
DictValuesr   r   r   r;  r<  rJ  r   r   r   r  r   rD   rC   r&   r7   r?   rE   r[   rk   rz   r   r   r   rB  rD  rC  rE  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r!  r#  r6  rF  r#   r$   r%   <module>r[     sf  
 * "  .  L L L K K * ,  + &  &  KJIO 	JJ	JJ	II
 % (	V$N #+:  	 F
$ ) Q	
 B%6	"%6$%6 %%6 N	%6
  %6  %6PN
N$N %N G	N
  N N& 
++

		  
**		 
 
))zz5;;(9(97;K;KL		 


zz5;;		73D3DgFVFVW	:3n :>=
=6==@086,. :>"
"6""J#.6@ >B-
-#:-MP--((X >B"("(#:"("(L ?C
$;05.5 @D)P :>
6IL 
K :>29
29629IL29829j(r$   