Drop Python 3.6 support (#543)

The following steps have been taken:

1. Black was updated to latest version. The code has been formatted with
the new version.
2. The pyupgrade utility is installed. This helped to remove all the
code that was needed to support Python < 3.7.

Fix #541.

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
This commit is contained in:
Evgeny Markov 2023-05-23 18:41:08 +02:00 committed by GitHub
parent feec06206c
commit c8d0751fe3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 60 additions and 119 deletions

View file

@ -1,5 +1,3 @@
# coding: utf-8
from collections import namedtuple
from msgpack import packb, unpackb, ExtType
@ -10,7 +8,7 @@ def test_namedtuple():
def default(o):
if isinstance(o, T):
return dict(o._asdict())
raise TypeError("Unsupported type %s" % (type(o),))
raise TypeError(f"Unsupported type {type(o)}")
packed = packb(T(1, 42), strict_types=True, use_bin_type=True, default=default)
unpacked = unpackb(packed, raw=False)
@ -23,7 +21,7 @@ def test_tuple():
def default(o):
if isinstance(o, tuple):
return {"__type__": "tuple", "value": list(o)}
raise TypeError("Unsupported type %s" % (type(o),))
raise TypeError(f"Unsupported type {type(o)}")
def convert(o):
if o.get("__type__") == "tuple":
@ -44,9 +42,7 @@ def test_tuple_ext():
def default(o):
if isinstance(o, tuple):
# Convert to list and pack
payload = packb(
list(o), strict_types=True, use_bin_type=True, default=default
)
payload = packb(list(o), strict_types=True, use_bin_type=True, default=default)
return ExtType(MSGPACK_EXT_TYPE_TUPLE, payload)
raise TypeError(repr(o))
@ -54,7 +50,7 @@ def test_tuple_ext():
if code == MSGPACK_EXT_TYPE_TUPLE:
# Unpack and convert to tuple
return tuple(unpackb(payload, raw=False, ext_hook=convert))
raise ValueError("Unknown Ext code {}".format(code))
raise ValueError(f"Unknown Ext code {code}")
data = packb(t, strict_types=True, use_bin_type=True, default=default)
expected = unpackb(data, raw=False, ext_hook=convert)