From 1bf62848d02280938f0902de0a2cd460cd222e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=80=D0=B5=D0=B4=D1=80=D0=B0=D0=B3=20=D0=9D=D0=B8?= =?UTF-8?q?=D0=BA=D0=BE=D0=BB=D0=B8=D1=9B?= Date: Tue, 16 Apr 2024 22:47:04 +0200 Subject: [PATCH] fix lint --- generate.py | 2 +- lsp_types.py | 121 +++++++++++++++++---------------- lsp_types_sublime_text_33.py | 121 +++++++++++++++++---------------- utils/generate_enumerations.py | 20 +++--- 4 files changed, 135 insertions(+), 129 deletions(-) diff --git a/generate.py b/generate.py index f90f9f6..b1069af 100755 --- a/generate.py +++ b/generate.py @@ -49,7 +49,7 @@ def generate(preferred_structure_kind: StructureKind, output: str) -> None: ]) content += '\n\n\n' - content += '\n\n'.join(generate_enumerations(lsp_json['enumerations'], ENUM_OVERRIDES)) + content += '\n\n\n'.join(generate_enumerations(lsp_json['enumerations'], ENUM_OVERRIDES)) content += '\n\n' content += '\n'.join(generate_type_aliases(lsp_json['typeAliases'], preferred_structure_kind)) content += '\n\n\n' diff --git a/lsp_types.py b/lsp_types.py index 08bb949..3056fd8 100644 --- a/lsp_types.py +++ b/lsp_types.py @@ -12,6 +12,14 @@ RegExp = str +SemanticTokenTypesLiteral = Literal['namespace', 'type', 'class', 'enum', 'interface', 'struct', 'typeParameter', 'parameter', 'variable', 'property', 'enumMember', 'event', 'function', 'method', 'macro', 'keyword', 'modifier', 'comment', 'string', 'number', 'regexp', 'operator', 'decorator'] +""" A set of predefined token types. This set is not fixed +an clients can specify additional token types via the +corresponding client capabilities. + +@since 3.16.0 """ + + class SemanticTokenTypes(StrEnum): """ A set of predefined token types. This set is not fixed an clients can specify additional token types via the @@ -46,8 +54,8 @@ class SemanticTokenTypes(StrEnum): """ @since 3.17.0 """ -SemanticTokenTypesLiteral = Literal['namespace', 'type', 'class', 'enum', 'interface', 'struct', 'typeParameter', 'parameter', 'variable', 'property', 'enumMember', 'event', 'function', 'method', 'macro', 'keyword', 'modifier', 'comment', 'string', 'number', 'regexp', 'operator', 'decorator'] -""" A set of predefined token types. This set is not fixed +SemanticTokenModifiersLiteral = Literal['declaration', 'definition', 'readonly', 'static', 'deprecated', 'abstract', 'async', 'modification', 'documentation', 'defaultLibrary'] +""" A set of predefined token modifiers. This set is not fixed an clients can specify additional token types via the corresponding client capabilities. @@ -72,12 +80,10 @@ class SemanticTokenModifiers(StrEnum): DefaultLibrary = 'defaultLibrary' -SemanticTokenModifiersLiteral = Literal['declaration', 'definition', 'readonly', 'static', 'deprecated', 'abstract', 'async', 'modification', 'documentation', 'defaultLibrary'] -""" A set of predefined token modifiers. This set is not fixed -an clients can specify additional token types via the -corresponding client capabilities. +DocumentDiagnosticReportKindLiteral = Literal['full', 'unchanged'] +""" The document diagnostic report kinds. -@since 3.16.0 """ +@since 3.17.0 """ class DocumentDiagnosticReportKind(StrEnum): @@ -92,12 +98,6 @@ class DocumentDiagnosticReportKind(StrEnum): returned report is still accurate. """ -DocumentDiagnosticReportKindLiteral = Literal['full', 'unchanged'] -""" The document diagnostic report kinds. - -@since 3.17.0 """ - - class ErrorCodes(IntEnum): """ Predefined error codes. """ ParseError = -32700 @@ -139,6 +139,10 @@ class LSPErrorCodes(IntEnum): the cancel. """ +FoldingRangeKindLiteral = Literal['comment', 'imports', 'region'] +""" A set of predefined range kinds. """ + + class FoldingRangeKind(StrEnum): """ A set of predefined range kinds. """ Comment = 'comment' @@ -149,10 +153,6 @@ class FoldingRangeKind(StrEnum): """ Folding range for a region (e.g. `#region`) """ -FoldingRangeKindLiteral = Literal['comment', 'imports', 'region'] -""" A set of predefined range kinds. """ - - class SymbolKind(IntEnum): """ A symbol kind. """ File = 1 @@ -191,6 +191,12 @@ class SymbolTag(IntEnum): """ Render a symbol as obsolete, usually using a strike-out. """ +UniquenessLevelLiteral = Literal['document', 'project', 'group', 'scheme', 'global'] +""" Moniker uniqueness level to define scope of the moniker. + +@since 3.16.0 """ + + class UniquenessLevel(StrEnum): """ Moniker uniqueness level to define scope of the moniker. @@ -207,8 +213,8 @@ class UniquenessLevel(StrEnum): """ The moniker is globally unique """ -UniquenessLevelLiteral = Literal['document', 'project', 'group', 'scheme', 'global'] -""" Moniker uniqueness level to define scope of the moniker. +MonikerKindLiteral = Literal['import', 'export', 'local'] +""" The moniker kind. @since 3.16.0 """ @@ -226,12 +232,6 @@ class MonikerKind(StrEnum): variable of a function, a class not visible outside the project, ...) """ -MonikerKindLiteral = Literal['import', 'export', 'local'] -""" The moniker kind. - -@since 3.16.0 """ - - class InlayHintKind(IntEnum): """ Inlay hint kinds. @@ -369,6 +369,10 @@ class DocumentHighlightKind(IntEnum): """ Write-access of a symbol, like writing to a variable. """ +CodeActionKindLiteral = Literal['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.move', 'refactor.rewrite', 'source', 'source.organizeImports', 'source.fixAll', 'notebook'] +""" A set of predefined code action kinds """ + + class CodeActionKind(StrEnum): """ A set of predefined code action kinds """ Empty = '' @@ -439,8 +443,7 @@ class CodeActionKind(StrEnum): @since 3.18.0 """ -CodeActionKindLiteral = Literal['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.move', 'refactor.rewrite', 'source', 'source.organizeImports', 'source.fixAll', 'notebook'] -""" A set of predefined code action kinds """ +TraceValueLiteral = Literal['off', 'messages', 'verbose'] class TraceValue(Enum): @@ -452,7 +455,13 @@ class TraceValue(Enum): """ Verbose message tracing. """ -TraceValueLiteral = Literal['off', 'messages', 'verbose'] +MarkupKindLiteral = Literal['plaintext', 'markdown'] +""" Describes the content type that a client supports in various +result literals like `Hover`, `ParameterInfo` or `CompletionItem`. + +Please note that `MarkupKinds` must not start with a `$`. This kinds +are reserved for internal usage. """ + class MarkupKind(StrEnum): """ Describes the content type that a client supports in various @@ -466,12 +475,10 @@ class MarkupKind(StrEnum): """ Markdown is supported as a content format """ -MarkupKindLiteral = Literal['plaintext', 'markdown'] -""" Describes the content type that a client supports in various -result literals like `Hover`, `ParameterInfo` or `CompletionItem`. - -Please note that `MarkupKinds` must not start with a `$`. This kinds -are reserved for internal usage. """ +LanguageKindLiteral = Literal['abap', 'bat', 'bibtex', 'clojure', 'coffeescript', 'c', 'cpp', 'csharp', 'css', 'd', 'pascal', 'diff', 'dart', 'dockerfile', 'elixir', 'erlang', 'fsharp', 'git-commit', 'rebase', 'go', 'groovy', 'handlebars', 'haskell', 'html', 'ini', 'java', 'javascript', 'javascriptreact', 'json', 'latex', 'less', 'lua', 'makefile', 'markdown', 'objective-c', 'objective-cpp', 'pascal', 'perl', 'perl6', 'php', 'powershell', 'jade', 'python', 'r', 'razor', 'ruby', 'rust', 'scss', 'sass', 'scala', 'shaderlab', 'shellscript', 'sql', 'swift', 'typescript', 'typescriptreact', 'tex', 'vb', 'xml', 'xsl', 'yaml'] +""" Predefined Language kinds +@since 3.18.0 +@proposed """ class LanguageKind(StrEnum): @@ -547,12 +554,6 @@ class LanguageKind(StrEnum): YAML = 'yaml' -LanguageKindLiteral = Literal['abap', 'bat', 'bibtex', 'clojure', 'coffeescript', 'c', 'cpp', 'csharp', 'css', 'd', 'pascal', 'diff', 'dart', 'dockerfile', 'elixir', 'erlang', 'fsharp', 'git-commit', 'rebase', 'go', 'groovy', 'handlebars', 'haskell', 'html', 'ini', 'java', 'javascript', 'javascriptreact', 'json', 'latex', 'less', 'lua', 'makefile', 'markdown', 'objective-c', 'objective-cpp', 'pascal', 'perl', 'perl6', 'php', 'powershell', 'jade', 'python', 'r', 'razor', 'ruby', 'rust', 'scss', 'sass', 'scala', 'shaderlab', 'shellscript', 'sql', 'swift', 'typescript', 'typescriptreact', 'tex', 'vb', 'xml', 'xsl', 'yaml'] -""" Predefined Language kinds -@since 3.18.0 -@proposed """ - - class InlineCompletionTriggerKind(IntEnum): """ Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered. @@ -564,6 +565,12 @@ class InlineCompletionTriggerKind(IntEnum): """ Completion was triggered automatically while editing. """ +PositionEncodingKindLiteral = Literal['utf-8', 'utf-16', 'utf-32'] +""" A set of predefined position encoding kinds. + +@since 3.17.0 """ + + class PositionEncodingKind(StrEnum): """ A set of predefined position encoding kinds. @@ -583,12 +590,6 @@ class PositionEncodingKind(StrEnum): encoding-agnostic representation of character offsets. """ -PositionEncodingKindLiteral = Literal['utf-8', 'utf-16', 'utf-32'] -""" A set of predefined position encoding kinds. - -@since 3.17.0 """ - - class FileChangeType(IntEnum): """ The file event type """ Created = 1 @@ -672,6 +673,13 @@ class CodeActionTriggerKind(IntEnum): also be triggered when file content changes. """ +FileOperationPatternKindLiteral = Literal['file', 'folder'] +""" A pattern kind describing if a glob pattern matches a file a folder or +both. + +@since 3.16.0 """ + + class FileOperationPatternKind(StrEnum): """ A pattern kind describing if a glob pattern matches a file a folder or both. @@ -683,13 +691,6 @@ class FileOperationPatternKind(StrEnum): """ The pattern matches a folder only. """ -FileOperationPatternKindLiteral = Literal['file', 'folder'] -""" A pattern kind describing if a glob pattern matches a file a folder or -both. - -@since 3.16.0 """ - - class NotebookCellKind(IntEnum): """ A notebook cell kind. @@ -700,6 +701,9 @@ class NotebookCellKind(IntEnum): """ A code-cell is source code. """ +ResourceOperationKindLiteral = Literal['create', 'rename', 'delete'] + + class ResourceOperationKind(StrEnum): Create = 'create' """ Supports creating new files and folders. """ @@ -709,7 +713,8 @@ class ResourceOperationKind(StrEnum): """ Supports deleting existing files and folders. """ -ResourceOperationKindLiteral = Literal['create', 'rename', 'delete'] +FailureHandlingKindLiteral = Literal['abort', 'transactional', 'textOnlyTransactional', 'undo'] + class FailureHandlingKind(StrEnum): Abort = 'abort' @@ -727,19 +732,17 @@ class FailureHandlingKind(StrEnum): guarantee that this is succeeding. """ -FailureHandlingKindLiteral = Literal['abort', 'transactional', 'textOnlyTransactional', 'undo'] - class PrepareSupportDefaultBehavior(IntEnum): Identifier = 1 """ The client's default behavior is to select the identifier according the to language's syntax rule. """ -class TokenFormat(StrEnum): - Relative = 'relative' +TokenFormatLiteral = Literal['relative'] -TokenFormatLiteral = Literal['relative'] +class TokenFormat(StrEnum): + Relative = 'relative' Definition = Union['Location', List['Location']] diff --git a/lsp_types_sublime_text_33.py b/lsp_types_sublime_text_33.py index ddb488c..1b50e83 100644 --- a/lsp_types_sublime_text_33.py +++ b/lsp_types_sublime_text_33.py @@ -12,6 +12,14 @@ RegExp = str +SemanticTokenTypesLiteral = Literal['namespace', 'type', 'class', 'enum', 'interface', 'struct', 'typeParameter', 'parameter', 'variable', 'property', 'enumMember', 'event', 'function', 'method', 'macro', 'keyword', 'modifier', 'comment', 'string', 'number', 'regexp', 'operator', 'decorator'] +""" A set of predefined token types. This set is not fixed +an clients can specify additional token types via the +corresponding client capabilities. + +@since 3.16.0 """ + + class SemanticTokenTypes(StrEnum): """ A set of predefined token types. This set is not fixed an clients can specify additional token types via the @@ -46,8 +54,8 @@ class SemanticTokenTypes(StrEnum): """ @since 3.17.0 """ -SemanticTokenTypesLiteral = Literal['namespace', 'type', 'class', 'enum', 'interface', 'struct', 'typeParameter', 'parameter', 'variable', 'property', 'enumMember', 'event', 'function', 'method', 'macro', 'keyword', 'modifier', 'comment', 'string', 'number', 'regexp', 'operator', 'decorator'] -""" A set of predefined token types. This set is not fixed +SemanticTokenModifiersLiteral = Literal['declaration', 'definition', 'readonly', 'static', 'deprecated', 'abstract', 'async', 'modification', 'documentation', 'defaultLibrary'] +""" A set of predefined token modifiers. This set is not fixed an clients can specify additional token types via the corresponding client capabilities. @@ -72,12 +80,10 @@ class SemanticTokenModifiers(StrEnum): DefaultLibrary = 'defaultLibrary' -SemanticTokenModifiersLiteral = Literal['declaration', 'definition', 'readonly', 'static', 'deprecated', 'abstract', 'async', 'modification', 'documentation', 'defaultLibrary'] -""" A set of predefined token modifiers. This set is not fixed -an clients can specify additional token types via the -corresponding client capabilities. +DocumentDiagnosticReportKindLiteral = Literal['full', 'unchanged'] +""" The document diagnostic report kinds. -@since 3.16.0 """ +@since 3.17.0 """ class DocumentDiagnosticReportKind(StrEnum): @@ -92,12 +98,6 @@ class DocumentDiagnosticReportKind(StrEnum): returned report is still accurate. """ -DocumentDiagnosticReportKindLiteral = Literal['full', 'unchanged'] -""" The document diagnostic report kinds. - -@since 3.17.0 """ - - class ErrorCodes(IntEnum): """ Predefined error codes. """ ParseError = -32700 @@ -139,6 +139,10 @@ class LSPErrorCodes(IntEnum): the cancel. """ +FoldingRangeKindLiteral = Literal['comment', 'imports', 'region'] +""" A set of predefined range kinds. """ + + class FoldingRangeKind(StrEnum): """ A set of predefined range kinds. """ Comment = 'comment' @@ -149,10 +153,6 @@ class FoldingRangeKind(StrEnum): """ Folding range for a region (e.g. `#region`) """ -FoldingRangeKindLiteral = Literal['comment', 'imports', 'region'] -""" A set of predefined range kinds. """ - - class SymbolKind(IntEnum): """ A symbol kind. """ File = 1 @@ -191,6 +191,12 @@ class SymbolTag(IntEnum): """ Render a symbol as obsolete, usually using a strike-out. """ +UniquenessLevelLiteral = Literal['document', 'project', 'group', 'scheme', 'global'] +""" Moniker uniqueness level to define scope of the moniker. + +@since 3.16.0 """ + + class UniquenessLevel(StrEnum): """ Moniker uniqueness level to define scope of the moniker. @@ -207,8 +213,8 @@ class UniquenessLevel(StrEnum): """ The moniker is globally unique """ -UniquenessLevelLiteral = Literal['document', 'project', 'group', 'scheme', 'global'] -""" Moniker uniqueness level to define scope of the moniker. +MonikerKindLiteral = Literal['import', 'export', 'local'] +""" The moniker kind. @since 3.16.0 """ @@ -226,12 +232,6 @@ class MonikerKind(StrEnum): variable of a function, a class not visible outside the project, ...) """ -MonikerKindLiteral = Literal['import', 'export', 'local'] -""" The moniker kind. - -@since 3.16.0 """ - - class InlayHintKind(IntEnum): """ Inlay hint kinds. @@ -369,6 +369,10 @@ class DocumentHighlightKind(IntEnum): """ Write-access of a symbol, like writing to a variable. """ +CodeActionKindLiteral = Literal['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.move', 'refactor.rewrite', 'source', 'source.organizeImports', 'source.fixAll', 'notebook'] +""" A set of predefined code action kinds """ + + class CodeActionKind(StrEnum): """ A set of predefined code action kinds """ Empty = '' @@ -439,8 +443,7 @@ class CodeActionKind(StrEnum): @since 3.18.0 """ -CodeActionKindLiteral = Literal['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.move', 'refactor.rewrite', 'source', 'source.organizeImports', 'source.fixAll', 'notebook'] -""" A set of predefined code action kinds """ +TraceValueLiteral = Literal['off', 'messages', 'verbose'] class TraceValue(Enum): @@ -452,7 +455,13 @@ class TraceValue(Enum): """ Verbose message tracing. """ -TraceValueLiteral = Literal['off', 'messages', 'verbose'] +MarkupKindLiteral = Literal['plaintext', 'markdown'] +""" Describes the content type that a client supports in various +result literals like `Hover`, `ParameterInfo` or `CompletionItem`. + +Please note that `MarkupKinds` must not start with a `$`. This kinds +are reserved for internal usage. """ + class MarkupKind(StrEnum): """ Describes the content type that a client supports in various @@ -466,12 +475,10 @@ class MarkupKind(StrEnum): """ Markdown is supported as a content format """ -MarkupKindLiteral = Literal['plaintext', 'markdown'] -""" Describes the content type that a client supports in various -result literals like `Hover`, `ParameterInfo` or `CompletionItem`. - -Please note that `MarkupKinds` must not start with a `$`. This kinds -are reserved for internal usage. """ +LanguageKindLiteral = Literal['abap', 'bat', 'bibtex', 'clojure', 'coffeescript', 'c', 'cpp', 'csharp', 'css', 'd', 'pascal', 'diff', 'dart', 'dockerfile', 'elixir', 'erlang', 'fsharp', 'git-commit', 'rebase', 'go', 'groovy', 'handlebars', 'haskell', 'html', 'ini', 'java', 'javascript', 'javascriptreact', 'json', 'latex', 'less', 'lua', 'makefile', 'markdown', 'objective-c', 'objective-cpp', 'pascal', 'perl', 'perl6', 'php', 'powershell', 'jade', 'python', 'r', 'razor', 'ruby', 'rust', 'scss', 'sass', 'scala', 'shaderlab', 'shellscript', 'sql', 'swift', 'typescript', 'typescriptreact', 'tex', 'vb', 'xml', 'xsl', 'yaml'] +""" Predefined Language kinds +@since 3.18.0 +@proposed """ class LanguageKind(StrEnum): @@ -547,12 +554,6 @@ class LanguageKind(StrEnum): YAML = 'yaml' -LanguageKindLiteral = Literal['abap', 'bat', 'bibtex', 'clojure', 'coffeescript', 'c', 'cpp', 'csharp', 'css', 'd', 'pascal', 'diff', 'dart', 'dockerfile', 'elixir', 'erlang', 'fsharp', 'git-commit', 'rebase', 'go', 'groovy', 'handlebars', 'haskell', 'html', 'ini', 'java', 'javascript', 'javascriptreact', 'json', 'latex', 'less', 'lua', 'makefile', 'markdown', 'objective-c', 'objective-cpp', 'pascal', 'perl', 'perl6', 'php', 'powershell', 'jade', 'python', 'r', 'razor', 'ruby', 'rust', 'scss', 'sass', 'scala', 'shaderlab', 'shellscript', 'sql', 'swift', 'typescript', 'typescriptreact', 'tex', 'vb', 'xml', 'xsl', 'yaml'] -""" Predefined Language kinds -@since 3.18.0 -@proposed """ - - class InlineCompletionTriggerKind(IntEnum): """ Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered. @@ -564,6 +565,12 @@ class InlineCompletionTriggerKind(IntEnum): """ Completion was triggered automatically while editing. """ +PositionEncodingKindLiteral = Literal['utf-8', 'utf-16', 'utf-32'] +""" A set of predefined position encoding kinds. + +@since 3.17.0 """ + + class PositionEncodingKind(StrEnum): """ A set of predefined position encoding kinds. @@ -583,12 +590,6 @@ class PositionEncodingKind(StrEnum): encoding-agnostic representation of character offsets. """ -PositionEncodingKindLiteral = Literal['utf-8', 'utf-16', 'utf-32'] -""" A set of predefined position encoding kinds. - -@since 3.17.0 """ - - class FileChangeType(IntEnum): """ The file event type """ Created = 1 @@ -672,6 +673,13 @@ class CodeActionTriggerKind(IntEnum): also be triggered when file content changes. """ +FileOperationPatternKindLiteral = Literal['file', 'folder'] +""" A pattern kind describing if a glob pattern matches a file a folder or +both. + +@since 3.16.0 """ + + class FileOperationPatternKind(StrEnum): """ A pattern kind describing if a glob pattern matches a file a folder or both. @@ -683,13 +691,6 @@ class FileOperationPatternKind(StrEnum): """ The pattern matches a folder only. """ -FileOperationPatternKindLiteral = Literal['file', 'folder'] -""" A pattern kind describing if a glob pattern matches a file a folder or -both. - -@since 3.16.0 """ - - class NotebookCellKind(IntEnum): """ A notebook cell kind. @@ -700,6 +701,9 @@ class NotebookCellKind(IntEnum): """ A code-cell is source code. """ +ResourceOperationKindLiteral = Literal['create', 'rename', 'delete'] + + class ResourceOperationKind(StrEnum): Create = 'create' """ Supports creating new files and folders. """ @@ -709,7 +713,8 @@ class ResourceOperationKind(StrEnum): """ Supports deleting existing files and folders. """ -ResourceOperationKindLiteral = Literal['create', 'rename', 'delete'] +FailureHandlingKindLiteral = Literal['abort', 'transactional', 'textOnlyTransactional', 'undo'] + class FailureHandlingKind(StrEnum): Abort = 'abort' @@ -727,19 +732,17 @@ class FailureHandlingKind(StrEnum): guarantee that this is succeeding. """ -FailureHandlingKindLiteral = Literal['abort', 'transactional', 'textOnlyTransactional', 'undo'] - class PrepareSupportDefaultBehavior(IntEnum): Identifier = 1 """ The client's default behavior is to select the identifier according the to language's syntax rule. """ -class TokenFormat(StrEnum): - Relative = 'relative' +TokenFormatLiteral = Literal['relative'] -TokenFormatLiteral = Literal['relative'] +class TokenFormat(StrEnum): + Relative = 'relative' Definition = Union['Location', List['Location']] diff --git a/utils/generate_enumerations.py b/utils/generate_enumerations.py index a6d153a..663e5c3 100644 --- a/utils/generate_enumerations.py +++ b/utils/generate_enumerations.py @@ -40,8 +40,17 @@ def generate_enumerations(enumerations: List[Enumeration], overrides: Dict[str, def toString(enumeration: Enumeration) -> str: result = '' symbol_name = enumeration['name'] - documentation = format_comment(enumeration.get('documentation'), indentation) kind = EnumKind.String if enumeration['type']['name'] == 'string' else EnumKind.Number + + # add Literal types only for strings + if kind == EnumKind.String: + litearal_values = format_enumeration_literal_values(enumeration['values']) + documentation = format_comment(enumeration.get('documentation'), '') + result += f"{symbol_name}Literal = Literal[{litearal_values}]\n" + if documentation: + result += f"{documentation}\n" + result += '\n\n' + documentation = format_comment(enumeration.get('documentation'), indentation) enum_class_override = overrides.get(symbol_name) enum_class = enum_class_override or ('Enum' if kind == EnumKind.String else 'IntEnum') values = format_enumeration_values(enumeration['values'], kind) @@ -49,15 +58,6 @@ def toString(enumeration: Enumeration) -> str: if documentation: result += f"{documentation}\n" result += f'{indentation}' + values - result += '\n' - - # add Literal types only for strings - if kind == EnumKind.String: - litearal_values = format_enumeration_literal_values(enumeration['values']) - documentation = format_comment(enumeration.get('documentation'), '') - result += f"\n\n{symbol_name}Literal = Literal[{litearal_values}]" - if documentation: - result += f"\n{documentation}\n" return result return [toString(enumeration) for enumeration in enumerations]