msgpack-types 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,21 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: msgpack-types
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Type stubs for msgpack
5
5
  Home-page: https://github.com/sbdchd/msgpack-types
6
6
  License: Apache-2.0
7
7
  Keywords: msgpack,types,mypy,stubs
8
8
  Author: Steve Dignam
9
9
  Author-email: steve@dignam.xyz
10
- Requires-Python: >=3.7,<4.0
10
+ Requires-Python: >=3.8,<4.0
11
11
  Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.7
14
13
  Classifier: Programming Language :: Python :: 3.8
15
14
  Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
17
16
  Classifier: Programming Language :: Python :: 3.11
18
17
  Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Dist: msgpack (>=1.1.0,<1.2.0)
19
19
  Project-URL: Repository, https://github.com/sbdchd/msgpack-types
20
20
  Description-Content-Type: text/markdown
21
21
 
@@ -1,8 +1,11 @@
1
1
  from __future__ import annotations
2
- from typing import Any, Callable, Dict, List, Optional, Tuple
3
- from msgpack._version import version
4
- from msgpack import _version
5
- from msgpack.exceptions import (
2
+
3
+ from collections.abc import Callable
4
+ from typing import Any
5
+
6
+ from typing_extensions import Protocol
7
+
8
+ from .exceptions import (
6
9
  BufferFull,
7
10
  ExtraData,
8
11
  FormatError,
@@ -14,51 +17,57 @@ from msgpack.exceptions import (
14
17
  UnpackException,
15
18
  UnpackValueError,
16
19
  )
17
- from typing_extensions import Protocol
18
- from msgpack.fallback import Packer, Unpacker, unpackb
19
- from msgpack import exceptions
20
- from msgpack.ext import ExtType, Timestamp
21
- from msgpack import ext
20
+ from .ext import ExtType, Timestamp
21
+ from .fallback import Packer, Unpacker, unpackb
22
+
23
+ version: tuple[int, int, int] = ...
24
+ __version__: str = ...
25
+
26
+ class _WriteStream(Protocol):
27
+ def write(self, b: bytes) -> int: ...
22
28
 
23
29
  class _Stream(Protocol):
24
30
  def read(self) -> bytes: ...
25
31
 
26
32
  class _FileLike(Protocol):
27
- def read(n: int) -> bytes: ...
33
+ def read(self, n: int) -> bytes: ...
28
34
 
29
35
  def pack(
30
36
  o: Any,
31
- stream: _Stream,
32
- default: Optional[Callable[[Any], Any]] = ...,
37
+ stream: _WriteStream,
38
+ *,
39
+ default: Callable[[Any], Any] | None = ...,
33
40
  use_single_float: bool = ...,
34
41
  autoreset: bool = ...,
35
42
  use_bin_type: bool = ...,
36
43
  strict_types: bool = ...,
37
44
  datetime: bool = ...,
38
- unicode_errors: Optional[str] = ...,
45
+ unicode_errors: str | None = ...,
39
46
  ) -> None: ...
40
47
  def packb(
41
48
  o: Any,
42
- default: Optional[Callable[[Any], Any]] = ...,
49
+ *,
50
+ default: Callable[[Any], Any] | None = ...,
43
51
  use_single_float: bool = ...,
44
52
  autoreset: bool = ...,
45
53
  use_bin_type: bool = ...,
46
54
  strict_types: bool = ...,
47
55
  datetime: bool = ...,
48
- unicode_errors: Optional[str] = ...,
56
+ unicode_errors: str | None = ...,
49
57
  ) -> bytes: ...
50
58
  def unpack(
51
59
  stream: _Stream,
52
- file_like: Optional[_FileLike] = ...,
60
+ *,
61
+ file_like: _FileLike | None = ...,
53
62
  read_size: int = ...,
54
63
  use_list: bool = ...,
55
64
  raw: bool = ...,
56
65
  timestamp: int = ...,
57
66
  strict_map_key: bool = ...,
58
- object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
59
- object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
60
- list_hook: Optional[Callable[[List[Any]], Any]] = ...,
61
- unicode_errors: Optional[str] = ...,
67
+ object_hook: Callable[[dict[Any, Any]], Any] | None = ...,
68
+ object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = ...,
69
+ list_hook: Callable[[list[Any]], Any] | None = ...,
70
+ unicode_errors: str | None = ...,
62
71
  max_buffer_size: int = ...,
63
72
  ext_hook: Callable[[int, bytes], Any] = ...,
64
73
  max_str_len: int = ...,
@@ -88,12 +97,10 @@ __all__ = [
88
97
  "Timestamp",
89
98
  "UnpackException",
90
99
  "UnpackValueError",
91
- "_version",
92
100
  "Unpacker",
101
+ "__version__",
93
102
  "dump",
94
103
  "dumps",
95
- "exceptions",
96
- "ext",
97
104
  "load",
98
105
  "loads",
99
106
  "pack",
@@ -102,4 +109,3 @@ __all__ = [
102
109
  "unpackb",
103
110
  "version",
104
111
  ]
105
-
@@ -0,0 +1,4 @@
1
+ from .fallback import Packer, Unpacker, unpackb
2
+
3
+
4
+ __all__ = ["Packer", "Unpacker", "unpackb"]
@@ -1,29 +1,26 @@
1
1
  from __future__ import annotations
2
- from typing import NamedTuple
2
+
3
3
  import datetime
4
+ from typing import NamedTuple
4
5
 
5
- class _ExtType(NamedTuple):
6
+ class ExtType(NamedTuple):
6
7
  code: int
7
8
  data: bytes
8
9
 
9
- class ExtType(_ExtType): ...
10
-
11
- class TimeStamp:
10
+ class Timestamp:
12
11
  def __init__(self, seconds: int, nanoseconds: int = ...) -> None: ...
13
12
  def __eq__(self, o: object) -> bool: ...
14
13
  def __ne__(self, o: object) -> bool: ...
14
+ def __hash__(self) -> int: ...
15
15
  @staticmethod
16
- def from_bytes(b: bytes) -> TimeStamp: ...
17
- @staticmethod
16
+ def from_bytes(b: bytes) -> Timestamp: ...
18
17
  def to_bytes(self) -> bytes: ...
19
18
  @staticmethod
20
- def from_unix(self, unix_sec: float) -> TimeStamp: ...
19
+ def from_unix(unix_sec: float) -> Timestamp: ...
21
20
  def to_unix(self) -> float: ...
22
21
  @staticmethod
23
- def from_unix_nano(unix_ns: int) -> TimeStamp: ...
24
- @staticmethod
22
+ def from_unix_nano(unix_ns: int) -> Timestamp: ...
25
23
  def to_unix_nano(self) -> int: ...
26
24
  def to_datetime(self) -> datetime.datetime: ...
27
25
  @staticmethod
28
- def from_datetime(dt: datetime.datetime) -> TimeStamp: ...
29
-
26
+ def from_datetime(dt: datetime.datetime) -> Timestamp: ...
@@ -1,23 +1,25 @@
1
1
  from __future__ import annotations
2
- from typing import Any, Callable, Dict, List, Optional, Tuple
2
+
3
+ from collections.abc import Callable
4
+ from typing import Any
3
5
 
4
6
  from typing_extensions import Protocol
5
7
 
6
8
  class _FileLike(Protocol):
7
- def read(n: int) -> bytes: ...
9
+ def read(self, n: int) -> bytes: ...
8
10
 
9
11
  def unpackb(
10
12
  packed: bytes,
11
- file_like: Optional[_FileLike] = ...,
13
+ file_like: _FileLike | None = ...,
12
14
  read_size: int = ...,
13
15
  use_list: bool = ...,
14
16
  raw: bool = ...,
15
17
  timestamp: int = ...,
16
18
  strict_map_key: bool = ...,
17
- object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
18
- object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
19
- list_hook: Optional[Callable[[List[Any]], Any]] = ...,
20
- unicode_errors: Optional[str] = ...,
19
+ object_hook: Callable[[dict[Any, Any]], Any] | None = ...,
20
+ object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = ...,
21
+ list_hook: Callable[[list[Any]], Any] | None = ...,
22
+ unicode_errors: str | None = ...,
21
23
  max_buffer_size: int = ...,
22
24
  ext_hook: Callable[[int, bytes], Any] = ...,
23
25
  max_str_len: int = ...,
@@ -30,16 +32,16 @@ def unpackb(
30
32
  class Unpacker:
31
33
  def __init__(
32
34
  self,
33
- file_like: Optional[_FileLike] = ...,
35
+ file_like: _FileLike | None = ...,
34
36
  read_size: int = ...,
35
37
  use_list: bool = ...,
36
38
  raw: bool = ...,
37
39
  timestamp: int = ...,
38
40
  strict_map_key: bool = ...,
39
- object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
40
- object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
41
- list_hook: Optional[Callable[[List[Any]], Any]] = ...,
42
- unicode_errors: Optional[str] = ...,
41
+ object_hook: Callable[[dict[Any, Any]], Any] | None = ...,
42
+ object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = ...,
43
+ list_hook: Callable[[list[Any]], Any] | None = ...,
44
+ unicode_errors: str | None = ...,
43
45
  max_buffer_size: int = ...,
44
46
  ext_hook: Callable[[int, bytes], Any] = ...,
45
47
  max_str_len: int = ...,
@@ -62,13 +64,13 @@ class Unpacker:
62
64
  class Packer:
63
65
  def __init__(
64
66
  self,
65
- default: Optional[Callable[[Any], Any]] = ...,
67
+ default: Callable[[Any], Any] | None = ...,
66
68
  use_single_float: bool = ...,
67
69
  autoreset: bool = ...,
68
70
  use_bin_type: bool = ...,
69
71
  strict_types: bool = ...,
70
72
  datetime: bool = ...,
71
- unicode_errors: Optional[str] = ...,
73
+ unicode_errors: str | None = ...,
72
74
  ): ...
73
75
  def pack(self, obj: Any) -> bytes: ...
74
76
  def pack_map_pairs(self, pairs: Any) -> bytes: ...
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "msgpack-types"
3
- version = "0.3.0"
3
+ version = "0.4.0"
4
4
  description = "Type stubs for msgpack"
5
5
  repository = "https://github.com/sbdchd/msgpack-types"
6
6
  readme = "README.md"
@@ -13,7 +13,8 @@ packages = [
13
13
 
14
14
 
15
15
  [tool.poetry.dependencies]
16
- python = "^3.7"
16
+ python = "^3.8"
17
+ msgpack = ">=1.1.0,<1.2.0"
17
18
 
18
19
  [tool.poetry.dev-dependencies]
19
20
  mypy = "^0.790.0"
@@ -21,7 +22,7 @@ ipython = "^7.19"
21
22
  flake8 = "^3.8"
22
23
  msgpack = "^1.0"
23
24
  isort = "^5.6"
24
- black = {version = "^18.3-alpha.0",allows-prereleases = true}
25
+ black = {version = "^18.3-alpha.0",allow-prereleases = true}
25
26
 
26
27
  [build-system]
27
28
  requires = ["poetry>=0.12"]
@@ -1,3 +0,0 @@
1
- from typing import Tuple
2
-
3
- version: Tuple[int, int, int]
File without changes
File without changes