diff options
| author | Viicos <65306057+Viicos@users.noreply.github.com> | 2022-12-28 11:33:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-28 17:33:22 +0700 |
| commit | 0a02a7dacf8578ef77991663bbfbfa8770c8f952 (patch) | |
| tree | ecccb644a782bc308db617e1fd21e55f36d27baf /src | |
| parent | c28bfb352ab1f390900ef92856a9570aadd5fe2c (diff) | |
| download | cryptography-0a02a7dacf8578ef77991663bbfbfa8770c8f952.tar.gz | |
Replace more deprecated `abstractproperty` (#7944)
Diffstat (limited to 'src')
4 files changed, 22 insertions, 11 deletions
diff --git a/src/cryptography/hazmat/primitives/_asymmetric.py b/src/cryptography/hazmat/primitives/_asymmetric.py index c6862d931..fb815a0e9 100644 --- a/src/cryptography/hazmat/primitives/_asymmetric.py +++ b/src/cryptography/hazmat/primitives/_asymmetric.py @@ -9,7 +9,8 @@ import abc class AsymmetricPadding(metaclass=abc.ABCMeta): - @abc.abstractproperty + @property + @abc.abstractmethod def name(self) -> str: """ A string naming this padding (e.g. "PSS", "PKCS1"). diff --git a/src/cryptography/hazmat/primitives/_cipheralgorithm.py b/src/cryptography/hazmat/primitives/_cipheralgorithm.py index 6e6a79c11..138a104e2 100644 --- a/src/cryptography/hazmat/primitives/_cipheralgorithm.py +++ b/src/cryptography/hazmat/primitives/_cipheralgorithm.py @@ -10,19 +10,22 @@ import typing class CipherAlgorithm(metaclass=abc.ABCMeta): - @abc.abstractproperty + @property + @abc.abstractmethod def name(self) -> str: """ A string naming this mode (e.g. "AES", "Camellia"). """ - @abc.abstractproperty + @property + @abc.abstractmethod def key_sizes(self) -> typing.FrozenSet[int]: """ Valid key sizes for this algorithm in bits """ - @abc.abstractproperty + @property + @abc.abstractmethod def key_size(self) -> int: """ The size of the key being used as an integer in bits (e.g. 128, 256). @@ -32,7 +35,8 @@ class CipherAlgorithm(metaclass=abc.ABCMeta): class BlockCipherAlgorithm(metaclass=abc.ABCMeta): key: bytes - @abc.abstractproperty + @property + @abc.abstractmethod def block_size(self) -> int: """ The size of a block as an integer in bits (e.g. 64, 128). diff --git a/src/cryptography/hazmat/primitives/asymmetric/dh.py b/src/cryptography/hazmat/primitives/asymmetric/dh.py index bbdd485cd..33de0e551 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/dh.py +++ b/src/cryptography/hazmat/primitives/asymmetric/dh.py @@ -170,7 +170,8 @@ DHParametersWithSerialization = DHParameters class DHPublicKey(metaclass=abc.ABCMeta): - @abc.abstractproperty + @property + @abc.abstractmethod def key_size(self) -> int: """ The bit length of the prime modulus. @@ -203,7 +204,8 @@ DHPublicKeyWithSerialization = DHPublicKey class DHPrivateKey(metaclass=abc.ABCMeta): - @abc.abstractproperty + @property + @abc.abstractmethod def key_size(self) -> int: """ The bit length of the prime modulus. diff --git a/src/cryptography/hazmat/primitives/hashes.py b/src/cryptography/hazmat/primitives/hashes.py index 440b1a3e9..330c08dfa 100644 --- a/src/cryptography/hazmat/primitives/hashes.py +++ b/src/cryptography/hazmat/primitives/hashes.py @@ -10,19 +10,22 @@ from cryptography.exceptions import AlreadyFinalized class HashAlgorithm(metaclass=abc.ABCMeta): - @abc.abstractproperty + @property + @abc.abstractmethod def name(self) -> str: """ A string naming this algorithm (e.g. "sha256", "md5"). """ - @abc.abstractproperty + @property + @abc.abstractmethod def digest_size(self) -> int: """ The size of the resulting digest in bytes. """ - @abc.abstractproperty + @property + @abc.abstractmethod def block_size(self) -> typing.Optional[int]: """ The internal block size of the hash function, or None if the hash @@ -31,7 +34,8 @@ class HashAlgorithm(metaclass=abc.ABCMeta): class HashContext(metaclass=abc.ABCMeta): - @abc.abstractproperty + @property + @abc.abstractmethod def algorithm(self) -> HashAlgorithm: """ A HashAlgorithm that will be used by this context. |
