libs.commands.report.entry

libs/commands/report/entry.py

 1"""
 2libs/commands/report/entry.py
 3"""
 4
 5from typing import TYPE_CHECKING
 6
 7import libs.global_value as g
 8from libs.bootstrap.section import SubCommands
 9from libs.commands.report import matrix, monthly, stats_list, stats_report, winner
10from libs.types import CommandType
11from libs.utils import dictutil
12
13if TYPE_CHECKING:
14    from integrations.protocols import MessageParserProtocol
15
16
17class ReportConfig(SubCommands):
18    """reportセクション処理"""
19
20    def __init__(self) -> None:
21        self.default_commandword: str = "麻雀レポート"
22        self.section: str = str(CommandType.REPORT)
23        self.default_reset()
24
25
26def main(m: "MessageParserProtocol") -> None:
27    """
28    レポート生成処理エントリーポイント
29
30    Args:
31        m (MessageParserProtocol): メッセージデータ
32
33    """
34    m.status.command_type = CommandType.REPORT
35    g.params = dictutil.placeholder(g.cfg.report, m)
36
37    if len(g.params.player_list) == 1:  # 成績レポート
38        stats_report.gen_pdf(m)
39    elif g.params.order:
40        winner.plot(m)
41    elif g.params.statistics:
42        monthly.plot(m)
43    elif g.params.versus_matrix or len(g.params.player_list) >= 2:  # 対局対戦マトリックス
44        matrix.plot(m)
45    else:
46        stats_list.main(m)
class ReportConfig(libs.bootstrap.section.SubCommands):
18class ReportConfig(SubCommands):
19    """reportセクション処理"""
20
21    def __init__(self) -> None:
22        self.default_commandword: str = "麻雀レポート"
23        self.section: str = str(CommandType.REPORT)
24        self.default_reset()

reportセクション処理

default_commandword: str

コマンドワードデフォルト値

section: str

セクション名

def main(m: integrations.protocols.MessageParserProtocol) -> None:
27def main(m: "MessageParserProtocol") -> None:
28    """
29    レポート生成処理エントリーポイント
30
31    Args:
32        m (MessageParserProtocol): メッセージデータ
33
34    """
35    m.status.command_type = CommandType.REPORT
36    g.params = dictutil.placeholder(g.cfg.report, m)
37
38    if len(g.params.player_list) == 1:  # 成績レポート
39        stats_report.gen_pdf(m)
40    elif g.params.order:
41        winner.plot(m)
42    elif g.params.statistics:
43        monthly.plot(m)
44    elif g.params.versus_matrix or len(g.params.player_list) >= 2:  # 対局対戦マトリックス
45        matrix.plot(m)
46    else:
47        stats_list.main(m)

レポート生成処理エントリーポイント

Arguments:
  • m (MessageParserProtocol): メッセージデータ