Skip to main content

Some useful tools for Python development

Project description

minwei_tools

This tools contain to major function

  1. Dotter : Display animated text on screen during long missions
  2. re_result : A Rust-like approach to error handling

Install

pip install minwei_tools

Usage

  • Dotter

    alt text

    from minwei_tools import Dotter, piano, slash
    from time import sleep
    
    with Dotter(cycle = piano, message="Loading", delay=0.1, show_timer=1) as d:
        sleep(120)
    

    Also support an async dotter

    from minwei_tools import AsyncDotter
    from time import sleep
    
    import asyncio
    
    async def main():
        async with AsyncDotter("Thinking", show_timer=True, delay=0.1):
            await asyncio.sleep(120)
    
    asyncio.run(main())
    
  • rs_result

    from minwei_tools.rs_result import Result, Ok, Err
    
    def devide(a: int, b: int) -> Result[int, str]:
        if b == 0:
            return Err("Division by zero error")
        return Ok(a // b)
    
    """
    >>> result : Result[int, str] = devide(10, 0)
    >>> result.is_ok()
    False
    >>> result.is_err()
    >>> result : Result[int, str] = devide(10, 2)
    >>> result.is_ok()
    True
    >>> result.unwrap()
    5
    """
    
    result : Result[int, str] = devide(10, 0)
    match result:
        case Ok(value):
            print(f"Result: {value}")
        case Err(value):
            print(f"Error: {value}")
            
    result : Result[int, str] = devide(10, 2)
    match result:
        case Ok(value):
            print(f"Result: {value}")
        case Err(value):
            print(f"Error: {value}")
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minwei_tools-0.1.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minwei_tools-0.1.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file minwei_tools-0.1.2.tar.gz.

File metadata

  • Download URL: minwei_tools-0.1.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for minwei_tools-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c16831565f52a1dba2882eb1050cb992a463a42c7239c2f5da4a493c5226fc11
MD5 22e61034cea6568ccd1594bcaf98aff2
BLAKE2b-256 001424e5bfc4fac24995a47b201ea8dfdc51e1ccd8cf43c00e5d214744a00652

See more details on using hashes here.

File details

Details for the file minwei_tools-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: minwei_tools-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for minwei_tools-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f47cd76da0da76af5b90e10cfe079bf7beab3f80f4b15bf16ff63f320bae13ff
MD5 d0bc562565c3ee94c5044138544f2277
BLAKE2b-256 43fdecea542ff2f82cab2ba77d0f72ef3d456d4cb01a2e4dc37940951d7983a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page