util/ostree: accept typing.List for List[str]
In python 3.6 the value of `__origin__` for typing.List[str] is typing.List. This then changed to the actual `list` type in later versions. Accept both versions.
This commit is contained in:
parent
7a2ad6f0f8
commit
696219dab9
1 changed files with 2 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ import contextlib
|
|||
import json
|
||||
import os
|
||||
import tempfile
|
||||
import typing
|
||||
|
||||
from typing import List
|
||||
|
||||
|
|
@ -17,7 +18,7 @@ class Param:
|
|||
origin = getattr(self.type, "__origin__", None)
|
||||
if origin:
|
||||
self.typecheck(value, origin)
|
||||
if origin is list:
|
||||
if origin is list or origin is typing.List:
|
||||
self.check_list(value, self.type)
|
||||
else:
|
||||
raise NotImplementedError(origin)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue