diff --git a/plugins/action/iptables_state.py b/plugins/action/iptables_state.py index dd6724476f..5649ed6f47 100644 --- a/plugins/action/iptables_state.py +++ b/plugins/action/iptables_state.py @@ -79,7 +79,7 @@ class ActionModule(ActionBase): self._supports_check_mode = True self._supports_async = True - result = super(ActionModule, self).run(tmp, task_vars) + result = super().run(tmp, task_vars) del tmp # tmp no longer has any effect if not result.get('skipped'): diff --git a/plugins/action/shutdown.py b/plugins/action/shutdown.py index d2a9d3c2b7..71c7b947dc 100644 --- a/plugins/action/shutdown.py +++ b/plugins/action/shutdown.py @@ -58,7 +58,7 @@ class ActionModule(ActionBase): } def __init__(self, *args, **kwargs): - super(ActionModule, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) @property def delay(self): @@ -200,7 +200,7 @@ class ActionModule(ActionBase): if task_vars is None: task_vars = {} - result = super(ActionModule, self).run(tmp, task_vars) + result = super().run(tmp, task_vars) if result.get('skipped', False) or result.get('failed', False): return result diff --git a/plugins/become/doas.py b/plugins/become/doas.py index 84efe31ac4..5eb7be6129 100644 --- a/plugins/become/doas.py +++ b/plugins/become/doas.py @@ -116,7 +116,7 @@ class BecomeModule(BecomeBase): return bool(re.match(b_prompt, b_output)) def build_become_command(self, cmd, shell): - super(BecomeModule, self).build_become_command(cmd, shell) + super().build_become_command(cmd, shell) if not cmd: return cmd diff --git a/plugins/become/dzdo.py b/plugins/become/dzdo.py index dad05eb34e..eac5dbd82a 100644 --- a/plugins/become/dzdo.py +++ b/plugins/become/dzdo.py @@ -81,7 +81,7 @@ class BecomeModule(BecomeBase): fail = ('Sorry, try again.',) def build_become_command(self, cmd, shell): - super(BecomeModule, self).build_become_command(cmd, shell) + super().build_become_command(cmd, shell) if not cmd: return cmd diff --git a/plugins/become/ksu.py b/plugins/become/ksu.py index 0ffba62385..1f0788944f 100644 --- a/plugins/become/ksu.py +++ b/plugins/become/ksu.py @@ -109,7 +109,7 @@ class BecomeModule(BecomeBase): def build_become_command(self, cmd, shell): - super(BecomeModule, self).build_become_command(cmd, shell) + super().build_become_command(cmd, shell) # Prompt handling for ``ksu`` is more complicated, this # is used to satisfy the connection plugin diff --git a/plugins/become/machinectl.py b/plugins/become/machinectl.py index 685f39f5d8..40fc72c216 100644 --- a/plugins/become/machinectl.py +++ b/plugins/become/machinectl.py @@ -117,7 +117,7 @@ class BecomeModule(BecomeBase): return ansi_color_codes.sub(b"", line) def build_become_command(self, cmd, shell): - super(BecomeModule, self).build_become_command(cmd, shell) + super().build_become_command(cmd, shell) if not cmd: return cmd diff --git a/plugins/become/pbrun.py b/plugins/become/pbrun.py index c9eb975427..b7af868d8f 100644 --- a/plugins/become/pbrun.py +++ b/plugins/become/pbrun.py @@ -92,7 +92,7 @@ class BecomeModule(BecomeBase): prompt = 'Password:' def build_become_command(self, cmd, shell): - super(BecomeModule, self).build_become_command(cmd, shell) + super().build_become_command(cmd, shell) if not cmd: return cmd diff --git a/plugins/become/pfexec.py b/plugins/become/pfexec.py index 2e7df0f6c0..7c242c8d76 100644 --- a/plugins/become/pfexec.py +++ b/plugins/become/pfexec.py @@ -95,7 +95,7 @@ class BecomeModule(BecomeBase): name = 'community.general.pfexec' def build_become_command(self, cmd, shell): - super(BecomeModule, self).build_become_command(cmd, shell) + super().build_become_command(cmd, shell) if not cmd: return cmd diff --git a/plugins/become/pmrun.py b/plugins/become/pmrun.py index 413600cdbf..6f2e4abab0 100644 --- a/plugins/become/pmrun.py +++ b/plugins/become/pmrun.py @@ -68,7 +68,7 @@ class BecomeModule(BecomeBase): prompt = 'Enter UPM user password:' def build_become_command(self, cmd, shell): - super(BecomeModule, self).build_become_command(cmd, shell) + super().build_become_command(cmd, shell) if not cmd: return cmd diff --git a/plugins/become/sesu.py b/plugins/become/sesu.py index ecd29c83c5..1b2b3f35d9 100644 --- a/plugins/become/sesu.py +++ b/plugins/become/sesu.py @@ -82,7 +82,7 @@ class BecomeModule(BecomeBase): fail = missing = ('Sorry, try again with sesu.',) def build_become_command(self, cmd, shell): - super(BecomeModule, self).build_become_command(cmd, shell) + super().build_become_command(cmd, shell) if not cmd: return cmd diff --git a/plugins/become/sudosu.py b/plugins/become/sudosu.py index 3b5d4d8b7f..8e353ca7a8 100644 --- a/plugins/become/sudosu.py +++ b/plugins/become/sudosu.py @@ -87,7 +87,7 @@ class BecomeModule(BecomeBase): missing = ('Sorry, a password is required to run sudo', 'sudo: a password is required') def build_become_command(self, cmd, shell): - super(BecomeModule, self).build_become_command(cmd, shell) + super().build_become_command(cmd, shell) if not cmd: return cmd diff --git a/plugins/cache/memcached.py b/plugins/cache/memcached.py index d7dcf2f712..75b405da1a 100644 --- a/plugins/cache/memcached.py +++ b/plugins/cache/memcached.py @@ -175,7 +175,7 @@ class CacheModule(BaseCacheModule): def __init__(self, *args, **kwargs): connection = ['127.0.0.1:11211'] - super(CacheModule, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if self.get_option('_uri'): connection = self.get_option('_uri') self._timeout = self.get_option('_timeout') diff --git a/plugins/cache/redis.py b/plugins/cache/redis.py index d7b596bb32..b8f6021c79 100644 --- a/plugins/cache/redis.py +++ b/plugins/cache/redis.py @@ -100,7 +100,7 @@ class CacheModule(BaseCacheModule): def __init__(self, *args, **kwargs): uri = '' - super(CacheModule, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if self.get_option('_uri'): uri = self.get_option('_uri') self._timeout = float(self.get_option('_timeout')) diff --git a/plugins/callback/cgroup_memory_recap.py b/plugins/callback/cgroup_memory_recap.py index 294ee4b378..30e7a6732f 100644 --- a/plugins/callback/cgroup_memory_recap.py +++ b/plugins/callback/cgroup_memory_recap.py @@ -71,14 +71,14 @@ class CallbackModule(CallbackBase): CALLBACK_NEEDS_WHITELIST = True def __init__(self, display=None): - super(CallbackModule, self).__init__(display) + super().__init__(display) self._task_memprof = None self.task_results = [] def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) self.cgroup_max_file = self.get_option('max_mem_file') self.cgroup_current_file = self.get_option('cur_mem_file') diff --git a/plugins/callback/context_demo.py b/plugins/callback/context_demo.py index f390a947a4..503e39fadd 100644 --- a/plugins/callback/context_demo.py +++ b/plugins/callback/context_demo.py @@ -31,7 +31,7 @@ class CallbackModule(CallbackBase): CALLBACK_NEEDS_WHITELIST = True def __init__(self, *args, **kwargs): - super(CallbackModule, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.task = None self.play = None diff --git a/plugins/callback/counter_enabled.py b/plugins/callback/counter_enabled.py index d5fe334a49..71ad915640 100644 --- a/plugins/callback/counter_enabled.py +++ b/plugins/callback/counter_enabled.py @@ -47,7 +47,7 @@ class CallbackModule(CallbackBase): _previous_batch_total = 0 def __init__(self): - super(CallbackModule, self).__init__() + super().__init__() self._playbook = "" self._play = "" diff --git a/plugins/callback/dense.py b/plugins/callback/dense.py index 30167791e9..15e4ee10a6 100644 --- a/plugins/callback/dense.py +++ b/plugins/callback/dense.py @@ -161,7 +161,7 @@ class CallbackModule(CallbackModule_default): if HAS_OD: self.disabled = False - self.super_ref = super(CallbackModule, self) + self.super_ref = super() self.super_ref.__init__() # Attributes to remove from results for more density diff --git a/plugins/callback/diy.py b/plugins/callback/diy.py index 68de880793..d668319b71 100644 --- a/plugins/callback/diy.py +++ b/plugins/callback/diy.py @@ -849,7 +849,7 @@ class CallbackModule(Default): return (spec['msg'] is not None) and (spec['msg'] != omit or omit is sentinel) def _parent_has_callback(self): - return hasattr(super(CallbackModule, self), sys._getframe(1).f_code.co_name) + return hasattr(super(), sys._getframe(1).f_code.co_name) def _template(self, loader, template, variables): _templar = Templar(loader=loader, variables=variables) @@ -1027,7 +1027,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_on_any(*args, **kwargs) + super().v2_on_any(*args, **kwargs) def v2_runner_on_failed(self, result, ignore_errors=False): self._diy_spec = self._get_output_specification( @@ -1045,7 +1045,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_runner_on_failed(result, ignore_errors) + super().v2_runner_on_failed(result, ignore_errors) def v2_runner_on_ok(self, result): self._diy_spec = self._get_output_specification( @@ -1063,7 +1063,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_runner_on_ok(result) + super().v2_runner_on_ok(result) def v2_runner_on_skipped(self, result): self._diy_spec = self._get_output_specification( @@ -1081,7 +1081,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_runner_on_skipped(result) + super().v2_runner_on_skipped(result) def v2_runner_on_unreachable(self, result): self._diy_spec = self._get_output_specification( @@ -1099,7 +1099,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_runner_on_unreachable(result) + super().v2_runner_on_unreachable(result) # not implemented as the call to this is not implemented yet def v2_runner_on_async_poll(self, result): @@ -1130,7 +1130,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_runner_item_on_ok(result) + super().v2_runner_item_on_ok(result) def v2_runner_item_on_failed(self, result): self._diy_spec = self._get_output_specification( @@ -1149,7 +1149,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_runner_item_on_failed(result) + super().v2_runner_item_on_failed(result) def v2_runner_item_on_skipped(self, result): self._diy_spec = self._get_output_specification( @@ -1168,7 +1168,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_runner_item_on_skipped(result) + super().v2_runner_item_on_skipped(result) def v2_runner_retry(self, result): self._diy_spec = self._get_output_specification( @@ -1186,7 +1186,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_runner_retry(result) + super().v2_runner_retry(result) def v2_runner_on_start(self, host, task): self._diy_host = host @@ -1207,7 +1207,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_runner_on_start(host, task) + super().v2_runner_on_start(host, task) def v2_playbook_on_start(self, playbook): self._diy_playbook = playbook @@ -1225,7 +1225,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_playbook_on_start(playbook) + super().v2_playbook_on_start(playbook) def v2_playbook_on_notify(self, handler, host): self._diy_handler = handler @@ -1246,7 +1246,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_playbook_on_notify(handler, host) + super().v2_playbook_on_notify(handler, host) def v2_playbook_on_no_hosts_matched(self): self._diy_spec = self._get_output_specification( @@ -1259,7 +1259,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_playbook_on_no_hosts_matched() + super().v2_playbook_on_no_hosts_matched() def v2_playbook_on_no_hosts_remaining(self): self._diy_spec = self._get_output_specification( @@ -1272,7 +1272,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_playbook_on_no_hosts_remaining() + super().v2_playbook_on_no_hosts_remaining() def v2_playbook_on_task_start(self, task, is_conditional): self._diy_task = task @@ -1291,7 +1291,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_playbook_on_task_start(task, is_conditional) + super().v2_playbook_on_task_start(task, is_conditional) # not implemented as the call to this is not implemented yet def v2_playbook_on_cleanup_task_start(self, task): @@ -1314,7 +1314,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_playbook_on_handler_task_start(task) + super().v2_playbook_on_handler_task_start(task) def v2_playbook_on_vars_prompt(self, varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None, @@ -1329,7 +1329,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_playbook_on_vars_prompt( + super().v2_playbook_on_vars_prompt( varname, private, prompt, encrypt, confirm, salt_size, salt, default, unsafe @@ -1359,7 +1359,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_playbook_on_play_start(play) + super().v2_playbook_on_play_start(play) def v2_playbook_on_stats(self, stats): self._diy_stats = stats @@ -1378,7 +1378,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_playbook_on_stats(stats) + super().v2_playbook_on_stats(stats) def v2_playbook_on_include(self, included_file): self._diy_included_file = included_file @@ -1398,7 +1398,7 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_playbook_on_include(included_file) + super().v2_playbook_on_include(included_file) def v2_on_file_diff(self, result): self._diy_spec = self._get_output_specification( @@ -1416,4 +1416,4 @@ class CallbackModule(Default): if self._parent_has_callback(): with self._suppress_stdout(enabled=self._using_diy(spec=self._diy_spec)): - super(CallbackModule, self).v2_on_file_diff(result) + super().v2_on_file_diff(result) diff --git a/plugins/callback/elastic.py b/plugins/callback/elastic.py index 9b0340deb8..5d98032bf3 100644 --- a/plugins/callback/elastic.py +++ b/plugins/callback/elastic.py @@ -297,7 +297,7 @@ class CallbackModule(CallbackBase): CALLBACK_NEEDS_ENABLED = True def __init__(self, display=None): - super(CallbackModule, self).__init__(display=display) + super().__init__(display=display) self.hide_task_arguments = None self.apm_service_name = None self.ansible_playbook = None @@ -315,9 +315,7 @@ class CallbackModule(CallbackBase): self.elastic = ElasticSource(display=self._display) def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, - var_options=var_options, - direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) self.hide_task_arguments = self.get_option('hide_task_arguments') diff --git a/plugins/callback/jabber.py b/plugins/callback/jabber.py index 319611d460..9d85be923c 100644 --- a/plugins/callback/jabber.py +++ b/plugins/callback/jabber.py @@ -62,7 +62,7 @@ class CallbackModule(CallbackBase): def __init__(self, display=None): - super(CallbackModule, self).__init__(display=display) + super().__init__(display=display) if not HAS_XMPP: self._display.warning("The required python xmpp library (xmpppy) is not installed. " diff --git a/plugins/callback/log_plays.py b/plugins/callback/log_plays.py index 89ec8cbff3..ff2198364d 100644 --- a/plugins/callback/log_plays.py +++ b/plugins/callback/log_plays.py @@ -62,10 +62,10 @@ class CallbackModule(CallbackBase): def __init__(self): - super(CallbackModule, self).__init__() + super().__init__() def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) self.log_folder = self.get_option("log_folder") diff --git a/plugins/callback/loganalytics.py b/plugins/callback/loganalytics.py index b39cefb932..3ee0f3ad49 100644 --- a/plugins/callback/loganalytics.py +++ b/plugins/callback/loganalytics.py @@ -157,7 +157,7 @@ class CallbackModule(CallbackBase): CALLBACK_NEEDS_WHITELIST = True def __init__(self, display=None): - super(CallbackModule, self).__init__(display=display) + super().__init__(display=display) self.start_datetimes = {} # Collect task start times self.workspace_id = None self.shared_key = None @@ -170,7 +170,7 @@ class CallbackModule(CallbackBase): ).total_seconds() def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) self.workspace_id = self.get_option('workspace_id') self.shared_key = self.get_option('shared_key') diff --git a/plugins/callback/logdna.py b/plugins/callback/logdna.py index 09d8b38dcb..3ab87274fe 100644 --- a/plugins/callback/logdna.py +++ b/plugins/callback/logdna.py @@ -114,7 +114,7 @@ class CallbackModule(CallbackBase): CALLBACK_NEEDS_WHITELIST = True def __init__(self, display=None): - super(CallbackModule, self).__init__(display=display) + super().__init__(display=display) self.disabled = True self.playbook_name = None @@ -125,7 +125,7 @@ class CallbackModule(CallbackBase): self.conf_tags = None def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) self.conf_key = self.get_option('conf_key') self.plugin_ignore_errors = self.get_option('plugin_ignore_errors') diff --git a/plugins/callback/logentries.py b/plugins/callback/logentries.py index 726ef81a9a..469e31965d 100644 --- a/plugins/callback/logentries.py +++ b/plugins/callback/logentries.py @@ -218,7 +218,7 @@ class CallbackModule(CallbackBase): def __init__(self): # TODO: allow for alternate posting methods (REST/UDP/agent/etc) - super(CallbackModule, self).__init__() + super().__init__() # verify dependencies if not HAS_SSL: @@ -235,7 +235,7 @@ class CallbackModule(CallbackBase): def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) # get options try: diff --git a/plugins/callback/logstash.py b/plugins/callback/logstash.py index f2279929f0..16d474fd38 100644 --- a/plugins/callback/logstash.py +++ b/plugins/callback/logstash.py @@ -122,7 +122,7 @@ class CallbackModule(CallbackBase): CALLBACK_NEEDS_WHITELIST = True def __init__(self): - super(CallbackModule, self).__init__() + super().__init__() if not HAS_LOGSTASH: self.disabled = True @@ -163,7 +163,7 @@ class CallbackModule(CallbackBase): self.base_data['inventory'] = context.CLIARGS.get('inventory') def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) self.ls_server = self.get_option('server') self.ls_port = int(self.get_option('port')) diff --git a/plugins/callback/mail.py b/plugins/callback/mail.py index 7afb08e3f0..40a0f09332 100644 --- a/plugins/callback/mail.py +++ b/plugins/callback/mail.py @@ -99,7 +99,7 @@ class CallbackModule(CallbackBase): CALLBACK_NEEDS_WHITELIST = True def __init__(self, display=None): - super(CallbackModule, self).__init__(display=display) + super().__init__(display=display) self.sender = None self.to = 'root' self.smtphost = os.getenv('SMTPHOST', 'localhost') @@ -109,7 +109,7 @@ class CallbackModule(CallbackBase): def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) self.sender = self.get_option('sender') self.to = self.get_option('to') diff --git a/plugins/callback/nrdp.py b/plugins/callback/nrdp.py index 6f1b5e2f5b..9f49ed6bcd 100644 --- a/plugins/callback/nrdp.py +++ b/plugins/callback/nrdp.py @@ -89,14 +89,14 @@ class CallbackModule(CallbackBase): UNKNOWN = 3 def __init__(self): - super(CallbackModule, self).__init__() + super().__init__() self.printed_playbook = False self.playbook_name = None self.play = None def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) self.url = self.get_option('url') if not self.url.endswith('/'): diff --git a/plugins/callback/opentelemetry.py b/plugins/callback/opentelemetry.py index 89817847a6..8cb37c80c6 100644 --- a/plugins/callback/opentelemetry.py +++ b/plugins/callback/opentelemetry.py @@ -478,7 +478,7 @@ class CallbackModule(CallbackBase): CALLBACK_NEEDS_ENABLED = True def __init__(self, display=None): - super(CallbackModule, self).__init__(display=display) + super().__init__(display=display) self.hide_task_arguments = None self.disable_attributes_in_logs = None self.disable_logs = None @@ -502,9 +502,7 @@ class CallbackModule(CallbackBase): self.opentelemetry = OpenTelemetrySource(display=self._display) def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, - var_options=var_options, - direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) environment_variable = self.get_option('enable_from_environment') if environment_variable is not None and os.environ.get(environment_variable, 'false').lower() != 'true': diff --git a/plugins/callback/print_task.py b/plugins/callback/print_task.py index 76d9aadb39..c73cdb8cec 100644 --- a/plugins/callback/print_task.py +++ b/plugins/callback/print_task.py @@ -44,7 +44,7 @@ class CallbackModule(CallbackBase): CALLBACK_NEEDS_ENABLED = True def __init__(self): - super(CallbackModule, self).__init__() + super().__init__() self._printed_message = False def _print_task(self, task): diff --git a/plugins/callback/say.py b/plugins/callback/say.py index 0455ee69e6..d27b4592ed 100644 --- a/plugins/callback/say.py +++ b/plugins/callback/say.py @@ -37,7 +37,7 @@ class CallbackModule(CallbackBase): def __init__(self): - super(CallbackModule, self).__init__() + super().__init__() self.FAILED_VOICE = None self.REGULAR_VOICE = None diff --git a/plugins/callback/selective.py b/plugins/callback/selective.py index e7906ea7e5..207b814bc3 100644 --- a/plugins/callback/selective.py +++ b/plugins/callback/selective.py @@ -83,14 +83,14 @@ class CallbackModule(CallbackBase): def __init__(self, display=None): """selective.py callback plugin.""" - super(CallbackModule, self).__init__(display) + super().__init__(display) self.last_skipped = False self.last_task_name = None self.printed_last_task = False def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) global DONT_COLORIZE DONT_COLORIZE = self.get_option('nocolor') diff --git a/plugins/callback/slack.py b/plugins/callback/slack.py index e1d95abe06..7570c981bd 100644 --- a/plugins/callback/slack.py +++ b/plugins/callback/slack.py @@ -86,7 +86,7 @@ class CallbackModule(CallbackBase): def __init__(self, display=None): - super(CallbackModule, self).__init__(display=display) + super().__init__(display=display) if not HAS_PRETTYTABLE: self.disabled = True @@ -103,7 +103,7 @@ class CallbackModule(CallbackBase): def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) self.webhook_url = self.get_option('webhook_url') self.channel = self.get_option('channel') diff --git a/plugins/callback/splunk.py b/plugins/callback/splunk.py index 74b905c9c2..2a3dcaef4b 100644 --- a/plugins/callback/splunk.py +++ b/plugins/callback/splunk.py @@ -168,7 +168,7 @@ class CallbackModule(CallbackBase): CALLBACK_NEEDS_WHITELIST = True def __init__(self, display=None): - super(CallbackModule, self).__init__(display=display) + super().__init__(display=display) self.start_datetimes = {} # Collect task start times self.url = None self.authtoken = None @@ -184,9 +184,7 @@ class CallbackModule(CallbackBase): ).total_seconds() def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, - var_options=var_options, - direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) self.url = self.get_option('url') diff --git a/plugins/callback/sumologic.py b/plugins/callback/sumologic.py index a460118e9b..15928cacc8 100644 --- a/plugins/callback/sumologic.py +++ b/plugins/callback/sumologic.py @@ -113,7 +113,7 @@ class CallbackModule(CallbackBase): CALLBACK_NEEDS_WHITELIST = True def __init__(self, display=None): - super(CallbackModule, self).__init__(display=display) + super().__init__(display=display) self.start_datetimes = {} # Collect task start times self.url = None self.sumologic = SumologicHTTPCollectorSource() @@ -125,7 +125,7 @@ class CallbackModule(CallbackBase): ).total_seconds() def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) self.url = self.get_option('url') diff --git a/plugins/callback/syslog_json.py b/plugins/callback/syslog_json.py index 657ca017f6..3dc53c0c30 100644 --- a/plugins/callback/syslog_json.py +++ b/plugins/callback/syslog_json.py @@ -74,11 +74,11 @@ class CallbackModule(CallbackBase): def __init__(self): - super(CallbackModule, self).__init__() + super().__init__() def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) syslog_host = self.get_option("server") syslog_port = int(self.get_option("port")) diff --git a/plugins/callback/tasks_only.py b/plugins/callback/tasks_only.py index 3de81fc2db..7f9498cebe 100644 --- a/plugins/callback/tasks_only.py +++ b/plugins/callback/tasks_only.py @@ -61,7 +61,7 @@ class CallbackModule(Default): pass def set_options(self, *args, **kwargs): - result = super(CallbackModule, self).set_options(*args, **kwargs) + result = super().set_options(*args, **kwargs) self.number_of_columns = self.get_option("number_of_columns") if self.number_of_columns is not None: self._display.columns = self.number_of_columns diff --git a/plugins/callback/timestamp.py b/plugins/callback/timestamp.py index f733fa8cb7..a7de50ceff 100644 --- a/plugins/callback/timestamp.py +++ b/plugins/callback/timestamp.py @@ -104,13 +104,13 @@ class CallbackModule(Default): CALLBACK_NAME = "community.general.timestamp" def __init__(self): - super(CallbackModule, self).__init__() + super().__init__() # Replace the banner method of the display object with the custom one self._display.banner = types.MethodType(banner, self._display) def set_options(self, task_keys=None, var_options=None, direct=None): - super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct) + super().set_options(task_keys=task_keys, var_options=var_options, direct=direct) # Store zoneinfo for specified timezone if available tzinfo = None diff --git a/plugins/connection/chroot.py b/plugins/connection/chroot.py index 35f7312326..6c556e435f 100644 --- a/plugins/connection/chroot.py +++ b/plugins/connection/chroot.py @@ -99,7 +99,7 @@ class Connection(ConnectionBase): default_user = 'root' 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.chroot = self._play_context.remote_addr @@ -130,7 +130,7 @@ class Connection(ConnectionBase): except ValueError as e: raise AnsibleError(str(e)) - super(Connection, self)._connect() + super()._connect() if not self._connected: display.vvv("THIS IS A LOCAL CHROOT DIR", host=self.chroot) self._connected = True @@ -155,7 +155,7 @@ class Connection(ConnectionBase): def exec_command(self, cmd, in_data=None, sudoable=False): """ run a command on the chroot """ - super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) + super().exec_command(cmd, in_data=in_data, sudoable=sudoable) p = self._buffered_exec_command(cmd) @@ -179,7 +179,7 @@ class Connection(ConnectionBase): def put_file(self, in_path, out_path): """ transfer a file from local to chroot """ - 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.chroot) out_path = shlex_quote(self._prefix_login_path(out_path)) @@ -205,7 +205,7 @@ class Connection(ConnectionBase): def fetch_file(self, in_path, out_path): """ fetch a file from chroot 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.chroot) in_path = shlex_quote(self._prefix_login_path(in_path)) @@ -229,5 +229,5 @@ class Connection(ConnectionBase): def close(self): """ terminate the connection; nothing to do here """ - super(Connection, self).close() + super().close() self._connected = False diff --git a/plugins/connection/incus.py b/plugins/connection/incus.py index 5aecd45b6d..4de826dbc9 100644 --- a/plugins/connection/incus.py +++ b/plugins/connection/incus.py @@ -90,7 +90,7 @@ class Connection(ConnectionBase): has_pipelining = True 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._incus_cmd = get_bin_path("incus") @@ -99,7 +99,7 @@ class Connection(ConnectionBase): def _connect(self): """connect to Incus (nothing to do here) """ - super(Connection, self)._connect() + super()._connect() if not self._connected: self._display.vvv(f"ESTABLISH Incus CONNECTION FOR USER: {self.get_option('remote_user')}", @@ -137,7 +137,7 @@ class Connection(ConnectionBase): def exec_command(self, cmd, in_data=None, sudoable=True): """ execute a command on the Incus host """ - super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) + super().exec_command(cmd, in_data=in_data, sudoable=sudoable) self._display.vvv(f"EXEC {cmd}", host=self._instance()) @@ -207,7 +207,7 @@ class Connection(ConnectionBase): def put_file(self, in_path, out_path): """ put a file from local to Incus """ - super(Connection, self).put_file(in_path, out_path) + super().put_file(in_path, out_path) self._display.vvv(f"PUT {in_path} TO {out_path}", host=self._instance()) @@ -251,7 +251,7 @@ class Connection(ConnectionBase): def fetch_file(self, in_path, out_path): """ fetch a file from Incus to local """ - super(Connection, self).fetch_file(in_path, out_path) + super().fetch_file(in_path, out_path) self._display.vvv(f"FETCH {in_path} TO {out_path}", host=self._instance()) @@ -269,6 +269,6 @@ class Connection(ConnectionBase): def close(self): """ close the connection (nothing to do here) """ - super(Connection, self).close() + super().close() self._connected = False diff --git a/plugins/connection/iocage.py b/plugins/connection/iocage.py index fa4973bae1..e355b3be8f 100644 --- a/plugins/connection/iocage.py +++ b/plugins/connection/iocage.py @@ -60,7 +60,7 @@ class Connection(Jail): host=kwargs[Jail.modified_jailname_key] ) - super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs) + super().__init__(play_context, new_stdin, *args, **kwargs) def get_jail_uuid(self): p = subprocess.Popen([self.iocage_cmd, 'get', 'host_hostuuid', self.ioc_jail], diff --git a/plugins/connection/jail.py b/plugins/connection/jail.py index 7f25c3fe01..59e91e48c8 100644 --- a/plugins/connection/jail.py +++ b/plugins/connection/jail.py @@ -60,7 +60,7 @@ class Connection(ConnectionBase): has_tty = False 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.jail = self._play_context.remote_addr if self.modified_jailname_key in kwargs: @@ -93,7 +93,7 @@ class Connection(ConnectionBase): def _connect(self): """ connect to the jail; nothing to do here """ - super(Connection, self)._connect() + super()._connect() if not self._connected: display.vvv(f"ESTABLISH JAIL CONNECTION FOR USER: {self._play_context.remote_user}", host=self.jail) self._connected = True @@ -126,7 +126,7 @@ class Connection(ConnectionBase): def exec_command(self, cmd, in_data=None, sudoable=False): """ run a command on the jail """ - super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) + super().exec_command(cmd, in_data=in_data, sudoable=sudoable) p = self._buffered_exec_command(cmd) @@ -150,7 +150,7 @@ class Connection(ConnectionBase): def put_file(self, in_path, out_path): """ transfer a file from local to jail """ - 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.jail) out_path = shlex_quote(self._prefix_login_path(out_path)) @@ -176,7 +176,7 @@ class Connection(ConnectionBase): def fetch_file(self, in_path, out_path): """ fetch a file from jail 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.jail) in_path = shlex_quote(self._prefix_login_path(in_path)) @@ -200,5 +200,5 @@ class Connection(ConnectionBase): def close(self): """ terminate the connection; nothing to do here """ - super(Connection, self).close() + super().close() self._connected = False diff --git a/plugins/connection/lxc.py b/plugins/connection/lxc.py index e8e28ed804..e88dbb75b6 100644 --- a/plugins/connection/lxc.py +++ b/plugins/connection/lxc.py @@ -58,14 +58,14 @@ class Connection(ConnectionBase): default_user = 'root' 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.container_name = None self.container = None def _connect(self): """ connect to the lxc; nothing to do here """ - super(Connection, self)._connect() + super()._connect() if not HAS_LIBLXC: msg = "lxc python bindings are not installed" @@ -118,7 +118,7 @@ class Connection(ConnectionBase): def exec_command(self, cmd, in_data=None, sudoable=False): """ run a command on the chroot """ - super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) + super().exec_command(cmd, in_data=in_data, sudoable=sudoable) # python2-lxc needs bytes. python3-lxc needs text. executable = to_native(self.get_option('executable'), errors='surrogate_or_strict') @@ -171,7 +171,7 @@ class Connection(ConnectionBase): def put_file(self, in_path, out_path): ''' transfer a file from local to lxc ''' - super(Connection, self).put_file(in_path, out_path) + super().put_file(in_path, out_path) self._display.vvv(f"PUT {in_path} TO {out_path}", host=self.container_name) in_path = to_bytes(in_path, errors='surrogate_or_strict') out_path = to_bytes(out_path, errors='surrogate_or_strict') @@ -199,7 +199,7 @@ class Connection(ConnectionBase): def fetch_file(self, in_path, out_path): ''' fetch a file from lxc to local ''' - super(Connection, self).fetch_file(in_path, out_path) + super().fetch_file(in_path, out_path) self._display.vvv(f"FETCH {in_path} TO {out_path}", host=self.container_name) in_path = to_bytes(in_path, errors='surrogate_or_strict') out_path = to_bytes(out_path, errors='surrogate_or_strict') @@ -230,5 +230,5 @@ class Connection(ConnectionBase): def close(self): ''' terminate the connection; nothing to do here ''' - super(Connection, self).close() + super().close() self._connected = False diff --git a/plugins/connection/lxd.py b/plugins/connection/lxd.py index e9930f76c7..f7f5deeb28 100644 --- a/plugins/connection/lxd.py +++ b/plugins/connection/lxd.py @@ -89,7 +89,7 @@ class Connection(ConnectionBase): has_pipelining = True 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) try: self._lxc_cmd = get_bin_path("lxc") @@ -102,7 +102,7 @@ class Connection(ConnectionBase): def _connect(self): """connect to lxd (nothing to do here) """ - super(Connection, self)._connect() + super()._connect() if not self._connected: self._display.vvv(f"ESTABLISH LXD CONNECTION FOR USER: {self.get_option('remote_user')}", host=self._host()) @@ -134,7 +134,7 @@ class Connection(ConnectionBase): def exec_command(self, cmd, in_data=None, sudoable=True): """ execute a command on the lxd host """ - super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) + super().exec_command(cmd, in_data=in_data, sudoable=sudoable) self._display.vvv(f"EXEC {cmd}", host=self._host()) @@ -181,7 +181,7 @@ class Connection(ConnectionBase): def put_file(self, in_path, out_path): """ put a file from local to lxd """ - super(Connection, self).put_file(in_path, out_path) + super().put_file(in_path, out_path) self._display.vvv(f"PUT {in_path} TO {out_path}", host=self._host()) @@ -225,7 +225,7 @@ class Connection(ConnectionBase): def fetch_file(self, in_path, out_path): """ fetch a file from lxd to local """ - super(Connection, self).fetch_file(in_path, out_path) + super().fetch_file(in_path, out_path) self._display.vvv(f"FETCH {in_path} TO {out_path}", host=self._host()) @@ -245,6 +245,6 @@ class Connection(ConnectionBase): def close(self): """ close the connection (nothing to do here) """ - super(Connection, self).close() + super().close() self._connected = False diff --git a/plugins/connection/qubes.py b/plugins/connection/qubes.py index 3969b1bd36..3b815c339b 100644 --- a/plugins/connection/qubes.py +++ b/plugins/connection/qubes.py @@ -57,7 +57,7 @@ class Connection(ConnectionBase): has_pipelining = True 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._remote_vmname = self._play_context.remote_addr self._connected = False @@ -103,13 +103,13 @@ class Connection(ConnectionBase): def _connect(self): """No persistent connection is being maintained.""" - super(Connection, self)._connect() + super()._connect() self._connected = True @ensure_connect # type: ignore # TODO: for some reason, the type infos for ensure_connect suck... def exec_command(self, cmd, in_data=None, sudoable=False): """Run specified command in a running QubesVM """ - super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) + super().exec_command(cmd, in_data=in_data, sudoable=sudoable) display.vvvv(f"CMD IS: {cmd}") @@ -120,7 +120,7 @@ class Connection(ConnectionBase): def put_file(self, in_path, out_path): """ Place a local file located in 'in_path' inside VM at 'out_path' """ - 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._remote_vmname) with open(in_path, "rb") as fobj: @@ -137,7 +137,7 @@ class Connection(ConnectionBase): def fetch_file(self, in_path, out_path): """Obtain file specified via 'in_path' from the container and place it at 'out_path' """ - 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._remote_vmname) # We are running in dom0 @@ -150,5 +150,5 @@ class Connection(ConnectionBase): def close(self): """ Closing the connection """ - super(Connection, self).close() + super().close() self._connected = False diff --git a/plugins/connection/saltstack.py b/plugins/connection/saltstack.py index b09ffcd787..69dd67bda8 100644 --- a/plugins/connection/saltstack.py +++ b/plugins/connection/saltstack.py @@ -39,7 +39,7 @@ class Connection(ConnectionBase): transport = 'community.general.saltstack' 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.host = self._play_context.remote_addr def _connect(self): @@ -52,7 +52,7 @@ class Connection(ConnectionBase): def exec_command(self, cmd, in_data=None, sudoable=False): """ run a command on the remote minion """ - super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) + super().exec_command(cmd, in_data=in_data, sudoable=sudoable) if in_data: raise errors.AnsibleError("Internal Error: this module does not support optimized module pipelining") @@ -76,7 +76,7 @@ class Connection(ConnectionBase): def put_file(self, in_path, out_path): """ transfer a file from local to remote """ - super(Connection, self).put_file(in_path, out_path) + super().put_file(in_path, out_path) out_path = self._normalize_path(out_path, '/') self._display.vvv(f"PUT {in_path} TO {out_path}", host=self.host) @@ -88,7 +88,7 @@ class Connection(ConnectionBase): def fetch_file(self, in_path, out_path): """ fetch a file from remote to local """ - super(Connection, self).fetch_file(in_path, out_path) + super().fetch_file(in_path, out_path) in_path = self._normalize_path(in_path, '/') self._display.vvv(f"FETCH {in_path} TO {out_path}", host=self.host) diff --git a/plugins/connection/wsl.py b/plugins/connection/wsl.py index 9f181afff2..9c2c0e9451 100644 --- a/plugins/connection/wsl.py +++ b/plugins/connection/wsl.py @@ -404,7 +404,7 @@ class Connection(ConnectionBase): _log_channel: str | None = None def __init__(self, play_context: PlayContext, new_stdin: io.TextIOWrapper | None = None, *args: t.Any, **kwargs: t.Any): - super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs) + super().__init__(play_context, new_stdin, *args, **kwargs) def _set_log_channel(self, name: str) -> None: """ Mimic paramiko.SSHClient.set_log_channel """ @@ -587,7 +587,7 @@ class Connection(ConnectionBase): cmd = self._build_wsl_command(cmd) - super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) # type: ignore[safe-super] + super().exec_command(cmd, in_data=in_data, sudoable=sudoable) # type: ignore[safe-super] bufsize = 4096 diff --git a/plugins/connection/zone.py b/plugins/connection/zone.py index 49b3188f44..5f6fb15479 100644 --- a/plugins/connection/zone.py +++ b/plugins/connection/zone.py @@ -49,7 +49,7 @@ class Connection(ConnectionBase): has_tty = False 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.zone = self._play_context.remote_addr @@ -96,7 +96,7 @@ class Connection(ConnectionBase): def _connect(self): """ connect to the zone; nothing to do here """ - super(Connection, self)._connect() + super()._connect() if not self._connected: display.vvv("THIS IS A LOCAL ZONE DIR", host=self.zone) self._connected = True @@ -123,7 +123,7 @@ class Connection(ConnectionBase): def exec_command(self, cmd, in_data=None, sudoable=False): """ run a command on the zone """ - super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) + super().exec_command(cmd, in_data=in_data, sudoable=sudoable) p = self._buffered_exec_command(cmd) @@ -146,7 +146,7 @@ class Connection(ConnectionBase): def put_file(self, in_path, out_path): """ transfer a file from local to zone """ - 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.zone) out_path = shlex_quote(self._prefix_login_path(out_path)) @@ -172,7 +172,7 @@ class Connection(ConnectionBase): def fetch_file(self, in_path, out_path): """ fetch a file from zone 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.zone) in_path = shlex_quote(self._prefix_login_path(in_path)) @@ -196,5 +196,5 @@ class Connection(ConnectionBase): def close(self): """ terminate the connection; nothing to do here """ - super(Connection, self).close() + super().close() self._connected = False diff --git a/plugins/inventory/cobbler.py b/plugins/inventory/cobbler.py index 7374193a74..06cd3493fc 100644 --- a/plugins/inventory/cobbler.py +++ b/plugins/inventory/cobbler.py @@ -147,7 +147,7 @@ except ImportError: class TimeoutTransport (xmlrpc_client.SafeTransport): def __init__(self, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): - super(TimeoutTransport, self).__init__() + super().__init__() self._timeout = timeout self.context = None @@ -163,7 +163,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable): NAME = 'community.general.cobbler' def __init__(self): - super(InventoryModule, self).__init__() + super().__init__() self.cache_key = None if not HAS_XMLRPC_CLIENT: @@ -171,7 +171,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable): def verify_file(self, path): valid = False - if super(InventoryModule, self).verify_file(path): + if super().verify_file(path): if path.endswith(('cobbler.yaml', 'cobbler.yml')): valid = True else: @@ -242,7 +242,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable): def parse(self, inventory, loader, path, cache=True): - super(InventoryModule, self).parse(inventory, loader, path) + super().parse(inventory, loader, path) # read config from file, this sets 'options' self._read_config_data(path) diff --git a/plugins/inventory/gitlab_runners.py b/plugins/inventory/gitlab_runners.py index 4a2b32680e..b482968c5f 100644 --- a/plugins/inventory/gitlab_runners.py +++ b/plugins/inventory/gitlab_runners.py @@ -128,12 +128,12 @@ class InventoryModule(BaseInventoryPlugin, Constructable): def verify_file(self, path): """Return the possibly of a file being consumable by this plugin.""" return ( - super(InventoryModule, self).verify_file(path) and + super().verify_file(path) and path.endswith(("gitlab_runners.yaml", "gitlab_runners.yml"))) def parse(self, inventory, loader, path, cache=True): if not HAS_GITLAB: raise AnsibleError('The GitLab runners dynamic inventory plugin requires python-gitlab: https://python-gitlab.readthedocs.io/en/stable/') - super(InventoryModule, self).parse(inventory, loader, path, cache) + super().parse(inventory, loader, path, cache) self._read_config_data(path) self._populate() diff --git a/plugins/inventory/icinga2.py b/plugins/inventory/icinga2.py index 017959f403..658087b107 100644 --- a/plugins/inventory/icinga2.py +++ b/plugins/inventory/icinga2.py @@ -110,7 +110,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable): def __init__(self): - super(InventoryModule, self).__init__() + super().__init__() # from config self.icinga2_url = None @@ -126,7 +126,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable): def verify_file(self, path): valid = False - if super(InventoryModule, self).verify_file(path): + if super().verify_file(path): if path.endswith(('icinga2.yaml', 'icinga2.yml')): valid = True else: @@ -274,7 +274,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable): def parse(self, inventory, loader, path, cache=True): - super(InventoryModule, self).parse(inventory, loader, path) + super().parse(inventory, loader, path) # read config from file, this sets 'options' self._read_config_data(path) diff --git a/plugins/inventory/incus.py b/plugins/inventory/incus.py index 8dde3adba3..a9e3c572cd 100644 --- a/plugins/inventory/incus.py +++ b/plugins/inventory/incus.py @@ -97,12 +97,12 @@ class InventoryModule(BaseInventoryPlugin, Constructable): NAME = "community.general.incus" def __init__(self): - super(InventoryModule, self).__init__() + super().__init__() def verify_file(self, path): valid = False - if super(InventoryModule, self).verify_file(path): + if super().verify_file(path): if path.endswith(("incus.yaml", "incus.yml")): valid = True else: @@ -113,7 +113,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable): return valid def parse(self, inventory, loader, path, cache=True): - super(InventoryModule, self).parse(inventory, loader, path) + super().parse(inventory, loader, path) self._read_config_data(path) diff --git a/plugins/inventory/iocage.py b/plugins/inventory/iocage.py index 9d4cef4a03..4e981583ae 100644 --- a/plugins/inventory/iocage.py +++ b/plugins/inventory/iocage.py @@ -214,11 +214,11 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): IOCAGE = '/usr/local/bin/iocage' def __init__(self): - super(InventoryModule, self).__init__() + super().__init__() def verify_file(self, path): valid = False - if super(InventoryModule, self).verify_file(path): + if super().verify_file(path): if path.endswith(('iocage.yaml', 'iocage.yml')): valid = True else: @@ -226,7 +226,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): return valid def parse(self, inventory, loader, path, cache=True): - super(InventoryModule, self).parse(inventory, loader, path) + super().parse(inventory, loader, path) self._read_config_data(path) cache_key = self.get_cache_key(path) diff --git a/plugins/inventory/linode.py b/plugins/inventory/linode.py index fc039b03b5..520d536b66 100644 --- a/plugins/inventory/linode.py +++ b/plugins/inventory/linode.py @@ -286,7 +286,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): Returns: bool(valid): is valid config file""" valid = False - if super(InventoryModule, self).verify_file(path): + if super().verify_file(path): if path.endswith(("linode.yaml", "linode.yml")): valid = True else: @@ -295,7 +295,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def parse(self, inventory, loader, path, cache=True): """Dynamically parse Linode the cloud inventory.""" - super(InventoryModule, self).parse(inventory, loader, path) + super().parse(inventory, loader, path) self.instances = None if not HAS_LINODE: diff --git a/plugins/inventory/lxd.py b/plugins/inventory/lxd.py index ce7cf71ede..94622d4b94 100644 --- a/plugins/inventory/lxd.py +++ b/plugins/inventory/lxd.py @@ -259,7 +259,7 @@ class InventoryModule(BaseInventoryPlugin): Returns: bool(valid): is valid""" valid = False - if super(InventoryModule, self).verify_file(path): + if super().verify_file(path): if path.endswith(('lxd.yaml', 'lxd.yml')): valid = True else: @@ -1096,7 +1096,7 @@ class InventoryModule(BaseInventoryPlugin): if IPADDRESS_IMPORT_ERROR: raise AnsibleError('another_library must be installed to use this plugin') from IPADDRESS_IMPORT_ERROR - super(InventoryModule, self).parse(inventory, loader, path, cache=False) + super().parse(inventory, loader, path, cache=False) # Read the inventory YAML file self._read_config_data(path) try: diff --git a/plugins/inventory/nmap.py b/plugins/inventory/nmap.py index ea0ce560fd..d68d0bb3ec 100644 --- a/plugins/inventory/nmap.py +++ b/plugins/inventory/nmap.py @@ -145,7 +145,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def __init__(self): self._nmap = None - super(InventoryModule, self).__init__() + super().__init__() def _populate(self, hosts): # Use constructed if applicable @@ -170,7 +170,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def verify_file(self, path): valid = False - if super(InventoryModule, self).verify_file(path): + if super().verify_file(path): file_name, ext = os.path.splitext(path) if not ext or ext in C.YAML_FILENAME_EXTENSIONS: @@ -185,7 +185,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): except ValueError as e: raise AnsibleParserError(f'nmap inventory plugin requires the nmap cli tool to work: {e}') - super(InventoryModule, self).parse(inventory, loader, path, cache=cache) + super().parse(inventory, loader, path, cache=cache) self._read_config_data(path) diff --git a/plugins/inventory/online.py b/plugins/inventory/online.py index cbc46a6723..b88dd31494 100644 --- a/plugins/inventory/online.py +++ b/plugins/inventory/online.py @@ -220,7 +220,7 @@ class InventoryModule(BaseInventoryPlugin): self.inventory.add_host(group=group, host=hostname) def parse(self, inventory, loader, path, cache=True): - super(InventoryModule, self).parse(inventory, loader, path) + super().parse(inventory, loader, path) self._read_config_data(path=path) token = self.get_option("oauth_token") diff --git a/plugins/inventory/opennebula.py b/plugins/inventory/opennebula.py index 26f7a21d88..18007d9775 100644 --- a/plugins/inventory/opennebula.py +++ b/plugins/inventory/opennebula.py @@ -104,7 +104,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable): def verify_file(self, path): valid = False - if super(InventoryModule, self).verify_file(path): + if super().verify_file(path): if path.endswith(('opennebula.yaml', 'opennebula.yml')): valid = True return valid @@ -248,7 +248,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable): if not HAS_PYONE: raise AnsibleError('OpenNebula Inventory plugin requires pyone to work!') - super(InventoryModule, self).parse(inventory, loader, path) + super().parse(inventory, loader, path) self._read_config_data(path=path) self._populate() diff --git a/plugins/inventory/scaleway.py b/plugins/inventory/scaleway.py index 8b01acb60b..6653a42681 100644 --- a/plugins/inventory/scaleway.py +++ b/plugins/inventory/scaleway.py @@ -338,7 +338,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable): def parse(self, inventory, loader, path, cache=True): if YAML_IMPORT_ERROR: raise AnsibleError('PyYAML is probably missing') from YAML_IMPORT_ERROR - super(InventoryModule, self).parse(inventory, loader, path) + super().parse(inventory, loader, path) self._read_config_data(path=path) config_zones = self.get_option("regions") diff --git a/plugins/inventory/virtualbox.py b/plugins/inventory/virtualbox.py index 564db57dac..041ba29077 100644 --- a/plugins/inventory/virtualbox.py +++ b/plugins/inventory/virtualbox.py @@ -92,7 +92,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def __init__(self): self._vbox_path = None - super(InventoryModule, self).__init__() + super().__init__() def _query_vbox_data(self, host, property_path): ret = None @@ -302,7 +302,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def verify_file(self, path): valid = False - if super(InventoryModule, self).verify_file(path): + if super().verify_file(path): if path.endswith(('virtualbox.yaml', 'virtualbox.yml', 'vbox.yaml', 'vbox.yml')): valid = True return valid @@ -314,7 +314,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): except ValueError as e: raise AnsibleParserError(e) - super(InventoryModule, self).parse(inventory, loader, path) + super().parse(inventory, loader, path) cache_key = self.get_cache_key(path) diff --git a/plugins/inventory/xen_orchestra.py b/plugins/inventory/xen_orchestra.py index fc0f0db757..810c5c2234 100644 --- a/plugins/inventory/xen_orchestra.py +++ b/plugins/inventory/xen_orchestra.py @@ -136,7 +136,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def __init__(self): - super(InventoryModule, self).__init__() + super().__init__() # from config self.counter = -1 @@ -347,7 +347,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def verify_file(self, path): valid = False - if super(InventoryModule, self).verify_file(path): + if super().verify_file(path): if path.endswith(('xen_orchestra.yaml', 'xen_orchestra.yml')): valid = True else: @@ -360,7 +360,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): raise AnsibleError('This plugin requires websocket-client 1.0.0 or higher: ' 'https://github.com/websocket-client/websocket-client.') - super(InventoryModule, self).parse(inventory, loader, path) + super().parse(inventory, loader, path) # read config from file, this sets 'options' self._read_config_data(path) diff --git a/plugins/lookup/chef_databag.py b/plugins/lookup/chef_databag.py index 69a53d007e..9382ee0809 100644 --- a/plugins/lookup/chef_databag.py +++ b/plugins/lookup/chef_databag.py @@ -58,7 +58,7 @@ class LookupModule(LookupBase): """ def __init__(self, loader=None, templar=None, **kwargs): - super(LookupModule, self).__init__(loader, templar, **kwargs) + super().__init__(loader, templar, **kwargs) # setup vars for data bag name and data bag item self.name = None diff --git a/plugins/lookup/passwordstore.py b/plugins/lookup/passwordstore.py index 31305d81bb..e0912ad397 100644 --- a/plugins/lookup/passwordstore.py +++ b/plugins/lookup/passwordstore.py @@ -302,7 +302,7 @@ def check_output2(*popenargs, **kwargs): class LookupModule(LookupBase): def __init__(self, loader=None, templar=None, **kwargs): - super(LookupModule, self).__init__(loader, templar, **kwargs) + super().__init__(loader, templar, **kwargs) self.realpass = None def is_real_pass(self): diff --git a/plugins/lookup/tss.py b/plugins/lookup/tss.py index ba819bab4c..1d39d1b3a8 100644 --- a/plugins/lookup/tss.py +++ b/plugins/lookup/tss.py @@ -358,7 +358,7 @@ class TSSClient(metaclass=abc.ABCMeta): # noqa: B024 class TSSClientV0(TSSClient): def __init__(self, **server_parameters): - super(TSSClientV0, self).__init__() + super().__init__() if server_parameters.get("domain"): raise AnsibleError("The 'domain' option requires 'python-tss-sdk' version 1.0.0 or greater") @@ -374,7 +374,7 @@ class TSSClientV0(TSSClient): class TSSClientV1(TSSClient): def __init__(self, **server_parameters): - super(TSSClientV1, self).__init__() + super().__init__() authorizer = self._get_authorizer(**server_parameters) self._client = SecretServer( diff --git a/plugins/module_utils/cmd_runner.py b/plugins/module_utils/cmd_runner.py index aa7c395fea..0571b7577d 100644 --- a/plugins/module_utils/cmd_runner.py +++ b/plugins/module_utils/cmd_runner.py @@ -54,7 +54,7 @@ class FormatError(CmdRunnerException): self.value = value self.args_formats = args_formats self.exc = exc - super(FormatError, self).__init__() + super().__init__() def __repr__(self): return f"FormatError({self.name!r}, {self.value!r}, {self.args_formats!r}, {self.exc!r})" diff --git a/plugins/module_utils/django.py b/plugins/module_utils/django.py index 908a6b7ce7..c39ac88ed8 100644 --- a/plugins/module_utils/django.py +++ b/plugins/module_utils/django.py @@ -85,16 +85,16 @@ class _DjangoRunner(PythonRunner): arg_fmts = dict(arg_formats) if arg_formats else {} arg_fmts.update(_django_std_arg_fmts) - super(_DjangoRunner, self).__init__(module, ["-m", "django"], arg_formats=arg_fmts, **kwargs) + super().__init__(module, ["-m", "django"], arg_formats=arg_fmts, **kwargs) def __call__(self, output_process=None, check_mode_skip=False, check_mode_return=None, **kwargs): args_order = ( ("command", "no_color", "settings", "pythonpath", "traceback", "verbosity", "skip_checks") + self._prepare_args_order(self.default_args_order) ) - return super(_DjangoRunner, self).__call__(args_order, output_process, check_mode_skip=check_mode_skip, check_mode_return=check_mode_return, **kwargs) + return super().__call__(args_order, output_process, check_mode_skip=check_mode_skip, check_mode_return=check_mode_return, **kwargs) def bare_context(self, *args, **kwargs): - return super(_DjangoRunner, self).__call__(*args, **kwargs) + return super().__call__(*args, **kwargs) class DjangoModuleHelper(ModuleHelper): @@ -109,7 +109,7 @@ class DjangoModuleHelper(ModuleHelper): self.module["argument_spec"], self.arg_formats = self._build_args(self.module.get("argument_spec", {}), self.arg_formats, *(["std"] + self._django_args)) - super(DjangoModuleHelper, self).__init__(self.module) + super().__init__(self.module) if self.django_admin_cmd is not None: self.vars.command = self.django_admin_cmd diff --git a/plugins/module_utils/hwc_utils.py b/plugins/module_utils/hwc_utils.py index 5d01602735..c9d554c284 100644 --- a/plugins/module_utils/hwc_utils.py +++ b/plugins/module_utils/hwc_utils.py @@ -25,7 +25,7 @@ from ansible.module_utils.common.text.converters import to_text class HwcModuleException(Exception): def __init__(self, message): - super(HwcModuleException, self).__init__() + super().__init__() self._message = message @@ -35,7 +35,7 @@ class HwcModuleException(Exception): class HwcClientException(Exception): def __init__(self, code, message): - super(HwcClientException, self).__init__() + super().__init__() self._code = code self._message = message @@ -47,7 +47,7 @@ class HwcClientException(Exception): class HwcClientException404(HwcClientException): def __init__(self, message): - super(HwcClientException404, self).__init__(404, message) + super().__init__(404, message) def __str__(self): return f"[HwcClientException404] message={self._message}" @@ -249,7 +249,7 @@ class HwcModule(AnsibleModule): ) ) - super(HwcModule, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) class _DictComparison: diff --git a/plugins/module_utils/mh/exceptions.py b/plugins/module_utils/mh/exceptions.py index d703b2676a..2d14555188 100644 --- a/plugins/module_utils/mh/exceptions.py +++ b/plugins/module_utils/mh/exceptions.py @@ -16,4 +16,4 @@ class ModuleHelperException(Exception): if update_output is None: update_output = {} self.update_output: dict[str, t.Any] = update_output - super(ModuleHelperException, self).__init__(*args) + super().__init__(*args) diff --git a/plugins/module_utils/mh/module_helper.py b/plugins/module_utils/mh/module_helper.py index cc9f88705a..684e46924f 100644 --- a/plugins/module_utils/mh/module_helper.py +++ b/plugins/module_utils/mh/module_helper.py @@ -26,7 +26,7 @@ class ModuleHelper(DeprecateAttrsMixin, ModuleHelperBase): facts_params: Sequence[str] = () def __init__(self, module=None): - super(ModuleHelper, self).__init__(module) + super().__init__(module) self.vars = VarDict() for name, value in self.module.params.items(): diff --git a/plugins/module_utils/oneview.py b/plugins/module_utils/oneview.py index 6b33f2df77..9738e9203e 100644 --- a/plugins/module_utils/oneview.py +++ b/plugins/module_utils/oneview.py @@ -151,7 +151,7 @@ class OneViewModuleTaskError(OneViewModuleException): """ def __init__(self, msg, error_code=None): - super(OneViewModuleTaskError, self).__init__(msg) + super().__init__(msg) self.error_code = error_code diff --git a/plugins/module_utils/python_runner.py b/plugins/module_utils/python_runner.py index 7d9b94f50e..9b6de1c326 100644 --- a/plugins/module_utils/python_runner.py +++ b/plugins/module_utils/python_runner.py @@ -30,5 +30,5 @@ class PythonRunner(CmdRunner): python_cmd = [self.python] + _ensure_list(command) - super(PythonRunner, self).__init__(module, python_cmd, arg_formats, default_args_order, - check_rc, force_lang, path_prefix, environ_update) + super().__init__(module, python_cmd, arg_formats, default_args_order, + check_rc, force_lang, path_prefix, environ_update) diff --git a/plugins/module_utils/utm_utils.py b/plugins/module_utils/utm_utils.py index 2e7432fb38..89ae06693a 100644 --- a/plugins/module_utils/utm_utils.py +++ b/plugins/module_utils/utm_utils.py @@ -21,7 +21,7 @@ from ansible.module_utils.urls import fetch_url class UTMModuleConfigurationError(Exception): def __init__(self, msg, **args): - super(UTMModuleConfigurationError, self).__init__(self, msg) + super().__init__(self, msg) self.msg = msg self.module_fail_args = args @@ -49,9 +49,9 @@ class UTMModule(AnsibleModule): validate_certs=dict(type='bool', required=False, default=True), state=dict(default='present', choices=['present', 'absent']) ) - super(UTMModule, self).__init__(self._merge_specs(default_specs, argument_spec), bypass_checks, no_log, - mutually_exclusive, required_together, required_one_of, - add_file_common_args, supports_check_mode, required_if) + super().__init__(self._merge_specs(default_specs, argument_spec), bypass_checks, no_log, + mutually_exclusive, required_together, required_one_of, + add_file_common_args, supports_check_mode, required_if) def _merge_specs(self, default_specs, custom_specs): result = default_specs.copy() diff --git a/plugins/module_utils/vardict.py b/plugins/module_utils/vardict.py index ce0b99ee62..cb94408d48 100644 --- a/plugins/module_utils/vardict.py +++ b/plugins/module_utils/vardict.py @@ -120,11 +120,11 @@ class VarDict: try: return self.__vars__[item].value except KeyError: - return getattr(super(VarDict, self), item) + return getattr(super(), item) def __setattr__(self, key, value): if key == '__vars__': - super(VarDict, self).__setattr__(key, value) + super().__setattr__(key, value) else: self.set(key, value) diff --git a/plugins/module_utils/wdc_redfish_utils.py b/plugins/module_utils/wdc_redfish_utils.py index 564be3829e..2d5a0db7a8 100644 --- a/plugins/module_utils/wdc_redfish_utils.py +++ b/plugins/module_utils/wdc_redfish_utils.py @@ -48,12 +48,12 @@ class WdcRedfishUtils(RedfishUtils): module, resource_id, data_modification): - super(WdcRedfishUtils, self).__init__(creds=creds, - root_uri=root_uris[0], - timeout=timeout, - module=module, - resource_id=resource_id, - data_modification=data_modification) + super().__init__(creds=creds, + root_uri=root_uris[0], + timeout=timeout, + module=module, + resource_id=resource_id, + data_modification=data_modification) # Update the root URI if we cannot perform a Redfish GET to the first one self._set_root_uri(root_uris) @@ -72,7 +72,7 @@ class WdcRedfishUtils(RedfishUtils): def _find_updateservice_resource(self): """Find the update service resource as well as additional WDC-specific resources.""" - response = super(WdcRedfishUtils, self)._find_updateservice_resource() + response = super()._find_updateservice_resource() if not response['ret']: return response return self._find_updateservice_additional_uris() diff --git a/plugins/modules/archive.py b/plugins/modules/archive.py index 129e621dca..f931a92525 100644 --- a/plugins/modules/archive.py +++ b/plugins/modules/archive.py @@ -484,7 +484,7 @@ class Archive(metaclass=abc.ABCMeta): class ZipArchive(Archive): def __init__(self, module): - super(ZipArchive, self).__init__(module) + super().__init__(module) def close(self): self.file.close() @@ -515,7 +515,7 @@ class ZipArchive(Archive): class TarArchive(Archive): def __init__(self, module): - super(TarArchive, self).__init__(module) + super().__init__(module) self.fileIO = None def close(self): diff --git a/plugins/modules/bitbucket_pipeline_variable.py b/plugins/modules/bitbucket_pipeline_variable.py index 67fda53e5c..2394ba6c1e 100644 --- a/plugins/modules/bitbucket_pipeline_variable.py +++ b/plugins/modules/bitbucket_pipeline_variable.py @@ -201,7 +201,7 @@ class BitBucketPipelineVariable(AnsibleModule): params = _load_params() or {} if params.get('secured'): kwargs['argument_spec']['value'].update({'no_log': True}) - super(BitBucketPipelineVariable, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def main(): diff --git a/plugins/modules/consul_agent_check.py b/plugins/modules/consul_agent_check.py index 72a48e86d4..f4a9f8ad8a 100644 --- a/plugins/modules/consul_agent_check.py +++ b/plugins/modules/consul_agent_check.py @@ -206,7 +206,7 @@ class ConsulAgentCheckModule(_ConsulModule): if operation == OPERATION_DELETE: return f"{self.api_endpoint}/deregister/{identifier}" - return super(ConsulAgentCheckModule, self).endpoint_url(operation, identifier) + return super().endpoint_url(operation, identifier) def read_object(self): url = self.endpoint_url(OPERATION_READ) @@ -217,7 +217,7 @@ class ConsulAgentCheckModule(_ConsulModule): return None def prepare_object(self, existing, obj): - existing = super(ConsulAgentCheckModule, self).prepare_object(existing, obj) + existing = super().prepare_object(existing, obj) validate_check(existing) return existing diff --git a/plugins/modules/consul_agent_service.py b/plugins/modules/consul_agent_service.py index ba59d7a007..ca09f74842 100644 --- a/plugins/modules/consul_agent_service.py +++ b/plugins/modules/consul_agent_service.py @@ -234,10 +234,10 @@ class ConsulAgentServiceModule(_ConsulModule): if operation == OPERATION_DELETE: return f"{self.api_endpoint}/deregister/{identifier}" - return super(ConsulAgentServiceModule, self).endpoint_url(operation, identifier) + return super().endpoint_url(operation, identifier) def prepare_object(self, existing, obj): - existing = super(ConsulAgentServiceModule, self).prepare_object(existing, obj) + existing = super().prepare_object(existing, obj) if "ServicePort" in existing: existing["Port"] = existing.pop("ServicePort") @@ -257,7 +257,7 @@ class ConsulAgentServiceModule(_ConsulModule): if "ServicePort" in module_obj: module_obj["Port"] = module_obj.pop("ServicePort") - return super(ConsulAgentServiceModule, self).needs_update(api_obj, module_obj) + return super().needs_update(api_obj, module_obj) def delete_object(self, obj): if not self._module.check_mode: diff --git a/plugins/modules/consul_auth_method.py b/plugins/modules/consul_auth_method.py index e96f1a3c2f..b5920d8673 100644 --- a/plugins/modules/consul_auth_method.py +++ b/plugins/modules/consul_auth_method.py @@ -170,12 +170,12 @@ class ConsulAuthMethodModule(_ConsulModule): def map_param(self, k, v, is_update): if k == "config" and v: v = {camel_case_key(k2): v2 for k2, v2 in v.items()} - return super(ConsulAuthMethodModule, self).map_param(k, v, is_update) + return super().map_param(k, v, is_update) def needs_update(self, api_obj, module_obj): if "MaxTokenTTL" in module_obj: module_obj["MaxTokenTTL"] = normalize_ttl(module_obj["MaxTokenTTL"]) - return super(ConsulAuthMethodModule, self).needs_update(api_obj, module_obj) + return super().needs_update(api_obj, module_obj) _ARGUMENT_SPEC = { diff --git a/plugins/modules/consul_binding_rule.py b/plugins/modules/consul_binding_rule.py index 20b8133666..70cd56d8d7 100644 --- a/plugins/modules/consul_binding_rule.py +++ b/plugins/modules/consul_binding_rule.py @@ -141,12 +141,12 @@ class ConsulBindingRuleModule(_ConsulModule): raise def module_to_obj(self, is_update): - obj = super(ConsulBindingRuleModule, self).module_to_obj(is_update) + obj = super().module_to_obj(is_update) del obj["Name"] return obj def prepare_object(self, existing, obj): - final = super(ConsulBindingRuleModule, self).prepare_object(existing, obj) + final = super().prepare_object(existing, obj) name = self.params["name"] description = final.pop("Description", "").split(": ", 1)[-1] final["Description"] = f"{name}: {description}" diff --git a/plugins/modules/consul_policy.py b/plugins/modules/consul_policy.py index 95d2ac48d0..8f1ed1ba55 100644 --- a/plugins/modules/consul_policy.py +++ b/plugins/modules/consul_policy.py @@ -146,7 +146,7 @@ class ConsulPolicyModule(_ConsulModule): def endpoint_url(self, operation, identifier=None): if operation == OPERATION_READ: return [self.api_endpoint, "name", self.params["name"]] - return super(ConsulPolicyModule, self).endpoint_url(operation, identifier) + return super().endpoint_url(operation, identifier) def main(): diff --git a/plugins/modules/consul_role.py b/plugins/modules/consul_role.py index 968de022a2..2054f048d8 100644 --- a/plugins/modules/consul_role.py +++ b/plugins/modules/consul_role.py @@ -217,7 +217,7 @@ class ConsulRoleModule(_ConsulModule): def endpoint_url(self, operation, identifier=None): if operation == OPERATION_READ: return [self.api_endpoint, "name", self.params["name"]] - return super(ConsulRoleModule, self).endpoint_url(operation, identifier) + return super().endpoint_url(operation, identifier) NAME_ID_SPEC = dict( diff --git a/plugins/modules/consul_token.py b/plugins/modules/consul_token.py index cbe49ee2af..596bc26257 100644 --- a/plugins/modules/consul_token.py +++ b/plugins/modules/consul_token.py @@ -236,7 +236,7 @@ class ConsulTokenModule(_ConsulModule): # if `accessor_id` is not supplied we can only create objects and are not idempotent if not self.id_from_obj(self.params): return None - return super(ConsulTokenModule, self).read_object() + return super().read_object() def needs_update(self, api_obj, module_obj): # SecretID is usually not supplied @@ -248,7 +248,7 @@ class ConsulTokenModule(_ConsulModule): # it writes to ExpirationTime, so we need to remove that as well if "ExpirationTTL" in module_obj: del module_obj["ExpirationTTL"] - return super(ConsulTokenModule, self).needs_update(api_obj, module_obj) + return super().needs_update(api_obj, module_obj) NAME_ID_SPEC = dict( diff --git a/plugins/modules/crypttab.py b/plugins/modules/crypttab.py index 862fc2c503..31937954d8 100644 --- a/plugins/modules/crypttab.py +++ b/plugins/modules/crypttab.py @@ -289,7 +289,7 @@ class Options(dict): """opts_string looks like: 'discard,foo=bar,baz=greeble' """ def __init__(self, opts_string): - super(Options, self).__init__() + super().__init__() self.itemlist = [] if opts_string is not None: for opt in opts_string.split(','): @@ -334,11 +334,11 @@ class Options(dict): def __setitem__(self, key, value): if key not in self: self.itemlist.append(key) - super(Options, self).__setitem__(key, value) + super().__setitem__(key, value) def __delitem__(self, key): self.itemlist.remove(key) - super(Options, self).__delitem__(key) + super().__delitem__(key) def __ne__(self, obj): return not (isinstance(obj, Options) and sorted(self.items()) == sorted(obj.items())) diff --git a/plugins/modules/dimensiondata_network.py b/plugins/modules/dimensiondata_network.py index cecb7afbdb..966ea83f40 100644 --- a/plugins/modules/dimensiondata_network.py +++ b/plugins/modules/dimensiondata_network.py @@ -138,7 +138,7 @@ class DimensionDataNetworkModule(DimensionDataModule): Create a new Dimension Data network module. """ - super(DimensionDataNetworkModule, self).__init__( + super().__init__( module=AnsibleModule( argument_spec=DimensionDataModule.argument_spec_with_wait( name=dict(type='str', required=True), diff --git a/plugins/modules/dimensiondata_vlan.py b/plugins/modules/dimensiondata_vlan.py index 84699e4f3b..0e3c96ed18 100644 --- a/plugins/modules/dimensiondata_vlan.py +++ b/plugins/modules/dimensiondata_vlan.py @@ -180,7 +180,7 @@ class DimensionDataVlanModule(DimensionDataModule): Create a new Dimension Data VLAN module. """ - super(DimensionDataVlanModule, self).__init__( + super().__init__( module=AnsibleModule( argument_spec=DimensionDataModule.argument_spec_with_wait( name=dict(required=True, type='str'), diff --git a/plugins/modules/filesystem.py b/plugins/modules/filesystem.py index a25ecfd616..f0b108dd78 100644 --- a/plugins/modules/filesystem.py +++ b/plugins/modules/filesystem.py @@ -444,7 +444,7 @@ class Btrfs(Filesystem): GROW_MOUNTPOINT_ONLY = True def __init__(self, module): - super(Btrfs, self).__init__(module) + super().__init__(module) mkfs = self.module.get_bin_path(self.MKFS, required=True) dummy, stdout, stderr = self.module.run_command([mkfs, '--version'], check_rc=True) match = re.search(r" v([0-9.]+)", stdout) @@ -485,7 +485,7 @@ class F2fs(Filesystem): GROW = 'resize.f2fs' def __init__(self, module): - super(F2fs, self).__init__(module) + super().__init__(module) mkfs = self.module.get_bin_path(self.MKFS, required=True) dummy, out, dummy = self.module.run_command([mkfs, os.devnull], check_rc=False, environ_update=self.LANG_ENV) # Looking for " F2FS-tools: mkfs.f2fs Ver: 1.10.0 (2018-01-30)" @@ -523,7 +523,7 @@ class VFAT(Filesystem): GROW_MAX_SPACE_FLAGS = ['-s', 'max'] def __init__(self, module): - super(VFAT, self).__init__(module) + super().__init__(module) if platform.system() == 'FreeBSD': self.MKFS = 'newfs_msdos' else: diff --git a/plugins/modules/ipa_config.py b/plugins/modules/ipa_config.py index ffa035d6e9..33f3e1aec5 100644 --- a/plugins/modules/ipa_config.py +++ b/plugins/modules/ipa_config.py @@ -236,7 +236,7 @@ from ansible.module_utils.common.text.converters import to_native class ConfigIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(ConfigIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def config_show(self): return self._post_json(method='config_show', name=None) diff --git a/plugins/modules/ipa_dnsrecord.py b/plugins/modules/ipa_dnsrecord.py index 2507cc7f14..e57ba6415e 100644 --- a/plugins/modules/ipa_dnsrecord.py +++ b/plugins/modules/ipa_dnsrecord.py @@ -204,7 +204,7 @@ from ansible.module_utils.common.text.converters import to_native class DNSRecordIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(DNSRecordIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def dnsrecord_find(self, zone_name, record_name): if record_name == '@': diff --git a/plugins/modules/ipa_dnszone.py b/plugins/modules/ipa_dnszone.py index 57faaef955..daa3720277 100644 --- a/plugins/modules/ipa_dnszone.py +++ b/plugins/modules/ipa_dnszone.py @@ -91,7 +91,7 @@ from ansible.module_utils.common.text.converters import to_native class DNSZoneIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(DNSZoneIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def dnszone_find(self, zone_name, details=None): items = {'all': 'true', diff --git a/plugins/modules/ipa_group.py b/plugins/modules/ipa_group.py index 2c004c8bb7..df3b257cf0 100644 --- a/plugins/modules/ipa_group.py +++ b/plugins/modules/ipa_group.py @@ -177,7 +177,7 @@ from ansible.module_utils.common.text.converters import to_native class GroupIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(GroupIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def group_find(self, name): return self._post_json(method='group_find', name=None, item={'all': True, 'cn': name}) diff --git a/plugins/modules/ipa_hbacrule.py b/plugins/modules/ipa_hbacrule.py index 67e39bbe98..56ba837b22 100644 --- a/plugins/modules/ipa_hbacrule.py +++ b/plugins/modules/ipa_hbacrule.py @@ -163,7 +163,7 @@ from ansible_collections.community.general.plugins.module_utils.version import L class HBACRuleIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(HBACRuleIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def hbacrule_find(self, name): return self._post_json(method='hbacrule_find', name=None, item={'all': True, 'cn': name}) diff --git a/plugins/modules/ipa_host.py b/plugins/modules/ipa_host.py index 4ac926a9b3..8d12178845 100644 --- a/plugins/modules/ipa_host.py +++ b/plugins/modules/ipa_host.py @@ -191,7 +191,7 @@ from ansible.module_utils.common.text.converters import to_native class HostIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(HostIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def host_show(self, name): return self._post_json(method='host_show', name=name) diff --git a/plugins/modules/ipa_hostgroup.py b/plugins/modules/ipa_hostgroup.py index f4f40d0bd9..41bd489b47 100644 --- a/plugins/modules/ipa_hostgroup.py +++ b/plugins/modules/ipa_hostgroup.py @@ -104,7 +104,7 @@ from ansible.module_utils.common.text.converters import to_native class HostGroupIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(HostGroupIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def hostgroup_find(self, name): return self._post_json(method='hostgroup_find', name=None, item={'all': True, 'cn': name}) diff --git a/plugins/modules/ipa_otpconfig.py b/plugins/modules/ipa_otpconfig.py index a260cc7a13..6956497fb0 100644 --- a/plugins/modules/ipa_otpconfig.py +++ b/plugins/modules/ipa_otpconfig.py @@ -87,7 +87,7 @@ from ansible.module_utils.common.text.converters import to_native class OTPConfigIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(OTPConfigIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def otpconfig_show(self): return self._post_json(method='otpconfig_show', name=None) diff --git a/plugins/modules/ipa_otptoken.py b/plugins/modules/ipa_otptoken.py index d8f2aca150..ab697176f3 100644 --- a/plugins/modules/ipa_otptoken.py +++ b/plugins/modules/ipa_otptoken.py @@ -178,7 +178,7 @@ from ansible.module_utils.common.text.converters import to_native class OTPTokenIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(OTPTokenIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def otptoken_find(self, name): return self._post_json(method='otptoken_find', name=None, item={'all': True, diff --git a/plugins/modules/ipa_pwpolicy.py b/plugins/modules/ipa_pwpolicy.py index 10650a49dd..796b921dbe 100644 --- a/plugins/modules/ipa_pwpolicy.py +++ b/plugins/modules/ipa_pwpolicy.py @@ -164,7 +164,7 @@ from ansible.module_utils.common.text.converters import to_native class PwPolicyIPAClient(IPAClient): '''The global policy will be selected when `name` is `None`''' def __init__(self, module, host, port, protocol): - super(PwPolicyIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def pwpolicy_find(self, name): if name is None: diff --git a/plugins/modules/ipa_role.py b/plugins/modules/ipa_role.py index 130036ebd1..8730e1156e 100644 --- a/plugins/modules/ipa_role.py +++ b/plugins/modules/ipa_role.py @@ -140,7 +140,7 @@ from ansible.module_utils.common.text.converters import to_native class RoleIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(RoleIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def role_find(self, name): return self._post_json(method='role_find', name=None, item={'all': True, 'cn': name}) diff --git a/plugins/modules/ipa_service.py b/plugins/modules/ipa_service.py index 089d49fc88..b721889b28 100644 --- a/plugins/modules/ipa_service.py +++ b/plugins/modules/ipa_service.py @@ -99,7 +99,7 @@ from ansible.module_utils.common.text.converters import to_native class ServiceIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(ServiceIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def service_find(self, name): return self._post_json(method='service_find', name=None, item={'all': True, 'krbcanonicalname': name}) diff --git a/plugins/modules/ipa_subca.py b/plugins/modules/ipa_subca.py index f057db8a8d..f296acb97b 100644 --- a/plugins/modules/ipa_subca.py +++ b/plugins/modules/ipa_subca.py @@ -87,7 +87,7 @@ from ansible_collections.community.general.plugins.module_utils.version import L class SubCAIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(SubCAIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def subca_find(self, subca_name): return self._post_json(method='ca_find', name=subca_name, item=None) diff --git a/plugins/modules/ipa_sudocmd.py b/plugins/modules/ipa_sudocmd.py index 1aabeb07a3..ac2607bd7a 100644 --- a/plugins/modules/ipa_sudocmd.py +++ b/plugins/modules/ipa_sudocmd.py @@ -72,7 +72,7 @@ from ansible.module_utils.common.text.converters import to_native class SudoCmdIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(SudoCmdIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def sudocmd_find(self, name): return self._post_json(method='sudocmd_find', name=None, item={'all': True, 'sudocmd': name}) diff --git a/plugins/modules/ipa_sudocmdgroup.py b/plugins/modules/ipa_sudocmdgroup.py index af3f4c9547..4ceb072f1b 100644 --- a/plugins/modules/ipa_sudocmdgroup.py +++ b/plugins/modules/ipa_sudocmdgroup.py @@ -81,7 +81,7 @@ from ansible.module_utils.common.text.converters import to_native class SudoCmdGroupIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(SudoCmdGroupIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def sudocmdgroup_find(self, name): return self._post_json(method='sudocmdgroup_find', name=None, item={'all': True, 'cn': name}) diff --git a/plugins/modules/ipa_sudorule.py b/plugins/modules/ipa_sudorule.py index 96ea6bfa30..7befb354bc 100644 --- a/plugins/modules/ipa_sudorule.py +++ b/plugins/modules/ipa_sudorule.py @@ -205,7 +205,7 @@ from ansible_collections.community.general.plugins.module_utils.version import L class SudoRuleIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(SudoRuleIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def sudorule_find(self, name): return self._post_json(method='sudorule_find', name=None, item={'all': True, 'cn': name}) diff --git a/plugins/modules/ipa_user.py b/plugins/modules/ipa_user.py index 4e01414b30..0b3a84832d 100644 --- a/plugins/modules/ipa_user.py +++ b/plugins/modules/ipa_user.py @@ -188,7 +188,7 @@ from ansible.module_utils.common.text.converters import to_native class UserIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(UserIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def user_find(self, name): return self._post_json(method='user_find', name=None, item={'all': True, 'uid': name}) diff --git a/plugins/modules/ipa_vault.py b/plugins/modules/ipa_vault.py index 54cbdce235..2b01687211 100644 --- a/plugins/modules/ipa_vault.py +++ b/plugins/modules/ipa_vault.py @@ -143,7 +143,7 @@ from ansible.module_utils.common.text.converters import to_native class VaultIPAClient(IPAClient): def __init__(self, module, host, port, protocol): - super(VaultIPAClient, self).__init__(module, host, port, protocol) + super().__init__(module, host, port, protocol) def vault_find(self, name): return self._post_json(method='vault_find', name=None, item={'all': True, 'cn': name}) diff --git a/plugins/modules/launchd.py b/plugins/modules/launchd.py index 55579675fa..47777e2732 100644 --- a/plugins/modules/launchd.py +++ b/plugins/modules/launchd.py @@ -354,7 +354,7 @@ class LaunchCtlTask(metaclass=ABCMeta): class LaunchCtlStart(LaunchCtlTask): def __init__(self, module, service, plist): - super(LaunchCtlStart, self).__init__(module, service, plist) + super().__init__(module, service, plist) def runCommand(self): state, dummy, dummy, dummy = self.get_state() @@ -381,7 +381,7 @@ class LaunchCtlStart(LaunchCtlTask): class LaunchCtlStop(LaunchCtlTask): def __init__(self, module, service, plist): - super(LaunchCtlStop, self).__init__(module, service, plist) + super().__init__(module, service, plist) def runCommand(self): state, dummy, dummy, dummy = self.get_state() @@ -408,7 +408,7 @@ class LaunchCtlStop(LaunchCtlTask): class LaunchCtlReload(LaunchCtlTask): def __init__(self, module, service, plist): - super(LaunchCtlReload, self).__init__(module, service, plist) + super().__init__(module, service, plist) def runCommand(self): state, dummy, dummy, dummy = self.get_state() @@ -423,7 +423,7 @@ class LaunchCtlReload(LaunchCtlTask): class LaunchCtlUnload(LaunchCtlTask): def __init__(self, module, service, plist): - super(LaunchCtlUnload, self).__init__(module, service, plist) + super().__init__(module, service, plist) def runCommand(self): state, dummy, dummy, dummy = self.get_state() @@ -432,16 +432,16 @@ class LaunchCtlUnload(LaunchCtlTask): class LaunchCtlRestart(LaunchCtlReload): def __init__(self, module, service, plist): - super(LaunchCtlRestart, self).__init__(module, service, plist) + super().__init__(module, service, plist) def runCommand(self): - super(LaunchCtlRestart, self).runCommand() + super().runCommand() self.start() class LaunchCtlList(LaunchCtlTask): def __init__(self, module, service): - super(LaunchCtlList, self).__init__(module, service, None) + super().__init__(module, service, None) def runCommand(self): # Do nothing, the list functionality is done by the diff --git a/plugins/modules/monit.py b/plugins/modules/monit.py index f903cbdd42..ff42022465 100644 --- a/plugins/modules/monit.py +++ b/plugins/modules/monit.py @@ -81,7 +81,7 @@ class StatusValue(namedtuple("Status", "value, is_pending")): ] def __new__(cls, value, is_pending=False): - return super(StatusValue, cls).__new__(cls, value, is_pending) + return super().__new__(cls, value, is_pending) def pending(self): return StatusValue(self.value, True) diff --git a/plugins/modules/oneview_datacenter_info.py b/plugins/modules/oneview_datacenter_info.py index cf9f10af79..3edc67343f 100644 --- a/plugins/modules/oneview_datacenter_info.py +++ b/plugins/modules/oneview_datacenter_info.py @@ -128,7 +128,7 @@ class DatacenterInfoModule(OneViewModuleBase): ) def __init__(self): - super(DatacenterInfoModule, self).__init__( + super().__init__( additional_arg_spec=self.argument_spec, supports_check_mode=True, ) diff --git a/plugins/modules/oneview_enclosure_info.py b/plugins/modules/oneview_enclosure_info.py index b57c8210f4..16745a2e0f 100644 --- a/plugins/modules/oneview_enclosure_info.py +++ b/plugins/modules/oneview_enclosure_info.py @@ -182,7 +182,7 @@ class EnclosureInfoModule(OneViewModuleBase): ) def __init__(self): - super(EnclosureInfoModule, self).__init__( + super().__init__( additional_arg_spec=self.argument_spec, supports_check_mode=True, ) diff --git a/plugins/modules/oneview_ethernet_network.py b/plugins/modules/oneview_ethernet_network.py index f931e66a9b..2d423964a7 100644 --- a/plugins/modules/oneview_ethernet_network.py +++ b/plugins/modules/oneview_ethernet_network.py @@ -147,7 +147,7 @@ class EthernetNetworkModule(OneViewModuleBase): data=dict(type='dict', required=True), ) - super(EthernetNetworkModule, self).__init__(additional_arg_spec=argument_spec, validate_etag_support=True) + super().__init__(additional_arg_spec=argument_spec, validate_etag_support=True) self.resource_client = self.oneview_client.ethernet_networks diff --git a/plugins/modules/oneview_ethernet_network_info.py b/plugins/modules/oneview_ethernet_network_info.py index 9528323fcf..c963175e49 100644 --- a/plugins/modules/oneview_ethernet_network_info.py +++ b/plugins/modules/oneview_ethernet_network_info.py @@ -122,7 +122,7 @@ class EthernetNetworkInfoModule(OneViewModuleBase): ) def __init__(self): - super(EthernetNetworkInfoModule, self).__init__( + super().__init__( additional_arg_spec=self.argument_spec, supports_check_mode=True, ) diff --git a/plugins/modules/oneview_fc_network.py b/plugins/modules/oneview_fc_network.py index 0b20a96625..d6563157cd 100644 --- a/plugins/modules/oneview_fc_network.py +++ b/plugins/modules/oneview_fc_network.py @@ -98,8 +98,7 @@ class FcNetworkModule(OneViewModuleBase): required=True, choices=['present', 'absent'])) - super(FcNetworkModule, self).__init__(additional_arg_spec=additional_arg_spec, - validate_etag_support=True) + super().__init__(additional_arg_spec=additional_arg_spec, validate_etag_support=True) self.resource_client = self.oneview_client.fc_networks diff --git a/plugins/modules/oneview_fc_network_info.py b/plugins/modules/oneview_fc_network_info.py index 525659e207..19c1e2af03 100644 --- a/plugins/modules/oneview_fc_network_info.py +++ b/plugins/modules/oneview_fc_network_info.py @@ -89,7 +89,7 @@ class FcNetworkInfoModule(OneViewModuleBase): params=dict(type='dict') ) - super(FcNetworkInfoModule, self).__init__( + super().__init__( additional_arg_spec=argument_spec, supports_check_mode=True, ) diff --git a/plugins/modules/oneview_fcoe_network.py b/plugins/modules/oneview_fcoe_network.py index 0212ea0b64..8e4502a355 100644 --- a/plugins/modules/oneview_fcoe_network.py +++ b/plugins/modules/oneview_fcoe_network.py @@ -94,8 +94,7 @@ class FcoeNetworkModule(OneViewModuleBase): state=dict(default='present', choices=['present', 'absent'])) - super(FcoeNetworkModule, self).__init__(additional_arg_spec=additional_arg_spec, - validate_etag_support=True) + super().__init__(additional_arg_spec=additional_arg_spec, validate_etag_support=True) self.resource_client = self.oneview_client.fcoe_networks diff --git a/plugins/modules/oneview_fcoe_network_info.py b/plugins/modules/oneview_fcoe_network_info.py index b1b4f49fda..c1ab8a8c07 100644 --- a/plugins/modules/oneview_fcoe_network_info.py +++ b/plugins/modules/oneview_fcoe_network_info.py @@ -87,7 +87,7 @@ class FcoeNetworkInfoModule(OneViewModuleBase): params=dict(type='dict'), ) - super(FcoeNetworkInfoModule, self).__init__( + super().__init__( additional_arg_spec=argument_spec, supports_check_mode=True, ) diff --git a/plugins/modules/oneview_logical_interconnect_group.py b/plugins/modules/oneview_logical_interconnect_group.py index 9f33726e8c..8da2be4aaf 100644 --- a/plugins/modules/oneview_logical_interconnect_group.py +++ b/plugins/modules/oneview_logical_interconnect_group.py @@ -119,8 +119,7 @@ class LogicalInterconnectGroupModule(OneViewModuleBase): data=dict(required=True, type='dict') ) - super(LogicalInterconnectGroupModule, self).__init__(additional_arg_spec=argument_spec, - validate_etag_support=True) + super().__init__(additional_arg_spec=argument_spec, validate_etag_support=True) self.resource_client = self.oneview_client.logical_interconnect_groups def execute_module(self): diff --git a/plugins/modules/oneview_logical_interconnect_group_info.py b/plugins/modules/oneview_logical_interconnect_group_info.py index 25a278b15a..d7914879b6 100644 --- a/plugins/modules/oneview_logical_interconnect_group_info.py +++ b/plugins/modules/oneview_logical_interconnect_group_info.py @@ -101,7 +101,7 @@ class LogicalInterconnectGroupInfoModule(OneViewModuleBase): params=dict(type='dict'), ) - super(LogicalInterconnectGroupInfoModule, self).__init__( + super().__init__( additional_arg_spec=argument_spec, supports_check_mode=True, ) diff --git a/plugins/modules/oneview_network_set.py b/plugins/modules/oneview_network_set.py index a7a9592a5b..e768662851 100644 --- a/plugins/modules/oneview_network_set.py +++ b/plugins/modules/oneview_network_set.py @@ -109,8 +109,7 @@ class NetworkSetModule(OneViewModuleBase): data=dict(required=True, type='dict')) def __init__(self): - super(NetworkSetModule, self).__init__(additional_arg_spec=self.argument_spec, - validate_etag_support=True) + super().__init__(additional_arg_spec=self.argument_spec, validate_etag_support=True) self.resource_client = self.oneview_client.network_sets def execute_module(self): diff --git a/plugins/modules/oneview_network_set_info.py b/plugins/modules/oneview_network_set_info.py index 0eb6ebc790..55053a90ea 100644 --- a/plugins/modules/oneview_network_set_info.py +++ b/plugins/modules/oneview_network_set_info.py @@ -141,7 +141,7 @@ class NetworkSetInfoModule(OneViewModuleBase): ) def __init__(self): - super(NetworkSetInfoModule, self).__init__( + super().__init__( additional_arg_spec=self.argument_spec, supports_check_mode=True, ) diff --git a/plugins/modules/oneview_san_manager.py b/plugins/modules/oneview_san_manager.py index 105aca72ac..f77457e07b 100644 --- a/plugins/modules/oneview_san_manager.py +++ b/plugins/modules/oneview_san_manager.py @@ -145,7 +145,7 @@ class SanManagerModule(OneViewModuleBase): ) def __init__(self): - super(SanManagerModule, self).__init__(additional_arg_spec=self.argument_spec, validate_etag_support=True) + super().__init__(additional_arg_spec=self.argument_spec, validate_etag_support=True) self.resource_client = self.oneview_client.san_managers def execute_module(self): diff --git a/plugins/modules/oneview_san_manager_info.py b/plugins/modules/oneview_san_manager_info.py index e158a40533..86d16491a3 100644 --- a/plugins/modules/oneview_san_manager_info.py +++ b/plugins/modules/oneview_san_manager_info.py @@ -95,7 +95,7 @@ class SanManagerInfoModule(OneViewModuleBase): ) def __init__(self): - super(SanManagerInfoModule, self).__init__( + super().__init__( additional_arg_spec=self.argument_spec, supports_check_mode=True, ) diff --git a/plugins/modules/online_server_info.py b/plugins/modules/online_server_info.py index 25019a826a..7177076b96 100644 --- a/plugins/modules/online_server_info.py +++ b/plugins/modules/online_server_info.py @@ -137,7 +137,7 @@ from ansible_collections.community.general.plugins.module_utils.online import ( class OnlineServerInfo(Online): def __init__(self, module): - super(OnlineServerInfo, self).__init__(module) + super().__init__(module) self.name = 'api/v1/server' def _get_server_detail(self, server_path): diff --git a/plugins/modules/online_user_info.py b/plugins/modules/online_user_info.py index 61b2c23ae8..2d7f2866bb 100644 --- a/plugins/modules/online_user_info.py +++ b/plugins/modules/online_user_info.py @@ -54,7 +54,7 @@ from ansible_collections.community.general.plugins.module_utils.online import ( class OnlineUserInfo(Online): def __init__(self, module): - super(OnlineUserInfo, self).__init__(module) + super().__init__(module) self.name = 'api/v1/user' diff --git a/plugins/modules/pamd.py b/plugins/modules/pamd.py index f0eb8f9e27..2410723392 100644 --- a/plugins/modules/pamd.py +++ b/plugins/modules/pamd.py @@ -277,7 +277,7 @@ class PamdEmptyLine(PamdLine): class PamdComment(PamdLine): def __init__(self, line): - super(PamdComment, self).__init__(line) + super().__init__(line) @property def is_valid(self): @@ -288,7 +288,7 @@ class PamdComment(PamdLine): class PamdInclude(PamdLine): def __init__(self, line): - super(PamdInclude, self).__init__(line) + super().__init__(line) @property def is_valid(self): diff --git a/plugins/modules/pids.py b/plugins/modules/pids.py index 437180c02a..2040299717 100644 --- a/plugins/modules/pids.py +++ b/plugins/modules/pids.py @@ -139,7 +139,7 @@ class PSAdapter(metaclass=abc.ABCMeta): class PSAdapter100(PSAdapter): def __init__(self, psutil): - super(PSAdapter100, self).__init__(psutil) + super().__init__(psutil) @staticmethod def _get_attribute_from_proc(proc, attribute): @@ -148,7 +148,7 @@ class PSAdapter100(PSAdapter): class PSAdapter200(PSAdapter): def __init__(self, psutil): - super(PSAdapter200, self).__init__(psutil) + super().__init__(psutil) @staticmethod def _get_attribute_from_proc(proc, attribute): @@ -158,7 +158,7 @@ class PSAdapter200(PSAdapter): class PSAdapter530(PSAdapter): def __init__(self, psutil): - super(PSAdapter530, self).__init__(psutil) + super().__init__(psutil) def _process_iter(self, *attrs): return self._psutil.process_iter(attrs=attrs) diff --git a/plugins/modules/scaleway_image_info.py b/plugins/modules/scaleway_image_info.py index 9cffb1aca0..d8761abef4 100644 --- a/plugins/modules/scaleway_image_info.py +++ b/plugins/modules/scaleway_image_info.py @@ -107,7 +107,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import class ScalewayImageInfo(Scaleway): def __init__(self, module): - super(ScalewayImageInfo, self).__init__(module) + super().__init__(module) self.name = 'images' region = module.params["region"] diff --git a/plugins/modules/scaleway_ip_info.py b/plugins/modules/scaleway_ip_info.py index 36196583cf..60dd8da62d 100644 --- a/plugins/modules/scaleway_ip_info.py +++ b/plugins/modules/scaleway_ip_info.py @@ -91,7 +91,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import class ScalewayIpInfo(Scaleway): def __init__(self, module): - super(ScalewayIpInfo, self).__init__(module) + super().__init__(module) self.name = 'ips' region = module.params["region"] diff --git a/plugins/modules/scaleway_organization_info.py b/plugins/modules/scaleway_organization_info.py index 873d15b794..57717f4c6c 100644 --- a/plugins/modules/scaleway_organization_info.py +++ b/plugins/modules/scaleway_organization_info.py @@ -82,7 +82,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import class ScalewayOrganizationInfo(Scaleway): def __init__(self, module): - super(ScalewayOrganizationInfo, self).__init__(module) + super().__init__(module) self.name = 'organizations' diff --git a/plugins/modules/scaleway_security_group_info.py b/plugins/modules/scaleway_security_group_info.py index 7ec1fe5b3f..6bbbd9b62a 100644 --- a/plugins/modules/scaleway_security_group_info.py +++ b/plugins/modules/scaleway_security_group_info.py @@ -95,7 +95,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import class ScalewaySecurityGroupInfo(Scaleway): def __init__(self, module): - super(ScalewaySecurityGroupInfo, self).__init__(module) + super().__init__(module) self.name = 'security_groups' region = module.params["region"] diff --git a/plugins/modules/scaleway_server_info.py b/plugins/modules/scaleway_server_info.py index 16a0fc17e3..85f23ee77e 100644 --- a/plugins/modules/scaleway_server_info.py +++ b/plugins/modules/scaleway_server_info.py @@ -177,7 +177,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import class ScalewayServerInfo(Scaleway): def __init__(self, module): - super(ScalewayServerInfo, self).__init__(module) + super().__init__(module) self.name = 'servers' region = module.params["region"] diff --git a/plugins/modules/scaleway_snapshot_info.py b/plugins/modules/scaleway_snapshot_info.py index e59f9e3262..df932ee6d1 100644 --- a/plugins/modules/scaleway_snapshot_info.py +++ b/plugins/modules/scaleway_snapshot_info.py @@ -95,7 +95,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import class ScalewaySnapshotInfo(Scaleway): def __init__(self, module): - super(ScalewaySnapshotInfo, self).__init__(module) + super().__init__(module) self.name = 'snapshots' region = module.params["region"] diff --git a/plugins/modules/scaleway_volume_info.py b/plugins/modules/scaleway_volume_info.py index b5b26360c3..8e418968fa 100644 --- a/plugins/modules/scaleway_volume_info.py +++ b/plugins/modules/scaleway_volume_info.py @@ -90,7 +90,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import class ScalewayVolumeInfo(Scaleway): def __init__(self, module): - super(ScalewayVolumeInfo, self).__init__(module) + super().__init__(module) self.name = 'volumes' region = module.params["region"] diff --git a/plugins/modules/timezone.py b/plugins/modules/timezone.py index 920432cc44..29cd4b7b27 100644 --- a/plugins/modules/timezone.py +++ b/plugins/modules/timezone.py @@ -132,7 +132,7 @@ class Timezone: Args: module: The AnsibleModule. """ - super(Timezone, self).__init__() + super().__init__() self.msg = [] # `self.value` holds the values for each params on each phases. # Initially there's only info of "planned" phase, but the @@ -266,7 +266,7 @@ class SystemdTimezone(Timezone): ) def __init__(self, module): - super(SystemdTimezone, self).__init__(module) + super().__init__(module) self.timedatectl = module.get_bin_path('timedatectl', required=True) self.status = dict() # Validate given timezone @@ -339,7 +339,7 @@ class NosystemdTimezone(Timezone): ) def __init__(self, module): - super(NosystemdTimezone, self).__init__(module) + super().__init__(module) # Validate given timezone planned_tz = '' if 'name' in self.value: @@ -592,7 +592,7 @@ class SmartOSTimezone(Timezone): """ def __init__(self, module): - super(SmartOSTimezone, self).__init__(module) + super().__init__(module) self.settimezone = self.module.get_bin_path('sm-set-timezone', required=False) if not self.settimezone: module.fail_json(msg='sm-set-timezone not found. Make sure the smtools package is installed.') @@ -645,7 +645,7 @@ class DarwinTimezone(Timezone): ) def __init__(self, module): - super(DarwinTimezone, self).__init__(module) + super().__init__(module) self.systemsetup = module.get_bin_path('systemsetup', required=True) self.status = dict() # Validate given timezone @@ -690,7 +690,7 @@ class BSDTimezone(Timezone): """ def __init__(self, module): - super(BSDTimezone, self).__init__(module) + super().__init__(module) def __get_timezone(self): zoneinfo_dir = '/usr/share/zoneinfo/' @@ -780,7 +780,7 @@ class AIXTimezone(Timezone): """ def __init__(self, module): - super(AIXTimezone, self).__init__(module) + super().__init__(module) self.settimezone = self.module.get_bin_path('chtz', required=True) def __get_timezone(self): diff --git a/plugins/modules/xenserver_guest.py b/plugins/modules/xenserver_guest.py index ffa4c7a18d..f7ad4baf54 100644 --- a/plugins/modules/xenserver_guest.py +++ b/plugins/modules/xenserver_guest.py @@ -565,7 +565,7 @@ class XenServerVM(XenServerObject): Args: module: Reference to Ansible module object. """ - super(XenServerVM, self).__init__(module) + super().__init__(module) self.vm_ref = get_object_ref(self.module, self.module.params['name'], self.module.params['uuid'], obj_type="VM", fail=False, msg_prefix="VM search: ") self.gather_params() diff --git a/plugins/modules/xenserver_guest_info.py b/plugins/modules/xenserver_guest_info.py index f9a4d01adf..989150e71d 100644 --- a/plugins/modules/xenserver_guest_info.py +++ b/plugins/modules/xenserver_guest_info.py @@ -168,7 +168,7 @@ class XenServerVM(XenServerObject): Args: module: Reference to AnsibleModule object. """ - super(XenServerVM, self).__init__(module) + super().__init__(module) self.vm_ref = get_object_ref(self.module, self.module.params['name'], self.module.params['uuid'], obj_type="VM", fail=True, msg_prefix="VM search: ") self.gather_params() diff --git a/plugins/modules/xenserver_guest_powerstate.py b/plugins/modules/xenserver_guest_powerstate.py index 56f4145711..3a74820b9b 100644 --- a/plugins/modules/xenserver_guest_powerstate.py +++ b/plugins/modules/xenserver_guest_powerstate.py @@ -196,7 +196,7 @@ class XenServerVM(XenServerObject): Args: module: Reference to Ansible module object. """ - super(XenServerVM, self).__init__(module) + super().__init__(module) self.vm_ref = get_object_ref(self.module, self.module.params['name'], self.module.params['uuid'], obj_type="VM", fail=True, msg_prefix="VM search: ") self.gather_params() diff --git a/ruff.toml b/ruff.toml index 98e89682cb..e6435b76ac 100644 --- a/ruff.toml +++ b/ruff.toml @@ -27,7 +27,6 @@ ignore = [ "F841", # Unused variable "UP006", # Use `dict` instead of `t.Dict` for type annotation "UP007", # Use `X | Y` for type annotations - "UP008", # Use `super()` instead of `super(__class__, self)` "UP009", # UTF-8 encoding declaration is unnecessary "UP014", # Convert `xxx` from `NamedTuple` functional to class syntax "UP018", # Unnecessary `str` call (rewrite as a literal) diff --git a/tests/unit/plugins/connection/test_lxc.py b/tests/unit/plugins/connection/test_lxc.py index 8bf2fb6780..2d257843a9 100644 --- a/tests/unit/plugins/connection/test_lxc.py +++ b/tests/unit/plugins/connection/test_lxc.py @@ -31,7 +31,7 @@ def lxc(request): _container_states = {} def __init__(self, name): - super(ContainerMock, self).__init__() + super().__init__() self.name = name @property diff --git a/tests/unit/plugins/module_utils/hwc/test_hwc_utils.py b/tests/unit/plugins/module_utils/hwc/test_hwc_utils.py index e9a6151e9d..b38549b4a3 100644 --- a/tests/unit/plugins/module_utils/hwc/test_hwc_utils.py +++ b/tests/unit/plugins/module_utils/hwc/test_hwc_utils.py @@ -12,7 +12,7 @@ from ansible_collections.community.general.plugins.module_utils.hwc_utils import class HwcUtilsTestCase(unittest.TestCase): def setUp(self): - super(HwcUtilsTestCase, self).setUp() + super().setUp() # Add backward compatibility if sys.version_info < (3, 0): diff --git a/tests/unit/plugins/module_utils/net_tools/pritunl/test_api.py b/tests/unit/plugins/module_utils/net_tools/pritunl/test_api.py index 491d07b86a..2bdd254cd2 100644 --- a/tests/unit/plugins/module_utils/net_tools/pritunl/test_api.py +++ b/tests/unit/plugins/module_utils/net_tools/pritunl/test_api.py @@ -340,7 +340,7 @@ class PritunlDeleteUserMock(MagicMock): class ModuleFailException(Exception): def __init__(self, msg, **kwargs): - super(ModuleFailException, self).__init__(msg) + super().__init__(msg) self.fail_msg = msg self.fail_kwargs = kwargs diff --git a/tests/unit/plugins/module_utils/xenserver/conftest.py b/tests/unit/plugins/module_utils/xenserver/conftest.py index 96c5ba47d6..77645179cc 100644 --- a/tests/unit/plugins/module_utils/xenserver/conftest.py +++ b/tests/unit/plugins/module_utils/xenserver/conftest.py @@ -79,7 +79,7 @@ def mock_xenapi_failure(XenAPI, mocker): # same side_effect as its parent mock object. class MagicMockSideEffect(MagicMock): def _get_child_mock(self, **kw): - child_mock = super(MagicMockSideEffect, self)._get_child_mock(**kw) + child_mock = super()._get_child_mock(**kw) child_mock.side_effect = self.side_effect return child_mock diff --git a/tests/unit/plugins/modules/test_alerta_customer.py b/tests/unit/plugins/modules/test_alerta_customer.py index e5265a1e85..e68ebe5b4e 100644 --- a/tests/unit/plugins/modules/test_alerta_customer.py +++ b/tests/unit/plugins/modules/test_alerta_customer.py @@ -69,11 +69,11 @@ def customer_response_page2(): class TestAlertaCustomerModule(ModuleTestCase): def setUp(self): - super(TestAlertaCustomerModule, self).setUp() + super().setUp() self.module = alerta_customer def tearDown(self): - super(TestAlertaCustomerModule, self).tearDown() + super().tearDown() @pytest.fixture def fetch_url_mock(self, mocker): diff --git a/tests/unit/plugins/modules/test_archive.py b/tests/unit/plugins/modules/test_archive.py index 187590f158..b4656824da 100644 --- a/tests/unit/plugins/modules/test_archive.py +++ b/tests/unit/plugins/modules/test_archive.py @@ -14,7 +14,7 @@ from ansible_collections.community.general.plugins.modules.archive import get_ar class TestArchive(ModuleTestCase): def setUp(self): - super(TestArchive, self).setUp() + super().setUp() self.mock_os_path_isdir = patch('os.path.isdir') self.os_path_isdir = self.mock_os_path_isdir.start() diff --git a/tests/unit/plugins/modules/test_bitbucket_access_key.py b/tests/unit/plugins/modules/test_bitbucket_access_key.py index 698c362d0c..bbf478c6fc 100644 --- a/tests/unit/plugins/modules/test_bitbucket_access_key.py +++ b/tests/unit/plugins/modules/test_bitbucket_access_key.py @@ -14,7 +14,7 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestBucketAccessKeyModule(ModuleTestCase): def setUp(self): - super(TestBucketAccessKeyModule, self).setUp() + super().setUp() self.module = bitbucket_access_key def test_missing_key_with_present_state(self): diff --git a/tests/unit/plugins/modules/test_bitbucket_pipeline_key_pair.py b/tests/unit/plugins/modules/test_bitbucket_pipeline_key_pair.py index d03edcf25b..ab140d40da 100644 --- a/tests/unit/plugins/modules/test_bitbucket_pipeline_key_pair.py +++ b/tests/unit/plugins/modules/test_bitbucket_pipeline_key_pair.py @@ -14,7 +14,7 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestBucketPipelineKeyPairModule(ModuleTestCase): def setUp(self): - super(TestBucketPipelineKeyPairModule, self).setUp() + super().setUp() self.module = bitbucket_pipeline_key_pair def test_missing_keys_with_present_state(self): diff --git a/tests/unit/plugins/modules/test_bitbucket_pipeline_known_host.py b/tests/unit/plugins/modules/test_bitbucket_pipeline_known_host.py index 973918c295..be85d9d485 100644 --- a/tests/unit/plugins/modules/test_bitbucket_pipeline_known_host.py +++ b/tests/unit/plugins/modules/test_bitbucket_pipeline_known_host.py @@ -17,7 +17,7 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestBucketPipelineKnownHostModule(ModuleTestCase): def setUp(self): - super(TestBucketPipelineKnownHostModule, self).setUp() + super().setUp() self.module = bitbucket_pipeline_known_host @pytest.mark.skipif(not HAS_PARAMIKO, reason='paramiko must be installed to test key creation') diff --git a/tests/unit/plugins/modules/test_bitbucket_pipeline_variable.py b/tests/unit/plugins/modules/test_bitbucket_pipeline_variable.py index 1a90dc5db4..7a898f36c0 100644 --- a/tests/unit/plugins/modules/test_bitbucket_pipeline_variable.py +++ b/tests/unit/plugins/modules/test_bitbucket_pipeline_variable.py @@ -14,7 +14,7 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestBucketPipelineVariableModule(ModuleTestCase): def setUp(self): - super(TestBucketPipelineVariableModule, self).setUp() + super().setUp() self.module = bitbucket_pipeline_variable def test_without_required_parameters(self): diff --git a/tests/unit/plugins/modules/test_bootc_manage.py b/tests/unit/plugins/modules/test_bootc_manage.py index bd7240c2f9..16dea94cc9 100644 --- a/tests/unit/plugins/modules/test_bootc_manage.py +++ b/tests/unit/plugins/modules/test_bootc_manage.py @@ -12,11 +12,11 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestBootcManageModule(ModuleTestCase): def setUp(self): - super(TestBootcManageModule, self).setUp() + super().setUp() self.module = bootc_manage def tearDown(self): - super(TestBootcManageModule, self).tearDown() + super().tearDown() def test_switch_without_image(self): """Failure if state is 'switch' but no image provided""" diff --git a/tests/unit/plugins/modules/test_campfire.py b/tests/unit/plugins/modules/test_campfire.py index 4a9e03e78b..50ef3446fa 100644 --- a/tests/unit/plugins/modules/test_campfire.py +++ b/tests/unit/plugins/modules/test_campfire.py @@ -13,11 +13,11 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestCampfireModule(ModuleTestCase): def setUp(self): - super(TestCampfireModule, self).setUp() + super().setUp() self.module = campfire def tearDown(self): - super(TestCampfireModule, self).tearDown() + super().tearDown() @pytest.fixture def fetch_url_mock(self, mocker): diff --git a/tests/unit/plugins/modules/test_circonus_annotation.py b/tests/unit/plugins/modules/test_circonus_annotation.py index 5240c72d2b..31a162334e 100644 --- a/tests/unit/plugins/modules/test_circonus_annotation.py +++ b/tests/unit/plugins/modules/test_circonus_annotation.py @@ -19,11 +19,11 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestCirconusAnnotation(ModuleTestCase): def setUp(self): - super(TestCirconusAnnotation, self).setUp() + super().setUp() self.module = circonus_annotation def tearDown(self): - super(TestCirconusAnnotation, self).tearDown() + super().tearDown() def test_without_required_parameters(self): """Failure must occurs when all parameters are missing""" diff --git a/tests/unit/plugins/modules/test_datadog_downtime.py b/tests/unit/plugins/modules/test_datadog_downtime.py index eb819bdcf8..9a102af329 100644 --- a/tests/unit/plugins/modules/test_datadog_downtime.py +++ b/tests/unit/plugins/modules/test_datadog_downtime.py @@ -22,11 +22,11 @@ DowntimeRecurrence = datadog_api_client.v1.model.downtime_recurrence.DowntimeRec class TestDatadogDowntime(ModuleTestCase): def setUp(self): - super(TestDatadogDowntime, self).setUp() + super().setUp() self.module = datadog_downtime def tearDown(self): - super(TestDatadogDowntime, self).tearDown() + super().tearDown() def test_without_required_parameters(self): """Failure must occurs when all parameters are missing""" diff --git a/tests/unit/plugins/modules/test_discord.py b/tests/unit/plugins/modules/test_discord.py index 8f4deb6ee1..8ce6101a48 100644 --- a/tests/unit/plugins/modules/test_discord.py +++ b/tests/unit/plugins/modules/test_discord.py @@ -16,11 +16,11 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestDiscordModule(ModuleTestCase): def setUp(self): - super(TestDiscordModule, self).setUp() + super().setUp() self.module = discord def tearDown(self): - super(TestDiscordModule, self).tearDown() + super().tearDown() @pytest.fixture def fetch_url_mock(self, mocker): diff --git a/tests/unit/plugins/modules/test_dnf_config_manager.py b/tests/unit/plugins/modules/test_dnf_config_manager.py index ca97e68502..94d246e85f 100644 --- a/tests/unit/plugins/modules/test_dnf_config_manager.py +++ b/tests/unit/plugins/modules/test_dnf_config_manager.py @@ -257,7 +257,7 @@ call_enable_crb = call(['/usr/bin/dnf', 'config-manager', '--assumeyes', '--set- class TestDNFConfigManager(ModuleTestCase): def setUp(self): - super(TestDNFConfigManager, self).setUp() + super().setUp() self.mock_run_command = (patch('ansible.module_utils.basic.AnsibleModule.run_command')) self.run_command = self.mock_run_command.start() self.mock_path_exists = (patch('os.path.exists')) @@ -266,7 +266,7 @@ class TestDNFConfigManager(ModuleTestCase): self.module = dnf_config_manager_module def tearDown(self): - super(TestDNFConfigManager, self).tearDown() + super().tearDown() self.mock_run_command.stop() self.mock_path_exists.stop() diff --git a/tests/unit/plugins/modules/test_dnsimple.py b/tests/unit/plugins/modules/test_dnsimple.py index c0f8a798b5..afc858df76 100644 --- a/tests/unit/plugins/modules/test_dnsimple.py +++ b/tests/unit/plugins/modules/test_dnsimple.py @@ -25,12 +25,12 @@ class TestDNSimple(ModuleTestCase): def setUp(self): """Setup.""" - super(TestDNSimple, self).setUp() + super().setUp() self.module = dnsimple_module def tearDown(self): """Teardown.""" - super(TestDNSimple, self).tearDown() + super().tearDown() def test_without_required_parameters(self): """Failure must occurs when all parameters are missing""" diff --git a/tests/unit/plugins/modules/test_dnsimple_info.py b/tests/unit/plugins/modules/test_dnsimple_info.py index 0af07c6fa3..4c89ff17ff 100644 --- a/tests/unit/plugins/modules/test_dnsimple_info.py +++ b/tests/unit/plugins/modules/test_dnsimple_info.py @@ -44,12 +44,12 @@ class TestDNSimple_Info(ModuleTestCase): def setUp(self): """Setup.""" - super(TestDNSimple_Info, self).setUp() + super().setUp() self.module = dnsimple_info def tearDown(self): """Teardown.""" - super(TestDNSimple_Info, self).tearDown() + super().tearDown() def test_with_no_parameters(self): """Failure must occurs when all parameters are missing""" diff --git a/tests/unit/plugins/modules/test_gem.py b/tests/unit/plugins/modules/test_gem.py index c5b4b1ccb1..c25045f812 100644 --- a/tests/unit/plugins/modules/test_gem.py +++ b/tests/unit/plugins/modules/test_gem.py @@ -20,7 +20,7 @@ def get_command(run_command): class TestGem(ModuleTestCase): def setUp(self): - super(TestGem, self).setUp() + super().setUp() self.rubygems_path = ['/usr/bin/gem'] self.mocker.patch( 'ansible_collections.community.general.plugins.modules.gem.get_rubygems_path', diff --git a/tests/unit/plugins/modules/test_gitlab_deploy_key.py b/tests/unit/plugins/modules/test_gitlab_deploy_key.py index 3f194a6f7c..9ea0d3cedf 100644 --- a/tests/unit/plugins/modules/test_gitlab_deploy_key.py +++ b/tests/unit/plugins/modules/test_gitlab_deploy_key.py @@ -45,7 +45,7 @@ except ImportError: class TestGitlabDeployKey(GitlabModuleTestCase): def setUp(self): - super(TestGitlabDeployKey, self).setUp() + super().setUp() self.moduleUtil = GitLabDeployKey(module=self.mock_module, gitlab_instance=self.gitlab_instance) diff --git a/tests/unit/plugins/modules/test_gitlab_group.py b/tests/unit/plugins/modules/test_gitlab_group.py index baf782a254..2526206007 100644 --- a/tests/unit/plugins/modules/test_gitlab_group.py +++ b/tests/unit/plugins/modules/test_gitlab_group.py @@ -47,7 +47,7 @@ except ImportError: class TestGitlabGroup(GitlabModuleTestCase): def setUp(self): - super(TestGitlabGroup, self).setUp() + super().setUp() self.moduleUtil = GitLabGroup(module=self.mock_module, gitlab_instance=self.gitlab_instance) diff --git a/tests/unit/plugins/modules/test_gitlab_group_access_token.py b/tests/unit/plugins/modules/test_gitlab_group_access_token.py index f3ffd382df..f728d0250f 100644 --- a/tests/unit/plugins/modules/test_gitlab_group_access_token.py +++ b/tests/unit/plugins/modules/test_gitlab_group_access_token.py @@ -54,7 +54,7 @@ except ImportError: class TestGitlabGroupAccessToken(GitlabModuleTestCase): @with_httmock(resp_get_user) def setUp(self): - super(TestGitlabGroupAccessToken, self).setUp() + super().setUp() if not python_gitlab_version_match_requirement(): self.skipTest(f"python-gitlab {'.'.join(map(str, PYTHON_GITLAB_MINIMAL_VERSION))}+ is needed for gitlab_group_access_token") diff --git a/tests/unit/plugins/modules/test_gitlab_hook.py b/tests/unit/plugins/modules/test_gitlab_hook.py index 633cd43df3..fc4a76c90d 100644 --- a/tests/unit/plugins/modules/test_gitlab_hook.py +++ b/tests/unit/plugins/modules/test_gitlab_hook.py @@ -45,7 +45,7 @@ except ImportError: class TestGitlabHook(GitlabModuleTestCase): def setUp(self): - super(TestGitlabHook, self).setUp() + super().setUp() self.moduleUtil = GitLabHook(module=self.mock_module, gitlab_instance=self.gitlab_instance) diff --git a/tests/unit/plugins/modules/test_gitlab_project.py b/tests/unit/plugins/modules/test_gitlab_project.py index b38d8b862d..2ef67fe553 100644 --- a/tests/unit/plugins/modules/test_gitlab_project.py +++ b/tests/unit/plugins/modules/test_gitlab_project.py @@ -48,7 +48,7 @@ except ImportError: class TestGitlabProject(GitlabModuleTestCase): @with_httmock(resp_get_user) def setUp(self): - super(TestGitlabProject, self).setUp() + super().setUp() self.gitlab_instance.user = self.gitlab_instance.users.get(1) self.moduleUtil = GitLabProject(module=self.mock_module, gitlab_instance=self.gitlab_instance) diff --git a/tests/unit/plugins/modules/test_gitlab_project_access_token.py b/tests/unit/plugins/modules/test_gitlab_project_access_token.py index 138d462e48..df7bd4ecf3 100644 --- a/tests/unit/plugins/modules/test_gitlab_project_access_token.py +++ b/tests/unit/plugins/modules/test_gitlab_project_access_token.py @@ -54,7 +54,7 @@ except ImportError: class TestGitlabProjectAccessToken(GitlabModuleTestCase): @with_httmock(resp_get_user) def setUp(self): - super(TestGitlabProjectAccessToken, self).setUp() + super().setUp() if not python_gitlab_version_match_requirement(): self.skipTest(f"python-gitlab {'.'.join(map(str, PYTHON_GITLAB_MINIMAL_VERSION))}+ is needed for gitlab_project_access_token") diff --git a/tests/unit/plugins/modules/test_gitlab_protected_branch.py b/tests/unit/plugins/modules/test_gitlab_protected_branch.py index 58f7d97ffd..bc83b01946 100644 --- a/tests/unit/plugins/modules/test_gitlab_protected_branch.py +++ b/tests/unit/plugins/modules/test_gitlab_protected_branch.py @@ -55,7 +55,7 @@ class TestGitlabProtectedBranch(GitlabModuleTestCase): @with_httmock(resp_get_project_by_name) @with_httmock(resp_get_user) def setUp(self): - super(TestGitlabProtectedBranch, self).setUp() + super().setUp() self.gitlab_instance.user = self.gitlab_instance.users.get(1) self.moduleUtil = GitlabProtectedBranch(module=self.mock_module, project="foo-bar/diaspora-client", gitlab_instance=self.gitlab_instance) diff --git a/tests/unit/plugins/modules/test_gitlab_runner.py b/tests/unit/plugins/modules/test_gitlab_runner.py index 29dcb6f8e7..47829f0d96 100644 --- a/tests/unit/plugins/modules/test_gitlab_runner.py +++ b/tests/unit/plugins/modules/test_gitlab_runner.py @@ -51,7 +51,7 @@ except ImportError: class TestGitlabRunner(GitlabModuleTestCase): def setUp(self): - super(TestGitlabRunner, self).setUp() + super().setUp() self.module_util_all = GitLabRunner(module=FakeAnsibleModule({"owned": False}), gitlab_instance=self.gitlab_instance) self.module_util_owned = GitLabRunner(module=FakeAnsibleModule({"owned": True}), gitlab_instance=self.gitlab_instance) diff --git a/tests/unit/plugins/modules/test_gitlab_user.py b/tests/unit/plugins/modules/test_gitlab_user.py index e2e68465d1..da0a30512a 100644 --- a/tests/unit/plugins/modules/test_gitlab_user.py +++ b/tests/unit/plugins/modules/test_gitlab_user.py @@ -54,7 +54,7 @@ except ImportError: class TestGitlabUser(GitlabModuleTestCase): def setUp(self): - super(TestGitlabUser, self).setUp() + super().setUp() self.moduleUtil = GitLabUser(module=self.mock_module, gitlab_instance=self.gitlab_instance) diff --git a/tests/unit/plugins/modules/test_icinga2_feature.py b/tests/unit/plugins/modules/test_icinga2_feature.py index 12ab2c8592..b67619d5ac 100644 --- a/tests/unit/plugins/modules/test_icinga2_feature.py +++ b/tests/unit/plugins/modules/test_icinga2_feature.py @@ -23,7 +23,7 @@ class TestIcinga2Feature(ModuleTestCase): def setUp(self): """Setup.""" - super(TestIcinga2Feature, self).setUp() + super().setUp() self.module = icinga2_feature self.mock_get_bin_path = patch.object(basic.AnsibleModule, 'get_bin_path', get_bin_path) self.mock_get_bin_path.start() @@ -31,7 +31,7 @@ class TestIcinga2Feature(ModuleTestCase): def tearDown(self): """Teardown.""" - super(TestIcinga2Feature, self).tearDown() + super().tearDown() def test_without_required_parameters(self): """Failure must occurs when all parameters are missing.""" diff --git a/tests/unit/plugins/modules/test_ipa_getkeytab.py b/tests/unit/plugins/modules/test_ipa_getkeytab.py index f9bed6e5f8..af03275fd4 100644 --- a/tests/unit/plugins/modules/test_ipa_getkeytab.py +++ b/tests/unit/plugins/modules/test_ipa_getkeytab.py @@ -14,7 +14,7 @@ class IPAKeytabModuleTestCase(ModuleTestCase): module = ipa_getkeytab def setUp(self): - super(IPAKeytabModuleTestCase, self).setUp() + super().setUp() ansible_module_path = "ansible_collections.community.general.plugins.modules.ipa_getkeytab.AnsibleModule" self.mock_run_command = patch(f'{ansible_module_path}.run_command') self.module_main_command = self.mock_run_command.start() @@ -25,7 +25,7 @@ class IPAKeytabModuleTestCase(ModuleTestCase): def tearDown(self): self.mock_run_command.stop() self.mock_get_bin_path.stop() - super(IPAKeytabModuleTestCase, self).tearDown() + super().tearDown() def module_main(self, exit_exc): with self.assertRaises(exit_exc) as exc: diff --git a/tests/unit/plugins/modules/test_ipa_otpconfig.py b/tests/unit/plugins/modules/test_ipa_otpconfig.py index 0f510aee28..f08a56c7fd 100644 --- a/tests/unit/plugins/modules/test_ipa_otpconfig.py +++ b/tests/unit/plugins/modules/test_ipa_otpconfig.py @@ -37,7 +37,7 @@ def patch_ipa(**kwargs): class TestIPAOTPConfig(ModuleTestCase): def setUp(self): - super(TestIPAOTPConfig, self).setUp() + super().setUp() self.module = ipa_otpconfig def _test_base(self, module_args, return_value, mock_calls, changed): diff --git a/tests/unit/plugins/modules/test_ipa_otptoken.py b/tests/unit/plugins/modules/test_ipa_otptoken.py index 90a11258dc..382571d913 100644 --- a/tests/unit/plugins/modules/test_ipa_otptoken.py +++ b/tests/unit/plugins/modules/test_ipa_otptoken.py @@ -37,7 +37,7 @@ def patch_ipa(**kwargs): class TestIPAOTPToken(ModuleTestCase): def setUp(self): - super(TestIPAOTPToken, self).setUp() + super().setUp() self.module = ipa_otptoken def _test_base(self, module_args, return_value, mock_calls, changed): diff --git a/tests/unit/plugins/modules/test_ipa_pwpolicy.py b/tests/unit/plugins/modules/test_ipa_pwpolicy.py index 4b74938447..be680dd092 100644 --- a/tests/unit/plugins/modules/test_ipa_pwpolicy.py +++ b/tests/unit/plugins/modules/test_ipa_pwpolicy.py @@ -37,7 +37,7 @@ def patch_ipa(**kwargs): class TestIPAPwPolicy(ModuleTestCase): def setUp(self): - super(TestIPAPwPolicy, self).setUp() + super().setUp() self.module = ipa_pwpolicy def _test_base(self, module_args, return_value, mock_calls, changed): diff --git a/tests/unit/plugins/modules/test_java_keystore.py b/tests/unit/plugins/modules/test_java_keystore.py index c85f0967b7..689faaa442 100644 --- a/tests/unit/plugins/modules/test_java_keystore.py +++ b/tests/unit/plugins/modules/test_java_keystore.py @@ -38,7 +38,7 @@ class TestCreateJavaKeystore(ModuleTestCase): def setUp(self): """Setup.""" - super(TestCreateJavaKeystore, self).setUp() + super().setUp() orig_exists = os.path.exists self.mock_create_file = patch('ansible_collections.community.general.plugins.modules.java_keystore.create_file') @@ -67,7 +67,7 @@ class TestCreateJavaKeystore(ModuleTestCase): def tearDown(self): """Teardown.""" - super(TestCreateJavaKeystore, self).tearDown() + super().tearDown() self.mock_create_file.stop() self.mock_create_path.stop() self.mock_current_type.stop() @@ -229,7 +229,7 @@ class TestCertChanged(ModuleTestCase): def setUp(self): """Setup.""" - super(TestCertChanged, self).setUp() + super().setUp() self.mock_create_file = patch('ansible_collections.community.general.plugins.modules.java_keystore.create_file') self.mock_current_type = patch('ansible_collections.community.general.plugins.modules.java_keystore.JavaKeystore.current_type') self.mock_run_command = patch('ansible.module_utils.basic.AnsibleModule.run_command') @@ -245,7 +245,7 @@ class TestCertChanged(ModuleTestCase): def tearDown(self): """Teardown.""" - super(TestCertChanged, self).tearDown() + super().tearDown() self.mock_create_file.stop() self.mock_current_type.stop() self.mock_run_command.stop() diff --git a/tests/unit/plugins/modules/test_keycloak_authentication.py b/tests/unit/plugins/modules/test_keycloak_authentication.py index f5906a8104..735ca41f5d 100644 --- a/tests/unit/plugins/modules/test_keycloak_authentication.py +++ b/tests/unit/plugins/modules/test_keycloak_authentication.py @@ -92,7 +92,7 @@ def mock_good_connection(): class TestKeycloakAuthentication(ModuleTestCase): def setUp(self): - super(TestKeycloakAuthentication, self).setUp() + super().setUp() self.module = keycloak_authentication def test_create_auth_flow_from_copy(self): diff --git a/tests/unit/plugins/modules/test_keycloak_authentication_required_actions.py b/tests/unit/plugins/modules/test_keycloak_authentication_required_actions.py index fb800e3147..167201c93d 100644 --- a/tests/unit/plugins/modules/test_keycloak_authentication_required_actions.py +++ b/tests/unit/plugins/modules/test_keycloak_authentication_required_actions.py @@ -111,7 +111,7 @@ def mock_good_connection(): class TestKeycloakAuthentication(ModuleTestCase): def setUp(self): - super(TestKeycloakAuthentication, self).setUp() + super().setUp() self.module = keycloak_authentication_required_actions def test_register_required_action(self): diff --git a/tests/unit/plugins/modules/test_keycloak_client.py b/tests/unit/plugins/modules/test_keycloak_client.py index c66c6a6fdd..f8e99afab6 100644 --- a/tests/unit/plugins/modules/test_keycloak_client.py +++ b/tests/unit/plugins/modules/test_keycloak_client.py @@ -91,7 +91,7 @@ def mock_good_connection(): class TestKeycloakRealm(ModuleTestCase): def setUp(self): - super(TestKeycloakRealm, self).setUp() + super().setUp() self.module = keycloak_client def test_authentication_flow_binding_overrides_feature(self): diff --git a/tests/unit/plugins/modules/test_keycloak_client_rolemapping.py b/tests/unit/plugins/modules/test_keycloak_client_rolemapping.py index 4d5c7465b5..e6bcb4c471 100644 --- a/tests/unit/plugins/modules/test_keycloak_client_rolemapping.py +++ b/tests/unit/plugins/modules/test_keycloak_client_rolemapping.py @@ -101,7 +101,7 @@ def mock_good_connection(): class TestKeycloakRealm(ModuleTestCase): def setUp(self): - super(TestKeycloakRealm, self).setUp() + super().setUp() self.module = keycloak_client_rolemapping def test_map_clientrole_to_group_with_name(self): diff --git a/tests/unit/plugins/modules/test_keycloak_clientscope.py b/tests/unit/plugins/modules/test_keycloak_clientscope.py index 1a5c9e1cd5..afcb0397a6 100644 --- a/tests/unit/plugins/modules/test_keycloak_clientscope.py +++ b/tests/unit/plugins/modules/test_keycloak_clientscope.py @@ -113,7 +113,7 @@ def mock_good_connection(): class TestKeycloakAuthentication(ModuleTestCase): def setUp(self): - super(TestKeycloakAuthentication, self).setUp() + super().setUp() self.module = keycloak_clientscope def test_create_clientscope(self): diff --git a/tests/unit/plugins/modules/test_keycloak_component.py b/tests/unit/plugins/modules/test_keycloak_component.py index 2b247be146..bec11da2e0 100644 --- a/tests/unit/plugins/modules/test_keycloak_component.py +++ b/tests/unit/plugins/modules/test_keycloak_component.py @@ -80,7 +80,7 @@ def mock_good_connection(): class TestKeycloakComponent(ModuleTestCase): def setUp(self): - super(TestKeycloakComponent, self).setUp() + super().setUp() self.module = keycloak_component def test_create_when_absent(self): diff --git a/tests/unit/plugins/modules/test_keycloak_identity_provider.py b/tests/unit/plugins/modules/test_keycloak_identity_provider.py index 9cf252a8c7..477cb565b0 100644 --- a/tests/unit/plugins/modules/test_keycloak_identity_provider.py +++ b/tests/unit/plugins/modules/test_keycloak_identity_provider.py @@ -102,7 +102,7 @@ def mock_good_connection(): class TestKeycloakIdentityProvider(ModuleTestCase): def setUp(self): - super(TestKeycloakIdentityProvider, self).setUp() + super().setUp() self.module = keycloak_identity_provider def test_create_when_absent(self): diff --git a/tests/unit/plugins/modules/test_keycloak_realm.py b/tests/unit/plugins/modules/test_keycloak_realm.py index 0deef16365..82ac628bfd 100644 --- a/tests/unit/plugins/modules/test_keycloak_realm.py +++ b/tests/unit/plugins/modules/test_keycloak_realm.py @@ -84,7 +84,7 @@ def mock_good_connection(): class TestKeycloakRealm(ModuleTestCase): def setUp(self): - super(TestKeycloakRealm, self).setUp() + super().setUp() self.module = keycloak_realm def test_create_when_absent(self): diff --git a/tests/unit/plugins/modules/test_keycloak_realm_info.py b/tests/unit/plugins/modules/test_keycloak_realm_info.py index eb76e74640..59e2bd94b9 100644 --- a/tests/unit/plugins/modules/test_keycloak_realm_info.py +++ b/tests/unit/plugins/modules/test_keycloak_realm_info.py @@ -81,7 +81,7 @@ def mock_good_connection(): class TestKeycloakRealmRole(ModuleTestCase): def setUp(self): - super(TestKeycloakRealmRole, self).setUp() + super().setUp() self.module = keycloak_realm_info def test_get_public_info(self): diff --git a/tests/unit/plugins/modules/test_keycloak_realm_keys.py b/tests/unit/plugins/modules/test_keycloak_realm_keys.py index d566b1b34d..9f9ff750c2 100644 --- a/tests/unit/plugins/modules/test_keycloak_realm_keys.py +++ b/tests/unit/plugins/modules/test_keycloak_realm_keys.py @@ -79,7 +79,7 @@ def mock_good_connection(): class TestKeycloakRealmKeys(ModuleTestCase): def setUp(self): - super(TestKeycloakRealmKeys, self).setUp() + super().setUp() self.module = keycloak_realm_key def test_create_when_absent(self): diff --git a/tests/unit/plugins/modules/test_keycloak_realm_keys_metadata_info.py b/tests/unit/plugins/modules/test_keycloak_realm_keys_metadata_info.py index 2db2ee2543..ac1b6980e2 100644 --- a/tests/unit/plugins/modules/test_keycloak_realm_keys_metadata_info.py +++ b/tests/unit/plugins/modules/test_keycloak_realm_keys_metadata_info.py @@ -89,7 +89,7 @@ def mock_good_connection(): class TestKeycloakRealmRole(ModuleTestCase): def setUp(self): - super(TestKeycloakRealmRole, self).setUp() + super().setUp() self.module = keycloak_realm_keys_metadata_info def test_get_public_info(self): diff --git a/tests/unit/plugins/modules/test_keycloak_role.py b/tests/unit/plugins/modules/test_keycloak_role.py index 51f4283588..6a13346caf 100644 --- a/tests/unit/plugins/modules/test_keycloak_role.py +++ b/tests/unit/plugins/modules/test_keycloak_role.py @@ -94,7 +94,7 @@ def mock_good_connection(): class TestKeycloakRealmRole(ModuleTestCase): def setUp(self): - super(TestKeycloakRealmRole, self).setUp() + super().setUp() self.module = keycloak_role def test_create_when_absent(self): @@ -470,7 +470,7 @@ class TestKeycloakRealmRole(ModuleTestCase): class TestKeycloakClientRole(ModuleTestCase): def setUp(self): - super(TestKeycloakClientRole, self).setUp() + super().setUp() self.module = keycloak_role def test_create_client_role_with_composites_when_absent(self): diff --git a/tests/unit/plugins/modules/test_keycloak_user.py b/tests/unit/plugins/modules/test_keycloak_user.py index 02b457d8f7..82efe6ce48 100644 --- a/tests/unit/plugins/modules/test_keycloak_user.py +++ b/tests/unit/plugins/modules/test_keycloak_user.py @@ -89,7 +89,7 @@ def mock_good_connection(): class TestKeycloakUser(ModuleTestCase): def setUp(self): - super(TestKeycloakUser, self).setUp() + super().setUp() self.module = keycloak_user def test_add_new_user(self): diff --git a/tests/unit/plugins/modules/test_keycloak_user_federation.py b/tests/unit/plugins/modules/test_keycloak_user_federation.py index 1fd9da6f2c..e79951d288 100644 --- a/tests/unit/plugins/modules/test_keycloak_user_federation.py +++ b/tests/unit/plugins/modules/test_keycloak_user_federation.py @@ -79,7 +79,7 @@ def mock_good_connection(): class TestKeycloakUserFederation(ModuleTestCase): def setUp(self): - super(TestKeycloakUserFederation, self).setUp() + super().setUp() self.module = keycloak_user_federation def test_create_when_absent(self): diff --git a/tests/unit/plugins/modules/test_keycloak_userprofile.py b/tests/unit/plugins/modules/test_keycloak_userprofile.py index 9b6ac80310..b6b0122f7b 100644 --- a/tests/unit/plugins/modules/test_keycloak_userprofile.py +++ b/tests/unit/plugins/modules/test_keycloak_userprofile.py @@ -75,7 +75,7 @@ def mock_good_connection(): class TestKeycloakUserprofile(ModuleTestCase): def setUp(self): - super(TestKeycloakUserprofile, self).setUp() + super().setUp() self.module = keycloak_userprofile def test_create_when_absent(self): diff --git a/tests/unit/plugins/modules/test_lvg_rename.py b/tests/unit/plugins/modules/test_lvg_rename.py index 1ad650f322..ff4a7d6df1 100644 --- a/tests/unit/plugins/modules/test_lvg_rename.py +++ b/tests/unit/plugins/modules/test_lvg_rename.py @@ -23,7 +23,7 @@ class TestLvgRename(ModuleTestCase): def setUp(self): """Prepare mocks for module testing""" - super(TestLvgRename, self).setUp() + super().setUp() self.mock_run_responses = {} diff --git a/tests/unit/plugins/modules/test_modprobe.py b/tests/unit/plugins/modules/test_modprobe.py index 337dbc3813..ff288c441d 100644 --- a/tests/unit/plugins/modules/test_modprobe.py +++ b/tests/unit/plugins/modules/test_modprobe.py @@ -12,7 +12,7 @@ from ansible_collections.community.general.plugins.modules.modprobe import Modpr class TestLoadModule(ModuleTestCase): def setUp(self): - super(TestLoadModule, self).setUp() + super().setUp() self.mock_module_loaded = patch( 'ansible_collections.community.general.plugins.modules.modprobe.Modprobe.module_loaded' @@ -26,7 +26,7 @@ class TestLoadModule(ModuleTestCase): def tearDown(self): """Teardown.""" - super(TestLoadModule, self).tearDown() + super().tearDown() self.mock_module_loaded.stop() self.mock_run_command.stop() self.mock_get_bin_path.stop() @@ -73,7 +73,7 @@ class TestLoadModule(ModuleTestCase): class TestUnloadModule(ModuleTestCase): def setUp(self): - super(TestUnloadModule, self).setUp() + super().setUp() self.mock_module_loaded = patch( 'ansible_collections.community.general.plugins.modules.modprobe.Modprobe.module_loaded' @@ -87,7 +87,7 @@ class TestUnloadModule(ModuleTestCase): def tearDown(self): """Teardown.""" - super(TestUnloadModule, self).tearDown() + super().tearDown() self.mock_module_loaded.stop() self.mock_run_command.stop() self.mock_get_bin_path.stop() @@ -146,7 +146,7 @@ class TestModuleIsLoadedPersistently(ModuleTestCase): if sys.version_info[0] == 3 and sys.version_info[1] < 7: self.skipTest("open_mock doesn't support readline in earlier python versions") - super(TestModuleIsLoadedPersistently, self).setUp() + super().setUp() self.mock_get_bin_path = patch('ansible.module_utils.basic.AnsibleModule.get_bin_path') @@ -154,7 +154,7 @@ class TestModuleIsLoadedPersistently(ModuleTestCase): def tearDown(self): """Teardown.""" - super(TestModuleIsLoadedPersistently, self).tearDown() + super().tearDown() self.mock_get_bin_path.stop() @@ -220,7 +220,7 @@ class TestPermanentParams(ModuleTestCase): def setUp(self): if sys.version_info[0] == 3 and sys.version_info[1] < 7: self.skipTest("open_mock doesn't support readline in earlier python versions") - super(TestPermanentParams, self).setUp() + super().setUp() self.mock_get_bin_path = patch('ansible.module_utils.basic.AnsibleModule.get_bin_path') @@ -228,7 +228,7 @@ class TestPermanentParams(ModuleTestCase): def tearDown(self): """Teardown.""" - super(TestPermanentParams, self).tearDown() + super().tearDown() self.mock_get_bin_path.stop() @@ -287,7 +287,7 @@ class TestPermanentParams(ModuleTestCase): class TestCreateModuleFIle(ModuleTestCase): def setUp(self): - super(TestCreateModuleFIle, self).setUp() + super().setUp() self.mock_get_bin_path = patch('ansible.module_utils.basic.AnsibleModule.get_bin_path') @@ -295,7 +295,7 @@ class TestCreateModuleFIle(ModuleTestCase): def tearDown(self): """Teardown.""" - super(TestCreateModuleFIle, self).tearDown() + super().tearDown() self.mock_get_bin_path.stop() @@ -320,7 +320,7 @@ class TestCreateModuleFIle(ModuleTestCase): class TestCreateModuleOptionsFIle(ModuleTestCase): def setUp(self): - super(TestCreateModuleOptionsFIle, self).setUp() + super().setUp() self.mock_get_bin_path = patch('ansible.module_utils.basic.AnsibleModule.get_bin_path') @@ -328,7 +328,7 @@ class TestCreateModuleOptionsFIle(ModuleTestCase): def tearDown(self): """Teardown.""" - super(TestCreateModuleOptionsFIle, self).tearDown() + super().tearDown() self.mock_get_bin_path.stop() @@ -354,7 +354,7 @@ class TestCreateModuleOptionsFIle(ModuleTestCase): class TestDisableOldParams(ModuleTestCase): def setUp(self): - super(TestDisableOldParams, self).setUp() + super().setUp() self.mock_get_bin_path = patch('ansible.module_utils.basic.AnsibleModule.get_bin_path') @@ -362,7 +362,7 @@ class TestDisableOldParams(ModuleTestCase): def tearDown(self): """Teardown.""" - super(TestDisableOldParams, self).tearDown() + super().tearDown() self.mock_get_bin_path.stop() @@ -412,7 +412,7 @@ class TestDisableOldParams(ModuleTestCase): class TestDisableModulePermanent(ModuleTestCase): def setUp(self): - super(TestDisableModulePermanent, self).setUp() + super().setUp() self.mock_get_bin_path = patch('ansible.module_utils.basic.AnsibleModule.get_bin_path') @@ -420,7 +420,7 @@ class TestDisableModulePermanent(ModuleTestCase): def tearDown(self): """Teardown.""" - super(TestDisableModulePermanent, self).tearDown() + super().tearDown() self.mock_get_bin_path.stop() diff --git a/tests/unit/plugins/modules/test_nomad_token.py b/tests/unit/plugins/modules/test_nomad_token.py index afe96bc88c..158bdad294 100644 --- a/tests/unit/plugins/modules/test_nomad_token.py +++ b/tests/unit/plugins/modules/test_nomad_token.py @@ -90,11 +90,11 @@ def mock_acl_delete_token(): class TestNomadTokenModule(ModuleTestCase): def setUp(self): - super(TestNomadTokenModule, self).setUp() + super().setUp() self.module = nomad_token def tearDown(self): - super(TestNomadTokenModule, self).tearDown() + super().tearDown() def test_should_fail_without_parameters(self): with self.assertRaises(AnsibleFailJson): diff --git a/tests/unit/plugins/modules/test_npm.py b/tests/unit/plugins/modules/test_npm.py index 7a2eec1019..fb16abca6d 100644 --- a/tests/unit/plugins/modules/test_npm.py +++ b/tests/unit/plugins/modules/test_npm.py @@ -15,7 +15,7 @@ class NPMModuleTestCase(ModuleTestCase): module = npm def setUp(self): - super(NPMModuleTestCase, self).setUp() + super().setUp() ansible_module_path = "ansible_collections.community.general.plugins.modules.npm.AnsibleModule" self.mock_run_command = patch(f'{ansible_module_path}.run_command') self.module_main_command = self.mock_run_command.start() @@ -26,7 +26,7 @@ class NPMModuleTestCase(ModuleTestCase): def tearDown(self): self.mock_run_command.stop() self.mock_get_bin_path.stop() - super(NPMModuleTestCase, self).tearDown() + super().tearDown() def module_main(self, exit_exc): with self.assertRaises(exit_exc) as exc: diff --git a/tests/unit/plugins/modules/test_pagerduty_alert.py b/tests/unit/plugins/modules/test_pagerduty_alert.py index bac654d0f6..900150cd40 100644 --- a/tests/unit/plugins/modules/test_pagerduty_alert.py +++ b/tests/unit/plugins/modules/test_pagerduty_alert.py @@ -53,11 +53,11 @@ class Response: class TestPagerDutyAlertModule(ModuleTestCase): def setUp(self): - super(TestPagerDutyAlertModule, self).setUp() + super().setUp() self.module = pagerduty_alert def tearDown(self): - super(TestPagerDutyAlertModule, self).tearDown() + super().tearDown() @pytest.fixture def fetch_url_mock(self, mocker): diff --git a/tests/unit/plugins/modules/test_pagerduty_change.py b/tests/unit/plugins/modules/test_pagerduty_change.py index 9cab573f61..960c331e68 100644 --- a/tests/unit/plugins/modules/test_pagerduty_change.py +++ b/tests/unit/plugins/modules/test_pagerduty_change.py @@ -15,11 +15,11 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestPagerDutyChangeModule(ModuleTestCase): def setUp(self): - super(TestPagerDutyChangeModule, self).setUp() + super().setUp() self.module = pagerduty_change def tearDown(self): - super(TestPagerDutyChangeModule, self).tearDown() + super().tearDown() @pytest.fixture def fetch_url_mock(self, mocker): diff --git a/tests/unit/plugins/modules/test_parted.py b/tests/unit/plugins/modules/test_parted.py index 4e71a8d845..0210202aee 100644 --- a/tests/unit/plugins/modules/test_parted.py +++ b/tests/unit/plugins/modules/test_parted.py @@ -130,7 +130,7 @@ parted_dict3 = { class TestParted(ModuleTestCase): def setUp(self): - super(TestParted, self).setUp() + super().setUp() self.module = parted_module self.mock_check_parted_label = (patch('ansible_collections.community.general.plugins.modules.parted.check_parted_label', return_value=False)) @@ -146,7 +146,7 @@ class TestParted(ModuleTestCase): self.get_bin_path = self.mock_get_bin_path.start() def tearDown(self): - super(TestParted, self).tearDown() + super().tearDown() self.mock_run_command.stop() self.mock_get_bin_path.stop() self.mock_parted.stop() diff --git a/tests/unit/plugins/modules/test_pmem.py b/tests/unit/plugins/modules/test_pmem.py index 64c193fc22..84768801e6 100644 --- a/tests/unit/plugins/modules/test_pmem.py +++ b/tests/unit/plugins/modules/test_pmem.py @@ -264,7 +264,7 @@ ndctl_list_N_two_namespaces = """[ class TestPmem(ModuleTestCase): def setUp(self): - super(TestPmem, self).setUp() + super().setUp() self.module = pmem_module self.mock_run_command = (patch('ansible.module_utils.basic.AnsibleModule.run_command')) @@ -282,7 +282,7 @@ class TestPmem(ModuleTestCase): self.pmem_init_env = self.mock_pmem_init_env.start() def tearDown(self): - super(TestPmem, self).tearDown() + super().tearDown() self.mock_get_bin_path.stop() self.mock_run_command.stop() self.mock_pmem_is_dcpmm_installed.stop() diff --git a/tests/unit/plugins/modules/test_pritunl_org.py b/tests/unit/plugins/modules/test_pritunl_org.py index b5b3884532..42d975e440 100644 --- a/tests/unit/plugins/modules/test_pritunl_org.py +++ b/tests/unit/plugins/modules/test_pritunl_org.py @@ -27,7 +27,7 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestPritunlOrg(ModuleTestCase): def setUp(self): - super(TestPritunlOrg, self).setUp() + super().setUp() self.module = pritunl_org # Add backward compatibility @@ -35,7 +35,7 @@ class TestPritunlOrg(ModuleTestCase): self.assertRegex = self.assertRegexpMatches def tearDown(self): - super(TestPritunlOrg, self).tearDown() + super().tearDown() def patch_add_pritunl_organization(self, **kwds): return patch( diff --git a/tests/unit/plugins/modules/test_pritunl_org_info.py b/tests/unit/plugins/modules/test_pritunl_org_info.py index bc809903e2..f0c67ae5d6 100644 --- a/tests/unit/plugins/modules/test_pritunl_org_info.py +++ b/tests/unit/plugins/modules/test_pritunl_org_info.py @@ -24,7 +24,7 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestPritunlOrgInfo(ModuleTestCase): def setUp(self): - super(TestPritunlOrgInfo, self).setUp() + super().setUp() self.module = pritunl_org_info # Add backward compatibility @@ -32,7 +32,7 @@ class TestPritunlOrgInfo(ModuleTestCase): self.assertRegex = self.assertRegexpMatches def tearDown(self): - super(TestPritunlOrgInfo, self).tearDown() + super().tearDown() def patch_get_pritunl_organizations(self, **kwds): return patch( diff --git a/tests/unit/plugins/modules/test_pritunl_user.py b/tests/unit/plugins/modules/test_pritunl_user.py index b11a234824..175995687c 100644 --- a/tests/unit/plugins/modules/test_pritunl_user.py +++ b/tests/unit/plugins/modules/test_pritunl_user.py @@ -43,7 +43,7 @@ def mock_pritunl_api(func, **kwargs): class TestPritunlUser(ModuleTestCase): def setUp(self): - super(TestPritunlUser, self).setUp() + super().setUp() self.module = pritunl_user # Add backward compatibility @@ -51,7 +51,7 @@ class TestPritunlUser(ModuleTestCase): self.assertRegex = self.assertRegexpMatches def tearDown(self): - super(TestPritunlUser, self).tearDown() + super().tearDown() def patch_get_pritunl_users(self, **kwds): return patch( diff --git a/tests/unit/plugins/modules/test_pritunl_user_info.py b/tests/unit/plugins/modules/test_pritunl_user_info.py index 6b1865874c..2adf99fffd 100644 --- a/tests/unit/plugins/modules/test_pritunl_user_info.py +++ b/tests/unit/plugins/modules/test_pritunl_user_info.py @@ -24,7 +24,7 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestPritunlUserInfo(ModuleTestCase): def setUp(self): - super(TestPritunlUserInfo, self).setUp() + super().setUp() self.module = pritunl_user_info # Add backward compatibility @@ -32,7 +32,7 @@ class TestPritunlUserInfo(ModuleTestCase): self.assertRegex = self.assertRegexpMatches def tearDown(self): - super(TestPritunlUserInfo, self).tearDown() + super().tearDown() def patch_get_pritunl_users(self, **kwds): return patch( diff --git a/tests/unit/plugins/modules/test_redis_info.py b/tests/unit/plugins/modules/test_redis_info.py index ba6b0bb930..f6e19cd9a1 100644 --- a/tests/unit/plugins/modules/test_redis_info.py +++ b/tests/unit/plugins/modules/test_redis_info.py @@ -31,12 +31,12 @@ class FakeRedisClientFail(MagicMock): class TestRedisInfoModule(ModuleTestCase): def setUp(self): - super(TestRedisInfoModule, self).setUp() + super().setUp() redis_info.HAS_REDIS_PACKAGE = True self.module = redis_info def tearDown(self): - super(TestRedisInfoModule, self).tearDown() + super().tearDown() def patch_redis_client(self, **kwds): return patch('ansible_collections.community.general.plugins.modules.redis_info.redis_client', autospec=True, **kwds) diff --git a/tests/unit/plugins/modules/test_rhsm_release.py b/tests/unit/plugins/modules/test_rhsm_release.py index 5b4a54afa8..9241b0256a 100644 --- a/tests/unit/plugins/modules/test_rhsm_release.py +++ b/tests/unit/plugins/modules/test_rhsm_release.py @@ -16,7 +16,7 @@ class RhsmRepositoryReleaseModuleTestCase(ModuleTestCase): SUBMAN_KWARGS = dict(check_rc=True, expand_user_and_vars=False) def setUp(self): - super(RhsmRepositoryReleaseModuleTestCase, self).setUp() + super().setUp() # Mainly interested that the subscription-manager calls are right # based on the module args, so patch out run_command in the module. @@ -41,7 +41,7 @@ class RhsmRepositoryReleaseModuleTestCase(ModuleTestCase): self.mock_run_command.stop() self.mock_get_bin_path.stop() self.mock_os_getuid.stop() - super(RhsmRepositoryReleaseModuleTestCase, self).tearDown() + super().tearDown() def module_main(self, exit_exc): with self.assertRaises(exit_exc) as exc: diff --git a/tests/unit/plugins/modules/test_rpm_ostree_pkg.py b/tests/unit/plugins/modules/test_rpm_ostree_pkg.py index 70a23f0a20..3740439578 100644 --- a/tests/unit/plugins/modules/test_rpm_ostree_pkg.py +++ b/tests/unit/plugins/modules/test_rpm_ostree_pkg.py @@ -15,7 +15,7 @@ class RpmOSTreeModuleTestCase(ModuleTestCase): module = rpm_ostree_pkg def setUp(self): - super(RpmOSTreeModuleTestCase, self).setUp() + super().setUp() ansible_module_path = "ansible_collections.community.general.plugins.modules.rpm_ostree_pkg.AnsibleModule" self.mock_run_command = patch(f'{ansible_module_path}.run_command') self.module_main_command = self.mock_run_command.start() @@ -26,7 +26,7 @@ class RpmOSTreeModuleTestCase(ModuleTestCase): def tearDown(self): self.mock_run_command.stop() self.mock_get_bin_path.stop() - super(RpmOSTreeModuleTestCase, self).tearDown() + super().tearDown() def module_main(self, exit_exc): with self.assertRaises(exit_exc) as exc: diff --git a/tests/unit/plugins/modules/test_simpleinit_msb.py b/tests/unit/plugins/modules/test_simpleinit_msb.py index 743f7c9e61..3daa7d4c34 100644 --- a/tests/unit/plugins/modules/test_simpleinit_msb.py +++ b/tests/unit/plugins/modules/test_simpleinit_msb.py @@ -85,10 +85,10 @@ _TELINIT_STATUS_RUNNING_NOT = """ class TestSimpleinitMSB(ModuleTestCase): def setUp(self): - super(TestSimpleinitMSB, self).setUp() + super().setUp() def tearDown(self): - super(TestSimpleinitMSB, self).tearDown() + super().tearDown() @patch('os.path.exists', return_value=True) @patch('ansible.module_utils.basic.AnsibleModule.get_bin_path', return_value="/sbin/telinit") diff --git a/tests/unit/plugins/modules/test_slack.py b/tests/unit/plugins/modules/test_slack.py index fa1c9c5935..4fdea48c99 100644 --- a/tests/unit/plugins/modules/test_slack.py +++ b/tests/unit/plugins/modules/test_slack.py @@ -14,11 +14,11 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module class TestSlackModule(ModuleTestCase): def setUp(self): - super(TestSlackModule, self).setUp() + super().setUp() self.module = slack def tearDown(self): - super(TestSlackModule, self).tearDown() + super().tearDown() @pytest.fixture def fetch_url_mock(self, mocker): diff --git a/tests/unit/plugins/modules/test_statsd.py b/tests/unit/plugins/modules/test_statsd.py index 9365669174..f077f4cfba 100644 --- a/tests/unit/plugins/modules/test_statsd.py +++ b/tests/unit/plugins/modules/test_statsd.py @@ -25,12 +25,12 @@ class FakeStatsD(MagicMock): class TestStatsDModule(ModuleTestCase): def setUp(self): - super(TestStatsDModule, self).setUp() + super().setUp() statsd.HAS_STATSD = True self.module = statsd def tearDown(self): - super(TestStatsDModule, self).tearDown() + super().tearDown() def patch_udp_statsd_client(self, **kwargs): return patch('ansible_collections.community.general.plugins.modules.statsd.udp_statsd_client', autospec=True, **kwargs) diff --git a/tests/unit/plugins/modules/test_sysupgrade.py b/tests/unit/plugins/modules/test_sysupgrade.py index 79e882f930..39cc6e0bf9 100644 --- a/tests/unit/plugins/modules/test_sysupgrade.py +++ b/tests/unit/plugins/modules/test_sysupgrade.py @@ -13,13 +13,13 @@ from ansible_collections.community.general.plugins.modules import sysupgrade class TestSysupgradeModule(ModuleTestCase): def setUp(self): - super(TestSysupgradeModule, self).setUp() + super().setUp() self.module = sysupgrade self.mock_get_bin_path = (patch('ansible.module_utils.basic.AnsibleModule.get_bin_path')) self.get_bin_path = self.mock_get_bin_path.start() def tearDown(self): - super(TestSysupgradeModule, self).tearDown() + super().tearDown() self.mock_get_bin_path.stop() def test_upgrade_success(self):