fix: load file with order

This commit is contained in:
egarette@silique.fr 2025-05-11 08:07:12 +02:00
parent 7dfb0465e5
commit 26ae0b4e76
174 changed files with 1035 additions and 180 deletions

View file

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-04-29 23:02+0200\n" "POT-Creation-Date: 2025-05-03 22:46+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View file

@ -110,7 +110,7 @@ class RougailUserDataYaml:
self.parse(values, path + ".", value, filename) self.parse(values, path + ".", value, filename)
elif isinstance(value, list) and value and isinstance(value[0], dict): elif isinstance(value, list) and value and isinstance(value[0], dict):
# it's a leadership # it's a leadership
keys = set() keys = []
for val in value: for val in value:
if not isinstance(val, dict): if not isinstance(val, dict):
self.errors.append( self.errors.append(
@ -119,7 +119,9 @@ class RougailUserDataYaml:
) )
) )
break break
keys |= set(val) for v in val:
if v not in keys:
keys.append(v)
else: else:
for val in value: for val in value:
for key in keys: for key in keys:

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": [], "errors": [],
"warnings": [ "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": [], "errors": [],
"warnings": [ "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": [], "errors": [],
"warnings": [ "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": [], "errors": [],
"warnings": [ "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": [], "errors": [],
"warnings": [ "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": [], "errors": [],
"warnings": [ "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\""
] ]
} }

View file

@ -1,6 +1,6 @@
{ {
"errors": [], "errors": [],
"warnings": [ "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/mandatories.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/mandatories.yml\""
] ]
} }

View file

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

View file

@ -1,6 +1,6 @@
{ {
"errors": [], "errors": [],
"warnings": [ "warnings": [
"cannot access to option \"rougail.variable\" (a variable) because has property \"disabled\" loaded from the YAML file \"tests/results/04_5disabled_calculation_variable4/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_variable4/file/all.yml\""
] ]
} }

View file

@ -1,6 +1,6 @@
{ {
"errors": [], "errors": [],
"warnings": [ "warnings": [
"cannot access to option \"rougail.variable\" (a variable) because has property \"disabled\" loaded from the YAML file \"tests/results/04_5disabled_calculation_variable_multi/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_multi/file/all.yml\""
] ]
} }

View file

@ -1,14 +0,0 @@
{
"rougail": {
"condition": [
"string1",
"string2",
"string3"
],
"variable": [
"string1",
"string2",
"string3"
]
}
}

View file

@ -1,14 +0,0 @@
{
"rougail": {
"condition": [
"string1",
"string2",
"string3"
],
"variable": [
"string1",
"string2",
"string3"
]
}
}

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