Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/scmposix.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 | 18c8c18993f0 |
children | a4b3b8dee0a8 |
comparison
equal
deleted
inserted
replaced
51301:58d39c7865e5 | 51302:9d3721552b6c |
---|---|
1 import array | 1 import array |
2 import errno | 2 import errno |
3 import fcntl | 3 import fcntl |
4 import os | 4 import os |
5 import sys | 5 import sys |
6 import typing | |
6 | 7 |
7 from typing import ( | 8 from typing import ( |
8 List, | 9 List, |
9 Tuple, | 10 Tuple, |
10 ) | 11 ) |
13 encoding, | 14 encoding, |
14 pycompat, | 15 pycompat, |
15 util, | 16 util, |
16 ) | 17 ) |
17 | 18 |
18 if pycompat.TYPE_CHECKING: | 19 if typing.TYPE_CHECKING: |
19 from . import ui as uimod | 20 from . import ui as uimod |
20 | 21 |
21 # BSD 'more' escapes ANSI color sequences by default. This can be disabled by | 22 # BSD 'more' escapes ANSI color sequences by default. This can be disabled by |
22 # $MORE variable, but there's no compatible option with Linux 'more'. Given | 23 # $MORE variable, but there's no compatible option with Linux 'more'. Given |
23 # OS X is widely used and most modern Unix systems would have 'less', setting | 24 # OS X is widely used and most modern Unix systems would have 'less', setting |