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. #467

Merged
merged 2 commits into from
Sep 21, 2022
Merged
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
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