Loading color.py +2 −14 Original line number Diff line number Diff line Loading @@ -38,20 +38,8 @@ else: # curses returns an error (e.g. could not find terminal) IS_COLOR = False # if C.IS_FORCE_COLOR: # 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' if C.IS_FORCE_COLOR: IS_COLOR = True # --- begin "pretty" # Loading path.py +2 −2 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ def makedirs_safe(path, mode=None): chance the parent directory might be world-writable (eg, /tmp) to prevent symlink hijacking and potential disclosure or modification of sensitive file contents. :param path: A byte or text string representing a directory chain to be created :param mode: If given, the mode to set the directory to :param mode: If given, the mode (permissions) to set the directory to [default mode=0o777] :raises AMMSMLError: If the directory cannot be created and does not already exist. :raises UnicodeDecodeError: if the path is not decodable in the utf-8 encoding. """ Loading Loading @@ -131,6 +131,6 @@ def cleanup_tmp_file(path, warn=False): # Importing here to avoid circular import from ammsml.utils.display import Display display = Display() display.display(u'Unable to remove temporary file {0}'.format(to_text(e))) display.display('Unable to remove temporary file {0}'.format(to_text(e))) except Exception: pass Loading
color.py +2 −14 Original line number Diff line number Diff line Loading @@ -38,20 +38,8 @@ else: # curses returns an error (e.g. could not find terminal) IS_COLOR = False # if C.IS_FORCE_COLOR: # 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' if C.IS_FORCE_COLOR: IS_COLOR = True # --- begin "pretty" # Loading
path.py +2 −2 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ def makedirs_safe(path, mode=None): chance the parent directory might be world-writable (eg, /tmp) to prevent symlink hijacking and potential disclosure or modification of sensitive file contents. :param path: A byte or text string representing a directory chain to be created :param mode: If given, the mode to set the directory to :param mode: If given, the mode (permissions) to set the directory to [default mode=0o777] :raises AMMSMLError: If the directory cannot be created and does not already exist. :raises UnicodeDecodeError: if the path is not decodable in the utf-8 encoding. """ Loading Loading @@ -131,6 +131,6 @@ def cleanup_tmp_file(path, warn=False): # Importing here to avoid circular import from ammsml.utils.display import Display display = Display() display.display(u'Unable to remove temporary file {0}'.format(to_text(e))) display.display('Unable to remove temporary file {0}'.format(to_text(e))) except Exception: pass