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:
Christian Kellner 2020-06-08 23:18:26 +02:00 committed by David Rheinsberg
parent 7a2ad6f0f8
commit 696219dab9

View file

@ -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)