fix: auto-fix code issues (cron)
- 修复重复导入/字段 - 修复异常处理 - 修复PEP8格式问题 - 添加类型注解
This commit is contained in:
@@ -22,14 +22,7 @@ try:
|
||||
from reportlab.lib.pagesizes import A4
|
||||
from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
|
||||
from reportlab.lib.units import inch
|
||||
from reportlab.platypus import (
|
||||
PageBreak,
|
||||
Paragraph,
|
||||
SimpleDocTemplate,
|
||||
Spacer,
|
||||
Table,
|
||||
TableStyle,
|
||||
)
|
||||
from reportlab.platypus import PageBreak, Paragraph, SimpleDocTemplate, Spacer, Table, TableStyle
|
||||
|
||||
REPORTLAB_AVAILABLE = True
|
||||
except ImportError:
|
||||
@@ -194,20 +187,16 @@ class ExportManager:
|
||||
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>'
|
||||
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'<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>'
|
||||
f'<text x="{legend_x + 25}" y="{text_y}" font-size="10" ' f'fill="#2c3e50">{etype}</text>'
|
||||
)
|
||||
|
||||
svg_parts.append("</svg>")
|
||||
@@ -320,7 +309,6 @@ class ExportManager:
|
||||
Returns:
|
||||
CSV 字符串
|
||||
"""
|
||||
import csv
|
||||
|
||||
output = io.StringIO()
|
||||
writer = csv.writer(output)
|
||||
@@ -586,7 +574,7 @@ class ExportManager:
|
||||
_export_manager = None
|
||||
|
||||
|
||||
def get_export_manager(db_manager=None):
|
||||
def get_export_manager(db_manager=None) -> None:
|
||||
"""获取导出管理器实例"""
|
||||
global _export_manager
|
||||
if _export_manager is None:
|
||||
|
||||
Reference in New Issue
Block a user