move project metadata to pyproject.toml (#555)

also: replace flake8 by ruff.
This commit is contained in:
TW 2023-09-05 03:51:04 +02:00 committed by GitHub
parent 7b75b4f368
commit 423c6df265
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 57 additions and 54 deletions

View file

@ -2,7 +2,6 @@ from .exceptions import *
from .ext import ExtType, Timestamp
import os
import sys
version = (1, 0, 5)

View file

@ -1,6 +1,5 @@
from collections import namedtuple
import datetime
import sys
import struct
@ -20,8 +19,9 @@ class ExtType(namedtuple("ExtType", "code data")):
class Timestamp:
"""Timestamp represents the Timestamp extension type in msgpack.
When built with Cython, msgpack uses C methods to pack and unpack `Timestamp`. When using pure-Python
msgpack, :func:`to_bytes` and :func:`from_bytes` are used to pack and unpack `Timestamp`.
When built with Cython, msgpack uses C methods to pack and unpack `Timestamp`.
When using pure-Python msgpack, :func:`to_bytes` and :func:`from_bytes` are used to pack and
unpack `Timestamp`.
This class is immutable: Do not override seconds and nanoseconds.
"""
@ -39,7 +39,7 @@ class Timestamp:
Number of nanoseconds to add to `seconds` to get fractional time.
Maximum is 999_999_999. Default is 0.
Note: Negative times (before the UNIX epoch) are represented as negative seconds + positive ns.
Note: Negative times (before the UNIX epoch) are represented as neg. seconds + pos. ns.
"""
if not isinstance(seconds, int):
raise TypeError("seconds must be an integer")

View file

@ -530,7 +530,7 @@ class Unpacker:
key = self._unpack(EX_CONSTRUCT)
if self._strict_map_key and type(key) not in (str, bytes):
raise ValueError("%s is not allowed for map key" % str(type(key)))
if type(key) is str:
if isinstance(key, str):
key = sys.intern(key)
ret[key] = self._unpack(EX_CONSTRUCT)
if self._object_hook is not None: