semvec/pypi-packages huggingface dataset:
timework 0.4.3
measure / limit execution time using with-statements or decorators, cross-platform
Requires Python: >=3.5

# timework

[![pypi](https://img.shields.io/pypi/v/timework)](https://pypi.org/project/timework/)
[![codefactor](https://www.codefactor.io/repository/github/bugstop/python-timework/badge)](https://www.codefactor.io/repository/github/bugstop/python-timework)
[![coverage](https://coveralls.io/repos/github/bugstop/python-timework/badge.svg?branch=master)](https://coveralls.io/github/bugstop/python-timework?branch=master)
[![platform](https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-red)](https://github.com/bugstop/python-timework)

measure / limit execution time using with-statements or decorators, cross-platform

## Install

```bash
pip install timework
```

## Usage

```python
import timework as tw
```

### Statement `with`

#### timework.Stopwatch

> measure execution time

##### Example

```python
with tw.Stopwatch() as s:
    s.split()
    s.stop()
    s.restart()
    s.pause()
    s.resume()
    s.get_sec()
    s.get_hms()
```

##### Functions

```
get_sec()  get_hms()  restart()  pause()
resume()   split()    stop()
```

### Decorator `@`

#### timework.timer

> measure execution time

##### Example

```python
@tw.timer(logging.warning)
def your_function():
    ...
```

##### Arguments

```
output: A function object that specifies where to log messages.
        For example: print. timework.nil does not log messages.
detail: A boolean value, whether to print start and end time.
        This argument must be passed using keywords.
```

#### timework.limit

> limit execution time

##### Example

```python
@tw.limit(3)
def your_function():
    ...
```

##### Arguments

```
timeout: This argument sets the timeout limit of the decorated
         function. Once the run time of the process reaches
         [timeout] seconds but not yet finishes, then raise
         TimeoutException and stop the inner function.
```

## License

MIT License &copy; <a href="https://github.com/bugstop" style="color: black !important; text-decoration: none !important;">bugstop</a>
asyncweb 0.0.2
Asynchronous restful API
Requires Python: >=3.6

Asynchronous restful API
================================

[![PyPI](https://img.shields.io/pypi/v/pycaches?style=flat-square)](https://pypi.org/project/pycaches/)
[![Travis build on master](https://img.shields.io/travis/codingjerk/pycaches/master?style=flat-square)](https://travis-ci.org/github/codingjerk/pycaches)
[![Travis build on develop](https://img.shields.io/travis/codingjerk/pycaches/develop?label=develop&style=flat-square)](https://travis-ci.org/github/codingjerk/pycaches)
[![Codecov coverage](https://img.shields.io/codecov/c/gh/codingjerk/pycaches/develop?token=VHP5IBJTDJ&style=flat-square)](https://codecov.io/gh/codingjerk/pycaches/)
[![Chat on Gitter](https://img.shields.io/gitter/room/codingjerk/pycaches?style=flat-square)](https://gitter.im/codingjerk/pycaches)
![License](https://img.shields.io/pypi/l/pycaches?style=flat-square)

特色
------------

✓ 基于aiohttp的异步web后端，实现了路由层和视图层

✓ 使用设计较友好


安装
------------
```sh
pip install asyncweb
```

开始使用
---------------

“asyncweb”允许您在几个步骤中快速创建一个rest资源。
它自动在集合或单个项上创建资源路由;只需在方法上指定'_collection'或'_item'后缀即可。
使用python字典，结果/请求的序列化/反序列化是透明的。

使用案例

```python
from aiohttp import web
from asyncweb import RestView, routes


@routes.resource("/views")
class RestResource(RestView):

    # example call: GET to <server>/views?start=10
    async def on_get_collection(self, start=0) -> list:
        return [
            {"id": int(start) + 1, "value": 1},
            {"id": int(start) + 2, "value": 2},
        ]

    # example call: GET <server>/views/80
    async def on_get_item(self, id: str) -> dict:
        return self.key

    # example call: POST to <server>/views
    async def on_post_collection(self, body: dict) -> dict:
        return body


app = web.Application()
app.add_routes(routes)
app['key'] = [1, 2, 4, 5]

if __name__ == '__main__':
    web.run_app(app)
```