mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
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:
parent
d6c6a66c15
commit
0b8012b8e1
7 changed files with 18 additions and 11 deletions
|
@ -17,6 +17,8 @@
|
|||
#
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import typing as T
|
||||
|
||||
from xml.sax import saxutils
|
||||
|
||||
from blueprintcompiler.gir import GirType
|
||||
|
@ -30,7 +32,7 @@ class XmlEmitter:
|
|||
self._tag_stack = []
|
||||
self._needs_newline = False
|
||||
|
||||
def start_tag(self, tag, **attrs: str | GirType | ClassName | bool | None):
|
||||
def start_tag(self, tag, **attrs: T.Union[str, GirType, ClassName, bool, None]):
|
||||
self._indent()
|
||||
self.result += f"<{tag}"
|
||||
for key, val in attrs.items():
|
||||
|
@ -56,7 +58,7 @@ class XmlEmitter:
|
|||
self.result += f"</{tag}>"
|
||||
self._needs_newline = True
|
||||
|
||||
def put_text(self, text: str | int | float):
|
||||
def put_text(self, text: T.Union[str, int, float]):
|
||||
self.result += saxutils.escape(str(text))
|
||||
self._needs_newline = False
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue