Global -> Logger Handlers
TARDIS log
- tardis_em.utils.logo.print_progress_bar(value: int, max_v: int)
Displays a progress bar indicating the percentage of completion. The progress bar is dynamically adjusted based on the terminal’s width in interactive mode. In non-interactive environments or in case of error, a default width is used.
- Parameters:
value – The current progress value. Must be a non-negative integer less than or equal to max_v.
max_v – The maximum value for the progress bar, representing 100% progress. Must be a positive integer greater than 0.
- Returns:
A formatted string representation of a progress bar including the current percentage of completion and value status.
- Return type:
str
- tardis_em.utils.logo.is_interactive()
Simple check if a command line window is from Jupiter.
- class tardis_em.utils.logo.TardisLogo(logo=True)
Class for managing TARDIS logo display and formatting within a console or Jupyter environment.
- static clear_output(wait=True)
Clears the current output displayed in the terminal or within an interactive environment.
- Parameters:
wait (bool) – Determines whether the clearing of the output should wait for the display to be updated. The functionality of this parameter applies specifically when an interactive shell is being used.
- cell_width()
Adjusts the cell width based on the environment and terminal properties.
TARDIS errors
- tardis_em.utils.errors.standard_error_id(id_s: str)
Fetches the standard error message corresponding to the provided ID.
This function attempts to look up an error ID in a predefined dictionary and returns the associated error message. If the ID does not exist in the dictionary, it falls back to a default string indicating an unknown error.
- Parameters:
id_s (str) – The identifier string for the error to search in the dictionary.
- Returns:
Corresponding error message if the ID is found, else “UNKNOWN_ERROR”.
- Return type:
str
- exception tardis_em.utils.errors.TardisError(id_='0', py='NA', desc='Unknown exertion occurred!', warning_b=True)
Handles errors specific to the TARDIS framework and provides mechanisms for standardized error logging, message formatting, and interactive displays.
The class allows the creation of custom error messages with standardized identifiers, logs error-related information to a file, and supports formatted, error-specific console notifications. It also facilitates the truncation of long error descriptions to fit within terminal display constraints.
- cut_desc(desc: str) Tuple[str, str, str, str, str, str, str, str]
Splits the given string desc into multiple smaller strings, ensuring each split string does not exceed the defined width. The method first retrieves the available width for truncation and then decides whether the input string needs splitting. If the string is shorter than or equal to the width, no splitting is done; otherwise, the string is truncated into multiple parts using the _truncate_str method.
- Parameters:
desc (str) – The input string to be truncated and split into smaller parts.
- Returns:
A tuple containing up to eight parts of the truncated string. Parts that are not used remain as empty strings.
- Return type:
Tuple[str, str, str, str, str, str, str, str]