feat: tags for family

This commit is contained in:
egarette@silique.fr 2026-06-20 20:03:50 +02:00
parent 2c1f2e7d9b
commit 24d87c3395
3 changed files with 14 additions and 8 deletions

View file

@ -25,7 +25,7 @@ classifiers = [
]
dependencies = [
"ruamel.yaml ~= 0.19.1",
"ruamel.yaml ~= 0.19.1", # same version as rougail-user-data-yaml
"pydantic ~= 2.13.4",
"rougail-base == 1.2.0rc3",
]

View file

@ -77,6 +77,7 @@ class Annotator(Walk):
"""convert families"""
for family in self.get_families():
self.family_variable_property(family)
self.convert_tag(family)
# collect for force_default_on_freeze
if family.hidden:
if family.hidden is True:
@ -164,13 +165,17 @@ class Annotator(Walk):
self.objectspace.properties.add(path, "notunique", True)
if variable.auto_save:
self.objectspace.properties.add(path, "force_store_value", True)
if variable.tags:
for tag in variable.tags:
self.check_tag(tag, variable.xmlfiles)
self.objectspace.properties.add(variable.path, tag, True)
self.objectspace.informations.add(
variable.path, "tags", tuple(variable.tags)
)
self.convert_tag(variable)
def convert_tag(self, variable):
if not variable.tags:
return
for tag in variable.tags:
self.check_tag(tag, variable.xmlfiles)
self.objectspace.properties.add(variable.path, tag, True)
self.objectspace.informations.add(
variable.path, "tags", tuple(variable.tags)
)
def check_tag(
self,

View file

@ -1063,6 +1063,7 @@ class Family(BaseModel):
# properties
hidden: Union[bool, Calculation] = False
disabled: Union[bool, Calculation] = False
tags: Optional[List[StrictStr]] = None
# others
namespace: Optional[StrictStr]
path: StrictStr