aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author苏向夜 <fu050409@163.com>2024-03-29 19:54:59 +0800
committer苏向夜 <fu050409@163.com>2024-03-29 19:54:59 +0800
commit7e69e6b41eb2aae99ab4b3af1b87e4ee54564f3f (patch)
tree0fcc1cff109f96b9f7626aa1f225510aebc28f7a
parent6c14879724282e4a5aad3f823d1a8cc72d4ffe6b (diff)
downloadipm-7e69e6b41eb2aae99ab4b3af1b87e4ee54564f3f.tar.gz
ipm-7e69e6b41eb2aae99ab4b3af1b87e4ee54564f3f.zip
fix(python): supports python gramma under version 3.8
-rw-r--r--src/ipm/models/index.py4
1 files changed, 2 insertions, 2 deletions
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: