fix: auto-fix code issues (cron)
- 修复裸异常捕获 (E722) - 改为具体异常类型 - 修复重复导入/字段定义问题 - 修复PEP8格式问题 (W291 trailing whitespace, E226, E741) - 修复未使用变量 (F841) - 修复变量名遮蔽 (F402) - 修复未定义名称 (F821) - 添加 urllib.parse 导入 - 修复 f-string 缺少占位符 (F541) - 修复模块级导入位置 (E402) - 修复行尾空白和空行问题 - 优化代码结构,提升可读性
This commit is contained in:
@@ -179,27 +179,29 @@ class ExportManager:
|
||||
# 图例
|
||||
legend_x = width - 150
|
||||
legend_y = 80
|
||||
svg_parts.append(f'<rect x="{
|
||||
legend_x -
|
||||
10}" y="{
|
||||
legend_y -
|
||||
20}" width="140" height="{
|
||||
len(type_colors) *
|
||||
25 +
|
||||
10}" fill="white" stroke="#bdc3c7" rx="5"/>')
|
||||
rect_x = legend_x - 10
|
||||
rect_y = legend_y - 20
|
||||
rect_height = len(type_colors) * 25 + 10
|
||||
svg_parts.append(
|
||||
f'<text x="{legend_x}" y="{legend_y}" font-size="12" font-weight="bold" fill="#2c3e50">实体类型</text>'
|
||||
f'<rect x="{rect_x}" y="{rect_y}" width="140" height="{rect_height}" '
|
||||
f'fill="white" stroke="#bdc3c7" rx="5"/>'
|
||||
)
|
||||
svg_parts.append(
|
||||
f'<text x="{legend_x}" y="{legend_y}" font-size="12" font-weight="bold" '
|
||||
f'fill="#2c3e50">实体类型</text>'
|
||||
)
|
||||
|
||||
for i, (etype, color) in enumerate(type_colors.items()):
|
||||
if etype != "default":
|
||||
y_pos = legend_y + 25 + i * 20
|
||||
svg_parts.append(f'<circle cx="{legend_x + 10}" cy="{y_pos}" r="8" fill="{color}"/>')
|
||||
svg_parts.append(f'<text x="{
|
||||
legend_x +
|
||||
25}" y="{
|
||||
y_pos +
|
||||
4}" font-size="10" fill="#2c3e50">{etype}</text>')
|
||||
svg_parts.append(
|
||||
f'<circle cx="{legend_x + 10}" cy="{y_pos}" r="8" fill="{color}"/>'
|
||||
)
|
||||
text_y = y_pos + 4
|
||||
svg_parts.append(
|
||||
f'<text x="{legend_x + 25}" y="{text_y}" font-size="10" '
|
||||
f'fill="#2c3e50">{etype}</text>'
|
||||
)
|
||||
|
||||
svg_parts.append("</svg>")
|
||||
return "\n".join(svg_parts)
|
||||
@@ -414,7 +416,7 @@ class ExportManager:
|
||||
story = []
|
||||
|
||||
# 标题页
|
||||
story.append(Paragraph(f"InsightFlow 项目报告", title_style))
|
||||
story.append(Paragraph("InsightFlow 项目报告", title_style))
|
||||
story.append(Paragraph(f"项目名称: {project_name}", styles["Heading2"]))
|
||||
story.append(Paragraph(f"生成时间: {datetime.now().strftime('%Y-%m-%d %H:%M')}", styles["Normal"]))
|
||||
story.append(Spacer(1, 0.3 * inch))
|
||||
|
||||
Reference in New Issue
Block a user