From 9073e7ee15114f84dcd346d3b425c79fb38e2f34 Mon Sep 17 00:00:00 2001 From: RogerSelwyn Date: Sat, 30 Nov 2024 15:50:40 +0000 Subject: [PATCH] maint: Remove redundant code --- custom_components/ms365_mail/config_flow.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/custom_components/ms365_mail/config_flow.py b/custom_components/ms365_mail/config_flow.py index 2fa0c50..bd7aea2 100644 --- a/custom_components/ms365_mail/config_flow.py +++ b/custom_components/ms365_mail/config_flow.py @@ -310,25 +310,15 @@ async def async_step_import(self, import_data: dict[str, Any]) -> ConfigFlowResu if self._check_existing(): return self.async_abort(reason="already_configured") await async_integration_imports(self.hass, import_data) - result = self.async_create_entry( + return self.async_create_entry( title=self._entity_name, data=data, options=options ) - self._disable_new() - return result def _check_existing(self): config_entries = self.hass.config_entries.async_entries(DOMAIN) - for config_entry in config_entries: - if config_entry.title == self._entity_name: - return True - return False - - def _disable_new(self): - config_entries = self.hass.config_entries.async_entries(DOMAIN) - for config_entry in config_entries: - if config_entry.title == self._entity_name: - config_entry.disabled_by = "migration" - return + return any( + config_entry.title == self._entity_name for config_entry in config_entries + ) def get_callback_url(hass, alt_config):