comparison mercurial/i18n.py @ 51285: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
51284:58d39c7865e5 51285:9d3721552b6c
9 import gettext as gettextmod 9 import gettext as gettextmod
10 import locale 10 import locale
11 import os 11 import os
12 import sys 12 import sys
13 13
14 from typing import (
15 Callable,
16 List,
17 )
18
14 from .utils import resourceutil 19 from .utils import resourceutil
15 from . import ( 20 from . import (
16 encoding, 21 encoding,
17 pycompat, 22 pycompat,
18 ) 23 )
19 24
20 if pycompat.TYPE_CHECKING: 25 # keeps pyflakes happy
21 from typing import ( 26 assert [
22 Callable, 27 Callable,
23 List, 28 List,
24 ) 29 ]
25
26 30
27 # modelled after templater.templatepath: 31 # modelled after templater.templatepath:
28 if getattr(sys, 'frozen', None) is not None: 32 if getattr(sys, 'frozen', None) is not None:
29 module = pycompat.sysexecutable 33 module = pycompat.sysexecutable
30 else: 34 else: