This commit is contained in:
almog 2021-10-17 19:22:45 +03:00
parent d219619301
commit c9df6d21d1
No known key found for this signature in database
GPG Key ID: CB2C7BBD0071DFDC
5 changed files with 9 additions and 7 deletions

View File

@ -1,8 +1,11 @@
import json
import logging
from typing import Coroutine
import click
logger = logging.getLogger(__name__)
# TODO: this is more general and should be part of refactoring the overall CLI code duplication
def run(coro: Coroutine):
@ -11,9 +14,10 @@ def run(coro: Coroutine):
response = asyncio.run(coro)
success = response is not None and response.get("success", False)
logger.info(f"data layer cli call response:{success}")
# todo make sure all cli methods follow this pattern, uncomment
# if not success:
# raise click.ClickException(message=f"query unsuccessful, response: {response}")
# raise click.ClickException(message=f"query unsuccessful, response: {response}")
@click.group("data", short_help="Manage your data")

View File

@ -84,7 +84,7 @@ class DataLayer:
# todo create singelton with wavaluellet and get id
store_id = await self.wallet.create_data_store()
res = await self.data_store.create_tree(store_id)
if res == False:
if res is False:
self.log.error("Failed to create tree")
return store_id
@ -118,7 +118,7 @@ class DataLayer:
# todo create singelton with wallet and get id
id = "0102030405060708091011121314151617181920212223242526272829303132"
res = await self.data_store.create_tree(id)
if res == False:
if res is False:
self.log.error("Failed to create tree")
return id

View File

@ -5,7 +5,6 @@ from chia.data_layer.data_layer import DataLayer
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.byte_types import hexstr_to_bytes
# todo input assertions for all rpc's

View File

@ -17,8 +17,6 @@ from chia.data_layer.data_layer import DataLayer
from chia.data_layer.data_store import DataStore
from chia.rpc.data_layer_rpc_api import DataLayerRpcApi
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.byte_types import hexstr_to_bytes
from chia.util.db_wrapper import DBWrapper
from chia.util.default_root import DEFAULT_ROOT_PATH
from tests.block_tools import create_block_tools_async
@ -106,7 +104,7 @@ class ChiaRoot:
def chia_root_fixture(tmp_path: pathlib.Path) -> ChiaRoot:
root = ChiaRoot(path=tmp_path.joinpath("chia_root"))
root.run(args=["init"])
root.run(args=["configure", "--set-log-level", "DEBUG"])
root.run(args=["configure", "--set-log-level", "INFO"])
return root

View File

@ -1,6 +1,7 @@
from typing import List, Dict
import pytest
# flake8: noqa: F401
import aiosqlite
from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.data_layer.data_layer import DataLayer