libs.commands.results.entry

libs/commands/results/entry.py

 1"""
 2libs/commands/results/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.results import detail, summary, versus
10from libs.types import CommandType
11from libs.utils import dictutil
12
13if TYPE_CHECKING:
14    from integrations.protocols import MessageParserProtocol
15
16
17class ResultsConfig(SubCommands):
18    """resultsセクション処理"""
19
20    def __init__(self) -> None:
21        self.default_commandword: str = "麻雀成績"
22        self.section: str = str(CommandType.RESULTS)
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.RESULTS
35    g.params = dictutil.placeholder(g.cfg.results, m)
36
37    if g.params.verbose and g.params.competition_list:
38        versus.aggregation(m)  # 直接対戦
39    elif g.params.score_comparisons:
40        summary.difference(m)  # 成績サマリ(差分モード)
41    elif g.params.competition_list:
42        detail.comparison(m)  # 成績詳細(比較)
43    elif g.params.player_list:
44        detail.aggregation(m)  # 成績詳細(単独)
45    else:
46        summary.aggregation(m)  # 成績サマリ(通常モード)
class ResultsConfig(libs.bootstrap.section.SubCommands):
18class ResultsConfig(SubCommands):
19    """resultsセクション処理"""
20
21    def __init__(self) -> None:
22        self.default_commandword: str = "麻雀成績"
23        self.section: str = str(CommandType.RESULTS)
24        self.default_reset()

resultsセクション処理

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.RESULTS
36    g.params = dictutil.placeholder(g.cfg.results, m)
37
38    if g.params.verbose and g.params.competition_list:
39        versus.aggregation(m)  # 直接対戦
40    elif g.params.score_comparisons:
41        summary.difference(m)  # 成績サマリ(差分モード)
42    elif g.params.competition_list:
43        detail.comparison(m)  # 成績詳細(比較)
44    elif g.params.player_list:
45        detail.aggregation(m)  # 成績詳細(単独)
46    else:
47        summary.aggregation(m)  # 成績サマリ(通常モード)

成績集計処理エントリーポイント

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