comparison mercurial/mail.py @ 51282:9d3721552b6c

pytype: import typing directly First we no longer needs the pycompat layer, second having the types imported in all case will allow to use them more directly in type annotation, something important to upgrade the old "type comment" to proper type annotation. A lot a stupid assert are needed to keep pyflakes happy. We should be able to remove most of them once the type comment have been upgraded.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 20 Dec 2023 12:51:20 +0100
parents 18c8c18993f0
children f15cb5111a1e
comparison
equal deleted inserted replaced
51281:58d39c7865e5 51282:9d3721552b6c
15 import io 15 import io
16 import os 16 import os
17 import smtplib 17 import smtplib
18 import socket 18 import socket
19 import time 19 import time
20
21 from typing import (
22 Any,
23 List,
24 Tuple,
25 Union,
26 )
20 27
21 from .i18n import _ 28 from .i18n import _
22 from .pycompat import ( 29 from .pycompat import (
23 open, 30 open,
24 ) 31 )
33 procutil, 40 procutil,
34 stringutil, 41 stringutil,
35 urlutil, 42 urlutil,
36 ) 43 )
37 44
38 if pycompat.TYPE_CHECKING: 45
39 from typing import Any, List, Tuple, Union 46 # keep pyflakes happy
40 47 assert [
41 # keep pyflakes happy 48 Any,
42 assert all((Any, List, Tuple, Union)) 49 List,
50 Tuple,
51 Union,
52 ]
43 53
44 54
45 class STARTTLS(smtplib.SMTP): 55 class STARTTLS(smtplib.SMTP):
46 """Derived class to verify the peer certificate for STARTTLS. 56 """Derived class to verify the peer certificate for STARTTLS.
47 57