def test_get_colors(self): ret = utils.get_colors() self.assertDictContainsSubset({"LIGHT_GRAY": "\x1b[0;37m"}, ret) ret = utils.get_colors(use=False) self.assertDictContainsSubset({"LIGHT_GRAY": ""}, ret) ret = utils.get_colors(use="LIGHT_GRAY") self.assertDictContainsSubset({"YELLOW": "\x1b[0;37m"}, ret) # YELLOW now == LIGHT_GRAY
def test_get_colors(self): ret = utils.get_colors() self.assertDictContainsSubset({'LIGHT_GRAY': '\x1b[0;37m'}, ret) ret = utils.get_colors(use=False) self.assertDictContainsSubset({'LIGHT_GRAY': ''}, ret) ret = utils.get_colors(use='LIGHT_GRAY') self.assertDictContainsSubset({'YELLOW': '\x1b[0;37m'}, ret) # YELLOW now == LIGHT_GRAY
def test_get_colors(self): ret = utils.get_colors() self.assertEqual('\x1b[0;37m', str(ret['LIGHT_GRAY'])) ret = utils.get_colors(use=False) self.assertDictContainsSubset({'LIGHT_GRAY': ''}, ret) ret = utils.get_colors(use='LIGHT_GRAY') # LIGHT_YELLOW now == LIGHT_GRAY self.assertEqual(str(ret['LIGHT_YELLOW']), str(ret['LIGHT_GRAY']))
def __init__(self, has_header=True, # if header will be displayed row_delimiter='-', # row delimiter char delim=' | ', # column delimiter justify='center', # text justify separate_rows=True, # display the line separating two consecutive rows prefix='| ', # character to display at the beginning of the row suffix=' |', # character to display at the end of the row width=50, # column max width wrapfunc=None): # function wrapper self.__dict__.update( get_colors( __opts__.get('color'), __opts__.get('color_theme') ) ) self.strip_colors = __opts__.get('strip_colors', True) self.has_header = has_header self.row_delimiter = row_delimiter self.delim = delim self.justify = justify self.separate_rows = separate_rows self.prefix = prefix self.suffix = suffix self.width = width if not(wrapfunc and callable(wrapfunc)): self.wrapfunc = self.wrap_onspace else: self.wrapfunc = wrapfunc
def __init__(self): self.colors = salt.utils.get_colors(__opts__.get('color')) self.__dict__.update( get_colors( __opts__.get('color') ) ) self.strip_colors = __opts__.get('strip_colors', True)
def __init__(self): self.__dict__.update( get_colors( __opts__.get('color'), __opts__.get('color_theme') ) ) self.strip_colors = __opts__.get('strip_colors', True)
def print_bulleted(options, message, color='LIGHT_BLUE'): colors = get_colors(options.no_color is False) print(' {0}*{ENDC} {1}'.format(colors[color], message, **colors)) sys.stdout.flush()
def __init__(self, parser): self.parser = parser self.colors = get_colors(self.parser.options.no_colors is False)
def __init__(self): self.__dict__.update( get_colors(__opts__.get('color'), __opts__.get('color_theme'))) self.strip_colors = __opts__.get('strip_colors', True)
import django import dj_database_url import six import yaml from django.db.utils import load_backend from django.utils.crypto import get_random_string from jinja2 import Environment, PackageLoader from pkg_resources import ResourceManager, get_provider from salt.utils import get_colors from salt.version import __version__ as salt_version from stackdio.core.config import StackdioConfig, StackdioConfigException raw_input = six.moves.input SALT_COLORS = get_colors() class Colors(object): ENDC = str(SALT_COLORS['ENDC']) BLACK = str(SALT_COLORS['DEFAULT_COLOR']) ERROR = str(SALT_COLORS['LIGHT_RED']) WARN = str(SALT_COLORS['YELLOW']) INFO = str(SALT_COLORS['CYAN']) PROMPT = str(SALT_COLORS['GREEN']) VALUE = str(SALT_COLORS['BLUE']) class BaseCommand(object): ERROR_INDENT = dict(initial_indent='ERROR: ', subsequent_indent=' ')
def __init__(self, opts=None): self.opts = opts self.colors = get_colors(opts.no_colors is False)
# Import Python libs from __future__ import absolute_import, print_function import subprocess import hashlib import pprint import optparse # Import Salt libs from salt.utils import get_colors # Import 3rd-party libs import yaml import salt.ext.six as six colors = get_colors() def parse(): ''' Parse command line options ''' parser = optparse.OptionParser() parser.add_option('-r', '--runs', dest='runs', default=10, type=int, help='Specify the number of times to run the consistency check') parser.add_option('-c', '--command',
def __init__(self): self.colors = get_colors(True) self.__dict__.update(get_colors(True)) self.strip_colors = True
def __init__(self): self.colors = salt.utils.get_colors(__opts__.get('color')) self.__dict__.update(get_colors(__opts__.get('color'))) self.strip_colors = __opts__.get('strip_colors', True)
import django import dj_database_url import six import yaml from django.db.utils import load_backend from django.utils.crypto import get_random_string from jinja2 import Environment, PackageLoader from pkg_resources import ResourceManager, get_provider from salt.utils import get_colors from salt.version import __version__ as salt_version from stackdio.core.config import StackdioConfig, StackdioConfigException raw_input = six.moves.input SALT_COLORS = get_colors() class Colors(object): ENDC = str(SALT_COLORS['ENDC']) BLACK = str(SALT_COLORS['DEFAULT_COLOR']) ERROR = str(SALT_COLORS['LIGHT_RED']) WARN = str(SALT_COLORS['YELLOW']) INFO = str(SALT_COLORS['CYAN']) PROMPT = str(SALT_COLORS['GREEN']) VALUE = str(SALT_COLORS['BLUE']) class BaseCommand(object): ERROR_INDENT = dict(initial_indent='ERROR: ', subsequent_indent=' ') WARNING_INDENT = dict(initial_indent='WARNING: ',