mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Moved compiled regex to a constant for efficiency
This commit is contained in:
parent
242c143c85
commit
fda44cdbf7
@ -15,6 +15,7 @@ MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5)
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
_DDWRT_DATA_REGEX = re.compile(r'\{(\w+)::([^\}]*)\}')
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
def get_scanner(hass, config):
|
def get_scanner(hass, config):
|
||||||
@ -155,5 +156,5 @@ def _parse_ddwrt_response(data_str):
|
|||||||
""" Parse the awful DD-WRT data format, why didn't they use JSON????.
|
""" Parse the awful DD-WRT data format, why didn't they use JSON????.
|
||||||
This code is a python version of how they are parsing in the JS """
|
This code is a python version of how they are parsing in the JS """
|
||||||
return {
|
return {
|
||||||
key: val for key, val in re.compile(r'\{(\w+)::([^\}]*)\}')
|
key: val for key, val in _DDWRT_DATA_REGEX
|
||||||
.findall(data_str)}
|
.findall(data_str)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user