diff --git a/color.py b/color.py index 6743511e5a20d104010dd2241d8418be170e0182..29c31c22d1e772fa379c6e840d8cfb1326d6ae06 100644 --- a/color.py +++ b/color.py @@ -18,6 +18,8 @@ import sys import re +from ammsml.config import constants as C + IS_COLOR: bool = True @@ -40,16 +42,16 @@ else: # IS_COLOR = True -class BColors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - CHANGED = '\033[94m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - ERROR = '\033[91m' - ENDC = '\033[0m' - BOLD = '\033[1m' - UNDERLINE = '\033[4m' +# class BColors: +# HEADER = '\033[95m' +# OKBLUE = '\033[94m' +# CHANGED = '\033[94m' +# OKGREEN = '\033[92m' +# WARNING = '\033[93m' +# ERROR = '\033[91m' +# ENDC = '\033[0m' +# BOLD = '\033[1m' +# UNDERLINE = '\033[4m' # --- begin "pretty" # @@ -115,9 +117,9 @@ def colorize(lead, num, color): def hostcolor(host: str, stats: list, color: bool = True) -> str: if IS_COLOR and color: if stats['failures'] != 0 or stats['unreachable'] != 0: - return "%-37s" % stringc(host, BColors.ERROR) + return "%-37s" % stringc(host, C.COLOR_ERROR) elif stats['changed'] != 0: - return "%-37s" % stringc(host, BColors.CHANGED) + return "%-37s" % stringc(host, C.COLOR_CHANGED) else: - return "%-37s" % stringc(host, BColors.OKGREEN) + return "%-37s" % stringc(host, C.COLOR_OKGREEN) return "%-26s" % host diff --git a/display.py b/display.py index ad5bfaed297740c92c7c879da1ec1759bf9acfd1..064a40c06ce5b874eb769266c49767a67100b69c 100644 --- a/display.py +++ b/display.py @@ -28,13 +28,13 @@ import subprocess from struct import unpack, pack from termios import TIOCGWINSZ -from utils.color import stringc -from utils.parsing import to_text -from utils.errors import AMMSMLError -from utils.singleton import Singleton -from config import constants as C -from utils.six import with_metaclass -from utils.wrap import wrap_var +from ammsml.utils.color import stringc +from ammsml.utils.parsing import to_text +from ammsml.utils.errors import AMMSMLError +from ammsml.utils.singleton import Singleton +from ammsml.config import constants as C +from ammsml.utils.six import with_metaclass +from ammsml.utils.wrap import wrap_var b_COW_PATHS = ( diff --git a/parseing_yaml.py b/parseing_yaml.py index 0fa3d0af63aa71fbaa078234f00f865823984023..df1355de5dc9b094710389d412fc33865e798967 100644 --- a/parseing_yaml.py +++ b/parseing_yaml.py @@ -18,7 +18,7 @@ import yaml -from utils.parsing import to_text +# from ammsml.utils.parsing import to_text class AMMSMLBaseYAMLObject(object): diff --git a/path.py b/path.py index fdd584387351147070bc16e615db0faf2aaa6a28..defe961acbfd25d00fe13b0a3bcb135e71f5805e 100644 --- a/path.py +++ b/path.py @@ -20,8 +20,8 @@ import os import shutil from errno import EEXIST -from utils.parsing import to_text -from utils.errors import AMMSMLError +from ammsml.utils.parsing import to_text +from ammsml.utils.errors import AMMSMLError __all__ = ['unfrackpath', 'makedirs_safe', 'resolve_path', 'cleanup_tmp_file'] @@ -129,7 +129,7 @@ def cleanup_tmp_file(path, warn=False): except Exception as e: if warn: # Importing here to avoid circular import - from utils.display import Display + from ammsml.utils.display import Display display = Display() display.display(u'Unable to remove temporary file {0}'.format(to_text(e))) except Exception: