Useful tools for debugging Python code
Project description
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!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lets_debug-0.0.4-py3-none-any.whl.
File metadata
- Download URL: lets_debug-0.0.4-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd602ba28cec0d5e41a16055409f33f498e7b0074f55e809816f0f1d87d4ebb5
|
|
| MD5 |
8dc0f750d40cb15b1227719dc8fbae3f
|
|
| BLAKE2b-256 |
d3cb278e94ab2e67abeabd23f206eb4ba0a47250ec31b7f7defec8034e5be850
|