
    XJeZ                     <   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mZm	Z	m
Z
mZmZmZ dZd dlmZ  edeeef                   Zeegef         Ze	 ddd	d
dddededefd            Zedd	d
dedededefd            Z	 ddd	d
de	e         dededeeef         fdZe	 ddd	d
dddededefd            Zedd	d
dedededefd            Z	 ddd	d
de	e         dededeeef         fdZdedededefdZd Zd Zdeee                  fdZd ZdS )    N)FunctionType)CallableListOptionalTupleTypeVarUnionoverloadz7.4.0)ensure_signature_is_compatible_WrappedMethod)boundTFcheck_signaturecheck_at_runtimemethodr   r   returnc                    d S N r   r   r   s      3lib/python3.11/site-packages/overrides/overrides.py	overridesr       	     C    c                    d S r   r   r   s      r   r   r   *   r   r   c                `    | t          | ||          S t          j        t          ||          S )a0  Decorator to indicate that the decorated method overrides a method in
    superclass.
    The decorator code is executed while loading class. Using this method
    should have minimal runtime performance implications.

    How to use:
    from overrides import overrides

    class SuperClass(object):
        def method(self):
          return 2

    class SubClass(SuperClass):

        @overrides
        def method(self):
            return 1

    :param check_signature: Whether or not to check the signature of the overridden method.
    :param check_at_runtime: Whether or not to check the overridden method at runtime.
    :raises AssertionError: if no match in super classes for the method name
    :return: method with possibly added (if the method doesn't have one)
        docstring from super class
    Nr   
_overrides	functoolspartialr   r   s      r   r   r   4   @    < &/3CDDD +-
 
 
 	
r   c                    d S r   r   r   s      r   overrider#   \   r   r   c                    d S r   r   r   s      r   r#   r#   f   r   r   c                `    | t          | ||          S t          j        t          ||          S )a.  Decorator to indicate that the decorated method overrides a method in
    superclass.
    The decorator code is executed while loading class. Using this method
    should have minimal runtime performance implications.

    How to use:
    from overrides import override

    class SuperClass(object):
        def method(self):
          return 2

    class SubClass(SuperClass):

        @override
        def method(self):
            return 1

    :param check_signature: Whether or not to check the signature of the overridden method.
    :param check_at_runtime: Whether or not to check the overridden method at runtime.
    :raises AssertionError: if no match in super classes for the method name
    :return: method with possibly added (if the method doesn't have one)
        docstring from super class
    Nr   r   r   s      r   r#   r#   p   r!   r   c                     t           dd           t           dd           }|$t          t          j         j                           }t          t          j        d          |          D ]St           j	                  r<|r%t          j                    fd            }|c S t                       c S Tt           j         d          )N__override__T__globals__   c                  6    t                      | i |S r   )_validate_method)argskwargsr   r   super_classs     r   wrapperz_overrides.<locals>.wrapper   s*    $V[/JJJ!6426222r   z: No super class method found)setattrgetattrvarssysmodules
__module___get_base_classes	_getframehasattr__name__r   wrapsr+   	TypeError__qualname__)r   r   r   global_varsr/   r.   s   ``   @r   r   r      s    FND)))&-66K3;v'89::(q)9)9;GG  ;00 	 
((3 3 3 3 3 3 )(3  oFFF	 v*III
J
JJr   c                    t          || j                  }t          t          j        || j                  t
                    }t          |dd          rt          | j         d|           | j        s|j        | _        |rB| j                            d          s*t          |t                    st          || |           d S d S d S d S )N	__final__Fz: is finalized in __)r1   r9   
isinstanceinspectgetattr_staticstaticmethodr;   __doc__
startswithpropertyr   )r   r.   r   super_method	is_statics        r   r+   r+      s    ;88L{FO<<l I |[%00 M6?KKkKKLLL> .%-H**400H <22H
 	'|VYGGGGGH H H H H Hr   c                 :    fdt          |           D             S )Nc                 0    g | ]}t          |          S r   )_get_base_class).0class_name_components	namespaces     r   
<listcomp>z%_get_base_classes.<locals>.<listcomp>   s4       ! 	-y99  r   )_get_base_class_names)framerO   s    `r   r6   r6      s6       %:5%A%A   r   c                 &   g }d}t          j        | j                  D ]}|j        | j        k    r n|j        t           j        vr(|sg }d}|j        dk    r|                    d|j	        f           V|j        dk    r|                    d|j	        f           ~|j        dk    r|                    d|j	        f           d}g }g }|D ],\  }}|dk    r|r|                    |           |g}&||gz  }-|r|                    |           |S )z(Get baseclass names from the code objectT	LOAD_NAMEname	LOAD_ATTRattrLOAD_GLOBALF)
disget_instructionsf_codeoffsetf_lastiopcodehasnameopnameappendargval)rR   extendsadd_last_stepinstructionitemsprevious_itemtss           r   rQ   rQ      s`   %'GM+EL99 " "--ES[00 	!G M,,NNFK$678888;..NNFK$678888=00NNFK$678888!MME!M ! !1;; ,]+++CMMaS MM $]###Lr   c                 8   	 || d                  }n\# t           $ rO t          |d         t                    r|d         | d                  }nt          |d         | d                   }Y nw xY w| dd          D ]"}t	          ||          rt          ||          }#|S )Nr   __builtins__   )KeyErrorrA   dictr1   r8   )
componentsrO   obj	components       r   rL   rL      s    D
1& D D Di/66 	DN+JqM:CC)N3Z]CCC	D
  ^ * *	3	"" 	*#y))CJs    AA*)A*r   )rY   r   rB   r3   typesr   typingr   r   r   r   r   r	   r
   __VERSION__overrides.signaturer   r   _DecoratorMethodboolr   r#   r   r+   r6   strrQ   rL   r   r   r   <module>ry      s  " 


      



       L L L L L L L L L L L L L L L L L L > > > > > >)|X7M1NOOO^,n<=  
 !"	    	
    
 
 !"	    	
    
 (,%
 !"	%
 %
 %
^$%
 %
 	%

 ^+,%
 %
 %
 %
P 
 !"	    	
    
 
 !"	    	
    
 (,%
 !"	%
 %
 %
^$%
 %
 	%

 ^+,%
 %
 %
 %
PKK-1KEIKK K K K.H H H"   DcO        F    r   