1
0
forked from VimPlug/jedi

Merge pull request #176 from tkf/basedefinition-type

More detailed BaseDefinition.type (fixes #169)
This commit is contained in:
David Halter
2013-03-15 10:36:53 -07:00
4 changed files with 70 additions and 9 deletions

View File

@@ -120,20 +120,22 @@ class BaseDefinition(object):
Finally, here is what you can get from :attr:`type`:
>>> defs[0].type
'Module'
'module'
>>> defs[1].type
'Class'
'class'
>>> defs[2].type
'Instance'
'instance'
>>> defs[3].type
'Function'
'function'
"""
# generate the type
stripped = self.definition
if isinstance(self.definition, er.InstanceElement):
stripped = self.definition.var
return type(stripped).__name__
if isinstance(stripped, pr.Name):
stripped = stripped.parent
return type(stripped).__name__.lower()
@property
def path(self):