Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import ABC from collections.abc for Python 3.10 compatibility. #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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