From e6c1a9baec74620d0f7579ed0fc0140641ab6eb8 Mon Sep 17 00:00:00 2001 From: Rigidity Date: Tue, 12 Dec 2023 12:59:12 -0500 Subject: [PATCH 1/4] Add a few missing type annotations --- chia/cmds/check_wallet_db.py | 2 +- chia/util/keyring_wrapper.py | 2 +- chia/util/struct_stream.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chia/cmds/check_wallet_db.py b/chia/cmds/check_wallet_db.py index 14fdcfb6fdbe..daae2194c816 100644 --- a/chia/cmds/check_wallet_db.py +++ b/chia/cmds/check_wallet_db.py @@ -206,7 +206,7 @@ def print_min_max_derivation_for_wallets(derivation_paths: List[DerivationPath]) class WalletDBReader: db_wrapper: DBWrapper2 # TODO: Remove db_wrapper member config = {"db_readers": 1} - sql_log_path = None + sql_log_path: Optional[Path] = None verbose = False async def get_all_wallets(self) -> List[Wallet]: diff --git a/chia/util/keyring_wrapper.py b/chia/util/keyring_wrapper.py index 0dbe5d05140e..7ccdf50d4b6f 100644 --- a/chia/util/keyring_wrapper.py +++ b/chia/util/keyring_wrapper.py @@ -63,7 +63,7 @@ class KeyringWrapper: """ # Static members - __shared_instance = None + __shared_instance: Optional[KeyringWrapper] = None __keys_root_path: Path = DEFAULT_KEYS_ROOT_PATH # Instance members diff --git a/chia/util/struct_stream.py b/chia/util/struct_stream.py index 5ac943647028..f0d2a265f5ce 100644 --- a/chia/util/struct_stream.py +++ b/chia/util/struct_stream.py @@ -89,4 +89,4 @@ def stream_to_bytes(self) -> bytes: # this is meant to avoid mixing up construcing a bytes object of a specific # size (i.e. bytes(int)) vs. serializing the integer to bytes (i.e. bytes(uint32)) - __bytes__ = None + __bytes__: None = None From edd8983b8d38dd6c3f7b9696e4c6b26face98006 Mon Sep 17 00:00:00 2001 From: Rigidity <35380458+Rigidity@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:29:06 -0500 Subject: [PATCH 2/4] Update chia/util/struct_stream.py Co-authored-by: Kyle Altendorf --- chia/util/struct_stream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chia/util/struct_stream.py b/chia/util/struct_stream.py index f0d2a265f5ce..5ac943647028 100644 --- a/chia/util/struct_stream.py +++ b/chia/util/struct_stream.py @@ -89,4 +89,4 @@ def stream_to_bytes(self) -> bytes: # this is meant to avoid mixing up construcing a bytes object of a specific # size (i.e. bytes(int)) vs. serializing the integer to bytes (i.e. bytes(uint32)) - __bytes__: None = None + __bytes__ = None From 51cea6935258e4d4cdb353566135a0b3aca50596 Mon Sep 17 00:00:00 2001 From: Rigidity <35380458+Rigidity@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:29:59 -0500 Subject: [PATCH 3/4] Update chia/util/keyring_wrapper.py Co-authored-by: Kyle Altendorf --- chia/util/keyring_wrapper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chia/util/keyring_wrapper.py b/chia/util/keyring_wrapper.py index 7ccdf50d4b6f..43f2d296fc77 100644 --- a/chia/util/keyring_wrapper.py +++ b/chia/util/keyring_wrapper.py @@ -63,8 +63,8 @@ class KeyringWrapper: """ # Static members - __shared_instance: Optional[KeyringWrapper] = None - __keys_root_path: Path = DEFAULT_KEYS_ROOT_PATH + __shared_instance: ClassVar[Optional[KeyringWrapper]] = None + __keys_root_path: ClassVar[Path] = DEFAULT_KEYS_ROOT_PATH # Instance members keys_root_path: Path From 15e535ca66a7b0bee54e42f793a99b484641e6ee Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Tue, 2 Jan 2024 13:33:35 -0500 Subject: [PATCH 4/4] add `ClassVar` import --- chia/util/keyring_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chia/util/keyring_wrapper.py b/chia/util/keyring_wrapper.py index 43f2d296fc77..0901d5a9e2b3 100644 --- a/chia/util/keyring_wrapper.py +++ b/chia/util/keyring_wrapper.py @@ -2,7 +2,7 @@ from pathlib import Path from sys import platform -from typing import Optional, Tuple, Union, overload +from typing import ClassVar, Optional, Tuple, Union, overload from keyring.backends.macOS import Keyring as MacKeyring from keyring.backends.Windows import WinVaultKeyring as WinKeyring