+
    QiM                        ^ RI Ht ^ RIt^ RIt^ RIHtHt ^ RIHtH	t	H
t
 ^ RIHt ^RIHtHtHt R R ltR	 R
 lt ! R R]4      t ! R R]4      t ! R R]4      tR R ltR R ltR# )    )annotationsN)AnyIterator)PythonAttributePythonModule	getModule)MethodicalMachine)TypeMachineInputProtocolCorec                    V ^8  d   QhRRRR/# )   attrzPythonAttribute | PythonModulereturnbool )formats   "3/usr/lib/python3/dist-packages/automat/_discover.py__annotate__r      s     7 7; 7 7    c                    \         P                  ! V P                  4       4      pVf   R# T p\        V\        4      '       g   VP
                  pK$  VP                  VP                  8H  # )z
Attempt to discover if this appearance of a PythonAttribute
representing a class refers to the module where that class was
defined.
F)inspect	getmoduleload
isinstancer   onObjectname__name__)r   sourceModulecurrentModules   &  r   isOriginalLocationr!      sW     $$TYY[1LM55%..!6!666r   c                    V ^8  d   QhRRRR/# )r   withinPythonModule | PythonAttributer   JIterator[tuple[str, MethodicalMachine | TypeMachine[InputProtocol, Core]]]r   )r   s   "r   r   r      s     -1 -1*-1O-1r   c              #    "   \         P                  ! V .4      p\        4       pV'       EdN   VP                  4       pVP	                  4       p\        V\        4      '       g   \        V\        4      '       d*   WB9  d$   VP                  V4       VP                  V3x  K~  \        P                  ! V4      '       dJ   \        V4      '       d9   WB9  d3   VP                  V4       VP                  VP                  4       4       K  \        V\        4      '       g   K  WB9  g   EK  VP                  V4       VP                  VP                  4       4       VP                  VP!                  4       4       EKV  R# 5i)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	   r
   addr   r   isclassr!   
extendleftiterAttributesr   iterModules)r#   queuevisitedr   values   &    r   findMachinesViaWrapperr3      s    ( vh'E 	  %yy{		u/00Juk4R4R"KK))U""OOE""'9$'?'?EDXKKT0023l++0DKKT0023T--/0! s   *E<BE<>AE<E<(AE<c                      ] tR t^OtRtRtR# )InvalidFQPNz@
The given FQPN was not a dot-separated list of Python objects.
r   Nr   
__module____qualname____firstlineno____doc____static_attributes__r   r   r   r5   r5   O       r   r5   c                      ] tR t^UtRtRtR# )NoModulez?
A prefix of the FQPN was not an importable module or package.
r   Nr6   r   r   r   r>   r>   U   r<   r   r>   c                      ] tR t^[tRtRtR# )NoObjectz3
A suffix of the FQPN was not an accessible object
r   Nr6   r   r   r   r@   r@   [   r<   r   r@   c                    V ^8  d   QhRRRR/# )r   fqpnstrr   r$   r   )r   s   "r   r   r   a   s     2 23 29 2r   c                  a V '       g   \        R4      h\        P                  ! V P                  R4      4      pRV9   d   \        RV : 24      hVP	                  4       o \        S4      pT'       d-   TP	                  4       o TS,          pTP                  4        K4  T#   \         d    \        S4      hi ; i  \         d    TP                  S4        Mi ; iTpT F[  o \        T3R lTP                  4        4       4      pK)    \         d'    \        RP                  TP                  S4      4      hi ; i	  T# )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  |   <"   T F1  pVP                   P                  R ^4      R,          S8X  g   K-  Vx  K3  	  R# 5i)rE   N)r   rsplit).0child	components   & r   	<genexpr>wrapFQPN.<locals>.<genexpr>   s8      7E::$$S!,R0I= 7s   *<
<z{}.{})r5   r'   r(   splitpopleftr   KeyErrorr>   r   
appendleftnextr.   StopIterationr@   r   r   )rB   
componentsmodule	attributerL   s   &   @r   wrapFQPNrX   a   sC    *++""4::c?3J	Z%),
 	

 ""$I"9%
 &&(		I&F
 KKM  "y!!"  	!!),	 I		F &557 I
  	F7>>)..)DEE	F   s*   !B" 	B< "B9<CC&#D1D<c                    V ^8  d   QhRRRR/# )r   rB   rC   r   r%   r   )r   s   "r   r   r      s     2 2
2O2r   c                *    \        \        V 4      4      # )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.

@param fqpn: a fully-qualified Python identifier (i.e. the dotted
    identifier of an object defined at module or class scope, including the
    package and modele names); where to start the search.

@return: a generator which yields (C{FQPN}, L{MethodicalMachine}) pairs.
)r3   rX   )rB   s   &r   findMachinesr[      s    $ "(4.11r   )
__future__r   r'   r   typingr   r   twisted.python.modulesr   r   r   automatr	   _typedr
   r   r   r!   r3   	Exceptionr5   r>   r@   rX   r[   r   r   r   <module>rb      sZ    "     K K % 4 47"-1`) { { 2j2r   