onix.scripts.log_generator module

Generate mock logs for ease of testing

onix.scripts.log_generator.generate_pokemon(species, context, level=100, hackmons=False, any_ability=False)[source]

Randomly generate a Showdown-style Pokemon dict and the corresponding Moveset DTO for the given species

Parameters:
  • species (str) – species or forme name
  • context (contexts.Context) – The resources needed by the function. Requires pokedex, formats_data, accessible_formes, natures and sanitizer.
  • level (int, optional) – the Pokemon’s desired level. Default is 100.
  • hackmons (bool, optional) – Set to True if this is for a metagame where a battle forme or mega evolution can appear outside its base forme. Default is False.
  • any_ability (bool, optional) – Set to True if the Pokemon can have have “illegal” abilities. Default is False.
Returns:

  • dict : A Showdown-style Pokemon dict of the specified species
  • Moveset : The corresponding moveset that should be parsed

Return type:

(tuple)

onix.scripts.log_generator.generate_player(name, **ratings)[source]

Generate a Showdown-style player’s rating dict and the corresponding Player DTO for the given species

Parameters:
  • name (str) – the player’s name
  • **ratings – values to put in the player’s rating dict. Unset values will be randomly generated.
Returns:

  • dict : A Showdown-style ratings dict for the specified player
  • Player : The corresponding DTO that should be parsed

Return type:

(tuple)

onix.scripts.log_generator.generate_log(players, teams, turns=None, end_type=None)[source]

Generate a mock log.

Parameters:
  • players (list of dict) – The rating dictionaries of the players in the match
  • teams (list of list of dict) – The Pokemon dictionaries for each player’s team. Must have same length as players.
  • turns (int, optional) – Number of turns in the battle. Default is a random value.
  • end_type (str, optional) – End type. Default is “normal”
Returns:

The mock log

Return type:

dict