mirror of
https://github.com/primedigitaltech/market-assistant.git
synced 2026-07-21 23:41:39 +08:00
fix(pipeline): 兼容入口全量同步 jd_report 符号含 _read_csv_rows
避免 import * 漏掉下划线辅助函数导致报告再生等接口 500。 Made-with: Cursor
This commit is contained in:
parent
ca6e71eb4b
commit
5195aec2d7
@ -6,18 +6,29 @@
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from pipeline.competitor_report.jd_report import * # noqa: F403, F401
|
||||
from pipeline.competitor_report.jd_report import ( # noqa: F401
|
||||
main,
|
||||
# ``import *`` 不导出以下划线开头的名称;测试与调试会经本兼容入口访问这些辅助函数。
|
||||
_comment_lines_with_product_context,
|
||||
_comment_sentiment_lexicon,
|
||||
_consumer_feedback_by_matrix_group,
|
||||
_counter_mix_top_rows_with_remainder,
|
||||
_merged_rows_grouped_for_matrix,
|
||||
_sku_to_matrix_group_map,
|
||||
_structure_names_for_pie_counter,
|
||||
import pipeline.competitor_report.jd_report as _jd
|
||||
|
||||
# ``from jd_report import *`` 不会绑定以下划线开头的名称;外部常以
|
||||
# ``import pipeline.jd_competitor_report as jcr`` 再访问 ``jcr._read_csv_rows`` 等。
|
||||
# 这里把实现模块中除模块身份相关 dunder 以外的符号全部同步到本模块,避免再漏导出。
|
||||
_SKIP = frozenset(
|
||||
{
|
||||
"__name__",
|
||||
"__doc__",
|
||||
"__file__",
|
||||
"__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__":
|
||||
main()
|
||||
_jd.main()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user