mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-23 12:41:43 +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:
@@ -1,5 +1,6 @@
|
||||
import re
|
||||
from codecs import BOM_UTF8
|
||||
from typing import Tuple
|
||||
|
||||
from parso.python.tokenize import group
|
||||
|
||||
@@ -13,10 +14,10 @@ class PrefixPart:
|
||||
self.type = typ
|
||||
self.value = value
|
||||
self.spacing = spacing
|
||||
self.start_pos = start_pos
|
||||
self.start_pos = start_pos # type: Tuple[int, int]
|
||||
|
||||
@property
|
||||
def end_pos(self):
|
||||
def end_pos(self) -> Tuple[int, int]:
|
||||
if self.value.endswith('\n'):
|
||||
return self.start_pos[0] + 1, 0
|
||||
if self.value == unicode_bom:
|
||||
|
||||
Reference in New Issue
Block a user