Skip to content

Commit 27edc6e

Browse files
ff137jamshale
andauthored
🎨 Replace deprecated ABC decorators (openwallet-foundation#3357)
Signed-off-by: ff137 <[email protected]> Co-authored-by: jamshale <[email protected]>
1 parent eb52b05 commit 27edc6e

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

acapy_agent/messaging/base_message.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Base message."""
22

3-
from abc import ABC, abstractclassmethod, abstractmethod, abstractproperty
3+
from abc import ABC, abstractmethod
44
from enum import Enum, auto
55
from typing import TYPE_CHECKING, Optional, Type
66

@@ -23,26 +23,31 @@ class BaseMessage(ABC):
2323
the context of the plugin.
2424
"""
2525

26-
@abstractproperty
26+
@property
27+
@abstractmethod
2728
def _type(self) -> str:
2829
"""Return message type."""
2930

30-
@abstractproperty
31+
@property
32+
@abstractmethod
3133
def _id(self) -> str:
3234
"""Return message id."""
3335

34-
@abstractproperty
36+
@property
37+
@abstractmethod
3538
def _thread_id(self) -> Optional[str]:
3639
"""Return message thread id."""
3740

3841
@abstractmethod
3942
def serialize(self, msg_format: DIDCommVersion = DIDCommVersion.v1) -> dict:
4043
"""Return serialized message in format specified."""
4144

42-
@abstractclassmethod
45+
@classmethod
46+
@abstractmethod
4347
def deserialize(cls, value: dict, msg_format: DIDCommVersion = DIDCommVersion.v1):
4448
"""Return message object deserialized from value in format specified."""
4549

46-
@abstractproperty
50+
@property
51+
@abstractmethod
4752
def Handler(self) -> Type["BaseHandler"]:
4853
"""Return reference to handler class."""

acapy_agent/protocols/issue_credential/v2_0/formats/handler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""V2.0 issue-credential base credential format handler."""
22

33
import logging
4-
from abc import ABC, abstractclassmethod, abstractmethod
4+
from abc import ABC, abstractmethod
55
from typing import Mapping, Optional, Tuple
66

77
from .....core.error import BaseError
@@ -60,7 +60,8 @@ def get_format_identifier(self, message_type: str) -> str:
6060
def get_format_data(self, message_type: str, data: dict) -> CredFormatAttachment:
6161
"""Get credential format and attachment objects for use in cred ex messages."""
6262

63-
@abstractclassmethod
63+
@classmethod
64+
@abstractmethod
6465
def validate_fields(cls, message_type: str, attachment_data: dict) -> None:
6566
"""Validate attachment data for specific message type and format."""
6667

acapy_agent/protocols/present_proof/v2_0/formats/handler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""present-proof-v2 format handler - supports ANONCREDS, DIF and INDY."""
22

33
import logging
4-
from abc import ABC, abstractclassmethod, abstractmethod
4+
from abc import ABC, abstractmethod
55
from typing import Optional, Tuple
66

77
from .....core.error import BaseError
@@ -56,7 +56,8 @@ def get_format_identifier(self, message_type: str) -> str:
5656
def get_format_data(self, message_type: str, data: dict) -> PresFormatAttachment:
5757
"""Get presentation format and attach objects for use in pres_ex messages."""
5858

59-
@abstractclassmethod
59+
@classmethod
60+
@abstractmethod
6061
def validate_fields(cls, message_type: str, attachment_data: dict) -> None:
6162
"""Validate attachment data for specific message type and format."""
6263

acapy_agent/vc/ld_proofs/crypto/key_pair.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Base key pair class."""
22

3-
from abc import ABC, abstractmethod, abstractproperty
3+
from abc import ABC, abstractmethod
44
from typing import List, Optional, Union
55

66

@@ -15,15 +15,17 @@ async def sign(self, message: Union[List[bytes], bytes]) -> bytes:
1515
async def verify(self, message: Union[List[bytes], bytes], signature: bytes) -> bool:
1616
"""Verify message(s) against signature using key pair."""
1717

18-
@abstractproperty
18+
@property
19+
@abstractmethod
1920
def has_public_key(self) -> bool:
2021
"""Whether key pair has a public key.
2122
2223
Public key is required for verification, but can be set dynamically
2324
in the verification process.
2425
"""
2526

26-
@abstractproperty
27+
@property
28+
@abstractmethod
2729
def public_key(self) -> Optional[bytes]:
2830
"""Getter for the public key bytes.
2931

0 commit comments

Comments
 (0)