[v1,2/4] dts: unify class inheritance from object

Message ID 20240423091252.62924-3-juraj.linkes@pantheon.tech (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series node and inheritance improvements |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Juraj Linkeš April 23, 2024, 9:12 a.m. UTC
  There are two ways we specify that a class inherits from object -
implicitly and explicitly. There's no need to explicitly specify that a
class inherits from object and is in fact mostly a remnant from Python2.
Leaving it implicit is the standard in Python3 and offers a small bonus
in cases where something would assign something else to the builtin
object variable.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 dts/framework/remote_session/testpmd_shell.py | 2 +-
 dts/framework/test_result.py                  | 4 ++--
 dts/framework/test_suite.py                   | 2 +-
 dts/framework/testbed_model/cpu.py            | 4 ++--
 dts/framework/testbed_model/sut_node.py       | 2 +-
 dts/framework/testbed_model/virtual_device.py | 2 +-
 dts/framework/utils.py                        | 4 ++--
 7 files changed, 10 insertions(+), 10 deletions(-)
  

Comments

Luca Vizzarro April 23, 2024, 9:19 a.m. UTC | #1
Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>
  
Patrick Robb April 23, 2024, 2:53 p.m. UTC | #2
Reviewed-by: Patrick Robb <probb@iol.unh.edu>
  
Jeremy Spewock April 30, 2024, 4:15 p.m. UTC | #3
Reviewed-by: Jeremy Spewock <jspewock@iol.unh.edu>
  

Patch

diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
index cb2ab6bd00..9456de941d 100644
--- a/dts/framework/remote_session/testpmd_shell.py
+++ b/dts/framework/remote_session/testpmd_shell.py
@@ -27,7 +27,7 @@ 
 from .interactive_shell import InteractiveShell
 
 
-class TestPmdDevice(object):
+class TestPmdDevice:
     """The data of a device that testpmd can recognize.
 
     Attributes:
diff --git a/dts/framework/test_result.py b/dts/framework/test_result.py
index 28f84fd793..83e637c280 100644
--- a/dts/framework/test_result.py
+++ b/dts/framework/test_result.py
@@ -96,7 +96,7 @@  def __bool__(self) -> bool:
         return self is self.PASS
 
 
-class FixtureResult(object):
+class FixtureResult:
     """A record that stores the result of a setup or a teardown.
 
     :attr:`~Result.FAIL` is a sensible default since it prevents false positives (which could happen
@@ -132,7 +132,7 @@  def __bool__(self) -> bool:
         return bool(self.result)
 
 
-class BaseResult(object):
+class BaseResult:
     """Common data and behavior of DTS results.
 
     Stores the results of the setup and teardown portions of the corresponding stage.
diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py
index 9c3b516002..7efa0eae44 100644
--- a/dts/framework/test_suite.py
+++ b/dts/framework/test_suite.py
@@ -27,7 +27,7 @@ 
 from .utils import get_packet_summaries
 
 
-class TestSuite(object):
+class TestSuite:
     """The base class with building blocks needed by most test cases.
 
         * Test suite setup/cleanup methods to override,
diff --git a/dts/framework/testbed_model/cpu.py b/dts/framework/testbed_model/cpu.py
index 9e33b2825d..a50cf44c19 100644
--- a/dts/framework/testbed_model/cpu.py
+++ b/dts/framework/testbed_model/cpu.py
@@ -26,7 +26,7 @@ 
 
 
 @dataclass(slots=True, frozen=True)
-class LogicalCore(object):
+class LogicalCore:
     """Representation of a logical CPU core.
 
     A physical core is represented in OS by multiple logical cores (lcores)
@@ -50,7 +50,7 @@  def __int__(self) -> int:
         return self.lcore
 
 
-class LogicalCoreList(object):
+class LogicalCoreList:
     r"""A unified way to store :class:`LogicalCore`\s.
 
     Create a unified format used across the framework and allow the user to use
diff --git a/dts/framework/testbed_model/sut_node.py b/dts/framework/testbed_model/sut_node.py
index 97aa26d419..10d56eba8d 100644
--- a/dts/framework/testbed_model/sut_node.py
+++ b/dts/framework/testbed_model/sut_node.py
@@ -34,7 +34,7 @@ 
 from .virtual_device import VirtualDevice
 
 
-class EalParameters(object):
+class EalParameters:
     """The environment abstraction layer parameters.
 
     The string representation can be created by converting the instance to a string.
diff --git a/dts/framework/testbed_model/virtual_device.py b/dts/framework/testbed_model/virtual_device.py
index e9b5e9c3be..569d67b007 100644
--- a/dts/framework/testbed_model/virtual_device.py
+++ b/dts/framework/testbed_model/virtual_device.py
@@ -7,7 +7,7 @@ 
 """
 
 
-class VirtualDevice(object):
+class VirtualDevice:
     """Base class for virtual devices used by DPDK.
 
     Attributes:
diff --git a/dts/framework/utils.py b/dts/framework/utils.py
index cc5e458cc8..f9ed1b562f 100644
--- a/dts/framework/utils.py
+++ b/dts/framework/utils.py
@@ -82,7 +82,7 @@  def __str__(self) -> str:
         return self.name
 
 
-class MesonArgs(object):
+class MesonArgs:
     """Aggregate the arguments needed to build DPDK."""
 
     _default_library: str
@@ -131,7 +131,7 @@  class _TarCompressionFormat(StrEnum):
     zstd = "zst"
 
 
-class DPDKGitTarball(object):
+class DPDKGitTarball:
     """Compressed tarball of DPDK from the repository.
 
     The class supports the :class:`os.PathLike` protocol,