def _from_dir_with_local_resources(self, path, data_key, data_type): tasks = {} for f in iter_files(path, ext=self._allowed_extensions[data_type]): task_id = len(tasks) + 1 tasks[task_id] = self._create_task_with_local_uri( f, data_key, task_id) return tasks
def from_dir_with_text_files(self, path, data_key): tasks = {} for f in iter_files(path, ext=''): tasks.update( self.from_text_file(f, data_key, start_task_id=len(tasks))) return tasks
def from_dir_with_json_files(self, path): tasks = {} for f in iter_files(path, ext='.json'): tasks.update(self.from_json_file(f, start_task_id=len(tasks))) return tasks
def ids(self): for f in iter_files(self.path, '.json'): yield int(os.path.splitext(os.path.basename(f))[0])