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-extensions to 4.11.0 #4316

Merged
merged 4 commits into from
May 22, 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
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/extensions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions src/openforms/conf/locale/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sergei+local@maykinmedia.nl>\n"
"Language-Team: Dutch <support@maykinmedia.nl>\n"
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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"
Expand Down
20 changes: 13 additions & 7 deletions src/openforms/config/checks.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -19,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:
Expand All @@ -30,14 +34,14 @@
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


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(
Expand Down Expand Up @@ -99,7 +103,9 @@
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(
Expand All @@ -119,7 +125,7 @@
try:
actions = plugin.get_config_actions()
except Exception as e:
actions = [
actions: list[Action] = [

Check warning on line 128 in src/openforms/config/checks.py

View check run for this annotation

Codecov / codecov/patch

src/openforms/config/checks.py#L128

Added line #L128 was not covered by tests
(
_("Internal error: {exception}").format(exception=e),
"",
Expand Down
7 changes: 4 additions & 3 deletions src/openforms/formio/utils.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"


Expand Down Expand Up @@ -155,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")
Expand Down
Loading