Skip to content

Commit f69e063

Browse files
authored
Large update (#909)
* Make module declaration precise. * Make settings match real file. * Replace `include` with import. * Make types more specific. * Replace `WSGIRequest` with `HttpRequest` where possible. * Replace all `OrderedDict` occurrences with plain `Dict` (it is not used in Django 3.2 and later) * Add fake datastructures for convenience: _PropertyDescriptor and _ListOrTuple now can live here. Added _IndexableCollection (often useful as alias for 'sequence or queryset') * Actualize other datastructures. * Rework MultiValueDict to reflect the fact that some methods can return empty list instead of value. * Deprecate SafeText in favor of SafeString. * Minor improvements to utils * Disallow using str in TimeFormat and DateFormat, drop removed fmt `B` * Do not let classproperty expect classmethod, make return value covariant. * Sync with real file. * Improve types for timezone. * Sync deprecated, new and removed features in translation utils. * Drop removed files, sync huge deprecations. * Fix incompatible decorators (properties, contextmanagers) * Rework pagination. * Sync validators with real code. Add _ValidatorCallable for any external use (field validation etc.) * Add shared type definitions (for fields of both forms and models). Actualize model fields. Mark keyword-only args explicitly in stubs (where code uses **kwargs). Disallow bytes for verbose_name. * Make all checks return Sequence[CheckMessage] or subclass to be covariant. * Add bidirectional references between backend.base and other files. Replace some Any's with specific types. * Actualize db.migrations: remove removed methods, replace "None" annotations in wrong places, improve some wrong annotations. * Actualize db.utils to match real file. * Replace FileResponse and TemplateResponse with HttpResponse(Base) where needed: at least HttpResponseNotModified/HttpResponseRedirect can be returned instead of it, so annotation was wrong. * Replace Any in forms where possible. Actualize class bases and method arguments. * Improve typing of serializers. * Actualize views, rename variable bound to Model to _M for consistency. * Make types of file-related code consistent. Disallow using bytes as path, because many methods expect str-only paths. Make File inherit from IO[AnyStr] instead of IO[Any]: it makes impossible to instantiate file of union type, but allows precise types for some methods. * Minor improvements: stop using None as annotation in wrong places, replace obvious Any's with precise types, actualize methods (missing/renamed/signature changed). * Allow less specific containers, replace Any's with specific types. * Improve types for requests and responses. * Use AbstractBaseUser instead of User in auth. * Use broader type for permission_required * Use wider container types. Add 'type: ignore' to avoid issues with mypy.stubtest. * Disallow using backend class as argument (it is passed to import_string). * Add required methods to PasseordValidator. * Allow using Path instance as argument. * Actualize methods. * Add 'type: ignore' to avoid issues with mypy.stubtest. * Replace Any's with specific types and BaseForm with ModelForm. * Actualize contrib.postgres * Remove render_to_response, add 'get_absolute_url' to corresponding protocol. * Actualize signers. * Use precise types for handlers. Disallow str as stream type for LimitedStream. * Exact types for ValidationError * Replace wrong used Union with Sequence. * Actualize static handlers. * More specific types for admin. Fixes #874. * Improve types and replace 'Tags' with str (it isn't Enum, so annotation was wrong). * Replace Any with specific types, actualize signatures. * Add async variants of handlers and clients. Use fake class to distinguish between request types in RequestFactory and AsyncRequestFactory. * Fix signature, minor improvements. * Actualize signatures and class names, replace Any with more specific types. * Fix signature. * Add some missing methods to Collector * Combinable rarely returns Self type: almost always it's CombinedExpression. * No Random in source anymore. * Drop removed SimpleCol. * Replace _OutputField with Field: nothing in docs about strings. * Introduce reusable types, add missing methods. Remove strange types (probably created by stubgen). Remove RawQuery from Compiler: it obviously doesn't work with RawQuery. * Use literal constants. * Actualize base classes. * Callable is not accepted by get_field. * Add precise types. * Use property and broader containers where possible. Add missing methods. * Actualize indexes. * More specific types for signals. * Fix signatures, drop missing methods. * Actualize window functions to match source. * Actualize text functions, add missing methods, use type aliases for consistency. * Add missing property decorators, methods and attributes. Use type aliases. Remove absent YearComparisonLookup and any SafeText references (they aren't related to lookups at all). * Use bound TypeVar, mark all BuiltinLookup descendants as generic explicitly. Remove strange Union from Lookup.__init__ * Apply type alias, fix base class and argument name. * Actualize BaseExpression methods. * Fix imports. * Add missing class and fix incompatible bases. * Use same types in __init__ and attribute. * OrderBy accepts F or Expression. * Non-expressions are converted to Values. * Add missing attributes. * Add missing methods, fix 'None' argument type. * Define properties where possible, remove 'None' argument annotations, remove inadequate type in make_immutable_fields_list. * Remove absent QueryWrapper. Replace some Any with precise types. * Fix wrong types and actualize signatures. Deny ManagerDescriptor.__get__ on model instances. * Use more specific types. * Arity can be None in subclasses. * Reformat with black * Make DeletionMixin generic. * Fix wrong type variable in _RequestFactory. * Fix variable name in signature. * Disallow returning None from Form.clean() * Allow again returning None from Form.clean * Drop some unused imports. * Add tests for MultiValueDict. * Add tests for utils.timezone. * Fix #834. * Add more files to import_all test * Allow None for `context_object_name` * Fix CI * Fix test to work on python 3.8
1 parent dc4c0d9 commit f69e063

File tree

322 files changed

+5736
-3461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+5736
-3461
lines changed

django-stubs/apps/config.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Dict, Iterator, Optional, Type
1+
import types
2+
from typing import Dict, Iterator, Optional, Type
23

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

89
class AppConfig:
910
name: str = ...
10-
module: Optional[Any] = ...
11+
module: Optional[types.ModuleType] = ...
1112
apps: Optional[Apps] = ...
1213
label: str = ...
1314
verbose_name: str = ...
1415
path: str = ...
1516
models_module: Optional[str] = ...
1617
models: Dict[str, Type[Model]] = ...
17-
def __init__(self, app_name: str, app_module: Optional[Any]) -> None: ...
18+
def __init__(self, app_name: str, app_module: Optional[types.ModuleType]) -> None: ...
1819
@classmethod
1920
def create(cls, entry: str) -> AppConfig: ...
2021
def get_model(self, model_name: str, require_ready: bool = ...) -> Type[Model]: ...

django-stubs/conf/__init__.pyi

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,37 @@
1-
from typing import Any
1+
from typing import Any, Optional
22

33
from django.utils.functional import LazyObject
44

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

88
ENVIRONMENT_VARIABLE: str = ...
9-
DEFAULT_CONTENT_TYPE_DEPRECATED_MSG: str = ...
10-
FILE_CHARSET_DEPRECATED_MSG: str = ...
9+
PASSWORD_RESET_TIMEOUT_DAYS_DEPRECATED_MSG: str = ...
10+
DEFAULT_HASHING_ALGORITHM_DEPRECATED_MSG: str = ...
1111

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

1616
class LazySettings(_DjangoConfLazyObject):
17-
configured: bool
18-
def configure(self, default_settings: Any = ..., **options: Any) -> Any: ...
17+
@property
18+
def configured(self) -> bool: ...
19+
def configure(self, default_settings: Any = ..., **options: Any) -> None: ...
1920

2021
settings: LazySettings = ...
2122

2223
class Settings:
23-
def __init__(self, settings_module: str): ...
24+
def __init__(self, settings_module: str) -> None: ...
2425
def is_overridden(self, setting: str) -> bool: ...
2526

26-
class UserSettingsHolder: ...
27+
class UserSettingsHolder:
28+
SETTINGS_MODULE: Optional[Any] = ...
29+
def __init__(self, default_settings: Any) -> None: ...
30+
def __getattr__(self, name: str) -> Any: ...
31+
def __setattr__(self, name: str, value: Any) -> None: ...
32+
def __delattr__(self, name: str) -> None: ...
33+
def is_overridden(self, setting: str) -> bool: ...
2734

2835
class SettingsReference(str):
36+
def __new__(self, value: Any, setting_name: str) -> SettingsReference: ...
2937
def __init__(self, value: str, setting_name: str) -> None: ...

django-stubs/conf/global_settings.pyi

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,11 @@ USE_L10N: bool = ...
6868
# notifications and other various emails.
6969
MANAGERS = ADMINS
7070

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

77-
# Encoding of files read from disk (template and initial SQL files).
78-
FILE_CHARSET: str = ...
79-
8076
# Email address that error messages come from.
8177
SERVER_EMAIL: str = ...
8278

@@ -136,7 +132,7 @@ APPEND_SLASH: bool = ...
136132
PREPEND_WWW: bool = ...
137133

138134
# Override the server-derived value of SCRIPT_NAME
139-
FORCE_SCRIPT_NAME = None
135+
FORCE_SCRIPT_NAME: Optional[str] = ...
140136

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

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

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

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

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

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

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

332328
# Cache to store session data if using the cache session backend.
333-
SESSION_CACHE_ALIAS = "default"
329+
SESSION_CACHE_ALIAS: str = ...
334330
# Cookie name. This can be whatever you want.
335-
SESSION_COOKIE_NAME = "sessionid"
331+
SESSION_COOKIE_NAME: str = ...
336332
# Age of cookie, in seconds (default: 2 weeks).
337-
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2
333+
SESSION_COOKIE_AGE: int = ...
338334
# A string like "example.com", or None for standard domain cookie.
339335
SESSION_COOKIE_DOMAIN: Optional[str] = ...
340336
# Whether the session cookie should be secure (https:// only).
341-
SESSION_COOKIE_SECURE = False
337+
SESSION_COOKIE_SECURE: bool = ...
342338
# The path of the session cookie.
343-
SESSION_COOKIE_PATH = "/"
339+
SESSION_COOKIE_PATH: str = ...
344340
# Whether to use the non-RFC standard httpOnly flag (IE, FF3+, others)
345-
SESSION_COOKIE_HTTPONLY = True
341+
SESSION_COOKIE_HTTPONLY: bool = ...
346342
# Whether to set the flag restricting cookie leaks on cross-site requests.
347343
# This can be 'Lax', 'Strict', or None to disable the flag.
348344
SESSION_COOKIE_SAMESITE: Optional[str] = ...
349345
# Whether to save the session data on every request.
350-
SESSION_SAVE_EVERY_REQUEST = False
346+
SESSION_SAVE_EVERY_REQUEST: bool = ...
351347
# Whether a user's session cookie expires when the Web browser is closed.
352-
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
348+
SESSION_EXPIRE_AT_BROWSER_CLOSE: bool = ...
353349
# The module to store session data
354-
SESSION_ENGINE = "django.contrib.sessions.backends.db"
350+
SESSION_ENGINE: str = ...
355351
# Directory to store session files if using the file session module. If None,
356352
# the backend will use a sensible default.
357353
SESSION_FILE_PATH: Optional[str] = ...
358354
# class to serialize session data
359-
SESSION_SERIALIZER = "django.contrib.sessions.serializers.JSONSerializer"
355+
SESSION_SERIALIZER: str = ...
360356

361357
#########
362358
# CACHE #
363359
#########
364360

365361
# The cache backends to use.
366362
CACHES: Dict[str, Dict[str, Any]] = ...
367-
CACHE_MIDDLEWARE_KEY_PREFIX = ""
368-
CACHE_MIDDLEWARE_SECONDS = 600
369-
CACHE_MIDDLEWARE_ALIAS = "default"
363+
CACHE_MIDDLEWARE_KEY_PREFIX: str = ...
364+
CACHE_MIDDLEWARE_SECONDS: int = ...
365+
CACHE_MIDDLEWARE_ALIAS: str = ...
370366

371367
##################
372368
# AUTHENTICATION #
@@ -376,14 +372,14 @@ AUTH_USER_MODEL: str = ...
376372

377373
AUTHENTICATION_BACKENDS: Sequence[str] = ...
378374

379-
LOGIN_URL = "/accounts/login/"
375+
LOGIN_URL: str = ...
380376

381377
LOGIN_REDIRECT_URL: str = ...
382378

383379
LOGOUT_REDIRECT_URL: Optional[str] = ...
384380

385381
# The number of days a password reset link is valid for
386-
PASSWORD_RESET_TIMEOUT_DAYS = 3
382+
PASSWORD_RESET_TIMEOUT_DAYS: int = ...
387383

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

399-
SIGNING_BACKEND = "django.core.signing.TimestampSigner"
395+
SIGNING_BACKEND: str = ...
400396

401397
########
402398
# CSRF #
403399
########
404400

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

409405
# Settings for CSRF cookie.
410-
CSRF_COOKIE_NAME = "csrftoken"
411-
CSRF_COOKIE_AGE = 60 * 60 * 24 * 7 * 52
412-
CSRF_COOKIE_DOMAIN = None
413-
CSRF_COOKIE_PATH = "/"
414-
CSRF_COOKIE_SECURE = False
415-
CSRF_COOKIE_HTTPONLY = False
406+
CSRF_COOKIE_NAME: str = ...
407+
CSRF_COOKIE_AGE: int = ...
408+
CSRF_COOKIE_DOMAIN: Optional[str] = ...
409+
CSRF_COOKIE_PATH: str = ...
410+
CSRF_COOKIE_SECURE: bool = ...
411+
CSRF_COOKIE_HTTPONLY: bool = ...
416412
CSRF_COOKIE_SAMESITE: Optional[str] = ...
417-
CSRF_HEADER_NAME = "HTTP_X_CSRFTOKEN"
413+
CSRF_HEADER_NAME: str = ...
418414
CSRF_TRUSTED_ORIGINS: List[str] = ...
419-
CSRF_USE_SESSIONS = False
415+
CSRF_USE_SESSIONS: bool = ...
420416

421417
############
422418
# MESSAGES #
423419
############
424420

425421
# Class to use as messages backend
426-
MESSAGE_STORAGE = "django.contrib.messages.storage.fallback.FallbackStorage"
422+
MESSAGE_STORAGE: str = ...
427423

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

435431
# The callable to use to configure logging
436-
LOGGING_CONFIG = "logging.config.dictConfig"
432+
LOGGING_CONFIG: str = ...
437433

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

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

445441
###########
446442
# TESTING #
447443
###########
448444

449445
# The name of the class to use to run the test suite
450-
TEST_RUNNER = "django.test.runner.DiscoverRunner"
446+
TEST_RUNNER: str = ...
451447

452448
# Apps that don't need to be serialized at test database creation time
453449
# (only apps with migrations are to start with)
@@ -494,11 +490,11 @@ SILENCED_SYSTEM_CHECKS: List[str] = ...
494490
#######################
495491
# SECURITY MIDDLEWARE #
496492
#######################
497-
SECURE_BROWSER_XSS_FILTER = False
498-
SECURE_CONTENT_TYPE_NOSNIFF = False
499-
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
500-
SECURE_HSTS_PRELOAD = False
501-
SECURE_HSTS_SECONDS = 0
493+
SECURE_BROWSER_XSS_FILTER: bool = ...
494+
SECURE_CONTENT_TYPE_NOSNIFF: bool = ...
495+
SECURE_HSTS_INCLUDE_SUBDOMAINS: bool = ...
496+
SECURE_HSTS_PRELOAD: bool = ...
497+
SECURE_HSTS_SECONDS: int = ...
502498
SECURE_REDIRECT_EXEMPT: List[str] = ...
503-
SECURE_SSL_HOST = None
504-
SECURE_SSL_REDIRECT = False
499+
SECURE_SSL_HOST: Optional[str] = ...
500+
SECURE_SSL_REDIRECT: bool = ...

django-stubs/conf/urls/__init__.pyi

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Union, overlo
33

44
from django.http.response import HttpResponse, HttpResponseBase
55
from django.urls import URLPattern, URLResolver
6+
from django.urls import include as include
67

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

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

14-
def include(arg: Any, namespace: str = ..., app_name: str = ...) -> IncludedURLConf: ...
15+
# Deprecated
1516
@overload
1617
def url(
17-
regex: str, view: Callable[..., HttpResponseBase], kwargs: Dict[str, Any] = ..., name: str = ...
18+
regex: str, view: Callable[..., HttpResponseBase], kwargs: Optional[Dict[str, Any]] = ..., name: Optional[str] = ...
1819
) -> URLPattern: ...
1920
@overload
20-
def url(regex: str, view: IncludedURLConf, kwargs: Dict[str, Any] = ..., name: str = ...) -> URLResolver: ...
21+
def url(
22+
regex: str, view: IncludedURLConf, kwargs: Optional[Dict[str, Any]] = ..., name: Optional[str] = ...
23+
) -> URLResolver: ...
2124
@overload
2225
def url(
23-
regex: str, view: Sequence[Union[URLResolver, str]], kwargs: Dict[str, Any] = ..., name: str = ...
26+
regex: str,
27+
view: Sequence[Union[URLResolver, str]],
28+
kwargs: Optional[Dict[str, Any]] = ...,
29+
name: Optional[str] = ...,
2430
) -> URLResolver: ...

django-stubs/conf/urls/i18n.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
from typing import Any, Callable, List, Tuple
1+
from typing import Callable, List, Tuple, Union
22

3-
from django.urls.resolvers import URLPattern
3+
from django.urls.resolvers import URLPattern, URLResolver
44

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

810
urlpatterns: List[Callable]

django-stubs/contrib/admin/__init__.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ from .filters import ListFilter as ListFilter
1212
from .filters import RelatedFieldListFilter as RelatedFieldListFilter
1313
from .filters import RelatedOnlyFieldListFilter as RelatedOnlyFieldListFilter
1414
from .filters import SimpleListFilter as SimpleListFilter
15-
from .helpers import ACTION_CHECKBOX_NAME as ACTION_CHECKBOX_NAME
1615
from .options import HORIZONTAL as HORIZONTAL
1716
from .options import VERTICAL as VERTICAL
1817
from .options import ModelAdmin as ModelAdmin
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from typing import Optional
22

33
from django.contrib.admin.options import ModelAdmin
4-
from django.core.handlers.wsgi import WSGIRequest
54
from django.db.models.query import QuerySet
5+
from django.http.request import HttpRequest
66
from django.template.response import TemplateResponse
77

8-
def delete_selected(modeladmin: ModelAdmin, request: WSGIRequest, queryset: QuerySet) -> Optional[TemplateResponse]: ...
8+
def delete_selected(modeladmin: ModelAdmin, request: HttpRequest, queryset: QuerySet) -> Optional[TemplateResponse]: ...

django-stubs/contrib/admin/checks.pyi

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
from typing import Any, List, Optional, Sequence
1+
from typing import Any, Optional, Sequence
22

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

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

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

13-
class ModelAdminChecks(BaseModelAdminChecks): ...
14-
class InlineModelAdminChecks(BaseModelAdminChecks): ...
13+
class ModelAdminChecks(BaseModelAdminChecks):
14+
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> Sequence[CheckMessage]: ...
15+
16+
class InlineModelAdminChecks(BaseModelAdminChecks):
17+
def check(self, inline_obj: BaseModelAdmin, **kwargs: Any) -> Sequence[CheckMessage]: ... # type: ignore
1518

1619
def must_be(type: Any, option: Any, obj: Any, id: Any): ...
1720
def must_inherit_from(parent: Any, option: Any, obj: Any, id: Any): ...
18-
def refer_to_missing_field(field: Any, option: Any, model: Any, obj: Any, id: Any): ...
21+
def refer_to_missing_field(field: Any, option: Any, obj: Any, id: Any): ...

0 commit comments

Comments
 (0)