allow 'variable' in dynamic family in 1.1

This commit is contained in:
egarette@silique.fr 2024-07-29 12:04:31 +02:00
parent 085840449c
commit 560deb52b6
2 changed files with 4 additions and 5 deletions

View file

@ -480,7 +480,7 @@ class ParserVariable:
return return
family_obj = {} family_obj = {}
subfamily_obj = {} subfamily_obj = {}
force_to_attrs = list(self.list_attributes(obj)) force_to_attrs = list(self.list_attributes(obj, version))
for key, value in obj.items(): for key, value in obj.items():
if key in force_to_attrs: if key in force_to_attrs:
if key.startswith("_"): if key.startswith("_"):
@ -558,6 +558,7 @@ class ParserVariable:
def list_attributes( def list_attributes(
self, self,
obj: Dict[str, Any], obj: Dict[str, Any],
version: str,
) -> Iterator[str]: ) -> Iterator[str]:
"""List attributes""" """List attributes"""
force_to_variable = [] force_to_variable = []
@ -580,8 +581,7 @@ class ParserVariable:
): ):
# it's a dict, so a new variables! # it's a dict, so a new variables!
continue continue
# FIXME should be remove with 1.0 format if version == '1.0' and key == "variable" and obj.get("type") != "dynamic" and obj.get("_type") != "dynamic":
if key == "variable" and obj.get("type") != "dynamic":
continue continue
if key in self.family_attrs: if key in self.family_attrs:
yield key yield key

View file

@ -35,9 +35,8 @@ except ModuleNotFoundError as err:
# from ast import parse as ast_parse # from ast import parse as ast_parse
from json import dumps from json import dumps
from pathlib import Path
from ruamel.yaml import YAML from ruamel.yaml import YAML
from pathlib import Path
from .config import RougailConfig from .config import RougailConfig
from .error import UpgradeError from .error import UpgradeError