From 740cf12c110ec66ecdd92d22bae9117023bbb433 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 23 Mar 2025 19:09:48 +0800 Subject: [PATCH] fix cython errors --- app/chain/subscribe.py | 2 +- app/utils/crypto.py | 6 +++--- setup.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/chain/subscribe.py b/app/chain/subscribe.py index d63d9f9d..6e63c82e 100644 --- a/app/chain/subscribe.py +++ b/app/chain/subscribe.py @@ -275,7 +275,7 @@ class SubscribeChain(ChainBase, metaclass=Singleton): return True return False - def search(self, sid: int = None, state: str = 'N', manual: bool = False): + def search(self, sid: int = None, state: Optional[str] = 'N', manual: bool = False): """ 订阅搜索 :param sid: 订阅ID,有值时只处理该订阅 diff --git a/app/utils/crypto.py b/app/utils/crypto.py index 3e45530b..5ca7ba9c 100644 --- a/app/utils/crypto.py +++ b/app/utils/crypto.py @@ -1,7 +1,7 @@ import base64 import hashlib from hashlib import md5 -from typing import Union +from typing import Union, Optional, Tuple from Crypto import Random from Crypto.Cipher import AES @@ -13,7 +13,7 @@ from cryptography.hazmat.primitives.asymmetric import padding as asym_padding, r class RSAUtils: @staticmethod - def generate_rsa_key_pair(key_size: int = 2048) -> (str, str): + def generate_rsa_key_pair(key_size: int = 2048) -> Tuple[str, str]: """ 生成RSA密钥对 :return: 私钥和公钥(Base64 编码,无标识符) @@ -46,7 +46,7 @@ class RSAUtils: return private_key_b64, public_key_b64 @staticmethod - def verify_rsa_keys(private_key: str, public_key: str) -> bool: + def verify_rsa_keys(private_key: Optional[str], public_key: Optional[str]) -> bool: """ 使用 RSA 验证私钥和公钥是否匹配 diff --git a/setup.py b/setup.py index 978e91f9..2b2b4df5 100644 --- a/setup.py +++ b/setup.py @@ -29,9 +29,9 @@ setup( "auto_pickle": False, "embedsignature": True, "annotation_typing": True, - "infer_types": False - }, - annotate=True + "infer_types": True, + "binding": True, + } ), script_args=["build_ext", "-j8", "--inplace"], )