o
    RhQ                     @   s  d dl Z d dlZd dlZd dlZd dlmZ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 dZeegef Ze	d"dd	d
dddededefddZedd	d
dedededefddZ	d"dd	d
de
e dededeeef fddZe	d"dd	d
dddededefddZedd	d
dedededefddZ	d"dd	d
de
e dededeeef fddZdedededefddZdd Zdd Zdede	e	e  fddZd d! ZdS )#    N)	FrameTypeFunctionType)CallableListOptionalTupleTypeVarUnionoverloadz7.7.0)ensure_signature_is_compatible_WrappedMethod)boundTFcheck_signaturecheck_at_runtimemethodr   r   returnc                C      d S N r   r   r   r   r   U/home/air/sanwanet/backup_V2/venv/lib/python3.10/site-packages/overrides/overrides.py	overrides       r   c                C   r   r   r   r   r   r   r   r   *   r   c                C   $   | dur
t | ||S tjt||d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   r   r   r   r   4      c                C   r   r   r   r   r   r   r   override\   r   r    c                C   r   r   r   r   r   r   r   r    f   r   c                C   r   )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   r   r   r   r    p   r   c                    s   t dd tdd }|d u rttjj }ttd|D ]%tj	rE|r;t
 fdd}|  S t    S q tj d)N__override__T__globals__   c                     s   t   | i |S r   )_validate_method)argskwargsr   r   super_classr   r   wrapper   s   z_overrides.<locals>.wrapperz: 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   r'   r   r      s   r   c                 C   s   t || j}tt|| jt}t |ddr t| j d| | js'|j| _|r<| jds>t|t	s@t
|| | d S d S d S d S )N	__final__Fz: is finalized in __)r+   r3   
isinstanceinspectgetattr_staticstaticmethodr5   __doc__
startswithpropertyr   )r   r(   r   super_method	is_staticr   r   r   r$      s    
r$   c                    s    fddt | D S )Nc                    s   g | ]}t | qS r   )_get_base_class).0class_name_components	namespacer   r   
<listcomp>   s    z%_get_base_classes.<locals>.<listcomp>)_get_base_class_names)framerG   r   rF   r   r0      s   
r0   rJ   c                 C   s   g }g }d}t | jD ]A}|j| jkr n8|jt jvrq|s#g }d}|jdv r4|r/|| |j	g}q|jdkrB|rB||j	 q|rI|| g }d}q|rU|| |S )z(Get baseclass names from the code objectT)	LOAD_NAMELOAD_GLOBAL	LOAD_ATTRF)
disget_instructionsf_codeoffsetf_lastiopcodehasnameopnameappendargval)rJ   current_itemitemsadd_last_stepinstructionr   r   r   rI      s0   




rI   c                 C   s   z|| d  }W n" t y*   t|d tr|d | d  }n	t|d | d }Y nw | dd  D ]}t||r=t||}q1|S )Nr   __builtins__   )KeyErrorr:   dictr+   r2   )
componentsrG   obj	componentr   r   r   rC      s   

rC   r   )rN   r   r;   r-   typesr   r   typingr   r   r   r   r   r	   r
   __VERSION__overrides.signaturer   r   _DecoratorMethodboolr   r    r   r$   r0   strrI   rC   r   r   r   r   <module>   s   $	


(	


(
$