Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/twisted/persisted/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/twisted/persisted/__pycache__/styles.cpython-310.pyc
o

�b1�@sPUdZddlZddlZddlZddlZddlZddlmZ	ddl
mZddlm
Z
mZddlmZiZeeejfed<ejZdd	�Zd
d�Zdd
�Ze�eje�dd�Zdd�Ze�eje�dd�Zdd�Ze�eje�dd�Z dd�Z!dd�Z"dd�Z#Gdd�d�Z$ia%ee&d fed!<ia'd"d#�Z(d$d%�Z)d&d'�Z*Gd(d �d �Z+dS))z(
Different styles of persisted objects.
�N)�StringIO)�Dict)�log�reflect)�_PYPY�
oldModulescCst|j|j|jjffS)z3support function for copy_reg to pickle method refs)�unpickleMethod�__name__�__self__�	__class__)�method�r
�:/usr/lib/python3/dist-packages/twisted/persisted/styles.py�pickleMethods�rcCst||�}|S)a�
    Retrieve the function object implementing a method name given the class
    it's on and a method name.

    @param classObject: A class to retrieve the method's function from.
    @type classObject: L{type}

    @param methodName: The name of the method whose function to retrieve.
    @type methodName: native L{str}

    @return: the function object corresponding to the given method name.
    @rtype: L{types.FunctionType}
    )�getattr)�classObject�
methodName�methodObjectr
r
r�_methodFunction"s
rc	Cs�|dur	t||�Szt||�}Wn&ty6t�d|d|�|dus'Jd��|j|ur-�t|||j�YSwd}tj||g|�R�}|S)aS
    Support function for copy_reg to unpickle method refs.

    @param im_name: The name of the method.
    @type im_name: native L{str}

    @param im_self: The instance that the method was present on.
    @type im_self: L{object}

    @param im_class: The class where the method was declared.
    @type im_class: L{type} or L{None}
    N�Methodznot on classz'No recourse: no instance to guess from.r
)	rr�AttributeErrorr�msgrr�types�
MethodType)�im_name�im_self�im_class�methodFunction�
maybeClass�boundr
r
rr4s

�
rcCs4|jdkrtd|����ttd�|j|jg�g�fS)a�
    Reduce, in the sense of L{pickle}'s C{object.__reduce__} special method, a
    function object into its constituent parts.

    @param f: The function to reduce.
    @type f: L{types.FunctionType}

    @return: a 2-tuple of a reference to L{_unpickleFunction} and a tuple of
        its arguments, a 1-tuple of the function's fully qualified name.
    @rtype: 2-tuple of C{callable, native string}
    z<lambda>zCannot pickle lambda function: �.)r	�_UniversalPicklingError�_unpickleFunction�tuple�join�
__module__�__qualname__)�fr
r
r�_pickleFunctionWs
r(cCsddlm}||�S)a�
    Convert a function name into a function by importing it.

    This is a synonym for L{twisted.python.reflect.namedAny}, but imported
    locally to avoid circular imports, and also to provide a persistent name
    that can be stored (and deprecated) independently of C{namedAny}.

    @param fullyQualifiedName: The fully qualified name of a function.
    @type fullyQualifiedName: native C{str}

    @return: A function object imported from the given location.
    @rtype: L{types.FunctionType}
    r)�namedAny)�twisted.python.reflectr))�fullyQualifiedNamer)r
r
rr"hsr"cCst|jffS)z3support function for copy_reg to pickle module refs)�unpickleModuler	)�moduler
r
r�pickleModule~sr.cCs6|tvrt�d|�t|}t�|�t|iid�S)z5support function for copy_reg to unpickle module refszModule has moved: %s�x)rrr�
__import__)�namer
r
rr,�s

r,cCs	t|��|��ffS)z�
    Reduce the given cStringO.

    This is only called on Python 2, because the cStringIO module only exists
    on Python 2.

    @param stringo: The string output to pickle.
    @type stringo: C{cStringIO.OutputType}
    )�unpickleStringO�getvalue�tell)�stringor
r
r�
pickleStringO�s
r6cCst�}|�|�|�|�|S)a�
    Convert the output of L{pickleStringO} into an appropriate type for the
    current python version.  This may be called on Python 3 and will convert a
    cStringIO into an L{io.StringIO}.

    @param val: The content of the file.
    @type val: L{bytes}

    @param sek: The seek position of the file.
    @type sek: L{int}

    @return: a file-like object which you can write bytes to.
    @rtype: C{cStringIO.OutputType} on Python 2, L{io.StringIO} on Python 3.
    )�
_cStringIO�write�seek��val�sekr/r
r
rr2�s

r2cCst|��|��ffS)aQ
    Reduce the given cStringI.

    This is only called on Python 2, because the cStringIO module only exists
    on Python 2.

    @param stringi: The string input to pickle.
    @type stringi: C{cStringIO.InputType}

    @return: a 2-tuple of (C{unpickleStringI}, (bytes, pointer))
    @rtype: 2-tuple of (function, (bytes, int))
    )�unpickleStringIr3r4)�stringir
r
r�
pickleStringI�s
r?cCst|�}|�|�|S)a�
    Convert the output of L{pickleStringI} into an appropriate type for the
    current Python version.

    This may be called on Python 3 and will convert a cStringIO into an
    L{io.StringIO}.

    @param val: The content of the file.
    @type val: L{bytes}

    @param sek: The seek position of the file.
    @type sek: L{int}

    @return: a file-like object which you can read bytes from.
    @rtype: C{cStringIO.OutputType} on Python 2, L{io.StringIO} on Python 3.
    )r7r9r:r
r
rr=�s
r=c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�	Ephemeralzh
    This type of object is never persisted; if possible, even references to it
    are eliminated.
    cCstdfS)zu
        Serialize any subclass of L{Ephemeral} in a way which replaces it with
        L{Ephemeral} itself.
        r
)r@)�selfr
r
r�
__reduce__�szEphemeral.__reduce__cCsJt�d|�ts#ddl}t|dd�r#|�|�D]
}t�d|���qdS)Nz!WARNING: serializing ephemeral %sr�
get_referrersz referred to by )rrr�gcrrC)rArD�rr
r
r�__getstate__�szEphemeral.__getstate__cCst�d|j�t|_dS)Nz#WARNING: unserializing ephemeral %s)rrrr@�rA�stater
r
r�__setstate__�s
zEphemeral.__setstate__N)r	r%r&�__doc__rBrFrIr
r
r
rr@�s

r@�	Versioned�versionedsToUpgradecCs&tt���D]}t|�qiaiadS�N)�listrL�values�requireUpgrade�upgraded)�	versionedr
r
r�	doUpgrade�s
rScCs4t|�}|tvr|tvrdt|<|��|SdSdS)z?Require that a Versioned instance be upgraded completely first.�N)�idrLrQ�versionUpgrade)�obj�objIDr
r
rrPs�rPcCs@|tg}t�|�D]}||vrt|t�r|�|�q	|dd�S)z�
    Get all of the parent classes of C{c}, not including C{c} itself, which are
    strict subclasses of L{Versioned}.

    @param c: a class
    @returns: list of classes
    �N)rK�inspect�getmro�
issubclass�append)�c�l�br
r
r�_aybabtu	s

�rac@s2eZdZdZdZdZdd�Zddd�Zd	d
�ZdS)rKa�
    This type of object is persisted with versioning information.

    I have a single class attribute, the int persistenceVersion.  After I am
    unserialized (and styles.doUpgrade() is called), self.upgradeToVersionX()
    will be called for each version upgrade I must undergo.

    For example, if I serialize an instance of a Foo(Versioned) at version 4
    and then unserialize it when the code is at version 9, the calls::

      self.upgradeToVersion5()
      self.upgradeToVersion6()
      self.upgradeToVersion7()
      self.upgradeToVersion8()
      self.upgradeToVersion9()

    will be made.  If any of these methods are undefined, a warning message
    will be printed.
    rr
cCs|tt|�<||_dSrM)rLrU�__dict__rGr
r
rrI3s
zVersioned.__setstate__NcCs�t�|p|j�}t|j�}|��|�|j�|D]$}d|jvr-|jD]	}||vr,||=q#d|jvr=|j|t�	|��d�<q|S)z8Get state, adding a version number to it on its way out.�persistenceForgets�persistenceVersionz.persistenceVersion)
�copyrbrar�reverser]rcrdr�qual)rA�dict�dct�bases�base�slotr
r
rrF7s"


�
���zVersioned.__getstate__c
CsZt|j�}|��|�|j�d|jvrB|jd}|jd=d}d}|D]}d|jvr+q#|j|kr5|}|j}q#|rB||jdt�|�<|D]f}t|j	vrQd|jvrQqD|j}dt�|�}|j�
|�pbd}|ri|j|=||ksqJd��||kr�|d}|j�
d|d�}	|	r�t�dt�|�t�|j�t
|�|f�|	|�n	t�d	�||��||ksuqDdS)
z (internal) Do a version upgrade.rdrNz%s.persistenceVersionz"Sorry, can't go backwards in time.rTzupgradeToVersion%sz'Upgrading %s (of %s @ %s) to version %sz(Warning: cannot upgrade {} to version {})rarrfr]rbrdrrgrK�	__bases__�getrrrU�format)
rArj�pver�highestVersion�highestBaserk�currentVers�pverName�persistVersrr
r
rrVHsh





���


���
	�����zVersioned.versionUpgraderM)	r	r%r&rJrdrcrIrFrVr
r
r
rrKs
),rJre�copyreg�copy_regrZ�pickler�iorr7�typingr�twisted.pythonrr�twisted.python.compatrr�str�
ModuleType�__annotations__�
PicklingErrorr!rrrrr(r"�FunctionTyper.r,r6r2r?r=r@rL�intrQrSrPrarKr
r
r
r�<module>sB 		

Spamworldpro Mini