/usr/lib/python2.6/site-packages/stevedore
Edit: /usr/lib/python2.6/site-packages/stevedore/dispatch.pyc (9627B)
Ñò
yDVc @ s[ d d k Z d d k l Z e i e ƒ Z d e f d „ ƒ YZ d e f d „ ƒ YZ d S( iÿÿÿÿNi ( t EnabledExtensionManagert DispatchExtensionManagerc B s e Z d Z d „ Z d „ Z RS( sF Loads all plugins and filters on execution.
This is useful for long-running processes that need to pass
different inputs to different extensions.
:param namespace: The namespace for the entry points.
:type namespace: str
:param check_func: Function to determine which extensions to load.
:type check_func: callable
:param invoke_on_load: Boolean controlling whether to invoke the
object returned by the entry point after the driver is loaded.
:type invoke_on_load: bool
:param invoke_args: Positional arguments to pass when invoking
the object returned by the entry point. Only used if invoke_on_load
is True.
:type invoke_args: tuple
:param invoke_kwds: Named arguments to pass when invoking
the object returned by the entry point. Only used if invoke_on_load
is True.
:type invoke_kwds: dict
:param propagate_map_exceptions: Boolean controlling whether exceptions
are propagated up through the map call or whether they are logged and
then ignored
:type invoke_on_load: bool
c O sr | i p t d | i ƒ ‚ n g } xD | i D]9 } | | | | Ž o | i | i | | | | ƒ q1 q1 W| S( s| Iterate over the extensions invoking func() for any where
filter_func() returns True.
The signature of filter_func() should be::
def filter_func(ext, *args, **kwds):
pass
The first argument to filter_func(), 'ext', is the
:class:`~stevedore.extension.Extension`
instance. filter_func() should return True if the extension
should be invoked for the input arguments.
The signature for func() should be::
def func(ext, *args, **kwds):
pass
The first argument to func(), 'ext', is the
:class:`~stevedore.extension.Extension` instance.
Exceptions raised from within func() are propagated up and
processing stopped if self.propagate_map_exceptions is True,
otherwise they are logged and ignored.
:param filter_func: Callable to test each extension.
:param func: Callable to invoke for each extension.
:param args: Variable arguments to pass to func()
:param kwds: Keyword arguments to pass to func()
:returns: List of values returned from func()
s No %s extensions found( t
extensionst RuntimeErrort namespacet _invoke_one_plugint append( t selft filter_funct funct argst kwdst responset e( ( s5 /tmp/pip-build-lt8jXN/stevedore/stevedore/dispatch.pyt map# s
$c O s | i | | i | | | Ž S( sU Iterate over the extensions invoking each one's object method called
`method_name` for any where filter_func() returns True.
This is equivalent of using :meth:`map` with func set to
`lambda x: x.obj.method_name()`
while being more convenient.
Exceptions raised from within the called method are propagated up
and processing stopped if self.propagate_map_exceptions is True,
otherwise they are logged and ignored.
.. versionadded:: 0.12
:param filter_func: Callable to test each extension.
:param method_name: The extension method name to call
for each extension.
:param args: Variable arguments to pass to method
:param kwds: Keyword arguments to pass to method
:returns: List of values returned from methods
( R t _call_extension_method( R R t method_nameR
R ( ( s5 /tmp/pip-build-lt8jXN/stevedore/stevedore/dispatch.pyt
map_methodL s ( t __name__t
__module__t __doc__R R ( ( ( s5 /tmp/pip-build-lt8jXN/stevedore/stevedore/dispatch.pyR s )t NameDispatchExtensionManagerc B sD e Z d Z e d h e d e d „ Z d „ Z d „ Z d „ Z RS( s5 Loads all plugins and filters on execution.
This is useful for long-running processes that need to pass
different inputs to different extensions and can predict the name
of the extensions before calling them.
The check_func argument should return a boolean, with ``True``
indicating that the extension should be loaded and made available
and ``False`` indicating that the extension should be ignored.
:param namespace: The namespace for the entry points.
:type namespace: str
:param check_func: Function to determine which extensions to load.
:type check_func: callable
:param invoke_on_load: Boolean controlling whether to invoke the
object returned by the entry point after the driver is loaded.
:type invoke_on_load: bool
:param invoke_args: Positional arguments to pass when invoking
the object returned by the entry point. Only used if invoke_on_load
is True.
:type invoke_args: tuple
:param invoke_kwds: Named arguments to pass when invoking
the object returned by the entry point. Only used if invoke_on_load
is True.
:type invoke_kwds: dict
:param propagate_map_exceptions: Boolean controlling whether exceptions
are propagated up through the map call or whether they are logged and
then ignored
:type invoke_on_load: bool
:param on_load_failure_callback: Callback function that will be called when
a entrypoint can not be loaded. The arguments that will be provided
when this is called (when an entrypoint fails to load) are
(manager, entrypoint, exception)
:type on_load_failure_callback: function
:param verify_requirements: Use setuptools to enforce the
dependencies of the plugin(s) being loaded. Defaults to False.
:type verify_requirements: bool
c C sG t t | ƒ i d | d | d | d | d | d | d | d | ƒ d S( NR t
check_funct invoke_on_loadt invoke_argst invoke_kwdst propagate_map_exceptionst on_load_failure_callbackt verify_requirements( t superR t __init__( R R R R R R R R R ( ( s5 /tmp/pip-build-lt8jXN/stevedore/stevedore/dispatch.pyR Ž s c C s6 t t | ƒ i | ƒ t d „ | i Dƒ ƒ | _ d S( Nc s s" x | ] } | i | f Vq Wd S( N( t name( t .0R
( ( s5 /tmp/pip-build-lt8jXN/stevedore/stevedore/dispatch.pys
s ( R R t
_init_pluginst dictR t by_name( R R ( ( s5 /tmp/pip-build-lt8jXN/stevedore/stevedore/dispatch.pyR! ž s c
O sn g } xa | D]Y } y | i | } Wn# t j
o t i d | ƒ q
X| i | i | | | | ƒ q
W| S( s5 Iterate over the extensions invoking func() for any where
the name is in the given list of names.
The signature for func() should be::
def func(ext, *args, **kwds):
pass
The first argument to func(), 'ext', is the
:class:`~stevedore.extension.Extension` instance.
Exceptions raised from within func() are propagated up and
processing stopped if self.propagate_map_exceptions is True,
otherwise they are logged and ignored.
:param names: List or set of name(s) of extension(s) to invoke.
:param func: Callable to invoke for each extension.
:param args: Variable arguments to pass to func()
:param kwds: Keyword arguments to pass to func()
:returns: List of values returned from func()
s" Missing extension %r being ignored( R# t KeyErrort LOGt debugR R ( R t namesR R
R R R R
( ( s5 /tmp/pip-build-lt8jXN/stevedore/stevedore/dispatch.pyR ¢ s c O s | i | | i | | | Ž S( sl Iterate over the extensions invoking each one's object method called
`method_name` for any where the name is in the given list of names.
This is equivalent of using :meth:`map` with func set to
`lambda x: x.obj.method_name()`
while being more convenient.
Exceptions raised from within the called method are propagated up
and processing stopped if self.propagate_map_exceptions is True,
otherwise they are logged and ignored.
.. versionadded:: 0.12
:param names: List or set of name(s) of extension(s) to invoke.
:param method_name: The extension method name
to call for each extension.
:param args: Variable arguments to pass to method
:param kwds: Keyword arguments to pass to method
:returns: List of values returned from methods
( R R ( R R' R R
R ( ( s5 /tmp/pip-build-lt8jXN/stevedore/stevedore/dispatch.pyR Â s ( N( R R R t Falset NoneR R! R R ( ( ( s5 /tmp/pip-build-lt8jXN/stevedore/stevedore/dispatch.pyR e s ' ( t loggingt enabledR t getLoggerR R% R R ( ( ( s5 /tmp/pip-build-lt8jXN/stevedore/stevedore/dispatch.pyt s ]