Пример #1
0
    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
Пример #2
0
    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
Пример #3
0
    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
Пример #4
0
    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']))
Пример #5
0
    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']))
Пример #6
0
    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
Пример #7
0
    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
Пример #8
0
 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)
Пример #9
0
 def __init__(self):
     self.__dict__.update(
         get_colors(
             __opts__.get('color'),
             __opts__.get('color_theme')
         )
     )
     self.strip_colors = __opts__.get('strip_colors', True)
Пример #10
0
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()
Пример #11
0
 def __init__(self, parser):
     self.parser = parser
     self.colors = get_colors(self.parser.options.no_colors is False)
Пример #12
0
 def __init__(self):
     self.__dict__.update(
         get_colors(__opts__.get('color'), __opts__.get('color_theme')))
     self.strip_colors = __opts__.get('strip_colors', True)
Пример #13
0
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='       ')
Пример #14
0
 def __init__(self, opts=None):
     self.opts = opts
     self.colors = get_colors(opts.no_colors is False)
Пример #15
0
# 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',
Пример #16
0
# 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',
Пример #17
0
 def __init__(self):
     self.colors = get_colors(True)
     self.__dict__.update(get_colors(True))
     self.strip_colors = True
Пример #18
0
 def __init__(self, parser):
     self.parser = parser
     self.colors = get_colors(self.parser.options.no_colors is False)
Пример #19
0
 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)
Пример #20
0
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()
Пример #21
0
 def __init__(self, opts=None):
     self.opts = opts
     self.colors = get_colors(opts.no_colors is False)
Пример #22
0
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: ',