@@ -594,9 +594,7 @@ def get_time(incl_time: bool = True, incl_timezone: bool = True) -> str:
594594 the_time = datetime .now ()
595595 timezone = datetime .now ().astimezone ().tzname ()
596596 # convert date parts to string
597- y = str (the_time .year )
598- M = str (the_time .month )
599- d = str (the_time .day )
597+
600598 # putting date parts into one string
601599 if incl_time and incl_timezone :
602600 fname = the_time .isoformat (sep = "_" , timespec = "seconds" ) + "_" + timezone
@@ -605,19 +603,13 @@ def get_time(incl_time: bool = True, incl_timezone: bool = True) -> str:
605603 elif incl_timezone :
606604 fname = "_" .join ([the_time .isoformat (sep = "_" , timespec = "hours" )[:- 3 ], timezone ])
607605 else :
608- fname = y + M + d
606+ y = str (the_time .year )
607+ m = str (the_time .month )
608+ d = str (the_time .day )
609+ fname = y + m + d
609610
610611 # optional
611612 fname = fname .replace (":" , "-" ) # remove ':' from hours, minutes, seconds
612- # POSTCONDITIONALS
613- # ! to delete (was it jused for something?)
614- # parts = fname.split("_")
615- # if incl_time and incl_timezone:
616- # assert len(parts) == 3, f"time and/or timezone inclusion issue: {fname}"
617- # elif incl_time or incl_timezone:
618- # assert len(parts) == 2, f"time/timezone inclusion issue: {fname}"
619- # else:
620- # assert len(parts) == 1, f"time/timezone inclusion issue: {fname}"
621613
622614 return fname
623615
@@ -724,7 +716,7 @@ def get_logger(
724716
725717 Returns
726718 -------
727- tuple[logging.Logger, str
719+ tuple[logging.Logger, str]
728720 A tuple containing the logger instance and the log file path.
729721 """
730722 # Generate log file name
0 commit comments