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:
parent
0c5466de47
commit
74c2c804e5
204 changed files with 390 additions and 401 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue