Skip to content

Commit c90a4ca

Browse files
Bump mypy
Also, warn_unused_configs requires turning off incremental mode using incremental = False. https://mypy.readthedocs.io/en/stable/config_file.html#confval-warn_unused_configs
1 parent 8bbb3f1 commit c90a4ca

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

ci-constraints-requirements.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,7 @@ markupsafe==2.1.5 ; python_full_version < '3.9'
8787
# via jinja2
8888
markupsafe==3.0.2 ; python_full_version >= '3.9'
8989
# via jinja2
90-
mypy==1.14.1 ; python_full_version < '3.9'
91-
# via cryptography (pyproject.toml)
92-
mypy==1.15.0 ; python_full_version >= '3.9'
90+
mypy==1.15.0
9391
# via cryptography (pyproject.toml)
9492
mypy-extensions==1.1.0
9593
# via mypy

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ sdist = ["build >=1.0.0"]
8787
# `click` included because its needed to type check `release.py`
8888
pep8test = [
8989
"ruff >=0.3.6",
90-
"mypy >=1.4",
90+
"mypy >=1.15",
9191
"check-sdist",
9292
"click >=8.0.1",
9393
]

src/cryptography/hazmat/bindings/_rust/x509.pyi

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ class Criticality:
228228
AGNOSTIC: Criticality
229229
NON_CRITICAL: Criticality
230230

231-
T = typing.TypeVar("T", contravariant=True, bound=x509.ExtensionType)
232-
233-
MaybeExtensionValidatorCallback = typing.Callable[
231+
type MaybeExtensionValidatorCallback[T: x509.ExtensionType] = typing.Callable[
234232
[
235233
Policy,
236234
x509.Certificate,
@@ -239,10 +237,12 @@ MaybeExtensionValidatorCallback = typing.Callable[
239237
None,
240238
]
241239

242-
PresentExtensionValidatorCallback = typing.Callable[
243-
[Policy, x509.Certificate, T],
244-
None,
245-
]
240+
type PresentExtensionValidatorCallback[T: x509.ExtensionType] = (
241+
typing.Callable[
242+
[Policy, x509.Certificate, T],
243+
None,
244+
]
245+
)
246246

247247
class ExtensionPolicy:
248248
@staticmethod
@@ -254,13 +254,13 @@ class ExtensionPolicy:
254254
def require_not_present(
255255
self, extension_type: type[x509.ExtensionType]
256256
) -> ExtensionPolicy: ...
257-
def may_be_present(
257+
def may_be_present[T: x509.ExtensionType](
258258
self,
259259
extension_type: type[T],
260260
criticality: Criticality,
261261
validator: MaybeExtensionValidatorCallback[T] | None,
262262
) -> ExtensionPolicy: ...
263-
def require_present(
263+
def require_present[T: x509.ExtensionType](
264264
self,
265265
extension_type: type[T],
266266
criticality: Criticality,

src/cryptography/utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ class CryptographyDeprecationWarning(UserWarning):
3232
# be more accurately named: Bufferable. It means something which has an
3333
# `__buffer__`. Which means you can't actually treat the result as a buffer
3434
# (and do things like take a `len()`).
35-
if sys.version_info >= (3, 9):
36-
Buffer = typing.Union[bytes, bytearray, memoryview]
37-
else:
38-
Buffer = typing.ByteString
35+
Buffer = typing.Union[bytes, bytearray, memoryview]
3936

4037

4138
def _check_bytes(name: str, value: bytes) -> None:

0 commit comments

Comments
 (0)