Remove some unnecessary uses of regular expressions (#101182)
This commit is contained in:
parent
09ba34fb3a
commit
5551a345ea
6 changed files with 6 additions and 16 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue