]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
chore: bump mypy to 1.4.1
authorDenis Laxalde <denis.laxalde@dalibo.com>
Wed, 12 Jul 2023 06:39:51 +0000 (08:39 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 21 Jul 2023 01:36:55 +0000 (02:36 +0100)
The issue previously mentioned about '# type: ignore[arg-type]' in
rows.py got resolved.

The new '# type: ignore[comparison-overlap]' in test_pipeline*.py are
due to https://github.com/python/mypy/issues/15509, a known regression
from Mypy 1.4. We use the workaround documented in the release blog post
https://mypy-lang.blogspot.com/2023/06/mypy-140-released.html (section
"Narrowing Enum Values Using “==”").

psycopg/psycopg/rows.py
psycopg/setup.py
tests/constraints.txt
tests/test_pipeline.py
tests/test_pipeline_async.py

index cb28b57ac9d9e131940488136a15d8c0d5bff5fa..2b240f7fb6accf47724ad9a41fc18622a405e31c 100644 (file)
@@ -121,8 +121,7 @@ def dict_row(cursor: "BaseCursor[Any, Any]") -> "RowMaker[DictRow]":
         return no_result
 
     def dict_row_(values: Sequence[Any]) -> Dict[str, Any]:
-        # https://github.com/python/mypy/issues/2608
-        return dict(zip(names, values))  # type: ignore[arg-type]
+        return dict(zip(names, values))
 
     return dict_row_
 
@@ -169,7 +168,7 @@ def class_row(cls: Type[T]) -> BaseRowFactory[T]:
             return no_result
 
         def class_row__(values: Sequence[Any]) -> T:
-            return cls(**dict(zip(names, values)))  # type: ignore[arg-type]
+            return cls(**dict(zip(names, values)))
 
         return class_row__
 
@@ -205,7 +204,7 @@ def kwargs_row(func: Callable[..., T]) -> BaseRowFactory[T]:
             return no_result
 
         def kwargs_row__(values: Sequence[Any]) -> T:
-            return func(**dict(zip(names, values)))  # type: ignore[arg-type]
+            return func(**dict(zip(names, values)))
 
         return kwargs_row__
 
index c8790650bb54224d191c15bb30b2b6b6e19ade46..c9dcd9782b84e6b9e79e09fde6edf478817686f4 100644 (file)
@@ -38,7 +38,7 @@ extras_require = {
     # Requirements to run the test suite
     "test": [
         "anyio >= 3.6.2",
-        "mypy >= 1.2",
+        "mypy >= 1.4.1",
         "pproxy >= 2.7",
         "pytest >= 6.2.5",
         "pytest-cov >= 3.0",
@@ -49,7 +49,7 @@ extras_require = {
         "black >= 23.1.0",
         "dnspython >= 2.1",
         "flake8 >= 4.0",
-        "mypy >= 1.2",
+        "mypy >= 1.4.1",
         "types-setuptools >= 57.4",
         "wheel >= 0.37",
     ],
index 3393d458fe855efd1b14d276243fa356119c219e..5ab24ed3cbe162bb4228f3e2545511d95e1f23cd 100644 (file)
@@ -10,7 +10,7 @@ importlib-metadata == 1.4
 
 # From the 'test' extra
 anyio == 3.6.2
-mypy == 1.2.0
+mypy == 1.4.1
 pproxy == 2.7.0
 pytest == 6.2.5
 pytest-cov == 3.0.0
index cfe39e07a9fe6a82a80083b1bc05a3c937ccbecc..0a0e93fab112829a1f23a09f5ba8f4d6956509d5 100644 (file)
@@ -51,7 +51,7 @@ def test_pipeline_reenter(conn: psycopg.Connection[Any]) -> None:
         assert p2 is p1
         assert p2.status == pq.PipelineStatus.ON
     assert conn._pipeline is None
-    assert p1.status == pq.PipelineStatus.OFF
+    assert p1.status == pq.PipelineStatus.OFF  # type: ignore[comparison-overlap]
 
 
 def test_pipeline_broken_conn_exit(conn: psycopg.Connection[Any]) -> None:
index 88c8d30bd3888bf8f26b328be6b974df92038626..488036a7e9ae9c6acc3bddccdb3daed989182415 100644 (file)
@@ -51,7 +51,7 @@ async def test_pipeline_reenter(aconn: psycopg.AsyncConnection[Any]) -> None:
         assert p2 is p1
         assert p2.status == pq.PipelineStatus.ON
     assert aconn._pipeline is None
-    assert p1.status == pq.PipelineStatus.OFF
+    assert p1.status == pq.PipelineStatus.OFF  # type: ignore[comparison-overlap]
 
 
 async def test_pipeline_broken_conn_exit(aconn: psycopg.AsyncConnection[Any]) -> None: