Support Python 3.9

Remove the '|' syntax for type unions, since it's a 3.10 feature, and
set mypy to check with version 3.9.
This commit is contained in:
James Westman 2022-10-27 13:15:58 -05:00
parent d6c6a66c15
commit 0b8012b8e1
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
7 changed files with 18 additions and 11 deletions

View file

@ -17,6 +17,7 @@
#
# SPDX-License-Identifier: LGPL-3.0-or-later
import typing as T
from .common import *
from .types import TypeName
@ -50,7 +51,7 @@ class TranslatedStringValue(Value):
return self.tokens["value"]
@property
def context(self) -> str | None:
def context(self) -> T.Optional[str]:
return self.tokens["context"]
@ -116,7 +117,7 @@ class NumberValue(Value):
grammar = UseNumber("value")
@property
def value(self) -> int | float:
def value(self) -> T.Union[int, float]:
return self.tokens["value"]
@validate()