WarMAC Main

The __init__.py file is the file that is called when WarMAC is executed. It pulls together all of the necessary modules and functions and executes them.
main.SUBCMD_DISPATCH: dict[str, Callable[[Namespace], None]] = average.average()

A dictionary of all commands that can be executed by the user.

main.fix_http_headers(http_headers: dict[str, str], platform: Literal['pc', 'ps4', 'xbox', 'switch', 'mobile'] = 'pc', *, crossplay: bool = True) None

Append the platform name and crossplay status to HTTP headers dict.

Append the platform name and crossplay status to a dictionary containing HTTP headers.

Parameters:
  • http_headers – HTTP headers dictionary.

  • platform – Desired platform, defaults to “pc”.

  • crossplay – Crossplay status, defaults to True.

main.process_cli_command(args: list[str] | None) str

Parse cli args, set up headers, and execute appropriate subcommand.

Call cli_parser.handle_input() to create and parse a cli_parser.WarMACParser, create http headers for the http request, and execute the function associated with the specified subcommand.

Parameters:

args – Optional cli args used for testing.

Raises:

errors.CommandError – Raised if the subparser field of argparse.Namespace does not exist in main.SUBCMD_DISPATCH.

Returns:

The data returned from the subcommand handler.

main.main(args: list[str] | None = None) Literal[0, 1]

Entry point for WarMAC.

Orchestrate core logic and handle errors for WarMAC.

Parameters:

args – Optional cli args used for testing.

Returns:

0 if execution is successful, 1 otherwise.