diff --git a/mainline/catalog.py b/mainline/catalog.py index efb7a90..c67178f 100644 --- a/mainline/catalog.py +++ b/mainline/catalog.py @@ -68,10 +68,7 @@ def __new__(mcs, class_name, bases, attributes): else: cls._providers = mcs._provider_mapping_factory() - cls._providers.update( - {k: v for k, v in six.iteritems(attributes) - if isinstance(v, IProvider)} - ) + cls._providers.update({k: v for k, v in six.iteritems(attributes) if isinstance(v, IProvider)}) return cls diff --git a/mainline/injection.py b/mainline/injection.py index 291c321..9f778a0 100644 --- a/mainline/injection.py +++ b/mainline/injection.py @@ -15,6 +15,7 @@ class Injector(object): + def __init__(self, di): self.di = di @@ -26,6 +27,7 @@ def decorate(self, wrapped): class CallableInjector(Injector): + def __init__(self, di, *args, **kwargs): super(CallableInjector, self).__init__(di) self.args = args @@ -56,6 +58,7 @@ def __call__(self, wrapped): class SpecInjector(CallableInjector): + def decorate(self, wrapped): # Remove the number of args from the wrapped function's argspec spec = getargspec(wrapped) @@ -80,6 +83,7 @@ def decorator(wrapped, instance, args, kwargs): class AutoSpecInjector(CallableInjector): + def decorate(self, wrapped): spec = getargspec(wrapped) @@ -119,6 +123,7 @@ def decorator(*args, **kwargs): class ClassPropertyInjector(Injector): + def __init__(self, di, key, name=None, replace_on_access=False): super(ClassPropertyInjector, self).__init__(di) self.key = key diff --git a/mainline/provider.py b/mainline/provider.py index 432e7e4..15e5fac 100644 --- a/mainline/provider.py +++ b/mainline/provider.py @@ -6,6 +6,7 @@ class IProvider(object): + def __init__(self): pass @@ -27,6 +28,7 @@ def providable(self): class IFactoryProvider(IProvider): + def __init__(self, factory=None): self.set_factory(factory) @@ -58,9 +60,7 @@ def __init__(self, factory, scope=NoneScope, key=''): super(Provider, self).__init__(factory) def __repr__(self): - return '<%s factory=%s scope=%s>' % (self.__class__.__name__, - self.factory, - self.scope) + return '<%s factory=%s scope=%s>' % (self.__class__.__name__, self.factory, self.scope) def provide(self, *args, **kwargs): if self.has_instance(): diff --git a/mainline/scope.py b/mainline/scope.py index f2bcff5..a769597 100644 --- a/mainline/scope.py +++ b/mainline/scope.py @@ -91,12 +91,14 @@ def instances_factory(self): class ProxyScope(IScope): + def __init__(self, scope, *args, **kwargs): self.instances = scope super(ProxyScope, self).__init__(*args, **kwargs) class NamespacedProxyScope(ProxyScope): + def __init__(self, namespace, scope, *args, **kwargs): self.namespace = namespace super(NamespacedProxyScope, self).__init__(scope, *args, **kwargs) diff --git a/mainline/utils.py b/mainline/utils.py index 842a0db..4a46c5e 100644 --- a/mainline/utils.py +++ b/mainline/utils.py @@ -15,6 +15,7 @@ def _get_object_init(): class classproperty(object): + def __init__(self, f): self.f = f @@ -23,6 +24,7 @@ def __get__(self, obj, owner): class ProxyMutableMapping(collections.MutableMapping): + def __init__(self, mapping): self.__mapping = mapping