dbxml2rst.helper module

dbxml2rst.helpers

Some helpers, used by the dbxml2rst library

copyright:Copyright (C) 2017 Markus Heiser
license:GPL V3.0, see LICENSE for details.
class dbxml2rst.helper.CLI(*args, **kwargs)[source]

Bases: object

A comfortable commandline.

addCMDParser(func, cmdName=None)[source]
autocomplete()[source]

bash completion

To get in use of bash completion, install argcomplete:

pip install argcomplete

and add the following to your ~/.bashrc:

function _py_argcomplete() {
        local IFS=$(echo -e '\v')
        COMPREPLY=( $(IFS="$IFS" \
                COMP_LINE="$COMP_LINE" \
                COMP_POINT="$COMP_POINT" \
                _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \
                _ARGCOMPLETE=1 \
                "$1" 8>&1 9>&2 1>/dev/null) )
        if [[ $? != 0 ]]; then
                unset COMPREPLY
        fi
}
complete -o nospace -o default -F _py_argcomplete myCommandName
class dbxml2rst.helper.Container[source]

Bases: dict

container class

class dbxml2rst.helper.EntityContainer(fname, *args, **kwargs)[source]

Bases: dbxml2rst.helper.PContainer

Variant of PContainer used by the dbxml2rst for xml-entities.

addNew(attr, val)[source]
class dbxml2rst.helper.PContainer(fname, *args, **kwargs)[source]

Bases: dbxml2rst.helper.Container

Persistent container class.

The persistence is a json dump in the file given by constructor’s argument fname. It serialize only properties (objects) which are covered by the json.dump.

updFromFile()[source]
writeToFile()[source]
class dbxml2rst.helper.SimpleLog[source]

Bases: object

LOG_FORMAT = ‘%(logclass)s: %(message)s\n’
debug(message, **replace)[source]
error(message, **replace)[source]
info(message, **replace)[source]
msg(message, **replace)[source]
warn(message, **replace)[source]