HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/usr/lib/python3/dist-packages/automat/__pycache__/_discover.cpython-38.pyc
U

��0X�@s�ddlZddlZddlmZddlmZmZdd�Zdd�ZGdd	�d	e	�Z
Gd
d�de
�ZGdd
�d
e
�Zdd�Z
dd�ZdS)�N)�MethodicalMachine)�PythonModule�	getModulecCs<t�|���}|dkrdS|}t|t�s0|j}q|j|jkS)z�
    Attempt to discover if this appearance of a PythonAttribute
    representing a class refers to the module where that class was
    defined.
    NF)�inspectZ	getmodule�load�
isinstancerZonObject�name�__name__)�attrZsourceModuleZ
currentModule�r�3/usr/lib/python3/dist-packages/automat/_discover.py�isOriginalLocations
r
ccs�t�|g�}t�}|r�|��}|��}t|t�rP||krP|�|�|j|fVqt	�
|�r�t|�r�||kr�|�|�|�|�
��qt|t�r||kr|�|�|�|�
��|�|���qdS)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�poprrr�addrrZisclassr
�
extendleft�iterAttributesrZiterModules)ZwithinZqueueZvisitedr
�valuerrr�findMachinesViaWrappers"
�

rc@seZdZdZdS)�InvalidFQPNzH
    The given FQPN was not a dot-separated list of Python objects.
    N�r	�
__module__�__qualname__�__doc__rrrrr>src@seZdZdZdS)�NoModulezG
    A prefix of the FQPN was not an importable module or package.
    NrrrrrrDsrc@seZdZdZdS)�NoObjectz;
    A suffix of the FQPN was not an accessible object
    NrrrrrrJsrc	s|std��t�|�d��}d|kr2td|f��|���zt��}Wntk
rbt���YnX|r�|���z|�}Wn"tk
r�|���Yq�YqdX|�	�qd|S|}|D]J�zt
�fdd�|��D��}Wq�tk
r�t
d�|j����Yq�Xq�|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}.
    zFQPN was empty�.�zOname must be a string giving a '.'-separated list of Python identifiers, not %rc3s(|] }|j�dd�d�kr|VqdS)r����N)r�rsplit)�.0Zchild�Z	componentrr�	<genexpr>ys�zwrapFQPN.<locals>.<genexpr>z{}.{})rrr�split�popleftr�KeyErrorr�
appendleftr�nextr�
StopIterationr�formatr)�fqpnZ
components�moduleZ	attributerr$r�wrapFQPNPs<��


r/cCstt|��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.
    )rr/)r-rrr�findMachines�sr0)rrZautomatrZtwisted.python.modulesrrr
r�	Exceptionrrrr/r0rrrr�<module>s&1