Skip to content

Commit

Permalink
maint: Remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed Nov 30, 2024
1 parent ef6c7ae commit 9073e7e
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions custom_components/ms365_mail/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 9073e7e

Please sign in to comment.