]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
⬆️ Upgrade mypy and tweak internal type annotations (#5398)
authorSebastián Ramírez <tiangolo@gmail.com>
Thu, 15 Sep 2022 13:26:21 +0000 (15:26 +0200)
committerGitHub <noreply@github.com>
Thu, 15 Sep 2022 13:26:21 +0000 (13:26 +0000)
fastapi/dependencies/utils.py
fastapi/routing.py
pyproject.toml

index cdc48c339dc507fd1938f9206d73c8e0176acaac..64a6c127654c0e0027182cad82c15630a39ef4c8 100644 (file)
@@ -426,22 +426,22 @@ def is_coroutine_callable(call: Callable[..., Any]) -> bool:
         return inspect.iscoroutinefunction(call)
     if inspect.isclass(call):
         return False
-    call = getattr(call, "__call__", None)
-    return inspect.iscoroutinefunction(call)
+    dunder_call = getattr(call, "__call__", None)
+    return inspect.iscoroutinefunction(dunder_call)
 
 
 def is_async_gen_callable(call: Callable[..., Any]) -> bool:
     if inspect.isasyncgenfunction(call):
         return True
-    call = getattr(call, "__call__", None)
-    return inspect.isasyncgenfunction(call)
+    dunder_call = getattr(call, "__call__", None)
+    return inspect.isasyncgenfunction(dunder_call)
 
 
 def is_gen_callable(call: Callable[..., Any]) -> bool:
     if inspect.isgeneratorfunction(call):
         return True
-    call = getattr(call, "__call__", None)
-    return inspect.isgeneratorfunction(call)
+    dunder_call = getattr(call, "__call__", None)
+    return inspect.isgeneratorfunction(dunder_call)
 
 
 async def solve_generator(
index 710cb9734612724ac3339ef82bc177b0d51db1ee..7caf018b552324aee9c1bf5df700951d5e395cbc 100644 (file)
@@ -127,7 +127,7 @@ async def serialize_response(
         if is_coroutine:
             value, errors_ = field.validate(response_content, {}, loc=("response",))
         else:
-            value, errors_ = await run_in_threadpool(  # type: ignore[misc]
+            value, errors_ = await run_in_threadpool(
                 field.validate, response_content, {}, loc=("response",)
             )
         if isinstance(errors_, ErrorWrapper):
index 744854f2bab6634ac7f04dd0ae7cf17bb12eea59..c68951160acc4adbdabcd97f86a69665543d985a 100644 (file)
@@ -51,7 +51,7 @@ Documentation = "https://fastapi.tiangolo.com/"
 test = [
     "pytest >=7.1.3,<8.0.0",
     "pytest-cov >=2.12.0,<4.0.0",
-    "mypy ==0.910",
+    "mypy ==0.971",
     "flake8 >=3.8.3,<6.0.0",
     "black == 22.3.0",
     "isort >=5.0.6,<6.0.0",