Skip to content

Commit 8672758

Browse files
committed
chore: Satisfy pylint
1 parent f53dfe8 commit 8672758

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

immich_auto_album.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -600,16 +600,19 @@ def parse_separated_strings(items: list[str]) -> dict:
600600
parsed_strings_dict[key] = value
601601
return parsed_strings_dict
602602

603-
def create_album_name(asset_path_chunks: list[str], album_separator: str, album_name_post_regex: list = [str]) -> str:
603+
# pylint: disable=R0912
604+
def create_album_name(asset_path_chunks: list[str], album_separator: str, album_name_postprocess_regex: list) -> str:
604605
"""
605606
Create album names from provided path_chunks string array.
606607
607608
The method uses global variables album_levels_range_arr or album_levels to
608609
generate album names either by level range or absolute album levels. If multiple
609610
album path chunks are used for album names they are separated by album_separator.
610611
611-
album_name_post_regex is list of pairs of regex and replace, this is optional
612+
album_name_postprocess_regex is list of pairs of regex and replace, this is optional
612613
"""
614+
if album_name_postprocess_regex is None:
615+
album_name_postprocess_regex = [str]
613616

614617
album_name_chunks = ()
615618
logging.debug("path chunks = %s", list(asset_path_chunks))
@@ -654,15 +657,15 @@ def create_album_name(asset_path_chunks: list[str], album_separator: str, album_
654657

655658
# final album name before regex
656659
album_name = album_separator.join(album_name_chunks)
657-
logging.debug(f"Album Name {album_name}")
660+
logging.debug("Album Name %s", album_name)
658661

659662
# apply regex if any
660-
if album_name_post_regex:
661-
for pattern, *repl in album_name_post_regex:
663+
if album_name_postprocess_regex:
664+
for pattern, *repl in album_name_postprocess_regex:
662665
# If no replacement string provided, default to empty string
663666
replace = repl[0] if repl else ''
664-
album_name = re.sub(pattern, replace, album_name)
665-
logging.debug(f"Album Post Regex s/{pattern}/{replace}/g --> {album_name}")
667+
album_name = re.sub(pattern, replace, album_name)
668+
logging.debug("Album Post Regex s/%s/%s/g --> %s", pattern, replace, album_name)
666669

667670
return album_name.strip()
668671

0 commit comments

Comments
 (0)