mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
small name refactoring
This commit is contained in:
@@ -365,19 +365,19 @@ class Script(object):
|
|||||||
|
|
||||||
:rtype: list of :class:`classes.CallSignature`
|
:rtype: list of :class:`classes.CallSignature`
|
||||||
"""
|
"""
|
||||||
call_signature_details = \
|
call_details = \
|
||||||
helpers.get_call_signature_details(self._module_node, self._pos)
|
helpers.get_call_signature_details(self._module_node, self._pos)
|
||||||
if call_signature_details is None:
|
if call_details is None:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
context = self._evaluator.create_context(
|
context = self._evaluator.create_context(
|
||||||
self._get_module(),
|
self._get_module(),
|
||||||
call_signature_details.bracket_leaf
|
call_details.bracket_leaf
|
||||||
)
|
)
|
||||||
definitions = helpers.cache_call_signatures(
|
definitions = helpers.cache_call_signatures(
|
||||||
self._evaluator,
|
self._evaluator,
|
||||||
context,
|
context,
|
||||||
call_signature_details.bracket_leaf,
|
call_details.bracket_leaf,
|
||||||
self._code_lines,
|
self._code_lines,
|
||||||
self._pos
|
self._pos
|
||||||
)
|
)
|
||||||
@@ -385,7 +385,7 @@ class Script(object):
|
|||||||
|
|
||||||
# TODO here we use stubs instead of the actual contexts. We should use
|
# TODO here we use stubs instead of the actual contexts. We should use
|
||||||
# the signatures from stubs, but the actual contexts, probably?!
|
# the signatures from stubs, but the actual contexts, probably?!
|
||||||
return [classes.CallSignature(self._evaluator, signature, call_signature_details)
|
return [classes.CallSignature(self._evaluator, signature, call_details)
|
||||||
for signature in definitions.get_signatures()]
|
for signature in definitions.get_signatures()]
|
||||||
|
|
||||||
def _analysis(self):
|
def _analysis(self):
|
||||||
|
|||||||
@@ -159,8 +159,8 @@ def evaluate_goto_definition(evaluator, context, leaf):
|
|||||||
return definitions
|
return definitions
|
||||||
|
|
||||||
|
|
||||||
CallSignatureDetails = namedtuple(
|
CallDetails = namedtuple(
|
||||||
'CallSignatureDetails',
|
'CallDetails',
|
||||||
['bracket_leaf', 'call_index', 'keyword_name_str']
|
['bracket_leaf', 'call_index', 'keyword_name_str']
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ def _get_call_signature_details_from_error_node(node, position):
|
|||||||
if name is None:
|
if name is None:
|
||||||
continue
|
continue
|
||||||
if name.type == 'name' or name.parent.type in ('trailer', 'atom'):
|
if name.type == 'name' or name.parent.type in ('trailer', 'atom'):
|
||||||
return CallSignatureDetails(
|
return CallDetails(
|
||||||
element,
|
element,
|
||||||
*_get_index_and_key(children, position)
|
*_get_index_and_key(children, position)
|
||||||
)
|
)
|
||||||
@@ -235,7 +235,7 @@ def get_call_signature_details(module, position):
|
|||||||
leaf = node.get_previous_leaf()
|
leaf = node.get_previous_leaf()
|
||||||
if leaf is None:
|
if leaf is None:
|
||||||
return None
|
return None
|
||||||
return CallSignatureDetails(
|
return CallDetails(
|
||||||
node.children[0], *_get_index_and_key(node.children, position))
|
node.children[0], *_get_index_and_key(node.children, position))
|
||||||
|
|
||||||
node = node.parent
|
node = node.parent
|
||||||
|
|||||||
Reference in New Issue
Block a user