ó
    Ï›‘h·*  ã                   ó–   • S SK r S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJ	r	  / r
 " S S	5      r " S
 S\5      rS r\" 5       rg)é    N)ÚFunctionType)Ú	Interface)ÚclassImplements)ÚInterfaceClass)Ú_decorator_non_return)ÚfromFunctionc                   ó   • \ rS rSrS rSrg)Úoptionalé    c                 ó&   • UR                   U l         g ©N©Ú__doc__)ÚselfÚmethods     ÚbC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\zope/interface/common/__init__.pyÚ__init__Úoptional.__init__$   s   € Ø—~‘~ˆ�ó    r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   Ú__static_attributes__© r   r   r
   r
       s   † õ&r   r
   c                   óp   • \ rS rSrSrS r\S 5       rS r\S 5       r	\S 5       r
S rSS
 jrS rS rSrg	)ÚABCInterfaceClassé(   a 
  
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
c           	      ó$  • Xl         UR                  SS5      nUR                  SS5      nSU;  a9  [        R                  " XX#5        [        R                  XU5        [        U l        g UR                  S5      nX`l        [        U5      U l	        [        U5      U l
        USS  UR                   :X  d   X45       e[        U5      R                  5        VVs0 s H]  u  px[        U[        5      (       d  M  U R                  U5      (       a  M4  U R!                  U5      (       a  ML  XpR#                  X‡5      _M_     n	nnU R%                  U5      U	S'   U	R'                  U5        [        R                  " XX)5        U R                  5         g s  snnf )NÚextra_classesr   Úignored_classesÚabcé   r   )r   Úpopr   r   r   Ú$_ABCInterfaceClass__register_classesÚ	__class__Ú_ABCInterfaceClass__abcÚtupleÚ!_ABCInterfaceClass__extra_classesÚ#_ABCInterfaceClass__ignored_classesÚvarsÚitemsÚ
isinstancer   Ú#_ABCInterfaceClass__is_private_nameÚ,_ABCInterfaceClass__is_reverse_protocol_nameÚ(_ABCInterfaceClass__method_from_functionÚ$_ABCInterfaceClass__create_class_docÚupdate)
r   ÚnameÚbasesÚattrsr    r!   Úbased_onÚkÚvÚmethodss
             r   r   ÚABCInterfaceClass.__init__z   sk  € àŒØŸ	™	 /°2Ó6ˆØŸ)™)Ð$5°rÓ:ˆà˜Óô ×#Ò# D°Ô=Ü×0Ñ0Ø _ôô ,ˆDŒNØà—9‘9˜UÓ#ˆØŒ
Ü$ ]Ó3ˆÔÜ!& Ó!7ˆÔà�A�Bˆx˜8×,Ñ,Ó,Ð>¨tÐ.>Ó>Ð,ô
 ˜X›×,Ñ,Ô.ô	
ò /‘�Ü˜!œ\×*ó 1ð ×&Ñ& q×)ó 1ð ×/Ñ/°×2ó	 1ˆA×*Ñ*¨1Ó0Ò0Ù.ð	 	ñ 
ð "×4Ñ4°UÓ;ˆ�	Ñà�‰�uÔÜ×Ò ¨EÔ;Ø×ÑÕ!ùó
s   ÃFÃ7FÄFÄ'Fc                 ó  • U R                  5        VVs0 s H  u  p[        U[        5      (       d  M  X_M      nnnU H  n[        X'   M     U(       d  gSSR	                  S UR                  5        5       5      -   nU$ s  snnf )NÚ z)

The following methods are optional:
 - z
-c              3   óH   #   • U  H  u  pU S UR                    3v •  M     g7f)Ú
Nr   )Ú.0r7   r8   s      r   Ú	<genexpr>Ú?ABCInterfaceClass.__optional_methods_to_docs.<locals>.<genexpr>©   s&   é € ð K
Ú,=¡D Aˆqˆc��A—I‘I�;ÕÒ,=ùs   ‚ ")r,   r-   r
   r   Újoin)r5   r7   r8   Ú	optionalsÚdocss        r   Ú__optional_methods_to_docsÚ,ABCInterfaceClass.__optional_methods_to_docs    s}   € à&+§k¡k¤mÔO¢m™d˜a´zÀ!ÄX×7N“T�Q’T¡mˆ	ÑOÛˆAÜ,ˆE‹Hñ ö Øà=ÀÇ
Á
ñ K
Ø,5¯O©OÔ,=óK
ó A
ñ 
ˆð ˆùó Ps
   ”B ³B c                 ó–  ^• U R                   nS mSR                  U4S j[        U R                  5       TS9 5       5      nU(       a  SU-   nUR                  =(       d    SnUR                  5       nU(       a  US   OSnSR                  UR                  UR                  UR                  S	U5      U R                  U5      U5      nU$ )
Nc                 ó†   • U R                   nU R                  nU[        R                   :X  a  SU-  $ US:X  a  SnSU SU S3$ )Nz`%s`Ú_ioÚioÚ`Ú.)r   r   Ústr)ÚcÚmodr3   s      r   ÚrefÚ1ABCInterfaceClass.__create_class_doc.<locals>.ref±   sK   € Ø—,‘,ˆCØ—:‘:ˆDØ”c—n‘nÓ$Ø ‘}Ð$Ø�e‹|Ø�Ø�s�e˜1˜T˜F !Ð$Ð$r   z
 - c              3   ó4   >#   • U  H  nT" U5      v •  M     g 7fr   r   )r?   rN   rP   s     €r   r@   Ú7ABCInterfaceClass.__create_class_doc.<locals>.<genexpr>º   s   øé € ð +
âD�ñ ��FˆFÚDùs   ƒ)Úkeyz!

Known implementations are:

 - r<   r   z&Interface for the ABC `{}.{}`.

{}{}{}r   )r'   rB   ÚsortedÚgetRegisteredConformersr   Ú
splitlinesÚformatr   r   ÚgetÚ,_ABCInterfaceClass__optional_methods_to_docs)r   r5   r6   Úimplementations_docÚbased_on_docÚdocrP   s         @r   Ú__create_class_docÚ$ABCInterfaceClass.__create_class_doc®   sÆ   ø€ Ø—:‘:ˆò	%ð &Ÿl™lô +
ä˜D×8Ñ8Ó:ÀÒDó+
ó 
Ðö à7Ð:MÑMð  ð !×(Ñ(×.¨BˆØ#×.Ñ.Ó0ˆÞ*6�| A’¸Bˆà<×CÑCØ×Ñ ×!2Ñ!2Ø�I‰I�i Ó.Ø×+Ñ+¨EÓ2Øó	
ˆð ˆ
r   c                 ó~   • U R                  S5      (       a  U R                  S5      (       a  gU R                  S5      $ )NÚ__FÚ_©Ú
startswithÚendswith©r3   s    r   Ú__is_private_nameÚ#ABCInterfaceClass.__is_private_nameÏ   s1   € à�?‰?˜4× Ñ  T§]¡]°4×%8Ñ%8ØØ�‰˜sÓ#Ð#r   c                 óT   • U R                  S5      =(       a    U R                  S5      $ )NÚ__rra   rc   rf   s    r   Ú__is_reverse_protocol_nameÚ,ABCInterfaceClass.__is_reverse_protocol_nameÕ   s!   € ð �‰˜uÓ%×=¨$¯-©-¸Ó*=Ð=r   c                 óB   • [        XUS9nUR                  SS  Ul        U$ )Nrf   r#   )r   Ú
positional)r   Úfunctionr3   r   s       r   Ú__method_from_functionÚ(ABCInterfaceClass.__method_from_functionÝ   s*   € Ü˜h°4Ñ8ˆð #×-Ñ-¨a¨bÐ1ˆÔØˆr   Nc                 ó†   • Ub  UOU R                  5       nUb  UOU R                  nU H  nXC;   a  M
  [        X@5        M     g r   )rV   r*   r   )r   Ú
conformersr!   ÚignoredÚclss        r   Ú__register_classesÚ$ABCInterfaceClass.__register_classesä   sQ   € ð %Ñ0‰JØ×-Ñ-Ó/ð 	ð
  /Ñ:‰OØ×'Ñ'ð 	ó ˆCØ‹~ÙÜ˜CÖ&ò r   c                 ó   • U R                   $ )z+
Return the ABC this interface represents.
)r'   )r   s    r   ÚgetABCÚABCInterfaceClass.getABCô   s   € ð �z‰zÐr   c                 ó¬  • U R                   n [        UR                  5      [        UR                  5      -   n[        [        R                  " X R                  5      5      $ ! [         ag    SSKJn  U" U5      nUS   nUS   n[        R                  " XV5       Vs/ s H	  ow" 5       PM     Os  snf nnU Vs/ s H	  owc  M  UPM     Os  snf nn N™f = f)zb
Return an iterable of the classes that are known to conform to
the ABC this interface parallels.
r   )Ú	_get_dumpr#   )r'   ÚlistÚ_abc_registryÚ
_abc_cacheÚAttributeErrorr"   r|   Ú	itertoolsÚchainÚsetr)   )r   r6   Ú
registeredr|   ÚdataÚregistryÚcacheÚxs           r   rV   Ú)ABCInterfaceClass.getRegisteredConformersú   sÃ   € ð
 —:‘:ˆð	Bä�X×+Ñ+Ó,¬t°H×4GÑ4GÓ/HÑHð ô ”9—?’? :×/CÑ/CÓDÓEÐEøô ó 	Bõ &Ù˜XÓ&ˆDØ˜A‘wˆHØ˜‘GˆEÜ'0§¢°xÔ'GÓHÒ'G !˜!ž#Ò'GùÒHˆJÐHÙ%/ÓA¢Z Ÿ!¢ZùÒAˆJÐA‰Jð	Bús/   Ž+A" Á":CÂB-Â,CÂ8C	ÃC	ÃCÃC)Ú__abcr&   Ú__extra_classesÚ__ignored_classesr   )NN)r   r   r   r   r   r   ÚstaticmethodrZ   r1   r.   r/   r0   r%   ry   rV   r   r   r   r   r   r   (   sf   † ñJòb$"ðL ñó ðòðB ñ$ó ð$ð
 ñ>ó ð>òô'ò õFr   r   c                  ó~   • S[         40 4n [        R                  " [        /U Q76 n[        R                  " U/U Q76   U$ )NÚABCInterface)r   r   Ú__new__r   r   )Úabc_name_bases_attrsÚinstances     r   Ú_create_ABCInterfacer“     sI   € ð
 +¬Y¨L¸"Ð=ÐÜ ×(Ò(ÜðØ0ò€Hô ×Ò˜HÐ<Ð';Ó<Ø€Or   )r�   Útypesr   Úzope.interfacer   r   Úzope.interface.interfacer   r   r   Ú__all__r
   r   r“   r�   r   r   r   Ú<module>r˜      sM   ðó Ý å $Ý *Ý 3Ý :Ý 1ð€÷&ñ &ôkF˜ô kFò\
ñ $Ó%�r   