Skip to content

lucas-six/handy.py

Repository files navigation

Handy Python

Test Lint pre-commit

Collection of handy utils for Python.

Usage

pip install handy-utils
from handy_utils import xxx

Features

  • MapReduce on local host
  • Decorators
    • @attrs: Add attributes to a function/method.
    • @accepts and @returns: Enforce function argument and return types.
    • @singleton: Define a class with a singleton instance.
    • @logging_wall_time: Logging the run time (wall time) of the decorated function in seconds.
    • @logging_wall_time_ns: Logging the run time (wall time) of the decorated function in nanoseconds.
    • @logging_cpu_time: Logging the process time (CPU time) of the decorated function in seconds.
    • @logging_cpu_time_ns: Logging the process time (CPU time) of the decorated function in nanoseconds.
  • Networking
    • TCP server (both IPv4 and IPv6)
    • UDP server (IPv4)
  • Regex patterns
    • Regex pattern of Chinese characters
    • Find Chinese characters in a string
    • Regex pattern of float numbers
    • Float number validation
    • Regex pattern of IPv4 addresses
    • IPv4 address validation
    • Regex pattern of email addresses
    • Email address validation
    • Regex pattern of HTML elements or tags
    • HTML element or tag validation
    • Regex pattern of domain names (English, Chinese)
    • Domain name validation (English, Chinese)
    • Regex pattern of color RGB hex
    • Color RGB hex validation
    • Password strength validation
    • Regex pattern of license plate (Chinese mainland, Hongkong)
    • License plate validation (Chinese mainland, Hongkong)
    • Regex pattern of WeChat (Wexin) ID
    • WeChat (Wexin) ID validation
    • Regex pattern of QQ number (ID)
    • QQ number (ID) validation
    • Regex pattern of Chinese telephone number
    • Chinese telephone number validation
    • Regex pattern of Chinese ID number
    • Chinese ID number validation

Scripts

Run a GUI (based on Tcl/Tk) for RE (regular expression)

python -m handy_utils.re_tk

License

Apache License 2.0

About

Collection of handy utils for Python.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages