Native utilities based only on python builtins. Timers, Decorators.
Project description
Readme of yasiu-native
Module with useful measure time decorators.
Installation
pip install yasiu-native
Time decorators
-
measure_perf_time_decorator
decorator that measures time using time.perf_counter
-
measure_real_time_decorator
decorator that measures time using time.time
Measuring time
from yasiu_native.time import measure_perf_time_decorator
@measure_perf_time_decorator()
def func():
...
@measure_perf_time_decorator(">4.1f")
def func():
...
@measure_perf_time_decorator(fmt=">4.1f")
def func():
...
Print buffering will impact your performance!
- Use with caution for multiple function calls
Flexible decorator
Decorator that checks if decorated function was passed with ()
or not
from yasiu_native.decorators import flexible_decorator
@flexible_decorator
def custom_decorator(func, decor_variable):
def wrapper(*a, **kw):
print(f"Decorated with {decor_variable}")
return func(*a, **kw)
return wrapper
@custom_decorator
def test_1():
pass
@custom_decorator()
def test_2():
pass
@custom_decorator(a=1)
def test_3(a=0):
pass
Console execution timer
not here yet.
All packages
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yasiu-native-0.1.1.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for yasiu_native-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ded08ce2b0f859a3c3991094e0795cd5ac41b3b7fa0348d57198e64cf23a0abc |
|
MD5 | 9350549e268870e49a021d4ecac32769 |
|
BLAKE2b-256 | c7c2b3e6de2410262f91d68c37731b8df12554538e765f508d1931f9f63b0ff3 |