#Hello ๐Ÿ™‚ I would like to add a PR to

1 messages ยท Page 1 of 1 (latest)

gusty badger
#

You could also do

@callback
def async_abort_entries_match(
    self, match_dict: dict[str, 
Any] | None = None
) -> None:
    ...
coral fossil
#

You mean like adding

@callback
def async_abort_entries_match(
    other_entries: list[ConfigEntry], match_dict: dict[str, Any] | None = None
) -> None:
    _async_abort_entries_match(other_entries, match_dict)

to the config_entries.py?

gusty badger
#
@callback
def async_abort_entries_match(
    self, match_dict: dict[str, Any] | None = None
) -> None:
    ...

@callback
def _async_abort_entries_match(
    self, match_dict: dict[str, Any] | None = None
) -> None:
coral fossil
#

Ah, but I think this syntax only works when having functions with the same name, but different parameters and/or return type

#

There are two possible ways to achieve this:

  1. Keep the old name but add the new name as a assignment (or rename the function and add the old name as an assignment)
    @callback
    def _async_abort_entries_match(
        self, match_dict: dict[str, Any] | None = None
    ) -> None:
        # original function body

    async_abort_entries_match = _async_abort_entries_match
#
  1. Add a function which calls the other function
    @callback
    def _async_abort_entries_match(
        self, match_dict: dict[str, Any] | None = None
    ) -> None:
        # original function body

    @callback
    def async_abort_entries_match(
        self, match_dict: dict[str, Any] | None = None
    ) -> None:
        self._async_abort_entries_match(match_dict)
gusty badger
#

I tend to say, choose your prefred one and create a PR for it ๐Ÿ™‚

errant rover
#

Why not just disable the complaint and keep it as is?

coral fossil
void oasis
#

Why would we even add this in the first place?

#

as in, you write: "But I would like to discuss it a bit before opening a PR."

#

but not context, motivation or reasoning to even consider anything like this has been given

coral fossil
void oasis
#

So, there is currently a discussion to forbid the use of update on abort in user flows

#

I see this is just for aborting it

#

but seems odd to do that in user input validation tbh

#

as that is no longer about validating user input

#

Looking at the linked config flow

#

I wonder why it is using the SchemaConfigFlow at all?

lapis radish
#

One thing that I found interesting in the webmin config flow is that everything is stored in the options and not in the data dict

void oasis
#

Oh good point

#

that needs to be fixed

coral fossil
#

Is options the wrong dict?

void oasis
#

It is a result of using this schema helper... this helper is meant to be used by helpers

#

not integrations

#

for helpers, the options are used, to provide the UI from the entity config panel (they basically have no connection/auth information)

coral fossil
#

Ah, good to know

void oasis
coral fossil
#

Okay, then I will fix it

coral fossil
#

Ah, the SchemaConfigFlow fills the options dict with the user input and sets the data dict to {}, that's why I used the options dict

coral fossil
void oasis
#

The schema flow was created for managing things like groups

coral fossil
#

Mhm, I see