HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/python/__pycache__/_oldstyle.cpython-38.pyc
U


W[!
�@stdZddlmZmZddlZddlmZddlmZm	Z	dd�Z
dd	�Zd
d�Ze
e	e�e
e�e�dd
���Z
dS)zD
Utilities to assist in the "flag day" new-style object transition.
�)�absolute_import�divisionN)�wraps)�_shouldEnableNewStyle�_PY3cs��fdd�}|S)a2
    If C{condition}, replace this function with C{alternative}.

    @param condition: A L{bool} which says whether this should be replaced.

    @param alternative: An alternative function that will be swapped in instead
        of the original, if C{condition} is truthy.

    @return: A decorator.
    csF�dkr��n �dkr|�ntd�t�����t|��fdd��}|S)NTFz8condition argument to _replaceIf requires a bool, not {}cs
�||�S)N�)�args�kwargs��callr�:/usr/lib/python3/dist-packages/twisted/python/_oldstyle.py�wrapped'sz._replaceIf.<locals>.decorator.<locals>.wrapped)�
ValueError�format�reprr)�funcr
��alternative�	conditionr
r�	decorators�z_replaceIf.<locals>.decoratorr)rrrrrr�
_replaceIfsrcCs|S)z]
    Return C{arg}. Do nothing.

    @param arg: The arg to return.

    @return: C{arg}
    r)�argrrr�passthru1srcCs2t|�tjk	r.ddlm}tdj||�d���|S)z�
    Ensure that C{cls} is an old-style class.

    @param cls: The class to check.

    @return: The class, if it is an old-style class.
    @raises: L{ValueError} if it is a new-style class.
    r)�fullyQualifiedNamez�twisted.python._oldstyle._oldStyle is being used to decorate a new-style class ({cls}). This should only be used to decorate old-style classes.)�cls)�type�typesZ	ClassTypeZtwisted.python.reflectrrr)rrrrr�_ensureOldClass=s	��rcCs$t|�|jtf}t|j||j�S)a�
    A decorator which conditionally converts old-style classes to new-style
    classes. If it is Python 3, or if the C{TWISTED_NEWSTYLE} environment
    variable has a falsey (C{no}, C{false}, C{False}, or C{0}) value in the
    environment, this decorator is a no-op.

    @param cls: An old-style class to convert to new-style.
    @type cls: L{types.ClassType}

    @return: A new-style version of C{cls}.
    )r�	__bases__�objectr�__name__�__dict__)rZ_basesrrr�	_oldStyleSsr")�__doc__Z
__future__rrr�	functoolsrZtwisted.python.compatrrrrrr"rrrr�<module>s