From 242c143c85041c6f7253165c670e073ff6383ebf Mon Sep 17 00:00:00 2001 From: jamespcole Date: Sun, 29 Mar 2015 11:30:04 +1100 Subject: [PATCH] refactored ddwrt data format parsong code --- homeassistant/components/device_tracker/ddwrt.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/device_tracker/ddwrt.py b/homeassistant/components/device_tracker/ddwrt.py index 3d6af407ded..1dd0eb6a436 100644 --- a/homeassistant/components/device_tracker/ddwrt.py +++ b/homeassistant/components/device_tracker/ddwrt.py @@ -154,9 +154,6 @@ class DdWrtDeviceScanner(object): 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 """ - data = {} - pattern = re.compile(r'\{(\w+)::([^\}]*)\}') - for (key, val) in re.findall(pattern, data_str): - data[key] = val - - return data + return { + key: val for key, val in re.compile(r'\{(\w+)::([^\}]*)\}') + .findall(data_str)}