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

This commit is contained in:
Mads Jensen
2021-02-25 14:59:00 -08:00
committed by GitHub
parent 135187f03e
commit 67c2b27af7
47 changed files with 58 additions and 58 deletions
+3 -3
View File
@@ -33,7 +33,7 @@ DEFAULT_NETWORK_TIMEOUT = 45
DER_CONTENT_TYPE = 'application/pkix-cert' DER_CONTENT_TYPE = 'application/pkix-cert'
class ClientBase(object): class ClientBase:
"""ACME client base object. """ACME client base object.
:ivar messages.Directory directory: :ivar messages.Directory directory:
@@ -795,7 +795,7 @@ class ClientV2(ClientBase):
if 'rel' in l and 'url' in l and l['rel'] == relation_type] 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 """ACME client wrapper that tends towards V2-style calls, but
supports V1 servers. supports V1 servers.
@@ -938,7 +938,7 @@ class BackwardsCompatibleClientV2(object):
return self.client.external_account_required() return self.client.external_account_required()
class ClientNetwork(object): class ClientNetwork:
"""Wrapper around requests that signs POSTs for authentication. """Wrapper around requests that signs POSTs for authentication.
Also adds user agent, and handles Content-Type. Also adds user agent, and handles Content-Type.
+3 -3
View File
@@ -27,7 +27,7 @@ logger = logging.getLogger(__name__)
_DEFAULT_SSL_METHOD = SSL.SSLv23_METHOD # type: ignore _DEFAULT_SSL_METHOD = SSL.SSLv23_METHOD # type: ignore
class _DefaultCertSelection(object): class _DefaultCertSelection:
def __init__(self, certs): def __init__(self, certs):
self.certs = certs self.certs = certs
@@ -36,7 +36,7 @@ class _DefaultCertSelection(object):
return self.certs.get(server_name, None) 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. """SSL wrapper for sockets.
:ivar socket sock: Original wrapped socket. :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) new_context.set_alpn_select_callback(self.alpn_selection)
connection.set_context(new_context) connection.set_context(new_context)
class FakeConnection(object): class FakeConnection:
"""Fake OpenSSL.SSL.Connection.""" """Fake OpenSSL.SSL.Connection."""
# pylint: disable=missing-function-docstring # pylint: disable=missing-function-docstring
+1 -1
View File
@@ -2,7 +2,7 @@
import sys import sys
class TypingClass(object): class TypingClass:
"""Ignore import errors by getting anything""" """Ignore import errors by getting anything"""
def __getattr__(self, name): def __getattr__(self, name):
return None return None
+1 -1
View File
@@ -274,7 +274,7 @@ class ResourceBody(jose.JSONObjectWithFields):
"""ACME Resource Body.""" """ACME Resource Body."""
class ExternalAccountBinding(object): class ExternalAccountBinding:
"""ACME External Account Binding""" """ACME External Account Binding"""
@classmethod @classmethod
+1 -1
View File
@@ -1,7 +1,7 @@
"""Useful mixins for Challenge and Resource objects""" """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.""" """This mixin stores the version of Let's Encrypt's endpoint being used."""
@property @property
def le_acme_version(self): def le_acme_version(self):
+1 -1
View File
@@ -53,7 +53,7 @@ class ACMEServerMixin:
allow_reuse_address = True allow_reuse_address = True
class BaseDualNetworkedServers(object): class BaseDualNetworkedServers:
"""Base class for a pair of IPv6 and IPv4 servers that tries to do everything """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 it's asked for both servers, but where failures in one server don't
affect the other. affect the other.
@@ -4,7 +4,7 @@ from certbot_apache._internal import augeasparser
from certbot_apache._internal import apacheparser from certbot_apache._internal import apacheparser
class DualNodeBase(object): class DualNodeBase:
""" Dual parser interface for in development testing. This is used as the """ Dual parser interface for in development testing. This is used as the
base class for dual parser interface classes. This class handles runtime base class for dual parser interface classes. This class handles runtime
attribute value assertions.""" attribute value assertions."""
@@ -95,7 +95,7 @@ class Addr(common.Addr):
return self.get_addr_obj(port) return self.get_addr_obj(port)
class VirtualHost(object): class VirtualHost:
"""Represents an Apache Virtualhost. """Represents an Apache Virtualhost.
:ivar str filep: file path of VH :ivar str filep: file path of VH
@@ -16,7 +16,7 @@ from certbot_apache._internal import constants
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class ApacheParser(object): class ApacheParser:
"""Class handles the fine details of parsing the Apache Configuration. """Class handles the fine details of parsing the Apache Configuration.
.. todo:: Make parsing general... remove sites-available etc... .. todo:: Make parsing general... remove sites-available etc...
@@ -7,7 +7,7 @@ import tempfile
from certbot_integration_tests.utils import certbot_call from certbot_integration_tests.utils import certbot_call
class IntegrationTestsContext(object): class IntegrationTestsContext:
"""General fixture describing a certbot integration tests context""" """General fixture describing a certbot integration tests context"""
def __init__(self, request): def __init__(self, request):
self.request = request self.request = request
@@ -23,7 +23,7 @@ from certbot_integration_tests.utils import proxy
from certbot_integration_tests.utils.constants import * 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 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 instance, to allow parallel execution of integration tests against the unique http-01 port
@@ -21,7 +21,7 @@ BIND_BIND_ADDRESS = ("127.0.0.1", 45953)
BIND_TEST_QUERY = bytearray.fromhex("0011cb37000000010000000000000000010003") BIND_TEST_QUERY = bytearray.fromhex("0011cb37000000010000000000000000010003")
class DNSServer(object): class DNSServer:
""" """
DNSServer configures and handles the lifetime of an RFC2136-capable server. DNSServer configures and handles the lifetime of an RFC2136-capable server.
DNServer provides access to the dns_xdist parameter, listing the address and port DNServer provides access to the dns_xdist parameter, listing the address and port
@@ -11,7 +11,7 @@ from certbot_compatibility_test import util
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class Proxy(object): class Proxy:
"""A common base for compatibility test configurators""" """A common base for compatibility test configurators"""
@classmethod @classmethod
@@ -10,7 +10,7 @@ from acme import errors as acme_errors
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class Validator(object): class Validator:
"""Collection of functions to test a live webserver's configuration""" """Collection of functions to test a live webserver's configuration"""
def certificate(self, cert, name, alt_host=None, port=443): def certificate(self, cert, name, alt_host=None, port=443):
@@ -85,7 +85,7 @@ class Authenticator(dns_common.DNSAuthenticator):
return _CloudflareClient(self.credentials.conf('email'), self.credentials.conf('api-key')) return _CloudflareClient(self.credentials.conf('email'), self.credentials.conf('api-key'))
class _CloudflareClient(object): class _CloudflareClient:
""" """
Encapsulates all communication with the Cloudflare API. Encapsulates all communication with the Cloudflare API.
""" """
@@ -54,7 +54,7 @@ class Authenticator(dns_common.DNSAuthenticator):
return _DigitalOceanClient(self.credentials.conf('token')) return _DigitalOceanClient(self.credentials.conf('token'))
class _DigitalOceanClient(object): class _DigitalOceanClient:
""" """
Encapsulates all communication with the DigitalOcean API. Encapsulates all communication with the DigitalOcean API.
""" """
@@ -76,7 +76,7 @@ class Authenticator(dns_common.DNSAuthenticator):
return _GoogleClient(self.conf('credentials')) return _GoogleClient(self.conf('credentials'))
class _GoogleClient(object): class _GoogleClient:
""" """
Encapsulates all communication with the Google Cloud DNS API. Encapsulates all communication with the Google Cloud DNS API.
""" """
+1 -1
View File
@@ -401,7 +401,7 @@ class GoogleClientTest(unittest.TestCase):
self.assertRaises(ServerNotFoundError, _GoogleClient.get_project_id) 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 Dummy object to create a fake HTTPResponse (the actual one requires a socket and we only
need the status attribute) need the status attribute)
@@ -88,7 +88,7 @@ class Authenticator(dns_common.DNSAuthenticator):
dns.tsig.HMAC_MD5)) dns.tsig.HMAC_MD5))
class _RFC2136Client(object): class _RFC2136Client:
""" """
Encapsulates all communication with the target DNS server. Encapsulates all communication with the target DNS server.
""" """
@@ -19,7 +19,7 @@ from acme.magic_typing import IO, Any # pylint: disable=unused-import
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class RawNginxParser(object): class RawNginxParser:
# pylint: disable=pointless-statement # pylint: disable=pointless-statement
"""A class that parses nginx configuration with pyparsing.""" """A class that parses nginx configuration with pyparsing."""
@@ -69,7 +69,7 @@ class RawNginxParser(object):
"""Returns the parsed tree as a list.""" """Returns the parsed tree as a list."""
return self.parse().asList() return self.parse().asList()
class RawNginxDumper(object): class RawNginxDumper:
"""A class that dumps nginx configuration from the provided tree.""" """A class that dumps nginx configuration from the provided tree."""
def __init__(self, blocks): def __init__(self, blocks):
self.blocks = blocks self.blocks = blocks
+1 -1
View File
@@ -143,7 +143,7 @@ class Addr(common.Addr):
return False return False
class VirtualHost(object): class VirtualHost:
"""Represents an Nginx Virtualhost. """Represents an Nginx Virtualhost.
:ivar str filep: file path of VH :ivar str filep: file path of VH
@@ -21,7 +21,7 @@ from certbot_nginx._internal import obj
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class NginxParser(object): class NginxParser:
"""Class handles the fine details of parsing the Nginx Configuration. """Class handles the fine details of parsing the Nginx Configuration.
:ivar str root: Normalized absolute path to the server root :ivar str root: Normalized absolute path to the server root
@@ -13,7 +13,7 @@ COMMENT = " managed by Certbot"
COMMENT_BLOCK = ["#", COMMENT] COMMENT_BLOCK = ["#", COMMENT]
class Parsable(object): class Parsable:
""" Abstract base class for "Parsable" objects whose underlying representation """ Abstract base class for "Parsable" objects whose underlying representation
is a tree of lists. is a tree of lists.
+1 -1
View File
@@ -24,7 +24,7 @@ from certbot.compat import filesystem
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class Account(object): class Account:
"""ACME protocol registration. """ACME protocol registration.
:ivar .RegistrationResource regr: Registration Resource :ivar .RegistrationResource regr: Registration Resource
+1 -1
View File
@@ -19,7 +19,7 @@ from certbot._internal import error_handler
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class AuthHandler(object): class AuthHandler:
"""ACME Authorization Handler for a client. """ACME Authorization Handler for a client.
:ivar auth: Authenticator capable of solving :ivar auth: Authenticator capable of solving
+2 -2
View File
@@ -12,7 +12,7 @@ from certbot.compat import os
from certbot._internal import constants 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""" """A class to use as a default to detect if a value is set by a user"""
def __bool__(self): def __bool__(self):
@@ -66,7 +66,7 @@ def config_help(name, hidden=False):
return field.__doc__ return field.__doc__
class HelpfulArgumentGroup(object): class HelpfulArgumentGroup:
"""Emulates an argparse group for use with HelpfulArgumentParser. """Emulates an argparse group for use with HelpfulArgumentParser.
This class is used in the add_group method of HelpfulArgumentParser. This class is used in the add_group method of HelpfulArgumentParser.
+1 -1
View File
@@ -41,7 +41,7 @@ from certbot._internal.cli import (
) )
class HelpfulArgumentParser(object): class HelpfulArgumentParser:
"""Argparse Wrapper. """Argparse Wrapper.
This class wraps argparse, adding the ability to make --help less This class wraps argparse, adding the ability to make --help less
+2 -2
View File
@@ -93,7 +93,7 @@ def ua_flags(config):
flags.append("hook") flags.append("hook")
return " ".join(flags) return " ".join(flags)
class DummyConfig(object): class DummyConfig:
"Shim for computing a sample user agent." "Shim for computing a sample user agent."
def __init__(self): def __init__(self):
self.authenticator = "XXX" self.authenticator = "XXX"
@@ -227,7 +227,7 @@ def perform_registration(acme, config, tos_cb):
raise raise
class Client(object): class Client:
"""Certbot's client. """Certbot's client.
:ivar .IConfig config: Client configuration. :ivar .IConfig config: Client configuration.
+1 -1
View File
@@ -13,7 +13,7 @@ from certbot.compat import os
@zope.interface.implementer(interfaces.IConfig) @zope.interface.implementer(interfaces.IConfig)
class NamespaceConfig(object): class NamespaceConfig:
"""Configuration wrapper around :class:`argparse.Namespace`. """Configuration wrapper around :class:`argparse.Namespace`.
For more documentation, including available attributes, please see For more documentation, including available attributes, please see
@@ -8,7 +8,7 @@ except ImportError:
import certbot._internal.display.dummy_readline as readline # type: ignore import certbot._internal.display.dummy_readline as readline # type: ignore
class Completer(object): class Completer:
"""Provides Tab completion when prompting users for a path. """Provides Tab completion when prompting users for a path.
This class is meant to be used with readline to provide Tab This class is meant to be used with readline to provide Tab
+1 -1
View File
@@ -45,7 +45,7 @@ else:
_SIGNALS = [] _SIGNALS = []
class ErrorHandler(object): class ErrorHandler:
"""Context manager for running code that must be cleaned up on failure. """Context manager for running code that must be cleaned up on failure.
The context manager allows you to register functions that will be called The context manager allows you to register functions that will be called
+2 -2
View File
@@ -38,7 +38,7 @@ def lock_dir(dir_path):
return LockFile(os.path.join(dir_path, '.certbot.lock')) return LockFile(os.path.join(dir_path, '.certbot.lock'))
class LockFile(object): class LockFile:
""" """
Platform independent file lock system. Platform independent file lock system.
LockFile accepts a parameter, the path to a file acting as a lock. Once the LockFile, 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() return self._lock_mechanism.is_locked()
class _BaseLockMechanism(object): class _BaseLockMechanism:
def __init__(self, path): def __init__(self, path):
# type: (str) -> None # type: (str) -> None
""" """
+1 -1
View File
@@ -39,7 +39,7 @@ PREFIX_FREE_DISTRIBUTIONS = [
"""Distributions for which prefix will be omitted.""" """Distributions for which prefix will be omitted."""
class PluginEntryPoint(object): class PluginEntryPoint:
"""Plugin entry point.""" """Plugin entry point."""
# this object is mutable, don't allow it to be hashed! # this object is mutable, don't allow it to be hashed!
@@ -28,7 +28,7 @@ if TYPE_CHECKING:
Set[achallenges.KeyAuthorizationAnnotatedChallenge] Set[achallenges.KeyAuthorizationAnnotatedChallenge]
] ]
class ServerManager(object): class ServerManager:
"""Standalone servers manager. """Standalone servers manager.
Manager for `ACMEServer` and `ACMETLSServer` instances. Manager for `ACMEServer` and `ACMETLSServer` instances.
+1 -1
View File
@@ -16,7 +16,7 @@ logger = logging.getLogger(__name__)
@zope.interface.implementer(interfaces.IReporter) @zope.interface.implementer(interfaces.IReporter)
class Reporter(object): class Reporter:
"""Collects and displays information to the user. """Collects and displays information to the user.
:ivar `queue.PriorityQueue` messages: Messages to be displayed to :ivar `queue.PriorityQueue` messages: Messages to be displayed to
+2 -2
View File
@@ -111,7 +111,7 @@ def notify(msg):
@zope.interface.implementer(interfaces.IDisplay) @zope.interface.implementer(interfaces.IDisplay)
class FileDisplay(object): class FileDisplay:
"""File-based display.""" """File-based display."""
# see https://github.com/certbot/certbot/issues/3915 # 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) @zope.interface.implementer(interfaces.IDisplay)
class NoninteractiveDisplay(object): class NoninteractiveDisplay:
"""An iDisplay implementation that never asks for interactive user input""" """An iDisplay implementation that never asks for interactive user input"""
def __init__(self, outfile, *unused_args, **unused_kwargs): def __init__(self, outfile, *unused_args, **unused_kwargs):
+1 -1
View File
@@ -36,7 +36,7 @@ except (ImportError, AttributeError): # pragma: no cover
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class RevocationChecker(object): class RevocationChecker:
"""This class figures out OCSP checking on this system, and performs it.""" """This class figures out OCSP checking on this system, and performs it."""
def __init__(self, enforce_openssl_binary_usage=False): def __init__(self, enforce_openssl_binary_usage=False):
+3 -3
View File
@@ -40,7 +40,7 @@ hostname_regex = re.compile(
@zope.interface.implementer(interfaces.IPlugin) @zope.interface.implementer(interfaces.IPlugin)
class Plugin(object): class Plugin:
"""Generic plugin.""" """Generic plugin."""
# provider is not inherited, subclasses must define it on their own # provider is not inherited, subclasses must define it on their own
# @zope.interface.provider(interfaces.IPluginFactory) # @zope.interface.provider(interfaces.IPluginFactory)
@@ -201,7 +201,7 @@ class Installer(Plugin):
constants.ALL_SSL_DHPARAMS_HASHES) constants.ALL_SSL_DHPARAMS_HASHES)
class Addr(object): class Addr:
r"""Represents an virtual host address. r"""Represents an virtual host address.
:param str addr: addr part of vhost address :param str addr: addr part of vhost address
@@ -299,7 +299,7 @@ class Addr(object):
return result return result
class ChallengePerformer(object): class ChallengePerformer:
"""Abstract base for challenge performers. """Abstract base for challenge performers.
:ivar configurator: Authenticator and installer plugin :ivar configurator: Authenticator and installer plugin
+1 -1
View File
@@ -233,7 +233,7 @@ class DNSAuthenticator(common.Plugin):
raise errors.PluginError('{0} required to proceed.'.format(label)) raise errors.PluginError('{0} required to proceed.'.format(label))
class CredentialsConfiguration(object): class CredentialsConfiguration:
"""Represents a user-supplied filed which stores API credentials.""" """Represents a user-supplied filed which stores API credentials."""
def __init__(self, filename, mapper=lambda x: x): def __init__(self, filename, mapper=lambda x: x):
@@ -23,7 +23,7 @@ except ImportError:
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class LexiconClient(object): class LexiconClient:
""" """
Encapsulates all communication with a DNS provider via Lexicon. Encapsulates all communication with a DNS provider via Lexicon.
""" """
+1 -1
View File
@@ -17,7 +17,7 @@ DOMAIN = 'example.com'
KEY = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem")) 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. A base test class to reduce duplication between test code for DNS Authenticator Plugins.
@@ -34,7 +34,7 @@ class BaseLexiconAuthenticatorTest(dns_test_common.BaseAuthenticatorTest):
self.assertEqual(expected, self.mock_client.mock_calls) self.assertEqual(expected, self.mock_client.mock_calls)
class BaseLexiconClientTest(object): class BaseLexiconClientTest:
DOMAIN_NOT_FOUND = Exception('No domain found') DOMAIN_NOT_FOUND = Exception('No domain found')
GENERIC_ERROR = RequestException GENERIC_ERROR = RequestException
LOGIN_ERROR = HTTPError('400 Client Error: ...') LOGIN_ERROR = HTTPError('400 Client Error: ...')
+1 -1
View File
@@ -11,7 +11,7 @@ from certbot.compat import os
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class PluginStorage(object): class PluginStorage:
"""Class implementing storage functionality for plugins""" """Class implementing storage functionality for plugins"""
def __init__(self, config, classkey): def __init__(self, config, classkey):
+1 -1
View File
@@ -17,7 +17,7 @@ from certbot.compat import os
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class Reverter(object): class Reverter:
"""Reverter Class - save and revert configuration checkpoints. """Reverter Class - save and revert configuration checkpoints.
This class can be used by the plugins, especially Installers, to This class can be used by the plugins, especially Installers, to
+1 -1
View File
@@ -185,7 +185,7 @@ def patch_get_utility_with_stdout(target='zope.component.getUtility',
return mock.patch(target, new=freezable_mock) return mock.patch(target, new=freezable_mock)
class FreezableMock(object): class FreezableMock:
"""Mock object with the ability to freeze attributes. """Mock object with the ability to freeze attributes.
This class works like a regular mock.MagicMock object, except This class works like a regular mock.MagicMock object, except
+1 -1
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 def more_info(self): # pylint: disable=missing-docstring,no-self-use
return 'A fake authenticator for testing.' return 'A fake authenticator for testing.'
class _FakeConfig(object): class _FakeConfig:
fake_propagation_seconds = 0 fake_propagation_seconds = 0
fake_config_key = 1 fake_config_key = 1
fake_other_key = None fake_other_key = None
+1 -1
View File
@@ -95,7 +95,7 @@ SECURITY_GROUP_NAME = 'certbot-security-group'
SENTINEL = None #queue kill signal SENTINEL = None #queue kill signal
SUBNET_NAME = 'certbot-subnet' SUBNET_NAME = 'certbot-subnet'
class Status(object): class Status:
"""Possible statuses of client tests.""" """Possible statuses of client tests."""
PASS = 'pass' PASS = 'pass'
FAIL = 'fail' FAIL = 'fail'