20. Autodoc Misc¶
- class accelerator.JobWithFile(job, name, sliced=False, extra=None)¶
- load(sliceno=None, encoding='bytes', default=<object object>)¶
blob.load this file
- class accelerator.DotDict(other=(), **kw)¶
Like an OrderedDict, but with d.foo as well as d[‘foo’]. (Names beginning with _ will have to use d[‘_foo’] syntax.) The normal dict.f (get, items, …) still return the functions.
- class accelerator.colourwrapper.Colour¶
Constants and functions for colouring output.
Available as constants named .COLOUR, functions named .colour and as direct calls on the object taking (value, *attrs). Colours are BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, These can be prefixed with BRIGHT and/or suffixed with BG. DEFAULT[BG] restores the default colour.
BOLD, FAINT, ITALIC, UNDERLINE, BLINK, INVERT, and STRIKE are also available. These can be prefixed with NOT to turn them off.
When using the constants, you should usually end with .RESET.
>>> colour.RED + 'foo' + colour.DEFAULT == colour.red('foo') == colour('foo', 'red')
colour(v, ‘red’, ‘bold’) and similar produce shorter sequences than other ways of combining several attributes.
- You can also use:
colour(v, ‘#RGB[bg]’) (0 - 5) (“256 colour” mode) colour(v, ‘#GG[bg]’) (00 - 1D) (grayscale from “256 colour” mode) colour(v, ‘XNN[bg]’) (00 - FF) (directly specifying a “256 colour” index) colour(v, ‘#RRGGBB[bg]’) (00 - FF) (but terminal support is not great)
Finally you can use names you put in the config file, some of which have default values. This also has a fallback system, so ‘foo/bar’ will fall back to ‘bar’ if ‘foo/bar’ is not defined. The defaults can be found in shell/__init__.py (search for “configuration defaults”).
In the configuration file you can also use <pre >post to just put those literal strings around the value. e.g. [colour]
grep/header = <e[4:3m >e[24m
if your terminal supports such extended codes.
The functions take force=True to return escape sequences even if colour is disabled and reset=True to reset all attributes before (and after) this sequence. (By default only the changed attributes are reset.)
- disable()¶
Turn colours off (make all constants empty)
- enable()¶
Turn colours on