src/pyams_utils/registry.py
branchdev-tf
changeset 427 63284c98cdc1
parent 408 cf2304af0fab
child 437 b5131bd64de7
--- a/src/pyams_utils/registry.py	Sat Nov 23 01:24:11 2019 +0100
+++ b/src/pyams_utils/registry.py	Sat Nov 23 14:57:24 2019 +0100
@@ -21,7 +21,6 @@
 See :ref:`zca` to get a brief introduction about using a local registry with PyAMS packages.
 """
 
-
 import logging
 import threading
 
@@ -52,12 +51,14 @@
     _registry = None
 
     def get_registry(self):
+        """Return local registry"""
         return self._registry
 
     def set_registry(self, registry):
+        """Define local registry"""
         self._registry = registry
 
-local_registry = LocalRegistry()
+local_registry = LocalRegistry()  # pylint: disable=invalid-name
 
 
 def get_local_registry():
@@ -74,7 +75,7 @@
 
 
 @subscriber(INewRequest)
-def handle_new_request(event):
+def handle_new_request(event):  # pylint: disable=unused-argument
     """New request event subscriber
 
     Is used to initialize local registry to None for any new request
@@ -183,7 +184,7 @@
             yield utility
 
 
-def get_all_utilities_registered_for(interface):
+def get_all_utilities_registered_for(interface):  # pylint: disable=invalid-name
     """Get list of registered utilities for given interface
 
     Do a registry lookup for matching utilities into local registry first, then on each registry
@@ -196,17 +197,17 @@
     return result
 
 
-class utility_config(object):  # pylint: disable=invalid-name
+class utility_config:  # pylint: disable=invalid-name
     """Function or class decorator to register a utility in the global registry
 
     :param str name: default=''; name under which the utility is registered
     :param Interface provides: the interface for which the utility is registered
 
-    Please note that a single utility can be registered several times (using several annotations), with
-    different names.
+    Please note that a single utility can be registered several times (using several annotations),
+    with different names.
 
-    If several utilities are registered for the same interface with the same name, the last registered
-    utility will override the previous ones.
+    If several utilities are registered for the same interface with the same name, the last
+    registered utility will override the previous ones.
     """
 
     venusian = venusian
@@ -218,13 +219,13 @@
         settings = self.__dict__.copy()
         depth = settings.pop('_depth', 0)
 
-        def callback(context, name, ob):
-            if type(ob) is type:
-                factory = ob
+        def callback(context, name, obj):
+            if isinstance(obj, type):
+                factory = obj
                 component = None
             else:
                 factory = None
-                component = ob
+                component = obj
 
             provides = settings.get('provides')
             if provides is None: