lsst.pex.config
17.0.1-2-g54f2ebc+8
|
Public Member Functions | |
def | __init__ (self, text, category) |
def | __str__ (self) |
Static Public Member Functions | |
def | colorize (val=None) |
Public Attributes | |
rawText | |
Static Public Attributes | |
categories | |
dictionary | colors |
A controller that determines whether strings should be colored. Parameters ---------- text : `str` Text content to print to a terminal. category : `str` Semantic category of the ``text``. See `categories` for possible values. Raises ------ RuntimeError Raised when the ``category`` is not a key of ``Color.categories``. Notes ----- The usual usage is ``Color(string, category)`` which returns a string that may be printed; categories are given by the keys of `Color.categories`. `Color.colorize` may be used to set or retrieve whether the user wants color. It always returns `False` when `sys.stdout` is not attached to a terminal.
Definition at line 30 of file history.py.
def lsst.pex.config.history.Color.__init__ | ( | self, | |
text, | |||
category | |||
) |
Definition at line 90 of file history.py.
def lsst.pex.config.history.Color.__str__ | ( | self | ) |
Definition at line 151 of file history.py.
|
static |
Get or set whether the string should be colorized. Parameters ---------- val : `bool` or `dict`, optional The value is usually a bool, but it may be a dict which is used to modify Color.categories Returns ------- shouldColorize : `bool` If `True`, the string should be colorized. A string **will not** be colorized if standard output or standard error are not attached to a terminal or if the ``val`` argument was `False`. Only strings written to a terminal are colorized.
Definition at line 113 of file history.py.
|
static |
Definition at line 55 of file history.py.
|
static |
Definition at line 75 of file history.py.
lsst.pex.config.history.Color.rawText |
Definition at line 96 of file history.py.