mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-08 18:59:59 +00:00
move project metadata to pyproject.toml (#555)
also: replace flake8 by ruff.
This commit is contained in:
parent
7b75b4f368
commit
423c6df265
14 changed files with 57 additions and 54 deletions
|
|
@ -2,7 +2,6 @@ from .exceptions import *
|
|||
from .ext import ExtType, Timestamp
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
version = (1, 0, 5)
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue