Display TTY  1
Customise your terminal's output
Loading...
Searching...
No Matches
constants.py
Go to the documentation of this file.
7
8"""
9@file constants.py
10@brief This is the file in charge of containing the constants used in the display_tty library.
11@details This module defines constants and configuration settings used throughout the
12display_tty project. It includes error codes, output modes, animation delays,
13TOML configuration defaults, and forbidden log levels.
14"""
15
16# Error codes
17ERR = 1 # General error code
18ERROR = ERR # Alias for ERR
19SUCCESS = 0 # Success code
20
21# Output modes
22OUT_TTY = "tty" # Output to terminal (TTY)
23OUT_STRING = "string" # Output as a string
24OUT_FILE = "file" # Output to a file
25OUT_DEFAULT = '' # Default output mode
26
27# OUTPUT modes keys
28KEY_OUTPUT_MODE = "OUTPUT_MODE" # Key for selecting output mode
29KEY_PRETTIFY_OUTPUT = "PRETTIFY_OUTPUT" # Key for enabling prettified output
30# Key for block-based prettified output
31KEY_PRETTIFY_OUTPUT_IN_BLOCKS = "PRETTY_OUTPUT_IN_BLOCS"
32
33# Animation delays
34# Key for animation delay in messages
35KEY_ANIMATION_DELAY = 'MESSAGE_ANIMATION_DELAY'
36# Key for blocky animation delay
37KEY_ANIMATION_DELAY_BLOCKY = 'MESSAGE_ANIMATION_DELAY_BLOCKY'
38
39# TOML configuration defaults
40TOML_CONF = {
41 KEY_OUTPUT_MODE: OUT_TTY, # Default output mode
42 KEY_PRETTIFY_OUTPUT: True, # Enable prettified output by default
43 # Enable block-based prettified output by default
44 KEY_PRETTIFY_OUTPUT_IN_BLOCKS: True,
45 KEY_ANIMATION_DELAY: 0.01, # Default animation delay
46 KEY_ANIMATION_DELAY_BLOCKY: 0.01, # Default blocky animation delay
47 'MESSAGE_CHARACTER': '@', # Default character for messages
48 'MESSAGE_ERROR_CHARACTER': '#', # Character for error messages
49 'MESSAGE_INFORM_CHARACTER': 'i', # Character for informational messages
50 'MESSAGE_QUESTION_CHARACTER': '?', # Character for question messages
51 'MESSAGE_SUCCESS_CHARACTER': '/', # Character for success messages
52 'MESSAGE_WARNING_CHARACTER': '!', # Character for warning messages
53 'SUB_SUB_TITLE_WALL_CHARACTER': '*', # Character for sub-sub-title walls
54 'SUB_TITLE_WALL_CHARACTER': '@', # Character for sub-title walls
55 'TITLE_WALL_CHARACTER': '#', # Character for title walls
56 'TREE_COLUMN_SEPERATOR_CHAR': '│', # Column separator for tree structures
57 'TREE_LINE_SEPERATOR_CHAR': '─', # Line separator for tree structures
58 'TREE_NODE_CHAR': '├', # Node character for tree structures
59 'TREE_NODE_END_CHAR': '└', # End node character for tree structures
60 'BOX_NO_VERTICAL': '#', # Box character without vertical lines
61 'BOX_VERTICAL_NO_HORIZONTAL': '#', # Box character without horizontal lines
62 'ROUND_BOX_CORNER_LEFT': '╔', # Top-left corner of a rounded box
63 'ROUND_BOX_CORNER_RIGHT': '╗', # Top-right corner of a rounded box
64 'ROUND_BOX_CORNER_BOTTOM_LEFT': '╚', # Bottom-left corner of a rounded box
65 'ROUND_BOX_CORNER_BOTTOM_RIGHT': '╝', # Bottom-right corner of a rounded box
66 'ROUND_BOX_HORIZONTAL': '═', # Horizontal line for rounded boxes
67 'ROUND_BOX_VERTICAL': '║', # Vertical line for rounded boxes
68 'DIFF_BORDER_LINE_CHARACTER_BOX': '-', # Border line character for diff boxes
69 'DIFF_SIDE_LINE_CHARACTER_BOX': '|', # Side line character for diff boxes
70}
71
72# Forbidden log levels
73FORBIDDEN_NUMBER_LOG_LEVELS_CORRESPONDANCE = {
74 "INFO": 20, # Informational messages
75 "WARN": 30, # Warning messages
76 "DEBUG": 10, # Debugging messages
77 "FATAL": 50, # Fatal error messages
78 "ERROR": 40, # Error messages
79 "NOTSET": 0, # No specific log level
80 "WARNING": 40, # Alias for WARN
81 "CRITICAL": 50 # Alias for FATAL
82}
83
84FORBIDDEN_NUMBER_LOG_LEVELS = list(
85 FORBIDDEN_NUMBER_LOG_LEVELS_CORRESPONDANCE.values()
86) # List of forbidden log level numbers