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

Cleanup: remove unicode prefix, remove explicit inheritance from object (#11015)

* Address UP025: remove unicode literals from strings.

* Address UP004: class inherits from 'object'.
This commit is contained in:
Felix Fontein 2025-10-30 20:17:10 +01:00 committed by GitHub
parent f61847b116
commit 0c5466de47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
242 changed files with 329 additions and 331 deletions

View file

@ -92,7 +92,7 @@ class StormConfig(SSHConfig):
self._config.append(host)
class ConfigParser(object):
class ConfigParser:
"""
Config parser for ~/.ssh/config files.
"""

View file

@ -71,7 +71,7 @@ class SdkManagerException(Exception):
pass
class AndroidSdkManager(object):
class AndroidSdkManager:
_RE_INSTALLED_PACKAGES_HEADER = re.compile(r'^Installed packages:$')
_RE_UPDATABLE_PACKAGES_HEADER = re.compile(r'^Available Updates:$')

View file

@ -23,7 +23,7 @@ class BtrfsModuleException(Exception):
pass
class BtrfsCommands(object):
class BtrfsCommands:
"""
Provides access to a subset of the Btrfs command line
@ -102,7 +102,7 @@ class BtrfsCommands(object):
result = self.__module.run_command(command, check_rc=True)
class BtrfsInfoProvider(object):
class BtrfsInfoProvider:
"""
Utility providing details of the currently available btrfs filesystems
@ -174,7 +174,7 @@ class BtrfsInfoProvider(object):
raise BtrfsModuleException(f"Failed to find subvolid for mountpoint in options '{mount_options}'")
class BtrfsSubvolume(object):
class BtrfsSubvolume:
"""
Wrapper class providing convenience methods for inspection of a btrfs subvolume
@ -252,7 +252,7 @@ class BtrfsSubvolume(object):
return self.__info['parent']
class BtrfsFilesystem(object):
class BtrfsFilesystem:
"""
Wrapper class providing convenience methods for inspection of a btrfs filesystem
@ -411,7 +411,7 @@ class BtrfsFilesystem(object):
}
class BtrfsFilesystemsProvider(object):
class BtrfsFilesystemsProvider:
"""
Provides methods to query available btrfs filesystems

View file

@ -89,7 +89,7 @@ def _full_jitter_backoff(retries=10, delay=3, max_delay=60, _random=random):
return backoff_gen
class CloudRetry(object):
class CloudRetry:
""" CloudRetry can be used by any cloud provider, in order to implement a
backoff algorithm/retry effect based on Status Code from Exceptions.
"""

View file

@ -63,7 +63,7 @@ class FormatError(CmdRunnerException):
return f"Failed to format parameter {self.name} with value {self.value}: {self.exc}"
class CmdRunner(object):
class CmdRunner:
"""
Wrapper for ``AnsibleModule.run_command()``.
@ -129,7 +129,7 @@ class CmdRunner(object):
context = __call__
class _CmdRunnerContext(object):
class _CmdRunnerContext:
def __init__(self, runner, args_order, output_process, check_mode_skip, check_mode_return, **kwargs):
self.runner = runner
self.args_order = tuple(args_order)

View file

@ -20,7 +20,7 @@ def _ensure_list(value):
return list(value) if is_sequence(value) else [value]
class _ArgFormat(object):
class _ArgFormat:
def __init__(self, func, ignore_none=True, ignore_missing_value=False):
self.func = func
self.ignore_none = ignore_none

View file

@ -16,7 +16,7 @@ from ansible.module_utils.basic import missing_required_lib
_deps = dict()
class _Dependency(object):
class _Dependency:
_states = ["pending", "failure", "success"]
def __init__(self, name, reason=None, url=None, msg=None):

View file

@ -52,7 +52,7 @@ except ImportError:
MCP_2_LOCATION_NAME_PATTERN = re.compile(r".*MCP\s?2.*")
class DimensionDataModule(object):
class DimensionDataModule:
"""
The base class containing common functionality used by Dimension Data modules for Ansible.
"""

View file

@ -10,7 +10,7 @@ from ansible.module_utils.common.text.converters import to_text
from ansible.module_utils.urls import fetch_url
class GandiLiveDNSAPI(object):
class GandiLiveDNSAPI:
api_endpoint = 'https://api.gandi.net/v5/livedns'
changed = False

View file

@ -16,7 +16,7 @@ def _create_regex_group_complement(s):
return re.compile(group)
class HomebrewValidate(object):
class HomebrewValidate:
# class regexes ------------------------------------------------ {{{
VALID_PATH_CHARS = rf"""
\w # alphanumeric characters (i.e., [a-zA-Z0-9_])

View file

@ -92,7 +92,7 @@ def session_method_wrapper(f):
return _wrap
class _ServiceClient(object):
class _ServiceClient:
def __init__(self, client, endpoint, product):
self._client = client
self._endpoint = endpoint
@ -140,7 +140,7 @@ class _ServiceClient(object):
return header
class Config(object):
class Config:
def __init__(self, module, product):
self._project_client = None
self._domain_client = None
@ -252,7 +252,7 @@ class HwcModule(AnsibleModule):
super(HwcModule, self).__init__(*args, **kwargs)
class _DictComparison(object):
class _DictComparison:
''' This class takes in two dictionaries `a` and `b`.
These are dictionaries of arbitrary depth, but made up of standard
Python types only.

View file

@ -350,7 +350,7 @@ def is_struct_included(struct1, struct2, exclude=None):
return to_text(struct1, 'utf-8') == to_text(struct2, 'utf-8')
class KeycloakAPI(object):
class KeycloakAPI:
""" Keycloak API access; Keycloak uses OAuth 2.0 to protect its API, an access token for which
is obtained through OpenID connect
"""

View file

@ -40,7 +40,7 @@ def _env_then_dns_fallback(*args, **kwargs):
raise AnsibleFallbackNotFound
class IPAClient(object):
class IPAClient:
def __init__(self, module, host, port, protocol):
self.host = host
self.port = port

View file

@ -51,7 +51,7 @@ def ldap_required_together():
return [['client_cert', 'client_key']]
class LdapGeneric(object):
class LdapGeneric:
def __init__(self, module):
# Shortcuts
self.module = module

View file

@ -38,7 +38,7 @@ class LXDClientException(Exception):
self.kwargs = kwargs
class LXDClient(object):
class LXDClient:
def __init__(self, url, key_file=None, cert_file=None, debug=False, server_cert_file=None, server_check_hostname=True):
"""LXD Client.

View file

@ -74,7 +74,7 @@ def manageiq_entities():
}
class ManageIQ(object):
class ManageIQ:
"""
class encapsulating ManageIQ API client.
"""
@ -177,7 +177,7 @@ class ManageIQ(object):
self.module.fail_json(msg=msg)
class ManageIQPolicies(object):
class ManageIQPolicies:
"""
Object to execute policies management operations of manageiq resources.
"""
@ -329,7 +329,7 @@ class ManageIQPolicies(object):
msg=f"Successfully {action}ed profiles: {profiles}")
class ManageIQTags(object):
class ManageIQTags:
"""
Object to execute tags management operations of manageiq resources.
"""

View file

@ -17,7 +17,7 @@ from ansible.module_utils.basic import json
import urllib.error as urllib_error
class Response(object):
class Response:
'''
Create a response object to mimic that of requests.
'''

View file

@ -12,7 +12,7 @@ from ansible_collections.community.general.plugins.module_utils.mh.exceptions im
from ansible_collections.community.general.plugins.module_utils.mh.deco import module_fails_on_exception
class ModuleHelperBase(object):
class ModuleHelperBase:
module: dict[str, t.Any] | None = None # TODO: better spec using t.TypedDict
ModuleHelperException = _MHE
_delegated_to_module: tuple[str, ...] = (

View file

@ -9,7 +9,7 @@ from __future__ import annotations
from ansible.module_utils.basic import AnsibleModule
class DeprecateAttrsMixin(object):
class DeprecateAttrsMixin:
def _deprecate_setup(self, attr, target, module):
if target is None:

View file

@ -6,7 +6,7 @@
from __future__ import annotations
class StateMixin(object):
class StateMixin:
state_param: str = 'state'
default_state: str | None = None

View file

@ -23,7 +23,7 @@ DELETE_HEADERS = {'accept': 'application/json'}
HEALTH_OK = 5
class OcapiUtils(object):
class OcapiUtils:
def __init__(self, creds, base_uri, proxy_slot_number, timeout, module):
self.root_uri = base_uri

View file

@ -7,7 +7,7 @@ from __future__ import annotations
import os
class OnePasswordConfig(object):
class OnePasswordConfig:
_config_file_paths = (
"~/.op/config",
"~/.config/op/config",

View file

@ -177,7 +177,7 @@ class OneViewModuleResourceNotFound(OneViewModuleException):
pass
class OneViewModuleBase(object, metaclass=abc.ABCMeta):
class OneViewModuleBase(metaclass=abc.ABCMeta):
MSG_CREATED = 'Resource created successfully.'
MSG_UPDATED = 'Resource updated successfully.'
MSG_DELETED = 'Resource deleted successfully.'

View file

@ -27,7 +27,7 @@ class OnlineException(Exception):
self.message = message
class Response(object):
class Response:
def __init__(self, resp, info):
self.body = None
@ -55,7 +55,7 @@ class Response(object):
return self.status_code in (200, 201, 202, 204)
class Online(object):
class Online:
def __init__(self, module):
self.module = module

View file

@ -47,7 +47,7 @@ REDFISH_COMMON_ARGUMENT_SPEC = {
}
class RedfishUtils(object):
class RedfishUtils:
def __init__(self, creds, root_uri, timeout, module, resource_id=None,
data_modification=False, strip_etag_quotes=False, ciphers=None):

View file

@ -89,7 +89,7 @@ def redis_auth_params(module):
return params
class RedisAnsible(object):
class RedisAnsible:
'''Base class for Redis module'''
def __init__(self, module):

View file

@ -95,7 +95,7 @@ def filter_sensitive_attributes(container, attributes):
return container
class SecretVariables(object):
class SecretVariables:
@staticmethod
def ensure_scaleway_secret_package(module):
if not HAS_SCALEWAY_SECRET_PACKAGE:
@ -139,7 +139,7 @@ def resource_attributes_should_be_changed(target, wished, verifiable_mutable_att
return diff
class Response(object):
class Response:
def __init__(self, resp, info):
self.body = None
@ -167,7 +167,7 @@ class Response(object):
return self.status_code in (200, 201, 202, 204)
class Scaleway(object):
class Scaleway:
def __init__(self, module):
self.module = module

View file

@ -8,7 +8,7 @@ from __future__ import annotations
import copy
class _Variable(object):
class _Variable:
NOTHING = object()
def __init__(self, diff=False, output=True, change=None, fact=False, verbosity=0):
@ -104,7 +104,7 @@ class _Variable(object):
)
class VarDict(object):
class VarDict:
reserved_names = ('__vars__', '_var', 'var', 'set_meta', 'get_meta', 'set', 'output', 'diff', 'facts', 'has_changed', 'as_dict')
def __init__(self):

View file

@ -756,7 +756,7 @@ def get_xenserver_version(module):
return xenserver_version
class XAPI(object):
class XAPI:
"""Class for XAPI session management."""
_xapi_session = None
@ -820,7 +820,7 @@ class XAPI(object):
return cls._xapi_session
class XenServerObject(object):
class XenServerObject:
"""Base class for all XenServer objects.
This class contains active XAPI session reference and common