mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 03:46:55 +00:00
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:
@@ -455,7 +455,7 @@ from ansible_collections.community.docker.plugins.module_utils._version import (
|
||||
|
||||
class ServicesManager(BaseComposeManager):
|
||||
def __init__(self, client):
|
||||
super(ServicesManager, self).__init__(client)
|
||||
super().__init__(client)
|
||||
parameters = self.client.module.params
|
||||
|
||||
self.state = parameters["state"]
|
||||
|
||||
@@ -180,7 +180,7 @@ from ansible_collections.community.docker.plugins.module_utils._compose_v2 impor
|
||||
|
||||
class ExecManager(BaseComposeManager):
|
||||
def __init__(self, client):
|
||||
super(ExecManager, self).__init__(client)
|
||||
super().__init__(client)
|
||||
parameters = self.client.module.params
|
||||
|
||||
self.service = parameters["service"]
|
||||
|
||||
@@ -127,7 +127,7 @@ from ansible_collections.community.docker.plugins.module_utils._version import (
|
||||
|
||||
class PullManager(BaseComposeManager):
|
||||
def __init__(self, client):
|
||||
super(PullManager, self).__init__(client)
|
||||
super().__init__(client)
|
||||
parameters = self.client.module.params
|
||||
|
||||
self.policy = parameters["policy"]
|
||||
|
||||
@@ -253,7 +253,7 @@ from ansible_collections.community.docker.plugins.module_utils._compose_v2 impor
|
||||
|
||||
class ExecManager(BaseComposeManager):
|
||||
def __init__(self, client):
|
||||
super(ExecManager, self).__init__(client)
|
||||
super().__init__(client)
|
||||
parameters = self.client.module.params
|
||||
|
||||
self.service = parameters["service"]
|
||||
|
||||
@@ -222,7 +222,7 @@ class ConfigManager(DockerBaseClass):
|
||||
|
||||
def __init__(self, client, results):
|
||||
|
||||
super(ConfigManager, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.results = results
|
||||
|
||||
@@ -234,7 +234,7 @@ class DockerHostManager(DockerBaseClass):
|
||||
|
||||
def __init__(self, client, results):
|
||||
|
||||
super(DockerHostManager, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.results = results
|
||||
|
||||
@@ -433,7 +433,7 @@ class ImageManager(DockerBaseClass):
|
||||
:type results: dict
|
||||
"""
|
||||
|
||||
super(ImageManager, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.results = results
|
||||
|
||||
@@ -327,7 +327,7 @@ def _quote_csv(text):
|
||||
|
||||
class ImageBuilder(DockerBaseClass):
|
||||
def __init__(self, client):
|
||||
super(ImageBuilder, self).__init__()
|
||||
super().__init__()
|
||||
self.client = client
|
||||
self.check_mode = self.client.check_mode
|
||||
parameters = self.client.module.params
|
||||
|
||||
@@ -122,7 +122,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
||||
|
||||
class ImageExportManager(DockerBaseClass):
|
||||
def __init__(self, client):
|
||||
super(ImageExportManager, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
parameters = self.client.module.params
|
||||
|
||||
@@ -158,7 +158,7 @@ class ImageManager(DockerBaseClass):
|
||||
|
||||
def __init__(self, client, results):
|
||||
|
||||
super(ImageManager, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.results = results
|
||||
|
||||
@@ -96,7 +96,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
||||
|
||||
class ImageManager(DockerBaseClass):
|
||||
def __init__(self, client, results):
|
||||
super(ImageManager, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.results = results
|
||||
|
||||
@@ -125,7 +125,7 @@ def image_info(image):
|
||||
|
||||
class ImagePuller(DockerBaseClass):
|
||||
def __init__(self, client):
|
||||
super(ImagePuller, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.check_mode = self.client.check_mode
|
||||
|
||||
@@ -97,7 +97,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
||||
|
||||
class ImagePusher(DockerBaseClass):
|
||||
def __init__(self, client):
|
||||
super(ImagePusher, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.check_mode = self.client.check_mode
|
||||
|
||||
@@ -120,7 +120,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
||||
class ImageRemover(DockerBaseClass):
|
||||
|
||||
def __init__(self, client):
|
||||
super(ImageRemover, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.check_mode = self.client.check_mode
|
||||
|
||||
@@ -142,7 +142,7 @@ def image_info(name, tag, image):
|
||||
|
||||
class ImageTagger(DockerBaseClass):
|
||||
def __init__(self, client):
|
||||
super(ImageTagger, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
parameters = self.client.module.params
|
||||
|
||||
@@ -145,7 +145,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
||||
)
|
||||
|
||||
|
||||
class DockerFileStore(object):
|
||||
class DockerFileStore:
|
||||
"""
|
||||
A custom credential store class that implements only the functionality we need to
|
||||
update the docker config file when no credential helpers is provided.
|
||||
@@ -238,7 +238,7 @@ class LoginManager(DockerBaseClass):
|
||||
|
||||
def __init__(self, client, results):
|
||||
|
||||
super(LoginManager, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.results = results
|
||||
|
||||
@@ -303,7 +303,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
||||
|
||||
class TaskParameters(DockerBaseClass):
|
||||
def __init__(self, client):
|
||||
super(TaskParameters, self).__init__()
|
||||
super().__init__()
|
||||
self.client = client
|
||||
|
||||
self.name = None
|
||||
@@ -385,7 +385,7 @@ def dicts_are_essentially_equal(a, b):
|
||||
return True
|
||||
|
||||
|
||||
class DockerNetworkManager(object):
|
||||
class DockerNetworkManager:
|
||||
|
||||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
@@ -157,7 +157,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
||||
|
||||
class TaskParameters(DockerBaseClass):
|
||||
def __init__(self, client):
|
||||
super(TaskParameters, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
# Spec
|
||||
self.name = None
|
||||
@@ -179,7 +179,7 @@ class SwarmNodeManager(DockerBaseClass):
|
||||
|
||||
def __init__(self, client, results):
|
||||
|
||||
super(SwarmNodeManager, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.results = results
|
||||
|
||||
@@ -149,7 +149,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
||||
|
||||
class TaskParameters(DockerBaseClass):
|
||||
def __init__(self, client):
|
||||
super(TaskParameters, self).__init__()
|
||||
super().__init__()
|
||||
self.client = client
|
||||
self.plugin_name = None
|
||||
self.alias = None
|
||||
@@ -174,7 +174,7 @@ def parse_options(options_list):
|
||||
return dict(x.split("=", 1) for x in options_list) if options_list else {}
|
||||
|
||||
|
||||
class DockerPluginManager(object):
|
||||
class DockerPluginManager:
|
||||
|
||||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
@@ -214,7 +214,7 @@ class SecretManager(DockerBaseClass):
|
||||
|
||||
def __init__(self, client, results):
|
||||
|
||||
super(SecretManager, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.results = results
|
||||
|
||||
@@ -315,7 +315,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
||||
|
||||
class TaskParameters(DockerBaseClass):
|
||||
def __init__(self):
|
||||
super(TaskParameters, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.advertise_addr = None
|
||||
self.listen_addr = None
|
||||
@@ -461,7 +461,7 @@ class SwarmManager(DockerBaseClass):
|
||||
|
||||
def __init__(self, client, results):
|
||||
|
||||
super(SwarmManager, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.results = results
|
||||
|
||||
@@ -210,7 +210,7 @@ class DockerSwarmManager(DockerBaseClass):
|
||||
|
||||
def __init__(self, client, results):
|
||||
|
||||
super(DockerSwarmManager, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.client = client
|
||||
self.results = results
|
||||
|
||||
@@ -1127,7 +1127,7 @@ def have_networks_changed(new_networks, old_networks):
|
||||
|
||||
class DockerService(DockerBaseClass):
|
||||
def __init__(self, docker_api_version, docker_py_version):
|
||||
super(DockerService, self).__init__()
|
||||
super().__init__()
|
||||
self.image = ""
|
||||
self.command = None
|
||||
self.args = None
|
||||
@@ -2174,7 +2174,7 @@ class DockerService(DockerBaseClass):
|
||||
return service
|
||||
|
||||
|
||||
class DockerServiceManager(object):
|
||||
class DockerServiceManager:
|
||||
|
||||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
@@ -137,7 +137,7 @@ from ansible_collections.community.docker.plugins.module_utils._util import (
|
||||
|
||||
class TaskParameters(DockerBaseClass):
|
||||
def __init__(self, client):
|
||||
super(TaskParameters, self).__init__()
|
||||
super().__init__()
|
||||
self.client = client
|
||||
|
||||
self.volume_name = None
|
||||
@@ -151,7 +151,7 @@ class TaskParameters(DockerBaseClass):
|
||||
setattr(self, key, value)
|
||||
|
||||
|
||||
class DockerVolumeManager(object):
|
||||
class DockerVolumeManager:
|
||||
|
||||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
Reference in New Issue
Block a user