Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove the name argument to extension constructors.

Do not force plugins to take an argument with their name.

Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
  • Loading branch information...
commit 8b0e71d3a9fbbf7e1709ab9dee01866e32b75cf5 1 parent d32fa18
@dhellmann dhellmann authored
Showing with 8 additions and 5 deletions.
  1. +7 −3 stevedore/extension.py
  2. +1 −2  stevedore/tests/test_extension.py
View
10 stevedore/extension.py
@@ -14,7 +14,8 @@ class Extension(object):
:param name: The entry point name.
:type name: str
- :param entry_point: The EntryPoint instance returned by :mod:`pkg_resources`.
+ :param entry_point: The EntryPoint instance returned by
+ :mod:`pkg_resources`.
:type entry_point: EntryPoint
:param plugin: The value returned by entry_point.load()
:param obj: The object returned by ``plugin(*args, **kwds)`` if the
@@ -46,7 +47,10 @@ class ExtensionManager(object):
:type invoke_kwds: dict
"""
- def __init__(self, namespace, invoke_on_load=False, invoke_args=(), invoke_kwds={}):
+ def __init__(self, namespace,
+ invoke_on_load=False,
+ invoke_args=(),
+ invoke_kwds={}):
self.namespace = namespace
self.extensions = []
for ep in pkg_resources.iter_entry_points(self.namespace):
@@ -69,7 +73,7 @@ def __init__(self, namespace, invoke_on_load=False, invoke_args=(), invoke_kwds=
def _load_one_plugin(self, ep, invoke_on_load, invoke_args, invoke_kwds):
plugin = ep.load()
if invoke_on_load:
- obj = plugin(ep.name, *invoke_args, **invoke_kwds)
+ obj = plugin(*invoke_args, **invoke_kwds)
else:
obj = None
return Extension(ep.name, ep, plugin, obj)
View
3  stevedore/tests/test_extension.py
@@ -5,8 +5,7 @@
class FauxExtension(object):
- def __init__(self, name, *args, **kwds):
- self.name = name
+ def __init__(self, *args, **kwds):
self.args = args
self.kwds = kwds
Please sign in to comment.
Something went wrong with that request. Please try again.