Skip to content

Commit 2379b01

Browse files
authored
Merge pull request #762 from jathpala/collections.abc
Corrects import of MutableMapping class for python 3.3+ (required for 3.8)
2 parents c639d9a + 040a2f4 commit 2379b01

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

nibabel/streamlines/tractogram.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import copy
22
import numbers
33
import numpy as np
4-
import collections
54
from warnings import warn
65

6+
try:
7+
from collections.abc import MutableMapping
8+
except ImportError:
9+
# PY2 compatibility
10+
from collections import MutableMapping
11+
712
from nibabel.affines import apply_affine
813

914
from .array_sequence import ArraySequence
@@ -19,7 +24,7 @@ def is_lazy_dict(obj):
1924
return is_data_dict(obj) and callable(list(obj.store.values())[0])
2025

2126

22-
class SliceableDataDict(collections.MutableMapping):
27+
class SliceableDataDict(MutableMapping):
2328
""" Dictionary for which key access can do slicing on the values.
2429
2530
This container behaves like a standard dictionary but extends key access to
@@ -181,7 +186,7 @@ def _extend_entry(self, key, value):
181186
self[key].extend(value)
182187

183188

184-
class LazyDict(collections.MutableMapping):
189+
class LazyDict(MutableMapping):
185190
""" Dictionary of generator functions.
186191
187192
This container behaves like a dictionary but it makes sure its elements are

0 commit comments

Comments
 (0)