Skip to content

Commit 1884958

Browse files
committed
Fix Python scripts on Ubuntu 20.04
Python 3.8 shipped with Ubuntu 20.04 does not support using concrete types subscript in type hints, e.g. `list[Version]` caused `TypeError: 'type' object is not subscriptable`. This patch fixes #1625 by using the type hint classes provided by the typing module instead of concrete types.
1 parent 056d653 commit 1884958

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/parse_specs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from templates.helper import param_traits, type_traits, value_traits
1818
import ctypes
1919
import itertools
20-
from typing import Optional
20+
from typing import Dict, List, Optional
2121
from version import Version
2222

2323

@@ -504,7 +504,7 @@ def __validate_union_tag(d):
504504
"""
505505
filters object by version
506506
"""
507-
def _filter_version(d, max_ver: Version) -> Optional[dict]:
507+
def _filter_version(d, max_ver: Version) -> Optional[Dict]:
508508
ver = Version(d.get('version', default_version))
509509
if ver > max_ver:
510510
return None
@@ -550,7 +550,7 @@ def __filter_desc(d) -> dict:
550550
"""
551551
creates docs per version
552552
"""
553-
def _make_versions(d, max_ver : Version) -> list[Version]:
553+
def _make_versions(d, max_ver : Version) -> List[Version]:
554554
docs = []
555555
type = d['type']
556556
if 'function' == type or 'struct' == type:

0 commit comments

Comments
 (0)