Skip to content

Commit

Permalink
Pass mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Aug 25, 2024
1 parent eebd8c0 commit 1b68224
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
5 changes: 4 additions & 1 deletion jaraco/crypto/cert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from __future__ import annotations

import ctypes
from typing import ClassVar

from .support import find_library

Expand Down Expand Up @@ -50,7 +53,7 @@ class BIO(ctypes.Structure):


class X509(ctypes.Structure):
_fields_ = [] # type: ignore
_fields_: ClassVar[list[tuple[str, ctypes._CData]]] = []

def get_serial_number(self):
asn1_i = lib.X509_get_serialNumber(ctypes.byref(self))
Expand Down
24 changes: 12 additions & 12 deletions jaraco/crypto/cipher.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ def finalize(self, data=None):
return b"".join(self.out_data)


evp.get_cipherbyname.argtypes = (ctypes.c_char_p,) # type: ignore
evp.get_cipherbyname.restype = ctypes.POINTER(CipherType) # type: ignore
evp.get_cipherbyname.argtypes = (ctypes.c_char_p,)
evp.get_cipherbyname.restype = ctypes.POINTER(CipherType)


# https://www.openssl.org/docs/man3.1/man3/EVP_CipherInit_ex.html
Expand All @@ -130,16 +130,16 @@ def finalize(self, data=None):
ctypes.c_char_p, # out[m]
ctypes.POINTER(ctypes.c_int), # outl
)
evp.EncryptInit_ex.argtypes = ( # type: ignore
evp.DecryptInit_ex.argtypes # type: ignore
) = _init_args[:2] + _init_args[3:5]
evp.CipherInit_ex.argtypes = _init_args # type: ignore
evp.EncryptUpdate.argtypes = ( # type: ignore
evp.DecryptUpdate.argtypes # type: ignore
) = evp.CipherUpdate.argtypes = _update_args # type: ignore
evp.EncryptFinal_ex.argtypes = ( # type: ignore
evp.DecryptFinal_ex.argtypes # type: ignore
) = evp.CipherFinal_ex.argtypes = _final_args # type: ignore
evp.EncryptInit_ex.argtypes = evp.DecryptInit_ex.argtypes = (
_init_args[:2] + _init_args[3:5]
)
evp.CipherInit_ex.argtypes = _init_args
evp.EncryptUpdate.argtypes = evp.DecryptUpdate.argtypes = evp.CipherUpdate.argtypes = (
_update_args
)
evp.EncryptFinal_ex.argtypes = evp.DecryptFinal_ex.argtypes = (
evp.CipherFinal_ex.argtypes
) = _final_args

evp.lib.EVP_CIPHER_CTX_new.argtypes = None
evp.lib.EVP_CIPHER_CTX_new.restype = ctypes.POINTER(Cipher)
Expand Down
7 changes: 5 additions & 2 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ enable_error_code = ignore-without-code
# Support namespace packages per https://github.com/python/mypy/issues/14057
explicit_package_bases = True

# Disable overload-overlap due to many false-positives
disable_error_code = overload-overlap
disable_error_code =
# Disable overload-overlap due to many false-positives
overload-overlap,
# This package has too many dynamically assigned attributes
attr-defined,
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,3 @@ namespaces = true


[tool.setuptools_scm]


[tool.pytest-enabler.mypy]
# Disabled due to jaraco/skeleton#143

0 comments on commit 1b68224

Please sign in to comment.