
    _neZ                        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y)    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                     y N r   r   r   s      3lib/python3.12/site-packages/overrides/overrides.py	overridesr                c                     y r   r   r   s      r   r   r   *   r   r   c                X    | 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
    r   
_overrides	functoolspartialr   r   s      r   r   r   4   6    < &/3CDD  +-
 	
r   c                     y r   r   r   s      r   overrider#   \   r   r   c                     y r   r   r   s      r   r#   r#   f   r   r   c                X    | 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
    r   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 ]N  t         j                        s|r#t        j                          fd       }|c S t                 c S  t         j                   d      )N__override__T__globals__   c                  .    t                | i |S r   )_validate_method)argskwargsr   r   super_classs     r   wrapperz_overrides.<locals>.wrapper   s    $V[/J!426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)&-6K3;;v'8'89:(q)9;G ;0(3 )3  oF v**++HI
JJr   c                    t        || j                        }t        t        j                  || j                        t
              }t        |dd      rt        | j                   d|       | j                  s|j                  | _        |r;| j                  j                  d      st        |t              st        || |       y y y y )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    ;8L{FOO<lI |[%06??++=k]KLL>>%--**40<2&|VYG 3 1 	r   c                 R    t        |       D cg c]  }t        ||       c}S c c}w r   )_get_base_class_names_get_base_class)frame	namespaceclass_name_componentss      r   r6   r6      s1     &;5%A! 	-y9  s   $c                 j   g }d}t        j                  | j                        D ]  }|j                  | j                  kD  r n|j
                  t         j                  vr;|sg }d}|j                  dk(  r|j                  d|j                  f       n|j                  dk(  r|j                  d|j                  f       |j                  dk(  r|j                  d|j                  f       d} g }g }|D ]'  \  }}|dk(  r|r|j                  |       |g}"||gz  }) |r|j                  |       |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)rM   extendsadd_last_stepinstructionitemsprevious_itemtss           r   rK   rK      s3   %'GM++ELL9 "-S[[0G M,NNFK$6$678;.NNFK$6$678=0NNFK$6$678!M""  E!M !1;]+CMaS M! ]#Lr   c                     	 || d      }| dd  D ]  }t	        ||      st        ||      } |S # t         $ r4 t        |d   t              r|d   | d      }nt        |d   | d         }Y aw xY w)Nr   __builtins__   )KeyErrorrA   dictr1   r8   )
componentsrN   obj	components       r   rL   rL      s    D
1&  ^ *	3	"#y)C* J  Di/6N+JqM:C)N3Z]CC	Ds   / :A,+A,r   )rV   r   rB   r3   typesr   typingr   r   r   r   r   r	   r
   __VERSION__overrides.signaturer   r   _DecoratorMethodboolr   r#   r   r+   r6   strrK   rL   r   r   r   <module>rv      sT  "    
  L L L >)|X7M1NO^,n<=  
 !"	  	
  
 
 !"	  	
  
 (,%
 !"	%
^$%
 %
 	%

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

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