MCPcopy Create free account
hub / github.com/NatsUIJM/autoContents / find_min_page_file

Function find_min_page_file

mainprogress/content_postprocessor.py:45–61  ·  view source on GitHub ↗

找到页码最小的_page_x_merged.json 文件

(json_files: list)

Source from the content-addressed store, hash-verified

43
44
45def find_min_page_file(json_files: list) -> str:
46 """找到页码最小的_page_x_merged.json 文件"""
47 min_page = float('inf')
48 min_file = None
49
50 for file_path in json_files:
51 filename = file_path.name
52 # 匹配_page_x_merged.json 模式
53 match = re.search(r'_page_(\d+)_merged\.json', filename)
54 if match:
55 # 修复:直接使用 match.group(1),去掉多余的 .group
56 page_num = int(match.group(1))
57 if page_num < min_page:
58 min_page = page_num
59 min_file = filename
60
61 return min_file
62
63
64def normalize_levels(data: list) -> list:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected