abstractmethod cleanup

docs update
This commit is contained in:
diminator 2016-05-10 17:18:49 +02:00
parent ca34b58629
commit a75eec9ad1
No known key found for this signature in database
GPG Key ID: C3D8590E6D0D439A
2 changed files with 10 additions and 10 deletions

View File

@ -15,6 +15,7 @@ class AbstractConsensusRules(metaclass=ABCMeta):
All methods listed below must be implemented. All methods listed below must be implemented.
""" """
@staticmethod
@abstractmethod @abstractmethod
def validate_transaction(bigchain, transaction): def validate_transaction(bigchain, transaction):
"""Validate a transaction. """Validate a transaction.
@ -31,8 +32,8 @@ class AbstractConsensusRules(metaclass=ABCMeta):
Descriptive exceptions indicating the reason the transaction failed. Descriptive exceptions indicating the reason the transaction failed.
See the `exceptions` module for bigchain-native error classes. See the `exceptions` module for bigchain-native error classes.
""" """
raise NotImplementedError
@staticmethod
@abstractmethod @abstractmethod
def validate_block(bigchain, block): def validate_block(bigchain, block):
"""Validate a block. """Validate a block.
@ -49,8 +50,8 @@ class AbstractConsensusRules(metaclass=ABCMeta):
Descriptive exceptions indicating the reason the block failed. Descriptive exceptions indicating the reason the block failed.
See the `exceptions` module for bigchain-native error classes. See the `exceptions` module for bigchain-native error classes.
""" """
raise NotImplementedError
@staticmethod
@abstractmethod @abstractmethod
def create_transaction(*args, **kwargs): def create_transaction(*args, **kwargs):
"""Create a new transaction. """Create a new transaction.
@ -61,8 +62,8 @@ class AbstractConsensusRules(metaclass=ABCMeta):
Returns: Returns:
dict: newly constructed transaction. dict: newly constructed transaction.
""" """
raise NotImplementedError
@staticmethod
@abstractmethod @abstractmethod
def sign_transaction(transaction, *args, **kwargs): def sign_transaction(transaction, *args, **kwargs):
"""Sign a transaction. """Sign a transaction.
@ -74,20 +75,19 @@ class AbstractConsensusRules(metaclass=ABCMeta):
Returns: Returns:
dict: transaction with any signatures applied. dict: transaction with any signatures applied.
""" """
raise NotImplementedError
@staticmethod
@abstractmethod @abstractmethod
def validate_fulfillments(signed_transaction): def validate_fulfillments(signed_transaction):
"""Verify the signature of a transaction. """Validate the fulfillments of a transaction.
Args: Args:
signed_transaction (dict): signed transaction to verify signed_transaction (dict): signed transaction to verify
Returns: Returns:
bool: True if the transaction's required signature data is present bool: True if the transaction's required fulfillments are present
and correct, False otherwise. and correct, False otherwise.
""" """
raise NotImplementedError
class BaseConsensusRules(AbstractConsensusRules): class BaseConsensusRules(AbstractConsensusRules):
@ -217,7 +217,7 @@ class BaseConsensusRules(AbstractConsensusRules):
@staticmethod @staticmethod
def validate_fulfillments(signed_transaction): def validate_fulfillments(signed_transaction):
"""Verify the signature of a transaction. """Validate the fulfillments of a transaction.
Refer to the documentation of ``bigchaindb.util.validate_fulfillments`` Refer to the documentation of ``bigchaindb.util.validate_fulfillments``
""" """

View File

@ -87,12 +87,12 @@ class Bigchain(object):
return self.consensus.sign_transaction(transaction, *args, **kwargs) return self.consensus.sign_transaction(transaction, *args, **kwargs)
def validate_fulfillments(self, signed_transaction, *args, **kwargs): def validate_fulfillments(self, signed_transaction, *args, **kwargs):
"""Verify the fulfillment(s) of a transaction. """Validate the fulfillment(s) of a transaction.
Refer to the documentation of your consensus plugin. Refer to the documentation of your consensus plugin.
Returns: Returns:
bool: True if the transaction's required fulfillments is present bool: True if the transaction's required fulfillments are present
and correct, False otherwise. and correct, False otherwise.
""" """