beremiz

Documentation

2018-02-02, Edouard Tisserant
584ad449ee58
Parents ccea0fa6ea91
Children cf54939e6b0c
Documentation
  • +9 -3
    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