Beispiel #1
0
def load_debug_deps():
    """ Try loading printdebug.DebugColrPrinter. If successful, replace
        the global `debug` function with DebugColrPrinter.debug.
    """
    global debug
    try:
        from printdebug import DebugColrPrinter
    except ImportError:
        return None
    debug = DebugColrPrinter().debug
Beispiel #2
0
    Converts doxygen-style markdown files to github/normal-style markdown files.
    -Christopher Welborn 08-11-2019
"""

import os
import re
import sys

from colr import (
    Colr as C,
    auto_disable as colr_auto_disable,
    docopt,
)

from printdebug import DebugColrPrinter
debugprinter = DebugColrPrinter()
debugprinter.enable(('-D' in sys.argv) or ('--debug' in sys.argv))
debug = debugprinter.debug
debug_err = debugprinter.debug_err

colr_auto_disable()

NAME = 'ColrC - Markdown Generator'
VERSION = '0.0.2'
VERSIONSTR = f'{NAME} v. {VERSION}'
SCRIPT = os.path.split(os.path.abspath(sys.argv[0]))[1]
SCRIPTDIR = os.path.abspath(sys.path[0])
COLRDIR = os.path.abspath(os.path.join(SCRIPTDIR, '..'))
USAGESTR = f"""{VERSIONSTR}
    Usage:
        {SCRIPT} -h | -v
Beispiel #3
0
        -l,--list            : List any previously saved benchmarks.
        -n num,--number num  : Number of code runs per time test.
                               Default: {default_num}
        -r num,--repeat num  : Number of time to repeat the time test.
                               Default: {default_repeat}
        -p,--profile         : Profile the code while benchmarking.
        -S,--save            : Save the benchmark results in benchmarks.json.
        -v,--version         : Show version.
""".format(
    default_num=DEFAULT_NUMBER,
    default_repeat=DEFAULT_REPEAT,
    script=SCRIPT,
    versionstr=VERSIONSTR,
)

debugprinter = DebugColrPrinter()
debugprinter.disable()
debug = debugprinter.debug
debug_err = debugprinter.debug_err

pygments_lexer = get_lexer_by_name('python3')
pygments_formatter = Terminal256Formatter(bg='dark', style='monokai')

config = load_json_settings(CONFIG_FILE, default={'times': {}})

# Global git branch being worked on, set in `main()`.
git_branch = None

# An indented, rainbowed, dots Frame.
default_frames = (Frames.dots.prepend(' ' * 9).append(' ').as_rainbow())
Beispiel #4
0
        print('\nUnable to initialize django!', file=sys.stderr)
        sys.exit(1)
except ImportError as ex:
    import_err('django_init.py', ex, local=True)

try:
    import objectupdater
except ImportError as ex:
    import_err('objectupdater.py', ex, local=True)

try:
    from wp_main.utilities import utilities
except ImportError as ex:
    import_err('{e.name}'.format(e=ex), ex, local=True)

debugprinter = DebugColrPrinter()
debugprinter.disable()
debug = debugprinter.debug

NAME = 'WpUpdate'
VERSION = '0.0.1'
VERSIONSTR = '{} v. {}'.format(NAME, VERSION)
SCRIPT = os.path.split(os.path.abspath(sys.argv[0]))[1]
SCRIPTDIR = os.path.abspath(sys.path[0])

USAGESTR = """{versionstr}
    Usage:
        {script} -h | -L | -v                  [-D]
        {script} APP [-f | -l]                 [-D]
        {script} APP -A FILE...                [-D]
        {script} APP ID... -a [-F]             [-D]
Beispiel #5
0
from printdebug import DebugColrPrinter

from ..lib.util.archive import (
    Archive,
    ArchiveFile,
    archive_split_char,
)
from ..lib.util.config import (
    NotSet, )
from ..lib.util.parser import (
    MozaikMasterFile, )

from ..test import (
    data, )

debugprinter = DebugColrPrinter()
debugprinter.enable(bool(os.environ.get('TT_TEST_DEBUG', 0)))
debug = debugprinter.debug

try:
    TESTDIR = os.path.split(__file__)[0]
except NameError:
    TESTDIR = os.path.abspath(sys.path[0])


def part_compare_fmt(a, b, mark_keys=None):
    """ Return a formatted string with two parts side by side. """
    maxwidth = 80
    halfwidth = maxwidth // 2
    itemwidth = maxwidth // 4
    mark_keys = set(mark_keys or [])
Beispiel #6
0
from printdebug import get_lineinfo

if 'linux' in platform.system().lower():
    from printdebug import DebugColrPrinter as DebugPrinter
else:
    from printdebug import DebugPrinter


colr_auto_disable()

SCRIPT = os.path.split(os.path.abspath(sys.argv[0]))[1]
SCRIPTDIR = os.path.abspath(sys.path[0])

LOGFILE = os.path.join(SCRIPTDIR, 'tigertamer.log')
DEBUG = False
debugprinter = DebugPrinter()
if not getattr(debugprinter, 'debug_err', None):
    # Fixing old version of printdebug.
    def polyfill_debug_err(*args, **kwargs):
        kwargs['level'] = kwargs.get('level', 0) + 1
        args = (
            a if isinstance(a, C) else C(a, 'red')
            for a in args
        )
        return debugprinter.debug(*args, **kwargs)
    debugprinter.debug_err = polyfill_debug_err

logger = logging.getLogger('tigertamer')

formatter = logging.Formatter(
    '[%(levelname)s] %(message)s'
Beispiel #7
0
import os
import re
import sys

from colr import (
    ColrControl as C,
    Preset,
    auto_disable as colr_auto_disable,
    docopt,
)
from colr.controls import EraseMethod

from printdebug import DebugColrPrinter

debugprinter = DebugColrPrinter()
debug = debugprinter.debug
debug_err = debugprinter.debug_err
colr_auto_disable()

NAME = 'Replace Strings'
VERSION = '0.1.3'
VERSIONSTR = '{} v. {}'.format(NAME, VERSION)
SCRIPT = os.path.split(os.path.abspath(sys.argv[0]))[1]
SCRIPTDIR = os.path.abspath(sys.path[0])

SOURCE_EXTS = {
    '.asm',
    '.bash',
    '.c',
    '.coffee',