yawning_titan.config.core.ConfigItemValidation#

class yawning_titan.config.core.ConfigItemValidation(fail_reasons=None, fail_exceptions=None)[source]#

Bases: ConfigValidationBase

Create ConfigItemValidation from ConfigValidationBase.

Methods

add_validation

Add a validation fail_reason, exception pair to their respective lists.

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.

stringify

Represent the class as a string.

Attributes

config_groups

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

config_items

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

passed

fail_reasons or :attribute: fail_exceptions.

property passed#

fail_reasons or :attribute: fail_exceptions.

Returns:

A bool.

Type:

Returns True if there are no

Type:

attribute

add_validation(fail_reason, exception)#

Add a validation fail_reason, exception pair to their respective lists.

Additionally check that no such error already exists.

Parameters:
  • fail_reason – A string message to describe a particular error.

  • exception – A wrapped Exception object that can be used to raise an error for the fail_reason.

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.

stringify()#

Represent the class as a string.

Returns:

A string.