]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Bump mypy from 0.910 to 0.961 (#2269)
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sun, 19 Jun 2022 10:50:04 +0000 (12:50 +0200)
committerGitHub <noreply@github.com>
Sun, 19 Jun 2022 10:50:04 +0000 (12:50 +0200)
* Bump mypy from 0.910 to 0.961

Bumps [mypy](https://github.com/python/mypy) from 0.910 to 0.961.
- [Release notes](https://github.com/python/mypy/releases)
- [Commits](https://github.com/python/mypy/compare/v0.910...v0.961)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
* Handle py37 iscoroutine type guard oddity

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: florimondmanca <florimond.manca@protonmail.com>
httpx/_compat.py
httpx/_transports/mock.py
requirements.txt

index 6d96ad27a1bc74b3c1a7b1d70340aa78b22da401..533fab46cfda81408f497542e6646aa4c6f12e26 100644 (file)
@@ -2,8 +2,13 @@
 The _compat module is used for code which requires branching between different
 Python environments. It is excluded from the code coverage checks.
 """
+import asyncio
 import ssl
 import sys
+import typing
+
+if typing.TYPE_CHECKING:  # pragma: no cover
+    import typing_extensions
 
 # Brotli support is optional
 # The C bindings in `brotli` are recommended for CPython.
@@ -38,3 +43,8 @@ else:
         context.options |= ssl.OP_NO_SSLv3
         context.options |= ssl.OP_NO_TLSv1
         context.options |= ssl.OP_NO_TLSv1_1
+
+
+def iscoroutine(coro: object) -> "typing_extensions.TypeGuard[typing.Coroutine]":
+    # Drop when this is resolved: https://github.com/python/typeshed/pull/8104
+    return asyncio.iscoroutine(coro)
index f61aee710114cb0b3740abd7c55eba2dfc5d2a92..4ff4913df0410d3f279544f2f27ff78f8d20a344 100644 (file)
@@ -1,6 +1,6 @@
-import asyncio
 import typing
 
+from .._compat import iscoroutine
 from .._models import Request, Response
 from .base import AsyncBaseTransport, BaseTransport
 
@@ -28,7 +28,7 @@ class MockTransport(AsyncBaseTransport, BaseTransport):
         # return the result.
 
         # https://simonwillison.net/2020/Sep/2/await-me-maybe/
-        if asyncio.iscoroutine(response):
+        if iscoroutine(response):
             response = await response
 
         return response
index 75077c498f64fe035e3702b4beaf5364d0676ce1..cffe00d071cf1118d8922906b6c234f8ddb42d27 100644 (file)
@@ -27,7 +27,7 @@ flake8==3.9.2
 flake8-bugbear==22.4.25
 flake8-pie==0.15.0; python_version>='3.7'
 isort==5.10.1
-mypy==0.910
+mypy==0.961
 types-certifi==2021.10.8.2
 pytest==7.1.2
 pytest-asyncio==0.18.3