🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

asyncpg-stubs

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asyncpg-stubs - pypi Package Compare versions

Comparing version
0.28.0
to
0.29.0
+18
asyncpg-stubs/_asyncio_compat.pyi
import sys
from asyncio import Future
from collections.abc import Awaitable, Generator
from typing import Any, TypeVar
from typing_extensions import TypeAlias
if sys.version_info < (3, 11):
from async_timeout import timeout as timeout_ctx
else:
from asyncio import timeout as timeout_ctx
_T = TypeVar('_T')
_FutureLike: TypeAlias = Future[_T] | Generator[Any, None, _T] | Awaitable[_T]
async def wait_for(
fut: _FutureLike[_T],
timeout: float | None,
) -> _T: ...
+1
-1

@@ -1,3 +0,3 @@

from typing_extensions import Final
from typing import Final
__version__: Final[str]
from _typeshed import StrPath
from asyncio import AbstractEventLoop
from typing import Any
from typing_extensions import TypedDict
from typing import Any, TypedDict

@@ -6,0 +5,0 @@ from . import connection, types

@@ -1,9 +0,6 @@

from asyncio import Future, StreamWriter
from collections.abc import Awaitable
import sys
from asyncio import StreamWriter
from pathlib import Path
from typing import TypeVar
from typing_extensions import Final
from typing import Final
_T = TypeVar('_T')
SYSTEM: Final[str]

@@ -13,5 +10,11 @@

async def wait_closed(stream: StreamWriter) -> None: ...
async def wait_for(
fut: Future[_T] | Awaitable[_T],
timeout: float | None,
) -> _T: ...
if sys.version_info < (3, 12):
from ._asyncio_compat import wait_for as wait_for
else:
from asyncio import wait_for as wait_for
if sys.version_info < (3, 11):
from async_timeout import timeout as timeout_ctx
else:
from asyncio import timeout as timeout_ctx

@@ -1,2 +0,1 @@

from _typeshed import Self
from asyncio import AbstractEventLoop, Future, Protocol

@@ -6,4 +5,4 @@ from collections.abc import Awaitable, Callable

from ssl import SSLContext
from typing import Any, NamedTuple
from typing_extensions import Final, Literal, TypeAlias
from typing import Any, Final, Literal, NamedTuple
from typing_extensions import Self, TypeAlias

@@ -25,3 +24,3 @@ from . import connection

@classmethod
def parse(cls: Self, sslmode: str | Self) -> Self: ...
def parse(cls, sslmode: str | Self) -> Self: ...

@@ -35,3 +34,2 @@ class _ConnectionParameters(NamedTuple):

direct_tls: bool
connect_timeout: float
server_settings: dict[str, str] | None

@@ -38,0 +36,0 @@ target_session_attrs: SessionAttribute

@@ -0,1 +1,2 @@

import contextlib
from asyncio import AbstractEventLoop

@@ -9,7 +10,17 @@ from collections.abc import (

Iterable,
Iterator,
Sequence,
)
from os import PathLike
from typing import Any, BinaryIO, Generic, NamedTuple, Protocol, TypeVar, overload
from typing_extensions import Literal, TypeAlias
from typing import (
Any,
BinaryIO,
Generic,
Literal,
NamedTuple,
Protocol,
TypeVar,
overload,
)
from typing_extensions import TypeAlias

@@ -37,3 +48,3 @@ from . import (

_SSLType: TypeAlias = connect_utils._ParsedSSLType | _SSLStringValues | bool
_HostType: TypeAlias = list[str] | str
_HostType: TypeAlias = list[str] | tuple[str] | str
_PortListType: TypeAlias = list[int | str] | list[int] | list[str]

@@ -82,2 +93,7 @@ _PortType: TypeAlias = _PortListType | int | str

class _QueryLogger(Protocol):
def __call__(
self, __record: LoggedQuery
) -> Awaitable[None] | Generator[Any, None, None] | None: ...
class ConnectionMeta(type):

@@ -96,2 +112,3 @@ def __instancecheck__(cls, instance: object) -> bool: ...

'_stmts_to_close',
'_stmt_cache_enabled',
'_listeners',

@@ -111,2 +128,3 @@ '_server_version',

'_source_traceback',
'_query_loggers',
'__weakref__',

@@ -130,2 +148,4 @@ )

def remove_termination_listener(self, callback: _TerminationListener) -> None: ...
def add_query_logger(self, callback: _QueryLogger) -> None: ...
def remove_query_logger(self, callback: _QueryLogger) -> None: ...
def get_server_pid(self) -> int: ...

@@ -317,2 +337,3 @@ def get_server_version(self) -> types.ServerVersion: ...

encoding: str | None = ...,
where: str | None = ...,
) -> str: ...

@@ -327,2 +348,3 @@ async def copy_records_to_table(

timeout: float | None = ...,
where: str | None = ...,
) -> str: ...

@@ -352,2 +374,4 @@ async def set_type_codec(

async def reload_schema_state(self) -> None: ...
@contextlib.contextmanager
def query_logger(self, callback: _QueryLogger) -> Iterator[None]: ...

@@ -424,2 +448,11 @@ @overload

class LoggedQuery(NamedTuple):
query: str
args: Any
timeout: float | None
elapsed: float
exception: BaseException | None
conn_addr: tuple[str, int] | str
conn_params: connect_utils._ConnectionParameters
class ServerCapabilities(NamedTuple):

@@ -431,1 +464,3 @@ advisory_locks: bool

sql_close_all: bool
sql_copy_from_where: bool
jit: bool

@@ -1,4 +0,4 @@

from _typeshed import Self
from collections.abc import Generator, Sequence
from typing import Any, Generic, TypeVar, overload
from typing_extensions import Self

@@ -98,3 +98,3 @@ from . import connection as _connection, connresource

) -> None: ...
def __aiter__(self: Self) -> Self: ...
def __aiter__(self) -> Self: ...
async def __anext__(self) -> _Record: ...

@@ -101,0 +101,0 @@

@@ -299,2 +299,5 @@ from typing import ClassVar

class SQLJsonItemCannotBeCastToTargetTypeError(DataError):
sqlstate: ClassVar[str]
class IntegrityConstraintViolationError(_base.PostgresError):

@@ -793,2 +796,3 @@ sqlstate: ClassVar[str]

'PostgresLogMessage',
'ClientConfigurationError',
'InternalClientError',

@@ -798,2 +802,4 @@ 'OutdatedSchemaCacheError',

'UnsupportedClientFeatureError',
'TargetServerAttributeNotMatched',
'UnsupportedServerFeatureError',
# End from _base.pyi

@@ -1011,2 +1017,3 @@ 'ActiveSQLTransactionError',

'SQLJsonArrayNotFoundError',
'SQLJsonItemCannotBeCastToTargetTypeError',
'SQLJsonMemberNotFoundError',

@@ -1013,0 +1020,0 @@ 'SQLJsonNumberNotFoundError',

@@ -1,3 +0,3 @@

from _typeshed import Self
from typing import Any, ClassVar, TypeVar
from typing_extensions import Self

@@ -11,2 +11,3 @@ __all__ = (

'PostgresLogMessage',
'ClientConfigurationError',
'InternalClientError',

@@ -17,2 +18,3 @@ 'OutdatedSchemaCacheError',

'TargetServerAttributeNotMatched',
'UnsupportedServerFeatureError',
)

@@ -51,5 +53,3 @@

@classmethod
def new(
cls: type[Self], fields: dict[str, str], query: str | None = ...
) -> Self: ...
def new(cls, fields: dict[str, str], query: str | None = ...) -> Self: ...

@@ -73,6 +73,8 @@ class FatalPostgresError(PostgresError): ...

) -> None: ...
def with_msg(self: Self, msg: str) -> Self: ...
def with_msg(self, msg: str) -> Self: ...
class ClientConfigurationError(InterfaceError, ValueError): ...
class DataError(InterfaceError, ValueError): ...
class UnsupportedClientFeatureError(InterfaceError): ...
class UnsupportedServerFeatureError(InterfaceError): ...

@@ -79,0 +81,0 @@ class InterfaceWarning(InterfaceMessage, UserWarning):

@@ -1,2 +0,2 @@

from typing_extensions import Final
from typing import Final

@@ -15,1 +15,2 @@ from . import protocol

def is_domain_type(typeinfo: protocol.Record) -> bool: ...
def is_composite_type(typeinfo: protocol.Record) -> bool: ...

@@ -8,2 +8,4 @@ import uuid

def get_text_codec(self) -> CodecInfo: ...
def get_json_decoder(self) -> object: ...
def get_json_encoder(self) -> object: ...

@@ -10,0 +12,0 @@ @final

import builtins
from _typeshed import Self
from collections.abc import Iterator, Sequence
from typing import SupportsFloat, overload
from typing_extensions import Literal, SupportsIndex, TypeAlias
from typing import Literal, SupportsFloat, SupportsIndex, overload
from typing_extensions import Self, TypeAlias

@@ -25,3 +24,3 @@ __all__ = (

def frombytes(
cls: type[Self],
cls,
bytes_: builtins.bytes | None = ...,

@@ -36,3 +35,3 @@ bitlength: int | None = ...,

def from_int(
cls: type[Self],
cls,
x: int,

@@ -52,3 +51,3 @@ length: int,

def __new__(
cls: type[Self],
cls,
x: SupportsFloat | SupportsIndex | str | builtins.bytes | builtins.bytearray,

@@ -64,5 +63,3 @@ y: SupportsFloat | SupportsIndex | str | builtins.bytes | builtins.bytearray,

__slots__ = ()
def __new__(
cls: type[Self], high: Sequence[float], low: Sequence[float]
) -> Self: ...
def __new__(cls, high: Sequence[float], low: Sequence[float]) -> Self: ...
@property

@@ -75,3 +72,3 @@ def high(self) -> Point: ...

__slots__ = ()
def __new__(cls: type[Self], A: float, B: float, C: float) -> Self: ...
def __new__(cls, A: float, B: float, C: float) -> Self: ...
@property

@@ -86,3 +83,3 @@ def A(self) -> float: ...

__slots__ = ()
def __new__(cls: type[Self], p1: Sequence[float], p2: Sequence[float]) -> Self: ...
def __new__(cls, p1: Sequence[float], p2: Sequence[float]) -> Self: ...
@property

@@ -115,3 +112,3 @@ def p1(self) -> Point: ...

__slots__ = ()
def __new__(cls: type[Self], center: Point, radius: float) -> Self: ...
def __new__(cls, center: Point, radius: float) -> Self: ...
@property

@@ -118,0 +115,0 @@ def center(self) -> Point: ...

@@ -1,5 +0,13 @@

from _typeshed import Self
import contextlib
from asyncio import AbstractEventLoop
from collections.abc import AsyncIterable, Callable, Generator, Iterable, Sequence
from collections.abc import (
AsyncIterable,
Callable,
Generator,
Iterable,
Iterator,
Sequence,
)
from typing import Any, Generic, Protocol, TypeVar, overload
from typing_extensions import Self

@@ -53,2 +61,4 @@ from . import (

) -> None: ...
def add_query_logger(self, callback: connection._QueryLogger) -> None: ...
def remove_query_logger(self, callback: connection._QueryLogger) -> None: ...
def get_server_pid(self) -> int: ...

@@ -240,2 +250,3 @@ def get_server_version(self) -> types.ServerVersion: ...

encoding: str | None = ...,
where: str | None = ...,
) -> str: ...

@@ -250,2 +261,3 @@ async def copy_records_to_table(

timeout: float | None = ...,
where: str | None = ...,
) -> str: ...

@@ -275,2 +287,4 @@ async def set_type_codec(

async def reload_schema_state(self) -> None: ...
@contextlib.contextmanager
def query_logger(self, callback: connection._QueryLogger) -> Iterator[None]: ...

@@ -318,5 +332,2 @@ class PoolConnectionHolder(Generic[_Record]):

'_connect_kwargs',
'_working_addr',
'_working_config',
'_working_params',
'_holders',

@@ -486,2 +497,3 @@ '_initialized',

encoding: str | None = ...,
where: str | None = ...,
) -> str: ...

@@ -496,2 +508,3 @@ async def copy_records_to_table(

timeout: float | None = ...,
where: str | None = ...,
) -> str: ...

@@ -510,4 +523,4 @@ def acquire(

async def expire_connections(self) -> None: ...
def __await__(self: Self) -> Generator[Any, None, Self | None]: ...
async def __aenter__(self: Self) -> Self: ...
def __await__(self) -> Generator[Any, None, Self | None]: ...
async def __aenter__(self) -> Self: ...
async def __aexit__(self, *exc: object) -> None: ...

@@ -514,0 +527,0 @@

@@ -7,4 +7,14 @@ import asyncio

from hashlib import md5, sha256
from typing import Any, ClassVar, Generic, NewType, TypeVar, overload
from typing_extensions import Final, Literal, TypeAlias, final
from typing import (
Any,
ClassVar,
Final,
Generic,
Literal,
NewType,
TypeVar,
final,
overload,
)
from typing_extensions import TypeAlias

@@ -42,2 +52,3 @@ import asyncpg.pgproto.pgproto

typeschema: str,
typeinfos: Iterable[object],
typekind: str,

@@ -72,2 +83,3 @@ encoder: Callable[[Any], Any],

closed: bool
prepared: bool
name: str

@@ -94,2 +106,3 @@ query: str

def mark_closed(self) -> None: ...
def mark_unprepared(self) -> None: ...
def __reduce__(self) -> Any: ...

@@ -204,2 +217,3 @@

) -> PreparedStatementState[_OtherRecord]: ...
async def close_portal(self, portal_name: str, timeout: _TimeoutType) -> None: ...
async def query(self, *args: object, **kwargs: object) -> str: ...

@@ -212,12 +226,2 @@ def resume_writing(self, *args: object, **kwargs: object) -> Any: ...

__pyx_vtable__: Any
def __init__(
self,
name: str,
schema: str,
kind: str,
type: int,
format: int,
xformat: int,
c_encoder: object,
) -> None: ...
def __reduce__(self) -> Any: ...

@@ -234,2 +238,3 @@

typekind: str,
typeinfos: Iterable[object],
encoder: Callable[[ConnectionSettings, WriteBuffer, object], object],

@@ -236,0 +241,0 @@ decoder: Callable[..., object],

from re import Pattern
from typing_extensions import Final
from typing import Final

@@ -4,0 +4,0 @@ from .types import ServerVersion

from enum import Enum
from typing import Any
from typing_extensions import Final, Literal, TypeAlias
from typing import Any, Final, Literal
from typing_extensions import TypeAlias

@@ -5,0 +5,0 @@ from . import connection as _connection, connresource

Metadata-Version: 2.1
Name: asyncpg-stubs
Version: 0.28.0
Version: 0.29.0
Summary: asyncpg stubs

@@ -9,3 +9,3 @@ Home-page: https://github.com/bryanforbes/asyncpg-stubs

Author-email: bryan@reigndropsfall.net
Requires-Python: >=3.7,<4.0
Requires-Python: >=3.8,<4.0
Classifier: Development Status :: 4 - Beta

@@ -15,3 +15,2 @@ Classifier: Intended Audience :: Developers

Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8

@@ -21,5 +20,7 @@ Classifier: Programming Language :: Python :: 3.9

Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Dist: asyncpg (>=0.28,<0.29)
Requires-Dist: typing-extensions (>=4.2.0,<5.0.0)
Requires-Dist: async-timeout (>=4.0.3) ; python_version < "3.12"
Requires-Dist: asyncpg (>=0.29,<0.30)
Requires-Dist: typing-extensions (>=4.7.0,<5.0.0)
Description-Content-Type: text/markdown

@@ -30,4 +31,6 @@

[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://github.com/bryanforbes/asyncpg-stubs/blob/master/LICENSE)
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![Checked with pyright](https://img.shields.io/badge/pyright-checked-informational.svg)](https://github.com/microsoft/pyright/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

@@ -34,0 +37,0 @@

[tool.poetry]
name = "asyncpg-stubs"
version = "0.28.0"
version = "0.29.0"
description = "asyncpg stubs"

@@ -19,15 +19,16 @@ homepage = "https://github.com/bryanforbes/asyncpg-stubs"

[tool.poetry.dependencies]
python = "^3.7"
asyncpg = ">=0.28,<0.29"
typing-extensions = "^4.2.0"
python = "^3.8"
asyncpg = ">=0.29,<0.30"
typing-extensions = "^4.7.0"
async-timeout = { version = ">=4.0.3", python = "<3.12" }
[tool.poetry.group.dev.dependencies]
black = "23.3.0"
pre-commit = "2.21.0"
mypy = "1.4.1"
ruff = "0.0.277"
black = "23.10.1"
pre-commit = "3.5.0"
mypy = "1.6.1"
ruff = "0.1.4"
[tool.black]
line-length = 88
target-version = ["py37"]
target-version = ["py38"]
skip-string-normalization = true

@@ -55,3 +56,3 @@ include = '\.pyi?$'

line-length = 88
target-version = "py37"
target-version = "py38"

@@ -79,3 +80,3 @@ [tool.ruff.per-file-ignores]

[tool.mypy]
python_version = "3.7"
python_version = "3.8"
incremental = true

@@ -89,3 +90,3 @@ strict = true

pythonVersion = "3.7"
pythonVersion = "3.8"
reportUnnecessaryTypeIgnoreComment = "warning"

@@ -92,0 +93,0 @@ typeCheckingMode = "strict"

# asyncpg-stubs
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://github.com/bryanforbes/asyncpg-stubs/blob/master/LICENSE)
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![Checked with pyright](https://img.shields.io/badge/pyright-checked-informational.svg)](https://github.com/microsoft/pyright/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

@@ -7,0 +9,0 @@