Fix pylint warnings

This commit is contained in:
Bart Schuurmans 2024-03-25 18:25:43 +01:00
parent bd95bcd50b
commit d9bf848cfa

View file

@ -236,7 +236,7 @@ class AddFileToTar(ChildJob):
if settings.USE_S3: if settings.USE_S3:
# Connection for writing temporary files # Connection for writing temporary files
s3 = S3Boto3Storage() storage = S3Boto3Storage()
# Handle for creating the final archive # Handle for creating the final archive
s3_archive_path = f"exports/{export_task_id}.tar.gz" s3_archive_path = f"exports/{export_task_id}.tar.gz"
@ -249,7 +249,7 @@ class AddFileToTar(ChildJob):
# Save JSON file to a temporary location # Save JSON file to a temporary location
export_json_tmp_file = f"exports/{export_task_id}/archive.json" export_json_tmp_file = f"exports/{export_task_id}/archive.json"
S3Boto3Storage.save( S3Boto3Storage.save(
s3, storage,
export_json_tmp_file, export_json_tmp_file,
ContentFile(export_json_bytes), ContentFile(export_json_bytes),
) )
@ -269,12 +269,12 @@ class AddFileToTar(ChildJob):
export_job.save() export_job.save()
# Delete temporary files # Delete temporary files
S3Boto3Storage.delete(s3, export_json_tmp_file) S3Boto3Storage.delete(storage, export_json_tmp_file)
else: else:
export_job.export_data_file = f"{export_task_id}.tar.gz" export_job.export_data_file = f"{export_task_id}.tar.gz"
with export_job.export_data_file.open("wb") as f: with export_job.export_data_file.open("wb") as tar_file:
with BookwyrmTarFile.open(mode="w:gz", fileobj=f) as tar: with BookwyrmTarFile.open(mode="w:gz", fileobj=tar_file) as tar:
# save json file # save json file
tar.write_bytes(export_json_bytes) tar.write_bytes(export_json_bytes)