Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions dso/dso/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Utility functions used in deep symbolic optimization."""

import collections
import copy
import functools
import numpy as np
Expand All @@ -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."""
Expand Down Expand Up @@ -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
Expand Down