Remove some unnecessary uses of regular expressions (#101182)

This commit is contained in:
Ville Skyttä 2023-10-04 04:55:00 +03:00 committed by GitHub
parent 09ba34fb3a
commit 5551a345ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 16 deletions

View file

@ -3,7 +3,6 @@ from __future__ import annotations
import functools
import logging
import re
import voluptuous as vol
@ -178,9 +177,7 @@ class MqttAlarm(MqttEntity, alarm.AlarmControlPanelEntity):
if (code := self._config.get(CONF_CODE)) is None:
self._attr_code_format = None
elif code == REMOTE_CODE or (
isinstance(code, str) and re.search("^\\d+$", code)
):
elif code == REMOTE_CODE or (isinstance(code, str) and code.isdigit()):
self._attr_code_format = alarm.CodeFormat.NUMBER
else:
self._attr_code_format = alarm.CodeFormat.TEXT