|
Cope 2.5.0
My personal "standard library" of all the generally useful code I've written for various projects over the years
|
| "var" Cope.debugging.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.
Usage:
debug() -> Prints a standard message to just tell you that it's getting called
debug('msg') -> Prints the string along with metadata
debug(var) -> Prints the variable name, type, and value
foo = debug(bar) -> Prints the variable name, type, and value, and returns the variable
@debug -> Use as a decorator to make note of when the function is called
Args:
var: The variable or variables to print
name: Manully specify the name of the variable
color: A number between 0-5, or 3 or 4 tuple/list of color data to print the debug message as
func: Ensure that the function the current call is called from is shown
file: Ensure that the file the current call is called from is shown
path: Show the full path of the current file, isntead of it's relative path
useRepr: Use __repr__() instead of __str__() on the given variable
limitToLine: If var is a list/tuple/dict/set, only show as many items as will fit on one terminal line, overriden by minItems
minItems: If var is a list/tuple/dict/set, don't truncate more than this many items
maxItems: If var is a list/tuple/dict/set, don't show more than this many items
stackTrace: Prints a neat stack trace of the current call
calls: If you're passing in a return from a function, say calls=2
background: Changes the background color instead of the forground color
active: Conditionally disables the function
clr: Alias of color
_repr: Alias of useRepr
trace: Alias of stackTrace
bg: Alias of background
Definition at line 281 of file debugging.py.