yawning_titan.game_modes.components.reset.Reset#
- class yawning_titan.game_modes.components.reset.Reset(randomise_vulnerabilities=False, choose_new_high_value_nodes=False, choose_new_entry_nodes=False)[source]#
Bases:
ConfigGroup
The modifications to network performed on reset.
The ConfigGroup constructor.
- Parameters:
doc – The groups doc.
Methods
Get the attributes of the class that are either :class: ConfigGroup or
ConfigItem
.Get all attributes of the class that are not :class: ConfigGroup or :class: ConfigItem.
Set the values of all :class: ConfigGroup or
ConfigItem
elements.Set the elements of the group from a .yaml file.
Represent the class as a string.
Return the ConfigGroup as a dict.
Convert the group into a unitary depth dictionary of legacy config value (aliases) to :class: ConfigItem's.
Save the values of the elements of the group to a .yaml file.
Validate the grouped items against their properties.
Call the .validate() method on each of the elements in the group.
Attributes
~yawning_titan.config.core.ConfigGroup children of the group.
~yawning_titan.config.core.ConfigItem children of the group.
- property config_groups#
~yawning_titan.config.core.ConfigGroup children of the group.
- Type:
Property to represent the
- Type:
class
- property config_items#
~yawning_titan.config.core.ConfigItem children of the group.
- Type:
Property to represent the
- Type:
class
- get_config_elements(types=None)#
Get the attributes of the class that are either :class: ConfigGroup or
ConfigItem
.- Parameters:
_type – An optional type for a specific type of config element.
- Returns:
A dictionary of names to config elements.
- get_non_config_elements()#
Get all attributes of the class that are not :class: ConfigGroup or :class: ConfigItem.
- Returns:
A dictionary of names to attributes.
- set_from_dict(config_dict, legacy=False, infer_legacy=False, **kwargs)#
Set the values of all :class: ConfigGroup or
ConfigItem
elements.- Parameters:
config_dict – A dictionary representing values of all config elements.
legacy – Whether to use the alias names for config elements to construct the config from a legacy dictionary.
infer_legacy – Attempt to recognise if a config is of a legacy type.
- kwargs can contain 2 parameters:
- root: Whether the element is a base level element or not.
if the element is a root then it should validate all of its descendants.
legacy_lookup: The current flattened dictionary representation of the class by its legacy keys.
- set_from_yaml(file_path, legacy=False, infer_legacy=False)#
Set the elements of the group from a .yaml file.
- Parameters:
file_path – The path to the .yaml file.
legacy – Whether to use the alias names for config elements to construct the config from a legacy dictionary.
infer_legacy – Attempt to recognise if a config is of a legacy type.
- stringify()#
Represent the class as a string.
- Returns:
A string.
- to_dict(values_only=False, legacy=False, include_none=True)#
Return the ConfigGroup as a dict.
- Parameters:
values_only – Create a dictionary containing only the value of :class: ConfigItem’s
legacy – Convert the group into a unitary depth dictionary of legacy config value (aliases) to :class: ConfigItem’s by calling :method: ConfigGroup.to_legacy.
- Returns:
The ConfigGroup as a dict.
- to_legacy_dict(flattened_dict=None)#
Convert the group into a unitary depth dictionary of legacy config value (aliases) to :class: ConfigItem’s.
- Returns:
a dictionary
- to_yaml(file_path)#
Save the values of the elements of the group to a .yaml file.
- Parameters:
file_path – The path to the .yaml file
- validate(raise_overall_exception=False)#
Validate the grouped items against their properties.
- Returns:
An instance of
ConfigGroupValidation
.
- validate_elements()#
Call the .validate() method on each of the elements in the group.