Python code modernization, 3/n (#1157)

* Remove __metaclass__ = type.

for i in $(grep -REl '__metaclass__ = type' plugins/ tests/); do
  sed -e '/^__metaclass__ = type/d' -i $i;
done

* Remove super arguments, and stop inheriting from object.
This commit is contained in:
Felix Fontein
2025-10-10 08:11:58 +02:00
committed by GitHub
parent 741c318b1d
commit e8ec22d3b1
99 changed files with 129 additions and 245 deletions
+6 -6
View File
@@ -180,7 +180,7 @@ class Connection(ConnectionBase):
)
def __init__(self, play_context, new_stdin, *args, **kwargs):
super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs)
super().__init__(play_context, new_stdin, *args, **kwargs)
self.client = None
self.ids = dict()
@@ -193,7 +193,7 @@ class Connection(ConnectionBase):
def _connect(self, port=None):
"""Connect to the container. Nothing to do"""
super(Connection, self)._connect()
super()._connect()
if not self._connected:
self.actual_user = self.get_option("remote_user")
display.vvv(
@@ -224,7 +224,7 @@ class Connection(ConnectionBase):
def exec_command(self, cmd, in_data=None, sudoable=False):
"""Run a command on the docker host"""
super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable)
super().exec_command(cmd, in_data=in_data, sudoable=sudoable)
command = [self._play_context.executable, "-c", to_text(cmd)]
@@ -376,7 +376,7 @@ class Connection(ConnectionBase):
def put_file(self, in_path, out_path):
"""Transfer a file from local to docker container"""
super(Connection, self).put_file(in_path, out_path)
super().put_file(in_path, out_path)
display.vvv(f"PUT {in_path} TO {out_path}", host=self.get_option("remote_addr"))
out_path = self._prefix_login_path(out_path)
@@ -418,7 +418,7 @@ class Connection(ConnectionBase):
def fetch_file(self, in_path, out_path):
"""Fetch a file from container to local."""
super(Connection, self).fetch_file(in_path, out_path)
super().fetch_file(in_path, out_path)
display.vvv(
f"FETCH {in_path} TO {out_path}", host=self.get_option("remote_addr")
)
@@ -446,7 +446,7 @@ class Connection(ConnectionBase):
def close(self):
"""Terminate the connection. Nothing to do for Docker"""
super(Connection, self).close()
super().close()
self._connected = False
def reset(self):