示例#1
0
 def read_groups(self, infname=None, inftype=None):
     # TODO: docstring
     if infname is None:
         infname = self.config['TASKS_FNAME_IN']
         inftype = self.config['TASKS_FTYPE_IN']
     # If no tasks have been written yet, don't load any.
     if not os.path.exists(infname):
         return
     if inftype == FTYPE_XML:
         from backend.xml import XmlBackend
         # TODO The tasks_dict used just here is a provisionary solution.
         tasks_dict = dict()
         for task in self.tasks:
             tasks_dict[task.id] = task
         with open(infname, 'rb') as infile:
             self.groups = XmlBackend.read_groups(infile, tasks_dict)
     else:
         raise NotImplementedError("Session.read_groups() is not "
                                   "implemented for this type of files.")
示例#2
0
 def read_groups(self, infname=None, inftype=None):
     # TODO: docstring
     if infname is None:
         infname = self.config['TASKS_FNAME_IN']
         inftype = self.config['TASKS_FTYPE_IN']
     # If no tasks have been written yet, don't load any.
     if not os.path.exists(infname):
         return
     if inftype == FTYPE_XML:
         from backend.xml import XmlBackend
         # TODO The tasks_dict used just here is a provisionary solution.
         tasks_dict = dict()
         for task in self.tasks:
             tasks_dict[task.id] = task
         with open(infname, 'rb') as infile:
             self.groups = XmlBackend.read_groups(infile, tasks_dict)
     else:
         raise NotImplementedError("Session.read_groups() is not "
                                   "implemented for this type of files.")