Bug 1310937 - Autophone - mozdevice - sync Bug 1300890 - Autophone - pylint fixes and logging clean up, r=jmaher.

This commit is contained in:
Bob Clary 2016-10-19 06:06:55 -07:00
Родитель b585826937
Коммит 05fec78423
3 изменённых файлов: 12 добавлений и 15 удалений

Просмотреть файл

@ -683,8 +683,7 @@ class ADBDevice(ADBCommand):
# Do we need to run adb root to get a root shell?
try:
if (not self._have_root_shell and
self.command_output(
if (not self._have_root_shell and self.command_output(
["root"],
timeout=timeout).find("cannot run as root") == -1):
self._have_root_shell = True
@ -700,7 +699,7 @@ class ADBDevice(ADBCommand):
quoted_cmd = []
for arg in cmd:
arg.replace('&', '\&')
arg.replace('&', r'\&')
needs_quoting = False
for char in [' ', '(', ')', '"', '&']:
@ -1579,7 +1578,6 @@ class ADBDevice(ADBCommand):
except ADBError:
self._logger.error('Ignoring exception in ADBDevice.list_files\n%s' %
traceback.format_exc())
pass
data[:] = [item for item in data if item]
self._logger.debug('list_files: %s' % data)
return data
@ -2186,7 +2184,7 @@ class ADBDevice(ADBCommand):
directives = ['battery', 'disk', 'id', 'os', 'process', 'systime',
'uptime']
if (directive in directives):
if directive in directives:
directives = [directive]
info = {}
@ -2208,7 +2206,7 @@ class ADBDevice(ADBCommand):
if 'uptime' in directives:
uptime = self.shell_output('uptime', timeout=timeout)
if uptime:
m = re.match('up time: ((\d+) days, )*(\d{2}):(\d{2}):(\d{2})',
m = re.match(r'up time: ((\d+) days, )*(\d{2}):(\d{2}):(\d{2})',
uptime)
if m:
uptime = '%d days %d hours %d minutes %d seconds' % tuple(

Просмотреть файл

@ -198,8 +198,7 @@ class ADBAndroid(ADBDevice):
failure = "Device state: %s" % state
success = False
else:
if (self.selinux and
self.shell_output('getenforce',
if (self.selinux and self.shell_output('getenforce',
timeout=timeout) != 'Permissive'):
self._logger.info('Setting SELinux Permissive Mode')
self.shell_output("setenforce Permissive", timeout=timeout, root=True)
@ -341,9 +340,9 @@ class ADBAndroid(ADBDevice):
if extras:
for (key, val) in extras.iteritems():
if type(val) is int:
if isinstance(val, int):
extra_type_param = "--ei"
elif type(val) is bool:
elif isinstance(val, bool):
extra_type_param = "--ez"
else:
extra_type_param = "--es"
@ -398,8 +397,8 @@ class ADBAndroid(ADBDevice):
if extra_args:
extras['args'] = " ".join(extra_args)
self.launch_application(app_name, "org.mozilla.gecko.BrowserApp", intent, url=url,
extras=extras,
self.launch_application(app_name, "org.mozilla.gecko.BrowserApp",
intent, url=url, extras=extras,
wait=wait, fail_if_running=fail_if_running,
timeout=timeout)

Просмотреть файл

@ -100,7 +100,7 @@ class ADBB2G(ADBDevice):
timeout=timeout)
directives = ['memtotal']
if (directive in directives):
if directive in directives:
directives = [directive]
if 'memtotal' in directives: