+
    Dfj!                     L   R t ^ RIt^ RIt^ RIt^ RIt^ RIHtHtHtH	t	 ^ RI
HtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt  ! R R	]4      t ! R
 R4      t ! R R4      tR t ]P4                  tR tR R lt]	! R]R7      tRR R llt]t R t!RR.t"R#   ] d	    RR lt L4i ; i)zL
Plugin system for Twisted.

@author: Jp Calderone
@author: Glyph Lefkowitz
N)IterableOptionalTypeTypeVar)	Interface
providedBy)log)getAdapterFactory)	getModule)namedAnyc                       ] tR t^tRtRtR# )IPluginz
Interface that must be implemented by all plugins.

Only objects which implement this interface will be considered for return
by C{getPlugins}.  To be useful, plugins should also implement some other
application-specific interface.
 N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       0/usr/lib/python3/dist-packages/twisted/plugin.pyr   r      s    r   r   c                   L   a  ] tR t^&t o R tV 3R lR ltR tRR lt]tRt	V t
R# )	CachedPluginc                    Wn         W n        W0n        W@n        V P                   P                  P                  V 4       R # N)dropinnamedescriptionprovidedpluginsappend)selfr   r   r   r   s   &&&&&r   __init__CachedPlugin.__init__'   s/    	& ""4(r   c                    < V ^8  d   QhRS[ /#    return)str)format__classdict__s   "r   __annotate__CachedPlugin.__annotate__.   s     
 
# 
r   c           
         R P                  V P                  V P                  P                  RP	                  V P
                   Uu. uF  qP                  NK  	  up4      4      # u upi )z(<CachedPlugin {!r}/{!r} (provides {!r})>z, )r)   r   r   
moduleNamejoinr   r   )r!   is   & r   __repr__CachedPlugin.__repr__.   sO    9@@IIKK""II4==9=azz=9:
 	
 :s   A$c                p    \        V P                  P                  R ,           V P                  ,           4      # ).)r   r   r.   r   )r!   s   &r   loadCachedPlugin.load5   s%    ..4tyy@AAr   Nc                    V P                    FS  pVP                  V4      '       d   V P                  4       u # \        WAR 4      f   K<  V! V P                  4       V4      u # 	  V# r   )r   isOrExtendsr5   r	   )r!   	interfaceregistrydefaultprovidedInterfaces   &&&& r   __conform__CachedPlugin.__conform__8   sV    !% ,,Y77yy{" !2tDP g66	 "/
 r   )r   r   r   r   )NN)r   r   r   r   r"   r1   r5   r=   getComponentr   __classdictcell__r*   s   @r   r   r   &   s&     )
 
B Lr   r   c                   *   a  ] tR t^Dt o RtR tRtV tR# )CachedDropina  
A collection of L{CachedPlugin} instances from a particular module in a
plugin package.

@type moduleName: C{str}
@ivar moduleName: The fully qualified name of the plugin module this
    represents.

@type description: C{str} or L{None}
@ivar description: A brief explanation of this collection of plugins
    (probably the plugin module's docstring).

@type plugins: C{list}
@ivar plugins: The L{CachedPlugin} instances which were loaded from this
    dropin.
c                ,    Wn         W n        . V n        R # r   )r.   r   r   )r!   r.   r   s   &&&r   r"   CachedDropin.__init__V   s    $&r   )r   r.   r   N)r   r   r   r   r   r"   r   r@   rA   s   @r   rC   rC   D   s     " r   rC   c                    \        V P                  V P                  4      pV P                  P	                  4        F@  w  r#\        VR 4      pVf   K  \        WVP                  \        \        V4      4      4       KB  	  V# r   )	rC   r   r   __dict__itemsr   r   listr   )providerr   kvplugins   &    r   _generateCacheEntryrN   \   sh    (++X-=-=>F!!'')D!AIItJv4F/GH	 *
 Mr   c                 $    / pV  F  pWV&   K	  	  V# r   r   )keysvaluedrK   s   &&  r   fromkeysrS   j   s    AaD r   c                   / p\        V P                  4      p/ pVP                  4        F@  pVP                  P	                  4       pWS9  d   . W5&   W5,          pVP                  V4       KB  	  VP                  4        EFH  w  rvVP                  R4      p VP                  4       p	VP                  R4      ;_uu_ 4       p
\        P                  ! V
4      pRRR4       Rp/ pT Fs  pTP                  P                  R4      R
,          pRY&   TX9  g"   TP                  P                  4       T	8  g   KQ  Rp TP                  4       p\        T4      pTY&   Ku  	  \%        XP'                  4       4       F  pY9  g   K  Y RpK  	  T'       d'    TP)                  \        P*                  ! T4      4       TP5                  T4       EKK  	  V#   + '       g   i     L; i  \         d	    / p^ p	 ELi ; i  \         d    \         P"                  ! 4         EK6  i ; i  \,         d8   p\         P.                  ! RTP0                  TP2                  R7        Rp?LRp?i\         d    \         P"                  ! RR	4        Li ; i)a#  
Compute all the possible loadable plugins, while loading as few as
possible and hitting the filesystem as little as possible.

@param module: a Python module object.  This represents a package to search
for plugins.

@return: a dictionary mapping module names to L{CachedDropin} instances.
zdropin.cacherNFr4   Tz@Unable to write to plugin cache %(path)s: error number %(errno)d)r)   patherrnoz)Unexpected error while writing cache file)r
   r   iterModulesfilePathparentr    rH   childgetModificationTimeopenpickler5   BaseExceptionr   splitrN   r   errrI   rP   
setContentdumpsOSErrormsgrV   rW   update)moduleallCachesCombinedmodbucketsplugmodfppbucketpseudoPackagePath
dropinPath
lastCachedfdropinDotCache
needsWriteexistingKeyspluginModule	pluginKeyrJ   entryes   &                  r   getCacherz   q   s:    
FOO
$CG ??$%%'GLg % &-]]_!&,,^<
	#779J%%!'Q & 
"L$))//4R8I&*L#/%%99;zI!
6+002H
 09E05N- #  n1134I,"-!
 5 K%%fll>&BC 	  0] &5^ W &% 	NJ	 % GGII  + $''  ! KIJKsf   )G ?GG 8G6%HGG G  G32G36 HHJ)-IJ(JJc                8    V ^8  d   QhR\         P                  /# r%   )types
ModuleType)r)   s   "r   r+   r+      s      )) r   c                      ^ RI Hp  V # )    N)twisted.pluginsr   )packages    r   _pluginsPackager      s
    %Nr   _TInterface)boundc                    V ^8  d   QhR\         \        ,          R\        \        P                  ,          R\
        \        ,          /# )r&   r9   r   r'   )r   r   r   r|   r}   r   )r)   s   "r   r+   r+      s9     " "K "+3E4D4D+E"k"r   c              #    "   Vf   \        4       p\        V4      pVP                  4        F,  w  r4VP                   F  p V ! VR4      pVe   Vx  K  K  	  K.  	  R#   \         d    \
        P                  ! 4         KD  i ; i5i)aG  
Retrieve all plugins implementing the given interface beneath the given module.

@param interface: An interface class.  Only plugins which implement this
interface will be returned.

@param package: A package beneath which plugins are installed.  For
most uses, the default value is correct.

@return: An iterator of plugins.
N)r   rz   rH   r   r`   r   rb   )r9   r   
allDropinskeyr   rM   adapteds   &&     r   
getPluginsr      s}      !#'"J!'')nnF"#FD1 &!M ' % * ! 	s)   >B	A
B B>BBBc           
        V P                  R4      p\        P                   Uu. uF  p\        P                  P	                  \        P                  P
                  ! V.VR.,           O5!  4      '       d   KR  \        P                  P                  \        P                  P
                  ! V.VO5!  4      NK  	  up# u upi )a  
Return a list of additional directories which should be searched for
modules to be included as part of the named plugin package.

@type name: C{str}
@param name: The fully-qualified Python name of a plugin package, eg
    C{'twisted.plugins'}.

@rtype: C{list} of C{str}
@return: The absolute paths to other directories which may contain plugin
    modules for the named plugin package.
r4   z__init__.py)ra   sysrV   osexistsr/   abspath)r   r   xs   &  r   pluginPackagePathsr      s     jjoG Aww~~bggll1Iw-/HIJ 	3Q112  s   AB>8AB>r   r   r   )#r   r   r_   r   r|   typingr   r   r   r   zope.interfacer   r   twisted.pythonr   twisted.python.componentsr	   twisted.python.modulesr
   twisted.python.reflectr   r   r   rC   rN   dictrS   AttributeErrorrz   r   r   r   
getPlugInsr   __all__r   r   r   <module>r      s    
  
  4 4 0  7 , +i  < 0}}HIX m95": 
< -
.y  s   "B B#"B#