Skip to content

Commit

Permalink
Add enum wrapped_comments
Browse files Browse the repository at this point in the history
Signed-off-by: HUG0-D <[email protected]>
  • Loading branch information
HUG0-D committed Nov 27, 2024
1 parent da4ec07 commit 55550f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions cimgen/cimgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,13 @@ def _parse_rdf(input_dic, version): # NOSONAR
for instance in enum_instances:
clarse = _get_rid_of_hash(instance["type"])
if clarse and clarse in classes_map:
if instance.get("comment"):
instance["wrapped_comment"] = wrap_and_clean(
instance["comment"],
width=100,
initial_indent="# ",
subsequent_indent=(" # "),
)
classes_map[clarse].add_enum_instance(instance)
else:
logger.info("Class {} for enum instance {} not found.".format(clarse, instance))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ from enum import Enum

class {{class_name}}(str, Enum):
"""
{{{class_comment}}} # noqa: E501
{{{wrapped_class_comment}}}
"""

{{#enum_instances}}
{{label}} = "{{label}}"{{#comment}} # {{comment}}{{/comment}} # noqa: E501
{{label}} = "{{label}}"{{#comment}}
{{wrapped_comment}}{{/comment}}
{{/enum_instances}}

0 comments on commit 55550f6

Please sign in to comment.