Fix more types

This commit is contained in:
Adrien Ferrand 2022-01-03 23:03:45 +01:00
parent 309531f8f7
commit 661a06025c
5 changed files with 13 additions and 9 deletions

View file

@ -316,6 +316,9 @@ class ExternalAccountBinding:
return eab.to_partial_json()
T = TypeVar('T', bound='Registration')
class Registration(ResourceBody):
"""Registration Resource Body.
@ -343,9 +346,9 @@ class Registration(ResourceBody):
email_prefix = 'mailto:'
@classmethod
def from_data(cls, phone: Optional[str] = None, email: Optional[str] = None,
def from_data(cls: Type[T], phone: Optional[str] = None, email: Optional[str] = None,
external_account_binding: Optional[Dict[str, Any]] = None,
**kwargs: Any) -> 'Registration':
**kwargs: Any) -> T:
"""
Create registration resource from contact details.
@ -679,9 +682,9 @@ class OrderResource(ResourceWithURI):
body: Order = jose.field('body', decoder=Order.from_json)
csr_pem: bytes = jose.field('csr_pem', omitempty=True)
authorizations: List[AuthorizationResource] = jose.field('authorizations')
fullchain_pem: bytes = jose.field('fullchain_pem', omitempty=True)
alternative_fullchains_pem: List[bytes] = jose.field('alternative_fullchains_pem',
omitempty=True)
fullchain_pem: str = jose.field('fullchain_pem', omitempty=True)
alternative_fullchains_pem: List[str] = jose.field('alternative_fullchains_pem',
omitempty=True)
@Directory.register

View file

@ -98,7 +98,7 @@ permitted by DNS standards.)
super().__init__(*args, **kwargs)
self.reverter = reverter.Reverter(self.config)
self.reverter.recovery_routine()
self.env: Dict[achallenges.KeyAuthorizationAnnotatedChallenge, Dict[str, str]] = {}
self.env: Dict[achallenges.AnnotatedChallenge, Dict[str, str]] = {}
self.subsequent_dns_challenge = False
self.subsequent_any_challenge = False

View file

@ -30,7 +30,7 @@ logger = logging.getLogger(__name__)
if TYPE_CHECKING:
ServedType = DefaultDict[
acme_standalone.BaseDualNetworkedServers,
Set[achallenges.KeyAuthorizationAnnotatedChallenge]
Set[achallenges.AnnotatedChallenge]
]

View file

@ -20,7 +20,7 @@ from certbot import crypto_util
from certbot import errors
from certbot import interfaces
from certbot._internal import cli
from certbot.achallenges import KeyAuthorizationAnnotatedChallenge as AnnotatedChallenge
from certbot.achallenges import AnnotatedChallenge
from certbot.compat import filesystem
from certbot.compat import os
from certbot.display import ops

View file

@ -9,6 +9,7 @@ from requests.exceptions import RequestException
from acme.challenges import Challenge
from certbot import errors
from certbot.achallenges import AnnotatedChallenge
from certbot.plugins import dns_test_common
from certbot.plugins.dns_common_lexicon import LexiconClient
from certbot.plugins.dns_test_common import _AuthenticatorCallableTestCase
@ -33,7 +34,7 @@ class _AuthenticatorCallableLexiconTestCase(_AuthenticatorCallableTestCase, Prot
a mocked LexiconClient instance.
"""
mock_client: MagicMock
achall: Challenge
achall: AnnotatedChallenge
class _LexiconAwareTestCase(Protocol):