comparison mercurial/utils/urlutil.py @ 51302: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 5c9c41273367
children f15cb5111a1e
comparison
equal deleted inserted replaced
51301:58d39c7865e5 51302:9d3721552b6c
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 import os 7 import os
8 import re as remod 8 import re as remod
9 import socket 9 import socket
10 10
11 from typing import (
12 Union,
13 )
14
11 from ..i18n import _ 15 from ..i18n import _
12 from .. import ( 16 from .. import (
13 encoding, 17 encoding,
14 error, 18 error,
15 pycompat, 19 pycompat,
22 26
23 from ..revlogutils import ( 27 from ..revlogutils import (
24 constants as revlog_constants, 28 constants as revlog_constants,
25 ) 29 )
26 30
27 31 # keeps pyflakes happy
28 if pycompat.TYPE_CHECKING: 32 assert [Union]
29 from typing import (
30 Union,
31 )
32 33
33 urlreq = urllibcompat.urlreq 34 urlreq = urllibcompat.urlreq
34 35
35 36
36 def getport(port): 37 def getport(port):