src/sisy/models.py
def func_from_info(self):
        """Find and return a callable object from a task info dictionary"""
        info = self.funcinfo
        functype = info['func_type']
        if functype in ['instancemethod', 'classmethod', 'staticmethod']:
            the_modelclass = get_module_member_by_dottedpath(info['class_path'])
            if functype == 'instancemethod':
                the_modelobject = the_modelclass.objects.get(pk=info['model_pk'])
                the_callable = get_member(the_modelobject, info['func_name'])
            else:
                the_callable = get_member(the_modelclass, info['func_name'])
            return the_callable
        elif functype == 'function':
            mod = import_module(info['module_name'])
            the_callable = get_member(mod, info['func_name'])
            return the_callable
        else:
            raise ValueError(f"Unknown functype '{functype} in task {self.pk} ({self.label})")
def func_from_info(self):
        info = self.funcinfo
        functype = info['func_type']
        if functype in ['instancemethod', 'classmethod', 'staticmethod']:
            the_modelclass = get_module_member_by_dottedpath(info['class_path'])
            if functype == 'instancemethod':
                the_modelobject = the_modelclass.objects.get(pk=info['model_pk'])
                the_callable = get_member(the_modelobject, info['func_name'])
            else:
                the_callable = get_member(the_modelclass, info['func_name'])
            return the_callable
        elif functype == 'function':
            mod = import_module(info['module_name'])
            the_callable = get_member(mod, info['func_name'])
            return the_callable
        else:
            raise ValueError(f"Unknown functype '{functype} in task {self.pk} ({self.label})")
def func_from_info ( self ) : info = self . funcinfo functype = info [ 'func_type' ] if functype in [ 'instancemethod' , 'classmethod' , 'staticmethod' ] : the_modelclass = get_module_member_by_dottedpath ( info [ 'class_path' ] ) if functype == 'instancemethod' : the_modelobject = the_modelclass . objects . get ( pk = info [ 'model_pk' ] ) the_callable = get_member ( the_modelobject , info [ 'func_name' ] ) else : the_callable = get_member ( the_modelclass , info [ 'func_name' ] ) return the_callable elif functype == 'function' : mod = import_module ( info [ 'module_name' ] ) the_callable = get_member ( mod , info [ 'func_name' ] ) return the_callable else : raise ValueError ( f"Unknown functype '{functype} in task {self.pk} ({self.label})" )
Find and return a callable object from a task info dictionary
Find and return a callable object from a task info dictionary