Пример #1
0
 def move_extracted_files(self, file_paths: List[str],
                          extraction_dir: Path) -> List[Path]:
     extracted_files = list()
     for item in file_paths:
         if not file_is_empty(item):
             absolute_path = Path(item)
             relative_path = absolute_path.relative_to(extraction_dir)
             target_path = Path(self._file_folder, relative_path)
             target_path.parent.mkdir(parents=True, exist_ok=True)
             shutil.move(str(absolute_path), str(target_path))
             extracted_files.append(target_path)
     return extracted_files
Пример #2
0
    def move_extracted_files(self, file_paths: List[str],
                             extraction_dir: Path) -> List[Path]:
        extracted_files = list()
        for item in file_paths:
            if not file_is_empty(item):
                absolute_path = Path(item)
                relative_path = absolute_path.relative_to(extraction_dir)
                target_path = Path(self._file_folder, relative_path)
                target_path.parent.mkdir(parents=True, exist_ok=True)
                try:
                    shutil.move(str(absolute_path), str(target_path))
                    extracted_files.append(target_path)
                except OSError as error:
                    logging.error(f'Error occurred during move: {error}')

        return extracted_files
Пример #3
0
 def test_file_is_zero_broken_link(self):
     self.assertFalse(
         file_is_empty(os.path.join(get_test_data_dir(), 'broken_link')),
         'Broken link is not empty')