WRedis is a library for specific functions for various Python projects.
WRedis simplifies code reuse in Python projects. The library offers a number of modules that make using modules easier and simpler.
To install the library, use pip:
pip install wutilsThe wutils library offers a number of general-purpose modules.
MIT
This project is licensed under the MIT License. See the LICENSE file for details.
This directory contains a collection of examples that demonstrate the usage of various modules and functionalities in this project. Each subfolder corresponds to a specific module and includes example scripts to help you understand how to use that module.
The examples are organized as follows:
examples/
periodic_task/
one_task.py
- Navigate to the module folder of interest, e.g.,
examples/module1/. - Open the
README.mdin that folder to get detailed information about the examples. - Run the scripts directly using:
python example1.py
This module demonstrates specific functionalities.
- one_task.py: Example demonstrating functionality.
import time
from wutils.periodic_task import PeriodicTask
def my_firts_periodic_function():
print("Running my_firts_periodic_function task...")
def my_second_periodic_function():
print("Running my_second_periodic_function task...")
# Create the periodic task with a 5-second interval and verbose logging enabled
task = PeriodicTask(5, my_firts_periodic_function, verbose=True)
# Start the task
task.start()
# Wait for some time and stop the task
time.sleep(15)
task.stop()
# Create another task with verbose logging disabled
silent_task = PeriodicTask(2, my_second_periodic_function, verbose=False)
silent_task.start()
time.sleep(10)
silent_task.stop()