refactor: Update config to use future annotations and move merge_dicts to misc.

This commit is contained in:
UpstreamData
2024-01-25 11:32:03 -07:00
parent c5eed797ec
commit b328a27f04
8 changed files with 64 additions and 55 deletions

View File

@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and -
# limitations under the License. -
# ------------------------------------------------------------------------------
from copy import deepcopy
from pyasic.rpc import APIError
@@ -76,3 +78,14 @@ def api_min_version(version: str):
return inner
return decorator
def merge_dicts(a: dict, b: dict) -> dict:
result = deepcopy(a)
for b_key, b_val in b.items():
a_val = result.get(b_key)
if isinstance(a_val, dict) and isinstance(b_val, dict):
result[b_key] = merge_dicts(a_val, b_val)
else:
result[b_key] = deepcopy(b_val)
return result