def _calc_stats(self): """ Calculating statistics for file extensions """ for file in get_data_files(): try: ext = get_file_ext(file) except WrongFileExtension: self.errors_count += 1 else: self.valid_count += 1 self.ext_stats[ext] = self.ext_stats.setdefault(ext, 0) + 1 self._show_process_report(file)
def run(self): while True: data_file = self.queue.get() ext = get_file_ext(data_file) # -- if ext and (ext in self.extractor.__class__.__dict__) and self.db.is_new(data_file): self.counter.inc_ing() data = getattr(self.extractor, ext)(data_file) self.db.insert_data(data_file, os.path.split(data_file)[1], data) else: if not ext: self.counter.inc_wrang() elif ext not in self.extractor.__class__.__dict__: self.counter.inc_unsupp() else: self.counter.inc_ignore() # -- self.counter.inc_proc() self.queue.task_done()
def run(self): while True: data_file = self.queue.get() ext = get_file_ext(data_file) #-- if ext and (ext in self.extractor.__class__.__dict__) and self.db.is_new(data_file): self.counter.inc_ing() data = getattr(self.extractor, ext)(data_file) self.db.insert_data(data_file, os.path.split(data_file)[1], data) else: if not ext: self.counter.inc_wrang() elif ext not in self.extractor.__class__.__dict__: self.counter.inc_unsupp() else: self.counter.inc_ignore() #-- self.counter.inc_proc() self.queue.task_done()