lets-debug
Introduction
This package allows you to debug your Python code using terminal tools.
Installation
pip install lets-debug
Imports
from lets_debug import terminal, DecoratorTools
Reference
terminal
These are the available methods from terminal:
log(*args)
Prints every element passed in *args using blue color.
warn(*args)
Prints every element passed in *args using orange color.
error(*args)
Prints every element passed in *args using red color.
success(*args)
Prints every element passed in *args using green color.
clear()
Clear terminal or command prompt screen.
count(name='counter')
Counts number of times that name was called using this method. It is useful for couting number of times that a function is called. See the example bellow:
def greet():
terminal.log('Welcome!')
terminal.count('greet')
greet()
greet()
The output will be:
greet: 1
greet: 2
check_bool(boolean: bool, callback: Any)
Prints callback if boolean is False.
table(dictionary_list: List[Dict])
Prints dictionary_list as table.
DecoratorTools
These are the available methods from DecoratorTools class (all methods are static):
log(*args, type='log')
Prints every element passed in *args using custom color. type argument defines the color. The available types are 'log', 'warn', 'error', and 'success'.
count(*args)
Counts number of times that a function was called.
stopwatch(*args)
Counts how long a function takes to run.
override(*args, **kwargs)
Check if the current method exists in its parent object. See the example bellow:
class Human:
def walk(self):
terminal.log('Human is walking...')
class Person(Human):
@override
def walk(self):
terminal.log('Person is walking...')
This code is OK. But if you remove walk() from Human class, an error message will appear in the output.
If you want the program to stop in this situations, set get_error option to True:
@override(get_error=True)
def walk(self):
Contributions
Feel free to use this package and to contribute on this repository with your ideas!
Release files for lets-debug 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lets_debug-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Release files / lets_debug-0.0.4-py3-none-any.whl
| Download URL | lets_debug-0.0.4-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd602ba28cec0d5e41a16055409f33f498e7b0074f55e809816f0f1d87d4ebb5
|
|
BLAKE2b-256 checksum How to use checksums |
d3cb278e94ab2e67abeabd23f206eb4ba0a47250ec31b7f7defec8034e5be850
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.5
|