mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-02 19:32:34 +01:00
Add support for Python 3
Add support for running under Python 3, while maintaining compatibility with Python 2. See http://python-future.org/compatible_idioms.html for more details behind these changes.
This commit is contained in:
committed by
Marc Bonnici
parent
c3ddb31d4d
commit
b3de85455a
@@ -13,7 +13,7 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import os
|
||||
import struct
|
||||
import signal
|
||||
@@ -88,7 +88,7 @@ class UinputDeviceInfo(object):
|
||||
self.abs_bits = bytearray(parts[3])
|
||||
self.num_absinfo = parts[4]
|
||||
self.absinfo = [absinfo(*read_struct(fh, absinfo_struct))
|
||||
for _ in xrange(self.num_absinfo)]
|
||||
for _ in range(self.num_absinfo)]
|
||||
|
||||
def __str__(self):
|
||||
return 'UInputInfo({})'.format(self.__dict__)
|
||||
@@ -145,7 +145,7 @@ class ReventRecording(object):
|
||||
if self.stream:
|
||||
events = self._iter_events()
|
||||
try:
|
||||
first = last = events.next()
|
||||
first = last = next(events)
|
||||
except StopIteration:
|
||||
self._duration = 0
|
||||
for last in events:
|
||||
@@ -230,7 +230,7 @@ class ReventRecording(object):
|
||||
|
||||
def _read_devices(self, fh):
|
||||
num_devices, = read_struct(fh, u32_struct)
|
||||
for _ in xrange(num_devices):
|
||||
for _ in range(num_devices):
|
||||
self.device_paths.append(read_string(fh))
|
||||
|
||||
def _read_gamepad_info(self, fh):
|
||||
@@ -243,7 +243,7 @@ class ReventRecording(object):
|
||||
raise RuntimeError(msg)
|
||||
self.fh.seek(self._events_start)
|
||||
if self.version >= 2:
|
||||
for _ in xrange(self.num_events):
|
||||
for _ in range(self.num_events):
|
||||
yield ReventEvent(self.fh)
|
||||
else:
|
||||
file_size = os.path.getsize(self.filepath)
|
||||
|
Reference in New Issue
Block a user