Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grzegorzkrug/yasiu-native
https://github.com/grzegorzkrug/yasiu-native
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/grzegorzkrug/yasiu-native
- Owner: GrzegorzKrug
- License: mit
- Created: 2023-01-04T09:49:55.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T22:01:37.000Z (over 1 year ago)
- Last Synced: 2024-11-10T05:43:02.268Z (4 days ago)
- Language: Python
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Readme of `yasiu-native`
Module with useful measure time decorators.
## Installation
```shell
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
```py
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
```python
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
[1. Native Package](https://pypi.org/project/yasiu-native/)
[2. Math Package](https://pypi.org/project/yasiu-math/)
[3. Image Package](https://pypi.org/project/yasiu-image/)
[4. Pyplot visualisation Package](https://pypi.org/project/yasiu-vis/)