#
# Autogenerated by Thrift for thrift/compiler/test/fixtures/basic/src/module.thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#  @generated
#
cimport cython as __cython
from cpython.object cimport PyTypeObject
from libcpp.memory cimport shared_ptr, make_shared, unique_ptr
from libcpp.optional cimport optional as __optional
from libcpp.string cimport string
from libcpp cimport bool as cbool
from libcpp.iterator cimport inserter as cinserter
from libcpp.utility cimport move as cmove
from cpython cimport bool as pbool
from cython.operator cimport dereference as deref, preincrement as inc, address as ptr_address
import thrift.py3.types
from thrift.py3.types import _IsSet as _fbthrift_IsSet
from thrift.py3.types cimport make_unique
cimport thrift.py3.types
cimport thrift.py3.exceptions
cimport thrift.python.exceptions
from thrift.python.types import EnumMeta as __EnumMeta
from thrift.python.std_libcpp cimport sv_to_str as __sv_to_str, string_view as __cstring_view
from thrift.python.types cimport(
    BadEnum as __BadEnum,
)
from thrift.py3.types cimport (
    cSetOp as __cSetOp,
    richcmp as __richcmp,
    set_op as __set_op,
    setcmp as __setcmp,
    init_unicode_from_cpp as __init_unicode_from_cpp,
    set_iter as __set_iter,
    map_iter as __map_iter,
    map_contains as __map_contains,
    map_getitem as __map_getitem,
    reference_shared_ptr as __reference_shared_ptr,
    get_field_name_by_index as __get_field_name_by_index,
    reset_field as __reset_field,
    translate_cpp_enum_to_python,
    const_pointer_cast,
    make_const_shared,
    constant_shared_ptr,
)
cimport thrift.py3.serializer as serializer
from thrift.python.protocol cimport Protocol as __Protocol
import folly.iobuf as _fbthrift_iobuf
from folly.optional cimport cOptional
from folly.memory cimport to_shared_ptr as __to_shared_ptr
from folly.range cimport Range as __cRange

import sys
from collections.abc import Sequence, Set, Mapping, Iterable
import weakref as __weakref
import builtins as _builtins
import importlib

from test.fixtures.basic.module.types_impl_FBTHRIFT_ONLY_DO_NOT_USE import (
    MyEnum,
    HackEnum,
    __MyUnionType,
    __UnionToBeRenamedType,
)

from test.fixtures.basic.module.containers_FBTHRIFT_ONLY_DO_NOT_USE import (
    List__i32,
)


cdef object get_types_reflection():
    import importlib
    return importlib.import_module(
        "test.fixtures.basic.module.types_reflection"
    )

@__cython.auto_pickle(False)
cdef class MyStruct(thrift.py3.types.Struct):
    def __init__(MyStruct self, **kwargs):
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cMyStruct]()
        self._fields_setter = _fbthrift_types_fields.__MyStruct_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get())
        super().__init__(**kwargs)

    def __call__(MyStruct self, **kwargs):
        if not kwargs:
            return self
        cdef MyStruct __fbthrift_inst = MyStruct.__new__(MyStruct)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cMyStruct](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
        __fbthrift_inst._fields_setter = _fbthrift_types_fields.__MyStruct_FieldsSetter._fbthrift_create(__fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get())
        for __fbthrift_name, _fbthrift_value in kwargs.items():
            __fbthrift_inst._fbthrift_set_field(__fbthrift_name, _fbthrift_value)
        return __fbthrift_inst

    cdef void _fbthrift_set_field(self, str name, object value) except *:
        self._fields_setter.set_field(name.encode("utf-8"), value)

    cdef object _fbthrift_isset(self):
        return _fbthrift_IsSet("MyStruct", {
          "MyIntField": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyIntField_ref().has_value(),
          "MyStringField": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyStringField_ref().has_value(),
          "MyDataField": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyDataField_ref().has_value(),
          "myEnum": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).myEnum_ref().has_value(),
          "oneway": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).oneway_ref().has_value(),
          "readonly": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).readonly_ref().has_value(),
          "idempotent": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).idempotent_ref().has_value(),
          "floatSet": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).floatSet_ref().has_value(),
          "no_hack_codegen_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).no_hack_codegen_field_ref().has_value(),
        })

    @staticmethod
    cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_test_fixtures_basic_module_cbindings.cMyStruct] cpp_obj):
        __fbthrift_inst = <MyStruct>MyStruct.__new__(MyStruct)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj)
        return __fbthrift_inst

    cdef inline MyIntField_impl(self):
        return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyIntField_ref().value()

    @property
    def MyIntField(self):
        return self.MyIntField_impl()

    cdef inline MyStringField_impl(self):
        return (<bytes>deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyStringField_ref().value()).decode('UTF-8')

    @property
    def MyStringField(self):
        return self.MyStringField_impl()

    cdef inline MyDataField_impl(self):
        if self.__fbthrift_cached_MyDataField is None:
            self.__fbthrift_cached_MyDataField = MyDataItem._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyDataField_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
        return self.__fbthrift_cached_MyDataField

    @property
    def MyDataField(self):
        return self.MyDataField_impl()

    cdef inline myEnum_impl(self):
        if self.__fbthrift_cached_myEnum is None:
            self.__fbthrift_cached_myEnum = translate_cpp_enum_to_python(MyEnum, <int>(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).myEnum_ref().value()))
        return self.__fbthrift_cached_myEnum

    @property
    def myEnum(self):
        return self.myEnum_impl()

    cdef inline oneway_impl(self):
        return <pbool> deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).oneway_ref().value()

    @property
    def oneway(self):
        return self.oneway_impl()

    cdef inline readonly_impl(self):
        return <pbool> deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).readonly_ref().value()

    @property
    def readonly(self):
        return self.readonly_impl()

    cdef inline idempotent_impl(self):
        return <pbool> deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).idempotent_ref().value()

    @property
    def idempotent(self):
        return self.idempotent_impl()

    cdef inline floatSet_impl(self):
        if self.__fbthrift_cached_floatSet is None:
            self.__fbthrift_cached_floatSet = Set__float._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).floatSet_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
        return self.__fbthrift_cached_floatSet

    @property
    def floatSet(self):
        return self.floatSet_impl()

    cdef inline no_hack_codegen_field_impl(self):
        return (<bytes>deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).no_hack_codegen_field_ref().value()).decode('UTF-8')

    @property
    def no_hack_codegen_field(self):
        return self.no_hack_codegen_field_impl()


    def __hash__(MyStruct self):
        return super().__hash__()

    def __repr__(MyStruct self):
        return super().__repr__()

    def __str__(MyStruct self):
        return super().__str__()


    def __copy__(MyStruct self):
        cdef shared_ptr[_test_fixtures_basic_module_cbindings.cMyStruct] cpp_obj = make_shared[_test_fixtures_basic_module_cbindings.cMyStruct](
            deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        )
        return MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj))

    def __richcmp__(self, other, int op):
        r = self._fbthrift_cmp_sametype(other, op)
        return __richcmp[_test_fixtures_basic_module_cbindings.cMyStruct](
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            (<MyStruct>other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            op,
        ) if r is None else r

    @staticmethod
    def __get_reflection__():
        return get_types_reflection().get_reflection__MyStruct()

    @staticmethod
    def __get_metadata__():
        cdef __fbthrift_cThriftMetadata meta
        _test_fixtures_basic_module_cbindings.StructMetadata[_test_fixtures_basic_module_cbindings.cMyStruct].gen(meta)
        return __MetadataBox.box(cmove(meta))

    @staticmethod
    def __get_thrift_name__():
        return "module.MyStruct"

    @classmethod
    def _fbthrift_get_field_name_by_index(cls, idx):
        return __sv_to_str(__get_field_name_by_index[_test_fixtures_basic_module_cbindings.cMyStruct](idx))

    @classmethod
    def _fbthrift_get_struct_size(cls):
        return 9

    cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(MyStruct self, __Protocol proto):
        cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data
        with nogil:
            data = cmove(serializer.cserialize[_test_fixtures_basic_module_cbindings.cMyStruct](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto))
        return _fbthrift_iobuf.from_unique_ptr(cmove(data))

    cdef cuint32_t _fbthrift_deserialize(MyStruct self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0:
        cdef cuint32_t needed
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cMyStruct]()
        with nogil:
            needed = serializer.cdeserialize[_test_fixtures_basic_module_cbindings.cMyStruct](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)
        return needed


    def _to_python(self):
        import importlib
        import thrift.python.converter
        python_types = importlib.import_module(
            "test.fixtures.basic.module.thrift_types"
        )
        return thrift.python.converter.to_python_struct(python_types.MyStruct, self)

    def _to_py3(self):
        return self

    def _to_py_deprecated(self):
        import importlib
        import thrift.util.converter
        py_deprecated_types = importlib.import_module("module.ttypes")
        return thrift.util.converter.to_py_struct(py_deprecated_types.MyStruct, self)

@__cython.auto_pickle(False)
cdef class Containers(thrift.py3.types.Struct):
    def __init__(Containers self, **kwargs):
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cContainers]()
        self._fields_setter = _fbthrift_types_fields.__Containers_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get())
        super().__init__(**kwargs)

    def __call__(Containers self, **kwargs):
        if not kwargs:
            return self
        cdef Containers __fbthrift_inst = Containers.__new__(Containers)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cContainers](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
        __fbthrift_inst._fields_setter = _fbthrift_types_fields.__Containers_FieldsSetter._fbthrift_create(__fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get())
        for __fbthrift_name, _fbthrift_value in kwargs.items():
            __fbthrift_inst._fbthrift_set_field(__fbthrift_name, _fbthrift_value)
        return __fbthrift_inst

    cdef void _fbthrift_set_field(self, str name, object value) except *:
        self._fields_setter.set_field(name.encode("utf-8"), value)

    cdef object _fbthrift_isset(self):
        return _fbthrift_IsSet("Containers", {
          "I32List": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).I32List_ref().has_value(),
          "StringSet": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).StringSet_ref().has_value(),
          "StringToI64Map": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).StringToI64Map_ref().has_value(),
        })

    @staticmethod
    cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_test_fixtures_basic_module_cbindings.cContainers] cpp_obj):
        __fbthrift_inst = <Containers>Containers.__new__(Containers)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj)
        return __fbthrift_inst

    cdef inline I32List_impl(self):
        if self.__fbthrift_cached_I32List is None:
            self.__fbthrift_cached_I32List = List__i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).I32List_ref().ref())
        return self.__fbthrift_cached_I32List

    @property
    def I32List(self):
        return self.I32List_impl()

    cdef inline StringSet_impl(self):
        if self.__fbthrift_cached_StringSet is None:
            self.__fbthrift_cached_StringSet = Set__string._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).StringSet_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
        return self.__fbthrift_cached_StringSet

    @property
    def StringSet(self):
        return self.StringSet_impl()

    cdef inline StringToI64Map_impl(self):
        if self.__fbthrift_cached_StringToI64Map is None:
            self.__fbthrift_cached_StringToI64Map = Map__string_i64._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).StringToI64Map_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
        return self.__fbthrift_cached_StringToI64Map

    @property
    def StringToI64Map(self):
        return self.StringToI64Map_impl()


    def __hash__(Containers self):
        return super().__hash__()

    def __repr__(Containers self):
        return super().__repr__()

    def __str__(Containers self):
        return super().__str__()


    def __copy__(Containers self):
        cdef shared_ptr[_test_fixtures_basic_module_cbindings.cContainers] cpp_obj = make_shared[_test_fixtures_basic_module_cbindings.cContainers](
            deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        )
        return Containers._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj))

    def __richcmp__(self, other, int op):
        r = self._fbthrift_cmp_sametype(other, op)
        return __richcmp[_test_fixtures_basic_module_cbindings.cContainers](
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            (<Containers>other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            op,
        ) if r is None else r

    @staticmethod
    def __get_reflection__():
        return get_types_reflection().get_reflection__Containers()

    @staticmethod
    def __get_metadata__():
        cdef __fbthrift_cThriftMetadata meta
        _test_fixtures_basic_module_cbindings.StructMetadata[_test_fixtures_basic_module_cbindings.cContainers].gen(meta)
        return __MetadataBox.box(cmove(meta))

    @staticmethod
    def __get_thrift_name__():
        return "module.Containers"

    @classmethod
    def _fbthrift_get_field_name_by_index(cls, idx):
        return __sv_to_str(__get_field_name_by_index[_test_fixtures_basic_module_cbindings.cContainers](idx))

    @classmethod
    def _fbthrift_get_struct_size(cls):
        return 3

    cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(Containers self, __Protocol proto):
        cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data
        with nogil:
            data = cmove(serializer.cserialize[_test_fixtures_basic_module_cbindings.cContainers](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto))
        return _fbthrift_iobuf.from_unique_ptr(cmove(data))

    cdef cuint32_t _fbthrift_deserialize(Containers self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0:
        cdef cuint32_t needed
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cContainers]()
        with nogil:
            needed = serializer.cdeserialize[_test_fixtures_basic_module_cbindings.cContainers](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)
        return needed


    def _to_python(self):
        import importlib
        import thrift.python.converter
        python_types = importlib.import_module(
            "test.fixtures.basic.module.thrift_types"
        )
        return thrift.python.converter.to_python_struct(python_types.Containers, self)

    def _to_py3(self):
        return self

    def _to_py_deprecated(self):
        import importlib
        import thrift.util.converter
        py_deprecated_types = importlib.import_module("module.ttypes")
        return thrift.util.converter.to_py_struct(py_deprecated_types.Containers, self)

@__cython.auto_pickle(False)
cdef class MyDataItem(thrift.py3.types.Struct):
    def __init__(MyDataItem self, **kwargs):
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cMyDataItem]()
        self._fields_setter = _fbthrift_types_fields.__MyDataItem_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get())
        super().__init__(**kwargs)

    def __call__(MyDataItem self, **kwargs):
        return self

    cdef void _fbthrift_set_field(self, str name, object value) except *:
        self._fields_setter.set_field(name.encode("utf-8"), value)

    cdef object _fbthrift_isset(self):
        return _fbthrift_IsSet("MyDataItem", {
        })

    @staticmethod
    cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_test_fixtures_basic_module_cbindings.cMyDataItem] cpp_obj):
        __fbthrift_inst = <MyDataItem>MyDataItem.__new__(MyDataItem)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj)
        return __fbthrift_inst


    def __hash__(MyDataItem self):
        return super().__hash__()

    def __repr__(MyDataItem self):
        return super().__repr__()

    def __str__(MyDataItem self):
        return super().__str__()


    def __copy__(MyDataItem self):
        cdef shared_ptr[_test_fixtures_basic_module_cbindings.cMyDataItem] cpp_obj = make_shared[_test_fixtures_basic_module_cbindings.cMyDataItem](
            deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        )
        return MyDataItem._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj))

    def __richcmp__(self, other, int op):
        r = self._fbthrift_cmp_sametype(other, op)
        return __richcmp[_test_fixtures_basic_module_cbindings.cMyDataItem](
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            (<MyDataItem>other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            op,
        ) if r is None else r

    @staticmethod
    def __get_reflection__():
        return get_types_reflection().get_reflection__MyDataItem()

    @staticmethod
    def __get_metadata__():
        cdef __fbthrift_cThriftMetadata meta
        _test_fixtures_basic_module_cbindings.StructMetadata[_test_fixtures_basic_module_cbindings.cMyDataItem].gen(meta)
        return __MetadataBox.box(cmove(meta))

    @staticmethod
    def __get_thrift_name__():
        return "module.MyDataItem"

    @classmethod
    def _fbthrift_get_field_name_by_index(cls, idx):
        return __sv_to_str(__get_field_name_by_index[_test_fixtures_basic_module_cbindings.cMyDataItem](idx))

    @classmethod
    def _fbthrift_get_struct_size(cls):
        return 0

    cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(MyDataItem self, __Protocol proto):
        cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data
        with nogil:
            data = cmove(serializer.cserialize[_test_fixtures_basic_module_cbindings.cMyDataItem](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto))
        return _fbthrift_iobuf.from_unique_ptr(cmove(data))

    cdef cuint32_t _fbthrift_deserialize(MyDataItem self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0:
        cdef cuint32_t needed
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cMyDataItem]()
        with nogil:
            needed = serializer.cdeserialize[_test_fixtures_basic_module_cbindings.cMyDataItem](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)
        return needed


    def _to_python(self):
        import importlib
        import thrift.python.converter
        python_types = importlib.import_module(
            "test.fixtures.basic.module.thrift_types"
        )
        return thrift.python.converter.to_python_struct(python_types.MyDataItem, self)

    def _to_py3(self):
        return self

    def _to_py_deprecated(self):
        import importlib
        import thrift.util.converter
        py_deprecated_types = importlib.import_module("module.ttypes")
        return thrift.util.converter.to_py_struct(py_deprecated_types.MyDataItem, self)



@__cython.auto_pickle(False)
cdef class MyUnion(thrift.py3.types.Union):
    Type = __MyUnionType

    def __init__(
        self, *,
        object myEnum=None,
        MyStruct myStruct=None,
        MyDataItem myDataItem=None,
        floatSet=None
    ):
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = __to_shared_ptr(cmove(MyUnion._make_instance(
          NULL,
          myEnum,
          myStruct,
          myDataItem,
          floatSet,
        )))
        self._load_cache()

    @staticmethod
    def fromValue(value):
        if value is None:
            return MyUnion()
        if isinstance(value, MyEnum):
            return MyUnion(myEnum=value)
        if isinstance(value, MyStruct):
            return MyUnion(myStruct=value)
        if isinstance(value, MyDataItem):
            return MyUnion(myDataItem=value)
        if isinstance(value, Set__float):
            return MyUnion(floatSet=value)
        raise ValueError(f"Unable to derive correct union field for value: {value}")

    @staticmethod
    cdef unique_ptr[_test_fixtures_basic_module_cbindings.cMyUnion] _make_instance(
        _test_fixtures_basic_module_cbindings.cMyUnion* base_instance,
        object myEnum,
        MyStruct myStruct,
        MyDataItem myDataItem,
        object floatSet
    ) except *:
        cdef unique_ptr[_test_fixtures_basic_module_cbindings.cMyUnion] c_inst = make_unique[_test_fixtures_basic_module_cbindings.cMyUnion]()
        cdef bint any_set = False
        if myEnum is not None:
            if any_set:
                raise TypeError("At most one field may be set when initializing a union")
            deref(c_inst).set_myEnum(<_test_fixtures_basic_module_cbindings.cMyEnum><int>myEnum)
            any_set = True
        if myStruct is not None:
            if any_set:
                raise TypeError("At most one field may be set when initializing a union")
            deref(c_inst).set_myStruct(deref((<MyStruct?> myStruct)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
            any_set = True
        if myDataItem is not None:
            if any_set:
                raise TypeError("At most one field may be set when initializing a union")
            deref(c_inst).set_myDataItem(deref((<MyDataItem?> myDataItem)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
            any_set = True
        if floatSet is not None:
            if any_set:
                raise TypeError("At most one field may be set when initializing a union")
            deref(c_inst).set_floatSet(<cset[float]>deref(Set__float(floatSet)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
            any_set = True
        # in C++ you don't have to call move(), but this doesn't translate
        # into a C++ return statement, so you do here
        return cmove(c_inst)

    @staticmethod
    cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_test_fixtures_basic_module_cbindings.cMyUnion] cpp_obj):
        __fbthrift_inst = <MyUnion>MyUnion.__new__(MyUnion)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj)
        __fbthrift_inst._load_cache()
        return __fbthrift_inst

    @property
    def myEnum(self):
        if self.type.value != 1:
            raise AttributeError(f'Union contains a value of type {self.type.name}, not myEnum')
        return self.value

    @property
    def myStruct(self):
        if self.type.value != 2:
            raise AttributeError(f'Union contains a value of type {self.type.name}, not myStruct')
        return self.value

    @property
    def myDataItem(self):
        if self.type.value != 3:
            raise AttributeError(f'Union contains a value of type {self.type.name}, not myDataItem')
        return self.value

    @property
    def floatSet(self):
        if self.type.value != 4:
            raise AttributeError(f'Union contains a value of type {self.type.name}, not floatSet')
        return self.value


    def __hash__(MyUnion self):
        return  super().__hash__()

    cdef _load_cache(MyUnion self):
        self.type = MyUnion.Type(<int>(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType()))
        cdef int type = self.type.value
        if type == 0:    # Empty
            self.value = None
        elif type == 1:
            self.value = translate_cpp_enum_to_python(MyEnum, <int>deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_myEnum())
        elif type == 2:
            self.value = MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_test_fixtures_basic_module_cbindings.cMyStruct](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_myStruct()))
        elif type == 3:
            self.value = MyDataItem._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_test_fixtures_basic_module_cbindings.cMyDataItem](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_myDataItem()))
        elif type == 4:
            self.value = Set__float._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[cset[float]](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_floatSet()))

    def __copy__(MyUnion self):
        cdef shared_ptr[_test_fixtures_basic_module_cbindings.cMyUnion] cpp_obj = make_shared[_test_fixtures_basic_module_cbindings.cMyUnion](
            deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        )
        return MyUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj))

    def __richcmp__(self, other, int op):
        r = self._fbthrift_cmp_sametype(other, op)
        return __richcmp[_test_fixtures_basic_module_cbindings.cMyUnion](
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            (<MyUnion>other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            op,
        ) if r is None else r

    @staticmethod
    def __get_reflection__():
        return get_types_reflection().get_reflection__MyUnion()

    @staticmethod
    def __get_metadata__():
        cdef __fbthrift_cThriftMetadata meta
        _test_fixtures_basic_module_cbindings.StructMetadata[_test_fixtures_basic_module_cbindings.cMyUnion].gen(meta)
        return __MetadataBox.box(cmove(meta))

    @staticmethod
    def __get_thrift_name__():
        return "module.MyUnion"

    @classmethod
    def _fbthrift_get_field_name_by_index(cls, idx):
        return __sv_to_str(__get_field_name_by_index[_test_fixtures_basic_module_cbindings.cMyUnion](idx))

    @classmethod
    def _fbthrift_get_struct_size(cls):
        return 4

    cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(MyUnion self, __Protocol proto):
        cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data
        with nogil:
            data = cmove(serializer.cserialize[_test_fixtures_basic_module_cbindings.cMyUnion](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto))
        return _fbthrift_iobuf.from_unique_ptr(cmove(data))

    cdef cuint32_t _fbthrift_deserialize(MyUnion self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0:
        cdef cuint32_t needed
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cMyUnion]()
        with nogil:
            needed = serializer.cdeserialize[_test_fixtures_basic_module_cbindings.cMyUnion](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)
        # force a cache reload since the underlying data's changed
        self._load_cache()
        return needed


    def _to_python(self):
        import importlib
        import thrift.python.converter
        python_types = importlib.import_module(
            "test.fixtures.basic.module.thrift_types"
        )
        return thrift.python.converter.to_python_struct(python_types.MyUnion, self)

    def _to_py3(self):
        return self

    def _to_py_deprecated(self):
        import importlib
        import thrift.util.converter
        py_deprecated_types = importlib.import_module("module.ttypes")
        return thrift.util.converter.to_py_struct(py_deprecated_types.MyUnion, self)

@__cython.auto_pickle(False)
cdef class MyException(thrift.py3.exceptions.GeneratedError):
    def __init__(MyException self, *args, **kwargs):
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cMyException]()
        self._fields_setter = _fbthrift_types_fields.__MyException_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get())
        super().__init__( *args, **kwargs)

    cdef void _fbthrift_set_field(self, str name, object value) except *:
        self._fields_setter.set_field(name.encode("utf-8"), value)

    cdef object _fbthrift_isset(self):
        return _fbthrift_IsSet("MyException", {
          "MyIntField": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyIntField_ref().has_value(),
          "MyStringField": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyStringField_ref().has_value(),
          "myStruct": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).myStruct_ref().has_value(),
          "myUnion": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).myUnion_ref().has_value(),
        })

    @staticmethod
    cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_test_fixtures_basic_module_cbindings.cMyException] cpp_obj):
        __fbthrift_inst = <MyException>MyException.__new__(MyException, (<bytes>deref(cpp_obj).what()).decode('utf-8'))
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj)
        _builtins.Exception.__init__(__fbthrift_inst, *(v for _, v in __fbthrift_inst))
        return __fbthrift_inst

    cdef inline MyIntField_impl(self):
        return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyIntField_ref().value()

    @property
    def MyIntField(self):
        return self.MyIntField_impl()

    cdef inline MyStringField_impl(self):
        return (<bytes>deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyStringField_ref().value()).decode('UTF-8')

    @property
    def MyStringField(self):
        return self.MyStringField_impl()

    cdef inline myStruct_impl(self):
        if self.__fbthrift_cached_myStruct is None:
            self.__fbthrift_cached_myStruct = MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).myStruct_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
        return self.__fbthrift_cached_myStruct

    @property
    def myStruct(self):
        return self.myStruct_impl()

    cdef inline myUnion_impl(self):
        if self.__fbthrift_cached_myUnion is None:
            self.__fbthrift_cached_myUnion = MyUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).myUnion_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
        return self.__fbthrift_cached_myUnion

    @property
    def myUnion(self):
        return self.myUnion_impl()


    def __hash__(MyException self):
        return super().__hash__()

    def __repr__(MyException self):
        return super().__repr__()

    def __str__(MyException self):
        return super().__str__()


    def __copy__(MyException self):
        cdef shared_ptr[_test_fixtures_basic_module_cbindings.cMyException] cpp_obj = make_shared[_test_fixtures_basic_module_cbindings.cMyException](
            deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        )
        return MyException._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj))

    def __richcmp__(self, other, int op):
        r = self._fbthrift_cmp_sametype(other, op)
        return __richcmp[_test_fixtures_basic_module_cbindings.cMyException](
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            (<MyException>other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            op,
        ) if r is None else r

    @staticmethod
    def __get_reflection__():
        return get_types_reflection().get_reflection__MyException()

    @staticmethod
    def __get_metadata__():
        cdef __fbthrift_cThriftMetadata meta
        _test_fixtures_basic_module_cbindings.ExceptionMetadata[_test_fixtures_basic_module_cbindings.cMyException].gen(meta)
        return __MetadataBox.box(cmove(meta))

    @staticmethod
    def __get_thrift_name__():
        return "module.MyException"

    @classmethod
    def _fbthrift_get_field_name_by_index(cls, idx):
        return __sv_to_str(__get_field_name_by_index[_test_fixtures_basic_module_cbindings.cMyException](idx))

    @classmethod
    def _fbthrift_get_struct_size(cls):
        return 4

    cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(MyException self, __Protocol proto):
        cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data
        with nogil:
            data = cmove(serializer.cserialize[_test_fixtures_basic_module_cbindings.cMyException](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto))
        return _fbthrift_iobuf.from_unique_ptr(cmove(data))

    cdef cuint32_t _fbthrift_deserialize(MyException self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0:
        cdef cuint32_t needed
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cMyException]()
        with nogil:
            needed = serializer.cdeserialize[_test_fixtures_basic_module_cbindings.cMyException](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)
        return needed


    def _to_python(self):
        import importlib
        import thrift.python.converter
        python_types = importlib.import_module(
            "test.fixtures.basic.module.thrift_types"
        )
        return thrift.python.converter.to_python_struct(python_types.MyException, self)

    def _to_py3(self):
        return self

    def _to_py_deprecated(self):
        import importlib
        import thrift.util.converter
        py_deprecated_types = importlib.import_module("module.ttypes")
        return thrift.util.converter.to_py_struct(py_deprecated_types.MyException, self)

@__cython.auto_pickle(False)
cdef class MyExceptionWithMessage(thrift.py3.exceptions.GeneratedError):
    def __init__(MyExceptionWithMessage self, *args, **kwargs):
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cMyExceptionWithMessage]()
        self._fields_setter = _fbthrift_types_fields.__MyExceptionWithMessage_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get())
        super().__init__( *args, **kwargs)

    cdef void _fbthrift_set_field(self, str name, object value) except *:
        self._fields_setter.set_field(name.encode("utf-8"), value)

    cdef object _fbthrift_isset(self):
        return _fbthrift_IsSet("MyExceptionWithMessage", {
          "MyIntField": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyIntField_ref().has_value(),
          "MyStringField": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyStringField_ref().has_value(),
          "myStruct": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).myStruct_ref().has_value(),
          "myUnion": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).myUnion_ref().has_value(),
        })

    @staticmethod
    cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_test_fixtures_basic_module_cbindings.cMyExceptionWithMessage] cpp_obj):
        __fbthrift_inst = <MyExceptionWithMessage>MyExceptionWithMessage.__new__(MyExceptionWithMessage, (<bytes>deref(cpp_obj).what()).decode('utf-8'))
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj)
        _builtins.Exception.__init__(__fbthrift_inst, *(v for _, v in __fbthrift_inst))
        return __fbthrift_inst

    cdef inline MyIntField_impl(self):
        return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyIntField_ref().value()

    @property
    def MyIntField(self):
        return self.MyIntField_impl()

    cdef inline MyStringField_impl(self):
        return (<bytes>deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).MyStringField_ref().value()).decode('UTF-8')

    @property
    def MyStringField(self):
        return self.MyStringField_impl()

    cdef inline myStruct_impl(self):
        if self.__fbthrift_cached_myStruct is None:
            self.__fbthrift_cached_myStruct = MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).myStruct_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
        return self.__fbthrift_cached_myStruct

    @property
    def myStruct(self):
        return self.myStruct_impl()

    cdef inline myUnion_impl(self):
        if self.__fbthrift_cached_myUnion is None:
            self.__fbthrift_cached_myUnion = MyUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).myUnion_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
        return self.__fbthrift_cached_myUnion

    @property
    def myUnion(self):
        return self.myUnion_impl()


    def __hash__(MyExceptionWithMessage self):
        return super().__hash__()

    def __repr__(MyExceptionWithMessage self):
        return super().__repr__()

    def __str__(MyExceptionWithMessage self):
        field = self.MyStringField
        if field is None:
            return str(field)
        return field


    def __copy__(MyExceptionWithMessage self):
        cdef shared_ptr[_test_fixtures_basic_module_cbindings.cMyExceptionWithMessage] cpp_obj = make_shared[_test_fixtures_basic_module_cbindings.cMyExceptionWithMessage](
            deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        )
        return MyExceptionWithMessage._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj))

    def __richcmp__(self, other, int op):
        r = self._fbthrift_cmp_sametype(other, op)
        return __richcmp[_test_fixtures_basic_module_cbindings.cMyExceptionWithMessage](
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            (<MyExceptionWithMessage>other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            op,
        ) if r is None else r

    @staticmethod
    def __get_reflection__():
        return get_types_reflection().get_reflection__MyExceptionWithMessage()

    @staticmethod
    def __get_metadata__():
        cdef __fbthrift_cThriftMetadata meta
        _test_fixtures_basic_module_cbindings.ExceptionMetadata[_test_fixtures_basic_module_cbindings.cMyExceptionWithMessage].gen(meta)
        return __MetadataBox.box(cmove(meta))

    @staticmethod
    def __get_thrift_name__():
        return "module.MyExceptionWithMessage"

    @classmethod
    def _fbthrift_get_field_name_by_index(cls, idx):
        return __sv_to_str(__get_field_name_by_index[_test_fixtures_basic_module_cbindings.cMyExceptionWithMessage](idx))

    @classmethod
    def _fbthrift_get_struct_size(cls):
        return 4

    cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(MyExceptionWithMessage self, __Protocol proto):
        cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data
        with nogil:
            data = cmove(serializer.cserialize[_test_fixtures_basic_module_cbindings.cMyExceptionWithMessage](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto))
        return _fbthrift_iobuf.from_unique_ptr(cmove(data))

    cdef cuint32_t _fbthrift_deserialize(MyExceptionWithMessage self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0:
        cdef cuint32_t needed
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cMyExceptionWithMessage]()
        with nogil:
            needed = serializer.cdeserialize[_test_fixtures_basic_module_cbindings.cMyExceptionWithMessage](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)
        return needed


    def _to_python(self):
        import importlib
        import thrift.python.converter
        python_types = importlib.import_module(
            "test.fixtures.basic.module.thrift_types"
        )
        return thrift.python.converter.to_python_struct(python_types.MyExceptionWithMessage, self)

    def _to_py3(self):
        return self

    def _to_py_deprecated(self):
        import importlib
        import thrift.util.converter
        py_deprecated_types = importlib.import_module("module.ttypes")
        return thrift.util.converter.to_py_struct(py_deprecated_types.MyExceptionWithMessage, self)

@__cython.auto_pickle(False)
cdef class ReservedKeyword(thrift.py3.types.Struct):
    def __init__(ReservedKeyword self, **kwargs):
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cReservedKeyword]()
        self._fields_setter = _fbthrift_types_fields.__ReservedKeyword_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get())
        super().__init__(**kwargs)

    def __call__(ReservedKeyword self, **kwargs):
        if not kwargs:
            return self
        cdef ReservedKeyword __fbthrift_inst = ReservedKeyword.__new__(ReservedKeyword)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cReservedKeyword](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))
        __fbthrift_inst._fields_setter = _fbthrift_types_fields.__ReservedKeyword_FieldsSetter._fbthrift_create(__fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get())
        for __fbthrift_name, _fbthrift_value in kwargs.items():
            __fbthrift_inst._fbthrift_set_field(__fbthrift_name, _fbthrift_value)
        return __fbthrift_inst

    cdef void _fbthrift_set_field(self, str name, object value) except *:
        self._fields_setter.set_field(name.encode("utf-8"), value)

    cdef object _fbthrift_isset(self):
        return _fbthrift_IsSet("ReservedKeyword", {
          "reserved_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).reserved_field_ref().has_value(),
        })

    @staticmethod
    cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_test_fixtures_basic_module_cbindings.cReservedKeyword] cpp_obj):
        __fbthrift_inst = <ReservedKeyword>ReservedKeyword.__new__(ReservedKeyword)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj)
        return __fbthrift_inst

    cdef inline reserved_field_impl(self):
        return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).reserved_field_ref().value()

    @property
    def reserved_field(self):
        return self.reserved_field_impl()


    def __hash__(ReservedKeyword self):
        return super().__hash__()

    def __repr__(ReservedKeyword self):
        return super().__repr__()

    def __str__(ReservedKeyword self):
        return super().__str__()


    def __copy__(ReservedKeyword self):
        cdef shared_ptr[_test_fixtures_basic_module_cbindings.cReservedKeyword] cpp_obj = make_shared[_test_fixtures_basic_module_cbindings.cReservedKeyword](
            deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        )
        return ReservedKeyword._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj))

    def __richcmp__(self, other, int op):
        r = self._fbthrift_cmp_sametype(other, op)
        return __richcmp[_test_fixtures_basic_module_cbindings.cReservedKeyword](
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            (<ReservedKeyword>other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            op,
        ) if r is None else r

    @staticmethod
    def __get_reflection__():
        return get_types_reflection().get_reflection__ReservedKeyword()

    @staticmethod
    def __get_metadata__():
        cdef __fbthrift_cThriftMetadata meta
        _test_fixtures_basic_module_cbindings.StructMetadata[_test_fixtures_basic_module_cbindings.cReservedKeyword].gen(meta)
        return __MetadataBox.box(cmove(meta))

    @staticmethod
    def __get_thrift_name__():
        return "module.ReservedKeyword"

    @classmethod
    def _fbthrift_get_field_name_by_index(cls, idx):
        return __sv_to_str(__get_field_name_by_index[_test_fixtures_basic_module_cbindings.cReservedKeyword](idx))

    @classmethod
    def _fbthrift_get_struct_size(cls):
        return 1

    cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(ReservedKeyword self, __Protocol proto):
        cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data
        with nogil:
            data = cmove(serializer.cserialize[_test_fixtures_basic_module_cbindings.cReservedKeyword](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto))
        return _fbthrift_iobuf.from_unique_ptr(cmove(data))

    cdef cuint32_t _fbthrift_deserialize(ReservedKeyword self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0:
        cdef cuint32_t needed
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cReservedKeyword]()
        with nogil:
            needed = serializer.cdeserialize[_test_fixtures_basic_module_cbindings.cReservedKeyword](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)
        return needed


    def _to_python(self):
        import importlib
        import thrift.python.converter
        python_types = importlib.import_module(
            "test.fixtures.basic.module.thrift_types"
        )
        return thrift.python.converter.to_python_struct(python_types.ReservedKeyword, self)

    def _to_py3(self):
        return self

    def _to_py_deprecated(self):
        import importlib
        import thrift.util.converter
        py_deprecated_types = importlib.import_module("module.ttypes")
        return thrift.util.converter.to_py_struct(py_deprecated_types.ReservedKeyword, self)



@__cython.auto_pickle(False)
cdef class UnionToBeRenamed(thrift.py3.types.Union):
    Type = __UnionToBeRenamedType

    def __init__(
        self, *,
        reserved_field=None
    ):
        if reserved_field is not None:
            if not isinstance(reserved_field, int):
                raise TypeError(f'reserved_field is not a { int !r}.')
            reserved_field = <cint32_t> reserved_field

        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = __to_shared_ptr(cmove(UnionToBeRenamed._make_instance(
          NULL,
          reserved_field,
        )))
        self._load_cache()

    @staticmethod
    def fromValue(value):
        if value is None:
            return UnionToBeRenamed()
        if isinstance(value, int):
            if not isinstance(value, pbool):
                try:
                    <cint32_t> value
                    return UnionToBeRenamed(reserved_field=value)
                except OverflowError:
                    pass
        raise ValueError(f"Unable to derive correct union field for value: {value}")

    @staticmethod
    cdef unique_ptr[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed] _make_instance(
        _test_fixtures_basic_module_cbindings.cUnionToBeRenamed* base_instance,
        object reserved_field
    ) except *:
        cdef unique_ptr[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed] c_inst = make_unique[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed]()
        cdef bint any_set = False
        if reserved_field is not None:
            if any_set:
                raise TypeError("At most one field may be set when initializing a union")
            deref(c_inst).set_reserved_field(reserved_field)
            any_set = True
        # in C++ you don't have to call move(), but this doesn't translate
        # into a C++ return statement, so you do here
        return cmove(c_inst)

    @staticmethod
    cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed] cpp_obj):
        __fbthrift_inst = <UnionToBeRenamed>UnionToBeRenamed.__new__(UnionToBeRenamed)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj)
        __fbthrift_inst._load_cache()
        return __fbthrift_inst

    @property
    def reserved_field(self):
        if self.type.value != 1:
            raise AttributeError(f'Union contains a value of type {self.type.name}, not reserved_field')
        return self.value


    def __hash__(UnionToBeRenamed self):
        return  super().__hash__()

    cdef _load_cache(UnionToBeRenamed self):
        self.type = UnionToBeRenamed.Type(<int>(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType()))
        cdef int type = self.type.value
        if type == 0:    # Empty
            self.value = None
        elif type == 1:
            self.value = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_reserved_field()

    def __copy__(UnionToBeRenamed self):
        cdef shared_ptr[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed] cpp_obj = make_shared[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed](
            deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        )
        return UnionToBeRenamed._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj))

    def __richcmp__(self, other, int op):
        r = self._fbthrift_cmp_sametype(other, op)
        return __richcmp[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed](
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            (<UnionToBeRenamed>other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            op,
        ) if r is None else r

    @staticmethod
    def __get_reflection__():
        return get_types_reflection().get_reflection__UnionToBeRenamed()

    @staticmethod
    def __get_metadata__():
        cdef __fbthrift_cThriftMetadata meta
        _test_fixtures_basic_module_cbindings.StructMetadata[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed].gen(meta)
        return __MetadataBox.box(cmove(meta))

    @staticmethod
    def __get_thrift_name__():
        return "module.UnionToBeRenamed"

    @classmethod
    def _fbthrift_get_field_name_by_index(cls, idx):
        return __sv_to_str(__get_field_name_by_index[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed](idx))

    @classmethod
    def _fbthrift_get_struct_size(cls):
        return 1

    cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(UnionToBeRenamed self, __Protocol proto):
        cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data
        with nogil:
            data = cmove(serializer.cserialize[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto))
        return _fbthrift_iobuf.from_unique_ptr(cmove(data))

    cdef cuint32_t _fbthrift_deserialize(UnionToBeRenamed self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0:
        cdef cuint32_t needed
        self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed]()
        with nogil:
            needed = serializer.cdeserialize[_test_fixtures_basic_module_cbindings.cUnionToBeRenamed](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)
        # force a cache reload since the underlying data's changed
        self._load_cache()
        return needed


    def _to_python(self):
        import importlib
        import thrift.python.converter
        python_types = importlib.import_module(
            "test.fixtures.basic.module.thrift_types"
        )
        return thrift.python.converter.to_python_struct(python_types.UnionToBeRenamed, self)

    def _to_py3(self):
        return self

    def _to_py_deprecated(self):
        import importlib
        import thrift.util.converter
        py_deprecated_types = importlib.import_module("module.ttypes")
        return thrift.util.converter.to_py_struct(py_deprecated_types.UnionToBeRenamed, self)

@__cython.auto_pickle(False)
@__cython.final
cdef class Set__float(thrift.py3.types.Set):
    def __init__(self, items=None):
        if isinstance(items, Set__float):
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = (<Set__float> items)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
        else:
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = Set__float__make_instance(items)

    @staticmethod
    cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[cset[float]] c_items):
        __fbthrift_inst = <Set__float>Set__float.__new__(Set__float)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(c_items)
        return __fbthrift_inst

    def __copy__(Set__float self):
        cdef shared_ptr[cset[float]] cpp_obj = make_shared[cset[float]](
            deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        )
        return Set__float._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj))

    def __len__(self):
        return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).size()

    def __contains__(self, item):
        if not self or item is None:
            return False
        if not isinstance(item, float):
            return False
        return pbool(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).count(item))


    def __iter__(self):
        if not self:
            return
        cdef __set_iter[cset[float]] itr = __set_iter[cset[float]](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        cdef float citem = 0
        for i in range(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).size()):
            itr.genNext(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, citem)
            yield citem

    def __hash__(self):
        return super().__hash__()

    def __richcmp__(self, other, int op):
        if isinstance(other, Set__float):
            # C level comparisons
            return __setcmp(
                self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
                (<Set__float> other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
                op,
            )
        return self._fbthrift_py_richcmp(other, op)

    cdef _fbthrift_do_set_op(self, other, __cSetOp op):
        if not isinstance(other, Set__float):
            other = Set__float(other)
        cdef shared_ptr[cset[float]] result
        return Set__float._create_FBTHRIFT_ONLY_DO_NOT_USE(__set_op[cset[float]](
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            (<Set__float>other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            op,
        ))

    @staticmethod
    def __get_reflection__():
        return get_types_reflection().get_reflection__Set__float()


Set.register(Set__float)

cdef shared_ptr[cset[float]] Set__float__make_instance(object items) except *:
    cdef shared_ptr[cset[float]] c_inst = make_shared[cset[float]]()
    if items is not None:
        for item in items:
            if not isinstance(item, (float, int)):
                raise TypeError(f"{item!r} is not of type float")
            deref(c_inst).insert(item)
    return cmove(c_inst)



cdef vector[cint32_t] List__i32__make_instance(object items) except *:
    cdef vector[cint32_t] c_inst
    if items is not None:
        for item in items:
            if not isinstance(item, int):
                raise TypeError(f"{item!r} is not of type int")
            item = <cint32_t> item
            c_inst.push_back(item)
    return cmove(c_inst)

cdef object List__i32__from_cpp(const vector[cint32_t]& c_vec) except *:
    cdef list py_list = []
    cdef int idx = 0
    for idx in range(c_vec.size()):
        py_list.append(c_vec[idx])
    return List__i32(py_list, thrift.py3.types._fbthrift_list_private_ctor)

@__cython.auto_pickle(False)
@__cython.final
cdef class Set__string(thrift.py3.types.Set):
    def __init__(self, items=None):
        if isinstance(items, Set__string):
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = (<Set__string> items)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
        else:
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = Set__string__make_instance(items)

    @staticmethod
    cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[cset[string]] c_items):
        __fbthrift_inst = <Set__string>Set__string.__new__(Set__string)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(c_items)
        return __fbthrift_inst

    def __copy__(Set__string self):
        cdef shared_ptr[cset[string]] cpp_obj = make_shared[cset[string]](
            deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        )
        return Set__string._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj))

    def __len__(self):
        return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).size()

    def __contains__(self, item):
        if not self or item is None:
            return False
        if not isinstance(item, str):
            return False
        return pbool(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).count(item.encode('UTF-8')))


    def __iter__(self):
        if not self:
            return
        cdef __set_iter[cset[string]] itr = __set_iter[cset[string]](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        cdef string citem
        for i in range(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).size()):
            itr.genNext(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, citem)
            yield bytes(citem).decode('UTF-8')

    def __hash__(self):
        return super().__hash__()

    def __richcmp__(self, other, int op):
        if isinstance(other, Set__string):
            # C level comparisons
            return __setcmp(
                self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
                (<Set__string> other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
                op,
            )
        return self._fbthrift_py_richcmp(other, op)

    cdef _fbthrift_do_set_op(self, other, __cSetOp op):
        if not isinstance(other, Set__string):
            other = Set__string(other)
        cdef shared_ptr[cset[string]] result
        return Set__string._create_FBTHRIFT_ONLY_DO_NOT_USE(__set_op[cset[string]](
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            (<Set__string>other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE,
            op,
        ))

    @staticmethod
    def __get_reflection__():
        return get_types_reflection().get_reflection__Set__string()


Set.register(Set__string)

cdef shared_ptr[cset[string]] Set__string__make_instance(object items) except *:
    cdef shared_ptr[cset[string]] c_inst = make_shared[cset[string]]()
    if items is not None:
        if isinstance(items, str):
            raise TypeError("If you really want to pass a string into a _typing.AbstractSet[str] field, explicitly convert it first.")
        for item in items:
            if not isinstance(item, str):
                raise TypeError(f"{item!r} is not of type str")
            deref(c_inst).insert(item.encode('UTF-8'))
    return cmove(c_inst)


@__cython.auto_pickle(False)
@__cython.final
cdef class Map__string_i64(thrift.py3.types.Map):
    def __init__(self, items=None):
        if isinstance(items, Map__string_i64):
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = (<Map__string_i64> items)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
        else:
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = Map__string_i64__make_instance(items)

    @staticmethod
    cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[cmap[string,cint64_t]] c_items):
        __fbthrift_inst = <Map__string_i64>Map__string_i64.__new__(Map__string_i64)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(c_items)
        return __fbthrift_inst

    def __copy__(Map__string_i64 self):
        cdef shared_ptr[cmap[string,cint64_t]] cpp_obj = make_shared[cmap[string,cint64_t]](
            deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        )
        return Map__string_i64._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj))

    def __len__(self):
        return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).size()

    cdef _check_key_type(self, key):
        if not self or key is None:
            return
        if isinstance(key, str):
            return key

    def __getitem__(self, key):
        err = KeyError(f'{key}')
        key = self._check_key_type(key)
        if key is None:
            raise err
        cdef string ckey = key.encode('UTF-8')
        if not __map_contains(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, ckey):
            raise err
        cdef cint64_t citem = 0
        __map_getitem(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, ckey, citem)
        return citem

    def __iter__(self):
        if not self:
            return
        cdef __map_iter[cmap[string,cint64_t]] itr = __map_iter[cmap[string,cint64_t]](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        cdef string citem
        for i in range(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).size()):
            itr.genNextKey(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, citem)
            yield bytes(citem).decode('UTF-8')

    def __contains__(self, key):
        key = self._check_key_type(key)
        if key is None:
            return False
        cdef string ckey = key.encode('UTF-8')
        return __map_contains(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, ckey)

    def values(self):
        if not self:
            return
        cdef __map_iter[cmap[string,cint64_t]] itr = __map_iter[cmap[string,cint64_t]](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        cdef cint64_t citem = 0
        for i in range(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).size()):
            itr.genNextValue(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, citem)
            yield citem

    def items(self):
        if not self:
            return
        cdef __map_iter[cmap[string,cint64_t]] itr = __map_iter[cmap[string,cint64_t]](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        cdef string ckey
        cdef cint64_t citem = 0
        for i in range(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).size()):
            itr.genNextItem(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, ckey, citem)
            yield (ckey.data().decode('UTF-8'), citem)

    @staticmethod
    def __get_reflection__():
        return get_types_reflection().get_reflection__Map__string_i64()

Mapping.register(Map__string_i64)

cdef shared_ptr[cmap[string,cint64_t]] Map__string_i64__make_instance(object items) except *:
    cdef shared_ptr[cmap[string,cint64_t]] c_inst = make_shared[cmap[string,cint64_t]]()
    if items is not None:
        for key, item in items.items():
            if not isinstance(key, str):
                raise TypeError(f"{key!r} is not of type str")
            if not isinstance(item, int):
                raise TypeError(f"{item!r} is not of type int")
            item = <cint64_t> item

            deref(c_inst)[key.encode('UTF-8')] = item
    return cmove(c_inst)


@__cython.auto_pickle(False)
@__cython.final
cdef class Map__string_List__i32(thrift.py3.types.Map):
    def __init__(self, items=None):
        if isinstance(items, Map__string_List__i32):
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = (<Map__string_List__i32> items)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE
        else:
            self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = Map__string_List__i32__make_instance(items)

    @staticmethod
    cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[cmap[string,vector[cint32_t]]] c_items):
        __fbthrift_inst = <Map__string_List__i32>Map__string_List__i32.__new__(Map__string_List__i32)
        __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(c_items)
        return __fbthrift_inst

    def __copy__(Map__string_List__i32 self):
        cdef shared_ptr[cmap[string,vector[cint32_t]]] cpp_obj = make_shared[cmap[string,vector[cint32_t]]](
            deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        )
        return Map__string_List__i32._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj))

    def __len__(self):
        return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).size()

    cdef _check_key_type(self, key):
        if not self or key is None:
            return
        if isinstance(key, str):
            return key

    def __getitem__(self, key):
        err = KeyError(f'{key}')
        key = self._check_key_type(key)
        if key is None:
            raise err
        cdef string ckey = key.encode('UTF-8')
        if not __map_contains(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, ckey):
            raise err
        cdef vector[cint32_t] citem
        __map_getitem(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, ckey, citem)
        return List__i32__from_cpp(citem)

    def __iter__(self):
        if not self:
            return
        cdef __map_iter[cmap[string,vector[cint32_t]]] itr = __map_iter[cmap[string,vector[cint32_t]]](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        cdef string citem
        for i in range(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).size()):
            itr.genNextKey(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, citem)
            yield bytes(citem).decode('UTF-8')

    def __contains__(self, key):
        key = self._check_key_type(key)
        if key is None:
            return False
        cdef string ckey = key.encode('UTF-8')
        return __map_contains(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, ckey)

    def values(self):
        if not self:
            return
        cdef __map_iter[cmap[string,vector[cint32_t]]] itr = __map_iter[cmap[string,vector[cint32_t]]](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        cdef vector[cint32_t] citem
        for i in range(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).size()):
            itr.genNextValue(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, citem)
            yield List__i32__from_cpp(citem)

    def items(self):
        if not self:
            return
        cdef __map_iter[cmap[string,vector[cint32_t]]] itr = __map_iter[cmap[string,vector[cint32_t]]](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)
        cdef string ckey
        cdef vector[cint32_t] citem
        for i in range(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).size()):
            itr.genNextItem(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, ckey, citem)
            yield (ckey.data().decode('UTF-8'), List__i32__from_cpp(citem))

    @staticmethod
    def __get_reflection__():
        return get_types_reflection().get_reflection__Map__string_List__i32()

Mapping.register(Map__string_List__i32)

cdef shared_ptr[cmap[string,vector[cint32_t]]] Map__string_List__i32__make_instance(object items) except *:
    cdef shared_ptr[cmap[string,vector[cint32_t]]] c_inst = make_shared[cmap[string,vector[cint32_t]]]()
    if items is not None:
        for key, item in items.items():
            if not isinstance(key, str):
                raise TypeError(f"{key!r} is not of type str")
            if item is None:
                raise TypeError("None is not of type _typing.Sequence[int]")
            if not isinstance(item, List__i32):
                item = List__i32(item)

            deref(c_inst)[key.encode('UTF-8')] = List__i32__make_instance(item)
    return cmove(c_inst)



FLAG = True
OFFSET = -10
COUNT = 200
MASK = 16388846
E = 2.718281828459
DATE = _test_fixtures_basic_module_cbindings.cDATE().decode('UTF-8')
AList = List__i32__from_cpp(_test_fixtures_basic_module_cbindings.cAList())
ASet = Set__string._create_FBTHRIFT_ONLY_DO_NOT_USE(constant_shared_ptr(_test_fixtures_basic_module_cbindings.cASet()))
AMap = Map__string_List__i32._create_FBTHRIFT_ONLY_DO_NOT_USE(constant_shared_ptr(_test_fixtures_basic_module_cbindings.cAMap()))
MyEnumAlias = MyEnum
MyDataItemAlias = MyDataItem
