forked from VimPlug/jedi
Extended documentation of BaseDefinition properties.
This commit is contained in:
@@ -56,6 +56,7 @@ class BaseDefinition(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self):
|
def type(self):
|
||||||
|
"""The type of the definition."""
|
||||||
# generate the type
|
# generate the type
|
||||||
stripped = self.definition
|
stripped = self.definition
|
||||||
if isinstance(self.definition, evaluate.InstanceElement):
|
if isinstance(self.definition, evaluate.InstanceElement):
|
||||||
@@ -64,6 +65,7 @@ class BaseDefinition(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def path(self):
|
def path(self):
|
||||||
|
"""The module path."""
|
||||||
path = []
|
path = []
|
||||||
if not isinstance(self.definition, keywords.Keyword):
|
if not isinstance(self.definition, keywords.Keyword):
|
||||||
par = self.definition
|
par = self.definition
|
||||||
@@ -77,20 +79,24 @@ class BaseDefinition(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def module_name(self):
|
def module_name(self):
|
||||||
|
"""The module name."""
|
||||||
path = self.module_path
|
path = self.module_path
|
||||||
sep = os.path.sep
|
sep = os.path.sep
|
||||||
p = re.sub(r'^.*?([\w\d]+)(%s__init__)?.py$' % sep, r'\1', path)
|
p = re.sub(r'^.*?([\w\d]+)(%s__init__)?.py$' % sep, r'\1', path)
|
||||||
return p
|
return p
|
||||||
|
|
||||||
def in_builtin_module(self):
|
def in_builtin_module(self):
|
||||||
|
"""Whether this is a builtin module."""
|
||||||
return not self.module_path.endswith('.py')
|
return not self.module_path.endswith('.py')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def line_nr(self):
|
def line_nr(self):
|
||||||
|
"""The line where the definition occurs (starting with 1)."""
|
||||||
return self.start_pos[0]
|
return self.start_pos[0]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def column(self):
|
def column(self):
|
||||||
|
"""The column where the definition occurs (starting with 0)."""
|
||||||
return self.start_pos[1]
|
return self.start_pos[1]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -103,7 +109,7 @@ class BaseDefinition(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def raw_doc(self):
|
def raw_doc(self):
|
||||||
""" Returns the raw docstring `__doc__` for any object """
|
"""The raw docstring ``__doc__`` for any object."""
|
||||||
try:
|
try:
|
||||||
return unicode(self.definition.docstr)
|
return unicode(self.definition.docstr)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
@@ -111,13 +117,12 @@ class BaseDefinition(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def description(self):
|
def description(self):
|
||||||
|
"""A textual description of the object."""
|
||||||
return unicode(self.definition)
|
return unicode(self.definition)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def full_name(self):
|
def full_name(self):
|
||||||
"""
|
"""The path to a certain class/function, see #61."""
|
||||||
Returns the path to a certain class/function, see #61.
|
|
||||||
"""
|
|
||||||
path = [unicode(p) for p in self.path]
|
path = [unicode(p) for p in self.path]
|
||||||
# TODO add further checks, the mapping should only occur on stdlib.
|
# TODO add further checks, the mapping should only occur on stdlib.
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user