Compare commits

...

4 commits

187 changed files with 1146 additions and 200 deletions

View file

@ -1,3 +1,11 @@
## 0.2.0a9 (2025-05-12)
### Fix
- black
- update translation
- load file with order
## 0.2.0a8 (2025-05-02)
### Fix

View file

@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2025-04-09 08:34+0200\n"
"PO-Revision-Date: 2025-04-09 08:35+0200\n"
"POT-Creation-Date: 2025-05-11 10:23+0200\n"
"PO-Revision-Date: 2025-05-11 10:23+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@ -16,21 +16,21 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.5\n"
#: src/rougail/user_data_yaml/__init__.py:42
#: src/rougail/user_data_yaml/__init__.py:43
msgid "yaml is not set in step.user_data"
msgstr "\"yaml\" n'est pas défini dans step.user_data"
#: src/rougail/user_data_yaml/__init__.py:62
#: src/rougail/user_data_yaml/__init__.py:63
msgid "cannot load \"{0}\", the root value is not a dict but \"{1}\""
msgstr ""
"ne peut charger \"{0}\", la valeur racine n'est pas une dictionnaire mais "
"\"{1}\""
#: src/rougail/user_data_yaml/__init__.py:85
#: src/rougail/user_data_yaml/__init__.py:86
msgid "the YAML file \"{0}\""
msgstr "le fichier YAML \"{0}\""
#: src/rougail/user_data_yaml/__init__.py:116
#: src/rougail/user_data_yaml/__init__.py:117
msgid "\"{0}\" in {1} has an unknown value"
msgstr "\"{0}\" dans {1} a une valeur inconnue"

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-04-29 23:02+0200\n"
"POT-Creation-Date: 2025-05-12 08:39+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -15,31 +15,31 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
#: src/rougail/user_data_yaml/__init__.py:43
#: src/rougail/user_data_yaml/__init__.py:45
msgid "yaml is not set in step.user_data"
msgstr ""
#: src/rougail/user_data_yaml/__init__.py:63
#: src/rougail/user_data_yaml/__init__.py:65
msgid "cannot load \"{0}\", the root value is not a dict but \"{1}\""
msgstr ""
#: src/rougail/user_data_yaml/__init__.py:86
#: src/rougail/user_data_yaml/__init__.py:88
msgid "the YAML file \"{0}\""
msgstr ""
#: src/rougail/user_data_yaml/__init__.py:117
#: src/rougail/user_data_yaml/__init__.py:120
msgid "\"{0}\" in {1} has an unknown value"
msgstr ""
#: src/rougail/user_data_yaml/config.py:29
#: src/rougail/user_data_yaml/config.py:30
msgid "Configuration rougail-user-data-yaml"
msgstr ""
#: src/rougail/user_data_yaml/config.py:38
#: src/rougail/user_data_yaml/config.py:39
msgid "Filename"
msgstr ""
#: src/rougail/user_data_yaml/config.py:49
#: src/rougail/user_data_yaml/config.py:50
msgid "File that may contain secrets"
msgstr ""

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail.user_data_yaml"
version = "0.2.0a8"
version = "0.2.0a9"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail user_data yaml"

View file

@ -15,6 +15,7 @@ details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from ruamel.yaml import YAML
from rougail.error import ExtentionError
@ -33,6 +34,7 @@ class RougailUserDataYaml:
) -> None:
if rougailconfig is None:
from rougail import RougailConfig
rougailconfig = RougailConfig
user_data = rougailconfig["step.user_data"]
if "yaml" not in user_data:
@ -71,11 +73,11 @@ class RougailUserDataYaml:
file_values,
filename,
)
if self.file_with_secrets == 'none':
if self.file_with_secrets == "none":
allow_secrets_variables = False
elif self.file_with_secrets == 'first':
elif self.file_with_secrets == "first":
allow_secrets_variables = idx == 0
elif self.file_with_secrets == 'last':
elif self.file_with_secrets == "last":
if not idx:
last_filenames = len(self.filenames) - 1
allow_secrets_variables = idx == last_filenames
@ -87,8 +89,9 @@ class RougailUserDataYaml:
"errors": self.errors,
"warnings": self.warnings,
"values": values,
'options': {'allow_secrets_variables': allow_secrets_variables,
},
"options": {
"allow_secrets_variables": allow_secrets_variables,
},
}
)
return user_datas
@ -110,7 +113,7 @@ class RougailUserDataYaml:
self.parse(values, path + ".", value, filename)
elif isinstance(value, list) and value and isinstance(value[0], dict):
# it's a leadership
keys = set()
keys = []
for val in value:
if not isinstance(val, dict):
self.errors.append(
@ -119,7 +122,9 @@ class RougailUserDataYaml:
)
)
break
keys |= set(val)
for v in val:
if v not in keys:
keys.append(v)
else:
for val in value:
for key in keys:

View file

@ -1 +1 @@
__version__ = "0.2.0a8"
__version__ = "0.2.0a9"

View file

@ -17,6 +17,7 @@ details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from .i18n import _

View file

@ -0,0 +1,6 @@
{
"errors": [],
"warnings": [
"variable or family \"unknown\" does not exist, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/00_unknown_variable.yaml\""
]
}

View file

@ -0,0 +1,7 @@
{
"errors": [],
"warnings": [
"family \"family_disabled\" is disabled, \"family_disabled.variable1\" will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/01_disabled_family.yaml\"",
"family \"family_disabled\" is disabled, \"family_disabled.variable2\" will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/01_disabled_family.yaml\""
]
}

View file

@ -0,0 +1,6 @@
{
"errors": [],
"warnings": [
"variable \"variable_disabled\" is disabled, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/01_disabled_variable.yaml\""
]
}

View file

@ -0,0 +1,6 @@
{
"errors": [],
"warnings": [
"the value \"test\" is invalid for \"variable_int\", which is not an integer, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/01_wrong_type.yaml\""
]
}

View file

@ -0,0 +1,6 @@
{
"errors": [],
"warnings": [
"family \"family_disabled_hidden\" is disabled and hidden, \"family_disabled_hidden.variable1\" will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/02_disabled_hidden_family.yaml\""
]
}

View file

@ -0,0 +1,6 @@
{
"errors": [],
"warnings": [
"the value \"**********\" is invalid for \"secret\", at least 10 characters are required, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/04_value_secret.yaml\""
]
}

View file

@ -0,0 +1,6 @@
{
"errors": [],
"warnings": [
"cannot set the value \"test\" to the family \"family\", it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/05_value_family.yaml\""
]
}

View file

@ -0,0 +1,6 @@
{
"errors": [],
"warnings": [
"variable or family \"dyn_unknown\" does not exist, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/06_dynamic_unknown.yaml\""
]
}

View file

@ -0,0 +1,9 @@
{
"errors": [],
"warnings": [
"variable \"leadership.follower_disabled\" at index \"0\" is disabled, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/07_leadership_disabled.yaml\"",
"variable \"leadership.follower_disabled\" at index \"1\" is disabled, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/07_leadership_disabled.yaml\"",
"variable \"leadership.follower_disabled\" at index \"2\" is disabled, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/07_leadership_disabled.yaml\"",
"variable \"leadership.follower_disabled_at_index\" at index \"1\" is disabled, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/07_leadership_disabled.yaml\""
]
}

View file

@ -0,0 +1,6 @@
{
"errors": [],
"warnings": [
"variable or family \"leadership.unknwon\" does not exist, it will be ignored when loading from the YAML file \"/home/gnunux/git/stove/rougail-user-data-yaml/tests/errors/yaml/07_leadership_unknown.yaml\""
]
}

View file

@ -0,0 +1,68 @@
%YAML 1.2
---
version: 1.1
variable:
secret:
type: secret
params:
min_len: 10
variable_disabled:
disabled: true
variable_disabled_hidden:
disabled: true
hidden: true
variable_int:
type: number
family:
variable:
family_disabled:
disabled: true
variable1:
variable2:
family_disabled_hidden:
disabled: true
hidden: true
variable1:
variable2:
dyn_{{ identifier }}:
dynamic:
- var1
- var2
variable:
leadership:
type: leadership
leader:
follower:
follower_disabled:
disabled: true
follower_disabled_at_index:
disabled:
jinja: >-
{% if index == 1 %}
true
{% else %}
{% endif %}
params:
index:
type: index
...

View file

@ -0,0 +1,2 @@
---
unknown: 1

View file

@ -0,0 +1,4 @@
---
family_disabled:
variable1: test
variable2: test

View file

@ -0,0 +1,2 @@
---
variable_disabled: test

View file

@ -0,0 +1,2 @@
---
variable_int: test

View file

@ -0,0 +1,3 @@
---
family_disabled_hidden:
variable1: test

View file

@ -0,0 +1,2 @@
---
secret: a

View file

@ -0,0 +1,2 @@
---
family: test

View file

@ -0,0 +1,3 @@
---
dyn_unknown:
variable: test

View file

@ -0,0 +1,14 @@
---
leadership:
- leader: test1
follower: test1
follower_disabled: test1
follower_disabled_at_index: test1
- leader: test2
follower: test2
follower_disabled: test2
follower_disabled_at_index: test2
- leader: test3
follower: test3
follower_disabled: test3
follower_disabled_at_index: test3

View file

@ -0,0 +1,4 @@
---
leadership:
- leader: test
unknwon: test

View file

@ -0,0 +1,5 @@
---
leadership:
- leader: test
follower: test1
- follower: test1

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1,9 @@
{
"errors": [],
"warnings": [
"family \"rougail.leadership\" is hidden, \"rougail.leadership.var1\" (a first variable) will be ignored when loading from the YAML file \"tests/results/00_2default_calculated_params_permissive/file/all.yml\"",
"family \"rougail.leadership\" is hidden, \"rougail.leadership.var2\" (a first variable) at index \"0\" will be ignored when loading from the YAML file \"tests/results/00_2default_calculated_params_permissive/file/all.yml\"",
"index \"1\" is greater than the leadership length \"1\" for option \"rougail.leadership.var2\" (a first variable) in the YAML file \"tests/results/00_2default_calculated_params_permissive/file/all.yml\"",
"index \"2\" is greater than the leadership length \"1\" for option \"rougail.leadership.var2\" (a first variable) in the YAML file \"tests/results/00_2default_calculated_params_permissive/file/all.yml\""
]
}

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1,17 @@
{
"rougail": {
"leadership": [
{
"var1": "string1",
"var2": "string1"
},
{
"var1": "string2"
},
{
"var1": "string3"
}
],
"var2": "string1"
}
}

View file

@ -0,0 +1,17 @@
{
"rougail": {
"leadership": [
{
"var1": "string1",
"var2": "string1"
},
{
"var1": "string2"
},
{
"var1": "string3"
}
],
"var2": "string1"
}
}

View file

@ -0,0 +1,9 @@
{
"rougail.leadership.var1": [
{
"rougail.leadership.var1": "a_value",
"rougail.leadership.var2": "a_value"
}
],
"rougail.var2": "string1"
}

View file

@ -0,0 +1,9 @@
{
"rougail.leadership.var1": [
{
"rougail.leadership.var1": "a_value",
"rougail.leadership.var2": "a_value"
}
],
"rougail.var2": "a_value"
}

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1,6 @@
{
"rougail": {
"var1": "string1",
"var2": "string1"
}
}

View file

@ -0,0 +1,6 @@
{
"rougail": {
"var1": "string1",
"var2": "string1"
}
}

View file

@ -0,0 +1,5 @@
{
"rougail": {
"var1": "string1"
}
}

View file

@ -0,0 +1,4 @@
{
"rougail.var1": "string1",
"rougail.var2": "string1"
}

View file

@ -0,0 +1,4 @@
{
"rougail.var1": "string1",
"rougail.var2": "string1"
}

View file

@ -1,6 +1,6 @@
{
"errors": [],
"warnings": [
"cannot access to option \"rougail.var\" (autosave variable) because has property \"hidden\" loaded from the YAML file \"tests/results/04_1auto_save_and_hidden/file/all.yml\""
"variable \"rougail.var\" (autosave variable) is hidden, it will be ignored when loading from the YAML file \"tests/results/04_1auto_save_and_hidden/file/all.yml\""
]
}

View file

@ -1,6 +1,6 @@
{
"errors": [],
"warnings": [
"cannot access to option \"rougail.var2\" (a second variable) because has property \"disabled\" loaded from the YAML file \"tests/results/04_1default_calculation_hidden/file/mandatories.yml\""
"variable \"rougail.var2\" (a second variable) is disabled, it will be ignored when loading from the YAML file \"tests/results/04_1default_calculation_hidden/file/mandatories.yml\""
]
}

View file

@ -1,6 +1,6 @@
{
"errors": [],
"warnings": [
"cannot access to option \"rougail.var2\" (a second variable) because has property \"disabled\" loaded from the YAML file \"tests/results/04_1default_calculation_hidden_2/file/mandatories.yml\""
"variable \"rougail.var2\" (a second variable) is disabled, it will be ignored when loading from the YAML file \"tests/results/04_1default_calculation_hidden_2/file/mandatories.yml\""
]
}

View file

@ -0,0 +1,7 @@
{
"errors": [],
"warnings": [
"variable \"rougail.var1\" (a first variable) is hidden, it will be ignored when loading from the YAML file \"tests/results/04_1default_calculation_hidden_3/file/all.yml\"",
"variable \"rougail.var2\" (a second variable) is disabled, it will be ignored when loading from the YAML file \"tests/results/04_1default_calculation_hidden_3/file/all.yml\""
]
}

View file

@ -0,0 +1,6 @@
{
"errors": [],
"warnings": [
"variable \"rougail.var2\" (a second variable) is disabled, it will be ignored when loading from the YAML file \"tests/results/04_1default_calculation_hidden_3/file/mandatories.yml\""
]
}

View file

@ -0,0 +1,7 @@
{
"rougail": {
"var1": "string1",
"var2": "string1",
"var3": "string1"
}
}

View file

@ -0,0 +1,7 @@
{
"rougail": {
"var1": "string1",
"var2": "string1",
"var3": "string1"
}
}

View file

@ -0,0 +1,5 @@
{
"rougail": {
"var2": "string1"
}
}

View file

@ -0,0 +1,4 @@
{
"rougail.var1": "value",
"rougail.var3": "string1"
}

View file

@ -0,0 +1,4 @@
{
"rougail.var1": "value",
"rougail.var3": "value"
}

View file

@ -0,0 +1,6 @@
{
"errors": [],
"warnings": [
"variable \"rougail.var1\" (a first variable) is hidden, it will be ignored when loading from the YAML file \"tests/results/04_1default_calculation_hidden_4/file/all.yml\""
]
}

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1,7 @@
{
"rougail": {
"var1": "string1",
"var2": "string1",
"var3": "string1"
}
}

View file

@ -0,0 +1,7 @@
{
"rougail": {
"var1": "string1",
"var2": "string1",
"var3": "string1"
}
}

View file

@ -0,0 +1,5 @@
{
"rougail": {
"var2": "string1"
}
}

View file

@ -0,0 +1,5 @@
{
"rougail.var1": "value",
"rougail.var2": "string1",
"rougail.var3": "string1"
}

View file

@ -0,0 +1,5 @@
{
"rougail.var1": "value",
"rougail.var2": "string1",
"rougail.var3": "value"
}

View file

@ -0,0 +1,6 @@
{
"errors": [],
"warnings": [
"variable \"rougail.var2\" (a second variable) is hidden, it will be ignored when loading from the YAML file \"tests/results/04_1default_calculation_hidden_5/file/all.yml\""
]
}

View file

@ -0,0 +1,6 @@
{
"errors": [],
"warnings": [
"variable \"rougail.var3\" (a third variable) is disabled, it will be ignored when loading from the YAML file \"tests/results/04_1default_calculation_hidden_5/file/mandatories.yml\""
]
}

View file

@ -0,0 +1,7 @@
{
"rougail": {
"var1": "string1",
"var2": "string1",
"var3": "string1"
}
}

View file

@ -0,0 +1,7 @@
{
"rougail": {
"var1": "string1",
"var2": "string1",
"var3": "string1"
}
}

View file

@ -0,0 +1,5 @@
{
"rougail": {
"var3": "string1"
}
}

View file

@ -0,0 +1,5 @@
{
"rougail.var1": "string1",
"rougail.var2": "string1",
"rougail.var3": "string1"
}

View file

@ -0,0 +1,4 @@
{
"rougail.var1": "value",
"rougail.var2": "value"
}

View file

@ -0,0 +1,7 @@
{
"errors": [],
"warnings": [
"variable \"rougail.var2\" (a second variable) is hidden, it will be ignored when loading from the YAML file \"tests/results/04_1default_calculation_hidden_6/file/all.yml\"",
"variable \"rougail.var3\" (a third variable) is disabled, it will be ignored when loading from the YAML file \"tests/results/04_1default_calculation_hidden_6/file/all.yml\""
]
}

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1,7 @@
{
"rougail": {
"var1": "string1",
"var2": "string1",
"var3": "string1"
}
}

View file

@ -0,0 +1,7 @@
{
"rougail": {
"var1": "string1",
"var2": "string1",
"var3": "string1"
}
}

View file

@ -0,0 +1,5 @@
{
"rougail": {
"var3": "string1"
}
}

View file

@ -0,0 +1,4 @@
{
"rougail.var1": "string1",
"rougail.var2": "string1"
}

View file

@ -0,0 +1,5 @@
{
"rougail.var1": "value",
"rougail.var2": "value",
"rougail.var3": "string1"
}

View file

@ -1,6 +1,6 @@
{
"errors": [],
"warnings": [
"cannot access to option \"rougail.var1\" (a first variable) because has property \"hidden\" (unknown is undefined) loaded from the YAML file \"tests/results/04_5disabled_calculation_optional/file/all.yml\""
"variable \"rougail.var1\" (a first variable) is hidden, it will be ignored when loading from the YAML file \"tests/results/04_5disabled_calculation_optional/file/all.yml\""
]
}

View file

@ -1,6 +1,6 @@
{
"errors": [],
"warnings": [
"cannot access to option \"rougail.variable\" (a variable) because has property \"disabled\" loaded from the YAML file \"tests/results/04_5disabled_calculation_variable/file/all.yml\""
"variable \"rougail.variable\" (a variable) is disabled, it will be ignored when loading from the YAML file \"tests/results/04_5disabled_calculation_variable/file/all.yml\""
]
}

View file

@ -1,6 +1,6 @@
{
"errors": [],
"warnings": [
"cannot access to option \"rougail.variable\" (a variable) because has property \"disabled\" loaded from the YAML file \"tests/results/04_5disabled_calculation_variable2/file/all.yml\""
"variable \"rougail.variable\" (a variable) is disabled, it will be ignored when loading from the YAML file \"tests/results/04_5disabled_calculation_variable2/file/all.yml\""
]
}

Some files were not shown because too many files have changed in this diff Show more