diff options
author | ikeikeikeike / ikedat / Tatsuo Ikeda <jp.ne.co.jp@gmail.com> | 2021-12-07 18:58:57 +0900 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2022-01-11 13:57:25 +0100 |
commit | 32bfe4007e4284b95a58be9f655c8aee605c712a (patch) | |
tree | 4c24f90666450cf00b63bea7be9f931a8790bee6 /rsa/key.py | |
parent | 5b377fb093ae3b7e5b1eaeec732ee429488bd662 (diff) | |
download | rsa-git-32bfe4007e4284b95a58be9f655c8aee605c712a.tar.gz |
Tiny fix to Incompatible types in assignment
Diffstat (limited to 'rsa/key.py')
-rw-r--r-- | rsa/key.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -47,6 +47,9 @@ log = logging.getLogger(__name__) DEFAULT_EXPONENT = 65537 +T = typing.TypeVar("T", bound="AbstractKey") + + class AbstractKey: """Abstract superclass for private and public keys.""" @@ -64,7 +67,7 @@ class AbstractKey: self.mutex = threading.Lock() @classmethod - def _load_pkcs1_pem(cls, keyfile: bytes) -> "AbstractKey": + def _load_pkcs1_pem(cls: typing.Type[T], keyfile: bytes) -> T: """Loads a key in PKCS#1 PEM format, implement in a subclass. :param keyfile: contents of a PEM-encoded file that contains @@ -76,7 +79,7 @@ class AbstractKey: """ @classmethod - def _load_pkcs1_der(cls, keyfile: bytes) -> "AbstractKey": + def _load_pkcs1_der(cls: typing.Type[T], keyfile: bytes) -> T: """Loads a key in PKCS#1 PEM format, implement in a subclass. :param keyfile: contents of a DER-encoded file that contains @@ -102,7 +105,7 @@ class AbstractKey: """ @classmethod - def load_pkcs1(cls, keyfile: bytes, format: str = "PEM") -> "AbstractKey": + def load_pkcs1(cls: typing.Type[T], keyfile: bytes, format: str = "PEM") -> T: """Loads a key in PKCS#1 DER or PEM format. :param keyfile: contents of a DER- or PEM-encoded file that contains |