validations_libs.group module

class validations_libs.group.Group(groups)[source]

Bases: object

An object for encapsulating the groups of validation

The validations can be grouped together by specifying a groups metadata. These groups are referenced in a groups.yaml file on the filesystem.

group1:
- description: >-
    Description of the group1
group2:
- description: >-
    Description of the group2
group3:
- description: >-
    Description of the group3
property get_data

Get the full content of the groups.yaml file

Returns:

The content of the groups.yaml file

Return type:

dict

Example:

>>> groups = "/foo/bar/groups.yaml"
>>> grp = Group(groups)
>>> print(grp.get_data)
{'group1': [{'description': 'Description of the group1'}],
 'group2': [{'description': 'Description of the group2'}],
 'group3': [{'description': 'Description of the group3'}]}
property get_formated_groups

Get a formated list of groups for output display

Returns:

information about parsed groups

Return type:

list of tuples

Example:

>>> groups = "/foo/bar/groups.yaml"
>>> grp = Group(groups)
>>> print(grp.get_formated_group)
[('group1', 'Description of the group1'),
 ('group2', 'Description of the group2'),
 ('group3', 'Description of the group3')]
property get_groups_keys_list

Get the list of the group name only

Returns:

The list of the group name

Return type:

list

Example:

>>> groups = "/foo/bar/groups.yaml"
>>> grp = Group(groups)
>>> print(grp.get_groups_keys_list)
['group1', 'group2', 'group3']