import queue
import asyncio
import threading
-from typing import Any, Callable, TypeAlias
-from collections.abc import Coroutine
+from typing import Any, TypeAlias
+from collections.abc import Callable, Coroutine
from ._compat import TypeVar
import sys
import logging
-from typing import TYPE_CHECKING, Callable, Generic, NamedTuple, TypeAlias
+from typing import TYPE_CHECKING, Generic, NamedTuple, TypeAlias
from weakref import ReferenceType, ref
from warnings import warn
from functools import partial
from collections import deque
+from collections.abc import Callable
from . import errors as e
from . import generators, postgres, pq
from __future__ import annotations
import re
-from typing import TYPE_CHECKING, Any, Callable, NamedTuple, TypeAlias, TypeGuard
+from typing import TYPE_CHECKING, Any, NamedTuple, TypeAlias, TypeGuard
from functools import lru_cache
-from collections.abc import Mapping, Sequence
+from collections.abc import Callable, Mapping, Sequence
from . import errors as e
from . import pq
from __future__ import annotations
import struct
-from typing import Callable, Protocol, TypeAlias, cast
+from typing import Protocol, TypeAlias, cast
+from collections.abc import Callable
from . import errors as e
from .abc import Buffer
from __future__ import annotations
-from typing import TYPE_CHECKING, Any, Callable, Protocol, TypeAlias, Union
-from collections.abc import Generator, Mapping, Sequence
+from typing import TYPE_CHECKING, Any, Protocol, TypeAlias, Union
+from collections.abc import Callable, Generator, Mapping, Sequence
from . import pq
from ._enums import PyFormat as PyFormat
from __future__ import annotations
-from typing import TYPE_CHECKING, Any, Callable, NoReturn, TypeAlias, TypeGuard
+from typing import TYPE_CHECKING, Any, NoReturn, TypeAlias, TypeGuard
from asyncio import CancelledError
from dataclasses import dataclass, field, fields
-from collections.abc import Sequence
+from collections.abc import Callable, Sequence
from .pq.abc import PGconn, PGresult
from .pq._enums import ConnStatus, DiagnosticField, PipelineStatus, TransactionStatus
import os
import logging
-from typing import Callable
+from collections.abc import Callable
from . import abc
from .misc import ConninfoOption, PGnotify, PGresAttDesc, error_message, version_pretty
import inspect
import logging
-from typing import Any, Callable
+from typing import Any
from functools import wraps
+from collections.abc import Callable
from . import PGconn, abc
from .misc import connection_summary
from __future__ import annotations
-from typing import TYPE_CHECKING, Any, Callable, Protocol, TypeAlias, Union
-from collections.abc import Sequence
+from typing import TYPE_CHECKING, Any, Protocol, TypeAlias, Union
+from collections.abc import Callable, Sequence
from ._enums import Format, Trace
from .._compat import Self
from os import getpid
from ctypes import POINTER, Array, addressof, byref, c_char_p, c_int, c_size_t, c_ulong
from ctypes import c_void_p, cast, create_string_buffer, py_object, string_at
-from typing import TYPE_CHECKING, Any, Callable
+from typing import TYPE_CHECKING, Any
from typing import cast as t_cast
from weakref import ref
-from collections.abc import Sequence
+from collections.abc import Callable, Sequence
from . import _pq_ctypes as impl
from .. import errors as e
from __future__ import annotations
import functools
-from typing import TYPE_CHECKING, Any, Callable, NamedTuple, NoReturn, Protocol
-from typing import TypeAlias
+from typing import TYPE_CHECKING, Any, NamedTuple, NoReturn, Protocol, TypeAlias
from collections import namedtuple
-from collections.abc import Sequence
+from collections.abc import Callable, Sequence
from . import errors as e
from . import pq
import re
import struct
from math import prod
-from typing import Any, Callable, cast
+from typing import Any, cast
from functools import cache
+from collections.abc import Callable
from .. import errors as e
from .. import postgres, pq
import re
import struct
-from typing import TYPE_CHECKING, Any, Callable, NamedTuple, cast
+from typing import TYPE_CHECKING, Any, NamedTuple, cast
from functools import cache
from collections import namedtuple
-from collections.abc import Iterator, Sequence
+from collections.abc import Callable, Iterator, Sequence
from .. import abc, postgres, pq, sql
from .._oids import TEXT_OID
import re
import struct
-from typing import TYPE_CHECKING, Any, Callable, cast
+from typing import TYPE_CHECKING, Any, cast
from datetime import date, datetime, time, timedelta, timezone
+from collections.abc import Callable
from .. import _oids
from ..pq import Format
from __future__ import annotations
import json
-from typing import Any, Callable, TypeAlias
+from typing import Any, TypeAlias
from functools import cache
+from collections.abc import Callable
from .. import _oids, abc
from .. import errors as e
from __future__ import annotations
-from typing import TYPE_CHECKING, Callable, TypeAlias
+from typing import TYPE_CHECKING, TypeAlias
+from collections.abc import Callable
from .. import _oids
from ..pq import Format
import struct
from abc import ABC, abstractmethod
from math import log
-from typing import TYPE_CHECKING, Any, Callable, DefaultDict, cast
+from typing import TYPE_CHECKING, Any, DefaultDict, cast
from decimal import Context, Decimal, DefaultContext
+from collections.abc import Callable
from .. import _oids
from .. import errors as e
from __future__ import annotations
-from typing import TYPE_CHECKING, Callable
+from typing import TYPE_CHECKING
+from collections.abc import Callable
from .. import _oids
from ..pq import Format
import asyncio
import logging
import threading
-from typing import Any, Callable, TypeAlias
-from collections.abc import Coroutine
+from typing import Any, TypeAlias
+from collections.abc import Callable, Coroutine
from ._compat import TypeVar
from __future__ import annotations
-from typing import Any, Callable
+from typing import Any
from dataclasses import dataclass, field
+from collections.abc import Callable
@dataclass(order=True)
from __future__ import annotations
-from typing import TYPE_CHECKING, Callable, TypeAlias, Union
-from collections.abc import Awaitable
+from typing import TYPE_CHECKING, TypeAlias, Union
+from collections.abc import Awaitable, Callable
from ._compat import TypeVar
import logging
from time import monotonic
from heapq import heappop, heappush
-from typing import Any, Callable
+from typing import Any
+from collections.abc import Callable
from ._task import Task
from ._acompat import Event, Lock
import logging
from time import monotonic
from heapq import heappop, heappush
-from typing import Any, Callable
+from typing import Any
+from collections.abc import Callable
from ._task import Task
from ._acompat import AEvent, ALock
from __future__ import annotations
-from typing import Any, Callable
+from typing import Any
from dataclasses import dataclass
-from collections.abc import Sequence
+from collections.abc import Callable, Sequence
from psycopg import AsyncConnection, AsyncCursor, AsyncServerCursor, Connection, Cursor
from psycopg import ServerCursor, connect, rows
import re
import sys
import operator
-from typing import Callable
from contextlib import contextmanager
+from collections.abc import Callable
import pytest
import re
import inspect
-from typing import Any, Callable, Iterable
+from typing import Any
+from collections.abc import Callable, Iterable
from isort.sorting import naturally