o
    NiX                     @   s   d dl Z d dlZd dlZd dlZd dlZdd ZG dd deZejd  dkZ	ejd  dkZ
e
r?efZefZefZeZeZdS efZeefZeejfZeZeZdS )    Nc                 C   s,   t dt t j| tdd t dt d S )Nalways   )category
stackleveldefault)warningssimplefilterDeprecationWarningwarn)msg r   A/home/ubuntu/.local/lib/python3.10/site-packages/promise/utils.pyr
      s   r
   c                   @   s   e Zd ZdddZdd ZdS )
deprecatedNc                 C   s,   t |s
t |rtd|| _|| _d S )Nz'Reason for deprecation must be supplied)inspectisclass
isfunction	TypeErrorreasonname)selfr   r   r   r   r   __init__   s   
zdeprecated.__init__c                    s`   t  rd}nt  rd}ntt |j| jp j| jdt	
  fdd}|S )Nz8Call to deprecated function or method {name} ({reason}).z+Call to deprecated class {name} ({reason}).)r   r   c                     s   t   | i |S N)r
   )argskwargscls_or_funcr   r   r   new_func"   s   z%deprecated.__call__.<locals>.new_func)r   r   r   r   typeformatr   __name__r   	functoolswraps)r   r   fmtr   r   r   r   __call__   s   

zdeprecated.__call__r   )r   
__module____qualname__r   r#   r   r   r   r   r      s    
r   r      )r    r   typesr   sysr
   objectr   version_infoPY2PY3strstring_typesintinteger_typesr   class_types	text_typebytesbinary_type
basestringlong	ClassTypeunicoder   r   r   r   <module>   s(    
