chore: Clean up blank lines across multiple files to enhance readability
- Removed excessive blank lines in various Python scripts, markdown files, and configuration files to improve overall code clarity and maintainability. - Ensured consistent formatting throughout the project, contributing to a more organized codebase.
This commit is contained in:
1 parent
ace3bbfa04
commit
07c387751d
62 files changed
+2432
-1734
No files matched your search
@@ -14,7 +14,15 @@ from typing import Any, Optional
|
||||
os.environ.setdefault("DISABLE_MODEL_SOURCE_CHECK", "True")
|
||||
# 额外抑制 paddle/oneDNN/glog 的冗余信息(INFO/WARNING)
|
||||
os.environ.setdefault("GLOG_minloglevel", "2")
|
||||
os.environ.setdefault("OMP_NUM_THREADS", "1")
|
||||
|
||||
# 优化OMP_NUM_THREADS:允许底层库使用多线程,但不要设置太高避免线程竞争
|
||||
# 设置为CPU核心数的一半,平衡性能和资源使用
|
||||
import os as os_module
|
||||
cpu_count = os_module.cpu_count() or 4
|
||||
# 对于OCR任务,每个线程内部会使用多个OMP线程,所以设置为2-4比较合适
|
||||
# 如果CPU核心数>=8,设置为4;否则设置为2
|
||||
optimal_omp_threads = min(4, max(2, cpu_count // 3))
|
||||
os.environ.setdefault("OMP_NUM_THREADS", str(optimal_omp_threads))
|
||||
|
||||
|
||||
class OCRProcessor:
|
||||
|
||||
@@ -99,3 +99,8 @@ def get_scrcpy_screenshot(device_id: str, output_path: str) -> bool:
|
||||
scrcpy = ScrcpyScreenshot()
|
||||
return scrcpy.get_screenshot(device_id, output_path)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
包含截图、图片裁剪等截图相关操作。
|
||||
支持后台截图服务和多线程优化。
|
||||
"""
|
||||
# pyright: reportOptionalMemberAccess=false
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -70,11 +71,10 @@ class ScreenshotOperations:
|
||||
try:
|
||||
import path_config
|
||||
out_dir = path_config.get_pic_dir()
|
||||
except Exception:
|
||||
except Exception: # type: ignore
|
||||
# 回退到旧路径(向后兼容)
|
||||
import path_config
|
||||
out_dir = path_config.get_pic_dir()
|
||||
else:
|
||||
out_dir = os.path.join(os.path.dirname(__file__), "pic")
|
||||
else: # type: ignore
|
||||
out_dir = os.path.join(os.path.dirname(__file__), "target_pic")
|
||||
if not os.path.exists(out_dir):
|
||||
os.makedirs(out_dir)
|
||||
|
||||
Reference in new issue
Block a user