From 393c5dedd30ded6c7a865474593e07c456406005 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Wed, 22 May 2024 12:12:50 +0200 Subject: [PATCH 1/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20`typing-exten?= =?UTF-8?q?sions`=20to=20`4.11.0`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements/base.txt | 2 +- requirements/ci.txt | 2 +- requirements/dev.txt | 2 +- requirements/extensions.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 84da0fb711..87c1e213c6 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -500,7 +500,7 @@ tinycss2==1.1.0 # weasyprint tornado==6.3.3 # via flower -typing-extensions==4.9.0 +typing-extensions==4.11.0 # via # -r requirements/base.in # asgiref diff --git a/requirements/ci.txt b/requirements/ci.txt index 8e206ed8ce..acf62a2263 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -1010,7 +1010,7 @@ tornado==6.3.3 # -c requirements/base.txt # -r requirements/base.txt # flower -typing-extensions==4.9.0 +typing-extensions==4.11.0 # via # -c requirements/base.txt # -r requirements/base.txt diff --git a/requirements/dev.txt b/requirements/dev.txt index 6cb1099e33..8c96d69bdb 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1178,7 +1178,7 @@ tornado==6.3.3 # -c requirements/ci.txt # -r requirements/ci.txt # flower -typing-extensions==4.9.0 +typing-extensions==4.11.0 # via # -c requirements/ci.txt # -r requirements/ci.txt diff --git a/requirements/extensions.txt b/requirements/extensions.txt index 0081093026..be2798ca7f 100644 --- a/requirements/extensions.txt +++ b/requirements/extensions.txt @@ -787,7 +787,7 @@ tornado==6.3.3 # via # -r requirements/base.txt # flower -typing-extensions==4.9.0 +typing-extensions==4.11.0 # via # -c requirements/base.in # -r requirements/base.txt From 1bac703c14976e38baba1d194acd413db81bb40d Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Wed, 22 May 2024 12:13:28 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20Use=20`TypeIs`=20wh?= =?UTF-8?q?ere=20possible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/openforms/config/checks.py | 6 ++++-- src/openforms/formio/utils.py | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/openforms/config/checks.py b/src/openforms/config/checks.py index dfd4bc8d35..f5b58c4b4f 100644 --- a/src/openforms/config/checks.py +++ b/src/openforms/config/checks.py @@ -1,8 +1,10 @@ -from typing import Any, Generator, Protocol, TypeGuard +from typing import Any, Generator, Protocol from django.utils.encoding import force_str from django.utils.translation import gettext as _ +from typing_extensions import TypeIs + from openforms.appointments.registry import register as appointments_register from openforms.contrib.brk.checks import BRKValidatorCheck from openforms.contrib.kadaster.config_check import BAGCheck, LocatieServerCheck @@ -30,7 +32,7 @@ def _subset_match(requested: str | None, checking: str) -> bool: return requested == checking -def is_plugin(plugin: Any) -> TypeGuard[AbstractBasePlugin]: +def is_plugin(plugin: Any) -> TypeIs[AbstractBasePlugin]: if hasattr(plugin, "identifier"): return True return False diff --git a/src/openforms/formio/utils.py b/src/openforms/formio/utils.py index c97d318604..3b5c5612e5 100644 --- a/src/openforms/formio/utils.py +++ b/src/openforms/formio/utils.py @@ -1,9 +1,10 @@ import logging from dataclasses import dataclass -from typing import Any, Callable, Iterator, TypeAlias, TypeGuard +from typing import Any, Callable, Iterator, TypeAlias import elasticapm from glom import Coalesce, Path, glom +from typing_extensions import TypeIs from openforms.typing import DataMapping, JSONObject, JSONValue from openforms.utils.glom import _glom_path_to_str @@ -21,7 +22,7 @@ ) -def _is_column_component(component: ComponentLike) -> TypeGuard[ColumnsComponent]: +def _is_column_component(component: ComponentLike) -> TypeIs[ColumnsComponent]: return component.get("type") == "columns" From 3ea1b293fcb1bd15fe1fcd0e4e52d095a40f4de9 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Wed, 22 May 2024 12:21:05 +0200 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20Quick=20typing=20fi?= =?UTF-8?q?xes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/openforms/config/checks.py | 14 +++++++++----- src/openforms/formio/utils.py | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/openforms/config/checks.py b/src/openforms/config/checks.py index f5b58c4b4f..a57df62d29 100644 --- a/src/openforms/config/checks.py +++ b/src/openforms/config/checks.py @@ -21,9 +21,11 @@ class ConfigCheckable(Protocol): verbose_name: str - def check_config(self) -> None: ... + @staticmethod + def check_config() -> None: ... - def get_config_actions(self) -> list[Action]: ... + @staticmethod + def get_config_actions() -> list[Action]: ... def _subset_match(requested: str | None, checking: str) -> bool: @@ -39,7 +41,7 @@ def is_plugin(plugin: Any) -> TypeIs[AbstractBasePlugin]: class ConfigurationCheck: - def __init__(self, requested_plugin: AbstractBasePlugin = None) -> None: + def __init__(self, requested_plugin: str = "") -> None: self.requested_plugin = requested_plugin def get_configuration_results( @@ -101,7 +103,9 @@ def get_register_entries(self, register) -> Generator[Entry, None, None]: else: yield self.get_plugin_entry(plugin) - def get_plugin_entry(self, plugin: AbstractBasePlugin | ConfigCheckable) -> Entry: + def get_plugin_entry( + self, plugin: AbstractBasePlugin | type[ConfigCheckable] + ) -> Entry: # undocumented query string support - helps for developers ;) status, error = True, "" if is_plugin(plugin) and not _subset_match( @@ -121,7 +125,7 @@ def get_plugin_entry(self, plugin: AbstractBasePlugin | ConfigCheckable) -> Entr try: actions = plugin.get_config_actions() except Exception as e: - actions = [ + actions: list[Action] = [ ( _("Internal error: {exception}").format(exception=e), "", diff --git a/src/openforms/formio/utils.py b/src/openforms/formio/utils.py index 3b5c5612e5..b444480e35 100644 --- a/src/openforms/formio/utils.py +++ b/src/openforms/formio/utils.py @@ -156,7 +156,7 @@ def get_readable_path_from_configuration_path( return " > ".join(keys_path) -def is_layout_component(component): +def is_layout_component(component: Component) -> bool: # Adapted from isLayoutComponent util function in Formio # https://github.com/formio/formio.js/blob/4.13.x/src/utils/formUtils.js#L25 column = component.get("columns") From 55f40b8f2fc41cb00986c2769280b0226fc26ea4 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Wed, 22 May 2024 12:23:36 +0200 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=8C=90=20makemessages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../conf/locale/nl/LC_MESSAGES/django.po | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/openforms/conf/locale/nl/LC_MESSAGES/django.po b/src/openforms/conf/locale/nl/LC_MESSAGES/django.po index 38c5e2e40a..934a6b03dc 100644 --- a/src/openforms/conf/locale/nl/LC_MESSAGES/django.po +++ b/src/openforms/conf/locale/nl/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Open Forms\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-22 10:57+0200\n" +"POT-Creation-Date: 2024-05-22 12:22+0200\n" "PO-Revision-Date: 2024-05-17 15:22+0200\n" "Last-Translator: Sergei Maertens \n" "Language-Team: Dutch \n" @@ -2187,36 +2187,36 @@ msgstr "Lijst van beschikbare stijlen" msgid "Retrieve theme details" msgstr "Stijldetails weergeven" -#: openforms/config/checks.py:52 +#: openforms/config/checks.py:54 msgid "Address lookup plugins" msgstr "Adresopzoekplugins" -#: openforms/config/checks.py:65 +#: openforms/config/checks.py:67 msgid "Validator plugins" msgstr "Validatieplugins" -#: openforms/config/checks.py:76 +#: openforms/config/checks.py:78 msgid "Appointment plugins" msgstr "Afspraakplugins" -#: openforms/config/checks.py:77 +#: openforms/config/checks.py:79 msgid "Registration plugins" msgstr "Registratieplugins" -#: openforms/config/checks.py:78 +#: openforms/config/checks.py:80 #: openforms/emails/templates/emails/admin_digest.html:46 msgid "Prefill plugins" msgstr "Prefillplugins" -#: openforms/config/checks.py:79 +#: openforms/config/checks.py:81 msgid "Payment plugins" msgstr "Betaalproviderplugins" -#: openforms/config/checks.py:80 +#: openforms/config/checks.py:82 msgid "DMN plugins" msgstr "DMN plugins" -#: openforms/config/checks.py:124 +#: openforms/config/checks.py:126 #, python-brace-format msgid "Internal error: {exception}" msgstr "Interne fout: {exception}" @@ -8303,8 +8303,8 @@ msgid "" "The co-sign component requires the '{field_label}' ({config_verbose_name}) " "to be configured." msgstr "" -"Het mede-ondertekencomponent vereist de configuratie van '{field_label}' " -"({config_verbose_name})." +"Het mede-ondertekencomponent vereist de configuratie van " +"'{field_label}' ({config_verbose_name})." #: openforms/products/api/viewsets.py:15 msgid "Retrieve details of a single product"