Skip to content

Commit

Permalink
Fixes for lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarons committed Aug 29, 2023
1 parent 8852bd6 commit e92fef8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/sync_drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def process_folder(item, destination_path, filters, ignore, root):
if not (item and destination_path and root):
return None
new_directory = os.path.join(destination_path, item.name)
new_directory_norm = unicodedata.normalize('NFC', new_directory)
new_directory_norm = unicodedata.normalize("NFC", new_directory)
if not wanted_folder(
filters=filters, ignore=ignore, folder_path=new_directory_norm, root=root
):
Expand Down Expand Up @@ -155,9 +155,9 @@ def process_package(local_file):
LOGGER.info(f"Unpacking {archive_file} to {os.path.dirname(archive_file)}")
unpack_archive(filename=archive_file, extract_dir=os.path.dirname(archive_file))
try:
os.rename(unicodedata.normalize('NFD', local_file), local_file)
except:
LOGGER.warning("Normalizing failed")
os.rename(unicodedata.normalize("NFD", local_file), local_file)
except Exception as e:
LOGGER.warning("Normalizing failed - " + str(e))
os.remove(archive_file)
elif "application/gzip" == magic_object.from_file(filename=local_file):
archive_file += ".gz"
Expand Down Expand Up @@ -209,7 +209,7 @@ def process_file(item, destination_path, filters, ignore, files):
if not (item and destination_path and files is not None):
return False
local_file = os.path.join(destination_path, item.name)
local_file = unicodedata.normalize('NFC', local_file)
local_file = unicodedata.normalize("NFC", local_file)
if not wanted_file(filters=filters, ignore=ignore, file_path=local_file):
return False
files.add(local_file)
Expand Down Expand Up @@ -274,7 +274,7 @@ def sync_directory(
if not new_folder:
continue
try:
files.add(unicodedata.normalize('NFC', new_folder))
files.add(unicodedata.normalize("NFC", new_folder))
files.update(
sync_directory(
drive=item,
Expand Down
2 changes: 1 addition & 1 deletion src/sync_photos.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def generate_file_name(photo, file_size, destination_path):
else f'{"__".join([name, file_size, base64.urlsafe_b64encode(photo.id.encode()).decode()])}.{extension}',
)

file_size_id_path_norm = unicodedata.normalize('NFC', file_size_id_path)
file_size_id_path_norm = unicodedata.normalize("NFC", file_size_id_path)

if os.path.isfile(file_path):
os.rename(file_path, file_size_id_path)
Expand Down

0 comments on commit e92fef8

Please sign in to comment.