fa45d8aa5f
- health_checklist.json: 192.168.1.122→node122
- ocr_client.py: docstring IP→node122
- docs/market-data-requirements.md: IP→node122
- 所有API调用通过ProxyHandler({})绕过系统代理
Privoxy对node122:18003返回500,直连正常
28 lines
847 B
Python
28 lines
847 B
Python
def get_tqdm(enable: bool = True):
|
|
"""
|
|
返回适用于当前环境的 tqdm 对象。
|
|
|
|
Args:
|
|
enable (bool): 是否启用进度条。默认为 True。
|
|
|
|
Returns:
|
|
tqdm 对象。
|
|
"""
|
|
if not enable:
|
|
# 如果进度条被禁用,返回一个不显示进度条的 tqdm 对象
|
|
return lambda iterable, *args, **kwargs: iterable
|
|
|
|
try:
|
|
# 尝试检查是否在 jupyter notebook 环境中,有利于退出进度条
|
|
# noinspection PyUnresolvedReferences
|
|
shell = get_ipython().__class__.__name__
|
|
if shell == "ZMQInteractiveShell":
|
|
from tqdm.notebook import tqdm
|
|
else:
|
|
from tqdm import tqdm
|
|
except (NameError, ImportError):
|
|
# 如果不在 Jupyter 环境中,就使用标准 tqdm
|
|
from tqdm import tqdm
|
|
|
|
return tqdm
|