예제 #1
0
파일: utils_test.py 프로젝트: bemehow/salt
    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
파일: utils_test.py 프로젝트: Roche/salt
    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
파일: table_out.py 프로젝트: bryson/salt
    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
파일: __init__.py 프로젝트: tligda/salt
 def __init__(self, parser):
     self.parser = parser
     self.colors = get_colors(self.parser.options.no_colors is False)
예제 #12
0
파일: nested.py 프로젝트: lvg01/salt.old
 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
파일: __init__.py 프로젝트: vlaci/salt
 def __init__(self, opts=None):
     self.opts = opts
     self.colors = get_colors(opts.no_colors is False)
예제 #15
0
파일: consist.py 프로젝트: bsemar/IntCont
# 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
파일: consist.py 프로젝트: DaveQB/salt
# 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
파일: __init__.py 프로젝트: bemehow/salt
 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
파일: __init__.py 프로젝트: Gowtham523/salt
 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: ',