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/zope/interface/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/zope/interface/__pycache__/interface.cpython-310.pyc
o

$
x`{��@sdZddlZddlmZddlmZddlZddlmZddlmZ	ddl
mZddlm
Zddlm
Z
gd	�Zd
ZdZdZd
Ze�Ze�Zdd�Zdd�ZGdd�de�ZeZeGdd�de��ZGdd�de�ZeGdd�dee��Zegd�ZGdd�de�Z Gdd�de!�Z"e"dee efd d!i�Z#d"d#�Z$Gd$d�de#�Z%e%d%d&d'�Z&d(d)�e&_'e&�(e&�e&j)e&fks�J�e&e _*e&e
_*Gd*d+�d+e%�Z+Gd,d-�d-e�Z,Gd.d/�d/e,�Z-d;d0d1�Z.d<d2d3�Z/d4d5�Z0dd6l1m2Z2dd7l1m3Z3dd8l
m4Z4dd9l
m5Z5dd:l1m6Z6e �(e6e6�dS)=z Interface object implementation
�N)�
MethodType)�FunctionType)�_use_c_impl)�PYTHON2)�Invalid)�ro)�InterfaceClass�
Specification�
adapter_hooks���__interface_tagged_values__�__interface_methods__cCs2t�d�j}|�ti�}|�dg�}|�|�tS)N��
invariants)�sys�	_getframe�f_locals�
setdefault�TAGGED_DATA�append�_decorator_non_return)�callr�tagsr�r�:/usr/lib/python3/dist-packages/zope/interface/interface.py�	invariant2s

rcCs$t�d�j}|�ti�}|||<tS)z;Attaches a tagged value to an interface at definition time.r)rrrrrr)�key�valuer�
tagged_valuesrrr�taggedValue:sr c@sXeZdZdZddd�Zdd�Zdd�Zd	d
�Zddd
�Zdd�Z	dd�Z
eZeZe	Z
dS)�ElementzI
    Default implementation of `zope.interface.interfaces.IElement`.
    �cCs0|s
|�d�dkr
|}d}||_||_d|_dS)N� r)�find�__name__�__doc__�_Element__tagged_values)�selfr%r&rrr�__init__Ls
zElement.__init__cC�|jS)z! Returns the name of the object. �r%�r(rrr�getNameW�zElement.getNamecCr*)z+ Returns the documentation for the object. )r&r,rrr�getDoc[r.zElement.getDoccCs|jst|��|j|S��* Returns the value associated with 'tag'. )r'�KeyError)r(�tagrrr�getTaggedValuefs
zElement.getTaggedValueNcCs|jr
|j�||�S|Sr0)r'�get)r(r3�defaultrrr�queryTaggedValuelszElement.queryTaggedValuecCs|jr|j��SdS)z# Returns a collection of all tags. r)r'�keysr,rrr�getTaggedValueTagspszElement.getTaggedValueTagscCs|jduri|_||j|<dS)z  Associates 'value' with 'key'. N)r'�r(r3rrrr�setTaggedValuets
zElement.setTaggedValue)r"�N)r%�
__module__�__qualname__r&r)r-r/r4r7r9r;�queryDirectTaggedValue�getDirectTaggedValue�getDirectTaggedValueTagsrrrrr!Bs
	
r!c@s,eZdZdZdd�Zdd�Zdd�ZeZdS)	�SpecificationBase)�_implied�_dependents�_bases�_v_attrs�__iro__�__sro__�__weakref__cC�t|�}||jvS)z2Is the interface implemented by an object
        )�
providedByrC)r(�ob�specrrrrK�s
zSpecificationBase.providedBycCrJ)z�Test whether the specification is implemented by a class or factory.

        Raise TypeError if argument is neither a class nor a callable.
        )�
implementedByrC)r(�clsrMrrrrN�s
zSpecificationBase.implementedBycCs
||jvS)zCIs the interface the same as or extend the given interface
        �rC)r(�	interfacerrr�isOrExtends�s
zSpecificationBase.isOrExtendsN)r%r=r>�	__slots__rKrNrR�__call__rrrrrB�s
rBc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�NameAndModuleComparisonMixinrcCs\||urdS|durdS|j|jf}z|j|jf}Wnty%tYSw||k||kS)a�
        Compare *self* to *other* based on ``__name__`` and ``__module__``.

        Return 0 if they are equal, return 1 if *self* is
        greater than *other*, and return -1 if *self* is less than
        *other*.

        If *other* does not have ``__name__`` or ``__module__``, then
        return ``NotImplemented``.

        .. caution::
           This allows comparison to things well outside the type hierarchy,
           perhaps not symmetrically.

           For example, ``class Foo(object)`` and ``class Foo(Interface)``
           in the same file would compare equal, depending on the order of
           operands. Writing code like this by hand would be unusual, but it could
           happen with dynamic creation of types and interfaces.

        None is treated as a pseudo interface that implies the loosest
        contact possible, no contract. For that reason, all interfaces
        sort before None.
        rN���)r%r=�AttributeError�NotImplemented)r(�other�n1�n2rrr�_compare�s�z%NameAndModuleComparisonMixin._comparecCs|�|�}|tur|S|dkS�Nr�r\rX�r(rY�crrr�__lt__��
z#NameAndModuleComparisonMixin.__lt__cCs|�|�}|tur|S|dkSr]r^r_rrr�__le__�rbz#NameAndModuleComparisonMixin.__le__cCs|�|�}|tur|S|dkSr]r^r_rrr�__gt__�rbz#NameAndModuleComparisonMixin.__gt__cCs|�|�}|tur|S|dkSr]r^r_rrr�__ge__�rbz#NameAndModuleComparisonMixin.__ge__N)	r%r=r>rSr\rarcrdrerrrrrU�s'rUc@s^eZdZdZdZddd�Zdd�Zedd	��Ze	fd
d�Z
dd
�Zdd�Zdd�Z
dd�ZdS)�
InterfaceBasez:Base class that wants to be replaced with a C base :)
    )r%�__ibmodule__�_v_cached_hashNcCs||_||_dSr<�r%rg)r(�name�modulerrrr)
s
zInterfaceBase.__init__cCst�r<)�NotImplementedError�r(�conformrrr�
_call_conformszInterfaceBase._call_conformcCr*r<)rgr,rrr�__module_property__sz!InterfaceBase.__module_property__cCsnz|j}Wntyd}Ynw|dur |�|�}|dur |S|�|�}|dur+|S|tur1|Std||��)z)Adapt an object to the interface
        NzCould not adapt)�__conform__rWro�	__adapt__�_marker�	TypeError)r(�obj�	alternatern�adapterrrrrTs
�

zInterfaceBase.__call__cCs6|�|�r|StD]}|||�}|dur|Sq	dS)z(Adapt an object to the receiver
        N)rKr
)r(ru�hookrwrrrrr+s

�zInterfaceBase.__adapt__cCs2z|jWStyt|j|jf�|_Y|jSwr<)rhrW�hashr%r=r,rrr�__hash__8s�zInterfaceBase.__hash__cCs|�|�}|tur|S|dkSr]r^r_rrr�__eq__@rbzInterfaceBase.__eq__cCs*||urdS|�|�}|tur|S|dkS)NFrr^r_rrr�__ne__Fs
zInterfaceBase.__ne__�NN)r%r=r>r&rSr)ro�propertyrprsrTrrrzr{r|rrrrrf�s


rfr
c@s�eZdZdZdZdZejZejZddd�Z	e
dd��Zdd	�Zd
d�Z
dd
�Ze
dd�e�ZeZdd�Zdd�Zdd�Zddd�Zddd�Zddd�ZdS) r	awSpecifications

    An interface specification is used to track interface declarations
    and component registrations.

    This class is a base class for both interfaces themselves and for
    interface specifications (declarations).

    Specifications are mutable.  If you reassign their bases, their
    relations with other specifications are adjusted accordingly.
    rNcCs2d|_d|_i|_d|_d|_d|_t|�|_dS)Nr)rDrErCrFrGrH�tuple�	__bases__)r(�basesrrrr)hs	zSpecification.__init__cCs|jdur
t��|_|jSr<)rD�weakref�WeakKeyDictionaryr,rrr�
dependentszs

zSpecification.dependentscCs|j�|d�d|j|<dS)Nrr)r�r5rD)r(�	dependentrrr�	subscribe�szSpecification.subscribecCsXz|j|}Wntyt|��w|d8}|s|j|=dS|dks%J�||j|<dS)Nrr)rDrtr2r�)r(r��nrrr�unsubscribe�s�zSpecification.unsubscribecCs>|jD]}|�|�q||_|D]}|�|�q|�|�dSr<)r�r�rEr��changed)r(r��brrr�
__setBases�s
zSpecification.__setBasescCr*r<)rEr,rrr�<lambda>��zSpecification.<lambda>csV|jdd�|jD�d�}|j��dur)|r)|d�ur)�fdd�|D�}|���|S)z�
        Calculate and return the resolution order for this object, using its ``__bases__``.

        Ensures that ``Interface`` is always the last (lowest priority) element.
        cSsi|]}||j�qSr)rH��.0r�rrr�
<dictcomp>�s��z0Specification._calculate_sro.<locals>.<dictcomp>)�	base_mrosNrVcsg|]}|�ur|�qSrr)r��x��rootrr�
<listcomp>�s
�z0Specification._calculate_sro.<locals>.<listcomp>)�_do_calculate_ror��_ROOTr)r(�srorr�r�_calculate_sro�s
#
�
�
zSpecification._calculate_srocCs~d|_|j}|��|��}t|�|_tdd�|D��|_|D]}d||<qt|jr/|j��nd�D]}|�	|�q2d|_dS)z�
        We, or something we depend on, have changed.

        By the time this is called, the things we depend on,
        such as our bases, should themselves be stable.
        NcSsg|]	}t|t�r|�qSr��
isinstancer)r��ancestorrrrr��s
�z)Specification.changed.<locals>.<listcomp>r)
rFrC�clearr�rrHrGrDr8r�)r(�originally_changed�implied�	ancestorsr�r�rrrr��s


zSpecification.changedccs:�i}|jD]}|��D]
}||vrd||<|VqqdS)�DReturn an iterator for the interfaces in the specification.
        rN)r��
interfaces)r(�seen�baserQrrrr�s�
���zSpecification.interfacesTcCs||jvo|p||kS)z�Does the specification extend the given interface?

        Test whether an interface in the specification extends the
        given interface
        rP)r(rQ�strictrrr�extends
s
�zSpecification.extendscCst�||�Sr<)r��ref)r(�callbackrrrr��zSpecification.weakrefcCsd|j}|duri}|_|�|�}|dur*|jD]}|�|�}|dur)|||<nq|dur0|S|S)z+Query for an attribute description
        N)rFr5rG�direct)r(rjr6�attrs�attr�ifacerrrr5s



�zSpecification.get)r)Tr<)r%r=r>r&rSr�rBrRrKr)r~r�r�r��_Specification__setBasesr��calculate_ror�r�r�r�r�r�r5rrrrr	Rs.

�
9 


r	c@s,eZdZdZdd�Zedd��Zdd�ZdS)	�_InterfaceMetaClassrcCsPt�d�jd}tjd}t|t�rtjd}||d<t�||||�}||_	|S)Nrr%r=rp)
rr�	f_globalsrf�__dict__r��str�type�__new__�_InterfaceMetaClass__module)rOrjr�r�r=�moduledescr�kindrrrr�ts


z_InterfaceMetaClass.__new__cCr*r<)r��rOrrrr=�r.z_InterfaceMetaClass.__module__cCsd|j|jfS)Nz<class '%s.%s'>)r�r%r�rrr�__repr__�s�z_InterfaceMetaClass.__repr__N)r%r=r>rSr�r~r�rrrrr�)sI
r�rrSrcCs&t�d�j}|�ti�}|||j<tS)a�
    Convert a method specification to an actual method of the interface.

    This is a decorator that functions like `staticmethod` et al.

    The primary use of this decorator is to allow interface definitions to
    define the ``__adapt__`` method, but other interface methods can be
    overridden this way too.

    .. seealso:: `zope.interface.interfaces.IInterfaceDeclaration.interfacemethod`
    r)rrrr�INTERFACE_METHODSr%r)�funcr�methodsrrr�interfacemethod�s
r�c@s�eZdZdZ		d/dd�Z		d0dd�Zdd	�Zd
d�Zdd
�Zdd�Z	d1dd�Z
dd�Zd1dd�Zdd�Z
e
Zdd�Zdd�Zd2dd�Zd2dd �Zd2d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�ZdS)3rz�
    Prototype (scarecrow) Interfaces Implementation.

    Note that it is not possible to change the ``__name__`` or ``__module__``
    after an instance of this object has been constructed.
    Nrc	Cs�t|t�sJ�|p
i}|�td�}|rK|�d|vr d|�d�ini�d|vr+d|d<t|t�r4|f}n|tur<tf}n|tf}t|�|d||�}n t	rk|rkt
|�dkrktdd�|D��}|rkt|d|i�jd}t�
|�S)N�
__classcell__rrr�_CALL_CUSTOM_ADAPTz<WithCustomMethods>css&�|]}tt|�t�rt|�VqdSr<)�
issubclassr�� _InterfaceClassWithCustomMethodsr�rrr�	<genexpr>�s��
�z)InterfaceClass.__new__.<locals>.<genexpr>)r�r�popr��updater�r�rr��PY2�len�__mro__�_InterfaceClassBaser�)	rOrjr�r�r&r=�needs_custom_class�	cls_bases�bases_with_custom_methodsrrrr��sD��
����
zInterfaceClass.__new__c
	Cs(tdd�|D��s
td��|duri}|dur;|�d�}t|t�r%|d=nz
t�d�jd}Wntt	fy:Ynwt
�|||�|�d�}|durYt|t�sY|durV|}|d=|dur_d}t
�|||�|�td�}|dur|��D]
\}}	|�||	�qtt�||�|�|�|_d	||f|_dS)
Ncss�|]}t|t�VqdSr<r�)r�r�rrrr��s�z*InterfaceClass.__init__.<locals>.<genexpr>zExpected base interfacesr=rr%r&r"�%s.%s)�allrtr5r�r�rrr�rWr2rfr)�	Attributer!r�r�itemsr;r	�_InterfaceClass__compute_attrs�_InterfaceClass__attrs�__identifier__)
r(rjr�r�r&r=�d�tagged_datar�valrrrr)�s<

�

zInterfaceClass.__init__cs"�fdd���fdd�|��D�S)NcsHt|t�r�|_|js||_|St|t�rt|�|d�}|Std|��)N)rjzConcrete attribute, )r�r�rQr%r�fromFunction�InvalidInterface)�aname�avalr,rr�update_value!s

��z4InterfaceClass.__compute_attrs.<locals>.update_valuecs,i|]\}}|dvr|tur|�||��qS))�
__locals__r>�__annotations__)r)r�r�r�)r�rrr�,s
�
z2InterfaceClass.__compute_attrs.<locals>.<dictcomp>)r�)r(r�r)r(r�r�__compute_attrss
�zInterfaceClass.__compute_attrsccs�|VdS)r�Nrr,rrrr�:s�
zInterfaceClass.interfacescCr*r<)r�r,rrr�getBases?�zInterfaceClass.getBasescCs||kp|�|�S)zSame interface or extends?)r�)r(rYrrr�isEqualOrExtendedByBsz"InterfaceClass.isEqualOrExtendedByFcCsB|s|j��S|j��}|jD]
}|�t�|�|���q|��S)z4Return the attribute names defined by the interface.)r�r8�copyr�r��dict�fromkeys�names�r(r��rr�rrrr�Fs


zInterfaceClass.namescCst|jdd��S)NT)r�)�iterr�r,rrr�__iter__RszInterfaceClass.__iter__cCsP|s|j��Si}|jddd�D]}|�t|�|���q|�|j�|��S)z=Return attribute names and descriptions defined by interface.NrV)r�r�r�r�r��namesAndDescriptionsr�rrrr�Us
z#InterfaceClass.namesAndDescriptionscCs|�|�}|dur|St|��)z4Return the attribute description for the given name.N)r5r2�r(rjr�rrr�getDescriptionForbs
z InterfaceClass.getDescriptionForcCs|�|�duSr<�r5�r(rjrrr�__contains__l�zInterfaceClass.__contains__cCs|j�|�Sr<)r�r5r�rrrr�or�zInterfaceClass.directcCs|�||�Sr<r�)r(rjr6rrr�queryDescriptionForrr�z"InterfaceClass.queryDescriptionForcCst|jD].}|�dd�D]%}z||�Wqty0}z|dur%|�|�n�WYd}~qd}~wwq|r8t|��dS)z&validate object to defined invariants.rrN)rGr?rr)r(ru�errorsr�r�errorrrr�validateInvariantsus
����	�z!InterfaceClass.validateInvariantscCs,|jD]}|�|t�}|tur|Sq|S)z�
        Queries for the value associated with *tag*, returning it from the nearest
        interface in the ``__iro__``.

        If not found, returns *default*.
        )rGr?rs)r(r3r6r�rrrrr7�s
�zInterfaceClass.queryTaggedValuecCs"|j|td�}|turt|��|S)r1)r6)r7rsr2r:rrrr4�szInterfaceClass.getTaggedValuecCs$t�}|jD]	}|�|���q|S)z Returns a list of all tags. )�setrGr�rA)r(r8r�rrrr9�s
z!InterfaceClass.getTaggedValueTagscCs>z|jWStyt|�}d|jj|f}||_|YSw)Nz<%s %s>)�_v_reprrWr��	__class__r%r�rrrr��s�zInterfaceClass.__repr__cCs |j}|j}|rd||f}|S)Nr�ri)r(rj�mrrr�__str__�s
zInterfaceClass.__str__cCs4z||�WStyt��djdur�YdSw)N�)rtr�exc_info�tb_nextrmrrrro�s
��zInterfaceClass._call_conformcCr*r<r+r,rrr�
__reduce__�r�zInterfaceClass.__reduce__)NrNNN)rNNN)Fr<)r%r=r>r&r�r)r�r�r�r�r�r�r�r��__getitem__r�r�r�r�r7r4r9r�r�ror�rrrrr�s8
�3
�3






	�	Interfacezzope.interface)r=cCstfSr<)r�rrrrr��r�r�c@seZdZdZdS)r�z_
    Marker class for interfaces with custom methods that override InterfaceClass methods.
    N)r%r=r>r&rrrrr��sr�c@s,eZdZdZdZdd�Zdd�Zdd�ZdS)	r�zAttribute descriptions
    NcCsdS)z/Return extra data to put at the end of __str__.r"rr,rrr�
_get_str_info�szAttribute._get_str_infocCs<d}|jdur|jjd|jjd}||jpd|��S)Nr"�.z	<unknown>)rQr=r%r)r(�ofrrrr��s
zAttribute.__str__cCs dt|�jt|�jt|�|fS)Nz<%s.%s object at 0x%x %s>)r�r=r%�idr,rrrr��s�zAttribute.__repr__)r%r=r>r&rQrr�r�rrrrr��sr�c@sdeZdZdZdZZdZZZdd�Z	dd�Z
dd	�Zee	e
e�Z
d
d�Zdd
�Zdd�ZeZdS)�Methodz�Method interfaces

    The idea here is that you have objects that describe methods.
    This provides an opportunity for rich meta-data.
    rNcCs|jduriS|jSr<��	_optionalr,rrr�
_get_optionals
zMethod._get_optionalcCs
||_dSr<r)r(�optrrr�
_set_optional�
zMethod._set_optionalcCs
d|_dSr<rr,rrr�
_del_optionalr
zMethod._del_optionalcOst|j|j��r<)�BrokenImplementationrQr%)r(�args�kwrrrrTr�zMethod.__call__cCs|j|j|j|j|jd�S)N��
positional�required�optional�varargs�kwargsrr,rrr�getSignatureInfos�zMethod.getSignatureInfocCs�g}|jD]}|�|�||j��vr"|ddt|j|�7<q|jr.|�d|j�|jr9|�d|j�dd�|�S)NrV�=�*z**z(%s)z, )rrrr8�reprrr�join)r(�sig�vrrr�getSignatureStrings

�zMethod.getSignatureString)r%r=r>r&rrrrrrr	rr~rrTrrrrrrrr�s
rcCs.|p|j}t||j�}t|dd�pd}|j}|j|}|j|d�}i}	t|�}
|
s0t|dd�}
||
}|dkrA||d�}d}|	�t	t
||d�|���|d|�|_|d|�|_|	|_
|}|jt@rq|||_|d}nd|_|jt@r|||_nd|_||_|j��D]
\}
}|�|
|�q�|S)N�__defaults__r�__defaults_count__rr)r%rr&�getattr�__code__�co_argcount�co_varnamesr�r�r��ziprrr�co_flags�
CO_VARARGSr�CO_VARKEYWORDSrrQr�r�r;)r�rQ�imlevelrj�method�defaults�code�nar�r�defaults_count�nr�argnorrrrrr�&s<





r�cCs&t|t�r	|j}n|}t||d|d�S)Nr)r'rj)r�r�__func__r�)�methrQrjr�rrr�
fromMethodZs
r1cCs~ddlm}ddlm}|t|�ddlm}|t|�ddlm}|t|�ddlm	}|t
|�ddlm}|t|�dS)Nr)�classImplements)�IElement)�
IAttribute)�IMethod)�ISpecification)�
IInterface)
�zope.interface.declarationsr2�zope.interface.interfacesr3r!r4r�r5rr6r	r7r)r2r3r4r5r6r7rrr�_wirecs



r:)rN)rK)r�)r)�_empty)NrNr})7r&r�typesrrr��zope.interface._compatrrr��zope.interface.exceptionsr�zope.interface.rorr��zope.interface�__all__r%r&rr��objectrrsrr r!�SpecificationBasePyrBrUrfr
r	r�r�r�r�rr�r�r�rHr�r�r�rr�r1r:r8rNrKr�rr;rrrr�<module>sr

=.N
OXh�


3
4	

Spamworldpro Mini