util/misc.py
changeset 1920 584ad449ee58
parent 1862 c4ba411f8c89
child 1923 65edbc03fdbf
--- a/util/misc.py	Thu Feb 01 14:51:18 2018 +0100
+++ b/util/misc.py	Fri Feb 02 11:06:41 2018 +0100
@@ -46,13 +46,19 @@
                 return False
     return True
 
+def GetClassImporter(classpath):
+    """
+    is used to resolve library class names in features.py
+    returns a callable that return the class pointed by classpath string
+    if a class is given instead of string, then returns a callable returning it.
+    """
 
-def GetClassImporter(classpath):
     if isinstance(classpath, str):
-        def fac():
+        def factory():
+            # on-demand import, only when using class
             mod = __import__(classpath.rsplit('.', 1)[0])
             return reduce(getattr, classpath.split('.')[1:], mod)
-        return fac
+        return factory
     else:
         return classpath