crate 2.0.0.dev2__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 +1 -1
- crate/client/http.py +18 -26
- {crate-2.0.0.dev2.dist-info → crate-2.0.0.dev4.dist-info}/METADATA +1 -1
- {crate-2.0.0.dev2.dist-info → crate-2.0.0.dev4.dist-info}/RECORD +8 -8
- {crate-2.0.0.dev2.dist-info → crate-2.0.0.dev4.dist-info}/LICENSE +0 -0
- {crate-2.0.0.dev2.dist-info → crate-2.0.0.dev4.dist-info}/NOTICE +0 -0
- {crate-2.0.0.dev2.dist-info → crate-2.0.0.dev4.dist-info}/WHEEL +0 -0
- {crate-2.0.0.dev2.dist-info → crate-2.0.0.dev4.dist-info}/top_level.txt +0 -0
crate/client/__init__.py
CHANGED
crate/client/http.py
CHANGED
@@ -20,7 +20,6 @@
|
|
20
20
|
# software solely pursuant to the terms of the relevant commercial agreement.
|
21
21
|
|
22
22
|
|
23
|
-
import calendar
|
24
23
|
import heapq
|
25
24
|
import io
|
26
25
|
import logging
|
@@ -29,12 +28,11 @@ import re
|
|
29
28
|
import socket
|
30
29
|
import ssl
|
31
30
|
import threading
|
31
|
+
import typing as t
|
32
32
|
from base64 import b64encode
|
33
|
-
from datetime import date, datetime, timezone
|
34
33
|
from decimal import Decimal
|
35
34
|
from time import time
|
36
35
|
from urllib.parse import urlparse
|
37
|
-
from uuid import UUID
|
38
36
|
|
39
37
|
import orjson
|
40
38
|
import urllib3
|
@@ -86,38 +84,32 @@ def super_len(o):
|
|
86
84
|
return None
|
87
85
|
|
88
86
|
|
89
|
-
|
90
|
-
epoch_naive = datetime(1970, 1, 1)
|
91
|
-
|
92
|
-
|
93
|
-
def cratedb_json_encoder(obj):
|
87
|
+
def cratedb_json_encoder(obj: t.Any) -> str:
|
94
88
|
"""
|
95
|
-
Encoder function for orjson.
|
89
|
+
Encoder function for orjson, with additional type support.
|
90
|
+
|
91
|
+
- Python's `Decimal` type.
|
92
|
+
- freezegun's `FakeDateTime` type.
|
96
93
|
|
97
94
|
https://github.com/ijl/orjson#default
|
98
|
-
https://github.com/ijl/orjson#opt_passthrough_datetime
|
99
95
|
"""
|
100
|
-
if isinstance(obj,
|
96
|
+
if isinstance(obj, Decimal):
|
101
97
|
return str(obj)
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
delta = obj - epoch_naive
|
107
|
-
return int(
|
108
|
-
delta.microseconds / 1000.0
|
109
|
-
+ (delta.seconds + delta.days * 24 * 3600) * 1000.0
|
110
|
-
)
|
111
|
-
if isinstance(obj, date):
|
112
|
-
return calendar.timegm(obj.timetuple()) * 1000
|
113
|
-
return obj
|
98
|
+
elif hasattr(obj, "isoformat"):
|
99
|
+
return obj.isoformat()
|
100
|
+
raise TypeError
|
101
|
+
|
114
102
|
|
103
|
+
def json_dumps(obj: t.Any) -> bytes:
|
104
|
+
"""
|
105
|
+
Serialize to JSON format, using `orjson`, with additional type support.
|
115
106
|
|
116
|
-
|
107
|
+
https://github.com/ijl/orjson
|
108
|
+
"""
|
117
109
|
return orjson.dumps(
|
118
110
|
obj,
|
119
111
|
default=cratedb_json_encoder,
|
120
|
-
option=
|
112
|
+
option=orjson.OPT_SERIALIZE_NUMPY,
|
121
113
|
)
|
122
114
|
|
123
115
|
|
@@ -337,7 +329,7 @@ def _update_pool_kwargs_for_ssl_minimum_version(server, kwargs):
|
|
337
329
|
kwargs["ssl_minimum_version"] = ssl.TLSVersion.MINIMUM_SUPPORTED
|
338
330
|
|
339
331
|
|
340
|
-
def _create_sql_payload(stmt, args, bulk_args):
|
332
|
+
def _create_sql_payload(stmt, args, bulk_args) -> bytes:
|
341
333
|
if not isinstance(stmt, str):
|
342
334
|
raise ValueError("stmt is not a string")
|
343
335
|
if args and bulk_args:
|
@@ -1,17 +1,17 @@
|
|
1
|
-
crate/client/__init__.py,sha256=
|
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=
|
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.
|
13
|
-
crate-2.0.0.
|
14
|
-
crate-2.0.0.
|
15
|
-
crate-2.0.0.
|
16
|
-
crate-2.0.0.
|
17
|
-
crate-2.0.0.
|
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,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|