Skip to content

Commit 258e0f3

Browse files
committed
Get collections ABCs from collections.abc
1 parent 674dc95 commit 258e0f3

File tree

16 files changed

+29
-29
lines changed

16 files changed

+29
-29
lines changed

source_py3/python_toolbox/combi/chain_space.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616

17-
class ChainSpace(sequence_tools.CuteSequenceMixin, collections.Sequence):
17+
class ChainSpace(sequence_tools.CuteSequenceMixin, collections.abc.Sequence):
1818
'''
1919
A space of sequences chained together.
2020

source_py3/python_toolbox/combi/map_space.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313

14-
class MapSpace(sequence_tools.CuteSequenceMixin, collections.Sequence):
14+
class MapSpace(sequence_tools.CuteSequenceMixin, collections.abc.Sequence):
1515
'''
1616
A space of a function applied to a sequence.
1717

source_py3/python_toolbox/combi/perming/perm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __getitem__(self, i): pass
3131

3232

3333
class PermItems(sequence_tools.CuteSequenceMixin, _BasePermView,
34-
collections.Sequence):
34+
collections.abc.Sequence):
3535
'''
3636
A viewer of a perm's items, similar to `dict.items()`.
3737
@@ -46,7 +46,7 @@ def __getitem__(self, i):
4646

4747

4848
class PermAsDictoid(sequence_tools.CuteSequenceMixin, _BasePermView,
49-
collections.Mapping):
49+
collections.abc.Mapping):
5050
'''A dict-like interface to a `Perm`.'''
5151
def __getitem__(self, key):
5252
return self.perm[key]
@@ -69,7 +69,7 @@ def __call__(cls, item, perm_space=None):
6969

7070

7171
@functools.total_ordering
72-
class Perm(sequence_tools.CuteSequenceMixin, collections.Sequence,
72+
class Perm(sequence_tools.CuteSequenceMixin, collections.abc.Sequence,
7373
metaclass=PermType):
7474
'''
7575
A permutation of items from a `PermSpace`.

source_py3/python_toolbox/combi/perming/perm_space.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __call__(cls, *args, **kwargs):
5959

6060
class PermSpace(_VariationRemovingMixin, _VariationAddingMixin,
6161
_FixedMapManagingMixin, sequence_tools.CuteSequenceMixin,
62-
collections.Sequence, metaclass=PermSpaceType):
62+
collections.abc.Sequence, metaclass=PermSpaceType):
6363
'''
6464
A space of permutations on a sequence.
6565

source_py3/python_toolbox/combi/product_space.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from python_toolbox import sequence_tools
88

99

10-
class ProductSpace(sequence_tools.CuteSequenceMixin, collections.Sequence):
10+
class ProductSpace(sequence_tools.CuteSequenceMixin, collections.abc.Sequence):
1111
'''
1212
A product space between sequences.
1313
@@ -70,7 +70,7 @@ def __getitem__(self, i):
7070

7171
def index(self, given_sequence):
7272
'''Get the index number of `given_sequence` in this product space.'''
73-
if not isinstance(given_sequence, collections.Sequence) or \
73+
if not isinstance(given_sequence, collections.abc.Sequence) or \
7474
not len(given_sequence) == len(self.sequences):
7575
raise ValueError
7676

source_py3/python_toolbox/combi/selection_space.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class SelectionSpace(sequence_tools.CuteSequenceMixin,
10-
collections.Sequence):
10+
collections.abc.Sequence):
1111
'''
1212
Space of possible selections of any number of items from `sequence`.
1313

source_py3/python_toolbox/logic_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def get_equivalence_classes(iterable, key=None, container=set, *,
105105
### Pre-processing input: #################################################
106106
# #
107107
if key is None:
108-
if isinstance(iterable, collections.Mapping):
108+
if isinstance(iterable, collections.abc.Mapping):
109109
d = iterable
110110
else:
111111
try:

source_py3/python_toolbox/nifty_collections/abstract.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Ordered(metaclass=abc.ABCMeta):
2020
__slots__ = ()
2121

2222

23-
Ordered.register(collections.Sequence)
23+
Ordered.register(collections.abc.Sequence)
2424
Ordered.register(collections.OrderedDict)
2525
Ordered.register(collections.deque)
2626
Ordered.register(queue.Queue)

source_py3/python_toolbox/nifty_collections/bagging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class _BaseBagMixin:
148148
def __init__(self, iterable={}):
149149
super().__init__()
150150

151-
if isinstance(iterable, collections.Mapping):
151+
if isinstance(iterable, collections.abc.Mapping):
152152
for key, value, in iterable.items():
153153
try:
154154
self._dict[key] = _process_count(value)

source_py3/python_toolbox/nifty_collections/lazy_tuple.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _with_lock(method, *args, **kwargs):
4545

4646

4747
@functools.total_ordering
48-
class LazyTuple(collections.Sequence):
48+
class LazyTuple(collections.abc.Sequence):
4949
'''
5050
A lazy tuple which requests as few values as possible from its iterator.
5151
@@ -75,8 +75,8 @@ def my_generator():
7575
'''
7676

7777
def __init__(self, iterable, definitely_infinite=False):
78-
was_given_a_sequence = isinstance(iterable, collections.Sequence) and \
79-
not isinstance(iterable, LazyTuple)
78+
was_given_a_sequence = isinstance(iterable, collections.abc.Sequence) \
79+
and not isinstance(iterable, LazyTuple)
8080

8181
self.is_exhausted = True if was_given_a_sequence else False
8282
'''Flag saying whether the internal iterator is tobag exhausted.'''

0 commit comments

Comments
 (0)