forked from VimPlug/jedi
Remove FUNCTION_CLASS, in favor of a typeshed solution
This commit is contained in:
@@ -441,7 +441,6 @@ def _is_class_instance(obj):
|
|||||||
|
|
||||||
|
|
||||||
class _SPECIAL_OBJECTS(object):
|
class _SPECIAL_OBJECTS(object):
|
||||||
FUNCTION_CLASS = types.FunctionType
|
|
||||||
BOUND_METHOD_CLASS = type(DirectObjectAccess(None, None).py__bool__)
|
BOUND_METHOD_CLASS = type(DirectObjectAccess(None, None).py__bool__)
|
||||||
MODULE_CLASS = types.ModuleType
|
MODULE_CLASS = types.ModuleType
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ from jedi.evaluate.lazy_context import LazyKnownContexts, LazyKnownContext, \
|
|||||||
from jedi.evaluate.context import iterable
|
from jedi.evaluate.context import iterable
|
||||||
from jedi import parser_utils
|
from jedi import parser_utils
|
||||||
from jedi.evaluate.parser_cache import get_yield_exprs
|
from jedi.evaluate.parser_cache import get_yield_exprs
|
||||||
|
from jedi.evaluate.helpers import contexts_from_qualified_names
|
||||||
|
|
||||||
|
|
||||||
class LambdaName(AbstractNameDefinition):
|
class LambdaName(AbstractNameDefinition):
|
||||||
@@ -139,7 +140,8 @@ class FunctionContext(use_metaclass(CachedMetaClass, FunctionMixin, TreeContext)
|
|||||||
return function
|
return function
|
||||||
|
|
||||||
def py__class__(self):
|
def py__class__(self):
|
||||||
return compiled.get_special_object(self.evaluator, u'FUNCTION_CLASS')
|
c, = contexts_from_qualified_names(self.evaluator, 'types', 'FunctionType')
|
||||||
|
return c
|
||||||
|
|
||||||
def get_default_param_context(self):
|
def get_default_param_context(self):
|
||||||
return self.parent_context
|
return self.parent_context
|
||||||
|
|||||||
@@ -271,3 +271,7 @@ def parse_dotted_names(nodes, is_import_from, until_node=None):
|
|||||||
# for names.
|
# for names.
|
||||||
break
|
break
|
||||||
return level, names
|
return level, names
|
||||||
|
|
||||||
|
|
||||||
|
def contexts_from_qualified_names(evaluator, *names):
|
||||||
|
return evaluator.import_module(names[:-1]).py__getattribute__(names[-1])
|
||||||
|
|||||||
Reference in New Issue
Block a user