Skip to content
Snippets Groups Projects
Verified Commit 3c2ed18b authored by Mateusz Żebrak's avatar Mateusz Żebrak
Browse files

Fix and enable FBT

parent f4671ee2
No related branches found
No related tags found
2 merge requests!399V1.27.5.12 release,!397Bump tools and enable new rules
Showing
with 99 additions and 84 deletions
...@@ -17,7 +17,7 @@ async def info(ctx: typer.Context) -> None: # noqa: ARG001 ...@@ -17,7 +17,7 @@ async def info(ctx: typer.Context) -> None: # noqa: ARG001
@beekeeper.command() @beekeeper.command()
async def spawn( async def spawn(
background: bool = typer.Option(True, help="Run in background."), background: bool = typer.Option(default=True, help="Run in background."), # noqa: FBT001
) -> None: ) -> None:
"""Spawn beekeeper process.""" """Spawn beekeeper process."""
from clive.__private.cli.commands.beekeeper import BeekeeperSpawn from clive.__private.cli.commands.beekeeper import BeekeeperSpawn
......
...@@ -54,7 +54,7 @@ class CliveTyper(typer.Typer): ...@@ -54,7 +54,7 @@ class CliveTyper(typer.Typer):
*, *,
name: Optional[str] = Default(None), name: Optional[str] = Default(None),
help: Optional[str] = Default(None), # noqa: A002 help: Optional[str] = Default(None), # noqa: A002
chain: bool = Default(False), chain: bool = Default(value=False),
) -> None: ) -> None:
super().__init__( super().__init__(
name=name, name=name,
...@@ -127,7 +127,7 @@ class CliveTyper(typer.Typer): ...@@ -127,7 +127,7 @@ class CliveTyper(typer.Typer):
common_options: list[type[CommonOptionsBase]] | None = None, common_options: list[type[CommonOptionsBase]] | None = None,
*, *,
help: Optional[str] = Default(None), # noqa: A002 help: Optional[str] = Default(None), # noqa: A002
invoke_without_command: bool = Default(False), invoke_without_command: bool = Default(value=False),
result_callback: Optional[Callable[..., Any]] = Default(None), result_callback: Optional[Callable[..., Any]] = Default(None),
) -> Callable[[CommandFunctionType], CommandFunctionType]: ) -> Callable[[CommandFunctionType], CommandFunctionType]:
return self.__common_decorator( return self.__common_decorator(
......
...@@ -46,7 +46,7 @@ class ProcessTransferSchedule(OperationCommand): ...@@ -46,7 +46,7 @@ class ProcessTransferSchedule(OperationCommand):
return None return None
def validate_existence( def validate_existence(
self, pair_id: int, scheduled_transfer: TransferSchedule | None, should_exists: bool self, pair_id: int, scheduled_transfer: TransferSchedule | None, *, should_exists: bool
) -> None: ) -> None:
"""Validate if scheduled_transfer (recurrent transfer) exists.""" """Validate if scheduled_transfer (recurrent transfer) exists."""
exists = scheduled_transfer is not None exists = scheduled_transfer is not None
...@@ -105,7 +105,7 @@ class ProcessTransferScheduleCreate(ProcessTransferSchedule): ...@@ -105,7 +105,7 @@ class ProcessTransferScheduleCreate(ProcessTransferSchedule):
if scheduled_transfers: if scheduled_transfers:
scheduled_transfer = self.get_scheduled_transfer(self.pair_id, scheduled_transfers) scheduled_transfer = self.get_scheduled_transfer(self.pair_id, scheduled_transfers)
self.validate_existence(self.pair_id, scheduled_transfer, False) self.validate_existence(self.pair_id, scheduled_transfer, should_exists=False)
await super().validate_inside_context_manager() await super().validate_inside_context_manager()
async def validate(self) -> None: async def validate(self) -> None:
...@@ -153,7 +153,7 @@ class ProcessTransferScheduleModify(ProcessTransferSchedule): ...@@ -153,7 +153,7 @@ class ProcessTransferScheduleModify(ProcessTransferSchedule):
self.pair_id = 0 if self.pair_id is None else self.pair_id self.pair_id = 0 if self.pair_id is None else self.pair_id
scheduled_transfer = self.get_scheduled_transfer(self.pair_id, scheduled_transfers) scheduled_transfer = self.get_scheduled_transfer(self.pair_id, scheduled_transfers)
self.validate_existence(self.pair_id, scheduled_transfer, True) self.validate_existence(self.pair_id, scheduled_transfer, should_exists=True)
self.scheduled_transfer = scheduled_transfer self.scheduled_transfer = scheduled_transfer
await super().validate_inside_context_manager() await super().validate_inside_context_manager()
...@@ -191,6 +191,6 @@ class ProcessTransferScheduleRemove(ProcessTransferSchedule): ...@@ -191,6 +191,6 @@ class ProcessTransferScheduleRemove(ProcessTransferSchedule):
self.pair_id = 0 if self.pair_id is None else self.pair_id self.pair_id = 0 if self.pair_id is None else self.pair_id
scheduled_transfer = self.get_scheduled_transfer(self.pair_id, scheduled_transfers) scheduled_transfer = self.get_scheduled_transfer(self.pair_id, scheduled_transfers)
self.validate_existence(self.pair_id, scheduled_transfer, True) self.validate_existence(self.pair_id, scheduled_transfer, should_exists=True)
self.scheduled_transfer = scheduled_transfer self.scheduled_transfer = scheduled_transfer
await super().validate_inside_context_manager() await super().validate_inside_context_manager()
...@@ -13,7 +13,7 @@ class OperationCommonOptions(CommonOptionsBase): ...@@ -13,7 +13,7 @@ class OperationCommonOptions(CommonOptionsBase):
password: Optional[str] = options.password_optional_option password: Optional[str] = options.password_optional_option
sign: Optional[str] = typer.Option(None, help="Key alias to sign the transaction with.", show_default=False) sign: Optional[str] = typer.Option(None, help="Key alias to sign the transaction with.", show_default=False)
beekeeper_remote: Optional[str] = options.beekeeper_remote_option beekeeper_remote: Optional[str] = options.beekeeper_remote_option
broadcast: bool = typer.Option(True, help="Whether broadcast the transaction. (i.e. dry-run)") broadcast: bool = typer.Option(default=True, help="Whether broadcast the transaction. (i.e. dry-run)")
save_file: Optional[str] = typer.Option( save_file: Optional[str] = typer.Option(
None, None,
help="The file to save the transaction to (format is determined by file extension - .bin or .json).", help="The file to save the transaction to (format is determined by file extension - .bin or .json).",
......
...@@ -32,8 +32,8 @@ async def add_key( ...@@ -32,8 +32,8 @@ async def add_key(
async def remove_key( async def remove_key(
ctx: typer.Context, # noqa: ARG001 ctx: typer.Context, # noqa: ARG001
alias: str = typer.Option(..., help="The key alias to remove.", show_default=False), alias: str = typer.Option(..., help="The key alias to remove.", show_default=False),
from_beekeeper: bool = typer.Option( from_beekeeper: bool = typer.Option( # noqa: FBT001
False, default=False,
help="Remove the key from the Beekeeper as well.", help="Remove the key from the Beekeeper as well.",
), ),
password: str = options.password_option, password: str = options.password_option,
......
...@@ -14,8 +14,8 @@ async def process_withdraw_routes_set( ...@@ -14,8 +14,8 @@ async def process_withdraw_routes_set(
from_account: str = options.from_account_name_option, from_account: str = options.from_account_name_option,
to_account: str = options.to_account_name_no_default_option, to_account: str = options.to_account_name_no_default_option,
percent: Decimal = options.percent_option, percent: Decimal = options.percent_option,
auto_vest: bool = typer.Option( auto_vest: bool = typer.Option( # noqa: FBT001
False, default=False,
help="If auto-vest is set, then the amount of the Hive is immediately converted into HP on the balance. " help="If auto-vest is set, then the amount of the Hive is immediately converted into HP on the balance. "
"With no-auto-vest there is no conversion from Hive into HP.", "With no-auto-vest there is no conversion from Hive into HP.",
), ),
......
...@@ -65,7 +65,7 @@ else: ...@@ -65,7 +65,7 @@ else:
async def process_transaction( async def process_transaction(
ctx: typer.Context, # noqa: ARG001 ctx: typer.Context, # noqa: ARG001
from_file: str = typer.Option(..., help="The file to load the transaction from.", show_default=False), from_file: str = typer.Option(..., help="The file to load the transaction from.", show_default=False),
force_unsign: bool = typer.Option(False, help="Whether to force unsigning the transaction."), force_unsign: bool = typer.Option(default=False, help="Whether to force unsigning the transaction."), # noqa: FBT001
already_signed_mode: AlreadySignedModeEnum = typer.Option( already_signed_mode: AlreadySignedModeEnum = typer.Option(
ALREADY_SIGNED_MODE_DEFAULT, help="How to handle the situation when transaction is already signed." ALREADY_SIGNED_MODE_DEFAULT, help="How to handle the situation when transaction is already signed."
), ),
......
...@@ -4,7 +4,7 @@ from concurrent.futures import ThreadPoolExecutor ...@@ -4,7 +4,7 @@ from concurrent.futures import ThreadPoolExecutor
class CustomThreadPoolExecutor(ThreadPoolExecutor): class CustomThreadPoolExecutor(ThreadPoolExecutor):
def shutdown(self, wait: bool = True, *, cancel_futures: bool = True) -> None: def shutdown(self, wait: bool = True, *, cancel_futures: bool = True) -> None: # noqa: FBT001, FBT002
"""Change default behavior of ThreadPoolExecutor.shutdown to cancel futures by default.""" """Change default behavior of ThreadPoolExecutor.shutdown to cancel futures by default."""
super().shutdown(wait=wait, cancel_futures=cancel_futures) super().shutdown(wait=wait, cancel_futures=cancel_futures)
......
...@@ -163,7 +163,7 @@ class ChainData: ...@@ -163,7 +163,7 @@ class ChainData:
def pretty_vests_to_hive_ratio(self) -> str: def pretty_vests_to_hive_ratio(self) -> str:
return humanize_vest_to_hive_ratio(self.vests_to_hive_ratio) return humanize_vest_to_hive_ratio(self.vests_to_hive_ratio)
def get_hbd_print_rate(self, colorized: bool = True, aligned: bool = True, pretty: bool = True) -> str: def get_hbd_print_rate(self, *, colorized: bool = True, aligned: bool = True, pretty: bool = True) -> str:
if aligned: if aligned:
if pretty: if pretty:
hbd_print_rate = self._aligned_financial_data.pretty_hbd_print_rate hbd_print_rate = self._aligned_financial_data.pretty_hbd_print_rate
...@@ -177,7 +177,7 @@ class ChainData: ...@@ -177,7 +177,7 @@ class ChainData:
return self.__colorize_hbd_print_rate(hbd_print_rate) return self.__colorize_hbd_print_rate(hbd_print_rate)
return hbd_print_rate return hbd_print_rate
def get_median_hive_price(self, colorized: bool = True, aligned: bool = True, pretty: bool = True) -> str: def get_median_hive_price(self, *, colorized: bool = True, aligned: bool = True, pretty: bool = True) -> str:
if aligned: if aligned:
median_hive_price = self._aligned_financial_data.pretty_median_hive_price median_hive_price = self._aligned_financial_data.pretty_median_hive_price
elif pretty: elif pretty:
...@@ -188,7 +188,7 @@ class ChainData: ...@@ -188,7 +188,7 @@ class ChainData:
return self.__colorize_median_hive_price(median_hive_price) return self.__colorize_median_hive_price(median_hive_price)
return median_hive_price return median_hive_price
def get_participation_count(self, colorized: bool = True, pretty: bool = True) -> str: def get_participation_count(self, *, colorized: bool = True, pretty: bool = True) -> str:
participation = self.pretty_participation if pretty else str(self.participation) participation = self.pretty_participation if pretty else str(self.participation)
if colorized: if colorized:
return self.__colorize_participation_count(participation) return self.__colorize_participation_count(participation)
......
...@@ -267,7 +267,7 @@ def humanize_asset(asset: Asset.AnyT, *, show_symbol: bool = True, sign_prefix: ...@@ -267,7 +267,7 @@ def humanize_asset(asset: Asset.AnyT, *, show_symbol: bool = True, sign_prefix:
return f"{pretty_asset} {asset_symbol if show_symbol else ''}".rstrip() return f"{pretty_asset} {asset_symbol if show_symbol else ''}".rstrip()
def humanize_bool(value: bool) -> str: def humanize_bool(value: bool) -> str: # noqa: FBT001
"""Convert True/False to a more human-readable format.""" """Convert True/False to a more human-readable format."""
if value: if value:
return "YES" return "YES"
......
...@@ -8,6 +8,7 @@ class AccountHistoryApi(Api): ...@@ -8,6 +8,7 @@ class AccountHistoryApi(Api):
@Api.method @Api.method
async def get_account_history( # noqa: PLR0913 async def get_account_history( # noqa: PLR0913
self, self,
*,
account: str, account: str,
start: int = -1, start: int = -1,
limit: int = 1_000, limit: int = 1_000,
...@@ -18,12 +19,13 @@ class AccountHistoryApi(Api): ...@@ -18,12 +19,13 @@ class AccountHistoryApi(Api):
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def get_transaction(self, id_: str, include_reversible: bool = True) -> account_history_api.GetTransaction: async def get_transaction(self, *, id_: str, include_reversible: bool = True) -> account_history_api.GetTransaction:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def enum_virtual_ops( # noqa: PLR0913 async def enum_virtual_ops( # noqa: PLR0913
self, self,
*,
block_range_begin: int, block_range_begin: int,
block_range_end: int, block_range_end: int,
operation_begin: int | None = None, operation_begin: int | None = None,
...@@ -35,6 +37,6 @@ class AccountHistoryApi(Api): ...@@ -35,6 +37,6 @@ class AccountHistoryApi(Api):
raise NotImplementedError raise NotImplementedError
async def get_ops_in_block( async def get_ops_in_block(
self, block_num: int, only_virtual: bool = False, include_reversible: bool = True self, *, block_num: int, only_virtual: bool = False, include_reversible: bool = True
) -> account_history_api.GetOpsInBlock: ) -> account_history_api.GetOpsInBlock:
raise NotImplementedError raise NotImplementedError
...@@ -59,76 +59,78 @@ class DatabaseApi(Api): ...@@ -59,76 +59,78 @@ class DatabaseApi(Api):
@Api.method @Api.method
async def find_accounts( async def find_accounts(
self, accounts: list[str], delayed_votes_active: bool | None = None self, *, accounts: list[str], delayed_votes_active: bool | None = None
) -> database_api.FindAccounts: ) -> database_api.FindAccounts:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_change_recovery_account_requests( async def find_change_recovery_account_requests(
self, accounts: list[str] self, *, accounts: list[str]
) -> database_api.FindChangeRecoveryAccountRequests: ) -> database_api.FindChangeRecoveryAccountRequests:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_collateralized_conversion_requests( async def find_collateralized_conversion_requests(
self, account: str self, *, account: str
) -> database_api.FindCollateralizedConversionRequests: ) -> database_api.FindCollateralizedConversionRequests:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_comments(self, comments: list[tuple[str, str]]) -> database_api.FindComments: async def find_comments(self, *, comments: list[tuple[str, str]]) -> database_api.FindComments:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_decline_voting_rights_requests( async def find_decline_voting_rights_requests(
self, accounts: list[str] self, *, accounts: list[str]
) -> database_api.FindDeclineVotingRightsRequests: ) -> database_api.FindDeclineVotingRightsRequests:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_escrows(self, from_: str = "") -> database_api.FindEscrows: async def find_escrows(self, *, from_: str = "") -> database_api.FindEscrows:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_hbd_conversion_requests(self, account: str) -> database_api.FindHbdConversionRequests: async def find_hbd_conversion_requests(self, *, account: str) -> database_api.FindHbdConversionRequests:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_limit_orders(self, account: str) -> database_api.FindLimitOrders: async def find_limit_orders(self, *, account: str) -> database_api.FindLimitOrders:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_owner_histories(self, owner: str = "") -> database_api.FindOwnerHistories: async def find_owner_histories(self, *, owner: str = "") -> database_api.FindOwnerHistories:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_proposals(self, proposal_ids: list[int]) -> database_api.FindProposals: async def find_proposals(self, *, proposal_ids: list[int]) -> database_api.FindProposals:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_recurrent_transfers(self, from_: str = "") -> database_api.FindRecurrentTransfers: async def find_recurrent_transfers(self, *, from_: str = "") -> database_api.FindRecurrentTransfers:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_savings_withdrawals(self, account: str) -> database_api.FindSavingsWithdrawals: async def find_savings_withdrawals(self, *, account: str) -> database_api.FindSavingsWithdrawals:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_vesting_delegation_expirations(self, account: str) -> database_api.FindVestingDelegationExpirations: async def find_vesting_delegation_expirations(
self, *, account: str
) -> database_api.FindVestingDelegationExpirations:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_vesting_delegations(self, account: str) -> database_api.FindVestingDelegations: async def find_vesting_delegations(self, *, account: str) -> database_api.FindVestingDelegations:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_withdraw_vesting_routes( async def find_withdraw_vesting_routes(
self, account: str, order: DatabaseApi.SORT_TYPES self, *, account: str, order: DatabaseApi.SORT_TYPES
) -> database_api.FindWithdrawVestingRoutes: ) -> database_api.FindWithdrawVestingRoutes:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def find_witnesses(self, owners: list[str]) -> database_api.FindWitnesses: async def find_witnesses(self, *, owners: list[str]) -> database_api.FindWitnesses:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
...@@ -137,7 +139,7 @@ class DatabaseApi(Api): ...@@ -137,7 +139,7 @@ class DatabaseApi(Api):
@Api.method @Api.method
async def get_comment_pending_payouts( async def get_comment_pending_payouts(
self, comments: list[tuple[str, str]] self, *, comments: list[tuple[str, str]]
) -> database_api.GetCommentPendingPayouts: ) -> database_api.GetCommentPendingPayouts:
raise NotImplementedError raise NotImplementedError
...@@ -162,15 +164,15 @@ class DatabaseApi(Api): ...@@ -162,15 +164,15 @@ class DatabaseApi(Api):
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def get_order_book(self, limit: int, base: Asset.Hive, quote: Asset.Hbd) -> database_api.GetOrderBook: async def get_order_book(self, *, limit: int, base: Asset.Hive, quote: Asset.Hbd) -> database_api.GetOrderBook:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def get_potential_signatures(self, trx: Transaction) -> database_api.GetPotentialSignatures: async def get_potential_signatures(self, *, trx: Transaction) -> database_api.GetPotentialSignatures:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def get_required_signatures(self, trx: Transaction) -> database_api.GetRequiredSignatures: async def get_required_signatures(self, *, trx: Transaction) -> database_api.GetRequiredSignatures:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
...@@ -178,7 +180,7 @@ class DatabaseApi(Api): ...@@ -178,7 +180,7 @@ class DatabaseApi(Api):
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def get_transaction_hex(self, trx: Transaction) -> database_api.GetTransactionHex: async def get_transaction_hex(self, *, trx: Transaction) -> database_api.GetTransactionHex:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
...@@ -190,18 +192,19 @@ class DatabaseApi(Api): ...@@ -190,18 +192,19 @@ class DatabaseApi(Api):
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def is_known_transaction(self, id_: str) -> database_api.IsKnownTransaction: async def is_known_transaction(self, *, id_: str) -> database_api.IsKnownTransaction:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_account_recovery_requests( async def list_account_recovery_requests(
self, account: str, limit: int, order: DatabaseApi.SORT_TYPES self, *, account: str, limit: int, order: DatabaseApi.SORT_TYPES
) -> database_api.ListAccountRecoveryRequests: ) -> database_api.ListAccountRecoveryRequests:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_accounts( async def list_accounts(
self, self,
*,
start: str | tuple[str, str] | tuple[datetime, str], start: str | tuple[str, str] | tuple[datetime, str],
limit: int, limit: int,
order: DatabaseApi.SORT_TYPES, order: DatabaseApi.SORT_TYPES,
...@@ -211,47 +214,48 @@ class DatabaseApi(Api): ...@@ -211,47 +214,48 @@ class DatabaseApi(Api):
@Api.method @Api.method
async def list_change_recovery_account_requests( async def list_change_recovery_account_requests(
self, start: str | tuple[datetime, str], limit: int, order: DatabaseApi.SORT_TYPES self, *, start: str | tuple[datetime, str], limit: int, order: DatabaseApi.SORT_TYPES
) -> database_api.ListChangeRecoveryAccountRequests: ) -> database_api.ListChangeRecoveryAccountRequests:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_collateralized_conversion_requests( async def list_collateralized_conversion_requests(
self, start: str | None, limit: int, order: DatabaseApi.SORT_TYPES self, *, start: str | None, limit: int, order: DatabaseApi.SORT_TYPES
) -> database_api.ListCollateralizedConversionRequests: ) -> database_api.ListCollateralizedConversionRequests:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_decline_voting_rights_requests( async def list_decline_voting_rights_requests(
self, start: str | tuple[datetime, str], limit: int, order: DatabaseApi.SORT_TYPES self, *, start: str | tuple[datetime, str], limit: int, order: DatabaseApi.SORT_TYPES
) -> database_api.ListDeclineVotingRightsRequests: ) -> database_api.ListDeclineVotingRightsRequests:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_escrows( async def list_escrows(
self, start: tuple[str, int] | tuple[bool, datetime, int], limit: int, order: DatabaseApi.SORT_TYPES self, *, start: tuple[str, int] | tuple[bool, datetime, int], limit: int, order: DatabaseApi.SORT_TYPES
) -> database_api.ListEscrows: ) -> database_api.ListEscrows:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_hbd_conversion_requests( async def list_hbd_conversion_requests(
self, limit: int, order: DatabaseApi.SORT_TYPES self, *, limit: int, order: DatabaseApi.SORT_TYPES
) -> database_api.ListHbdConversionRequests: ) -> database_api.ListHbdConversionRequests:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_limit_orders( async def list_limit_orders(
self, start: tuple[str, int] | tuple[dict[Literal["base", "quote"], Asset.Hive | Asset.Hbd], int] self, *, start: tuple[str, int] | tuple[dict[Literal["base", "quote"], Asset.Hive | Asset.Hbd], int]
) -> database_api.ListLimitOrders: ) -> database_api.ListLimitOrders:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_owner_histories(self, start: tuple[str, datetime], limit: int) -> database_api.ListOwnerHistories: async def list_owner_histories(self, *, start: tuple[str, datetime], limit: int) -> database_api.ListOwnerHistories:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_proposal_votes( # noqa: PLR0913 async def list_proposal_votes( # noqa: PLR0913
self, self,
*,
start: list[str], start: list[str],
limit: int, limit: int,
order: DatabaseApi.SORT_TYPES, order: DatabaseApi.SORT_TYPES,
...@@ -263,6 +267,7 @@ class DatabaseApi(Api): ...@@ -263,6 +267,7 @@ class DatabaseApi(Api):
@Api.method @Api.method
async def list_proposals( # noqa: PLR0913 async def list_proposals( # noqa: PLR0913
self, self,
*,
start: list[str] | list[int] | list[datetime], start: list[str] | list[int] | list[datetime],
limit: int, limit: int,
order: DatabaseApi.SORT_TYPES, order: DatabaseApi.SORT_TYPES,
...@@ -274,6 +279,7 @@ class DatabaseApi(Api): ...@@ -274,6 +279,7 @@ class DatabaseApi(Api):
@Api.method @Api.method
async def list_savings_withdrawals( async def list_savings_withdrawals(
self, self,
*,
start: tuple[int] | tuple[datetime, str, int] | tuple[str, datetime, int], start: tuple[int] | tuple[datetime, str, int] | tuple[str, datetime, int],
limit: int, limit: int,
order: DatabaseApi.SORT_TYPES, order: DatabaseApi.SORT_TYPES,
...@@ -282,47 +288,50 @@ class DatabaseApi(Api): ...@@ -282,47 +288,50 @@ class DatabaseApi(Api):
@Api.method @Api.method
async def list_vesting_delegation_expirations( async def list_vesting_delegation_expirations(
self, start: tuple[str, datetime, int] | tuple[datetime, int], limit: int, order: DatabaseApi.SORT_TYPES self, *, start: tuple[str, datetime, int] | tuple[datetime, int], limit: int, order: DatabaseApi.SORT_TYPES
) -> database_api.ListVestingDelegationExpirations: ) -> database_api.ListVestingDelegationExpirations:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_vesting_delegations( async def list_vesting_delegations(
self, start: tuple[str, str], limit: int, order: DatabaseApi.SORT_TYPES self, *, start: tuple[str, str], limit: int, order: DatabaseApi.SORT_TYPES
) -> database_api.ListVestingDelegations: ) -> database_api.ListVestingDelegations:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_withdraw_vesting_routes( async def list_withdraw_vesting_routes(
self, start: tuple[str, str] | tuple[str, int], limit: int, order: DatabaseApi.SORT_TYPES self, *, start: tuple[str, str] | tuple[str, int], limit: int, order: DatabaseApi.SORT_TYPES
) -> database_api.ListWithdrawVestingRoutes: ) -> database_api.ListWithdrawVestingRoutes:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_witness_votes( async def list_witness_votes(
self, start: tuple[str, str], limit: int, order: DatabaseApi.SORT_TYPES self, *, start: tuple[str, str], limit: int, order: DatabaseApi.SORT_TYPES
) -> database_api.ListWitnessVotes: ) -> database_api.ListWitnessVotes:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_witnesses( async def list_witnesses(
self, start: str | tuple[int, str] | tuple[str | int, str], limit: int, order: DatabaseApi.SORT_TYPES self, *, start: str | tuple[int, str] | tuple[str | int, str], limit: int, order: DatabaseApi.SORT_TYPES
) -> database_api.ListWitnesses: ) -> database_api.ListWitnesses:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def verify_account_authority(self, account: str, signers: list[str]) -> database_api.VerifyAccountAuthority: async def verify_account_authority(
self, *, account: str, signers: list[str]
) -> database_api.VerifyAccountAuthority:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def verify_authority( async def verify_authority(
self, trx: Transaction, pack: DatabaseApi.PACK_TYPES = "hf26" self, *, trx: Transaction, pack: DatabaseApi.PACK_TYPES = "hf26"
) -> database_api.VerifyAuthority: ) -> database_api.VerifyAuthority:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def verify_signatures( # noqa: PLR0913 async def verify_signatures( # noqa: PLR0913
self, self,
*,
hash_: str, hash_: str,
signatures: list[str], signatures: list[str],
required_owner: list[str], required_owner: list[str],
......
...@@ -8,7 +8,7 @@ from schemas.apis import rc_api # noqa: TCH001 ...@@ -8,7 +8,7 @@ from schemas.apis import rc_api # noqa: TCH001
class RcApi(Api): class RcApi(Api):
@Api.method @Api.method
async def find_rc_accounts( async def find_rc_accounts(
self, accounts: list[str], refresh_mana: bool = False self, *, accounts: list[str], refresh_mana: bool = False
) -> rc_api.FindRcAccounts[Asset.Vests]: ) -> rc_api.FindRcAccounts[Asset.Vests]:
raise NotImplementedError raise NotImplementedError
...@@ -22,10 +22,10 @@ class RcApi(Api): ...@@ -22,10 +22,10 @@ class RcApi(Api):
@Api.method @Api.method
async def list_rc_accounts( async def list_rc_accounts(
self, accounts: list[str], refresh_mana: bool = False self, *, accounts: list[str], refresh_mana: bool = False
) -> rc_api.ListRcAccounts[Asset.Vests]: ) -> rc_api.ListRcAccounts[Asset.Vests]:
raise NotImplementedError raise NotImplementedError
@Api.method @Api.method
async def list_rc_direct_delegations(self, start: tuple[str, str], limit: int) -> rc_api.ListRcDirectDelegations: async def list_rc_direct_delegations(self, *, start: tuple[str, str], limit: int) -> rc_api.ListRcDirectDelegations:
raise NotImplementedError raise NotImplementedError
...@@ -6,5 +6,5 @@ from schemas.apis import transaction_status_api # noqa: TCH001 ...@@ -6,5 +6,5 @@ from schemas.apis import transaction_status_api # noqa: TCH001
class TransactionStatusApi(Api): class TransactionStatusApi(Api):
@Api.method @Api.method
async def find_transaction(self, transaction_id: str) -> transaction_status_api.FindTransaction: async def find_transaction(self, *, transaction_id: str) -> transaction_status_api.FindTransaction:
raise NotImplementedError raise NotImplementedError
...@@ -42,9 +42,9 @@ class World: ...@@ -42,9 +42,9 @@ class World:
def __init__( def __init__(
self, self,
profile_name: str | None = None, profile_name: str | None = None,
use_beekeeper: bool = True,
beekeeper_remote_endpoint: Url | None = None, beekeeper_remote_endpoint: Url | None = None,
*args: Any, *args: Any,
use_beekeeper: bool = True,
**kwargs: Any, **kwargs: Any,
) -> None: ) -> None:
# Multiple inheritance friendly, passes arguments to next object in MRO. # Multiple inheritance friendly, passes arguments to next object in MRO.
......
from __future__ import annotations from __future__ import annotations
from collections.abc import Awaitable, Callable
from datetime import timedelta from datetime import timedelta
from typing import TYPE_CHECKING from typing import TYPE_CHECKING, Protocol
from textual import on from textual import on
from textual.binding import Binding from textual.binding import Binding
...@@ -20,11 +19,16 @@ from clive.__private.ui.widgets.inputs.labelized_input import LabelizedInput ...@@ -20,11 +19,16 @@ from clive.__private.ui.widgets.inputs.labelized_input import LabelizedInput
from clive.__private.ui.widgets.inputs.text_input import TextInput from clive.__private.ui.widgets.inputs.text_input import TextInput
if TYPE_CHECKING: if TYPE_CHECKING:
from collections.abc import Awaitable
from textual.app import ComposeResult from textual.app import ComposeResult
ActivationResultCallbackT = Callable[[bool], Awaitable[None]] class ActivationResultCallback(Protocol):
ActivationResultCallbackOptionalT = ActivationResultCallbackT | None def __call__(self, *, activated: bool) -> Awaitable[None]: ...
ActivationResultCallbackOptional = ActivationResultCallback | None
class ActiveModeTimeContainer(Horizontal): class ActiveModeTimeContainer(Horizontal):
...@@ -43,7 +47,7 @@ class Activate(BaseScreen): ...@@ -43,7 +47,7 @@ class Activate(BaseScreen):
Binding("f2", "activate", "Ok"), Binding("f2", "activate", "Ok"),
] ]
def __init__(self, *, activation_result_callback: ActivationResultCallbackOptionalT = None) -> None: def __init__(self, *, activation_result_callback: ActivationResultCallbackOptional = None) -> None:
super().__init__() super().__init__()
self._activation_result_callback = activation_result_callback self._activation_result_callback = activation_result_callback
self._name_input = LabelizedInput("Profile name", value=self.app.world.profile_data.name) self._name_input = LabelizedInput("Profile name", value=self.app.world.profile_data.name)
...@@ -103,12 +107,12 @@ class Activate(BaseScreen): ...@@ -103,12 +107,12 @@ class Activate(BaseScreen):
async def __exit_success(self) -> None: async def __exit_success(self) -> None:
self.app.pop_screen() self.app.pop_screen()
await self.__set_activation_result(True) await self.__set_activation_result(value=True)
async def __exit_cancel(self) -> None: async def __exit_cancel(self) -> None:
self.app.pop_screen() self.app.pop_screen()
await self.__set_activation_result(False) await self.__set_activation_result(value=False)
async def __set_activation_result(self, value: bool) -> None: async def __set_activation_result(self, *, value: bool) -> None:
if self._activation_result_callback is not None: if self._activation_result_callback is not None:
await self._activation_result_callback(value) await self._activation_result_callback(activated=value)
...@@ -66,7 +66,7 @@ class Clive(App[int], ManualReactive): ...@@ -66,7 +66,7 @@ class Clive(App[int], ManualReactive):
"dashboard_active": DashboardActive, "dashboard_active": DashboardActive,
} }
header_expanded = var(False) header_expanded = var(default=False)
"""Synchronize the expanded header state in all created header objects.""" """Synchronize the expanded header state in all created header objects."""
__app_instance: ClassVar[Clive | None] = None __app_instance: ClassVar[Clive | None] = None
...@@ -216,7 +216,7 @@ class Clive(App[int], ManualReactive): ...@@ -216,7 +216,7 @@ class Clive(App[int], ManualReactive):
self, self,
screen: Screen[ScreenResultType] | str, screen: Screen[ScreenResultType] | str,
callback: ScreenResultCallbackType[ScreenResultType] | None = None, callback: ScreenResultCallbackType[ScreenResultType] | None = None,
wait_for_dismiss: Literal[False] = False, wait_for_dismiss: Literal[False] = False, # noqa: FBT002
) -> AwaitMount: ... ) -> AwaitMount: ...
@overload @overload
...@@ -224,14 +224,14 @@ class Clive(App[int], ManualReactive): ...@@ -224,14 +224,14 @@ class Clive(App[int], ManualReactive):
self, self,
screen: Screen[ScreenResultType] | str, screen: Screen[ScreenResultType] | str,
callback: ScreenResultCallbackType[ScreenResultType] | None = None, callback: ScreenResultCallbackType[ScreenResultType] | None = None,
wait_for_dismiss: Literal[True] = True, wait_for_dismiss: Literal[True] = True, # noqa: FBT002
) -> asyncio.Future[ScreenResultType]: ... ) -> asyncio.Future[ScreenResultType]: ...
def push_screen( def push_screen(
self, self,
screen: Screen[ScreenResultType] | str, screen: Screen[ScreenResultType] | str,
callback: ScreenResultCallbackType[ScreenResultType] | None = None, callback: ScreenResultCallbackType[ScreenResultType] | None = None,
wait_for_dismiss: bool = False, wait_for_dismiss: bool = False, # noqa: FBT001, FBT002
) -> AwaitMount | asyncio.Future[ScreenResultType]: ) -> AwaitMount | asyncio.Future[ScreenResultType]:
fun = super().push_screen fun = super().push_screen
return self.__update_screen(lambda: fun(screen=screen, callback=callback, wait_for_dismiss=wait_for_dismiss)) # type: ignore[no-any-return, call-overload] return self.__update_screen(lambda: fun(screen=screen, callback=callback, wait_for_dismiss=wait_for_dismiss)) # type: ignore[no-any-return, call-overload]
......
...@@ -43,7 +43,7 @@ class DataProvider(Container, CliveWidget, Generic[ProviderContentT], AbstractCl ...@@ -43,7 +43,7 @@ class DataProvider(Container, CliveWidget, Generic[ProviderContentT], AbstractCl
_content: ProviderContentT | None = var(None, init=False) # type: ignore[assignment] _content: ProviderContentT | None = var(None, init=False) # type: ignore[assignment]
"""Should be overridden by subclasses to store the data retrieved by the provider.""" """Should be overridden by subclasses to store the data retrieved by the provider."""
updated: bool = var(False) # type: ignore[assignment] updated: bool = var(default=False) # type: ignore[assignment]
""" """
Set to True when the provider has updated the content for the first time. Can be watched. Set to True when the provider has updated the content for the first time. Can be watched.
......
...@@ -139,7 +139,7 @@ class CartItem(ColumnLayout, CliveWidget): ...@@ -139,7 +139,7 @@ class CartItem(ColumnLayout, CliveWidget):
yield ButtonMoveDown(disabled=self.__is_last) yield ButtonMoveDown(disabled=self.__is_last)
yield ButtonDelete() yield ButtonDelete()
def focus(self, _: bool = True) -> Self: def focus(self, _: bool = True) -> Self: # noqa: FBT001, FBT002
if focused := self.app.focused: # Focus the corresponding button as it was before if focused := self.app.focused: # Focus the corresponding button as it was before
assert focused.id, "Previously focused widget has no id!" assert focused.id, "Previously focused widget has no id!"
with contextlib.suppress(NoMatches): with contextlib.suppress(NoMatches):
......
...@@ -26,7 +26,7 @@ class GovernanceActionRow(Horizontal, AbstractClassMessagePump): ...@@ -26,7 +26,7 @@ class GovernanceActionRow(Horizontal, AbstractClassMessagePump):
DEFAULT_CSS = get_css_from_relative_path(__file__) DEFAULT_CSS = get_css_from_relative_path(__file__)
def __init__(self, identifier: str, vote: bool, pending: bool = False) -> None: def __init__(self, identifier: str, *, vote: bool, pending: bool = False) -> None:
""" """
Initialize the GovernanceActionRow. Initialize the GovernanceActionRow.
...@@ -84,14 +84,14 @@ class GovernanceActions(ScrollablePartFocusable): ...@@ -84,14 +84,14 @@ class GovernanceActions(ScrollablePartFocusable):
async def on_mount(self) -> None: # type: ignore[override] async def on_mount(self) -> None: # type: ignore[override]
await self.mount_operations_from_cart() await self.mount_operations_from_cart()
async def add_row(self, identifier: str, vote: bool = False, pending: bool = False) -> None: async def add_row(self, identifier: str, *, vote: bool = False, pending: bool = False) -> None:
# check if action is already in the list, if so - return # check if action is already in the list, if so - return
with contextlib.suppress(NoMatches): with contextlib.suppress(NoMatches):
self.get_widget_by_id(self.create_action_row_id(identifier)) self.get_widget_by_id(self.create_action_row_id(identifier))
return return
await self.mount(self.create_action_row(identifier, vote, pending)) await self.mount(self.create_action_row(identifier, vote=vote, pending=pending))
if vote: if vote:
self.__actions_votes += 1 self.__actions_votes += 1
...@@ -99,11 +99,11 @@ class GovernanceActions(ScrollablePartFocusable): ...@@ -99,11 +99,11 @@ class GovernanceActions(ScrollablePartFocusable):
self.__actions_votes -= 1 self.__actions_votes -= 1
if not pending: if not pending:
self.add_to_actions(identifier, vote) self.add_to_actions(identifier, vote=vote)
self.hook_on_row_added() self.hook_on_row_added()
async def remove_row(self, identifier: str, vote: bool = False) -> None: async def remove_row(self, identifier: str, *, vote: bool = False) -> None:
try: try:
await self.get_widget_by_id(self.create_action_row_id(identifier)).remove() await self.get_widget_by_id(self.create_action_row_id(identifier)).remove()
except NoMatches: except NoMatches:
...@@ -116,7 +116,7 @@ class GovernanceActions(ScrollablePartFocusable): ...@@ -116,7 +116,7 @@ class GovernanceActions(ScrollablePartFocusable):
self.delete_from_actions(identifier) self.delete_from_actions(identifier)
def add_to_actions(self, identifier: str, vote: bool) -> None: def add_to_actions(self, identifier: str, *, vote: bool) -> None:
self.__actions_to_perform[identifier] = vote self.__actions_to_perform[identifier] = vote
def delete_from_actions(self, identifier: str) -> None: def delete_from_actions(self, identifier: str) -> None:
...@@ -143,5 +143,5 @@ class GovernanceActions(ScrollablePartFocusable): ...@@ -143,5 +143,5 @@ class GovernanceActions(ScrollablePartFocusable):
"""Check cart and mount all appropriate operations.""" """Check cart and mount all appropriate operations."""
@abstractmethod @abstractmethod
def create_action_row(self, identifier: str, vote: bool, pending: bool) -> GovernanceActionRow: def create_action_row(self, identifier: str, *, vote: bool, pending: bool) -> GovernanceActionRow:
pass pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment