Skip to content

Commit f5b5661

Browse files
committed
more goodness from build-tools
1 parent 0d95be2 commit f5b5661

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

scripts/semconv/templates/semantic_attributes.j2

+4-9
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@
1616

1717
# pylint: disable=too-many-lines
1818

19-
{%- macro print_value(type, value) -%}
20-
{{ "\"" if type == "string"}}{{value}}{{ "\"" if type == "string"}}
21-
{%- endmacro %}
22-
23-
{%- set enum_attributes = filtered_attributes | selectattr("is_enum", "true") | list %}
24-
{%- if enum_attributes | count > 0 %}
19+
{%- set filtered_enum_attributes = enum_attributes | select(filter) | list %}
20+
{%- if filtered_enum_attributes | count > 0 %}
2521

2622
from enum import Enum
2723
{%- endif %}
@@ -46,12 +42,11 @@ Deprecated: {{attribute.deprecated | to_doc_brief}}.
4642
{%- endfor %}
4743
{# Extra line #}
4844
{# Extra line #}
49-
{%- for attribute in enum_attributes %}
45+
{%- for attribute in filtered_enum_attributes %}
5046
{%- set class_name = attribute.fqn | to_camelcase(True) ~ "Values" %}
51-
{%- set type = attribute.attr_type.enum_type %}
5247
class {{class_name}}(Enum):
5348
{%- for member in attribute.attr_type.members %}
54-
{{ member.member_id | to_const_name }} = {{ print_value(type, member.value) }}
49+
{{ member.member_id | to_const_name }} = {{ attribute | print_member_value(member) }}
5550
"""{{member.brief | to_doc_brief}}."""
5651
{# Extra line #}
5752
{%- endfor %}

0 commit comments

Comments
 (0)