Show More
@@ -27,7 +27,7 b' from .utils import (' | |||||
27 | stringutil, |
|
27 | stringutil, | |
28 | ) |
|
28 | ) | |
29 |
|
29 | |||
30 | if not globals(): |
|
30 | if pycompat.TYPE_CHECKING: | |
31 | from typing import ( |
|
31 | from typing import ( | |
32 | Any, |
|
32 | Any, | |
33 | Callable, |
|
33 | Callable, |
@@ -61,7 +61,7 b' from .utils import (' | |||||
61 | stringutil, |
|
61 | stringutil, | |
62 | ) |
|
62 | ) | |
63 |
|
63 | |||
64 | if not globals(): |
|
64 | if pycompat.TYPE_CHECKING: | |
65 | from typing import ( |
|
65 | from typing import ( | |
66 | Any, |
|
66 | Any, | |
67 | Dict, |
|
67 | Dict, |
@@ -20,14 +20,11 b' from . import (' | |||||
20 |
|
20 | |||
21 | from .pure import charencode as charencodepure |
|
21 | from .pure import charencode as charencodepure | |
22 |
|
22 | |||
23 | _TYPE_CHECKING = False |
|
23 | if pycompat.TYPE_CHECKING: | |
24 |
|
||||
25 | if not globals(): # hide this from non-pytype users |
|
|||
26 | from typing import ( |
|
24 | from typing import ( | |
27 | Any, |
|
25 | Any, | |
28 | Callable, |
|
26 | Callable, | |
29 | List, |
|
27 | List, | |
30 | TYPE_CHECKING as _TYPE_CHECKING, |
|
|||
31 | Text, |
|
28 | Text, | |
32 | Type, |
|
29 | Type, | |
33 | TypeVar, |
|
30 | TypeVar, | |
@@ -124,7 +121,7 b' class localstr(bytes):' | |||||
124 | s._utf8 = u |
|
121 | s._utf8 = u | |
125 | return s |
|
122 | return s | |
126 |
|
123 | |||
127 |
if |
|
124 | if pycompat.TYPE_CHECKING: | |
128 | # pseudo implementation to help pytype see localstr() constructor |
|
125 | # pseudo implementation to help pytype see localstr() constructor | |
129 | def __init__(self, u, l): |
|
126 | def __init__(self, u, l): | |
130 | # type: (bytes, bytes) -> None |
|
127 | # type: (bytes, bytes) -> None |
@@ -42,7 +42,7 b' from .utils import (' | |||||
42 | ) |
|
42 | ) | |
43 |
|
43 | |||
44 |
|
44 | |||
45 | if not globals(): |
|
45 | if pycompat.TYPE_CHECKING: | |
46 | from typing import ( |
|
46 | from typing import ( | |
47 | Any, |
|
47 | Any, | |
48 | Tuple, |
|
48 | Tuple, |
@@ -36,7 +36,7 b' from .utils import (' | |||||
36 | stringutil, |
|
36 | stringutil, | |
37 | ) |
|
37 | ) | |
38 |
|
38 | |||
39 | if not globals(): # hide this from non-pytype users |
|
39 | if pycompat.TYPE_CHECKING: | |
40 | from typing import Any, List, Tuple, Union |
|
40 | from typing import Any, List, Tuple, Union | |
41 |
|
41 | |||
42 | # keep pyflakes happy |
|
42 | # keep pyflakes happy |
@@ -20,6 +20,12 b' import tempfile' | |||||
20 |
|
20 | |||
21 | ispy3 = sys.version_info[0] >= 3 |
|
21 | ispy3 = sys.version_info[0] >= 3 | |
22 | ispypy = '__pypy__' in sys.builtin_module_names |
|
22 | ispypy = '__pypy__' in sys.builtin_module_names | |
|
23 | TYPE_CHECKING = False | |||
|
24 | ||||
|
25 | if not globals(): # hide this from non-pytype users | |||
|
26 | import typing | |||
|
27 | ||||
|
28 | TYPE_CHECKING = typing.TYPE_CHECKING | |||
23 |
|
29 | |||
24 | if not ispy3: |
|
30 | if not ispy3: | |
25 | import cookielib |
|
31 | import cookielib |
@@ -23,11 +23,12 b' from .i18n import _' | |||||
23 |
|
23 | |||
24 | from . import ( |
|
24 | from . import ( | |
25 | error, |
|
25 | error, | |
|
26 | pycompat, | |||
26 | util, |
|
27 | util, | |
27 | ) |
|
28 | ) | |
28 | from .utils import cborutil |
|
29 | from .utils import cborutil | |
29 |
|
30 | |||
30 | if not globals(): |
|
31 | if pycompat.TYPE_CHECKING: | |
31 | from typing import ( |
|
32 | from typing import ( | |
32 | Any, |
|
33 | Any, | |
33 | Dict, |
|
34 | Dict, |
General Comments 0
You need to be logged in to leave comments.
Login now