Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_chars(self, array, char_color='white'):
"""Set the characters used to draw lines between rows and columns
- the array should contain 4 fields:
[horizontal, vertical, corner, header]
- default is set to:
['-', '|', '+', '=']
"""
if len(array) != 4:
raise ArraySizeError("array should contain 4 characters")
if sys.stdout.isatty():
array = [termcolor.colored(x[:1], char_color) for x in [str(s) for s in array]]
else:
array = [x[:1] for x in [str(s) for s in array]]
(self._char_horiz, self._char_vert,
self._char_corner, self._char_header) = array
LOG_LEVEL = level.upper()
_STDOUT_HANDLER.setLevel(LOG_LEVEL)
LOG_LEVEL = 'INFO'
"""str: The global logging level for stdout loggers and software packages.
Don't change directly. May be changed via :any:`set_log_level`.
"""
LOG_FILE = os.path.join(USER_PREFIX, 'debug_log')
"""str: Absolute path to a log file to receive all debugging output."""
LINE_MARKER = os.environ.get('TAU_LINE_MARKER', '[TAU] ')
"""str: Marker for each line of output."""
COLORED_LINE_MARKER = termcolor.colored(LINE_MARKER, 'red')
TERM_SIZE = get_terminal_size()
"""tuple: (width, height) tuple of detected terminal dimensions in characters."""
LINE_WIDTH = TERM_SIZE[0] - len(LINE_MARKER)
"""Width of a line on the terminal.
Uses system specific methods to determine console line width. If the line
width cannot be determined, the default is 80.
"""
_ROOT_LOGGER = logging.getLogger()
if not _ROOT_LOGGER.handlers:
_ROOT_LOGGER.setLevel(logging.DEBUG)
_LOG_FILE_PREFIX = os.path.dirname(LOG_FILE)
try:
LOG_LEVEL = level.upper()
_STDOUT_HANDLER.setLevel(LOG_LEVEL)
LOG_LEVEL = 'INFO'
"""str: The global logging level for stdout loggers and software packages.
Don't change directly. May be changed via :any:`set_log_level`.
"""
LOG_FILE = os.path.join(USER_PREFIX, 'debug_log')
"""str: Absolute path to a log file to receive all debugging output."""
LINE_MARKER = os.environ.get('TAU_LINE_MARKER', '[TAU] ')
"""str: Marker for each line of output."""
COLORED_LINE_MARKER = termcolor.colored(LINE_MARKER, 'red')
TERM_SIZE = get_terminal_size()
"""tuple: (width, height) tuple of detected terminal dimensions in characters."""
LINE_WIDTH = TERM_SIZE[0] - len(LINE_MARKER)
"""Width of a line on the terminal.
Uses system specific methods to determine console line width. If the line
width cannot be determined, the default is 80.
"""
_ROOT_LOGGER = logging.getLogger()
if not _ROOT_LOGGER.handlers:
_ROOT_LOGGER.setLevel(logging.DEBUG)
_LOG_FILE_PREFIX = os.path.dirname(LOG_FILE)
try: