修复shared_memory_cache.py类型注解错误

- 修复clear_cache方法参数类型:str -> Optional[str]
- 修复get_kline_data方法参数类型:str -> Optional[str]
- 解决Pylance类型检查警告
This commit is contained in:
cuizhan 2025-08-13 16:24:47 +08:00
parent ac8404a66d
commit e479a664a5

View File

@ -264,7 +264,7 @@ class SharedMemoryKlineCache:
print(f"❌ 批量添加K线数据到共享内存失败: {e}") print(f"❌ 批量添加K线数据到共享内存失败: {e}")
return 0 return 0
def get_kline_data(self, stock_code: str = None, limit: int = 100) -> dict: def get_kline_data(self, stock_code: Optional[str] = None, limit: int = 100) -> dict:
""" """
从共享内存获取K线数据 从共享内存获取K线数据
@ -351,7 +351,7 @@ class SharedMemoryKlineCache:
except Exception as e: except Exception as e:
return {'status': 'error', 'error': str(e)} return {'status': 'error', 'error': str(e)}
def clear_cache(self, stock_code: str = None) -> bool: def clear_cache(self, stock_code: Optional[str] = None) -> bool:
"""清理缓存数据""" """清理缓存数据"""
with self.lock: with self.lock:
try: try: