Skip to content

Commit

Permalink
Merge pull request #467 from tirkarthi/fix-collections
Browse files Browse the repository at this point in the history
Import ABC from collections.abc for Python 3.10 compatibility.
  • Loading branch information
adelavega committed Sep 21, 2022
2 parents 6e5e23b + a9a1543 commit 4237acd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pliers/utils/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
''' Miscellaneous internal utilities. '''

import collections
import collections.abc
import os
from abc import ABCMeta, abstractmethod, abstractproperty
from types import GeneratorType
Expand All @@ -25,7 +26,7 @@ def listify(obj):
def flatten(l):
''' Flatten an iterable. '''
for el in l:
if isinstance(el, collections.Iterable) and not isinstance(el, str):
if isinstance(el, collections.abc.Iterable) and not isinstance(el, str):
yield from flatten(el)
else:
yield el
Expand All @@ -39,7 +40,7 @@ def flatten_dict(d, parent_key='', sep='_'):
items = []
for k, v in d.items():
new_key = parent_key + sep + k if parent_key else k
if isinstance(v, collections.MutableMapping):
if isinstance(v, collections.abc.MutableMapping):
items.extend(flatten_dict(v, new_key, sep=sep).items())
else:
items.append((new_key, v))
Expand Down

0 comments on commit 4237acd

Please sign in to comment.