from .connection import BaseConnection
from . import pq
-Format = pq.Format
-
class Transformer:
def __init__(self, context: AdaptContext = None): ...
@property
@property
def loaders(self) -> LoadersMap: ...
@property
- def pgresult(self) -> Optional["pq.proto.PGresult"]: ...
+ def pgresult(self) -> Optional[pq.proto.PGresult]: ...
@pgresult.setter
- def pgresult(self, result: Optional["pq.proto.PGresult"]) -> None: ...
- def set_row_types(self, types: Sequence[Tuple[int, Format]]) -> None: ...
+ def pgresult(self, result: Optional[pq.proto.PGresult]) -> None: ...
+ def set_row_types(
+ self, types: Sequence[Tuple[int, pq.Format]]
+ ) -> None: ...
def dump_sequence(
- self, objs: Iterable[Any], formats: Iterable[Format]
+ self, objs: Iterable[Any], formats: Iterable[pq.Format]
) -> Tuple[List[Optional[bytes]], List[int]]: ...
- def dump(self, obj: None, format: Format = Format.TEXT) -> MaybeOid: ...
- def get_dump_function(self, src: type, format: Format) -> DumpFunc: ...
- def lookup_dumper(self, src: type, format: Format) -> DumperType: ...
+ def dump(
+ self, obj: None, format: pq.Format = pq.Format.TEXT
+ ) -> MaybeOid: ...
+ def get_dump_function(self, src: type, format: pq.Format) -> DumpFunc: ...
+ def lookup_dumper(self, src: type, format: pq.Format) -> DumperType: ...
def load_row(self, row: int) -> Optional[Tuple[Any, ...]]: ...
def load_sequence(
self, record: Sequence[Optional[bytes]]
) -> Tuple[Any, ...]: ...
def load(
- self, data: bytes, oid: int, format: Format = Format.TEXT
+ self, data: bytes, oid: int, format: pq.Format = pq.Format.TEXT
) -> Any: ...
- def get_load_function(self, oid: int, format: Format) -> LoadFunc: ...
- def lookup_loader(self, oid: int, format: Format) -> LoaderType: ...
+ def get_load_function(self, oid: int, format: pq.Format) -> LoadFunc: ...
+ def lookup_loader(self, oid: int, format: pq.Format) -> LoaderType: ...
def register_builtin_c_loaders() -> None: ...
def connect(conninfo: str) -> PQGen[pq.proto.PGconn]: ...
from typing_extensions import Protocol
from . import pq
+from .pq import Format
if TYPE_CHECKING:
- from .connection import BaseConnection # noqa
- from .cursor import BaseCursor # noqa
- from .adapt import Dumper, Loader # noqa
- from .waiting import Wait, Ready # noqa
-
-# Part of the module interface (just importing it makes mypy unhappy)
-Format = pq.Format
+ from .connection import BaseConnection
+ from .cursor import BaseCursor
+ from .adapt import Dumper, Loader
+ from .waiting import Wait, Ready
EncodeFunc = Callable[[str], Tuple[bytes, int]]
DecodeFunc = Callable[[bytes], Tuple[str, int]]
...
@property
- def pgresult(self) -> Optional["pq.proto.PGresult"]:
+ def pgresult(self) -> Optional[pq.proto.PGresult]:
...
@pgresult.setter
- def pgresult(self, result: Optional["pq.proto.PGresult"]) -> None:
+ def pgresult(self, result: Optional[pq.proto.PGresult]) -> None:
...
@property