Correct to pep8 style with yapf linter.
Bug=28751508
Change-Id: Ic7435726030b6d9a40ba5e4dc37302f34d86e67d
diff --git a/utils/python/controllers/adb.py b/utils/python/controllers/adb.py
index c6a0e96..9e8859a 100644
--- a/utils/python/controllers/adb.py
+++ b/utils/python/controllers/adb.py
@@ -21,12 +21,16 @@
import subprocess
import time
+
class AdbError(Exception):
"""Raised when there is an error in adb operations."""
-SL4A_LAUNCH_CMD=("am start -a com.googlecode.android_scripting.action.LAUNCH_SERVER "
+
+SL4A_LAUNCH_CMD = (
+ "am start -a com.googlecode.android_scripting.action.LAUNCH_SERVER "
"--ei com.googlecode.android_scripting.extra.USE_SERVICE_PORT {} "
- "com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher" )
+ "com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher")
+
def get_available_host_port():
"""Gets a host port number available for adb forward.
@@ -40,6 +44,7 @@
if is_port_available(port):
return port
+
def is_port_available(port):
"""Checks if a given port number is available on the system.
@@ -65,6 +70,7 @@
if s:
s.close()
+
def list_occupied_adb_ports():
"""Lists all the host ports occupied by adb forward.
@@ -86,6 +92,7 @@
used_ports.append(int(tokens[1]))
return used_ports
+
class AdbProxy():
"""Proxy class for ADB.
@@ -95,6 +102,7 @@
>> adb.start_server()
>> adb.devices() # will return the console output of "adb devices".
"""
+
def __init__(self, serial="", log=None):
self.serial = serial
if serial:
@@ -156,7 +164,7 @@
if self.is_sl4a_running():
return
raise AdbError(
- "com.googlecode.android_scripting process never started.")
+ "com.googlecode.android_scripting process never started.")
def is_sl4a_running(self):
"""Checks if the sl4a app is running on an android device.
@@ -166,8 +174,8 @@
"""
#Grep for process with a preceding S which means it is truly started.
out = self.shell('ps | grep "S com.googlecode.android_scripting"')
- if len(out)==0:
- return False
+ if len(out) == 0:
+ return False
return True
def __getattr__(self, name):
@@ -175,4 +183,5 @@
clean_name = name.replace('_', '-')
arg_str = ' '.join(str(elem) for elem in args)
return self._exec_adb_cmd(clean_name, arg_str)
+
return adb_call