aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author苏向夜 <fu050409@163.com>2024-03-12 21:14:33 +0800
committer苏向夜 <fu050409@163.com>2024-03-12 21:14:33 +0800
commitc950ac14e4dccfcdbe8bcf4561d3cacb25967195 (patch)
treef6bae90c335aae910b1dcb269d9953fa39593da7
parent596c5568f5f6e27e89f70035762d86bf809002a9 (diff)
downloadipm-c950ac14e4dccfcdbe8bcf4561d3cacb25967195.tar.gz
ipm-c950ac14e4dccfcdbe8bcf4561d3cacb25967195.zip
fix(python): supports python gramma under version 3.8
-rw-r--r--src/ipm/models/ipk.py2
-rw-r--r--src/ipm/utils/hash.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/ipm/models/ipk.py b/src/ipm/models/ipk.py
index ffe307f..aa7513f 100644
--- a/src/ipm/models/ipk.py
+++ b/src/ipm/models/ipk.py
@@ -196,7 +196,7 @@ class InfiniProject(InfiniPackage):
return self._data["project"]["webpage"] # type: ignore
@property
- def unzip(self) -> str | int:
+ def unzip(self) -> Union[str, int]:
return self._data["project"]["unzip"] # type: ignore
@property
diff --git a/src/ipm/utils/hash.py b/src/ipm/utils/hash.py
index c1fa37b..7409d37 100644
--- a/src/ipm/utils/hash.py
+++ b/src/ipm/utils/hash.py
@@ -1,8 +1,9 @@
+from ipm.typing import StrPath
from pathlib import Path
import hashlib
-def ifp_hash(lfp_path: str | Path, block_size=65536) -> bytes:
+def ifp_hash(lfp_path: StrPath, block_size=65536) -> bytes:
sha256 = hashlib.sha256()
with Path(lfp_path).resolve().open("rb") as file:
for block in iter(lambda: file.read(block_size), b""):