refactor get_standard_name_number() and added proper docstring

This commit is contained in:
2025-09-30 17:46:36 +02:00
parent af80345ff6
commit a0f2f83a8a

View File

@@ -2,7 +2,22 @@ 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"""
"""Returns a number string filled to the length of the input number
This function returns the number in a standartized way as a string.
As input it takes the current number of the string to build and a
number which determines the length of the string.
Args:
current_number (int): The current number of the item.
number_str_length (int): The length of the string which gets returned.
Examples:
>>> get_standard_name_number(1, 2)
'01'
>>> get_standard_name_number(23, 4)
'0023'
"""
# logger.debug(
# f"FUNC: get_standard_name_number() index={current_number} string_length={number_str_length}"
# )
@@ -38,10 +53,14 @@ def get_standard_folder_name(name) -> str:
'directory_name'
"""
logger.debug(f"FUNC: get_standard_folder_name() MSG: entered function with value: '{name}'")
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}'")
logger.debug(
f"FUNC: get_standard_folder_name() MSG: exiting function with folder name: '{standard_folder_name}'"
)
return standard_folder_name
@@ -70,11 +89,13 @@ def get_standard_file_name(name) -> str:
'file_name'
"""
logger.debug(f"FUNC: get_standard_file_name() MSG: entered function with name='{name}'")
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}'")
logger.debug(
f"FUNC: get_standard_file_name MSG: Continuing with expected input: '{standard_file_name}'"
)
logger.debug("FUNC get_standard_file_name() MSG: Exit")
return standard_file_name