This repository has been archived by the owner on May 18, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
338 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.