stevedore.driver.
DriverManager
(namespace, name, invoke_on_load=False, invoke_args=(), invoke_kwds={}, on_load_failure_callback=None, verify_requirements=False, warn_on_missing_entrypoint=True)¶Bases: stevedore.named.NamedExtensionManager
Load a single plugin with a given name from the namespace.
Parameters: |
|
---|
__call__
(func, *args, **kwds)¶Invokes func() for the single loaded extension.
The signature for func() should be:
def func(ext, *args, **kwds):
pass
The first argument to func(), ‘ext’, is the
Extension
instance.
Exceptions raised from within func() are logged and ignored.
Parameters: |
|
---|---|
Returns: | List of values returned from func() |
__init__
(namespace, name, invoke_on_load=False, invoke_args=(), invoke_kwds={}, on_load_failure_callback=None, verify_requirements=False, warn_on_missing_entrypoint=True)¶x.__init__(…) initializes x; see help(type(x)) for signature
driver
¶Returns the driver being used by this manager.
make_test_instance
(extension, namespace='TESTING', propagate_map_exceptions=False, on_load_failure_callback=None, verify_requirements=False)¶Construct a test DriverManager
Test instances are passed a list of extensions to work from rather than loading them from entry points.
Parameters: |
|
---|---|
Returns: | The manager instance, initialized for testing |
stevedore.hook.
HookManager
(namespace, name, invoke_on_load=False, invoke_args=(), invoke_kwds={}, on_load_failure_callback=None, verify_requirements=False, on_missing_entrypoints_callback=None, warn_on_missing_entrypoint=False)¶Bases: stevedore.named.NamedExtensionManager
Coordinate execution of multiple extensions using a common name.
Parameters: |
|
---|
__getitem__
(name)¶Return the named extensions.
Accessing a HookManager as a dictionary (em['name']
)
produces a list of the Extension
instance(s) with the
specified name, in the order they would be invoked by map().
__init__
(namespace, name, invoke_on_load=False, invoke_args=(), invoke_kwds={}, on_load_failure_callback=None, verify_requirements=False, on_missing_entrypoints_callback=None, warn_on_missing_entrypoint=False)¶x.__init__(…) initializes x; see help(type(x)) for signature
stevedore.named.
NamedExtensionManager
(namespace, names, invoke_on_load=False, invoke_args=(), invoke_kwds={}, name_order=False, propagate_map_exceptions=False, on_load_failure_callback=None, on_missing_entrypoints_callback=None, verify_requirements=False, warn_on_missing_entrypoint=True)¶Bases: stevedore.extension.ExtensionManager
Loads only the named extensions.
This is useful for explicitly enabling extensions in a configuration file, for example.
Parameters: |
|
---|
__init__
(namespace, names, invoke_on_load=False, invoke_args=(), invoke_kwds={}, name_order=False, propagate_map_exceptions=False, on_load_failure_callback=None, on_missing_entrypoints_callback=None, verify_requirements=False, warn_on_missing_entrypoint=True)¶x.__init__(…) initializes x; see help(type(x)) for signature
make_test_instance
(extensions, namespace='TESTING', propagate_map_exceptions=False, on_load_failure_callback=None, verify_requirements=False)¶Construct a test NamedExtensionManager
Test instances are passed a list of extensions to use rather than loading them from entry points.
Parameters: |
|
---|---|
Returns: | The manager instance, initialized for testing |
stevedore.enabled.
EnabledExtensionManager
(namespace, check_func, invoke_on_load=False, invoke_args=(), invoke_kwds={}, propagate_map_exceptions=False, on_load_failure_callback=None, verify_requirements=False)¶Bases: stevedore.extension.ExtensionManager
Loads only plugins that pass a check function.
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.
Parameters: |
|
---|
__init__
(namespace, check_func, invoke_on_load=False, invoke_args=(), invoke_kwds={}, propagate_map_exceptions=False, on_load_failure_callback=None, verify_requirements=False)¶x.__init__(…) initializes x; see help(type(x)) for signature
stevedore.dispatch.
DispatchExtensionManager
(namespace, check_func, invoke_on_load=False, invoke_args=(), invoke_kwds={}, propagate_map_exceptions=False, on_load_failure_callback=None, verify_requirements=False)¶Bases: stevedore.enabled.EnabledExtensionManager
Loads all plugins and filters on execution.
This is useful for long-running processes that need to pass different inputs to different extensions.
Parameters: |
|
---|
map
(filter_func, func, *args, **kwds)¶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
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
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.
Parameters: |
|
---|---|
Returns: | List of values returned from func() |
map_method
(filter_func, method_name, *args, **kwds)¶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 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.
New in version 0.12.
Parameters: |
|
---|---|
Returns: | List of values returned from methods |
stevedore.dispatch.
NameDispatchExtensionManager
(namespace, check_func, invoke_on_load=False, invoke_args=(), invoke_kwds={}, propagate_map_exceptions=False, on_load_failure_callback=None, verify_requirements=False)¶Bases: stevedore.dispatch.DispatchExtensionManager
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.
Parameters: |
|
---|
__init__
(namespace, check_func, invoke_on_load=False, invoke_args=(), invoke_kwds={}, propagate_map_exceptions=False, on_load_failure_callback=None, verify_requirements=False)¶x.__init__(…) initializes x; see help(type(x)) for signature
map
(names, func, *args, **kwds)¶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
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.
Parameters: |
|
---|---|
Returns: | List of values returned from func() |
map_method
(names, method_name, *args, **kwds)¶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 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.
New in version 0.12.
Parameters: |
|
---|---|
Returns: | List of values returned from methods |
stevedore.extension.
ExtensionManager
(namespace, invoke_on_load=False, invoke_args=(), invoke_kwds={}, propagate_map_exceptions=False, on_load_failure_callback=None, verify_requirements=False)¶Bases: object
Base class for all of the other managers.
Parameters: |
|
---|
__contains__
(name)¶Return true if name is in list of enabled extensions.
__getitem__
(name)¶Return the named extension.
Accessing an ExtensionManager as a dictionary (em['name']
)
produces the Extension
instance with the
specified name.
__init__
(namespace, invoke_on_load=False, invoke_args=(), invoke_kwds={}, propagate_map_exceptions=False, on_load_failure_callback=None, verify_requirements=False)¶x.__init__(…) initializes x; see help(type(x)) for signature
__iter__
()¶Produce iterator for the manager.
Iterating over an ExtensionManager produces the Extension
instances in the order they would be invoked.
__weakref__
¶list of weak references to the object (if defined)
entry_points_names
()¶Return the list of entry points names for this namespace.
list_entry_points
()¶Return the list of entry points for this namespace.
The entry points are not actually loaded, their list is just read and returned.
make_test_instance
(extensions, namespace='TESTING', propagate_map_exceptions=False, on_load_failure_callback=None, verify_requirements=False)¶Construct a test ExtensionManager
Test instances are passed a list of extensions to work from rather than loading them from entry points.
Parameters: |
|
---|---|
Returns: | The manager instance, initialized for testing |
map
(func, *args, **kwds)¶Iterate over the extensions invoking func() for each.
The signature for func() should be:
def func(ext, *args, **kwds):
pass
The first argument to func(), ‘ext’, is the
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.
Parameters: |
|
---|---|
Returns: | List of values returned from func() |
map_method
(method_name, *args, **kwds)¶Iterate over the extensions invoking a method by name.
This is equivalent of using 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.
New in version 0.12.
Parameters: |
|
---|---|
Returns: | List of values returned from methods |
names
()¶Returns the names of the discovered extensions
stevedore.extension.
Extension
(name, entry_point, plugin, obj)¶Bases: object
Book-keeping object for tracking extensions.
The arguments passed to the constructor are saved as attributes of
the instance using the same names, and can be accessed by the
callables passed to map()
or when iterating over an
ExtensionManager
directly.
Parameters: |
|
---|
entry_point_target
¶The module and attribute referenced by this extension’s entry_point.
Returns: | A string representation of the target of the entry point in ‘dotted.module:object’ format. |
---|
stevedore.tests.manager.
TestExtensionManager
(extensions, namespace='test', invoke_on_load=False, invoke_args=(), invoke_kwds={})¶Bases: stevedore.extension.ExtensionManager
ExtensionManager that is explicitly initialized for tests.
Deprecated since version 0.13: Use the make_test_instance()
class method of the class
being replaced by the test instance instead of using this class
directly.
Parameters: |
|
---|
__init__
(extensions, namespace='test', invoke_on_load=False, invoke_args=(), invoke_kwds={})¶x.__init__(…) initializes x; see help(type(x)) for signature
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.