4ae33cbe53
- 每个文件补充模块级 docstring、类/函数 docstring、关键逻辑行内注释 - 注释风格:"中文说明" 或 # 中文说明 - 代码结构和逻辑完全不变
120 lines
2.9 KiB
Python
120 lines
2.9 KiB
Python
"""核心公开 API 模块。
|
|
|
|
作为 a1_swap_mod_packer 包的统一入口,通过 __all__ 列表集中导出
|
|
所有对外公开的符号(类、函数、常量),方便外部调用者从一个模块导入所有所需接口。
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from .archive import GCODE_MEMBER_RE, MD5_MEMBER_RE, list_gcode_members
|
|
from .builder import (
|
|
build_packed_3mf,
|
|
expand_jobs,
|
|
load_plate_sources,
|
|
process_plate_gcode,
|
|
update_preview_label,
|
|
write_output_3mf,
|
|
)
|
|
from .gcode import (
|
|
M73_RE,
|
|
apply_line_ending,
|
|
apply_plate_number_offset,
|
|
build_swap_block,
|
|
format_duration,
|
|
format_filament,
|
|
insert_swap_block,
|
|
list_swap_gcode_files,
|
|
normalize_newlines,
|
|
read_swap_gcode_file,
|
|
resolve_swap_gcode_path,
|
|
)
|
|
from .metadata import (
|
|
multiply_summary,
|
|
read_3mf_summary,
|
|
read_filament_metadata,
|
|
read_slice_plate_metadata,
|
|
safe_float,
|
|
summarize_jobs,
|
|
update_first_slice_info,
|
|
)
|
|
from .models import (
|
|
DEFAULT_INSERT_BEFORE_MARKER,
|
|
DEFAULT_ZIP_COMPRESS_LEVEL,
|
|
BuildOptions,
|
|
BuildResult,
|
|
BuildSummary,
|
|
GcodePatchConfig,
|
|
GcodePatchRule,
|
|
LineEnding,
|
|
MetadataMode,
|
|
PlateJob,
|
|
PlateSource,
|
|
ThreeMfSummary,
|
|
)
|
|
from .patches import apply_gcode_patches, apply_patch_rule, parse_bool, parse_patch_config
|
|
from .planning import (
|
|
DEFAULT_OUTPUT_PATTERN,
|
|
OutputNamingOptions,
|
|
OutputSummary,
|
|
make_unique_for_run,
|
|
resolve_output_path,
|
|
sanitize_filename,
|
|
summarize_jobs_for_output,
|
|
three_mf_summary_from_mapping,
|
|
)
|
|
|
|
# 公开 API:集中管理所有对外的符号导出
|
|
__all__ = [
|
|
"DEFAULT_INSERT_BEFORE_MARKER",
|
|
"DEFAULT_OUTPUT_PATTERN",
|
|
"DEFAULT_ZIP_COMPRESS_LEVEL",
|
|
"GCODE_MEMBER_RE",
|
|
"M73_RE",
|
|
"MD5_MEMBER_RE",
|
|
"BuildOptions",
|
|
"BuildResult",
|
|
"BuildSummary",
|
|
"GcodePatchConfig",
|
|
"GcodePatchRule",
|
|
"LineEnding",
|
|
"MetadataMode",
|
|
"OutputNamingOptions",
|
|
"OutputSummary",
|
|
"PlateJob",
|
|
"PlateSource",
|
|
"ThreeMfSummary",
|
|
"apply_gcode_patches",
|
|
"apply_line_ending",
|
|
"apply_patch_rule",
|
|
"apply_plate_number_offset",
|
|
"build_packed_3mf",
|
|
"build_swap_block",
|
|
"expand_jobs",
|
|
"format_duration",
|
|
"format_filament",
|
|
"insert_swap_block",
|
|
"list_gcode_members",
|
|
"list_swap_gcode_files",
|
|
"load_plate_sources",
|
|
"make_unique_for_run",
|
|
"multiply_summary",
|
|
"normalize_newlines",
|
|
"parse_bool",
|
|
"parse_patch_config",
|
|
"process_plate_gcode",
|
|
"read_3mf_summary",
|
|
"read_filament_metadata",
|
|
"read_slice_plate_metadata",
|
|
"read_swap_gcode_file",
|
|
"resolve_output_path",
|
|
"resolve_swap_gcode_path",
|
|
"safe_float",
|
|
"sanitize_filename",
|
|
"summarize_jobs",
|
|
"summarize_jobs_for_output",
|
|
"three_mf_summary_from_mapping",
|
|
"update_first_slice_info",
|
|
"update_preview_label",
|
|
"write_output_3mf",
|
|
]
|