Metadata-Version: 2.1
Name: timepkg
Version: 0.3.2
Summary: Timing Utilities
Home-page: https://github.com/DavOstx7/timepkg.git
License: LICENSE
Author: dav ost
Author-email: davidost2003@gmail.com
Requires-Python: >=3.6,<4.0
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: dataclasses (>=0.6,<0.7) ; python_version < "3.7"
Requires-Dist: typing-extensions (>=4.1.1,<5.0.0) ; python_version < "3.10"
Project-URL: Repository, https://github.com/DavOstx7/timepkg.git
Description-Content-Type: text/markdown

# timepkg

The official repository fof the timepkg python package!

## Installation

```shell
pip install timepkg
```

## Usage

### Timekeeper

```python
import time
from timepkg import timekeeper


@timekeeper
def function():
    print("Hello World!")
    ...
    time.sleep(1)
    return "Goodbye!"


result = function()
print(result)
return_value, execution_time = function()
print(return_value, execution_time)
```

```bash
Hello World!
KeeperResult(return_value='Goodbye!', execution_time=1.0127643000000002)
Hello World!
Goodbye! 1.0116009
```

### Guardian

```python
import time
from timepkg import guardian


@guardian(save_metadata=True, guarded_exceptions=[ValueError])
def function():
    print("Hello World!")
    ...
    time.sleep(1)
    raise ValueError("Error!")


result = function()
print(result)
return_value, execution_time, (start_time, end_time, raised_exception) = function()
print(return_value, execution_time, start_time, end_time, raised_exception)
```

```bash
Hello World!
GuardianResult(return_value=None, execution_time=1.00541090965271, metadata=GuardianMetadata(start_time=1720282040.3592346, end_time=1720282041.3646455, raised_exception=ValueError('Error!',)))
Hello World!
None 1.0010006427764893 1720282041.3646455 1720282042.3656461 Error!
```


