Merge branch 'master' into pr/9071

This commit is contained in:
Adrien Ferrand 2022-01-19 11:12:47 +01:00
commit d1097d476f
11 changed files with 23 additions and 25 deletions

View file

@ -34,10 +34,9 @@ class TLSServer(socketserver.TCPServer):
else:
self.address_family = socket.AF_INET
self.certs = kwargs.pop("certs", {})
self.method = kwargs.pop(
"method", crypto_util._DEFAULT_SSL_METHOD)
self.method = kwargs.pop("method", crypto_util._DEFAULT_SSL_METHOD)
self.allow_reuse_address = kwargs.pop("allow_reuse_address", True)
socketserver.TCPServer.__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
def _wrap_sock(self) -> None:
self.socket = crypto_util.SSLSocket(
@ -190,7 +189,7 @@ class HTTPServer(BaseHTTPServer.HTTPServer):
self.address_family = socket.AF_INET6
else:
self.address_family = socket.AF_INET
BaseHTTPServer.HTTPServer.__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
class HTTP01Server(HTTPServer, ACMEServerMixin):
@ -198,8 +197,8 @@ class HTTP01Server(HTTPServer, ACMEServerMixin):
def __init__(self, server_address: Tuple[str, int], resources: Set[challenges.HTTP01],
ipv6: bool = False, timeout: int = 30) -> None:
HTTPServer.__init__(
self, server_address, HTTP01RequestHandler.partial_init(
super().__init__(
server_address, HTTP01RequestHandler.partial_init(
simple_http_resources=resources, timeout=timeout), ipv6=ipv6)
@ -208,7 +207,7 @@ class HTTP01DualNetworkedServers(BaseDualNetworkedServers):
affect the other."""
def __init__(self, *args: Any, **kwargs: Any) -> None:
BaseDualNetworkedServers.__init__(self, HTTP01Server, *args, **kwargs)
super().__init__(HTTP01Server, *args, **kwargs)
class HTTP01RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
@ -226,7 +225,7 @@ class HTTP01RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def __init__(self, *args: Any, **kwargs: Any) -> None:
self.simple_http_resources = kwargs.pop("simple_http_resources", set())
self._timeout = kwargs.pop('timeout', 30)
BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
self.server: HTTP01Server
# In parent class BaseHTTPRequestHandler, 'timeout' is a class-level property but we

View file

@ -165,7 +165,6 @@ class TLSALPN01ServerTest(unittest.TestCase):
class BaseDualNetworkedServersTest(unittest.TestCase):
"""Test for acme.standalone.BaseDualNetworkedServers."""
class SingleProtocolServer(socketserver.TCPServer):
"""Server that only serves on a single protocol. FreeBSD has this behavior for AF_INET6."""
def __init__(self, *args, **kwargs):
@ -175,7 +174,7 @@ class BaseDualNetworkedServersTest(unittest.TestCase):
kwargs["bind_and_activate"] = False
else:
self.address_family = socket.AF_INET
socketserver.TCPServer.__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
if ipv6:
# NB: On Windows, socket.IPPROTO_IPV6 constant may be missing.
# We use the corresponding value (41) instead.
@ -202,7 +201,6 @@ class BaseDualNetworkedServersTest(unittest.TestCase):
self.assertEqual(em.exception.errno, EADDRINUSE)
def test_ports_equal(self):
from acme.standalone import BaseDualNetworkedServers
servers = BaseDualNetworkedServers(

View file

@ -28,7 +28,7 @@ from certbot_nginx._internal import constants
from certbot_nginx._internal import display_ops
from certbot_nginx._internal import http_01
from certbot_nginx._internal import nginxparser
from certbot_nginx._internal import obj # pylint: disable=unused-import
from certbot_nginx._internal import obj
from certbot_nginx._internal import parser
NAME_RANK = 0

View file

@ -118,7 +118,7 @@ class UnspacedList(list):
# Turn self into a version of the source list that has spaces removed
# and all sub-lists also UnspacedList()ed
list.__init__(self, list_source)
super().__init__(list_source)
for i, entry in reversed(list(enumerate(self))):
if isinstance(entry, list):
sublist = UnspacedList(entry)

View file

@ -20,7 +20,7 @@ import pytz
from acme import fields as acme_fields
from acme import messages
from acme.client import ClientBase # pylint: disable=unused-import
from acme.client import ClientBase
from certbot import configuration
from certbot import errors
from certbot import interfaces
@ -125,6 +125,7 @@ class AccountMemoryStorage(interfaces.AccountStorage):
except KeyError:
raise errors.AccountNotFound(account_id)
class RegistrationResourceWithNewAuthzrURI(messages.RegistrationResource):
"""A backwards-compatible RegistrationResource with a new-authz URI.
@ -136,6 +137,7 @@ class RegistrationResourceWithNewAuthzrURI(messages.RegistrationResource):
"""
new_authzr_uri = jose.Field('new_authzr_uri')
class AccountFileStorage(interfaces.AccountStorage):
"""Accounts file storage.

View file

@ -167,6 +167,7 @@ class ErrorHandler:
logger.debug("Calling signal %s", signum)
os.kill(os.getpid(), signum)
class ExitHandler(ErrorHandler):
"""Context manager for running code that must be cleaned up.
@ -175,5 +176,5 @@ class ExitHandler(ErrorHandler):
regular exit.
"""
def __init__(self, func: Callable[..., Any], *args: Any, **kwargs: Any) -> None:
ErrorHandler.__init__(self, func, *args, **kwargs)
super().__init__(func, *args, **kwargs)
self.call_on_regular_exit = True

View file

@ -22,7 +22,7 @@ from certbot import crypto_util
from certbot import errors
from certbot import util
from certbot.compat.os import getenv
from certbot.interfaces import RenewableCert # pylint: disable=unused-import
from certbot.interfaces import RenewableCert
logger = logging.getLogger(__name__)

View file

@ -10,9 +10,9 @@ import string
import sys
import unittest
from certbot.compat import filesystem # pylint: disable=ungrouped-imports
from certbot.compat import os # pylint: disable=ungrouped-imports
import certbot.tests.util as test_util # pylint: disable=ungrouped-imports
from certbot.compat import filesystem
from certbot.compat import os
import certbot.tests.util as test_util
try:
import mock

View file

@ -18,7 +18,7 @@ import pytz
from certbot import crypto_util, configuration
from certbot import errors
from certbot import interfaces # pylint: disable=unused-import
from certbot import interfaces
from certbot import util
from certbot._internal import account
from certbot._internal import cli
@ -529,7 +529,6 @@ class DeleteIfAppropriateTest(test_util.ConfigTestCase):
def test_opt_in_deletion(self, mock_get_utility, mock_delete,
mock_cert_path_to_lineage, mock_full_archive_dir,
mock_match_and_check_overlaps, mock_renewal_file_for_certname):
# pylint: disable = unused-argument
config = self.config
config.namespace.delete_after_revoke = True
config.cert_path = "/some/reasonable/path"

View file

@ -133,7 +133,7 @@ class CredentialsConfigurationTest(test_util.TempDirTestCase):
def __init__(self, *args, **kwargs):
self.reset()
logging.Handler.__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
def emit(self, record):
self.messages[record.levelname.lower()].append(record.getMessage())

View file

@ -7,10 +7,10 @@ from typing import Tuple
import unittest
import josepy as jose
import OpenSSL.crypto # pylint: disable=unused-import
import OpenSSL.crypto
from acme import challenges
from acme import standalone as acme_standalone # pylint: disable=unused-import
from acme import standalone as acme_standalone
from certbot import achallenges
from certbot import errors
from certbot.tests import acme_util
@ -22,7 +22,6 @@ except ImportError: # pragma: no cover
from unittest import mock
class ServerManagerTest(unittest.TestCase):
"""Tests for certbot._internal.plugins.standalone.ServerManager."""