
    yIf!                    n   d Z ddlmZ ddlZddlZddlZddlZddlmZ ddl	m
Z
 ddlmZmZmZ ddlZddlmZmZmZ ddlmZmZ dd	lmZmZmZ dd
lmZ ddlmZ ddlmZm Z  erddl!m"Z" dZ# e$e#          Z%d Z&dJdZ' G d d          Z( G d de(          Z) G d de(          Z* G d de(          Z+ G d de(          Z, G d de(          Z- G d  d!e(          Z. G d" d#e*          Z/ G d$ d%e*e.          Z0 G d& d'e0          Z1 G d( d)e(          Z2 G d* d+e2          Z3 G d, d-e3          Z4 G d. d/e3          Z5 G d0 d1e3          Z6 G d2 d3e3          Z7i d4e4d5e6d6e7d7e5d8e5d9e5d:e5d;e5d<e5d=e5d>e5d?e5d@e5dAe5dBe5dCe5dDe5e5e5dEZ8 G dF dGe(          Z9 G dH dIe(          Z:dS )Ka  
Data object model, as per https://docs.python.org/3/reference/datamodel.html.

This module describes, at least partially, a data object model for some
of astroid's nodes. The model contains special attributes that nodes such
as functions, classes, modules etc have, such as __doc__, __class__,
__module__ etc, being used when doing attribute lookups over nodes.

For instance, inferring `obj.__class__` will first trigger an inference
of the `obj` variable. If it was successfully inferred, then an attribute
`__class__ will be looked for in the inferred object. This is the part
where the data model occurs. The model is attached to those nodes
and the lookup mechanism will try to see if attributes such as
`__class__` are defined by the model or not. If they are defined,
the model will be requested to return the corresponding value of that
attribute. Thus the model can be viewed as a special part of the lookup
mechanism.
    )annotationsN)Iterator)	lru_cache)TYPE_CHECKINGAnyLiteral)basesnodesutil)InferenceContextcopy_context)AttributeInferenceErrorInferenceError	NoDefault)AstroidManager)node_classes)InferenceResultSuccessfulInferenceResult)Propertyattr_c                X   t          j        | | j        | j        | j        | j                  fdt          |                                          D             }d |                                D             }	                    t          t          ||                               S )Nparentlineno
col_offset
end_linenoend_col_offsetc                <    g | ]}t          j        |           S )valuer   r   Const).0r    objs     S/var/www/piapp/venv/lib/python3.11/site-packages/astroid/interpreter/objectmodel.py
<listcomp>z _dunder_dict.<locals>.<listcomp>;   s6       8=s333      c                    g | ]
}|d          S ) )r#   elems     r%   r&   z _dunder_dict.<locals>.<listcomp>B   s    7774d2h777r'   )r   Dictr   r   r   r   listkeysvaluespostinitzip)instance
attributesr.   r/   r$   s       @r%   _dunder_dictr4   1   s    

&&.  C   AEjooFWFWAXAX  D 87:#4#4#6#6777FLLc$''(()))Jr'   modelObjectModelreturnr   c                J    	 | j         j        S # t          $ r
 | j         cY S w xY wN)	_instance_proxiedAttributeError)r5   s    r%   _get_bound_noder=   H   s;    ''   s    ""c                  ~    e Zd Zd Zd Zd ZddZddZedd
            Z	d Z
edd            Zedd            ZdS )r6   c                    d | _         d S r9   r:   selfs    r%   __init__zObjectModel.__init__Q   s    r'   c                   g }t          |           j        }d}t          |          dz   }t          |                                           D ]}dt          |          z
  |z
  }t          j        |d|                              d          }|d         g}|dd          D ]}	|                    d|z  |	z              |                    |           ||d	d|z  z   	                    |          d
z  S )Nz%(cname)s(%(fields)s)   P      )indentwidthTr    z,
)cnamefields)
type__name__lensortedr3   pprintpformat
splitlinesappendjoin)
rB   resultrK   string	alignmentfieldrI   linesinnerlines
             r%   __repr__zObjectModel.__repr__T   s   T

#(JJN	DOO--.. 	! 	!EUOi/EN5%@@@KKDQQE1XJEabb	 5 5S9_t34444MM%    sY.44V<<
 
 
 	
r'   c                    || _         | S r9   r@   )rB   r2   s     r%   __call__zObjectModel.__call__g   s    !r'   Nc                     | |          S r9   r*   )rB   r2   clss      r%   __get__zObjectModel.__get__k   s     tH~~r'   r7   boolc                .    ||                                  v S r9   )r3   rB   names     r%   __contains__zObjectModel.__contains__u   s    t((((r'   	list[str]c                4    d t          |           D             S )z;Get the attributes which are exported by this object model.c                `    g | ]+}|                     t                    |t          d          ,S r9   )
startswithIMPL_PREFIXLEN_OF_IMPL_PREFIX)r#   os     r%   r&   z*ObjectModel.attributes.<locals>.<listcomp>{   s5    WWW1Q\\+=V=VW$%%&WWWr'   )dirrA   s    r%   r3   zObjectModel.attributesx   s     XWD		WWWWr'   c                    ||                                  v rt          | t          |z             S t          | j        |          )zLook up the given *name* in the current model.

        It should return an AST or an interpreter object,
        but if the name is not found, then an AttributeInferenceError will be raised.
        target	attribute)r3   getattrrl   r   r:   re   s     r%   lookupzObjectModel.lookup}   sC     4??$$$$4t!3444%T^tLLLLr'   bases.BoundMethodc                    ddl m} |                    d          }t                      j        d         |_        t          j        |t          |                     S )zECalling cls.__new__(type) on an object returns an instance of 'type'.r   builderz$def __new__(self, cls): return cls()objectproxybound	astroidry   extract_noder   builtins_moduler   r	   BoundMethodr=   rB   ry   nodes      r%   attr___new__zObjectModel.attr___new__   sc     	$#####")"6"66#
 #

 %&&6x@ t?43H3HIIIIr'   c                    ddl m} |                    d          }t                      j        d         |_        t          j        |t          |                     S )z-Calling cls.__init__() normally returns None.r   rx   z0def __init__(self, *args, **kwargs): return Nonerz   r{   r~   r   s      r%   attr___init__zObjectModel.attr___init__   se     	$#####
 #*"6"6B#
 #

 %&&6x@ t?43H3HIIIIr'   r9   )r7   rc   )r7   rh   r7   rv   )rN   
__module____qualname__rC   r]   r_   rb   rg   r   r3   ru   propertyr   r   r*   r'   r%   r6   r6   P   s          
 
 
&     ) ) ) ) X X X YXM M M J J J XJ J J J XJ J Jr'   c                      e Zd Zd Zed             Zed             Zed             Zed             Zed             Z	ed             Z
ed             Zed	             Zed
             Zed             ZdS )ModuleModelc                \    t                      j        }|j                            d          S )N__dict__)r   r   special_attributesru   )rB   builtins_ast_modules     r%   	_builtinszModuleModel._builtins   s(    ,..>"5<<ZHHHr'   c                *    |                                  S r9   )r   rA   s    r%   attr_builtinszModuleModel.attr_builtins   s    ~~r'   c                      j         j        st           j         d           fd j         j        D             }t	          j         j                   }|                    |           |S )N__path__rq   c                    g | ]Q}t          j        |                    d           s|nt          j                            |          j                  RS )z__init__.pyr   )r   r"   endswithospathdirnamer:   )r#   r   rB   s     r%   r&   z-ModuleModel.attr___path__.<locals>.<listcomp>   si     
 
 
   $m < <WDD"'//RVBWBW~	  
 
 
r'   r   )r:   packager   r   r   Listr0   )rB   	path_objs	containers   `  r%   attr___path__zModuleModel.attr___path__   s    ~% 	W):VVVV
 
 
 
 +
 
 
	 !%T^<<<	9%%%r'   c                L    t          j        | j        j        | j                  S Nr   r   r"   r:   rf   rA   s    r%   attr___name__zModuleModel.attr___name__       !(;DNSSSSr'   c                j    t          j        t          | j        j        dd           | j                  S Nr    r   r   r"   rt   r:   doc_noderA   s    r%   attr___doc__zModuleModel.attr___doc__   5    !$.17DAA>
 
 
 	
r'   c                L    t          j        | j        j        | j                  S r   )r   r"   r:   filerA   s    r%   attr___file__zModuleModel.attr___file__   r   r'   c                @    t          | j        | j        j                  S r9   )r4   r:   globalsrA   s    r%   attr___dict__zModuleModel.attr___dict__   s    DNDN,BCCCr'   c                n    | j         j        sd}n| j         j        }t          j        || j                   S )N r   )r:   r   rf   r   r"   )rB   r    s     r%   attr___package__zModuleModel.attr___package__   s8    ~% 	(EEN'E!dnEEEEr'   c                (    t          j                    S r9   r   UnknownrA   s    r%   attr___spec__zModuleModel.attr___spec__        #%%%r'   c                (    t          j                    S r9   r   rA   s    r%   attr___loader__zModuleModel.attr___loader__   r   r'   c                (    t          j                    S r9   r   rA   s    r%   attr___cached__zModuleModel.attr___cached__   r   r'   N)rN   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r*   r'   r%   r   r      s@       I I I     X    X& T T XT 
 
 X
 T T XT D D XD F F XF & & X& & & X& & & X& & &r'   r   c                  :   e Zd Zed             Zed             Zed             Zed             Zed             Zed             Z	e	Z
ed             Zed             Zed	             Zed
             ZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZ eZ!dS )FunctionModelc                L    t          j        | j        j        | j                  S r   r   rA   s    r%   r   zFunctionModel.attr___name__   r   r'   c                j    t          j        t          | j        j        dd           | j                  S r   r   rA   s    r%   r   zFunctionModel.attr___doc__   r   r'   c                f    t          j        | j                                        | j                  S r   r   r"   r:   qnamerA   s    r%   attr___qualname__zFunctionModel.attr___qualname__   s(    !(<(<(>(>t~VVVVr'   c                    | j         }|j        j        st          j        d |          S t          j        |          }|                    |j        j                   |S )Nr   r   )r:   argsdefaultsr   r"   Tupler0   )rB   funcdefaults_objs      r%   attr___defaults__zFunctionModel.attr___defaults__  s^    ~y! 	?%D>>>>#)666di0111r'   c                   t          j        | j        | j        j        | j        j        | j        j        | j        j                  | j        j        sd }n| j        j        }| j        j        }t          j
        t          |j        pg |j                  t          |j        |j                  t          |j        pg |j                            }d |D             }|j        r|j        ||j        <   |j        r|j        ||j        <   |r||d<   fd |j                    D             }                    |           S )Nr   c                (    i | ]\  }}||j         |S r*   )rf   )r#   arg
annotations      r%   
<dictcomp>z6FunctionModel.attr___annotations__.<locals>.<dictcomp>$  s5     
 
 
%6c:j
Hj
 
 
r'   r7   c                F    g | ]\  }}t          j        |           |fS )r   r!   )r#   keyr    r$   s      r%   r&   z6FunctionModel.attr___annotations__.<locals>.<listcomp>.  sB     
 
 
e C000%8
 
 
r'   )r   r,   r:   r   r   r   r   returnsr   	itertoolschainr1   r   
kwonlyargskwonlyargs_annotationsposonlyargsposonlyargs_annotationsvarargannotationvarargkwargannotationkwargitemsr0   )rB   r   r   pair_annotationsr   r   r$   s         @r%   attr___annotations__z"FunctionModel.attr___annotations__  sm   >>(~0~0>8
 
 
 ~% 	-GGn,G~"$?	R!122!<== &B(DEE
 

 
:J
 
 
   	='+'<K$ 	;&*&:K
# 	,$+K!
 
 
 
 1 1 3 3
 
 

 	U
r'   c                    t          j        | j        | j        j        | j        j        | j        j        | j        j                  S Nr   r   r,   r:   r   r   r   r   rA   s    r%   r   zFunctionModel.attr___dict__6  A     >>(~0~0>8
 
 
 	
r'   c                J   d }| j         j        }t          j        | j         | j         j        | j         j        | j         j        | j         j                  }t           |||                    }|	                    t          |                                                     |S )Nc              3     K   | j         D ]O}	 |                     |j                  }n# t          $ r Y *w xY wt	          j        |j        |          }||fV  Pd S Nr   )r   default_valuerf   r   r   r"   )r   r   r   defaultrf   s        r%   _default_argsz8FunctionModel.attr___kwdefaults__.<locals>._default_argsD  s       $ $"00::GG    H $)#(6BBBGm####$ $s   (
55r   )r:   r   r   r,   r   r   r   r   dictr0   r-   r   )rB   r   r   r$   r   s        r%   attr___kwdefaults__z!FunctionModel.attr___kwdefaults__B  s    	$ 	$ 	$ ~">>(~0~0>8
 
 
 dC0011T(..**++,,,
r'   c                |    t          j        | j                                                                                  S r9   r   r"   r:   rootr   rA   s    r%   attr___module__zFunctionModel.attr___module__[  -    !$."5"5"7"7"="="?"?@@@r'   c                t    | j          G fddt          j                  } || j         | j                   S )Nc                  F    e Zd ZdZddZ	 dd fdZe fd            ZdS )9FunctionModel.attr___get__.<locals>.DescriptorBoundMethodz_Bound method which knows how to understand calling descriptor
            binding.
            r7   
Literal[0]c                    dS Nr   r*   rA   s    r%   implicit_parameterszMFunctionModel.attr___get__.<locals>.DescriptorBoundMethod.implicit_parametersh  s	     qr'   Ncaller SuccessfulInferenceResult | NonecontextInferenceContext | NoneIterator[bases.BoundMethod]c              3  4  K   t          |j                  dk    st          |j                  dk     rt          d| |          t          |          }	 t	          |j        d                             |                    }n/# t          $ r"}t          ||j        d                   |d }~ww xY wt          |t          j	                  rt          d| |          t          t          j                  rV  d S                     j        j        j        j        j        j        	          }|                    j        j        j        j        j        
           t          j        |          }t          j        ||          V  d S )NrG   rE   z(Invalid arguments for descriptor bindingrr   r   r   r   )r   r   zInvalid class inferredrf   r   r   r   r   r   )r   r{   )rO   r   r   r   nextinferStopIteration
isinstancer   UninferableBaser	   r   	__class__rf   r   r   r   r   r   r0   body
decoratorsr   r   UnboundMethod)rB   r   r   ra   enew_funcr|   r   s          r%   infer_call_resultzKFunctionModel.attr___get__.<locals>.DescriptorBoundMethod.infer_call_resultm  s     
 v{##a''3v{+;+;a+?+?(B# '    'w//Vv{1~33G3DDEECC$ V V V(v{1~NNNTUUV c4#788 (0w    dE$566 JJJF  >>;#;##'#6 *   !!IIOL!] "    +H55'e3????????s   .B 
B1B,,B1c           
     V   t          j        j        j        dd          }j        j                                        }|                    t          j        ddd|dd                     j        j                                        }|                    ||g g g g g g            |S )a  Overwrite the underlying args to match those of the underlying func.

                Usually the underlying *func* is a function/method, as in:

                    def test(self):
                        pass

                This has only the *self* parameter but when we access test.__get__
                we get a new object which has two parameters, *self* and *type*.
                Nr   r   r   rM   r   r  )r   r   r   r   kw_defaultsr   r   r   )	r   	Argumentsr   r   copyrT   
AssignNamer   r0   )rB   	argumentspositional_or_keyword_paramspositional_only_paramsr   s       r%   r   z>FunctionModel.attr___get__.<locals>.DescriptorBoundMethod.args  s     $-9+D  	 04y~/B/B/D/D,,33&# #$(#''+  	 	 	 *.)>)C)C)E)E&""5 6! " "+-,. # 	 	 	 ! r'   )r7   r   r9   )r   r   r   r   r7   r   )rN   r   r   __doc__r   r  r   r   r   s   r%   DescriptorBoundMethodr   c  s             482@ 2@ 2@ 2@ 2@ 2@ 2@h (! (! (! (! X(! (! (!r'   r  r{   )r:   r	   r   )rB   r  r   s     @r%   attr___get__zFunctionModel.attr___get___  sh    ~g	! g	! g	! g	! g	! g	! g	!E$5 g	! g	! g	!R %$4>PPPPr'   c                (    t          j                    S r9   r   rA   s    r%   attr___ne__zFunctionModel.attr___ne__  s    #%%%r'   N)"rN   r   r   r   r   r   r   r   r   r   attr___globals__r   r   r  r  attr___subclasshook__attr___str__attr___sizeof__attr___setattr___attr___repr__attr___reduce__attr___reduce_ex__attr___lt__attr___eq__attr___gt__attr___format__attr___delattr___attr___getattribute__attr___hash__attr___dir__attr___call__attr___class__attr___closure__attr___code__r*   r'   r%   r   r      s       T T XT 
 
 X
 W W XW   X % % X%N 
 
 X
 %  X0 A A XA lQ lQ XlQ^ & & X& (L!O#M!O$KKK!O#'MLM N"MMMr'   r   c                      e Zd Z fdZed             Zed             Zed             Zed             Zed             Z	ed             Z
ed             Zed	             Zed
             Zed             Zed             Z xZS )
ClassModelc                n    t                      | _        t                                                       d S r9   )r   r   superrC   )rB   r	  s    r%   rC   zClassModel.__init__  s,    '))r'   c                |    t          j        | j                                                                                  S r9   r   rA   s    r%   r   zClassModel.attr___module__  r   r'   c                >    t          j        | j        j                  S r9   r   rA   s    r%   r   zClassModel.attr___name__  s    !$."5666r'   c                X    t          j        | j                                                  S r9   r   rA   s    r%   r   zClassModel.attr___qualname__  s!    !$."6"6"8"8999r'   c                \    t          j        t          | j        j        dd                     S Nr    r   rA   s    r%   r   zClassModel.attr___doc__  $    !'$.*A7D"Q"QRRRr'   c                    | j         j        st          | j         d          | j                                         }t	          j        | j                   }|                    |           |S )N__mro__rq   r   )r:   newstyler   mror   r   r0   )rB   r@  r$   s      r%   attr___mro__zClassModel.attr___mro__  sd    ~& 	V)9UUUUn  "" 777S
r'   c                    | j         j        st          | j         d          |  G fddt          j                  }| j                                         }|j        d         d         } |||          S )Nr@  rq   c                       e Zd Z	 d	d
 fdZdS )+ClassModel.attr_mro.<locals>.MroBoundMethodNr   r   r   r   r7   Iterator[node_classes.Tuple]c              3     K   j         V  d S r9   )rA  )rB   r   r   
other_selfs      r%   r  z=ClassModel.attr_mro.<locals>.MroBoundMethod.infer_call_result  s      
 !------r'   r9   )r   r   r   r   r7   rE  rN   r   r   r  )rG  s   r%   MroBoundMethodrD    s=         48. . . . . . . . .r'   rI  r   r{   )r:   r?  r   r	   r   implicit_metaclasslocals)rB   rI  rJ  
mro_methodrG  s       @r%   attr_mrozClassModel.attr_mro	  s    ~& 	R)5QQQQ
	. 	. 	. 	. 	. 	. 	.U. 	. 	. 	. "^>>@@'.u5a8
~J6HIIIIr'   c                    t          j                    }t                      }t          | j                            |                    }|                    |           |S )Nelts)r   r   r   r-   r:   _inferred_basesr0   )rB   r$   r   rP  s       r%   attr___bases__zClassModel.attr___bases__  sQ     """$$DN227;;<<$
r'   c                B    ddl m} |                    | j                  S Nr   )helpersr   rU  object_typer:   rB   rU  s     r%   r0  zClassModel.attr___class__&  ,     	$#####""4>222r'   c                     j         j        st           j         d           j                                          j                                         } fd|                    t          j                  D             }t          j	         j                   
                    |            G fddt          j                  } j                                         }|j        d         d         } |||          S )	zGet the subclasses of the underlying class.

        This looks only in the current module for retrieving the subclasses,
        thus it might miss a couple of them.
        __subclasses__rq   c                b    g | ]+}|j         k    |                    j                   )|,S )r  )r:   is_subtype_ofr   )r#   ra   r   rB   s     r%   r&   z2ClassModel.attr___subclasses__.<locals>.<listcomp>;  sJ     
 
 
dn$$):):5$,):)W)W$ $$$r'   r   c                       e Zd Z	 d	d
 fdZdS )=ClassModel.attr___subclasses__.<locals>.SubclassesBoundMethodNr   r   r   r   r7   Iterator[node_classes.List]c              3     K   V  d S r9   r*   rB   r   r   r$   s      r%   r  zOClassModel.attr___subclasses__.<locals>.SubclassesBoundMethod.infer_call_resultE        
 					r'   r9   )r   r   r   r   r7   r`  rH  r$   s   r%   SubclassesBoundMethodr_  D  =         48        r'   re  r   r{   )r:   r?  r   r   r   nodes_of_classr
   ClassDefr   r   r0   r	   r   rJ  rK  )rB   r   classesre  rJ  subclasses_methodr$   r   s   `     @@r%   attr___subclasses__zClassModel.attr___subclasses__-  s:    ~& 	)~1A    $$&&~""$$
 
 
 
 
**5>::
 
 
 t~666W	 	 	 	 	 	 	E$5 	 	 	 "^>>@@.56FGJ$$+<DVWWWWr'   c                    t          j        | j        | j        j        | j        j        | j        j        | j        j                  S r   r   rA   s    r%   r   zClassModel.attr___dict__P  r   r'   c                4    | j                                         S )z-Calling a class A() returns an instance of A.)r:   instantiate_classrA   s    r%   r/  zClassModel.attr___call__Z  s     ~//111r'   )rN   r   r   rC   r   r   r   r   r   rA  rM  rR  r0  rk  r   r/  __classcell__r	  s   @r%   r4  r4    sn            A A XA 7 7 X7 : : X: S S XS   X J J XJ(   X 3 3 X3  X  X X XD 
 
 X
 2 2 X2 2 2 2 2r'   r4  c                  f    e Zd Zed             Zed             Zed             Zed             ZdS )
SuperModelc                    | j         j        S r9   )r:   mro_pointerrA   s    r%   attr___thisclass__zSuperModel.attr___thisclass__a      ~))r'   c                    | j         j        S r9   )r:   _self_classrA   s    r%   attr___self_class__zSuperModel.attr___self_class__e  rv  r'   c                    | j         j        S r9   )r:   rM   rA   s    r%   attr___self__zSuperModel.attr___self__i  s    ~""r'   c                    | j         j        S r9   r:   r;   rA   s    r%   r0  zSuperModel.attr___class__m      ~&&r'   N)rN   r   r   r   ru  ry  r{  r0  r*   r'   r%   rr  rr  `  s~        * * X* * * X* # # X# ' ' X' ' 'r'   rr  c                  \    e Zd Zed             Zed             Zed             ZeZeZeZ	dS )UnboundMethodModelc                B    ddl m} |                    | j                  S rT  rV  rX  s     r%   r0  z!UnboundMethodModel.attr___class__s  rY  r'   c                    | j         j        S r9   r}  rA   s    r%   attr___func__z UnboundMethodModel.attr___func__z  r~  r'   c                8    t          j        d | j                  S r   )r   r"   r:   rA   s    r%   r{  z UnboundMethodModel.attr___self__~  s    !T^DDDDr'   N)
rN   r   r   r   r0  r  r{  attr_im_funcattr_im_classattr_im_selfr*   r'   r%   r  r  r  sq        3 3 X3 ' ' X' E E XE !L"M LLLr'   r  c                  B    e Zd ZdZedd            Zedd            ZdS )ContextManagerModelzModel for context managers.

    Based on 3.3.9 of the Data Model documentation:
    https://docs.python.org/3/reference/datamodel.html#with-statement-context-managers
    r7   rv   c                    ddl m} |                    d          }t                      j        d         |_        t          j        |t          |                     S )a.  Representation of the base implementation of __enter__.

        As per Python documentation:
        Enter the runtime context related to this object. The with statement
        will bind this method's return value to the target(s) specified in the
        as clause of the statement, if any.
        r   rx   zdef __enter__(self): ...rz   r{   r~   r   s      r%   attr___enter__z"ContextManagerModel.attr___enter__  s_     	$#####")"6"67U"V"V %&&6x@ t?43H3HIIIIr'   c                    ddl m} |                    d          }t                      j        d         |_        t          j        |t          |                     S )aL  Representation of the base implementation of __exit__.

        As per Python documentation:
        Exit the runtime context related to this object. The parameters describe the
        exception that caused the context to be exited. If the context was exited
        without an exception, all three arguments will be None.
        r   rx   z7def __exit__(self, exc_type, exc_value, traceback): ...rz   r{   r~   r   s      r%   attr___exit__z!ContextManagerModel.attr___exit__  sc     	$#####")"6"6I#
 #

 %&&6x@ t?43H3HIIIIr'   Nr   )rN   r   r   r  r   r  r  r*   r'   r%   r  r    sh          J J J XJ" J J J XJ J Jr'   r  c                  :    e Zd Zed             Zed             ZdS )BoundMethodModelc                $    | j         j        j        S r9   r}  rA   s    r%   r  zBoundMethodModel.attr___func__  s    ~&//r'   c                    | j         j        S r9   )r:   r}   rA   s    r%   r{  zBoundMethodModel.attr___self__  s    ~##r'   N)rN   r   r   r   r  r{  r*   r'   r%   r  r    sH        0 0 X0 $ $ X$ $ $r'   r  c                  J     e Zd Z fdZed             Zed             Z xZS )GeneratorModelc                2    t                      j        | g|R i |}t                      j        d         }|j                                        D ]E\  }}|d         }|fd}t          t          |          t          |z   t          |                     F|S )N	generatorr   c                    |S r9   r*   ra   meths     r%   patchedz'GeneratorModel.__new__.<locals>.patched      r'   )
r6  __new__r   r   rK  r   setattrrM   rl   r   )
ra   r   kwargsretr  rf   r/   methodr  r	  s
            r%   r  zGeneratorModel.__new__  s    eggoc3D333F33"$$4[A	%,2244 	F 	FLD&AYF"(     DII{T18G3D3DEEEE
r'   c                V    t          j        | j        j        j        | j                  S r   )r   r"   r:   r   rf   rA   s    r%   r   zGeneratorModel.attr___name__  s+    !.',T^
 
 
 	
r'   c                t    t          j        t          | j        j        j        dd           | j                  S r   )r   r"   rt   r:   r   r   rA   s    r%   r   zGeneratorModel.attr___doc__  s8    !$./8'4HH>
 
 
 	
r'   )rN   r   r   r  r   r   r   ro  rp  s   @r%   r  r    sn             
 
 X

 
 
 X
 
 
 
 
r'   r  c                       e Zd Z fdZ xZS )AsyncGeneratorModelc                ~    t                      j        | g|R i |}t                      j        }|                    d          }||                    d          }|j                                        D ]E\  }}|d         }|fd}	t          t          |          t          |z   t          |	                     F|S )Nasync_generatorr  r   c                    |S r9   r*   r  s     r%   r  z,AsyncGeneratorModel.__new__.<locals>.patched  r  r'   )r6  r  r   r   getrK  r   r  rM   rl   r   )ra   r   r  r  astroid_builtinsr  rf   r/   r  r  r	  s             r%   r  zAsyncGeneratorModel.__new__  s    eggoc3D333F33)++;$(():;;	(,,[99I%,2244 	F 	FLD&AYF"(     DII{T18G3D3DEEEE
r'   )rN   r   r   r  ro  rp  s   @r%   r  r    s8                r'   r  c                  f    e Zd Zed             Zed             Zed             Zed             ZdS )InstanceModelc                    | j         j        S r9   r}  rA   s    r%   r0  zInstanceModel.attr___class__  r~  r'   c                |    t          j        | j                                                                                  S r9   r   rA   s    r%   r   zInstanceModel.attr___module__  r   r'   c                \    t          j        t          | j        j        dd                     S r;  r   rA   s    r%   r   zInstanceModel.attr___doc__  r<  r'   c                @    t          | j        | j        j                  S r9   )r4   r:   instance_attrsrA   s    r%   r   zInstanceModel.attr___dict__  s    DNDN,IJJJr'   N)rN   r   r   r   r0  r   r   r   r*   r'   r%   r  r    s        ' ' X' A A XA S S XS K K XK K Kr'   r  c                  <    e Zd Zedd            Zed             ZdS )ExceptionInstanceModelr7   nodes.Tuplec                6    t          j        | j                  S r   )r
   r   r:   rA   s    r%   	attr_argsz ExceptionInstanceModel.attr_args  s    {$.1111r'   c                ~    t                      j        }|t          j        j                 }|                                S r9   )r   r   typesTracebackTyperN   rn  )rB   r   traceback_types      r%   attr___traceback__z)ExceptionInstanceModel.attr___traceback__  s3    ,..>,U-@-IJ//111r'   N)r7   r  )rN   r   r   r   r  r  r*   r'   r%   r  r    sM        2 2 2 X2 2 2 X2 2 2r'   r  c                  $    e Zd Zed             ZdS )SyntaxErrorInstanceModelc                *    t          j        d          S Nr   r!   rA   s    r%   	attr_textz"SyntaxErrorInstanceModel.attr_text      !"%%%r'   N)rN   r   r   r   r  r*   r'   r%   r  r    s-        & & X& & &r'   r  c                  T    e Zd Zed             Zed             Zed             ZeZdS )OSErrorInstanceModelc                *    t          j        d          S r  r!   rA   s    r%   attr_filenamez"OSErrorInstanceModel.attr_filename  r  r'   c                *    t          j        d          S r   r!   rA   s    r%   
attr_errnozOSErrorInstanceModel.attr_errno  s    !!$$$r'   c                *    t          j        d          S r  r!   rA   s    r%   attr_strerrorz"OSErrorInstanceModel.attr_strerror!  r  r'   N)rN   r   r   r   r  r  r  attr_filename2r*   r'   r%   r  r    sd        & & X& % % X% & & X& #NNNr'   r  c                  :    e Zd Zed             Zed             ZdS )ImportErrorInstanceModelc                *    t          j        d          S r  r!   rA   s    r%   	attr_namez"ImportErrorInstanceModel.attr_name)  r  r'   c                *    t          j        d          S r  r!   rA   s    r%   	attr_pathz"ImportErrorInstanceModel.attr_path-  r  r'   N)rN   r   r   r   r  r  r*   r'   r%   r  r  (  sH        & & X& & & X& & &r'   r  c                  $    e Zd Zed             ZdS )UnicodeDecodeErrorInstanceModelc                *    t          j        d          S )Nr'   r!   rA   s    r%   attr_objectz+UnicodeDecodeErrorInstanceModel.attr_object3  s    !#&&&r'   N)rN   r   r   r   r  r*   r'   r%   r  r  2  s-        ' ' X' ' 'r'   r  zbuiltins.SyntaxErrorzbuiltins.ImportErrorzbuiltins.UnicodeDecodeErrorzbuiltins.OSErrorzbuiltins.BlockingIOErrorzbuiltins.BrokenPipeErrorzbuiltins.ChildProcessErrorzbuiltins.ConnectionAbortedErrorzbuiltins.ConnectionErrorzbuiltins.ConnectionRefusedErrorzbuiltins.ConnectionResetErrorzbuiltins.FileExistsErrorzbuiltins.FileNotFoundErrorzbuiltins.InterruptedErrorzbuiltins.IsADirectoryErrorzbuiltins.NotADirectoryErrorzbuiltins.PermissionError)zbuiltins.ProcessLookupErrorzbuiltins.TimeoutErrorc                  l    e Zd Zed             Zd Zed             Zed             Zed             ZdS )	DictModelc                    | j         j        S r9   r}  rA   s    r%   r0  zDictModel.attr___class__Q  r~  r'   c                     G fddt           j                  }t          | j        j                            |          d          } ||| j                  S )z7Generate a bound method that can infer the given *obj*.c                       e Zd Z	 d	d
 fdZdS )@DictModel._generic_dict_attribute.<locals>.DictMethodBoundMethodNr   r   r   r   r7   Iterator[InferenceResult]c              3     K   V  d S r9   r*   rb  s      r%   r  zRDictModel._generic_dict_attribute.<locals>.DictMethodBoundMethod.infer_call_resultY  rc  r'   r9   r   r   r   r   r7   r  rH  rd  s   r%   DictMethodBoundMethodr  X  rf  r'   r  Nr{   )r   r   r  r:   r;   igetattr)rB   r$   rf   r  r  s    `   r%   _generic_dict_attributez!DictModel._generic_dict_attributeU  sv    	 	 	 	 	 	 	G$7 	 	 	 DN+44T::DAA$$4t~FFFFr'   c                n   ddl m} g }t          j        | j                  }| j        j        D ]F\  }}t          j        |          }|                    ||f           |                    |           G|                    |           |	                    |          }| 
                    |d          S )Nr   objectsr   rO  r   )r   r  r   r   r:   r   r   r0   rT   	DictItemsr  )rB   r  elemsr$   r   r    r+   	items_objs           r%   
attr_itemszDictModel.attr_itemsc  s    ######t~666.. 	 	JC%S111DMM3,'''LL%   %%c**	++Iw???r'   c                    ddl m} d | j        j        D             }t	          j        | j                  }|                    |           |                    |          }|                     |d          S )Nr   r  c                    g | ]\  }}|S r*   r*   )r#   r   _s      r%   r&   z'DictModel.attr_keys.<locals>.<listcomp>v  s    999a999r'   r   rO  r.   )	r   r  r:   r   r   r   r0   DictKeysr  )rB   r  r.   r$   keys_objs        r%   	attr_keyszDictModel.attr_keysr  s~    ######99DN$8999t~666$##C((++Hf===r'   c                    ddl m} d | j        j        D             }t	          j        | j                  }|                    |           |                    |          }|                     |d          S )Nr   r  c                    g | ]\  }}|S r*   r*   )r#   r  r    s      r%   r&   z)DictModel.attr_values.<locals>.<listcomp>  s    ???JQ%???r'   r   r/   )	r   r  r:   r   r   r   r0   
DictValuesr  )rB   r  r/   r$   
values_objs        r%   attr_valueszDictModel.attr_values}  s|    ######??$.*>???t~666V'',,
++JAAAr'   N)	rN   r   r   r   r0  r  r  r  r  r*   r'   r%   r  r  P  s        ' ' X'G G G @ @ X@ > > X> B B XB B Br'   r  c                      e Zd ZdZd Zed             Zed             Zed             Zed             Z	ed             Z
dS )	PropertyModelzModel for a builtin property.c           
     *   t          j        || j        | j        j        | j        j        | j        j        | j        j                  }t          j        |d d           }|                    g g g g g g g g            |                    |g            |S )Nrf   r   r   r   r   r   r  )r   r   r   r  r   r   r   r   r   r
  )	r
   FunctionDefr:   r   r   r   r   r  r0   )rB   rf   functionr   s       r%   _init_functionzPropertyModel._init_function  s    $>>(~0~0>8
 
 
 ht4HHH$&#% 	 		
 		
 		
 	t"---r'   c                   | j          G fddt          j                  } |d| j         | j         j        | j         j        | j         j        | j         j                  }|                    j        j	                   |S )Nc                       e Zd Z	 d	d
 fdZdS )5PropertyModel.attr_fget.<locals>.PropertyFuncAccessorNr   r   r   r   r7   r  c              3     K   |r*t          |j                  dk    rt          d| |          j                            ||          E d {V  d S )NrE   zfget() needs a single argumentr  r   r   )rO   r   r   r  r  )rB   r   r   r   s      r%   r  zGPropertyModel.attr_fget.<locals>.PropertyFuncAccessor.infer_call_result  s        c&+..!33(8w     =::!7 ;           r'   r9   r  rH  r  s   r%   PropertyFuncAccessorr    s=         48        r'   r  fgetr  r  )
r:   r
   r  r   r   r   r   r0   r   r
  )rB   r  property_accessorr   s      @r%   	attr_fgetzPropertyModel.attr_fget  s    ~	 	 	 	 	 	 	5#4 	 	 	  10>>(~0~0>8
 
 
 	""		"BBB  r'   c                b   | j         }dd} ||          st          d|j        j                    G fddt          j                  } |d	| j         | j         j        | j         j        | j         j        | j         j	        
          }|
                    j        j                   |S )Nr   r   r7   astroid.FunctionDef | Nonec                      fd j                                         D             D ]A}|                                D ]*}|                     j        j        dz             r|c c S +BdS )z
            Given a property, find the corresponding setter function and returns it.

            :param func: property for which the setter has to be found
            :return: the setter function or None
            c                >    g | ]}|j         j        j         k    |S r*   )rf   r  )r#   tr   s     r%   r&   z@PropertyModel.attr_fset.<locals>.find_setter.<locals>.<listcomp>  s1       4=CU9U9U9U9U9Ur'   z.setterN)r   get_childrendecoratornamesr   r  rf   )r   rr   dec_names   `  r%   find_setterz,PropertyModel.attr_fset.<locals>.find_setter  s       ;3355   & & !' 5 5 7 7 & &H(();i)GHH &%&& 4r'   z&Unable to find the setter of property c                       e Zd Z	 d	d
 fdZdS )5PropertyModel.attr_fset.<locals>.PropertyFuncAccessorNr   r   r   r   r7   r  c              3     K   |r*t          |j                  dk    rt          d| |                              ||          E d {V  d S )NrG   zfset() needs two argumentsr  r  )rO   r   r   r  )rB   r   r   func_setters      r%   r  zGPropertyModel.attr_fset.<locals>.PropertyFuncAccessor.infer_call_result  sw        c&+..!33(4T7    '88PW8XXXXXXXXXXXr'   r9   r  rH  )r  s   r%   r  r    sF         48
Y 
Y 
Y 
Y 
Y 
Y 
Y 
Y 
Yr'   r  fsetr  r  )r   r   r7   r  )r:   r   r  rf   r
   r  r   r   r   r   r0   r   r
  )rB   r   r
  r  r   r  s        @r%   	attr_fsetzPropertyModel.attr_fset  s   ~	 	 	 	 "k$'' 	 M9KMM  	Y 	Y 	Y 	Y 	Y 	Y 	Y5#4 	Y 	Y 	Y 10>>(~0~0>8
 
 
 	""(8{?O"PPP  r'   c                ,    |                      d          S )Nsetterr  rA   s    r%   attr_setterzPropertyModel.attr_setter      ""8,,,r'   c                ,    |                      d          S )Ndeleterr  rA   s    r%   attr_deleterzPropertyModel.attr_deleter  s    ""9---r'   c                ,    |                      d          S )Ngetterr  rA   s    r%   attr_getterzPropertyModel.attr_getter  r  r'   N)rN   r   r   r  r  r   r  r  r  r  r  r*   r'   r%   r  r    s        ''  2 ! ! X!< .! .! X.!` - - X- . . X. - - X- - -r'   r  )r5   r6   r7   r   );r  
__future__r   r   r   rQ   r  collections.abcr   	functoolsr   typingr   r   r   r   r	   r
   r   astroid.contextr   r   astroid.exceptionsr   r   r   astroid.managerr   astroid.nodesr   astroid.typingr   r   astroid.objectsr   rl   rO   rm   r4   r=   r6   r   r   r4  rr  r  r  r  r  r  r  r  r  r  r  r  BUILTIN_EXCEPTIONSr  r  r*   r'   r%   <module>r'     s  
 & # " " " " "     				   $ $ $ $ $ $       . . . . . . . . . .  & & & & & & & & & & : : : : : : : : Q Q Q Q Q Q Q Q Q Q * * * * * * & & & & & & E E E E E E E E )((((((S%%   .   TJ TJ TJ TJ TJ TJ TJ TJnJ& J& J& J& J&+ J& J& J&Zq  q  q  q  q K q  q  q hu2 u2 u2 u2 u2 u2 u2 u2p' ' ' ' ' ' ' '$! ! ! ! ! ! ! !*+J +J +J +J +J+ +J +J +J\$ $ $ $ $} $ $ $
 
 
 
 
]$7 
 
 
:    .   *K K K K KK K K K*	2 	2 	2 	2 	2] 	2 	2 	2& & & & &5 & & &# # # # #1 # # # & & & & &5 & & &' ' ' ' '&< ' ' '44 "#B
 ,  4  4 !"6 &';  4 &'; $%9  4 !"6  !5  !"6!" "#7#$  4%& $81)   06B 6B 6B 6B 6B 6B 6B 6Brv- v- v- v- v-K v- v- v- v- v-r'   