yasiu-native


Nameyasiu-native JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryNative utilities based only on python builtins. Timers, Decorators.
upload_time2023-01-14 20:24:50
maintainerGrzegorz Krug
docs_urlNone
authorGrzegorz Krug
requires_python>=3.7
licenseMIT
keywords time timeit measure time decorators
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 cauction 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-time/)

[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/)


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "yasiu-native",
    "maintainer": "Grzegorz Krug",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "kruggrzegorz@gmail.com",
    "keywords": "time,timeit,measure time,decorators",
    "author": "Grzegorz Krug",
    "author_email": "kruggrzegorz@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/31/3c/6485f6a883834a34a1d3c101aa0404823ba5dc3abc690356d6bdeec0ad55/yasiu-native-0.1.0.tar.gz",
    "platform": null,
    "description": "# Readme of `yasiu-native`\r\n\r\nModule with useful measure time decorators.\r\n\r\n## Installation\r\n\r\n```shell\r\npip install yasiu-native\r\n```\r\n\r\n## Time decorators\r\n\r\n- **measure_perf_time_decorator**\r\n\r\n  decorator that measures time using *time.perf_counter*\r\n\r\n\r\n- **measure_real_time_decorator**\r\n\r\n  decorator that measures time using *time.time*\r\n\r\n### Measuring time\r\n\r\n```py\r\nfrom yasiu_native.time import measure_perf_time_decorator\r\n\r\n\r\n@measure_perf_time_decorator()\r\ndef func():\r\n    ...\r\n\r\n\r\n@measure_perf_time_decorator(\">4.1f\")\r\ndef func():\r\n    ...\r\n\r\n\r\n@measure_perf_time_decorator(fmt=\">4.1f\")\r\ndef func():\r\n    ...\r\n```\r\n\r\n### Print buffering will impact your performance!\r\n\r\n- Use with cauction for multiple function calls\r\n\r\n## Flexible decorator\r\n\r\nDecorator that checks if decorated function was passed with `()` or not\r\n\r\n```python\r\nfrom yasiu_native.decorators import flexible_decorator\r\n\r\n\r\n@flexible_decorator\r\ndef custom_decorator(func, decor_variable):\r\n    def wrapper(*a, **kw):\r\n        print(f\"Decorated with {decor_variable}\")\r\n        return func(*a, **kw)\r\n\r\n    return wrapper\r\n\r\n\r\n@custom_decorator\r\ndef test_1():\r\n    pass\r\n\r\n\r\n@custom_decorator()\r\ndef test_2():\r\n    pass\r\n\r\n\r\n@custom_decorator(a=1)\r\ndef test_3(a=0):\r\n    pass\r\n\r\n```\r\n\r\n## Console execution timer\r\n\r\nnot here yet.\r\n\r\n# All packages\r\n\r\n[1. Native Package](https://pypi.org/project/yasiu-time/)\r\n\r\n[2. Math Package](https://pypi.org/project/yasiu-math/)\r\n\r\n[3. Image Package](https://pypi.org/project/yasiu-image/)\r\n\r\n[4. Pyplot visualisation Package](https://pypi.org/project/yasiu-vis/)\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Native utilities based only on python builtins. Timers, Decorators.",
    "version": "0.1.0",
    "split_keywords": [
        "time",
        "timeit",
        "measure time",
        "decorators"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "313c6485f6a883834a34a1d3c101aa0404823ba5dc3abc690356d6bdeec0ad55",
                "md5": "7ba4aa215a13f22b5d179d9d11d020ed",
                "sha256": "603979201d3b7fca347b07ea79764decb2e3d18a0a6826308f881689ff1799a5"
            },
            "downloads": -1,
            "filename": "yasiu-native-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7ba4aa215a13f22b5d179d9d11d020ed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 3905,
            "upload_time": "2023-01-14T20:24:50",
            "upload_time_iso_8601": "2023-01-14T20:24:50.750384Z",
            "url": "https://files.pythonhosted.org/packages/31/3c/6485f6a883834a34a1d3c101aa0404823ba5dc3abc690356d6bdeec0ad55/yasiu-native-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-14 20:24:50",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "yasiu-native"
}
        
Elapsed time: 0.02781s