Cope 2.5.0
My personal "standard library" of all the generally useful code I've written for various projects over the years
|
Functions & classes that can be useful for debugging. More...
Classes | |
class | Debug |
class | Undefined |
Functions | |
def | printArgs (*args, **kwargs) |
inspect.FrameInfo | get_metadata (int calls=1) |
Gets the meta data of the line you're calling this function from. | |
str | prettify (Union[tuple, list, set, dict] iterable, Literal['pprint', 'custom'] method='custom', int width=..., int depth=..., int indent=4) |
"Cast" a tuple, list, set or dict to a string, automatically shorten it if it's long, and display how long it is. | |
str | get_full_typename (var, bool add_braces=True) |
Get the name of the type of var, formatted nicely. | |
def | print_debug_count (int left_adjust=2) |
Increment and print the debug count. | |
str | get_varname (var, bool full=True, int calls=1, inspect.FrameInfo metadata=None) |
Gets the variable name given to var | |
str | get_adjusted_filename (str filename) |
Gets the filename of the file given, adjusted to be relative to the appropriate root directory. | |
str | get_context (inspect.FrameInfo metadata, bool func=None, bool file=None, bool path=None) |
Returns the stuff in the [] (the "context") | |
def | print_stack_trace (calls, func, file, path) |
'Union[1, 2, 3, False]' | called_as_decorator (funcName, metadata=None, calls=1) |
Return 1 if being used as a function decorator, 2 if as a class decorator, 3 if not sure, and False if neither. | |
def | print_context (int calls=1, bool func=True, bool file=True, bool path=False, color='context') |
"var" | debug (var=undefined, str name=None, color=..., Literal['pprint', 'custom', 'repr'] show='custom', bool func=None, bool file=None, bool path=None, int calls=1, bool active=True, bool background=False, int depth=..., int width=..., bool stackTrace=False, bool raiseError=False, clr=..., bool trace=False, bool bg=False, bool throwError=False, bool throw=False # Alias of raiseError) |
Print variable names and values for easy debugging. | |
def | debug (var=undefined, name=None, color=1, trace=False, calls=1) |
Variables | |
try : | |
logging | Log = logging.getLogger(__name__) |
repr | _repr = repr |
int | _debug_count = 0 |
None | root_dir = None |
bool | display_func = True |
bool | display_file = True |
bool | display_path = False |
int | verbosity = 1 |
Undefined | undefined = Undefined() |
Functions & classes that can be useful for debugging.