From 11eeb8574b7b4620ac6fd440cb251f8aa2458f5b Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Thu, 8 Jul 2021 22:25:12 -0700 Subject: Reduce import scopes, remove cycles. --- logging_utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'logging_utils.py') diff --git a/logging_utils.py b/logging_utils.py index a24f1c9..ba5270f 100644 --- a/logging_utils.py +++ b/logging_utils.py @@ -12,8 +12,6 @@ import sys import argparse_utils import config -import string_utils as su -import thread_utils as tu cfg = config.add_commandline_args( f'Logging ({__file__})', @@ -199,7 +197,8 @@ def get_logger(name: str = ""): def tprint(*args, **kwargs) -> None: if config.config['logging_debug_threads']: - print(f'{tu.current_thread_id()}', end="") + from thread_utils import current_thread_id + print(f'{current_thread_id()}', end="") print(*args, **kwargs) else: pass @@ -258,6 +257,7 @@ class OutputSink(object): self.destination_bitv = destination_bitv def print(self, *args, **kwargs): + from string_utils import sprintf, strip_escape_sequences end = kwargs.pop("end", None) if end is not None: if not isinstance(end, str): @@ -268,7 +268,7 @@ class OutputSink(object): raise TypeError("sep must be None or a string") if kwargs: raise TypeError("invalid keyword arguments to print()") - buf = su.sprintf(*args, end="", sep=sep) + buf = sprintf(*args, end="", sep=sep) if sep is None: sep = " " if end is None: @@ -282,7 +282,7 @@ class OutputSink(object): if self.destination_bitv & self.FILENAME and self.f is not None: self.f.write(buf.encode('utf-8')) self.f.flush() - buf = su.strip_escape_sequences(buf) + buf = strip_escape_sequences(buf) if self.logger is not None: if self.destination_bitv & self.LOG_DEBUG: self.logger.debug(buf) -- cgit v1.3