forked from VimPlug/jedi
deprecate start_pos as discussed in #221
This commit is contained in:
@@ -70,7 +70,7 @@ class BaseDefinition(object):
|
|||||||
}.items())
|
}.items())
|
||||||
|
|
||||||
def __init__(self, definition, start_pos):
|
def __init__(self, definition, start_pos):
|
||||||
self.start_pos = start_pos
|
self._start_pos = start_pos
|
||||||
self._definition = definition
|
self._definition = definition
|
||||||
"""
|
"""
|
||||||
An instance of :class:`jedi.parsing_representation.Base` subclass.
|
An instance of :class:`jedi.parsing_representation.Base` subclass.
|
||||||
@@ -81,6 +81,16 @@ class BaseDefinition(object):
|
|||||||
self._module = definition.get_parent_until()
|
self._module = definition.get_parent_until()
|
||||||
self.module_path = self._module.path
|
self.module_path = self._module.path
|
||||||
|
|
||||||
|
@property
|
||||||
|
def start_pos(self):
|
||||||
|
"""
|
||||||
|
.. deprecated:: 0.7.0
|
||||||
|
Use :attr:`.line` and :attr:`.column` instead.
|
||||||
|
.. todo:: Remove!
|
||||||
|
"""
|
||||||
|
warnings.warn("Use line/column instead.", DeprecationWarning)
|
||||||
|
return self._start_pos
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self):
|
def type(self):
|
||||||
"""
|
"""
|
||||||
@@ -194,14 +204,14 @@ class BaseDefinition(object):
|
|||||||
"""The line where the definition occurs (starting with 1)."""
|
"""The line where the definition occurs (starting with 1)."""
|
||||||
if self.in_builtin_module:
|
if self.in_builtin_module:
|
||||||
return None
|
return None
|
||||||
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)."""
|
"""The column where the definition occurs (starting with 0)."""
|
||||||
if self.in_builtin_module:
|
if self.in_builtin_module:
|
||||||
return None
|
return None
|
||||||
return self.start_pos[1]
|
return self._start_pos[1]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def doc(self):
|
def doc(self):
|
||||||
@@ -550,14 +560,14 @@ class Usage(BaseDefinition):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def description(self):
|
def description(self):
|
||||||
return "%s@%s,%s" % (self.text, self.start_pos[0], self.start_pos[1])
|
return "%s@%s,%s" % (self.text, self.line, self.column)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.start_pos == other.start_pos \
|
return self._start_pos == other._start_pos \
|
||||||
and self.module_path == other.module_path
|
and self.module_path == other.module_path
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash((self.start_pos, self.module_path))
|
return hash((self._start_pos, self.module_path))
|
||||||
|
|
||||||
|
|
||||||
class CallDef(object):
|
class CallDef(object):
|
||||||
|
|||||||
Reference in New Issue
Block a user