From 0e2215bc0cbbc2478b517c28410d580880cf2aaf Mon Sep 17 00:00:00 2001 From: robcxyz Date: Sun, 31 Dec 2023 10:33:54 -0800 Subject: [PATCH] chore: change hook create from copy to deepcopy because of nested key update --- tackle/hooks.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tackle/hooks.py b/tackle/hooks.py index 91696982..b89c7ed3 100644 --- a/tackle/hooks.py +++ b/tackle/hooks.py @@ -5,6 +5,7 @@ import re import typing import typing as typing_types +from copy import deepcopy from functools import partial, partialmethod from typing import Annotated, Any, Callable, Optional, Type, TypeVar, Union @@ -121,9 +122,7 @@ def dcl_hook_exec( input_element = {tmp_key: input_element} hook_context.data.input = input_element - public_data = get_public_data_from_walk( - context=hook_context, value=input_element.copy() - ) + public_data = get_public_data_from_walk(context=hook_context, value=input_element) if tmp_key: return public_data[tmp_key] return public_data @@ -804,7 +803,7 @@ def create_dcl_method( return create_dcl_hook( context=context, hook_name=arg, - hook_input_raw=method.input_raw.copy(), + hook_input_raw=method.input_raw, ) @@ -864,7 +863,7 @@ def get_hooks_from_namespace( Hook = create_dcl_hook( context=context, hook_name=hook_name, - hook_input_raw=Hook.input_raw.copy(), + hook_input_raw=deepcopy(Hook.input_raw), ) return Hook