Compare commits
No commits in common. "8f5ce6999f7cbbda8d302ca677f89b83685d6777" and "bae0368356b1bb2cbf6b1171c5d64873a322d5b2" have entirely different histories.
8f5ce6999f
...
bae0368356
12 changed files with 10 additions and 80 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -1,13 +1,3 @@
|
||||||
## 0.1.0a21 (2025-11-06)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- add some tests
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- always remove choice type + support warnings
|
|
||||||
|
|
||||||
## 0.1.0a20 (2025-11-03)
|
## 0.1.0a20 (2025-11-03)
|
||||||
|
|
||||||
### Feat
|
### Feat
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rougail.output_formatter"
|
name = "rougail.output_formatter"
|
||||||
version = "0.1.0a21"
|
version = "0.1.0a20"
|
||||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
description = "Rougail output formatter"
|
description = "Rougail output formatter"
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,8 @@ class RougailOutputFormatter:
|
||||||
|
|
||||||
def get_attributes(self, obj, excludes=[]) -> dict:
|
def get_attributes(self, obj, excludes=[]) -> dict:
|
||||||
type_name = obj.__name__
|
type_name = obj.__name__
|
||||||
|
if type_name == "Variable" and excludes == []:
|
||||||
|
raise Exception("pff")
|
||||||
if type_name not in self.attributes:
|
if type_name not in self.attributes:
|
||||||
self.attributes[type_name] = {
|
self.attributes[type_name] = {
|
||||||
str(attr): o.default
|
str(attr): o.default
|
||||||
|
|
@ -390,6 +392,8 @@ class RougailOutputFormatter:
|
||||||
and isinstance(variable["default"], list)
|
and isinstance(variable["default"], list)
|
||||||
):
|
):
|
||||||
del variable["multi"]
|
del variable["multi"]
|
||||||
|
elif variable.get("type") == "choice" and "choices" in variable:
|
||||||
|
del variable["type"]
|
||||||
elif variable.get("type") == "string":
|
elif variable.get("type") == "string":
|
||||||
# default type is string
|
# default type is string
|
||||||
del variable["type"]
|
del variable["type"]
|
||||||
|
|
@ -400,8 +404,6 @@ class RougailOutputFormatter:
|
||||||
# if boolean, the default value is True
|
# if boolean, the default value is True
|
||||||
del variable["type"]
|
del variable["type"]
|
||||||
variable["default"] = True
|
variable["default"] = True
|
||||||
if variable.get("type") == "choice" and "choices" in variable:
|
|
||||||
del variable["type"]
|
|
||||||
if (
|
if (
|
||||||
"default" not in variable
|
"default" not in variable
|
||||||
and variable.get("multi") is True
|
and variable.get("multi") is True
|
||||||
|
|
@ -526,8 +528,6 @@ class RougailOutputFormatter:
|
||||||
jinja["description"] = LiteralScalarString(value.description.strip())
|
jinja["description"] = LiteralScalarString(value.description.strip())
|
||||||
else:
|
else:
|
||||||
jinja["description"] = value.description.strip()
|
jinja["description"] = value.description.strip()
|
||||||
if value.warnings:
|
|
||||||
jinja["warnings"] = True
|
|
||||||
if value.params:
|
if value.params:
|
||||||
jinja["params"] = self.object_to_yaml(
|
jinja["params"] = self.object_to_yaml(
|
||||||
"params", type_, value.params, multi, object_path
|
"params", type_, value.params, multi, object_path
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
__version__ = "0.1.0a21"
|
__version__ = "0.1.0a20"
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ version: 1.1
|
||||||
|
|
||||||
var:
|
var:
|
||||||
description: A choice
|
description: A choice
|
||||||
|
type: choice
|
||||||
choices:
|
choices:
|
||||||
- quote'
|
- quote'
|
||||||
- quote"
|
- quote"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ source_variable_2: val2 # the second source variable
|
||||||
|
|
||||||
my_variable:
|
my_variable:
|
||||||
description: a variable
|
description: a variable
|
||||||
|
type: choice
|
||||||
choices:
|
choices:
|
||||||
- variable: _.source_variable_1
|
- variable: _.source_variable_1
|
||||||
- variable: _.source_variable_2
|
- variable: _.source_variable_2
|
||||||
|
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
int:
|
|
||||||
description: An integer
|
|
||||||
validators:
|
|
||||||
- jinja: |-
|
|
||||||
{% if _.int > 100 %}
|
|
||||||
value is too high
|
|
||||||
{% endif %}
|
|
||||||
description: the max value is 100
|
|
||||||
warnings: true
|
|
||||||
default: 1000
|
|
||||||
...
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
int:
|
|
||||||
description: An integer
|
|
||||||
params:
|
|
||||||
min_integer: 10
|
|
||||||
max_integer: 100
|
|
||||||
warnings: true
|
|
||||||
default: 1000
|
|
||||||
...
|
|
||||||
|
|
@ -4,6 +4,7 @@ version: 1.1
|
||||||
|
|
||||||
var:
|
var:
|
||||||
description: A choice
|
description: A choice
|
||||||
|
type: choice
|
||||||
choices:
|
choices:
|
||||||
- a
|
- a
|
||||||
- b
|
- b
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
dyn{{ identifier }}:
|
|
||||||
description: A dynamic famify for {{ identifier }}
|
|
||||||
dynamic:
|
|
||||||
- val1
|
|
||||||
- val2
|
|
||||||
|
|
||||||
var1: # A dynamic variable
|
|
||||||
|
|
||||||
var2:
|
|
||||||
description: A new variable
|
|
||||||
disabled:
|
|
||||||
variable: _.var1
|
|
||||||
when: val1
|
|
||||||
...
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
version: 1.1
|
|
||||||
|
|
||||||
dyn{{ identifier }}:
|
|
||||||
description: A dynamic famify for {{ identifier }}
|
|
||||||
dynamic:
|
|
||||||
- val1
|
|
||||||
- val2
|
|
||||||
|
|
||||||
var1: # A dynamic variable
|
|
||||||
|
|
||||||
var2:
|
|
||||||
description: A new variable
|
|
||||||
disabled:
|
|
||||||
variable: _.dynval1.var1
|
|
||||||
when: val1
|
|
||||||
...
|
|
||||||
|
|
@ -15,7 +15,7 @@ excludes = [
|
||||||
]
|
]
|
||||||
|
|
||||||
test_ok = get_structures_list(excludes)
|
test_ok = get_structures_list(excludes)
|
||||||
# test_ok = [Path('../rougail-tests/structures/04_5validators_warnings')]
|
# test_ok = [Path('../rougail-tests/structures/60_6family_dynamic_sub_dynamic_1_0_2')]
|
||||||
|
|
||||||
|
|
||||||
def idfn(fixture_value):
|
def idfn(fixture_value):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue