mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 00:35:50 +02:00
[apache] Add type hints to apache obj and http_01 for mypy --strict (#10154)
``` $ mypy --strict certbot-apache/certbot_apache/_internal/http_01.py Success: no issues found in 1 source file $ mypy --strict certbot-apache/certbot_apache/_internal/obj.py Success: no issues found in 1 source file ``` PEP 526 says to declare types of unpacked tuples beforehand: https://peps.python.org/pep-0526/#global-and-local-variable-annotations. Could have just declared it in apache, but improved the acme return type while I was at it. Once again, `typing.Pattern` is deprecated in favor of `re.Pattern` so changing that while parametrizing the type
This commit is contained in:
@@ -19,6 +19,7 @@ Note, that all annotated challenges act as a proxy objects::
|
||||
"""
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Tuple
|
||||
from typing import Type
|
||||
|
||||
import josepy as jose
|
||||
@@ -49,7 +50,8 @@ class KeyAuthorizationAnnotatedChallenge(AnnotatedChallenge):
|
||||
"""Client annotated `KeyAuthorizationChallenge` challenge."""
|
||||
__slots__ = ('challb', 'domain', 'account_key') # pylint: disable=redefined-slots-in-subclass
|
||||
|
||||
def response_and_validation(self, *args: Any, **kwargs: Any) -> Any:
|
||||
def response_and_validation(self, *args: Any, **kwargs: Any
|
||||
) -> Tuple['challenges.KeyAuthorizationChallengeResponse', Any]:
|
||||
"""Generate response and validation."""
|
||||
return self.challb.chall.response_and_validation(
|
||||
self.account_key, *args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user