未验证 提交 150170d2 编写于 作者: O openharmony_ci 提交者: Gitee

!171 合并修改到3.2beta3

Merge pull request !171 from liguangjie/cherry-pick-1663725328
......@@ -382,7 +382,7 @@ class SyncService:
Return true if the connection opened, false if hdc refuse the
connection. This can happen device is invalid.
"""
LOG.debug("Open sync, timeout=%s" % int(timeout/1000))
LOG.debug("Open sync, timeout=%s" % int(timeout / 1000))
self.sock = HdcHelper.socket(host=self.host, port=self.port,
timeout=timeout)
HdcHelper.set_device(self.device, self.sock)
......@@ -813,7 +813,7 @@ class HdcHelper:
with HdcHelper.socket(host=device.host, port=device.port,
timeout=timeout) as sock:
output_flag = kwargs.get("output_flag", True)
timeout_msg = " with timeout %ss" % str(timeout/1000)
timeout_msg = " with timeout %ss" % str(timeout / 1000)
message = "%s execute command: hdc shell %s%s" % \
(convert_serial(device.device_sn), command,
timeout_msg)
......@@ -845,7 +845,7 @@ class HdcHelper:
return resp
except socket.timeout as _:
device.log.error("%s shell %s timeout[%sS]" % (
convert_serial(device.device_sn), command, str(timeout/1000)))
convert_serial(device.device_sn), command, str(timeout / 1000)))
raise ShellCommandUnresponsiveException()
finally:
if receiver:
......@@ -1005,7 +1005,7 @@ class HdcHelper:
if timeout is not None:
sock.setblocking(False)
sock.settimeout(timeout/1000)
sock.settimeout(timeout / 1000)
return sock
......
......@@ -196,7 +196,7 @@ class ManagerDevice(IDeviceManager):
else:
device_dict = dict(zip(
self.global_device_filter,
list(range(1, len(self.global_device_filter)+1))))
list(range(1, len(self.global_device_filter) + 1))))
for index in range(len(self.devices_list)):
if self.devices_list[index].device_sn not in \
self.global_device_filter:
......
......@@ -456,7 +456,7 @@ class Console(object):
split_list = list(history_command.split())
if "--repeat" in split_list:
pos = split_list.index("--repeat")
split_list = split_list[:pos] + split_list[pos+2:]
split_list = split_list[:pos] + split_list[pos + 2:]
history_command = " ".join(split_list)
argument = self.argument_parser(history_command.split())
......
......@@ -80,10 +80,10 @@ class DeviceStateMonitor(object):
def wait_for_boot_complete(self, wait_time):
counter = 1
start_time = int(time.time()*1000)
start_time = int(time.time() * 1000)
self.device.log.debug("wait for boot complete, and wait time: %s ms" %
wait_time)
while int(time.time()*1000) - start_time < wait_time:
while int(time.time() * 1000) - start_time < wait_time:
try:
result = self.device.get_recover_result(retry=0)
if self.device.check_recover_result(result):
......@@ -99,10 +99,10 @@ class DeviceStateMonitor(object):
def wait_for_device_available(self, wait_time=None):
if not wait_time:
wait_time = self.default_available_timeout
start_time = int(time.time()*1000)
start_time = int(time.time() * 1000)
if not self.wait_for_device_online(wait_time):
return False
elapsed_time = int(time.time()*1000) - start_time
elapsed_time = int(time.time() * 1000) - start_time
if not self.wait_for_boot_complete(wait_time - elapsed_time):
return False
return True
......
......@@ -401,8 +401,8 @@ class EncryptFileHandler(RotatingFileHandler):
stream = getattr(self, "stream", self._open())
stream.write(msg)
self.flush()
except RecursionError as _: # pylint:disable=undefined-variable
raise
except RecursionError as error: # pylint:disable=undefined-variable
raise error
def _encrypt_valid(self):
from _core.report.encrypt import check_pub_key_exist
......
......@@ -491,7 +491,7 @@ def convert_ip(origin_ip):
addr = origin_ip.strip().split(".")
if len(addr) == 4:
return "{}.{}.{}.{}".format(
addr[0], '*'*len(addr[1]), '*'*len(addr[2]), addr[-1])
addr[0], '*' * len(addr[1]), '*' * len(addr[2]), addr[-1])
else:
return origin_ip
......@@ -511,9 +511,9 @@ def convert_serial(serial):
return "remote_{}_{}".format(convert_ip(serial.split("_")[1]),
convert_port(serial.split("_")[-1]))
else:
length = len(serial)//3
length = len(serial) // 3
return "{}{}{}".format(
serial[0:length], "*"*(len(serial)-length*2), serial[-length:])
serial[0:length], "*" * (len(serial) - length * 2), serial[-length:])
def get_shell_handler(request, parser_type):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册