TypeDAL 5.1.0__tar.gz → 5.1.1__tar.gz
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.
- {typedal-5.1.0 → typedal-5.1.1}/PKG-INFO +1 -1
- {typedal-5.1.0 → typedal-5.1.1}/pyproject.toml +3 -3
- {typedal-5.1.0 → typedal-5.1.1}/pyproject.toml.orig +3 -3
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/query_builder.py +32 -1
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/warnings.py +4 -0
- {typedal-5.1.0 → typedal-5.1.1}/README.md +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/__about__.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/__init__.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/asynchronous.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/caching.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/cli.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/config.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/constants.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/core.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/define.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/enum_helpers.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/fields.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/for_py4web.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/for_web2py.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/helpers.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/mixins.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/py.typed +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/relationships.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/rows.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/serializers/as_json.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/serializers/typescript.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/tables.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/types.py +0 -0
- {typedal-5.1.0 → typedal-5.1.1}/src/typedal/web2py_py4web_shared.py +0 -0
|
@@ -6,7 +6,7 @@ build-backend = "uv_build"
|
|
|
6
6
|
name = "TypeDAL"
|
|
7
7
|
description = "Typing support for PyDAL"
|
|
8
8
|
readme = "README.md"
|
|
9
|
-
version = "5.1.
|
|
9
|
+
version = "5.1.1"
|
|
10
10
|
requires-python = ">=3.12"
|
|
11
11
|
license-expression = "MIT"
|
|
12
12
|
keywords = []
|
|
@@ -164,7 +164,7 @@ badge = true
|
|
|
164
164
|
mypy = "--disable-error-code misc"
|
|
165
165
|
|
|
166
166
|
[tool.black]
|
|
167
|
-
target-version = ["
|
|
167
|
+
target-version = ["py312"]
|
|
168
168
|
line-length = 120
|
|
169
169
|
extend-exclude = '''
|
|
170
170
|
# A regex preceded with ^/ will apply only to files and directories
|
|
@@ -199,7 +199,7 @@ exclude = [
|
|
|
199
199
|
]
|
|
200
200
|
|
|
201
201
|
[tool.ruff]
|
|
202
|
-
target-version = "
|
|
202
|
+
target-version = "py312"
|
|
203
203
|
line-length = 120
|
|
204
204
|
extend-exclude = [
|
|
205
205
|
"*.bak/",
|
|
@@ -6,7 +6,7 @@ build-backend = "uv_build"
|
|
|
6
6
|
name = "TypeDAL"
|
|
7
7
|
description = 'Typing support for PyDAL'
|
|
8
8
|
readme = "README.md"
|
|
9
|
-
version = "5.1.
|
|
9
|
+
version = "5.1.1"
|
|
10
10
|
requires-python = ">=3.12"
|
|
11
11
|
license-expression = "MIT"
|
|
12
12
|
keywords = []
|
|
@@ -181,7 +181,7 @@ badge = true
|
|
|
181
181
|
mypy = "--disable-error-code misc"
|
|
182
182
|
|
|
183
183
|
[tool.black]
|
|
184
|
-
target-version = ["
|
|
184
|
+
target-version = ["py312"]
|
|
185
185
|
line-length = 120
|
|
186
186
|
# 'extend-exclude' excludes files or directories in addition to the defaults
|
|
187
187
|
extend-exclude = '''
|
|
@@ -229,7 +229,7 @@ strict = true
|
|
|
229
229
|
exclude = ["venv", ".bak"]
|
|
230
230
|
|
|
231
231
|
[tool.ruff]
|
|
232
|
-
target-version = "
|
|
232
|
+
target-version = "py312"
|
|
233
233
|
line-length = 120
|
|
234
234
|
|
|
235
235
|
extend-exclude = ["*.bak/", "venv*/", "tests/", "example_*.py"]
|
|
@@ -46,7 +46,19 @@ from .types import (
|
|
|
46
46
|
merge_permissions,
|
|
47
47
|
require_permission,
|
|
48
48
|
)
|
|
49
|
-
from .warnings import UnusedWindowWarning
|
|
49
|
+
from .warnings import NoopQueryWarning, UnusedWindowWarning
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def warn_noop(method: str) -> None:
|
|
53
|
+
"""
|
|
54
|
+
Warn that `method` was called without arguments, which has no effect.
|
|
55
|
+
"""
|
|
56
|
+
# stacklevel: 1 = here, 2 = the query builder method, 3 = the caller.
|
|
57
|
+
warnings.warn(
|
|
58
|
+
f"`.{method}()` without arguments does nothing. You can remove this call.",
|
|
59
|
+
stacklevel=3,
|
|
60
|
+
category=NoopQueryWarning,
|
|
61
|
+
)
|
|
50
62
|
|
|
51
63
|
|
|
52
64
|
class QueryBuilder[T_MetaInstance: _TypedTable](Select):
|
|
@@ -175,6 +187,10 @@ class QueryBuilder[T_MetaInstance: _TypedTable](Select):
|
|
|
175
187
|
"""
|
|
176
188
|
Return a clone of this builder with permission overrides merged in.
|
|
177
189
|
"""
|
|
190
|
+
if not permissions and self:
|
|
191
|
+
warn_noop("permissions")
|
|
192
|
+
return self
|
|
193
|
+
|
|
178
194
|
return self._extend(permissions=permissions)
|
|
179
195
|
|
|
180
196
|
def _normalize_select_option(
|
|
@@ -216,8 +232,15 @@ class QueryBuilder[T_MetaInstance: _TypedTable](Select):
|
|
|
216
232
|
join: othertable.on(query) - do an INNER JOIN. Using TypeDAL relationships with .join() is recommended!
|
|
217
233
|
left: othertable.on(query) - do a LEFT JOIN. Using TypeDAL relationships with .join() is recommended!
|
|
218
234
|
cache: cache the query result to speed up repeated queries; e.g. (cache=(cache.ram, 3600), cacheable=True)
|
|
235
|
+
|
|
236
|
+
Calling this without any fields or options on a builder that already has settings
|
|
237
|
+
does nothing and emits a NoopQueryWarning.
|
|
219
238
|
"""
|
|
220
239
|
|
|
240
|
+
if not fields and not options and self:
|
|
241
|
+
warn_noop("select")
|
|
242
|
+
return self
|
|
243
|
+
|
|
221
244
|
for key in ("distinct",):
|
|
222
245
|
if options.get(key):
|
|
223
246
|
options[key] = self._normalize_select_option(options[key])
|
|
@@ -282,7 +305,15 @@ class QueryBuilder[T_MetaInstance: _TypedTable](Select):
|
|
|
282
305
|
.where(lambda table: table.id == 5).where(lambda table: table.id == 6) == (table.id == 5) & (table.id=6)
|
|
283
306
|
When passing multiple queries to a single .where, they will be ORed:
|
|
284
307
|
.where(lambda table: table.id == 5, lambda table: table.id == 6) == (table.id == 5) | (table.id=6)
|
|
308
|
+
|
|
309
|
+
Calling this without any arguments on a builder that already has settings
|
|
310
|
+
does nothing and emits a NoopQueryWarning.
|
|
311
|
+
Starting an empty builder (e.g. `Model.where()`) is allowed and stays silent.
|
|
285
312
|
"""
|
|
313
|
+
if not queries_or_lambdas and not filters and self:
|
|
314
|
+
warn_noop("where")
|
|
315
|
+
return self
|
|
316
|
+
|
|
286
317
|
new_query = self.query
|
|
287
318
|
table = self._ensure_table_defined()
|
|
288
319
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|