From 8ae634c993c6d0d7651e78a7c4570aa79dd90885 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Wed, 1 Jun 2022 16:24:11 +0100 Subject: [PATCH 1/2] Add the missing fields to dj-database-url config type --- stubs/dj-database-url/dj_database_url.pyi | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/stubs/dj-database-url/dj_database_url.pyi b/stubs/dj-database-url/dj_database_url.pyi index f719d5a165eb..2a9863e15d28 100644 --- a/stubs/dj-database-url/dj_database_url.pyi +++ b/stubs/dj-database-url/dj_database_url.pyi @@ -4,15 +4,21 @@ from typing_extensions import TypedDict DEFAULT_ENV: str SCHEMES: dict[str, str] +# From https://docs.djangoproject.com/en/4.0/ref/settings/#databases class _DBConfig(TypedDict, total=False): + ATOMIC_REQUESTS: bool + AUTOCOMMIT: bool + CONN_MAX_AGE: int + DISABLE_SERVER_SIDE_CURSORS: bool ENGINE: str + HOST: str NAME: str - USER: str + OPTIONS: dict[str, Any] PASSWORD: str - HOST: str PORT: str - CONN_MAX_AGE: int - OPTIONS: dict[str, Any] + TEST: dict[str, Any] + TIME_ZONE: str + USER: str def parse(url: str, engine: str | None = ..., conn_max_age: int = ..., ssl_require: bool = ...) -> _DBConfig: ... def config( From 5f80b0fb08dabf99c1c6acbd8f1633bd46d7ee26 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Wed, 1 Jun 2022 16:41:45 +0100 Subject: [PATCH 2/2] Options can be None Co-authored-by: Alex Waygood --- stubs/dj-database-url/dj_database_url.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/dj-database-url/dj_database_url.pyi b/stubs/dj-database-url/dj_database_url.pyi index 2a9863e15d28..353a0a5c4d8b 100644 --- a/stubs/dj-database-url/dj_database_url.pyi +++ b/stubs/dj-database-url/dj_database_url.pyi @@ -13,7 +13,7 @@ class _DBConfig(TypedDict, total=False): ENGINE: str HOST: str NAME: str - OPTIONS: dict[str, Any] + OPTIONS: dict[str, Any] | None PASSWORD: str PORT: str TEST: dict[str, Any]