comparison src/core/constants.py @ 2154:7cbffd754b4a

core (constants), tools (common/ansi): moved ANSI escape codes to a dedicated class, with helper methods
author Goffi <goffi@goffi.org>
date Thu, 16 Feb 2017 00:44:54 +0100
parents bca699faf416
children f472179305a1
comparison
equal deleted inserted replaced
2153:f67434fd88d2 2154:7cbffd754b4a
311 IGNORE = 'ignore' 311 IGNORE = 'ignore'
312 NO_LIMIT = -1 # used in bridge when a integer value is expected 312 NO_LIMIT = -1 # used in bridge when a integer value is expected
313 DEFAULT_MAX_AGE = 1209600 # default max age of cached files, in seconds 313 DEFAULT_MAX_AGE = 1209600 # default max age of cached files, in seconds
314 HASH_SHA1_EMPTY = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' 314 HASH_SHA1_EMPTY = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
315 315
316
317 ## ANSI escape sequences ##
318 # XXX: used for logging
319 # XXX: they will be probably moved in a dedicated module in the future
320 ANSI_RESET = '\033[0m'
321 ANSI_NORMAL_WEIGHT = '\033[22m'
322 ANSI_FG_BLACK, ANSI_FG_RED, ANSI_FG_GREEN, ANSI_FG_YELLOW, ANSI_FG_BLUE, ANSI_FG_MAGENTA, ANSI_FG_CYAN, ANSI_FG_WHITE = ('\033[3%dm' % nb for nb in xrange(8))
323 ANSI_BOLD = '\033[1m'
324 ANSI_BLINK = '\033[5m'
325 ANSI_BLINK_OFF = '\033[25m'
326
327 @classmethod 316 @classmethod
328 def LOG_OPTIONS(cls): 317 def LOG_OPTIONS(cls):
329 """Return options checked for logs""" 318 """Return options checked for logs"""
330 # XXX: we use a classmethod so we can use Const inheritance to change default options 319 # XXX: we use a classmethod so we can use Const inheritance to change default options
331 return(cls.LOG_OPT_COLORS, cls.LOG_OPT_TAINTS_DICT, cls.LOG_OPT_LEVEL, cls.LOG_OPT_FORMAT, cls.LOG_OPT_LOGGER, cls.LOG_OPT_OUTPUT) 320 return(cls.LOG_OPT_COLORS, cls.LOG_OPT_TAINTS_DICT, cls.LOG_OPT_LEVEL, cls.LOG_OPT_FORMAT, cls.LOG_OPT_LOGGER, cls.LOG_OPT_OUTPUT)