填表完成后清理 Python 缓存
在差旅报销填表成功后删除 __pycache__,避免运行脚本产生的缓存目录残留在项目根目录。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
be21f0ab5a
commit
327b745055
7
差旅报销.py
7
差旅报销.py
|
|
@ -222,6 +222,7 @@ def command_fill(args):
|
|||
verify_output(output_file, result)
|
||||
final_archive_dir = finalize_archive_dir(archive_dir, result)
|
||||
final_output_file = final_archive_dir / OUTPUT_DIR_NAME / output_file.name
|
||||
cleanup_pycache()
|
||||
|
||||
print(f"完成:{final_output_file}")
|
||||
print(f"本次归档目录:{final_archive_dir}")
|
||||
|
|
@ -358,6 +359,12 @@ def unique_archive_dir(path):
|
|||
index += 1
|
||||
|
||||
|
||||
def cleanup_pycache():
|
||||
pycache_dir = Path("__pycache__")
|
||||
if pycache_dir.exists():
|
||||
shutil.rmtree(pycache_dir)
|
||||
|
||||
|
||||
def build_archive_dir_name(meta):
|
||||
start_date = normalize_date_for_filename(meta["出发日期"])
|
||||
end_date = normalize_date_for_filename(meta["结束日期"])
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user