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__/registry.cpython-310.pyc
o

$
x`�e�@s�dZddlmZzddlmZWn
eydd�ZYnwddlmZddlmZddlm	Z	dd	lm
Z
dd
lmZddlmZddlm
Z
dd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZdgZGdd�de�Zdd�ZGdd�de�Z ee
�Gdd�de��Z!dd �Z"d!d"�Z#d#d$�Z$d%d&�Z%ee
�Gd'd(�d(e��Z&ee	�Gd)d*�d*e��Z'ee�Gd+d,�d,e'��Z(ee�Gd-d.�d.e'��Z)d/S)0zBasic components support
�)�defaultdict)�notifycO�dS�N�)�arg�kwrr�9/usr/lib/python3/dist-packages/zope/interface/registry.pyr�r)�ISpecification)�ComponentLookupError)�IAdapterRegistration)�IComponents)�IHandlerRegistration)� ISubscriptionAdapterRegistration)�IUtilityRegistration)�
Registered)�Unregistered)�	Interface)�
implementedBy)�implementer)�implementer_only)�
providedBy)�AdapterRegistry)�CLASS_TYPES)�STRING_TYPES�
Componentsc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_UnhashableComponentCountercCsdd�|��D�|_dS)NcSsg|]}|�qSrr)�.0�itemrrr	�
<listcomp>6sz8_UnhashableComponentCounter.__init__.<locals>.<listcomp>)�items�_data)�self�	otherdictrrr	�__init__4sz$_UnhashableComponentCounter.__init__cCs$|jD]\}}||kr|SqdS�Nr)r")r#�key�	component�countrrr	�__getitem__8s
�z'_UnhashableComponentCounter.__getitem__cCsHt|j�D]\}}|d|kr||f|j|<dSq|j�||f�dSr&)�	enumerater"�append)r#r(r)�i�datarrr	�__setitem__>s�z'_UnhashableComponentCounter.__setitem__cCs6t|j�D]\}}|d|kr|j|=dSqt|��r&)r+r"�KeyError)r#r(r-r.rrr	�__delitem__Es�z'_UnhashableComponentCounter.__delitem__N)�__name__�
__module__�__qualname__r%r*r/r1rrrr	r1s
rcCstt�Sr)r�intrrrr	�_defaultdict_intL�r6c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�_UtilityRegistrationscCs"tt�|_||_||_|��dSr)rr6�_cache�
_utilities�_utility_registrations�%_UtilityRegistrations__populate_cache)r#�	utilities�utility_registrationsrrr	r%Qs
z_UtilityRegistrations.__init__cCs4t|j���D]\\}}}|d}|�||�qdSr&)�iterr;r!�$_UtilityRegistrations__cache_utility)r#�p�_r.r(rrr	�__populate_cacheYs�z&_UtilityRegistrations.__populate_cachecCsZz|j||d7<WdSty,t|j|�}|j|<||d7<YdSw)N�)r9�	TypeErrorr)r#�providedr(�provrrr	�__cache_utility^s�z%_UtilityRegistrations.__cache_utilitycCs@|j|}||}|d8}|dkr||=|dkS|||<|dkS)NrDr)r9)r#rFr(r)rrr	�__uncache_utilitygs
�z'_UtilityRegistrations.__uncache_utilitycCs*z
|j||dkWStyYdSw)NrF)r9rE)r#rFr(rrr	�_is_utility_subscribedvs
�z,_UtilityRegistrations._is_utility_subscribedcCsV|�||�}|||f|j||f<|j�d|||�|s#|j�d||�|�||�dS�Nr)rJr;r:�register�	subscriber@)r#rF�namer(�info�factory�
subscribedrrr	�registerUtility}sz%_UtilityRegistrations.registerUtilitycCsD|j||f=|j�d||�|�||�}|s |j�d||�dSdSrK)r;r:�
unregister�&_UtilityRegistrations__uncache_utility�unsubscribe)r#rFrNr(rQrrr	�unregisterUtility�s�z'_UtilityRegistrations.unregisterUtilityN)
r2r3r4r%r<r@rTrJrRrVrrrr	r8Os	r8csreZdZdZdIdd�Zdd�Z�fdd	�Zd
d�Zdd
�Ze	dd��Z
dd�Zdd�Ze	dd�dd��Z
		dJdd�Z		dKdd�Zdd�ZdLdd�ZdMd d!�Zd"d#�Zd$d%�Z		dNd&d'�Z		dOd(d)�Zd*d+�ZdLd,d-�ZdMd.d/�Z		dLd0d1�ZdMd2d3�Zd4d5�Z			dNd6d7�Zd8d9�Z		dOd:d;�Zd<d=�Z 			dPd>d?�Z!d@dA�Z"dQdBdC�Z#dDdE�Z$dRdGdH�Z%�Z&S)SrN�rcCs8t|t�sJ�||_|��|��t|�|_d|_dSr)�
isinstancerr2�_init_registries�_init_registrations�tuple�	__bases__�_v_utility_registrations_cache)r#rN�basesrrr	r%�s

zComponents.__init__cCsd|jj|jfS)Nz<%s %s>)�	__class__r2�r#rrr	�__repr__��zComponents.__repr__cs<tt|���}dd�|d��D�}t|�}||d<t|�S)NcSs i|]\}}|�d�s||�qS)�_v_)�
startswith)r�k�vrrr	�
<dictcomp>�s�z)Components.__reduce__.<locals>.<dictcomp>�)�superr�
__reduce__r!�listr[)r#�	reduction�filtered_state�r_rr	rj�s
zComponents.__reduce__cCst�|_t�|_dSr)r�adaptersr=r`rrr	rY�szComponents._init_registriescCsi|_i|_g|_g|_dSr)r;�_adapter_registrations�_subscription_registrations�_handler_registrationsr`rrr	rZ�s
zComponents._init_registrationscCs>|j}|dus|j|jus|j|jurt|j|j�}|_|Sr)r]r:r=r;r8)r#�cacherrr	�_utility_registrations_cache�s
�z'Components._utility_registrations_cachecCs|j�dd�S)Nr\r)�__dict__�getr`rrr	�	_getBases�szComponents._getBasescCs>tdd�|D��|j_tdd�|D��|j_t|�|jd<dS)NcS�g|]}|j�qSr)ro�r�baserrr	r ���z(Components._setBases.<locals>.<listcomp>cSrxr)r=ryrrr	r �r{r\)r[ror\r=ru�r#r^rrr	�	_setBases�s��zComponents._setBasescCs|��Sr)rwr`rrr	�<lambda>�szComponents.<lambda>cCs
|�|�Sr)r}r|rrr	r~�s
Tc	Cs�|r|rtd��|�}|durt|�}|dkrt|�}|j�||f�}|dur<|dd�||fkr3dS|�|d||�|j�|||||�|rWtt	t
||||||���dSdS)N�$Can't specify factory and component.rWrhr)rE�_getUtilityProvided�_getNamer;rvrVrtrRrr�UtilityRegistration)r#r(rFrNrO�eventrP�regrrr	rR�s.
��
��zComponents.registerUtilitycCs�|r|rtd��|�}|dur|durtd��t|�}|j�||f�}|dus1|dur3||dkr3dS|dur;|d}|j�|||�ttt||||g|dd��R���dS)Nrz3Must specify one of component, factory and providedrFrDT)	rEr�r;rvrtrVrrr�)r#r(rFrNrP�oldrrr	rV�s*��zComponents.unregisterUtilityccs8�t|j���D]\\}}}t|||g|�R�VqdSr)r?r;r!r�)r#rFrNr.rrr	�registeredUtilitiess
���zComponents.registeredUtilitiescCs|j�d|||�SrK)r=�lookup)r#rFrN�defaultrrr	�queryUtilityrbzComponents.queryUtilitycCs&|j�d||�}|durt||��|SrK)r=r�r)r#rFrN�utilityrrr	�
getUtility!s
zComponents.getUtilityccs(�|j�d|�D]	\}}||fVqdSrK)r=�	lookupAll)r#�	interfacerNr�rrr	�getUtilitiesFor's��zComponents.getUtilitiesForcCs|j�d|�SrK)r=�
subscriptions)r#r�rrr	�getAllUtilitiesRegisteredFor+�z'Components.getAllUtilitiesRegisteredForc	Csv|durt|�}t||�}|dkrt|�}||f|j|||f<|j�||||�|r9ttt||||||���dSdS�NrW)	�_getAdapterProvided�_getAdapterRequiredr�rprorLrr�AdapterRegistration�r#rP�requiredrFrNrOr�rrr	�registerAdapter.s
�
�
��zComponents.registerAdaptercCs�|dur|durtd��t|�}|dur|durtd��t||�}|j�|||f�}|dus8|dur:||dkr:dS|j|||f=|j�|||�ttt	||||g|�R���dS)N�(Must specify one of factory and provided�(Must specify one of factory and requiredrFT)
rEr�r�rprvrorSrrr�)r#rPr�rFrNr�rrr	�unregisterAdapter@s&
��zComponents.unregisterAdapterccs<�t|j���D]\\}}}\}}t||||||�VqdSr)r?rpr!r�)r#r�rFrNr(rOrrr	�registeredAdapters[s��
��zComponents.registeredAdapterscC�|j�||||�Sr)ro�queryAdapter)r#�objectr�rNr�rrr	r�arbzComponents.queryAdaptercC�(|j�|||�}|durt|||��|Sr)ror�r)r#r�r�rN�adapterrrr	�
getAdapterd�zComponents.getAdaptercCr�r)ro�queryMultiAdapter)r#�objectsr�rNr�rrr	r�js�zComponents.queryMultiAdaptercCr�r)ror�r)r#r�r�rNr�rrr	�getMultiAdapteror�zComponents.getMultiAdapterccsB�|j�ttt|��|�D]\}}||�}|dur||fVq
dSr)ror�rk�mapr)r#r�rFrNrPr�rrr	�getAdaptersus��
��zComponents.getAdaptersc	Csr|rtd��|durt|�}t||�}|j�|||||f�|j�|||�|r7ttt	||||||���dSdS)N�'Named subscribers are not yet supported)
rEr�r�rqr,rorMrr�SubscriptionRegistrationr�rrr	�registerSubscriptionAdapter}s 
�
�
��z&Components.registerSubscriptionAdaptercc�$�|jD]}t|g|�R�VqdSr)rqr��r#r.rrr	�registeredSubscriptionAdapters���
�z)Components.registeredSubscriptionAdaptersc	s�|rtd���dur�durtd��t����dur"�dur"td��t�����dur7��fdd�|jD�}n���fdd�|jD�}t|�t|j�krNdS||jdd�<|j�����ttt	|��|�d���d	S)
Nr�r�r�cs4g|]\}}}}}|�kr|�ks|||||f�qSrr�r�rrA�n�fr-)rFr�rr	r �s
�z<Components.unregisterSubscriptionAdapter.<locals>.<listcomp>cs<g|]\}}}}}|�kr|�kr|�ks|||||f�qSrrr��rPrFr�rr	r �s
�FrWT)
rEr�r�rq�lenrorUrrr�)r#rPr�rFrN�newrr�r	�unregisterSubscriptionAdapter�s4
��
��z(Components.unregisterSubscriptionAdaptercCs|j�||�Sr�ro�subscribers)r#r�rFrrr	r��r�zComponents.subscriberscCs^|rtd��t||�}|j�||||f�|j�|d|�|r-ttt|||||���dSdS)Nz$Named handlers are not yet supported)	rEr�rrr,rorMrr�HandlerRegistration)r#rPr�rNrOr�rrr	�registerHandler�s

�
��zComponents.registerHandlerccr�r)rrr�r�rrr	�registeredHandlers�r�zComponents.registeredHandlerscs�|rtd���dur�durtd��t�����dur&�fdd�|jD�}n��fdd�|jD�}t|�t|j�kr<dS||jdd�<|j��d��ttt|�|�d���dS)	Nr�r�cs(g|]\}}}}|�kr||||f�qSrr�rr�r�r�r-)r�rr	r �s


�z0Components.unregisterHandler.<locals>.<listcomp>cs0g|]\}}}}|�kr|�ks||||f�qSrrr��rPr�rr	r �s


�FrWT)	rEr�rrr�rorUrrr�)r#rPr�rNr�rr�r	�unregisterHandler�s(

���zComponents.unregisterHandlercGs|j�|d�dSrr�)r#r�rrr	�handle�rbzComponents.handleFc	Cs"t|j�}|j}d}d}d}d}d|jvsJ�dd�|_|r%|j}|j}	ndd�}}	zN|��D]:\\}
}\}}
}|�d|
|�|krN|d|
||�|d7}n|d7}|�	d|
|�durf|d7}|	d|
|�q0|d7}q0W|`|ry|st|ry|�|�n|`|r�|s�|r�|�|�www||||d	�S)
a�
        Emergency maintenance method to rebuild the ``.utilities``
        registry from the local copy maintained in this object, or
        detect the need to do so.

        Most users will never need to call this, but it can be helpful
        in the event of suspected corruption.

        By default, this method only checks for corruption. To make it
        actually rebuild the registry, pass `True` for *rebuild*.

        :param bool rebuild: If set to `True` (not the default),
           this method will actually register and subscribe utilities
           in the registry as needed to synchronize with the local cache.

        :return: A dictionary that's meant as diagnostic data. The keys
           and values may change over time. When called with a false *rebuild*,
           the keys ``"needed_registered"`` and ``"needed_subscribed"`` will be
           non-zero if any corruption was detected, but that will not be corrected.

        .. versionadded:: 5.3.0
        r�changedcSrrr)rBrrr	r~r
zAComponents.rebuildUtilityRegistryFromLocalCache.<locals>.<lambda>cWrrr)�argsrrr	r~$r
rrDN)�needed_registered�did_not_register�needed_subscribed�did_not_subscribe)
�dictr;r=rur�rLrMr!�
registeredrQ)r#�rebuild�regs�utilsr�r�r�r�rLrMrFrN�value�_info�_factoryrrr	�$rebuildUtilityRegistryFromLocalCache�sH



�

����z/Components.rebuildUtilityRegistryFromLocalCache)rWr)NNrWrWTN)NNrWN)rWN)rW)NNrWrWT)NNNrW)NrWrWT)NNrW)F)'r2r3r4r]r%rarjrYrZ�propertyrtrwr}r\rRrVr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��
__classcell__rrrnr	r�sr


�
�
�


�
�


�
	
�
�*
�
"cCsz|jWStyYdSwr�)�__component_name__�AttributeError)r(rrr	r�?s
�r�cC�(tt|��}t|�dkr|dStd��)NrDrzWThe utility doesn't provide a single interface and no provided interface was specified.)rkrr�rE)r(rFrrr	r�E��r�cCr�)NrDrzaThe adapter factory doesn't implement a single interface and no provided interface was specified.)rkrr�rE)rPrFrrr	r�Mr�r�cCs�|durz|j}Wntytd��wt�|�rtd��g}|D]%}|dur+t}nt�|�sBt|t�r:t|�}ntdt	|���|�
|�q"t|�S)NzoThe adapter factory doesn't have a __component_adapts__ attribute and no required specifications were specifiedzLthe required argument should be a list of interfaces, not a single interfacez?Required specification must be a specification or class, not %r)�__component_adapts__r�rErrrrXrr�typer,r[)rPr��resultr�rrr	r�Us,
��



�r�c@sVeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)r�NcC�,||||||f\|_|_|_|_|_|_dSr)�registryrFrNr(rOrP)r#r�rFrNr(�docrPrrr	r%ts�zUtilityRegistration.__init__c
Cs<d|jj|jt|jdd�|jt|jdt|j��|j|j	fS)Nz%s(%r, %s, %r, %s, %r, %r)r2)
r_r2r��getattrrFrNr(�reprrPrOr`rrr	rays�zUtilityRegistration.__repr__cC�t|�Sr��idr`rrr	�__hash__�r7zUtilityRegistration.__hash__cC�t|�t|�kSr�r��r#�otherrrr	�__eq__��zUtilityRegistration.__eq__cC�t|�t|�kSrr�r�rrr	�__ne__�r�zUtilityRegistration.__ne__cC�t|�t|�kSrr�r�rrr	�__lt__�r�zUtilityRegistration.__lt__cC�t|�t|�kSrr�r�rrr	�__le__�r�zUtilityRegistration.__le__cC�t|�t|�kSrr�r�rrr	�__gt__�r�zUtilityRegistration.__gt__cC�t|�t|�kSrr�r�rrr	�__ge__�r�zUtilityRegistration.__ge__r�r2r3r4r%rar�r�r�r�r�r�r�rrrr	r�qs
	r�c@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)r�cCr�r)r�r�rFrNrPrO)r#r�r�rFrNr(r�rrr	r%�s�zAdapterRegistration.__init__cCsTd|jj|jdd�dd�|jD��dt|jdd�|jt|jdt	|j��|j
fS)Nz%s(%r, %s, %s, %r, %s, %r)�[�, cSrxr�r2�rr�rrr	r ��z0AdapterRegistration.__repr__.<locals>.<listcomp>�]r2)r_r2r��joinr�r�rFrNrPr�rOr`rrr	ra�s�zAdapterRegistration.__repr__cCr�rr�r`rrr	r��r7zAdapterRegistration.__hash__cCr�rr�r�rrr	r��r�zAdapterRegistration.__eq__cCr�rr�r�rrr	r��r�zAdapterRegistration.__ne__cCr�rr�r�rrr	r��r�zAdapterRegistration.__lt__cCr�rr�r�rrr	r��r�zAdapterRegistration.__le__cCr�rr�r�rrr	r��r�zAdapterRegistration.__gt__cCr�rr�r�rrr	r��r�zAdapterRegistration.__ge__Nr�rrrr	r��s	r�c@seZdZdS)r�N)r2r3r4rrrr	r��sr�c@s,eZdZdd�Zedd��ZdZdd�ZdS)r�cCs&|||||f\|_|_|_|_|_dSr)r�r�rN�handlerrO)r#r�r�rNr�r�rrr	r%�s�zHandlerRegistration.__init__cCs|jSr)r�r`rrr	rP�szHandlerRegistration.factoryNc
CsHd|jj|jdd�dd�|jD��d|jt|jdt|j��|j	fS)Nz%s(%r, %s, %r, %s, %r)r�r�cSrxrr�r�rrr	r �r�z0HandlerRegistration.__repr__.<locals>.<listcomp>r�r2)
r_r2r�r�r�rNr�rPr�rOr`rrr	ra�s�zHandlerRegistration.__repr__)r2r3r4r%r�rPrFrarrrr	r��s
r�N)*�__doc__�collectionsr�
zope.eventr�ImportError�zope.interface.interfacesrrr
rrrrrr�zope.interface.interfacer�zope.interface.declarationsrrrr�zope.interface.adapterr�zope.interface._compatrr�__all__r�rr6r8rr�r�r�r�r�r�r�r�rrrr	�<module>s\
��C/%%

Spamworldpro Mini