Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions benchmarks/streamable.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint8, uint64

from benchmarks.utils import EnumType, get_commit_hash
from benchmarks.utils import get_commit_hash
from chia._tests.util.benchmarks import rand_full_block, rand_hash
from chia.util.streamable import Streamable, streamable

Expand Down Expand Up @@ -226,8 +226,8 @@ def compare_results(


@click.command()
@click.option("-d", "--data", default=Data.all, type=EnumType(Data))
@click.option("-m", "--mode", default=Mode.all, type=EnumType(Mode))
@click.option("-d", "--data", default=Data.all, type=click.Choice(Data))
@click.option("-m", "--mode", default=Mode.all, type=click.Choice(Mode))
@click.option("-r", "--runs", default=100, help="Number of benchmark runs to average results")
@click.option("-t", "--ms", default=50, help="Milliseconds per run")
@click.option("--live/--no-live", default=False, help="Print live results (slower)")
Expand Down
18 changes: 1 addition & 17 deletions benchmarks/utils.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
from __future__ import annotations

import contextlib
import enum
import os
import subprocess
import sys
from collections.abc import AsyncIterator
from pathlib import Path
from typing import Any, Generic, Optional, TypeVar, Union

import click
from typing import Optional, Union

from chia.util.db_wrapper import DBWrapper2

_T_Enum = TypeVar("_T_Enum", bound=enum.Enum)


# Workaround to allow `Enum` with click.Choice: https://github.com/pallets/click/issues/605#issuecomment-901099036
class EnumType(click.Choice, Generic[_T_Enum]):
def __init__(self, enum: type[_T_Enum], case_sensitive: bool = False) -> None:
self.__enum = enum
super().__init__(choices=[item.value for item in enum], case_sensitive=case_sensitive)

def convert(self, value: Any, param: Optional[click.Parameter], ctx: Optional[click.Context]) -> _T_Enum:
converted_str = super().convert(value, param, ctx)
return self.__enum(converted_str)


@contextlib.asynccontextmanager
async def setup_db(name: Union[str, os.PathLike[str]], db_version: int) -> AsyncIterator[DBWrapper2]:
Expand Down
1 change: 1 addition & 0 deletions chia/_tests/wallet/test_signer_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ async def test_signer_commands(wallet_environments: WalletTestFramework) -> None
)


@pytest.mark.filterwarnings("ignore:The parameter .* is used more than once:UserWarning")
def test_signer_command_default_parsing() -> None:
check_click_parsing(
GatherSigningInfoCMD(
Expand Down
16 changes: 8 additions & 8 deletions chia/cmds/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def get_transaction_cmd(
"--limit",
help="Max number of transactions to return",
type=int,
default=(2**32 - 1),
default=(2**16 - 1),
show_default=True,
required=False,
)
Expand All @@ -105,19 +105,19 @@ def get_transaction_cmd(
help="Prompt for each page of data. Defaults to true for interactive consoles, otherwise false.",
)
@click.option(
"--sort-by-height",
"--sort-by-relevance",
"sort_key",
flag_value=SortKey.CONFIRMED_AT_HEIGHT,
flag_value=SortKey.RELEVANCE,
type=SortKey,
help="Sort transactions by height",
default=SortKey.RELEVANCE,
help="Sort transactions by {confirmed, height, time}",
)
@click.option(
"--sort-by-relevance",
"--sort-by-height",
"sort_key",
flag_value=SortKey.RELEVANCE,
flag_value=SortKey.CONFIRMED_AT_HEIGHT,
type=SortKey,
default=True,
help="Sort transactions by {confirmed, height, time}",
help="Sort transactions by height",
)
@click.option(
"--reverse",
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1018,14 +1018,14 @@ files = [

[[package]]
name = "click"
version = "8.1.8"
version = "8.3.0"
description = "Composable command line interface toolkit"
optional = false
python-versions = ">=3.7"
python-versions = ">=3.10"
groups = ["main"]
files = [
{file = "click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"},
{file = "click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a"},
{file = "click-8.3.0-py3-none-any.whl", hash = "sha256:9b9f285302c6e3064f4330c05f05b81945b2a39544279343e6e7c5f27a9baddc"},
{file = "click-8.3.0.tar.gz", hash = "sha256:e7b8232224eba16f4ebe410c25ced9f7875cb5f3263ffc93cc3e8da705e229c4"},
]

[package.dependencies]
Expand Down
Loading