mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +08:00
replace name and statement end_pos (this way we can get rid of all that end_pos crap soon)
This commit is contained in:
@@ -860,6 +860,10 @@ class Statement(Simple, DocstringMixin):
|
||||
# cache
|
||||
self._assignment_details = []
|
||||
|
||||
@property
|
||||
def end_pos(self):
|
||||
return self._token_list[-1].end_pos
|
||||
|
||||
def get_code(self, new_line=True):
|
||||
def assemble(command_list, assignment=None):
|
||||
pieces = [c.get_code() if isinstance(c, Simple) else c.string if
|
||||
@@ -1427,6 +1431,10 @@ class Name(Simple):
|
||||
""" Returns the names in a full string format """
|
||||
return ".".join(unicode(n) for n in self.names)
|
||||
|
||||
@property
|
||||
def end_pos(self):
|
||||
return self.names[-1].end_pos
|
||||
|
||||
@property
|
||||
def docstr(self):
|
||||
"""Return attribute docstring (PEP 257) if exists."""
|
||||
|
||||
@@ -89,7 +89,7 @@ def test_module():
|
||||
name = module.name
|
||||
assert str(name) == 'example'
|
||||
assert name.start_pos == (0, 0)
|
||||
assert name.end_pos == (0, 0)
|
||||
assert name.end_pos == (0, 7)
|
||||
|
||||
module = Parser(u('asdf'), no_docstr=True).module
|
||||
name = module.name
|
||||
|
||||
Reference in New Issue
Block a user