整理项目文件分类
This commit is contained in:
1 parent
38e2b399d4
commit
1fdec7a548
20 files changed
+35
-13
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -5,7 +5,8 @@ import sys
|
||||
import subprocess
|
||||
|
||||
# 查找目标文件
|
||||
target_dir = "pic/debug_captures/2025-12-31"
|
||||
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
target_dir = os.path.join(PROJECT_ROOT, "pic", "debug_captures", "2025-12-31")
|
||||
if os.path.exists(target_dir):
|
||||
files = os.listdir(target_dir)
|
||||
# 查找包含关键字的文件
|
||||
@@ -24,7 +25,12 @@ if os.path.exists(target_dir):
|
||||
print("\n开始运行测试...\n")
|
||||
|
||||
# 运行测试脚本
|
||||
cmd = [sys.executable, "-u", "test_real_parallel_ocr.py", full_path]
|
||||
cmd = [
|
||||
sys.executable,
|
||||
"-u",
|
||||
os.path.join(PROJECT_ROOT, "deleted_tests_backup", "test_real_parallel_ocr.py"),
|
||||
full_path,
|
||||
]
|
||||
env = os.environ.copy()
|
||||
env['PYTHONIOENCODING'] = 'utf-8'
|
||||
env['PYTHONUNBUFFERED'] = '1'
|
||||
@@ -6,7 +6,8 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, PROJECT_ROOT)
|
||||
|
||||
|
||||
def test_delays():
|
||||
@@ -14,7 +15,11 @@ def test_delays():
|
||||
print("=== 测试延迟设置 ===")
|
||||
|
||||
# 检查代码中是否包含正确的延迟调用
|
||||
with open("douyin/other/douyin_yanghao.py", "r", encoding="utf-8") as f:
|
||||
with open(
|
||||
os.path.join(PROJECT_ROOT, "douyin", "other", "douyin_yanghao.py"),
|
||||
"r",
|
||||
encoding="utf-8",
|
||||
) as f:
|
||||
content = f.read()
|
||||
|
||||
# 检查点击爱心前的延迟
|
||||
@@ -5,7 +5,8 @@ import os
|
||||
import time
|
||||
|
||||
# 添加项目根目录到路径
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, PROJECT_ROOT)
|
||||
|
||||
from douyin.fudai.douyin_fudai_core import should_skip_fudai_by_config
|
||||
|
||||
@@ -12,6 +12,8 @@ import psutil
|
||||
import gc
|
||||
from pathlib import Path
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def get_memory_usage():
|
||||
"""获取当前内存使用情况"""
|
||||
@@ -49,7 +51,7 @@ def test_easyocr_performance():
|
||||
print(f" 内存增加: {memory_after - memory_before:.2f}MB")
|
||||
|
||||
# 查找测试图片
|
||||
pic_dir = Path("pic")
|
||||
pic_dir = PROJECT_ROOT / "pic"
|
||||
test_images = list(pic_dir.glob("*.png"))[:2] # 最多2张图片
|
||||
|
||||
if not test_images:
|
||||
@@ -115,7 +117,7 @@ def test_paddleocr_performance():
|
||||
print(f" 内存增加: {memory_after - memory_before:.2f}MB")
|
||||
|
||||
# 查找测试图片
|
||||
pic_dir = Path("pic")
|
||||
pic_dir = PROJECT_ROOT / "pic"
|
||||
test_images = list(pic_dir.glob("*.png"))[:2] # 最多2张图片
|
||||
|
||||
if not test_images:
|
||||
@@ -5,7 +5,7 @@ import subprocess
|
||||
import threading
|
||||
|
||||
# Add project root to path
|
||||
project_root = os.path.dirname(os.path.abspath(__file__))
|
||||
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if project_root not in sys.path:
|
||||
sys.path.insert(0, project_root)
|
||||
|
||||
+3
-2
@@ -6,7 +6,8 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.insert(0, PROJECT_ROOT)
|
||||
|
||||
|
||||
def validate_fudai_mapping_recording():
|
||||
@@ -22,7 +23,7 @@ def validate_fudai_mapping_recording():
|
||||
]
|
||||
|
||||
# 读取文件内容
|
||||
file_path = "douyin/fudai/douyin_fudai_core.py"
|
||||
file_path = os.path.join(PROJECT_ROOT, "douyin", "fudai", "douyin_fudai_core.py")
|
||||
try:
|
||||
with open(file_path, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
+3
-2
@@ -6,7 +6,8 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.insert(0, PROJECT_ROOT)
|
||||
|
||||
|
||||
def validate_reservation_lock_protection():
|
||||
@@ -23,7 +24,7 @@ def validate_reservation_lock_protection():
|
||||
]
|
||||
|
||||
# 读取文件内容
|
||||
file_path = "douyin/core/douyin_fudai.py"
|
||||
file_path = os.path.join(PROJECT_ROOT, "douyin", "core", "douyin_fudai.py")
|
||||
try:
|
||||
with open(file_path, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
@@ -2,11 +2,17 @@
|
||||
"""项目自检脚本:检查 action_logger 初始化与 analyser._log_kv 绑定。
|
||||
|
||||
用法: 在与项目相同的 Python 环境中运行:
|
||||
python check_action_logger.py
|
||||
python tools/check_action_logger.py
|
||||
"""
|
||||
import logging
|
||||
import time
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
|
||||
import sys
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(PROJECT_ROOT))
|
||||
|
||||
from douyin.logging import action_logger, douyin_logging_wrapper
|
||||
from douyin.core.douyin_fudai import fudai_analyse
|
||||
File renamed without changes.
Reference in new issue
Block a user