From 44a0db07c4241b7c169768fc995a47eed1c8cd70 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 20:04:23 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.1 → v0.1.13](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.1...v0.1.13) - [github.com/psf/black: 23.10.0 → 23.12.1](https://github.com/psf/black/compare/23.10.0...23.12.1) - [github.com/pre-commit/mirrors-prettier: v3.0.3 → v4.0.0-alpha.8](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.3...v4.0.0-alpha.8) - [github.com/pre-commit/mirrors-mypy: v1.6.1 → v1.8.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.6.1...v1.8.0) - [github.com/adrienverge/yamllint.git: v1.32.0 → v1.33.0](https://github.com/adrienverge/yamllint.git/compare/v1.32.0...v1.33.0) --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ebae345..71afda1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,12 +3,12 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.1 + rev: v0.1.13 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/psf/black - rev: 23.10.0 + rev: 23.12.1 hooks: - id: black args: @@ -24,17 +24,17 @@ repos: - --quiet-level=2 exclude_types: [csv, json] - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.3 + rev: v4.0.0-alpha.8 hooks: - id: prettier - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.6.1 + rev: v1.8.0 hooks: - id: mypy additional_dependencies: [types-all] args: [--config-file=pyproject.toml] - repo: https://github.com/adrienverge/yamllint.git - rev: v1.32.0 + rev: v1.33.0 hooks: - id: yamllint exclude: (.vscode|.devcontainer|.github) From 620ab1657a6d06d81b229e4722c15d6c51e6fd0a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 20:04:40 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../alarmdotcom/alarm_control_panel.py | 6 +- custom_components/alarmdotcom/base_device.py | 14 +-- custom_components/alarmdotcom/config_flow.py | 114 ++++++++---------- custom_components/alarmdotcom/manifest.json | 5 +- 4 files changed, 64 insertions(+), 75 deletions(-) diff --git a/custom_components/alarmdotcom/alarm_control_panel.py b/custom_components/alarmdotcom/alarm_control_panel.py index 86bee18..9eba9b5 100644 --- a/custom_components/alarmdotcom/alarm_control_panel.py +++ b/custom_components/alarmdotcom/alarm_control_panel.py @@ -124,7 +124,11 @@ def state(self) -> str | None: match self._device.desired_state: case libPartition.DeviceState.DISARMED: return str(STATE_ALARM_DISARMING) - case libPartition.DeviceState.ARMED_STAY | libPartition.DeviceState.ARMED_AWAY | libPartition.DeviceState.ARMED_NIGHT: + case ( + libPartition.DeviceState.ARMED_STAY + | libPartition.DeviceState.ARMED_AWAY + | libPartition.DeviceState.ARMED_NIGHT + ): return str(STATE_ALARM_ARMING) LOGGER.error( diff --git a/custom_components/alarmdotcom/base_device.py b/custom_components/alarmdotcom/base_device.py index ce96ab0..2f956c5 100644 --- a/custom_components/alarmdotcom/base_device.py +++ b/custom_components/alarmdotcom/base_device.py @@ -51,14 +51,12 @@ def __init__( self._attr_extra_state_attributes: MutableMapping[str, Any] = {} - self._attr_device_info = DeviceInfo( - { - "manufacturer": "Alarm.com", - "name": device.name, - "identifiers": {(DOMAIN, self._adc_id)}, - "via_device": (DOMAIN, self._device.partition_id), - } - ) + self._attr_device_info = DeviceInfo({ + "manufacturer": "Alarm.com", + "name": device.name, + "identifiers": {(DOMAIN, self._adc_id)}, + "via_device": (DOMAIN, self._device.partition_id), + }) @property def device_type_name(self) -> str: diff --git a/custom_components/alarmdotcom/config_flow.py b/custom_components/alarmdotcom/config_flow.py index 718b9b8..2d13b44 100644 --- a/custom_components/alarmdotcom/config_flow.py +++ b/custom_components/alarmdotcom/config_flow.py @@ -133,16 +133,14 @@ async def async_step_user(self, user_input: dict[str, Any] | None = None) -> Flo else: return await self.async_step_final() - creds_schema = vol.Schema( - { - vol.Required(CONF_USERNAME): TextSelector( - TextSelectorConfig(type=TextSelectorType.TEXT, autocomplete="username") - ), - vol.Required(CONF_PASSWORD): TextSelector( - TextSelectorConfig(type=TextSelectorType.PASSWORD, autocomplete="current-password") - ), - } - ) + creds_schema = vol.Schema({ + vol.Required(CONF_USERNAME): TextSelector( + TextSelectorConfig(type=TextSelectorType.TEXT, autocomplete="username") + ), + vol.Required(CONF_PASSWORD): TextSelector( + TextSelectorConfig(type=TextSelectorType.PASSWORD, autocomplete="current-password") + ), + }) return self.async_show_form(step_id="user", data_schema=creds_schema, errors=errors, last_step=False) @@ -176,17 +174,15 @@ async def async_step_otp_select_method(self, user_input: dict[str, Any] | None = ) errors["base"] = "cannot_connect" - otp_method_schema = vol.Schema( - { - vol.Required(CONF_OTP_METHOD, default=self._enabled_otp_methods[0].name): SelectSelector( - SelectSelectorConfig( - options=[otp_type.name for otp_type in self._enabled_otp_methods], - mode=SelectSelectorMode.DROPDOWN, - translation_key=CONF_OTP_METHODS_LIST, - ) - ), - } - ) + otp_method_schema = vol.Schema({ + vol.Required(CONF_OTP_METHOD, default=self._enabled_otp_methods[0].name): SelectSelector( + SelectSelectorConfig( + options=[otp_type.name for otp_type in self._enabled_otp_methods], + mode=SelectSelectorMode.DROPDOWN, + translation_key=CONF_OTP_METHODS_LIST, + ) + ), + }) return self.async_show_form( step_id="otp_select_method", data_schema=otp_method_schema, errors=errors, last_step=False @@ -229,13 +225,11 @@ async def async_step_otp_submit(self, user_input: dict[str, Any] | None = None) else: return await self.async_step_final() - creds_schema = vol.Schema( - { - vol.Required(CONF_OTP): TextSelector( - TextSelectorConfig(type=TextSelectorType.TEXT, autocomplete="one-time-code") - ), - } - ) + creds_schema = vol.Schema({ + vol.Required(CONF_OTP): TextSelector( + TextSelectorConfig(type=TextSelectorType.TEXT, autocomplete="one-time-code") + ), + }) return self.async_show_form(step_id="otp_submit", data_schema=creds_schema, errors=errors, last_step=True) @@ -296,25 +290,23 @@ async def async_step_init(self, user_input: dict[str, Any] | None = None) -> Flo self.options.update(user_input) return await self.async_step_modes() - schema = vol.Schema( - { - vol.Optional( - CONF_ARM_CODE, - default=("" if not (arm_code_raw := self.options.get(CONF_ARM_CODE)) else arm_code_raw), - ): selector.selector({"text": {"type": "password"}}), - vol.Required( - CONF_UPDATE_INTERVAL, - default=self.options.get(CONF_UPDATE_INTERVAL, CONF_DEFAULT_UPDATE_INTERVAL_SECONDS), - ): selector.selector( - { - "number": { - "mode": "box", - CONF_UNIT_OF_MEASUREMENT: "seconds", - } + schema = vol.Schema({ + vol.Optional( + CONF_ARM_CODE, + default=("" if not (arm_code_raw := self.options.get(CONF_ARM_CODE)) else arm_code_raw), + ): selector.selector({"text": {"type": "password"}}), + vol.Required( + CONF_UPDATE_INTERVAL, + default=self.options.get(CONF_UPDATE_INTERVAL, CONF_DEFAULT_UPDATE_INTERVAL_SECONDS), + ): selector.selector( + { + "number": { + "mode": "box", + CONF_UNIT_OF_MEASUREMENT: "seconds", } - ), - } - ) + } + ), + }) return self.async_show_form( step_id="init", @@ -331,22 +323,20 @@ async def async_step_modes(self, user_input: dict[str, Any] | None = None) -> Fl self.options.update(user_input) return self.async_create_entry(title="", data=self.options) - schema = vol.Schema( - { - vol.Required( - CONF_ARM_HOME, - default=self.options.get(CONF_ARM_HOME, CONF_OPTIONS_DEFAULT[CONF_ARM_HOME]), - ): cv.multi_select(CONF_ARM_MODE_OPTIONS), - vol.Required( - CONF_ARM_AWAY, - default=self.options.get(CONF_ARM_AWAY, CONF_OPTIONS_DEFAULT[CONF_ARM_AWAY]), - ): cv.multi_select(CONF_ARM_MODE_OPTIONS), - vol.Required( - CONF_ARM_NIGHT, - default=self.options.get(CONF_ARM_NIGHT, CONF_OPTIONS_DEFAULT[CONF_ARM_NIGHT]), - ): cv.multi_select(CONF_ARM_MODE_OPTIONS), - } - ) + schema = vol.Schema({ + vol.Required( + CONF_ARM_HOME, + default=self.options.get(CONF_ARM_HOME, CONF_OPTIONS_DEFAULT[CONF_ARM_HOME]), + ): cv.multi_select(CONF_ARM_MODE_OPTIONS), + vol.Required( + CONF_ARM_AWAY, + default=self.options.get(CONF_ARM_AWAY, CONF_OPTIONS_DEFAULT[CONF_ARM_AWAY]), + ): cv.multi_select(CONF_ARM_MODE_OPTIONS), + vol.Required( + CONF_ARM_NIGHT, + default=self.options.get(CONF_ARM_NIGHT, CONF_OPTIONS_DEFAULT[CONF_ARM_NIGHT]), + ): cv.multi_select(CONF_ARM_MODE_OPTIONS), + }) return self.async_show_form( step_id="modes", diff --git a/custom_components/alarmdotcom/manifest.json b/custom_components/alarmdotcom/manifest.json index 4b6fedb..5981c88 100644 --- a/custom_components/alarmdotcom/manifest.json +++ b/custom_components/alarmdotcom/manifest.json @@ -8,9 +8,6 @@ "integration_type": "hub", "iot_class": "cloud_polling", "issue_tracker": "https://github.com/pyalarmdotcom/alarmdotcom/issues", - "requirements": [ - "beautifulsoup4>=4.10.0", - "pyalarmdotcomajax==0.5.10" - ], + "requirements": ["beautifulsoup4>=4.10.0", "pyalarmdotcomajax==0.5.10"], "version": "3.0.10" }