Add type annotations to start- and end-pos attributes

These are frequently used within consuming code, so having annotations
avoids others needing to work around mypy errors from them.
This commit is contained in:
Peter Law
2021-01-03 15:57:35 +00:00
parent 14c88c1f4b
commit 0e20c33c21
4 changed files with 23 additions and 19 deletions
+2 -1
View File
@@ -47,6 +47,7 @@ try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping
from typing import Tuple
from parso.tree import Node, BaseNode, Leaf, ErrorNode, ErrorLeaf, \
search_ancestor
@@ -149,7 +150,7 @@ class _LeafWithoutNewlines(PythonLeaf):
__slots__ = ()
@property
def end_pos(self):
def end_pos(self) -> Tuple[int, int]:
return self.line, self.column + len(self.value)