From fee777373fa3a3e932ecc7910e709e8d9bf0c723 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 9 Jul 2025 21:06:30 -0400 Subject: [PATCH 1/2] fewer mutable defaults --- chia/wallet/cat_wallet/cat_wallet.py | 5 ++++- chia/wallet/vc_wallet/cr_cat_wallet.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/chia/wallet/cat_wallet/cat_wallet.py b/chia/wallet/cat_wallet/cat_wallet.py index 9885976e7d6d..cb89ae73fa33 100644 --- a/chia/wallet/cat_wallet/cat_wallet.py +++ b/chia/wallet/cat_wallet/cat_wallet.py @@ -254,8 +254,11 @@ async def create_from_puzzle_info( puzzle_driver: PuzzleInfo, name: Optional[str] = None, # We're hinting this as Any for mypy by should explore adding this to the wallet protocol and hinting properly - potential_subclasses: dict[AssetType, Any] = {}, + potential_subclasses: Optional[dict[AssetType, Any]] = None, ) -> Any: + if potential_subclasses is None: + potential_subclasses = {} + next_layer: Optional[PuzzleInfo] = puzzle_driver.also() if next_layer is not None: if AssetType(next_layer.type()) in potential_subclasses: diff --git a/chia/wallet/vc_wallet/cr_cat_wallet.py b/chia/wallet/vc_wallet/cr_cat_wallet.py index df569a18248c..297000b2904a 100644 --- a/chia/wallet/vc_wallet/cr_cat_wallet.py +++ b/chia/wallet/vc_wallet/cr_cat_wallet.py @@ -134,8 +134,11 @@ async def create_from_puzzle_info( puzzle_driver: PuzzleInfo, name: Optional[str] = None, # We're hinting this as Any for mypy by should explore adding this to the wallet protocol and hinting properly - potential_subclasses: dict[AssetType, Any] = {}, + potential_subclasses: Optional[dict[AssetType, Any]] = None, ) -> Any: + if potential_subclasses is None: + potential_subclasses = {} + cr_layer: Optional[PuzzleInfo] = puzzle_driver.also() if cr_layer is None: # pragma: no cover raise ValueError("create_from_puzzle_info called on CRCATWallet with a non CR-CAT puzzle driver") From ee2d7daa2c9d88ab74bfbfff20a5aec21e839976 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Mon, 14 Jul 2025 10:58:00 -0400 Subject: [PATCH 2/2] catchup --- chia/wallet/cat_wallet/r_cat_wallet.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chia/wallet/cat_wallet/r_cat_wallet.py b/chia/wallet/cat_wallet/r_cat_wallet.py index 19eed3fb86f0..2300e511978c 100644 --- a/chia/wallet/cat_wallet/r_cat_wallet.py +++ b/chia/wallet/cat_wallet/r_cat_wallet.py @@ -139,8 +139,11 @@ async def create_from_puzzle_info( puzzle_driver: PuzzleInfo, name: Optional[str] = None, # We're hinting this as Any for mypy by should explore adding this to the wallet protocol and hinting properly - potential_subclasses: dict[AssetType, Any] = {}, + potential_subclasses: Optional[dict[AssetType, Any]] = None, ) -> Any: + if potential_subclasses is None: + potential_subclasses = {} + rev_layer: Optional[PuzzleInfo] = puzzle_driver.also() if rev_layer is None: raise ValueError("create_from_puzzle_info called on RCATWallet with a non R-CAT puzzle driver")