Python <3.9 typing compat: list

Subscribing builtins.list wasn't added until Python 3.9 so use
`typing.List` where applicable.
This commit is contained in:
lojack5
2023-10-18 13:08:54 -06:00
parent 17438ac318
commit 2ea917b0b5
2 changed files with 3 additions and 3 deletions

View File

@@ -82,7 +82,7 @@ typing_imports = """\
from __future__ import annotations
from collections.abc import Callable
from enum import IntEnum, IntFlag, auto
from typing import Any, overload, TypeAlias, TypeVar, ParamSpec, Generic, Union, Optional
from typing import Any, overload, TypeAlias, TypeVar, ParamSpec, Generic, Union, Optional, List
"""

View File

@@ -213,11 +213,11 @@ class FixWxPrefix(object):
if type_name.startswith('Vector<') and type_name.endswith('>'):
# Special handling for 'Vector<type>' types
type_name = self.cleanType(type_name[7:-1])
return f'list[{type_name}]'
return f'List[{type_name}]'
if type_name.startswith('Array'):
type_name = self.cleanType(type_name[5:])
if type_name:
return f'list[{type_name}]'
return f'List[{type_name}]'
else:
return 'list'
return type_map.get(type_name, type_name)