mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Fix namedtuple docstring/signature issues, fixes #1506
This commit is contained in:
@@ -129,6 +129,9 @@ def import_module_decorator(func):
|
|||||||
|
|
||||||
|
|
||||||
def _try_to_load_stub_cached(inference_state, import_names, *args, **kwargs):
|
def _try_to_load_stub_cached(inference_state, import_names, *args, **kwargs):
|
||||||
|
if import_names is None:
|
||||||
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return inference_state.stub_module_cache[import_names]
|
return inference_state.stub_module_cache[import_names]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ from operator import itemgetter as _itemgetter
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
class {typename}(tuple):
|
class {typename}(tuple):
|
||||||
'{typename}({arg_list})'
|
|
||||||
|
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
_fields = {field_names!r}
|
_fields = {field_names!r}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ def test_namedtuple_infer(Script):
|
|||||||
|
|
||||||
assert d1.get_line_code() == "class Foo(tuple):\n"
|
assert d1.get_line_code() == "class Foo(tuple):\n"
|
||||||
assert d1.module_path is None
|
assert d1.module_path is None
|
||||||
|
assert d1.docstring() == 'Foo(id, timestamp, gps_timestamp, attributes)'
|
||||||
|
|
||||||
|
|
||||||
def test_re_sub(Script, environment):
|
def test_re_sub(Script, environment):
|
||||||
|
|||||||
Reference in New Issue
Block a user