From 336a9011a749c3ee16e2beb6aa564b818ceb76bf Mon Sep 17 00:00:00 2001 From: Christof Schulze Date: Sat, 2 Nov 2019 22:52:44 +0100 Subject: [PATCH] added path creatin mode (permissions), minor cleanups --- color.py | 16 ++-------------- path.py | 4 ++-- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/color.py b/color.py index 537f464..5f901bd 100644 --- a/color.py +++ b/color.py @@ -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" # diff --git a/path.py b/path.py index dbd47ae..8c7e365 100644 --- a/path.py +++ b/path.py @@ -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. """ @@ -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 -- GitLab