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

Update typing #2582

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
https://docs.djangoproject.com/en/4.2/ref/settings/
"""

from typing import Dict, List, Tuple, Union

from django.utils.translation import gettext_lazy as _

from server.settings.components import BASE_DIR, config
Expand All @@ -21,7 +19,7 @@

# Application definition:

INSTALLED_APPS: Tuple[str, ...] = (
INSTALLED_APPS: tuple[str, ...] = (
# Your apps go here:
'server.apps.main',

Expand All @@ -48,7 +46,7 @@
'health_check.storage',
)

MIDDLEWARE: Tuple[str, ...] = (
MIDDLEWARE: tuple[str, ...] = (
# Logging:
'server.settings.components.logging.LoggingContextVarsMiddleware',

Expand Down Expand Up @@ -194,7 +192,7 @@
REFERRER_POLICY = 'same-origin'

# https://github.com/adamchainz/django-permissions-policy#setting
PERMISSIONS_POLICY: Dict[str, Union[str, List[str]]] = {} # noqa: WPS234
PERMISSIONS_POLICY: dict[str, str | list[str]] = {} # noqa: WPS234


# Timeouts
Expand Down
14 changes: 6 additions & 8 deletions {{cookiecutter.project_name}}/server/settings/components/csp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
Docs: https://github.com/mozilla/django-csp
"""

from typing import Tuple

# These values might and will be redefined in `development.py` env:
CSP_SCRIPT_SRC: Tuple[str, ...] = ("'self'",)
CSP_IMG_SRC: Tuple[str, ...] = ("'self'",)
CSP_FONT_SRC: Tuple[str, ...] = ("'self'",)
CSP_STYLE_SRC: Tuple[str, ...] = ("'self'",)
CSP_DEFAULT_SRC: Tuple[str, ...] = ("'none'",)
CSP_CONNECT_SRC: Tuple[str, ...] = ()
CSP_SCRIPT_SRC: tuple[str, ...] = ("'self'",)
CSP_IMG_SRC: tuple[str, ...] = ("'self'",)
CSP_FONT_SRC: tuple[str, ...] = ("'self'",)
CSP_STYLE_SRC: tuple[str, ...] = ("'self'",)
CSP_DEFAULT_SRC: tuple[str, ...] = ("'none'",)
CSP_CONNECT_SRC: tuple[str, ...] = ()
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# 'Do not log' by Nikita Sobolev (@sobolevn)
# https://sobolevn.me/2020/03/do-not-log

from typing import TYPE_CHECKING, Callable, final
from collections.abc import Callable
from typing import TYPE_CHECKING, final

import structlog

Expand Down