@@ -434,16 +434,18 @@ def get_basename(fname: None | str = None) -> str:
434434 - For a given filename, returns basename WITHOUT file extension
435435 - If no fname given (i.e., None) then return basename that the function is called in
436436
437- PARAMS
438- -----
439- - fname (None or str): the filename to get basename of, or None
437+ Parameters
438+ ----------
439+ fname: str, optional
440+ The filename to get basename from. Default is None.
440441
441- OUTPUTS
442- -----
443- - basename of given filepath or the current file the function is executed
442+ Returns
443+ -------
444+ str
445+ basename of given filepath or the current file the function is executed
444446
445447 Examples
446- -----
448+ ---------
447449 1)
448450 >>> get_basename()
449451 utils
@@ -467,17 +469,18 @@ def get_time(incl_time: bool = True, incl_timezone: bool = True) -> str:
467469 Gets current date, time (optional) and timezone (optional) for file naming
468470
469471 Parameters
470- -----
472+ ----------
471473 - incl_time (bool): whether to include timestamp in the string
472474 - incl_timezone (bool): whether to include the timezone in the string
473475
474476 Returns
475- -----
476- - fname (str): includes date, timestamp and/or timezone
477+ -------
478+ str
479+ fname that includes date, timestamp and/or timezone
477480 connected by '_' in one string e.g. yyyyMMdd_hhmm_timezone
478481
479482 Examples
480- -----
483+ --------
481484 1)
482485 >>> get_time()
483486 '20231019_101758_CEST'
@@ -530,13 +533,14 @@ def generate_log_filename(folder: str = "logs", suffix: str = "") -> str:
530533 Creates log file name and path
531534
532535 Parameters
533- -----
536+ ----------
534537 folder (str): name of the folder to put the log file in
535538 suffix (str): anything else you want to add to the log file name
536539
537540 Returns
538- -----
539- log_filepath (str): the file path to the log file
541+ -------
542+ str
543+ The file path to the log file
540544 """
541545 # PRECONDITIONS
542546 create_folder (folder )
@@ -548,7 +552,7 @@ def generate_log_filename(folder: str = "logs", suffix: str = "") -> str:
548552 return log_filepath
549553
550554
551- def init_log (filename : str , display : bool = False , logger_id : str | None = None ):
555+ def init_log (filename : str , display : bool = False , logger_id : str | None = None ) -> logging . Logger :
552556 """
553557 - Custom python logger configuration (basicConfig())
554558 with two handlers (for stdout and for file)
@@ -557,15 +561,16 @@ def init_log(filename: str, display: bool = False, logger_id: str | None = None)
557561 display in stdout
558562
559563 Parameters
560- -----
561- - filename (str): filepath to log record file
564+ ----------
565+ filename (str): filepath to log record file
562566 - display (bool): whether to print the logs to whatever standard output
563567 - logger_id (str): an optional identifier for yourself,
564568 if None then defaults to 'root'
565569
566570 Returns
567- -----
568- - logger object
571+ -------
572+ logging.Logger
573+ The logger object
569574
570575 Examples
571576 -----
0 commit comments