From f7683262f83ea128bb6a2f4ff1de3e705a089aed Mon Sep 17 00:00:00 2001 From: Andrew Rabert Date: Tue, 14 Jul 2020 10:03:16 -0400 Subject: [PATCH] Use non-deprecated collections.abc See https://docs.python.org/3.9/whatsnew/3.9.html#you-should-check-for-deprecationwarning-in-your-code --- sprockets/mixins/mediatype/transcoders.py | 62 +++++++++++------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/sprockets/mixins/mediatype/transcoders.py b/sprockets/mixins/mediatype/transcoders.py index a5123f0..bc201b9 100644 --- a/sprockets/mixins/mediatype/transcoders.py +++ b/sprockets/mixins/mediatype/transcoders.py @@ -159,35 +159,35 @@ class MsgPackTranscoder(handlers.BinaryContentHandler): an input value before passing it to :func:`umsgpack.packb`. Values are normalized according to the following table. - +-------------------------------+-------------------------------+ - | **Value** | **MsgPack Family** | - +-------------------------------+-------------------------------+ - | :data:`None` | `nil byte`_ (0xC0) | - +-------------------------------+-------------------------------+ - | :data:`True` | `true byte`_ (0xC3) | - +-------------------------------+-------------------------------+ - | :data:`False` | `false byte`_ (0xC2) | - +-------------------------------+-------------------------------+ - | :class:`int` | `integer family`_ | - +-------------------------------+-------------------------------+ - | :class:`float` | `float family`_ | - +-------------------------------+-------------------------------+ - | String | `str family`_ | - +-------------------------------+-------------------------------+ - | :class:`bytes` | `bin family`_ | - +-------------------------------+-------------------------------+ - | :class:`bytearray` | `bin family`_ | - +-------------------------------+-------------------------------+ - | :class:`memoryview` | `bin family`_ | - +-------------------------------+-------------------------------+ - | :class:`collections.Sequence` | `array family`_ | - +-------------------------------+-------------------------------+ - | :class:`collections.Set` | `array family`_ | - +-------------------------------+-------------------------------+ - | :class:`collections.Mapping` | `map family`_ | - +-------------------------------+-------------------------------+ - | :class:`uuid.UUID` | Converted to String | - +-------------------------------+-------------------------------+ + +-----------------------------------+-------------------------------+ + | **Value** | **MsgPack Family** | + +-----------------------------------+-------------------------------+ + | :data:`None` | `nil byte`_ (0xC0) | + +-----------------------------------+-------------------------------+ + | :data:`True` | `true byte`_ (0xC3) | + +-----------------------------------+-------------------------------+ + | :data:`False` | `false byte`_ (0xC2) | + +-----------------------------------+-------------------------------+ + | :class:`int` | `integer family`_ | + +-----------------------------------+-------------------------------+ + | :class:`float` | `float family`_ | + +-----------------------------------+-------------------------------+ + | String | `str family`_ | + +-----------------------------------+-------------------------------+ + | :class:`bytes` | `bin family`_ | + +-----------------------------------+-------------------------------+ + | :class:`bytearray` | `bin family`_ | + +-----------------------------------+-------------------------------+ + | :class:`memoryview` | `bin family`_ | + +-----------------------------------+-------------------------------+ + | :class:`collections.abc.Sequence` | `array family`_ | + +-----------------------------------+-------------------------------+ + | :class:`collections.abc.Set` | `array family`_ | + +-----------------------------------+-------------------------------+ + | :class:`collections.abc.Mapping` | `map family`_ | + +-----------------------------------+-------------------------------+ + | :class:`uuid.UUID` | Converted to String | + +-----------------------------------+-------------------------------+ .. _nil byte: https://github.com/msgpack/msgpack/blob/ 0b8f5ac67cdd130f4d4d4fe6afb839b989fdb86a/spec.md#formats-nil @@ -231,10 +231,10 @@ class MsgPackTranscoder(handlers.BinaryContentHandler): if isinstance(datum, (bytes, str)): return datum - if isinstance(datum, (collections.Sequence, collections.Set)): + if isinstance(datum, (collections.abc.Sequence, collections.abc.Set)): return [self.normalize_datum(item) for item in datum] - if isinstance(datum, collections.Mapping): + if isinstance(datum, collections.abc.Mapping): out = {} for k, v in datum.items(): out[k] = self.normalize_datum(v)