Reland "[Autotest] Python3 files/server/* migration"
Fixed the division errors
This is a reland of b05fb5a3dd205d085395c3e2f7d05127cabd07ec
TEST=network_WiFi_ChannelHop && network_WiFi_SimpleConnect.wifi_check24HT20
Original change's description:
> [Autotest] Python3 files/server/* migration
>
> Does not include subdirs
> TEST=applicable unittests, compiling in py2 and py3
> BUG=chromium:990593
>
> Change-Id: I668c7531e7fc926f9a20c3bf2bab0d62eb3e3926
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2318565
> Commit-Queue: Derek Beckett <[email protected]>
> Tested-by: Derek Beckett <[email protected]>
> Reviewed-by: Greg Edelston <[email protected]>
Bug: chromium:990593
Change-Id: I912aa024130987af313dc472a273267669e6b69c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2373204
Commit-Queue: Derek Beckett <[email protected]>
Tested-by: Derek Beckett <[email protected]>
Reviewed-by: Greg Edelston <[email protected]>
Reviewed-by: Gregory Nisbet <[email protected]>
Auto-Submit: Derek Beckett <[email protected]>
diff --git a/server/site_linux_system.py b/server/site_linux_system.py
index 0433a00..7ca462d 100644
--- a/server/site_linux_system.py
+++ b/server/site_linux_system.py
@@ -1,7 +1,12 @@
+# Lint as: python2, python3
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+
import datetime
import collections
import logging
@@ -16,6 +21,8 @@
from autotest_lib.client.common_lib.cros.network import iw_runner
from autotest_lib.client.common_lib.cros.network import ping_runner
from autotest_lib.server.cros.network import packet_capturer
+import six
+from six.moves import range
NetDev = collections.namedtuple('NetDev',
['inherited', 'phy', 'if_name', 'if_type'])
@@ -239,7 +246,7 @@
# across systems. (The default random class might, e.g., seed
# itself based on wall-clock time.)
sysrand = random.SystemRandom()
- for tries in xrange(0, self.MAC_RETRY_LIMIT):
+ for tries in range(0, self.MAC_RETRY_LIMIT):
mac_addr = '%02x:%02x:%02x:%02x:%02x:%02x' % (
(sysrand.getrandbits(8) & ~self.MAC_BIT_MULTICAST) |
self.MAC_BIT_LOCAL,
@@ -323,10 +330,10 @@
def get_capabilities(self):
caps = set()
phymap = self.phys_for_frequency
- if [freq for freq in phymap.iterkeys() if freq > 5000]:
+ if [freq for freq in six.iterkeys(phymap) if freq > 5000]:
# The frequencies are expressed in megaherz
caps.add(self.CAPABILITY_5GHZ)
- if [freq for freq in phymap.iterkeys() if len(phymap[freq]) > 1]:
+ if [freq for freq in six.iterkeys(phymap) if len(phymap[freq]) > 1]:
caps.add(self.CAPABILITY_MULTI_AP_SAME_BAND)
caps.add(self.CAPABILITY_MULTI_AP)
elif len(self.phy_bus_type) > 1: