Skip to content

wisrovi/wutils

Repository files navigation

Wutils

WRedis is a library for specific functions for various Python projects.

Description

WRedis simplifies code reuse in Python projects. The library offers a number of modules that make using modules easier and simpler.

Installation

To install the library, use pip:

pip install wutils

Description

The wutils library offers a number of general-purpose modules.

License

MIT

This project is licensed under the MIT License. See the LICENSE file for details.

Examples

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.

Directory Structure

The examples are organized as follows:

examples/
    periodic_task/
        one_task.py

How to Use

  1. Navigate to the module folder of interest, e.g., examples/module1/.
  2. Open the README.md in that folder to get detailed information about the examples.
  3. Run the scripts directly using:
    python example1.py

Modules and Examples

periodic_task

Description

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()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors