From c950ac14e4dccfcdbe8bcf4561d3cacb25967195 Mon Sep 17 00:00:00 2001 From: 苏向夜 Date: Tue, 12 Mar 2024 21:14:33 +0800 Subject: fix(python): supports python gramma under version 3.8 --- src/ipm/models/ipk.py | 2 +- src/ipm/utils/hash.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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""): -- cgit v1.2.3-70-g09d2