Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace more deprecated abstractproperty #7944

Merged
merged 1 commit into from Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Expand Up @@ -59,7 +59,6 @@ tests =[
[tool.coverage.report]
exclude_lines = [
"@abc.abstractmethod",
"@abc.abstractproperty",
"@typing.overload",
"if typing.TYPE_CHECKING",
]
Expand Down
3 changes: 2 additions & 1 deletion src/cryptography/hazmat/primitives/_asymmetric.py
Expand Up @@ -9,7 +9,8 @@


class AsymmetricPadding(metaclass=abc.ABCMeta):
@abc.abstractproperty
@property
@abc.abstractmethod
def name(self) -> str:
"""
A string naming this padding (e.g. "PSS", "PKCS1").
Expand Down
12 changes: 8 additions & 4 deletions src/cryptography/hazmat/primitives/_cipheralgorithm.py
Expand Up @@ -10,19 +10,22 @@


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).
Expand All @@ -32,7 +35,8 @@ def key_size(self) -> int:
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).
Expand Down
6 changes: 4 additions & 2 deletions src/cryptography/hazmat/primitives/asymmetric/dh.py
Expand Up @@ -170,7 +170,8 @@ def parameter_numbers(self) -> DHParameterNumbers:


class DHPublicKey(metaclass=abc.ABCMeta):
@abc.abstractproperty
@property
@abc.abstractmethod
def key_size(self) -> int:
"""
The bit length of the prime modulus.
Expand Down Expand Up @@ -203,7 +204,8 @@ def public_bytes(


class DHPrivateKey(metaclass=abc.ABCMeta):
@abc.abstractproperty
@property
@abc.abstractmethod
def key_size(self) -> int:
"""
The bit length of the prime modulus.
Expand Down
12 changes: 8 additions & 4 deletions src/cryptography/hazmat/primitives/hashes.py
Expand Up @@ -10,19 +10,22 @@


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
Expand All @@ -31,7 +34,8 @@ def block_size(self) -> typing.Optional[int]:


class HashContext(metaclass=abc.ABCMeta):
@abc.abstractproperty
@property
@abc.abstractmethod
def algorithm(self) -> HashAlgorithm:
"""
A HashAlgorithm that will be used by this context.
Expand Down