Skip to content

Commit

Permalink
misc: use collections.abc to import ABCs from.
Browse files Browse the repository at this point in the history
Squelches remaining warnings of this type:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  • Loading branch information
veox authored and cburgdorf committed May 9, 2019
1 parent bb898f8 commit 957dfdb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions rlp/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def encode_raw(item):
return item
payload = item
prefix_offset = 128 # string
elif not isinstance(item, str) and isinstance(item, collections.Sequence):
elif not isinstance(item, str) and isinstance(item, collections.abc.Sequence):
payload = b''.join(encode_raw(x) for x in item)
prefix_offset = 192 # list
else:
Expand Down Expand Up @@ -274,7 +274,7 @@ def infer_sedes(obj):
return big_endian_int
elif BinaryClass.is_valid_type(obj):
return binary
elif not isinstance(obj, str) and isinstance(obj, collections.Sequence):
elif not isinstance(obj, str) and isinstance(obj, collections.abc.Sequence):
return List(map(infer_sedes, obj))
elif isinstance(obj, bool):
return boolean
Expand Down
2 changes: 1 addition & 1 deletion rlp/sedes/lists.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Module for sedes objects that use lists as serialization format.
"""
from collections import Sequence
from collections.abc import Sequence

from eth_utils import (
to_list,
Expand Down
2 changes: 1 addition & 1 deletion rlp/sedes/serializable.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def Changeset(obj, changes):
return cls(obj, changes)


class BaseSerializable(collections.Sequence):
class BaseSerializable(collections.abc.Sequence):
def __init__(self, *args, **kwargs):
if kwargs:
field_values = merge_kwargs_to_args(args, kwargs, self._meta.field_names)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_lazy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections import Sequence
from collections.abc import Sequence

import pytest

Expand Down

0 comments on commit 957dfdb

Please sign in to comment.