From 7e69e6b41eb2aae99ab4b3af1b87e4ee54564f3f Mon Sep 17 00:00:00 2001 From: 苏向夜 Date: Fri, 29 Mar 2024 19:54:59 +0800 Subject: fix(python): supports python gramma under version 3.8 --- src/ipm/models/index.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ipm/models/index.py b/src/ipm/models/index.py index f823131..0bac21e 100644 --- a/src/ipm/models/index.py +++ b/src/ipm/models/index.py @@ -1,5 +1,5 @@ from pathlib import Path -from typing import Any, Literal, Optional +from typing import Any, Literal, Optional, Union from ipm.const import INDEX_PATH from ipm.exceptions import LockLoadFailed from ipm.typing import Dict @@ -28,7 +28,7 @@ class Yggdrasil: json.dump(self._data, self._source_path.open("w", encoding="utf-8")) @staticmethod - def try_loads(path: Path) -> Dict | Literal[False]: + def try_loads(path: Path) -> Union[Dict, Literal[False]]: try: return json.loads(path.read_text(encoding="utf-8")) except Exception as e: -- cgit v1.2.3-70-g09d2