mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +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__)
|
||||
|
||||
_DDWRT_DATA_REGEX = re.compile(r'\{(\w+)::([^\}]*)\}')
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
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????.
|
||||
This code is a python version of how they are parsing in the JS """
|
||||
return {
|
||||
key: val for key, val in re.compile(r'\{(\w+)::([^\}]*)\}')
|
||||
key: val for key, val in _DDWRT_DATA_REGEX
|
||||
.findall(data_str)}
|
||||
|
Loading…
x
Reference in New Issue
Block a user