diff --git a/stevedore/dispatch.py b/stevedore/dispatch.py index 47a4b3b..fe8f75d 100644 --- a/stevedore/dispatch.py +++ b/stevedore/dispatch.py @@ -38,24 +38,18 @@ class DispatchExtensionManager(EnabledExtensionManager[T]): 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 """ def map( # type: ignore[override] @@ -155,32 +149,24 @@ class NameDispatchExtensionManager(DispatchExtensionManager[T]): 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 an 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: **DEPRECATED** This is a no-op and will be removed in a future version. - :type verify_requirements: bool """ def __init__( diff --git a/stevedore/driver.py b/stevedore/driver.py index f3b0f12..941e892 100644 --- a/stevedore/driver.py +++ b/stevedore/driver.py @@ -37,29 +37,21 @@ class DriverManager(NamedExtensionManager[T]): """Load a single plugin with a given name from the namespace. :param namespace: The namespace for the entry points. - :type namespace: str :param name: The name of the driver to load. - :type name: str :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 on_load_failure_callback: Callback function that will be called when an 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: **DEPRECATED** This is a no-op and will be removed in a future version. - :type verify_requirements: bool - :type warn_on_missing_entrypoint: bool """ def __init__( @@ -112,25 +104,19 @@ class DriverManager(NamedExtensionManager[T]): than loading them from entry points. :param extension: Pre-configured Extension instance - :type extension: :class:`~stevedore.extension.Extension` :param namespace: The namespace for the manager; used only for identification since the extensions are passed in. - :type namespace: str :param propagate_map_exceptions: Boolean controlling whether exceptions are propagated up through the map call or whether they are logged and then ignored - :type propagate_map_exceptions: bool :param on_load_failure_callback: Callback function that will be called when an 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: **DEPRECATED** This is a no-op and will be removed in a future version. - :type verify_requirements: bool :return: The manager instance, initialized for testing - """ o = super().make_test_instance( diff --git a/stevedore/enabled.py b/stevedore/enabled.py index 15dcbeb..1cd15bb 100644 --- a/stevedore/enabled.py +++ b/stevedore/enabled.py @@ -33,33 +33,24 @@ class EnabledExtensionManager(ExtensionManager[T]): 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, taking an :class:`Extension` - instance as argument :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 propagate_map_exceptions: bool :param on_load_failure_callback: Callback function that will be called when an 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: **DEPRECATED** This is a no-op and will be removed in a future version. - :type verify_requirements: bool """ def __init__( diff --git a/stevedore/example/base.py b/stevedore/example/base.py index be6dcc5..b29aff9 100644 --- a/stevedore/example/base.py +++ b/stevedore/example/base.py @@ -28,8 +28,6 @@ class FormatterBase(metaclass=abc.ABCMeta): def format(self, data: dict[str, Any]) -> Iterable[str]: """Format the data and return unicode text. - :param data: A dictionary with string keys and simple types as - values. - :type data: dict(str:?) + :param data: A dictionary with string keys and simple types as values. :returns: Iterable producing the formatted text. """ diff --git a/stevedore/example/simple.py b/stevedore/example/simple.py index 9087a0a..7c9cf80 100644 --- a/stevedore/example/simple.py +++ b/stevedore/example/simple.py @@ -24,9 +24,8 @@ class Simple(base.FormatterBase): def format(self, data: dict[str, Any]) -> Iterable[str]: """Format the data and return unicode text. - :param data: A dictionary with string keys and simple types as - values. - :type data: dict(str:?) + :param data: A dictionary with string keys and simple types as values. + :returns: Iterable producing the formatted text. """ for name, value in sorted(data.items()): line = f'{name} = {value}\n' diff --git a/stevedore/example2/fields.py b/stevedore/example2/fields.py index 04e742c..5755ef1 100644 --- a/stevedore/example2/fields.py +++ b/stevedore/example2/fields.py @@ -35,9 +35,8 @@ class FieldList(base.FormatterBase): def format(self, data: dict[str, Any]) -> Iterable[str]: """Format the data and return unicode text. - :param data: A dictionary with string keys and simple types as - values. - :type data: dict(str:?) + :param data: A dictionary with string keys and simple types as values. + :returns: Iterable producing the formatted text. """ for name, value in sorted(data.items()): full_text = f': {name} : {value}' diff --git a/stevedore/extension.py b/stevedore/extension.py index 147ebf3..a8b0a13 100644 --- a/stevedore/extension.py +++ b/stevedore/extension.py @@ -48,10 +48,7 @@ class Extension(Generic[T]): :class:`ExtensionManager` directly. :param name: The entry point name. - :type name: str - :param entry_point: The EntryPoint instance returned by - :mod:`entrypoints`. - :type entry_point: EntryPoint + :param entry_point: The EntryPoint instance returned by :mod:`entrypoints`. :param plugin: The value returned by entry_point.load() :param obj: The object returned by ``plugin(*args, **kwds)`` if the manager invoked the extension on load. @@ -102,30 +99,23 @@ class ExtensionManager(Generic[T]): """Base class for all of the other managers. :param namespace: The namespace for the entry points. - :type namespace: str :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 propagate_map_exceptions: bool :param on_load_failure_callback: Callback function that will be called when an 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: **DEPRECATED** This is a no-op and will be removed in a future version. - :type verify_requirements: bool """ def __init__( @@ -173,23 +163,18 @@ class ExtensionManager(Generic[T]): than loading them from entry points. :param extensions: Pre-configured Extension instances to use - :type extensions: list of :class:`~stevedore.extension.Extension` :param namespace: The namespace for the manager; used only for identification since the extensions are passed in. - :type namespace: str :param propagate_map_exceptions: When calling map, controls whether exceptions are propagated up through the map call or whether they are logged and then ignored - :type propagate_map_exceptions: bool :param on_load_failure_callback: Callback function that will be called when an 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: **DEPRECATED** This is a no-op and will be removed in a future version. - :type verify_requirements: bool :return: The manager instance, initialized for testing """ if verify_requirements is not None: diff --git a/stevedore/hook.py b/stevedore/hook.py index 868ae52..bcc6864 100644 --- a/stevedore/hook.py +++ b/stevedore/hook.py @@ -26,34 +26,27 @@ class HookManager(NamedExtensionManager[T]): """Coordinate execution of multiple extensions using a common name. :param namespace: The namespace for the entry points. - :type namespace: str :param name: The name of the hooks to load. - :type name: str :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 on_load_failure_callback: Callback function that will be called when an 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 on_missing_entrypoints_callback: Callback function that will be + called when one or more names cannot be found. The provided argument + will be a subset of the 'names' parameter. :param verify_requirements: **DEPRECATED** This is a no-op and will be removed in a future version. - :type verify_requirements: bool - :type on_missing_entrypoints_callback: function :param warn_on_missing_entrypoint: Flag to control whether failing to load a plugin is reported via a log mess. Only applies if on_missing_entrypoints_callback is None. - :type warn_on_missing_entrypoint: bool - """ def __init__( diff --git a/stevedore/named.py b/stevedore/named.py index afea30f..c70d65d 100644 --- a/stevedore/named.py +++ b/stevedore/named.py @@ -39,44 +39,32 @@ class NamedExtensionManager(ExtensionManager[T]): configuration file, for example. :param namespace: The namespace for the entry points. - :type namespace: str :param names: The names of the extensions to load. - :type names: list(str) :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 name_order: If true, sort the loaded extensions to match the order used in ``names``. - :type name_order: bool :param propagate_map_exceptions: Boolean controlling whether exceptions are propagated up through the map call or whether they are logged and then ignored - :type propagate_map_exceptions: bool :param on_load_failure_callback: Callback function that will be called when an 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 on_missing_entrypoints_callback: Callback function that will be called when one or more names cannot be found. The provided argument will be a subset of the 'names' parameter. - :type on_missing_entrypoints_callback: function :param verify_requirements: **DEPRECATED** This is a no-op and will be removed in a future version. - :type verify_requirements: bool :param warn_on_missing_entrypoint: Flag to control whether failing to load a plugin is reported via a log mess. Only applies if on_missing_entrypoints_callback is None. - :type warn_on_missing_entrypoint: bool - """ def __init__( @@ -132,23 +120,18 @@ class NamedExtensionManager(ExtensionManager[T]): loading them from entry points. :param extensions: Pre-configured Extension instances - :type extensions: list of :class:`~stevedore.extension.Extension` :param namespace: The namespace for the manager; used only for identification since the extensions are passed in. - :type namespace: str :param propagate_map_exceptions: Boolean controlling whether exceptions are propagated up through the map call or whether they are logged and then ignored - :type propagate_map_exceptions: bool :param on_load_failure_callback: Callback function that will be called when an 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: **DEPRECATED** This is a no-op and will be removed in a future version. - :type verify_requirements: bool :return: The manager instance, initialized for testing """ o = cls.__new__(cls) diff --git a/stevedore/tests/manager.py b/stevedore/tests/manager.py index bc40bda..739104a 100644 --- a/stevedore/tests/manager.py +++ b/stevedore/tests/manager.py @@ -32,23 +32,17 @@ class TestExtensionManager(extension.ExtensionManager[T]): being replaced by the test instance instead of using this class directly. - :param extensions: Pre-configured Extension instances to use - instead of loading them from entry points. - :type extensions: list of :class:`~stevedore.extension.Extension` + :param extensions: Pre-configured Extension instances to use instead of + loading them from entry points. :param namespace: The namespace for the entry points. - :type namespace: str :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 - """ def __init__(