]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
chore: drop use of deprecated aliases
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 7 May 2025 01:54:21 +0000 (03:54 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 7 May 2025 18:16:21 +0000 (20:16 +0200)
26 files changed:
psycopg/psycopg/_acompat.py
psycopg/psycopg/_connection_base.py
psycopg/psycopg/_queries.py
psycopg/psycopg/_struct.py
psycopg/psycopg/abc.py
psycopg/psycopg/errors.py
psycopg/psycopg/pq/__init__.py
psycopg/psycopg/pq/_debug.py
psycopg/psycopg/pq/abc.py
psycopg/psycopg/pq/pq_ctypes.py
psycopg/psycopg/rows.py
psycopg/psycopg/types/array.py
psycopg/psycopg/types/composite.py
psycopg/psycopg/types/datetime.py
psycopg/psycopg/types/json.py
psycopg/psycopg/types/net.py
psycopg/psycopg/types/numeric.py
psycopg/psycopg/types/uuid.py
psycopg_pool/psycopg_pool/_acompat.py
psycopg_pool/psycopg_pool/_task.py
psycopg_pool/psycopg_pool/abc.py
psycopg_pool/psycopg_pool/sched.py
psycopg_pool/psycopg_pool/sched_async.py
tests/typing_example.py
tests/utils.py
tools/isort-psycopg/isort_psycopg.py

index de8d8de6afd34c543cf43ec8805e150c154424fa..04a5c6f2de9c12d41feba2dae864ea90bb617901 100644 (file)
@@ -13,8 +13,8 @@ from __future__ import annotations
 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
 
index 9a7754f552584d131e25d92eb2b65f5a3f7e3a5a..53d06cc4f477eaba87b9b688be7e1b0fe04d15c3 100644 (file)
@@ -8,11 +8,12 @@ from __future__ import annotations
 
 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
index 4da8a0d0b5ee889a6de1d22aa95fbb04fcc0f7ec..14950738b9de6c6804ecfc105ccea59fb81d7602 100644 (file)
@@ -7,9 +7,9 @@ Utility module to manipulate queries
 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
index ddbee086c50c7e9d1bc2a2d38bbd92f5acd26b02..4926f5d4f19796fe5b8c7d39bfef2d60c39b7bbe 100644 (file)
@@ -7,7 +7,8 @@ Utility functions to deal with binary structs.
 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
index 029df2118cae18c574d8b7fd276c665f4b5bd2e2..fbab53ff1bf83cedce38c5499369b741c50449a1 100644 (file)
@@ -6,8 +6,8 @@ Protocol objects representing different implementations of the same classes.
 
 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
index 0385daa6ccc6deb9c688ccba6c32ae3fad603450..be11e6c7caf5077fab8ba63ebfd2d6a63af9986f 100644 (file)
@@ -20,10 +20,10 @@ DBAPI-defined Exceptions are defined in the following hierarchy::
 
 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
index 4f242980de359b5a49b2789f18edaf94f761f1f6..4485f88b62d5cd36cf9c4d9e13a694f08accefc3 100644 (file)
@@ -13,7 +13,7 @@ from __future__ import annotations
 
 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
index 6fb389112be2b57d2ffc87c26e749c656368b152..3efd9a0841f60b780c42b5e2affd560eb53c6e4b 100644 (file)
@@ -30,8 +30,9 @@ Suggested usage::
 
 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
index f67a6611f9649a408e50fa689c3e238c7f25dbdc..bf4ae12bb9cc1db4f67989965bb03dbb3486430c 100644 (file)
@@ -6,8 +6,8 @@ Protocol objects to represent objects exposed by different pq implementations.
 
 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
index 207868b9d65b8f7acd70441cb6af2e431556daf7..d583960144de3cc860269044372fcde4185209a7 100644 (file)
@@ -17,10 +17,10 @@ import logging
 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
index c9c806eb4484b2c2944a235bbfc503a2e93e9218..b0c685507d89fcb93fa6f04274a24dc3597810f1 100644 (file)
@@ -7,10 +7,9 @@ psycopg row factories
 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
index 0b9465c4f44e90ecaea889098fcf76283f3acb14..ae46854812f57c82716b4d48a6766b950f93c378 100644 (file)
@@ -9,8 +9,9 @@ from __future__ import annotations
 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
index f72688191543b829dcbbf53baf8f561dceac5f06..22b14449cac7916ba0f0d4a567bbf1755337b8e3 100644 (file)
@@ -8,10 +8,10 @@ from __future__ import annotations
 
 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
index 1fcab4b9711cec676ae92e76d3385d5e67af71e6..1bcdc25f1a21542a6d23e9c12ef346c17289436f 100644 (file)
@@ -8,8 +8,9 @@ from __future__ import annotations
 
 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
index ec8516be5b95ec00d838e63f10bc80ec68da27b5..f35dd0a8a255238497715d7d1a567d5fa9a0eb26 100644 (file)
@@ -7,8 +7,9 @@ Adapters for JSON types.
 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
index ccc47c4ed918cc5dc0f6434712d5681765bcdb7e..8199908d661ebe5d1fe8e930b4c59e01c7c6f13c 100644 (file)
@@ -6,7 +6,8 @@ Adapters for network types.
 
 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
index 28fbc9aa1d4c6f2fab938360c2f82d380be14beb..3ff4df8ab7725fadda6ae6322ae46ff5940440f5 100644 (file)
@@ -10,8 +10,9 @@ import sys
 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
index 5963377466d391f0d0eb4d3ae2b1843b91d50dee..b094937add30742aa93b36b24da5e105c53d46e1 100644 (file)
@@ -6,7 +6,8 @@ Adapters for the UUID type.
 
 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
index 4ec60afe361851a7048e0efe298f52729fa060ba..03ff960b82fe33a26ac75910be3dc0637be516b3 100644 (file)
@@ -15,8 +15,8 @@ import queue
 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
 
index 7629d1c460d161375662e6c0c8dde82d6fc4da39..8e4b9bd60c81f5504fef04a46119c4aab184461f 100644 (file)
@@ -6,8 +6,9 @@ Task for Scheduler and AsyncScheduler
 
 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)
index 19b225041fc9cda8f2b403a3a3863877656243e7..5a14c42be216bc4902e9095a627afb741ab9f723 100644 (file)
@@ -6,8 +6,8 @@ Types used in the psycopg_pool package
 
 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
 
index 6fc4e2b91b74ee9e607de2c9569c50435b5a3b6a..6f2ece88b6841b359cfd504f7a8173118eab92ef 100644 (file)
@@ -20,7 +20,8 @@ from __future__ import annotations
 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
index 3db6533d6c85bf49650444ffc0749bbc77035e5d..11298e50b5dfd2d147c8e384c95253a462e59744 100644 (file)
@@ -17,7 +17,8 @@ from __future__ import annotations
 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
index 01cd4602679edd0df8e596b9c4fd3a5a1de7c45d..ae0747449dafbf212cf89ff01cebba84c2fd9455 100644 (file)
@@ -2,9 +2,9 @@
 
 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
index 0cdba8bf33df48d665dbd963bba4f419edc454c5..3be844f5e268f8fed1a30b5cc5404561a6fc321d 100644 (file)
@@ -3,8 +3,8 @@ from __future__ import annotations
 import re
 import sys
 import operator
-from typing import Callable
 from contextlib import contextmanager
+from collections.abc import Callable
 
 import pytest
 
index ff5471604929abed8c3ca211c538c3d3f9c7af50..d2eaf45b949ec22b5cffe94a818bc8f0295d2311 100644 (file)
@@ -4,7 +4,8 @@ from __future__ import annotations
 
 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