TypeDAL 3.14.2__py3-none-any.whl → 3.15.0__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.
Potentially problematic release.
This version of TypeDAL might be problematic. Click here for more details.
- typedal/__about__.py +1 -1
- typedal/core.py +19 -11
- typedal/fields.py +12 -5
- {typedal-3.14.2.dist-info → typedal-3.15.0.dist-info}/METADATA +1 -1
- {typedal-3.14.2.dist-info → typedal-3.15.0.dist-info}/RECORD +7 -7
- {typedal-3.14.2.dist-info → typedal-3.15.0.dist-info}/WHEEL +0 -0
- {typedal-3.14.2.dist-info → typedal-3.15.0.dist-info}/entry_points.txt +0 -0
typedal/__about__.py
CHANGED
typedal/core.py
CHANGED
|
@@ -2434,7 +2434,7 @@ class QueryBuilder(typing.Generic[T_MetaInstance]):
|
|
|
2434
2434
|
|
|
2435
2435
|
def where(
|
|
2436
2436
|
self,
|
|
2437
|
-
*queries_or_lambdas: Query | typing.Callable[[Type[T_MetaInstance]], Query],
|
|
2437
|
+
*queries_or_lambdas: Query | typing.Callable[[Type[T_MetaInstance]], Query] | dict,
|
|
2438
2438
|
**filters: Any,
|
|
2439
2439
|
) -> "QueryBuilder[T_MetaInstance]":
|
|
2440
2440
|
"""
|
|
@@ -2453,20 +2453,28 @@ class QueryBuilder(typing.Generic[T_MetaInstance]):
|
|
|
2453
2453
|
new_query = self.query
|
|
2454
2454
|
table = self.model._ensure_table_defined()
|
|
2455
2455
|
|
|
2456
|
-
|
|
2457
|
-
|
|
2456
|
+
queries_or_lambdas = (
|
|
2457
|
+
*queries_or_lambdas,
|
|
2458
|
+
filters,
|
|
2459
|
+
)
|
|
2458
2460
|
|
|
2459
2461
|
subquery: DummyQuery | Query = DummyQuery()
|
|
2460
|
-
for
|
|
2461
|
-
if isinstance(
|
|
2462
|
-
subquery |= typing.cast(Query,
|
|
2463
|
-
elif callable(
|
|
2464
|
-
if result :=
|
|
2462
|
+
for query_part in queries_or_lambdas:
|
|
2463
|
+
if isinstance(query_part, _Query):
|
|
2464
|
+
subquery |= typing.cast(Query, query_part)
|
|
2465
|
+
elif callable(query_part):
|
|
2466
|
+
if result := query_part(self.model):
|
|
2465
2467
|
subquery |= result
|
|
2466
|
-
elif isinstance(
|
|
2467
|
-
subquery |= typing.cast(Query,
|
|
2468
|
+
elif isinstance(query_part, (Field, _Field)) or is_typed_field(query_part):
|
|
2469
|
+
subquery |= typing.cast(Query, query_part != None)
|
|
2470
|
+
elif isinstance(query_part, dict):
|
|
2471
|
+
subsubquery = DummyQuery()
|
|
2472
|
+
for field, value in query_part.items():
|
|
2473
|
+
subsubquery &= table[field] == value
|
|
2474
|
+
if subsubquery:
|
|
2475
|
+
subquery |= subsubquery
|
|
2468
2476
|
else:
|
|
2469
|
-
raise ValueError(f"Unexpected query type ({type(
|
|
2477
|
+
raise ValueError(f"Unexpected query type ({type(query_part)}).")
|
|
2470
2478
|
|
|
2471
2479
|
if subquery:
|
|
2472
2480
|
new_query &= subquery
|
typedal/fields.py
CHANGED
|
@@ -267,16 +267,23 @@ def safe_decode_native_point(value: str | None):
|
|
|
267
267
|
return ()
|
|
268
268
|
|
|
269
269
|
|
|
270
|
-
def safe_encode_native_point(value):
|
|
270
|
+
def safe_encode_native_point(value: tuple[str, str] | str) -> str:
|
|
271
271
|
if not value:
|
|
272
272
|
return ""
|
|
273
273
|
|
|
274
|
+
# Convert string to tuple if needed
|
|
274
275
|
if isinstance(value, str):
|
|
275
|
-
value =
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
value = value.strip("() ")
|
|
277
|
+
if not value:
|
|
278
|
+
return ""
|
|
279
|
+
value = tuple(float(x.strip()) for x in value.split(","))
|
|
278
280
|
|
|
279
|
-
|
|
281
|
+
# Validate and format
|
|
282
|
+
if len(value) != 2:
|
|
283
|
+
raise ValueError("Point must have exactly 2 coordinates")
|
|
284
|
+
|
|
285
|
+
x, y = value
|
|
286
|
+
return f"({x},{y})"
|
|
280
287
|
|
|
281
288
|
|
|
282
289
|
NativePointField = SQLCustomType(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
typedal/__about__.py,sha256=
|
|
1
|
+
typedal/__about__.py,sha256=tFYWLMmiY9IJaclhUwUG67qOTY5HFlDDVEQ-pJBZCAs,207
|
|
2
2
|
typedal/__init__.py,sha256=Y6LT5UE3HrfWND_drJddYFbDjfnvqQER8MxZiEREFGw,366
|
|
3
3
|
typedal/caching.py,sha256=6YUzUMpan56nSy3D-Jl0FS-8V4LbTnpRSoDJHj6yPYo,11782
|
|
4
4
|
typedal/cli.py,sha256=SnWceLPDd-t90VPHAV9O3RR7JZtpVniT55TqtrRv3VM,19255
|
|
5
5
|
typedal/config.py,sha256=0qy1zrTUdtmXPM9jHzFnSR1DJsqGJqcdG6pvhzKQHe0,11625
|
|
6
|
-
typedal/core.py,sha256=
|
|
7
|
-
typedal/fields.py,sha256=
|
|
6
|
+
typedal/core.py,sha256=awjvORId3Dx3P8NlCMTvJ9q_paG_auGSRg4-n-hg7ao,109186
|
|
7
|
+
typedal/fields.py,sha256=oOmTonXG-g4Lpj5_gSr8GJ-EZIEqO435Fm8-MS_cmoc,7356
|
|
8
8
|
typedal/for_py4web.py,sha256=KIIu8XgnAfRQCJfZCra79k8SInOHiFuLDKUv3hzTJng,1908
|
|
9
9
|
typedal/for_web2py.py,sha256=xn7zo6ImsmTkH6LacbjLQl2oqyBvP0zLqRxEJvMQk1w,1929
|
|
10
10
|
typedal/helpers.py,sha256=LpBgTwKmt9f1b4Mz98mxusvIHGiCpW_abDMZLP81g6Y,8850
|
|
@@ -13,7 +13,7 @@ typedal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
13
13
|
typedal/types.py,sha256=1FIgv1s0be0E8r5Wd9E1nvDvK4ETV8u2NlfI7_P6UUY,6752
|
|
14
14
|
typedal/web2py_py4web_shared.py,sha256=VK9T8P5UwVLvfNBsY4q79ANcABv-jX76YKADt1Zz_co,1539
|
|
15
15
|
typedal/serializers/as_json.py,sha256=3JZlFhPrdvZVFAmH7P5DUAz8-TIk-br0F1CjKG3PFDM,2246
|
|
16
|
-
typedal-3.
|
|
17
|
-
typedal-3.
|
|
18
|
-
typedal-3.
|
|
19
|
-
typedal-3.
|
|
16
|
+
typedal-3.15.0.dist-info/METADATA,sha256=yuhuXMX56Wr_RmrPUODadHclKmDnJjMnAOFfZuwQuMc,10461
|
|
17
|
+
typedal-3.15.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
18
|
+
typedal-3.15.0.dist-info/entry_points.txt,sha256=m1wqcc_10rHWPdlQ71zEkmJDADUAnZtn7Jac_6mbyUc,44
|
|
19
|
+
typedal-3.15.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|