forked from VimPlug/jedi
Merge pull request #176 from tkf/basedefinition-type
More detailed BaseDefinition.type (fixes #169)
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user