Skip to content

Commit

Permalink
Import ABC from collections.abc instead of collections for Python 3 c…
Browse files Browse the repository at this point in the history
…ompatibility.
  • Loading branch information
tirkarthi authored and mriehl committed Sep 10, 2021
1 parent 5b2a27f commit 1ed6950
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/python/fysom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

import collections
import functools
import weakref
import types
import sys

try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping

__author__ = 'Mansour Behabadi'
__copyright__ = 'Copyright 2011, Mansour Behabadi and Jake Gordon'
__credits__ = ['Mansour Behabadi', 'Jake Gordon']
Expand Down Expand Up @@ -159,7 +163,7 @@ def __init__(self, cfg={}, initial=None, events=None, callbacks=None,
# convert 3-tuples in the event specification to dicts
events_dicts = []
for e in cfg["events"]:
if isinstance(e, collections.Mapping):
if isinstance(e, Mapping):
events_dicts.append(e)
elif hasattr(e, "__iter__"):
name, src, dst = list(e)[:3]
Expand Down Expand Up @@ -520,7 +524,7 @@ def is_very_angry(self, event):
# convert 3-tuples in the event specification to dicts
events_dicts = []
for e in cfg["events"]:
if isinstance(e, collections.Mapping):
if isinstance(e, Mapping):
events_dicts.append(e)
elif hasattr(e, "__iter__"):
name, src, dst = list(e)[:3]
Expand Down

0 comments on commit 1ed6950

Please sign in to comment.