1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

Cleanup: use super() instead of super(__class__, self) (#11016)

* Address UP008: Use super() instead of super(__class__, self).

* Linting.
This commit is contained in:
Felix Fontein 2025-10-30 20:17:26 +01:00 committed by GitHub
parent 0c5466de47
commit 74c2c804e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
204 changed files with 390 additions and 401 deletions

View file

@ -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'):

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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')

View file

@ -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'))

View file

@ -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')

View file

@ -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

View file

@ -47,7 +47,7 @@ class CallbackModule(CallbackBase):
_previous_batch_total = 0
def __init__(self):
super(CallbackModule, self).__init__()
super().__init__()
self._playbook = ""
self._play = ""

View file

@ -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

View file

@ -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)

View file

@ -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')

View file

@ -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. "

View file

@ -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")

View file

@ -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')

View file

@ -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')

View file

@ -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:

View file

@ -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'))

View file

@ -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')

View file

@ -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('/'):

View file

@ -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':

View file

@ -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):

View file

@ -37,7 +37,7 @@ class CallbackModule(CallbackBase):
def __init__(self):
super(CallbackModule, self).__init__()
super().__init__()
self.FAILED_VOICE = None
self.REGULAR_VOICE = None

View file

@ -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')

View file

@ -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')

View file

@ -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')

View file

@ -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')

View file

@ -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"))

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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],

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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()

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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:

View file

@ -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:

View file

@ -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)

View file

@ -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")

View file

@ -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()

View file

@ -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")

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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):

View file

@ -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(

View file

@ -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})"

View file

@ -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

View file

@ -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:

View file

@ -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)

View file

@ -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():

View file

@ -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

View file

@ -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)

View file

@ -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()

View file

@ -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)

View file

@ -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()

View file

@ -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):

View file

@ -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():

View file

@ -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

View file

@ -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:

View file

@ -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 = {

View file

@ -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}"

View file

@ -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():

View file

@ -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(

View file

@ -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(

View file

@ -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()))

View file

@ -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),

View file

@ -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'),

View file

@ -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:

View file

@ -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)

View file

@ -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 == '@':

View file

@ -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',

View file

@ -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})

View file

@ -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})

View file

@ -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)

View file

@ -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})

View file

@ -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)

View file

@ -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,

View file

@ -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:

View file

@ -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})

View file

@ -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})

View file

@ -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)

View file

@ -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})

Some files were not shown because too many files have changed in this diff Show more