mirror of
https://github.com/sprockets/sprockets.mixins.mediatype.git
synced 2024-12-28 11:24:12 +00:00
Use non-deprecated collections.abc
See https://docs.python.org/3.9/whatsnew/3.9.html#you-should-check-for-deprecationwarning-in-your-code
This commit is contained in:
parent
3dadd00c64
commit
f7683262f8
1 changed files with 31 additions and 31 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue