mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Some more Python compatibility improvements.
This commit is contained in:
@@ -104,9 +104,6 @@ class CompiledObject(Base):
|
||||
return _parse_function_doc(self.doc)
|
||||
|
||||
def api_type(self):
|
||||
if fake.is_class_instance(self.obj):
|
||||
return 'instance'
|
||||
|
||||
obj = self.obj
|
||||
if inspect.isclass(obj):
|
||||
return 'class'
|
||||
@@ -115,7 +112,8 @@ class CompiledObject(Base):
|
||||
elif inspect.isbuiltin(obj) or inspect.ismethod(obj) \
|
||||
or inspect.ismethoddescriptor(obj) or inspect.isfunction(obj):
|
||||
return 'function'
|
||||
raise NotImplementedError
|
||||
# Everything else...
|
||||
return 'instance'
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
@@ -190,8 +188,11 @@ class CompiledObject(Base):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
# might not exist sometimes (raises AttributeError)
|
||||
return FakeName(self._get_class().__name__, self)
|
||||
try:
|
||||
name = self._get_class().__name__
|
||||
except AttributeError:
|
||||
name = repr(self.obj)
|
||||
return FakeName(name, self)
|
||||
|
||||
def _execute_function(self, params):
|
||||
if self.type != 'funcdef':
|
||||
|
||||
@@ -7,7 +7,7 @@ Fallback to callee definition when definition not found.
|
||||
"""Parenthesis closed at next line."""
|
||||
|
||||
# Ignore these definitions for a little while, not sure if we really want them.
|
||||
# python <= 2.7
|
||||
# python <= 2.5
|
||||
|
||||
#? isinstance
|
||||
isinstance(
|
||||
|
||||
Reference in New Issue
Block a user