diff --git a/docs/examples/firstexample.py b/docs/examples/firstexample.py index ccd0b02e..3cec7cd2 100644 --- a/docs/examples/firstexample.py +++ b/docs/examples/firstexample.py @@ -4,7 +4,7 @@ hookimpl = pluggy.HookimplMarker("myproject") -class MySpec: +class MySpec(object): """A hook specification namespace. """ @hookspec @@ -13,7 +13,7 @@ def myhook(self, arg1, arg2): """ -class Plugin_1: +class Plugin_1(object): """A hook implementation namespace. """ @hookimpl @@ -22,7 +22,7 @@ def myhook(self, arg1, arg2): return arg1 + arg2 -class Plugin_2: +class Plugin_2(object): """A 2nd hook implementation namespace. """ @hookimpl diff --git a/pluggy.py b/pluggy.py index 37dd6b51..e4444ff4 100644 --- a/pluggy.py +++ b/pluggy.py @@ -9,7 +9,7 @@ _py3 = sys.version_info > (3, 0) -class HookspecMarker: +class HookspecMarker(object): """ Decorator helper class for marking functions as hook specifications. You can instantiate it with a project_name to get a decorator. @@ -47,7 +47,7 @@ def setattr_hookspec_opts(func): return setattr_hookspec_opts -class HookimplMarker: +class HookimplMarker(object): """ Decorator helper class for marking functions as hook implementations. You can instantiate with a project_name to get a decorator. @@ -101,7 +101,7 @@ def normalize_hookimpl_opts(opts): opts.setdefault("optionalhook", False) -class _TagTracer: +class _TagTracer(object): def __init__(self): self._tag2proc = {} self.writer = None @@ -148,7 +148,7 @@ def setprocessor(self, tags, processor): self._tag2proc[tags] = processor -class _TagTracerSub: +class _TagTracerSub(object): def __init__(self, root, tags): self.root = root self.tags = tags @@ -188,7 +188,7 @@ def _wrapped_call(wrap_controller, func): return call_outcome.get_result() -class _CallOutcome: +class _CallOutcome(object): """ Outcome of a function call, either an exception or a proper result. Calling the ``get_result`` method will return the result or reraise the exception raised when the function was called. """ @@ -221,7 +221,7 @@ def _reraise(cls, val, tb): """) -class _TracedHookExecution: +class _TracedHookExecution(object): def __init__(self, pluginmanager, before, after): self.pluginmanager = pluginmanager self.before = before @@ -517,7 +517,7 @@ def subset_hook_caller(self, name, remove_plugins): return orig -class _MultiCall: +class _MultiCall(object): """ execute a call into multiple python functions/methods. """ # XXX note that the __multicall__ argument is supported only @@ -611,7 +611,7 @@ def varnames(func): return tuple(args) -class _HookRelay: +class _HookRelay(object): """ hook holder object for performing 1:N hook calls where N is the number of registered plugins. @@ -715,7 +715,7 @@ def _maybe_apply_history(self, method): proc(res[0]) -class HookImpl: +class HookImpl(object): def __init__(self, plugin, plugin_name, function, hook_impl_opts): self.function = function self.argnames = varnames(self.function) diff --git a/testing/conftest.py b/testing/conftest.py index 5334b818..3d61a349 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -15,7 +15,7 @@ def he_pm(request, pm): from pluggy import HookspecMarker hookspec = HookspecMarker("example") - class Hooks: + class Hooks(object): @hookspec def he_method1(self, arg): return arg + 1 diff --git a/testing/test_details.py b/testing/test_details.py index c47a1d9a..51280122 100644 --- a/testing/test_details.py +++ b/testing/test_details.py @@ -15,7 +15,7 @@ def parse_hookimpl_opts(self, module_or_class, name): opts = {} return opts - class Plugin: + class Plugin(object): def x1meth(self): pass @@ -23,7 +23,7 @@ def x1meth(self): def x1meth2(self): pass - class Spec: + class Spec(object): @hookspec def x1meth(self): pass @@ -48,11 +48,11 @@ def test_plugin_getattr_raises_errors(): """Pluggy must be able to handle plugins which raise weird exceptions when getattr() gets called (#11). """ - class DontTouchMe: + class DontTouchMe(object): def __getattr__(self, x): raise Exception('cant touch me') - class Module: + class Module(object): pass module = Module() diff --git a/testing/test_helpers.py b/testing/test_helpers.py index bb813bcf..db12f30a 100644 --- a/testing/test_helpers.py +++ b/testing/test_helpers.py @@ -5,7 +5,7 @@ def test_varnames(): def f(x): i = 3 # noqa - class A: + class A(object): def f(self, y): pass @@ -26,11 +26,11 @@ def f(x, y=3): def test_varnames_class(): - class C: + class C(object): def __init__(self, x): pass - class D: + class D(object): pass class E(object): diff --git a/testing/test_hookrelay.py b/testing/test_hookrelay.py index a44a5fc4..38c5e2ad 100644 --- a/testing/test_hookrelay.py +++ b/testing/test_hookrelay.py @@ -7,7 +7,7 @@ def test_happypath(pm): - class Api: + class Api(object): @hookspec def hello(self, arg): "api hook 1" @@ -17,7 +17,7 @@ def hello(self, arg): assert hasattr(hook, 'hello') assert repr(hook.hello).find("hello") != -1 - class Plugin: + class Plugin(object): @hookimpl def hello(self, arg): return arg + 1 @@ -32,14 +32,14 @@ def hello(self, arg): def test_argmismatch(pm): - class Api: + class Api(object): @hookspec def hello(self, arg): "api hook 1" pm.add_hookspecs(Api) - class Plugin: + class Plugin(object): @hookimpl def hello(self, argwrong): pass @@ -51,7 +51,7 @@ def hello(self, argwrong): def test_only_kwargs(pm): - class Api: + class Api(object): @hookspec def hello(self, arg): "api hook 1" @@ -61,14 +61,14 @@ def hello(self, arg): def test_firstresult_definition(pm): - class Api: + class Api(object): @hookspec(firstresult=True) def hello(self, arg): "api hook 1" pm.add_hookspecs(Api) - class Plugin: + class Plugin(object): @hookimpl def hello(self, arg): return arg + 1 diff --git a/testing/test_method_ordering.py b/testing/test_method_ordering.py index c8bd39b1..7c87702a 100644 --- a/testing/test_method_ordering.py +++ b/testing/test_method_ordering.py @@ -12,7 +12,7 @@ @pytest.fixture def hc(pm): - class Hooks: + class Hooks(object): @hookspec def he_method1(self, arg): pass @@ -149,7 +149,7 @@ def he_method2(): def test_hookspec(pm): - class HookSpec: + class HookSpec(object): @hookspec() def he_myhook1(arg1): pass @@ -181,14 +181,14 @@ def he_myhook1(arg1): def test_decorator_functional(pm): - class HookSpec: + class HookSpec(object): @hookspec(firstresult=True) def he_myhook(self, arg1): """ add to arg1 """ pm.add_hookspecs(HookSpec) - class Plugin: + class Plugin(object): @hookimpl() def he_myhook(self, arg1): return arg1 + 1 @@ -204,12 +204,12 @@ def test_load_setuptools_instantiation(monkeypatch, pm): def my_iter(name): assert name == "hello" - class EntryPoint: + class EntryPoint(object): name = "myname" dist = None def load(self): - class PseudoPlugin: + class PseudoPlugin(object): x = 42 return PseudoPlugin() @@ -235,12 +235,12 @@ def test_load_setuptools_not_installed(monkeypatch, pm): def test_add_tracefuncs(he_pm): l = [] - class api1: + class api1(object): @hookimpl def he_method1(self): l.append("he_method1-api1") - class api2: + class api2(object): @hookimpl def he_method1(self): l.append("he_method1-api2") @@ -274,12 +274,12 @@ def after(outcome, hook_name, hook_impls, kwargs): def test_hook_tracing(he_pm): saveindent = [] - class api1: + class api1(object): @hookimpl def he_method1(self): saveindent.append(he_pm.trace.root.indent) - class api2: + class api2(object): @hookimpl def he_method1(self): saveindent.append(he_pm.trace.root.indent) @@ -311,14 +311,14 @@ def he_method1(self): def test_prefix_hookimpl(): pm = PluginManager(hookspec.project_name, "hello_") - class HookSpec: + class HookSpec(object): @hookspec def hello_myhook(self, arg1): """ add to arg1 """ pm.add_hookspecs(HookSpec) - class Plugin: + class Plugin(object): def hello_myhook(self, arg1): return arg1 + 1 @@ -331,7 +331,7 @@ def hello_myhook(self, arg1): def test_prefix_hookimpl_dontmatch_module(): pm = PluginManager(hookspec.project_name, "hello_") - class BadPlugin: + class BadPlugin(object): hello_module = __import__('email') pm.register(BadPlugin()) diff --git a/testing/test_multicall.py b/testing/test_multicall.py index 0d668049..7aff8c33 100644 --- a/testing/test_multicall.py +++ b/testing/test_multicall.py @@ -26,14 +26,14 @@ def MC(methods, kwargs, firstresult=False): def test_call_passing(): - class P1: + class P1(object): @hookimpl def m(self, __multicall__, x): assert len(__multicall__.results) == 1 assert not __multicall__.hook_impls return 17 - class P2: + class P2(object): @hookimpl def m(self, __multicall__, x): assert __multicall__.results == [] @@ -55,7 +55,7 @@ def test_keyword_args(): def f(x): return x + 1 - class A: + class A(object): @hookimpl def f(self, x, y): return x + y diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py index 063f8f44..a362de2f 100644 --- a/testing/test_pluginmanager.py +++ b/testing/test_pluginmanager.py @@ -17,7 +17,7 @@ def test_plugin_double_register(pm): def test_pm(pm): - class A: + class A(object): pass a1, a2 = A(), A() @@ -38,7 +38,7 @@ class A: def test_has_plugin(pm): - class A: + class A(object): pass a1 = A() @@ -48,7 +48,7 @@ class A: def test_register_dynamic_attr(he_pm): - class A: + class A(object): def __getattr__(self, name): if name[0] != "_": return 42 @@ -60,7 +60,7 @@ def __getattr__(self, name): def test_pm_name(pm): - class A: + class A(object): pass a1 = A() @@ -79,7 +79,7 @@ class A: def test_set_blocked(pm): - class A: + class A(object): pass a1 = A() @@ -98,7 +98,7 @@ class A: def test_register_mismatch_method(he_pm): - class hello: + class hello(object): @hookimpl def he_method_notexists(self): pass @@ -109,7 +109,7 @@ def he_method_notexists(self): def test_register_mismatch_arg(he_pm): - class hello: + class hello(object): @hookimpl def he_method1(self, qlwkje): pass @@ -119,7 +119,7 @@ def he_method1(self, qlwkje): def test_register(pm): - class MyPlugin: + class MyPlugin(object): pass my = MyPlugin() pm.register(my) @@ -136,14 +136,14 @@ class MyPlugin: def test_register_unknown_hooks(pm): - class Plugin1: + class Plugin1(object): @hookimpl def he_method1(self, arg): return arg + 1 pname = pm.register(Plugin1()) - class Hooks: + class Hooks(object): @hookspec def he_method1(self, arg): pass @@ -155,7 +155,7 @@ def he_method1(self, arg): def test_register_historic(pm): - class Hooks: + class Hooks(object): @hookspec(historic=True) def he_method1(self, arg): pass @@ -164,7 +164,7 @@ def he_method1(self, arg): pm.hook.he_method1.call_historic(kwargs=dict(arg=1)) l = [] - class Plugin: + class Plugin(object): @hookimpl def he_method1(self, arg): l.append(arg) @@ -172,7 +172,7 @@ def he_method1(self, arg): pm.register(Plugin()) assert l == [1] - class Plugin2: + class Plugin2(object): @hookimpl def he_method1(self, arg): l.append(arg * 10) @@ -184,7 +184,7 @@ def he_method1(self, arg): def test_with_result_memorized(pm): - class Hooks: + class Hooks(object): @hookspec(historic=True) def he_method1(self, arg): pass @@ -194,7 +194,7 @@ def he_method1(self, arg): he_method1.call_historic(lambda res: l.append(res), dict(arg=1)) l = [] - class Plugin: + class Plugin(object): @hookimpl def he_method1(self, arg): return arg * 10 @@ -204,23 +204,23 @@ def he_method1(self, arg): def test_with_callbacks_immediately_executed(pm): - class Hooks: + class Hooks(object): @hookspec(historic=True) def he_method1(self, arg): pass pm.add_hookspecs(Hooks) - class Plugin1: + class Plugin1(object): @hookimpl def he_method1(self, arg): return arg * 10 - class Plugin2: + class Plugin2(object): @hookimpl def he_method1(self, arg): return arg * 20 - class Plugin3: + class Plugin3(object): @hookimpl def he_method1(self, arg): return arg * 30 @@ -237,7 +237,7 @@ def he_method1(self, arg): def test_register_historic_incompat_hookwrapper(pm): - class Hooks: + class Hooks(object): @hookspec(historic=True) def he_method1(self, arg): pass @@ -246,7 +246,7 @@ def he_method1(self, arg): l = [] - class Plugin: + class Plugin(object): @hookimpl(hookwrapper=True) def he_method1(self, arg): l.append(arg) @@ -256,7 +256,7 @@ def he_method1(self, arg): def test_call_extra(pm): - class Hooks: + class Hooks(object): @hookspec def he_method1(self, arg): pass @@ -271,14 +271,14 @@ def he_method1(arg): def test_call_with_too_few_args(pm): - class Hooks: + class Hooks(object): @hookspec def he_method1(self, arg): pass pm.add_hookspecs(Hooks) - class Plugin1: + class Plugin1(object): @hookimpl def he_method1(self, arg): 0 / 0 @@ -288,7 +288,7 @@ def he_method1(self, arg): def test_subset_hook_caller(pm): - class Hooks: + class Hooks(object): @hookspec def he_method1(self, arg): pass @@ -297,17 +297,17 @@ def he_method1(self, arg): l = [] - class Plugin1: + class Plugin1(object): @hookimpl def he_method1(self, arg): l.append(arg) - class Plugin2: + class Plugin2(object): @hookimpl def he_method1(self, arg): l.append(arg * 10) - class PluginNo: + class PluginNo(object): pass plugin1, plugin2, plugin3 = Plugin1(), Plugin2(), PluginNo()