Stop inheriting from object. It's unneeded on Python 3+. (#8675)

This commit is contained in:
Mads Jensen 2021-02-25 23:59:00 +01:00 committed by GitHub
parent 135187f03e
commit 67c2b27af7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 58 additions and 58 deletions

View file

@ -33,7 +33,7 @@ DEFAULT_NETWORK_TIMEOUT = 45
DER_CONTENT_TYPE = 'application/pkix-cert'
class ClientBase(object):
class ClientBase:
"""ACME client base object.
:ivar messages.Directory directory:
@ -795,7 +795,7 @@ class ClientV2(ClientBase):
if 'rel' in l and 'url' in l and l['rel'] == relation_type]
class BackwardsCompatibleClientV2(object):
class BackwardsCompatibleClientV2:
"""ACME client wrapper that tends towards V2-style calls, but
supports V1 servers.
@ -938,7 +938,7 @@ class BackwardsCompatibleClientV2(object):
return self.client.external_account_required()
class ClientNetwork(object):
class ClientNetwork:
"""Wrapper around requests that signs POSTs for authentication.
Also adds user agent, and handles Content-Type.

View file

@ -27,7 +27,7 @@ logger = logging.getLogger(__name__)
_DEFAULT_SSL_METHOD = SSL.SSLv23_METHOD # type: ignore
class _DefaultCertSelection(object):
class _DefaultCertSelection:
def __init__(self, certs):
self.certs = certs
@ -36,7 +36,7 @@ class _DefaultCertSelection(object):
return self.certs.get(server_name, None)
class SSLSocket(object): # pylint: disable=too-few-public-methods
class SSLSocket: # pylint: disable=too-few-public-methods
"""SSL wrapper for sockets.
:ivar socket sock: Original wrapped socket.
@ -93,7 +93,7 @@ class SSLSocket(object): # pylint: disable=too-few-public-methods
new_context.set_alpn_select_callback(self.alpn_selection)
connection.set_context(new_context)
class FakeConnection(object):
class FakeConnection:
"""Fake OpenSSL.SSL.Connection."""
# pylint: disable=missing-function-docstring

View file

@ -2,7 +2,7 @@
import sys
class TypingClass(object):
class TypingClass:
"""Ignore import errors by getting anything"""
def __getattr__(self, name):
return None

View file

@ -274,7 +274,7 @@ class ResourceBody(jose.JSONObjectWithFields):
"""ACME Resource Body."""
class ExternalAccountBinding(object):
class ExternalAccountBinding:
"""ACME External Account Binding"""
@classmethod

View file

@ -1,7 +1,7 @@
"""Useful mixins for Challenge and Resource objects"""
class VersionedLEACMEMixin(object):
class VersionedLEACMEMixin:
"""This mixin stores the version of Let's Encrypt's endpoint being used."""
@property
def le_acme_version(self):

View file

@ -53,7 +53,7 @@ class ACMEServerMixin:
allow_reuse_address = True
class BaseDualNetworkedServers(object):
class BaseDualNetworkedServers:
"""Base class for a pair of IPv6 and IPv4 servers that tries to do everything
it's asked for both servers, but where failures in one server don't
affect the other.

View file

@ -4,7 +4,7 @@ from certbot_apache._internal import augeasparser
from certbot_apache._internal import apacheparser
class DualNodeBase(object):
class DualNodeBase:
""" Dual parser interface for in development testing. This is used as the
base class for dual parser interface classes. This class handles runtime
attribute value assertions."""

View file

@ -95,7 +95,7 @@ class Addr(common.Addr):
return self.get_addr_obj(port)
class VirtualHost(object):
class VirtualHost:
"""Represents an Apache Virtualhost.
:ivar str filep: file path of VH

View file

@ -16,7 +16,7 @@ from certbot_apache._internal import constants
logger = logging.getLogger(__name__)
class ApacheParser(object):
class ApacheParser:
"""Class handles the fine details of parsing the Apache Configuration.
.. todo:: Make parsing general... remove sites-available etc...

View file

@ -7,7 +7,7 @@ import tempfile
from certbot_integration_tests.utils import certbot_call
class IntegrationTestsContext(object):
class IntegrationTestsContext:
"""General fixture describing a certbot integration tests context"""
def __init__(self, request):
self.request = request

View file

@ -23,7 +23,7 @@ from certbot_integration_tests.utils import proxy
from certbot_integration_tests.utils.constants import *
class ACMEServer(object):
class ACMEServer:
"""
ACMEServer configures and handles the lifecycle of an ACME CA server and an HTTP reverse proxy
instance, to allow parallel execution of integration tests against the unique http-01 port

View file

@ -21,7 +21,7 @@ BIND_BIND_ADDRESS = ("127.0.0.1", 45953)
BIND_TEST_QUERY = bytearray.fromhex("0011cb37000000010000000000000000010003")
class DNSServer(object):
class DNSServer:
"""
DNSServer configures and handles the lifetime of an RFC2136-capable server.
DNServer provides access to the dns_xdist parameter, listing the address and port

View file

@ -11,7 +11,7 @@ from certbot_compatibility_test import util
logger = logging.getLogger(__name__)
class Proxy(object):
class Proxy:
"""A common base for compatibility test configurators"""
@classmethod

View file

@ -10,7 +10,7 @@ from acme import errors as acme_errors
logger = logging.getLogger(__name__)
class Validator(object):
class Validator:
"""Collection of functions to test a live webserver's configuration"""
def certificate(self, cert, name, alt_host=None, port=443):

View file

@ -85,7 +85,7 @@ class Authenticator(dns_common.DNSAuthenticator):
return _CloudflareClient(self.credentials.conf('email'), self.credentials.conf('api-key'))
class _CloudflareClient(object):
class _CloudflareClient:
"""
Encapsulates all communication with the Cloudflare API.
"""

View file

@ -54,7 +54,7 @@ class Authenticator(dns_common.DNSAuthenticator):
return _DigitalOceanClient(self.credentials.conf('token'))
class _DigitalOceanClient(object):
class _DigitalOceanClient:
"""
Encapsulates all communication with the DigitalOcean API.
"""

View file

@ -76,7 +76,7 @@ class Authenticator(dns_common.DNSAuthenticator):
return _GoogleClient(self.conf('credentials'))
class _GoogleClient(object):
class _GoogleClient:
"""
Encapsulates all communication with the Google Cloud DNS API.
"""

View file

@ -401,7 +401,7 @@ class GoogleClientTest(unittest.TestCase):
self.assertRaises(ServerNotFoundError, _GoogleClient.get_project_id)
class DummyResponse(object):
class DummyResponse:
"""
Dummy object to create a fake HTTPResponse (the actual one requires a socket and we only
need the status attribute)

View file

@ -88,7 +88,7 @@ class Authenticator(dns_common.DNSAuthenticator):
dns.tsig.HMAC_MD5))
class _RFC2136Client(object):
class _RFC2136Client:
"""
Encapsulates all communication with the target DNS server.
"""

View file

@ -19,7 +19,7 @@ from acme.magic_typing import IO, Any # pylint: disable=unused-import
logger = logging.getLogger(__name__)
class RawNginxParser(object):
class RawNginxParser:
# pylint: disable=pointless-statement
"""A class that parses nginx configuration with pyparsing."""
@ -69,7 +69,7 @@ class RawNginxParser(object):
"""Returns the parsed tree as a list."""
return self.parse().asList()
class RawNginxDumper(object):
class RawNginxDumper:
"""A class that dumps nginx configuration from the provided tree."""
def __init__(self, blocks):
self.blocks = blocks

View file

@ -143,7 +143,7 @@ class Addr(common.Addr):
return False
class VirtualHost(object):
class VirtualHost:
"""Represents an Nginx Virtualhost.
:ivar str filep: file path of VH

View file

@ -21,7 +21,7 @@ from certbot_nginx._internal import obj
logger = logging.getLogger(__name__)
class NginxParser(object):
class NginxParser:
"""Class handles the fine details of parsing the Nginx Configuration.
:ivar str root: Normalized absolute path to the server root

View file

@ -13,7 +13,7 @@ COMMENT = " managed by Certbot"
COMMENT_BLOCK = ["#", COMMENT]
class Parsable(object):
class Parsable:
""" Abstract base class for "Parsable" objects whose underlying representation
is a tree of lists.

View file

@ -24,7 +24,7 @@ from certbot.compat import filesystem
logger = logging.getLogger(__name__)
class Account(object):
class Account:
"""ACME protocol registration.
:ivar .RegistrationResource regr: Registration Resource

View file

@ -19,7 +19,7 @@ from certbot._internal import error_handler
logger = logging.getLogger(__name__)
class AuthHandler(object):
class AuthHandler:
"""ACME Authorization Handler for a client.
:ivar auth: Authenticator capable of solving

View file

@ -12,7 +12,7 @@ from certbot.compat import os
from certbot._internal import constants
class _Default(object):
class _Default:
"""A class to use as a default to detect if a value is set by a user"""
def __bool__(self):
@ -66,7 +66,7 @@ def config_help(name, hidden=False):
return field.__doc__
class HelpfulArgumentGroup(object):
class HelpfulArgumentGroup:
"""Emulates an argparse group for use with HelpfulArgumentParser.
This class is used in the add_group method of HelpfulArgumentParser.

View file

@ -41,7 +41,7 @@ from certbot._internal.cli import (
)
class HelpfulArgumentParser(object):
class HelpfulArgumentParser:
"""Argparse Wrapper.
This class wraps argparse, adding the ability to make --help less

View file

@ -93,7 +93,7 @@ def ua_flags(config):
flags.append("hook")
return " ".join(flags)
class DummyConfig(object):
class DummyConfig:
"Shim for computing a sample user agent."
def __init__(self):
self.authenticator = "XXX"
@ -227,7 +227,7 @@ def perform_registration(acme, config, tos_cb):
raise
class Client(object):
class Client:
"""Certbot's client.
:ivar .IConfig config: Client configuration.

View file

@ -13,7 +13,7 @@ from certbot.compat import os
@zope.interface.implementer(interfaces.IConfig)
class NamespaceConfig(object):
class NamespaceConfig:
"""Configuration wrapper around :class:`argparse.Namespace`.
For more documentation, including available attributes, please see

View file

@ -8,7 +8,7 @@ except ImportError:
import certbot._internal.display.dummy_readline as readline # type: ignore
class Completer(object):
class Completer:
"""Provides Tab completion when prompting users for a path.
This class is meant to be used with readline to provide Tab

View file

@ -45,7 +45,7 @@ else:
_SIGNALS = []
class ErrorHandler(object):
class ErrorHandler:
"""Context manager for running code that must be cleaned up on failure.
The context manager allows you to register functions that will be called

View file

@ -38,7 +38,7 @@ def lock_dir(dir_path):
return LockFile(os.path.join(dir_path, '.certbot.lock'))
class LockFile(object):
class LockFile:
"""
Platform independent file lock system.
LockFile accepts a parameter, the path to a file acting as a lock. Once the LockFile,
@ -97,7 +97,7 @@ class LockFile(object):
return self._lock_mechanism.is_locked()
class _BaseLockMechanism(object):
class _BaseLockMechanism:
def __init__(self, path):
# type: (str) -> None
"""

View file

@ -39,7 +39,7 @@ PREFIX_FREE_DISTRIBUTIONS = [
"""Distributions for which prefix will be omitted."""
class PluginEntryPoint(object):
class PluginEntryPoint:
"""Plugin entry point."""
# this object is mutable, don't allow it to be hashed!

View file

@ -28,7 +28,7 @@ if TYPE_CHECKING:
Set[achallenges.KeyAuthorizationAnnotatedChallenge]
]
class ServerManager(object):
class ServerManager:
"""Standalone servers manager.
Manager for `ACMEServer` and `ACMETLSServer` instances.

View file

@ -16,7 +16,7 @@ logger = logging.getLogger(__name__)
@zope.interface.implementer(interfaces.IReporter)
class Reporter(object):
class Reporter:
"""Collects and displays information to the user.
:ivar `queue.PriorityQueue` messages: Messages to be displayed to

View file

@ -111,7 +111,7 @@ def notify(msg):
@zope.interface.implementer(interfaces.IDisplay)
class FileDisplay(object):
class FileDisplay:
"""File-based display."""
# see https://github.com/certbot/certbot/issues/3915
@ -478,7 +478,7 @@ def assert_valid_call(prompt, default, cli_flag, force_interactive):
@zope.interface.implementer(interfaces.IDisplay)
class NoninteractiveDisplay(object):
class NoninteractiveDisplay:
"""An iDisplay implementation that never asks for interactive user input"""
def __init__(self, outfile, *unused_args, **unused_kwargs):

View file

@ -36,7 +36,7 @@ except (ImportError, AttributeError): # pragma: no cover
logger = logging.getLogger(__name__)
class RevocationChecker(object):
class RevocationChecker:
"""This class figures out OCSP checking on this system, and performs it."""
def __init__(self, enforce_openssl_binary_usage=False):

View file

@ -40,7 +40,7 @@ hostname_regex = re.compile(
@zope.interface.implementer(interfaces.IPlugin)
class Plugin(object):
class Plugin:
"""Generic plugin."""
# provider is not inherited, subclasses must define it on their own
# @zope.interface.provider(interfaces.IPluginFactory)
@ -201,7 +201,7 @@ class Installer(Plugin):
constants.ALL_SSL_DHPARAMS_HASHES)
class Addr(object):
class Addr:
r"""Represents an virtual host address.
:param str addr: addr part of vhost address
@ -299,7 +299,7 @@ class Addr(object):
return result
class ChallengePerformer(object):
class ChallengePerformer:
"""Abstract base for challenge performers.
:ivar configurator: Authenticator and installer plugin

View file

@ -233,7 +233,7 @@ class DNSAuthenticator(common.Plugin):
raise errors.PluginError('{0} required to proceed.'.format(label))
class CredentialsConfiguration(object):
class CredentialsConfiguration:
"""Represents a user-supplied filed which stores API credentials."""
def __init__(self, filename, mapper=lambda x: x):

View file

@ -23,7 +23,7 @@ except ImportError:
logger = logging.getLogger(__name__)
class LexiconClient(object):
class LexiconClient:
"""
Encapsulates all communication with a DNS provider via Lexicon.
"""

View file

@ -17,7 +17,7 @@ DOMAIN = 'example.com'
KEY = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem"))
class BaseAuthenticatorTest(object):
class BaseAuthenticatorTest:
"""
A base test class to reduce duplication between test code for DNS Authenticator Plugins.

View file

@ -34,7 +34,7 @@ class BaseLexiconAuthenticatorTest(dns_test_common.BaseAuthenticatorTest):
self.assertEqual(expected, self.mock_client.mock_calls)
class BaseLexiconClientTest(object):
class BaseLexiconClientTest:
DOMAIN_NOT_FOUND = Exception('No domain found')
GENERIC_ERROR = RequestException
LOGIN_ERROR = HTTPError('400 Client Error: ...')

View file

@ -11,7 +11,7 @@ from certbot.compat import os
logger = logging.getLogger(__name__)
class PluginStorage(object):
class PluginStorage:
"""Class implementing storage functionality for plugins"""
def __init__(self, config, classkey):

View file

@ -17,7 +17,7 @@ from certbot.compat import os
logger = logging.getLogger(__name__)
class Reverter(object):
class Reverter:
"""Reverter Class - save and revert configuration checkpoints.
This class can be used by the plugins, especially Installers, to

View file

@ -185,7 +185,7 @@ def patch_get_utility_with_stdout(target='zope.component.getUtility',
return mock.patch(target, new=freezable_mock)
class FreezableMock(object):
class FreezableMock:
"""Mock object with the ability to freeze attributes.
This class works like a regular mock.MagicMock object, except

View file

@ -29,7 +29,7 @@ class DNSAuthenticatorTest(test_util.TempDirTestCase, dns_test_common.BaseAuthen
def more_info(self): # pylint: disable=missing-docstring,no-self-use
return 'A fake authenticator for testing.'
class _FakeConfig(object):
class _FakeConfig:
fake_propagation_seconds = 0
fake_config_key = 1
fake_other_key = None

View file

@ -95,7 +95,7 @@ SECURITY_GROUP_NAME = 'certbot-security-group'
SENTINEL = None #queue kill signal
SUBNET_NAME = 'certbot-subnet'
class Status(object):
class Status:
"""Possible statuses of client tests."""
PASS = 'pass'
FAIL = 'fail'