Documentation
authorEdouard Tisserant
Fri, 02 Feb 2018 11:06:41 +0100
changeset 1920 584ad449ee58
parent 1919 ccea0fa6ea91
child 1921 cf54939e6b0c
Documentation
util/misc.py
--- 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