| # WARNING: This file is machine generated by fidlgen. |
| |
| from __future__ import annotations |
| |
| from dataclasses import dataclass |
| from fidl_codec import add_ir_path, encode_fidl_object |
| import sys |
| import typing |
| import enum |
| |
| import fidl |
| from fidl._ir import get_fidl_ir_map |
| |
| _ir_path = get_fidl_ir_map()["test.constants"] |
| add_ir_path(_ir_path) |
| |
| |
| class Struct: |
| def __init__( |
| self, |
| *args: list[typing.Any], |
| _unsupported: fidl.Unsupported, |
| **kwargs: dict[str, typing.Any], |
| ) -> None: |
| raise NotImplementedError( |
| """ |
| test.constants/Struct not supported. |
| |
| - int64_with_default annotated with allow_deprecated_struct_defaults |
| - string_with_default annotated with allow_deprecated_struct_defaults |
| - bool_with_default annotated with allow_deprecated_struct_defaults |
| - enum_with_default annotated with allow_deprecated_struct_defaults |
| - bits_with_default annotated with allow_deprecated_struct_defaults |
| """ |
| ) |
| |
| |
| Enum = enum.IntEnum( |
| "Enum", |
| { |
| "__fidl_kind__": "enum", |
| "__fidl_type__": "Enum", |
| "__fidl_raw_type__": "test.constants/Enum", |
| "__strict__": True, |
| "E": 170, |
| "EMPTY__": 0, |
| "make_default": classmethod(lambda cls: cls(0)), |
| }, |
| ) |
| |
| |
| EnumType = enum.IntEnum( |
| "EnumType", |
| { |
| "__fidl_kind__": "enum", |
| "__fidl_type__": "EnumType", |
| "__fidl_raw_type__": "test.constants/EnumType", |
| "__strict__": True, |
| "VALUE": 3, |
| "SECOND_VALUE": 4, |
| "EMPTY__": 0, |
| "make_default": classmethod(lambda cls: cls(0)), |
| }, |
| ) |
| |
| |
| Bits = enum.IntFlag( |
| "Bits", |
| { |
| "__fidl_kind__": "bits", |
| "__fidl_type__": "Bits", |
| "__fidl_raw_type__": "test.constants/Bits", |
| "__strict__": True, |
| "B": 8, |
| "make_default": classmethod(lambda cls: cls(value=0)), |
| }, |
| ) |
| |
| |
| BitsType = enum.IntFlag( |
| "BitsType", |
| { |
| "__fidl_kind__": "bits", |
| "__fidl_type__": "BitsType", |
| "__fidl_raw_type__": "test.constants/BitsType", |
| "__strict__": True, |
| "VALUE": 1, |
| "SECOND_VALUE": 4, |
| "THIRD_VALUE": 2, |
| "make_default": classmethod(lambda cls: cls(value=0)), |
| }, |
| ) |
| |
| |
| # Generated constants |
| BOOL: bool = True |
| FLOAT32: float = 3.14159 |
| FLOAT64: float = 3.14159 |
| INT16: int = 4 |
| INT32: int = 4 |
| INT64: int = 4 |
| INT8: int = 4 |
| STRING: str = """string""" |
| UINT16: int = 4 |
| UINT32: int = 4 |
| UINT64: int = 4 |
| UINT8: int = 4 |
| BITS_PRIMITIVE_VAL: int = 1 |
| BITS_VAL: int | BitsType = 1 |
| ENUM_PRIMITIVE_VAL: int = 3 |
| ENUM_VAL: int | EnumType = 3 |
| OR_RESULT: int | BitsType = 7 |
| OR_RESULT_PRIMITIVE_VAL: int = 5 |