def find_class(self, name): from aiida.work.legacy.job_process import JobProcess if self.is_wrapped_job_calculation(name): idx = name.find(JobProcess.__name__) wrapped_class = name[idx + len(JobProcess.__name__) + 1:] # Recreate the class return JobProcess.build(plum.util.load_class(wrapped_class))
def test_class_loader(self): TemplatereplacerProcess = JobProcess.build(TemplatereplacerCalculation) LoadedClass = class_loader.load_class( fullname(TemplatereplacerProcess)) self.assertEqual(TemplatereplacerProcess.__name__, LoadedClass.__name__) self.assertEqual(fullname(TemplatereplacerProcess), fullname(LoadedClass))
def test_class_loader(self): PwProcess = JobProcess.build(PwCalculation) LoadedClass = class_loader.load_class(fullname(PwProcess)) self.assertEqual(PwProcess.__name__, LoadedClass.__name__) self.assertEqual(fullname(PwProcess), fullname(LoadedClass))
def test_class_loader(self): cl = ClassLoader() PwProcess = JobProcess.build(PwCalculation)
def test_class_loader(self): cl = ClassLoader() TemplatereplacerProcess = JobProcess.build(TemplatereplacerCalculation)