fix: finish enums migration
confirm project works as expected comparing before-refactor one.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
{%- for benum in payload.iter_enums() %}
|
||||
{%- if benum.get_enum_comment() is not none %}
|
||||
{{ benum.get_enum_comment() | block_comment('/// ') }}
|
||||
{%- endif %}
|
||||
{% if benum.get_use_flags() %}[Flags]{%- endif %}
|
||||
{%- endif %} {%- if benum.get_use_flags() %}
|
||||
[Flags]{%- endif %}
|
||||
public enum {{ benum.get_enum_name() }} : {% if benum.get_can_unsigned() -%} uint {%- else -%} int {%- endif %} {
|
||||
{%- for entry in benum.iter_entries() %}
|
||||
{{ entry.get_entry_name() }} {%- if entry.get_entry_value() is not none %} = {{ entry.get_entry_value() }} {%- endif %}, {%- if entry.get_entry_comment() is not none %} /// {{ entry.get_entry_comment() | line_comment }} {%- endif %}
|
||||
|
||||
@@ -10,7 +10,7 @@ class EnumDocstring():
|
||||
{% for benum in payload.iter_enums() %}
|
||||
DOCSTRING_{{ benum.get_enum_name() }}: dict[{{ benum.get_enum_name() }}, EnumDocstring] = {
|
||||
{%- for entry in benum.iter_entries() %}
|
||||
{{ benum.get_enum_name() }}.{{ entry.get_entry_name() }}: EnumDocstring("{{ utils.extract_human_readable_entry_name(entry.get_entry_name()) }}", "{{ entry.get_entry_comment() | some_or_blank | escape_string }}"),
|
||||
{{ benum.get_enum_name() }}.{{ entry.get_entry_name() }}: EnumDocstring("{{ utils.underline_to_camel(entry.get_entry_name()) }}", "{{ entry.get_entry_comment() | some_or_blank | escape_string }}"),
|
||||
{%- endfor %}
|
||||
}
|
||||
{%- endfor %}
|
||||
|
||||
@@ -3,12 +3,12 @@ import enum
|
||||
{% for benum in payload.iter_enums() %}
|
||||
class {{ benum.get_enum_name() }}(enum.IntEnum):
|
||||
{%- if benum.get_enum_comment() is not none %}
|
||||
"""
|
||||
{{ benum.get_enum_comment() | block_comment('') }}
|
||||
"""
|
||||
"""
|
||||
{{ benum.get_enum_comment() | block_comment(' ') }}
|
||||
"""
|
||||
{%- endif %}
|
||||
{%- for entry in benum.iter_entries() %}
|
||||
{{ entry.get_entry_name() }} = {% if entry.get_entry_value() is none -%} auto() {%- else -%} {{ utils.convert_to_python_number(entry.get_entry_value()) }} {%- endif %} {%- if entry.get_entry_comment() is not none %}
|
||||
{{ entry.get_entry_name() }} = {% if entry.get_entry_value() is none -%} auto() {%- else -%} {{ utils.to_py_num_literal(entry.get_entry_value()) }} {%- endif %} {%- if entry.get_entry_comment() is not none %}
|
||||
"""{{ entry.get_entry_comment() | line_comment }}""" {%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
|
||||
Reference in New Issue
Block a user