ormsgpack 1.7.0__cp39-cp39-win_amd64.whl → 1.8.0__cp39-cp39-win_amd64.whl

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.

Potentially problematic release.


This version of ormsgpack might be problematic. Click here for more details.

ormsgpack/__init__.py CHANGED
@@ -9,6 +9,7 @@ from .ormsgpack import (
9
9
  OPT_PASSTHROUGH_DATETIME,
10
10
  OPT_PASSTHROUGH_SUBCLASS,
11
11
  OPT_PASSTHROUGH_TUPLE,
12
+ OPT_PASSTHROUGH_UUID,
12
13
  OPT_SERIALIZE_NUMPY,
13
14
  OPT_SERIALIZE_PYDANTIC,
14
15
  OPT_SORT_KEYS,
@@ -36,6 +37,7 @@ __all__ = (
36
37
  "OPT_PASSTHROUGH_DATETIME",
37
38
  "OPT_PASSTHROUGH_SUBCLASS",
38
39
  "OPT_PASSTHROUGH_TUPLE",
40
+ "OPT_PASSTHROUGH_UUID",
39
41
  "OPT_SERIALIZE_NUMPY",
40
42
  "OPT_SERIALIZE_PYDANTIC",
41
43
  "OPT_SORT_KEYS",
ormsgpack/__init__.pyi CHANGED
@@ -26,6 +26,7 @@ OPT_PASSTHROUGH_DATACLASS: int
26
26
  OPT_PASSTHROUGH_DATETIME: int
27
27
  OPT_PASSTHROUGH_SUBCLASS: int
28
28
  OPT_PASSTHROUGH_TUPLE: int
29
+ OPT_PASSTHROUGH_UUID: int
29
30
  OPT_SERIALIZE_NUMPY: int
30
31
  OPT_SERIALIZE_PYDANTIC: int
31
32
  OPT_NON_STR_KEYS: int
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ormsgpack
3
- Version: 1.7.0
3
+ Version: 1.8.0
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: Apache Software License
@@ -120,8 +120,7 @@ It natively serializes
120
120
  `None` instances. It supports arbitrary types through `default`. It
121
121
  serializes subclasses of `str`, `int`, `dict`, `list`,
122
122
  `dataclasses.dataclass`, and `enum.Enum`. It does not serialize subclasses
123
- of `tuple` to avoid serializing `namedtuple` objects as arrays. To avoid
124
- serializing subclasses, specify the option `ormsgpack.OPT_PASSTHROUGH_SUBCLASS`.
123
+ of `tuple` to avoid serializing `namedtuple` objects as arrays.
125
124
 
126
125
  The output is a `bytes` object.
127
126
 
@@ -205,13 +204,16 @@ value, respectively.
205
204
  b'\xc7\x18\x000.0842389659712649442845'
206
205
  ```
207
206
 
207
+ `default` can also be used to serialize some supported types to a custom
208
+ format by enabling the corresponding passthrough options.
209
+
208
210
  #### option
209
211
 
210
212
  To modify how data is serialized, specify `option`. Each `option` is an integer
211
213
  constant in `ormsgpack`. To specify multiple options, mask them together, e.g.,
212
214
  `option=ormsgpack.OPT_NON_STR_KEYS | ormsgpack.OPT_NAIVE_UTC`.
213
215
 
214
- ##### OPT_NAIVE_UTC
216
+ ##### `OPT_NAIVE_UTC`
215
217
 
216
218
  Serialize `datetime.datetime` objects without a `tzinfo` and `numpy.datetime64`
217
219
  objects as UTC. This has no effect on `datetime.datetime` objects that have
@@ -234,11 +236,13 @@ b'\xb91970-01-01T00:00:00+00:00'
234
236
  '1970-01-01T00:00:00+00:00'
235
237
  ```
236
238
 
237
- ##### OPT_NON_STR_KEYS
239
+ ##### `OPT_NON_STR_KEYS`
238
240
 
239
241
  Serialize `dict` keys of type other than `str`. This allows `dict` keys
240
242
  to be one of `str`, `int`, `float`, `bool`, `None`, `datetime.datetime`,
241
243
  `datetime.date`, `datetime.time`, `enum.Enum`, and `uuid.UUID`.
244
+ `dict` keys of unsupported types are not handled using `default` and
245
+ result in `MsgpackEncodeError` being raised.
242
246
 
243
247
  ```python
244
248
  >>> import ormsgpack, datetime, uuid
@@ -270,7 +274,7 @@ occurrence of a key (in the above, `false`). The first value will be lost.
270
274
 
271
275
  This option is not compatible with `ormsgpack.OPT_SORT_KEYS`.
272
276
 
273
- ##### OPT_OMIT_MICROSECONDS
277
+ ##### `OPT_OMIT_MICROSECONDS`
274
278
 
275
279
  Do not serialize the microsecond component of `datetime.datetime`,
276
280
  `datetime.time` and `numpy.datetime64` instances.
@@ -292,9 +296,10 @@ b'\xb31970-01-01T00:00:00'
292
296
  '1970-01-01T00:00:00'
293
297
  ```
294
298
 
295
- ##### OPT_PASSTHROUGH_BIG_INT
299
+ ##### `OPT_PASSTHROUGH_BIG_INT`
296
300
 
297
- Enables passthrough of big (Python) ints. By setting this option, one can set a `default` function for ints larger than 63 bits, smaller ints are still serialized efficiently.
301
+ Enable passthrough of `int` instances smaller than -9223372036854775807 or
302
+ larger than 18446744073709551615 to `default`.
298
303
 
299
304
  ```python
300
305
  >>> import ormsgpack
@@ -312,10 +317,9 @@ b'\x82\xa4type\xa6bigint\xa5value\xb436893488147419103232'
312
317
  {'type': 'bigint', 'value': '36893488147419103232'}
313
318
  ```
314
319
 
315
- ##### OPT_PASSTHROUGH_DATACLASS
320
+ ##### `OPT_PASSTHROUGH_DATACLASS`
316
321
 
317
- Passthrough `dataclasses.dataclass` instances to `default`. This allows
318
- customizing their output but is much slower.
322
+ Enable passthrough of `dataclasses.dataclass` instances to `default`.
319
323
 
320
324
 
321
325
  ```python
@@ -343,11 +347,10 @@ TypeError: Type is not msgpack serializable: User
343
347
  b'\x82\xa2id\xa33b1\xa4name\xa3asd'
344
348
  ```
345
349
 
346
- ##### OPT_PASSTHROUGH_DATETIME
350
+ ##### `OPT_PASSTHROUGH_DATETIME`
347
351
 
348
- Passthrough `datetime.datetime`, `datetime.date`, and `datetime.time` instances
349
- to `default`. This allows serializing datetimes to a custom format, e.g.,
350
- HTTP dates:
352
+ Enable passthrough of `datetime.datetime`, `datetime.date`, and
353
+ `datetime.time` instances to `default`.
351
354
 
352
355
  ```python
353
356
  >>> import ormsgpack, datetime
@@ -368,11 +371,10 @@ TypeError: Type is not msgpack serializable: datetime.datetime
368
371
  b'\x81\xaacreated_at\xbdThu, 01 Jan 1970 00:00:00 GMT'
369
372
  ```
370
373
 
371
- This does not affect datetimes in `dict` keys if using OPT_NON_STR_KEYS.
372
-
373
- ##### OPT_PASSTHROUGH_SUBCLASS
374
+ ##### `OPT_PASSTHROUGH_SUBCLASS`
374
375
 
375
- Passthrough subclasses of builtin types to `default`.
376
+ Enable passthrough of subclasses of `str`, `int`, `dict` and `list` to
377
+ `default`.
376
378
 
377
379
  ```python
378
380
  >>> import ormsgpack
@@ -392,12 +394,9 @@ TypeError: Type is not msgpack serializable: Secret
392
394
  b'\xa6******'
393
395
  ```
394
396
 
395
- This does not affect serializing subclasses as `dict` keys if using
396
- OPT_NON_STR_KEYS.
397
-
398
- ##### OPT_PASSTHROUGH_TUPLE
397
+ ##### `OPT_PASSTHROUGH_TUPLE`
399
398
 
400
- Passthrough tuples to `default`.
399
+ Enable passthrough of `tuple` instances to `default`.
401
400
 
402
401
  ```python
403
402
  >>> import ormsgpack
@@ -417,15 +416,19 @@ b'\x82\xa4type\xa5tuple\xa5value\x93\xcd#\xe9\xa4test*'
417
416
  {'type': 'tuple', 'value': [9193, 'test', 42]}
418
417
  ```
419
418
 
420
- ##### OPT_SERIALIZE_NUMPY
419
+ ##### `OPT_PASSTHROUGH_UUID`
420
+
421
+ Enable passthrough of `uuid.UUID` instances to `default`.
422
+
423
+ ##### `OPT_SERIALIZE_NUMPY`
421
424
 
422
425
  Serialize `numpy.ndarray` instances. For more, see
423
426
  [numpy](#numpy).
424
427
 
425
- ##### OPT_SERIALIZE_PYDANTIC
428
+ ##### `OPT_SERIALIZE_PYDANTIC`
426
429
  Serialize `pydantic.BaseModel` instances.
427
430
 
428
- ##### OPT_SORT_KEYS
431
+ ##### `OPT_SORT_KEYS`
429
432
 
430
433
  Serialize `dict` keys and pydantic model fields in sorted order. The default
431
434
  is to serialize in an unspecified order.
@@ -451,7 +454,7 @@ b'\x83\xa1A\x03\xa1a\x01\xa2\xc3\xa4\x02'
451
454
 
452
455
  `dataclass` also serialize as maps but this has no effect on them.
453
456
 
454
- ##### OPT_UTC_Z
457
+ ##### `OPT_UTC_Z`
455
458
 
456
459
  Serialize a UTC timezone on `datetime.datetime` and `numpy.datetime64` instances
457
460
  as `Z` instead of `+00:00`.
@@ -620,9 +623,6 @@ b'\xaa1900-01-02'
620
623
 
621
624
  Errors with `tzinfo` result in `MsgpackEncodeError` being raised.
622
625
 
623
- To disable serialization of `datetime` objects specify the option
624
- `ormsgpack.OPT_PASSTHROUGH_DATETIME`.
625
-
626
626
  To use "Z" suffix instead of "+00:00" to indicate UTC ("Zulu") time, use the option
627
627
  `ormsgpack.OPT_UTC_Z`.
628
628
 
@@ -0,0 +1,9 @@
1
+ ormsgpack-1.8.0.dist-info/METADATA,sha256=Xl3RmNAi8eDYZg5SPudylK9YEn46gXDliC86fynnAcA,44268
2
+ ormsgpack-1.8.0.dist-info/WHEEL,sha256=SmPT9fUKPAPiE6hwAZ9_NHUVRjWSQ_RENTrzrvPx4p0,94
3
+ ormsgpack-1.8.0.dist-info/licenses/LICENSE-APACHE,sha256=fP1zjFPWHHnwfjSPYiv3cHyQhCNwVNN_vgd4inX1iBw,11048
4
+ ormsgpack-1.8.0.dist-info/licenses/LICENSE-MIT,sha256=NlFq79yExdWh50hUJZE6ItvaaesZMMXoTWrklytRlLk,1046
5
+ ormsgpack/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ ormsgpack/__init__.py,sha256=8OwJ6fMUN0Yv3HpqVCOMut34chTbKtoaR9yJQmF5TDE,1025
7
+ ormsgpack/__init__.pyi,sha256=xlbnosG9L-NzjW4eN-C_Zhbg6nd9X6iY_hD4dEoBkAE,878
8
+ ormsgpack/ormsgpack.cp39-win_amd64.pyd,sha256=okkwdPcGvknO0ZYIy-atBW-bd5L296GWQOlZpNyLpZM,215552
9
+ ormsgpack-1.8.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.7.8)
2
+ Generator: maturin (1.8.2)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp39-cp39-win_amd64
@@ -1,9 +0,0 @@
1
- ormsgpack-1.7.0.dist-info/METADATA,sha256=UIb3GG9Z4O4O3xUEFYv8TL3eeeJoLVBSrUM9dGOTe-I,44379
2
- ormsgpack-1.7.0.dist-info/WHEEL,sha256=h0q91EbVxHoBi794yFjiiifp_BgZOWVr8yp46YG3uBM,94
3
- ormsgpack-1.7.0.dist-info/licenses/LICENSE-APACHE,sha256=fP1zjFPWHHnwfjSPYiv3cHyQhCNwVNN_vgd4inX1iBw,11048
4
- ormsgpack-1.7.0.dist-info/licenses/LICENSE-MIT,sha256=NlFq79yExdWh50hUJZE6ItvaaesZMMXoTWrklytRlLk,1046
5
- ormsgpack/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- ormsgpack/__init__.py,sha256=cO7CRlLMoqVgapEc5lz2nE0SNNuvi659IAbl0fYU4_Q,969
7
- ormsgpack/__init__.pyi,sha256=ifO6bsEVSuexKoxAF37hhZperoUVIyT6it2NLq79fa8,851
8
- ormsgpack/ormsgpack.cp39-win_amd64.pyd,sha256=Ax8bLQRzoDE0I7oIdJvGEj6Poh4IqjtIQeSBOlTCmDM,213504
9
- ormsgpack-1.7.0.dist-info/RECORD,,