crate 2.0.0.dev3__py3-none-any.whl → 2.0.0.dev4__py3-none-any.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.
crate/client/__init__.py CHANGED
@@ -29,7 +29,7 @@ __all__ = [
29
29
 
30
30
  # version string read from setup.py using a regex. Take care not to break the
31
31
  # regex!
32
- __version__ = "2.0.0.dev3"
32
+ __version__ = "2.0.0.dev4"
33
33
 
34
34
  # codeql[py/unused-global-variable]
35
35
  apilevel = "2.0"
crate/client/http.py CHANGED
@@ -28,6 +28,7 @@ import re
28
28
  import socket
29
29
  import ssl
30
30
  import threading
31
+ import typing as t
31
32
  from base64 import b64encode
32
33
  from decimal import Decimal
33
34
  from time import time
@@ -83,18 +84,28 @@ def super_len(o):
83
84
  return None
84
85
 
85
86
 
86
- def cratedb_json_encoder(obj):
87
+ def cratedb_json_encoder(obj: t.Any) -> str:
87
88
  """
88
- Encoder function for orjson.
89
+ Encoder function for orjson, with additional type support.
90
+
91
+ - Python's `Decimal` type.
92
+ - freezegun's `FakeDateTime` type.
89
93
 
90
94
  https://github.com/ijl/orjson#default
91
95
  """
92
- if isinstance(obj, (Decimal,)):
96
+ if isinstance(obj, Decimal):
93
97
  return str(obj)
94
- return obj
98
+ elif hasattr(obj, "isoformat"):
99
+ return obj.isoformat()
100
+ raise TypeError
101
+
95
102
 
103
+ def json_dumps(obj: t.Any) -> bytes:
104
+ """
105
+ Serialize to JSON format, using `orjson`, with additional type support.
96
106
 
97
- def json_dumps(obj):
107
+ https://github.com/ijl/orjson
108
+ """
98
109
  return orjson.dumps(
99
110
  obj,
100
111
  default=cratedb_json_encoder,
@@ -318,7 +329,7 @@ def _update_pool_kwargs_for_ssl_minimum_version(server, kwargs):
318
329
  kwargs["ssl_minimum_version"] = ssl.TLSVersion.MINIMUM_SUPPORTED
319
330
 
320
331
 
321
- def _create_sql_payload(stmt, args, bulk_args):
332
+ def _create_sql_payload(stmt, args, bulk_args) -> bytes:
322
333
  if not isinstance(stmt, str):
323
334
  raise ValueError("stmt is not a string")
324
335
  if args and bulk_args:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: crate
3
- Version: 2.0.0.dev3
3
+ Version: 2.0.0.dev4
4
4
  Summary: CrateDB Python Client
5
5
  Home-page: https://github.com/crate/crate-python
6
6
  Author: Crate.io
@@ -1,17 +1,17 @@
1
- crate/client/__init__.py,sha256=KJxfw5bFsK_B0BEj1E74dFBMWuDAsFfpA2Y8Gej43AM,1349
1
+ crate/client/__init__.py,sha256=PWUy4mL7gZJC-NybTg1ZXl_Rka2qs3RSKaXTw-gXtXo,1349
2
2
  crate/client/_pep440.py,sha256=iwY5wopxbgbwsT0ImANrwN3V_ZYQHhSr7lEdVT5dQRM,42
3
3
  crate/client/blob.py,sha256=aMo6ZNHGT3Zq_yR3gcpd3CKrJvfqUAhExhKtHUwC5Io,3460
4
4
  crate/client/connection.py,sha256=80v9_--YilDAaIQpejf3G_TWGz9iwUkixwHAL66sDm0,8098
5
5
  crate/client/converter.py,sha256=Qci0MNcpz1jAnjquG8Ld9LI84_iHVInrv4HMb8r5zzg,4313
6
6
  crate/client/cursor.py,sha256=Mlk-TVLzM4zSSr7GxcHK4Mjbt1KQeMfNFNrPBtGjk-c,10741
7
7
  crate/client/exceptions.py,sha256=wMyJmOB3RP5kuPeW9f0fEb-1AKZcGSTyIGvN0HqpqUw,2557
8
- crate/client/http.py,sha256=MnrMZ5JIyghAgp7QboREHpWwV3NW9gigFAUzo6Wd8Eg,22130
8
+ crate/client/http.py,sha256=EIorrFOO7De2MF_0CQRjAJyUp0VlN-nODdTfOcp8I4k,22485
9
9
  crate/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  crate/testing/layer.py,sha256=jvHRWTRE4Zal211UO0HWPFcbprAcaGB3WyAUDR7BKFQ,13376
11
11
  crate/testing/util.py,sha256=BPEZ8DavXwyOTCmOQnP5QjQlapEw3harzKK4w2HOTA4,3264
12
- crate-2.0.0.dev3.dist-info/LICENSE,sha256=s_w3FXmAYQuatqsgvyYLnGyC_13KOqp3W1DUEXO9RpY,10175
13
- crate-2.0.0.dev3.dist-info/METADATA,sha256=FRLfH3m7xC2wgcs0O1b2tRsDcDqCyviODEkrfJj0YPw,5655
14
- crate-2.0.0.dev3.dist-info/NOTICE,sha256=jfWOHkoZKjNATGXMfgpMJdL38ki_ZZTgR6M9CUUJxrM,1159
15
- crate-2.0.0.dev3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
16
- crate-2.0.0.dev3.dist-info/top_level.txt,sha256=2wP2HlpxdhgTLMl9ipi168xkm6FMq9_2bf0xGGxF_OI,6
17
- crate-2.0.0.dev3.dist-info/RECORD,,
12
+ crate-2.0.0.dev4.dist-info/LICENSE,sha256=s_w3FXmAYQuatqsgvyYLnGyC_13KOqp3W1DUEXO9RpY,10175
13
+ crate-2.0.0.dev4.dist-info/METADATA,sha256=7sRRZkesWsBu_8GGkagdd_q0EzVkL2zH85soJ-4z_ns,5655
14
+ crate-2.0.0.dev4.dist-info/NOTICE,sha256=jfWOHkoZKjNATGXMfgpMJdL38ki_ZZTgR6M9CUUJxrM,1159
15
+ crate-2.0.0.dev4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
16
+ crate-2.0.0.dev4.dist-info/top_level.txt,sha256=2wP2HlpxdhgTLMl9ipi168xkm6FMq9_2bf0xGGxF_OI,6
17
+ crate-2.0.0.dev4.dist-info/RECORD,,