Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/pyfakefs/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/pyfakefs/__pycache__/deprecator.cpython-37.opt-1.pyc

B

��\�	�@s(dZddlZddlZGdd�de�ZdS)z,Utilities for handling deprecated functions.�Nc@s2eZdZdZdZd
dd�Zdd�Zedd	��ZdS)�
Deprecatorz�Decorator class for adding deprecated functions.

    Warnings are switched on by default.
    To disable deprecation warnings, use:

    >>>  from pyfakefs.deprecator import Deprecator
    >>>
    >>>  Deprecator.show_warnings = False
    TNcCs||_||_dS)N)�use_instead�	func_name)�selfrr�r�D/opt/alt/python37/lib/python3.7/site-packages/pyfakefs/deprecator.py�__init__szDeprecator.__init__cst�����fdd��}|S)zZDecorator to mark functions as deprecated. Emit warning
        when the function is used.csb�jrXt�dt�d}�jdk	r,d��j�}tjd��jp>�j|�tdd�t�dt��||�S)N�always�zUse {} instead.z"Call to deprecated function {}. {}�)�category�
stacklevel�default)	�
show_warnings�warnings�simplefilter�DeprecationWarningr�format�warnr�__name__)�args�kwargs�message)�funcrrr�	_new_func's

z&Deprecator.__call__.<locals>._new_func)�	functools�wraps)rrrr)rrr�__call__#s
zDeprecator.__call__cs(t�j|��fdd��}t|||�dS)abAdd the deprecated version of a member function to the given class.
        Gives a deprecation warning on usage.

        Args:
            clss: the class where the deprecated function is to be added
            func: the actual function that is called by the deprecated version
            deprecated_name: the deprecated name of the function
        cs
�||�S)Nr)rr)rrr�
_old_functionAsz%Deprecator.add.<locals>._old_functionN)rr�setattr)ZclssrZdeprecated_namerr)rr�add6szDeprecator.add)NN)	r�
__module__�__qualname__�__doc__rrr�staticmethodr rrrrrs
	
r)r#rr�objectrrrrr�<module>s