diff options
author | Adrien Ferrand <ferrand.ad@gmail.com> | 2022-01-20 01:09:06 +0300 |
---|---|---|
committer | Adrien Ferrand <ferrand.ad@gmail.com> | 2022-01-20 01:20:37 +0300 |
commit | 791667216c7fd7ee3ba031d135e72d9d184fc01d (patch) | |
tree | b1531b164c4a195aa60966e56dd9d6e86fd74a4e | |
parent | 7eb6bbae82ef698fdea2d3ce7498477fa1c4a7fb (diff) |
Last fixestest-typed-jose-fields
-rw-r--r-- | acme/acme/challenges.py | 28 | ||||
-rw-r--r-- | acme/acme/crypto_util.py | 8 | ||||
-rw-r--r-- | acme/acme/messages.py | 5 | ||||
-rw-r--r-- | certbot-nginx/certbot_nginx/_internal/configurator.py | 2 | ||||
-rw-r--r-- | certbot-nginx/certbot_nginx/_internal/nginxparser.py | 3 | ||||
-rw-r--r-- | certbot/certbot/_internal/auth_handler.py | 3 |
6 files changed, 26 insertions, 23 deletions
diff --git a/acme/acme/challenges.py b/acme/acme/challenges.py index c2f1e4f72..94d121a21 100644 --- a/acme/acme/challenges.py +++ b/acme/acme/challenges.py @@ -177,7 +177,7 @@ class KeyAuthorizationChallenge(_TokenChallenge, metaclass=abc.ABCMeta): """Generate Key Authorization. :param JWK account_key: - :rtype unicode: + :rtype str: """ return self.encode("token") + "." + jose.b64encode( @@ -238,7 +238,7 @@ class DNS01Response(KeyAuthorizationChallengeResponse): around `KeyAuthorizationChallengeResponse.verify`. :param challenges.DNS01 chall: Corresponding challenge. - :param unicode domain: Domain name being verified. + :param str domain: Domain name being verified. :param JWK account_public_key: Public key for the key pair being authorized. @@ -266,7 +266,7 @@ class DNS01(KeyAuthorizationChallenge): """Generate validation. :param JWK account_key: - :rtype: string + :rtype: str """ return jose.b64encode(hashlib.sha256(self.key_authorization( @@ -276,7 +276,7 @@ class DNS01(KeyAuthorizationChallenge): """Domain name for TXT validation record. :param str name: Domain name being validated. - :rtype: string + :rtype: str """ return "{0}.{1}".format(self.LABEL, name) @@ -303,7 +303,7 @@ class HTTP01Response(KeyAuthorizationChallengeResponse): """Simple verify. :param challenges.SimpleHTTP chall: Corresponding challenge. - :param unicode domain: Domain name being verified. + :param str domain: Domain name being verified. :param JWK account_public_key: Public key for the key pair being authorized. :param int port: Port used in the validation. @@ -367,7 +367,7 @@ class HTTP01(KeyAuthorizationChallenge): def path(self) -> str: """Path (starting with '/') for provisioned resource. - :rtype: string + :rtype: str """ return '/' + self.URI_ROOT_PATH + '/' + self.encode('token') @@ -378,8 +378,8 @@ class HTTP01(KeyAuthorizationChallenge): Forms an URI to the HTTPS server provisioned resource (containing :attr:`~SimpleHTTP.token`). - :param unicode domain: Domain name being verified. - :rtype: string + :param str domain: Domain name being verified. + :rtype: str """ return "http://" + domain + self.path @@ -388,7 +388,7 @@ class HTTP01(KeyAuthorizationChallenge): """Generate validation. :param JWK account_key: - :rtype: string + :rtype: str """ return self.key_authorization(account_key) @@ -419,7 +419,7 @@ class TLSALPN01Response(KeyAuthorizationChallengeResponse): ) -> Tuple[crypto.X509, crypto.PKey]: """Generate tls-alpn-01 certificate. - :param unicode domain: Domain verified by the challenge. + :param str domain: Domain verified by the challenge. :param OpenSSL.crypto.PKey key: Optional private key used in certificate generation. If not provided (``None``), then fresh key will be generated. @@ -443,8 +443,8 @@ class TLSALPN01Response(KeyAuthorizationChallengeResponse): port: Optional[int] = None) -> crypto.X509: """Probe tls-alpn-01 challenge certificate. - :param unicode domain: domain being validated, required. - :param string host: IP address used to probe the certificate. + :param str domain: domain being validated, required. + :param str host: IP address used to probe the certificate. :param int port: Port used to probe the certificate. """ @@ -460,7 +460,7 @@ class TLSALPN01Response(KeyAuthorizationChallengeResponse): def verify_cert(self, domain: str, cert: crypto.X509) -> bool: """Verify tls-alpn-01 challenge certificate. - :param unicode domain: Domain name being validated. + :param str domain: Domain name being validated. :param OpensSSL.crypto.X509 cert: Challenge certificate. :returns: Whether the certificate was successfully verified. @@ -615,7 +615,7 @@ class DNS(_TokenChallenge): def validation_domain_name(self, name: str) -> str: """Domain name for TXT validation record. - :param unicode name: Domain name being validated. + :param str name: Domain name being validated. """ return "{0}.{1}".format(self.LABEL, name) diff --git a/acme/acme/crypto_util.py b/acme/acme/crypto_util.py index c96d0baf3..eb6672926 100644 --- a/acme/acme/crypto_util.py +++ b/acme/acme/crypto_util.py @@ -278,7 +278,7 @@ def _pyopenssl_cert_or_req_san(cert_or_req: Union[crypto.X509, crypto.X509Req]) :type cert_or_req: `OpenSSL.crypto.X509` or `OpenSSL.crypto.X509Req`. :returns: A list of Subject Alternative Names that is DNS. - :rtype: `list` of `unicode` + :rtype: `list` of `str` """ # This function finds SANs with dns name @@ -300,7 +300,7 @@ def _pyopenssl_cert_or_req_san_ip(cert_or_req: Union[crypto.X509, crypto.X509Req :type cert_or_req: `OpenSSL.crypto.X509` or `OpenSSL.crypto.X509Req`. :returns: A list of Subject Alternative Names that are IP Addresses. - :rtype: `list` of `unicode`. note that this returns as string, not IPaddress object + :rtype: `list` of `str`. note that this returns as string, not IPaddress object """ @@ -320,7 +320,7 @@ def _pyopenssl_extract_san_list_raw(cert_or_req: Union[crypto.X509, crypto.X509R :type cert_or_req: `OpenSSL.crypto.X509` or `OpenSSL.crypto.X509Req`. :returns: raw san strings, parsed byte as utf-8 - :rtype: `list` of `unicode` + :rtype: `list` of `str` """ # This function finds SANs by dumping the certificate/CSR to text and @@ -352,7 +352,7 @@ def gen_ss_cert(key: crypto.PKey, domains: Optional[List[str]] = None, ) -> crypto.X509: """Generate new self-signed certificate. - :type domains: `list` of `unicode` + :type domains: `list` of `str` :param OpenSSL.crypto.PKey key: :param bool force_san: :param extensions: List of additional extensions to include in the cert. diff --git a/acme/acme/messages.py b/acme/acme/messages.py index 04ed75426..e4d1b2602 100644 --- a/acme/acme/messages.py +++ b/acme/acme/messages.py @@ -25,7 +25,7 @@ from acme import util from acme.mixins import ResourceMixin if TYPE_CHECKING: - from typing_extensions import Protocol + from typing_extensions import Protocol # pragma: no cover else: Protocol = object @@ -207,6 +207,9 @@ class Identifier(jose.JSONObjectWithFields): class HasResourceType(Protocol): + """ + Represents a class with a resource_type class parameter of type string. + """ resource_type: str = NotImplemented diff --git a/certbot-nginx/certbot_nginx/_internal/configurator.py b/certbot-nginx/certbot_nginx/_internal/configurator.py index 3c56283ef..8ef78b543 100644 --- a/certbot-nginx/certbot_nginx/_internal/configurator.py +++ b/certbot-nginx/certbot_nginx/_internal/configurator.py @@ -1191,7 +1191,7 @@ class NginxConfigurator(common.Configurator): self._chall_out += len(achalls) responses: List[Optional[challenges.ChallengeResponse]] = [None] * len(achalls) http_doer = http_01.NginxHttp01(self) - + key_achalls = [achall for achall in achalls if isinstance(achall, achallenges.KeyAuthorizationAnnotatedChallenge)] diff --git a/certbot-nginx/certbot_nginx/_internal/nginxparser.py b/certbot-nginx/certbot_nginx/_internal/nginxparser.py index 3d86776c6..d5422bfed 100644 --- a/certbot-nginx/certbot_nginx/_internal/nginxparser.py +++ b/certbot-nginx/certbot_nginx/_internal/nginxparser.py @@ -1,7 +1,6 @@ """Very low-level nginx config parser based on pyparsing.""" # Forked from https://github.com/fatiherikli/nginxparser (MIT Licensed) import copy -from distutils.log import error import logging import typing from typing import Any @@ -168,7 +167,7 @@ class UnspacedList(List[Any]): inbound = UnspacedList(inbound) return inbound, inbound.spaced - def insert(self, i: SupportsIndex, x: Any) -> None: + def insert(self, i: "SupportsIndex", x: Any) -> None: """Insert object before index.""" if not isinstance(i, int): raise ValueError("Only integers are supported") diff --git a/certbot/certbot/_internal/auth_handler.py b/certbot/certbot/_internal/auth_handler.py index e9e7d064f..08dc8be35 100644 --- a/certbot/certbot/_internal/auth_handler.py +++ b/certbot/certbot/_internal/auth_handler.py @@ -2,10 +2,11 @@ import datetime import logging import time -from typing import Dict, Sequence +from typing import Dict from typing import Iterable from typing import List from typing import Optional +from typing import Sequence from typing import Tuple from typing import Type |