]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
chore: upgrade to mypy 1.0.0
authorDenis Laxalde <denis@laxalde.org>
Sat, 11 Feb 2023 09:51:35 +0000 (10:51 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 14 Feb 2023 14:38:49 +0000 (14:38 +0000)
Some "type: ignore" no longer needed, some need a different kind.

psycopg/psycopg/pq/__init__.py
psycopg/psycopg/types/numeric.py
psycopg/setup.py
tests/constraints.txt
tests/test_copy.py
tests/test_copy_async.py
tests/test_server_cursor.py
tests/test_server_cursor_async.py

index d5180b1b6682b7def219682b23c3e95a23ce26cc..0048ebbf1a451cfc9779225d12201b553549783d 100644 (file)
@@ -86,7 +86,7 @@ def import_from_libpq() -> None:
     # Pure Python implementation, slow and requires the system libpq installed.
     if not module and (not impl or impl == "python"):
         try:
-            from . import pq_ctypes as module  # type: ignore[no-redef]
+            from . import pq_ctypes as module  # type: ignore[assignment]
         except Exception as e:
             handle_error("python", e)
 
index 8e92392a33543bfb49e82ca65295cbd5628e146c..0b9fb112b58055d4e7c4908a41e80665c4f3c37c 100644 (file)
@@ -371,9 +371,9 @@ class NumericBinaryDumper(Dumper):
 
 def dump_decimal_to_numeric_binary(obj: Decimal) -> Union[bytearray, bytes]:
     sign, digits, exp = obj.as_tuple()
-    if exp == "n" or exp == "N":  # type: ignore[comparison-overlap]
+    if exp == "n" or exp == "N":
         return NUMERIC_NAN_BIN
-    elif exp == "F":  # type: ignore[comparison-overlap]
+    elif exp == "F":
         return NUMERIC_NINF_BIN if sign else NUMERIC_PINF_BIN
 
     # Weights of py digits into a pg digit according to their positions.
index b07339fcaef5506ce744963de0d7b64bc1598024..6af918aa062f53b57e23d62b61f6258fc1623ff9 100644 (file)
@@ -38,7 +38,7 @@ extras_require = {
     # Requirements to run the test suite
     "test": [
         "anyio >= 3.6.2",
-        "mypy >= 0.990",
+        "mypy >= 1.0",
         "pproxy >= 2.7",
         "pytest >= 6.2.5",
         "pytest-cov >= 3.0",
index d4b9ffc061edf6e8e4c57b7506aecdc043e0fcab..0e19f20b5295670ee65db032764cda00c06b7be3 100644 (file)
@@ -10,7 +10,7 @@ importlib-metadata == 1.4
 
 # From the 'test' extra
 anyio == 3.6.2
-mypy == 0.990
+mypy == 1.0.0
 pproxy == 2.7.0
 pytest == 6.2.5
 pytest-cov == 3.0.0
index 17cf2fc786b5b49cd6a3139a8de773273a271b5d..3a26f78631c4f7a210057c8a3d7be88f006bf6f2 100644 (file)
@@ -320,7 +320,7 @@ def test_subclass_adapter(conn, format):
     if format == Format.TEXT:
         from psycopg.types.string import StrDumper as BaseDumper
     else:
-        from psycopg.types.string import (  # type: ignore[no-redef]
+        from psycopg.types.string import (  # type: ignore[assignment]
             StrBinaryDumper as BaseDumper,
         )
 
index 79e97c0c6dbdbe40e80b675ec6dc9ff783767869..e49d8ff65b987408f84810cab9584eb6520abcd5 100644 (file)
@@ -312,7 +312,7 @@ async def test_subclass_adapter(aconn, format):
     if format == Format.TEXT:
         from psycopg.types.string import StrDumper as BaseDumper
     else:
-        from psycopg.types.string import (  # type: ignore[no-redef]
+        from psycopg.types.string import (  # type: ignore[assignment]
             StrBinaryDumper as BaseDumper,
         )
 
index f7b6c8ed63cdb093ee3cdc17cdc33cb82da1a2bb..385dcd774839ac981c5df2ea9c397a66c20dc6cb 100644 (file)
@@ -17,7 +17,7 @@ def test_init_row_factory(conn):
 
     with psycopg.ServerCursor(conn, "bar") as cur:
         assert cur.name == "bar"
-        assert cur.row_factory is rows.dict_row  # type: ignore
+        assert cur.row_factory is rows.dict_row
 
     with psycopg.ServerCursor(conn, "baz", row_factory=rows.namedtuple_row) as cur:
         assert cur.name == "baz"
index 8325639c1d8ec040513708df40ec7201aecf718d..99ff9cc76686775f1949af1ab955f12557ae70f8 100644 (file)
@@ -19,7 +19,7 @@ async def test_init_row_factory(aconn):
 
     async with psycopg.AsyncServerCursor(aconn, "bar") as cur:
         assert cur.name == "bar"
-        assert cur.row_factory is rows.dict_row  # type: ignore
+        assert cur.row_factory is rows.dict_row
 
     async with psycopg.AsyncServerCursor(
         aconn, "baz", row_factory=rows.namedtuple_row