From 534338dc59fffca27fadedf2026102dc0421ed29 Mon Sep 17 00:00:00 2001 From: Karthikeyan Singaravelan Date: Sun, 24 Apr 2022 14:10:35 +0000 Subject: [PATCH] Import ABC from collections.abc for Python 3.10 compatibility. --- dso/dso/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dso/dso/utils.py b/dso/dso/utils.py index e33bcb7..bbbb012 100644 --- a/dso/dso/utils.py +++ b/dso/dso/utils.py @@ -1,6 +1,5 @@ """Utility functions used in deep symbolic optimization.""" -import collections import copy import functools import numpy as np @@ -10,6 +9,11 @@ import os import pandas as pd +try: + from collections.abc import Mapping +except ImportError: + from collections import Mapping + def is_float(s): """Determine whether the input variable can be cast to float.""" @@ -154,7 +158,7 @@ def safe_merge_dicts(base_dict, update_dict): return update_dict base_dict = copy.deepcopy(base_dict) for key, value in update_dict.items(): - if isinstance(value, collections.Mapping): + if isinstance(value, Mapping): base_dict[key] = safe_merge_dicts(base_dict.get(key, {}), value) else: base_dict[key] = value