maintainers: Avoid backwards-incompatible type declarations
Local-variable type declarations break on interpreter versions < 3.6.
Instead, cast the object to the type to avoid the incompatible syntax.
Change-Id: I1b813908002fe6aac95e6514ac09838d2f28daa6
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/amboar/obmc-scripts/maintainers/obmc/maintainers.py b/amboar/obmc-scripts/maintainers/obmc/maintainers.py
index d18d676..2b261af 100755
--- a/amboar/obmc-scripts/maintainers/obmc/maintainers.py
+++ b/amboar/obmc-scripts/maintainers/obmc/maintainers.py
@@ -106,7 +106,7 @@
def parse_block(src: Iterator[str]) -> Optional[B]:
state = ParseState.BEGIN
- repo: Dict[LineType, D] = OrderedDict()
+ repo = cast(B, OrderedDict())
for line in src:
try:
entry = parse_line(line)
@@ -149,10 +149,10 @@
break
def parse_maintainers(src: Iterator[str]) -> Dict[D, B]:
- maintainers: Dict[D, B] = OrderedDict()
+ maintainers = cast(Dict[D, B], OrderedDict())
trash_preamble(src)
while True:
- repo: B = parse_block(src)
+ repo = cast(B, parse_block(src))
if not repo:
break
maintainers[repo[LineType.REPO]] = repo