adjusted hashlib imports and renamed to bigchaindb error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
Lorenz Herzberger 2022-09-27 16:34:22 +02:00
parent 69fe9b253d
commit cddfe862ef
No known key found for this signature in database
GPG Key ID: FA5EE906EB55316A
12 changed files with 21 additions and 53 deletions

View File

@ -3,10 +3,10 @@
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
from planetmint.exceptions import BigchainDBError
from planetmint.exceptions import PlanetmintError
class BackendError(BigchainDBError):
class BackendError(PlanetmintError):
"""Top level exception for any backend exception."""

View File

@ -4,9 +4,9 @@
# Code is Apache-2.0 and docs are CC-BY-4.0
class BigchainDBError(Exception):
class PlanetmintError(Exception):
"""Base class for Planetmint exceptions."""
class CriticalDoubleSpend(BigchainDBError):
class CriticalDoubleSpend(PlanetmintError):
"""Data integrity error that requires attention"""

View File

@ -13,11 +13,7 @@ from uuid import uuid4
import rapidjson
try:
from hashlib import sha3_256
except ImportError:
# NOTE: needed for Python < 3.6
from sha3 import sha3_256
import requests

View File

@ -8,10 +8,7 @@ import hashlib
import json
from binascii import hexlify
try:
from hashlib import sha3_256
except ImportError:
from sha3 import sha3_256
def encode_transaction(value):

View File

@ -5,12 +5,7 @@
# Separate all crypto code so that we can easily test several implementations
from collections import namedtuple
try:
from hashlib import sha3_256
except ImportError:
from sha3 import sha3_256
from cryptoconditions import crypto

View File

@ -5,32 +5,32 @@
"""Custom exceptions used in the `planetmint` package.
"""
from planetmint.exceptions import BigchainDBError
from planetmint.exceptions import PlanetmintError
class ConfigurationError(BigchainDBError):
class ConfigurationError(PlanetmintError):
"""Raised when there is a problem with server configuration"""
class DatabaseDoesNotExist(BigchainDBError):
class DatabaseDoesNotExist(PlanetmintError):
"""Raised when trying to delete the database but the db is not there"""
class StartupError(BigchainDBError):
class StartupError(PlanetmintError):
"""Raised when there is an error starting up the system"""
class CyclicBlockchainError(BigchainDBError):
class CyclicBlockchainError(PlanetmintError):
"""Raised when there is a cycle in the blockchain"""
class KeypairMismatchException(BigchainDBError):
class KeypairMismatchException(PlanetmintError):
"""Raised if the private key(s) provided for signing don't match any of the
current owner(s)
"""
class OperationError(BigchainDBError):
class OperationError(PlanetmintError):
"""Raised when an operation cannot go through"""
@ -43,7 +43,7 @@ class OperationError(BigchainDBError):
# especially for the purposes of testing.
class ValidationError(BigchainDBError):
class ValidationError(PlanetmintError):
"""Raised if there was an error in validation"""

View File

@ -21,10 +21,7 @@ from cryptoconditions import Fulfillment, ThresholdSha256, Ed25519Sha256, Zenroo
from cryptoconditions.exceptions import ParsingError, ASN1DecodeError, ASN1EncodeError
from cid import is_cid
try:
from hashlib import sha3_256
except ImportError:
from sha3 import sha3_256
from planetmint.transactions.common.crypto import PrivateKey, hash_data
from planetmint.transactions.common.exceptions import (

View File

@ -22,12 +22,8 @@ from cryptoconditions import Fulfillment
from cryptoconditions import PreimageSha256
from cryptoconditions import Ed25519Sha256
from pytest import mark, raises
from ipld import marshal, multihash
try:
from hashlib import sha3_256
except ImportError:
from sha3 import sha3_256
pytestmark = mark.bdb

View File

@ -9,11 +9,7 @@ from unittest.mock import patch
from planetmint.transactions.types.assets.create import Create
from planetmint.transactions.types.assets.transfer import Transfer
try:
from hashlib import sha3_256
except ImportError:
# NOTE: needed for Python < 3.6
from sha3 import sha3_256
import pytest
from pymongo import MongoClient

View File

@ -7,10 +7,7 @@ import base64
import json
from pytest import mark
try:
from hashlib import sha3_256
except ImportError:
from sha3 import sha3_256
def test_encode_decode_transaction(b):

View File

@ -11,10 +11,7 @@ import json
import pytest
try:
import hashlib as sha3
except ImportError:
import sha3
from unittest.mock import MagicMock
from planetmint.transactions.common.exceptions import AmountError, SchemaValidationError, ThresholdTooDeep

View File

@ -11,10 +11,7 @@ import pytest
from cryptoconditions import Ed25519Sha256
from ipld import multihash, marshal
try:
from hashlib import sha3_256
except ImportError:
from sha3 import sha3_256
from planetmint.transactions.common import crypto
from planetmint.transactions.types.assets.create import Create