| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c2c8d20 commit 348acbb
34 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | 1 | [flake8] | |
| 2 | + select = C90,E,F,W,Y0 | ||
| 2 | 3 | ignore = E402,E731,W503,W504,E252 | |
| 3 | - exclude = .git,__pycache__,build,dist,.eggs,.github,.local,.venv,.tox | ||
| 4 | + exclude = .git,__pycache__,build,dist,.eggs,.github,.local,.venv*,.tox | ||
| 5 | + per-file-ignores = *.pyi: F401, F403, F405, F811, E127, E128, E203, E266, E301, E302, E305, E501, E701, E704, E741, B303, W503, W504 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,3 +34,6 @@ docs/_build | |||
| 34 | 34 | /.eggs | |
| 35 | 35 | /.vscode | |
| 36 | 36 | /.mypy_cache | |
| 37 | + /.venv* | ||
| 38 | + /.tox | ||
| 39 | + /.vim | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,3 @@ | |||
| 1 | 1 | [submodule "asyncpg/pgproto"] | |
| 2 | 2 | path = asyncpg/pgproto | |
| 3 | - url = https://github.com/MagicStack/py-pgproto.git | ||
| 3 | + url = https://github.com/bryanforbes/py-pgproto.git | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,6 @@ | |||
| 1 | 1 | recursive-include docs *.py *.rst Makefile *.css | |
| 2 | 2 | recursive-include examples *.py | |
| 3 | 3 | recursive-include tests *.py *.pem | |
| 4 | - recursive-include asyncpg *.pyx *.pxd *.pxi *.py *.c *.h | ||
| 4 | + recursive-include asyncpg *.pyx *.pxd *.pxi *.py *.pyi *.c *.h | ||
| 5 | 5 | include LICENSE README.rst Makefile performance.png .flake8 | |
| 6 | + include asyncpg/py.typed | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,16 +4,17 @@ | |||
| 4 | 4 | # This module is part of asyncpg and is released under | |
| 5 | 5 | # the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0 | |
| 6 | 6 | ||
| 7 | + from __future__ import annotations | ||
| 7 | 8 | ||
| 8 | 9 | from .connection import connect, Connection # NOQA | |
| 9 | 10 | from .exceptions import * # NOQA | |
| 10 | 11 | from .pool import create_pool, Pool # NOQA | |
| 11 | 12 | from .protocol import Record # NOQA | |
| 12 | 13 | from .types import * # NOQA | |
| 13 | 14 | ||
| 14 | - | ||
| 15 | + from . import exceptions | ||
| 15 | 16 | from ._version import __version__ # NOQA | |
| 16 | 17 | ||
| 17 | 18 | ||
| 18 | - __all__ = ('connect', 'create_pool', 'Pool', 'Record', 'Connection') | ||
| 19 | + __all__ = ['connect', 'create_pool', 'Pool', 'Record', 'Connection'] | ||
| 19 | 20 | __all__ += exceptions.__all__ # NOQA | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,18 +4,28 @@ | |||
| 4 | 4 | # | |
| 5 | 5 | # SPDX-License-Identifier: PSF-2.0 | |
| 6 | 6 | ||
| 7 | + from __future__ import annotations | ||
| 7 | 8 | ||
| 8 | 9 | import asyncio | |
| 9 | 10 | import functools | |
| 10 | 11 | import sys | |
| 12 | + import typing | ||
| 13 | + | ||
| 14 | + if typing.TYPE_CHECKING: | ||
| 15 | + from . import compat | ||
| 11 | 16 | ||
| 12 | 17 | if sys.version_info < (3, 11): | |
| 13 | 18 | from async_timeout import timeout as timeout_ctx | |
| 14 | 19 | else: | |
| 15 | 20 | from asyncio import timeout as timeout_ctx | |
| 16 | 21 | ||
| 17 | 22 | ||
| 18 | - async def wait_for(fut, timeout): | ||
| 23 | + _T = typing.TypeVar('_T') | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + async def wait_for( | ||
| 27 | + fut: compat.Awaitable[_T], timeout: float | None | ||
| 28 | + ) -> _T: | ||
| 19 | 29 | """Wait for the single Future or coroutine to complete, with timeout. | |
| 20 | 30 | ||
| 21 | 31 | Coroutine will be wrapped in Task. | |
@@ -65,7 +75,7 @@ async def wait_for(fut, timeout): | |||
| 65 | 75 | return await fut | |
| 66 | 76 | ||
| 67 | 77 | ||
| 68 | - async def _cancel_and_wait(fut): | ||
| 78 | + async def _cancel_and_wait(fut: asyncio.Future[_T]) -> None: | ||
| 69 | 79 | """Cancel the *fut* future or task and wait until it completes.""" | |
| 70 | 80 | ||
| 71 | 81 | loop = asyncio.get_running_loop() | |
@@ -82,6 +92,6 @@ async def _cancel_and_wait(fut): | |||
| 82 | 92 | fut.remove_done_callback(cb) | |
| 83 | 93 | ||
| 84 | 94 | ||
| 85 | - def _release_waiter(waiter, *args): | ||
| 95 | + def _release_waiter(waiter: asyncio.Future[typing.Any], *args: object) -> None: | ||
| 86 | 96 | if not waiter.done(): | |
| 87 | 97 | waiter.set_result(None) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,4 +10,8 @@ | |||
| 10 | 10 | # supported platforms, publish the packages on PyPI, merge the PR | |
| 11 | 11 | # to the target branch, create a Git tag pointing to the commit. | |
| 12 | 12 | ||
| 13 | - __version__ = '0.30.0.dev0' | ||
| 13 | + from __future__ import annotations | ||
| 14 | + | ||
| 15 | + import typing | ||
| 16 | + | ||
| 17 | + __version__: typing.Final = '0.30.0.dev0' | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments