improved many docstrings

This commit is contained in:
David Halter
2012-08-30 15:07:11 +02:00
parent d21044dca2
commit 83a5a4267f
7 changed files with 53 additions and 17 deletions

View File

@@ -1,5 +1,6 @@
import inspect
try:
# Use colorama for nicer console output.
from colorama import Fore, init
init()
except ImportError:
@@ -12,8 +13,13 @@ NOTICE = object()
WARNING = object()
ERROR = object()
debug_function = None
#debug_function = print_to_stdout
ignored_modules = []
def dbg(*args):
""" Looks at the stack, to see if a debug message should be printed. """
if debug_function:
frm = inspect.stack()[1]
mod = inspect.getmodule(frm[0])
@@ -35,8 +41,3 @@ def print_to_stdout(level, *args):
""" The default debug function """
msg = (Fore.GREEN + 'dbg: ' if level == NOTICE else Fore.RED + 'warning: ')
print(msg + ', '.join(str(a) for a in args) + Fore.RESET)
debug_function = None
#debug_function = print_to_stdout
ignored_modules = []