Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Commit

Permalink
New: Release 5.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iann838 committed Mar 17, 2022
1 parent b1d5274 commit aaae20d
Show file tree
Hide file tree
Showing 18 changed files with 338 additions and 334 deletions.
12 changes: 12 additions & 0 deletions docs/changelog/v5.md
@@ -1,5 +1,17 @@
# 5.x.x

## 5.3.0

- New `pyot.utils.functools` module.
- New utilities `async_property` and `async_cached_property` in `pyot.utils.functools`.
- New utility `sync_to_async` in `pyot.utils.sync`.
- Removed `PtrCache` from `pyot.utils.cache`, use `functools.lru_cache` instead.
- Removed `cached_property` from `pyot.utils.cache`, use `functools.cached_property` instead.
- Removed `pyot.utils.cache` module.
- Reworked `pyot.utils.lol.champion` (interfaces unchanged).
- Fixed some typings in util modules.
- Fixed a bug where `pyot.core.functional.lazy_property` is not caching returned values.

## 5.2.0

- `lol.MerakiItem` removed `meraki_` prefixed properties, non-prefixed properties will replace them. To keep having access to `lol.Item`s properties, use the `item` property instead.
Expand Down
4 changes: 4 additions & 0 deletions docs/cores/configuration.md
Expand Up @@ -9,6 +9,10 @@ These configurations generally stays all packed in a single file (generally call
- Adding `pyot` to Django's `INSTALLED_APPS` by following Django integration guide.
- Or any way that would cause imports on these configurations files.

{% hint style='tip' %}
If an integration of Pyot to another framework is needed. General integration guides are provided for Django, FastAPI and Celery projects at the **Integrations** page. These guides does not require to be strictly followed and only serves for reference purposes.
{% endhint %}

## Model Conf

Module: `pyot.conf.model`
Expand Down
8 changes: 4 additions & 4 deletions docs/cores/installation.md
Expand Up @@ -25,8 +25,8 @@ pip install git+https://github.com/paaksing/Pyot.git
Depending on the need, installation of extras may be needed:

```shell
pip install pyot[diskcache] # installs: ["diskcache>=5.1", "asgiref>=3.2"]
pip install pyot[redis] # installs: ["aioredis<2.0"]
pip install pyot[mongodb] # installs: ["motor>=2.3"]
pip install pyot[test] # installs: ["typeguard>=2.13"]
pip install pyot[diskcache] # installs: ["diskcache>=5.1", "asgiref>=3.2"]
pip install pyot[redis] # installs: ["aioredis<2.0"]
pip install pyot[mongodb] # installs: ["motor>=2.3"]
pip install pyot[test] # installs: ["typeguard>=2.13"]
```
2 changes: 1 addition & 1 deletion docs/cores/objects.md
Expand Up @@ -17,6 +17,7 @@ Some internal info has been hidden, to learn more please review source code inst
### _class_ PyotStaticBase

Metaclass: `PyotMetaClass`

Extends: `PyotRoutingBase`

Definitions:
Expand Down Expand Up @@ -51,7 +52,6 @@ Methods:
## Pyot Core

Base class: `PyotCoreBase`
Extend class: `PyotStaticBase`

Inherits all functionalities of `PyotStaticBase`. This type of objects has the ability to request for data on pipelines.

Expand Down
93 changes: 0 additions & 93 deletions docs/utils/cache.md

This file was deleted.

89 changes: 89 additions & 0 deletions docs/utils/functools.md
@@ -0,0 +1,89 @@
# Functools

Module: `pyot.utils.functools`

### _class_ async_cached_property

> Async equivalent of `functools.cached_property`, takes an async method and
> converts it to a cached property that returns an awaitable with the return value.
>
> Usage:
> ```
> class A:
> @async_cached_property
> async def b(self):
> ...
>
> a = A()
> await a.b
> ```
Extends:
* `pyot.utils.functools.async_property`
* `Generic`

Definitions:
* `__get__` -> `Awaitable[~R]`
* `instance`: `None`
* `cls`: `None`
* `__init__` -> `None`
* `func`: `Callable[..., Awaitable[~R]]`
* `name`: `None`
* `__new__` -> `None`
* `cls`: `None`
* `args`: `None`
* `kwds`: `None`
* `__set__` -> `None`
* `obj`: `None`
* `value`: `None`
* `__set_name__` -> `None`
* `owner`: `None`
* `name`: `None`

Methods:
* _asyncmethod_ `proxy` -> `Awaitable[~R]`
* `instance`: `None`


### _class_ async_property

> Async equivalent of `property`, takes an async method and
> converts it to a property that returns an awaitable with the return value.
>
> Usage:
> ```
> class A:
> @async_property
> async def b(self):
> ...
>
> a = A()
> await a.b
> ```
Extends:
* `Generic`

Definitions:
* `__get__` -> `Awaitable[~R]`
* `instance`: `None`
* `cls`: `None`
* `__init__` -> `None`
* `func`: `Callable[..., Awaitable[~R]]`
* `name`: `None`
* `__new__` -> `None`
* `cls`: `None`
* `args`: `None`
* `kwds`: `None`
* `__set__` -> `None`
* `obj`: `None`
* `value`: `None`
* `__set_name__` -> `None`
* `owner`: `None`
* `name`: `None`

Methods:
* _asyncmethod_ `proxy` -> `Awaitable[~R]`
* `instance`: `None`


35 changes: 20 additions & 15 deletions docs/utils/lol/champion.md
Expand Up @@ -2,38 +2,43 @@

Module: `pyot.utils.lol.champion`

### _asyncfunction_ `fill_champion_summary` -> `None`
* `cache`: `pyot.utils.cache.PtrCache`
> Fill champion summary data to cache.
### _class_ ChampionKeysCache

Definitions:
* `__init__` -> `None`
* `__str__` -> `str`

### _asyncfunction_ `id_by_key` -> `None`
* `value`: `None`

### _constant_ `champion_keys_cache`: `ChampionKeysCache()`


### _asyncfunction_ `id_by_key` -> `int`
* `value`: `str`
> Get champion id by key

### _asyncfunction_ `id_by_name` -> `None`
* `value`: `None`
### _asyncfunction_ `id_by_name` -> `int`
* `value`: `str`
> Get champion id by name

### _asyncfunction_ `key_by_id` -> `None`
* `value`: `None`
### _asyncfunction_ `key_by_id` -> `str`
* `value`: `int`
> Get champion key by id

### _asyncfunction_ `key_by_name` -> `None`
* `value`: `None`
### _asyncfunction_ `key_by_name` -> `str`
* `value`: `str`
> Get champion key by name

### _asyncfunction_ `name_by_id` -> `None`
* `value`: `None`
### _asyncfunction_ `name_by_id` -> `str`
* `value`: `int`
> Get champion name by id

### _asyncfunction_ `name_by_key` -> `None`
* `value`: `None`
### _asyncfunction_ `name_by_key` -> `str`
* `value`: `str`
> Get champion name by key

8 changes: 4 additions & 4 deletions docs/utils/parsers.md
Expand Up @@ -3,18 +3,18 @@
Module: `pyot.utils.parsers`

### _function_ `from_bytes` -> `~T`
* `obj`: `None`
* `obj`: `bytes`
* `class_of_t`: `Union[Type[~T], NoneType] = None`
> Convert a byte string to python object.

### _function_ `safejson` -> `None`
### _function_ `safejson` -> `Any`
* `content`: `str`
> Same as json.loads with graceful fallback by returning original string

### _function_ `to_bytes` -> `ByteString`
* `obj`: `None`
### _function_ `to_bytes` -> `bytes`
* `obj`: `Any`
> Convert a python object to byte string.

4 changes: 2 additions & 2 deletions docs/utils/runners.md
Expand Up @@ -9,8 +9,8 @@ Module: `pyot.utils.runners`

### _asyncfunction_ `thread_run` -> `~R`
* `func`: `Callable[..., ~R]`
* `args`: `None`
* `kwargs`: `None`
* `args`: `Sequence[Any]`
* `kwargs`: `Mapping[str, Any]`
> Run a blocking function in a thread.

7 changes: 6 additions & 1 deletion docs/utils/sync.md
Expand Up @@ -4,6 +4,11 @@ Module: `pyot.utils.sync`

### _function_ `async_to_sync` -> `Callable[..., ~R]`
* `func`: `Callable[..., Awaitable[~R]]`
> Wraps `asyncio.run` on an async function making it sync callable. Can be used as decorator @async_to_sync
> Wraps `asyncio.run` on an async function converting to sync callable. Can be used as decorator @async_to_sync

### _function_ `sync_to_async` -> `Callable[..., Awaitable[~R]]`
* `func`: `Callable[..., ~R]`
> Wraps `thread_run` on a blocking function converting to async by running in a thread. Can be used as decorator @sync_to_async

0 comments on commit aaae20d

Please sign in to comment.