TypeDAL 4.8.5__tar.gz → 4.8.6__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-4.8.6/.crush/.gitignore +1 -0
- typedal-4.8.6/.crush/crush.db-shm +0 -0
- typedal-4.8.6/.crush/crush.db-wal +0 -0
- typedal-4.8.6/.crush/logs/crush.log +37 -0
- {typedal-4.8.5 → typedal-4.8.6}/CHANGELOG.md +6 -0
- {typedal-4.8.5 → typedal-4.8.6}/PKG-INFO +1 -1
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/__about__.py +1 -1
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/fields.py +15 -2
- typedal-4.8.6/tests/__init__.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_config.py +11 -2
- typedal-4.8.5/typing_again.py +0 -40
- /typedal-4.8.5/src/typedal/py.typed → /typedal-4.8.6/.crush/init +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/.github/workflows/su6.yml +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/.gitignore +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/.readthedocs.yml +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/README.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/coverage.svg +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/10_advanced_apis.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/1_getting_started.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/2_defining_tables.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/3_building_queries.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/4_relationships.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/5_py4web.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/6_migrations.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/7_configuration.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/8_mixins.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/9_memoization.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/css/code_blocks.css +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/index.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/docs/requirements.txt +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/example_new.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/example_old.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/mkdocs.yml +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/pyproject.toml +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/__init__.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/caching.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/cli.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/config.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/constants.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/core.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/define.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/enum_helpers.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/for_py4web.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/for_web2py.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/helpers.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/mixins.py +0 -0
- /typedal-4.8.5/tests/__init__.py → /typedal-4.8.6/src/typedal/py.typed +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/query_builder.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/relationships.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/rows.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/serializers/as_json.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/serializers/typescript.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/tables.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/types.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/src/typedal/web2py_py4web_shared.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tasks.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/configs/simple.toml +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/configs/valid.env +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/configs/valid.toml +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/py314_tests.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_cli.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_docs_examples.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_helpers.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_json.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_main.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_mixins.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_mypy.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_orm.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_py4web.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_query_builder.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_relationships.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_row.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_stats.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_table.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_typescript.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_typing_mypy.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_typing_pyright.md +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_web2py.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/test_xx_others.py +0 -0
- {typedal-4.8.5 → typedal-4.8.6}/tests/timings.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{"time":"2026-01-20T14:19:21.359487106+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/config.(*catwalkSync).Get.func1","file":"github.com/charmbracelet/crush/internal/config/catwalk.go","line":55},"msg":"Fetching providers from Catwalk"}
|
|
2
|
+
{"time":"2026-01-20T14:19:21.518115889+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/config.(*catwalkSync).Get.func1","file":"github.com/charmbracelet/crush/internal/config/catwalk.go","line":63},"msg":"Catwalk providers not modified"}
|
|
3
|
+
{"time":"2026-01-20T14:19:21.52626179+01:00","level":"INFO","msg":"OK 20250424200609_initial.sql (1.52ms)"}
|
|
4
|
+
{"time":"2026-01-20T14:19:21.526651475+01:00","level":"INFO","msg":"OK 20250515105448_add_summary_message_id.sql (330.71µs)"}
|
|
5
|
+
{"time":"2026-01-20T14:19:21.526995425+01:00","level":"INFO","msg":"OK 20250624000000_add_created_at_indexes.sql (325.29µs)"}
|
|
6
|
+
{"time":"2026-01-20T14:19:21.527303588+01:00","level":"INFO","msg":"OK 20250627000000_add_provider_to_messages.sql (293.15µs)"}
|
|
7
|
+
{"time":"2026-01-20T14:19:21.52790648+01:00","level":"INFO","msg":"OK 20250810000000_add_is_summary_message.sql (495.71µs)"}
|
|
8
|
+
{"time":"2026-01-20T14:19:21.528316924+01:00","level":"INFO","msg":"OK 20250812000000_add_todos_to_sessions.sql (389.38µs)"}
|
|
9
|
+
{"time":"2026-01-20T14:19:21.528324939+01:00","level":"INFO","msg":"goose: successfully migrated database to version: 20250812000000"}
|
|
10
|
+
{"time":"2026-01-20T14:19:21.528356959+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/app.(*App).initLSPClients","file":"github.com/charmbracelet/crush/internal/app/lsp.go","line":21},"msg":"LSP clients initialization started in background"}
|
|
11
|
+
{"time":"2026-01-20T14:19:21.52843831+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/app.New.func1","file":"github.com/charmbracelet/crush/internal/app/app.go","line":102},"msg":"Initializing MCP clients"}
|
|
12
|
+
{"time":"2026-01-20T14:21:06.413595152+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/agent.(*sessionAgent).generateTitle","file":"github.com/charmbracelet/crush/internal/agent/agent.go","line":788},"msg":"generated title with small model"}
|
|
13
|
+
{"time":"2026-01-20T14:21:14.539289381+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/agent.(*sessionAgent).generateTitle","file":"github.com/charmbracelet/crush/internal/agent/agent.go","line":788},"msg":"generated title with small model"}
|
|
14
|
+
{"time":"2026-01-20T14:21:15.710688424+01:00","level":"WARN","source":{"function":"github.com/charmbracelet/crush/internal/agent/tools.init.func1","file":"github.com/charmbracelet/crush/internal/agent/tools/rg.go","line":18},"msg":"Ripgrep (rg) not found in $PATH. Some grep features might be limited or slower."}
|
|
15
|
+
{"time":"2026-01-20T14:21:17.08089755+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/agent.(*sessionAgent).generateTitle","file":"github.com/charmbracelet/crush/internal/agent/agent.go","line":788},"msg":"generated title with small model"}
|
|
16
|
+
{"time":"2026-01-20T14:21:17.151106375+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/agent.(*sessionAgent).generateTitle","file":"github.com/charmbracelet/crush/internal/agent/agent.go","line":788},"msg":"generated title with small model"}
|
|
17
|
+
{"time":"2026-01-20T14:22:05.503761296+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/agent.(*sessionAgent).generateTitle","file":"github.com/charmbracelet/crush/internal/agent/agent.go","line":788},"msg":"generated title with small model"}
|
|
18
|
+
{"time":"2026-01-20T14:26:05.030425805+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/agent.(*sessionAgent).generateTitle","file":"github.com/charmbracelet/crush/internal/agent/agent.go","line":788},"msg":"generated title with small model"}
|
|
19
|
+
{"time":"2026-01-20T14:36:26.778665189+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/agent.(*sessionAgent).generateTitle","file":"github.com/charmbracelet/crush/internal/agent/agent.go","line":788},"msg":"generated title with small model"}
|
|
20
|
+
{"time":"2026-01-20T14:38:51.314473736+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/agent.(*sessionAgent).generateTitle","file":"github.com/charmbracelet/crush/internal/agent/agent.go","line":788},"msg":"generated title with small model"}
|
|
21
|
+
{"time":"2026-01-20T15:02:22.602405814+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/app.(*App).Shutdown.func1","file":"github.com/charmbracelet/crush/internal/app/app.go","line":403},"msg":"Shutdown took 6.62949ms"}
|
|
22
|
+
{"time":"2026-01-20T15:02:23.719585648+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/config.(*catwalkSync).Get.func1","file":"github.com/charmbracelet/crush/internal/config/catwalk.go","line":55},"msg":"Fetching providers from Catwalk"}
|
|
23
|
+
{"time":"2026-01-20T15:02:23.881789126+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/config.(*catwalkSync).Get.func1","file":"github.com/charmbracelet/crush/internal/config/catwalk.go","line":63},"msg":"Catwalk providers not modified"}
|
|
24
|
+
{"time":"2026-01-20T15:02:23.884044691+01:00","level":"INFO","msg":"goose: no migrations to run. current version: 20250812000000"}
|
|
25
|
+
{"time":"2026-01-20T15:02:23.884082792+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/app.(*App).initLSPClients","file":"github.com/charmbracelet/crush/internal/app/lsp.go","line":21},"msg":"LSP clients initialization started in background"}
|
|
26
|
+
{"time":"2026-01-20T15:02:23.884273487+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/app.New.func1","file":"github.com/charmbracelet/crush/internal/app/app.go","line":102},"msg":"Initializing MCP clients"}
|
|
27
|
+
{"time":"2026-01-20T15:04:13.024457515+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/agent.(*sessionAgent).generateTitle","file":"github.com/charmbracelet/crush/internal/agent/agent.go","line":788},"msg":"generated title with small model"}
|
|
28
|
+
{"time":"2026-01-20T15:04:14.232072885+01:00","level":"WARN","source":{"function":"github.com/charmbracelet/crush/internal/agent/tools.init.func1","file":"github.com/charmbracelet/crush/internal/agent/tools/rg.go","line":18},"msg":"Ripgrep (rg) not found in $PATH. Some grep features might be limited or slower."}
|
|
29
|
+
{"time":"2026-01-20T15:11:24.612161916+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/app.(*App).Shutdown.func1","file":"github.com/charmbracelet/crush/internal/app/app.go","line":403},"msg":"Shutdown took 9.537141ms"}
|
|
30
|
+
{"time":"2026-01-20T15:11:25.263960575+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/config.(*catwalkSync).Get.func1","file":"github.com/charmbracelet/crush/internal/config/catwalk.go","line":55},"msg":"Fetching providers from Catwalk"}
|
|
31
|
+
{"time":"2026-01-20T15:11:25.431990051+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/config.(*catwalkSync).Get.func1","file":"github.com/charmbracelet/crush/internal/config/catwalk.go","line":63},"msg":"Catwalk providers not modified"}
|
|
32
|
+
{"time":"2026-01-20T15:11:25.434282035+01:00","level":"INFO","msg":"goose: no migrations to run. current version: 20250812000000"}
|
|
33
|
+
{"time":"2026-01-20T15:11:25.434366662+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/app.(*App).initLSPClients","file":"github.com/charmbracelet/crush/internal/app/lsp.go","line":21},"msg":"LSP clients initialization started in background"}
|
|
34
|
+
{"time":"2026-01-20T15:11:25.434579879+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/app.New.func1","file":"github.com/charmbracelet/crush/internal/app/app.go","line":102},"msg":"Initializing MCP clients"}
|
|
35
|
+
{"time":"2026-01-20T15:24:40.456010578+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/agent.(*sessionAgent).generateTitle","file":"github.com/charmbracelet/crush/internal/agent/agent.go","line":788},"msg":"generated title with small model"}
|
|
36
|
+
{"time":"2026-01-20T15:24:51.673808433+01:00","level":"WARN","source":{"function":"github.com/charmbracelet/crush/internal/agent/tools.init.func1","file":"github.com/charmbracelet/crush/internal/agent/tools/rg.go","line":18},"msg":"Ripgrep (rg) not found in $PATH. Some grep features might be limited or slower."}
|
|
37
|
+
{"time":"2026-01-20T15:26:03.868420566+01:00","level":"INFO","source":{"function":"github.com/charmbracelet/crush/internal/agent.(*sessionAgent).Cancel","file":"github.com/charmbracelet/crush/internal/agent/agent.go","line":907},"msg":"Request cancellation initiated","session_id":"4c2d1684-8db2-4ffd-83bb-9c08fe850f29"}
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
<!--next-version-placeholder-->
|
|
4
4
|
|
|
5
|
+
## v4.8.6 (2026-06-02)
|
|
6
|
+
|
|
7
|
+
### Fix
|
|
8
|
+
|
|
9
|
+
* Support `None` for timestamp fields ([`e49be64`](https://github.com/trialandsuccess/TypeDAL/commit/e49be6425158c0c299bdccb9d5c18187f4f1c10e))
|
|
10
|
+
|
|
5
11
|
## v4.8.5 (2026-05-28)
|
|
6
12
|
|
|
7
13
|
### Fix
|
|
@@ -412,7 +412,9 @@ def UploadField(**kw: t.Unpack[FieldSettings]) -> TypedField[str]:
|
|
|
412
412
|
Upload = UploadField
|
|
413
413
|
|
|
414
414
|
|
|
415
|
-
def ReferenceField[
|
|
415
|
+
def ReferenceField[
|
|
416
|
+
T_subclass: (TypedTable, Table)
|
|
417
|
+
](
|
|
416
418
|
other_table: str | t.Type[TypedTable] | TypedTable | Table | T_subclass,
|
|
417
419
|
**kw: t.Unpack[FieldSettings],
|
|
418
420
|
) -> TypedField[int]:
|
|
@@ -490,10 +492,21 @@ Bigint = BigintField
|
|
|
490
492
|
|
|
491
493
|
## Custom:
|
|
492
494
|
|
|
495
|
+
|
|
496
|
+
def safe_encode_native_timestamp(value: dt.datetime | None) -> str | None:
|
|
497
|
+
"""
|
|
498
|
+
Encode timestamp values for SQL without turning None into the string 'None'.
|
|
499
|
+
"""
|
|
500
|
+
if value is None:
|
|
501
|
+
return None
|
|
502
|
+
|
|
503
|
+
return f"'{value}'"
|
|
504
|
+
|
|
505
|
+
|
|
493
506
|
NativeTimestampField = SQLCustomType(
|
|
494
507
|
type="datetime",
|
|
495
508
|
native="timestamp",
|
|
496
|
-
encoder=
|
|
509
|
+
encoder=safe_encode_native_timestamp,
|
|
497
510
|
# decoder=lambda x: x, # already parsed into datetime
|
|
498
511
|
)
|
|
499
512
|
|
|
File without changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
+
from datetime import datetime
|
|
2
3
|
import os
|
|
3
4
|
import shutil
|
|
4
5
|
import sqlite3
|
|
@@ -179,9 +180,11 @@ def test_timestamp_fields_sqlite(at_temp_dir):
|
|
|
179
180
|
ts = TimestampField(default=dt.datetime.now)
|
|
180
181
|
dt = TypedField(dt.datetime, default=dt.datetime.now)
|
|
181
182
|
|
|
183
|
+
ts_optional: TypedField[datetime | None] = TimestampField(default=None, notnull=False)
|
|
184
|
+
|
|
182
185
|
db.define(Timestamp)
|
|
183
186
|
|
|
184
|
-
row = Timestamp.insert()
|
|
187
|
+
row = Timestamp.insert(ts_optional=None)
|
|
185
188
|
|
|
186
189
|
# old:
|
|
187
190
|
assert isinstance(row.dt, dt.datetime), "not a datetime"
|
|
@@ -190,10 +193,12 @@ def test_timestamp_fields_sqlite(at_temp_dir):
|
|
|
190
193
|
# new:
|
|
191
194
|
assert isinstance(row.ts, dt.datetime), "not a datetime"
|
|
192
195
|
assert "." in str(row.ts) # ms precision
|
|
196
|
+
assert row.ts_optional is None
|
|
193
197
|
|
|
194
198
|
assert '"ts" timestamp NOT NULL' in Timestamp._sql()
|
|
195
199
|
|
|
196
200
|
|
|
201
|
+
|
|
197
202
|
def test_timestamp_fields_psql(at_temp_dir):
|
|
198
203
|
examples = Path(__file__).parent / "configs"
|
|
199
204
|
shutil.copy(examples / "valid.env", "./.env")
|
|
@@ -206,9 +211,11 @@ def test_timestamp_fields_psql(at_temp_dir):
|
|
|
206
211
|
ts = TimestampField(default=dt.datetime.now)
|
|
207
212
|
dt = TypedField(dt.datetime, default=dt.datetime.now)
|
|
208
213
|
|
|
214
|
+
ts_optional: TypedField[datetime | None] = TimestampField(default=None, notnull=False)
|
|
215
|
+
|
|
209
216
|
db.define(Timestamp)
|
|
210
217
|
|
|
211
|
-
row = Timestamp.insert()
|
|
218
|
+
row = Timestamp.insert(ts_optional=None)
|
|
212
219
|
|
|
213
220
|
# old:
|
|
214
221
|
assert isinstance(row.dt, dt.datetime), "not a datetime"
|
|
@@ -217,10 +224,12 @@ def test_timestamp_fields_psql(at_temp_dir):
|
|
|
217
224
|
# new:
|
|
218
225
|
assert isinstance(row.ts, dt.datetime), "not a datetime"
|
|
219
226
|
assert "." in str(row.ts) # ms precision
|
|
227
|
+
assert row.ts_optional is None
|
|
220
228
|
|
|
221
229
|
assert '"ts" timestamp NOT NULL' in Timestamp._sql()
|
|
222
230
|
|
|
223
231
|
|
|
232
|
+
|
|
224
233
|
def test_point_fields_sqlite(at_temp_dir):
|
|
225
234
|
db = TypeDAL("sqlite:memory")
|
|
226
235
|
|
typedal-4.8.5/typing_again.py
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
from typedal import TypeDAL, TypedTable, TypedField, relationship, Relationship
|
|
2
|
-
|
|
3
|
-
from typing import reveal_type
|
|
4
|
-
|
|
5
|
-
db = TypeDAL()
|
|
6
|
-
|
|
7
|
-
reveal_type(db)
|
|
8
|
-
|
|
9
|
-
@db.define
|
|
10
|
-
class OtherTable(TypedTable):
|
|
11
|
-
...
|
|
12
|
-
|
|
13
|
-
@db.define
|
|
14
|
-
class MyTable(TypedTable):
|
|
15
|
-
field = TypedField(str)
|
|
16
|
-
|
|
17
|
-
rel = relationship(OtherTable)
|
|
18
|
-
multiple = relationship(list[OtherTable])
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
row = MyTable.first_or_fail()
|
|
22
|
-
|
|
23
|
-
reveal_type(row) # expected: MyTable; pycharm: MyTable
|
|
24
|
-
reveal_type(MyTable.field) # expected: TypedField[str]; pycharm: TypedField[str]
|
|
25
|
-
reveal_type(row.field) # expected: str; pycharm: TypedField[str]
|
|
26
|
-
|
|
27
|
-
q = MyTable.field.belongs([""])
|
|
28
|
-
|
|
29
|
-
reveal_type(q) # expected: Query; pycharm: Query
|
|
30
|
-
|
|
31
|
-
reveal_type(MyTable.rel) # expected: Relationship[OtherTable]; pycharm: Relationship[OtherTable | None]
|
|
32
|
-
reveal_type(row.rel) # expected: OtherTable | None; pycharm: Relationship[OtherTable | None]
|
|
33
|
-
|
|
34
|
-
reveal_type(MyTable.multiple) # expected: Relationship[list[OtherTable]]; pycharm: Relationship[list[OtherTable]]
|
|
35
|
-
reveal_type(row.multiple) # expected: list[OtherTable]; pycharm: Relationship[list[OtherTable]]
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
MyTable.field.label = "Test Label"
|
|
40
|
-
MyTable.field.represent = lambda value, row: "Test Repr"
|
|
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
|
|
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
|
|
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
|