feat: define abstract methods

Signed-off-by: Alexander Tkachev <sasha64sasha@gmail.com>
This commit is contained in:
Alexander Tkachev 2022-07-23 01:22:31 +03:00
parent 09062e35ff
commit a96bd6cdde
1 changed files with 6 additions and 3 deletions

View File

@ -9,6 +9,7 @@ class CloudEvent(abc.ABC):
""" """
@classmethod @classmethod
@abc.abstractmethod
def create( def create(
cls, cls,
attributes: typing.Dict[str, typing.Any], attributes: typing.Dict[str, typing.Any],
@ -20,9 +21,10 @@ class CloudEvent(abc.ABC):
we MUST NOT assume how the __init__ function looks across different python we MUST NOT assume how the __init__ function looks across different python
frameworks frameworks
""" """
raise NotImplementedError() pass
@property @property
@abc.abstractmethod
def _attributes_read_model(self) -> typing.Dict[str, typing.Any]: def _attributes_read_model(self) -> typing.Dict[str, typing.Any]:
""" """
:return: attributes of this event :return: attributes of this event
@ -30,16 +32,17 @@ class CloudEvent(abc.ABC):
you MUST NOT mutate this dict you MUST NOT mutate this dict
implementation MAY assume the dic will not be mutated implementation MAY assume the dic will not be mutated
""" """
raise NotImplementedError() pass
@property @property
@abc.abstractmethod
def _data_read_model(self) -> typing.Optional[typing.Any]: def _data_read_model(self) -> typing.Optional[typing.Any]:
""" """
:return: data value of the event :return: data value of the event
you MUST NOT mutate this value you MUST NOT mutate this value
implementation MAY assume the value will not be mutated implementation MAY assume the value will not be mutated
""" """
raise NotImplementedError() pass
def __setitem__(self, key: str, value: typing.Any) -> None: def __setitem__(self, key: str, value: typing.Any) -> None:
raise NotImplementedError() raise NotImplementedError()