Skip to content

Commit 7f2bd9a

Browse files
committed
Fix type adapter type checks in 3.10
1 parent 8425de3 commit 7f2bd9a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nisystemlink/clients/core/_uplink/_base_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# mypy: disable-error-code = misc
22

3+
from types import UnionType
34
from typing import Any, Callable, Dict, get_origin, Type, Union
45

56
import requests
@@ -78,7 +79,7 @@ def decoder(response: Response | Any) -> Any:
7879
return adapter.validate_python(response, by_alias=True, strict=True)
7980

8081
origin = get_origin(_class)
81-
modelable_origin = origin is Union or origin is dict or origin is list
82+
modelable_origin = origin is Union or origin is UnionType or origin is dict or origin is list
8283
if modelable_origin or utils.is_subclass(_class, JsonModel):
8384
if _type_adapters.get(_class) is None:
8485
_type_adapters[_class] = TypeAdapter(_class)

0 commit comments

Comments
 (0)