Table of Contents
light-util is a library that provides lightweight tools for Python development.
You can use it easyly.
You can install it from pypi by pip.
pip install light-util
light-util can be used for both synchronous and asynchronous functions.
You can easily use light-util with a decorator.
from light_util import get_time
import time
import asyncio
if __name__ == "__main__":
@get_time
async def async_example_function(n):
time.sleep(2) # Simulate a delay
# raise ValueError("An example error")
return 1
@get_time
def example_function(n):
time.sleep(2) # Simulate a delay
# raise ValueError("An example error")
return 1
import asyncio
asyncio.run(async_example_function(1000000))
example_function(1000000)
# function [async_example_function] execution elapsed: 2.002s
# function [example_function] execution elapsed: 2.002s
Distributed under the Unlicense License. See LICENSE
for more information.
Zhihao Zhang - [email protected]
Project Link: https://github.com/zzhdbw/light-util