A Python package for function execution status and spinner output
Project description
Formatter and Example
This project demonstrates the use of a Python decorator to format the output of functions, showing a running spinner, and indicating success or failure with colored and formatted text. It includes two files: formatter.py and example.py.
Example Output
Files
- formatter.py: This file contains the
format_outputdecorator that provides the desired formatting for function output. - example.py: This file demonstrates how to use the
format_outputdecorator by applying it to two example functions, one that succeeds and one that fails.
Features
- Spinner Animation: Displays a spinner animation while the function is running.
- Success/Failure Indication: Shows a green checkmark for successful completion and a red cross for failures.
- Exception Handling: Exceptions are displayed in red and underlined.
- Function Numbering: Each function is prefixed with a unique number.
- Text Formatting: Function names are displayed in bold and underlined.
- Separation of Outputs: Outputs from different functions are separated by a line for clarity.
Usage
1. formatter.py
The format_output decorator is defined in this file. It wraps a function to display the running spinner, success/failure message, and handle exceptions.
2. example.py
The example.py file demonstrates the use of the format_output decorator. It includes two functions, one that succeeds and one that fails, to showcase the decorator's functionality.
Running the Example
- Save formatter.py and example.py in the same directory.
- Run example.py using the command:
python example.py
You should see the spinner, success, and failure messages formatted as described, with appropriate separation and formatting for each function's output.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 TaskFormatter-1.0.0.tar.gz.
File metadata
- Download URL: TaskFormatter-1.0.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
717d2fdbc9d08bdf7b5b5bdd41b2e90bcbda06607629a47eac1a02d08490f5ef
|
|
| MD5 |
80618f175531f98179a15f4f8a786749
|
|
| BLAKE2b-256 |
5bba30dbc83b4dd7801b6b097b7f8487777c684afff388f8ff021f9e86cd98e0
|
File details
Details for the file TaskFormatter-1.0.0-py3-none-any.whl.
File metadata
- Download URL: TaskFormatter-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
223a649d11b7ece6797fe8f381bb468ac680d87e2fb95e0e8254dfa9c2112a6f
|
|
| MD5 |
991efa25f12ec3a10e7da2353996bedc
|
|
| BLAKE2b-256 |
abd1f7c69bae6646ed4ece5795d5dbd4f91e0eb83a62758f683c8ae1a01f2def
|