Skip to content

Commit c5321ad

Browse files
jwortmannpredragnikolicrchldeathaxerwols
authored
Import from typing, typing_extensions and enum modules on Python 3.8 (#2446)
* "Add .python-version file" * remove pathlib from dependencies * change import * Revert "change import" (: This reverts commit c70cd57. * Fix failing unittests on MacOS (#2436) This commit adopts `unittesting.ViewTestCase` to run view related test cases. ViewTestCase ... 1. provides `view` and `window` members pointing to a dedicated view, being created for testing. 2. ensures not to close empty windows, which was probably the most likely reason for unittests failing before on MacOS. * keep the same order as before * rchlint * add release notes * Import from enum and typing modules * Keep using fake enums * Import remaining classes from typing_extensions * Fix enum types and import from enum module * Quoted type annotation not needed anymore with the ParamSpec from typing_extensions --------- Co-authored-by: Предраг Николић <[email protected]> Co-authored-by: Rafal Chlodnicki <[email protected]> Co-authored-by: deathaxe <[email protected]> Co-authored-by: Raoul Wols <[email protected]>
1 parent 0fabb7d commit c5321ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+130
-107
lines changed

boot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
from .plugin.core.transports import kill_all_subprocesses
3737
from .plugin.core.tree_view import LspCollapseTreeItemCommand
3838
from .plugin.core.tree_view import LspExpandTreeItemCommand
39-
from .plugin.core.typing import Any, Optional, List, Type, Dict
4039
from .plugin.core.views import LspRunTextCommandHelperCommand
4140
from .plugin.document_link import LspOpenLinkCommand
4241
from .plugin.documents import DocumentSyncListener
@@ -86,6 +85,7 @@
8685
from .plugin.tooling import LspOnDoubleClickCommand
8786
from .plugin.tooling import LspParseVscodePackageJson
8887
from .plugin.tooling import LspTroubleshootServerCommand
88+
from typing import Any, Dict, List, Optional, Type
8989

9090

9191
def _get_final_subclasses(derived: List[Type], results: List[Type]) -> None:

dependencies.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
">=4096": [
44
"bracex",
55
"mdpopups",
6+
"typing_extensions",
67
"wcmatch"
78
]
89
}

plugin/code_actions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from .core.sessions import AbstractViewListener
1212
from .core.sessions import SessionBufferProtocol
1313
from .core.settings import userprefs
14-
from .core.typing import Any, List, Dict, Callable, Optional, Tuple, TypeGuard, Union, cast
1514
from .core.views import entire_content_region
1615
from .core.views import first_selection_region
1716
from .core.views import format_code_actions_for_quick_panel
@@ -21,6 +20,9 @@
2120
from abc import ABCMeta
2221
from abc import abstractmethod
2322
from functools import partial
23+
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
24+
from typing import cast
25+
from typing_extensions import TypeGuard
2426
import sublime
2527

2628
ConfigName = str

plugin/code_lens.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
from .core.protocol import CodeLens
33
from .core.protocol import CodeLensExtended
44
from .core.protocol import Error
5-
from .core.typing import List, Tuple, Dict, Iterable, Optional, Generator, Union, cast
65
from .core.registry import LspTextCommand
76
from .core.registry import LspWindowCommand
87
from .core.registry import windows
98
from .core.views import make_command_link
109
from .core.views import range_to_region
1110
from html import escape as html_escape
1211
from functools import partial
12+
from typing import Dict, Generator, Iterable, List, Optional, Tuple, Union
13+
from typing import cast
1314
import itertools
1415
import sublime
1516

plugin/color.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from .core.protocol import ColorPresentationParams
55
from .core.protocol import Request
66
from .core.registry import LspTextCommand
7-
from .core.typing import List
87
from .core.views import range_to_region
98
from .core.views import text_document_identifier
9+
from typing import List
1010
import sublime
1111

1212

plugin/completion.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@
1919
from .core.registry import LspTextCommand
2020
from .core.sessions import Session
2121
from .core.settings import userprefs
22-
from .core.typing import Callable, List, Dict, Optional, Generator, Tuple, Union, cast, Any, TypeGuard
2322
from .core.views import FORMAT_STRING, FORMAT_MARKUP_CONTENT
2423
from .core.views import MarkdownLangMap
2524
from .core.views import minihtml
2625
from .core.views import range_to_region
2726
from .core.views import show_lsp_popup
2827
from .core.views import text_document_position_params
2928
from .core.views import update_lsp_popup
29+
from typing import Any, Callable, Dict, Generator, List, Optional, Tuple, Union
30+
from typing import cast
31+
from typing_extensions import TypeGuard
3032
import functools
3133
import html
3234
import sublime

plugin/core/active_request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from .progress import ViewProgressReporter
44
from .progress import WindowProgressReporter
55
from .protocol import Request
6-
from .typing import Any, Optional, Dict
6+
from typing import Any, Dict, Optional
77
from weakref import ref
88
import sublime
99

plugin/core/collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""
22
Module with additional collections.
33
"""
4-
from .typing import Optional, Dict, Any, Generator
54
from copy import deepcopy
5+
from typing import Any, Dict, Generator, Optional
66
import sublime
77

88

plugin/core/configurations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
from .logging import exception_log
33
from .logging import printf
44
from .types import ClientConfig
5-
from .typing import Generator, List, Optional, Set, Dict, Deque
65
from .url import parse_uri
76
from .workspace import enable_in_project, disable_in_project
87
from abc import ABCMeta
98
from abc import abstractmethod
109
from collections import deque
1110
from datetime import datetime, timedelta
11+
from typing import Deque, Dict, Generator, List, Optional, Set
1212
from weakref import WeakSet
1313
import sublime
1414

plugin/core/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from .protocol import DiagnosticSeverity
44
from .protocol import DocumentHighlightKind
55
from .protocol import SymbolKind
6-
from .typing import Dict, Tuple
6+
from typing import Dict, Tuple
77
import sublime
88

99

0 commit comments

Comments
 (0)