migrate obsoleted function parse_obj_as to TypeAdapter().validate_python().

This commit is contained in:
2023-07-19 14:43:16 +09:00
parent b569c20b6e
commit 23025bd679
9 changed files with 23 additions and 23 deletions

View File

@ -3,9 +3,8 @@ import hashlib
import json
import os
from pydantic import ValidationError
from pydantic import TypeAdapter, ValidationError
from pydantic.dataclasses import dataclass
from pydantic.tools import parse_obj_as
from mdrsclient.exceptions import UnexpectedException
from mdrsclient.models import Laboratories, Token, User
@ -108,7 +107,7 @@ class CacheFile:
if self.__serial != serial:
try:
with open(self.__cache_file) as f:
data = parse_obj_as(CacheData, json.load(f))
data = TypeAdapter(CacheData).validate_python(json.load(f))
if not data.verify_digest():
raise UnexpectedException("Cache data has been broken.")
self.__data = data