yawning_titan.game_modes.components.blue_agent.MakeNodeSafeGroup#

class yawning_titan.game_modes.components.blue_agent.MakeNodeSafeGroup(doc=None, use=False, increases_vulnerability=False, gives_random_vulnerability=False, vulnerability_change=None)[source]#

Bases: ConfigGroup

Group of values that collectively.

The ConfigGroup constructor.

Parameters:

doc – The groups doc.

Methods

get_config_elements

Get the attributes of the class that are either :class: ConfigGroup or ConfigItem.

get_non_config_elements

Get all attributes of the class that are not :class: ConfigGroup or :class: ConfigItem.

set_from_dict

Set the values of all :class: ConfigGroup or ConfigItem elements.

set_from_yaml

Set the elements of the group from a .yaml file.

stringify

Represent the class as a string.

to_dict

Return the ConfigGroup as a dict.

to_legacy_dict

Convert the group into a unitary depth dictionary of legacy config value (aliases) to :class: ConfigItem's.

to_yaml

Save the values of the elements of the group to a .yaml file.

validate

Extend the parent validation with additional rules specific to this :class: ~yawning_titan.config.core.ConfigGroup.

validate_elements

Call the .validate() method on each of the elements in the group.

Attributes

config_groups

~yawning_titan.config.core.ConfigGroup children of the group.

config_items

~yawning_titan.config.core.ConfigItem children of the group.

validate()[source]#

Extend the parent validation with additional rules specific to this :class: ~yawning_titan.config.core.ConfigGroup.

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_elements()#

Call the .validate() method on each of the elements in the group.