mirror of
https://github.com/davidhalter/parso.git
synced 2026-04-27 17:51:34 +08:00
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:
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user