Languages

Built-in language specifications for common programming languages.

class literalizer.languages.Ada(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_DASH, declaration_style: DeclarationStyles = DeclarationStyles.DECLARE, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Ada language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

DOUBLE_DASH = CommentConfig(prefix='--', suffix='')
class DateFormats(*values)

Date format options for Ada.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Ada.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

DECLARE = DeclarationStyleConfig(formatter=<function _format_variable_declaration>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='1.0 / 0.0', neg_inf_literal='-1.0 / 0.0', nan_literal='0.0 / 0.0')
REPR = functools.partial(<function format_float_repr>, inf_literal='1.0 / 0.0', neg_inf_literal='-1.0 / 0.0', nan_literal='0.0 / 0.0')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='1.0 / 0.0', neg_inf_literal='-1.0 / 0.0', nan_literal='0.0 / 0.0')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Ada.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence="AList'(1 .. 0 => ANull)", preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Ada.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=')', empty_set="ASet'(1 .. 0 => ANull)", preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.adb'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'ada'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Bash(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.DECLARE, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Bash language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for Bash.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Bash.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

DECLARE = DeclarationStyleConfig(formatter=<function _format_variable_declaration>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
REPR = functools.partial(<function format_float_repr>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Bash.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Bash.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=')', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = <function format_string_backslash>
SINGLE = <function format_string_bash_single>
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.sh'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'bash'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.C(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.TYPED, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

C language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for C.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for C.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

TYPED = DeclarationStyleConfig(formatter=<function _format_variable_declaration>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='INFINITY', neg_inf_literal='-INFINITY', nan_literal='NAN')
REPR = functools.partial(<function format_float_repr>, inf_literal='INFINITY', neg_inf_literal='-INFINITY', nan_literal='NAN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='INFINITY', neg_inf_literal='-INFINITY', nan_literal='NAN')
class IntegerFormats(*values)

Integer format options.

DECIMAL = <class 'str'>
HEX = <function format_integer_hex>
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

AUTO = 'auto'
NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for C.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='}})', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for C.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='}})', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.c'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'c'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.CSharp(*, date_format: DateFormats = DateFormats.CSHARP, datetime_format: DatetimeFormats = DatetimeFormats.CSHARP, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.TUPLE, set_format: SetFormats = SetFormats.HASH_SET, default_set_element_type: str = 'object', default_sequence_element_type: str = 'object', default_dict_key_type: str = 'string', default_dict_value_type: str = 'object', variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.VAR, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DICTIONARY, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

C# language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.CSHARPnew DateOnly(...) call, e.g. new DateOnly(2024, 1, 15).

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.CSHARPnew DateTime(...) call, e.g. new DateTime(2024, 1, 15, 12, 30, 0).

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for C#.

CSHARP = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=('using System;',), type_produced=<class 'datetime.date'>)
ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for C#.

CSHARP = DatetimeFormatConfig(formatter=<function datetime_ymdhms_formatter.<locals>._format>, preamble_lines=('using System;',), type_produced=<class 'datetime.datetime'>)
ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

VAR = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DICTIONARY = _CSharpDictSpec(opener_template='new Dictionary<{key_type}, {type_name}> {{')
SORTED_DICTIONARY = _CSharpDictSpec(opener_template='new SortedDictionary<{key_type}, {type_name}> {{')
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='double.PositiveInfinity', neg_inf_literal='double.NegativeInfinity', nan_literal='double.NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='double.PositiveInfinity', neg_inf_literal='double.NegativeInfinity', nan_literal='double.NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='double.PositiveInfinity', neg_inf_literal='double.NegativeInfinity', nan_literal='double.NaN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for C#.

ARRAY = <function sequence_format_factory.<locals>._build>
TUPLE = <function sequence_format_factory.<locals>._build>
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for C#.

HASH_SET = <function set_format_factory.<locals>._build>
SORTED_SET = <function set_format_factory.<locals>._build>
class StringFormats(*values)

String format options.

DOUBLE = <function format_string_backslash>
VERBATIM = <function format_string_verbatim_csharp>
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.cs'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'csharp'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = True
supports_default_dict_value_type: bool = True
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = True
supports_default_set_element_type: bool = True
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Clojure(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.VECTOR, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.SEMICOLON, declaration_style: DeclarationStyles = DeclarationStyles.DEF, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Clojure language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

SEMICOLON = CommentConfig(prefix=';', suffix='')
class DateFormats(*values)

Date format options for Clojure.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Clojure.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

DEF = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Double/POSITIVE_INFINITY', neg_inf_literal='Double/NEGATIVE_INFINITY', nan_literal='Double/NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Double/POSITIVE_INFINITY', neg_inf_literal='Double/NEGATIVE_INFINITY', nan_literal='Double/NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Double/POSITIVE_INFINITY', neg_inf_literal='Double/NEGATIVE_INFINITY', nan_literal='Double/NaN')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Clojure.

VECTOR = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Clojure.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='}', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.clj'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'clojure'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Cobol(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.SEQUENCE, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.STAR_ANGLE, declaration_style: DeclarationStyles = DeclarationStyles.TYPED, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

GnuCOBOL free-format language specification.

Data is represented as COBOL WORKING-STORAGE SECTION level items: scalars become elementary data items with VALUE clauses, and sequences / dicts become group items with 05-level sub-items.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

STAR_ANGLE = CommentConfig(prefix='*>', suffix='')
class DateFormats(*values)

Date format options for Cobol.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Cobol.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

TYPED = DeclarationStyleConfig(formatter=<function _format_variable_declaration>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='9.99E99', neg_inf_literal='-9.99E99', nan_literal='0.0')
REPR = functools.partial(<function format_float_repr>, inf_literal='9.99E99', neg_inf_literal='-9.99E99', nan_literal='0.0')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='9.99E99', neg_inf_literal='-9.99E99', nan_literal='0.0')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for COBOL.

SEQUENCE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence='05 FILLER PIC X(1) VALUE SPACES.', preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for COBOL.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='', empty_set='05 FILLER PIC X(1) VALUE SPACES.', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.cob'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'cobol'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.CommonLisp(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.SEMICOLON, declaration_style: DeclarationStyles = DeclarationStyles.DEFPARAMETER, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Common Lisp language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='#|', suffix=' |#')
SEMICOLON = CommentConfig(prefix=';', suffix='')
class DateFormats(*values)

Date format options for CommonLisp.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for CommonLisp.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

DEFPARAMETER = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='sb-ext:double-float-positive-infinity', neg_inf_literal='sb-ext:double-float-negative-infinity', nan_literal='#.(sb-int:with-float-traps-masked (:invalid) (- sb-ext:double-float-positive-infinity sb-ext:double-float-positive-infinity))')
REPR = functools.partial(<function format_float_repr>, inf_literal='sb-ext:double-float-positive-infinity', neg_inf_literal='sb-ext:double-float-negative-infinity', nan_literal='#.(sb-int:with-float-traps-masked (:invalid) (- sb-ext:double-float-positive-infinity sb-ext:double-float-positive-infinity))')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='sb-ext:double-float-positive-infinity', neg_inf_literal='sb-ext:double-float-negative-infinity', nan_literal='#.(sb-int:with-float-traps-masked (:invalid) (- sb-ext:double-float-positive-infinity sb-ext:double-float-positive-infinity))')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Common Lisp.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence='nil', preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Common Lisp.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=')', empty_set='nil', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.lisp'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'common-lisp'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Cpp(*, date_format: DateFormats = DateFormats.CPP, datetime_format: DatetimeFormats = DatetimeFormats.CPP, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.INITIALIZER_LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.AUTO, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.MAP, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

C++ language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.CPPstd::chrono::year_month_day literal, e.g. std::chrono::year_month_day{std::chrono::year{2024}, std::chrono::month{1}, std::chrono::day{15}}.

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.CPPstd::chrono::sys_days with time-of-day durations, e.g. std::chrono::sys_days{...} + std::chrono::hours{12} + std::chrono::minutes{30}.

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for C++.

CPP = DateFormatConfig(formatter=<function _format_date_cpp>, preamble_lines=('#include <chrono>',), type_produced=<class 'datetime.date'>)
ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=('#include <string>',), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for C++.

CPP = DatetimeFormatConfig(formatter=<function _format_datetime_cpp>, preamble_lines=('#include <chrono>',), type_produced=<class 'datetime.datetime'>)
ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=('#include <string>',), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

AUTO = DeclarationStyleConfig(formatter=<function _format_variable_declaration>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

MAP = DictFormatConfig(open_fn=functools.partial(<function _typed_dict_open>, type_to_opener=<function make_type_to_opener.<locals>.type_to_opener>, fallback='{'), close='}', format_entry=<function braced_dict_entry.<locals>._format>, empty_dict=None, preamble_lines=('#include <map>',), narrowed_open=None)
UNORDERED_MAP = DictFormatConfig(open_fn=functools.partial(<function _typed_dict_open>, type_to_opener=<function make_type_to_opener.<locals>.type_to_opener>, fallback='{'), close='}', format_entry=<function braced_dict_entry.<locals>._format>, empty_dict=None, preamble_lines=('#include <unordered_map>',), narrowed_open=None)
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='INFINITY', neg_inf_literal='-INFINITY', nan_literal='NAN')
REPR = functools.partial(<function format_float_repr>, inf_literal='INFINITY', neg_inf_literal='-INFINITY', nan_literal='NAN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='INFINITY', neg_inf_literal='-INFINITY', nan_literal='NAN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_tick>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal_c_style>, 'UNDERSCORE': <function format_integer_octal_c_style>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

AUTO = _NumericLiteralSuffixConfig(int_type='long', formatter_wrapper=<function make_long_suffix_formatter>)
NONE = _NumericLiteralSuffixConfig(int_type='int', formatter_wrapper=<function _identity_wrapper>)
property int_type: str

Return the C++ integer type for this suffix.

wrap_integer_formatter(base: Callable[[int], str]) Callable[[int], str]

Wrap the base integer formatter.

class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for C++.

ARRAY = <function _make_array_config>
INITIALIZER_LIST = <function _make_initializer_list_config>
get_config(*, int_type: str) SequenceFormatConfig

Return the sequence format config for the given int type.

property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for C++.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='}', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.cpp'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'cpp'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Crystal(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, default_set_element_type: str = 'String', default_dict_key_type: str = 'String', default_dict_value_type: str = 'String', variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Crystal language specification.

Parameters:

sequence_format

Which Crystal sequence type to use.

  • sequence_formats.ARRAY — array literal, e.g. [1, 2, 3].

  • sequence_formats.TUPLE — tuple literal, e.g. {1, 2, 3}.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for Crystal.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Crystal.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = <function dict_format_factory.<locals>._build>
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Float64::INFINITY', neg_inf_literal='-Float64::INFINITY', nan_literal='Float64::NAN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Float64::INFINITY', neg_inf_literal='-Float64::INFINITY', nan_literal='Float64::NAN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Float64::INFINITY', neg_inf_literal='-Float64::INFINITY', nan_literal='Float64::NAN')
class IntegerFormats(*values)

Integer format options.

DECIMAL = mappingproxy({'NONE': <function Crystal.IntegerFormats.<lambda>>, 'UNDERSCORE': <function format_integer_underscore>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Crystal.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence='[] of Nil', preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
TUPLE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='}', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Crystal.

SET = <function set_format_factory.<locals>._build>
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.cr'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'crystal'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = True
supports_default_dict_value_type: bool = True
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = True
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.D(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.AUTO, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

D language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for D.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for D.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

AUTO = DeclarationStyleConfig(formatter=<function _format_variable_declaration>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='double.infinity', neg_inf_literal='-double.infinity', nan_literal='double.nan')
REPR = functools.partial(<function format_float_repr>, inf_literal='double.infinity', neg_inf_literal='-double.infinity', nan_literal='double.nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='double.infinity', neg_inf_literal='-double.infinity', nan_literal='double.nan')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for D.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='])', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence='parseJSON("[]")', preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for D.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='])', empty_set='parseJSON("[]")', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.d'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'd'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Dart(*, date_format: DateFormats = DateFormats.DART, datetime_format: DatetimeFormats = DatetimeFormats.DART, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, default_set_element_type: str = 'dynamic', default_dict_key_type: str = 'String', default_dict_value_type: str = 'dynamic', variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.FINAL, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Dart language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.DARTDateTime.parse(...) call, e.g. DateTime.parse("2024-01-15").

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.DARTDateTime.parse(...) call, e.g. DateTime.parse("2024-01-15T12:30:00").

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date formatting options for Dart.

DART = DateFormatConfig(formatter=<function date_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime formatting options for Dart.

DART = DatetimeFormatConfig(formatter=<function datetime_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

CONST = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
FINAL = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
VAR = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='double.infinity', neg_inf_literal='double.negativeInfinity', nan_literal='double.nan')
REPR = functools.partial(<function format_float_repr>, inf_literal='double.infinity', neg_inf_literal='double.negativeInfinity', nan_literal='double.nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='double.infinity', neg_inf_literal='double.negativeInfinity', nan_literal='double.nan')
class IntegerFormats(*values)

Integer format options.

DECIMAL = <class 'str'>
HEX = <function format_integer_hex>
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Dart.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback='[', uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
TUPLE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=True, supports_trailing_comma=True, empty_sequence='()', preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Dart.

SET = <function set_format_factory.<locals>._build>
class StringFormats(*values)

String format options.

DOUBLE = <function format_string_backslash_dollar>
SINGLE = <function format_string_backslash_dollar_single>
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.dart'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'dart'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = True
supports_default_dict_value_type: bool = True
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = True
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Dhall(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.LINE, declaration_style: DeclarationStyles = DeclarationStyles.LET, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '  ')

Dhall language specification.

Produces Dhall values — records for mappings, and lists for sequences and sets — following Dhall syntax.

Dhall is a programmable configuration language that is not Turing-complete. It supports records ({ key = value }), lists ([1, 2, 3]), Text, Natural, Double, and Bool types.

Dhall has no null type; null values are rendered as the empty string "".

Dates and datetimes are rendered as quoted ISO 8601 strings because Dhall has no native date type.

Dict keys that cannot be represented as Dhall backtick-quoted labels raise InvalidDictKeyError. This includes empty keys and keys containing control characters or backticks, since Dhall labels only allow printable ASCII.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

LINE = CommentConfig(prefix='--', suffix='')
class DateFormats(*values)

Date format options for Dhall.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Dhall.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

LET = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

Dhall backtick-quoted labels must be non-empty and contain only printable ASCII, so unsupported dict keys always raise InvalidDictKeyError.

ERROR = 'error'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Infinity', neg_inf_literal='-Infinity', nan_literal='NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Infinity', neg_inf_literal='-Infinity', nan_literal='NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Infinity', neg_inf_literal='-Infinity', nan_literal='NaN')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Dhall.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=False, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence='[] : List {}', preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=True)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Dhall.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set='[] : List {}', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.dhall'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = None
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = False
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Elixir(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.MAP_SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Elixir language specification.

Parameters:
  • date_format

    Which date format to use.

    • date_formats.ISO — ISO 8601 string literal, e.g. "2024-01-15".

    • date_formats.ELIXIR — Elixir ~D sigil, e.g. ~D[2024-01-15].

  • datetime_format

    Which datetime format to use.

    • datetime_formats.ISO — ISO 8601 string literal, e.g. "2024-01-15T12:30:00+00:00".

    • datetime_formats.ELIXIR — Elixir ~U sigil for timezone-aware datetimes (e.g. ~U[2024-01-15 12:30:00+00:00]) or ~N sigil for naive datetimes (e.g. ~N[2024-01-15 12:30:00]).

  • sequence_format

    Which Elixir sequence type to use.

    • sequence_formats.LIST — list literal, e.g. [1, 2, 3].

    • sequence_formats.TUPLE — tuple literal, e.g. {1, 2, 3}.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for Elixir.

ELIXIR = DateFormatConfig(formatter=<function date_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Elixir.

ELIXIR = DatetimeFormatConfig(formatter=<function _format_datetime_elixir>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal=':infinity', neg_inf_literal=':negative_infinity', nan_literal=':nan')
REPR = functools.partial(<function format_float_repr>, inf_literal=':infinity', neg_inf_literal=':negative_infinity', nan_literal=':nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal=':infinity', neg_inf_literal=':negative_infinity', nan_literal=':nan')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Elixir.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
TUPLE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='}', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Elixir.

MAP_SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='])', empty_set='MapSet.new()', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.ex'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'elixir'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Elm(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_DASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Elm language specification.

The generated output uses custom constructors (ENull, EBool, EList, EDict, ESet) that are not built-in Elm types. To compile the generated code, define a Val custom type in the consuming module:

type Val
    = ENull
    | EBool Bool
    | EInt Int
    | EFloat Float
    | EStr String
    | EList (List Val)
    | EDict (List ( String, Val ))
    | ESet (List Val)

The body preamble automatically emits only the constructors that are actually used by the data.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.ISO — ISO 8601 string, e.g. EStr "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.ISO — ISO 8601 string, e.g. EStr "2024-01-15T12:30:00".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function _format_elm_bytes_base64>
HEX = <function _format_elm_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='{-', suffix=' -}')
DOUBLE_DASH = CommentConfig(prefix='--', suffix='')
class DateFormats(*values)

Date format options for Elm.

ISO = DateFormatConfig(formatter=<function _format_elm_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Elm.

ISO = DatetimeFormatConfig(formatter=<function _format_elm_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = <function _elm_float_wrapper.<locals>._format>
REPR = <function _elm_float_wrapper.<locals>._format>
SCIENTIFIC = <function _elm_float_wrapper.<locals>._format>
class IntegerFormats(*values)

Integer format options.

DECIMAL = <function _format_elm_integer_decimal>
HEX = <function _format_elm_integer_hex>
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Elm.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Elm.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.elm'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'elm'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Erlang(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.BINARY, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.PERCENT, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Erlang language specification.

Parameters:
  • date_format

    Which date format to use.

    • date_formats.ISO — ISO 8601 string literal, e.g. "2024-01-15".

    • date_formats.ERLANG — Erlang date tuple, e.g. {2024, 1, 15}.

  • datetime_format

    Which datetime format to use.

    • datetime_formats.ISO — ISO 8601 string literal, e.g. "2024-01-15T12:30:00+00:00".

    • datetime_formats.ERLANG — Erlang datetime tuple, e.g. {{2024, 1, 15}, {12, 30, 0}}.

  • sequence_format

    Which Erlang sequence type to use.

    • sequence_formats.LIST — list literal, e.g. [1, 2, 3].

    • sequence_formats.TUPLE — tuple literal, e.g. {1, 2, 3}.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
BINARY = <function _format_bytes>
class CommentFormats(*values)

Comment style options.

PERCENT = CommentConfig(prefix='%', suffix='')
class DateFormats(*values)

Date format options for Erlang.

ERLANG = DateFormatConfig(formatter=<function _format_date_erlang>, preamble_lines=(), type_produced=<class 'datetime.date'>)
ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Erlang.

ERLANG = DatetimeFormatConfig(formatter=<function _format_datetime_erlang>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function _format_variable_declaration>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
REPR = functools.partial(<function format_float_repr>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
class IntegerFormats(*values)

Integer format options.

BINARY = <function format_integer_binary_erlang>
DECIMAL = <class 'str'>
HEX = <function format_integer_hex_erlang>
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Erlang.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
TUPLE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='}', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Erlang.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='])', empty_set='sets:from_list([])', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.erl'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'erlang'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.FSharp(*, date_format: DateFormats = DateFormats.FSHARP, datetime_format: DatetimeFormats = DatetimeFormats.FSHARP, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.LET, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

F# language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.FSHARPSystem.DateOnly(...) call, e.g. System.DateOnly(2024, 1, 15).

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.FSHARPSystem.DateTime(...) call, e.g. System.DateTime(2024, 1, 15, 12, 30, 0).

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='(*', suffix=' *)')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for FSharp.

FSHARP = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for FSharp.

FSHARP = DatetimeFormatConfig(formatter=<function datetime_ymdhms_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

LET = DeclarationStyleConfig(formatter=<function _format_variable_declaration_let>, supports_redefinition=False)
LET_MUTABLE = DeclarationStyleConfig(formatter=<function _format_variable_declaration_let_mutable>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='infinity', neg_inf_literal='-infinity', nan_literal='nan')
REPR = functools.partial(<function format_float_repr>, inf_literal='infinity', neg_inf_literal='-infinity', nan_literal='nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='infinity', neg_inf_literal='-infinity', nan_literal='nan')
class IntegerFormats(*values)

Integer format options.

BINARY = <function format_integer_binary>
DECIMAL = <class 'str'>
HEX = <function format_integer_hex>
OCTAL = <function format_integer_octal>
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for F#.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='|]', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for F#.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.fs'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'fsharp'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Fortran(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.EXCLAMATION, declaration_style: DeclarationStyles = DeclarationStyles.TYPED, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Fortran language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

EXCLAMATION = CommentConfig(prefix='!', suffix='')
class DateFormats(*values)

Date format options for Fortran.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Fortran.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

TYPED = DeclarationStyleConfig(formatter=<function _format_variable_declaration>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='ieee_value(0.0, ieee_positive_inf)', neg_inf_literal='ieee_value(0.0, ieee_negative_inf)', nan_literal='ieee_value(0.0, ieee_quiet_nan)')
REPR = functools.partial(<function format_float_repr>, inf_literal='ieee_value(0.0, ieee_positive_inf)', neg_inf_literal='ieee_value(0.0, ieee_negative_inf)', nan_literal='ieee_value(0.0, ieee_quiet_nan)')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='ieee_value(0.0, ieee_positive_inf)', neg_inf_literal='ieee_value(0.0, ieee_negative_inf)', nan_literal='ieee_value(0.0, ieee_quiet_nan)')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Fortran.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='])', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Fortran.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='])', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.f90'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'fortran'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Gleam(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.LET, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.NONE, indent: str = '  ')

Gleam language specification.

The generated output uses custom constructors (GNull, GBool, GList, GDict, GSet) that are not built-in Gleam types. To compile the generated code, a GVal custom type is emitted in the body preamble:

type GVal {
  GNull
  GBool(Bool)
  GInt(Int)
  GFloat(Float)
  GStr(String)
  GList(List(GVal))
  GDict(List(#(String, GVal)))
  GSet(List(GVal))
}

The body preamble automatically emits only the constructors that are actually used by the data.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.ISO — ISO 8601 string, e.g. GStr("2024-01-15").

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.ISO — ISO 8601 string, e.g. GStr("2024-01-15T12:30:00").

  • sequence_format

    Which Gleam sequence type to use.

    • sequence_formats.LIST — list literal, e.g. GList([GInt(1), GInt(2), GInt(3)]).

    • sequence_formats.TUPLE — tuple literal, e.g. #(GInt(1), GInt(2), GInt(3)).

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function _format_gleam_bytes_base64>
HEX = <function _format_gleam_bytes_hex>
class CommentFormats(*values)

Comment style options.

DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for Gleam.

ISO = DateFormatConfig(formatter=<function _format_gleam_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Gleam.

ISO = DatetimeFormatConfig(formatter=<function _format_gleam_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

LET = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = <function _gleam_float_wrapper.<locals>._format>
REPR = <function _gleam_float_wrapper.<locals>._format>
SCIENTIFIC = <function _gleam_float_wrapper.<locals>._format>
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function _gleam_integer_wrapper.<locals>._format>, 'UNDERSCORE': <function _gleam_integer_wrapper.<locals>._format>})
DECIMAL = mappingproxy({'NONE': <function _format_gleam_integer_decimal>, 'UNDERSCORE': <function _gleam_integer_wrapper.<locals>._format>})
HEX = mappingproxy({'NONE': <function _gleam_integer_wrapper.<locals>._format>, 'UNDERSCORE': <function _gleam_integer_wrapper.<locals>._format>})
OCTAL = mappingproxy({'NONE': <function _gleam_integer_wrapper.<locals>._format>, 'UNDERSCORE': <function _gleam_integer_wrapper.<locals>._format>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

NONE = 'none'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Gleam.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='])', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
TUPLE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence='#()', preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Gleam.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='])', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.gleam'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'gleam'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Go(*, date_format: DateFormats = DateFormats.GO, datetime_format: DatetimeFormats = DatetimeFormats.GO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.SLICE, set_format: SetFormats = SetFormats.SET, default_set_element_type: str = 'any', default_sequence_element_type: str = 'any', default_dict_key_type: str = 'string', default_dict_value_type: str = 'any', default_ordered_map_value_type: str = 'any', variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.SHORT, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '\t')

Go language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.GOtime.Date call, e.g. time.Date(2024, time.January, 15, 0, 0, 0, 0, time.UTC).

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.GOtime.Date call, e.g. time.Date(2024, time.January, 15, 12, 30, 0, 0, time.UTC).

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for Go.

GO = DateFormatConfig(formatter=<function _format_date_go>, preamble_lines=('import "time"',), type_produced=<class 'datetime.date'>)
ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Go.

GO = DatetimeFormatConfig(formatter=<function _format_datetime_go>, preamble_lines=('import "time"',), type_produced=<class 'datetime.datetime'>)
ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

SHORT = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
VAR = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='math.Inf(1)', neg_inf_literal='math.Inf(-1)', nan_literal='math.NaN()')
REPR = functools.partial(<function format_float_repr>, inf_literal='math.Inf(1)', neg_inf_literal='math.Inf(-1)', nan_literal='math.NaN()')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='math.Inf(1)', neg_inf_literal='math.Inf(-1)', nan_literal='math.NaN()')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

AUTO = 'auto'
NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Go.

SLICE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='}', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Go.

SET = <function set_format_factory.<locals>._build>
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

YES = 'yes'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.go'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'go'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = True
supports_default_dict_value_type: bool = True
supports_default_ordered_map_value_type: bool = True
supports_default_sequence_element_type: bool = True
supports_default_set_element_type: bool = True
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Groovy(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, default_set_element_type: str = 'Object', variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.DEF, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Groovy language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for Groovy.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Groovy.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

DEF = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Double.POSITIVE_INFINITY', neg_inf_literal='Double.NEGATIVE_INFINITY', nan_literal='Double.NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Double.POSITIVE_INFINITY', neg_inf_literal='Double.NEGATIVE_INFINITY', nan_literal='Double.NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Double.POSITIVE_INFINITY', neg_inf_literal='Double.NEGATIVE_INFINITY', nan_literal='Double.NaN')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Groovy.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Groovy.

SET = <function set_format_factory.<locals>._build>
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.groovy'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'groovy'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = True
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Haskell(*, date_format: DateFormats = DateFormats.HASKELL, datetime_format: DatetimeFormats = DatetimeFormats.HASKELL, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_DASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Haskell language specification.

The generated output uses custom constructors (HNull, HBool, HList, HMap, HSet) that are not built-in Haskell types. To compile the generated code, define a Val ADT and typeclass instances in the consuming module:

{-# LANGUAGE OverloadedStrings #-}

import Data.String (IsString(fromString))

data Val
  = HNull
  | HBool Bool
  | HInt Integer
  | HFloat Double
  | HStr String
  | HList [Val]
  | HMap [(String, Val)]
  | HSet [Val]

instance IsString Val where
    fromString = HStr

instance Num Val where
    fromInteger = HInt
    negate (HInt n)   = HInt (negate n)
    negate (HFloat f) = HFloat (negate f)
    ...

instance Fractional Val where
    fromRational r = HFloat (realToFrac r)
    ...

OverloadedStrings lets bare string literals like "hi" resolve to HStr "hi" via IsString, and the Num / Fractional instances let numeric literals resolve to HInt / HFloat.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.HASKELLfromGregorian call, e.g. fromGregorian 2024 1 15. Requires the time package.

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.HASKELLUTCTime constructor, e.g. UTCTime (fromGregorian 2024 1 15) (secondsToDiffTime 45000). Requires the time package.

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='{-', suffix=' -}')
DOUBLE_DASH = CommentConfig(prefix='--', suffix='')
class DateFormats(*values)

Date format options for Haskell.

HASKELL = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=('{-# LANGUAGE OverloadedStrings #-}',), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Haskell.

HASKELL = DatetimeFormatConfig(formatter=<function _format_datetime_haskell>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=('{-# LANGUAGE OverloadedStrings #-}',), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='(1/0)', neg_inf_literal='(-1/0)', nan_literal='(0/0)')
REPR = functools.partial(<function format_float_repr>, inf_literal='(1/0)', neg_inf_literal='(-1/0)', nan_literal='(0/0)')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='(1/0)', neg_inf_literal='(-1/0)', nan_literal='(0/0)')
class IntegerFormats(*values)

Integer format options.

BINARY = <function format_integer_binary>
DECIMAL = <class 'str'>
HEX = <function format_integer_hex>
OCTAL = <function format_integer_octal>
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Haskell.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
TUPLE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Haskell.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.hs'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'haskell'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Hcl(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

HCL (HashiCorp Configuration Language) language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for Hcl.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Hcl.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
REPR = functools.partial(<function format_float_repr>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for HCL.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for HCL.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

YES = 'yes'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.hcl'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'hcl'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Java(*, date_format: DateFormats = DateFormats.JAVA, datetime_format: DatetimeFormats = DatetimeFormats.INSTANT, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.VAR, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.MAP_OF_ENTRIES, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Java language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.JAVALocalDate.of(...) call, e.g. LocalDate.of(2024, 1, 15).

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.INSTANTInstant.parse(...) call, e.g. Instant.parse("2024-01-15T12:30:00").

    • datetime_formats.ZONEDZonedDateTime.of(...) call, e.g. ZonedDateTime.of(2024, 1, 15, 12, 30, 0, 0, ZoneId.of("UTC")).

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

  • sequence_format

    How to format sequences.

    • sequence_formats.ARRAY — Java array literal, e.g. new Object[]{1, 2, 3}.

    • sequence_formats.LISTList.of(...) call, e.g. List.of(1, 2, 3).

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date formatting options for Java.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
JAVA = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=('import java.time.LocalDate;',), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime formatting options for Java.

INSTANT = DatetimeFormatConfig(formatter=<function datetime_iso_formatter.<locals>._format>, preamble_lines=('import java.time.Instant;',), type_produced=<class 'datetime.datetime'>)
ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
ZONED = DatetimeFormatConfig(formatter=<function _format_datetime_java_zoned>, preamble_lines=('import java.time.ZoneId;', 'import java.time.ZonedDateTime;'), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

VAR = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

HASH_MAP = DictFormatConfig(open_fn=<function fixed_dict_open.<locals>._open>, close='))', format_entry=<function dict_entry_with_template.<locals>._format>, empty_dict='new HashMap<>()', preamble_lines=('import java.util.HashMap;', 'import java.util.Map;'), narrowed_open=None)
MAP_OF_ENTRIES = DictFormatConfig(open_fn=<function fixed_dict_open.<locals>._open>, close=')', format_entry=<function dict_entry_with_template.<locals>._format>, empty_dict=None, preamble_lines=('import java.util.Map;',), narrowed_open=None)
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Double.POSITIVE_INFINITY', neg_inf_literal='Double.NEGATIVE_INFINITY', nan_literal='Double.NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Double.POSITIVE_INFINITY', neg_inf_literal='Double.NEGATIVE_INFINITY', nan_literal='Double.NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Double.POSITIVE_INFINITY', neg_inf_literal='Double.NEGATIVE_INFINITY', nan_literal='Double.NaN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal_c_style>, 'UNDERSCORE': <function format_integer_octal_c_style>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

AUTO = 'auto'
NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Java.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='}', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback='new Object[]{', uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
LIST = SequenceFormatConfig(sequence_open=<function _list_of_open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence='List.of()', preamble_lines=('import java.util.List;',), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Java.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=')', empty_set=None, preamble_lines=('import java.util.Set;',), set_opener_template='')
TREE_SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='))', empty_set='new TreeSet<>()', preamble_lines=('import java.util.Set;', 'import java.util.TreeSet;'), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.java'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'java'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.JavaScript(*, date_format: DateFormats = DateFormats.JS, datetime_format: DatetimeFormats = DatetimeFormats.JS, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.CONST, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.OBJECT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

JavaScript language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.JSnew Date(...) call, e.g. new Date("2024-01-15").

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.JSnew Date(...) call, e.g. new Date("2024-01-15T12:30:00").

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date formatting options for JavaScript.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
JS = DateFormatConfig(formatter=<function date_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime formatting options for JavaScript.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
JS = DatetimeFormatConfig(formatter=<function datetime_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

CONST = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
LET = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

MAP = DictFormatConfig(open_fn=<function fixed_dict_open.<locals>._open>, close='])', format_entry=<function dict_entry_with_template.<locals>._format>, empty_dict='new Map()', preamble_lines=(), narrowed_open=None)
OBJECT = DictFormatConfig(open_fn=<function fixed_dict_open.<locals>._open>, close='}', format_entry=<function dict_entry_with_separator.<locals>._format>, empty_dict=None, preamble_lines=(), narrowed_open=None)
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Infinity', neg_inf_literal='-Infinity', nan_literal='NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Infinity', neg_inf_literal='-Infinity', nan_literal='NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Infinity', neg_inf_literal='-Infinity', nan_literal='NaN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

NONE = 'none'
SEMICOLON = 'semicolon'
wrap_formatter(formatter: Callable[[str, str, Value], str]) Callable[[str, str, Value], str]

Wrap a formatter to match this line ending style.

class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for JavaScript.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for JavaScript.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='])', empty_set='new Set()', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = <function format_string_backslash>
SINGLE = <function format_string_backslash_single>
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.js'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'javascript'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Json5(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

JSON5 language specification.

Produces JSON5 values — objects for mappings, and arrays for sequences and sets — following the JSON5 Data Interchange Format.

JSON5 is a superset of JSON that permits unquoted identifier keys, trailing commas, single- and double-quoted strings, comments, and several other syntactic relaxations.

Dates and datetimes are rendered as quoted ISO 8601 strings because JSON5 has no native date type.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for Json5.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Json5.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Infinity', neg_inf_literal='-Infinity', nan_literal='NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Infinity', neg_inf_literal='-Infinity', nan_literal='NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Infinity', neg_inf_literal='-Infinity', nan_literal='NaN')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for JSON5.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for JSON5.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.json5'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'json5'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Jsonnet(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Jsonnet language specification.

Produces Jsonnet values — objects for mappings, and arrays for sequences and sets — following the Jsonnet data templating language.

Jsonnet is a superset of JSON that permits unquoted identifier keys, trailing commas, single- and double-quoted strings, comments, and powerful data templating features.

Dates and datetimes are rendered as quoted ISO 8601 strings because Jsonnet has no native date type.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for Jsonnet.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Jsonnet.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='"Infinity"', neg_inf_literal='"-Infinity"', nan_literal='"NaN"')
REPR = functools.partial(<function format_float_repr>, inf_literal='"Infinity"', neg_inf_literal='"-Infinity"', nan_literal='"NaN"')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='"Infinity"', neg_inf_literal='"-Infinity"', nan_literal='"NaN"')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Jsonnet.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Jsonnet.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.jsonnet'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'jsonnet'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Julia(*, date_format: DateFormats = DateFormats.JULIA, datetime_format: DatetimeFormats = DatetimeFormats.JULIA, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DICT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Julia language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.JULIADate(...) constructor call, e.g. Date(2024, 1, 15).

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.JULIADateTime(...) constructor call, e.g. DateTime(2024, 1, 15, 12, 30, 0).

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

  • sequence_format

    Which Julia sequence type to use.

    • sequence_formats.ARRAY — array literal, e.g. [1, 2, 3].

    • sequence_formats.TUPLE — tuple literal, e.g. (1, 2, 3).

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='#=', suffix=' =#')
HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date formatting options for Julia.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
JULIA = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=('using Dates',), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime formatting options for Julia.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
JULIA = DatetimeFormatConfig(formatter=<function datetime_ymdhms_formatter.<locals>._format>, preamble_lines=('using Dates',), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DICT = DictFormatConfig(open_fn=<function fixed_dict_open.<locals>._open>, close=')', format_entry=<function dict_entry_with_separator.<locals>._format>, empty_dict='Dict()', preamble_lines=(), narrowed_open=None)
ORDERED = DictFormatConfig(open_fn=<function fixed_dict_open.<locals>._open>, close=')', format_entry=<function dict_entry_with_separator.<locals>._format>, empty_dict='OrderedDict()', preamble_lines=('using DataStructures',), narrowed_open=None)
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Julia.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
TUPLE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=True, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Julia.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='])', empty_set='Set()', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.jl'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'julia'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Kotlin(*, date_format: DateFormats = DateFormats.KOTLIN, datetime_format: DatetimeFormats = DatetimeFormats.KOTLIN, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, default_set_element_type: str = 'Any?', default_dict_key_type: str = 'String', default_dict_value_type: str = 'Any?', variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.VAL, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.MAP, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Kotlin language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.KOTLINLocalDate.of(...) call, e.g. LocalDate.of(2024, 1, 15).

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.KOTLINLocalDateTime.of(...) call, e.g. LocalDateTime.of(2024, 1, 15, 12, 30, 0).

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

  • sequence_format

    Which Kotlin sequence type to use.

    • sequence_formats.LIST — typed array calls (e.g. intArrayOf(1, 2, 3)). Heterogeneous sequences fall back to listOf<Any?>(…).

    • sequence_formats.TUPLEPair(…) for two-element sequences, Triple(…) for three-element sequences, e.g. Pair("a", 1). Other sizes fall back to listOf<Any?>(…).

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for Kotlin.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
KOTLIN = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=('import java.time.LocalDate',), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Kotlin.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
KOTLIN = DatetimeFormatConfig(formatter=<function datetime_ymdhms_formatter.<locals>._format>, preamble_lines=('import java.time.LocalDateTime',), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

VAL = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
VAR = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

HASH_MAP = _KotlinDictSpec(opener_template='hashMapOf<{key_type}, {type_name}>(')
MAP = _KotlinDictSpec(opener_template='mapOf<{key_type}, {type_name}>(')
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Double.POSITIVE_INFINITY', neg_inf_literal='Double.NEGATIVE_INFINITY', nan_literal='Double.NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Double.POSITIVE_INFINITY', neg_inf_literal='Double.NEGATIVE_INFINITY', nan_literal='Double.NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Double.POSITIVE_INFINITY', neg_inf_literal='Double.NEGATIVE_INFINITY', nan_literal='Double.NaN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Kotlin.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
LIST = SequenceFormatConfig(sequence_open=functools.partial(<function _typed_sequence_open>, type_to_opener=<function _kotlin_type_to_opener>, fallback='listOf<Any?>('), close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback='listOf<Any?>(', uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
TUPLE = SequenceFormatConfig(sequence_open=<function _kotlin_tuple_open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Kotlin.

SET = <function set_format_factory.<locals>._build>
SORTED_SET = <function set_format_factory.<locals>._build>
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.kts'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'kotlin'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = True
supports_default_dict_value_type: bool = True
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = True
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Lua(*, date_format: DateFormats = DateFormats.LUA, datetime_format: DatetimeFormats = DatetimeFormats.LUA, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.TABLE, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_DASH, declaration_style: DeclarationStyles = DeclarationStyles.LOCAL, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Lua language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='--[[', suffix=' ]]')
DOUBLE_DASH = CommentConfig(prefix='--', suffix='')
class DateFormats(*values)

Date format options for Lua.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
LUA = DateFormatConfig(formatter=<function _format_date_lua>, preamble_lines=(), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Lua.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
LUA = DatetimeFormatConfig(formatter=<function _format_datetime_lua>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

LOCAL = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='math.huge', neg_inf_literal='-math.huge', nan_literal='(0/0)')
REPR = functools.partial(<function format_float_repr>, inf_literal='math.huge', neg_inf_literal='-math.huge', nan_literal='(0/0)')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='math.huge', neg_inf_literal='-math.huge', nan_literal='(0/0)')
class IntegerFormats(*values)

Integer format options.

DECIMAL = <class 'str'>
HEX = <function format_integer_hex>
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Lua.

TABLE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='}', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Lua.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='}', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = <function format_string_backslash>
SINGLE = <function format_string_backslash_single>
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.lua'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'lua'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Matlab(*, date_format: DateFormats = DateFormats.MATLAB, datetime_format: DatetimeFormats = DatetimeFormats.MATLAB, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.CELL_ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.PERCENT, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.STRUCT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

MATLAB language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='%{', suffix=' %}')
PERCENT = CommentConfig(prefix='%', suffix='')
class DateFormats(*values)

Date format options for Matlab.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
MATLAB = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Matlab.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
MATLAB = DatetimeFormatConfig(formatter=<function _format_datetime_matlab>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

CONTAINERS_MAP = DictFormatConfig(open_fn=<function _containers_map_open>, close='})', format_entry=<function _format_containers_map_entry>, empty_dict='containers.Map()', preamble_lines=(), narrowed_open=None)
STRUCT = DictFormatConfig(open_fn=<function fixed_dict_open.<locals>._open>, close=')', format_entry=<function _format_matlab_dict_entry>, empty_dict='struct()', preamble_lines=(), narrowed_open=None)
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for MATLAB.

CELL_ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='}', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence='{}', preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for MATLAB.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='}', empty_set='{}', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.m'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'matlab'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Mojo(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, default_set_element_type: str = 'String', default_sequence_element_type: str = 'String', default_dict_key_type: str = 'String', default_dict_value_type: str = 'String', variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Mojo language specification.

Mojo does not support heterogeneous collections — every element in a list or set must share a single type. When a collection contains scalar values of mixed types (e.g. [1, 2.5, 3]), all values are coerced to their string representations so that the resulting literal is valid Mojo (e.g. ["1", "2.5", "3"]).

For sets, this coercion can cause the output to have fewer elements than the input when distinct values of different types coerce to the same string (e.g. {1, "1"} both become "1").

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for Mojo.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Mojo.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = <function dict_format_factory.<locals>._build>
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='std.math.inf[DType.float64]()', neg_inf_literal='-std.math.inf[DType.float64]()', nan_literal='std.math.nan[DType.float64]()')
REPR = functools.partial(<function format_float_repr>, inf_literal='std.math.inf[DType.float64]()', neg_inf_literal='-std.math.inf[DType.float64]()', nan_literal='std.math.nan[DType.float64]()')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='std.math.inf[DType.float64]()', neg_inf_literal='-std.math.inf[DType.float64]()', nan_literal='std.math.nan[DType.float64]()')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Mojo.

LIST = <function sequence_format_factory.<locals>._build>
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Mojo.

SET = <function set_format_factory.<locals>._build>
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

YES = 'yes'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.mojo'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'mojo'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = True
supports_default_dict_value_type: bool = True
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = True
supports_default_set_element_type: bool = True
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Nim(*, date_format: DateFormats = DateFormats.NIM, datetime_format: DatetimeFormats = DatetimeFormats.NIM, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.SEQ, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.VAR, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Nim language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.NIM — table literal, e.g. {"year": 2024, "month": 1, "day": 15}.

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.NIM — table literal, e.g. {"year": 2024, "month": 1, "day": 15, "hour": 12, "minute": 30, "second": 0}.

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='#[', suffix=' ]#')
HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for Nim.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=('import json',), type_produced=<class 'str'>)
NIM = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=('import json',), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Nim.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=('import json',), type_produced=<class 'str'>)
NIM = DatetimeFormatConfig(formatter=<function datetime_ymdhms_formatter.<locals>._format>, preamble_lines=('import json',), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

CONST = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
LET = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
VAR = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Nim.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=('import json',), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
SEQ = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=False, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=('import json',), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=True, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Nim.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=('import json',), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.nim'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'nim'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Norg(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.PERCENT, declaration_style: DeclarationStyles = DeclarationStyles.BLOCK, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Norg markup language specification.

Produces data literals using Norg-compatible syntax — square brackets for sequences and sets, curly braces for mappings, and key: value for dict entries.

Norg comments use the null attached modifier: % comment %.

Variable declarations use a heading followed by a ranged verbatim tag: * name then @code json / @end.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

PERCENT = CommentConfig(prefix='%', suffix='%')
class DateFormats(*values)

Date format options for Norg.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Norg.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

BLOCK = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
REPR = functools.partial(<function format_float_repr>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Norg.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Norg.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.norg'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = None
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.OCaml(*, date_format: DateFormats = DateFormats.OCAML, datetime_format: DatetimeFormats = DatetimeFormats.OCAML, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.PAREN_STAR, declaration_style: DeclarationStyles = DeclarationStyles.LET, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

OCaml language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.OCAML — tuple literal, e.g. (2024, 1, 15).

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.OCAML — pair of tuples, e.g. ((2024, 1, 15), (12, 30, 0)).

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

PAREN_STAR = CommentConfig(prefix='(*', suffix=' *)')
class DateFormats(*values)

Date format options for OCaml.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
OCAML = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for OCaml.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
OCAML = DatetimeFormatConfig(formatter=<function datetime_ymdhms_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

LET = DeclarationStyleConfig(formatter=<function _format_variable_declaration>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='infinity', neg_inf_literal='neg_infinity', nan_literal='nan')
REPR = functools.partial(<function format_float_repr>, inf_literal='infinity', neg_inf_literal='neg_infinity', nan_literal='nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='infinity', neg_inf_literal='neg_infinity', nan_literal='nan')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for OCaml.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='|]', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for OCaml.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.ml'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'ocaml'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.ObjectiveC(*, date_format: DateFormats = DateFormats.OBJC, datetime_format: DatetimeFormats = DatetimeFormats.OBJC, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.TYPED, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Objective-C language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function _format_objc_bytes_base64>
HEX = <function _format_objc_bytes>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for ObjectiveC.

ISO = DateFormatConfig(formatter=<function date_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'str'>)
OBJC = DateFormatConfig(formatter=<function date_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for ObjectiveC.

ISO = DatetimeFormatConfig(formatter=<function datetime_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'str'>)
OBJC = DatetimeFormatConfig(formatter=<function datetime_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

TYPED = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='INFINITY', neg_inf_literal='-INFINITY', nan_literal='NAN')
REPR = functools.partial(<function format_float_repr>, inf_literal='INFINITY', neg_inf_literal='-INFINITY', nan_literal='NAN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='INFINITY', neg_inf_literal='-INFINITY', nan_literal='NAN')
class IntegerFormats(*values)

Integer format options.

DECIMAL = <class 'str'>
HEX = <function format_integer_hex>
OCTAL = <function format_integer_octal_c_style>
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Objective-C.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence='@[]', preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Objective-C.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']]', empty_set='[NSSet set]', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.m'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'objective-c'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Occam(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_DASH, declaration_style: DeclarationStyles = DeclarationStyles.VAL, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Occam-pi language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

DOUBLE_DASH = CommentConfig(prefix='--', suffix='')
class DateFormats(*values)

Date format options for Occam.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Occam.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

VAL = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
REPR = functools.partial(<function format_float_repr>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Occam.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='])', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Occam.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='])', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.occ'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = None
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Odin(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.DYNAMIC_ARRAY, set_format: SetFormats = SetFormats.SET, default_set_element_type: str = 'string', variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.SHORT, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '\t')

Odin language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for Odin.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Odin.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

SHORT = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='math.inf_f64(1)', neg_inf_literal='math.inf_f64(-1)', nan_literal='math.nan_f64()')
REPR = functools.partial(<function format_float_repr>, inf_literal='math.inf_f64(1)', neg_inf_literal='math.inf_f64(-1)', nan_literal='math.nan_f64()')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='math.inf_f64(1)', neg_inf_literal='math.inf_f64(-1)', nan_literal='math.nan_f64()')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Odin.

DYNAMIC_ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='}', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Odin.

SET = <function set_format_factory.<locals>._build>
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.odin'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'odin'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = True
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Perl(*, date_format: DateFormats = DateFormats.PERL, datetime_format: DatetimeFormats = DatetimeFormats.PERL, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.MY, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Perl language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.PERLDateTime->new(...) call, e.g. DateTime->new(year => 2024, month => 1, day => 15).

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.PERLDateTime->new(...) call, e.g. DateTime->new(year => 2024, month => 1, day => 15, hour => 12, minute => 30, second => 0, time_zone => 'UTC').

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00+00:00".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for Perl.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
PERL = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=('use DateTime;',), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Perl.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
PERL = DatetimeFormatConfig(formatter=<function _format_datetime_perl>, preamble_lines=('use DateTime;',), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

MY = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal_c_style>, 'UNDERSCORE': <function format_integer_octal_c_style>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Perl.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Perl.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = <function format_string_backslash>
SINGLE = <function format_string_backslash_single_minimal>
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.pl'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'perl'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Php(*, date_format: DateFormats = DateFormats.PHP, datetime_format: DatetimeFormats = DatetimeFormats.PHP, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

PHP language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for Php.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
PHP = DateFormatConfig(formatter=<function date_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Php.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
PHP = DatetimeFormatConfig(formatter=<function datetime_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='INF', neg_inf_literal='-INF', nan_literal='NAN')
REPR = functools.partial(<function format_float_repr>, inf_literal='INF', neg_inf_literal='-INF', nan_literal='NAN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='INF', neg_inf_literal='-INF', nan_literal='NAN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
OCTAL_C_STYLE = mappingproxy({'NONE': <function format_integer_octal_c_style>, 'UNDERSCORE': <function format_integer_octal_c_style>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for PHP.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for PHP.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = <function format_string_backslash>
SINGLE = <function format_string_backslash_single_minimal>
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.php'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'php'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.PowerShell(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

PowerShell language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='<#', suffix=' #>')
HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for PowerShell.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for PowerShell.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='[double]::PositiveInfinity', neg_inf_literal='[double]::NegativeInfinity', nan_literal='[double]::NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='[double]::PositiveInfinity', neg_inf_literal='[double]::NegativeInfinity', nan_literal='[double]::NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='[double]::PositiveInfinity', neg_inf_literal='[double]::NegativeInfinity', nan_literal='[double]::NaN')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for PowerShell.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for PowerShell.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=')', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.ps1'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'powershell'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.PureScript(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_DASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

PureScript language specification.

The generated output uses custom constructors (PNull, PBool, PList, PDict, PSet) that are not built-in PureScript types. To compile the generated code, define a Val ADT in the consuming module:

import Prelude

data Tuple a b = Tuple a b

data Val
    = PNull
    | PBool Boolean
    | PInt Int
    | PFloat Number
    | PStr String
    | PList (Array Val)
    | PDict (Array (Tuple String Val))
    | PSet (Array Val)

The body preamble automatically emits only the constructors that are actually used by the data.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.ISO — ISO 8601 string, e.g. PStr "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.ISO — ISO 8601 string, e.g. PStr "2024-01-15T12:30:00".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function _format_purescript_bytes_base64>
HEX = <function _format_purescript_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='{-', suffix=' -}')
DOUBLE_DASH = CommentConfig(prefix='--', suffix='')
class DateFormats(*values)

Date format options for PureScript.

ISO = DateFormatConfig(formatter=<function _format_purescript_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for PureScript.

ISO = DatetimeFormatConfig(formatter=<function _format_purescript_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = <function _purescript_float_wrapper.<locals>._format>
REPR = <function _purescript_float_wrapper.<locals>._format>
SCIENTIFIC = <function _purescript_float_wrapper.<locals>._format>
class IntegerFormats(*values)

Integer format options.

DECIMAL = <function _format_purescript_integer_decimal>
HEX = <function _format_purescript_integer_hex>
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for PureScript.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for PureScript.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.purs'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = None
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Python(*, date_format: DateFormats = DateFormats.PYTHON, datetime_format: DatetimeFormats = DatetimeFormats.PYTHON, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.TUPLE, set_format: SetFormats = SetFormats.SET, default_set_element_type: str = 'Any', default_sequence_element_type: str = 'Any', default_dict_key_type: str = 'str', default_dict_value_type: str = 'Any', variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Python language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.PYTHONdatetime.date constructor call, e.g. datetime.date(year=2024, month=1, day=15).

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.PYTHONdatetime.datetime constructor call, e.g. datetime.datetime(year=2024, month=1, day=15, hour=12, minute=30, second=0).

    • datetime_formats.EPOCH — Unix epoch float, e.g. 1705312200.0.

  • bytes_format

    How to format bytes values.

    • bytes_formats.HEX — lowercase hex string, e.g. "48656c6c6f".

    • bytes_formats.PYTHON — Python bytes literal, e.g. b'Hello'.

  • sequence_format

    Which Python sequence type to use.

    • sequence_formats.TUPLE — tuple literal, e.g. (1, 2, 3).

    • sequence_formats.LIST — list literal, e.g. [1, 2, 3].

  • set_format

    Which Python set type to use.

    • set_formats.SET — mutable set literal, e.g. {1, 2, 3}.

    • set_formats.FROZENSET — immutable frozenset, e.g. frozenset({1, 2, 3}).

  • default_set_element_type – Type name used for empty set type hints. Defaults to "Any".

  • default_sequence_element_type – Type name used for empty list/tuple type hints. Defaults to "Any".

  • default_dict_key_type – Type name used for empty dict key type hints. Defaults to "str".

  • default_dict_value_type – Type name used for empty dict value type hints. Defaults to "Any".

  • variable_type_hints

    Whether to add inline type hints to variable declarations.

    • VariableTypeHints.AUTO — bare assignment, e.g. my_var = {...}. Empty collections still receive a type annotation so that type-checkers can infer the element types, e.g. my_var: dict[str, Any] = {}.

    • VariableTypeHints.ALWAYS — every declaration has a type annotation, e.g. my_var: dict[str, Any] = {...}.

class BytesFormats(*values)

Bytes formatting options for Python.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
PYTHON = <function _format_bytes_python>
property type_hint: str

The Python type hint for this bytes format.

class CommentFormats(*values)

Comment style options.

HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date formatting options for Python.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
PYTHON = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=('import datetime',), type_produced=<class 'datetime.date'>)
property type_hint: str

The Python type hint for this date format.

class DatetimeFormats(*values)

Datetime formatting options for Python.

EPOCH = DatetimeFormatConfig(formatter=<function _format_datetime_epoch>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
PYTHON = DatetimeFormatConfig(formatter=<function _format_datetime_python>, preamble_lines=('import datetime',), type_produced=<class 'datetime.datetime'>)
property type_hint: str

The Python type hint for this datetime format.

class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='float("inf")', neg_inf_literal='float("-inf")', nan_literal='float("nan")')
REPR = functools.partial(<function format_float_repr>, inf_literal='float("inf")', neg_inf_literal='float("-inf")', nan_literal='float("nan")')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='float("inf")', neg_inf_literal='float("-inf")', nan_literal='float("nan")')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Python.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
TUPLE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=True, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

property type_hint: str

Python type hint name for this sequence format.

class SetFormats(*values)

Set type options for Python.

FROZENSET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='})', empty_set='frozenset()', preamble_lines=(), set_opener_template='')
SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='}', empty_set='set()', preamble_lines=(), set_opener_template='')
property type_hint: str

Python type hint name for this set format.

class StringFormats(*values)

String format options.

DOUBLE = <function format_string_backslash>
RAW = <function format_string_raw_python>
SINGLE = <function format_string_backslash_single>
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options for Python.

ALWAYS = 'always'
AUTO = 'auto'
formatter(*, bytes_hint: str, date_hint: str, datetime_hint: str, sequence_hint: str, set_hint: str, default_set_element_type: str, default_sequence_element_type: str, default_dict_value_type: str, default_dict_key_type: str) Callable[[str, str, Value], str]

Return the variable declaration formatter for this hint style.

bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.py'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'python'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = True
supports_default_dict_value_type: bool = True
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = True
supports_default_set_element_type: bool = True
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.R(*, date_format: DateFormats = DateFormats.R, datetime_format: DatetimeFormats = DatetimeFormats.R, empty_dict_key: EmptyDictKey = EmptyDictKey.POSITIONAL, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

R language specification.

Dicts are represented as named list() calls where each entry is written as "key" = value. R’s parser rejects zero-length names, so by default dict keys that are empty strings are emitted as positional (unnamed) list elements rather than as "" = value.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.Ras.Date(...) call, e.g. as.Date("2024-01-15").

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.Ras.POSIXct(...) call, e.g. as.POSIXct("2024-01-15T12:30:00").

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

  • empty_dict_key

    How to handle empty-string dict keys.

    • EmptyDictKey.POSITIONAL — emit as an unnamed positional list element.

    • EmptyDictKey.ERROR — raise InvalidDictKeyError.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date formatting options for R.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
R = DateFormatConfig(formatter=<function date_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime formatting options for R.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
R = DatetimeFormatConfig(formatter=<function datetime_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

How to handle empty-string dict keys in R.

R’s parser rejects zero-length names ("" = value is a parse error).

ERROR = <function _format_r_dict_entry_error>
POSITIONAL = <function _format_r_dict_entry_positional>
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
class IntegerFormats(*values)

Integer format options.

DECIMAL = <class 'str'>
HEX = <function format_integer_hex>
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for R.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for R.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=')', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.R'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'r'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Racket(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.SEMICOLON, declaration_style: DeclarationStyles = DeclarationStyles.DEFINE, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Racket language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='#|', suffix=' |#')
SEMICOLON = CommentConfig(prefix=';', suffix='')
class DateFormats(*values)

Date format options for Racket.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Racket.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

DEFINE = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='+inf.0', neg_inf_literal='-inf.0', nan_literal='+nan.0')
REPR = functools.partial(<function format_float_repr>, inf_literal='+inf.0', neg_inf_literal='-inf.0', nan_literal='+nan.0')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='+inf.0', neg_inf_literal='-inf.0', nan_literal='+nan.0')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Racket.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence='(list)', preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Racket.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=')', empty_set='(set)', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.rkt'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'racket'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Raku(*, date_format: DateFormats = DateFormats.RAKU, datetime_format: DatetimeFormats = DatetimeFormats.RAKU, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.MY, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.SINGLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Raku language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.RAKUDate.new(...) call, e.g. Date.new(year => 2024, month => 1, day => 15).

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.RAKUDateTime.new(...) call, e.g. DateTime.new(year => 2024, month => 1, day => 15, hour => 12, minute => 30, second => 0, timezone => 0).

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00+00:00".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for Raku.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
RAKU = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Raku.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
RAKU = DatetimeFormatConfig(formatter=<function _format_datetime_raku>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

MY = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Inf', neg_inf_literal='-Inf', nan_literal='NaN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Raku.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Raku.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = <function format_string_backslash_raku>
SINGLE = <function format_string_backslash_single_minimal>
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.raku'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'raku'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Ruby(*, date_format: DateFormats = DateFormats.RUBY, datetime_format: DatetimeFormats = DatetimeFormats.RUBY, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.ROCKET, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Ruby language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.RUBYDate.new(...) call, e.g. Date.new(2024, 1, 15).

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.RUBYTime.new(...) call, e.g. Time.new(2024, 1, 15, 12, 30, 0).

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

  • dict_entry_style

    How to format dict/hash entries.

    • dict_entry_styles.ROCKET — rocket notation, e.g. "name" => "Alice".

    • dict_entry_styles.SYMBOL — symbol notation, e.g. name: "Alice".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for Ruby.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
RUBY = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=("require 'date'",), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Ruby.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
RUBY = DatetimeFormatConfig(formatter=<function datetime_ymdhms_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options for Ruby.

  • ROCKET — rocket notation, e.g. "key" => "value".

  • SYMBOL — symbol notation, e.g. key: "value".

ROCKET = (<function dict_entry_with_separator.<locals>._format>,)
SYMBOL = (<function dict_entry_symbol_style.<locals>._format>,)
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Float::INFINITY', neg_inf_literal='-Float::INFINITY', nan_literal='Float::NAN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Float::INFINITY', neg_inf_literal='-Float::INFINITY', nan_literal='Float::NAN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Float::INFINITY', neg_inf_literal='-Float::INFINITY', nan_literal='Float::NAN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Ruby.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Ruby.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='])', empty_set='Set.new', preamble_lines=("require 'set'",), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = <function format_string_backslash>
SINGLE = <function format_string_backslash_single_minimal>
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.rb'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'ruby'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Rust(*, date_format: DateFormats = DateFormats.RUST, datetime_format: DatetimeFormats = DatetimeFormats.RUST, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.VEC, set_format: SetFormats = SetFormats.HASH_SET, default_sequence_element_type: str = 'String', default_set_element_type: str = 'String', default_dict_key_type: str = 'String', default_dict_value_type: str = 'String', variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.LET, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.HASH_MAP, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Rust language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.RUSTNaiveDate::from_ymd_opt(...) call, e.g. NaiveDate::from_ymd_opt(2024, 1, 15).unwrap(). Requires the chrono crate.

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.RUSTNaiveDateTime::new(...) call, e.g. NaiveDateTime::new(NaiveDate::from_ymd_opt(2024, 1, 15) .unwrap(), NaiveTime::from_hms_opt(12, 30, 0).unwrap()). Requires the chrono crate.

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

  • sequence_format

    Which Rust sequence type to use.

    • sequence_formats.VECvec![] macro, e.g. vec![1, 2, 3]. Because Vec is homogeneous, mixed-type sequences have all elements coerced to strings.

    • sequence_formats.ARRAY — fixed-size array literal, e.g. [1, 2, 3]. Because Rust arrays are homogeneous, mixed-type sequences have all elements coerced to strings.

    • sequence_formats.TUPLE — tuple literal, e.g. (1, 2, 3).

  • default_sequence_element_type – Type name used for empty Vec literals, e.g. Vec::<String>::new(). Defaults to "String".

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for Rust.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
RUST = DateFormatConfig(formatter=<function _format_date_rust>, preamble_lines=('use chrono::NaiveDate;',), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Rust.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
RUST = DatetimeFormatConfig(formatter=<function _format_datetime_rust>, preamble_lines=('use chrono::NaiveDate;', 'use chrono::NaiveDateTime;', 'use chrono::NaiveTime;'), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

LET = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
LET_MUT = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

BTREE_MAP = <function dict_format_factory.<locals>._build>
HASH_MAP = <function dict_format_factory.<locals>._build>
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='f64::INFINITY', neg_inf_literal='f64::NEG_INFINITY', nan_literal='f64::NAN')
REPR = functools.partial(<function format_float_repr>, inf_literal='f64::INFINITY', neg_inf_literal='f64::NEG_INFINITY', nan_literal='f64::NAN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='f64::INFINITY', neg_inf_literal='f64::NEG_INFINITY', nan_literal='f64::NAN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Rust.

ARRAY = <function sequence_format_factory.<locals>._build>
TUPLE = <function sequence_format_factory.<locals>._build>
VEC = <function sequence_format_factory.<locals>._build>
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Rust.

BTREE_SET = <function set_format_factory.<locals>._build>
HASH_SET = <function set_format_factory.<locals>._build>
class StringFormats(*values)

String format options.

DOUBLE = <function format_string_backslash>
RAW = <function format_string_raw_rust>
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.rs'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'rust'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = True
supports_default_dict_value_type: bool = True
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = True
supports_default_set_element_type: bool = True
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Scala(*, date_format: DateFormats = DateFormats.SCALA, datetime_format: DatetimeFormats = DatetimeFormats.SCALA, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.VAL, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.MAP, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Scala language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for Scala.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
SCALA = DateFormatConfig(formatter=<function date_ymd_formatter.<locals>._format>, preamble_lines=('import java.time.LocalDate',), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Scala.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
SCALA = DatetimeFormatConfig(formatter=<function _format_datetime_scala>, preamble_lines=('import java.time.ZoneId', 'import java.time.ZonedDateTime'), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

VAL = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
VAR = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

LIST_MAP = _ScalaDictSpec(opener_template='ListMap[String, {type_name}](', fallback='ListMap(', preamble_lines=('import scala.collection.immutable.ListMap',))
MAP = _ScalaDictSpec(opener_template='Map[String, {type_name}](', fallback='Map(', preamble_lines=())
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Double.PositiveInfinity', neg_inf_literal='Double.NegativeInfinity', nan_literal='Double.NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Double.PositiveInfinity', neg_inf_literal='Double.NegativeInfinity', nan_literal='Double.NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Double.PositiveInfinity', neg_inf_literal='Double.NegativeInfinity', nan_literal='Double.NaN')
class IntegerFormats(*values)

Integer format options.

DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Scala.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback='Array(', uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
SEQ = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Scala.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=')', empty_set=None, preamble_lines=(), set_opener_template='')
TREE_SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=')', empty_set=None, preamble_lines=('import scala.collection.immutable.TreeSet',), set_opener_template='TreeSet[{type_name}](')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.scala'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'scala'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Scheme(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.LIST, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.SEMICOLON, declaration_style: DeclarationStyles = DeclarationStyles.DEFINE, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Scheme language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='#|', suffix=' |#')
SEMICOLON = CommentConfig(prefix=';', suffix='')
class DateFormats(*values)

Date format options for Scheme.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for Scheme.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

DEFINE = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='+inf.0', neg_inf_literal='-inf.0', nan_literal='+nan.0')
REPR = functools.partial(<function format_float_repr>, inf_literal='+inf.0', neg_inf_literal='-inf.0', nan_literal='+nan.0')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='+inf.0', neg_inf_literal='-inf.0', nan_literal='+nan.0')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Scheme.

LIST = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=')', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence='(list)', preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Scheme.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=')', empty_set='(list)', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.scm'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'scheme'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Swift(*, date_format: DateFormats = DateFormats.SWIFT, datetime_format: DatetimeFormats = DatetimeFormats.SWIFT, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, default_set_element_type: str = 'AnyHashable', default_sequence_element_type: str = 'Any', default_dict_key_type: str = 'String', default_dict_value_type: str = 'Any', variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.LET, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Swift language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for Swift.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
SWIFT = DateFormatConfig(formatter=<function _format_date_swift>, preamble_lines=('import Foundation',), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Swift.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
SWIFT = DatetimeFormatConfig(formatter=<function _format_datetime_swift>, preamble_lines=('import Foundation',), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

LET = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
VAR = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = <function dict_format_factory.<locals>._build>
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Double.infinity', neg_inf_literal='-Double.infinity', nan_literal='Double.nan')
REPR = functools.partial(<function format_float_repr>, inf_literal='Double.infinity', neg_inf_literal='-Double.infinity', nan_literal='Double.nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Double.infinity', neg_inf_literal='-Double.infinity', nan_literal='Double.nan')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Swift.

ARRAY = <function sequence_format_factory.<locals>._build>
TUPLE = <function sequence_format_factory.<locals>._build>
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Swift.

SET = <function set_format_factory.<locals>._build>
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.swift'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'swift'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = True
supports_default_dict_value_type: bool = True
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = True
supports_default_set_element_type: bool = True
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.SystemVerilog(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.TYPED, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

SystemVerilog language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for SystemVerilog.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for SystemVerilog.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

TYPED = DeclarationStyleConfig(formatter=<function _format_variable_declaration>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal="$bitstoreal(64'h7FF0000000000000)", neg_inf_literal="$bitstoreal(64'hFFF0000000000000)", nan_literal="$bitstoreal(64'h7FF8000000000000)")
REPR = functools.partial(<function format_float_repr>, inf_literal="$bitstoreal(64'h7FF0000000000000)", neg_inf_literal="$bitstoreal(64'hFFF0000000000000)", nan_literal="$bitstoreal(64'h7FF8000000000000)")
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal="$bitstoreal(64'h7FF0000000000000)", neg_inf_literal="$bitstoreal(64'hFFF0000000000000)", nan_literal="$bitstoreal(64'h7FF8000000000000)")
class IntegerFormats(*values)

Integer format options.

DECIMAL = <class 'str'>
HEX = <function _format_integer_hex_sv>
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for SystemVerilog.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='}', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=False, empty_sequence="'{}", preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for SystemVerilog.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='}', empty_set="'{}", preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.sv'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'systemverilog'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Toml(*, date_format: DateFormats = DateFormats.TOML, datetime_format: DatetimeFormats = DatetimeFormats.TOML, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

TOML language specification.

Produces TOML inline values — inline tables for mappings, and arrays for sequences and sets — using TOML v1.1 multiline inline table syntax, which permits newlines and comments within braces.

null is not a TOML type; dict entries whose value is null are omitted (skip_null_dict_values = True), and null values in sequences are rendered as the empty string "".

Dates and datetimes are rendered as unquoted TOML native date / datetime literals, which are a distinct TOML type.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for Toml.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
TOML = DateFormatConfig(formatter=<function date_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Toml.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
TOML = DatetimeFormatConfig(formatter=<function datetime_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
REPR = functools.partial(<function format_float_repr>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='inf', neg_inf_literal='-inf', nan_literal='nan')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for TOML.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for TOML.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.toml'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'toml'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.TypeScript(*, date_format: DateFormats = DateFormats.JS, datetime_format: DatetimeFormats = DatetimeFormats.JS, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.CONST, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.OBJECT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

TypeScript language specification.

Parameters:
  • date_format

    How to format datetime.date values.

    • date_formats.JSnew Date(...) call, e.g. new Date("2024-01-15").

    • date_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15".

  • datetime_format

    How to format datetime.datetime values.

    • datetime_formats.JSnew Date(...) call, e.g. new Date("2024-01-15T12:30:00").

    • datetime_formats.ISO — ISO 8601 quoted string, e.g. "2024-01-15T12:30:00".

  • sequence_format

    Which TypeScript sequence type to use.

    • sequence_formats.ARRAY — array literal, e.g. [1, 2, 3].

    • sequence_formats.TUPLEas const tuple literal, e.g. [1, 2, 3] as const. TypeScript infers per-element types instead of a union array type.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

BLOCK = CommentConfig(prefix='/*', suffix=' */')
DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date formatting options for TypeScript.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
JS = DateFormatConfig(formatter=<function date_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime formatting options for TypeScript.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
JS = DatetimeFormatConfig(formatter=<function datetime_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

CONST = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
LET = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
VAR = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

MAP = DictFormatConfig(open_fn=<function fixed_dict_open.<locals>._open>, close='])', format_entry=<function dict_entry_with_template.<locals>._format>, empty_dict='new Map()', preamble_lines=(), narrowed_open=None)
OBJECT = DictFormatConfig(open_fn=<function fixed_dict_open.<locals>._open>, close='}', format_entry=<function dict_entry_with_separator.<locals>._format>, empty_dict=None, preamble_lines=(), narrowed_open=None)
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Infinity', neg_inf_literal='-Infinity', nan_literal='NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Infinity', neg_inf_literal='-Infinity', nan_literal='NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Infinity', neg_inf_literal='-Infinity', nan_literal='NaN')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

NONE = 'none'
SEMICOLON = 'semicolon'
wrap_formatter(formatter: Callable[[str, str, Value], str]) Callable[[str, str, Value], str]

Wrap a formatter to match this line ending style.

class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for TypeScript.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
TUPLE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='] as const', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence='[] as const', preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for TypeScript.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='])', empty_set='new Set()', preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = <function format_string_backslash>
SINGLE = <function format_string_backslash_single>
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.ts'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'typescript'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.VisualBasic(*, date_format: DateFormats = DateFormats.ISO, datetime_format: DatetimeFormats = DatetimeFormats.ISO, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.HASH_SET, default_set_element_type: str = 'Object', default_sequence_element_type: str = 'Object', default_dict_key_type: str = 'String', default_dict_value_type: str = 'Object', variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.APOSTROPHE, declaration_style: DeclarationStyles = DeclarationStyles.DIM, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Visual Basic (.NET) language specification.

VB.NET collection initializers (New T() { ... }, New HashSet(Of T) From { ... }, etc.) do not support comments inside the { ... } block. YAML comments associated with collection elements are therefore emitted as standalone comment lines before the collection — or before the variable declaration when a variable name is supplied.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

APOSTROPHE = CommentConfig(prefix="'", suffix='')
class DateFormats(*values)

Date format options for VisualBasic.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DatetimeFormats(*values)

Datetime format options for VisualBasic.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
class DeclarationStyles(*values)

Declaration style options.

DIM = DeclarationStyleConfig(formatter=<function _format_variable_declaration>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = <function dict_format_factory.<locals>._build>
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='Double.PositiveInfinity', neg_inf_literal='Double.NegativeInfinity', nan_literal='Double.NaN')
REPR = functools.partial(<function format_float_repr>, inf_literal='Double.PositiveInfinity', neg_inf_literal='Double.NegativeInfinity', nan_literal='Double.NaN')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='Double.PositiveInfinity', neg_inf_literal='Double.NegativeInfinity', nan_literal='Double.NaN')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for Visual Basic.

ARRAY = 'array'
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Visual Basic.

HASH_SET = <function set_format_factory.<locals>._build>
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.vb'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'vb.net'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = True
supports_default_dict_value_type: bool = True
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = True
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Yaml(*, date_format: DateFormats = DateFormats.YAML, datetime_format: DatetimeFormats = DatetimeFormats.YAML, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.SEQUENCE, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.HASH, declaration_style: DeclarationStyles = DeclarationStyles.ASSIGN, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.NO, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

YAML language specification.

Produces YAML flow-style values — flow mappings for dicts, and flow sequences for sequences and sets — so that the output is valid inline YAML that can be embedded in any YAML document.

Dates and datetimes are rendered as unquoted YAML native date / datetime literals, which YAML parsers interpret as typed values.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

HASH = CommentConfig(prefix='#', suffix='')
class DateFormats(*values)

Date format options for Yaml.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
YAML = DateFormatConfig(formatter=<function date_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Yaml.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
YAML = DatetimeFormatConfig(formatter=<function datetime_iso_formatter.<locals>._format>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

ASSIGN = DeclarationStyleConfig(formatter=<function variable_formatter.<locals>._format>, supports_redefinition=False)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='.inf', neg_inf_literal='-.inf', nan_literal='.nan')
REPR = functools.partial(<function format_float_repr>, inf_literal='.inf', neg_inf_literal='-.inf', nan_literal='.nan')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='.inf', neg_inf_literal='-.inf', nan_literal='.nan')
class IntegerFormats(*values)

Integer format options.

DECIMAL = 'decimal'
class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
class SequenceFormats(*values)

Sequence type options for YAML.

SEQUENCE = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close=']', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for YAML.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close=']', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = 'no'
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.yaml'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'yaml'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints

class literalizer.languages.Zig(*, date_format: DateFormats = DateFormats.ZIG, datetime_format: DatetimeFormats = DatetimeFormats.ZIG, bytes_format: BytesFormats = BytesFormats.HEX, sequence_format: SequenceFormats = SequenceFormats.ARRAY, set_format: SetFormats = SetFormats.SET, variable_type_hints: VariableTypeHints = VariableTypeHints.AUTO, comment_format: CommentFormats = CommentFormats.DOUBLE_SLASH, declaration_style: DeclarationStyles = DeclarationStyles.CONST, dict_entry_style: DictEntryStyles = DictEntryStyles.DEFAULT, dict_format: DictFormats = DictFormats.DEFAULT, float_format: FloatFormats = FloatFormats.REPR, integer_format: IntegerFormats = IntegerFormats.DECIMAL, numeric_literal_suffix: NumericLiteralSuffixes = NumericLiteralSuffixes.NONE, numeric_separator: NumericSeparators = NumericSeparators.NONE, string_format: StringFormats = StringFormats.DOUBLE, trailing_comma: TrailingCommas = TrailingCommas.YES, line_ending: LineEndings = LineEndings.SEMICOLON, indent: str = '    ')

Zig language specification.

class BytesFormats(*values)

Bytes formatting options.

BASE64 = <function format_bytes_base64>
HEX = <function format_bytes_hex>
class CommentFormats(*values)

Comment style options.

DOUBLE_SLASH = CommentConfig(prefix='//', suffix='')
class DateFormats(*values)

Date format options for Zig.

ISO = DateFormatConfig(formatter=<function format_date_iso>, preamble_lines=(), type_produced=<class 'str'>)
ZIG = DateFormatConfig(formatter=<function _format_date_zig>, preamble_lines=(), type_produced=<class 'datetime.date'>)
class DatetimeFormats(*values)

Datetime format options for Zig.

ISO = DatetimeFormatConfig(formatter=<function format_datetime_iso>, preamble_lines=(), type_produced=<class 'str'>)
ZIG = DatetimeFormatConfig(formatter=<function _format_datetime_zig>, preamble_lines=(), type_produced=<class 'datetime.datetime'>)
class DeclarationStyles(*values)

Declaration style options.

CONST = DeclarationStyleConfig(formatter=<function _format_const_declaration>, supports_redefinition=False)
VAR = DeclarationStyleConfig(formatter=<function _format_var_declaration>, supports_redefinition=True)
class DictEntryStyles(*values)

Dict entry style options.

DEFAULT = 'default'
class DictFormats(*values)

Dict/map format options.

DEFAULT = 'default'
class EmptyDictKey(*values)

Empty dict key options.

ALLOW = 'allow'
class FloatFormats(*values)

Float format options.

FIXED = functools.partial(<function format_float_fixed>, inf_literal='std.math.inf(f64)', neg_inf_literal='-std.math.inf(f64)', nan_literal='std.math.nan(f64)')
REPR = functools.partial(<function format_float_repr>, inf_literal='std.math.inf(f64)', neg_inf_literal='-std.math.inf(f64)', nan_literal='std.math.nan(f64)')
SCIENTIFIC = functools.partial(<function format_float_scientific>, inf_literal='std.math.inf(f64)', neg_inf_literal='-std.math.inf(f64)', nan_literal='std.math.nan(f64)')
class IntegerFormats(*values)

Integer format options.

BINARY = mappingproxy({'NONE': <function format_integer_binary>, 'UNDERSCORE': <function format_integer_binary>})
DECIMAL = mappingproxy({'NONE': <class 'str'>, 'UNDERSCORE': <function format_integer_underscore>})
HEX = mappingproxy({'NONE': <function format_integer_hex>, 'UNDERSCORE': <function format_integer_hex>})
OCTAL = mappingproxy({'NONE': <function format_integer_octal>, 'UNDERSCORE': <function format_integer_octal>})
get_formatter(numeric_separator: Enum) Callable[[int], str]

Return the integer formatter for the given separator.

class LineEndings(*values)

Line ending options.

SEMICOLON = 'semicolon'
class NumericLiteralSuffixes(*values)

Numeric literal suffix options.

NONE = 'none'
class NumericSeparators(*values)

Numeric separator options.

NONE = 'none'
UNDERSCORE = 'underscore'
class SequenceFormats(*values)

Sequence type options for Zig.

ARRAY = SequenceFormatConfig(sequence_open=<function fixed_sequence_open.<locals>._open>, close='}}', supports_heterogeneity=True, single_element_trailing_comma=False, supports_trailing_comma=True, empty_sequence=None, preamble_lines=(), format_entry=<function passthrough_sequence_entry>, typed_opener_fallback=None, uses_typed_literal_for_scalars=False, requires_uniform_record_shapes=False)
property supports_heterogeneity: bool

Whether this sequence format supports mixed-type elements.

class SetFormats(*values)

Set type options for Zig.

SET = SetFormatConfig(set_open=<function fixed_set_open.<locals>._open>, close='}}', empty_set=None, preamble_lines=(), set_opener_template='')
class StringFormats(*values)

String format options.

DOUBLE = 'double'
class TrailingCommas(*values)

Trailing comma options.

NO = TrailingCommaConfig(multiline_trailing_comma=False)
YES = TrailingCommaConfig(multiline_trailing_comma=True)
class VariableTypeHints(*values)

Variable type hint options.

AUTO = 'auto'
bytes_formats

alias of BytesFormats

comment_formats

alias of CommentFormats

date_formats

alias of DateFormats

datetime_formats

alias of DatetimeFormats

declaration_styles

alias of DeclarationStyles

dict_entry_styles

alias of DictEntryStyles

dict_formats

alias of DictFormats

empty_dict_keys

alias of EmptyDictKey

extension: str = '.zig'
float_formats

alias of FloatFormats

integer_formats

alias of IntegerFormats

line_endings

alias of LineEndings

numeric_literal_suffixes

alias of NumericLiteralSuffixes

numeric_separators

alias of NumericSeparators

pygments_name: str | None = 'zig'
sequence_formats

alias of SequenceFormats

set_formats

alias of SetFormats

string_formats

alias of StringFormats

supports_default_dict_key_type: bool = False
supports_default_dict_value_type: bool = False
supports_default_ordered_map_value_type: bool = False
supports_default_sequence_element_type: bool = False
supports_default_set_element_type: bool = False
supports_non_printable_ascii_dict_keys: bool = True
trailing_commas

alias of TrailingCommas

variable_type_hints_formats

alias of VariableTypeHints