2025-09-28 17:19:20 +02:00
|
|
|
from .refit_logger import logger
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_standard_name_number(current_number, number_str_length):
|
|
|
|
|
"""returns a number string filled to the length of the input number"""
|
2025-09-29 21:38:42 +02:00
|
|
|
# logger.debug(
|
|
|
|
|
# f"FUNC: get_standard_name_number() index={current_number} string_length={number_str_length}"
|
|
|
|
|
# )
|
2025-09-28 17:19:20 +02:00
|
|
|
current_number = str(current_number)
|
|
|
|
|
standard_name_number = str.zfill(current_number, number_str_length)
|
2025-09-29 21:38:42 +02:00
|
|
|
# logger.debug(
|
|
|
|
|
# f"FUNC: get_standard_name_number() return value= '{standard_name_number}'"
|
|
|
|
|
# )
|
2025-09-28 17:19:20 +02:00
|
|
|
return standard_name_number
|
|
|
|
|
|
|
|
|
|
|
2025-09-30 09:35:25 +02:00
|
|
|
def get_standard_folder_name(name) -> str:
|
2025-09-30 17:21:12 +02:00
|
|
|
"""Returnes a standard name either from a list or the default value.
|
2025-09-30 09:35:25 +02:00
|
|
|
|
2025-09-30 17:21:12 +02:00
|
|
|
This function sanitizes the input, which gets passed as a list or None from
|
|
|
|
|
argparse. The function either chooses the first entry of the list, given to
|
|
|
|
|
the --name argument or returns the default value 'directory'
|
2025-09-30 09:35:25 +02:00
|
|
|
|
2025-09-30 17:21:12 +02:00
|
|
|
Args:
|
|
|
|
|
name (list[str] | None): A list of names if passed to the --name argument
|
|
|
|
|
or None if no name is passed.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
str: The file name. Returns 'file' as default value if name argument is 'None'
|
|
|
|
|
otherwise the first element of the list.
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
>>> get_standard_file_name(None)
|
|
|
|
|
'file'
|
|
|
|
|
>>> get_standard_file_name(["example"])
|
|
|
|
|
'example'
|
|
|
|
|
>>> get_standard_file_name(["directory_name", "example"])
|
|
|
|
|
'directory_name'
|
2025-09-30 09:35:25 +02:00
|
|
|
"""
|
2025-09-28 17:19:20 +02:00
|
|
|
|
2025-09-30 17:21:12 +02:00
|
|
|
logger.debug(f"FUNC: get_standard_folder_name() MSG: entered function with value: '{name}'")
|
|
|
|
|
standard_folder_name = name[0] if name is not None else "directory"
|
|
|
|
|
|
|
|
|
|
logger.debug(f"FUNC: get_standard_folder_name() MSG: exiting function with folder name: '{standard_folder_name}'")
|
2025-09-28 17:19:20 +02:00
|
|
|
|
|
|
|
|
return standard_folder_name
|
2025-09-29 15:36:18 +02:00
|
|
|
|
2025-09-29 20:11:16 +02:00
|
|
|
|
2025-09-30 09:35:25 +02:00
|
|
|
def get_standard_file_name(name) -> str:
|
|
|
|
|
"""Returnes a name either from a list or the default value.
|
|
|
|
|
|
|
|
|
|
This function sanitizes the input, which gets passed as a list or None from
|
|
|
|
|
argparse. The function either chooses the first entry of the list, given to
|
|
|
|
|
the --name argument or returns the default value 'file'
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
name (list[str] | None): A list of names if passed to the --name argument
|
|
|
|
|
or None if no name is passed.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
str: The file name. Returns 'file' as default value if name argument is 'None'
|
|
|
|
|
otherwise the first element of the list.
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
>>> get_standard_file_name(None)
|
|
|
|
|
'file'
|
|
|
|
|
>>> get_standard_file_name(["example"])
|
|
|
|
|
'example'
|
|
|
|
|
>>> get_standard_file_name(["file_name", "example"])
|
|
|
|
|
'file_name'
|
|
|
|
|
"""
|
2025-09-29 20:11:16 +02:00
|
|
|
|
2025-09-30 09:35:25 +02:00
|
|
|
logger.debug(f"FUNC: get_standard_file_name() MSG: entered function with name='{name}'")
|
|
|
|
|
standard_file_name = name[0] if name is not None else "file"
|
|
|
|
|
logger.debug(f"FUNC: get_standard_file_name MSG: Continuing with expected input: '{standard_file_name}'")
|
2025-09-29 20:11:16 +02:00
|
|
|
|
|
|
|
|
logger.debug("FUNC get_standard_file_name() MSG: Exit")
|
2025-09-29 15:36:18 +02:00
|
|
|
return standard_file_name
|
2025-09-30 15:56:23 +02:00
|
|
|
|
|
|
|
|
|