7
7
8
8
from surrealdb .data .types .table import Table
9
9
from surrealdb .data .types .constants import *
10
- from surrealdb .data .types .datetime import DateTimeCompact
11
10
from surrealdb .data .types .duration import Duration
12
11
from surrealdb .data .types .future import Future
13
12
from surrealdb .data .types .geometry import Geometry
14
13
from surrealdb .data .types .range import Range
15
14
from surrealdb .data .types .record_id import RecordID
15
+ from surrealdb .data .types .datetime import IsoDateTimeWrapper
16
+
16
17
17
18
class AsyncSurrealDBMeta (type ):
18
19
@@ -28,12 +29,20 @@ def __call__(cls, *args, **kwargs):
28
29
29
30
constructed_url = Url (url )
30
31
31
- if constructed_url .scheme == UrlScheme .HTTP or constructed_url .scheme == UrlScheme .HTTPS :
32
+ if (
33
+ constructed_url .scheme == UrlScheme .HTTP
34
+ or constructed_url .scheme == UrlScheme .HTTPS
35
+ ):
32
36
return AsyncHttpSurrealConnection (url = url )
33
- elif constructed_url .scheme == UrlScheme .WS or constructed_url .scheme == UrlScheme .WSS :
37
+ elif (
38
+ constructed_url .scheme == UrlScheme .WS
39
+ or constructed_url .scheme == UrlScheme .WSS
40
+ ):
34
41
return AsyncWsSurrealConnection (url = url )
35
42
else :
36
- raise ValueError (f"Unsupported protocol in URL: { url } . Use 'ws://' or 'http://'." )
43
+ raise ValueError (
44
+ f"Unsupported protocol in URL: { url } . Use 'ws://' or 'http://'."
45
+ )
37
46
38
47
39
48
class BlockingSurrealDBMeta (type ):
@@ -50,28 +59,57 @@ def __call__(cls, *args, **kwargs):
50
59
51
60
constructed_url = Url (url )
52
61
53
- if constructed_url .scheme == UrlScheme .HTTP or constructed_url .scheme == UrlScheme .HTTPS :
62
+ if (
63
+ constructed_url .scheme == UrlScheme .HTTP
64
+ or constructed_url .scheme == UrlScheme .HTTPS
65
+ ):
54
66
return BlockingHttpSurrealConnection (url = url )
55
- elif constructed_url .scheme == UrlScheme .WS or constructed_url .scheme == UrlScheme .WSS :
67
+ elif (
68
+ constructed_url .scheme == UrlScheme .WS
69
+ or constructed_url .scheme == UrlScheme .WSS
70
+ ):
56
71
return BlockingWsSurrealConnection (url = url )
57
72
else :
58
- raise ValueError (f"Unsupported protocol in URL: { url } . Use 'ws://' or 'http://'." )
73
+ raise ValueError (
74
+ f"Unsupported protocol in URL: { url } . Use 'ws://' or 'http://'."
75
+ )
76
+
59
77
60
- def Surreal (url : Optional [str ] = None ) -> Union [BlockingWsSurrealConnection , BlockingHttpSurrealConnection ]:
78
+ def Surreal (
79
+ url : Optional [str ] = None ,
80
+ ) -> Union [BlockingWsSurrealConnection , BlockingHttpSurrealConnection ]:
61
81
constructed_url = Url (url )
62
- if constructed_url .scheme == UrlScheme .HTTP or constructed_url .scheme == UrlScheme .HTTPS :
82
+ if (
83
+ constructed_url .scheme == UrlScheme .HTTP
84
+ or constructed_url .scheme == UrlScheme .HTTPS
85
+ ):
63
86
return BlockingHttpSurrealConnection (url = url )
64
- elif constructed_url .scheme == UrlScheme .WS or constructed_url .scheme == UrlScheme .WSS :
87
+ elif (
88
+ constructed_url .scheme == UrlScheme .WS
89
+ or constructed_url .scheme == UrlScheme .WSS
90
+ ):
65
91
return BlockingWsSurrealConnection (url = url )
66
92
else :
67
- raise ValueError (f"Unsupported protocol in URL: { url } . Use 'ws://' or 'http://'." )
93
+ raise ValueError (
94
+ f"Unsupported protocol in URL: { url } . Use 'ws://' or 'http://'."
95
+ )
68
96
69
97
70
- def AsyncSurreal (url : Optional [str ] = None ) -> Union [AsyncWsSurrealConnection , AsyncHttpSurrealConnection ]:
98
+ def AsyncSurreal (
99
+ url : Optional [str ] = None ,
100
+ ) -> Union [AsyncWsSurrealConnection , AsyncHttpSurrealConnection ]:
71
101
constructed_url = Url (url )
72
- if constructed_url .scheme == UrlScheme .HTTP or constructed_url .scheme == UrlScheme .HTTPS :
102
+ if (
103
+ constructed_url .scheme == UrlScheme .HTTP
104
+ or constructed_url .scheme == UrlScheme .HTTPS
105
+ ):
73
106
return AsyncHttpSurrealConnection (url = url )
74
- elif constructed_url .scheme == UrlScheme .WS or constructed_url .scheme == UrlScheme .WSS :
107
+ elif (
108
+ constructed_url .scheme == UrlScheme .WS
109
+ or constructed_url .scheme == UrlScheme .WSS
110
+ ):
75
111
return AsyncWsSurrealConnection (url = url )
76
112
else :
77
- raise ValueError (f"Unsupported protocol in URL: { url } . Use 'ws://' or 'http://'." )
113
+ raise ValueError (
114
+ f"Unsupported protocol in URL: { url } . Use 'ws://' or 'http://'."
115
+ )
0 commit comments