From e9cf8b9436bae014be16411b573177a0412179f1 Mon Sep 17 00:00:00 2001 From: Liangliang He Date: Wed, 11 Apr 2018 11:36:35 +0800 Subject: [PATCH] Fix python code style against pycodestyle 2.4.0 --- tools/sh_commands.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/sh_commands.py b/tools/sh_commands.py index 8c1bd423..2711412b 100644 --- a/tools/sh_commands.py +++ b/tools/sh_commands.py @@ -29,9 +29,13 @@ def adb_split_stdout(stdout_str): def adb_devices(target_socs=None): - outputs = sh.grep(sh.adb("devices"), "^[A-Za-z0-9]\+[[:space:]]\+device$") - raw_lists = sh.cut(outputs, "-f1") - device_ids = adb_split_stdout(raw_lists) + device_ids = [] + p = re.compile(r'(\w+)\s+device') + for line in adb_split_stdout(sh.adb("devices")): + m = p.match(line) + if m: + device_ids.append(m.group(1)) + if target_socs is not None: target_socs_set = set(target_socs) target_devices = [] @@ -48,7 +52,7 @@ def adb_getprop_by_serialno(serialno): outputs = sh.adb("-s", serialno, "shell", "getprop") raw_props = adb_split_stdout(outputs) props = {} - p = re.compile("\[(.+)\]: \[(.+)\]") + p = re.compile(r'\[(.+)\]: \[(.+)\]') for raw_prop in raw_props: m = p.match(raw_prop) if m: -- GitLab