fix(pipeline): 兼容入口全量同步 jd_report 符号含 _read_csv_rows

避免 import * 漏掉下划线辅助函数导致报告再生等接口 500。

Made-with: Cursor
This commit is contained in:
hub-gif 2026-04-17 14:39:36 +08:00
parent ca6e71eb4b
commit 5195aec2d7

View File

@ -6,18 +6,29 @@
""" """
from __future__ import annotations from __future__ import annotations
from pipeline.competitor_report.jd_report import * # noqa: F403, F401 import pipeline.competitor_report.jd_report as _jd
from pipeline.competitor_report.jd_report import ( # noqa: F401
main, # ``from jd_report import *`` 不会绑定以下划线开头的名称;外部常以
# ``import *`` 不导出以下划线开头的名称;测试与调试会经本兼容入口访问这些辅助函数。 # ``import pipeline.jd_competitor_report as jcr`` 再访问 ``jcr._read_csv_rows`` 等。
_comment_lines_with_product_context, # 这里把实现模块中除模块身份相关 dunder 以外的符号全部同步到本模块,避免再漏导出。
_comment_sentiment_lexicon, _SKIP = frozenset(
_consumer_feedback_by_matrix_group, {
_counter_mix_top_rows_with_remainder, "__name__",
_merged_rows_grouped_for_matrix, "__doc__",
_sku_to_matrix_group_map, "__file__",
_structure_names_for_pie_counter, "__package__",
"__loader__",
"__spec__",
"__path__",
"__cached__",
"__builtins__",
"__annotations__",
}
) )
for _k, _v in vars(_jd).items():
if _k in _SKIP or (_k.startswith("__") and _k.endswith("__")):
continue
globals()[_k] = _v
if __name__ == "__main__": if __name__ == "__main__":
main() _jd.main()