Skip to content

Commit

Permalink
Merge branch 'master' into remove-queryset-hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
intgr authored May 6, 2024
2 parents c4132a8 + b0858a7 commit 2159913
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 46 deletions.
2 changes: 1 addition & 1 deletion django-stubs/contrib/auth/backends.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ UserModel: Any

class BaseBackend:
def authenticate(self, request: HttpRequest | None, **kwargs: Any) -> AbstractBaseUser | None: ...
def get_user(self, user_id: int) -> AbstractBaseUser | None: ...
def get_user(self, user_id: Any) -> AbstractBaseUser | None: ...
def get_user_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ...
def get_group_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ...
def get_all_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ...
Expand Down
14 changes: 9 additions & 5 deletions django-stubs/contrib/gis/db/backends/mysql/schema.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ from logging import Logger
from typing import Any

from django.db.backends.mysql.schema import DatabaseSchemaEditor
from django.db.models.base import Model
from django.db.models.fields import Field

logger: Logger

Expand All @@ -10,9 +12,11 @@ class MySQLGISSchemaEditor(DatabaseSchemaEditor):
sql_drop_spatial_index: str
geometry_sql: Any
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def skip_default(self, field: Any) -> Any: ...
def column_sql(self, model: Any, field: Any, include_default: bool = ...) -> Any: ...
def create_model(self, model: Any) -> None: ...
def add_field(self, model: Any, field: Any) -> None: ...
def remove_field(self, model: Any, field: Any) -> None: ...
def skip_default(self, field: Field) -> bool: ...
def column_sql(
self, model: type[Model], field: Field, include_default: bool = ...
) -> tuple[None, None] | tuple[str, list[Any]]: ...
def create_model(self, model: type[Model]) -> None: ...
def add_field(self, model: type[Model], field: Field) -> None: ...
def remove_field(self, model: type[Model], field: Field) -> None: ...
def create_spatial_indexes(self) -> None: ...
14 changes: 9 additions & 5 deletions django-stubs/contrib/gis/db/backends/oracle/schema.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from typing import Any

from django.db.backends.oracle.schema import DatabaseSchemaEditor
from django.db.models.base import Model
from django.db.models.fields import Field

class OracleGISSchemaEditor(DatabaseSchemaEditor):
sql_add_geometry_metadata: str
Expand All @@ -11,9 +13,11 @@ class OracleGISSchemaEditor(DatabaseSchemaEditor):
geometry_sql: Any
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def geo_quote_name(self, name: Any) -> Any: ...
def column_sql(self, model: Any, field: Any, include_default: bool = ...) -> Any: ...
def create_model(self, model: Any) -> None: ...
def delete_model(self, model: Any) -> None: ...
def add_field(self, model: Any, field: Any) -> None: ...
def remove_field(self, model: Any, field: Any) -> None: ...
def column_sql(
self, model: type[Model], field: Field, include_default: bool = ...
) -> tuple[None, None] | tuple[str, list[Any]]: ...
def create_model(self, model: type[Model]) -> None: ...
def delete_model(self, model: type[Model]) -> None: ...
def add_field(self, model: type[Model], field: Field) -> None: ...
def remove_field(self, model: type[Model], field: Field) -> None: ...
def run_geometry_sql(self) -> None: ...
21 changes: 14 additions & 7 deletions django-stubs/contrib/gis/db/backends/spatialite/schema.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from typing import Any

from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.models.base import Model
from django.db.models.fields import Field

class SpatialiteSchemaEditor(DatabaseSchemaEditor):
sql_add_geometry_column: str
Expand All @@ -14,12 +16,17 @@ class SpatialiteSchemaEditor(DatabaseSchemaEditor):
geometry_sql: Any
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def geo_quote_name(self, name: Any) -> Any: ...
def column_sql(self, model: Any, field: Any, include_default: bool = ...) -> Any: ...
def remove_geometry_metadata(self, model: Any, field: Any) -> None: ...
def create_model(self, model: Any) -> None: ...
def delete_model(self, model: Any, **kwargs: Any) -> None: ...
def add_field(self, model: Any, field: Any) -> None: ...
def remove_field(self, model: Any, field: Any) -> None: ...
def column_sql(
self, model: type[Model], field: Field, include_default: bool = ...
) -> tuple[None, None] | tuple[str, list[Any]]: ...
def remove_geometry_metadata(self, model: type[Model], field: Field) -> None: ...
def create_model(self, model: type[Model]) -> None: ...
def delete_model(self, model: type[Model], **kwargs: Any) -> None: ...
def add_field(self, model: type[Model], field: Field) -> None: ...
def remove_field(self, model: type[Model], field: Field) -> None: ...
def alter_db_table(
self, model: Any, old_db_table: Any, new_db_table: Any, disable_constraints: bool = ...
self,
model: type[Model],
old_db_table: str,
new_db_table: str,
) -> None: ...
12 changes: 6 additions & 6 deletions django-stubs/db/backends/base/schema.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class BaseDatabaseSchemaEditor(AbstractContextManager[Any]):
def column_sql(
self, model: type[Model], field: Field, include_default: bool = ...
) -> tuple[None, None] | tuple[str, list[Any]]: ...
def skip_default(self, field: Any) -> bool: ...
def skip_default_on_alter(self, field: Any) -> bool: ...
def skip_default(self, field: Field) -> bool: ...
def skip_default_on_alter(self, field: Field) -> bool: ...
def prepare_default(self, value: Any) -> Any: ...
def db_default_sql(self, field: Field) -> _AsSqlType: ...
def effective_default(self, field: Field) -> int | str: ...
Expand All @@ -101,10 +101,10 @@ class BaseDatabaseSchemaEditor(AbstractContextManager[Any]):
) -> None: ...
def alter_db_table(self, model: type[Model], old_db_table: str, new_db_table: str) -> None: ...
def alter_db_table_comment(
self, model: type[Model], old_db_table_comment: str | None, new_db_table_comment: str
self, model: type[Model], old_db_table_comment: str, new_db_table_comment: str
) -> None: ...
def alter_db_tablespace(self, model: Any, old_db_tablespace: Any, new_db_tablespace: Any) -> None: ...
def add_field(self, model: Any, field: Any) -> None: ...
def remove_field(self, model: Any, field: Any) -> None: ...
def alter_db_tablespace(self, model: type[Model], old_db_tablespace: str, new_db_tablespace: str) -> None: ...
def add_field(self, model: type[Model], field: Field) -> None: ...
def remove_field(self, model: type[Model], field: Field) -> None: ...
def alter_field(self, model: type[Model], old_field: Field, new_field: Field, strict: bool = ...) -> None: ...
def remove_procedure(self, procedure_name: Any, param_types: Any = ...) -> None: ...
6 changes: 4 additions & 2 deletions django-stubs/db/backends/mysql/schema.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ from typing import Any

from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.backends.mysql.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.fields import Field

class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
connection: DatabaseWrapper
Expand All @@ -22,5 +24,5 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
@property
def sql_rename_column(self) -> str: ... # type: ignore[override]
def quote_value(self, value: Any) -> str: ...
def skip_default(self, field: Any) -> bool: ...
def add_field(self, model: Any, field: Any) -> None: ...
def skip_default(self, field: Field) -> bool: ...
def add_field(self, model: type[Model], field: Field) -> None: ...
8 changes: 5 additions & 3 deletions django-stubs/db/backends/oracle/schema.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ from typing import Any

from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.backends.oracle.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.fields import Field

class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
connection: DatabaseWrapper
Expand All @@ -16,8 +18,8 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_delete_table: str
sql_create_index: str
def quote_value(self, value: Any) -> str: ...
def remove_field(self, model: Any, field: Any) -> None: ...
def delete_model(self, model: Any) -> None: ...
def alter_field(self, model: Any, old_field: Any, new_field: Any, strict: bool = ...) -> None: ...
def remove_field(self, model: type[Model], field: Field) -> None: ...
def delete_model(self, model: type[Model]) -> None: ...
def alter_field(self, model: type[Model], old_field: Field, new_field: Field, strict: bool = ...) -> None: ...
def normalize_name(self, name: Any) -> str: ...
def prepare_default(self, value: Any) -> Any: ...
6 changes: 4 additions & 2 deletions django-stubs/db/backends/postgresql/schema.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ from typing import Any

from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.backends.postgresql.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.indexes import Index

class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
connection: DatabaseWrapper
Expand All @@ -17,5 +19,5 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_delete_fk: str
sql_delete_procedure: str
def quote_value(self, value: Any) -> str: ...
def add_index(self, model: Any, index: Any, concurrently: bool = ...) -> None: ...
def remove_index(self, model: Any, index: Any, concurrently: bool = ...) -> None: ...
def add_index(self, model: type[Model], index: Index, concurrently: bool = ...) -> None: ...
def remove_index(self, model: type[Model], index: Index, concurrently: bool = ...) -> None: ...
9 changes: 0 additions & 9 deletions django-stubs/forms/forms.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ from django.forms.renderers import BaseRenderer
from django.forms.utils import ErrorDict, ErrorList, RenderableFormMixin, _DataT, _FilesT
from django.forms.widgets import Media, MediaDefiningClass
from django.utils.functional import _StrOrPromise, cached_property
from django.utils.safestring import SafeString

class DeclarativeFieldsMetaclass(MediaDefiningClass): ...

Expand Down Expand Up @@ -71,14 +70,6 @@ class BaseForm(RenderableFormMixin):
def hidden_fields(self) -> list[BoundField]: ...
def visible_fields(self) -> list[BoundField]: ...
def get_initial_for_field(self, field: Field, field_name: str) -> Any: ...
def _html_output(
self,
normal_row: str,
error_row: str,
row_ender: str,
help_text_html: str,
errors_on_separate_row: bool,
) -> SafeString: ...

class Form(BaseForm, metaclass=DeclarativeFieldsMetaclass):
base_fields: ClassVar[dict[str, Field]]
Expand Down
1 change: 1 addition & 0 deletions django-stubs/forms/renderers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def get_default_renderer() -> BaseRenderer: ...
class BaseRenderer:
form_template_name: str
formset_template_name: str
field_template_name: str
def get_template(self, template_name: str) -> Any: ...
def render(self, template_name: str, context: dict[str, Any], request: HttpRequest | None = ...) -> str: ...

Expand Down
1 change: 1 addition & 0 deletions scripts/stubtest/allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ django.forms.formsets.BaseFormSet.forms
django.forms.formsets.BaseFormSet.management_form
django.forms.renderers.EngineMixin.engine
django.forms.renderers.Jinja2.backend
django.forms.renderers.Jinja2DivFormRenderer.__init__
django.http.HttpRequest.accepted_types
django.http.HttpRequest.headers
django.http.request.HttpRequest.accepted_types
Expand Down
6 changes: 0 additions & 6 deletions scripts/stubtest/allowlist_todo_django50.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
django.contrib.contenttypes.fields.GenericForeignKey.get_content_type
django.contrib.contenttypes.fields.GenericForeignKey.get_prefetch_querysets
django.contrib.contenttypes.prefetch
django.contrib.gis.db.backends.spatialite.schema.SpatialiteSchemaEditor.alter_db_table
django.contrib.gis.db.models.Case.allowed_default
django.contrib.gis.db.models.ExpressionWrapper.allowed_default
django.contrib.gis.db.models.F.allowed_default
Expand All @@ -22,7 +21,6 @@ django.contrib.gis.db.models.Lookup.allowed_default
django.contrib.gis.db.models.Prefetch.get_current_querysets
django.contrib.gis.db.models.Q.identity
django.contrib.gis.db.models.When.allowed_default
django.contrib.gis.forms.BaseForm._html_output
django.contrib.gis.forms.ClearableFileInput.checked
django.contrib.gis.forms.fields_for_model
django.contrib.gis.geos.prototypes.io.DEFAULT_TRIM_VALUE
Expand Down Expand Up @@ -90,12 +88,8 @@ django.db.models.sql.query.Query.build_filtered_relation_q
django.db.models.sql.query.Query.join
django.db.models.sql.query.Query.resolve_lookup_value
django.db.models.sql.query.Query.setup_joins
django.forms.BaseForm._html_output
django.forms.ClearableFileInput.checked
django.forms.fields_for_model
django.forms.forms.BaseForm._html_output
django.forms.models.fields_for_model
django.forms.renderers.BaseRenderer.field_template_name
django.forms.renderers.Jinja2DivFormRenderer.__init__
django.forms.widgets.ClearableFileInput.checked
django.template.autoreload

0 comments on commit 2159913

Please sign in to comment.