Skip to content

Commit 0bd3a7c

Browse files
authored
Merge branch 'master' into fix/site-name-stub
2 parents e1dcd57 + e228e18 commit 0bd3a7c

File tree

27 files changed

+306
-264
lines changed

27 files changed

+306
-264
lines changed

django-stubs/contrib/gis/db/backends/mysql/schema.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ logger: Logger
99

1010
class MySQLGISSchemaEditor(DatabaseSchemaEditor):
1111
sql_add_spatial_index: str
12-
sql_drop_spatial_index: str
13-
geometry_sql: Any
14-
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
1512
def skip_default(self, field: Field) -> bool: ...
1613
def column_sql(
1714
self, model: type[Model], field: Field, include_default: bool = ...
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
22
from django.db.backends.oracle.features import DatabaseFeatures as OracleDatabaseFeatures
3+
from django.utils.functional import cached_property
34

45
class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures):
56
supports_add_srs_entry: bool
67
supports_geometry_field_introspection: bool
78
supports_geometry_field_unique_index: bool
89
supports_perimeter_geodetic: bool
910
supports_dwithin_distance_expr: bool
11+
supports_tolerance_parameter: bool
12+
13+
@cached_property
14+
def django_test_skips(self) -> dict[str, set[str]]: ... # type: ignore[override]

django-stubs/contrib/gis/db/backends/oracle/operations.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations):
2626
Adapter: Any
2727
extent: str
2828
unionagg: str
29+
from_text: str # type: ignore[assignment]
2930
function_names: Any
3031
select: str
3132
gis_operators: Any
3233
unsupported_functions: Any
3334
def geo_quote_name(self, name: Any) -> Any: ...
35+
def convert_extent(self, clob: Any) -> tuple[float, float, float, float] | None: ... # type: ignore[override]
3436
def geo_db_type(self, f: Any) -> Any: ...
3537
def get_distance(self, f: Any, value: Any, lookup_type: Any) -> Any: ...
3638
def get_geom_placeholder(self, f: Any, value: Any, compiler: Any) -> Any: ...

django-stubs/db/backends/base/features.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ class BaseDatabaseFeatures:
144144
prohibits_null_characters_in_text_exception: tuple[ValueError | DataError] | None
145145
supports_unlimited_charfield: bool
146146
supports_tuple_comparison_against_subquery: bool
147+
rounds_to_even: bool
148+
supports_tuple_lookups: bool
147149
test_collations: dict[str, str | None]
148150
test_now_utc_template: str | None
149151
insert_test_table_with_defaults: str | None

django-stubs/db/backends/base/schema.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class BaseDatabaseSchemaEditor(AbstractContextManager[Any]):
5151
sql_delete_index: str
5252
sql_create_pk: str
5353
sql_delete_pk: str
54+
sql_pk_constraint: str
5455
sql_delete_procedure: str
5556
sql_alter_table_comment: str
5657
sql_alter_column_comment: str

django-stubs/db/backends/oracle/base.pyi

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from contextlib import AbstractContextManager
33
from typing import Any
44

55
from django.db.backends.base.base import BaseDatabaseWrapper
6+
from django.utils.functional import cached_property
67

78
from .client import DatabaseClient
89
from .creation import DatabaseCreation
@@ -40,15 +41,22 @@ class DatabaseWrapper(BaseDatabaseWrapper):
4041
Database: Any
4142
SchemaEditorClass: Any
4243
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
44+
@property
45+
def is_pool(self) -> bool: ...
46+
@property
47+
def pool(self) -> Any: ...
48+
def close_pool(self) -> None: ...
4349
def get_connection_params(self) -> Any: ...
4450
def get_new_connection(self, conn_params: Any) -> Any: ...
4551
pattern_ops: Any
4652
def init_connection_state(self) -> None: ...
4753
def create_cursor(self, name: Any | None = None) -> Any: ...
4854
def check_constraints(self, table_names: Any | None = None) -> None: ...
49-
def is_usable(self) -> Any: ...
50-
@property
51-
def oracle_version(self) -> Any: ...
55+
def is_usable(self) -> bool: ...
56+
@cached_property
57+
def oracle_version(self) -> tuple[int, ...]: ...
58+
@cached_property
59+
def oracledb_version(self) -> tuple[int, ...]: ...
5260

5361
class OracleParam:
5462
force_bytes: Any

django-stubs/db/backends/oracle/features.pyi

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
1313
has_select_for_update_of: bool
1414
select_for_update_of_column: bool
1515
can_return_columns_from_insert: bool
16-
can_introspect_autofield: bool
1716
supports_subqueries_in_group_by: bool
1817
supports_transactions: bool
1918
supports_timezones: bool
@@ -25,33 +24,48 @@ class DatabaseFeatures(BaseDatabaseFeatures):
2524
supports_tablespaces: bool
2625
supports_sequence_reset: bool
2726
can_introspect_materialized_views: bool
28-
can_introspect_time_field: bool
2927
atomic_transactions: bool
30-
supports_combined_alters: bool
3128
nulls_order_largest: bool
3229
requires_literal_defaults: bool
3330
closed_cursor_error_class: Any
34-
bare_select_suffix: str
3531
supports_select_for_update_with_limit: bool
3632
supports_temporal_subtraction: bool
3733
ignores_table_name_case: bool
3834
supports_index_on_text_field: bool
39-
has_case_insensitive_like: bool
4035
create_test_procedure_without_params_sql: str
4136
create_test_procedure_with_int_param_sql: str
4237
supports_callproc_kwargs: bool
4338
supports_over_clause: bool
4439
supports_frame_range_fixed_distance: bool
4540
supports_ignore_conflicts: bool
46-
max_query_params: Any
41+
max_query_params: int
4742
supports_partial_indexes: bool
4843
supports_slicing_ordering_in_compound: bool
4944
allows_multiple_constraints_on_same_fields: bool
50-
supports_primitives_in_json_field: bool
5145
supports_json_field_contains: bool
5246
can_return_rows_from_update: bool
5347
supports_aggregate_order_by_clause: bool
5448
supports_any_value: bool
5549
supports_tuple_comparison_against_subquery: bool
50+
supports_json_negative_indexing: bool
51+
52+
@cached_property
53+
def django_test_skips(self) -> dict[str, set[str]]: ... # type: ignore[override]
54+
@cached_property
55+
def introspected_field_types(self) -> dict[str, str]: ... # type: ignore[override]
56+
@cached_property
57+
def test_collations(self) -> dict[str, str | None]: ... # type: ignore[override]
58+
@cached_property
59+
def supports_collation_on_charfield(self) -> bool: ... # type: ignore[override]
60+
@cached_property
61+
def supports_primitives_in_json_field(self) -> bool: ... # type: ignore[override]
62+
@cached_property
63+
def supports_frame_exclusion(self) -> bool: ... # type: ignore[override]
64+
@cached_property
65+
def supports_comparing_boolean_expr(self) -> bool: ... # type: ignore[override]
66+
@cached_property
67+
def supports_aggregation_over_interval_types(self) -> bool: ...
68+
@cached_property
69+
def bare_select_suffix(self) -> str: ... # type: ignore[override]
5670
@cached_property
57-
def supports_json_negative_indexing(self) -> bool: ... # type: ignore[override]
71+
def supports_tuple_lookups(self) -> bool: ... # type: ignore[override]

django-stubs/db/models/fields/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]):
228228
@property
229229
def flatchoices(self) -> list[_Choice]: ...
230230
def has_default(self) -> bool: ...
231+
def has_db_default(self) -> bool: ...
231232
def get_default(self) -> Any: ...
232233
def check(self, **kwargs: Any) -> list[CheckMessage]: ...
233234
def get_col(self, alias: str, output_field: Field | None = None) -> Col: ...

django-stubs/db/models/fields/related.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from typing import Any, Generic, Literal, TypeVar, overload
33
from uuid import UUID
44

55
from django.core import validators # due to weird mypy.stubtest error
6+
from django.db.backends.base.base import BaseDatabaseWrapper
67
from django.db.models.base import Model
78
from django.db.models.expressions import Combinable, Expression
89
from django.db.models.fields import NOT_PROVIDED, Field, _AllLimitChoicesTo, _ErrorMessagesMapping, _LimitChoicesTo
@@ -187,6 +188,7 @@ class ForeignKey(ForeignObject[_ST, _GT]):
187188
error_messages: _ErrorMessagesMapping | None = ...,
188189
db_comment: str | None = ...,
189190
) -> None: ...
191+
def cast_db_type(self, connection: BaseDatabaseWrapper) -> str | None: ...
190192

191193
class OneToOneField(ForeignKey[_ST, _GT]):
192194
_pyi_private_set_type: Any | Combinable
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from typing import Any
2+
3+
from django.db.backends.base.base import BaseDatabaseWrapper
4+
from django.db.models.expressions import Func
5+
from django.db.models.fields import Field
6+
from django.db.models.lookups import Exact, GreaterThan, GreaterThanOrEqual, In, IsNull, LessThan, LessThanOrEqual
7+
from django.db.models.sql.compiler import SQLCompiler, _AsSqlType
8+
9+
class Tuple(Func):
10+
function: str
11+
output_field: Field
12+
def __len__(self) -> int: ...
13+
def __iter__(self) -> Any: ...
14+
def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override]
15+
16+
class TupleLookupMixin:
17+
allows_composite_expressions: bool
18+
def get_prep_lookup(self) -> Any: ...
19+
def check_rhs_is_tuple_or_list(self) -> None: ...
20+
def check_rhs_length_equals_lhs_length(self) -> None: ...
21+
def check_rhs_is_supported_expression(self) -> None: ...
22+
def get_lhs_str(self) -> str: ...
23+
def get_prep_lhs(self) -> Any: ...
24+
def process_lhs(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, lhs: Any = None) -> _AsSqlType: ...
25+
def process_rhs(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ...
26+
def get_fallback_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ...
27+
def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ...
28+
29+
class TupleExact(TupleLookupMixin, Exact): ...
30+
class TupleIsNull(TupleLookupMixin, IsNull): ...
31+
class TupleGreaterThan(TupleLookupMixin, GreaterThan): ...
32+
class TupleGreaterThanOrEqual(TupleLookupMixin, GreaterThanOrEqual): ...
33+
class TupleLessThan(TupleLookupMixin, LessThan): ...
34+
class TupleLessThanOrEqual(TupleLookupMixin, LessThanOrEqual): ...
35+
36+
class TupleIn(TupleLookupMixin, In):
37+
def check_rhs_is_collection_of_tuples_or_lists(self) -> None: ...
38+
def check_rhs_elements_length_equals_lhs_length(self) -> None: ...
39+
def check_rhs_is_query(self) -> None: ...
40+
41+
tuple_lookups: dict[str, type[TupleLookupMixin]]

0 commit comments

Comments
 (0)