Skip to content

Commit

Permalink
Fixes for recent mypy
Browse files Browse the repository at this point in the history
Including ALPN typing which was totally broken
  • Loading branch information
alex committed Jan 7, 2025
1 parent d3489af commit ff2cf66
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/OpenSSL/SSL.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ class _NoOverlappingProtocols:
_ALPNSelectCallback = Callable[
[
"Connection",
typing.Union[typing.List[bytes], _NoOverlappingProtocols],
typing.List[bytes],
],
None,
typing.Union[bytes, _NoOverlappingProtocols],
]
_CookieGenerateCallback = Callable[["Connection"], bytes]
_CookieVerifyCallback = Callable[["Connection", bytes], bool]
Expand Down Expand Up @@ -1889,7 +1889,7 @@ def __init__(
# Negotiation. These strings get copied at some point but it's well
# after the callback returns, so we have to hang them somewhere to
# avoid them getting freed.
self._alpn_select_callback_args = None
self._alpn_select_callback_args: Any = None

# Reference the verify_callback of the Context. This ensures that if
# set_verify is called again after the SSL object has been created we
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSSL/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from cryptography.hazmat.bindings.openssl.binding import Binding

StrOrBytesPath = Union[str, bytes, os.PathLike]
StrOrBytesPath = Union[str, bytes, os.PathLike[str], os.PathLike[bytes]]

binding = Binding()
ffi = binding.ffi
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSSL/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
rsa.RSAPublicKey,
]
_Key = Union[_PrivateKey, _PublicKey]
StrOrBytesPath = Union[str, bytes, PathLike]
StrOrBytesPath = Union[str, bytes, PathLike[str], PathLike[bytes]]
PassphraseCallableT = Union[bytes, Callable[..., bytes]]


Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ commands =

[testenv:py311-mypy]
deps =
mypy==1.1.1
mypy
skip_install = true
commands =
mypy src
Expand Down

0 comments on commit ff2cf66

Please sign in to comment.