From 93ada9762d83ba1fb19b6c7c07d5b99b6b40ffae Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Fri, 13 Jan 2023 12:46:27 +0000 Subject: [PATCH] devlib: Remove "future" Remove the "future" dependency as devlib does not support Python 2 anymore. Also remove the "from __future__ import division" as this is the default in Python 3. --- devlib/collector/dmesg.py | 1 - devlib/collector/ftrace.py | 1 - devlib/derived/energy.py | 1 - devlib/derived/fps.py | 1 - devlib/instrument/__init__.py | 1 - devlib/instrument/acmecape.py | 1 - devlib/instrument/arm_energy_probe.py | 1 - devlib/instrument/energy_probe.py | 1 - devlib/instrument/frames.py | 1 - devlib/instrument/gem5power.py | 2 -- devlib/instrument/hwmon.py | 1 - devlib/instrument/netstats/__init__.py | 3 +-- devlib/platform/arm.py | 1 - devlib/utils/misc.py | 1 - devlib/utils/ssh.py | 5 ++--- setup.py | 1 - 16 files changed, 3 insertions(+), 20 deletions(-) diff --git a/devlib/collector/dmesg.py b/devlib/collector/dmesg.py index b5ba616..faf9682 100644 --- a/devlib/collector/dmesg.py +++ b/devlib/collector/dmesg.py @@ -13,7 +13,6 @@ # limitations under the License. # -from __future__ import division import re from itertools import takewhile from datetime import timedelta diff --git a/devlib/collector/ftrace.py b/devlib/collector/ftrace.py index d6ac314..609d11c 100644 --- a/devlib/collector/ftrace.py +++ b/devlib/collector/ftrace.py @@ -13,7 +13,6 @@ # limitations under the License. # -from __future__ import division import os import json import time diff --git a/devlib/derived/energy.py b/devlib/derived/energy.py index 768a1ee..55eae60 100644 --- a/devlib/derived/energy.py +++ b/devlib/derived/energy.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from __future__ import division from collections import defaultdict from devlib.derived import DerivedMeasurements, DerivedMetric diff --git a/devlib/derived/fps.py b/devlib/derived/fps.py index b7ef4ca..5663539 100644 --- a/devlib/derived/fps.py +++ b/devlib/derived/fps.py @@ -13,7 +13,6 @@ # limitations under the License. # -from __future__ import division import os try: diff --git a/devlib/instrument/__init__.py b/devlib/instrument/__init__.py index 600b6b6..6dca81c 100644 --- a/devlib/instrument/__init__.py +++ b/devlib/instrument/__init__.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from __future__ import division import logging import collections diff --git a/devlib/instrument/acmecape.py b/devlib/instrument/acmecape.py index 54c3014..ec0a77b 100644 --- a/devlib/instrument/acmecape.py +++ b/devlib/instrument/acmecape.py @@ -14,7 +14,6 @@ # #pylint: disable=attribute-defined-outside-init -from __future__ import division import os import sys import time diff --git a/devlib/instrument/arm_energy_probe.py b/devlib/instrument/arm_energy_probe.py index 11c4add..80ef643 100644 --- a/devlib/instrument/arm_energy_probe.py +++ b/devlib/instrument/arm_energy_probe.py @@ -30,7 +30,6 @@ # pylint: disable=W0613,E1101,access-member-before-definition,attribute-defined-outside-init -from __future__ import division import os import shutil import signal diff --git a/devlib/instrument/energy_probe.py b/devlib/instrument/energy_probe.py index ce18726..b0b5180 100644 --- a/devlib/instrument/energy_probe.py +++ b/devlib/instrument/energy_probe.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from __future__ import division import os import signal import tempfile diff --git a/devlib/instrument/frames.py b/devlib/instrument/frames.py index e9c929e..402c481 100644 --- a/devlib/instrument/frames.py +++ b/devlib/instrument/frames.py @@ -13,7 +13,6 @@ # limitations under the License. # -from __future__ import division import os from devlib.instrument import (Instrument, CONTINUOUS, diff --git a/devlib/instrument/gem5power.py b/devlib/instrument/gem5power.py index 35b338b..2a59b6e 100644 --- a/devlib/instrument/gem5power.py +++ b/devlib/instrument/gem5power.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import division - from devlib.platform.gem5 import Gem5SimulationPlatform from devlib.instrument import Instrument, CONTINUOUS, MeasurementsCsv from devlib.exception import TargetStableError diff --git a/devlib/instrument/hwmon.py b/devlib/instrument/hwmon.py index 8c7f15d..7c1cb7d 100644 --- a/devlib/instrument/hwmon.py +++ b/devlib/instrument/hwmon.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from __future__ import division import re from devlib.instrument import Instrument, Measurement, INSTANTANEOUS diff --git a/devlib/instrument/netstats/__init__.py b/devlib/instrument/netstats/__init__.py index 3db342f..74ac9d7 100644 --- a/devlib/instrument/netstats/__init__.py +++ b/devlib/instrument/netstats/__init__.py @@ -18,8 +18,7 @@ import re import tempfile from datetime import datetime from collections import defaultdict - -from future.moves.itertools import zip_longest +from itertools import zip_longest from devlib.instrument import Instrument, MeasurementsCsv, CONTINUOUS from devlib.exception import TargetStableError, HostError diff --git a/devlib/platform/arm.py b/devlib/platform/arm.py index eb5dbb5..fbe81af 100644 --- a/devlib/platform/arm.py +++ b/devlib/platform/arm.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from __future__ import division import os import sys import tempfile diff --git a/devlib/utils/misc.py b/devlib/utils/misc.py index 5a48f9b..4734892 100644 --- a/devlib/utils/misc.py +++ b/devlib/utils/misc.py @@ -18,7 +18,6 @@ Miscellaneous functions that don't fit anywhere else. """ -from __future__ import division from contextlib import contextmanager from functools import partial, reduce, wraps from itertools import groupby diff --git a/devlib/utils/ssh.py b/devlib/utils/ssh.py index a46267a..39d7046 100644 --- a/devlib/utils/ssh.py +++ b/devlib/utils/ssh.py @@ -32,7 +32,6 @@ import weakref import select import copy import functools -from future.utils import raise_from from shlex import quote from paramiko.client import SSHClient, AutoAddPolicy, RejectPolicy @@ -848,8 +847,8 @@ class TelnetConnection(SshConnectionBase): try: check_output(command, timeout=timeout, shell=True) except subprocess.CalledProcessError as e: - raise_from(HostError("Failed to copy file with '{}'. Output:\n{}".format( - command_redacted, e.output)), None) + msg = f"Failed to copy file with '{command_redacted}'. Output:\n{e.output}" + raise HostError(msg) from None except TimeoutError as e: raise TimeoutError(command_redacted, e.output) diff --git a/setup.py b/setup.py index 1bb7bd1..bf1b408 100644 --- a/setup.py +++ b/setup.py @@ -90,7 +90,6 @@ params = dict( 'paramiko', # SSH connection 'scp', # SSH connection file transfers 'wrapt', # Basic for construction of decorator functions - 'future', # Python 2-3 compatibility 'numpy', 'pandas', 'lxml', # More robust xml parsing