File: colors.py

package info (click to toggle)
python-plumbum 1.6.2-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 492 kB
  • ctags: 1,033
  • sloc: python: 5,397; makefile: 5
file content (23 lines) | stat: -rw-r--r-- 646 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""
This module imitates a real module, providing standard syntax
like from `plumbum.colors` and from `plumbum.colors.bg` to work alongside
all the standard syntax for colors.
"""

from __future__ import print_function
import sys
import os
import atexit

from plumbum.colorlib import ansicolors, main
_reset = ansicolors.reset.now
if __name__ == '__main__':
    main()
else: # Don't register an exit if this is called using -m!
    atexit.register(_reset)

# Oddly, the order here matters for Python2, but not Python3
sys.modules[__name__ + '.fg'] = ansicolors.fg
sys.modules[__name__ + '.bg'] = ansicolors.bg
sys.modules[__name__] = ansicolors