Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 25, 2024
1 parent e085983 commit 6e404ef
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions filecluster/configuration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for keeping configuration-related code for the filecluster."""

import logging
import os
from datetime import timedelta
Expand Down
1 change: 1 addition & 0 deletions filecluster/dbase.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for handling operations on both databases: media and clusters."""

import itertools
import logging
import multiprocessing
Expand Down
1 change: 1 addition & 0 deletions filecluster/filecluster_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom type definitions to be used in filecluster package."""

from typing import NewType

import pandas as pd
Expand Down
15 changes: 8 additions & 7 deletions filecluster/image_grouper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for file clustering and supporting operations."""

import logging
import math
import os
Expand Down Expand Up @@ -355,7 +356,7 @@ def move_files_to_cluster_folder(self):
if dir_name is None or isnan:
raise DateStringNoneException()
# instead, create dummy date
#dir_name = "XXXX_XX_XX"
# dir_name = "XXXX_XX_XX"

ut.create_folder_for_cluster(
config=self.config, date_string=dir_name, mode=mode
Expand Down Expand Up @@ -386,9 +387,9 @@ def add_target_dir_for_duplicates(self):
for idx, _row in self.inbox_media_df[sel_dups].iterrows():
dup_cluster = self.inbox_media_df.duplicated_cluster[idx]
try:
self.inbox_media_df.loc[
idx, "target_path"
] = path_creator.for_duplicates(dup_cluster[0])
self.inbox_media_df.loc[idx, "target_path"] = (
path_creator.for_duplicates(dup_cluster[0])
)
except Exception as e:
logger.error(f"{e}")

Expand Down Expand Up @@ -542,9 +543,9 @@ def mark_inbox_duplicates(self) -> Tuple[List[str], List[str]]:
for idx, _row in tqdm(
self.inbox_media_df[sel_dups].iterrows(), total=sum(sel_dups)
):
self.inbox_media_df.loc[
idx, "status"
] = Status.DUPLICATE # Fixme: copy of a slice
self.inbox_media_df.loc[idx, "status"] = (
Status.DUPLICATE
) # Fixme: copy of a slice
dups_lib_patch = list(
filter(lambda x: _row.file_name in str(x), confirmed_library_dups)
)
Expand Down
1 change: 1 addition & 0 deletions filecluster/image_reader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for reading media data on files from given folder."""

import logging
import os
from pathlib import Path
Expand Down
7 changes: 4 additions & 3 deletions filecluster/utlis.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Helper utilities to work with media files, exif data, hashing and base64 images."""

import base64
import hashlib
import logging
import math
import os
import sys
import time
Expand All @@ -15,7 +15,6 @@
from PIL import Image
from filecluster.configuration import Config
from filecluster.configuration import CopyMode
from filecluster.exceptions import DateStringNoneException

log_fmt = "%(levelname).1s %(message)s"
logging.basicConfig(format=log_fmt)
Expand Down Expand Up @@ -80,7 +79,9 @@ def create_folder_for_cluster(config: Config, date_string: str, mode: CopyMode):
if mode != CopyMode.NOP:
pth = Path(config.out_dir_name)
if not isinstance(date_string, str):
logger.error(f"Expected date string got: {date_string} of type: {type(date_string)}")
logger.error(
f"Expected date string got: {date_string} of type: {type(date_string)}"
)
dir_name = (
pth / date_string
) # fixme: can raise error: TypeError: unsupported operand type(s) for /: 'WindowsPath' and 'float'
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Setup function for filecluster package."""

from setuptools import find_packages
from setuptools import setup

Expand Down

0 comments on commit 6e404ef

Please sign in to comment.