Skip to content

Commit

Permalink
Merge pull request #854 from PCMDI/lee1043-patch-1
Browse files Browse the repository at this point in the history
Import Mapping function from collections.abc to comply with Python 3.10
  • Loading branch information
lee1043 committed Jun 10, 2022
2 parents 9f6e1bf + 1a59193 commit 4cd9f2b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion pcmdi_metrics/io/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import logging
import os
import re
from collections import Mapping, OrderedDict
from collections import OrderedDict
from collections.abc import Mapping

import cdat_info
import cdms2
Expand Down
4 changes: 2 additions & 2 deletions pcmdi_metrics/mjo/lib/dict_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# Modifed by Jiwoo Lee, 2020-06-26: Skip merging when dict is empty

import collections
from collections.abc import Mapping


def dict_merge(dct, merge_dct):
Expand All @@ -36,7 +36,7 @@ def dict_merge(dct, merge_dct):
if (
k in dct
and isinstance(dct[k], dict)
and isinstance(merge_dct[k], collections.Mapping)
and isinstance(merge_dct[k], Mapping)
):
dict_merge(dct[k], merge_dct[k])
else:
Expand Down
4 changes: 2 additions & 2 deletions pcmdi_metrics/variability_mode/lib/dict_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

import collections
from collections.abc import Mapping


def dict_merge(dct, merge_dct):
Expand All @@ -32,7 +32,7 @@ def dict_merge(dct, merge_dct):
if (
k in dct
and isinstance(dct[k], dict)
and isinstance(merge_dct[k], collections.Mapping)
and isinstance(merge_dct[k], Mapping)
):
dict_merge(dct[k], merge_dct[k])
else:
Expand Down

0 comments on commit 4cd9f2b

Please sign in to comment.