Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ repos:
- id: zimports
args: [ --style=pycharm ]
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.3.0
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.15.2
hooks:
- id: pyupgrade
args: [ --py36-plus ]
- repo: https://github.com/pycqa/flake8
rev: '6.1.0'
rev: '7.0.0'
hooks:
- id: flake8
exclude: (__pycache__|.venv|tmp|.tox)
Expand Down
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
Loading