in src/s3wrapper.py [0:0]
def get(self):
log.debug(f'Selected file ext {self.file_ext}')
if (self.file_ext in IGNORE_FILE_EXT):
log.info(f'File ext: {self.file_ext} is IGNORED')
elif (self.file_ext == '.dcm'):
log.debug(
f'Select .dcm file type for processing, return file location: {self.file_location}')
self.download_file()
self.file_list.append(self.file_location)
elif (self.file_ext == '.zip'):
self.download_file()
if (zipfile.is_zipfile(self.file_location)):
archive = zipfile.ZipFile(self.file_location, 'r')
self.file_list = utils.unzip(archive)
else:
log.error(
f'Invalid ZipFile {self} downloaded to {self.file_location}')
raise
elif (self.file_ext == '.bz2'):
log.info(f'Select .bz2 file extension, continue assuming tar.bz2')
self.download_file()
archive = tarfile.open(self.file_location, 'r')
self.file_list = utils.tar(archive)
elif (self.file_ext == '.tar'):
log.info(
f'Select .tar file type for processing {self.file_location}')
self.download_file()
archive = tarfile.open(self.file_location, 'r')
self.file_list = utils.tar(archive)
elif (self.file_ext == '.gz'):
log.info(f'Select .gz file extension, continue assuming tar.gz')
self.download_file()
archive = tarfile.open(self.file_location, 'r')
self.file_list = utils.tar(archive)
else:
log.error(f'Unexpected file extension {self.file_ext}')
raise Exception(f'{self.file_ext} file extension not supported')