mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 06:25:45 +00:00
reordered imports to be standardized
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
a712a3ebf9
commit
e4bce1cb21
@ -3,13 +3,12 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
from itertools import repeat
|
||||
import logging
|
||||
from importlib import import_module
|
||||
|
||||
import tarantool
|
||||
from transactions.common.exceptions import ConfigurationError
|
||||
import logging
|
||||
|
||||
from itertools import repeat
|
||||
from importlib import import_module
|
||||
from transactions.common.exceptions import ConfigurationError
|
||||
from planetmint.config import Config
|
||||
from planetmint.backend.exceptions import ConnectionError
|
||||
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
|
||||
"""Database creation and schema-providing interfaces for backends."""
|
||||
|
||||
from functools import singledispatch
|
||||
import logging
|
||||
|
||||
from functools import singledispatch
|
||||
from planetmint.config import Config
|
||||
from planetmint.backend.connection import connect
|
||||
from transactions.common.exceptions import ValidationError
|
||||
|
||||
@ -4,18 +4,16 @@
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
"""Query implementation for Tarantool"""
|
||||
import json
|
||||
|
||||
from secrets import token_hex
|
||||
from hashlib import sha256
|
||||
from operator import itemgetter
|
||||
import json
|
||||
|
||||
from tarantool.error import DatabaseError
|
||||
|
||||
from planetmint.backend import query
|
||||
from planetmint.backend.utils import module_dispatch_registrar
|
||||
from planetmint.backend.tarantool.connection import TarantoolDBConnection
|
||||
from planetmint.backend.tarantool.transaction.tools import TransactionCompose, TransactionDecompose
|
||||
from json import dumps, loads
|
||||
|
||||
|
||||
register_query = module_dispatch_registrar(query)
|
||||
@ -325,7 +323,7 @@ def store_unspent_outputs(connection, *unspent_outputs: list):
|
||||
if unspent_outputs:
|
||||
for utxo in unspent_outputs:
|
||||
output = connection.run(
|
||||
connection.space("utxos").insert((utxo["transaction_id"], utxo["output_index"], dumps(utxo)))
|
||||
connection.space("utxos").insert((utxo["transaction_id"], utxo["output_index"], json.dumps(utxo)))
|
||||
)
|
||||
result.append(output)
|
||||
return result
|
||||
@ -344,7 +342,7 @@ def delete_unspent_outputs(connection, *unspent_outputs: list):
|
||||
@register_query(TarantoolDBConnection)
|
||||
def get_unspent_outputs(connection, query=None): # for now we don't have implementation for 'query'.
|
||||
_utxos = connection.run(connection.space("utxos").select([]))
|
||||
return [loads(utx[2]) for utx in _utxos]
|
||||
return [json.loads(utx[2]) for utx in _utxos]
|
||||
|
||||
|
||||
@register_query(TarantoolDBConnection)
|
||||
@ -459,7 +457,7 @@ def get_asset_tokens_for_public_key(
|
||||
|
||||
@register_query(TarantoolDBConnection)
|
||||
def store_abci_chain(connection, height: int, chain_id: str, is_synced: bool = True):
|
||||
hash_id_primarykey = sha256(dumps(obj={"height": height}).encode()).hexdigest()
|
||||
hash_id_primarykey = sha256(json.dumps(obj={"height": height}).encode()).hexdigest()
|
||||
connection.run(
|
||||
connection.space("abci_chains").upsert(
|
||||
(height, is_synced, chain_id, hash_id_primarykey),
|
||||
@ -471,7 +469,7 @@ def store_abci_chain(connection, height: int, chain_id: str, is_synced: bool = T
|
||||
|
||||
@register_query(TarantoolDBConnection)
|
||||
def delete_abci_chain(connection, height: int):
|
||||
hash_id_primarykey = sha256(dumps(obj={"height": height}).encode()).hexdigest()
|
||||
hash_id_primarykey = sha256(json.dumps(obj={"height": height}).encode()).hexdigest()
|
||||
connection.run(connection.space("abci_chains").delete(hash_id_primarykey), only_data=False)
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import logging
|
||||
|
||||
import tarantool
|
||||
from planetmint.config import Config
|
||||
from planetmint.backend.utils import module_dispatch_registrar
|
||||
from planetmint import backend
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
from secrets import token_hex
|
||||
import copy
|
||||
import json
|
||||
|
||||
from secrets import token_hex
|
||||
from transactions.common.memoize import HDict
|
||||
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import logging
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
import planetmint
|
||||
|
||||
from planetmint.core import rollback
|
||||
from planetmint.utils import load_node_key
|
||||
@ -20,7 +21,6 @@ from transactions.common.exceptions import DatabaseDoesNotExist, ValidationError
|
||||
from transactions.types.elections.vote import Vote
|
||||
from transactions.types.elections.chain_migration_election import ChainMigrationElection
|
||||
from transactions.types.elections.validator_utils import election_id_to_public_key
|
||||
import planetmint
|
||||
from planetmint import ValidatorElection, Planetmint
|
||||
from planetmint.backend import schema
|
||||
from planetmint.commands import utils
|
||||
|
||||
@ -12,9 +12,9 @@ import builtins
|
||||
import functools
|
||||
import multiprocessing as mp
|
||||
import sys
|
||||
|
||||
import planetmint
|
||||
import planetmint.config_utils
|
||||
|
||||
from planetmint.version import __version__
|
||||
|
||||
|
||||
|
||||
@ -21,9 +21,9 @@ import copy
|
||||
import json
|
||||
import logging
|
||||
import collections.abc
|
||||
|
||||
from functools import lru_cache
|
||||
from pkg_resources import iter_entry_points, ResolutionError
|
||||
|
||||
from planetmint.config import Config
|
||||
from transactions.common import exceptions
|
||||
from planetmint.validation import BaseValidationRules
|
||||
|
||||
@ -8,6 +8,7 @@ with Tendermint.
|
||||
"""
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from tendermint.abci import types_pb2
|
||||
from abci.application import BaseApplication
|
||||
from abci.application import OkCode
|
||||
|
||||
@ -3,13 +3,9 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import planetmint
|
||||
import logging
|
||||
|
||||
from transactions.common.exceptions import ConfigurationError
|
||||
from logging.config import dictConfig as set_logging_config
|
||||
from planetmint.config import Config, DEFAULT_LOGGING_CONFIG
|
||||
import os
|
||||
|
||||
|
||||
def _normalize_log_level(level):
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import multiprocessing as mp
|
||||
from collections import defaultdict
|
||||
|
||||
from collections import defaultdict
|
||||
from planetmint import App
|
||||
from planetmint.lib import Planetmint
|
||||
from planetmint.tendermint_utils import decode_transaction
|
||||
|
||||
@ -11,9 +11,7 @@ import codecs
|
||||
from binascii import hexlify
|
||||
from tendermint.abci import types_pb2
|
||||
from tendermint.crypto import keys_pb2
|
||||
|
||||
from hashlib import sha3_256
|
||||
|
||||
from transactions.common.exceptions import InvalidPublicKey
|
||||
|
||||
|
||||
|
||||
@ -8,8 +8,8 @@ import threading
|
||||
import queue
|
||||
import multiprocessing as mp
|
||||
import json
|
||||
|
||||
import setproctitle
|
||||
|
||||
from packaging import version
|
||||
from planetmint.version import __tm_supported_versions__
|
||||
from planetmint.tendermint_utils import key_from_base64
|
||||
|
||||
@ -10,11 +10,10 @@ The application is implemented in Flask and runs using Gunicorn.
|
||||
|
||||
import copy
|
||||
import multiprocessing
|
||||
import gunicorn.app.base
|
||||
|
||||
from flask import Flask
|
||||
from flask_cors import CORS
|
||||
import gunicorn.app.base
|
||||
|
||||
from planetmint import utils
|
||||
from planetmint import Planetmint
|
||||
from planetmint.web.routes import add_routes
|
||||
|
||||
@ -11,7 +11,6 @@ import logging
|
||||
|
||||
from flask_restful import reqparse, Resource
|
||||
from flask import current_app
|
||||
|
||||
from planetmint.backend.exceptions import OperationError
|
||||
from planetmint.web.views.base import make_error
|
||||
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
import logging
|
||||
|
||||
from flask import jsonify, request
|
||||
|
||||
from planetmint.config import Config
|
||||
|
||||
|
||||
|
||||
@ -9,7 +9,6 @@ For more information please refer to the documentation: http://planetmint.io/htt
|
||||
"""
|
||||
from flask import current_app
|
||||
from flask_restful import Resource, reqparse
|
||||
|
||||
from planetmint.web.views.base import make_error
|
||||
|
||||
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
"""API Index endpoint"""
|
||||
|
||||
import flask
|
||||
from flask_restful import Resource
|
||||
|
||||
from flask_restful import Resource
|
||||
from planetmint.web.views.base import base_ws_uri
|
||||
from planetmint import version
|
||||
from planetmint.web.websocket_server import EVENTS_ENDPOINT, EVENTS_ENDPOINT_BLOCKS
|
||||
|
||||
@ -11,7 +11,6 @@ import logging
|
||||
|
||||
from flask_restful import reqparse, Resource
|
||||
from flask import current_app
|
||||
|
||||
from planetmint.backend.exceptions import OperationError
|
||||
from planetmint.web.views.base import make_error
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
|
||||
from flask import current_app
|
||||
from flask_restful import reqparse, Resource
|
||||
|
||||
from planetmint.web.views import parameters
|
||||
|
||||
|
||||
|
||||
@ -11,7 +11,6 @@ import logging
|
||||
|
||||
from flask import current_app, request, jsonify
|
||||
from flask_restful import Resource, reqparse
|
||||
|
||||
from transactions.common.transaction_mode_types import BROADCAST_TX_ASYNC
|
||||
from transactions.common.exceptions import (
|
||||
SchemaValidationError,
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
|
||||
import json
|
||||
|
||||
from planetmint.events import EventTypes
|
||||
from planetmint.events import POISON_PILL
|
||||
|
||||
|
||||
@ -21,7 +21,6 @@ import logging
|
||||
import threading
|
||||
import aiohttp
|
||||
|
||||
|
||||
from uuid import uuid4
|
||||
from concurrent.futures import CancelledError
|
||||
from planetmint.config import Config
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user