libs.commands.graph.entry

libs/commands/graph/entry.py

 1"""
 2libs/commands/graph/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.graph import personal, rating, summary
10from libs.types import CommandType
11from libs.utils import dictutil
12
13if TYPE_CHECKING:
14    from integrations.protocols import MessageParserProtocol
15
16
17class GraphConfig(SubCommands):
18    """graphセクション処理"""
19
20    def __init__(self) -> None:
21        self.default_commandword: str = "麻雀グラフ"
22        self.section: str = str(CommandType.GRAPH)
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.GRAPH
35    g.params = dictutil.placeholder(g.cfg.graph, m)
36
37    if len(g.params.player_list) == 1:  # 対象がひとり
38        if g.params.statistics:
39            personal.statistics_plot(m)
40        else:
41            personal.plot(m)
42    else:  # 対象が複数
43        if g.params.rating:  # レーティング
44            rating.plot(m)
45        else:
46            if g.params.order:
47                summary.rank_plot(m)
48            else:
49                summary.point_plot(m)
class GraphConfig(libs.bootstrap.section.SubCommands):
18class GraphConfig(SubCommands):
19    """graphセクション処理"""
20
21    def __init__(self) -> None:
22        self.default_commandword: str = "麻雀グラフ"
23        self.section: str = str(CommandType.GRAPH)
24        self.default_reset()

graphセクション処理

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.GRAPH
36    g.params = dictutil.placeholder(g.cfg.graph, m)
37
38    if len(g.params.player_list) == 1:  # 対象がひとり
39        if g.params.statistics:
40            personal.statistics_plot(m)
41        else:
42            personal.plot(m)
43    else:  # 対象が複数
44        if g.params.rating:  # レーティング
45            rating.plot(m)
46        else:
47            if g.params.order:
48                summary.rank_plot(m)
49            else:
50                summary.point_plot(m)

グラフ生成処理エントリーポイント

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