diff --git a/jaraco/crypto/cert.py b/jaraco/crypto/cert.py index 8a35023..eb46879 100644 --- a/jaraco/crypto/cert.py +++ b/jaraco/crypto/cert.py @@ -1,4 +1,7 @@ +from __future__ import annotations + import ctypes +from typing import ClassVar from .support import find_library @@ -50,7 +53,7 @@ class BIO(ctypes.Structure): class X509(ctypes.Structure): - _fields_ = [] # type: ignore + _fields_: ClassVar[list[tuple[str, type[ctypes._CData]]]] = [] def get_serial_number(self): asn1_i = lib.X509_get_serialNumber(ctypes.byref(self)) diff --git a/jaraco/crypto/cipher.py b/jaraco/crypto/cipher.py index 9796658..3e3e49c 100644 --- a/jaraco/crypto/cipher.py +++ b/jaraco/crypto/cipher.py @@ -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 @@ -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) diff --git a/mypy.ini b/mypy.ini index efcb8cb..f65ddc3 100644 --- a/mypy.ini +++ b/mypy.ini @@ -13,3 +13,5 @@ explicit_package_bases = True disable_error_code = # Disable due to many false positives overload-overlap, + # This package has too many dynamically assigned attributes + attr-defined, diff --git a/pyproject.toml b/pyproject.toml index 395a110..e57f15e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,7 +74,3 @@ namespaces = true [tool.setuptools_scm] - - -[tool.pytest-enabler.mypy] -# Disabled due to jaraco/skeleton#143