added comments to file creation function
This commit is contained in:
@@ -90,27 +90,30 @@ class Refit_Create:
|
|||||||
f"FUNC: create_n_files() MSG: Entered function VALUES: n={self.n} name={self.name} input={self.input}"
|
f"FUNC: create_n_files() MSG: Entered function VALUES: n={self.n} name={self.name} input={self.input}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get name of the file
|
# Get the name from the input argument.
|
||||||
file_name = librefit.get_standard_file_name(name)
|
file_name = librefit.get_standard_file_name(name)
|
||||||
|
|
||||||
|
# Get the length of the entered number to fill it with 0
|
||||||
length_n = len(str(n))
|
length_n = len(str(n))
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"FUNC: create_n_files() MSG: file name='{file_name}' length_n={length_n}"
|
f"FUNC: create_n_files() MSG: file name='{file_name}' length_n={length_n}"
|
||||||
)
|
)
|
||||||
|
|
||||||
while n > 0:
|
while n > 0:
|
||||||
|
|
||||||
# Get number of the file(s) to create
|
# Get number of the file(s) to create
|
||||||
file_number = str(n - 1)
|
file_number = str(n - 1)
|
||||||
number_string = librefit.get_standard_name_number(file_number, length_n)
|
number_string = librefit.get_standard_name_number(file_number, length_n)
|
||||||
|
|
||||||
|
# Get the name of the file, either applying default or using first list item.
|
||||||
temp_name = f"{file_name}_{number_string}"
|
temp_name = f"{file_name}_{number_string}"
|
||||||
|
|
||||||
file_path = Path(os.path.join(input, temp_name))
|
file_path = Path(os.path.join(input, temp_name)) # Build file path
|
||||||
|
file_path.touch(exist_ok=True) # creating file
|
||||||
file_path.touch(exist_ok=True)
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"FUNC: create_n_files MSG: created file at {os.path.join(input, temp_name)}"
|
f"FUNC: create_n_files MSG: created file at {os.path.join(input, temp_name)}"
|
||||||
)
|
)
|
||||||
|
# Counting down n for the next ieration of the while-loop
|
||||||
n -= 1
|
n -= 1
|
||||||
|
|
||||||
def rf_create_decider(self):
|
def rf_create_decider(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user