forked from VimPlug/jedi
Eliminate CompiledObject.type
This commit is contained in:
@@ -176,18 +176,6 @@ class CompiledObject(Context):
|
|||||||
# Everything else...
|
# Everything else...
|
||||||
return 'instance'
|
return 'instance'
|
||||||
|
|
||||||
@property
|
|
||||||
def type(self):
|
|
||||||
"""Imitate the tree.Node.type values."""
|
|
||||||
cls = self._get_class()
|
|
||||||
if inspect.isclass(cls):
|
|
||||||
return 'classdef'
|
|
||||||
elif inspect.ismodule(cls):
|
|
||||||
return 'file_input'
|
|
||||||
elif inspect.isbuiltin(cls) or inspect.ismethod(cls) or \
|
|
||||||
inspect.ismethoddescriptor(cls):
|
|
||||||
return 'funcdef'
|
|
||||||
|
|
||||||
@underscore_memoization
|
@underscore_memoization
|
||||||
def _cls(self):
|
def _cls(self):
|
||||||
"""
|
"""
|
||||||
@@ -257,7 +245,7 @@ class CompiledObject(Context):
|
|||||||
|
|
||||||
def _execute_function(self, params):
|
def _execute_function(self, params):
|
||||||
from jedi.evaluate import docstrings
|
from jedi.evaluate import docstrings
|
||||||
if self.type != 'funcdef':
|
if self.api_type != 'function':
|
||||||
return
|
return
|
||||||
for name in self._parse_function_doc()[1].split():
|
for name in self._parse_function_doc()[1].split():
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ def evaluator():
|
|||||||
def test_import_module(evaluator):
|
def test_import_module(evaluator):
|
||||||
compiled_obj = evaluator.compiled_subprocess.import_module(name='math')
|
compiled_obj = evaluator.compiled_subprocess.import_module(name='math')
|
||||||
assert compiled_obj.py__bool__() is True
|
assert compiled_obj.py__bool__() is True
|
||||||
assert compiled_obj.type == 'file_input'
|
assert compiled_obj.api_type == 'module'
|
||||||
with pytest.raises(AttributeError):
|
with pytest.raises(AttributeError):
|
||||||
assert compiled_obj.py__mro__()
|
assert compiled_obj.py__mro__()
|
||||||
|
|||||||
Reference in New Issue
Block a user