Parcourir la source

【第一版开发】

1.移除无效代码
2.增加launch.json快速调试配置
ChenYL il y a 1 an
Parent
commit
5f116aa4c7
4 fichiers modifiés avec 34 ajouts et 29 suppressions
  1. 28 0
      .vscode/launch.json
  2. 6 0
      src/__init__.py
  3. 0 2
      src/ak/core/stock_dxsyl_em.py
  4. 0 27
      src/ak/utils/tqdm.py

+ 28 - 0
.vscode/launch.json

@@ -0,0 +1,28 @@
+{
+    // 使用 IntelliSense 了解相关属性。 
+    // 悬停以查看现有属性的描述。
+    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "name": "Python 调试程序: FastAPI",
+            "type": "debugpy",
+            "request": "launch",
+            "module": "uvicorn",
+            "args": [
+                "main:app", // FastAPI 应用的导入路径
+                "--reload", // 开启自动重载
+                "--host",
+                "127.0.0.1", // 指定主机地址
+                "--port",
+                "8000" // 指定端口号
+            ],
+            "jinja": true,
+            "console": "integratedTerminal",
+            "env": {
+                "CONDA_PREFIX": "${env:HOME}/anaconda3/envs/akserver", // 指定conda环境
+                "PYTHONPATH": "${workspaceFolder}/src", // 确保项目根目录在 PYTHONPATH 中
+            }
+        }
+    ]
+}

+ 6 - 0
src/__init__.py

@@ -0,0 +1,6 @@
+# -*- coding:utf-8 -*-
+# !/usr/bin/env python
+"""
+Date: 2024/6/19 22:00
+Desc: 
+"""

+ 0 - 2
src/ak/core/stock_dxsyl_em.py

@@ -11,8 +11,6 @@ https://data.eastmoney.com/xg/xg/default_2.html
 import pandas as pd
 import requests
 
-from ak.utils.tqdm import get_tqdm
-
 def stock_xgsglb_em(symbol: str = "全部股票") -> pd.DataFrame:
     """
     新股申购与中签查询

+ 0 - 27
src/ak/utils/tqdm.py

@@ -1,27 +0,0 @@
-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