{%- macro file_header() -%}
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

{% endmacro -%}

{%- macro str_or_empty(str) -%}
{% if str is none %}{{""}}{% else %}{{str}}{% endif %}
{%- endmacro %}

{%- macro remove_trailing_dots(str) -%}
{%- if str[-1:] == '.' -%}{{ remove_trailing_dots(str[:-1]) }}{%- else -%}{{ str }}{%- endif -%}
{%- endmacro -%}

{%- macro comment_with_prefix(str, prefix) -%}
{{remove_trailing_dots(str | trim(' \n')) | comment_with_prefix(prefix) | replace("\\", "\\\\")}}
{%- endmacro %}

{%- macro import_deprecated(semconv) -%}
    {%- if (semconv | select("deprecated") | list | count > 0) or (ctx.filter == "any" and semconv | select("stable") | list | count > 0) -%}
from typing_extensions import deprecated
    {%- endif -%}
{%- endmacro-%}

{%- macro deprecated_note_or_empty(attribute) -%}
{% if attribute is deprecated %}{{ attribute.deprecated.note }}{% else %}{{""}}{% endif %}
{%- endmacro %}
