comparison mercurial/upgrade_utils/actions.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 ddf2b33ee388
children 8b2ea2246a5f
comparison
equal deleted inserted replaced
51281:58d39c7865e5 51282:9d3721552b6c
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 import random 8 import random
9 9
10 from typing import (
11 List,
12 Type,
13 )
14
10 from ..i18n import _ 15 from ..i18n import _
11 from .. import ( 16 from .. import (
12 error, 17 error,
13 localrepo, 18 localrepo,
14 pycompat,
15 requirements, 19 requirements,
16 revlog, 20 revlog,
17 util, 21 util,
18 ) 22 )
19 23
20 from ..utils import compression 24 from ..utils import compression
21 25
22 if pycompat.TYPE_CHECKING: 26 # keeps pyflakes happy
23 from typing import ( 27 assert [
24 List, 28 List,
25 Type, 29 Type,
26 ) 30 ]
27
28 31
29 # list of requirements that request a clone of all revlog if added/removed 32 # list of requirements that request a clone of all revlog if added/removed
30 RECLONES_REQUIREMENTS = { 33 RECLONES_REQUIREMENTS = {
31 requirements.GENERALDELTA_REQUIREMENT, 34 requirements.GENERALDELTA_REQUIREMENT,
32 requirements.SPARSEREVLOG_REQUIREMENT, 35 requirements.SPARSEREVLOG_REQUIREMENT,