§
    Ètºf  ã                   óž   — d dl Z d dlZd dlmZ d dlmZmZ d„ Zd„ Z G d„ de	¦  «        Z
 G d„ d	e
¦  «        Z G d
„ de
¦  «        Zd„ Zd„ ZdS )é    N)ÚMethodicalMachine)ÚPythonModuleÚ	getModulec                 óÜ   — t          j        |                      ¦   «         ¦  «        }|€dS | }t          |t          ¦  «        s|j        }t          |t          ¦  «        ¯|j        |j        k    S )z•
    Attempt to discover if this appearance of a PythonAttribute
    representing a class refers to the module where that class was
    defined.
    NF)ÚinspectÚ	getmoduleÚloadÚ
isinstancer   ÚonObjectÚnameÚ__name__)ÚattrÚsourceModuleÚcurrentModules      úP/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/automat/_discover.pyÚisOriginalLocationr      sm   € õ Ô$ T§Y¢Y¡[¤[Ñ1Ô1€LØÐØˆuà€MÝ˜­Ñ5Ô5ð /Ø%Ô.ˆõ ˜­Ñ5Ô5ð /ð Ô Ô!6Ò6Ð6ó    c              #   óä  K  — t          j        | g¦  «        }t          ¦   «         }|�rG|                     ¦   «         }|                     ¦   «         }t          |t          ¦  «        r%||vr!|                     |¦  «         |j        |fV — nàt          j
        |¦  «        rPt          |¦  «        rA||vr=|                     |¦  «         |                     |                     ¦   «         ¦  «         n|t          |t          ¦  «        rg||vrc|                     |¦  «         |                     |                     ¦   «         ¦  «         |                     |                     ¦   «         ¦  «         |�°EdS dS )aÁ  
    Recursively yield L{MethodicalMachine}s and their FQPNs within a
    L{PythonModule} or a L{twisted.python.modules.PythonAttribute}
    wrapper object.

    Note that L{PythonModule}s may refer to packages, as well.

    The discovery heuristic considers L{MethodicalMachine} instances
    that are module-level attributes or class-level attributes
    accessible from module scope.  Machines inside nested classes will
    be discovered, but those returned from functions or methods will not be.

    @type within: L{PythonModule} or L{twisted.python.modules.PythonAttribute}
    @param within: Where to start the search.

    @return: a generator which yields FQPN, L{MethodicalMachine} pairs.
    N)ÚcollectionsÚdequeÚsetÚpopr	   r
   r   Úaddr   r   Úisclassr   Ú
extendleftÚiterAttributesr   ÚiterModules)ÚwithinÚqueueÚvisitedr   Úvalues        r   ÚfindMachinesViaWrapperr"      sx  è è € õ$ Ô˜v˜hÑ'Ô'€EÝ‰eŒe€Gà
ñ 1Ø�yŠy‰{Œ{ˆØ—	’	‘”ˆå�eÕ.Ñ/Ô/ð 
	1°EÀÐ4HÐ4HØ�KŠK˜ÑÔÐØ”)˜UÐ"Ð"Ð"Ð"Ð"ÝŒo˜eÑ$Ô$ð 	1Õ);¸DÑ)AÔ)Að 	1Ø˜7Ð"Ð"Ø�KŠK˜ÑÔÐØ×Ò˜T×0Ò0Ñ2Ô2Ñ3Ô3Ð3Ð3Ý˜�lÑ+Ô+ð 	1°¸WÐ0DÐ0DØ�KŠK˜ÑÔÐØ×Ò˜T×0Ò0Ñ2Ô2Ñ3Ô3Ð3Ø×Ò˜T×-Ò-Ñ/Ô/Ñ0Ô0Ð0ð ñ 1ð 1ð 1ð 1ð 1r   c                   ó   — e Zd ZdZdS )ÚInvalidFQPNzH
    The given FQPN was not a dot-separated list of Python objects.
    N©r   Ú
__module__Ú__qualname__Ú__doc__© r   r   r$   r$   >   ó   € € € € € ðð ð ð r   r$   c                   ó   — e Zd ZdZdS )ÚNoModulezG
    A prefix of the FQPN was not an importable module or package.
    Nr%   r)   r   r   r,   r,   D   r*   r   r,   c                   ó   — e Zd ZdZdS )ÚNoObjectz;
    A suffix of the FQPN was not an accessible object
    Nr%   r)   r   r   r.   r.   J   r*   r   r.   c                 ó¸  ‡— | st          d¦  «        ‚t          j        |                      d¦  «        ¦  «        }d|v rt          d| ›�¦  «        ‚|                     ¦   «         Š	 t          ‰¦  «        }n# t          $ r t          ‰¦  «        ‚w xY w|rY|                     ¦   «         Š	 |‰         }|                     ¦   «          n%# t          $ r | 	                    ‰¦  «         Y nw xY w|°Y|S |}|D ]fŠ	 t          ˆfd„|                     ¦   «         D ¦   «         ¦  «        }Œ1# t          $ r) t          d                     |j        ‰¦  «        ¦  «        ‚w xY w|S )z®
    Given an FQPN, retrieve the object via the global Python module
    namespace and wrap it with a L{PythonModule} or a
    L{twisted.python.modules.PythonAttribute}.
    zFQPN was emptyú.Ú zMname must be a string giving a '.'-separated list of Python identifiers, not c              3   óf   •K  — | ]+}|j                              d d¦  «        d         ‰k    ¯'|V — Œ,dS )r0   é   éÿÿÿÿN)r   Úrsplit)Ú.0ÚchildÚ	components     €r   ú	<genexpr>zwrapFQPN.<locals>.<genexpr>y   sT   øè è € ð Lð L uØ %¤
× 1Ò 1°#°qÑ 9Ô 9¸"Ô =ÀÒ JÐ Jð #Ø JÐ JÐ JÐ JðLð Lr   z{}.{})r$   r   r   ÚsplitÚpopleftr   ÚKeyErrorr,   r	   Ú
appendleftÚnextr   ÚStopIterationr.   Úformatr   )ÚfqpnÚ
componentsÚmoduleÚ	attributer8   s       @r   ÚwrapFQPNrE   P   sß  ø€ ð ð ,ÝÐ*Ñ+Ô+Ð+åÔ" 4§:¢:¨c¡?¤?Ñ3Ô3€Jà	ˆZÐÐÝˆkà%) Tð,ñ-ô -ð 	-ð ×"Ò"Ñ$Ô$€Ið"Ý˜9Ñ%Ô%ˆˆøÝð "ð "ð "Ý�yÑ!Ô!Ð!ð"øøøð ð 
Ø×&Ò&Ñ(Ô(ˆ	ð	Ø˜IÔ&ˆFð
 �KŠK‰MŒMˆMˆMøõ	 ð 	ð 	ð 	Ø×!Ò! )Ñ,Ô,Ð,ØˆEð	øøøð	 ð 
ð ˆð €IØð Fð Fˆ	ð	FÝð Lð Lð Lð L°	×0HÒ0HÑ0JÔ0Jð Lñ Lô Lñ Lô LˆIˆIøåð 	Fð 	Fð 	FÝ˜7Ÿ>š>¨)¬.¸)ÑDÔDÑEÔEÐEð	Føøøð Ðs*   Á%A5 Á5BÂ)C ÃC(Ã'C(Ã6-D$Ä$3Ec                 ó:   — t          t          | ¦  «        ¦  «        S )a'  
    Recursively yield L{MethodicalMachine}s and their FQPNs in and
    under the a Python object specified by an FQPN.

    The discovery heuristic considers L{MethodicalMachine} instances
    that are module-level attributes or class-level attributes
    accessible from module scope.  Machines inside nested classes will
    be discovered, but those returned from functions or methods will not be.

    @type within: an FQPN
    @param within: Where to start the search.

    @return: a generator which yields FQPN, L{MethodicalMachine} pairs.
    )r"   rE   )rA   s    r   ÚfindMachinesrG   �   s   € õ "¥(¨4¡.¤.Ñ1Ô1Ð1r   )r   r   Úautomatr   Útwisted.python.modulesr   r   r   r"   Ú	Exceptionr$   r,   r.   rE   rG   r)   r   r   ú<module>rK      s
  ðØ Ð Ð Ð Ø €€€Ø %Ð %Ð %Ð %Ð %Ð %Ø :Ð :Ð :Ð :Ð :Ð :Ð :Ð :ð7ð 7ð 7ð"#1ð #1ð #1ðLð ð ð ð �)ñ ô ð ðð ð ð ð ˆ{ñ ô ð ðð ð ð ð ˆ{ñ ô ð ð.ð .ð .ðb2ð 2ð 2ð 2ð 2r   