forked from VimPlug/jedi
Start implementing an is_class function that will determine if an object is a class or not in the future.
This commit is contained in:
@@ -54,6 +54,9 @@ class CompiledObject(Base):
|
||||
def py__bool__(self):
|
||||
return bool(self.obj)
|
||||
|
||||
def is_class(self):
|
||||
return isinstance(self.obj, type)
|
||||
|
||||
@property
|
||||
def doc(self):
|
||||
return inspect.getdoc(self.obj) or ''
|
||||
|
||||
@@ -314,6 +314,9 @@ class Wrapper(pr.Base):
|
||||
def is_scope(self):
|
||||
return True
|
||||
|
||||
def is_class(self):
|
||||
return False
|
||||
|
||||
|
||||
class Class(use_metaclass(CachedMetaClass, Wrapper)):
|
||||
"""
|
||||
@@ -384,6 +387,9 @@ class Class(use_metaclass(CachedMetaClass, Wrapper)):
|
||||
if add_class_vars:
|
||||
yield self, compiled.type_names
|
||||
|
||||
def is_class(self):
|
||||
return True
|
||||
|
||||
def get_subscope_by_name(self, name):
|
||||
for s in [self] + self.py__bases__(self._evaluator):
|
||||
for sub in reversed(s.subscopes):
|
||||
|
||||
Reference in New Issue
Block a user