From 2224595b00745c3791659fbf0ee4e55201328ebd Mon Sep 17 00:00:00 2001 From: Jae Hyuck Sa Date: Sun, 19 May 2024 20:39:05 +0900 Subject: [PATCH] 5.0: Update `django.db.models.sql.compiler` (#2166) * 5.0: Update django.db.models.sql.compiler * Update django-stubs/db/models/sql/compiler.pyi --------- Co-authored-by: Nikita Sobolev --- django-stubs/db/models/sql/compiler.pyi | 5 ++++- scripts/stubtest/allowlist_todo.txt | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/django-stubs/db/models/sql/compiler.pyi b/django-stubs/db/models/sql/compiler.pyi index 8c365fe09..b000631be 100644 --- a/django-stubs/db/models/sql/compiler.pyi +++ b/django-stubs/db/models/sql/compiler.pyi @@ -7,7 +7,7 @@ from uuid import UUID from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.utils import CursorWrapper from django.db.models.base import Model -from django.db.models.expressions import BaseExpression, Expression +from django.db.models.expressions import BaseExpression, Expression, Ref from django.db.models.sql.query import Query from django.db.models.sql.subqueries import AggregateQuery, DeleteQuery, InsertQuery, UpdateQuery from django.utils.functional import cached_property @@ -18,6 +18,9 @@ _ParamT: TypeAlias = str | int _ParamsT: TypeAlias = list[_ParamT] _AsSqlType: TypeAlias = tuple[str, _ParamsT] +class PositionRef(Ref): + def __init__(self, ordinal: str, refs: str, source: Expression) -> None: ... + class SQLCompiler: query: Query connection: BaseDatabaseWrapper diff --git a/scripts/stubtest/allowlist_todo.txt b/scripts/stubtest/allowlist_todo.txt index 60c80599a..2d9c54d71 100644 --- a/scripts/stubtest/allowlist_todo.txt +++ b/scripts/stubtest/allowlist_todo.txt @@ -1222,7 +1222,6 @@ django.db.models.sql.Query.names_to_path django.db.models.sql.Query.solve_lookup_type django.db.models.sql.Query.table_alias django.db.models.sql.XOR -django.db.models.sql.compiler.PositionRef django.db.models.sql.compiler.SQLCompiler.__init__ django.db.models.sql.compiler.SQLCompiler.deferred_to_columns django.db.models.sql.compiler.SQLCompiler.get_default_columns