forked from typeddjango/django-stubs
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Use PEP-585 standard generic collections #184
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,12 @@ Default Django settings. Override these with settings in the module pointed to | |
by the DJANGO_SETTINGS_MODULE environment variable. | ||
""" | ||
|
||
from collections.abc import Sequence | ||
from re import Pattern | ||
|
||
# This is defined here as a do-nothing function because we can't import | ||
# django.utils.translation -- that module depends on the settings. | ||
from typing import Any, Dict, List, Optional, Pattern, Protocol, Sequence, Tuple, Union | ||
from typing import Any, Optional, Protocol, Union | ||
|
||
#################### | ||
# CORE # | ||
|
@@ -19,16 +22,16 @@ DEBUG_PROPAGATE_EXCEPTIONS: bool = ... | |
|
||
# People who get code error notifications. | ||
# In the format [('Full Name', '[email protected]'), ('Full Name', '[email protected]')] | ||
ADMINS: List[Tuple[str, str]] = ... | ||
ADMINS: list[tuple[str, str]] = ... | ||
|
||
# List of IP addresses, as strings, that: | ||
# * See debug comments, when DEBUG is true | ||
# * Receive x-headers | ||
INTERNAL_IPS: List[str] = ... | ||
INTERNAL_IPS: list[str] = ... | ||
|
||
# Hosts/domain names that are valid for this site. | ||
# "*" matches anything, ".example.com" matches example.com and all subdomains | ||
ALLOWED_HOSTS: List[str] = ... | ||
ALLOWED_HOSTS: list[str] = ... | ||
|
||
# Local time zone for this installation. All choices can be found here: | ||
# https://en.wikipedia.org/wiki/List_of_tz_zones_by_name (although not all | ||
|
@@ -44,15 +47,15 @@ USE_TZ: bool = ... | |
LANGUAGE_CODE: str = ... | ||
|
||
# Languages we provide translations for, out of the box. | ||
LANGUAGES: List[Tuple[str, str]] = ... | ||
LANGUAGES: list[tuple[str, str]] = ... | ||
|
||
# Languages using BiDi (right-to-left) layout | ||
LANGUAGES_BIDI: List[str] = ... | ||
LANGUAGES_BIDI: list[str] = ... | ||
|
||
# If you set this to False, Django will make some optimizations so as not | ||
# to load the internationalization machinery. | ||
USE_I18N: bool = ... | ||
LOCALE_PATHS: List[str] = ... | ||
LOCALE_PATHS: list[str] = ... | ||
|
||
# Settings for language cookie | ||
LANGUAGE_COOKIE_NAME: str = ... | ||
|
@@ -81,13 +84,13 @@ FILE_CHARSET: str = ... | |
SERVER_EMAIL: str = ... | ||
|
||
# Database connection info. If left empty, will default to the dummy backend. | ||
DATABASES: Dict[str, Dict[str, Any]] = ... | ||
DATABASES: dict[str, dict[str, Any]] = ... | ||
|
||
# Classes used to implement DB routing behavior. | ||
class Router(Protocol): | ||
def allow_migrate(self, db: Any, app_label: Any, **hints: Any) -> Any: ... | ||
|
||
DATABASE_ROUTERS: List[Union[str, Router]] = ... | ||
DATABASE_ROUTERS: list[Union[str, Router]] = ... | ||
|
||
# The email backend to use. For possible shortcuts see django.core.mail. | ||
# The default is to use the SMTP backend. | ||
|
@@ -114,9 +117,9 @@ EMAIL_SSL_KEYFILE: Optional[str] = ... | |
EMAIL_TIMEOUT: Optional[int] = ... | ||
|
||
# List of strings representing installed apps. | ||
INSTALLED_APPS: List[str] = ... | ||
INSTALLED_APPS: list[str] = ... | ||
|
||
TEMPLATES: List[Dict[str, Any]] = ... | ||
TEMPLATES: list[dict[str, Any]] = ... | ||
|
||
# Default form rendering class. | ||
FORM_RENDERER: str = ... | ||
|
@@ -148,9 +151,9 @@ FORCE_SCRIPT_NAME = None | |
# re.compile(r'^SiteSucker.*'), | ||
# re.compile(r'^sohu-search'), | ||
# ] | ||
DISALLOWED_USER_AGENTS: List[Pattern[str]] = ... | ||
DISALLOWED_USER_AGENTS: list[Pattern[str]] = ... | ||
|
||
ABSOLUTE_URL_OVERRIDES: Dict[str, Any] = ... | ||
ABSOLUTE_URL_OVERRIDES: dict[str, Any] = ... | ||
|
||
# List of compiled regular expression objects representing URLs that need not | ||
# be reported by BrokenLinkEmailsMiddleware. Here are a few examples: | ||
|
@@ -162,7 +165,7 @@ ABSOLUTE_URL_OVERRIDES: Dict[str, Any] = ... | |
# re.compile(r'^/phpmyadmin/'), | ||
# re.compile(r'\.(cgi|php|pl)$'), | ||
# ] | ||
IGNORABLE_404_URLS: List[Pattern[str]] = ... | ||
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 | ||
|
@@ -189,7 +192,7 @@ STATIC_ROOT: Optional[str] = ... | |
STATIC_URL: Optional[str] = ... | ||
|
||
# List of upload handler classes to be applied in order. | ||
FILE_UPLOAD_HANDLERS: List[str] = ... | ||
FILE_UPLOAD_HANDLERS: list[str] = ... | ||
|
||
# Maximum size, in bytes, of a request before it will be streamed to the | ||
# file system instead of into memory. | ||
|
@@ -258,20 +261,20 @@ SHORT_DATETIME_FORMAT: str = ... | |
# See all available format string here: | ||
# https://docs.python.org/library/datetime.html#strftime-behavior | ||
# * Note that these format strings are different from the ones to display dates | ||
DATE_INPUT_FORMATS: List[str] = ... | ||
DATE_INPUT_FORMATS: list[str] = ... | ||
|
||
# Default formats to be used when parsing times from input boxes, in order | ||
# See all available format string here: | ||
# https://docs.python.org/library/datetime.html#strftime-behavior | ||
# * Note that these format strings are different from the ones to display dates | ||
TIME_INPUT_FORMATS: List[str] = ... # '14:30:59' # '14:30:59.000200' # '14:30' | ||
TIME_INPUT_FORMATS: list[str] = ... # '14:30:59' # '14:30:59.000200' # '14:30' | ||
|
||
# Default formats to be used when parsing dates and times from input boxes, | ||
# in order | ||
# See all available format string here: | ||
# https://docs.python.org/library/datetime.html#strftime-behavior | ||
# * Note that these format strings are different from the ones to display dates | ||
DATETIME_INPUT_FORMATS: List[str] = ... | ||
DATETIME_INPUT_FORMATS: list[str] = ... | ||
|
||
# First day of week, to be used on calendars | ||
# 0 means Sunday, 1 means Monday... | ||
|
@@ -314,7 +317,7 @@ WSGI_APPLICATION: Optional[str] = ... | |
# that header/value, request.is_secure() will return True. | ||
# WARNING! Only set this if you fully understand what you're doing. Otherwise, | ||
# you may be opening yourself up to a security risk. | ||
SECURE_PROXY_SSL_HEADER: Optional[Tuple[str, str]] = ... | ||
SECURE_PROXY_SSL_HEADER: Optional[tuple[str, str]] = ... | ||
|
||
############## | ||
# MIDDLEWARE # | ||
|
@@ -323,7 +326,7 @@ SECURE_PROXY_SSL_HEADER: Optional[Tuple[str, str]] = ... | |
# List of middleware to use. Order is important; in the request phase, these | ||
# middleware will be applied in the order given, and in the response | ||
# phase the middleware will be applied in reverse order. | ||
MIDDLEWARE: List[str] = ... | ||
MIDDLEWARE: list[str] = ... | ||
|
||
############ | ||
# SESSIONS # | ||
|
@@ -363,7 +366,7 @@ SESSION_SERIALIZER = "django.contrib.sessions.serializers.JSONSerializer" | |
######### | ||
|
||
# The cache backends to use. | ||
CACHES: Dict[str, Dict[str, Any]] = ... | ||
CACHES: dict[str, dict[str, Any]] = ... | ||
CACHE_MIDDLEWARE_KEY_PREFIX = "" | ||
CACHE_MIDDLEWARE_SECONDS = 600 | ||
CACHE_MIDDLEWARE_ALIAS = "default" | ||
|
@@ -388,9 +391,9 @@ PASSWORD_RESET_TIMEOUT_DAYS = 3 | |
# the first hasher in this list is the preferred algorithm. any | ||
# password using different algorithms will be converted automatically | ||
# upon login | ||
PASSWORD_HASHERS: List[str] = ... | ||
PASSWORD_HASHERS: list[str] = ... | ||
|
||
AUTH_PASSWORD_VALIDATORS: List[Dict[str, str]] = ... | ||
AUTH_PASSWORD_VALIDATORS: list[dict[str, str]] = ... | ||
|
||
########### | ||
# SIGNING # | ||
|
@@ -415,7 +418,7 @@ CSRF_COOKIE_SECURE = False | |
CSRF_COOKIE_HTTPONLY = False | ||
CSRF_COOKIE_SAMESITE: Optional[str] = ... | ||
CSRF_HEADER_NAME = "HTTP_X_CSRFTOKEN" | ||
CSRF_TRUSTED_ORIGINS: List[str] = ... | ||
CSRF_TRUSTED_ORIGINS: list[str] = ... | ||
CSRF_USE_SESSIONS = False | ||
|
||
############ | ||
|
@@ -436,7 +439,7 @@ MESSAGE_STORAGE = "django.contrib.messages.storage.fallback.FallbackStorage" | |
LOGGING_CONFIG = "logging.config.dictConfig" | ||
|
||
# Custom logging configuration. | ||
LOGGING: Dict[str, Any] = ... | ||
LOGGING: dict[str, Any] = ... | ||
|
||
# Default exception reporter filter class used in case none has been | ||
# specifically assigned to the HttpRequest instance. | ||
|
@@ -451,35 +454,35 @@ TEST_RUNNER = "django.test.runner.DiscoverRunner" | |
|
||
# Apps that don't need to be serialized at test database creation time | ||
# (only apps with migrations are to start with) | ||
TEST_NON_SERIALIZED_APPS: List[str] = ... | ||
TEST_NON_SERIALIZED_APPS: list[str] = ... | ||
|
||
############ | ||
# FIXTURES # | ||
############ | ||
|
||
# The list of directories to search for fixtures | ||
FIXTURE_DIRS: List[str] = ... | ||
FIXTURE_DIRS: list[str] = ... | ||
|
||
############### | ||
# STATICFILES # | ||
############### | ||
|
||
# A list of locations of additional static files | ||
STATICFILES_DIRS: List[str] = ... | ||
STATICFILES_DIRS: list[str] = ... | ||
|
||
# The default file storage backend used during the build process | ||
STATICFILES_STORAGE: str = ... | ||
|
||
# List of finder classes that know how to find static files in | ||
# various locations. | ||
STATICFILES_FINDERS: List[str] = ... | ||
STATICFILES_FINDERS: list[str] = ... | ||
|
||
############## | ||
# MIGRATIONS # | ||
############## | ||
|
||
# Migration module overrides for apps, by app label. | ||
MIGRATION_MODULES: Dict[str, str] = ... | ||
MIGRATION_MODULES: dict[str, str] = ... | ||
|
||
################# | ||
# SYSTEM CHECKS # | ||
|
@@ -489,7 +492,7 @@ MIGRATION_MODULES: Dict[str, str] = ... | |
# issues like warnings, infos or debugs will not generate a message. Silencing | ||
# serious issues like errors and criticals does not result in hiding the | ||
# message, but Django will not stop you from e.g. running server. | ||
SILENCED_SYSTEM_CHECKS: List[str] = ... | ||
SILENCED_SYSTEM_CHECKS: list[str] = ... | ||
|
||
####################### | ||
# SECURITY MIDDLEWARE # | ||
|
@@ -499,6 +502,6 @@ SECURE_CONTENT_TYPE_NOSNIFF = False | |
SECURE_HSTS_INCLUDE_SUBDOMAINS = False | ||
SECURE_HSTS_PRELOAD = False | ||
SECURE_HSTS_SECONDS = 0 | ||
SECURE_REDIRECT_EXEMPT: List[str] = ... | ||
SECURE_REDIRECT_EXEMPT: list[str] = ... | ||
SECURE_SSL_HOST = None | ||
SECURE_SSL_REDIRECT = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from typing import Any, Dict | ||
from typing import Any | ||
|
||
LANG_INFO: Dict[str, Any] = ... | ||
LANG_INFO: dict[str, Any] = ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
from typing import Any, Callable, List, Tuple | ||
from collections.abc import Callable | ||
from typing import Any | ||
|
||
from django.urls.resolvers import URLPattern | ||
|
||
def i18n_patterns( | ||
*urls: Any, prefix_default_language: bool = ... | ||
) -> List[List[URLPattern]]: ... | ||
def is_language_prefix_patterns_used(urlconf: str) -> Tuple[bool, bool]: ... | ||
) -> list[list[URLPattern]]: ... | ||
def is_language_prefix_patterns_used(urlconf: str) -> tuple[bool, bool]: ... | ||
|
||
urlpatterns: List[Callable[..., Any]] | ||
urlpatterns: list[Callable[..., Any]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
from typing import Any, Callable, List | ||
from collections.abc import Callable | ||
from typing import Any | ||
|
||
from django.urls.resolvers import URLPattern | ||
|
||
def static( | ||
prefix: str, view: Callable[..., Any] = ..., **kwargs: Any | ||
) -> List[URLPattern]: ... | ||
) -> list[URLPattern]: ... |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surprised it didn't update Optional[str] to str | None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this will be updated in the next PR I prepared to use PEP-604 (
A | B
andA | None
) syntax. The changes are huge I had to split them to multiple PRs.