Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large update #909

Merged
merged 103 commits into from
Apr 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
d7346d1
Make module declaration precise.
sterliakov Mar 24, 2022
63a6acd
Make settings match real file.
sterliakov Mar 24, 2022
5e94a8a
Replace `include` with import.
sterliakov Mar 24, 2022
5521420
Make types more specific.
sterliakov Mar 24, 2022
9074622
Replace `WSGIRequest` with `HttpRequest` where possible.
sterliakov Mar 24, 2022
566024f
Replace all `OrderedDict` occurrences with plain `Dict` (it is not us…
sterliakov Mar 24, 2022
9d36fce
Add fake datastructures for convenience: _PropertyDescriptor and _Lis…
sterliakov Mar 24, 2022
51827b7
Actualize other datastructures.
sterliakov Mar 24, 2022
fe24dde
Rework MultiValueDict to reflect the fact that some methods can retur…
sterliakov Mar 24, 2022
65ca156
Deprecate SafeText in favor of SafeString.
sterliakov Mar 24, 2022
56feba5
Minor improvements to utils
sterliakov Mar 24, 2022
db09d78
Disallow using str in TimeFormat and DateFormat, drop removed fmt `B`
sterliakov Mar 24, 2022
9d93055
Do not let classproperty expect classmethod, make return value covari…
sterliakov Mar 24, 2022
c8ff1ce
Sync with real file.
sterliakov Mar 24, 2022
264306a
Improve types for timezone.
sterliakov Mar 24, 2022
9d83709
Sync deprecated, new and removed features in translation utils.
sterliakov Mar 24, 2022
48d396c
Drop removed files, sync huge deprecations.
sterliakov Mar 24, 2022
a49ee1a
Fix incompatible decorators (properties, contextmanagers)
sterliakov Mar 24, 2022
b629be0
Rework pagination.
sterliakov Mar 24, 2022
1ad4453
Sync validators with real code. Add _ValidatorCallable for any extern…
sterliakov Mar 24, 2022
7193e78
Add shared type definitions (for fields of both forms and models). Ac…
sterliakov Mar 24, 2022
0773712
Make all checks return Sequence[CheckMessage] or subclass to be covar…
sterliakov Mar 25, 2022
c67eebd
Add bidirectional references between backend.base and other files. Re…
sterliakov Mar 25, 2022
1986184
Actualize db.migrations: remove removed methods, replace "None" annot…
sterliakov Mar 25, 2022
599b985
Actualize db.utils to match real file.
sterliakov Mar 25, 2022
222d098
Replace FileResponse and TemplateResponse with HttpResponse(Base) whe…
sterliakov Mar 25, 2022
d0b1462
Replace Any in forms where possible. Actualize class bases and method…
sterliakov Mar 25, 2022
57f24b7
Improve typing of serializers.
sterliakov Mar 25, 2022
63c1ac6
Actualize views, rename variable bound to Model to _M for consistency.
sterliakov Mar 25, 2022
da20385
Make types of file-related code consistent. Disallow using bytes as p…
sterliakov Mar 25, 2022
25f1a79
Minor improvements: stop using None as annotation in wrong places, re…
sterliakov Mar 25, 2022
0f19b7c
Allow less specific containers, replace Any's with specific types.
sterliakov Mar 25, 2022
16baf27
Improve types for requests and responses.
sterliakov Mar 25, 2022
37a2f0b
Use AbstractBaseUser instead of User in auth.
sterliakov Mar 25, 2022
d3da253
Use broader type for permission_required
sterliakov Mar 25, 2022
535aaf8
Use wider container types. Add 'type: ignore' to avoid issues with my…
sterliakov Mar 25, 2022
37d6bb5
Disallow using backend class as argument (it is passed to import_stri…
sterliakov Mar 25, 2022
592222b
Add required methods to PasseordValidator.
sterliakov Mar 25, 2022
c2f4455
Allow using Path instance as argument.
sterliakov Mar 25, 2022
5e42596
Actualize methods.
sterliakov Mar 25, 2022
e11d8db
Add 'type: ignore' to avoid issues with mypy.stubtest.
sterliakov Mar 25, 2022
546b111
Replace Any's with specific types and BaseForm with ModelForm.
sterliakov Mar 25, 2022
afef9d6
Actualize contrib.postgres
sterliakov Mar 25, 2022
f74c304
Remove render_to_response, add 'get_absolute_url' to corresponding pr…
sterliakov Mar 25, 2022
bc0db91
Actualize signers.
sterliakov Mar 25, 2022
45ecbf5
Use precise types for handlers. Disallow str as stream type for Limit…
sterliakov Mar 25, 2022
ed94d6b
Exact types for ValidationError
sterliakov Mar 25, 2022
96eea2b
Replace wrong used Union with Sequence.
sterliakov Mar 25, 2022
56f7a97
Actualize static handlers.
sterliakov Mar 25, 2022
aa81c80
More specific types for admin. Fixes #874.
sterliakov Mar 25, 2022
731dfcc
Improve types and replace 'Tags' with str (it isn't Enum, so annotati…
sterliakov Mar 25, 2022
ffb48ef
Replace Any with specific types, actualize signatures.
sterliakov Mar 25, 2022
7d9eea1
Add async variants of handlers and clients. Use fake class to disting…
sterliakov Mar 25, 2022
1b9d6ea
Fix signature, minor improvements.
sterliakov Mar 25, 2022
40f126e
Actualize signatures and class names, replace Any with more specific …
sterliakov Mar 25, 2022
64b1176
Fix signature.
sterliakov Mar 25, 2022
531cba1
Add some missing methods to Collector
sterliakov Mar 25, 2022
ac2f812
Combinable rarely returns Self type: almost always it's CombinedExpre…
sterliakov Mar 25, 2022
9aec5d2
No Random in source anymore.
sterliakov Mar 25, 2022
d7c0f4b
Drop removed SimpleCol.
sterliakov Mar 25, 2022
329427d
Replace _OutputField with Field: nothing in docs about strings.
sterliakov Mar 25, 2022
8192a49
Introduce reusable types, add missing methods. Remove strange types (…
sterliakov Mar 25, 2022
8f9d807
Use literal constants.
sterliakov Mar 25, 2022
0246fcc
Actualize base classes.
sterliakov Mar 25, 2022
9175688
Callable is not accepted by get_field.
sterliakov Mar 25, 2022
1044f2a
Add precise types.
sterliakov Mar 25, 2022
a2c2873
Use property and broader containers where possible. Add missing methods.
sterliakov Mar 25, 2022
e714320
Actualize indexes.
sterliakov Mar 25, 2022
06d5712
More specific types for signals.
sterliakov Mar 25, 2022
9122eb3
Fix signatures, drop missing methods.
sterliakov Mar 25, 2022
959d27e
Actualize window functions to match source.
sterliakov Mar 25, 2022
6300a15
Actualize text functions, add missing methods, use type aliases for c…
sterliakov Mar 25, 2022
e662c88
Add missing property decorators, methods and attributes. Use type ali…
sterliakov Mar 25, 2022
8223390
Use bound TypeVar, mark all BuiltinLookup descendants as generic expl…
sterliakov Mar 25, 2022
4afccd1
Apply type alias, fix base class and argument name.
sterliakov Mar 25, 2022
0cee260
Actualize BaseExpression methods.
sterliakov Mar 25, 2022
a05ec68
Fix imports.
sterliakov Mar 25, 2022
3e30f70
Add missing class and fix incompatible bases.
sterliakov Mar 25, 2022
fbf9d75
Use same types in __init__ and attribute.
sterliakov Mar 25, 2022
b0b2a1a
OrderBy accepts F or Expression.
sterliakov Mar 25, 2022
9bc4005
Non-expressions are converted to Values.
sterliakov Mar 25, 2022
380891d
Add missing attributes.
sterliakov Mar 25, 2022
1f558a1
Add missing methods, fix 'None' argument type.
sterliakov Mar 25, 2022
e736ace
Define properties where possible, remove 'None' argument annotations,…
sterliakov Mar 25, 2022
5ce7106
Remove absent QueryWrapper. Replace some Any with precise types.
sterliakov Mar 25, 2022
b8a84cf
Fix wrong types and actualize signatures. Deny ManagerDescriptor.__ge…
sterliakov Mar 25, 2022
183a260
Use more specific types.
sterliakov Mar 25, 2022
f4cbb4c
Arity can be None in subclasses.
sterliakov Mar 25, 2022
e3ffba6
Reformat with black
sterliakov Mar 26, 2022
1a89a41
Make DeletionMixin generic.
sterliakov Mar 26, 2022
eb3f228
Fix wrong type variable in _RequestFactory.
sterliakov Mar 28, 2022
4717d38
Fix variable name in signature.
sterliakov Apr 2, 2022
dc2bfe5
Disallow returning None from Form.clean()
sterliakov Apr 2, 2022
44ab0a6
Merge upstream. Discard #899 (see my comment for explanation)
sterliakov Apr 2, 2022
61539fa
Allow again returning None from Form.clean
sterliakov Apr 2, 2022
224a52b
Drop some unused imports.
sterliakov Apr 2, 2022
de0a07b
Add tests for MultiValueDict.
sterliakov Apr 2, 2022
01cbcb7
Add tests for utils.timezone.
sterliakov Apr 2, 2022
4c92fff
Fix #834.
sterliakov Apr 2, 2022
0aac534
Add more files to import_all test
sterliakov Apr 2, 2022
e7a7946
Allow None for `context_object_name`
sterliakov Apr 2, 2022
6c0dece
Fix CI
sterliakov Apr 3, 2022
5005b7b
Fix test to work on python 3.8
sterliakov Apr 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 4 additions & 3 deletions django-stubs/apps/config.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Dict, Iterator, Optional, Type
import types
from typing import Dict, Iterator, Optional, Type

from django.apps.registry import Apps
from django.db.models.base import Model
Expand All @@ -7,14 +8,14 @@ MODELS_MODULE_NAME: str

class AppConfig:
name: str = ...
module: Optional[Any] = ...
module: Optional[types.ModuleType] = ...
apps: Optional[Apps] = ...
label: str = ...
verbose_name: str = ...
path: str = ...
models_module: Optional[str] = ...
models: Dict[str, Type[Model]] = ...
def __init__(self, app_name: str, app_module: Optional[Any]) -> None: ...
def __init__(self, app_name: str, app_module: Optional[types.ModuleType]) -> None: ...
@classmethod
def create(cls, entry: str) -> AppConfig: ...
def get_model(self, model_name: str, require_ready: bool = ...) -> Type[Model]: ...
Expand Down
22 changes: 15 additions & 7 deletions django-stubs/conf/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
from typing import Any
from typing import Any, Optional

from django.utils.functional import LazyObject

# explicit dependency on standard settings to make it loaded
from . import global_settings

ENVIRONMENT_VARIABLE: str = ...
DEFAULT_CONTENT_TYPE_DEPRECATED_MSG: str = ...
FILE_CHARSET_DEPRECATED_MSG: str = ...
PASSWORD_RESET_TIMEOUT_DAYS_DEPRECATED_MSG: str = ...
DEFAULT_HASHING_ALGORITHM_DEPRECATED_MSG: str = ...

# required for plugin to be able to distinguish this specific instance of LazySettings from others
class _DjangoConfLazyObject(LazyObject):
def __getattr__(self, item: Any) -> Any: ...

class LazySettings(_DjangoConfLazyObject):
configured: bool
def configure(self, default_settings: Any = ..., **options: Any) -> Any: ...
@property
def configured(self) -> bool: ...
def configure(self, default_settings: Any = ..., **options: Any) -> None: ...

settings: LazySettings = ...

class Settings:
def __init__(self, settings_module: str): ...
def __init__(self, settings_module: str) -> None: ...
def is_overridden(self, setting: str) -> bool: ...

class UserSettingsHolder: ...
class UserSettingsHolder:
SETTINGS_MODULE: Optional[Any] = ...
def __init__(self, default_settings: Any) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def __setattr__(self, name: str, value: Any) -> None: ...
def __delattr__(self, name: str) -> None: ...
def is_overridden(self, setting: str) -> bool: ...

class SettingsReference(str):
def __new__(self, value: Any, setting_name: str) -> SettingsReference: ...
def __init__(self, value: str, setting_name: str) -> None: ...
88 changes: 42 additions & 46 deletions django-stubs/conf/global_settings.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,11 @@ USE_L10N: bool = ...
# notifications and other various emails.
MANAGERS = ADMINS

# Default content type and charset to use for all HttpResponse objects, if a
# Default charset to use for all HttpResponse objects, if a
# MIME type isn't manually specified. These are used to construct the
# Content-Type header.
DEFAULT_CONTENT_TYPE: str = ...
DEFAULT_CHARSET: str = ...

# Encoding of files read from disk (template and initial SQL files).
FILE_CHARSET: str = ...

# Email address that error messages come from.
SERVER_EMAIL: str = ...

Expand Down Expand Up @@ -136,7 +132,7 @@ APPEND_SLASH: bool = ...
PREPEND_WWW: bool = ...

# Override the server-derived value of SCRIPT_NAME
FORCE_SCRIPT_NAME = None
FORCE_SCRIPT_NAME: Optional[str] = ...

# List of compiled regular expression objects representing User-Agent strings
# that are not allowed to visit any page, systemwide. Use this for bad
Expand All @@ -148,7 +144,7 @@ FORCE_SCRIPT_NAME = None
# re.compile(r'^SiteSucker.*'),
# re.compile(r'^sohu-search'),
# ]
DISALLOWED_USER_AGENTS: List[Pattern] = ...
DISALLOWED_USER_AGENTS: List[Pattern[str]] = ...

ABSOLUTE_URL_OVERRIDES: Dict[str, Any] = ...

Expand All @@ -162,7 +158,7 @@ ABSOLUTE_URL_OVERRIDES: Dict[str, Any] = ...
# re.compile(r'^/phpmyadmin/'),
# re.compile(r'\.(cgi|php|pl)$'),
# ]
IGNORABLE_404_URLS: List[Pattern] = ...
IGNORABLE_404_URLS: List[Pattern[str]] = ...

# A secret key for this particular Django installation. Used in secret-key
# hashing algorithms. Set this in your settings, or Django will complain
Expand Down Expand Up @@ -210,12 +206,12 @@ FILE_UPLOAD_TEMP_DIR: Optional[str] = ...

# The numeric mode to set newly-uploaded files to. The value should be a mode
# you'd pass directly to os.chmod; see https://docs.python.org/library/os.html#files-and-directories.
FILE_UPLOAD_PERMISSIONS = None
FILE_UPLOAD_PERMISSIONS: int = ...

# The numeric mode to assign to newly-created directories, when uploading files.
# The value should be a mode as you'd pass to os.chmod;
# see https://docs.python.org/library/os.html#files-and-directories.
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
FILE_UPLOAD_DIRECTORY_PERMISSIONS: Optional[int] = ...

# Python module path where user will place custom format definition.
# The directory where this setting is pointing should contain subdirectories
Expand Down Expand Up @@ -330,43 +326,43 @@ MIDDLEWARE: List[str] = ...
############

# Cache to store session data if using the cache session backend.
SESSION_CACHE_ALIAS = "default"
SESSION_CACHE_ALIAS: str = ...
# Cookie name. This can be whatever you want.
SESSION_COOKIE_NAME = "sessionid"
SESSION_COOKIE_NAME: str = ...
# Age of cookie, in seconds (default: 2 weeks).
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2
SESSION_COOKIE_AGE: int = ...
# A string like "example.com", or None for standard domain cookie.
SESSION_COOKIE_DOMAIN: Optional[str] = ...
# Whether the session cookie should be secure (https:// only).
SESSION_COOKIE_SECURE = False
SESSION_COOKIE_SECURE: bool = ...
# The path of the session cookie.
SESSION_COOKIE_PATH = "/"
SESSION_COOKIE_PATH: str = ...
# Whether to use the non-RFC standard httpOnly flag (IE, FF3+, others)
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_HTTPONLY: bool = ...
# Whether to set the flag restricting cookie leaks on cross-site requests.
# This can be 'Lax', 'Strict', or None to disable the flag.
SESSION_COOKIE_SAMESITE: Optional[str] = ...
# Whether to save the session data on every request.
SESSION_SAVE_EVERY_REQUEST = False
SESSION_SAVE_EVERY_REQUEST: bool = ...
# Whether a user's session cookie expires when the Web browser is closed.
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SESSION_EXPIRE_AT_BROWSER_CLOSE: bool = ...
# The module to store session data
SESSION_ENGINE = "django.contrib.sessions.backends.db"
SESSION_ENGINE: str = ...
# Directory to store session files if using the file session module. If None,
# the backend will use a sensible default.
SESSION_FILE_PATH: Optional[str] = ...
# class to serialize session data
SESSION_SERIALIZER = "django.contrib.sessions.serializers.JSONSerializer"
SESSION_SERIALIZER: str = ...

#########
# CACHE #
#########

# The cache backends to use.
CACHES: Dict[str, Dict[str, Any]] = ...
CACHE_MIDDLEWARE_KEY_PREFIX = ""
CACHE_MIDDLEWARE_SECONDS = 600
CACHE_MIDDLEWARE_ALIAS = "default"
CACHE_MIDDLEWARE_KEY_PREFIX: str = ...
CACHE_MIDDLEWARE_SECONDS: int = ...
CACHE_MIDDLEWARE_ALIAS: str = ...

##################
# AUTHENTICATION #
Expand All @@ -376,14 +372,14 @@ AUTH_USER_MODEL: str = ...

AUTHENTICATION_BACKENDS: Sequence[str] = ...

LOGIN_URL = "/accounts/login/"
LOGIN_URL: str = ...

LOGIN_REDIRECT_URL: str = ...

LOGOUT_REDIRECT_URL: Optional[str] = ...

# The number of days a password reset link is valid for
PASSWORD_RESET_TIMEOUT_DAYS = 3
PASSWORD_RESET_TIMEOUT_DAYS: int = ...

# the first hasher in this list is the preferred algorithm. any
# password using different algorithms will be converted automatically
Expand All @@ -396,34 +392,34 @@ AUTH_PASSWORD_VALIDATORS: List[Dict[str, str]] = ...
# SIGNING #
###########

SIGNING_BACKEND = "django.core.signing.TimestampSigner"
SIGNING_BACKEND: str = ...

########
# CSRF #
########

# Dotted path to callable to be used as view when a request is
# rejected by the CSRF middleware.
CSRF_FAILURE_VIEW = "django.views.csrf.csrf_failure"
CSRF_FAILURE_VIEW: str = ...

# Settings for CSRF cookie.
CSRF_COOKIE_NAME = "csrftoken"
CSRF_COOKIE_AGE = 60 * 60 * 24 * 7 * 52
CSRF_COOKIE_DOMAIN = None
CSRF_COOKIE_PATH = "/"
CSRF_COOKIE_SECURE = False
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_NAME: str = ...
CSRF_COOKIE_AGE: int = ...
CSRF_COOKIE_DOMAIN: Optional[str] = ...
CSRF_COOKIE_PATH: str = ...
CSRF_COOKIE_SECURE: bool = ...
CSRF_COOKIE_HTTPONLY: bool = ...
CSRF_COOKIE_SAMESITE: Optional[str] = ...
CSRF_HEADER_NAME = "HTTP_X_CSRFTOKEN"
CSRF_HEADER_NAME: str = ...
CSRF_TRUSTED_ORIGINS: List[str] = ...
CSRF_USE_SESSIONS = False
CSRF_USE_SESSIONS: bool = ...

############
# MESSAGES #
############

# Class to use as messages backend
MESSAGE_STORAGE = "django.contrib.messages.storage.fallback.FallbackStorage"
MESSAGE_STORAGE: str = ...

# Default values of MESSAGE_LEVEL and MESSAGE_TAGS are defined within
# django.contrib.messages to avoid imports in this settings file.
Expand All @@ -433,21 +429,21 @@ MESSAGE_STORAGE = "django.contrib.messages.storage.fallback.FallbackStorage"
###########

# The callable to use to configure logging
LOGGING_CONFIG = "logging.config.dictConfig"
LOGGING_CONFIG: str = ...

# Custom logging configuration.
LOGGING: Dict[str, Any] = ...

# Default exception reporter filter class used in case none has been
# specifically assigned to the HttpRequest instance.
DEFAULT_EXCEPTION_REPORTER_FILTER = "django.views.debug.SafeExceptionReporterFilter"
DEFAULT_EXCEPTION_REPORTER_FILTER: str = ...

###########
# TESTING #
###########

# The name of the class to use to run the test suite
TEST_RUNNER = "django.test.runner.DiscoverRunner"
TEST_RUNNER: str = ...

# Apps that don't need to be serialized at test database creation time
# (only apps with migrations are to start with)
Expand Down Expand Up @@ -494,11 +490,11 @@ SILENCED_SYSTEM_CHECKS: List[str] = ...
#######################
# SECURITY MIDDLEWARE #
#######################
SECURE_BROWSER_XSS_FILTER = False
SECURE_CONTENT_TYPE_NOSNIFF = False
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
SECURE_HSTS_PRELOAD = False
SECURE_HSTS_SECONDS = 0
SECURE_BROWSER_XSS_FILTER: bool = ...
SECURE_CONTENT_TYPE_NOSNIFF: bool = ...
SECURE_HSTS_INCLUDE_SUBDOMAINS: bool = ...
SECURE_HSTS_PRELOAD: bool = ...
SECURE_HSTS_SECONDS: int = ...
SECURE_REDIRECT_EXEMPT: List[str] = ...
SECURE_SSL_HOST = None
SECURE_SSL_REDIRECT = False
SECURE_SSL_HOST: Optional[str] = ...
SECURE_SSL_REDIRECT: bool = ...
14 changes: 10 additions & 4 deletions django-stubs/conf/urls/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Union, overlo

from django.http.response import HttpResponse, HttpResponseBase
from django.urls import URLPattern, URLResolver
from django.urls import include as include

handler400: Union[str, Callable[..., HttpResponse]] = ...
handler403: Union[str, Callable[..., HttpResponse]] = ...
Expand All @@ -11,14 +12,19 @@ handler500: Union[str, Callable[..., HttpResponse]] = ...

IncludedURLConf = Tuple[Sequence[Union[URLResolver, URLPattern]], Optional[str], Optional[str]]

def include(arg: Any, namespace: str = ..., app_name: str = ...) -> IncludedURLConf: ...
# Deprecated
@overload
def url(
regex: str, view: Callable[..., HttpResponseBase], kwargs: Dict[str, Any] = ..., name: str = ...
regex: str, view: Callable[..., HttpResponseBase], kwargs: Optional[Dict[str, Any]] = ..., name: Optional[str] = ...
) -> URLPattern: ...
@overload
def url(regex: str, view: IncludedURLConf, kwargs: Dict[str, Any] = ..., name: str = ...) -> URLResolver: ...
def url(
regex: str, view: IncludedURLConf, kwargs: Optional[Dict[str, Any]] = ..., name: Optional[str] = ...
) -> URLResolver: ...
@overload
def url(
regex: str, view: Sequence[Union[URLResolver, str]], kwargs: Dict[str, Any] = ..., name: str = ...
regex: str,
view: Sequence[Union[URLResolver, str]],
kwargs: Optional[Dict[str, Any]] = ...,
name: Optional[str] = ...,
) -> URLResolver: ...
8 changes: 5 additions & 3 deletions django-stubs/conf/urls/i18n.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from typing import Any, Callable, List, Tuple
from typing import Callable, List, Tuple, Union

from django.urls.resolvers import URLPattern
from django.urls.resolvers import URLPattern, URLResolver

def i18n_patterns(*urls: Any, prefix_default_language: bool = ...) -> List[List[URLPattern]]: ...
def i18n_patterns(
*urls: Union[URLPattern, URLResolver], prefix_default_language: bool = ...
) -> List[Union[URLPattern, URLResolver]]: ...
def is_language_prefix_patterns_used(urlconf: str) -> Tuple[bool, bool]: ...

urlpatterns: List[Callable]
1 change: 0 additions & 1 deletion django-stubs/contrib/admin/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ from .filters import ListFilter as ListFilter
from .filters import RelatedFieldListFilter as RelatedFieldListFilter
from .filters import RelatedOnlyFieldListFilter as RelatedOnlyFieldListFilter
from .filters import SimpleListFilter as SimpleListFilter
from .helpers import ACTION_CHECKBOX_NAME as ACTION_CHECKBOX_NAME
from .options import HORIZONTAL as HORIZONTAL
from .options import VERTICAL as VERTICAL
from .options import ModelAdmin as ModelAdmin
Expand Down
4 changes: 2 additions & 2 deletions django-stubs/contrib/admin/actions.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Optional

from django.contrib.admin.options import ModelAdmin
from django.core.handlers.wsgi import WSGIRequest
from django.db.models.query import QuerySet
from django.http.request import HttpRequest
from django.template.response import TemplateResponse

def delete_selected(modeladmin: ModelAdmin, request: WSGIRequest, queryset: QuerySet) -> Optional[TemplateResponse]: ...
def delete_selected(modeladmin: ModelAdmin, request: HttpRequest, queryset: QuerySet) -> Optional[TemplateResponse]: ...
17 changes: 10 additions & 7 deletions django-stubs/contrib/admin/checks.pyi
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
from typing import Any, List, Optional, Sequence
from typing import Any, Optional, Sequence

from django.apps.config import AppConfig
from django.contrib.admin.options import BaseModelAdmin
from django.core.checks.messages import CheckMessage, Error

def check_admin_app(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Error]: ...
def check_dependencies(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Error]: ...
def check_admin_app(app_configs: Optional[Sequence[AppConfig]], **kwargs: Any) -> Sequence[CheckMessage]: ...
def check_dependencies(**kwargs: Any) -> Sequence[CheckMessage]: ...

class BaseModelAdminChecks:
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> List[CheckMessage]: ...
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> Sequence[CheckMessage]: ...

class ModelAdminChecks(BaseModelAdminChecks): ...
class InlineModelAdminChecks(BaseModelAdminChecks): ...
class ModelAdminChecks(BaseModelAdminChecks):
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> Sequence[CheckMessage]: ...

class InlineModelAdminChecks(BaseModelAdminChecks):
def check(self, inline_obj: BaseModelAdmin, **kwargs: Any) -> Sequence[CheckMessage]: ... # type: ignore

def must_be(type: Any, option: Any, obj: Any, id: Any): ...
def must_inherit_from(parent: Any, option: Any, obj: Any, id: Any): ...
def refer_to_missing_field(field: Any, option: Any, model: Any, obj: Any, id: Any): ...
def refer_to_missing_field(field: Any, option: Any, obj: Any, id: Any): ...
Loading