forked from VimPlug/jedi
Improve typing_extensions usages
This commit is contained in:
@@ -282,7 +282,7 @@ def parse_stub_module(inference_state, file_io):
|
|||||||
|
|
||||||
def create_stub_module(inference_state, grammar, python_value_set,
|
def create_stub_module(inference_state, grammar, python_value_set,
|
||||||
stub_module_node, file_io, import_names):
|
stub_module_node, file_io, import_names):
|
||||||
if import_names == ('typing',):
|
if import_names in [('typing',), ('typing_extensions',)]:
|
||||||
module_cls = TypingModuleWrapper
|
module_cls = TypingModuleWrapper
|
||||||
else:
|
else:
|
||||||
module_cls = StubModuleValue
|
module_cls = StubModuleValue
|
||||||
|
|||||||
@@ -560,6 +560,8 @@ def typed_dict_test_foo(arg: Bar):
|
|||||||
# Self
|
# Self
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|
||||||
|
import typing_extensions
|
||||||
|
|
||||||
# From #2023, #2068
|
# From #2023, #2068
|
||||||
class Builder:
|
class Builder:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -577,6 +579,9 @@ class Builder:
|
|||||||
def add_not_implemented(self: Self, y: int) -> Self:
|
def add_not_implemented(self: Self, y: int) -> Self:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def add_not_implemented_typing_extensions(self: Self, y: int) -> typing_extensions.Self:
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
b = Builder()
|
b = Builder()
|
||||||
#? Builder()
|
#? Builder()
|
||||||
b.add_x(2)
|
b.add_x(2)
|
||||||
@@ -584,3 +589,5 @@ b.add_x(2)
|
|||||||
b.add_x(2).add_y(5)
|
b.add_x(2).add_y(5)
|
||||||
#? Builder()
|
#? Builder()
|
||||||
b.add_x(2).add_not_implemented(5)
|
b.add_x(2).add_not_implemented(5)
|
||||||
|
#? Builder()
|
||||||
|
b.add_x(2).add_not_implemented_typing_extensions(5)
|
||||||
|
|||||||
Reference in New Issue
Block a user