mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Fix signature issues
This commit is contained in:
@@ -11,7 +11,6 @@ arguments.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
|
|
||||||
import parso
|
import parso
|
||||||
from parso.python import tree
|
from parso.python import tree
|
||||||
|
|||||||
@@ -405,7 +405,10 @@ class BaseDefinition(object):
|
|||||||
return ''.join(lines[start_index:index + after + 1])
|
return ''.join(lines[start_index:index + after + 1])
|
||||||
|
|
||||||
def get_signatures(self):
|
def get_signatures(self):
|
||||||
return [Signature(self._inference_state, s) for s in self._name.infer().get_signatures()]
|
return [
|
||||||
|
BaseSignature(self._inference_state, s)
|
||||||
|
for s in self._name.infer().get_signatures()
|
||||||
|
]
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
return _values_to_definitions(self._name.infer().execute_with_values())
|
return _values_to_definitions(self._name.infer().execute_with_values())
|
||||||
@@ -628,14 +631,14 @@ class Definition(BaseDefinition):
|
|||||||
return hash((self._name.start_pos, self.module_path, self.name, self._inference_state))
|
return hash((self._name.start_pos, self.module_path, self.name, self._inference_state))
|
||||||
|
|
||||||
|
|
||||||
class Signature(Definition):
|
class BaseSignature(Definition):
|
||||||
"""
|
"""
|
||||||
`Signature` objects is the return value of `Script.function_definition`.
|
`BaseSignature` objects is the return value of `Script.function_definition`.
|
||||||
It knows what functions you are currently in. e.g. `isinstance(` would
|
It knows what functions you are currently in. e.g. `isinstance(` would
|
||||||
return the `isinstance` function. without `(` it would return nothing.
|
return the `isinstance` function. without `(` it would return nothing.
|
||||||
"""
|
"""
|
||||||
def __init__(self, inference_state, signature):
|
def __init__(self, inference_state, signature):
|
||||||
super(Signature, self).__init__(inference_state, signature.name)
|
super(BaseSignature, self).__init__(inference_state, signature.name)
|
||||||
self._signature = signature
|
self._signature = signature
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -650,9 +653,9 @@ class Signature(Definition):
|
|||||||
return self._signature.to_string()
|
return self._signature.to_string()
|
||||||
|
|
||||||
|
|
||||||
class Signature(Signature):
|
class Signature(BaseSignature):
|
||||||
"""
|
"""
|
||||||
`Signature` objects is the return value of `Script.call_signatures`.
|
`Signature` objects is the return value of `Script.find_signatures`.
|
||||||
It knows what functions you are currently in. e.g. `isinstance(` would
|
It knows what functions you are currently in. e.g. `isinstance(` would
|
||||||
return the `isinstance` function with its params. Without `(` it would
|
return the `isinstance` function with its params. Without `(` it would
|
||||||
return nothing.
|
return nothing.
|
||||||
|
|||||||
Reference in New Issue
Block a user