From c4aad1c68d1a3d1e9459a05fbd46e7fd6c804eff Mon Sep 17 00:00:00 2001 From: Josué A Date: Tue, 7 Jul 2015 15:27:43 +0000 Subject: [PATCH] Added support for loading classes by providing a class reference. --- simso/core/Scheduler.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/simso/core/Scheduler.py b/simso/core/Scheduler.py index b474732..bdcd8c0 100644 --- a/simso/core/Scheduler.py +++ b/simso/core/Scheduler.py @@ -53,9 +53,12 @@ class SchedulerInfo(object): try: clas = None if self.clas: - name = self.clas.rsplit('.', 1)[1] - importlib.import_module(self.clas) - clas = getattr(importlib.import_module(self.clas), name) + if type(self.clas) is type: + clas = self.clas + else: + name = self.clas.rsplit('.', 1)[1] + importlib.import_module(self.clas) + clas = getattr(importlib.import_module(self.clas), name) elif self.filename: path, name = os.path.split(self.filename) name = os.path.splitext(name)[0] -- libgit2 0.26.0