From d8f26509cbc32af5b985a20b53904de9af5a72ac Mon Sep 17 00:00:00 2001 From: Andrew Hilger Date: Mon, 13 Jan 2025 14:43:31 -0800 Subject: [PATCH] add containers to converters Summary: Add python to cpp fn `{{type:flat_name}}__make_instance` to `converter.pyx`. This is hidden behind a `gen_legacy_container_converters` flag that will only be enabled for a small number of use cases. On trunk / non-auto-migrate, it just calls `types.{{type:flat_name}}__make_instance`. In auto-migrate, it just returns default initialization, but later up in the stack, we use mustache to paste the same implementation as `types.pyx` into `converter.pyx`. Reviewed By: yoney Differential Revision: D67999499 fbshipit-source-id: 6de114714114e02726d92006e0d489932139fb4b --- .../generate/t_mstch_py3_generator.cc | 6 + .../templates/py3/converter.pxd.mustache | 17 + .../templates/py3/converter.pyx.mustache | 14 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../fixtures/enumstrict/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../test/fixtures/basic/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../test/fixtures/enums/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../gen-py3/includes/converter.pyx | 1 + .../gen-py3/module/converter.pyx | 1 + .../gen-py3/transitive/converter.pyx | 1 + .../gen-py3/includes/converter.pyx | 1 + .../gen-py3/transitive/converter.pyx | 1 + .../gen-py3/includes/converter.pyx | 1 + .../gen-py3/module/converter.pyx | 1 + .../gen-py3/service/converter.pyx | 1 + .../gen-py3/transitive/converter.pyx | 1 + .../gen-py3/transitive/converter.pyx | 1 + .../gen-py3/includes/converter.pyx | 1 + .../matching_struct_names/converter.pyx | 1 + .../gen-py3/module/converter.pyx | 1 + .../gen-py3/transitive/converter.pyx | 1 + .../gen-py3/includes/converter.pyx | 1 + .../py3_service/gen-py3/module/converter.pyx | 1 + .../py3_service/gen-py3/service/converter.pyx | 1 + .../gen-py3/transitive/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3/gen-py3/foo/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../another_interactions/shared/converter.pyx | 1 + .../interactions/module/converter.pyx | 1 + .../list/out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3/gen-py3/includes/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../test/module/module/converter.pyx | 1 + .../py3_emptyns/gen-py3/emptyns/converter.pyx | 1 + .../extend/test/extend/converter.pyx | 1 + .../namespacing/test/hsmodule/converter.pyx | 1 + .../module/converter.pyx | 1 + .../module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + thrift/compiler/test/fixtures/py3/cmd | 1 + .../py3/out/py3/gen-py3/module/converter.pyx | 1 + .../gen-py3/module/converter.pyx | 1 + .../out/py3_empty/gen-py3/empty/converter.pyx | 1 + .../gen-py3/cpp/metadata.cpp | 43 + .../gen-py3/cpp/metadata.h | 22 + .../gen-py3/cpp/types.h | 386 ++ .../gen-py3/module/builders.py | 193 + .../gen-py3/module/cbindings.pxd | 488 +++ .../gen-py3/module/clients.pxd | 18 + .../gen-py3/module/clients.py | 6 + .../gen-py3/module/clients.pyi | 291 ++ .../gen-py3/module/clients.pyx | 1934 ++++++++++ .../gen-py3/module/clients_wrapper.cpp | 1041 ++++++ .../gen-py3/module/clients_wrapper.h | 189 + .../gen-py3/module/clients_wrapper.pxd | 152 + .../containers_FBTHRIFT_ONLY_DO_NOT_USE.py | 1475 ++++++++ .../gen-py3/module/converter.pxd | 91 + .../gen-py3/module/converter.pyx | 165 + .../gen-py3/module/metadata.cpp | 34 + .../gen-py3/module/metadata.h | 18 + .../gen-py3/module/metadata.pxd | 14 + .../gen-py3/module/metadata.py | 6 + .../gen-py3/module/metadata.pyi | 10 + .../gen-py3/module/metadata.pyx | 23 + .../gen-py3/module/services.pxd | 65 + .../gen-py3/module/services.py | 6 + .../gen-py3/module/services.pyi | 342 ++ .../gen-py3/module/services.pyx | 3212 +++++++++++++++++ .../gen-py3/module/services_interface.pxd | 19 + .../gen-py3/module/services_wrapper.cpp | 1069 ++++++ .../gen-py3/module/services_wrapper.h | 183 + .../gen-py3/module/services_wrapper.pxd | 17 + .../gen-py3/module/types.h | 327 ++ .../gen-py3/module/types.pxd | 311 ++ .../gen-py3/module/types.py | 6 + .../gen-py3/module/types.pyi | 964 +++++ .../gen-py3/module/types.pyx | 2307 ++++++++++++ .../gen-py3/module/types_empty.pyx | 9 + .../gen-py3/module/types_fields.pxd | 183 + .../gen-py3/module/types_fields.pyx | 642 ++++ .../types_impl_FBTHRIFT_ONLY_DO_NOT_USE.py | 152 + .../gen-py3/module/types_reflection.py | 938 +++++ .../gen-py3/python/metadata.cpp | 29 + .../gen-py3/python/metadata.h | 22 + .../gen-py3/python/types.h | 155 + .../gen-py3/scope/metadata.cpp | 37 + .../gen-py3/scope/metadata.h | 20 + .../gen-py3/scope/types.h | 310 ++ .../gen-py3/thrift/metadata.cpp | 37 + .../gen-py3/thrift/metadata.h | 20 + .../gen-py3/thrift/types.h | 311 ++ .../out/py3/gen-py3/module0/converter.pyx | 1 + .../out/py3/gen-py3/module1/converter.pyx | 1 + .../out/py3/gen-py3/module2/converter.pyx | 1 + .../refs/out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../gen-py3/module_structs/converter.pyx | 1 + .../sink/out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3/gen-py3/module/converter.pyx | 1 + .../out/py3_a/gen-py3/a/converter.pyx | 1 + .../out/py3_a/gen-py3/b/converter.pyx | 1 + .../out/py3_a/gen-py3/c/converter.pyx | 1 + .../out/py3_s/gen-py3/b/converter.pyx | 1 + .../out/py3_s/gen-py3/c/converter.pyx | 1 + .../out/py3_s/gen-py3/s/converter.pyx | 1 + .../fixtures/types/included/converter.pyx | 1 + .../fixtures/types/module/converter.pyx | 1 + 119 files changed, 18397 insertions(+) create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/cpp/metadata.cpp create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/cpp/metadata.h create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/cpp/types.h create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/builders.py create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/cbindings.pxd create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.pxd create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.py create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.pyi create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.pyx create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients_wrapper.cpp create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients_wrapper.h create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients_wrapper.pxd create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/containers_FBTHRIFT_ONLY_DO_NOT_USE.py create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/converter.pxd create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/converter.pyx create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.cpp create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.h create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.pxd create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.py create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.pyi create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.pyx create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.pxd create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.py create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.pyi create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.pyx create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_interface.pxd create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_wrapper.cpp create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_wrapper.h create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_wrapper.pxd create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.h create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.pxd create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.py create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.pyi create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.pyx create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_empty.pyx create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_fields.pxd create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_fields.pyx create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_impl_FBTHRIFT_ONLY_DO_NOT_USE.py create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_reflection.py create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/python/metadata.cpp create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/python/metadata.h create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/python/types.h create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/scope/metadata.cpp create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/scope/metadata.h create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/scope/types.h create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/thrift/metadata.cpp create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/thrift/metadata.h create mode 100644 thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/thrift/types.h diff --git a/thrift/compiler/generate/t_mstch_py3_generator.cc b/thrift/compiler/generate/t_mstch_py3_generator.cc index 9c2fedaa887..b2be5022500 100644 --- a/thrift/compiler/generate/t_mstch_py3_generator.cc +++ b/thrift/compiler/generate/t_mstch_py3_generator.cc @@ -164,6 +164,8 @@ class py3_mstch_program : public mstch_program { &py3_mstch_program::capi_converter}, {"program:intercompatible?", &py3_mstch_program::intercompatible}, {"program:auto_migrate?", &py3_mstch_program::auto_migrate}, + {"program:gen_legacy_container_converters?", + &py3_mstch_program::legacy_container_converters}, {"program:stream_types", &py3_mstch_program::getStreamTypes}, {"program:response_and_stream_functions", &py3_mstch_program::response_and_stream_functions}, @@ -290,6 +292,10 @@ class py3_mstch_program : public mstch_program { mstch::node auto_migrate() { return has_option("auto_migrate"); } + mstch::node legacy_container_converters() { + return has_option("gen_legacy_container_converters"); + } + mstch::node py_deprecated_module_path() { const std::string& module_path = program_->get_namespace("py"); if (module_path.empty()) { diff --git a/thrift/compiler/generate/templates/py3/converter.pxd.mustache b/thrift/compiler/generate/templates/py3/converter.pxd.mustache index 9ec17036773..fdab7f54bcb 100644 --- a/thrift/compiler/generate/templates/py3/converter.pxd.mustache +++ b/thrift/compiler/generate/templates/py3/converter.pxd.mustache @@ -17,7 +17,19 @@ }} {{> common/auto_generated_py}} +{{#program:gen_legacy_container_converters?}} +{{> types/cimport_std }} + +cimport {{#program:py3Namespaces}}{{value}}.{{/program:py3Namespaces}}{{program:name}}.cbindings as {{> types/current_module_cbindings}} +{{#program:includeNamespaces}} +{{#hasTypes?}} +cimport {{#includeNamespace}}{{value}}.{{/includeNamespace}}cbindings as _{{#includeNamespace}}{{value}}_{{/includeNamespace}}cbindings +{{/hasTypes?}} +{{/program:includeNamespaces}} +{{/program:gen_legacy_container_converters?}} +{{^program:gen_legacy_container_converters?}} from libcpp.memory cimport shared_ptr +{{/program:gen_legacy_container_converters?}} cimport {{#program:py3Namespaces}}{{value}}.{{/program:py3Namespaces}}{{program:name}}.cbindings as _fbthrift_cbindings @@ -27,3 +39,8 @@ cdef shared_ptr[_fbthrift_cbindings.{{> types/c_struct }}] {{struct:name}}_conve cdef object {{struct:name}}_from_cpp(const shared_ptr[_fbthrift_cbindings.{{> types/c_struct }}]& c_struct) {{/program:filtered_structs}} +{{#program:gen_legacy_container_converters?}} +{{#program:containerTypes}} +cdef {{> types/cython_cpp_type}} {{type:flat_name}}__make_instance(object items) except * +{{/program:containerTypes}} +{{/program:gen_legacy_container_converters?}} diff --git a/thrift/compiler/generate/templates/py3/converter.pyx.mustache b/thrift/compiler/generate/templates/py3/converter.pyx.mustache index 61a366535f4..8a63d87a9b4 100644 --- a/thrift/compiler/generate/templates/py3/converter.pyx.mustache +++ b/thrift/compiler/generate/templates/py3/converter.pyx.mustache @@ -52,3 +52,17 @@ cdef object {{struct:name}}_from_cpp(const shared_ptr[_fbthrift_cbindings.{{> ty {{/program:auto_migrate?}} {{/program:filtered_structs}} + +{{#program:gen_legacy_container_converters?}} +{{#program:containerTypes}} +cdef {{> types/cython_cpp_type}} {{type:flat_name}}__make_instance(object items) except *: +{{^program:auto_migrate?}} + return _fbthrift_ctypes.{{type:flat_name}}__make_instance(items) +{{/program:auto_migrate?}} +{{#program:auto_migrate?}} + cdef {{> types/cython_cpp_type}} ret + return ret +{{/program:auto_migrate?}} + +{{/program:containerTypes}} +{{/program:gen_legacy_container_converters?}} diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/basic-annotations/out/py3/gen-py3/module/converter.pyx index 9f98e828ecf..e196f2f618f 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/basic-annotations/out/py3/gen-py3/module/converter.pyx @@ -21,3 +21,4 @@ cdef shared_ptr[_fbthrift_cbindings.cSecretStruct] SecretStruct_convert_to_cpp(o cdef object SecretStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cSecretStruct]& c_struct): return _fbthrift_ctypes.SecretStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/basic-enum/out/py3/gen-py3/test/fixtures/enumstrict/module/converter.pyx b/thrift/compiler/test/fixtures/basic-enum/out/py3/gen-py3/test/fixtures/enumstrict/module/converter.pyx index 8028af1796d..d7893586dde 100644 --- a/thrift/compiler/test/fixtures/basic-enum/out/py3/gen-py3/test/fixtures/enumstrict/module/converter.pyx +++ b/thrift/compiler/test/fixtures/basic-enum/out/py3/gen-py3/test/fixtures/enumstrict/module/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cMyStruct] MyStruct_convert_to_cpp(object in cdef object MyStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyStruct]& c_struct): return _fbthrift_ctypes.MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/basic-stack-arguments/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/basic-stack-arguments/out/py3/gen-py3/module/converter.pyx index 44a8611c3bb..e56e2537a82 100644 --- a/thrift/compiler/test/fixtures/basic-stack-arguments/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/basic-stack-arguments/out/py3/gen-py3/module/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cMyStruct] MyStruct_convert_to_cpp(object in cdef object MyStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyStruct]& c_struct): return _fbthrift_ctypes.MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/converter.pyx b/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/converter.pyx index 0c08719931e..26ce31444a0 100644 --- a/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/converter.pyx +++ b/thrift/compiler/test/fixtures/basic/out/py3/gen-py3/test/fixtures/basic/module/converter.pyx @@ -57,3 +57,4 @@ cdef shared_ptr[_fbthrift_cbindings.cUnionToBeRenamed] UnionToBeRenamed_convert_ cdef object UnionToBeRenamed_from_cpp(const shared_ptr[_fbthrift_cbindings.cUnionToBeRenamed]& c_struct): return _fbthrift_ctypes.UnionToBeRenamed._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/converter.pyx index f1a1808e58c..4ff4c167df8 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/complex-union/out/py3/gen-py3/module/converter.pyx @@ -57,3 +57,4 @@ cdef shared_ptr[_fbthrift_cbindings.cNonCopyableUnion] NonCopyableUnion_convert_ cdef object NonCopyableUnion_from_cpp(const shared_ptr[_fbthrift_cbindings.cNonCopyableUnion]& c_struct): return _fbthrift_ctypes.NonCopyableUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/converter.pyx index 450188c2d1a..b2e53bdecb2 100644 --- a/thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/constants/out/py3/gen-py3/module/converter.pyx @@ -57,3 +57,4 @@ cdef shared_ptr[_fbthrift_cbindings.cunion2] union2_convert_to_cpp(object inst) cdef object union2_from_cpp(const shared_ptr[_fbthrift_cbindings.cunion2]& c_struct): return _fbthrift_ctypes.union2._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/converter.pyx index ceee398565e..a07cd843faf 100644 --- a/thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/empty-struct/out/py3/gen-py3/module/converter.pyx @@ -21,3 +21,4 @@ cdef shared_ptr[_fbthrift_cbindings.cNada] Nada_convert_to_cpp(object inst) exce cdef object Nada_from_cpp(const shared_ptr[_fbthrift_cbindings.cNada]& c_struct): return _fbthrift_ctypes.Nada._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/enums/out/py3/gen-py3/test/fixtures/enums/module/converter.pyx b/thrift/compiler/test/fixtures/enums/out/py3/gen-py3/test/fixtures/enums/module/converter.pyx index 40cc3fb46ee..629e095ecdd 100644 --- a/thrift/compiler/test/fixtures/enums/out/py3/gen-py3/test/fixtures/enums/module/converter.pyx +++ b/thrift/compiler/test/fixtures/enums/out/py3/gen-py3/test/fixtures/enums/module/converter.pyx @@ -21,3 +21,4 @@ cdef shared_ptr[_fbthrift_cbindings.cMyStruct] MyStruct_convert_to_cpp(object in cdef object MyStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyStruct]& c_struct): return _fbthrift_ctypes.MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/exceptions/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/exceptions/out/py3/gen-py3/module/converter.pyx index cb05f26d800..e6987a4451a 100644 --- a/thrift/compiler/test/fixtures/exceptions/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/exceptions/out/py3/gen-py3/module/converter.pyx @@ -51,3 +51,4 @@ cdef shared_ptr[_fbthrift_cbindings.cBanal] Banal_convert_to_cpp(object inst) ex cdef object Banal_from_cpp(const shared_ptr[_fbthrift_cbindings.cBanal]& c_struct): return _fbthrift_ctypes.Banal._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/includes/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/includes/converter.pyx index 742b81dd765..5c0e29dd70d 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/includes/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/includes/converter.pyx @@ -18,3 +18,4 @@ cdef shared_ptr[_fbthrift_cbindings.cIncluded] Included_convert_to_cpp(object in cdef object Included_from_cpp(const shared_ptr[_fbthrift_cbindings.cIncluded]& c_struct): return cpp_to_python[_fbthrift_cbindings.cIncluded](deref(c_struct)) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/module/converter.pyx index 95e303efdc0..70a488f8900 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/module/converter.pyx @@ -18,3 +18,4 @@ cdef shared_ptr[_fbthrift_cbindings.cMyStruct] MyStruct_convert_to_cpp(object in cdef object MyStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyStruct]& c_struct): return cpp_to_python[_fbthrift_cbindings.cMyStruct](deref(c_struct)) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/transitive/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/transitive/converter.pyx index 7ab8fe573eb..e76e674708d 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/transitive/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate/gen-py3/transitive/converter.pyx @@ -18,3 +18,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return cpp_to_python[_fbthrift_cbindings.cFoo](deref(c_struct)) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_includes/gen-py3/includes/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_includes/gen-py3/includes/converter.pyx index 178d093b644..6ecd6b45504 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_includes/gen-py3/includes/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_includes/gen-py3/includes/converter.pyx @@ -18,3 +18,4 @@ cdef shared_ptr[_fbthrift_cbindings.cIncluded] Included_convert_to_cpp(object in cdef object Included_from_cpp(const shared_ptr[_fbthrift_cbindings.cIncluded]& c_struct): return cpp_to_python[_fbthrift_cbindings.cIncluded](deref(c_struct)) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_includes/gen-py3/transitive/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_includes/gen-py3/transitive/converter.pyx index 7ab8fe573eb..e76e674708d 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_includes/gen-py3/transitive/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_includes/gen-py3/transitive/converter.pyx @@ -18,3 +18,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return cpp_to_python[_fbthrift_cbindings.cFoo](deref(c_struct)) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/includes/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/includes/converter.pyx index 742b81dd765..5c0e29dd70d 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/includes/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/includes/converter.pyx @@ -18,3 +18,4 @@ cdef shared_ptr[_fbthrift_cbindings.cIncluded] Included_convert_to_cpp(object in cdef object Included_from_cpp(const shared_ptr[_fbthrift_cbindings.cIncluded]& c_struct): return cpp_to_python[_fbthrift_cbindings.cIncluded](deref(c_struct)) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/module/converter.pyx index 93e36e135ab..da1a8d788ce 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/module/converter.pyx @@ -18,3 +18,4 @@ cdef shared_ptr[_fbthrift_cbindings.cMyStruct] MyStruct_convert_to_cpp(object in cdef object MyStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyStruct]& c_struct): return cpp_to_python[_fbthrift_cbindings.cMyStruct](deref(c_struct)) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/service/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/service/converter.pyx index 8102746fbd9..a951c653c44 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/service/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/service/converter.pyx @@ -13,3 +13,4 @@ from cython.operator cimport dereference as deref cdef extern from "thrift/compiler/test/fixtures/includes/gen-python-capi/service/thrift_types_capi.h": pass + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/transitive/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/transitive/converter.pyx index 7ab8fe573eb..e76e674708d 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/transitive/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_service/gen-py3/transitive/converter.pyx @@ -18,3 +18,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return cpp_to_python[_fbthrift_cbindings.cFoo](deref(c_struct)) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_transitive/gen-py3/transitive/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_transitive/gen-py3/transitive/converter.pyx index b011059f5c9..76517097999 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_transitive/gen-py3/transitive/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_auto_migrate_transitive/gen-py3/transitive/converter.pyx @@ -18,3 +18,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return cpp_to_python[_fbthrift_cbindings.cFoo](deref(c_struct)) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/includes/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/includes/converter.pyx index 66334e26652..6f2a9a4ea5d 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/includes/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/includes/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cIncluded] Included_convert_to_cpp(object in cdef object Included_from_cpp(const shared_ptr[_fbthrift_cbindings.cIncluded]& c_struct): return _fbthrift_ctypes.Included._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/matching_struct_names/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/matching_struct_names/converter.pyx index 43bba3cb1eb..d377c1de488 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/matching_struct_names/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/matching_struct_names/converter.pyx @@ -21,3 +21,4 @@ cdef shared_ptr[_fbthrift_cbindings.cCombo] Combo_convert_to_cpp(object inst) ex cdef object Combo_from_cpp(const shared_ptr[_fbthrift_cbindings.cCombo]& c_struct): return _fbthrift_ctypes.Combo._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/module/converter.pyx index 432299eb0dd..f98d5230ae9 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/module/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cMyStruct] MyStruct_convert_to_cpp(object in cdef object MyStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyStruct]& c_struct): return _fbthrift_ctypes.MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/transitive/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/transitive/converter.pyx index 8ac884112c8..dd1aa620fb2 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/transitive/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_matching_struct_names/gen-py3/transitive/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return _fbthrift_ctypes.Foo._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/includes/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/includes/converter.pyx index 66334e26652..6f2a9a4ea5d 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/includes/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/includes/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cIncluded] Included_convert_to_cpp(object in cdef object Included_from_cpp(const shared_ptr[_fbthrift_cbindings.cIncluded]& c_struct): return _fbthrift_ctypes.Included._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/module/converter.pyx index 432299eb0dd..f98d5230ae9 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/module/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cMyStruct] MyStruct_convert_to_cpp(object in cdef object MyStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cMyStruct]& c_struct): return _fbthrift_ctypes.MyStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/service/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/service/converter.pyx index e254379abcd..474dd3138a1 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/service/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/service/converter.pyx @@ -9,3 +9,4 @@ cimport service.types as _fbthrift_ctypes + diff --git a/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/transitive/converter.pyx b/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/transitive/converter.pyx index 8ac884112c8..dd1aa620fb2 100644 --- a/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/transitive/converter.pyx +++ b/thrift/compiler/test/fixtures/includes/out/py3_service/gen-py3/transitive/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return _fbthrift_ctypes.Foo._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/inheritance/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/inheritance/out/py3/gen-py3/module/converter.pyx index 1e893b9c708..31f80b49eac 100644 --- a/thrift/compiler/test/fixtures/inheritance/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/inheritance/out/py3/gen-py3/module/converter.pyx @@ -9,3 +9,4 @@ cimport module.types as _fbthrift_ctypes + diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/foo/converter.pyx b/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/foo/converter.pyx index a385763135b..b8f5ed34d59 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/foo/converter.pyx +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/foo/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFields] Fields_convert_to_cpp(object inst) cdef object Fields_from_cpp(const shared_ptr[_fbthrift_cbindings.cFields]& c_struct): return _fbthrift_ctypes.Fields._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/module/converter.pyx index c23d7c86b9d..cd959d310bd 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/py3/gen-py3/module/converter.pyx @@ -33,3 +33,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFieldsInjectedWithIncludedStruct] FieldsInj cdef object FieldsInjectedWithIncludedStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cFieldsInjectedWithIncludedStruct]& c_struct): return _fbthrift_ctypes.FieldsInjectedWithIncludedStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/int_limits/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/int_limits/out/py3/gen-py3/module/converter.pyx index 206e6749db1..7c55ba59f83 100644 --- a/thrift/compiler/test/fixtures/int_limits/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/int_limits/out/py3/gen-py3/module/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cLimits] Limits_convert_to_cpp(object inst) cdef object Limits_from_cpp(const shared_ptr[_fbthrift_cbindings.cLimits]& c_struct): return _fbthrift_ctypes.Limits._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/another_interactions/shared/converter.pyx b/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/another_interactions/shared/converter.pyx index 403b647a815..c615f904243 100644 --- a/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/another_interactions/shared/converter.pyx +++ b/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/another_interactions/shared/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cDoSomethingResult] DoSomethingResult_conver cdef object DoSomethingResult_from_cpp(const shared_ptr[_fbthrift_cbindings.cDoSomethingResult]& c_struct): return _fbthrift_ctypes.DoSomethingResult._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/interactions/module/converter.pyx b/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/interactions/module/converter.pyx index 72cdac23f4e..36dd599c100 100644 --- a/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/interactions/module/converter.pyx +++ b/thrift/compiler/test/fixtures/interactions/out/py3/gen-py3/test/fixtures/interactions/module/converter.pyx @@ -21,3 +21,4 @@ cdef shared_ptr[_fbthrift_cbindings.cShouldBeBoxed] ShouldBeBoxed_convert_to_cpp cdef object ShouldBeBoxed_from_cpp(const shared_ptr[_fbthrift_cbindings.cShouldBeBoxed]& c_struct): return _fbthrift_ctypes.ShouldBeBoxed._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/list/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/list/out/py3/gen-py3/module/converter.pyx index 460fed100fa..28bdbe193ef 100644 --- a/thrift/compiler/test/fixtures/list/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/list/out/py3/gen-py3/module/converter.pyx @@ -9,3 +9,4 @@ cimport module.types as _fbthrift_ctypes + diff --git a/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/includes/converter.pyx b/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/includes/converter.pyx index 5f7f515fb65..f55970c32b3 100644 --- a/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/includes/converter.pyx +++ b/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/includes/converter.pyx @@ -21,3 +21,4 @@ cdef shared_ptr[_fbthrift_cbindings.cAStructB] AStructB_convert_to_cpp(object in cdef object AStructB_from_cpp(const shared_ptr[_fbthrift_cbindings.cAStructB]& c_struct): return _fbthrift_ctypes.AStructB._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/module/converter.pyx index 709e72353eb..b8f10686966 100644 --- a/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/mcpp2-compare/out/py3/gen-py3/module/converter.pyx @@ -99,3 +99,4 @@ cdef shared_ptr[_fbthrift_cbindings.cAllRequiredNoExceptMoveCtrStruct] AllRequir cdef object AllRequiredNoExceptMoveCtrStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cAllRequiredNoExceptMoveCtrStruct]& c_struct): return _fbthrift_ctypes.AllRequiredNoExceptMoveCtrStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/mixin/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/mixin/out/py3/gen-py3/module/converter.pyx index d2ee8d951b7..d0b040fbcc3 100644 --- a/thrift/compiler/test/fixtures/mixin/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/mixin/out/py3/gen-py3/module/converter.pyx @@ -33,3 +33,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return _fbthrift_ctypes.Foo._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/namespace/out/py3/gen-py3/my/namespacing/test/module/module/converter.pyx b/thrift/compiler/test/fixtures/namespace/out/py3/gen-py3/my/namespacing/test/module/module/converter.pyx index dc9a4e256f2..1fd52570836 100644 --- a/thrift/compiler/test/fixtures/namespace/out/py3/gen-py3/my/namespacing/test/module/module/converter.pyx +++ b/thrift/compiler/test/fixtures/namespace/out/py3/gen-py3/my/namespacing/test/module/module/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return _fbthrift_ctypes.Foo._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/namespace/out/py3_emptyns/gen-py3/emptyns/converter.pyx b/thrift/compiler/test/fixtures/namespace/out/py3_emptyns/gen-py3/emptyns/converter.pyx index a3336f82909..c3e4071c210 100644 --- a/thrift/compiler/test/fixtures/namespace/out/py3_emptyns/gen-py3/emptyns/converter.pyx +++ b/thrift/compiler/test/fixtures/namespace/out/py3_emptyns/gen-py3/emptyns/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return _fbthrift_ctypes.Foo._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/extend/test/extend/converter.pyx b/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/extend/test/extend/converter.pyx index a041c471242..86b2fca350f 100644 --- a/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/extend/test/extend/converter.pyx +++ b/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/extend/test/extend/converter.pyx @@ -9,3 +9,4 @@ cimport my.namespacing.extend.test.extend.types as _fbthrift_ctypes + diff --git a/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/test/hsmodule/converter.pyx b/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/test/hsmodule/converter.pyx index 858f31b3a95..9d23acc205a 100644 --- a/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/test/hsmodule/converter.pyx +++ b/thrift/compiler/test/fixtures/namespace/out/py3_extend/gen-py3/my/namespacing/test/hsmodule/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cHsFoo] HsFoo_convert_to_cpp(object inst) ex cdef object HsFoo_from_cpp(const shared_ptr[_fbthrift_cbindings.cHsFoo]& c_struct): return _fbthrift_ctypes.HsFoo._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/namespace_from_package/out/py3/gen-py3/test/namespace_from_package/module/converter.pyx b/thrift/compiler/test/fixtures/namespace_from_package/out/py3/gen-py3/test/namespace_from_package/module/converter.pyx index 1222b2e13cb..790d0d92cc0 100644 --- a/thrift/compiler/test/fixtures/namespace_from_package/out/py3/gen-py3/test/namespace_from_package/module/converter.pyx +++ b/thrift/compiler/test/fixtures/namespace_from_package/out/py3/gen-py3/test/namespace_from_package/module/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return _fbthrift_ctypes.Foo._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/py3/gen-py3/test/namespace_from_package_without_module_name/module/converter.pyx b/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/py3/gen-py3/test/namespace_from_package_without_module_name/module/converter.pyx index 1d3a10a1ad3..529c9e7699f 100644 --- a/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/py3/gen-py3/test/namespace_from_package_without_module_name/module/converter.pyx +++ b/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/py3/gen-py3/test/namespace_from_package_without_module_name/module/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return _fbthrift_ctypes.Foo._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/optionals/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/optionals/out/py3/gen-py3/module/converter.pyx index 8e55bc796e9..a5504e898d9 100644 --- a/thrift/compiler/test/fixtures/optionals/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/optionals/out/py3/gen-py3/module/converter.pyx @@ -27,3 +27,4 @@ cdef shared_ptr[_fbthrift_cbindings.cPerson] Person_convert_to_cpp(object inst) cdef object Person_from_cpp(const shared_ptr[_fbthrift_cbindings.cPerson]& c_struct): return _fbthrift_ctypes.Person._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/params/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/params/out/py3/gen-py3/module/converter.pyx index 8609db2408d..419654537be 100644 --- a/thrift/compiler/test/fixtures/params/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/params/out/py3/gen-py3/module/converter.pyx @@ -9,3 +9,4 @@ cimport module.types as _fbthrift_ctypes + diff --git a/thrift/compiler/test/fixtures/py3/cmd b/thrift/compiler/test/fixtures/py3/cmd index 8f3022bd359..445e3a8240c 100644 --- a/thrift/compiler/test/fixtures/py3/cmd +++ b/thrift/compiler/test/fixtures/py3/cmd @@ -7,3 +7,4 @@ python_capi: mstch_python_capi src/module.thrift python_capi_empty: mstch_python_capi src/empty.thrift python: mstch_python:auto_migrate,base_library_package=fbcode.thrift.python,import_static src/module.thrift py3_auto_migrate: mstch_py3:auto_migrate src/module.thrift +py3_legacy_container_converters: mstch_py3:gen_legacy_container_converters src/module.thrift diff --git a/thrift/compiler/test/fixtures/py3/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/py3/out/py3/gen-py3/module/converter.pyx index 9c81a1d2db7..1636f94eabf 100644 --- a/thrift/compiler/test/fixtures/py3/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/py3/out/py3/gen-py3/module/converter.pyx @@ -69,3 +69,4 @@ cdef shared_ptr[_fbthrift_cbindings.cAdaptedTypedefFields] AdaptedTypedefFields_ cdef object AdaptedTypedefFields_from_cpp(const shared_ptr[_fbthrift_cbindings.cAdaptedTypedefFields]& c_struct): return _fbthrift_ctypes.AdaptedTypedefFields._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_auto_migrate/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/py3/out/py3_auto_migrate/gen-py3/module/converter.pyx index 3f71792c95b..2fe9c0a5ae1 100644 --- a/thrift/compiler/test/fixtures/py3/out/py3_auto_migrate/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/py3/out/py3_auto_migrate/gen-py3/module/converter.pyx @@ -63,3 +63,4 @@ cdef shared_ptr[_fbthrift_cbindings.cAdaptedTypedefFields] AdaptedTypedefFields_ cdef object AdaptedTypedefFields_from_cpp(const shared_ptr[_fbthrift_cbindings.cAdaptedTypedefFields]& c_struct): return cpp_to_python[_fbthrift_cbindings.cAdaptedTypedefFields](deref(c_struct)) + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_empty/gen-py3/empty/converter.pyx b/thrift/compiler/test/fixtures/py3/out/py3_empty/gen-py3/empty/converter.pyx index 25b7a914435..c68ae151757 100644 --- a/thrift/compiler/test/fixtures/py3/out/py3_empty/gen-py3/empty/converter.pyx +++ b/thrift/compiler/test/fixtures/py3/out/py3_empty/gen-py3/empty/converter.pyx @@ -9,3 +9,4 @@ cimport empty.types as _fbthrift_ctypes + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/cpp/metadata.cpp b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/cpp/metadata.cpp new file mode 100644 index 00000000000..99336148826 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/cpp/metadata.cpp @@ -0,0 +1,43 @@ +/** + * Autogenerated by Thrift for thrift/annotation/cpp.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#include "thrift/compiler/test/fixtures/py3/gen-py3/cpp/metadata.h" + +namespace facebook { +namespace thrift { +namespace annotation { +namespace cpp { +::apache::thrift::metadata::ThriftMetadata cpp_getThriftModuleMetadata() { + ::apache::thrift::metadata::ThriftServiceMetadataResponse response; + ::apache::thrift::metadata::ThriftMetadata& metadata = *response.metadata_ref(); + ::apache::thrift::detail::md::EnumMetadata::gen(metadata); + ::apache::thrift::detail::md::EnumMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + return metadata; +} +} // namespace facebook +} // namespace thrift +} // namespace annotation +} // namespace cpp diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/cpp/metadata.h b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/cpp/metadata.h new file mode 100644 index 00000000000..83c7f49a082 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/cpp/metadata.h @@ -0,0 +1,22 @@ +/** + * Autogenerated by Thrift for thrift/annotation/cpp.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#pragma once + +#include + +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/cpp_metadata.h" + +namespace facebook { +namespace thrift { +namespace annotation { +namespace cpp { +::apache::thrift::metadata::ThriftMetadata cpp_getThriftModuleMetadata(); +} // namespace facebook +} // namespace thrift +} // namespace annotation +} // namespace cpp diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/cpp/types.h b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/cpp/types.h new file mode 100644 index 00000000000..4d8d9e1e82a --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/cpp/types.h @@ -0,0 +1,386 @@ +/** + * Autogenerated by Thrift for thrift/annotation/cpp.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#pragma once + +#include +#include + +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/cpp_data.h" +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/cpp_types.h" +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/cpp_metadata.h" +namespace thrift { +namespace py3 { + + + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::Name>( + ::facebook::thrift::annotation::cpp::Name& obj, uint16_t index) { + switch (index) { + case 0: + obj.value_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::Name>().value_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::Type>( + ::facebook::thrift::annotation::cpp::Type& obj, uint16_t index) { + switch (index) { + case 0: + obj.name_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::Type>().name_ref()); + return; + case 1: + obj.template__ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::Type>().template__ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::Ref>( + ::facebook::thrift::annotation::cpp::Ref& obj, uint16_t index) { + switch (index) { + case 0: + obj.type_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::Ref>().type_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::Lazy>( + ::facebook::thrift::annotation::cpp::Lazy& obj, uint16_t index) { + switch (index) { + case 0: + obj.ref_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::Lazy>().ref_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::DisableLazyChecksum>( + ::facebook::thrift::annotation::cpp::DisableLazyChecksum& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::Adapter>( + ::facebook::thrift::annotation::cpp::Adapter& obj, uint16_t index) { + switch (index) { + case 0: + obj.name_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::Adapter>().name_ref()); + return; + case 1: + obj.adaptedType_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::Adapter>().adaptedType_ref()); + return; + case 2: + obj.underlyingName_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::Adapter>().underlyingName_ref()); + return; + case 3: + obj.extraNamespace_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::Adapter>().extraNamespace_ref()); + return; + case 4: + obj.moveOnly_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::Adapter>().moveOnly_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::PackIsset>( + ::facebook::thrift::annotation::cpp::PackIsset& obj, uint16_t index) { + switch (index) { + case 0: + obj.atomic_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::PackIsset>().atomic_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::MinimizePadding>( + ::facebook::thrift::annotation::cpp::MinimizePadding& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::ScopedEnumAsUnionType>( + ::facebook::thrift::annotation::cpp::ScopedEnumAsUnionType& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::FieldInterceptor>( + ::facebook::thrift::annotation::cpp::FieldInterceptor& obj, uint16_t index) { + switch (index) { + case 0: + obj.name_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::FieldInterceptor>().name_ref()); + return; + case 1: + obj.noinline_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::FieldInterceptor>().noinline_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::UseOpEncode>( + ::facebook::thrift::annotation::cpp::UseOpEncode& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::EnumType>( + ::facebook::thrift::annotation::cpp::EnumType& obj, uint16_t index) { + switch (index) { + case 0: + obj.type_ref().copy_from(default_inst<::facebook::thrift::annotation::cpp::EnumType>().type_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::Frozen2Exclude>( + ::facebook::thrift::annotation::cpp::Frozen2Exclude& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::Frozen2RequiresCompleteContainerParams>( + ::facebook::thrift::annotation::cpp::Frozen2RequiresCompleteContainerParams& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::ProcessInEbThreadUnsafe>( + ::facebook::thrift::annotation::cpp::ProcessInEbThreadUnsafe& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::RuntimeAnnotation>( + ::facebook::thrift::annotation::cpp::RuntimeAnnotation& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::UseCursorSerialization>( + ::facebook::thrift::annotation::cpp::UseCursorSerialization& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::GenerateDeprecatedHeaderClientMethods>( + ::facebook::thrift::annotation::cpp::GenerateDeprecatedHeaderClientMethods& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::cpp::AllowLegacyNonOptionalRef>( + ::facebook::thrift::annotation::cpp::AllowLegacyNonOptionalRef& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::Name>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::Type>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::Ref>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::Lazy>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::DisableLazyChecksum>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::Adapter>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::PackIsset>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::MinimizePadding>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::ScopedEnumAsUnionType>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::FieldInterceptor>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::UseOpEncode>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::EnumType>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::Frozen2Exclude>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::Frozen2RequiresCompleteContainerParams>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::ProcessInEbThreadUnsafe>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::RuntimeAnnotation>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::UseCursorSerialization>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::GenerateDeprecatedHeaderClientMethods>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::cpp::AllowLegacyNonOptionalRef>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} +} // namespace py3 +} // namespace thrift diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/builders.py b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/builders.py new file mode 100644 index 00000000000..a0d581aa6d3 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/builders.py @@ -0,0 +1,193 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# +import typing as _typing + +import folly.iobuf as _fbthrift_iobuf +import thrift.py3.builder + + +import module.types as _module_types + + +_fbthrift_struct_type__SimpleException = _module_types.SimpleException +class SimpleException_Builder(thrift.py3.builder.StructBuilder): + _struct_type = _fbthrift_struct_type__SimpleException + + def __init__(self): + self.err_code: _typing.Optional[int] = None + + def __iter__(self): + yield "err_code", self.err_code + +_fbthrift_struct_type__OptionalRefStruct = _module_types.OptionalRefStruct +class OptionalRefStruct_Builder(thrift.py3.builder.StructBuilder): + _struct_type = _fbthrift_struct_type__OptionalRefStruct + + def __init__(self): + self.optional_blob: _typing.Optional[_fbthrift_iobuf.IOBuf] = None + + def __iter__(self): + yield "optional_blob", self.optional_blob + +_fbthrift_struct_type__SimpleStruct = _module_types.SimpleStruct +class SimpleStruct_Builder(thrift.py3.builder.StructBuilder): + _struct_type = _fbthrift_struct_type__SimpleStruct + + def __init__(self): + self.is_on: _typing.Optional[bool] = None + self.tiny_int: _typing.Optional[int] = None + self.small_int: _typing.Optional[int] = None + self.nice_sized_int: _typing.Optional[int] = None + self.big_int: _typing.Optional[int] = None + self.real: _typing.Optional[float] = None + self.smaller_real: _typing.Optional[float] = None + self.something: _typing.Optional[dict] = None + + def __iter__(self): + yield "is_on", self.is_on + yield "tiny_int", self.tiny_int + yield "small_int", self.small_int + yield "nice_sized_int", self.nice_sized_int + yield "big_int", self.big_int + yield "real", self.real + yield "smaller_real", self.smaller_real + yield "something", self.something + +_fbthrift_struct_type__HiddenTypeFieldsStruct = _module_types.HiddenTypeFieldsStruct +class HiddenTypeFieldsStruct_Builder(thrift.py3.builder.StructBuilder): + _struct_type = _fbthrift_struct_type__HiddenTypeFieldsStruct + + def __init__(self): + pass + + def __iter__(self): + pass + +_fbthrift_struct_type__ComplexStruct = _module_types.ComplexStruct +class ComplexStruct_Builder(thrift.py3.builder.StructBuilder): + _struct_type = _fbthrift_struct_type__ComplexStruct + + def __init__(self): + self.structOne: _typing.Any = None + self.structTwo: _typing.Any = None + self.an_integer: _typing.Optional[int] = None + self.name: _typing.Optional[str] = None + self.an_enum: _typing.Optional[_module_types.AnEnum] = None + self.some_bytes: _typing.Optional[bytes] = None + self.sender: _typing.Optional[str] = None + self.cdef_: _typing.Optional[str] = None + self.bytes_with_cpp_type: _typing.Optional[bytes] = None + + def __iter__(self): + yield "structOne", self.structOne + yield "structTwo", self.structTwo + yield "an_integer", self.an_integer + yield "name", self.name + yield "an_enum", self.an_enum + yield "some_bytes", self.some_bytes + yield "sender", self.sender + yield "cdef_", self.cdef_ + yield "bytes_with_cpp_type", self.bytes_with_cpp_type + +_fbthrift_struct_type__BinaryUnion = _module_types.BinaryUnion +class BinaryUnion_Builder(thrift.py3.builder.StructBuilder): + _struct_type = _fbthrift_struct_type__BinaryUnion + + def __init__(self): + self.iobuf_val: _typing.Optional[_fbthrift_iobuf.IOBuf] = None + + def __iter__(self): + yield "iobuf_val", self.iobuf_val + +_fbthrift_struct_type__BinaryUnionStruct = _module_types.BinaryUnionStruct +class BinaryUnionStruct_Builder(thrift.py3.builder.StructBuilder): + _struct_type = _fbthrift_struct_type__BinaryUnionStruct + + def __init__(self): + self.u: _typing.Any = None + + def __iter__(self): + yield "u", self.u + +_fbthrift_struct_type__CustomFields = _module_types.CustomFields +class CustomFields_Builder(thrift.py3.builder.StructBuilder): + _struct_type = _fbthrift_struct_type__CustomFields + + def __init__(self): + self.bool_field: _typing.Optional[bool] = None + self.integer_field: _typing.Optional[int] = None + self.double_field: _typing.Optional[float] = None + self.string_field: _typing.Optional[str] = None + self.binary_field: _typing.Optional[bytes] = None + self.list_field: _typing.Optional[list] = None + self.set_field: _typing.Optional[set] = None + self.map_field: _typing.Optional[dict] = None + self.struct_field: _typing.Any = None + + def __iter__(self): + yield "bool_field", self.bool_field + yield "integer_field", self.integer_field + yield "double_field", self.double_field + yield "string_field", self.string_field + yield "binary_field", self.binary_field + yield "list_field", self.list_field + yield "set_field", self.set_field + yield "map_field", self.map_field + yield "struct_field", self.struct_field + +_fbthrift_struct_type__CustomTypedefFields = _module_types.CustomTypedefFields +class CustomTypedefFields_Builder(thrift.py3.builder.StructBuilder): + _struct_type = _fbthrift_struct_type__CustomTypedefFields + + def __init__(self): + self.bool_field: _typing.Optional[bool] = None + self.integer_field: _typing.Optional[int] = None + self.double_field: _typing.Optional[float] = None + self.string_field: _typing.Optional[str] = None + self.binary_field: _typing.Optional[bytes] = None + self.list_field: _typing.Optional[list] = None + self.set_field: _typing.Optional[set] = None + self.map_field: _typing.Optional[dict] = None + self.struct_field: _typing.Any = None + + def __iter__(self): + yield "bool_field", self.bool_field + yield "integer_field", self.integer_field + yield "double_field", self.double_field + yield "string_field", self.string_field + yield "binary_field", self.binary_field + yield "list_field", self.list_field + yield "set_field", self.set_field + yield "map_field", self.map_field + yield "struct_field", self.struct_field + +_fbthrift_struct_type__AdaptedTypedefFields = _module_types.AdaptedTypedefFields +class AdaptedTypedefFields_Builder(thrift.py3.builder.StructBuilder): + _struct_type = _fbthrift_struct_type__AdaptedTypedefFields + + def __init__(self): + self.bool_field: _typing.Optional[bool] = None + self.integer_field: _typing.Optional[int] = None + self.double_field: _typing.Optional[float] = None + self.string_field: _typing.Optional[str] = None + self.binary_field: _typing.Optional[bytes] = None + self.list_field: _typing.Optional[list] = None + self.set_field: _typing.Optional[set] = None + self.map_field: _typing.Optional[dict] = None + self.struct_field: _typing.Any = None + + def __iter__(self): + yield "bool_field", self.bool_field + yield "integer_field", self.integer_field + yield "double_field", self.double_field + yield "string_field", self.string_field + yield "binary_field", self.binary_field + yield "list_field", self.list_field + yield "set_field", self.set_field + yield "map_field", self.map_field + yield "struct_field", self.struct_field + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/cbindings.pxd b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/cbindings.pxd new file mode 100644 index 00000000000..247e1dd1cfe --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/cbindings.pxd @@ -0,0 +1,488 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# +from libc.stdint cimport ( + int8_t as cint8_t, + int16_t as cint16_t, + int32_t as cint32_t, + int64_t as cint64_t, + uint16_t as cuint16_t, + uint32_t as cuint32_t, +) +from libcpp.string cimport string +from libcpp cimport bool as cbool, nullptr, nullptr_t +from cpython cimport bool as pbool +from libcpp.memory cimport shared_ptr, unique_ptr +from libcpp.vector cimport vector +from libcpp.set cimport set as cset +from libcpp.map cimport map as cmap, pair as cpair +from libcpp.unordered_map cimport unordered_map as cumap +cimport folly.iobuf as _fbthrift_iobuf +from thrift.python.exceptions cimport cTException +from thrift.py3.types cimport ( + bstring, + field_ref as __field_ref, + optional_field_ref as __optional_field_ref, + required_field_ref as __required_field_ref, + terse_field_ref as __terse_field_ref, + union_field_ref as __union_field_ref, + get_union_field_value as __get_union_field_value, +) +from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata + + +cdef extern from * nogil: + cdef cppclass _std_unordered_map "::std::unordered_map"[T, U]: + ctypedef T key_type + ctypedef U mapped_type + ctypedef size_t size_type + + cppclass iterator: + cpair[T, U]& operator*() + iterator operator++() + bint operator==(iterator) + bint operator!=(iterator) + cppclass reverse_iterator: + cpair[T, U]& operator*() + iterator operator++() + bint operator==(reverse_iterator) + bint operator!=(reverse_iterator) + cppclass const_iterator(iterator): + pass + cppclass const_reverse_iterator(reverse_iterator): + pass + + _std_unordered_map() except + + _std_unordered_map(_std_unordered_map&) except + + + U& operator[](T&) + iterator find(const T&) + const_iterator const_find "find"(const T&) + size_type count(const T&) + size_type size() + iterator begin() + const_iterator const_begin "begin"() + iterator end() + const_iterator const_end "end"() + reverse_iterator rbegin() + const_reverse_iterator const_rbegin "rbegin"() + reverse_iterator rend() + const_reverse_iterator const_rend "rend"() + void clear() + bint empty() + +cdef extern from *: + ctypedef bstring foo_Bar "foo::Bar" +cdef extern from *: + ctypedef cbool _MyType "::MyType" +cdef extern from *: + ctypedef cint64_t _MyType "::MyType" +cdef extern from *: + ctypedef double _MyType "::MyType" +cdef extern from *: + ctypedef string _MyType "::MyType" +cdef extern from *: + ctypedef bstring _MyType "::MyType" +cdef extern from * nogil: + cdef cppclass _MyType "::MyType": + ctypedef cint32_t value_type + ctypedef size_t size_type + + cppclass iterator: + cint32_t& operator*() + iterator operator++() + bint operator==(iterator) + bint operator!=(iterator) + cppclass reverse_iterator: + cint32_t& operator*() + iterator operator++() + bint operator==(reverse_iterator) + bint operator!=(reverse_iterator) + cppclass const_iterator(iterator): + pass + cppclass const_reverse_iterator(reverse_iterator): + pass + + _MyType() except + + _MyType(_MyType&) except + + + cint32_t& operator[](size_type) + void push_back(cint32_t&) except + + size_type size() + iterator begin() + const_iterator const_begin "begin"() + iterator end() + const_iterator const_end "end"() + reverse_iterator rbegin() + const_reverse_iterator const_rbegin "rbegin"() + reverse_iterator rend() + const_reverse_iterator const_rend "rend"() + void clear() + bint empty() + +cdef extern from * nogil: + cdef cppclass _MyType "::MyType": + ctypedef cint32_t value_type + ctypedef size_t size_type + + cppclass iterator: + cint32_t& operator*() + iterator operator++() + bint operator==(iterator) + bint operator!=(iterator) + cppclass reverse_iterator: + cint32_t& operator*() + iterator operator++() + bint operator==(reverse_iterator) + bint operator!=(reverse_iterator) + cppclass const_iterator(iterator): + pass + cppclass const_reverse_iterator(reverse_iterator): + pass + + _MyType() except + + _MyType(_MyType&) except + + + cpair[iterator, bint] insert(const cint32_t&) except + + size_type size() + size_type count(const cint32_t&) + iterator begin() + const_iterator const_begin "begin"() + iterator end() + const_iterator const_end "end"() + reverse_iterator rbegin() + const_reverse_iterator const_rbegin "rbegin"() + reverse_iterator rend() + const_reverse_iterator const_rend "rend"() + void clear() + bint empty() + +cdef extern from * nogil: + cdef cppclass _MyType "::MyType": + ctypedef cint32_t key_type + ctypedef cint32_t mapped_type + ctypedef size_t size_type + + cppclass iterator: + cpair[cint32_t, cint32_t]& operator*() + iterator operator++() + bint operator==(iterator) + bint operator!=(iterator) + cppclass reverse_iterator: + cpair[cint32_t, cint32_t]& operator*() + iterator operator++() + bint operator==(reverse_iterator) + bint operator!=(reverse_iterator) + cppclass const_iterator(iterator): + pass + cppclass const_reverse_iterator(reverse_iterator): + pass + + _MyType() except + + _MyType(_MyType&) except + + + cint32_t& operator[](cint32_t&) + iterator find(const cint32_t&) + const_iterator const_find "find"(const cint32_t&) + size_type count(const cint32_t&) + size_type size() + iterator begin() + const_iterator const_begin "begin"() + iterator end() + const_iterator const_end "end"() + reverse_iterator rbegin() + const_reverse_iterator const_rbegin "rbegin"() + reverse_iterator rend() + const_reverse_iterator const_rend "rend"() + void clear() + bint empty() + +cdef extern from *: + ctypedef string _py3_simple_AdaptedString "::py3::simple::AdaptedString" +cdef extern from *: + ctypedef bstring _py3_simple_AdaptedBinary "::py3::simple::AdaptedBinary" +cdef extern from * nogil: + cdef cppclass _py3_simple_AdaptedList "::py3::simple::AdaptedList": + ctypedef cint32_t value_type + ctypedef size_t size_type + + cppclass iterator: + cint32_t& operator*() + iterator operator++() + bint operator==(iterator) + bint operator!=(iterator) + cppclass reverse_iterator: + cint32_t& operator*() + iterator operator++() + bint operator==(reverse_iterator) + bint operator!=(reverse_iterator) + cppclass const_iterator(iterator): + pass + cppclass const_reverse_iterator(reverse_iterator): + pass + + _py3_simple_AdaptedList() except + + _py3_simple_AdaptedList(_py3_simple_AdaptedList&) except + + + cint32_t& operator[](size_type) + void push_back(cint32_t&) except + + size_type size() + iterator begin() + const_iterator const_begin "begin"() + iterator end() + const_iterator const_end "end"() + reverse_iterator rbegin() + const_reverse_iterator const_rbegin "rbegin"() + reverse_iterator rend() + const_reverse_iterator const_rend "rend"() + void clear() + bint empty() + +cdef extern from * nogil: + cdef cppclass _py3_simple_AdaptedSet "::py3::simple::AdaptedSet": + ctypedef cint32_t value_type + ctypedef size_t size_type + + cppclass iterator: + cint32_t& operator*() + iterator operator++() + bint operator==(iterator) + bint operator!=(iterator) + cppclass reverse_iterator: + cint32_t& operator*() + iterator operator++() + bint operator==(reverse_iterator) + bint operator!=(reverse_iterator) + cppclass const_iterator(iterator): + pass + cppclass const_reverse_iterator(reverse_iterator): + pass + + _py3_simple_AdaptedSet() except + + _py3_simple_AdaptedSet(_py3_simple_AdaptedSet&) except + + + cpair[iterator, bint] insert(const cint32_t&) except + + size_type size() + size_type count(const cint32_t&) + iterator begin() + const_iterator const_begin "begin"() + iterator end() + const_iterator const_end "end"() + reverse_iterator rbegin() + const_reverse_iterator const_rbegin "rbegin"() + reverse_iterator rend() + const_reverse_iterator const_rend "rend"() + void clear() + bint empty() + +cdef extern from * nogil: + cdef cppclass _py3_simple_AdaptedMap "::py3::simple::AdaptedMap": + ctypedef cint32_t key_type + ctypedef cint32_t mapped_type + ctypedef size_t size_type + + cppclass iterator: + cpair[cint32_t, cint32_t]& operator*() + iterator operator++() + bint operator==(iterator) + bint operator!=(iterator) + cppclass reverse_iterator: + cpair[cint32_t, cint32_t]& operator*() + iterator operator++() + bint operator==(reverse_iterator) + bint operator!=(reverse_iterator) + cppclass const_iterator(iterator): + pass + cppclass const_reverse_iterator(reverse_iterator): + pass + + _py3_simple_AdaptedMap() except + + _py3_simple_AdaptedMap(_py3_simple_AdaptedMap&) except + + + cint32_t& operator[](cint32_t&) + iterator find(const cint32_t&) + const_iterator const_find "find"(const cint32_t&) + size_type count(const cint32_t&) + size_type size() + iterator begin() + const_iterator const_begin "begin"() + iterator end() + const_iterator const_end "end"() + reverse_iterator rbegin() + const_reverse_iterator const_rbegin "rbegin"() + reverse_iterator rend() + const_reverse_iterator const_rend "rend"() + void clear() + bint empty() + + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-cpp2/module_metadata.h" namespace "apache::thrift::detail::md": + cdef cppclass EnumMetadata[T]: + @staticmethod + void gen(__fbthrift_cThriftMetadata &metadata) +cdef extern from "thrift/compiler/test/fixtures/py3/gen-cpp2/module_types.h" namespace "::py3::simple": + cdef cppclass cAnEnum "::py3::simple::AnEnum": + pass + + cdef cppclass cAnEnumRenamed "::py3::simple::AnEnumRenamed": + pass + + cdef cppclass cFlags "::py3::simple::Flags": + pass + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-cpp2/module_metadata.h" namespace "apache::thrift::detail::md": + cdef cppclass ExceptionMetadata[T]: + @staticmethod + void gen(__fbthrift_cThriftMetadata &metadata) +cdef extern from "thrift/compiler/test/fixtures/py3/gen-cpp2/module_metadata.h" namespace "apache::thrift::detail::md": + cdef cppclass StructMetadata[T]: + @staticmethod + void gen(__fbthrift_cThriftMetadata &metadata) +cdef extern from "thrift/compiler/test/fixtures/py3/gen-cpp2/module_types_custom_protocol.h" namespace "::py3::simple": + + cdef cppclass cSimpleException "::py3::simple::SimpleException"(cTException): + cSimpleException() except + + cSimpleException(const cSimpleException&) except + + bint operator==(cSimpleException&) + bint operator!=(cSimpleException&) + bint operator<(cSimpleException&) + bint operator>(cSimpleException&) + bint operator<=(cSimpleException&) + bint operator>=(cSimpleException&) + __field_ref[cint16_t] err_code_ref "err_code_ref" () + + + cdef cppclass cOptionalRefStruct "::py3::simple::OptionalRefStruct": + cOptionalRefStruct() except + + cOptionalRefStruct(const cOptionalRefStruct&) except + + bint operator==(cOptionalRefStruct&) + bint operator!=(cOptionalRefStruct&) + bint operator<(cOptionalRefStruct&) + bint operator>(cOptionalRefStruct&) + bint operator<=(cOptionalRefStruct&) + bint operator>=(cOptionalRefStruct&) + __optional_field_ref[unique_ptr[_fbthrift_iobuf.cIOBuf]] optional_blob_ref "optional_blob_ref" () + + + cdef cppclass cSimpleStruct "::py3::simple::SimpleStruct": + cSimpleStruct() except + + cSimpleStruct(const cSimpleStruct&) except + + bint operator==(cSimpleStruct&) + bint operator!=(cSimpleStruct&) + __field_ref[cbool] is_on_ref "is_on_ref" () + __field_ref[cint8_t] tiny_int_ref "tiny_int_ref" () + __field_ref[cint16_t] small_int_ref "small_int_ref" () + __field_ref[cint32_t] nice_sized_int_ref "nice_sized_int_ref" () + __field_ref[cint64_t] big_int_ref "big_int_ref" () + __field_ref[double] real_ref "real_ref" () + __field_ref[float] smaller_real_ref "smaller_real_ref" () + __field_ref[_std_unordered_map[cint32_t,cint32_t]] something_ref "something_ref" () + + + cdef cppclass cHiddenTypeFieldsStruct "::py3::simple::HiddenTypeFieldsStruct": + cHiddenTypeFieldsStruct() except + + cHiddenTypeFieldsStruct(const cHiddenTypeFieldsStruct&) except + + bint operator==(cHiddenTypeFieldsStruct&) + bint operator!=(cHiddenTypeFieldsStruct&) + + + cdef cppclass cComplexStruct "::py3::simple::ComplexStruct": + cComplexStruct() except + + cComplexStruct(const cComplexStruct&) except + + bint operator==(cComplexStruct&) + bint operator!=(cComplexStruct&) + __field_ref[cSimpleStruct] structOne_ref "structOne_ref" () + __field_ref[cSimpleStruct] structTwo_ref "structTwo_ref" () + __field_ref[cint32_t] an_integer_ref "an_integer_ref" () + __field_ref[string] name_ref "name_ref" () + __field_ref[cAnEnum] an_enum_ref "an_enum_ref" () + __field_ref[string] some_bytes_ref "some_bytes_ref" () + __field_ref[string] sender_ref "from_ref" () + __field_ref[string] cdef__ref "cdef_ref" () + __field_ref[foo_Bar] bytes_with_cpp_type_ref "bytes_with_cpp_type_ref" () + + cdef enum cBinaryUnion__type "::py3::simple::BinaryUnion::Type": + cBinaryUnion__type___EMPTY__ "::py3::simple::BinaryUnion::Type::__EMPTY__", + cBinaryUnion__type_iobuf_val "::py3::simple::BinaryUnion::Type::iobuf_val", + + cdef cppclass cBinaryUnion "::py3::simple::BinaryUnion": + cBinaryUnion() except + + cBinaryUnion(const cBinaryUnion&) except + + cBinaryUnion__type getType() const + const _fbthrift_iobuf.cIOBuf& get_iobuf_val "get_iobuf_val" () const + _fbthrift_iobuf.cIOBuf& set_iobuf_val "set_iobuf_val" (const _fbthrift_iobuf.cIOBuf&) + + + cdef cppclass cBinaryUnionStruct "::py3::simple::BinaryUnionStruct": + cBinaryUnionStruct() except + + cBinaryUnionStruct(const cBinaryUnionStruct&) except + + __field_ref[cBinaryUnion] u_ref "u_ref" () + + + cdef cppclass cCustomFields "::py3::simple::CustomFields": + cCustomFields() except + + cCustomFields(const cCustomFields&) except + + bint operator==(cCustomFields&) + bint operator!=(cCustomFields&) + __field_ref[_MyType] bool_field_ref "bool_field_ref" () + __field_ref[_MyType] integer_field_ref "integer_field_ref" () + __field_ref[_MyType] double_field_ref "double_field_ref" () + __field_ref[_MyType] string_field_ref "string_field_ref" () + __field_ref[_MyType] binary_field_ref "binary_field_ref" () + __field_ref[_MyType] list_field_ref "list_field_ref" () + __field_ref[_MyType] set_field_ref "set_field_ref" () + __field_ref[_MyType] map_field_ref "map_field_ref" () + __field_ref[cSimpleStruct] struct_field_ref "struct_field_ref" () + + + cdef cppclass cCustomTypedefFields "::py3::simple::CustomTypedefFields": + cCustomTypedefFields() except + + cCustomTypedefFields(const cCustomTypedefFields&) except + + bint operator==(cCustomTypedefFields&) + bint operator!=(cCustomTypedefFields&) + __field_ref[_MyType] bool_field_ref "bool_field_ref" () + __field_ref[_MyType] integer_field_ref "integer_field_ref" () + __field_ref[_MyType] double_field_ref "double_field_ref" () + __field_ref[_MyType] string_field_ref "string_field_ref" () + __field_ref[_MyType] binary_field_ref "binary_field_ref" () + __field_ref[_MyType] list_field_ref "list_field_ref" () + __field_ref[_MyType] set_field_ref "set_field_ref" () + __field_ref[_MyType] map_field_ref "map_field_ref" () + __field_ref[cSimpleStruct] struct_field_ref "struct_field_ref" () + + + cdef cppclass cAdaptedTypedefFields "::py3::simple::AdaptedTypedefFields": + cAdaptedTypedefFields() except + + cAdaptedTypedefFields(const cAdaptedTypedefFields&) except + + bint operator==(cAdaptedTypedefFields&) + bint operator!=(cAdaptedTypedefFields&) + __field_ref[cbool] bool_field_ref "bool_field_ref" () + __field_ref[cint64_t] integer_field_ref "integer_field_ref" () + __field_ref[double] double_field_ref "double_field_ref" () + __field_ref[_py3_simple_AdaptedString] string_field_ref "string_field_ref" () + __field_ref[_py3_simple_AdaptedBinary] binary_field_ref "binary_field_ref" () + __field_ref[_py3_simple_AdaptedList] list_field_ref "list_field_ref" () + __field_ref[_py3_simple_AdaptedSet] set_field_ref "set_field_ref" () + __field_ref[_py3_simple_AdaptedMap] map_field_ref "map_field_ref" () + __field_ref[cSimpleStruct] struct_field_ref "struct_field_ref" () + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-cpp2/module_constants.h" namespace "::py3::simple": + cdef cbool cA_BOOL "::py3::simple::module_constants::A_BOOL" + cdef cint8_t cA_BYTE "::py3::simple::module_constants::A_BYTE" + cdef cint16_t cTHE_ANSWER "::py3::simple::module_constants::THE_ANSWER" + cdef cint32_t cA_NUMBER "::py3::simple::module_constants::A_NUMBER" + cdef cint64_t cA_BIG_NUMBER "::py3::simple::module_constants::A_BIG_NUMBER" + cdef double cA_REAL_NUMBER "::py3::simple::module_constants::A_REAL_NUMBER" + cdef double cA_FAKE_NUMBER "::py3::simple::module_constants::A_FAKE_NUMBER" + cdef const char* cA_WORD "::py3::simple::module_constants::A_WORD"() + cdef string cSOME_BYTES "::py3::simple::module_constants::SOME_BYTES"() + cdef cSimpleStruct cA_STRUCT "::py3::simple::module_constants::A_STRUCT"() + cdef cSimpleStruct cEMPTY "::py3::simple::module_constants::EMPTY"() + cdef vector[string] cWORD_LIST "::py3::simple::module_constants::WORD_LIST"() + cdef vector[cmap[cint32_t,double]] cSOME_MAP "::py3::simple::module_constants::SOME_MAP"() + cdef cset[cint32_t] cDIGITS "::py3::simple::module_constants::DIGITS"() + cdef cmap[string,cSimpleStruct] cA_CONST_MAP "::py3::simple::module_constants::A_CONST_MAP"() + cdef cmap[cAnEnumRenamed,cint32_t] cANOTHER_CONST_MAP "::py3::simple::module_constants::ANOTHER_CONST_MAP"() diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.pxd b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.pxd new file mode 100644 index 00000000000..83356c003c8 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.pxd @@ -0,0 +1,18 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# +cimport thrift.py3.client + + +cdef class SimpleService(thrift.py3.client.Client): + pass + +cdef class DerivedService(SimpleService): + pass + +cdef class RederivedService(DerivedService): + pass + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.py b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.py new file mode 100644 index 00000000000..23ce2f67166 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.py @@ -0,0 +1,6 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.pyi b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.pyi new file mode 100644 index 00000000000..a3da5dbb058 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.pyi @@ -0,0 +1,291 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +import folly.iobuf as _fbthrift_iobuf +import thrift.py3.types +import thrift.py3.client +import thrift.py3.common +import typing as _typing +from types import TracebackType + +import module.types as _module_types + + +_SimpleServiceT = _typing.TypeVar('_SimpleServiceT', bound='SimpleService') + + +class SimpleService(thrift.py3.client.Client): + + async def get_five( + self, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def add_five( + self, + num: int, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def do_nothing( + self, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> None: ... + + async def concat( + self, + first: str, + second: str, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> str: ... + + async def get_value( + self, + simple_struct: _module_types.SimpleStruct, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def negate( + self, + input: bool, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> bool: ... + + async def tiny( + self, + input: int, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def small( + self, + input: int, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def big( + self, + input: int, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def two( + self, + input: float, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> float: ... + + async def expected_exception( + self, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> None: ... + + async def unexpected_exception( + self, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def sum_i16_list( + self, + numbers: _typing.Sequence[int], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def sum_i32_list( + self, + numbers: _typing.Sequence[int], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def sum_i64_list( + self, + numbers: _typing.Sequence[int], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def concat_many( + self, + words: _typing.Sequence[str], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> str: ... + + async def count_structs( + self, + items: _typing.Sequence[_module_types.SimpleStruct], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def sum_set( + self, + numbers: _typing.AbstractSet[int], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def contains_word( + self, + words: _typing.AbstractSet[str], + word: str, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> bool: ... + + async def get_map_value( + self, + words: _typing.Mapping[str, str], + key: str, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> str: ... + + async def map_length( + self, + items: _typing.Mapping[str, _module_types.SimpleStruct], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def sum_map_values( + self, + items: _typing.Mapping[str, int], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def complex_sum_i32( + self, + counter: _module_types.ComplexStruct, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def repeat_name( + self, + counter: _module_types.ComplexStruct, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> str: ... + + async def get_struct( + self, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _module_types.SimpleStruct: ... + + async def fib( + self, + n: int, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _typing.Sequence[int]: ... + + async def unique_words( + self, + words: _typing.Sequence[str], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _typing.AbstractSet[str]: ... + + async def words_count( + self, + words: _typing.Sequence[str], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _typing.Mapping[str, int]: ... + + async def set_enum( + self, + in_enum: _module_types.AnEnum, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _module_types.AnEnum: ... + + async def list_of_lists( + self, + num_lists: int, + num_items: int, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _typing.Sequence[_typing.Sequence[int]]: ... + + async def word_character_frequency( + self, + sentence: str, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _typing.Mapping[str, _typing.Mapping[str, int]]: ... + + async def list_of_sets( + self, + some_words: str, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _typing.Sequence[_typing.AbstractSet[str]]: ... + + async def nested_map_argument( + self, + struct_map: _typing.Mapping[str, _typing.Sequence[_module_types.SimpleStruct]], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + async def make_sentence( + self, + word_chars: _typing.Sequence[_typing.Sequence[str]], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> str: ... + + async def get_union( + self, + sets: _typing.Sequence[_typing.AbstractSet[int]], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _typing.AbstractSet[int]: ... + + async def get_keys( + self, + string_map: _typing.Sequence[_typing.Mapping[str, str]], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _typing.AbstractSet[str]: ... + + async def lookup_double( + self, + key: int, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> float: ... + + async def retrieve_binary( + self, + something: bytes, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> bytes: ... + + async def contain_binary( + self, + binaries: _typing.Sequence[bytes], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _typing.AbstractSet[bytes]: ... + + async def contain_enum( + self, + the_enum: _typing.Sequence[_module_types.AnEnum], + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _typing.Sequence[_module_types.AnEnum]: ... + + async def get_binary_union_struct( + self, + u: _module_types.BinaryUnion, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> _module_types.BinaryUnionStruct: ... + + + +_DerivedServiceT = _typing.TypeVar('_DerivedServiceT', bound='DerivedService') + + +class DerivedService(SimpleService): + + async def get_six( + self, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + + + +_RederivedServiceT = _typing.TypeVar('_RederivedServiceT', bound='RederivedService') + + +class RederivedService(DerivedService): + + async def get_seven( + self, + rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None + ) -> int: ... + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.pyx b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.pyx new file mode 100644 index 00000000000..b2ef0a5da91 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients.pyx @@ -0,0 +1,1934 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# +from libc.stdint cimport ( + int8_t as cint8_t, + int16_t as cint16_t, + int32_t as cint32_t, + int64_t as cint64_t, +) +from libcpp.memory cimport shared_ptr, make_shared, unique_ptr +from libcpp.string cimport string +from libcpp cimport bool as cbool +from cpython cimport bool as pbool +from libcpp.vector cimport vector +from libcpp.set cimport set as cset +from libcpp.map cimport map as cmap +from libcpp.utility cimport move as cmove +from cython.operator cimport dereference as deref, typeid +from cpython.ref cimport PyObject +from thrift.py3.client cimport cRequestChannel_ptr, makeClientWrapper, cClientWrapper +from thrift.py3.exceptions cimport try_make_shared_exception +from thrift.python.exceptions cimport create_py_exception +from folly cimport cFollyTry, cFollyUnit, c_unit +from folly.cast cimport down_cast_ptr +from libcpp.typeinfo cimport type_info +import thrift.py3.types +cimport thrift.py3.types +from thrift.py3.types cimport make_unique +import thrift.py3.client +cimport thrift.py3.client +from thrift.python.common cimport ( + RpcOptions as __RpcOptions, + cThriftServiceMetadataResponse as __fbthrift_cThriftServiceMetadataResponse, + ServiceMetadata, + MetadataBox as __MetadataBox, +) + +from folly.futures cimport bridgeFutureWith +from folly.executor cimport get_executor +cimport folly.iobuf as _fbthrift_iobuf +import folly.iobuf as _fbthrift_iobuf +from folly.iobuf cimport move as move_iobuf +cimport cython + +import sys +import types as _py_types +from asyncio import get_event_loop as asyncio_get_event_loop, shield as asyncio_shield, InvalidStateError as asyncio_InvalidStateError + +cimport module.types as _module_types +cimport module.cbindings as _module_cbindings +import module.types as _module_types + +cimport module.services_interface as _fbthrift_services_interface + +from module.clients_wrapper cimport cSimpleServiceAsyncClient, cSimpleServiceClientWrapper +from module.clients_wrapper cimport cDerivedServiceAsyncClient, cDerivedServiceClientWrapper +from module.clients_wrapper cimport cRederivedServiceAsyncClient, cRederivedServiceClientWrapper + + +cdef void SimpleService_get_five_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_add_five_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_do_nothing_callback( + cFollyTry[cFollyUnit]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(None) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_concat_callback( + cFollyTry[string]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value().data().decode('UTF-8')) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_get_value_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_negate_callback( + cFollyTry[cbool]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_tiny_callback( + cFollyTry[cint8_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_small_callback( + cFollyTry[cint16_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_big_callback( + cFollyTry[cint64_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_two_callback( + cFollyTry[double]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_expected_exception_callback( + cFollyTry[cFollyUnit]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException[_module_cbindings.cSimpleException](): + try: + exc = _module_types.SimpleException._create_FBTHRIFT_ONLY_DO_NOT_USE(try_make_shared_exception[_module_cbindings.cSimpleException](result.exception())) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + else: + pyfuture.set_exception(exc) + elif result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(None) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_unexpected_exception_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_sum_i16_list_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_sum_i32_list_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_sum_i64_list_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_concat_many_callback( + cFollyTry[string]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value().data().decode('UTF-8')) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_count_structs_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_sum_set_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_contains_word_callback( + cFollyTry[cbool]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_get_map_value_callback( + cFollyTry[string]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value().data().decode('UTF-8')) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_map_length_callback( + cFollyTry[cint16_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_sum_map_values_callback( + cFollyTry[cint16_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_complex_sum_i32_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_repeat_name_callback( + cFollyTry[string]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value().data().decode('UTF-8')) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_get_struct_callback( + cFollyTry[_module_cbindings.cSimpleStruct]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_module_cbindings.cSimpleStruct](cmove(result.value())))) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_fib_callback( + cFollyTry[vector[cint32_t]]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.List__i32__from_cpp(cmove(result.value()))) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_unique_words_callback( + cFollyTry[cset[string]]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.Set__string__from_cpp(cmove(result.value()))) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_words_count_callback( + cFollyTry[cmap[string,cint16_t]]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.Map__string_i16__from_cpp(cmove(result.value()))) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_set_enum_callback( + cFollyTry[_module_cbindings.cAnEnum]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.AnEnum( result.value())) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_list_of_lists_callback( + cFollyTry[vector[vector[cint32_t]]]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.List__List__i32__from_cpp(cmove(result.value()))) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_word_character_frequency_callback( + cFollyTry[cmap[string,cmap[string,cint32_t]]]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.Map__string_Map__string_i32__from_cpp(cmove(result.value()))) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_list_of_sets_callback( + cFollyTry[vector[cset[string]]]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.List__Set__string__from_cpp(cmove(result.value()))) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_nested_map_argument_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_make_sentence_callback( + cFollyTry[string]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value().data().decode('UTF-8')) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_get_union_callback( + cFollyTry[cset[cint32_t]]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.Set__i32__from_cpp(cmove(result.value()))) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_get_keys_callback( + cFollyTry[cset[string]]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.Set__string__from_cpp(cmove(result.value()))) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_lookup_double_callback( + cFollyTry[double]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_retrieve_binary_callback( + cFollyTry[string]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_contain_binary_callback( + cFollyTry[cset[string]]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.Set__binary__from_cpp(cmove(result.value()))) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_contain_enum_callback( + cFollyTry[vector[_module_cbindings.cAnEnum]]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.List__AnEnum__from_cpp(cmove(result.value()))) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void SimpleService_get_binary_union_struct_callback( + cFollyTry[_module_cbindings.cBinaryUnionStruct]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(_module_types.BinaryUnionStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_module_cbindings.cBinaryUnionStruct](cmove(result.value())))) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void DerivedService_get_six_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + +cdef void RederivedService_get_seven_callback( + cFollyTry[cint32_t]&& result, + PyObject* userdata +) noexcept: + client, pyfuture, options = userdata + if result.hasException(): + pyfuture.set_exception(create_py_exception(result.exception(), <__RpcOptions>options)) + else: + try: + pyfuture.set_result(result.value()) + except Exception as ex: + pyfuture.set_exception(ex.with_traceback(None)) + + +cdef object _SimpleService_annotations = _py_types.MappingProxyType({ +}) + + +@cython.auto_pickle(False) +cdef class SimpleService(thrift.py3.client.Client): + annotations = _SimpleService_annotations + + cdef const type_info* _typeid(SimpleService self): + return &typeid(cSimpleServiceAsyncClient) + + cdef bind_client(SimpleService self, cRequestChannel_ptr&& channel): + self._client = makeClientWrapper[cSimpleServiceAsyncClient, cSimpleServiceClientWrapper]( + cmove(channel) + ) + + _fbthrift_annotations_DO_NOT_USE_get_five = { + 'return': 'int', + + } + + @cython.always_allow_keywords(True) + def get_five( + SimpleService self, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).get_five(rpc_options._cpp_obj, + ), + SimpleService_get_five_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_add_five = { + 'return': 'int', + 'num': 'int', + } + + @cython.always_allow_keywords(True) + def add_five( + SimpleService self, + num not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(num, int): + raise TypeError(f'num is not a {int !r}.') + else: + num = num + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).add_five(rpc_options._cpp_obj, + num, + ), + SimpleService_add_five_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_do_nothing = { + 'return': 'None', + + } + + @cython.always_allow_keywords(True) + def do_nothing( + SimpleService self, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cFollyUnit]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).do_nothing(rpc_options._cpp_obj, + ), + SimpleService_do_nothing_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_concat = { + 'return': 'str', + 'first': 'str', 'second': 'str', + } + + @cython.always_allow_keywords(True) + def concat( + SimpleService self, + str first not None, + str second not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[string]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).concat(rpc_options._cpp_obj, + first.encode('UTF-8'), + second.encode('UTF-8'), + ), + SimpleService_concat_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_get_value = { + 'return': 'int', + 'simple_struct': 'module.types.SimpleStruct', + } + + @cython.always_allow_keywords(True) + def get_value( + SimpleService self, + _module_types.SimpleStruct simple_struct not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).get_value(rpc_options._cpp_obj, + deref((<_module_types.SimpleStruct>simple_struct)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE), + ), + SimpleService_get_value_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_negate = { + 'return': 'bool', + 'input': 'bool', + } + + @cython.always_allow_keywords(True) + def negate( + SimpleService self, + pbool input not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cbool]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).negate(rpc_options._cpp_obj, + input, + ), + SimpleService_negate_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_tiny = { + 'return': 'int', + 'input': 'int', + } + + @cython.always_allow_keywords(True) + def tiny( + SimpleService self, + input not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(input, int): + raise TypeError(f'input is not a {int !r}.') + else: + input = input + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint8_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).tiny(rpc_options._cpp_obj, + input, + ), + SimpleService_tiny_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_small = { + 'return': 'int', + 'input': 'int', + } + + @cython.always_allow_keywords(True) + def small( + SimpleService self, + input not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(input, int): + raise TypeError(f'input is not a {int !r}.') + else: + input = input + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint16_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).small(rpc_options._cpp_obj, + input, + ), + SimpleService_small_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_big = { + 'return': 'int', + 'input': 'int', + } + + @cython.always_allow_keywords(True) + def big( + SimpleService self, + input not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(input, int): + raise TypeError(f'input is not a {int !r}.') + else: + input = input + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint64_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).big(rpc_options._cpp_obj, + input, + ), + SimpleService_big_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_two = { + 'return': 'float', + 'input': 'float', + } + + @cython.always_allow_keywords(True) + def two( + SimpleService self, + double input, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[double]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).two(rpc_options._cpp_obj, + input, + ), + SimpleService_two_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_expected_exception = { + 'return': 'None', + + } + + @cython.always_allow_keywords(True) + def expected_exception( + SimpleService self, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cFollyUnit]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).expected_exception(rpc_options._cpp_obj, + ), + SimpleService_expected_exception_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_unexpected_exception = { + 'return': 'int', + + } + + @cython.always_allow_keywords(True) + def unexpected_exception( + SimpleService self, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).unexpected_exception(rpc_options._cpp_obj, + ), + SimpleService_unexpected_exception_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_sum_i16_list = { + 'return': 'int', + 'numbers': '_typing.Sequence[int]', + } + + @cython.always_allow_keywords(True) + def sum_i16_list( + SimpleService self, + numbers not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(numbers, _module_types.List__i16): + numbers = _module_types.List__i16(numbers) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).sum_i16_list(rpc_options._cpp_obj, + _module_types.List__i16__make_instance(numbers), + ), + SimpleService_sum_i16_list_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_sum_i32_list = { + 'return': 'int', + 'numbers': '_typing.Sequence[int]', + } + + @cython.always_allow_keywords(True) + def sum_i32_list( + SimpleService self, + numbers not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(numbers, _module_types.List__i32): + numbers = _module_types.List__i32(numbers) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).sum_i32_list(rpc_options._cpp_obj, + _module_types.List__i32__make_instance(numbers), + ), + SimpleService_sum_i32_list_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_sum_i64_list = { + 'return': 'int', + 'numbers': '_typing.Sequence[int]', + } + + @cython.always_allow_keywords(True) + def sum_i64_list( + SimpleService self, + numbers not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(numbers, _module_types.List__i64): + numbers = _module_types.List__i64(numbers) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).sum_i64_list(rpc_options._cpp_obj, + _module_types.List__i64__make_instance(numbers), + ), + SimpleService_sum_i64_list_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_concat_many = { + 'return': 'str', + 'words': '_typing.Sequence[str]', + } + + @cython.always_allow_keywords(True) + def concat_many( + SimpleService self, + words not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(words, _module_types.List__string): + words = _module_types.List__string(words) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[string]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).concat_many(rpc_options._cpp_obj, + _module_types.List__string__make_instance(words), + ), + SimpleService_concat_many_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_count_structs = { + 'return': 'int', + 'items': '_typing.Sequence[module.types.SimpleStruct]', + } + + @cython.always_allow_keywords(True) + def count_structs( + SimpleService self, + items not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(items, _module_types.List__SimpleStruct): + items = _module_types.List__SimpleStruct(items) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).count_structs(rpc_options._cpp_obj, + _module_types.List__SimpleStruct__make_instance(items), + ), + SimpleService_count_structs_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_sum_set = { + 'return': 'int', + 'numbers': '_typing.AbstractSet[int]', + } + + @cython.always_allow_keywords(True) + def sum_set( + SimpleService self, + numbers not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(numbers, _module_types.Set__i32): + numbers = _module_types.Set__i32(numbers) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).sum_set(rpc_options._cpp_obj, + _module_types.Set__i32__make_instance(numbers), + ), + SimpleService_sum_set_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_contains_word = { + 'return': 'bool', + 'words': '_typing.AbstractSet[str]', 'word': 'str', + } + + @cython.always_allow_keywords(True) + def contains_word( + SimpleService self, + words not None, + str word not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(words, _module_types.Set__string): + words = _module_types.Set__string(words) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cbool]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).contains_word(rpc_options._cpp_obj, + _module_types.Set__string__make_instance(words), + word.encode('UTF-8'), + ), + SimpleService_contains_word_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_get_map_value = { + 'return': 'str', + 'words': '_typing.Mapping[str, str]', 'key': 'str', + } + + @cython.always_allow_keywords(True) + def get_map_value( + SimpleService self, + words not None, + str key not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(words, _module_types.Map__string_string): + words = _module_types.Map__string_string(words) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[string]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).get_map_value(rpc_options._cpp_obj, + _module_types.Map__string_string__make_instance(words), + key.encode('UTF-8'), + ), + SimpleService_get_map_value_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_map_length = { + 'return': 'int', + 'items': '_typing.Mapping[str, module.types.SimpleStruct]', + } + + @cython.always_allow_keywords(True) + def map_length( + SimpleService self, + items not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(items, _module_types.Map__string_SimpleStruct): + items = _module_types.Map__string_SimpleStruct(items) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint16_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).map_length(rpc_options._cpp_obj, + _module_types.Map__string_SimpleStruct__make_instance(items), + ), + SimpleService_map_length_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_sum_map_values = { + 'return': 'int', + 'items': '_typing.Mapping[str, int]', + } + + @cython.always_allow_keywords(True) + def sum_map_values( + SimpleService self, + items not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(items, _module_types.Map__string_i16): + items = _module_types.Map__string_i16(items) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint16_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).sum_map_values(rpc_options._cpp_obj, + _module_types.Map__string_i16__make_instance(items), + ), + SimpleService_sum_map_values_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_complex_sum_i32 = { + 'return': 'int', + 'counter': 'module.types.ComplexStruct', + } + + @cython.always_allow_keywords(True) + def complex_sum_i32( + SimpleService self, + _module_types.ComplexStruct counter not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).complex_sum_i32(rpc_options._cpp_obj, + deref((<_module_types.ComplexStruct>counter)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE), + ), + SimpleService_complex_sum_i32_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_repeat_name = { + 'return': 'str', + 'counter': 'module.types.ComplexStruct', + } + + @cython.always_allow_keywords(True) + def repeat_name( + SimpleService self, + _module_types.ComplexStruct counter not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[string]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).repeat_name(rpc_options._cpp_obj, + deref((<_module_types.ComplexStruct>counter)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE), + ), + SimpleService_repeat_name_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_get_struct = { + 'return': 'module.types.SimpleStruct', + + } + + @cython.always_allow_keywords(True) + def get_struct( + SimpleService self, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[_module_cbindings.cSimpleStruct]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).get_struct(rpc_options._cpp_obj, + ), + SimpleService_get_struct_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_fib = { + 'return': '_typing.Sequence[int]', + 'n': 'int', + } + + @cython.always_allow_keywords(True) + def fib( + SimpleService self, + n not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(n, int): + raise TypeError(f'n is not a {int !r}.') + else: + n = n + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[vector[cint32_t]]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).fib(rpc_options._cpp_obj, + n, + ), + SimpleService_fib_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_unique_words = { + 'return': '_typing.AbstractSet[str]', + 'words': '_typing.Sequence[str]', + } + + @cython.always_allow_keywords(True) + def unique_words( + SimpleService self, + words not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(words, _module_types.List__string): + words = _module_types.List__string(words) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cset[string]]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).unique_words(rpc_options._cpp_obj, + _module_types.List__string__make_instance(words), + ), + SimpleService_unique_words_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_words_count = { + 'return': '_typing.Mapping[str, int]', + 'words': '_typing.Sequence[str]', + } + + @cython.always_allow_keywords(True) + def words_count( + SimpleService self, + words not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(words, _module_types.List__string): + words = _module_types.List__string(words) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cmap[string,cint16_t]]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).words_count(rpc_options._cpp_obj, + _module_types.List__string__make_instance(words), + ), + SimpleService_words_count_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_set_enum = { + 'return': 'module.types.AnEnum', + 'in_enum': 'module.types.AnEnum', + } + + @cython.always_allow_keywords(True) + def set_enum( + SimpleService self, + object in_enum not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[_module_cbindings.cAnEnum]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).set_enum(rpc_options._cpp_obj, + <_module_cbindings.cAnEnum>in_enum, + ), + SimpleService_set_enum_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_list_of_lists = { + 'return': '_typing.Sequence[_typing.Sequence[int]]', + 'num_lists': 'int', 'num_items': 'int', + } + + @cython.always_allow_keywords(True) + def list_of_lists( + SimpleService self, + num_lists not None, + num_items not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(num_lists, int): + raise TypeError(f'num_lists is not a {int !r}.') + else: + num_lists = num_lists + if not isinstance(num_items, int): + raise TypeError(f'num_items is not a {int !r}.') + else: + num_items = num_items + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[vector[vector[cint32_t]]]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).list_of_lists(rpc_options._cpp_obj, + num_lists, + num_items, + ), + SimpleService_list_of_lists_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_word_character_frequency = { + 'return': '_typing.Mapping[str, _typing.Mapping[str, int]]', + 'sentence': 'str', + } + + @cython.always_allow_keywords(True) + def word_character_frequency( + SimpleService self, + str sentence not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cmap[string,cmap[string,cint32_t]]]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).word_character_frequency(rpc_options._cpp_obj, + sentence.encode('UTF-8'), + ), + SimpleService_word_character_frequency_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_list_of_sets = { + 'return': '_typing.Sequence[_typing.AbstractSet[str]]', + 'some_words': 'str', + } + + @cython.always_allow_keywords(True) + def list_of_sets( + SimpleService self, + str some_words not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[vector[cset[string]]]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).list_of_sets(rpc_options._cpp_obj, + some_words.encode('UTF-8'), + ), + SimpleService_list_of_sets_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_nested_map_argument = { + 'return': 'int', + 'struct_map': '_typing.Mapping[str, _typing.Sequence[module.types.SimpleStruct]]', + } + + @cython.always_allow_keywords(True) + def nested_map_argument( + SimpleService self, + struct_map not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(struct_map, _module_types.Map__string_List__SimpleStruct): + struct_map = _module_types.Map__string_List__SimpleStruct(struct_map) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).nested_map_argument(rpc_options._cpp_obj, + _module_types.Map__string_List__SimpleStruct__make_instance(struct_map), + ), + SimpleService_nested_map_argument_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_make_sentence = { + 'return': 'str', + 'word_chars': '_typing.Sequence[_typing.Sequence[str]]', + } + + @cython.always_allow_keywords(True) + def make_sentence( + SimpleService self, + word_chars not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(word_chars, _module_types.List__List__string): + word_chars = _module_types.List__List__string(word_chars) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[string]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).make_sentence(rpc_options._cpp_obj, + _module_types.List__List__string__make_instance(word_chars), + ), + SimpleService_make_sentence_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_get_union = { + 'return': '_typing.AbstractSet[int]', + 'sets': '_typing.Sequence[_typing.AbstractSet[int]]', + } + + @cython.always_allow_keywords(True) + def get_union( + SimpleService self, + sets not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(sets, _module_types.List__Set__i32): + sets = _module_types.List__Set__i32(sets) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cset[cint32_t]]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).get_union(rpc_options._cpp_obj, + _module_types.List__Set__i32__make_instance(sets), + ), + SimpleService_get_union_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_get_keys = { + 'return': '_typing.AbstractSet[str]', + 'string_map': '_typing.Sequence[_typing.Mapping[str, str]]', + } + + @cython.always_allow_keywords(True) + def get_keys( + SimpleService self, + string_map not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(string_map, _module_types.List__Map__string_string): + string_map = _module_types.List__Map__string_string(string_map) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cset[string]]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).get_keys(rpc_options._cpp_obj, + _module_types.List__Map__string_string__make_instance(string_map), + ), + SimpleService_get_keys_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_lookup_double = { + 'return': 'float', + 'key': 'int', + } + + @cython.always_allow_keywords(True) + def lookup_double( + SimpleService self, + key not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(key, int): + raise TypeError(f'key is not a {int !r}.') + else: + key = key + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[double]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).lookup_double(rpc_options._cpp_obj, + key, + ), + SimpleService_lookup_double_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_retrieve_binary = { + 'return': 'bytes', + 'something': 'bytes', + } + + @cython.always_allow_keywords(True) + def retrieve_binary( + SimpleService self, + bytes something not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[string]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).retrieve_binary(rpc_options._cpp_obj, + something, + ), + SimpleService_retrieve_binary_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_contain_binary = { + 'return': '_typing.AbstractSet[bytes]', + 'binaries': '_typing.Sequence[bytes]', + } + + @cython.always_allow_keywords(True) + def contain_binary( + SimpleService self, + binaries not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(binaries, _module_types.List__binary): + binaries = _module_types.List__binary(binaries) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cset[string]]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).contain_binary(rpc_options._cpp_obj, + _module_types.List__binary__make_instance(binaries), + ), + SimpleService_contain_binary_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_contain_enum = { + 'return': '_typing.Sequence[module.types.AnEnum]', + 'the_enum': '_typing.Sequence[module.types.AnEnum]', + } + + @cython.always_allow_keywords(True) + def contain_enum( + SimpleService self, + the_enum not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + if not isinstance(the_enum, _module_types.List__AnEnum): + the_enum = _module_types.List__AnEnum(the_enum) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[vector[_module_cbindings.cAnEnum]]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).contain_enum(rpc_options._cpp_obj, + _module_types.List__AnEnum__make_instance(the_enum), + ), + SimpleService_contain_enum_callback, + __userdata + ) + return asyncio_shield(__future) + + _fbthrift_annotations_DO_NOT_USE_get_binary_union_struct = { + 'return': 'module.types.BinaryUnionStruct', + 'u': 'module.types.BinaryUnion', + } + + @cython.always_allow_keywords(True) + def get_binary_union_struct( + SimpleService self, + _module_types.BinaryUnion u not None, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[_module_cbindings.cBinaryUnionStruct]( + self._executor, + down_cast_ptr[cSimpleServiceClientWrapper, cClientWrapper](self._client.get()).get_binary_union_struct(rpc_options._cpp_obj, + deref((<_module_types.BinaryUnion>u)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE), + ), + SimpleService_get_binary_union_struct_callback, + __userdata + ) + return asyncio_shield(__future) + + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftServiceMetadataResponse response + ServiceMetadata[_fbthrift_services_interface.cSimpleServiceSvIf].gen(response) + return __MetadataBox.box(cmove(deref(response.metadata_ref()))) + + @staticmethod + def __get_thrift_name__(): + return "module.SimpleService" + +cdef object _DerivedService_annotations = _py_types.MappingProxyType({ + """bar""": """1""", """foo""": """\"\"\"""", +}) + + +@cython.auto_pickle(False) +cdef class DerivedService(SimpleService): + annotations = _DerivedService_annotations + + cdef const type_info* _typeid(DerivedService self): + return &typeid(cDerivedServiceAsyncClient) + + cdef bind_client(DerivedService self, cRequestChannel_ptr&& channel): + self._client = makeClientWrapper[cDerivedServiceAsyncClient, cDerivedServiceClientWrapper]( + cmove(channel) + ) + + _fbthrift_annotations_DO_NOT_USE_get_six = { + 'return': 'int', + + } + + @cython.always_allow_keywords(True) + def get_six( + DerivedService self, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cDerivedServiceClientWrapper, cClientWrapper](self._client.get()).get_six(rpc_options._cpp_obj, + ), + DerivedService_get_six_callback, + __userdata + ) + return asyncio_shield(__future) + + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftServiceMetadataResponse response + ServiceMetadata[_fbthrift_services_interface.cDerivedServiceSvIf].gen(response) + return __MetadataBox.box(cmove(deref(response.metadata_ref()))) + + @staticmethod + def __get_thrift_name__(): + return "module.DerivedService" + +cdef object _RederivedService_annotations = _py_types.MappingProxyType({ +}) + + +@cython.auto_pickle(False) +cdef class RederivedService(DerivedService): + annotations = _RederivedService_annotations + + cdef const type_info* _typeid(RederivedService self): + return &typeid(cRederivedServiceAsyncClient) + + cdef bind_client(RederivedService self, cRequestChannel_ptr&& channel): + self._client = makeClientWrapper[cRederivedServiceAsyncClient, cRederivedServiceClientWrapper]( + cmove(channel) + ) + + _fbthrift_annotations_DO_NOT_USE_get_seven = { + 'return': 'int', + + } + + @cython.always_allow_keywords(True) + def get_seven( + RederivedService self, + __RpcOptions rpc_options=None + ): + if rpc_options is None: + rpc_options = <__RpcOptions>__RpcOptions.__new__(__RpcOptions) + self._check_connect_future() + __loop = asyncio_get_event_loop() + __future = __loop.create_future() + __userdata = (self, __future, rpc_options) + bridgeFutureWith[cint32_t]( + self._executor, + down_cast_ptr[cRederivedServiceClientWrapper, cClientWrapper](self._client.get()).get_seven(rpc_options._cpp_obj, + ), + RederivedService_get_seven_callback, + __userdata + ) + return asyncio_shield(__future) + + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftServiceMetadataResponse response + ServiceMetadata[_fbthrift_services_interface.cRederivedServiceSvIf].gen(response) + return __MetadataBox.box(cmove(deref(response.metadata_ref()))) + + @staticmethod + def __get_thrift_name__(): + return "module.RederivedService" + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients_wrapper.cpp b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients_wrapper.cpp new file mode 100644 index 00000000000..d1c5f62ef42 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients_wrapper.cpp @@ -0,0 +1,1041 @@ +/** + * Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#include + +namespace py3 { +namespace simple { + + +folly::Future +SimpleServiceClientWrapper::get_five( + apache::thrift::RpcOptions& rpcOptions) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_get_five, channel_); + try { + client->get_five( + rpcOptions, + std::move(callback) + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::add_five( + apache::thrift::RpcOptions& rpcOptions, + int32_t arg_num) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_add_five, channel_); + try { + client->add_five( + rpcOptions, + std::move(callback), + arg_num + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::do_nothing( + apache::thrift::RpcOptions& rpcOptions) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_do_nothing, channel_); + try { + client->do_nothing( + rpcOptions, + std::move(callback) + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::concat( + apache::thrift::RpcOptions& rpcOptions, + std::string arg_first, + std::string arg_second) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_concat, channel_); + try { + client->concat( + rpcOptions, + std::move(callback), + arg_first, + arg_second + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::get_value( + apache::thrift::RpcOptions& rpcOptions, + ::py3::simple::SimpleStruct arg_simple_struct) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_get_value, channel_); + try { + client->get_value( + rpcOptions, + std::move(callback), + arg_simple_struct + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::negate( + apache::thrift::RpcOptions& rpcOptions, + bool arg_input) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_negate, channel_); + try { + client->negate( + rpcOptions, + std::move(callback), + arg_input + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::tiny( + apache::thrift::RpcOptions& rpcOptions, + int8_t arg_input) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_tiny, channel_); + try { + client->tiny( + rpcOptions, + std::move(callback), + arg_input + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::small( + apache::thrift::RpcOptions& rpcOptions, + int16_t arg_input) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_small, channel_); + try { + client->small( + rpcOptions, + std::move(callback), + arg_input + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::big( + apache::thrift::RpcOptions& rpcOptions, + int64_t arg_input) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_big, channel_); + try { + client->big( + rpcOptions, + std::move(callback), + arg_input + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::two( + apache::thrift::RpcOptions& rpcOptions, + double arg_input) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_two, channel_); + try { + client->two( + rpcOptions, + std::move(callback), + arg_input + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::expected_exception( + apache::thrift::RpcOptions& rpcOptions) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_expected_exception, channel_); + try { + client->expected_exception( + rpcOptions, + std::move(callback) + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::unexpected_exception( + apache::thrift::RpcOptions& rpcOptions) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_unexpected_exception, channel_); + try { + client->unexpected_exception( + rpcOptions, + std::move(callback) + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::sum_i16_list( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_numbers) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_sum_i16_list, channel_); + try { + client->sum_i16_list( + rpcOptions, + std::move(callback), + arg_numbers + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::sum_i32_list( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_numbers) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_sum_i32_list, channel_); + try { + client->sum_i32_list( + rpcOptions, + std::move(callback), + arg_numbers + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::sum_i64_list( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_numbers) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_sum_i64_list, channel_); + try { + client->sum_i64_list( + rpcOptions, + std::move(callback), + arg_numbers + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::concat_many( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_words) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_concat_many, channel_); + try { + client->concat_many( + rpcOptions, + std::move(callback), + arg_words + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::count_structs( + apache::thrift::RpcOptions& rpcOptions, + std::vector<::py3::simple::SimpleStruct> arg_items) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_count_structs, channel_); + try { + client->count_structs( + rpcOptions, + std::move(callback), + arg_items + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::sum_set( + apache::thrift::RpcOptions& rpcOptions, + std::set arg_numbers) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_sum_set, channel_); + try { + client->sum_set( + rpcOptions, + std::move(callback), + arg_numbers + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::contains_word( + apache::thrift::RpcOptions& rpcOptions, + std::set arg_words, + std::string arg_word) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_contains_word, channel_); + try { + client->contains_word( + rpcOptions, + std::move(callback), + arg_words, + arg_word + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::get_map_value( + apache::thrift::RpcOptions& rpcOptions, + std::map arg_words, + std::string arg_key) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_get_map_value, channel_); + try { + client->get_map_value( + rpcOptions, + std::move(callback), + arg_words, + arg_key + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::map_length( + apache::thrift::RpcOptions& rpcOptions, + std::map arg_items) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_map_length, channel_); + try { + client->map_length( + rpcOptions, + std::move(callback), + arg_items + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::sum_map_values( + apache::thrift::RpcOptions& rpcOptions, + std::map arg_items) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_sum_map_values, channel_); + try { + client->sum_map_values( + rpcOptions, + std::move(callback), + arg_items + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::complex_sum_i32( + apache::thrift::RpcOptions& rpcOptions, + ::py3::simple::ComplexStruct arg_counter) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_complex_sum_i32, channel_); + try { + client->complex_sum_i32( + rpcOptions, + std::move(callback), + arg_counter + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::repeat_name( + apache::thrift::RpcOptions& rpcOptions, + ::py3::simple::ComplexStruct arg_counter) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_repeat_name, channel_); + try { + client->repeat_name( + rpcOptions, + std::move(callback), + arg_counter + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future<::py3::simple::SimpleStruct> +SimpleServiceClientWrapper::get_struct( + apache::thrift::RpcOptions& rpcOptions) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper<::py3::simple::SimpleStruct>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback<::py3::simple::SimpleStruct>>( + std::move(_promise), rpcOptions, client->recv_wrapped_get_struct, channel_); + try { + client->get_struct( + rpcOptions, + std::move(callback) + ); + } catch (...) { + return folly::makeFuture<::py3::simple::SimpleStruct>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future> +SimpleServiceClientWrapper::fib( + apache::thrift::RpcOptions& rpcOptions, + int16_t arg_n) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>>( + std::move(_promise), rpcOptions, client->recv_wrapped_fib, channel_); + try { + client->fib( + rpcOptions, + std::move(callback), + arg_n + ); + } catch (...) { + return folly::makeFuture>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future> +SimpleServiceClientWrapper::unique_words( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_words) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>>( + std::move(_promise), rpcOptions, client->recv_wrapped_unique_words, channel_); + try { + client->unique_words( + rpcOptions, + std::move(callback), + arg_words + ); + } catch (...) { + return folly::makeFuture>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future> +SimpleServiceClientWrapper::words_count( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_words) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>>( + std::move(_promise), rpcOptions, client->recv_wrapped_words_count, channel_); + try { + client->words_count( + rpcOptions, + std::move(callback), + arg_words + ); + } catch (...) { + return folly::makeFuture>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future<::py3::simple::AnEnum> +SimpleServiceClientWrapper::set_enum( + apache::thrift::RpcOptions& rpcOptions, + ::py3::simple::AnEnum arg_in_enum) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper<::py3::simple::AnEnum>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback<::py3::simple::AnEnum>>( + std::move(_promise), rpcOptions, client->recv_wrapped_set_enum, channel_); + try { + client->set_enum( + rpcOptions, + std::move(callback), + arg_in_enum + ); + } catch (...) { + return folly::makeFuture<::py3::simple::AnEnum>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future>> +SimpleServiceClientWrapper::list_of_lists( + apache::thrift::RpcOptions& rpcOptions, + int16_t arg_num_lists, + int16_t arg_num_items) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>>>( + std::move(_promise), rpcOptions, client->recv_wrapped_list_of_lists, channel_); + try { + client->list_of_lists( + rpcOptions, + std::move(callback), + arg_num_lists, + arg_num_items + ); + } catch (...) { + return folly::makeFuture>>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future>> +SimpleServiceClientWrapper::word_character_frequency( + apache::thrift::RpcOptions& rpcOptions, + std::string arg_sentence) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>>>( + std::move(_promise), rpcOptions, client->recv_wrapped_word_character_frequency, channel_); + try { + client->word_character_frequency( + rpcOptions, + std::move(callback), + arg_sentence + ); + } catch (...) { + return folly::makeFuture>>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future>> +SimpleServiceClientWrapper::list_of_sets( + apache::thrift::RpcOptions& rpcOptions, + std::string arg_some_words) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>>>( + std::move(_promise), rpcOptions, client->recv_wrapped_list_of_sets, channel_); + try { + client->list_of_sets( + rpcOptions, + std::move(callback), + arg_some_words + ); + } catch (...) { + return folly::makeFuture>>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::nested_map_argument( + apache::thrift::RpcOptions& rpcOptions, + std::map> arg_struct_map) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_nested_map_argument, channel_); + try { + client->nested_map_argument( + rpcOptions, + std::move(callback), + arg_struct_map + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::make_sentence( + apache::thrift::RpcOptions& rpcOptions, + std::vector> arg_word_chars) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_make_sentence, channel_); + try { + client->make_sentence( + rpcOptions, + std::move(callback), + arg_word_chars + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future> +SimpleServiceClientWrapper::get_union( + apache::thrift::RpcOptions& rpcOptions, + std::vector> arg_sets) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>>( + std::move(_promise), rpcOptions, client->recv_wrapped_get_union, channel_); + try { + client->get_union( + rpcOptions, + std::move(callback), + arg_sets + ); + } catch (...) { + return folly::makeFuture>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future> +SimpleServiceClientWrapper::get_keys( + apache::thrift::RpcOptions& rpcOptions, + std::vector> arg_string_map) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>>( + std::move(_promise), rpcOptions, client->recv_wrapped_get_keys, channel_); + try { + client->get_keys( + rpcOptions, + std::move(callback), + arg_string_map + ); + } catch (...) { + return folly::makeFuture>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::lookup_double( + apache::thrift::RpcOptions& rpcOptions, + int32_t arg_key) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_lookup_double, channel_); + try { + client->lookup_double( + rpcOptions, + std::move(callback), + arg_key + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +SimpleServiceClientWrapper::retrieve_binary( + apache::thrift::RpcOptions& rpcOptions, + std::string arg_something) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_retrieve_binary, channel_); + try { + client->retrieve_binary( + rpcOptions, + std::move(callback), + arg_something + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future> +SimpleServiceClientWrapper::contain_binary( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_binaries) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>>( + std::move(_promise), rpcOptions, client->recv_wrapped_contain_binary, channel_); + try { + client->contain_binary( + rpcOptions, + std::move(callback), + arg_binaries + ); + } catch (...) { + return folly::makeFuture>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future> +SimpleServiceClientWrapper::contain_enum( + apache::thrift::RpcOptions& rpcOptions, + std::vector<::py3::simple::AnEnum> arg_the_enum) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>>( + std::move(_promise), rpcOptions, client->recv_wrapped_contain_enum, channel_); + try { + client->contain_enum( + rpcOptions, + std::move(callback), + arg_the_enum + ); + } catch (...) { + return folly::makeFuture>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future<::py3::simple::BinaryUnionStruct> +SimpleServiceClientWrapper::get_binary_union_struct( + apache::thrift::RpcOptions& rpcOptions, + ::py3::simple::BinaryUnion arg_u) { + auto* client = static_cast<::py3::simple::SimpleServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper<::py3::simple::BinaryUnionStruct>; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback<::py3::simple::BinaryUnionStruct>>( + std::move(_promise), rpcOptions, client->recv_wrapped_get_binary_union_struct, channel_); + try { + client->get_binary_union_struct( + rpcOptions, + std::move(callback), + arg_u + ); + } catch (...) { + return folly::makeFuture<::py3::simple::BinaryUnionStruct>(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +DerivedServiceClientWrapper::get_six( + apache::thrift::RpcOptions& rpcOptions) { + auto* client = static_cast<::py3::simple::DerivedServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_get_six, channel_); + try { + client->get_six( + rpcOptions, + std::move(callback) + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +folly::Future +RederivedServiceClientWrapper::get_seven( + apache::thrift::RpcOptions& rpcOptions) { + auto* client = static_cast<::py3::simple::RederivedServiceAsyncClient*>(async_client_.get()); + using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; + folly::Promise _promise; + auto _future = _promise.getFuture(); + auto callback = std::make_unique<::thrift::py3::FutureCallback>( + std::move(_promise), rpcOptions, client->recv_wrapped_get_seven, channel_); + try { + client->get_seven( + rpcOptions, + std::move(callback) + ); + } catch (...) { + return folly::makeFuture(folly::exception_wrapper( + std::current_exception() + )); + } + return std::move(_future).thenValue(CallbackHelper::extractResult); +} + +} // namespace py3 +} // namespace simple diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients_wrapper.h b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients_wrapper.h new file mode 100644 index 00000000000..00dd1d3f8f6 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients_wrapper.h @@ -0,0 +1,189 @@ +/** + * Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#pragma once +#if __has_include() +#include +#else +#include +#endif +#if __has_include() +#include +#else +#include +#endif +#if __has_include() +#include +#else +#include +#endif + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace py3 { +namespace simple { + +class SimpleServiceClientWrapper : public ::thrift::py3::ClientWrapper { + public: + using ::thrift::py3::ClientWrapper::ClientWrapper; + + folly::Future get_five( + apache::thrift::RpcOptions& rpcOptions); + folly::Future add_five( + apache::thrift::RpcOptions& rpcOptions, + int32_t arg_num); + folly::Future do_nothing( + apache::thrift::RpcOptions& rpcOptions); + folly::Future concat( + apache::thrift::RpcOptions& rpcOptions, + std::string arg_first, + std::string arg_second); + folly::Future get_value( + apache::thrift::RpcOptions& rpcOptions, + ::py3::simple::SimpleStruct arg_simple_struct); + folly::Future negate( + apache::thrift::RpcOptions& rpcOptions, + bool arg_input); + folly::Future tiny( + apache::thrift::RpcOptions& rpcOptions, + int8_t arg_input); + folly::Future small( + apache::thrift::RpcOptions& rpcOptions, + int16_t arg_input); + folly::Future big( + apache::thrift::RpcOptions& rpcOptions, + int64_t arg_input); + folly::Future two( + apache::thrift::RpcOptions& rpcOptions, + double arg_input); + folly::Future expected_exception( + apache::thrift::RpcOptions& rpcOptions); + folly::Future unexpected_exception( + apache::thrift::RpcOptions& rpcOptions); + folly::Future sum_i16_list( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_numbers); + folly::Future sum_i32_list( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_numbers); + folly::Future sum_i64_list( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_numbers); + folly::Future concat_many( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_words); + folly::Future count_structs( + apache::thrift::RpcOptions& rpcOptions, + std::vector<::py3::simple::SimpleStruct> arg_items); + folly::Future sum_set( + apache::thrift::RpcOptions& rpcOptions, + std::set arg_numbers); + folly::Future contains_word( + apache::thrift::RpcOptions& rpcOptions, + std::set arg_words, + std::string arg_word); + folly::Future get_map_value( + apache::thrift::RpcOptions& rpcOptions, + std::map arg_words, + std::string arg_key); + folly::Future map_length( + apache::thrift::RpcOptions& rpcOptions, + std::map arg_items); + folly::Future sum_map_values( + apache::thrift::RpcOptions& rpcOptions, + std::map arg_items); + folly::Future complex_sum_i32( + apache::thrift::RpcOptions& rpcOptions, + ::py3::simple::ComplexStruct arg_counter); + folly::Future repeat_name( + apache::thrift::RpcOptions& rpcOptions, + ::py3::simple::ComplexStruct arg_counter); + folly::Future<::py3::simple::SimpleStruct> get_struct( + apache::thrift::RpcOptions& rpcOptions); + folly::Future> fib( + apache::thrift::RpcOptions& rpcOptions, + int16_t arg_n); + folly::Future> unique_words( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_words); + folly::Future> words_count( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_words); + folly::Future<::py3::simple::AnEnum> set_enum( + apache::thrift::RpcOptions& rpcOptions, + ::py3::simple::AnEnum arg_in_enum); + folly::Future>> list_of_lists( + apache::thrift::RpcOptions& rpcOptions, + int16_t arg_num_lists, + int16_t arg_num_items); + folly::Future>> word_character_frequency( + apache::thrift::RpcOptions& rpcOptions, + std::string arg_sentence); + folly::Future>> list_of_sets( + apache::thrift::RpcOptions& rpcOptions, + std::string arg_some_words); + folly::Future nested_map_argument( + apache::thrift::RpcOptions& rpcOptions, + std::map> arg_struct_map); + folly::Future make_sentence( + apache::thrift::RpcOptions& rpcOptions, + std::vector> arg_word_chars); + folly::Future> get_union( + apache::thrift::RpcOptions& rpcOptions, + std::vector> arg_sets); + folly::Future> get_keys( + apache::thrift::RpcOptions& rpcOptions, + std::vector> arg_string_map); + folly::Future lookup_double( + apache::thrift::RpcOptions& rpcOptions, + int32_t arg_key); + folly::Future retrieve_binary( + apache::thrift::RpcOptions& rpcOptions, + std::string arg_something); + folly::Future> contain_binary( + apache::thrift::RpcOptions& rpcOptions, + std::vector arg_binaries); + folly::Future> contain_enum( + apache::thrift::RpcOptions& rpcOptions, + std::vector<::py3::simple::AnEnum> arg_the_enum); + folly::Future<::py3::simple::BinaryUnionStruct> get_binary_union_struct( + apache::thrift::RpcOptions& rpcOptions, + ::py3::simple::BinaryUnion arg_u); +}; + + +class DerivedServiceClientWrapper : public ::py3::simple::SimpleServiceClientWrapper { + public: + using ::py3::simple::SimpleServiceClientWrapper::SimpleServiceClientWrapper; + + folly::Future get_six( + apache::thrift::RpcOptions& rpcOptions); +}; + + +class RederivedServiceClientWrapper : public ::py3::simple::DerivedServiceClientWrapper { + public: + using ::py3::simple::DerivedServiceClientWrapper::DerivedServiceClientWrapper; + + folly::Future get_seven( + apache::thrift::RpcOptions& rpcOptions); +}; + + +} // namespace py3 +} // namespace simple diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients_wrapper.pxd b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients_wrapper.pxd new file mode 100644 index 00000000000..b9bfc99d65b --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/clients_wrapper.pxd @@ -0,0 +1,152 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +from cpython.ref cimport PyObject +from libc.stdint cimport ( + int8_t as cint8_t, + int16_t as cint16_t, + int32_t as cint32_t, + int64_t as cint64_t, +) +from libcpp cimport bool as cbool +from libcpp.map cimport map as cmap, pair as cpair +from libcpp.memory cimport shared_ptr, unique_ptr +from libcpp.set cimport set as cset +from libcpp.string cimport string +from libcpp.vector cimport vector + +from folly cimport cFollyFuture, cFollyTry, cFollyUnit +cimport folly.iobuf as _fbthrift_iobuf +from thrift.python.common cimport cRpcOptions +from thrift.py3.client cimport cClientWrapper + +cimport module.types as _module_types +cimport module.cbindings as _module_cbindings + + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-cpp2/module_clients.h" namespace "::py3::simple": + cdef cppclass cSimpleServiceAsyncClient "::py3::simple::SimpleServiceAsyncClient": + pass + +cdef extern from "" namespace "std": + cdef unique_ptr[cSimpleServiceClientWrapper] move(unique_ptr[cSimpleServiceClientWrapper]) + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-cpp2/module_clients.h" namespace "::py3::simple": + cdef cppclass cDerivedServiceAsyncClient "::py3::simple::DerivedServiceAsyncClient": + pass + +cdef extern from "" namespace "std": + cdef unique_ptr[cDerivedServiceClientWrapper] move(unique_ptr[cDerivedServiceClientWrapper]) + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-cpp2/module_clients.h" namespace "::py3::simple": + cdef cppclass cRederivedServiceAsyncClient "::py3::simple::RederivedServiceAsyncClient": + pass + +cdef extern from "" namespace "std": + cdef unique_ptr[cRederivedServiceClientWrapper] move(unique_ptr[cRederivedServiceClientWrapper]) + +cdef extern from "thrift/lib/cpp/TProcessorEventHandler.h" namespace "::apache::thrift": + cdef cppclass cTProcessorEventHandler "apache::thrift::TProcessorEventHandler": + pass + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-py3/module/clients_wrapper.h" namespace "::py3::simple": + cdef cppclass cSimpleServiceClientWrapper "::py3::simple::SimpleServiceClientWrapper": + void setPersistentHeader(const string& key, const string& value) + void addEventHandler(const shared_ptr[cTProcessorEventHandler]& handler) + + cFollyFuture[cint32_t] get_five(cRpcOptions, ) + cFollyFuture[cint32_t] add_five(cRpcOptions, + cint32_t arg_num,) + cFollyFuture[cFollyUnit] do_nothing(cRpcOptions, ) + cFollyFuture[string] concat(cRpcOptions, + string arg_first, + string arg_second,) + cFollyFuture[cint32_t] get_value(cRpcOptions, + _module_cbindings.cSimpleStruct arg_simple_struct,) + cFollyFuture[cbool] negate(cRpcOptions, + cbool arg_input,) + cFollyFuture[cint8_t] tiny(cRpcOptions, + cint8_t arg_input,) + cFollyFuture[cint16_t] small(cRpcOptions, + cint16_t arg_input,) + cFollyFuture[cint64_t] big(cRpcOptions, + cint64_t arg_input,) + cFollyFuture[double] two(cRpcOptions, + double arg_input,) + cFollyFuture[cFollyUnit] expected_exception(cRpcOptions, ) + cFollyFuture[cint32_t] unexpected_exception(cRpcOptions, ) + cFollyFuture[cint32_t] sum_i16_list(cRpcOptions, + vector[cint16_t] arg_numbers,) + cFollyFuture[cint32_t] sum_i32_list(cRpcOptions, + vector[cint32_t] arg_numbers,) + cFollyFuture[cint32_t] sum_i64_list(cRpcOptions, + vector[cint64_t] arg_numbers,) + cFollyFuture[string] concat_many(cRpcOptions, + vector[string] arg_words,) + cFollyFuture[cint32_t] count_structs(cRpcOptions, + vector[_module_cbindings.cSimpleStruct] arg_items,) + cFollyFuture[cint32_t] sum_set(cRpcOptions, + cset[cint32_t] arg_numbers,) + cFollyFuture[cbool] contains_word(cRpcOptions, + cset[string] arg_words, + string arg_word,) + cFollyFuture[string] get_map_value(cRpcOptions, + cmap[string,string] arg_words, + string arg_key,) + cFollyFuture[cint16_t] map_length(cRpcOptions, + cmap[string,_module_cbindings.cSimpleStruct] arg_items,) + cFollyFuture[cint16_t] sum_map_values(cRpcOptions, + cmap[string,cint16_t] arg_items,) + cFollyFuture[cint32_t] complex_sum_i32(cRpcOptions, + _module_cbindings.cComplexStruct arg_counter,) + cFollyFuture[string] repeat_name(cRpcOptions, + _module_cbindings.cComplexStruct arg_counter,) + cFollyFuture[_module_cbindings.cSimpleStruct] get_struct(cRpcOptions, ) + cFollyFuture[vector[cint32_t]] fib(cRpcOptions, + cint16_t arg_n,) + cFollyFuture[cset[string]] unique_words(cRpcOptions, + vector[string] arg_words,) + cFollyFuture[cmap[string,cint16_t]] words_count(cRpcOptions, + vector[string] arg_words,) + cFollyFuture[_module_cbindings.cAnEnum] set_enum(cRpcOptions, + _module_cbindings.cAnEnum arg_in_enum,) + cFollyFuture[vector[vector[cint32_t]]] list_of_lists(cRpcOptions, + cint16_t arg_num_lists, + cint16_t arg_num_items,) + cFollyFuture[cmap[string,cmap[string,cint32_t]]] word_character_frequency(cRpcOptions, + string arg_sentence,) + cFollyFuture[vector[cset[string]]] list_of_sets(cRpcOptions, + string arg_some_words,) + cFollyFuture[cint32_t] nested_map_argument(cRpcOptions, + cmap[string,vector[_module_cbindings.cSimpleStruct]] arg_struct_map,) + cFollyFuture[string] make_sentence(cRpcOptions, + vector[vector[string]] arg_word_chars,) + cFollyFuture[cset[cint32_t]] get_union(cRpcOptions, + vector[cset[cint32_t]] arg_sets,) + cFollyFuture[cset[string]] get_keys(cRpcOptions, + vector[cmap[string,string]] arg_string_map,) + cFollyFuture[double] lookup_double(cRpcOptions, + cint32_t arg_key,) + cFollyFuture[string] retrieve_binary(cRpcOptions, + string arg_something,) + cFollyFuture[cset[string]] contain_binary(cRpcOptions, + vector[string] arg_binaries,) + cFollyFuture[vector[_module_cbindings.cAnEnum]] contain_enum(cRpcOptions, + vector[_module_cbindings.cAnEnum] arg_the_enum,) + cFollyFuture[_module_cbindings.cBinaryUnionStruct] get_binary_union_struct(cRpcOptions, + _module_cbindings.cBinaryUnion arg_u,) + + + cdef cppclass cDerivedServiceClientWrapper "::py3::simple::DerivedServiceClientWrapper"(cSimpleServiceClientWrapper): + + cFollyFuture[cint32_t] get_six(cRpcOptions, ) + + + cdef cppclass cRederivedServiceClientWrapper "::py3::simple::RederivedServiceClientWrapper"(cDerivedServiceClientWrapper): + + cFollyFuture[cint32_t] get_seven(cRpcOptions, ) + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/containers_FBTHRIFT_ONLY_DO_NOT_USE.py b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/containers_FBTHRIFT_ONLY_DO_NOT_USE.py new file mode 100644 index 00000000000..277d1b8dd78 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/containers_FBTHRIFT_ONLY_DO_NOT_USE.py @@ -0,0 +1,1475 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +import thrift.py3.types +import importlib +from collections.abc import Mapping, Sequence, Set + +""" + This is a helper module to define py3 container types. + All types defined here are re-exported in the parent `.types` module. + Only `import` types defined here via the parent `.types` module. + If you `import` them directly from here, you will get nasty import errors. +""" + +_fbthrift__module_name__ = "module.types" + +import module.types as _module_types + +def get_types_reflection(): + return importlib.import_module( + "module.types_reflection" + ) + +__all__ = [] + +class List__i16(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__i16): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = List__i16._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__i16) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, int): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__i16() + + +Sequence.register(List__i16) + +__all__.append('List__i16') + + +class List__i32(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__i32): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = List__i32._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__i32) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, int): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__i32() + + +Sequence.register(List__i32) + +__all__.append('List__i32') + + +class List__i64(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__i64): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = List__i64._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__i64) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, int): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__i64() + + +Sequence.register(List__i64) + +__all__.append('List__i64') + + +class List__string(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__string): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + if isinstance(items, str): + raise TypeError("If you really want to pass a string into a _typing.Sequence[str] field, explicitly convert it first.") + check_method = List__string._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__string) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, str) + ): + raise TypeError(f"{item!r} is not of type str") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, str): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__string() + + +Sequence.register(List__string) + +__all__.append('List__string') + + +class List__SimpleStruct(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__SimpleStruct): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = List__SimpleStruct._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__SimpleStruct) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, _module_types.SimpleStruct) + ): + raise TypeError(f"{item!r} is not of type _module_types.SimpleStruct") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, _module_types.SimpleStruct): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__SimpleStruct() + + +Sequence.register(List__SimpleStruct) + +__all__.append('List__SimpleStruct') + + +class Set__i32(thrift.py3.types.Set): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_set_private_ctor: + _py_obj = items + elif isinstance(items, Set__i32): + _py_obj = frozenset(items) + elif items is None: + _py_obj = frozenset() + else: + check_method = Set__i32._check_item_type_or_raise + _py_obj = frozenset(check_method(item) for item in items) + + super().__init__(_py_obj, Set__i32) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, int): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__Set__i32() + + +Set.register(Set__i32) + +__all__.append('Set__i32') + + +class Set__string(thrift.py3.types.Set): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_set_private_ctor: + _py_obj = items + elif isinstance(items, Set__string): + _py_obj = frozenset(items) + elif items is None: + _py_obj = frozenset() + else: + if isinstance(items, str): + raise TypeError("If you really want to pass a string into a _typing.AbstractSet[str] field, explicitly convert it first.") + check_method = Set__string._check_item_type_or_raise + _py_obj = frozenset(check_method(item) for item in items) + + super().__init__(_py_obj, Set__string) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, str) + ): + raise TypeError(f"{item!r} is not of type str") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, str): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__Set__string() + + +Set.register(Set__string) + +__all__.append('Set__string') + + +class Map__string_string(thrift.py3.types.Map): + __module__ = _fbthrift__module_name__ + __slots__ = () + + _FBTHRIFT_USE_SORTED_REPR = True + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_map_private_ctor: + _py_obj = items + elif isinstance(items, Map__string_string): + _py_obj = dict(items) + elif items is None: + _py_obj = dict() + else: + check_key = Map__string_string._check_key_type_or_raise + check_val = Map__string_string._check_val_type_or_raise + _py_obj = {check_key(k) : check_val(v) for k, v in items.items()} + + super().__init__(_py_obj, Map__string_string) + + @staticmethod + def _check_key_type_or_raise(key): + if not ( + isinstance(key, str) + ): + raise TypeError(f"{key!r} is not of type str") + return key + + @staticmethod + def _check_key_type_or_none(key): + if key is None: + return None + if isinstance(key, str): + return key + + @staticmethod + def _check_val_type_or_raise(item): + if not ( + isinstance(item, str) + ): + raise TypeError(f"{item!r} is not of type str") + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__Map__string_string() + + +Mapping.register(Map__string_string) +__all__.append('Map__string_string') + + +class Map__string_SimpleStruct(thrift.py3.types.Map): + __module__ = _fbthrift__module_name__ + __slots__ = () + + _FBTHRIFT_USE_SORTED_REPR = True + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_map_private_ctor: + _py_obj = items + elif isinstance(items, Map__string_SimpleStruct): + _py_obj = dict(items) + elif items is None: + _py_obj = dict() + else: + check_key = Map__string_SimpleStruct._check_key_type_or_raise + check_val = Map__string_SimpleStruct._check_val_type_or_raise + _py_obj = {check_key(k) : check_val(v) for k, v in items.items()} + + super().__init__(_py_obj, Map__string_SimpleStruct) + + @staticmethod + def _check_key_type_or_raise(key): + if not ( + isinstance(key, str) + ): + raise TypeError(f"{key!r} is not of type str") + return key + + @staticmethod + def _check_key_type_or_none(key): + if key is None: + return None + if isinstance(key, str): + return key + + @staticmethod + def _check_val_type_or_raise(item): + if not ( + isinstance(item, _module_types.SimpleStruct) + ): + raise TypeError(f"{item!r} is not of type _module_types.SimpleStruct") + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__Map__string_SimpleStruct() + + +Mapping.register(Map__string_SimpleStruct) +__all__.append('Map__string_SimpleStruct') + + +class Map__string_i16(thrift.py3.types.Map): + __module__ = _fbthrift__module_name__ + __slots__ = () + + _FBTHRIFT_USE_SORTED_REPR = True + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_map_private_ctor: + _py_obj = items + elif isinstance(items, Map__string_i16): + _py_obj = dict(items) + elif items is None: + _py_obj = dict() + else: + check_key = Map__string_i16._check_key_type_or_raise + check_val = Map__string_i16._check_val_type_or_raise + _py_obj = {check_key(k) : check_val(v) for k, v in items.items()} + + super().__init__(_py_obj, Map__string_i16) + + @staticmethod + def _check_key_type_or_raise(key): + if not ( + isinstance(key, str) + ): + raise TypeError(f"{key!r} is not of type str") + return key + + @staticmethod + def _check_key_type_or_none(key): + if key is None: + return None + if isinstance(key, str): + return key + + @staticmethod + def _check_val_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__Map__string_i16() + + +Mapping.register(Map__string_i16) +__all__.append('Map__string_i16') + + +class List__List__i32(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__List__i32): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = List__List__i32._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__List__i32) + + @staticmethod + def _check_item_type_or_raise(item): + if item is None: + raise TypeError("None is not of the type _typing.Sequence[int]") + if not isinstance(item, _module_types.List__i32): + item = _module_types.List__i32(item) + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, _module_types.List__i32): + return item + try: + return _module_types.List__i32(item) + except: + pass + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__List__i32() + + +Sequence.register(List__List__i32) + +__all__.append('List__List__i32') + + +class Map__string_i32(thrift.py3.types.Map): + __module__ = _fbthrift__module_name__ + __slots__ = () + + _FBTHRIFT_USE_SORTED_REPR = True + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_map_private_ctor: + _py_obj = items + elif isinstance(items, Map__string_i32): + _py_obj = dict(items) + elif items is None: + _py_obj = dict() + else: + check_key = Map__string_i32._check_key_type_or_raise + check_val = Map__string_i32._check_val_type_or_raise + _py_obj = {check_key(k) : check_val(v) for k, v in items.items()} + + super().__init__(_py_obj, Map__string_i32) + + @staticmethod + def _check_key_type_or_raise(key): + if not ( + isinstance(key, str) + ): + raise TypeError(f"{key!r} is not of type str") + return key + + @staticmethod + def _check_key_type_or_none(key): + if key is None: + return None + if isinstance(key, str): + return key + + @staticmethod + def _check_val_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__Map__string_i32() + + +Mapping.register(Map__string_i32) +__all__.append('Map__string_i32') + + +class Map__string_Map__string_i32(thrift.py3.types.Map): + __module__ = _fbthrift__module_name__ + __slots__ = () + + _FBTHRIFT_USE_SORTED_REPR = True + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_map_private_ctor: + _py_obj = items + elif isinstance(items, Map__string_Map__string_i32): + _py_obj = dict(items) + elif items is None: + _py_obj = dict() + else: + check_key = Map__string_Map__string_i32._check_key_type_or_raise + check_val = Map__string_Map__string_i32._check_val_type_or_raise + _py_obj = {check_key(k) : check_val(v) for k, v in items.items()} + + super().__init__(_py_obj, Map__string_Map__string_i32) + + @staticmethod + def _check_key_type_or_raise(key): + if not ( + isinstance(key, str) + ): + raise TypeError(f"{key!r} is not of type str") + return key + + @staticmethod + def _check_key_type_or_none(key): + if key is None: + return None + if isinstance(key, str): + return key + + @staticmethod + def _check_val_type_or_raise(item): + if item is None: + raise TypeError("None is not of the type _typing.Mapping[str, int]") + if not isinstance(item, _module_types.Map__string_i32): + item = _module_types.Map__string_i32(item) + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__Map__string_Map__string_i32() + + +Mapping.register(Map__string_Map__string_i32) +__all__.append('Map__string_Map__string_i32') + + +class List__Set__string(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__Set__string): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = List__Set__string._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__Set__string) + + @staticmethod + def _check_item_type_or_raise(item): + if item is None: + raise TypeError("None is not of the type _typing.AbstractSet[str]") + if not isinstance(item, _module_types.Set__string): + item = _module_types.Set__string(item) + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, _module_types.Set__string): + return item + try: + return _module_types.Set__string(item) + except: + pass + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__Set__string() + + +Sequence.register(List__Set__string) + +__all__.append('List__Set__string') + + +class Map__string_List__SimpleStruct(thrift.py3.types.Map): + __module__ = _fbthrift__module_name__ + __slots__ = () + + _FBTHRIFT_USE_SORTED_REPR = True + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_map_private_ctor: + _py_obj = items + elif isinstance(items, Map__string_List__SimpleStruct): + _py_obj = dict(items) + elif items is None: + _py_obj = dict() + else: + check_key = Map__string_List__SimpleStruct._check_key_type_or_raise + check_val = Map__string_List__SimpleStruct._check_val_type_or_raise + _py_obj = {check_key(k) : check_val(v) for k, v in items.items()} + + super().__init__(_py_obj, Map__string_List__SimpleStruct) + + @staticmethod + def _check_key_type_or_raise(key): + if not ( + isinstance(key, str) + ): + raise TypeError(f"{key!r} is not of type str") + return key + + @staticmethod + def _check_key_type_or_none(key): + if key is None: + return None + if isinstance(key, str): + return key + + @staticmethod + def _check_val_type_or_raise(item): + if item is None: + raise TypeError("None is not of the type _typing.Sequence[_module_types.SimpleStruct]") + if not isinstance(item, _module_types.List__SimpleStruct): + item = _module_types.List__SimpleStruct(item) + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__Map__string_List__SimpleStruct() + + +Mapping.register(Map__string_List__SimpleStruct) +__all__.append('Map__string_List__SimpleStruct') + + +class List__List__string(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__List__string): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = List__List__string._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__List__string) + + @staticmethod + def _check_item_type_or_raise(item): + if item is None: + raise TypeError("None is not of the type _typing.Sequence[str]") + if not isinstance(item, _module_types.List__string): + item = _module_types.List__string(item) + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, _module_types.List__string): + return item + try: + return _module_types.List__string(item) + except: + pass + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__List__string() + + +Sequence.register(List__List__string) + +__all__.append('List__List__string') + + +class List__Set__i32(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__Set__i32): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = List__Set__i32._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__Set__i32) + + @staticmethod + def _check_item_type_or_raise(item): + if item is None: + raise TypeError("None is not of the type _typing.AbstractSet[int]") + if not isinstance(item, _module_types.Set__i32): + item = _module_types.Set__i32(item) + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, _module_types.Set__i32): + return item + try: + return _module_types.Set__i32(item) + except: + pass + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__Set__i32() + + +Sequence.register(List__Set__i32) + +__all__.append('List__Set__i32') + + +class List__Map__string_string(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__Map__string_string): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = List__Map__string_string._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__Map__string_string) + + @staticmethod + def _check_item_type_or_raise(item): + if item is None: + raise TypeError("None is not of the type _typing.Mapping[str, str]") + if not isinstance(item, _module_types.Map__string_string): + item = _module_types.Map__string_string(item) + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, _module_types.Map__string_string): + return item + try: + return _module_types.Map__string_string(item) + except: + pass + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__Map__string_string() + + +Sequence.register(List__Map__string_string) + +__all__.append('List__Map__string_string') + + +class List__binary(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__binary): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + if isinstance(items, str): + raise TypeError("If you really want to pass a string into a _typing.Sequence[bytes] field, explicitly convert it first.") + check_method = List__binary._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__binary) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, bytes) + ): + raise TypeError(f"{item!r} is not of type bytes") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, bytes): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__binary() + + +Sequence.register(List__binary) + +__all__.append('List__binary') + + +class Set__binary(thrift.py3.types.Set): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_set_private_ctor: + _py_obj = items + elif isinstance(items, Set__binary): + _py_obj = frozenset(items) + elif items is None: + _py_obj = frozenset() + else: + if isinstance(items, str): + raise TypeError("If you really want to pass a string into a _typing.AbstractSet[bytes] field, explicitly convert it first.") + check_method = Set__binary._check_item_type_or_raise + _py_obj = frozenset(check_method(item) for item in items) + + super().__init__(_py_obj, Set__binary) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, bytes) + ): + raise TypeError(f"{item!r} is not of type bytes") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, bytes): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__Set__binary() + + +Set.register(Set__binary) + +__all__.append('Set__binary') + + +class List__AnEnum(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__AnEnum): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = List__AnEnum._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__AnEnum) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, _module_types.AnEnum) or + isinstance(item, thrift.py3.types.BadEnum) + ): + raise TypeError(f"{item!r} is not of type _module_types.AnEnum") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, _module_types.AnEnum): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__AnEnum() + + +Sequence.register(List__AnEnum) + +__all__.append('List__AnEnum') + + +class _std_unordered_map__Map__i32_i32(thrift.py3.types.Map): + __module__ = _fbthrift__module_name__ + __slots__ = () + + _FBTHRIFT_USE_SORTED_REPR = False + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_map_private_ctor: + _py_obj = items + elif isinstance(items, _std_unordered_map__Map__i32_i32): + _py_obj = dict(items) + elif items is None: + _py_obj = dict() + else: + check_key = _std_unordered_map__Map__i32_i32._check_key_type_or_raise + check_val = _std_unordered_map__Map__i32_i32._check_val_type_or_raise + _py_obj = {check_key(k) : check_val(v) for k, v in items.items()} + + super().__init__(_py_obj, _std_unordered_map__Map__i32_i32) + + @staticmethod + def _check_key_type_or_raise(key): + if not ( + isinstance(key, int) + ): + raise TypeError(f"{key!r} is not of type int") + return key + + @staticmethod + def _check_key_type_or_none(key): + if key is None: + return None + if isinstance(key, int): + return key + + @staticmethod + def _check_val_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection___std_unordered_map__Map__i32_i32() + + +Mapping.register(_std_unordered_map__Map__i32_i32) +__all__.append('_std_unordered_map__Map__i32_i32') + + +class _MyType__List__i32(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, _MyType__List__i32): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = _MyType__List__i32._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, _MyType__List__i32) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, int): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection___MyType__List__i32() + + +Sequence.register(_MyType__List__i32) + +__all__.append('_MyType__List__i32') + + +class _MyType__Set__i32(thrift.py3.types.Set): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_set_private_ctor: + _py_obj = items + elif isinstance(items, _MyType__Set__i32): + _py_obj = frozenset(items) + elif items is None: + _py_obj = frozenset() + else: + check_method = _MyType__Set__i32._check_item_type_or_raise + _py_obj = frozenset(check_method(item) for item in items) + + super().__init__(_py_obj, _MyType__Set__i32) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, int): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection___MyType__Set__i32() + + +Set.register(_MyType__Set__i32) + +__all__.append('_MyType__Set__i32') + + +class _MyType__Map__i32_i32(thrift.py3.types.Map): + __module__ = _fbthrift__module_name__ + __slots__ = () + + _FBTHRIFT_USE_SORTED_REPR = True + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_map_private_ctor: + _py_obj = items + elif isinstance(items, _MyType__Map__i32_i32): + _py_obj = dict(items) + elif items is None: + _py_obj = dict() + else: + check_key = _MyType__Map__i32_i32._check_key_type_or_raise + check_val = _MyType__Map__i32_i32._check_val_type_or_raise + _py_obj = {check_key(k) : check_val(v) for k, v in items.items()} + + super().__init__(_py_obj, _MyType__Map__i32_i32) + + @staticmethod + def _check_key_type_or_raise(key): + if not ( + isinstance(key, int) + ): + raise TypeError(f"{key!r} is not of type int") + return key + + @staticmethod + def _check_key_type_or_none(key): + if key is None: + return None + if isinstance(key, int): + return key + + @staticmethod + def _check_val_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection___MyType__Map__i32_i32() + + +Mapping.register(_MyType__Map__i32_i32) +__all__.append('_MyType__Map__i32_i32') + + +class _py3_simple_AdaptedList__List__i32(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, _py3_simple_AdaptedList__List__i32): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = _py3_simple_AdaptedList__List__i32._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, _py3_simple_AdaptedList__List__i32) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, int): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection___py3_simple_AdaptedList__List__i32() + + +Sequence.register(_py3_simple_AdaptedList__List__i32) + +__all__.append('_py3_simple_AdaptedList__List__i32') + + +class _py3_simple_AdaptedSet__Set__i32(thrift.py3.types.Set): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_set_private_ctor: + _py_obj = items + elif isinstance(items, _py3_simple_AdaptedSet__Set__i32): + _py_obj = frozenset(items) + elif items is None: + _py_obj = frozenset() + else: + check_method = _py3_simple_AdaptedSet__Set__i32._check_item_type_or_raise + _py_obj = frozenset(check_method(item) for item in items) + + super().__init__(_py_obj, _py3_simple_AdaptedSet__Set__i32) + + @staticmethod + def _check_item_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, int): + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection___py3_simple_AdaptedSet__Set__i32() + + +Set.register(_py3_simple_AdaptedSet__Set__i32) + +__all__.append('_py3_simple_AdaptedSet__Set__i32') + + +class _py3_simple_AdaptedMap__Map__i32_i32(thrift.py3.types.Map): + __module__ = _fbthrift__module_name__ + __slots__ = () + + _FBTHRIFT_USE_SORTED_REPR = True + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_map_private_ctor: + _py_obj = items + elif isinstance(items, _py3_simple_AdaptedMap__Map__i32_i32): + _py_obj = dict(items) + elif items is None: + _py_obj = dict() + else: + check_key = _py3_simple_AdaptedMap__Map__i32_i32._check_key_type_or_raise + check_val = _py3_simple_AdaptedMap__Map__i32_i32._check_val_type_or_raise + _py_obj = {check_key(k) : check_val(v) for k, v in items.items()} + + super().__init__(_py_obj, _py3_simple_AdaptedMap__Map__i32_i32) + + @staticmethod + def _check_key_type_or_raise(key): + if not ( + isinstance(key, int) + ): + raise TypeError(f"{key!r} is not of type int") + return key + + @staticmethod + def _check_key_type_or_none(key): + if key is None: + return None + if isinstance(key, int): + return key + + @staticmethod + def _check_val_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection___py3_simple_AdaptedMap__Map__i32_i32() + + +Mapping.register(_py3_simple_AdaptedMap__Map__i32_i32) +__all__.append('_py3_simple_AdaptedMap__Map__i32_i32') + + +class Map__i32_double(thrift.py3.types.Map): + __module__ = _fbthrift__module_name__ + __slots__ = () + + _FBTHRIFT_USE_SORTED_REPR = True + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_map_private_ctor: + _py_obj = items + elif isinstance(items, Map__i32_double): + _py_obj = dict(items) + elif items is None: + _py_obj = dict() + else: + check_key = Map__i32_double._check_key_type_or_raise + check_val = Map__i32_double._check_val_type_or_raise + _py_obj = {check_key(k) : check_val(v) for k, v in items.items()} + + super().__init__(_py_obj, Map__i32_double) + + @staticmethod + def _check_key_type_or_raise(key): + if not ( + isinstance(key, int) + ): + raise TypeError(f"{key!r} is not of type int") + return key + + @staticmethod + def _check_key_type_or_none(key): + if key is None: + return None + if isinstance(key, int): + return key + + @staticmethod + def _check_val_type_or_raise(item): + if not ( + isinstance(item, (float, int)) + ): + raise TypeError(f"{item!r} is not of type float") + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__Map__i32_double() + + +Mapping.register(Map__i32_double) +__all__.append('Map__i32_double') + + +class List__Map__i32_double(thrift.py3.types.List): + __module__ = _fbthrift__module_name__ + __slots__ = () + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_list_private_ctor: + _py_obj = items + elif isinstance(items, List__Map__i32_double): + _py_obj = list(items) + elif items is None: + _py_obj = [] + else: + check_method = List__Map__i32_double._check_item_type_or_raise + _py_obj = [check_method(item) for item in items] + + super().__init__(_py_obj, List__Map__i32_double) + + @staticmethod + def _check_item_type_or_raise(item): + if item is None: + raise TypeError("None is not of the type _typing.Mapping[int, float]") + if not isinstance(item, _module_types.Map__i32_double): + item = _module_types.Map__i32_double(item) + return item + + @staticmethod + def _check_item_type_or_none(item): + if item is None: + return None + if isinstance(item, _module_types.Map__i32_double): + return item + try: + return _module_types.Map__i32_double(item) + except: + pass + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__List__Map__i32_double() + + +Sequence.register(List__Map__i32_double) + +__all__.append('List__Map__i32_double') + + +class Map__AnEnumRenamed_i32(thrift.py3.types.Map): + __module__ = _fbthrift__module_name__ + __slots__ = () + + _FBTHRIFT_USE_SORTED_REPR = True + + def __init__(self, items=None, private_ctor_token=None) -> None: + if private_ctor_token is thrift.py3.types._fbthrift_map_private_ctor: + _py_obj = items + elif isinstance(items, Map__AnEnumRenamed_i32): + _py_obj = dict(items) + elif items is None: + _py_obj = dict() + else: + check_key = Map__AnEnumRenamed_i32._check_key_type_or_raise + check_val = Map__AnEnumRenamed_i32._check_val_type_or_raise + _py_obj = {check_key(k) : check_val(v) for k, v in items.items()} + + super().__init__(_py_obj, Map__AnEnumRenamed_i32) + + @staticmethod + def _check_key_type_or_raise(key): + if not ( + isinstance(key, _module_types.AnEnumRenamed) or + isinstance(key, thrift.py3.types.BadEnum) + ): + raise TypeError(f"{key!r} is not of type _module_types.AnEnumRenamed") + return key + + @staticmethod + def _check_key_type_or_none(key): + if key is None: + return None + if isinstance(key, _module_types.AnEnumRenamed): + return key + + @staticmethod + def _check_val_type_or_raise(item): + if not ( + isinstance(item, int) + ): + raise TypeError(f"{item!r} is not of type int") + return item + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__Map__AnEnumRenamed_i32() + + +Mapping.register(Map__AnEnumRenamed_i32) +__all__.append('Map__AnEnumRenamed_i32') + + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/converter.pxd b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/converter.pxd new file mode 100644 index 00000000000..26c21564418 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/converter.pxd @@ -0,0 +1,91 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +from libc.stdint cimport ( + int8_t as cint8_t, + int16_t as cint16_t, + int32_t as cint32_t, + int64_t as cint64_t, + uint16_t as cuint16_t, + uint32_t as cuint32_t, +) +from libcpp.string cimport string +from libcpp cimport bool as cbool, nullptr, nullptr_t +from cpython cimport bool as pbool +from libcpp.memory cimport shared_ptr, unique_ptr +from libcpp.vector cimport vector +from libcpp.set cimport set as cset +from libcpp.map cimport map as cmap, pair as cpair +from libcpp.unordered_map cimport unordered_map as cumap +cimport folly.iobuf as _fbthrift_iobuf + +cimport module.cbindings as _module_cbindings + +cimport module.cbindings as _fbthrift_cbindings + + +cdef shared_ptr[_fbthrift_cbindings.cSimpleException] SimpleException_convert_to_cpp(object inst) except* +cdef object SimpleException_from_cpp(const shared_ptr[_fbthrift_cbindings.cSimpleException]& c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cOptionalRefStruct] OptionalRefStruct_convert_to_cpp(object inst) except* +cdef object OptionalRefStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cOptionalRefStruct]& c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cSimpleStruct] SimpleStruct_convert_to_cpp(object inst) except* +cdef object SimpleStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cSimpleStruct]& c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cHiddenTypeFieldsStruct] HiddenTypeFieldsStruct_convert_to_cpp(object inst) except* +cdef object HiddenTypeFieldsStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cHiddenTypeFieldsStruct]& c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cComplexStruct] ComplexStruct_convert_to_cpp(object inst) except* +cdef object ComplexStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cComplexStruct]& c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cBinaryUnion] BinaryUnion_convert_to_cpp(object inst) except* +cdef object BinaryUnion_from_cpp(const shared_ptr[_fbthrift_cbindings.cBinaryUnion]& c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cBinaryUnionStruct] BinaryUnionStruct_convert_to_cpp(object inst) except* +cdef object BinaryUnionStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cBinaryUnionStruct]& c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cCustomFields] CustomFields_convert_to_cpp(object inst) except* +cdef object CustomFields_from_cpp(const shared_ptr[_fbthrift_cbindings.cCustomFields]& c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cCustomTypedefFields] CustomTypedefFields_convert_to_cpp(object inst) except* +cdef object CustomTypedefFields_from_cpp(const shared_ptr[_fbthrift_cbindings.cCustomTypedefFields]& c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cAdaptedTypedefFields] AdaptedTypedefFields_convert_to_cpp(object inst) except* +cdef object AdaptedTypedefFields_from_cpp(const shared_ptr[_fbthrift_cbindings.cAdaptedTypedefFields]& c_struct) + +cdef vector[cint16_t] List__i16__make_instance(object items) except * +cdef vector[cint32_t] List__i32__make_instance(object items) except * +cdef vector[cint64_t] List__i64__make_instance(object items) except * +cdef vector[string] List__string__make_instance(object items) except * +cdef vector[_module_cbindings.cSimpleStruct] List__SimpleStruct__make_instance(object items) except * +cdef cset[cint32_t] Set__i32__make_instance(object items) except * +cdef cset[string] Set__string__make_instance(object items) except * +cdef cmap[string,string] Map__string_string__make_instance(object items) except * +cdef cmap[string,_module_cbindings.cSimpleStruct] Map__string_SimpleStruct__make_instance(object items) except * +cdef cmap[string,cint16_t] Map__string_i16__make_instance(object items) except * +cdef vector[vector[cint32_t]] List__List__i32__make_instance(object items) except * +cdef cmap[string,cint32_t] Map__string_i32__make_instance(object items) except * +cdef cmap[string,cmap[string,cint32_t]] Map__string_Map__string_i32__make_instance(object items) except * +cdef vector[cset[string]] List__Set__string__make_instance(object items) except * +cdef cmap[string,vector[_module_cbindings.cSimpleStruct]] Map__string_List__SimpleStruct__make_instance(object items) except * +cdef vector[vector[string]] List__List__string__make_instance(object items) except * +cdef vector[cset[cint32_t]] List__Set__i32__make_instance(object items) except * +cdef vector[cmap[string,string]] List__Map__string_string__make_instance(object items) except * +cdef vector[string] List__binary__make_instance(object items) except * +cdef cset[string] Set__binary__make_instance(object items) except * +cdef vector[_module_cbindings.cAnEnum] List__AnEnum__make_instance(object items) except * +cdef _module_cbindings._std_unordered_map[cint32_t,cint32_t] _std_unordered_map__Map__i32_i32__make_instance(object items) except * +cdef _module_cbindings._MyType _MyType__List__i32__make_instance(object items) except * +cdef _module_cbindings._MyType _MyType__Set__i32__make_instance(object items) except * +cdef _module_cbindings._MyType _MyType__Map__i32_i32__make_instance(object items) except * +cdef _module_cbindings._py3_simple_AdaptedList _py3_simple_AdaptedList__List__i32__make_instance(object items) except * +cdef _module_cbindings._py3_simple_AdaptedSet _py3_simple_AdaptedSet__Set__i32__make_instance(object items) except * +cdef _module_cbindings._py3_simple_AdaptedMap _py3_simple_AdaptedMap__Map__i32_i32__make_instance(object items) except * +cdef cmap[cint32_t,double] Map__i32_double__make_instance(object items) except * +cdef vector[cmap[cint32_t,double]] List__Map__i32_double__make_instance(object items) except * +cdef cmap[_module_cbindings.cAnEnumRenamed,cint32_t] Map__AnEnumRenamed_i32__make_instance(object items) except * diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/converter.pyx new file mode 100644 index 00000000000..86d119728c6 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/converter.pyx @@ -0,0 +1,165 @@ + +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +cimport module.types as _fbthrift_ctypes + + +cdef shared_ptr[_fbthrift_cbindings.cSimpleException] SimpleException_convert_to_cpp(object inst) except*: + return (<_fbthrift_ctypes.SimpleException?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + +cdef object SimpleException_from_cpp(const shared_ptr[_fbthrift_cbindings.cSimpleException]& c_struct): + return _fbthrift_ctypes.SimpleException._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cOptionalRefStruct] OptionalRefStruct_convert_to_cpp(object inst) except*: + return (<_fbthrift_ctypes.OptionalRefStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + +cdef object OptionalRefStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cOptionalRefStruct]& c_struct): + return _fbthrift_ctypes.OptionalRefStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cSimpleStruct] SimpleStruct_convert_to_cpp(object inst) except*: + return (<_fbthrift_ctypes.SimpleStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + +cdef object SimpleStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cSimpleStruct]& c_struct): + return _fbthrift_ctypes.SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cHiddenTypeFieldsStruct] HiddenTypeFieldsStruct_convert_to_cpp(object inst) except*: + return (<_fbthrift_ctypes.HiddenTypeFieldsStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + +cdef object HiddenTypeFieldsStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cHiddenTypeFieldsStruct]& c_struct): + return _fbthrift_ctypes.HiddenTypeFieldsStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cComplexStruct] ComplexStruct_convert_to_cpp(object inst) except*: + return (<_fbthrift_ctypes.ComplexStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + +cdef object ComplexStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cComplexStruct]& c_struct): + return _fbthrift_ctypes.ComplexStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cBinaryUnion] BinaryUnion_convert_to_cpp(object inst) except*: + return (<_fbthrift_ctypes.BinaryUnion?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + +cdef object BinaryUnion_from_cpp(const shared_ptr[_fbthrift_cbindings.cBinaryUnion]& c_struct): + return _fbthrift_ctypes.BinaryUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cBinaryUnionStruct] BinaryUnionStruct_convert_to_cpp(object inst) except*: + return (<_fbthrift_ctypes.BinaryUnionStruct?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + +cdef object BinaryUnionStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cBinaryUnionStruct]& c_struct): + return _fbthrift_ctypes.BinaryUnionStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cCustomFields] CustomFields_convert_to_cpp(object inst) except*: + return (<_fbthrift_ctypes.CustomFields?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + +cdef object CustomFields_from_cpp(const shared_ptr[_fbthrift_cbindings.cCustomFields]& c_struct): + return _fbthrift_ctypes.CustomFields._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cCustomTypedefFields] CustomTypedefFields_convert_to_cpp(object inst) except*: + return (<_fbthrift_ctypes.CustomTypedefFields?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + +cdef object CustomTypedefFields_from_cpp(const shared_ptr[_fbthrift_cbindings.cCustomTypedefFields]& c_struct): + return _fbthrift_ctypes.CustomTypedefFields._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + +cdef shared_ptr[_fbthrift_cbindings.cAdaptedTypedefFields] AdaptedTypedefFields_convert_to_cpp(object inst) except*: + return (<_fbthrift_ctypes.AdaptedTypedefFields?>inst)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + +cdef object AdaptedTypedefFields_from_cpp(const shared_ptr[_fbthrift_cbindings.cAdaptedTypedefFields]& c_struct): + return _fbthrift_ctypes.AdaptedTypedefFields._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + + +cdef vector[cint16_t] List__i16__make_instance(object items) except *: + return _fbthrift_ctypes.List__i16__make_instance(items) + +cdef vector[cint32_t] List__i32__make_instance(object items) except *: + return _fbthrift_ctypes.List__i32__make_instance(items) + +cdef vector[cint64_t] List__i64__make_instance(object items) except *: + return _fbthrift_ctypes.List__i64__make_instance(items) + +cdef vector[string] List__string__make_instance(object items) except *: + return _fbthrift_ctypes.List__string__make_instance(items) + +cdef vector[_module_cbindings.cSimpleStruct] List__SimpleStruct__make_instance(object items) except *: + return _fbthrift_ctypes.List__SimpleStruct__make_instance(items) + +cdef cset[cint32_t] Set__i32__make_instance(object items) except *: + return _fbthrift_ctypes.Set__i32__make_instance(items) + +cdef cset[string] Set__string__make_instance(object items) except *: + return _fbthrift_ctypes.Set__string__make_instance(items) + +cdef cmap[string,string] Map__string_string__make_instance(object items) except *: + return _fbthrift_ctypes.Map__string_string__make_instance(items) + +cdef cmap[string,_module_cbindings.cSimpleStruct] Map__string_SimpleStruct__make_instance(object items) except *: + return _fbthrift_ctypes.Map__string_SimpleStruct__make_instance(items) + +cdef cmap[string,cint16_t] Map__string_i16__make_instance(object items) except *: + return _fbthrift_ctypes.Map__string_i16__make_instance(items) + +cdef vector[vector[cint32_t]] List__List__i32__make_instance(object items) except *: + return _fbthrift_ctypes.List__List__i32__make_instance(items) + +cdef cmap[string,cint32_t] Map__string_i32__make_instance(object items) except *: + return _fbthrift_ctypes.Map__string_i32__make_instance(items) + +cdef cmap[string,cmap[string,cint32_t]] Map__string_Map__string_i32__make_instance(object items) except *: + return _fbthrift_ctypes.Map__string_Map__string_i32__make_instance(items) + +cdef vector[cset[string]] List__Set__string__make_instance(object items) except *: + return _fbthrift_ctypes.List__Set__string__make_instance(items) + +cdef cmap[string,vector[_module_cbindings.cSimpleStruct]] Map__string_List__SimpleStruct__make_instance(object items) except *: + return _fbthrift_ctypes.Map__string_List__SimpleStruct__make_instance(items) + +cdef vector[vector[string]] List__List__string__make_instance(object items) except *: + return _fbthrift_ctypes.List__List__string__make_instance(items) + +cdef vector[cset[cint32_t]] List__Set__i32__make_instance(object items) except *: + return _fbthrift_ctypes.List__Set__i32__make_instance(items) + +cdef vector[cmap[string,string]] List__Map__string_string__make_instance(object items) except *: + return _fbthrift_ctypes.List__Map__string_string__make_instance(items) + +cdef vector[string] List__binary__make_instance(object items) except *: + return _fbthrift_ctypes.List__binary__make_instance(items) + +cdef cset[string] Set__binary__make_instance(object items) except *: + return _fbthrift_ctypes.Set__binary__make_instance(items) + +cdef vector[_module_cbindings.cAnEnum] List__AnEnum__make_instance(object items) except *: + return _fbthrift_ctypes.List__AnEnum__make_instance(items) + +cdef _module_cbindings._std_unordered_map[cint32_t,cint32_t] _std_unordered_map__Map__i32_i32__make_instance(object items) except *: + return _fbthrift_ctypes._std_unordered_map__Map__i32_i32__make_instance(items) + +cdef _module_cbindings._MyType _MyType__List__i32__make_instance(object items) except *: + return _fbthrift_ctypes._MyType__List__i32__make_instance(items) + +cdef _module_cbindings._MyType _MyType__Set__i32__make_instance(object items) except *: + return _fbthrift_ctypes._MyType__Set__i32__make_instance(items) + +cdef _module_cbindings._MyType _MyType__Map__i32_i32__make_instance(object items) except *: + return _fbthrift_ctypes._MyType__Map__i32_i32__make_instance(items) + +cdef _module_cbindings._py3_simple_AdaptedList _py3_simple_AdaptedList__List__i32__make_instance(object items) except *: + return _fbthrift_ctypes._py3_simple_AdaptedList__List__i32__make_instance(items) + +cdef _module_cbindings._py3_simple_AdaptedSet _py3_simple_AdaptedSet__Set__i32__make_instance(object items) except *: + return _fbthrift_ctypes._py3_simple_AdaptedSet__Set__i32__make_instance(items) + +cdef _module_cbindings._py3_simple_AdaptedMap _py3_simple_AdaptedMap__Map__i32_i32__make_instance(object items) except *: + return _fbthrift_ctypes._py3_simple_AdaptedMap__Map__i32_i32__make_instance(items) + +cdef cmap[cint32_t,double] Map__i32_double__make_instance(object items) except *: + return _fbthrift_ctypes.Map__i32_double__make_instance(items) + +cdef vector[cmap[cint32_t,double]] List__Map__i32_double__make_instance(object items) except *: + return _fbthrift_ctypes.List__Map__i32_double__make_instance(items) + +cdef cmap[_module_cbindings.cAnEnumRenamed,cint32_t] Map__AnEnumRenamed_i32__make_instance(object items) except *: + return _fbthrift_ctypes.Map__AnEnumRenamed_i32__make_instance(items) + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.cpp b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.cpp new file mode 100644 index 00000000000..244c992eb2a --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.cpp @@ -0,0 +1,34 @@ +/** + * Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#include "thrift/compiler/test/fixtures/py3/gen-py3/module/metadata.h" + +namespace py3 { +namespace simple { +::apache::thrift::metadata::ThriftMetadata module_getThriftModuleMetadata() { + ::apache::thrift::metadata::ThriftServiceMetadataResponse response; + ::apache::thrift::metadata::ThriftMetadata& metadata = *response.metadata_ref(); + ::apache::thrift::detail::md::EnumMetadata::gen(metadata); + ::apache::thrift::detail::md::EnumMetadata::gen(metadata); + ::apache::thrift::detail::md::EnumMetadata::gen(metadata); + ::apache::thrift::detail::md::ExceptionMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::ServiceMetadata<::apache::thrift::ServiceHandler<::py3::simple::SimpleService>>::gen(response); + ::apache::thrift::detail::md::ServiceMetadata<::apache::thrift::ServiceHandler<::py3::simple::DerivedService>>::gen(response); + ::apache::thrift::detail::md::ServiceMetadata<::apache::thrift::ServiceHandler<::py3::simple::RederivedService>>::gen(response); + return metadata; +} +} // namespace py3 +} // namespace simple diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.h b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.h new file mode 100644 index 00000000000..b18ac93d41e --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.h @@ -0,0 +1,18 @@ +/** + * Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#pragma once + +#include + +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/module_metadata.h" + +namespace py3 { +namespace simple { +::apache::thrift::metadata::ThriftMetadata module_getThriftModuleMetadata(); +} // namespace py3 +} // namespace simple diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.pxd b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.pxd new file mode 100644 index 00000000000..63283e3f840 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.pxd @@ -0,0 +1,14 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +from apache.thrift.metadata.cbindings cimport cThriftMetadata +from thrift.python.common cimport ( + cThriftMetadata as __fbthrift_cThriftMetadata, +) + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-py3/module/metadata.h" : + cdef cThriftMetadata cGetThriftModuleMetadata "::py3::simple::module_getThriftModuleMetadata"() diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.py b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.py new file mode 100644 index 00000000000..23ce2f67166 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.py @@ -0,0 +1,6 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.pyi b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.pyi new file mode 100644 index 00000000000..f3bf90634d5 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.pyi @@ -0,0 +1,10 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +from apache.thrift.metadata.types import ThriftMetadata + +def getThriftModuleMetadata() -> ThriftMetadata: ... diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.pyx b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.pyx new file mode 100644 index 00000000000..db19bfdd950 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/metadata.pyx @@ -0,0 +1,23 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +from libcpp.memory cimport shared_ptr, make_shared +from libcpp.utility cimport move as cmove + +from apache.thrift.metadata.cbindings cimport ( + cThriftMetadata, +) +from apache.thrift.metadata.converter cimport ( + ThriftMetadata_from_cpp +) + +from module.metadata cimport cGetThriftModuleMetadata + +def getThriftModuleMetadata(): + cdef shared_ptr[cThriftMetadata] metadata + metadata = make_shared[cThriftMetadata](cGetThriftModuleMetadata()) + return ThriftMetadata_from_cpp(cmove(metadata)) diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.pxd b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.pxd new file mode 100644 index 00000000000..688c8fe6ba7 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.pxd @@ -0,0 +1,65 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +from thrift.py3.server cimport ServiceInterface + + +cdef class SimpleServiceInterface(ServiceInterface): + # these are to avoid weird Cython multiple inheritance issue + cdef bint _for_cython_get_five + cdef bint _for_cython_add_five + cdef bint _for_cython_do_nothing + cdef bint _for_cython_concat + cdef bint _for_cython_get_value + cdef bint _for_cython_negate + cdef bint _for_cython_tiny + cdef bint _for_cython_small + cdef bint _for_cython_big + cdef bint _for_cython_two + cdef bint _for_cython_expected_exception + cdef bint _for_cython_unexpected_exception + cdef bint _for_cython_sum_i16_list + cdef bint _for_cython_sum_i32_list + cdef bint _for_cython_sum_i64_list + cdef bint _for_cython_concat_many + cdef bint _for_cython_count_structs + cdef bint _for_cython_sum_set + cdef bint _for_cython_contains_word + cdef bint _for_cython_get_map_value + cdef bint _for_cython_map_length + cdef bint _for_cython_sum_map_values + cdef bint _for_cython_complex_sum_i32 + cdef bint _for_cython_repeat_name + cdef bint _for_cython_get_struct + cdef bint _for_cython_fib + cdef bint _for_cython_unique_words + cdef bint _for_cython_words_count + cdef bint _for_cython_set_enum + cdef bint _for_cython_list_of_lists + cdef bint _for_cython_word_character_frequency + cdef bint _for_cython_list_of_sets + cdef bint _for_cython_nested_map_argument + cdef bint _for_cython_make_sentence + cdef bint _for_cython_get_union + cdef bint _for_cython_get_keys + cdef bint _for_cython_lookup_double + cdef bint _for_cython_retrieve_binary + cdef bint _for_cython_contain_binary + cdef bint _for_cython_contain_enum + cdef bint _for_cython_get_binary_union_struct + pass + +cdef class DerivedServiceInterface(SimpleServiceInterface): + # these are to avoid weird Cython multiple inheritance issue + cdef bint _for_cython_get_six + pass + +cdef class RederivedServiceInterface(DerivedServiceInterface): + # these are to avoid weird Cython multiple inheritance issue + cdef bint _for_cython_get_seven + pass + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.py b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.py new file mode 100644 index 00000000000..23ce2f67166 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.py @@ -0,0 +1,6 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.pyi b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.pyi new file mode 100644 index 00000000000..f068a43764c --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.pyi @@ -0,0 +1,342 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +import folly.iobuf as _fbthrift_iobuf +import typing as _typing +from thrift.py3.server import RequestContext, ServiceInterface +from abc import abstractmethod, ABCMeta + +import module.types as _module_types + +_SimpleServiceInterfaceT = _typing.TypeVar('_SimpleServiceInterfaceT', bound='SimpleServiceInterface') + + +class SimpleServiceInterface( + ServiceInterface, + metaclass=ABCMeta, +): + + + @abstractmethod + async def get_five( + self + ) -> int: ... + + + @abstractmethod + async def add_five( + self, + num: int + ) -> int: ... + + + @abstractmethod + async def do_nothing( + self + ) -> None: ... + + + @abstractmethod + async def concat( + self, + first: str, + second: str + ) -> str: ... + + + @abstractmethod + async def get_value( + self, + simple_struct: _module_types.SimpleStruct + ) -> int: ... + + + @abstractmethod + async def negate( + self, + input: bool + ) -> bool: ... + + + @abstractmethod + async def tiny( + self, + input: int + ) -> int: ... + + + @abstractmethod + async def small( + self, + input: int + ) -> int: ... + + + @abstractmethod + async def big( + self, + input: int + ) -> int: ... + + + @abstractmethod + async def two( + self, + input: float + ) -> float: ... + + + @abstractmethod + async def expected_exception( + self + ) -> None: ... + + + @abstractmethod + async def unexpected_exception( + self + ) -> int: ... + + + @abstractmethod + async def sum_i16_list( + self, + numbers: _typing.Sequence[int] + ) -> int: ... + + + @abstractmethod + async def sum_i32_list( + self, + numbers: _typing.Sequence[int] + ) -> int: ... + + + @abstractmethod + async def sum_i64_list( + self, + numbers: _typing.Sequence[int] + ) -> int: ... + + + @abstractmethod + async def concat_many( + self, + words: _typing.Sequence[str] + ) -> str: ... + + + @abstractmethod + async def count_structs( + self, + items: _typing.Sequence[_module_types.SimpleStruct] + ) -> int: ... + + + @abstractmethod + async def sum_set( + self, + numbers: _typing.AbstractSet[int] + ) -> int: ... + + + @abstractmethod + async def contains_word( + self, + words: _typing.AbstractSet[str], + word: str + ) -> bool: ... + + + @abstractmethod + async def get_map_value( + self, + words: _typing.Mapping[str, str], + key: str + ) -> str: ... + + + @abstractmethod + async def map_length( + self, + items: _typing.Mapping[str, _module_types.SimpleStruct] + ) -> int: ... + + + @abstractmethod + async def sum_map_values( + self, + items: _typing.Mapping[str, int] + ) -> int: ... + + + @abstractmethod + async def complex_sum_i32( + self, + counter: _module_types.ComplexStruct + ) -> int: ... + + + @abstractmethod + async def repeat_name( + self, + counter: _module_types.ComplexStruct + ) -> str: ... + + + @abstractmethod + async def get_struct( + self + ) -> _module_types.SimpleStruct: ... + + + @abstractmethod + async def fib( + self, + n: int + ) -> _typing.Sequence[int]: ... + + + @abstractmethod + async def unique_words( + self, + words: _typing.Sequence[str] + ) -> _typing.AbstractSet[str]: ... + + + @abstractmethod + async def words_count( + self, + words: _typing.Sequence[str] + ) -> _typing.Mapping[str, int]: ... + + + @abstractmethod + async def set_enum( + self, + in_enum: _module_types.AnEnum + ) -> _module_types.AnEnum: ... + + + @abstractmethod + async def list_of_lists( + self, + num_lists: int, + num_items: int + ) -> _typing.Sequence[_typing.Sequence[int]]: ... + + + @abstractmethod + async def word_character_frequency( + self, + sentence: str + ) -> _typing.Mapping[str, _typing.Mapping[str, int]]: ... + + + @abstractmethod + async def list_of_sets( + self, + some_words: str + ) -> _typing.Sequence[_typing.AbstractSet[str]]: ... + + + @abstractmethod + async def nested_map_argument( + self, + struct_map: _typing.Mapping[str, _typing.Sequence[_module_types.SimpleStruct]] + ) -> int: ... + + + @abstractmethod + async def make_sentence( + self, + word_chars: _typing.Sequence[_typing.Sequence[str]] + ) -> str: ... + + + @abstractmethod + async def get_union( + self, + sets: _typing.Sequence[_typing.AbstractSet[int]] + ) -> _typing.AbstractSet[int]: ... + + + @abstractmethod + async def get_keys( + self, + string_map: _typing.Sequence[_typing.Mapping[str, str]] + ) -> _typing.AbstractSet[str]: ... + + + @abstractmethod + async def lookup_double( + self, + key: int + ) -> float: ... + + + @abstractmethod + async def retrieve_binary( + self, + something: bytes + ) -> bytes: ... + + + @abstractmethod + async def contain_binary( + self, + binaries: _typing.Sequence[bytes] + ) -> _typing.AbstractSet[bytes]: ... + + + @abstractmethod + async def contain_enum( + self, + the_enum: _typing.Sequence[_module_types.AnEnum] + ) -> _typing.Sequence[_module_types.AnEnum]: ... + + + @abstractmethod + async def get_binary_union_struct( + self, + u: _module_types.BinaryUnion + ) -> _module_types.BinaryUnionStruct: ... + pass + + +_DerivedServiceInterfaceT = _typing.TypeVar('_DerivedServiceInterfaceT', bound='DerivedServiceInterface') + + +class DerivedServiceInterface( +SimpleServiceInterface, + metaclass=ABCMeta, +): + + + @abstractmethod + async def get_six( + self + ) -> int: ... + pass + + +_RederivedServiceInterfaceT = _typing.TypeVar('_RederivedServiceInterfaceT', bound='RederivedServiceInterface') + + +class RederivedServiceInterface( +DerivedServiceInterface, + metaclass=ABCMeta, +): + + + @abstractmethod + async def get_seven( + self + ) -> int: ... + pass + + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.pyx b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.pyx new file mode 100644 index 00000000000..31893c89478 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services.pyx @@ -0,0 +1,3212 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +cimport cython +from typing import AsyncIterator +from cpython.version cimport PY_VERSION_HEX +from libc.stdint cimport ( + int8_t as cint8_t, + int16_t as cint16_t, + int32_t as cint32_t, + int64_t as cint64_t, +) +from libcpp.memory cimport shared_ptr, make_shared, unique_ptr +from libcpp.string cimport string +from libcpp cimport bool as cbool +from cpython cimport bool as pbool +from libcpp.vector cimport vector +from libcpp.set cimport set as cset +from libcpp.map cimport map as cmap +from libcpp.utility cimport move as cmove +from libcpp.pair cimport pair +from cython.operator cimport dereference as deref +from cpython.ref cimport PyObject +from thrift.python.exceptions cimport ( + ApplicationError as __ApplicationError, + cTApplicationException, + cTApplicationExceptionType__UNKNOWN, +) +from thrift.py3.server cimport ServiceInterface, RequestContext, Cpp2RequestContext +from thrift.py3.server import RequestContext +from folly cimport ( + cFollyPromise, + cFollyUnit, + c_unit, +) +from thrift.python.common cimport ( + cThriftServiceMetadataResponse as __fbthrift_cThriftServiceMetadataResponse, + ServiceMetadata, + MetadataBox as __MetadataBox, +) + +from thrift.py3.server cimport THRIFT_REQUEST_CONTEXT as __THRIFT_REQUEST_CONTEXT +from thrift.py3.types cimport make_unique + +cimport folly.futures +from folly.executor cimport get_executor +cimport folly.iobuf as _fbthrift_iobuf +import folly.iobuf as _fbthrift_iobuf +from folly.iobuf cimport move as move_iobuf +from folly.memory cimport to_shared_ptr as __to_shared_ptr + +cimport module.types as _module_types +cimport module.cbindings as _module_cbindings +import module.types as _module_types + +cimport module.services_interface as _fbthrift_services_interface + +import asyncio +import functools +import sys +import traceback +import types as _py_types + +from module.services_wrapper cimport cSimpleServiceInterface +from module.services_wrapper cimport cDerivedServiceInterface +from module.services_wrapper cimport cRederivedServiceInterface + + + +@cython.auto_pickle(False) +cdef class Promise__module_cbindings_cAnEnum: + cdef cFollyPromise[_module_cbindings.cAnEnum]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[_module_cbindings.cAnEnum](cFollyPromise[_module_cbindings.cAnEnum].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[_module_cbindings.cAnEnum] cPromise): + cdef Promise__module_cbindings_cAnEnum inst = Promise__module_cbindings_cAnEnum.__new__(Promise__module_cbindings_cAnEnum) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise__module_cbindings_cBinaryUnionStruct: + cdef cFollyPromise[unique_ptr[_module_cbindings.cBinaryUnionStruct]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[_module_cbindings.cBinaryUnionStruct]](cFollyPromise[unique_ptr[_module_cbindings.cBinaryUnionStruct]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[_module_cbindings.cBinaryUnionStruct]] cPromise): + cdef Promise__module_cbindings_cBinaryUnionStruct inst = Promise__module_cbindings_cBinaryUnionStruct.__new__(Promise__module_cbindings_cBinaryUnionStruct) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_vector___module_cbindings_cAnEnum: + cdef cFollyPromise[unique_ptr[vector[_module_cbindings.cAnEnum]]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[vector[_module_cbindings.cAnEnum]]](cFollyPromise[unique_ptr[vector[_module_cbindings.cAnEnum]]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[vector[_module_cbindings.cAnEnum]]] cPromise): + cdef Promise_vector___module_cbindings_cAnEnum inst = Promise_vector___module_cbindings_cAnEnum.__new__(Promise_vector___module_cbindings_cAnEnum) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_vector__vector__cint32_t: + cdef cFollyPromise[unique_ptr[vector[vector[cint32_t]]]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[vector[vector[cint32_t]]]](cFollyPromise[unique_ptr[vector[vector[cint32_t]]]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[vector[vector[cint32_t]]]] cPromise): + cdef Promise_vector__vector__cint32_t inst = Promise_vector__vector__cint32_t.__new__(Promise_vector__vector__cint32_t) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_vector__cset__string: + cdef cFollyPromise[unique_ptr[vector[cset[string]]]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[vector[cset[string]]]](cFollyPromise[unique_ptr[vector[cset[string]]]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[vector[cset[string]]]] cPromise): + cdef Promise_vector__cset__string inst = Promise_vector__cset__string.__new__(Promise_vector__cset__string) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_vector__cint32_t: + cdef cFollyPromise[unique_ptr[vector[cint32_t]]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[vector[cint32_t]]](cFollyPromise[unique_ptr[vector[cint32_t]]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[vector[cint32_t]]] cPromise): + cdef Promise_vector__cint32_t inst = Promise_vector__cint32_t.__new__(Promise_vector__cint32_t) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_cmap__string_cmap__string_cint32_t: + cdef cFollyPromise[unique_ptr[cmap[string,cmap[string,cint32_t]]]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[cmap[string,cmap[string,cint32_t]]]](cFollyPromise[unique_ptr[cmap[string,cmap[string,cint32_t]]]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[cmap[string,cmap[string,cint32_t]]]] cPromise): + cdef Promise_cmap__string_cmap__string_cint32_t inst = Promise_cmap__string_cmap__string_cint32_t.__new__(Promise_cmap__string_cmap__string_cint32_t) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_cmap__string_cint16_t: + cdef cFollyPromise[unique_ptr[cmap[string,cint16_t]]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[cmap[string,cint16_t]]](cFollyPromise[unique_ptr[cmap[string,cint16_t]]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[cmap[string,cint16_t]]] cPromise): + cdef Promise_cmap__string_cint16_t inst = Promise_cmap__string_cint16_t.__new__(Promise_cmap__string_cint16_t) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_cset__binary: + cdef cFollyPromise[unique_ptr[cset[string]]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[cset[string]]](cFollyPromise[unique_ptr[cset[string]]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[cset[string]]] cPromise): + cdef Promise_cset__binary inst = Promise_cset__binary.__new__(Promise_cset__binary) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_cset__cint32_t: + cdef cFollyPromise[unique_ptr[cset[cint32_t]]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[cset[cint32_t]]](cFollyPromise[unique_ptr[cset[cint32_t]]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[cset[cint32_t]]] cPromise): + cdef Promise_cset__cint32_t inst = Promise_cset__cint32_t.__new__(Promise_cset__cint32_t) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_cset__string: + cdef cFollyPromise[unique_ptr[cset[string]]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[cset[string]]](cFollyPromise[unique_ptr[cset[string]]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[cset[string]]] cPromise): + cdef Promise_cset__string inst = Promise_cset__string.__new__(Promise_cset__string) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise__module_cbindings_cSimpleStruct: + cdef cFollyPromise[unique_ptr[_module_cbindings.cSimpleStruct]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[_module_cbindings.cSimpleStruct]](cFollyPromise[unique_ptr[_module_cbindings.cSimpleStruct]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[_module_cbindings.cSimpleStruct]] cPromise): + cdef Promise__module_cbindings_cSimpleStruct inst = Promise__module_cbindings_cSimpleStruct.__new__(Promise__module_cbindings_cSimpleStruct) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_binary: + cdef cFollyPromise[unique_ptr[string]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[string]](cFollyPromise[unique_ptr[string]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[string]] cPromise): + cdef Promise_binary inst = Promise_binary.__new__(Promise_binary) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_cbool: + cdef cFollyPromise[cbool]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[cbool](cFollyPromise[cbool].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[cbool] cPromise): + cdef Promise_cbool inst = Promise_cbool.__new__(Promise_cbool) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_cint8_t: + cdef cFollyPromise[cint8_t]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[cint8_t](cFollyPromise[cint8_t].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[cint8_t] cPromise): + cdef Promise_cint8_t inst = Promise_cint8_t.__new__(Promise_cint8_t) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_double: + cdef cFollyPromise[double]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[double](cFollyPromise[double].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[double] cPromise): + cdef Promise_double inst = Promise_double.__new__(Promise_double) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_cint16_t: + cdef cFollyPromise[cint16_t]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[cint16_t](cFollyPromise[cint16_t].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[cint16_t] cPromise): + cdef Promise_cint16_t inst = Promise_cint16_t.__new__(Promise_cint16_t) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_cint32_t: + cdef cFollyPromise[cint32_t]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[cint32_t](cFollyPromise[cint32_t].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[cint32_t] cPromise): + cdef Promise_cint32_t inst = Promise_cint32_t.__new__(Promise_cint32_t) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_cint64_t: + cdef cFollyPromise[cint64_t]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[cint64_t](cFollyPromise[cint64_t].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[cint64_t] cPromise): + cdef Promise_cint64_t inst = Promise_cint64_t.__new__(Promise_cint64_t) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_string: + cdef cFollyPromise[unique_ptr[string]]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[unique_ptr[string]](cFollyPromise[unique_ptr[string]].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[unique_ptr[string]] cPromise): + cdef Promise_string inst = Promise_string.__new__(Promise_string) + inst.cPromise[0] = cmove(cPromise) + return inst + +@cython.auto_pickle(False) +cdef class Promise_cFollyUnit: + cdef cFollyPromise[cFollyUnit]* cPromise + + def __cinit__(self): + self.cPromise = new cFollyPromise[cFollyUnit](cFollyPromise[cFollyUnit].makeEmpty()) + + def __dealloc__(self): + del self.cPromise + + @staticmethod + cdef _fbthrift_create(cFollyPromise[cFollyUnit] cPromise): + cdef Promise_cFollyUnit inst = Promise_cFollyUnit.__new__(Promise_cFollyUnit) + inst.cPromise[0] = cmove(cPromise) + return inst + +cdef object _SimpleService_annotations = _py_types.MappingProxyType({ +}) + + +@cython.auto_pickle(False) +cdef class SimpleServiceInterface( + ServiceInterface +): + annotations = _SimpleService_annotations + + def __cinit__(self): + self._cpp_obj = cSimpleServiceInterface( + self, + get_executor() + ) + + _fbthrift_annotations_DO_NOT_USE_get_five = { + 'return': 'int', + + } + + async def get_five( + self): + raise NotImplementedError("async def get_five is not implemented") + + _fbthrift_annotations_DO_NOT_USE_add_five = { + 'return': 'int', + 'num': 'int', + } + + async def add_five( + self, + num): + raise NotImplementedError("async def add_five is not implemented") + + _fbthrift_annotations_DO_NOT_USE_do_nothing = { + 'return': 'None', + + } + + async def do_nothing( + self): + raise NotImplementedError("async def do_nothing is not implemented") + + _fbthrift_annotations_DO_NOT_USE_concat = { + 'return': 'str', + 'first': 'str', 'second': 'str', + } + + async def concat( + self, + first, + second): + raise NotImplementedError("async def concat is not implemented") + + _fbthrift_annotations_DO_NOT_USE_get_value = { + 'return': 'int', + 'simple_struct': 'module.types.SimpleStruct', + } + + async def get_value( + self, + simple_struct): + raise NotImplementedError("async def get_value is not implemented") + + _fbthrift_annotations_DO_NOT_USE_negate = { + 'return': 'bool', + 'input': 'bool', + } + + async def negate( + self, + input): + raise NotImplementedError("async def negate is not implemented") + + _fbthrift_annotations_DO_NOT_USE_tiny = { + 'return': 'int', + 'input': 'int', + } + + async def tiny( + self, + input): + raise NotImplementedError("async def tiny is not implemented") + + _fbthrift_annotations_DO_NOT_USE_small = { + 'return': 'int', + 'input': 'int', + } + + async def small( + self, + input): + raise NotImplementedError("async def small is not implemented") + + _fbthrift_annotations_DO_NOT_USE_big = { + 'return': 'int', + 'input': 'int', + } + + async def big( + self, + input): + raise NotImplementedError("async def big is not implemented") + + _fbthrift_annotations_DO_NOT_USE_two = { + 'return': 'float', + 'input': 'float', + } + + async def two( + self, + input): + raise NotImplementedError("async def two is not implemented") + + _fbthrift_annotations_DO_NOT_USE_expected_exception = { + 'return': 'None', + + } + + async def expected_exception( + self): + raise NotImplementedError("async def expected_exception is not implemented") + + _fbthrift_annotations_DO_NOT_USE_unexpected_exception = { + 'return': 'int', + + } + + async def unexpected_exception( + self): + raise NotImplementedError("async def unexpected_exception is not implemented") + + _fbthrift_annotations_DO_NOT_USE_sum_i16_list = { + 'return': 'int', + 'numbers': '_typing.Sequence[int]', + } + + async def sum_i16_list( + self, + numbers): + raise NotImplementedError("async def sum_i16_list is not implemented") + + _fbthrift_annotations_DO_NOT_USE_sum_i32_list = { + 'return': 'int', + 'numbers': '_typing.Sequence[int]', + } + + async def sum_i32_list( + self, + numbers): + raise NotImplementedError("async def sum_i32_list is not implemented") + + _fbthrift_annotations_DO_NOT_USE_sum_i64_list = { + 'return': 'int', + 'numbers': '_typing.Sequence[int]', + } + + async def sum_i64_list( + self, + numbers): + raise NotImplementedError("async def sum_i64_list is not implemented") + + _fbthrift_annotations_DO_NOT_USE_concat_many = { + 'return': 'str', + 'words': '_typing.Sequence[str]', + } + + async def concat_many( + self, + words): + raise NotImplementedError("async def concat_many is not implemented") + + _fbthrift_annotations_DO_NOT_USE_count_structs = { + 'return': 'int', + 'items': '_typing.Sequence[module.types.SimpleStruct]', + } + + async def count_structs( + self, + items): + raise NotImplementedError("async def count_structs is not implemented") + + _fbthrift_annotations_DO_NOT_USE_sum_set = { + 'return': 'int', + 'numbers': '_typing.AbstractSet[int]', + } + + async def sum_set( + self, + numbers): + raise NotImplementedError("async def sum_set is not implemented") + + _fbthrift_annotations_DO_NOT_USE_contains_word = { + 'return': 'bool', + 'words': '_typing.AbstractSet[str]', 'word': 'str', + } + + async def contains_word( + self, + words, + word): + raise NotImplementedError("async def contains_word is not implemented") + + _fbthrift_annotations_DO_NOT_USE_get_map_value = { + 'return': 'str', + 'words': '_typing.Mapping[str, str]', 'key': 'str', + } + + async def get_map_value( + self, + words, + key): + raise NotImplementedError("async def get_map_value is not implemented") + + _fbthrift_annotations_DO_NOT_USE_map_length = { + 'return': 'int', + 'items': '_typing.Mapping[str, module.types.SimpleStruct]', + } + + async def map_length( + self, + items): + raise NotImplementedError("async def map_length is not implemented") + + _fbthrift_annotations_DO_NOT_USE_sum_map_values = { + 'return': 'int', + 'items': '_typing.Mapping[str, int]', + } + + async def sum_map_values( + self, + items): + raise NotImplementedError("async def sum_map_values is not implemented") + + _fbthrift_annotations_DO_NOT_USE_complex_sum_i32 = { + 'return': 'int', + 'counter': 'module.types.ComplexStruct', + } + + async def complex_sum_i32( + self, + counter): + raise NotImplementedError("async def complex_sum_i32 is not implemented") + + _fbthrift_annotations_DO_NOT_USE_repeat_name = { + 'return': 'str', + 'counter': 'module.types.ComplexStruct', + } + + async def repeat_name( + self, + counter): + raise NotImplementedError("async def repeat_name is not implemented") + + _fbthrift_annotations_DO_NOT_USE_get_struct = { + 'return': 'module.types.SimpleStruct', + + } + + async def get_struct( + self): + raise NotImplementedError("async def get_struct is not implemented") + + _fbthrift_annotations_DO_NOT_USE_fib = { + 'return': '_typing.Sequence[int]', + 'n': 'int', + } + + async def fib( + self, + n): + raise NotImplementedError("async def fib is not implemented") + + _fbthrift_annotations_DO_NOT_USE_unique_words = { + 'return': '_typing.AbstractSet[str]', + 'words': '_typing.Sequence[str]', + } + + async def unique_words( + self, + words): + raise NotImplementedError("async def unique_words is not implemented") + + _fbthrift_annotations_DO_NOT_USE_words_count = { + 'return': '_typing.Mapping[str, int]', + 'words': '_typing.Sequence[str]', + } + + async def words_count( + self, + words): + raise NotImplementedError("async def words_count is not implemented") + + _fbthrift_annotations_DO_NOT_USE_set_enum = { + 'return': 'module.types.AnEnum', + 'in_enum': 'module.types.AnEnum', + } + + async def set_enum( + self, + in_enum): + raise NotImplementedError("async def set_enum is not implemented") + + _fbthrift_annotations_DO_NOT_USE_list_of_lists = { + 'return': '_typing.Sequence[_typing.Sequence[int]]', + 'num_lists': 'int', 'num_items': 'int', + } + + async def list_of_lists( + self, + num_lists, + num_items): + raise NotImplementedError("async def list_of_lists is not implemented") + + _fbthrift_annotations_DO_NOT_USE_word_character_frequency = { + 'return': '_typing.Mapping[str, _typing.Mapping[str, int]]', + 'sentence': 'str', + } + + async def word_character_frequency( + self, + sentence): + raise NotImplementedError("async def word_character_frequency is not implemented") + + _fbthrift_annotations_DO_NOT_USE_list_of_sets = { + 'return': '_typing.Sequence[_typing.AbstractSet[str]]', + 'some_words': 'str', + } + + async def list_of_sets( + self, + some_words): + raise NotImplementedError("async def list_of_sets is not implemented") + + _fbthrift_annotations_DO_NOT_USE_nested_map_argument = { + 'return': 'int', + 'struct_map': '_typing.Mapping[str, _typing.Sequence[module.types.SimpleStruct]]', + } + + async def nested_map_argument( + self, + struct_map): + raise NotImplementedError("async def nested_map_argument is not implemented") + + _fbthrift_annotations_DO_NOT_USE_make_sentence = { + 'return': 'str', + 'word_chars': '_typing.Sequence[_typing.Sequence[str]]', + } + + async def make_sentence( + self, + word_chars): + raise NotImplementedError("async def make_sentence is not implemented") + + _fbthrift_annotations_DO_NOT_USE_get_union = { + 'return': '_typing.AbstractSet[int]', + 'sets': '_typing.Sequence[_typing.AbstractSet[int]]', + } + + async def get_union( + self, + sets): + raise NotImplementedError("async def get_union is not implemented") + + _fbthrift_annotations_DO_NOT_USE_get_keys = { + 'return': '_typing.AbstractSet[str]', + 'string_map': '_typing.Sequence[_typing.Mapping[str, str]]', + } + + async def get_keys( + self, + string_map): + raise NotImplementedError("async def get_keys is not implemented") + + _fbthrift_annotations_DO_NOT_USE_lookup_double = { + 'return': 'float', + 'key': 'int', + } + + async def lookup_double( + self, + key): + raise NotImplementedError("async def lookup_double is not implemented") + + _fbthrift_annotations_DO_NOT_USE_retrieve_binary = { + 'return': 'bytes', + 'something': 'bytes', + } + + async def retrieve_binary( + self, + something): + raise NotImplementedError("async def retrieve_binary is not implemented") + + _fbthrift_annotations_DO_NOT_USE_contain_binary = { + 'return': '_typing.AbstractSet[bytes]', + 'binaries': '_typing.Sequence[bytes]', + } + + async def contain_binary( + self, + binaries): + raise NotImplementedError("async def contain_binary is not implemented") + + _fbthrift_annotations_DO_NOT_USE_contain_enum = { + 'return': '_typing.Sequence[module.types.AnEnum]', + 'the_enum': '_typing.Sequence[module.types.AnEnum]', + } + + async def contain_enum( + self, + the_enum): + raise NotImplementedError("async def contain_enum is not implemented") + + _fbthrift_annotations_DO_NOT_USE_get_binary_union_struct = { + 'return': 'module.types.BinaryUnionStruct', + 'u': 'module.types.BinaryUnion', + } + + async def get_binary_union_struct( + self, + u): + raise NotImplementedError("async def get_binary_union_struct is not implemented") + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftServiceMetadataResponse response + ServiceMetadata[_fbthrift_services_interface.cSimpleServiceSvIf].gen(response) + return __MetadataBox.box(cmove(deref(response.metadata_ref()))) + + @staticmethod + def __get_thrift_name__(): + return "module.SimpleService" + +cdef object _DerivedService_annotations = _py_types.MappingProxyType({ + """bar""": """1""", """foo""": """\"\"\"""", +}) + + +@cython.auto_pickle(False) +cdef class DerivedServiceInterface( +SimpleServiceInterface +): + annotations = _DerivedService_annotations + + def __cinit__(self): + self._cpp_obj = cDerivedServiceInterface( + self, + get_executor() + ) + + _fbthrift_annotations_DO_NOT_USE_get_six = { + 'return': 'int', + + } + + async def get_six( + self): + raise NotImplementedError("async def get_six is not implemented") + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftServiceMetadataResponse response + ServiceMetadata[_fbthrift_services_interface.cDerivedServiceSvIf].gen(response) + return __MetadataBox.box(cmove(deref(response.metadata_ref()))) + + @staticmethod + def __get_thrift_name__(): + return "module.DerivedService" + +cdef object _RederivedService_annotations = _py_types.MappingProxyType({ +}) + + +@cython.auto_pickle(False) +cdef class RederivedServiceInterface( +DerivedServiceInterface +): + annotations = _RederivedService_annotations + + def __cinit__(self): + self._cpp_obj = cRederivedServiceInterface( + self, + get_executor() + ) + + _fbthrift_annotations_DO_NOT_USE_get_seven = { + 'return': 'int', + + } + + async def get_seven( + self): + raise NotImplementedError("async def get_seven is not implemented") + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftServiceMetadataResponse response + ServiceMetadata[_fbthrift_services_interface.cRederivedServiceSvIf].gen(response) + return __MetadataBox.box(cmove(deref(response.metadata_ref()))) + + @staticmethod + def __get_thrift_name__(): + return "module.RederivedService" + + + +cdef api void call_cy_SimpleService_get_five( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_get_five_coro( + self, + __promise + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_add_five( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise, + cint32_t num +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + arg_num = num + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_add_five_coro( + self, + __promise, + arg_num + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_do_nothing( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cFollyUnit] cPromise +) noexcept: + cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_do_nothing_coro( + self, + __promise + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_concat( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[string]] cPromise, + unique_ptr[string] first, + unique_ptr[string] second +) noexcept: + cdef Promise_string __promise = Promise_string._fbthrift_create(cmove(cPromise)) + arg_first = (deref(first)).data().decode('UTF-8') + arg_second = (deref(second)).data().decode('UTF-8') + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_concat_coro( + self, + __promise, + arg_first, + arg_second + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_get_value( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise, + unique_ptr[_module_cbindings.cSimpleStruct] simple_struct +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + arg_simple_struct = _module_types.SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cSimpleStruct](simple_struct.release())) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_get_value_coro( + self, + __promise, + arg_simple_struct + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_negate( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cbool] cPromise, + cbool input +) noexcept: + cdef Promise_cbool __promise = Promise_cbool._fbthrift_create(cmove(cPromise)) + arg_input = input + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_negate_coro( + self, + __promise, + arg_input + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_tiny( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint8_t] cPromise, + cint8_t input +) noexcept: + cdef Promise_cint8_t __promise = Promise_cint8_t._fbthrift_create(cmove(cPromise)) + arg_input = input + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_tiny_coro( + self, + __promise, + arg_input + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_small( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint16_t] cPromise, + cint16_t input +) noexcept: + cdef Promise_cint16_t __promise = Promise_cint16_t._fbthrift_create(cmove(cPromise)) + arg_input = input + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_small_coro( + self, + __promise, + arg_input + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_big( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint64_t] cPromise, + cint64_t input +) noexcept: + cdef Promise_cint64_t __promise = Promise_cint64_t._fbthrift_create(cmove(cPromise)) + arg_input = input + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_big_coro( + self, + __promise, + arg_input + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_two( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[double] cPromise, + double input +) noexcept: + cdef Promise_double __promise = Promise_double._fbthrift_create(cmove(cPromise)) + arg_input = input + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_two_coro( + self, + __promise, + arg_input + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_expected_exception( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cFollyUnit] cPromise +) noexcept: + cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_expected_exception_coro( + self, + __promise + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_unexpected_exception( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_unexpected_exception_coro( + self, + __promise + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_sum_i16_list( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise, + unique_ptr[vector[cint16_t]] numbers +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + arg_numbers = _module_types.List__i16__from_cpp(deref(numbers)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_sum_i16_list_coro( + self, + __promise, + arg_numbers + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_sum_i32_list( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise, + unique_ptr[vector[cint32_t]] numbers +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + arg_numbers = _module_types.List__i32__from_cpp(deref(numbers)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_sum_i32_list_coro( + self, + __promise, + arg_numbers + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_sum_i64_list( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise, + unique_ptr[vector[cint64_t]] numbers +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + arg_numbers = _module_types.List__i64__from_cpp(deref(numbers)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_sum_i64_list_coro( + self, + __promise, + arg_numbers + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_concat_many( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[string]] cPromise, + unique_ptr[vector[string]] words +) noexcept: + cdef Promise_string __promise = Promise_string._fbthrift_create(cmove(cPromise)) + arg_words = _module_types.List__string__from_cpp(deref(words)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_concat_many_coro( + self, + __promise, + arg_words + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_count_structs( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise, + unique_ptr[vector[_module_cbindings.cSimpleStruct]] items +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + arg_items = _module_types.List__SimpleStruct__from_cpp(deref(items)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_count_structs_coro( + self, + __promise, + arg_items + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_sum_set( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise, + unique_ptr[cset[cint32_t]] numbers +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + arg_numbers = _module_types.Set__i32__from_cpp(deref(numbers)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_sum_set_coro( + self, + __promise, + arg_numbers + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_contains_word( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cbool] cPromise, + unique_ptr[cset[string]] words, + unique_ptr[string] word +) noexcept: + cdef Promise_cbool __promise = Promise_cbool._fbthrift_create(cmove(cPromise)) + arg_words = _module_types.Set__string__from_cpp(deref(words)) + arg_word = (deref(word)).data().decode('UTF-8') + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_contains_word_coro( + self, + __promise, + arg_words, + arg_word + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_get_map_value( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[string]] cPromise, + unique_ptr[cmap[string,string]] words, + unique_ptr[string] key +) noexcept: + cdef Promise_string __promise = Promise_string._fbthrift_create(cmove(cPromise)) + arg_words = _module_types.Map__string_string__from_cpp(deref(words)) + arg_key = (deref(key)).data().decode('UTF-8') + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_get_map_value_coro( + self, + __promise, + arg_words, + arg_key + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_map_length( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint16_t] cPromise, + unique_ptr[cmap[string,_module_cbindings.cSimpleStruct]] items +) noexcept: + cdef Promise_cint16_t __promise = Promise_cint16_t._fbthrift_create(cmove(cPromise)) + arg_items = _module_types.Map__string_SimpleStruct__from_cpp(deref(items)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_map_length_coro( + self, + __promise, + arg_items + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_sum_map_values( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint16_t] cPromise, + unique_ptr[cmap[string,cint16_t]] items +) noexcept: + cdef Promise_cint16_t __promise = Promise_cint16_t._fbthrift_create(cmove(cPromise)) + arg_items = _module_types.Map__string_i16__from_cpp(deref(items)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_sum_map_values_coro( + self, + __promise, + arg_items + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_complex_sum_i32( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise, + unique_ptr[_module_cbindings.cComplexStruct] counter +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + arg_counter = _module_types.ComplexStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cComplexStruct](counter.release())) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_complex_sum_i32_coro( + self, + __promise, + arg_counter + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_repeat_name( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[string]] cPromise, + unique_ptr[_module_cbindings.cComplexStruct] counter +) noexcept: + cdef Promise_string __promise = Promise_string._fbthrift_create(cmove(cPromise)) + arg_counter = _module_types.ComplexStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cComplexStruct](counter.release())) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_repeat_name_coro( + self, + __promise, + arg_counter + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_get_struct( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[_module_cbindings.cSimpleStruct]] cPromise +) noexcept: + cdef Promise__module_cbindings_cSimpleStruct __promise = Promise__module_cbindings_cSimpleStruct._fbthrift_create(cmove(cPromise)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_get_struct_coro( + self, + __promise + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_fib( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[vector[cint32_t]]] cPromise, + cint16_t n +) noexcept: + cdef Promise_vector__cint32_t __promise = Promise_vector__cint32_t._fbthrift_create(cmove(cPromise)) + arg_n = n + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_fib_coro( + self, + __promise, + arg_n + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_unique_words( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[cset[string]]] cPromise, + unique_ptr[vector[string]] words +) noexcept: + cdef Promise_cset__string __promise = Promise_cset__string._fbthrift_create(cmove(cPromise)) + arg_words = _module_types.List__string__from_cpp(deref(words)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_unique_words_coro( + self, + __promise, + arg_words + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_words_count( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[cmap[string,cint16_t]]] cPromise, + unique_ptr[vector[string]] words +) noexcept: + cdef Promise_cmap__string_cint16_t __promise = Promise_cmap__string_cint16_t._fbthrift_create(cmove(cPromise)) + arg_words = _module_types.List__string__from_cpp(deref(words)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_words_count_coro( + self, + __promise, + arg_words + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_set_enum( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[_module_cbindings.cAnEnum] cPromise, + _module_cbindings.cAnEnum in_enum +) noexcept: + cdef Promise__module_cbindings_cAnEnum __promise = Promise__module_cbindings_cAnEnum._fbthrift_create(cmove(cPromise)) + arg_in_enum = _module_types.AnEnum( in_enum) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_set_enum_coro( + self, + __promise, + arg_in_enum + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_list_of_lists( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[vector[vector[cint32_t]]]] cPromise, + cint16_t num_lists, + cint16_t num_items +) noexcept: + cdef Promise_vector__vector__cint32_t __promise = Promise_vector__vector__cint32_t._fbthrift_create(cmove(cPromise)) + arg_num_lists = num_lists + arg_num_items = num_items + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_list_of_lists_coro( + self, + __promise, + arg_num_lists, + arg_num_items + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_word_character_frequency( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[cmap[string,cmap[string,cint32_t]]]] cPromise, + unique_ptr[string] sentence +) noexcept: + cdef Promise_cmap__string_cmap__string_cint32_t __promise = Promise_cmap__string_cmap__string_cint32_t._fbthrift_create(cmove(cPromise)) + arg_sentence = (deref(sentence)).data().decode('UTF-8') + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_word_character_frequency_coro( + self, + __promise, + arg_sentence + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_list_of_sets( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[vector[cset[string]]]] cPromise, + unique_ptr[string] some_words +) noexcept: + cdef Promise_vector__cset__string __promise = Promise_vector__cset__string._fbthrift_create(cmove(cPromise)) + arg_some_words = (deref(some_words)).data().decode('UTF-8') + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_list_of_sets_coro( + self, + __promise, + arg_some_words + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_nested_map_argument( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise, + unique_ptr[cmap[string,vector[_module_cbindings.cSimpleStruct]]] struct_map +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + arg_struct_map = _module_types.Map__string_List__SimpleStruct__from_cpp(deref(struct_map)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_nested_map_argument_coro( + self, + __promise, + arg_struct_map + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_make_sentence( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[string]] cPromise, + unique_ptr[vector[vector[string]]] word_chars +) noexcept: + cdef Promise_string __promise = Promise_string._fbthrift_create(cmove(cPromise)) + arg_word_chars = _module_types.List__List__string__from_cpp(deref(word_chars)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_make_sentence_coro( + self, + __promise, + arg_word_chars + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_get_union( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[cset[cint32_t]]] cPromise, + unique_ptr[vector[cset[cint32_t]]] sets +) noexcept: + cdef Promise_cset__cint32_t __promise = Promise_cset__cint32_t._fbthrift_create(cmove(cPromise)) + arg_sets = _module_types.List__Set__i32__from_cpp(deref(sets)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_get_union_coro( + self, + __promise, + arg_sets + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_get_keys( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[cset[string]]] cPromise, + unique_ptr[vector[cmap[string,string]]] string_map +) noexcept: + cdef Promise_cset__string __promise = Promise_cset__string._fbthrift_create(cmove(cPromise)) + arg_string_map = _module_types.List__Map__string_string__from_cpp(deref(string_map)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_get_keys_coro( + self, + __promise, + arg_string_map + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_lookup_double( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[double] cPromise, + cint32_t key +) noexcept: + cdef Promise_double __promise = Promise_double._fbthrift_create(cmove(cPromise)) + arg_key = key + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_lookup_double_coro( + self, + __promise, + arg_key + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_retrieve_binary( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[string]] cPromise, + unique_ptr[string] something +) noexcept: + cdef Promise_binary __promise = Promise_binary._fbthrift_create(cmove(cPromise)) + arg_something = (deref(something)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_retrieve_binary_coro( + self, + __promise, + arg_something + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_contain_binary( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[cset[string]]] cPromise, + unique_ptr[vector[string]] binaries +) noexcept: + cdef Promise_cset__binary __promise = Promise_cset__binary._fbthrift_create(cmove(cPromise)) + arg_binaries = _module_types.List__binary__from_cpp(deref(binaries)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_contain_binary_coro( + self, + __promise, + arg_binaries + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_contain_enum( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[vector[_module_cbindings.cAnEnum]]] cPromise, + unique_ptr[vector[_module_cbindings.cAnEnum]] the_enum +) noexcept: + cdef Promise_vector___module_cbindings_cAnEnum __promise = Promise_vector___module_cbindings_cAnEnum._fbthrift_create(cmove(cPromise)) + arg_the_enum = _module_types.List__AnEnum__from_cpp(deref(the_enum)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_contain_enum_coro( + self, + __promise, + arg_the_enum + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_get_binary_union_struct( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[unique_ptr[_module_cbindings.cBinaryUnionStruct]] cPromise, + unique_ptr[_module_cbindings.cBinaryUnion] u +) noexcept: + cdef Promise__module_cbindings_cBinaryUnionStruct __promise = Promise__module_cbindings_cBinaryUnionStruct._fbthrift_create(cmove(cPromise)) + arg_u = _module_types.BinaryUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cBinaryUnion](u.release())) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + SimpleService_get_binary_union_struct_coro( + self, + __promise, + arg_u + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_SimpleService_onStartServing( + object self, + cFollyPromise[cFollyUnit] cPromise +) noexcept: + cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) + asyncio.get_event_loop().create_task( + SimpleService_onStartServing_coro( + self, + __promise + ) + ) +cdef api void call_cy_SimpleService_onStopRequested( + object self, + cFollyPromise[cFollyUnit] cPromise +) noexcept: + cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) + asyncio.get_event_loop().create_task( + SimpleService_onStopRequested_coro( + self, + __promise + ) + ) +async def SimpleService_get_five_coro( + object self, + Promise_cint32_t promise +): + try: + result = await self.get_five() + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.get_five:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.get_five:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_add_five_coro( + object self, + Promise_cint32_t promise, + num +): + try: + result = await self.add_five( + num) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.add_five:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.add_five:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_do_nothing_coro( + object self, + Promise_cFollyUnit promise +): + try: + result = await self.do_nothing() + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.do_nothing:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.do_nothing:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(c_unit) + +async def SimpleService_concat_coro( + object self, + Promise_string promise, + first, + second +): + try: + result = await self.concat( + first, + second) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.concat:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.concat:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[string]( result.encode('UTF-8'))) + +async def SimpleService_get_value_coro( + object self, + Promise_cint32_t promise, + simple_struct +): + try: + result = await self.get_value( + simple_struct) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.get_value:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.get_value:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_negate_coro( + object self, + Promise_cbool promise, + input +): + try: + result = await self.negate( + input) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.negate:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.negate:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_tiny_coro( + object self, + Promise_cint8_t promise, + input +): + try: + result = await self.tiny( + input) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.tiny:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.tiny:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_small_coro( + object self, + Promise_cint16_t promise, + input +): + try: + result = await self.small( + input) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.small:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.small:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_big_coro( + object self, + Promise_cint64_t promise, + input +): + try: + result = await self.big( + input) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.big:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.big:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_two_coro( + object self, + Promise_double promise, + input +): + try: + result = await self.two( + input) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.two:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.two:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_expected_exception_coro( + object self, + Promise_cFollyUnit promise +): + try: + result = await self.expected_exception() + except _module_types.SimpleException as ex: + promise.cPromise.setException(deref((<_module_types.SimpleException> ex)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.expected_exception:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.expected_exception:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(c_unit) + +async def SimpleService_unexpected_exception_coro( + object self, + Promise_cint32_t promise +): + try: + result = await self.unexpected_exception() + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.unexpected_exception:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.unexpected_exception:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_sum_i16_list_coro( + object self, + Promise_cint32_t promise, + numbers +): + try: + result = await self.sum_i16_list( + numbers) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.sum_i16_list:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.sum_i16_list:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_sum_i32_list_coro( + object self, + Promise_cint32_t promise, + numbers +): + try: + result = await self.sum_i32_list( + numbers) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.sum_i32_list:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.sum_i32_list:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_sum_i64_list_coro( + object self, + Promise_cint32_t promise, + numbers +): + try: + result = await self.sum_i64_list( + numbers) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.sum_i64_list:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.sum_i64_list:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_concat_many_coro( + object self, + Promise_string promise, + words +): + try: + result = await self.concat_many( + words) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.concat_many:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.concat_many:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[string]( result.encode('UTF-8'))) + +async def SimpleService_count_structs_coro( + object self, + Promise_cint32_t promise, + items +): + try: + result = await self.count_structs( + items) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.count_structs:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.count_structs:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_sum_set_coro( + object self, + Promise_cint32_t promise, + numbers +): + try: + result = await self.sum_set( + numbers) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.sum_set:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.sum_set:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_contains_word_coro( + object self, + Promise_cbool promise, + words, + word +): + try: + result = await self.contains_word( + words, + word) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.contains_word:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.contains_word:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_get_map_value_coro( + object self, + Promise_string promise, + words, + key +): + try: + result = await self.get_map_value( + words, + key) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.get_map_value:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.get_map_value:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[string]( result.encode('UTF-8'))) + +async def SimpleService_map_length_coro( + object self, + Promise_cint16_t promise, + items +): + try: + result = await self.map_length( + items) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.map_length:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.map_length:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_sum_map_values_coro( + object self, + Promise_cint16_t promise, + items +): + try: + result = await self.sum_map_values( + items) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.sum_map_values:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.sum_map_values:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_complex_sum_i32_coro( + object self, + Promise_cint32_t promise, + counter +): + try: + result = await self.complex_sum_i32( + counter) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.complex_sum_i32:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.complex_sum_i32:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_repeat_name_coro( + object self, + Promise_string promise, + counter +): + try: + result = await self.repeat_name( + counter) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.repeat_name:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.repeat_name:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[string]( result.encode('UTF-8'))) + +async def SimpleService_get_struct_coro( + object self, + Promise__module_cbindings_cSimpleStruct promise +): + try: + result = await self.get_struct() + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.get_struct:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.get_struct:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[_module_cbindings.cSimpleStruct](deref((<_module_types.SimpleStruct?> result)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))) + +async def SimpleService_fib_coro( + object self, + Promise_vector__cint32_t promise, + n +): + try: + result = await self.fib( + n) + result = _module_types.List__i32(result) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.fib:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.fib:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[vector[cint32_t]](_module_types.List__i32__make_instance(result))) + +async def SimpleService_unique_words_coro( + object self, + Promise_cset__string promise, + words +): + try: + result = await self.unique_words( + words) + result = _module_types.Set__string(result) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.unique_words:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.unique_words:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[cset[string]](_module_types.Set__string__make_instance(result))) + +async def SimpleService_words_count_coro( + object self, + Promise_cmap__string_cint16_t promise, + words +): + try: + result = await self.words_count( + words) + result = _module_types.Map__string_i16(result) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.words_count:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.words_count:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[cmap[string,cint16_t]](_module_types.Map__string_i16__make_instance(result))) + +async def SimpleService_set_enum_coro( + object self, + Promise__module_cbindings_cAnEnum promise, + in_enum +): + try: + result = await self.set_enum( + in_enum) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.set_enum:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.set_enum:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(<_module_cbindings.cAnEnum>result) + +async def SimpleService_list_of_lists_coro( + object self, + Promise_vector__vector__cint32_t promise, + num_lists, + num_items +): + try: + result = await self.list_of_lists( + num_lists, + num_items) + result = _module_types.List__List__i32(result) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.list_of_lists:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.list_of_lists:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[vector[vector[cint32_t]]](_module_types.List__List__i32__make_instance(result))) + +async def SimpleService_word_character_frequency_coro( + object self, + Promise_cmap__string_cmap__string_cint32_t promise, + sentence +): + try: + result = await self.word_character_frequency( + sentence) + result = _module_types.Map__string_Map__string_i32(result) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.word_character_frequency:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.word_character_frequency:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[cmap[string,cmap[string,cint32_t]]](_module_types.Map__string_Map__string_i32__make_instance(result))) + +async def SimpleService_list_of_sets_coro( + object self, + Promise_vector__cset__string promise, + some_words +): + try: + result = await self.list_of_sets( + some_words) + result = _module_types.List__Set__string(result) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.list_of_sets:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.list_of_sets:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[vector[cset[string]]](_module_types.List__Set__string__make_instance(result))) + +async def SimpleService_nested_map_argument_coro( + object self, + Promise_cint32_t promise, + struct_map +): + try: + result = await self.nested_map_argument( + struct_map) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.nested_map_argument:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.nested_map_argument:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_make_sentence_coro( + object self, + Promise_string promise, + word_chars +): + try: + result = await self.make_sentence( + word_chars) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.make_sentence:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.make_sentence:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[string]( result.encode('UTF-8'))) + +async def SimpleService_get_union_coro( + object self, + Promise_cset__cint32_t promise, + sets +): + try: + result = await self.get_union( + sets) + result = _module_types.Set__i32(result) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.get_union:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.get_union:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[cset[cint32_t]](_module_types.Set__i32__make_instance(result))) + +async def SimpleService_get_keys_coro( + object self, + Promise_cset__string promise, + string_map +): + try: + result = await self.get_keys( + string_map) + result = _module_types.Set__string(result) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.get_keys:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.get_keys:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[cset[string]](_module_types.Set__string__make_instance(result))) + +async def SimpleService_lookup_double_coro( + object self, + Promise_double promise, + key +): + try: + result = await self.lookup_double( + key) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.lookup_double:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.lookup_double:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def SimpleService_retrieve_binary_coro( + object self, + Promise_binary promise, + something +): + try: + result = await self.retrieve_binary( + something) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.retrieve_binary:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.retrieve_binary:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[string]( result)) + +async def SimpleService_contain_binary_coro( + object self, + Promise_cset__binary promise, + binaries +): + try: + result = await self.contain_binary( + binaries) + result = _module_types.Set__binary(result) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.contain_binary:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.contain_binary:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[cset[string]](_module_types.Set__binary__make_instance(result))) + +async def SimpleService_contain_enum_coro( + object self, + Promise_vector___module_cbindings_cAnEnum promise, + the_enum +): + try: + result = await self.contain_enum( + the_enum) + result = _module_types.List__AnEnum(result) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.contain_enum:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.contain_enum:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[vector[_module_cbindings.cAnEnum]](_module_types.List__AnEnum__make_instance(result))) + +async def SimpleService_get_binary_union_struct_coro( + object self, + Promise__module_cbindings_cBinaryUnionStruct promise, + u +): + try: + result = await self.get_binary_union_struct( + u) + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.get_binary_union_struct:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.get_binary_union_struct:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(make_unique[_module_cbindings.cBinaryUnionStruct](deref((<_module_types.BinaryUnionStruct?> result)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE))) + +async def SimpleService_onStartServing_coro( + object self, + Promise_cFollyUnit promise +): + try: + result = await self.onStartServing() + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.onStartServing:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.onStartServing:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(c_unit) + +async def SimpleService_onStopRequested_coro( + object self, + Promise_cFollyUnit promise +): + try: + result = await self.onStopRequested() + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler SimpleService.onStopRequested:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler SimpleService.onStopRequested:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(c_unit) + +cdef api void call_cy_DerivedService_get_six( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + DerivedService_get_six_coro( + self, + __promise + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_DerivedService_onStartServing( + object self, + cFollyPromise[cFollyUnit] cPromise +) noexcept: + cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) + asyncio.get_event_loop().create_task( + DerivedService_onStartServing_coro( + self, + __promise + ) + ) +cdef api void call_cy_DerivedService_onStopRequested( + object self, + cFollyPromise[cFollyUnit] cPromise +) noexcept: + cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) + asyncio.get_event_loop().create_task( + DerivedService_onStopRequested_coro( + self, + __promise + ) + ) +async def DerivedService_get_six_coro( + object self, + Promise_cint32_t promise +): + try: + result = await self.get_six() + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler DerivedService.get_six:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler DerivedService.get_six:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def DerivedService_onStartServing_coro( + object self, + Promise_cFollyUnit promise +): + try: + result = await self.onStartServing() + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler DerivedService.onStartServing:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler DerivedService.onStartServing:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(c_unit) + +async def DerivedService_onStopRequested_coro( + object self, + Promise_cFollyUnit promise +): + try: + result = await self.onStopRequested() + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler DerivedService.onStopRequested:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler DerivedService.onStopRequested:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(c_unit) + +cdef api void call_cy_RederivedService_get_seven( + object self, + Cpp2RequestContext* ctx, + cFollyPromise[cint32_t] cPromise +) noexcept: + cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) + __context = RequestContext._fbthrift_create(ctx) + __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) + asyncio.get_event_loop().create_task( + RederivedService_get_seven_coro( + self, + __promise + ) + ) + __THRIFT_REQUEST_CONTEXT.reset(__context_token) +cdef api void call_cy_RederivedService_onStartServing( + object self, + cFollyPromise[cFollyUnit] cPromise +) noexcept: + cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) + asyncio.get_event_loop().create_task( + RederivedService_onStartServing_coro( + self, + __promise + ) + ) +cdef api void call_cy_RederivedService_onStopRequested( + object self, + cFollyPromise[cFollyUnit] cPromise +) noexcept: + cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) + asyncio.get_event_loop().create_task( + RederivedService_onStopRequested_coro( + self, + __promise + ) + ) +async def RederivedService_get_seven_coro( + object self, + Promise_cint32_t promise +): + try: + result = await self.get_seven() + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler RederivedService.get_seven:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler RederivedService.get_seven:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue( result) + +async def RederivedService_onStartServing_coro( + object self, + Promise_cFollyUnit promise +): + try: + result = await self.onStartServing() + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler RederivedService.onStartServing:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler RederivedService.onStartServing:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(c_unit) + +async def RederivedService_onStopRequested_coro( + object self, + Promise_cFollyUnit promise +): + try: + result = await self.onStopRequested() + except __ApplicationError as ex: + # If the handler raised an ApplicationError convert it to a C++ one + promise.cPromise.setException(cTApplicationException( + ex.type.value, ex.message.encode('UTF-8') + )) + except Exception as ex: + print( + "Unexpected error in service handler RederivedService.onStopRequested:", + file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') + )) + except asyncio.CancelledError as ex: + print("Coroutine was cancelled in service handler RederivedService.onStopRequested:", file=sys.stderr) + traceback.print_exc() + promise.cPromise.setException(cTApplicationException( + cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') + )) + else: + promise.cPromise.setValue(c_unit) + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_interface.pxd b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_interface.pxd new file mode 100644 index 00000000000..2f5b4e62c28 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_interface.pxd @@ -0,0 +1,19 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-cpp2/module_handlers.h" namespace "::py3::simple": + cdef cppclass cSimpleServiceSvIf "::py3::simple::SimpleServiceSvIf": + pass + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-cpp2/module_handlers.h" namespace "::py3::simple": + cdef cppclass cDerivedServiceSvIf "::py3::simple::DerivedServiceSvIf": + pass + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-cpp2/module_handlers.h" namespace "::py3::simple": + cdef cppclass cRederivedServiceSvIf "::py3::simple::RederivedServiceSvIf": + pass diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_wrapper.cpp b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_wrapper.cpp new file mode 100644 index 00000000000..a07d2004d04 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_wrapper.cpp @@ -0,0 +1,1069 @@ +/** + * Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#include +#include +#include + +namespace py3 { +namespace simple { + +SimpleServiceWrapper::SimpleServiceWrapper(PyObject *obj, folly::Executor* exc) + : if_object(obj), executor(exc) + { + import_module__services(); + } + + +void SimpleServiceWrapper::async_tm_get_five( + apache::thrift::HandlerCallbackPtr callback) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_get_five( + this->if_object, + ctx, + std::move(promise) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_add_five( + apache::thrift::HandlerCallbackPtr callback + , int32_t num +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + num + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_add_five( + this->if_object, + ctx, + std::move(promise), + num ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_do_nothing( + apache::thrift::HandlerCallbackPtr callback) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_do_nothing( + this->if_object, + ctx, + std::move(promise) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_concat( + apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr first + , std::unique_ptr second +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + first = std::move(first), + second = std::move(second) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>(); + call_cy_SimpleService_concat( + this->if_object, + ctx, + std::move(promise), + std::move(first), + std::move(second) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_get_value( + apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr<::py3::simple::SimpleStruct> simple_struct +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + simple_struct = std::move(simple_struct) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_get_value( + this->if_object, + ctx, + std::move(promise), + std::move(simple_struct) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_negate( + apache::thrift::HandlerCallbackPtr callback + , bool input +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + input + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_negate( + this->if_object, + ctx, + std::move(promise), + input ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_tiny( + apache::thrift::HandlerCallbackPtr callback + , int8_t input +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + input + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_tiny( + this->if_object, + ctx, + std::move(promise), + input ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_small( + apache::thrift::HandlerCallbackPtr callback + , int16_t input +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + input + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_small( + this->if_object, + ctx, + std::move(promise), + input ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_big( + apache::thrift::HandlerCallbackPtr callback + , int64_t input +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + input + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_big( + this->if_object, + ctx, + std::move(promise), + input ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_two( + apache::thrift::HandlerCallbackPtr callback + , double input +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + input + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_two( + this->if_object, + ctx, + std::move(promise), + input ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_expected_exception( + apache::thrift::HandlerCallbackPtr callback) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_expected_exception( + this->if_object, + ctx, + std::move(promise) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_unexpected_exception( + apache::thrift::HandlerCallbackPtr callback) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_unexpected_exception( + this->if_object, + ctx, + std::move(promise) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_sum_i16_list( + apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> numbers +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + numbers = std::move(numbers) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_sum_i16_list( + this->if_object, + ctx, + std::move(promise), + std::move(numbers) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_sum_i32_list( + apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> numbers +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + numbers = std::move(numbers) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_sum_i32_list( + this->if_object, + ctx, + std::move(promise), + std::move(numbers) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_sum_i64_list( + apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> numbers +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + numbers = std::move(numbers) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_sum_i64_list( + this->if_object, + ctx, + std::move(promise), + std::move(numbers) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_concat_many( + apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr> words +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + words = std::move(words) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>(); + call_cy_SimpleService_concat_many( + this->if_object, + ctx, + std::move(promise), + std::move(words) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_count_structs( + apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> items +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + items = std::move(items) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_count_structs( + this->if_object, + ctx, + std::move(promise), + std::move(items) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_sum_set( + apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> numbers +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + numbers = std::move(numbers) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_sum_set( + this->if_object, + ctx, + std::move(promise), + std::move(numbers) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_contains_word( + apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> words + , std::unique_ptr word +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + words = std::move(words), + word = std::move(word) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_contains_word( + this->if_object, + ctx, + std::move(promise), + std::move(words), + std::move(word) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_get_map_value( + apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr> words + , std::unique_ptr key +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + words = std::move(words), + key = std::move(key) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>(); + call_cy_SimpleService_get_map_value( + this->if_object, + ctx, + std::move(promise), + std::move(words), + std::move(key) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_map_length( + apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> items +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + items = std::move(items) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_map_length( + this->if_object, + ctx, + std::move(promise), + std::move(items) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_sum_map_values( + apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> items +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + items = std::move(items) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_sum_map_values( + this->if_object, + ctx, + std::move(promise), + std::move(items) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_complex_sum_i32( + apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr<::py3::simple::ComplexStruct> counter +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + counter = std::move(counter) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_complex_sum_i32( + this->if_object, + ctx, + std::move(promise), + std::move(counter) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_repeat_name( + apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr<::py3::simple::ComplexStruct> counter +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + counter = std::move(counter) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>(); + call_cy_SimpleService_repeat_name( + this->if_object, + ctx, + std::move(promise), + std::move(counter) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_get_struct( + apache::thrift::HandlerCallbackPtr> callback) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>(); + call_cy_SimpleService_get_struct( + this->if_object, + ctx, + std::move(promise) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_fib( + apache::thrift::HandlerCallbackPtr>> callback + , int16_t n +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + n + ]() mutable { + auto [promise, future] = folly::makePromiseContract>>(); + call_cy_SimpleService_fib( + this->if_object, + ctx, + std::move(promise), + n ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_unique_words( + apache::thrift::HandlerCallbackPtr>> callback + , std::unique_ptr> words +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + words = std::move(words) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>>(); + call_cy_SimpleService_unique_words( + this->if_object, + ctx, + std::move(promise), + std::move(words) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_words_count( + apache::thrift::HandlerCallbackPtr>> callback + , std::unique_ptr> words +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + words = std::move(words) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>>(); + call_cy_SimpleService_words_count( + this->if_object, + ctx, + std::move(promise), + std::move(words) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_set_enum( + apache::thrift::HandlerCallbackPtr<::py3::simple::AnEnum> callback + , ::py3::simple::AnEnum in_enum +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + in_enum + ]() mutable { + auto [promise, future] = folly::makePromiseContract<::py3::simple::AnEnum>(); + call_cy_SimpleService_set_enum( + this->if_object, + ctx, + std::move(promise), + in_enum ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try<::py3::simple::AnEnum>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_list_of_lists( + apache::thrift::HandlerCallbackPtr>>> callback + , int16_t num_lists + , int16_t num_items +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + num_lists, + num_items + ]() mutable { + auto [promise, future] = folly::makePromiseContract>>>(); + call_cy_SimpleService_list_of_lists( + this->if_object, + ctx, + std::move(promise), + num_lists, + num_items ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>>>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_word_character_frequency( + apache::thrift::HandlerCallbackPtr>>> callback + , std::unique_ptr sentence +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + sentence = std::move(sentence) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>>>(); + call_cy_SimpleService_word_character_frequency( + this->if_object, + ctx, + std::move(promise), + std::move(sentence) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>>>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_list_of_sets( + apache::thrift::HandlerCallbackPtr>>> callback + , std::unique_ptr some_words +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + some_words = std::move(some_words) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>>>(); + call_cy_SimpleService_list_of_sets( + this->if_object, + ctx, + std::move(promise), + std::move(some_words) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>>>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_nested_map_argument( + apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr>> struct_map +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + struct_map = std::move(struct_map) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_nested_map_argument( + this->if_object, + ctx, + std::move(promise), + std::move(struct_map) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_make_sentence( + apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr>> word_chars +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + word_chars = std::move(word_chars) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>(); + call_cy_SimpleService_make_sentence( + this->if_object, + ctx, + std::move(promise), + std::move(word_chars) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_get_union( + apache::thrift::HandlerCallbackPtr>> callback + , std::unique_ptr>> sets +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + sets = std::move(sets) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>>(); + call_cy_SimpleService_get_union( + this->if_object, + ctx, + std::move(promise), + std::move(sets) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_get_keys( + apache::thrift::HandlerCallbackPtr>> callback + , std::unique_ptr>> string_map +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + string_map = std::move(string_map) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>>(); + call_cy_SimpleService_get_keys( + this->if_object, + ctx, + std::move(promise), + std::move(string_map) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_lookup_double( + apache::thrift::HandlerCallbackPtr callback + , int32_t key +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + key + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_lookup_double( + this->if_object, + ctx, + std::move(promise), + key ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_retrieve_binary( + apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr something +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + something = std::move(something) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>(); + call_cy_SimpleService_retrieve_binary( + this->if_object, + ctx, + std::move(promise), + std::move(something) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_contain_binary( + apache::thrift::HandlerCallbackPtr>> callback + , std::unique_ptr> binaries +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + binaries = std::move(binaries) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>>(); + call_cy_SimpleService_contain_binary( + this->if_object, + ctx, + std::move(promise), + std::move(binaries) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_contain_enum( + apache::thrift::HandlerCallbackPtr>> callback + , std::unique_ptr> the_enum +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + the_enum = std::move(the_enum) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>>(); + call_cy_SimpleService_contain_enum( + this->if_object, + ctx, + std::move(promise), + std::move(the_enum) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +void SimpleServiceWrapper::async_tm_get_binary_union_struct( + apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr<::py3::simple::BinaryUnion> u +) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback), + u = std::move(u) + ]() mutable { + auto [promise, future] = folly::makePromiseContract>(); + call_cy_SimpleService_get_binary_union_struct( + this->if_object, + ctx, + std::move(promise), + std::move(u) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try>&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +std::shared_ptr SimpleServiceInterface(PyObject *if_object, folly::Executor *exc) { + return std::make_shared(if_object, exc); +} +folly::SemiFuture SimpleServiceWrapper::semifuture_onStartServing() { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_onStartServing( + this->if_object, + std::move(promise) + ); + return std::move(future); +} +folly::SemiFuture SimpleServiceWrapper::semifuture_onStopRequested() { + auto [promise, future] = folly::makePromiseContract(); + call_cy_SimpleService_onStopRequested( + this->if_object, + std::move(promise) + ); + return std::move(future); +} + + +DerivedServiceWrapper::DerivedServiceWrapper(PyObject *obj, folly::Executor* exc) + : ::py3::simple::SimpleServiceWrapper(obj, exc) + { + import_module__services(); + } + +void DerivedServiceWrapper::async_tm_get_six( + apache::thrift::HandlerCallbackPtr callback) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_DerivedService_get_six( + this->if_object, + ctx, + std::move(promise) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +std::shared_ptr DerivedServiceInterface(PyObject *if_object, folly::Executor *exc) { + return std::make_shared(if_object, exc); +} +folly::SemiFuture DerivedServiceWrapper::semifuture_onStartServing() { + auto [promise, future] = folly::makePromiseContract(); + call_cy_DerivedService_onStartServing( + this->if_object, + std::move(promise) + ); + return std::move(future); +} +folly::SemiFuture DerivedServiceWrapper::semifuture_onStopRequested() { + auto [promise, future] = folly::makePromiseContract(); + call_cy_DerivedService_onStopRequested( + this->if_object, + std::move(promise) + ); + return std::move(future); +} + + +RederivedServiceWrapper::RederivedServiceWrapper(PyObject *obj, folly::Executor* exc) + : ::py3::simple::DerivedServiceWrapper(obj, exc) + { + import_module__services(); + } + +void RederivedServiceWrapper::async_tm_get_seven( + apache::thrift::HandlerCallbackPtr callback) { + auto ctx = callback->getRequestContext(); + folly::via( + this->executor, + [this, ctx, + callback = std::move(callback) + ]() mutable { + auto [promise, future] = folly::makePromiseContract(); + call_cy_RederivedService_get_seven( + this->if_object, + ctx, + std::move(promise) ); + std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try&& t) { + (void)t; + callback->complete(std::move(t)); + }); + }); +} +std::shared_ptr RederivedServiceInterface(PyObject *if_object, folly::Executor *exc) { + return std::make_shared(if_object, exc); +} +folly::SemiFuture RederivedServiceWrapper::semifuture_onStartServing() { + auto [promise, future] = folly::makePromiseContract(); + call_cy_RederivedService_onStartServing( + this->if_object, + std::move(promise) + ); + return std::move(future); +} +folly::SemiFuture RederivedServiceWrapper::semifuture_onStopRequested() { + auto [promise, future] = folly::makePromiseContract(); + call_cy_RederivedService_onStopRequested( + this->if_object, + std::move(promise) + ); + return std::move(future); +} +} // namespace py3 +} // namespace simple diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_wrapper.h b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_wrapper.h new file mode 100644 index 00000000000..dc2aed42bcc --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_wrapper.h @@ -0,0 +1,183 @@ +/** + * Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#pragma once +#if __has_include() +#include +#else +#include +#endif +#if __has_include() +#include +#else +#include +#endif +#if __has_include() +#include +#else +#include +#endif +#include +#include + +#include + +namespace py3 { +namespace simple { + +class SimpleServiceWrapper : virtual public SimpleServiceSvIf { + protected: + PyObject *if_object; + folly::Executor *executor; + public: + explicit SimpleServiceWrapper(PyObject *if_object, folly::Executor *exc); + void async_tm_get_five(apache::thrift::HandlerCallbackPtr callback) override; + void async_tm_add_five(apache::thrift::HandlerCallbackPtr callback + , int32_t num + ) override; + void async_tm_do_nothing(apache::thrift::HandlerCallbackPtr callback) override; + void async_tm_concat(apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr first + , std::unique_ptr second + ) override; + void async_tm_get_value(apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr<::py3::simple::SimpleStruct> simple_struct + ) override; + void async_tm_negate(apache::thrift::HandlerCallbackPtr callback + , bool input + ) override; + void async_tm_tiny(apache::thrift::HandlerCallbackPtr callback + , int8_t input + ) override; + void async_tm_small(apache::thrift::HandlerCallbackPtr callback + , int16_t input + ) override; + void async_tm_big(apache::thrift::HandlerCallbackPtr callback + , int64_t input + ) override; + void async_tm_two(apache::thrift::HandlerCallbackPtr callback + , double input + ) override; + void async_tm_expected_exception(apache::thrift::HandlerCallbackPtr callback) override; + void async_tm_unexpected_exception(apache::thrift::HandlerCallbackPtr callback) override; + void async_tm_sum_i16_list(apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> numbers + ) override; + void async_tm_sum_i32_list(apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> numbers + ) override; + void async_tm_sum_i64_list(apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> numbers + ) override; + void async_tm_concat_many(apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr> words + ) override; + void async_tm_count_structs(apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> items + ) override; + void async_tm_sum_set(apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> numbers + ) override; + void async_tm_contains_word(apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> words + , std::unique_ptr word + ) override; + void async_tm_get_map_value(apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr> words + , std::unique_ptr key + ) override; + void async_tm_map_length(apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> items + ) override; + void async_tm_sum_map_values(apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr> items + ) override; + void async_tm_complex_sum_i32(apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr<::py3::simple::ComplexStruct> counter + ) override; + void async_tm_repeat_name(apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr<::py3::simple::ComplexStruct> counter + ) override; + void async_tm_get_struct(apache::thrift::HandlerCallbackPtr> callback) override; + void async_tm_fib(apache::thrift::HandlerCallbackPtr>> callback + , int16_t n + ) override; + void async_tm_unique_words(apache::thrift::HandlerCallbackPtr>> callback + , std::unique_ptr> words + ) override; + void async_tm_words_count(apache::thrift::HandlerCallbackPtr>> callback + , std::unique_ptr> words + ) override; + void async_tm_set_enum(apache::thrift::HandlerCallbackPtr<::py3::simple::AnEnum> callback + , ::py3::simple::AnEnum in_enum + ) override; + void async_tm_list_of_lists(apache::thrift::HandlerCallbackPtr>>> callback + , int16_t num_lists + , int16_t num_items + ) override; + void async_tm_word_character_frequency(apache::thrift::HandlerCallbackPtr>>> callback + , std::unique_ptr sentence + ) override; + void async_tm_list_of_sets(apache::thrift::HandlerCallbackPtr>>> callback + , std::unique_ptr some_words + ) override; + void async_tm_nested_map_argument(apache::thrift::HandlerCallbackPtr callback + , std::unique_ptr>> struct_map + ) override; + void async_tm_make_sentence(apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr>> word_chars + ) override; + void async_tm_get_union(apache::thrift::HandlerCallbackPtr>> callback + , std::unique_ptr>> sets + ) override; + void async_tm_get_keys(apache::thrift::HandlerCallbackPtr>> callback + , std::unique_ptr>> string_map + ) override; + void async_tm_lookup_double(apache::thrift::HandlerCallbackPtr callback + , int32_t key + ) override; + void async_tm_retrieve_binary(apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr something + ) override; + void async_tm_contain_binary(apache::thrift::HandlerCallbackPtr>> callback + , std::unique_ptr> binaries + ) override; + void async_tm_contain_enum(apache::thrift::HandlerCallbackPtr>> callback + , std::unique_ptr> the_enum + ) override; + void async_tm_get_binary_union_struct(apache::thrift::HandlerCallbackPtr> callback + , std::unique_ptr<::py3::simple::BinaryUnion> u + ) override; +folly::SemiFuture semifuture_onStartServing() override; +folly::SemiFuture semifuture_onStopRequested() override; +}; + +std::shared_ptr SimpleServiceInterface(PyObject *if_object, folly::Executor *exc); + + +class DerivedServiceWrapper : public ::py3::simple::SimpleServiceWrapper, virtual public DerivedServiceSvIf { + public: + explicit DerivedServiceWrapper(PyObject *if_object, folly::Executor *exc); + void async_tm_get_six(apache::thrift::HandlerCallbackPtr callback) override; +folly::SemiFuture semifuture_onStartServing() override; +folly::SemiFuture semifuture_onStopRequested() override; +}; + +std::shared_ptr DerivedServiceInterface(PyObject *if_object, folly::Executor *exc); + + +class RederivedServiceWrapper : public ::py3::simple::DerivedServiceWrapper, virtual public RederivedServiceSvIf { + public: + explicit RederivedServiceWrapper(PyObject *if_object, folly::Executor *exc); + void async_tm_get_seven(apache::thrift::HandlerCallbackPtr callback) override; +folly::SemiFuture semifuture_onStartServing() override; +folly::SemiFuture semifuture_onStopRequested() override; +}; + +std::shared_ptr RederivedServiceInterface(PyObject *if_object, folly::Executor *exc); +} // namespace py3 +} // namespace simple diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_wrapper.pxd b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_wrapper.pxd new file mode 100644 index 00000000000..cd651875651 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/services_wrapper.pxd @@ -0,0 +1,17 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +from cpython.ref cimport PyObject +from libcpp.memory cimport shared_ptr +from thrift.py3.server cimport cAsyncProcessorFactory +from folly cimport cFollyExecutor + + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-py3/module/services_wrapper.h" namespace "::py3::simple": + shared_ptr[cAsyncProcessorFactory] cSimpleServiceInterface "::py3::simple::SimpleServiceInterface"(PyObject *if_object, cFollyExecutor* Q) except * + shared_ptr[cAsyncProcessorFactory] cDerivedServiceInterface "::py3::simple::DerivedServiceInterface"(PyObject *if_object, cFollyExecutor* Q) except * + shared_ptr[cAsyncProcessorFactory] cRederivedServiceInterface "::py3::simple::RederivedServiceInterface"(PyObject *if_object, cFollyExecutor* Q) except * diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.h b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.h new file mode 100644 index 00000000000..2dc5b52f044 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.h @@ -0,0 +1,327 @@ +/** + * Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#pragma once + +#include +#include + +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/module_data.h" +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/module_types.h" +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/module_metadata.h" +namespace thrift { +namespace py3 { + + + +template<> +inline void reset_field<::py3::simple::SimpleException>( + ::py3::simple::SimpleException& obj, uint16_t index) { + switch (index) { + case 0: + obj.err_code_ref().copy_from(default_inst<::py3::simple::SimpleException>().err_code_ref()); + return; + } +} + +template<> +inline void reset_field<::py3::simple::OptionalRefStruct>( + ::py3::simple::OptionalRefStruct& obj, uint16_t index) { + switch (index) { + case 0: + obj.optional_blob_ref()->reset(); + return; + } +} + +template<> +inline void reset_field<::py3::simple::SimpleStruct>( + ::py3::simple::SimpleStruct& obj, uint16_t index) { + switch (index) { + case 0: + obj.is_on_ref().copy_from(default_inst<::py3::simple::SimpleStruct>().is_on_ref()); + return; + case 1: + obj.tiny_int_ref().copy_from(default_inst<::py3::simple::SimpleStruct>().tiny_int_ref()); + return; + case 2: + obj.small_int_ref().copy_from(default_inst<::py3::simple::SimpleStruct>().small_int_ref()); + return; + case 3: + obj.nice_sized_int_ref().copy_from(default_inst<::py3::simple::SimpleStruct>().nice_sized_int_ref()); + return; + case 4: + obj.big_int_ref().copy_from(default_inst<::py3::simple::SimpleStruct>().big_int_ref()); + return; + case 5: + obj.real_ref().copy_from(default_inst<::py3::simple::SimpleStruct>().real_ref()); + return; + case 6: + obj.smaller_real_ref().copy_from(default_inst<::py3::simple::SimpleStruct>().smaller_real_ref()); + return; + case 7: + obj.something_ref().copy_from(default_inst<::py3::simple::SimpleStruct>().something_ref()); + return; + } +} + +template<> +inline void reset_field<::py3::simple::HiddenTypeFieldsStruct>( + ::py3::simple::HiddenTypeFieldsStruct& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::py3::simple::ComplexStruct>( + ::py3::simple::ComplexStruct& obj, uint16_t index) { + switch (index) { + case 0: + obj.structOne_ref().copy_from(default_inst<::py3::simple::ComplexStruct>().structOne_ref()); + return; + case 1: + obj.structTwo_ref().copy_from(default_inst<::py3::simple::ComplexStruct>().structTwo_ref()); + return; + case 2: + obj.an_integer_ref().copy_from(default_inst<::py3::simple::ComplexStruct>().an_integer_ref()); + return; + case 3: + obj.name_ref().copy_from(default_inst<::py3::simple::ComplexStruct>().name_ref()); + return; + case 4: + obj.an_enum_ref().copy_from(default_inst<::py3::simple::ComplexStruct>().an_enum_ref()); + return; + case 5: + obj.some_bytes_ref().copy_from(default_inst<::py3::simple::ComplexStruct>().some_bytes_ref()); + return; + case 6: + obj.from_ref().copy_from(default_inst<::py3::simple::ComplexStruct>().from_ref()); + return; + case 7: + obj.cdef_ref().copy_from(default_inst<::py3::simple::ComplexStruct>().cdef_ref()); + return; + case 8: + obj.bytes_with_cpp_type_ref().copy_from(default_inst<::py3::simple::ComplexStruct>().bytes_with_cpp_type_ref()); + return; + } +} + +template<> +inline void reset_field<::py3::simple::BinaryUnionStruct>( + ::py3::simple::BinaryUnionStruct& obj, uint16_t index) { + switch (index) { + case 0: + obj.u_ref().copy_from(default_inst<::py3::simple::BinaryUnionStruct>().u_ref()); + return; + } +} + +template<> +inline void reset_field<::py3::simple::CustomFields>( + ::py3::simple::CustomFields& obj, uint16_t index) { + switch (index) { + case 0: + obj.bool_field_ref().copy_from(default_inst<::py3::simple::CustomFields>().bool_field_ref()); + return; + case 1: + obj.integer_field_ref().copy_from(default_inst<::py3::simple::CustomFields>().integer_field_ref()); + return; + case 2: + obj.double_field_ref().copy_from(default_inst<::py3::simple::CustomFields>().double_field_ref()); + return; + case 3: + obj.string_field_ref().copy_from(default_inst<::py3::simple::CustomFields>().string_field_ref()); + return; + case 4: + obj.binary_field_ref().copy_from(default_inst<::py3::simple::CustomFields>().binary_field_ref()); + return; + case 5: + obj.list_field_ref().copy_from(default_inst<::py3::simple::CustomFields>().list_field_ref()); + return; + case 6: + obj.set_field_ref().copy_from(default_inst<::py3::simple::CustomFields>().set_field_ref()); + return; + case 7: + obj.map_field_ref().copy_from(default_inst<::py3::simple::CustomFields>().map_field_ref()); + return; + case 8: + obj.struct_field_ref().copy_from(default_inst<::py3::simple::CustomFields>().struct_field_ref()); + return; + } +} + +template<> +inline void reset_field<::py3::simple::CustomTypedefFields>( + ::py3::simple::CustomTypedefFields& obj, uint16_t index) { + switch (index) { + case 0: + obj.bool_field_ref().copy_from(default_inst<::py3::simple::CustomTypedefFields>().bool_field_ref()); + return; + case 1: + obj.integer_field_ref().copy_from(default_inst<::py3::simple::CustomTypedefFields>().integer_field_ref()); + return; + case 2: + obj.double_field_ref().copy_from(default_inst<::py3::simple::CustomTypedefFields>().double_field_ref()); + return; + case 3: + obj.string_field_ref().copy_from(default_inst<::py3::simple::CustomTypedefFields>().string_field_ref()); + return; + case 4: + obj.binary_field_ref().copy_from(default_inst<::py3::simple::CustomTypedefFields>().binary_field_ref()); + return; + case 5: + obj.list_field_ref().copy_from(default_inst<::py3::simple::CustomTypedefFields>().list_field_ref()); + return; + case 6: + obj.set_field_ref().copy_from(default_inst<::py3::simple::CustomTypedefFields>().set_field_ref()); + return; + case 7: + obj.map_field_ref().copy_from(default_inst<::py3::simple::CustomTypedefFields>().map_field_ref()); + return; + case 8: + obj.struct_field_ref().copy_from(default_inst<::py3::simple::CustomTypedefFields>().struct_field_ref()); + return; + } +} + +template<> +inline void reset_field<::py3::simple::AdaptedTypedefFields>( + ::py3::simple::AdaptedTypedefFields& obj, uint16_t index) { + switch (index) { + case 0: + obj.bool_field_ref().copy_from(default_inst<::py3::simple::AdaptedTypedefFields>().bool_field_ref()); + return; + case 1: + obj.integer_field_ref().copy_from(default_inst<::py3::simple::AdaptedTypedefFields>().integer_field_ref()); + return; + case 2: + obj.double_field_ref().copy_from(default_inst<::py3::simple::AdaptedTypedefFields>().double_field_ref()); + return; + case 3: + obj.string_field_ref().copy_from(default_inst<::py3::simple::AdaptedTypedefFields>().string_field_ref()); + return; + case 4: + obj.binary_field_ref().copy_from(default_inst<::py3::simple::AdaptedTypedefFields>().binary_field_ref()); + return; + case 5: + obj.list_field_ref().copy_from(default_inst<::py3::simple::AdaptedTypedefFields>().list_field_ref()); + return; + case 6: + obj.set_field_ref().copy_from(default_inst<::py3::simple::AdaptedTypedefFields>().set_field_ref()); + return; + case 7: + obj.map_field_ref().copy_from(default_inst<::py3::simple::AdaptedTypedefFields>().map_field_ref()); + return; + case 8: + obj.struct_field_ref().copy_from(default_inst<::py3::simple::AdaptedTypedefFields>().struct_field_ref()); + return; + } +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::py3::simple::SimpleException>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::py3::simple::OptionalRefStruct>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::py3::simple::SimpleStruct>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::py3::simple::HiddenTypeFieldsStruct>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::py3::simple::ComplexStruct>::namesmap() { + static const folly::Indestructible map { + { + {"from", "sender"}, + {"cdef", "cdef_"}, + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::py3::simple::BinaryUnion>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::py3::simple::BinaryUnionStruct>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::py3::simple::CustomFields>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::py3::simple::CustomTypedefFields>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::py3::simple::AdaptedTypedefFields>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} +} // namespace py3 +} // namespace thrift diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.pxd b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.pxd new file mode 100644 index 00000000000..293e48506c8 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.pxd @@ -0,0 +1,311 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +from libc.stdint cimport ( + int8_t as cint8_t, + int16_t as cint16_t, + int32_t as cint32_t, + int64_t as cint64_t, + uint16_t as cuint16_t, + uint32_t as cuint32_t, +) +from libcpp.string cimport string +from libcpp cimport bool as cbool, nullptr, nullptr_t +from cpython cimport bool as pbool +from libcpp.memory cimport shared_ptr, unique_ptr +from libcpp.vector cimport vector +from libcpp.set cimport set as cset +from libcpp.map cimport map as cmap, pair as cpair +from libcpp.unordered_map cimport unordered_map as cumap +cimport folly.iobuf as _fbthrift_iobuf +from thrift.python.exceptions cimport cTException +from thrift.py3.types cimport ( + bstring, + field_ref as __field_ref, + optional_field_ref as __optional_field_ref, + required_field_ref as __required_field_ref, + terse_field_ref as __terse_field_ref, + union_field_ref as __union_field_ref, + get_union_field_value as __get_union_field_value, +) +from thrift.python.common cimport cThriftMetadata as __fbthrift_cThriftMetadata +cimport thrift.py3.exceptions +cimport thrift.py3.types +from libc.stdint cimport int64_t +from thrift.python.common cimport ( + RpcOptions as __RpcOptions, + MetadataBox as __MetadataBox, +) +from folly.optional cimport cOptional as __cOptional + + +cimport module.types as _fbthrift_types +cimport module.types_fields as _fbthrift_types_fields +cimport module.cbindings as _module_cbindings + +cdef extern from "thrift/compiler/test/fixtures/py3/gen-py3/module/types.h": + pass + + + +cdef class SimpleException(thrift.py3.exceptions.GeneratedError): + cdef shared_ptr[_module_cbindings.cSimpleException] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + cdef _fbthrift_types_fields.__SimpleException_FieldsSetter _fields_setter + cdef inline object err_code_impl(self) + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cSimpleException]) + + + +cdef class OptionalRefStruct(thrift.py3.types.Struct): + cdef shared_ptr[_module_cbindings.cOptionalRefStruct] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + cdef _fbthrift_types_fields.__OptionalRefStruct_FieldsSetter _fields_setter + cdef inline object optional_blob_impl(self) + cdef _fbthrift_iobuf.IOBuf __fbthrift_cached_optional_blob + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cOptionalRefStruct]) + + + +cdef class SimpleStruct(thrift.py3.types.Struct): + cdef shared_ptr[_module_cbindings.cSimpleStruct] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + cdef _fbthrift_types_fields.__SimpleStruct_FieldsSetter _fields_setter + cdef inline object is_on_impl(self) + cdef inline object tiny_int_impl(self) + cdef inline object small_int_impl(self) + cdef inline object nice_sized_int_impl(self) + cdef inline object big_int_impl(self) + cdef inline object real_impl(self) + cdef inline object smaller_real_impl(self) + cdef inline object something_impl(self) + cdef object __fbthrift_cached_something + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cSimpleStruct]) + + + +cdef class HiddenTypeFieldsStruct(thrift.py3.types.Struct): + cdef shared_ptr[_module_cbindings.cHiddenTypeFieldsStruct] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + cdef _fbthrift_types_fields.__HiddenTypeFieldsStruct_FieldsSetter _fields_setter + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cHiddenTypeFieldsStruct]) + + + +cdef class ComplexStruct(thrift.py3.types.Struct): + cdef shared_ptr[_module_cbindings.cComplexStruct] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + cdef _fbthrift_types_fields.__ComplexStruct_FieldsSetter _fields_setter + cdef inline object structOne_impl(self) + cdef inline object structTwo_impl(self) + cdef inline object an_integer_impl(self) + cdef inline object name_impl(self) + cdef inline object an_enum_impl(self) + cdef inline object some_bytes_impl(self) + cdef inline object sender_impl(self) + cdef inline object cdef__impl(self) + cdef inline object bytes_with_cpp_type_impl(self) + cdef SimpleStruct __fbthrift_cached_structOne + cdef SimpleStruct __fbthrift_cached_structTwo + cdef object __fbthrift_cached_an_enum + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cComplexStruct]) + + + +cdef class BinaryUnion(thrift.py3.types.Union): + cdef shared_ptr[_module_cbindings.cBinaryUnion] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + cdef int64_t type_int + cdef object py_type + cdef object py_value + cdef _initialize_py(BinaryUnion self) + + @staticmethod + cdef unique_ptr[_module_cbindings.cBinaryUnion] _make_instance( + _module_cbindings.cBinaryUnion* base_instance, + _fbthrift_iobuf.IOBuf iobuf_val + ) except * + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cBinaryUnion]) + + + +cdef class BinaryUnionStruct(thrift.py3.types.Struct): + cdef shared_ptr[_module_cbindings.cBinaryUnionStruct] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + cdef _fbthrift_types_fields.__BinaryUnionStruct_FieldsSetter _fields_setter + cdef inline object u_impl(self) + cdef BinaryUnion __fbthrift_cached_u + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cBinaryUnionStruct]) + + + +cdef class CustomFields(thrift.py3.types.Struct): + cdef shared_ptr[_module_cbindings.cCustomFields] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + cdef _fbthrift_types_fields.__CustomFields_FieldsSetter _fields_setter + cdef inline object bool_field_impl(self) + cdef inline object integer_field_impl(self) + cdef inline object double_field_impl(self) + cdef inline object string_field_impl(self) + cdef inline object binary_field_impl(self) + cdef inline object list_field_impl(self) + cdef inline object set_field_impl(self) + cdef inline object map_field_impl(self) + cdef inline object struct_field_impl(self) + cdef object __fbthrift_cached_list_field + cdef object __fbthrift_cached_set_field + cdef object __fbthrift_cached_map_field + cdef SimpleStruct __fbthrift_cached_struct_field + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cCustomFields]) + + + +cdef class CustomTypedefFields(thrift.py3.types.Struct): + cdef shared_ptr[_module_cbindings.cCustomTypedefFields] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + cdef _fbthrift_types_fields.__CustomTypedefFields_FieldsSetter _fields_setter + cdef inline object bool_field_impl(self) + cdef inline object integer_field_impl(self) + cdef inline object double_field_impl(self) + cdef inline object string_field_impl(self) + cdef inline object binary_field_impl(self) + cdef inline object list_field_impl(self) + cdef inline object set_field_impl(self) + cdef inline object map_field_impl(self) + cdef inline object struct_field_impl(self) + cdef object __fbthrift_cached_list_field + cdef object __fbthrift_cached_set_field + cdef object __fbthrift_cached_map_field + cdef SimpleStruct __fbthrift_cached_struct_field + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cCustomTypedefFields]) + + + +cdef class AdaptedTypedefFields(thrift.py3.types.Struct): + cdef shared_ptr[_module_cbindings.cAdaptedTypedefFields] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE + cdef _fbthrift_types_fields.__AdaptedTypedefFields_FieldsSetter _fields_setter + cdef inline object bool_field_impl(self) + cdef inline object integer_field_impl(self) + cdef inline object double_field_impl(self) + cdef inline object string_field_impl(self) + cdef inline object binary_field_impl(self) + cdef inline object list_field_impl(self) + cdef inline object set_field_impl(self) + cdef inline object map_field_impl(self) + cdef inline object struct_field_impl(self) + cdef object __fbthrift_cached_list_field + cdef object __fbthrift_cached_set_field + cdef object __fbthrift_cached_map_field + cdef SimpleStruct __fbthrift_cached_struct_field + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cAdaptedTypedefFields]) + + +cdef vector[cint16_t] List__i16__make_instance(object items) except * +cdef object List__i16__from_cpp(const vector[cint16_t]&) except * + +cdef vector[cint32_t] List__i32__make_instance(object items) except * +cdef object List__i32__from_cpp(const vector[cint32_t]&) except * + +cdef vector[cint64_t] List__i64__make_instance(object items) except * +cdef object List__i64__from_cpp(const vector[cint64_t]&) except * + +cdef vector[string] List__string__make_instance(object items) except * +cdef object List__string__from_cpp(const vector[string]&) except * + +cdef vector[_module_cbindings.cSimpleStruct] List__SimpleStruct__make_instance(object items) except * +cdef object List__SimpleStruct__from_cpp(const vector[_module_cbindings.cSimpleStruct]&) except * + +cdef cset[cint32_t] Set__i32__make_instance(object items) except * +cdef object Set__i32__from_cpp(const cset[cint32_t]&) except * + +cdef cset[string] Set__string__make_instance(object items) except * +cdef object Set__string__from_cpp(const cset[string]&) except * + +cdef cmap[string,string] Map__string_string__make_instance(object items) except * +cdef object Map__string_string__from_cpp(const cmap[string,string]&) except * + +cdef cmap[string,_module_cbindings.cSimpleStruct] Map__string_SimpleStruct__make_instance(object items) except * +cdef object Map__string_SimpleStruct__from_cpp(const cmap[string,_module_cbindings.cSimpleStruct]&) except * + +cdef cmap[string,cint16_t] Map__string_i16__make_instance(object items) except * +cdef object Map__string_i16__from_cpp(const cmap[string,cint16_t]&) except * + +cdef vector[vector[cint32_t]] List__List__i32__make_instance(object items) except * +cdef object List__List__i32__from_cpp(const vector[vector[cint32_t]]&) except * + +cdef cmap[string,cint32_t] Map__string_i32__make_instance(object items) except * +cdef object Map__string_i32__from_cpp(const cmap[string,cint32_t]&) except * + +cdef cmap[string,cmap[string,cint32_t]] Map__string_Map__string_i32__make_instance(object items) except * +cdef object Map__string_Map__string_i32__from_cpp(const cmap[string,cmap[string,cint32_t]]&) except * + +cdef vector[cset[string]] List__Set__string__make_instance(object items) except * +cdef object List__Set__string__from_cpp(const vector[cset[string]]&) except * + +cdef cmap[string,vector[_module_cbindings.cSimpleStruct]] Map__string_List__SimpleStruct__make_instance(object items) except * +cdef object Map__string_List__SimpleStruct__from_cpp(const cmap[string,vector[_module_cbindings.cSimpleStruct]]&) except * + +cdef vector[vector[string]] List__List__string__make_instance(object items) except * +cdef object List__List__string__from_cpp(const vector[vector[string]]&) except * + +cdef vector[cset[cint32_t]] List__Set__i32__make_instance(object items) except * +cdef object List__Set__i32__from_cpp(const vector[cset[cint32_t]]&) except * + +cdef vector[cmap[string,string]] List__Map__string_string__make_instance(object items) except * +cdef object List__Map__string_string__from_cpp(const vector[cmap[string,string]]&) except * + +cdef vector[string] List__binary__make_instance(object items) except * +cdef object List__binary__from_cpp(const vector[string]&) except * + +cdef cset[string] Set__binary__make_instance(object items) except * +cdef object Set__binary__from_cpp(const cset[string]&) except * + +cdef vector[_module_cbindings.cAnEnum] List__AnEnum__make_instance(object items) except * +cdef object List__AnEnum__from_cpp(const vector[_module_cbindings.cAnEnum]&) except * + +cdef _module_cbindings._std_unordered_map[cint32_t,cint32_t] _std_unordered_map__Map__i32_i32__make_instance(object items) except * +cdef object _std_unordered_map__Map__i32_i32__from_cpp(const _module_cbindings._std_unordered_map[cint32_t,cint32_t]&) except * + +cdef _module_cbindings._MyType _MyType__List__i32__make_instance(object items) except * +cdef object _MyType__List__i32__from_cpp(const _module_cbindings._MyType&) except * + +cdef _module_cbindings._MyType _MyType__Set__i32__make_instance(object items) except * +cdef object _MyType__Set__i32__from_cpp(const _module_cbindings._MyType&) except * + +cdef _module_cbindings._MyType _MyType__Map__i32_i32__make_instance(object items) except * +cdef object _MyType__Map__i32_i32__from_cpp(const _module_cbindings._MyType&) except * + +cdef _module_cbindings._py3_simple_AdaptedList _py3_simple_AdaptedList__List__i32__make_instance(object items) except * +cdef object _py3_simple_AdaptedList__List__i32__from_cpp(const _module_cbindings._py3_simple_AdaptedList&) except * + +cdef _module_cbindings._py3_simple_AdaptedSet _py3_simple_AdaptedSet__Set__i32__make_instance(object items) except * +cdef object _py3_simple_AdaptedSet__Set__i32__from_cpp(const _module_cbindings._py3_simple_AdaptedSet&) except * + +cdef _module_cbindings._py3_simple_AdaptedMap _py3_simple_AdaptedMap__Map__i32_i32__make_instance(object items) except * +cdef object _py3_simple_AdaptedMap__Map__i32_i32__from_cpp(const _module_cbindings._py3_simple_AdaptedMap&) except * + +cdef cmap[cint32_t,double] Map__i32_double__make_instance(object items) except * +cdef object Map__i32_double__from_cpp(const cmap[cint32_t,double]&) except * + +cdef vector[cmap[cint32_t,double]] List__Map__i32_double__make_instance(object items) except * +cdef object List__Map__i32_double__from_cpp(const vector[cmap[cint32_t,double]]&) except * + +cdef cmap[_module_cbindings.cAnEnumRenamed,cint32_t] Map__AnEnumRenamed_i32__make_instance(object items) except * +cdef object Map__AnEnumRenamed_i32__from_cpp(const cmap[_module_cbindings.cAnEnumRenamed,cint32_t]&) except * + + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.py b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.py new file mode 100644 index 00000000000..23ce2f67166 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.py @@ -0,0 +1,6 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.pyi b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.pyi new file mode 100644 index 00000000000..8bf8def4945 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.pyi @@ -0,0 +1,964 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +import enum as _python_std_enum +import folly.iobuf as _fbthrift_iobuf +import thrift.py3.types +import thrift.python.types +import thrift.py3.exceptions +import typing as _typing + +import sys +import itertools + + +class AnEnum(thrift.python.types.Enum): + NOTSET: AnEnum = ... + ONE: AnEnum = ... + TWO: AnEnum = ... + THREE: AnEnum = ... + FOUR: AnEnum = ... + def _to_python(self) -> "module.thrift_types.AnEnum": ... # type: ignore + def _to_py3(self) -> AnEnum: ... + def _to_py_deprecated(self) -> int: ... + def __int__(self) -> int: ... + def __index__(self) -> int: ... + + +class AnEnumRenamed(thrift.python.types.Enum): + name_: AnEnumRenamed = ... + value_: AnEnumRenamed = ... + renamed_: AnEnumRenamed = ... + def _to_python(self) -> "module.thrift_types.AnEnumRenamed": ... # type: ignore + def _to_py3(self) -> AnEnumRenamed: ... + def _to_py_deprecated(self) -> int: ... + def __int__(self) -> int: ... + def __index__(self) -> int: ... + + +class Flags(thrift.python.types.Flag): + flag_A: Flags = ... + flag_B: Flags = ... + flag_C: Flags = ... + flag_D: Flags = ... + def _to_python(self) -> "module.thrift_types.Flags": ... # type: ignore + def _to_py3(self) -> Flags: ... + def _to_py_deprecated(self) -> int: ... + def __int__(self) -> int: ... + def __index__(self) -> int: ... + + +class SimpleException(thrift.py3.exceptions.GeneratedError, _typing.Hashable): + class __fbthrift_IsSet: + err_code: bool + pass + + err_code: _typing.Final[int] = ... + + def __init__( + self, *, + err_code: _typing.Optional[int]=None + ) -> None: ... + + def __hash__(self) -> int: ... + def __str__(self) -> str: ... + def __repr__(self) -> str: ... + def __lt__(self, other: 'SimpleException') -> bool: ... + def __gt__(self, other: 'SimpleException') -> bool: ... + def __le__(self, other: 'SimpleException') -> bool: ... + def __ge__(self, other: 'SimpleException') -> bool: ... + + def _to_python(self) -> "module.thrift_types.SimpleException": ... # type: ignore + def _to_py3(self) -> SimpleException: ... + def _to_py_deprecated(self) -> "module.ttypes.SimpleException": ... # type: ignore + +class OptionalRefStruct(thrift.py3.types.Struct, _typing.Hashable): + class __fbthrift_IsSet: + optional_blob: bool + pass + + optional_blob: _typing.Final[_typing.Optional[_fbthrift_iobuf.IOBuf]] = ... + + def __init__( + self, *, + optional_blob: _typing.Optional[_fbthrift_iobuf.IOBuf]=None + ) -> None: ... + + def __call__( + self, *, + optional_blob: _typing.Union[_fbthrift_iobuf.IOBuf, None]=None + ) -> OptionalRefStruct: ... + + def __reduce__(self) -> _typing.Tuple[_typing.Callable, _typing.Tuple[_typing.Type['OptionalRefStruct'], bytes]]: ... + def __hash__(self) -> int: ... + def __str__(self) -> str: ... + def __repr__(self) -> str: ... + def __lt__(self, other: 'OptionalRefStruct') -> bool: ... + def __gt__(self, other: 'OptionalRefStruct') -> bool: ... + def __le__(self, other: 'OptionalRefStruct') -> bool: ... + def __ge__(self, other: 'OptionalRefStruct') -> bool: ... + + def _to_python(self) -> "module.thrift_types.OptionalRefStruct": ... # type: ignore + def _to_py3(self) -> OptionalRefStruct: ... + def _to_py_deprecated(self) -> "module.ttypes.OptionalRefStruct": ... # type: ignore + +class SimpleStruct(thrift.py3.types.Struct, _typing.Hashable): + class __fbthrift_IsSet: + is_on: bool + tiny_int: bool + small_int: bool + nice_sized_int: bool + big_int: bool + real: bool + smaller_real: bool + something: bool + pass + + is_on: _typing.Final[bool] = ... + tiny_int: _typing.Final[int] = ... + small_int: _typing.Final[int] = ... + nice_sized_int: _typing.Final[int] = ... + big_int: _typing.Final[int] = ... + real: _typing.Final[float] = ... + smaller_real: _typing.Final[float] = ... + something: _typing.Final[_typing.Mapping[int, int]] = ... + + def __init__( + self, *, + is_on: _typing.Optional[bool]=None, + tiny_int: _typing.Optional[int]=None, + small_int: _typing.Optional[int]=None, + nice_sized_int: _typing.Optional[int]=None, + big_int: _typing.Optional[int]=None, + real: _typing.Optional[float]=None, + smaller_real: _typing.Optional[float]=None, + something: _typing.Optional[_typing.Mapping[int, int]]=None + ) -> None: ... + + def __call__( + self, *, + is_on: _typing.Union[bool, None]=None, + tiny_int: _typing.Union[int, None]=None, + small_int: _typing.Union[int, None]=None, + nice_sized_int: _typing.Union[int, None]=None, + big_int: _typing.Union[int, None]=None, + real: _typing.Union[float, None]=None, + smaller_real: _typing.Union[float, None]=None, + something: _typing.Union[_typing.Mapping[int, int], None]=None + ) -> SimpleStruct: ... + + def __reduce__(self) -> _typing.Tuple[_typing.Callable, _typing.Tuple[_typing.Type['SimpleStruct'], bytes]]: ... + def __hash__(self) -> int: ... + def __str__(self) -> str: ... + def __repr__(self) -> str: ... + + def _to_python(self) -> "module.thrift_types.SimpleStruct": ... # type: ignore + def _to_py3(self) -> SimpleStruct: ... + def _to_py_deprecated(self) -> "module.ttypes.SimpleStruct": ... # type: ignore + +class HiddenTypeFieldsStruct(thrift.py3.types.Struct, _typing.Hashable): + class __fbthrift_IsSet: + pass + + + def __init__( + self, + ) -> None: ... + + def __call__( + self, + ) -> HiddenTypeFieldsStruct: ... + + def __reduce__(self) -> _typing.Tuple[_typing.Callable, _typing.Tuple[_typing.Type['HiddenTypeFieldsStruct'], bytes]]: ... + def __hash__(self) -> int: ... + def __str__(self) -> str: ... + def __repr__(self) -> str: ... + + def _to_python(self) -> "module.thrift_types.HiddenTypeFieldsStruct": ... # type: ignore + def _to_py3(self) -> HiddenTypeFieldsStruct: ... + def _to_py_deprecated(self) -> "module.ttypes.HiddenTypeFieldsStruct": ... # type: ignore + +class ComplexStruct(thrift.py3.types.Struct, _typing.Hashable): + class __fbthrift_IsSet: + structOne: bool + structTwo: bool + an_integer: bool + name: bool + an_enum: bool + some_bytes: bool + sender: bool + cdef_: bool + bytes_with_cpp_type: bool + pass + + structOne: _typing.Final[SimpleStruct] = ... + structTwo: _typing.Final[SimpleStruct] = ... + an_integer: _typing.Final[int] = ... + name: _typing.Final[str] = ... + an_enum: _typing.Final[AnEnum] = ... + some_bytes: _typing.Final[bytes] = ... + sender: _typing.Final[str] = ... + cdef_: _typing.Final[str] = ... + bytes_with_cpp_type: _typing.Final[bytes] = ... + + def __init__( + self, *, + structOne: _typing.Optional[SimpleStruct]=None, + structTwo: _typing.Optional[SimpleStruct]=None, + an_integer: _typing.Optional[int]=None, + name: _typing.Optional[str]=None, + an_enum: _typing.Optional[AnEnum]=None, + some_bytes: _typing.Optional[bytes]=None, + sender: _typing.Optional[str]=None, + cdef_: _typing.Optional[str]=None, + bytes_with_cpp_type: _typing.Optional[bytes]=None + ) -> None: ... + + def __call__( + self, *, + structOne: _typing.Union[SimpleStruct, None]=None, + structTwo: _typing.Union[SimpleStruct, None]=None, + an_integer: _typing.Union[int, None]=None, + name: _typing.Union[str, None]=None, + an_enum: _typing.Union[AnEnum, None]=None, + some_bytes: _typing.Union[bytes, None]=None, + sender: _typing.Union[str, None]=None, + cdef_: _typing.Union[str, None]=None, + bytes_with_cpp_type: _typing.Union[bytes, None]=None + ) -> ComplexStruct: ... + + def __reduce__(self) -> _typing.Tuple[_typing.Callable, _typing.Tuple[_typing.Type['ComplexStruct'], bytes]]: ... + def __hash__(self) -> int: ... + def __str__(self) -> str: ... + def __repr__(self) -> str: ... + + def _to_python(self) -> "module.thrift_types.ComplexStruct": ... # type: ignore + def _to_py3(self) -> ComplexStruct: ... + def _to_py_deprecated(self) -> "module.ttypes.ComplexStruct": ... # type: ignore + +_BinaryUnionValueType = _typing.Union[None, _fbthrift_iobuf.IOBuf] + +class BinaryUnion(thrift.py3.types.Union, _typing.Hashable): + class __fbthrift_IsSet: + iobuf_val: bool + pass + + iobuf_val: _typing.Final[_fbthrift_iobuf.IOBuf] = ... + + def __init__( + self, *, + iobuf_val: _typing.Optional[_fbthrift_iobuf.IOBuf]=None + ) -> None: ... + + def __hash__(self) -> int: ... + def __str__(self) -> str: ... + def __repr__(self) -> str: ... + def __lt__(self, other: 'BinaryUnion') -> bool: ... + def __gt__(self, other: 'BinaryUnion') -> bool: ... + def __le__(self, other: 'BinaryUnion') -> bool: ... + def __ge__(self, other: 'BinaryUnion') -> bool: ... + + class Type(_python_std_enum.Enum): + EMPTY: BinaryUnion.Type = ... + iobuf_val: BinaryUnion.Type = ... + + @staticmethod + def fromValue(value: _BinaryUnionValueType) -> BinaryUnion: ... + type: _typing.Final[BinaryUnion.Type] + value: _typing.Final[_BinaryUnionValueType] + def get_type(self) -> BinaryUnion.Type: ... + + def _to_python(self) -> "module.thrift_types.BinaryUnion": ... # type: ignore + def _to_py3(self) -> BinaryUnion: ... + def _to_py_deprecated(self) -> "module.ttypes.BinaryUnion": ... # type: ignore + +class BinaryUnionStruct(thrift.py3.types.Struct, _typing.Hashable): + class __fbthrift_IsSet: + u: bool + pass + + u: _typing.Final[BinaryUnion] = ... + + def __init__( + self, *, + u: _typing.Optional[BinaryUnion]=None + ) -> None: ... + + def __call__( + self, *, + u: _typing.Union[BinaryUnion, None]=None + ) -> BinaryUnionStruct: ... + + def __reduce__(self) -> _typing.Tuple[_typing.Callable, _typing.Tuple[_typing.Type['BinaryUnionStruct'], bytes]]: ... + def __hash__(self) -> int: ... + def __str__(self) -> str: ... + def __repr__(self) -> str: ... + def __lt__(self, other: 'BinaryUnionStruct') -> bool: ... + def __gt__(self, other: 'BinaryUnionStruct') -> bool: ... + def __le__(self, other: 'BinaryUnionStruct') -> bool: ... + def __ge__(self, other: 'BinaryUnionStruct') -> bool: ... + + def _to_python(self) -> "module.thrift_types.BinaryUnionStruct": ... # type: ignore + def _to_py3(self) -> BinaryUnionStruct: ... + def _to_py_deprecated(self) -> "module.ttypes.BinaryUnionStruct": ... # type: ignore + +class CustomFields(thrift.py3.types.Struct, _typing.Hashable): + class __fbthrift_IsSet: + bool_field: bool + integer_field: bool + double_field: bool + string_field: bool + binary_field: bool + list_field: bool + set_field: bool + map_field: bool + struct_field: bool + pass + + bool_field: _typing.Final[bool] = ... + integer_field: _typing.Final[int] = ... + double_field: _typing.Final[float] = ... + string_field: _typing.Final[str] = ... + binary_field: _typing.Final[bytes] = ... + list_field: _typing.Final[_typing.Sequence[int]] = ... + set_field: _typing.Final[_typing.AbstractSet[int]] = ... + map_field: _typing.Final[_typing.Mapping[int, int]] = ... + struct_field: _typing.Final[SimpleStruct] = ... + + def __init__( + self, *, + bool_field: _typing.Optional[bool]=None, + integer_field: _typing.Optional[int]=None, + double_field: _typing.Optional[float]=None, + string_field: _typing.Optional[str]=None, + binary_field: _typing.Optional[bytes]=None, + list_field: _typing.Optional[_typing.Sequence[int]]=None, + set_field: _typing.Optional[_typing.AbstractSet[int]]=None, + map_field: _typing.Optional[_typing.Mapping[int, int]]=None, + struct_field: _typing.Optional[SimpleStruct]=None + ) -> None: ... + + def __call__( + self, *, + bool_field: _typing.Union[bool, None]=None, + integer_field: _typing.Union[int, None]=None, + double_field: _typing.Union[float, None]=None, + string_field: _typing.Union[str, None]=None, + binary_field: _typing.Union[bytes, None]=None, + list_field: _typing.Union[_typing.Sequence[int], None]=None, + set_field: _typing.Union[_typing.AbstractSet[int], None]=None, + map_field: _typing.Union[_typing.Mapping[int, int], None]=None, + struct_field: _typing.Union[SimpleStruct, None]=None + ) -> CustomFields: ... + + def __reduce__(self) -> _typing.Tuple[_typing.Callable, _typing.Tuple[_typing.Type['CustomFields'], bytes]]: ... + def __hash__(self) -> int: ... + def __str__(self) -> str: ... + def __repr__(self) -> str: ... + + def _to_python(self) -> "module.thrift_types.CustomFields": ... # type: ignore + def _to_py3(self) -> CustomFields: ... + def _to_py_deprecated(self) -> "module.ttypes.CustomFields": ... # type: ignore + +class CustomTypedefFields(thrift.py3.types.Struct, _typing.Hashable): + class __fbthrift_IsSet: + bool_field: bool + integer_field: bool + double_field: bool + string_field: bool + binary_field: bool + list_field: bool + set_field: bool + map_field: bool + struct_field: bool + pass + + bool_field: _typing.Final[bool] = ... + integer_field: _typing.Final[int] = ... + double_field: _typing.Final[float] = ... + string_field: _typing.Final[str] = ... + binary_field: _typing.Final[bytes] = ... + list_field: _typing.Final[_typing.Sequence[int]] = ... + set_field: _typing.Final[_typing.AbstractSet[int]] = ... + map_field: _typing.Final[_typing.Mapping[int, int]] = ... + struct_field: _typing.Final[SimpleStruct] = ... + + def __init__( + self, *, + bool_field: _typing.Optional[bool]=None, + integer_field: _typing.Optional[int]=None, + double_field: _typing.Optional[float]=None, + string_field: _typing.Optional[str]=None, + binary_field: _typing.Optional[bytes]=None, + list_field: _typing.Optional[_typing.Sequence[int]]=None, + set_field: _typing.Optional[_typing.AbstractSet[int]]=None, + map_field: _typing.Optional[_typing.Mapping[int, int]]=None, + struct_field: _typing.Optional[SimpleStruct]=None + ) -> None: ... + + def __call__( + self, *, + bool_field: _typing.Union[bool, None]=None, + integer_field: _typing.Union[int, None]=None, + double_field: _typing.Union[float, None]=None, + string_field: _typing.Union[str, None]=None, + binary_field: _typing.Union[bytes, None]=None, + list_field: _typing.Union[_typing.Sequence[int], None]=None, + set_field: _typing.Union[_typing.AbstractSet[int], None]=None, + map_field: _typing.Union[_typing.Mapping[int, int], None]=None, + struct_field: _typing.Union[SimpleStruct, None]=None + ) -> CustomTypedefFields: ... + + def __reduce__(self) -> _typing.Tuple[_typing.Callable, _typing.Tuple[_typing.Type['CustomTypedefFields'], bytes]]: ... + def __hash__(self) -> int: ... + def __str__(self) -> str: ... + def __repr__(self) -> str: ... + + def _to_python(self) -> "module.thrift_types.CustomTypedefFields": ... # type: ignore + def _to_py3(self) -> CustomTypedefFields: ... + def _to_py_deprecated(self) -> "module.ttypes.CustomTypedefFields": ... # type: ignore + +class AdaptedTypedefFields(thrift.py3.types.Struct, _typing.Hashable): + class __fbthrift_IsSet: + bool_field: bool + integer_field: bool + double_field: bool + string_field: bool + binary_field: bool + list_field: bool + set_field: bool + map_field: bool + struct_field: bool + pass + + bool_field: _typing.Final[bool] = ... + integer_field: _typing.Final[int] = ... + double_field: _typing.Final[float] = ... + string_field: _typing.Final[str] = ... + binary_field: _typing.Final[bytes] = ... + list_field: _typing.Final[_typing.Sequence[int]] = ... + set_field: _typing.Final[_typing.AbstractSet[int]] = ... + map_field: _typing.Final[_typing.Mapping[int, int]] = ... + struct_field: _typing.Final[SimpleStruct] = ... + + def __init__( + self, *, + bool_field: _typing.Optional[bool]=None, + integer_field: _typing.Optional[int]=None, + double_field: _typing.Optional[float]=None, + string_field: _typing.Optional[str]=None, + binary_field: _typing.Optional[bytes]=None, + list_field: _typing.Optional[_typing.Sequence[int]]=None, + set_field: _typing.Optional[_typing.AbstractSet[int]]=None, + map_field: _typing.Optional[_typing.Mapping[int, int]]=None, + struct_field: _typing.Optional[SimpleStruct]=None + ) -> None: ... + + def __call__( + self, *, + bool_field: _typing.Union[bool, None]=None, + integer_field: _typing.Union[int, None]=None, + double_field: _typing.Union[float, None]=None, + string_field: _typing.Union[str, None]=None, + binary_field: _typing.Union[bytes, None]=None, + list_field: _typing.Union[_typing.Sequence[int], None]=None, + set_field: _typing.Union[_typing.AbstractSet[int], None]=None, + map_field: _typing.Union[_typing.Mapping[int, int], None]=None, + struct_field: _typing.Union[SimpleStruct, None]=None + ) -> AdaptedTypedefFields: ... + + def __reduce__(self) -> _typing.Tuple[_typing.Callable, _typing.Tuple[_typing.Type['AdaptedTypedefFields'], bytes]]: ... + def __hash__(self) -> int: ... + def __str__(self) -> str: ... + def __repr__(self) -> str: ... + + def _to_python(self) -> "module.thrift_types.AdaptedTypedefFields": ... # type: ignore + def _to_py3(self) -> AdaptedTypedefFields: ... + def _to_py_deprecated(self) -> "module.ttypes.AdaptedTypedefFields": ... # type: ignore + +_List__i16T = _typing.TypeVar('_List__i16T', bound=_typing.Sequence[int]) + + +class List__i16(_typing.Sequence[int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[int]: ... + @_typing.overload + def __getitem__(self, i: int) -> int: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[int]: ... + def __add__(self, other: _typing.Sequence[int]) -> 'List__i16': ... + def __radd__(self, other: _List__i16T) -> _List__i16T: ... + def __reversed__(self) -> _typing.Iterator[int]: ... + def __iter__(self) -> _typing.Iterator[int]: ... + + +_List__i32T = _typing.TypeVar('_List__i32T', bound=_typing.Sequence[int]) + + +class List__i32(_typing.Sequence[int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[int]: ... + @_typing.overload + def __getitem__(self, i: int) -> int: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[int]: ... + def __add__(self, other: _typing.Sequence[int]) -> 'List__i32': ... + def __radd__(self, other: _List__i32T) -> _List__i32T: ... + def __reversed__(self) -> _typing.Iterator[int]: ... + def __iter__(self) -> _typing.Iterator[int]: ... + + +_List__i64T = _typing.TypeVar('_List__i64T', bound=_typing.Sequence[int]) + + +class List__i64(_typing.Sequence[int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[int]: ... + @_typing.overload + def __getitem__(self, i: int) -> int: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[int]: ... + def __add__(self, other: _typing.Sequence[int]) -> 'List__i64': ... + def __radd__(self, other: _List__i64T) -> _List__i64T: ... + def __reversed__(self) -> _typing.Iterator[int]: ... + def __iter__(self) -> _typing.Iterator[int]: ... + + +_List__stringT = _typing.TypeVar('_List__stringT', bound=_typing.Sequence[str]) + + +class List__string(_typing.Sequence[str], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[str]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[str]: ... + @_typing.overload + def __getitem__(self, i: int) -> str: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[str]: ... + def __add__(self, other: _typing.Sequence[str]) -> 'List__string': ... + def __radd__(self, other: _List__stringT) -> _List__stringT: ... + def __reversed__(self) -> _typing.Iterator[str]: ... + def __iter__(self) -> _typing.Iterator[str]: ... + + +_List__SimpleStructT = _typing.TypeVar('_List__SimpleStructT', bound=_typing.Sequence[SimpleStruct]) + + +class List__SimpleStruct(_typing.Sequence[SimpleStruct], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[SimpleStruct]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[SimpleStruct]: ... + @_typing.overload + def __getitem__(self, i: int) -> SimpleStruct: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[SimpleStruct]: ... + def __add__(self, other: _typing.Sequence[SimpleStruct]) -> 'List__SimpleStruct': ... + def __radd__(self, other: _List__SimpleStructT) -> _List__SimpleStructT: ... + def __reversed__(self) -> _typing.Iterator[SimpleStruct]: ... + def __iter__(self) -> _typing.Iterator[SimpleStruct]: ... + + +class Set__i32(_typing.AbstractSet[int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.AbstractSet[int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.AbstractSet[int]: ... + def __contains__(self, x: object) -> bool: ... + def union(self, other: _typing.AbstractSet[int]) -> 'Set__i32': ... + def intersection(self, other: _typing.AbstractSet[int]) -> 'Set__i32': ... + def difference(self, other: _typing.AbstractSet[int]) -> 'Set__i32': ... + def symmetric_difference(self, other: _typing.AbstractSet[int]) -> 'Set__i32': ... + def issubset(self, other: _typing.AbstractSet[int]) -> bool: ... + def issuperset(self, other: _typing.AbstractSet[int]) -> bool: ... + def __iter__(self) -> _typing.Iterator[int]: ... + + +class Set__string(_typing.AbstractSet[str], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.AbstractSet[str]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.AbstractSet[str]: ... + def __contains__(self, x: object) -> bool: ... + def union(self, other: _typing.AbstractSet[str]) -> 'Set__string': ... + def intersection(self, other: _typing.AbstractSet[str]) -> 'Set__string': ... + def difference(self, other: _typing.AbstractSet[str]) -> 'Set__string': ... + def symmetric_difference(self, other: _typing.AbstractSet[str]) -> 'Set__string': ... + def issubset(self, other: _typing.AbstractSet[str]) -> bool: ... + def issuperset(self, other: _typing.AbstractSet[str]) -> bool: ... + def __iter__(self) -> _typing.Iterator[str]: ... + + +class Map__string_string(_typing.Mapping[str, str], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Mapping[str, str]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Mapping[str, str]: ... + def __getitem__(self, key: str) -> str: ... + def __iter__(self) -> _typing.Iterator[str]: ... + + +class Map__string_SimpleStruct(_typing.Mapping[str, SimpleStruct], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Mapping[str, SimpleStruct]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Mapping[str, SimpleStruct]: ... + def __getitem__(self, key: str) -> SimpleStruct: ... + def __iter__(self) -> _typing.Iterator[str]: ... + + +class Map__string_i16(_typing.Mapping[str, int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Mapping[str, int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Mapping[str, int]: ... + def __getitem__(self, key: str) -> int: ... + def __iter__(self) -> _typing.Iterator[str]: ... + + +_List__List__i32T = _typing.TypeVar('_List__List__i32T', bound=_typing.Sequence[_typing.Sequence[int]]) + + +class List__List__i32(_typing.Sequence[_typing.Sequence[int]], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[_typing.Sequence[int]]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[_typing.Sequence[int]]: ... + @_typing.overload + def __getitem__(self, i: int) -> _typing.Sequence[int]: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[_typing.Sequence[int]]: ... + def __add__(self, other: _typing.Sequence[_typing.Sequence[int]]) -> 'List__List__i32': ... + def __radd__(self, other: _List__List__i32T) -> _List__List__i32T: ... + def __reversed__(self) -> _typing.Iterator[_typing.Sequence[int]]: ... + def __iter__(self) -> _typing.Iterator[_typing.Sequence[int]]: ... + + +class Map__string_i32(_typing.Mapping[str, int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Mapping[str, int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Mapping[str, int]: ... + def __getitem__(self, key: str) -> int: ... + def __iter__(self) -> _typing.Iterator[str]: ... + + +class Map__string_Map__string_i32(_typing.Mapping[str, _typing.Mapping[str, int]], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Mapping[str, _typing.Mapping[str, int]]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Mapping[str, _typing.Mapping[str, int]]: ... + def __getitem__(self, key: str) -> _typing.Mapping[str, int]: ... + def __iter__(self) -> _typing.Iterator[str]: ... + + +_List__Set__stringT = _typing.TypeVar('_List__Set__stringT', bound=_typing.Sequence[_typing.AbstractSet[str]]) + + +class List__Set__string(_typing.Sequence[_typing.AbstractSet[str]], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[_typing.AbstractSet[str]]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[_typing.AbstractSet[str]]: ... + @_typing.overload + def __getitem__(self, i: int) -> _typing.AbstractSet[str]: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[_typing.AbstractSet[str]]: ... + def __add__(self, other: _typing.Sequence[_typing.AbstractSet[str]]) -> 'List__Set__string': ... + def __radd__(self, other: _List__Set__stringT) -> _List__Set__stringT: ... + def __reversed__(self) -> _typing.Iterator[_typing.AbstractSet[str]]: ... + def __iter__(self) -> _typing.Iterator[_typing.AbstractSet[str]]: ... + + +class Map__string_List__SimpleStruct(_typing.Mapping[str, _typing.Sequence[SimpleStruct]], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Mapping[str, _typing.Sequence[SimpleStruct]]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Mapping[str, _typing.Sequence[SimpleStruct]]: ... + def __getitem__(self, key: str) -> _typing.Sequence[SimpleStruct]: ... + def __iter__(self) -> _typing.Iterator[str]: ... + + +_List__List__stringT = _typing.TypeVar('_List__List__stringT', bound=_typing.Sequence[_typing.Sequence[str]]) + + +class List__List__string(_typing.Sequence[_typing.Sequence[str]], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[_typing.Sequence[str]]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[_typing.Sequence[str]]: ... + @_typing.overload + def __getitem__(self, i: int) -> _typing.Sequence[str]: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[_typing.Sequence[str]]: ... + def __add__(self, other: _typing.Sequence[_typing.Sequence[str]]) -> 'List__List__string': ... + def __radd__(self, other: _List__List__stringT) -> _List__List__stringT: ... + def __reversed__(self) -> _typing.Iterator[_typing.Sequence[str]]: ... + def __iter__(self) -> _typing.Iterator[_typing.Sequence[str]]: ... + + +_List__Set__i32T = _typing.TypeVar('_List__Set__i32T', bound=_typing.Sequence[_typing.AbstractSet[int]]) + + +class List__Set__i32(_typing.Sequence[_typing.AbstractSet[int]], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[_typing.AbstractSet[int]]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[_typing.AbstractSet[int]]: ... + @_typing.overload + def __getitem__(self, i: int) -> _typing.AbstractSet[int]: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[_typing.AbstractSet[int]]: ... + def __add__(self, other: _typing.Sequence[_typing.AbstractSet[int]]) -> 'List__Set__i32': ... + def __radd__(self, other: _List__Set__i32T) -> _List__Set__i32T: ... + def __reversed__(self) -> _typing.Iterator[_typing.AbstractSet[int]]: ... + def __iter__(self) -> _typing.Iterator[_typing.AbstractSet[int]]: ... + + +_List__Map__string_stringT = _typing.TypeVar('_List__Map__string_stringT', bound=_typing.Sequence[_typing.Mapping[str, str]]) + + +class List__Map__string_string(_typing.Sequence[_typing.Mapping[str, str]], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[_typing.Mapping[str, str]]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[_typing.Mapping[str, str]]: ... + @_typing.overload + def __getitem__(self, i: int) -> _typing.Mapping[str, str]: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[_typing.Mapping[str, str]]: ... + def __add__(self, other: _typing.Sequence[_typing.Mapping[str, str]]) -> 'List__Map__string_string': ... + def __radd__(self, other: _List__Map__string_stringT) -> _List__Map__string_stringT: ... + def __reversed__(self) -> _typing.Iterator[_typing.Mapping[str, str]]: ... + def __iter__(self) -> _typing.Iterator[_typing.Mapping[str, str]]: ... + + +_List__binaryT = _typing.TypeVar('_List__binaryT', bound=_typing.Sequence[bytes]) + + +class List__binary(_typing.Sequence[bytes], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[bytes]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[bytes]: ... + @_typing.overload + def __getitem__(self, i: int) -> bytes: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[bytes]: ... + def __add__(self, other: _typing.Sequence[bytes]) -> 'List__binary': ... + def __radd__(self, other: _List__binaryT) -> _List__binaryT: ... + def __reversed__(self) -> _typing.Iterator[bytes]: ... + def __iter__(self) -> _typing.Iterator[bytes]: ... + + +class Set__binary(_typing.AbstractSet[bytes], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.AbstractSet[bytes]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.AbstractSet[bytes]: ... + def __contains__(self, x: object) -> bool: ... + def union(self, other: _typing.AbstractSet[bytes]) -> 'Set__binary': ... + def intersection(self, other: _typing.AbstractSet[bytes]) -> 'Set__binary': ... + def difference(self, other: _typing.AbstractSet[bytes]) -> 'Set__binary': ... + def symmetric_difference(self, other: _typing.AbstractSet[bytes]) -> 'Set__binary': ... + def issubset(self, other: _typing.AbstractSet[bytes]) -> bool: ... + def issuperset(self, other: _typing.AbstractSet[bytes]) -> bool: ... + def __iter__(self) -> _typing.Iterator[bytes]: ... + + +_List__AnEnumT = _typing.TypeVar('_List__AnEnumT', bound=_typing.Sequence[AnEnum]) + + +class List__AnEnum(_typing.Sequence[AnEnum], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[AnEnum]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[AnEnum]: ... + @_typing.overload + def __getitem__(self, i: int) -> AnEnum: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[AnEnum]: ... + def __add__(self, other: _typing.Sequence[AnEnum]) -> 'List__AnEnum': ... + def __radd__(self, other: _List__AnEnumT) -> _List__AnEnumT: ... + def __reversed__(self) -> _typing.Iterator[AnEnum]: ... + def __iter__(self) -> _typing.Iterator[AnEnum]: ... + + +class _std_unordered_map__Map__i32_i32(_typing.Mapping[int, int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Mapping[int, int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Mapping[int, int]: ... + def __getitem__(self, key: int) -> int: ... + def __iter__(self) -> _typing.Iterator[int]: ... + + +__MyType__List__i32T = _typing.TypeVar('__MyType__List__i32T', bound=_typing.Sequence[int]) + + +class _MyType__List__i32(_typing.Sequence[int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[int]: ... + @_typing.overload + def __getitem__(self, i: int) -> int: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[int]: ... + def __add__(self, other: _typing.Sequence[int]) -> '_MyType__List__i32': ... + def __radd__(self, other: __MyType__List__i32T) -> __MyType__List__i32T: ... + def __reversed__(self) -> _typing.Iterator[int]: ... + def __iter__(self) -> _typing.Iterator[int]: ... + + +class _MyType__Set__i32(_typing.AbstractSet[int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.AbstractSet[int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.AbstractSet[int]: ... + def __contains__(self, x: object) -> bool: ... + def union(self, other: _typing.AbstractSet[int]) -> '_MyType__Set__i32': ... + def intersection(self, other: _typing.AbstractSet[int]) -> '_MyType__Set__i32': ... + def difference(self, other: _typing.AbstractSet[int]) -> '_MyType__Set__i32': ... + def symmetric_difference(self, other: _typing.AbstractSet[int]) -> '_MyType__Set__i32': ... + def issubset(self, other: _typing.AbstractSet[int]) -> bool: ... + def issuperset(self, other: _typing.AbstractSet[int]) -> bool: ... + def __iter__(self) -> _typing.Iterator[int]: ... + + +class _MyType__Map__i32_i32(_typing.Mapping[int, int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Mapping[int, int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Mapping[int, int]: ... + def __getitem__(self, key: int) -> int: ... + def __iter__(self) -> _typing.Iterator[int]: ... + + +__py3_simple_AdaptedList__List__i32T = _typing.TypeVar('__py3_simple_AdaptedList__List__i32T', bound=_typing.Sequence[int]) + + +class _py3_simple_AdaptedList__List__i32(_typing.Sequence[int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[int]: ... + @_typing.overload + def __getitem__(self, i: int) -> int: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[int]: ... + def __add__(self, other: _typing.Sequence[int]) -> '_py3_simple_AdaptedList__List__i32': ... + def __radd__(self, other: __py3_simple_AdaptedList__List__i32T) -> __py3_simple_AdaptedList__List__i32T: ... + def __reversed__(self) -> _typing.Iterator[int]: ... + def __iter__(self) -> _typing.Iterator[int]: ... + + +class _py3_simple_AdaptedSet__Set__i32(_typing.AbstractSet[int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.AbstractSet[int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.AbstractSet[int]: ... + def __contains__(self, x: object) -> bool: ... + def union(self, other: _typing.AbstractSet[int]) -> '_py3_simple_AdaptedSet__Set__i32': ... + def intersection(self, other: _typing.AbstractSet[int]) -> '_py3_simple_AdaptedSet__Set__i32': ... + def difference(self, other: _typing.AbstractSet[int]) -> '_py3_simple_AdaptedSet__Set__i32': ... + def symmetric_difference(self, other: _typing.AbstractSet[int]) -> '_py3_simple_AdaptedSet__Set__i32': ... + def issubset(self, other: _typing.AbstractSet[int]) -> bool: ... + def issuperset(self, other: _typing.AbstractSet[int]) -> bool: ... + def __iter__(self) -> _typing.Iterator[int]: ... + + +class _py3_simple_AdaptedMap__Map__i32_i32(_typing.Mapping[int, int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Mapping[int, int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Mapping[int, int]: ... + def __getitem__(self, key: int) -> int: ... + def __iter__(self) -> _typing.Iterator[int]: ... + + +class Map__i32_double(_typing.Mapping[int, float], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Mapping[int, float]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Mapping[int, float]: ... + def __getitem__(self, key: int) -> float: ... + def __iter__(self) -> _typing.Iterator[int]: ... + + +_List__Map__i32_doubleT = _typing.TypeVar('_List__Map__i32_doubleT', bound=_typing.Sequence[_typing.Mapping[int, float]]) + + +class List__Map__i32_double(_typing.Sequence[_typing.Mapping[int, float]], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[_typing.Mapping[int, float]]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[_typing.Mapping[int, float]]: ... + @_typing.overload + def __getitem__(self, i: int) -> _typing.Mapping[int, float]: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[_typing.Mapping[int, float]]: ... + def __add__(self, other: _typing.Sequence[_typing.Mapping[int, float]]) -> 'List__Map__i32_double': ... + def __radd__(self, other: _List__Map__i32_doubleT) -> _List__Map__i32_doubleT: ... + def __reversed__(self) -> _typing.Iterator[_typing.Mapping[int, float]]: ... + def __iter__(self) -> _typing.Iterator[_typing.Mapping[int, float]]: ... + + +class Map__AnEnumRenamed_i32(_typing.Mapping[AnEnumRenamed, int], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Mapping[AnEnumRenamed, int]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Mapping[AnEnumRenamed, int]: ... + def __getitem__(self, key: AnEnumRenamed) -> int: ... + def __iter__(self) -> _typing.Iterator[AnEnumRenamed]: ... + + +A_BOOL: bool = ... +A_BYTE: int = ... +THE_ANSWER: int = ... +A_NUMBER: int = ... +A_BIG_NUMBER: int = ... +A_REAL_NUMBER: float = ... +A_FAKE_NUMBER: float = ... +A_WORD: str = ... +SOME_BYTES: bytes = ... +A_STRUCT: SimpleStruct = ... +EMPTY: SimpleStruct = ... +WORD_LIST: List__string = ... +SOME_MAP: List__Map__i32_double = ... +DIGITS: Set__i32 = ... +A_CONST_MAP: Map__string_SimpleStruct = ... +ANOTHER_CONST_MAP: Map__AnEnumRenamed_i32 = ... +IOBufPtr = _fbthrift_iobuf.IOBuf +IOBuf = _fbthrift_iobuf.IOBuf +AdaptedTypeDef = SimpleStruct +foo_bar = bytes +CustomBool = bool +CustomInteger = int +CustomDouble = float +CustomString = str +CustomBinary = bytes +CustomList = _MyType__List__i32 +CustomSet = _MyType__Set__i32 +CustomMap = _MyType__Map__i32_i32 +CustomStruct = SimpleStruct +AdaptedBool = bool +AdaptedInteger = int +AdaptedDouble = float +AdaptedString = str +AdaptedBinary = bytes +AdaptedList = _py3_simple_AdaptedList__List__i32 +AdaptedSet = _py3_simple_AdaptedSet__Set__i32 +AdaptedMap = _py3_simple_AdaptedMap__Map__i32_i32 +AdaptedStruct = SimpleStruct diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.pyx b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.pyx new file mode 100644 index 00000000000..c96f7762fbc --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types.pyx @@ -0,0 +1,2307 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/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 +import thrift.python.converter +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 ( + richcmp as __richcmp, + init_unicode_from_cpp as __init_unicode_from_cpp, + set_iter as __set_iter, + map_iter as __map_iter, + 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 + +import module.thrift_types as _fbthrift_python_types +from module.types_impl_FBTHRIFT_ONLY_DO_NOT_USE import ( + AnEnum, + AnEnumRenamed, + Flags, + __BinaryUnionType, +) + +from module.containers_FBTHRIFT_ONLY_DO_NOT_USE import ( + List__i16, + List__i32, + List__i64, + List__string, + List__SimpleStruct, + Set__i32, + Set__string, + Map__string_string, + Map__string_SimpleStruct, + Map__string_i16, + List__List__i32, + Map__string_i32, + Map__string_Map__string_i32, + List__Set__string, + Map__string_List__SimpleStruct, + List__List__string, + List__Set__i32, + List__Map__string_string, + List__binary, + Set__binary, + List__AnEnum, + _std_unordered_map__Map__i32_i32, + _MyType__List__i32, + _MyType__Set__i32, + _MyType__Map__i32_i32, + _py3_simple_AdaptedList__List__i32, + _py3_simple_AdaptedSet__Set__i32, + _py3_simple_AdaptedMap__Map__i32_i32, + Map__i32_double, + List__Map__i32_double, + Map__AnEnumRenamed_i32, +) + +_fbthrift__module_name__ = "module.types" + +cdef object get_types_reflection(): + return importlib.import_module( + "module.types_reflection" + ) + +@__cython.auto_pickle(False) +cdef class SimpleException(thrift.py3.exceptions.GeneratedError): + __module__ = _fbthrift__module_name__ + + def __init__(SimpleException self, *args, **kwargs): + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cSimpleException]() + self._fields_setter = _fbthrift_types_fields.__SimpleException_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("SimpleException", { + "err_code": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).err_code_ref().has_value(), + }) + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cSimpleException] cpp_obj): + __fbthrift_inst = SimpleException.__new__(SimpleException, (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 err_code_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).err_code_ref().value() + + @property + def err_code(self): + return self.err_code_impl() + + + def __hash__(SimpleException self): + return super().__hash__() + + def __repr__(SimpleException self): + return super().__repr__() + + def __str__(SimpleException self): + return super().__str__() + + + def __copy__(SimpleException self): + cdef shared_ptr[_module_cbindings.cSimpleException] cpp_obj = make_shared[_module_cbindings.cSimpleException]( + deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + ) + return SimpleException._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj)) + + def __richcmp__(self, other, int op): + r = self._fbthrift_cmp_sametype(other, op) + return __richcmp[_module_cbindings.cSimpleException]( + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, + (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__SimpleException() + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftMetadata meta + _module_cbindings.ExceptionMetadata[_module_cbindings.cSimpleException].gen(meta) + return __MetadataBox.box(cmove(meta)) + + @staticmethod + def __get_thrift_name__(): + return "module.SimpleException" + + @classmethod + def _fbthrift_get_field_name_by_index(cls, idx): + return __sv_to_str(__get_field_name_by_index[_module_cbindings.cSimpleException](idx)) + + @classmethod + def _fbthrift_get_struct_size(cls): + return 1 + + cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(SimpleException self, __Protocol proto): + cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data + with nogil: + data = cmove(serializer.cserialize[_module_cbindings.cSimpleException](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)) + return _fbthrift_iobuf.from_unique_ptr(cmove(data)) + + cdef cuint32_t _fbthrift_deserialize(SimpleException self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0: + cdef cuint32_t needed + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cSimpleException]() + with nogil: + needed = serializer.cdeserialize[_module_cbindings.cSimpleException](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto) + return needed + + + def _to_python(self): + return thrift.python.converter.to_python_struct( + _fbthrift_python_types.SimpleException, + self, + ) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + import thrift.util.converter + py_deprecated_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_deprecated_types.SimpleException, self) + +@__cython.auto_pickle(False) +cdef class OptionalRefStruct(thrift.py3.types.Struct): + __module__ = _fbthrift__module_name__ + + def __init__(OptionalRefStruct self, **kwargs): + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cOptionalRefStruct]() + self._fields_setter = _fbthrift_types_fields.__OptionalRefStruct_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + super().__init__(**kwargs) + + def __call__(OptionalRefStruct self, **kwargs): + if not kwargs: + return self + cdef OptionalRefStruct __fbthrift_inst = OptionalRefStruct.__new__(OptionalRefStruct) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cOptionalRefStruct](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + __fbthrift_inst._fields_setter = _fbthrift_types_fields.__OptionalRefStruct_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("OptionalRefStruct", { + "optional_blob": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).optional_blob_ref().has_value(), + }) + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cOptionalRefStruct] cpp_obj): + __fbthrift_inst = OptionalRefStruct.__new__(OptionalRefStruct) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj) + return __fbthrift_inst + + cdef inline optional_blob_impl(self): + if not deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).optional_blob_ref().has_value(): + return None + if self.__fbthrift_cached_optional_blob is None: + if not deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).optional_blob_ref().value_unchecked(): + return None + self.__fbthrift_cached_optional_blob = _fbthrift_iobuf.IOBuf.create(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).optional_blob_ref().value_unchecked().get(), self) + return self.__fbthrift_cached_optional_blob + + @property + def optional_blob(self): + return self.optional_blob_impl() + + + def __hash__(OptionalRefStruct self): + return super().__hash__() + + def __repr__(OptionalRefStruct self): + return super().__repr__() + + def __str__(OptionalRefStruct self): + return super().__str__() + + + def __copy__(OptionalRefStruct self): + cdef shared_ptr[_module_cbindings.cOptionalRefStruct] cpp_obj = make_shared[_module_cbindings.cOptionalRefStruct]( + deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + ) + return OptionalRefStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj)) + + def __richcmp__(self, other, int op): + r = self._fbthrift_cmp_sametype(other, op) + return __richcmp[_module_cbindings.cOptionalRefStruct]( + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE, + (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__OptionalRefStruct() + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftMetadata meta + _module_cbindings.StructMetadata[_module_cbindings.cOptionalRefStruct].gen(meta) + return __MetadataBox.box(cmove(meta)) + + @staticmethod + def __get_thrift_name__(): + return "module.OptionalRefStruct" + + @classmethod + def _fbthrift_get_field_name_by_index(cls, idx): + return __sv_to_str(__get_field_name_by_index[_module_cbindings.cOptionalRefStruct](idx)) + + @classmethod + def _fbthrift_get_struct_size(cls): + return 1 + + cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(OptionalRefStruct self, __Protocol proto): + cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data + with nogil: + data = cmove(serializer.cserialize[_module_cbindings.cOptionalRefStruct](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)) + return _fbthrift_iobuf.from_unique_ptr(cmove(data)) + + cdef cuint32_t _fbthrift_deserialize(OptionalRefStruct self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0: + cdef cuint32_t needed + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cOptionalRefStruct]() + with nogil: + needed = serializer.cdeserialize[_module_cbindings.cOptionalRefStruct](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto) + return needed + + + def _to_python(self): + return thrift.python.converter.to_python_struct( + _fbthrift_python_types.OptionalRefStruct, + self, + ) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + import thrift.util.converter + py_deprecated_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_deprecated_types.OptionalRefStruct, self) + +@__cython.auto_pickle(False) +cdef class SimpleStruct(thrift.py3.types.Struct): + __module__ = _fbthrift__module_name__ + + def __init__(SimpleStruct self, **kwargs): + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cSimpleStruct]() + self._fields_setter = _fbthrift_types_fields.__SimpleStruct_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + super().__init__(**kwargs) + + def __call__(SimpleStruct self, **kwargs): + if not kwargs: + return self + cdef SimpleStruct __fbthrift_inst = SimpleStruct.__new__(SimpleStruct) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cSimpleStruct](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + __fbthrift_inst._fields_setter = _fbthrift_types_fields.__SimpleStruct_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("SimpleStruct", { + "is_on": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).is_on_ref().has_value(), + "tiny_int": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).tiny_int_ref().has_value(), + "small_int": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).small_int_ref().has_value(), + "nice_sized_int": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).nice_sized_int_ref().has_value(), + "big_int": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).big_int_ref().has_value(), + "real": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).real_ref().has_value(), + "smaller_real": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).smaller_real_ref().has_value(), + "something": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).something_ref().has_value(), + }) + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cSimpleStruct] cpp_obj): + __fbthrift_inst = SimpleStruct.__new__(SimpleStruct) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj) + return __fbthrift_inst + + cdef inline is_on_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).is_on_ref().value() + + @property + def is_on(self): + return self.is_on_impl() + + cdef inline tiny_int_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).tiny_int_ref().value() + + @property + def tiny_int(self): + return self.tiny_int_impl() + + cdef inline small_int_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).small_int_ref().value() + + @property + def small_int(self): + return self.small_int_impl() + + cdef inline nice_sized_int_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).nice_sized_int_ref().value() + + @property + def nice_sized_int(self): + return self.nice_sized_int_impl() + + cdef inline big_int_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).big_int_ref().value() + + @property + def big_int(self): + return self.big_int_impl() + + cdef inline real_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).real_ref().value() + + @property + def real(self): + return self.real_impl() + + cdef inline smaller_real_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).smaller_real_ref().value() + + @property + def smaller_real(self): + return self.smaller_real_impl() + + cdef inline something_impl(self): + if self.__fbthrift_cached_something is None: + self.__fbthrift_cached_something = _std_unordered_map__Map__i32_i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).something_ref().ref()) + return self.__fbthrift_cached_something + + @property + def something(self): + return self.something_impl() + + + def __hash__(SimpleStruct self): + return super().__hash__() + + def __repr__(SimpleStruct self): + return super().__repr__() + + def __str__(SimpleStruct self): + return super().__str__() + + + def __copy__(SimpleStruct self): + cdef shared_ptr[_module_cbindings.cSimpleStruct] cpp_obj = make_shared[_module_cbindings.cSimpleStruct]( + deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + ) + return SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj)) + + def __eq__(SimpleStruct self, other): + if not isinstance(other, SimpleStruct): + return False + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) == deref((other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + + def __ne__(SimpleStruct self, other): + if not isinstance(other, SimpleStruct): + return True + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) != deref((other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__SimpleStruct() + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftMetadata meta + _module_cbindings.StructMetadata[_module_cbindings.cSimpleStruct].gen(meta) + return __MetadataBox.box(cmove(meta)) + + @staticmethod + def __get_thrift_name__(): + return "module.SimpleStruct" + + __fbthrift_field_name_list = [ + 'is_on', + 'tiny_int', + 'small_int', + 'nice_sized_int', + 'big_int', + 'real', + 'smaller_real', + 'something', + ] + + @classmethod + def _fbthrift_get_field_name_by_index(cls, idx): + return cls.__fbthrift_field_name_list[idx] + + @classmethod + def _fbthrift_get_struct_size(cls): + return 8 + + cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(SimpleStruct self, __Protocol proto): + cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data + with nogil: + data = cmove(serializer.cserialize[_module_cbindings.cSimpleStruct](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)) + return _fbthrift_iobuf.from_unique_ptr(cmove(data)) + + cdef cuint32_t _fbthrift_deserialize(SimpleStruct self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0: + cdef cuint32_t needed + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cSimpleStruct]() + with nogil: + needed = serializer.cdeserialize[_module_cbindings.cSimpleStruct](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto) + return needed + + + def _to_python(self): + return thrift.python.converter.to_python_struct( + _fbthrift_python_types.SimpleStruct, + self, + ) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + import thrift.util.converter + py_deprecated_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_deprecated_types.SimpleStruct, self) + +@__cython.auto_pickle(False) +cdef class HiddenTypeFieldsStruct(thrift.py3.types.Struct): + __module__ = _fbthrift__module_name__ + + def __init__(HiddenTypeFieldsStruct self, **kwargs): + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cHiddenTypeFieldsStruct]() + self._fields_setter = _fbthrift_types_fields.__HiddenTypeFieldsStruct_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + super().__init__(**kwargs) + + def __call__(HiddenTypeFieldsStruct 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("HiddenTypeFieldsStruct", { + }) + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cHiddenTypeFieldsStruct] cpp_obj): + __fbthrift_inst = HiddenTypeFieldsStruct.__new__(HiddenTypeFieldsStruct) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj) + return __fbthrift_inst + + + def __hash__(HiddenTypeFieldsStruct self): + return super().__hash__() + + def __repr__(HiddenTypeFieldsStruct self): + return super().__repr__() + + def __str__(HiddenTypeFieldsStruct self): + return super().__str__() + + + def __copy__(HiddenTypeFieldsStruct self): + cdef shared_ptr[_module_cbindings.cHiddenTypeFieldsStruct] cpp_obj = make_shared[_module_cbindings.cHiddenTypeFieldsStruct]( + deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + ) + return HiddenTypeFieldsStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj)) + + def __eq__(HiddenTypeFieldsStruct self, other): + if not isinstance(other, HiddenTypeFieldsStruct): + return False + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) == deref((other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + + def __ne__(HiddenTypeFieldsStruct self, other): + if not isinstance(other, HiddenTypeFieldsStruct): + return True + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) != deref((other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__HiddenTypeFieldsStruct() + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftMetadata meta + _module_cbindings.StructMetadata[_module_cbindings.cHiddenTypeFieldsStruct].gen(meta) + return __MetadataBox.box(cmove(meta)) + + @staticmethod + def __get_thrift_name__(): + return "module.HiddenTypeFieldsStruct" + + __fbthrift_field_name_list = [ + ] + + @classmethod + def _fbthrift_get_field_name_by_index(cls, idx): + return cls.__fbthrift_field_name_list[idx] + + @classmethod + def _fbthrift_get_struct_size(cls): + return 0 + + cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(HiddenTypeFieldsStruct self, __Protocol proto): + cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data + with nogil: + data = cmove(serializer.cserialize[_module_cbindings.cHiddenTypeFieldsStruct](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)) + return _fbthrift_iobuf.from_unique_ptr(cmove(data)) + + cdef cuint32_t _fbthrift_deserialize(HiddenTypeFieldsStruct self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0: + cdef cuint32_t needed + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cHiddenTypeFieldsStruct]() + with nogil: + needed = serializer.cdeserialize[_module_cbindings.cHiddenTypeFieldsStruct](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto) + return needed + + + def _to_python(self): + return thrift.python.converter.to_python_struct( + _fbthrift_python_types.HiddenTypeFieldsStruct, + self, + ) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + import thrift.util.converter + py_deprecated_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_deprecated_types.HiddenTypeFieldsStruct, self) + +@__cython.auto_pickle(False) +cdef class ComplexStruct(thrift.py3.types.Struct): + __module__ = _fbthrift__module_name__ + + def __init__(ComplexStruct self, **kwargs): + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cComplexStruct]() + self._fields_setter = _fbthrift_types_fields.__ComplexStruct_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + super().__init__(**kwargs) + + def __call__(ComplexStruct self, **kwargs): + if not kwargs: + return self + cdef ComplexStruct __fbthrift_inst = ComplexStruct.__new__(ComplexStruct) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cComplexStruct](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + __fbthrift_inst._fields_setter = _fbthrift_types_fields.__ComplexStruct_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("ComplexStruct", { + "structOne": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).structOne_ref().has_value(), + "structTwo": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).structTwo_ref().has_value(), + "an_integer": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).an_integer_ref().has_value(), + "name": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).name_ref().has_value(), + "an_enum": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).an_enum_ref().has_value(), + "some_bytes": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).some_bytes_ref().has_value(), + "sender": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).sender_ref().has_value(), + "cdef_": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).cdef__ref().has_value(), + "bytes_with_cpp_type": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).bytes_with_cpp_type_ref().has_value(), + }) + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cComplexStruct] cpp_obj): + __fbthrift_inst = ComplexStruct.__new__(ComplexStruct) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj) + return __fbthrift_inst + + cdef inline structOne_impl(self): + if self.__fbthrift_cached_structOne is None: + self.__fbthrift_cached_structOne = SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).structOne_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + return self.__fbthrift_cached_structOne + + @property + def structOne(self): + return self.structOne_impl() + + cdef inline structTwo_impl(self): + if self.__fbthrift_cached_structTwo is None: + self.__fbthrift_cached_structTwo = SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).structTwo_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + return self.__fbthrift_cached_structTwo + + @property + def structTwo(self): + return self.structTwo_impl() + + cdef inline an_integer_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).an_integer_ref().value() + + @property + def an_integer(self): + return self.an_integer_impl() + + cdef inline name_impl(self): + return (deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).name_ref().value()).decode('UTF-8') + + @property + def name(self): + return self.name_impl() + + cdef inline an_enum_impl(self): + if self.__fbthrift_cached_an_enum is None: + self.__fbthrift_cached_an_enum = translate_cpp_enum_to_python(AnEnum, (deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).an_enum_ref().value())) + return self.__fbthrift_cached_an_enum + + @property + def an_enum(self): + return self.an_enum_impl() + + cdef inline some_bytes_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).some_bytes_ref().value() + + @property + def some_bytes(self): + return self.some_bytes_impl() + + cdef inline sender_impl(self): + return (deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).sender_ref().value()).decode('UTF-8') + + @property + def sender(self): + return self.sender_impl() + + cdef inline cdef__impl(self): + return (deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).cdef__ref().value()).decode('UTF-8') + + @property + def cdef_(self): + return self.cdef__impl() + + cdef inline bytes_with_cpp_type_impl(self): + return (deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).bytes_with_cpp_type_ref().value().data())[:deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).bytes_with_cpp_type_ref().value().size()] + + @property + def bytes_with_cpp_type(self): + return self.bytes_with_cpp_type_impl() + + + def __hash__(ComplexStruct self): + return super().__hash__() + + def __repr__(ComplexStruct self): + return super().__repr__() + + def __str__(ComplexStruct self): + return super().__str__() + + + def __copy__(ComplexStruct self): + cdef shared_ptr[_module_cbindings.cComplexStruct] cpp_obj = make_shared[_module_cbindings.cComplexStruct]( + deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + ) + return ComplexStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj)) + + def __eq__(ComplexStruct self, other): + if not isinstance(other, ComplexStruct): + return False + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) == deref((other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + + def __ne__(ComplexStruct self, other): + if not isinstance(other, ComplexStruct): + return True + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) != deref((other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__ComplexStruct() + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftMetadata meta + _module_cbindings.StructMetadata[_module_cbindings.cComplexStruct].gen(meta) + return __MetadataBox.box(cmove(meta)) + + @staticmethod + def __get_thrift_name__(): + return "module.ComplexStruct" + + @classmethod + def _fbthrift_get_field_name_by_index(cls, idx): + return __sv_to_str(__get_field_name_by_index[_module_cbindings.cComplexStruct](idx)) + + @classmethod + def _fbthrift_get_struct_size(cls): + return 9 + + cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(ComplexStruct self, __Protocol proto): + cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data + with nogil: + data = cmove(serializer.cserialize[_module_cbindings.cComplexStruct](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)) + return _fbthrift_iobuf.from_unique_ptr(cmove(data)) + + cdef cuint32_t _fbthrift_deserialize(ComplexStruct self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0: + cdef cuint32_t needed + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cComplexStruct]() + with nogil: + needed = serializer.cdeserialize[_module_cbindings.cComplexStruct](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto) + return needed + + + def _to_python(self): + return thrift.python.converter.to_python_struct( + _fbthrift_python_types.ComplexStruct, + self, + ) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + import thrift.util.converter + py_deprecated_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_deprecated_types.ComplexStruct, self) + + + +@__cython.auto_pickle(False) +cdef class BinaryUnion(thrift.py3.types.Union): + __module__ = _fbthrift__module_name__ + Type = __BinaryUnionType + + def __init__( + self, *, + _fbthrift_iobuf.IOBuf iobuf_val=None + ): + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = __to_shared_ptr(cmove(BinaryUnion._make_instance( + NULL, + iobuf_val, + ))) + self._initialize_py() + + @staticmethod + def fromValue(value): + if value is None: + return BinaryUnion() + if isinstance(value, _fbthrift_iobuf.IOBuf): + return BinaryUnion(iobuf_val=value) + raise ValueError(f"Unable to derive correct union field for value: {value}") + + @staticmethod + cdef unique_ptr[_module_cbindings.cBinaryUnion] _make_instance( + _module_cbindings.cBinaryUnion* base_instance, + _fbthrift_iobuf.IOBuf iobuf_val + ) except *: + cdef unique_ptr[_module_cbindings.cBinaryUnion] c_inst = make_unique[_module_cbindings.cBinaryUnion]() + cdef bint any_set = False + if iobuf_val is not None: + if any_set: + raise TypeError("At most one field may be set when initializing a union") + deref(c_inst).set_iobuf_val(deref((<_fbthrift_iobuf.IOBuf?>iobuf_val)._this)) + 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[_module_cbindings.cBinaryUnion] cpp_obj): + __fbthrift_inst = BinaryUnion.__new__(BinaryUnion) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj) + __fbthrift_inst._initialize_py() + return __fbthrift_inst + + @property + def iobuf_val(BinaryUnion self not None): + if self.type_int != 1: + raise AttributeError(f'Union contains a value of type {self.type.name}, not iobuf_val') + return self.value + + + def __hash__(BinaryUnion self): + return super().__hash__() + + @property + def type(BinaryUnion self not None): + if self.py_type is None: + self.py_type = BinaryUnion.Type(self.type_int) + return self.py_type + + @property + def value(BinaryUnion self not None): + if self.py_value is not None or self.type_int == 0: + return self.py_value + elif self.type_int == 1: + self.py_value = _fbthrift_iobuf.from_unique_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).get_iobuf_val().clone()) + return self.py_value + + cdef _initialize_py(BinaryUnion self): + self.py_type = None + self.type_int = deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).getType() + self.py_value = None + + def __copy__(BinaryUnion self): + cdef shared_ptr[_module_cbindings.cBinaryUnion] cpp_obj = make_shared[_module_cbindings.cBinaryUnion]( + deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + ) + return BinaryUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj)) + + def __eq__(BinaryUnion self, other): + return isinstance(other, BinaryUnion) and self._fbthrift_noncomparable_eq(other) + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__BinaryUnion() + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftMetadata meta + _module_cbindings.StructMetadata[_module_cbindings.cBinaryUnion].gen(meta) + return __MetadataBox.box(cmove(meta)) + + @staticmethod + def __get_thrift_name__(): + return "module.BinaryUnion" + + @classmethod + def _fbthrift_get_field_name_by_index(cls, idx): + return __sv_to_str(__get_field_name_by_index[_module_cbindings.cBinaryUnion](idx)) + + @classmethod + def _fbthrift_get_struct_size(cls): + return 1 + + cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(BinaryUnion self, __Protocol proto): + cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data + with nogil: + data = cmove(serializer.cserialize[_module_cbindings.cBinaryUnion](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)) + return _fbthrift_iobuf.from_unique_ptr(cmove(data)) + + cdef cuint32_t _fbthrift_deserialize(BinaryUnion self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0: + cdef cuint32_t needed + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cBinaryUnion]() + with nogil: + needed = serializer.cdeserialize[_module_cbindings.cBinaryUnion](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto) + # clear cache reload since the underlying data's changed + self._initialize_py() + return needed + + + def _to_python(self): + return thrift.python.converter.to_python_struct( + _fbthrift_python_types.BinaryUnion, + self, + ) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + import thrift.util.converter + py_deprecated_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_deprecated_types.BinaryUnion, self) + +@__cython.auto_pickle(False) +cdef class BinaryUnionStruct(thrift.py3.types.Struct): + __module__ = _fbthrift__module_name__ + + def __init__(BinaryUnionStruct self, **kwargs): + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cBinaryUnionStruct]() + self._fields_setter = _fbthrift_types_fields.__BinaryUnionStruct_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + super().__init__(**kwargs) + + def __call__(BinaryUnionStruct self, **kwargs): + if not kwargs: + return self + cdef BinaryUnionStruct __fbthrift_inst = BinaryUnionStruct.__new__(BinaryUnionStruct) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cBinaryUnionStruct](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + __fbthrift_inst._fields_setter = _fbthrift_types_fields.__BinaryUnionStruct_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("BinaryUnionStruct", { + "u": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).u_ref().has_value(), + }) + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cBinaryUnionStruct] cpp_obj): + __fbthrift_inst = BinaryUnionStruct.__new__(BinaryUnionStruct) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj) + return __fbthrift_inst + + cdef inline u_impl(self): + if self.__fbthrift_cached_u is None: + self.__fbthrift_cached_u = BinaryUnion._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).u_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + return self.__fbthrift_cached_u + + @property + def u(self): + return self.u_impl() + + + def __hash__(BinaryUnionStruct self): + return super().__hash__() + + def __repr__(BinaryUnionStruct self): + return super().__repr__() + + def __str__(BinaryUnionStruct self): + return super().__str__() + + + def __copy__(BinaryUnionStruct self): + cdef shared_ptr[_module_cbindings.cBinaryUnionStruct] cpp_obj = make_shared[_module_cbindings.cBinaryUnionStruct]( + deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + ) + return BinaryUnionStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj)) + + def __eq__(BinaryUnionStruct self, other): + return isinstance(other, BinaryUnionStruct) and self._fbthrift_noncomparable_eq(other) + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__BinaryUnionStruct() + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftMetadata meta + _module_cbindings.StructMetadata[_module_cbindings.cBinaryUnionStruct].gen(meta) + return __MetadataBox.box(cmove(meta)) + + @staticmethod + def __get_thrift_name__(): + return "module.BinaryUnionStruct" + + @classmethod + def _fbthrift_get_field_name_by_index(cls, idx): + return __sv_to_str(__get_field_name_by_index[_module_cbindings.cBinaryUnionStruct](idx)) + + @classmethod + def _fbthrift_get_struct_size(cls): + return 1 + + cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(BinaryUnionStruct self, __Protocol proto): + cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data + with nogil: + data = cmove(serializer.cserialize[_module_cbindings.cBinaryUnionStruct](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)) + return _fbthrift_iobuf.from_unique_ptr(cmove(data)) + + cdef cuint32_t _fbthrift_deserialize(BinaryUnionStruct self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0: + cdef cuint32_t needed + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cBinaryUnionStruct]() + with nogil: + needed = serializer.cdeserialize[_module_cbindings.cBinaryUnionStruct](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto) + return needed + + + def _to_python(self): + return thrift.python.converter.to_python_struct( + _fbthrift_python_types.BinaryUnionStruct, + self, + ) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + import thrift.util.converter + py_deprecated_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_deprecated_types.BinaryUnionStruct, self) + +@__cython.auto_pickle(False) +cdef class CustomFields(thrift.py3.types.Struct): + __module__ = _fbthrift__module_name__ + + def __init__(CustomFields self, **kwargs): + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cCustomFields]() + self._fields_setter = _fbthrift_types_fields.__CustomFields_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + super().__init__(**kwargs) + + def __call__(CustomFields self, **kwargs): + if not kwargs: + return self + cdef CustomFields __fbthrift_inst = CustomFields.__new__(CustomFields) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cCustomFields](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + __fbthrift_inst._fields_setter = _fbthrift_types_fields.__CustomFields_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("CustomFields", { + "bool_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).bool_field_ref().has_value(), + "integer_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).integer_field_ref().has_value(), + "double_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).double_field_ref().has_value(), + "string_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).string_field_ref().has_value(), + "binary_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).binary_field_ref().has_value(), + "list_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).list_field_ref().has_value(), + "set_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).set_field_ref().has_value(), + "map_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).map_field_ref().has_value(), + "struct_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).struct_field_ref().has_value(), + }) + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cCustomFields] cpp_obj): + __fbthrift_inst = CustomFields.__new__(CustomFields) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj) + return __fbthrift_inst + + cdef inline bool_field_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).bool_field_ref().value() + + @property + def bool_field(self): + return self.bool_field_impl() + + cdef inline integer_field_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).integer_field_ref().value() + + @property + def integer_field(self): + return self.integer_field_impl() + + cdef inline double_field_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).double_field_ref().value() + + @property + def double_field(self): + return self.double_field_impl() + + cdef inline string_field_impl(self): + return (deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).string_field_ref().value()).decode('UTF-8') + + @property + def string_field(self): + return self.string_field_impl() + + cdef inline binary_field_impl(self): + return (deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).binary_field_ref().value().data())[:deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).binary_field_ref().value().size()] + + @property + def binary_field(self): + return self.binary_field_impl() + + cdef inline list_field_impl(self): + if self.__fbthrift_cached_list_field is None: + self.__fbthrift_cached_list_field = _MyType__List__i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).list_field_ref().ref()) + return self.__fbthrift_cached_list_field + + @property + def list_field(self): + return self.list_field_impl() + + cdef inline set_field_impl(self): + if self.__fbthrift_cached_set_field is None: + self.__fbthrift_cached_set_field = _MyType__Set__i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).set_field_ref().ref()) + return self.__fbthrift_cached_set_field + + @property + def set_field(self): + return self.set_field_impl() + + cdef inline map_field_impl(self): + if self.__fbthrift_cached_map_field is None: + self.__fbthrift_cached_map_field = _MyType__Map__i32_i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).map_field_ref().ref()) + return self.__fbthrift_cached_map_field + + @property + def map_field(self): + return self.map_field_impl() + + cdef inline struct_field_impl(self): + if self.__fbthrift_cached_struct_field is None: + self.__fbthrift_cached_struct_field = SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).struct_field_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + return self.__fbthrift_cached_struct_field + + @property + def struct_field(self): + return self.struct_field_impl() + + + def __hash__(CustomFields self): + return super().__hash__() + + def __repr__(CustomFields self): + return super().__repr__() + + def __str__(CustomFields self): + return super().__str__() + + + def __copy__(CustomFields self): + cdef shared_ptr[_module_cbindings.cCustomFields] cpp_obj = make_shared[_module_cbindings.cCustomFields]( + deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + ) + return CustomFields._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj)) + + def __eq__(CustomFields self, other): + if not isinstance(other, CustomFields): + return False + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) == deref((other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + + def __ne__(CustomFields self, other): + if not isinstance(other, CustomFields): + return True + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) != deref((other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__CustomFields() + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftMetadata meta + _module_cbindings.StructMetadata[_module_cbindings.cCustomFields].gen(meta) + return __MetadataBox.box(cmove(meta)) + + @staticmethod + def __get_thrift_name__(): + return "module.CustomFields" + + @classmethod + def _fbthrift_get_field_name_by_index(cls, idx): + return __sv_to_str(__get_field_name_by_index[_module_cbindings.cCustomFields](idx)) + + @classmethod + def _fbthrift_get_struct_size(cls): + return 9 + + cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(CustomFields self, __Protocol proto): + cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data + with nogil: + data = cmove(serializer.cserialize[_module_cbindings.cCustomFields](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)) + return _fbthrift_iobuf.from_unique_ptr(cmove(data)) + + cdef cuint32_t _fbthrift_deserialize(CustomFields self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0: + cdef cuint32_t needed + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cCustomFields]() + with nogil: + needed = serializer.cdeserialize[_module_cbindings.cCustomFields](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto) + return needed + + + def _to_python(self): + return thrift.python.converter.to_python_struct( + _fbthrift_python_types.CustomFields, + self, + ) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + import thrift.util.converter + py_deprecated_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_deprecated_types.CustomFields, self) + +@__cython.auto_pickle(False) +cdef class CustomTypedefFields(thrift.py3.types.Struct): + __module__ = _fbthrift__module_name__ + + def __init__(CustomTypedefFields self, **kwargs): + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cCustomTypedefFields]() + self._fields_setter = _fbthrift_types_fields.__CustomTypedefFields_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + super().__init__(**kwargs) + + def __call__(CustomTypedefFields self, **kwargs): + if not kwargs: + return self + cdef CustomTypedefFields __fbthrift_inst = CustomTypedefFields.__new__(CustomTypedefFields) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cCustomTypedefFields](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + __fbthrift_inst._fields_setter = _fbthrift_types_fields.__CustomTypedefFields_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("CustomTypedefFields", { + "bool_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).bool_field_ref().has_value(), + "integer_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).integer_field_ref().has_value(), + "double_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).double_field_ref().has_value(), + "string_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).string_field_ref().has_value(), + "binary_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).binary_field_ref().has_value(), + "list_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).list_field_ref().has_value(), + "set_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).set_field_ref().has_value(), + "map_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).map_field_ref().has_value(), + "struct_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).struct_field_ref().has_value(), + }) + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cCustomTypedefFields] cpp_obj): + __fbthrift_inst = CustomTypedefFields.__new__(CustomTypedefFields) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj) + return __fbthrift_inst + + cdef inline bool_field_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).bool_field_ref().value() + + @property + def bool_field(self): + return self.bool_field_impl() + + cdef inline integer_field_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).integer_field_ref().value() + + @property + def integer_field(self): + return self.integer_field_impl() + + cdef inline double_field_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).double_field_ref().value() + + @property + def double_field(self): + return self.double_field_impl() + + cdef inline string_field_impl(self): + return (deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).string_field_ref().value()).decode('UTF-8') + + @property + def string_field(self): + return self.string_field_impl() + + cdef inline binary_field_impl(self): + return (deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).binary_field_ref().value().data())[:deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).binary_field_ref().value().size()] + + @property + def binary_field(self): + return self.binary_field_impl() + + cdef inline list_field_impl(self): + if self.__fbthrift_cached_list_field is None: + self.__fbthrift_cached_list_field = _MyType__List__i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).list_field_ref().ref()) + return self.__fbthrift_cached_list_field + + @property + def list_field(self): + return self.list_field_impl() + + cdef inline set_field_impl(self): + if self.__fbthrift_cached_set_field is None: + self.__fbthrift_cached_set_field = _MyType__Set__i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).set_field_ref().ref()) + return self.__fbthrift_cached_set_field + + @property + def set_field(self): + return self.set_field_impl() + + cdef inline map_field_impl(self): + if self.__fbthrift_cached_map_field is None: + self.__fbthrift_cached_map_field = _MyType__Map__i32_i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).map_field_ref().ref()) + return self.__fbthrift_cached_map_field + + @property + def map_field(self): + return self.map_field_impl() + + cdef inline struct_field_impl(self): + if self.__fbthrift_cached_struct_field is None: + self.__fbthrift_cached_struct_field = SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).struct_field_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + return self.__fbthrift_cached_struct_field + + @property + def struct_field(self): + return self.struct_field_impl() + + + def __hash__(CustomTypedefFields self): + return super().__hash__() + + def __repr__(CustomTypedefFields self): + return super().__repr__() + + def __str__(CustomTypedefFields self): + return super().__str__() + + + def __copy__(CustomTypedefFields self): + cdef shared_ptr[_module_cbindings.cCustomTypedefFields] cpp_obj = make_shared[_module_cbindings.cCustomTypedefFields]( + deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + ) + return CustomTypedefFields._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj)) + + def __eq__(CustomTypedefFields self, other): + if not isinstance(other, CustomTypedefFields): + return False + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) == deref((other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + + def __ne__(CustomTypedefFields self, other): + if not isinstance(other, CustomTypedefFields): + return True + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) != deref((other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__CustomTypedefFields() + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftMetadata meta + _module_cbindings.StructMetadata[_module_cbindings.cCustomTypedefFields].gen(meta) + return __MetadataBox.box(cmove(meta)) + + @staticmethod + def __get_thrift_name__(): + return "module.CustomTypedefFields" + + @classmethod + def _fbthrift_get_field_name_by_index(cls, idx): + return __sv_to_str(__get_field_name_by_index[_module_cbindings.cCustomTypedefFields](idx)) + + @classmethod + def _fbthrift_get_struct_size(cls): + return 9 + + cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(CustomTypedefFields self, __Protocol proto): + cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data + with nogil: + data = cmove(serializer.cserialize[_module_cbindings.cCustomTypedefFields](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)) + return _fbthrift_iobuf.from_unique_ptr(cmove(data)) + + cdef cuint32_t _fbthrift_deserialize(CustomTypedefFields self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0: + cdef cuint32_t needed + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cCustomTypedefFields]() + with nogil: + needed = serializer.cdeserialize[_module_cbindings.cCustomTypedefFields](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto) + return needed + + + def _to_python(self): + return thrift.python.converter.to_python_struct( + _fbthrift_python_types.CustomTypedefFields, + self, + ) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + import thrift.util.converter + py_deprecated_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_deprecated_types.CustomTypedefFields, self) + +@__cython.auto_pickle(False) +cdef class AdaptedTypedefFields(thrift.py3.types.Struct): + __module__ = _fbthrift__module_name__ + + def __init__(AdaptedTypedefFields self, **kwargs): + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cAdaptedTypedefFields]() + self._fields_setter = _fbthrift_types_fields.__AdaptedTypedefFields_FieldsSetter._fbthrift_create(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + super().__init__(**kwargs) + + def __call__(AdaptedTypedefFields self, **kwargs): + if not kwargs: + return self + cdef AdaptedTypedefFields __fbthrift_inst = AdaptedTypedefFields.__new__(AdaptedTypedefFields) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cAdaptedTypedefFields](deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + __fbthrift_inst._fields_setter = _fbthrift_types_fields.__AdaptedTypedefFields_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("AdaptedTypedefFields", { + "bool_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).bool_field_ref().has_value(), + "integer_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).integer_field_ref().has_value(), + "double_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).double_field_ref().has_value(), + "string_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).string_field_ref().has_value(), + "binary_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).binary_field_ref().has_value(), + "list_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).list_field_ref().has_value(), + "set_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).set_field_ref().has_value(), + "map_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).map_field_ref().has_value(), + "struct_field": deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).struct_field_ref().has_value(), + }) + + @staticmethod + cdef _create_FBTHRIFT_ONLY_DO_NOT_USE(shared_ptr[_module_cbindings.cAdaptedTypedefFields] cpp_obj): + __fbthrift_inst = AdaptedTypedefFields.__new__(AdaptedTypedefFields) + __fbthrift_inst._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = cmove(cpp_obj) + return __fbthrift_inst + + cdef inline bool_field_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).bool_field_ref().value() + + @property + def bool_field(self): + return self.bool_field_impl() + + cdef inline integer_field_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).integer_field_ref().value() + + @property + def integer_field(self): + return self.integer_field_impl() + + cdef inline double_field_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).double_field_ref().value() + + @property + def double_field(self): + return self.double_field_impl() + + cdef inline string_field_impl(self): + return (deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).string_field_ref().value()).decode('UTF-8') + + @property + def string_field(self): + return self.string_field_impl() + + cdef inline binary_field_impl(self): + return (deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).binary_field_ref().value().data())[:deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).binary_field_ref().value().size()] + + @property + def binary_field(self): + return self.binary_field_impl() + + cdef inline list_field_impl(self): + if self.__fbthrift_cached_list_field is None: + self.__fbthrift_cached_list_field = _py3_simple_AdaptedList__List__i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).list_field_ref().ref()) + return self.__fbthrift_cached_list_field + + @property + def list_field(self): + return self.list_field_impl() + + cdef inline set_field_impl(self): + if self.__fbthrift_cached_set_field is None: + self.__fbthrift_cached_set_field = _py3_simple_AdaptedSet__Set__i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).set_field_ref().ref()) + return self.__fbthrift_cached_set_field + + @property + def set_field(self): + return self.set_field_impl() + + cdef inline map_field_impl(self): + if self.__fbthrift_cached_map_field is None: + self.__fbthrift_cached_map_field = _py3_simple_AdaptedMap__Map__i32_i32__from_cpp(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).map_field_ref().ref()) + return self.__fbthrift_cached_map_field + + @property + def map_field(self): + return self.map_field_impl() + + cdef inline struct_field_impl(self): + if self.__fbthrift_cached_struct_field is None: + self.__fbthrift_cached_struct_field = SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(__reference_shared_ptr(deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).struct_field_ref().ref(), self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + return self.__fbthrift_cached_struct_field + + @property + def struct_field(self): + return self.struct_field_impl() + + + def __hash__(AdaptedTypedefFields self): + return super().__hash__() + + def __repr__(AdaptedTypedefFields self): + return super().__repr__() + + def __str__(AdaptedTypedefFields self): + return super().__str__() + + + def __copy__(AdaptedTypedefFields self): + cdef shared_ptr[_module_cbindings.cAdaptedTypedefFields] cpp_obj = make_shared[_module_cbindings.cAdaptedTypedefFields]( + deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + ) + return AdaptedTypedefFields._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cpp_obj)) + + def __eq__(AdaptedTypedefFields self, other): + if not isinstance(other, AdaptedTypedefFields): + return False + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) == deref((other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get()) + + def __ne__(AdaptedTypedefFields self, other): + if not isinstance(other, AdaptedTypedefFields): + return True + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) != deref((other)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + + @staticmethod + def __get_reflection__(): + return get_types_reflection().get_reflection__AdaptedTypedefFields() + + @staticmethod + def __get_metadata__(): + cdef __fbthrift_cThriftMetadata meta + _module_cbindings.StructMetadata[_module_cbindings.cAdaptedTypedefFields].gen(meta) + return __MetadataBox.box(cmove(meta)) + + @staticmethod + def __get_thrift_name__(): + return "module.AdaptedTypedefFields" + + @classmethod + def _fbthrift_get_field_name_by_index(cls, idx): + return __sv_to_str(__get_field_name_by_index[_module_cbindings.cAdaptedTypedefFields](idx)) + + @classmethod + def _fbthrift_get_struct_size(cls): + return 9 + + cdef _fbthrift_iobuf.IOBuf _fbthrift_serialize(AdaptedTypedefFields self, __Protocol proto): + cdef unique_ptr[_fbthrift_iobuf.cIOBuf] data + with nogil: + data = cmove(serializer.cserialize[_module_cbindings.cAdaptedTypedefFields](self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto)) + return _fbthrift_iobuf.from_unique_ptr(cmove(data)) + + cdef cuint32_t _fbthrift_deserialize(AdaptedTypedefFields self, const _fbthrift_iobuf.cIOBuf* buf, __Protocol proto) except? 0: + cdef cuint32_t needed + self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE = make_shared[_module_cbindings.cAdaptedTypedefFields]() + with nogil: + needed = serializer.cdeserialize[_module_cbindings.cAdaptedTypedefFields](buf, self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE.get(), proto) + return needed + + + def _to_python(self): + return thrift.python.converter.to_python_struct( + _fbthrift_python_types.AdaptedTypedefFields, + self, + ) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + import thrift.util.converter + py_deprecated_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_deprecated_types.AdaptedTypedefFields, self) + +cdef vector[cint16_t] List__i16__make_instance(object items) except *: + cdef vector[cint16_t] c_inst + if items is None: + return cmove(c_inst) + for item in items: + if not isinstance(item, int): + raise TypeError(f"{item!r} is not of type int") + item = item + c_inst.push_back(item) + return cmove(c_inst) + +cdef object List__i16__from_cpp(const vector[cint16_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__i16(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef vector[cint32_t] List__i32__make_instance(object items) except *: + cdef vector[cint32_t] c_inst + if items is None: + return cmove(c_inst) + for item in items: + if not isinstance(item, int): + raise TypeError(f"{item!r} is not of type int") + item = 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) + +cdef vector[cint64_t] List__i64__make_instance(object items) except *: + cdef vector[cint64_t] c_inst + if items is None: + return cmove(c_inst) + for item in items: + if not isinstance(item, int): + raise TypeError(f"{item!r} is not of type int") + item = item + c_inst.push_back(item) + return cmove(c_inst) + +cdef object List__i64__from_cpp(const vector[cint64_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__i64(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef vector[string] List__string__make_instance(object items) except *: + cdef vector[string] c_inst + if items is None: + return cmove(c_inst) + if isinstance(items, str): + raise TypeError("If you really want to pass a string into a _typing.Sequence[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") + c_inst.push_back(item.encode('UTF-8')) + return cmove(c_inst) + +cdef object List__string__from_cpp(const vector[string]& c_vec) except *: + cdef list py_list = [] + cdef int idx = 0 + for idx in range(c_vec.size()): + py_list.append(__init_unicode_from_cpp(c_vec[idx])) + return List__string(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef vector[_module_cbindings.cSimpleStruct] List__SimpleStruct__make_instance(object items) except *: + cdef vector[_module_cbindings.cSimpleStruct] c_inst + if items is None: + return cmove(c_inst) + for item in items: + if not isinstance(item, SimpleStruct): + raise TypeError(f"{item!r} is not of type SimpleStruct") + c_inst.push_back(deref((item)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + return cmove(c_inst) + +cdef object List__SimpleStruct__from_cpp(const vector[_module_cbindings.cSimpleStruct]& c_vec) except *: + cdef list py_list = [] + cdef int idx = 0 + for idx in range(c_vec.size()): + py_list.append(SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(make_shared[_module_cbindings.cSimpleStruct](c_vec[idx]))) + return List__SimpleStruct(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef cset[cint32_t] Set__i32__make_instance(object items) except *: + cdef cset[cint32_t] c_inst + if items is None: + return cmove(c_inst) + for item in items: + if not isinstance(item, int): + raise TypeError(f"{item!r} is not of type int") + item = item + c_inst.insert(item) + return cmove(c_inst) + +cdef object Set__i32__from_cpp(const cset[cint32_t]& c_set) except *: + cdef list py_items = [] + cdef __set_iter[cset[cint32_t]] iter = __set_iter[cset[cint32_t]](c_set) + cdef cint32_t citem = 0 + for i in range(c_set.size()): + iter.genNextItem(citem) + py_items.append(citem) + return Set__i32(frozenset(py_items), thrift.py3.types._fbthrift_set_private_ctor) + +cdef cset[string] Set__string__make_instance(object items) except *: + cdef cset[string] c_inst + if items is None: + return cmove(c_inst) + 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") + c_inst.insert(item.encode('UTF-8')) + return cmove(c_inst) + +cdef object Set__string__from_cpp(const cset[string]& c_set) except *: + cdef list py_items = [] + cdef __set_iter[cset[string]] iter = __set_iter[cset[string]](c_set) + cdef string citem + for i in range(c_set.size()): + iter.genNextItem(citem) + py_items.append(__init_unicode_from_cpp(citem)) + return Set__string(frozenset(py_items), thrift.py3.types._fbthrift_set_private_ctor) + +cdef cmap[string,string] Map__string_string__make_instance(object items) except *: + cdef cmap[string,string] c_inst + if items is None: + return cmove(c_inst) + 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, str): + raise TypeError(f"{item!r} is not of type str") + + c_inst[key.encode('UTF-8')] = item.encode('UTF-8') + return cmove(c_inst) + +cdef object Map__string_string__from_cpp(const cmap[string,string]& c_map) except *: + cdef dict py_items = {} + cdef __map_iter[cmap[string,string]] iter = __map_iter[cmap[string,string]](c_map) + cdef string ckey + cdef string cval + for i in range(c_map.size()): + iter.genNextKeyVal(ckey, cval) + py_items[__init_unicode_from_cpp(ckey)] = __init_unicode_from_cpp(cval) + return Map__string_string(py_items, private_ctor_token=thrift.py3.types._fbthrift_map_private_ctor) + +cdef cmap[string,_module_cbindings.cSimpleStruct] Map__string_SimpleStruct__make_instance(object items) except *: + cdef cmap[string,_module_cbindings.cSimpleStruct] c_inst + if items is None: + return cmove(c_inst) + 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, SimpleStruct): + raise TypeError(f"{item!r} is not of type SimpleStruct") + + c_inst[key.encode('UTF-8')] = deref((item)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE) + return cmove(c_inst) + +cdef object Map__string_SimpleStruct__from_cpp(const cmap[string,_module_cbindings.cSimpleStruct]& c_map) except *: + cdef dict py_items = {} + cdef __map_iter[cmap[string,_module_cbindings.cSimpleStruct]] iter = __map_iter[cmap[string,_module_cbindings.cSimpleStruct]](c_map) + cdef string ckey + cdef shared_ptr[_module_cbindings.cSimpleStruct] cval + for i in range(c_map.size()): + iter.genNextKeyVal(ckey, cval) + py_items[__init_unicode_from_cpp(ckey)] = SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(cmove(cval)) + return Map__string_SimpleStruct(py_items, private_ctor_token=thrift.py3.types._fbthrift_map_private_ctor) + +cdef cmap[string,cint16_t] Map__string_i16__make_instance(object items) except *: + cdef cmap[string,cint16_t] c_inst + if items is None: + return cmove(c_inst) + 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 = item + + c_inst[key.encode('UTF-8')] = item + return cmove(c_inst) + +cdef object Map__string_i16__from_cpp(const cmap[string,cint16_t]& c_map) except *: + cdef dict py_items = {} + cdef __map_iter[cmap[string,cint16_t]] iter = __map_iter[cmap[string,cint16_t]](c_map) + cdef string ckey + cdef cint16_t cval = 0 + for i in range(c_map.size()): + iter.genNextKeyVal(ckey, cval) + py_items[__init_unicode_from_cpp(ckey)] = cval + return Map__string_i16(py_items, private_ctor_token=thrift.py3.types._fbthrift_map_private_ctor) + +cdef vector[vector[cint32_t]] List__List__i32__make_instance(object items) except *: + cdef vector[vector[cint32_t]] c_inst + if items is None: + return cmove(c_inst) + for item in items: + if item is None: + raise TypeError("None is not of the type _typing.Sequence[int]") + if not isinstance(item, List__i32): + item = List__i32(item) + c_inst.push_back(List__i32__make_instance(item)) + return cmove(c_inst) + +cdef object List__List__i32__from_cpp(const vector[vector[cint32_t]]& c_vec) except *: + cdef list py_list = [] + cdef int idx = 0 + for idx in range(c_vec.size()): + py_list.append(List__i32__from_cpp(c_vec[idx])) + return List__List__i32(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef cmap[string,cint32_t] Map__string_i32__make_instance(object items) except *: + cdef cmap[string,cint32_t] c_inst + if items is None: + return cmove(c_inst) + 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 = item + + c_inst[key.encode('UTF-8')] = item + return cmove(c_inst) + +cdef object Map__string_i32__from_cpp(const cmap[string,cint32_t]& c_map) except *: + cdef dict py_items = {} + cdef __map_iter[cmap[string,cint32_t]] iter = __map_iter[cmap[string,cint32_t]](c_map) + cdef string ckey + cdef cint32_t cval = 0 + for i in range(c_map.size()): + iter.genNextKeyVal(ckey, cval) + py_items[__init_unicode_from_cpp(ckey)] = cval + return Map__string_i32(py_items, private_ctor_token=thrift.py3.types._fbthrift_map_private_ctor) + +cdef cmap[string,cmap[string,cint32_t]] Map__string_Map__string_i32__make_instance(object items) except *: + cdef cmap[string,cmap[string,cint32_t]] c_inst + if items is None: + return cmove(c_inst) + 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.Mapping[str, int]") + if not isinstance(item, Map__string_i32): + item = Map__string_i32(item) + + c_inst[key.encode('UTF-8')] = Map__string_i32__make_instance(item) + return cmove(c_inst) + +cdef object Map__string_Map__string_i32__from_cpp(const cmap[string,cmap[string,cint32_t]]& c_map) except *: + cdef dict py_items = {} + cdef __map_iter[cmap[string,cmap[string,cint32_t]]] iter = __map_iter[cmap[string,cmap[string,cint32_t]]](c_map) + cdef string ckey + cdef cmap[string,cint32_t] cval + for i in range(c_map.size()): + iter.genNextKeyVal(ckey, cval) + py_items[__init_unicode_from_cpp(ckey)] = Map__string_i32__from_cpp(cval) + return Map__string_Map__string_i32(py_items, private_ctor_token=thrift.py3.types._fbthrift_map_private_ctor) + +cdef vector[cset[string]] List__Set__string__make_instance(object items) except *: + cdef vector[cset[string]] c_inst + if items is None: + return cmove(c_inst) + for item in items: + if item is None: + raise TypeError("None is not of the type _typing.AbstractSet[str]") + if not isinstance(item, Set__string): + item = Set__string(item) + c_inst.push_back(Set__string__make_instance(item)) + return cmove(c_inst) + +cdef object List__Set__string__from_cpp(const vector[cset[string]]& c_vec) except *: + cdef list py_list = [] + cdef int idx = 0 + for idx in range(c_vec.size()): + py_list.append(Set__string__from_cpp(c_vec[idx])) + return List__Set__string(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef cmap[string,vector[_module_cbindings.cSimpleStruct]] Map__string_List__SimpleStruct__make_instance(object items) except *: + cdef cmap[string,vector[_module_cbindings.cSimpleStruct]] c_inst + if items is None: + return cmove(c_inst) + 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[SimpleStruct]") + if not isinstance(item, List__SimpleStruct): + item = List__SimpleStruct(item) + + c_inst[key.encode('UTF-8')] = List__SimpleStruct__make_instance(item) + return cmove(c_inst) + +cdef object Map__string_List__SimpleStruct__from_cpp(const cmap[string,vector[_module_cbindings.cSimpleStruct]]& c_map) except *: + cdef dict py_items = {} + cdef __map_iter[cmap[string,vector[_module_cbindings.cSimpleStruct]]] iter = __map_iter[cmap[string,vector[_module_cbindings.cSimpleStruct]]](c_map) + cdef string ckey + cdef vector[_module_cbindings.cSimpleStruct] cval + for i in range(c_map.size()): + iter.genNextKeyVal(ckey, cval) + py_items[__init_unicode_from_cpp(ckey)] = List__SimpleStruct__from_cpp(cval) + return Map__string_List__SimpleStruct(py_items, private_ctor_token=thrift.py3.types._fbthrift_map_private_ctor) + +cdef vector[vector[string]] List__List__string__make_instance(object items) except *: + cdef vector[vector[string]] c_inst + if items is None: + return cmove(c_inst) + for item in items: + if item is None: + raise TypeError("None is not of the type _typing.Sequence[str]") + if not isinstance(item, List__string): + item = List__string(item) + c_inst.push_back(List__string__make_instance(item)) + return cmove(c_inst) + +cdef object List__List__string__from_cpp(const vector[vector[string]]& c_vec) except *: + cdef list py_list = [] + cdef int idx = 0 + for idx in range(c_vec.size()): + py_list.append(List__string__from_cpp(c_vec[idx])) + return List__List__string(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef vector[cset[cint32_t]] List__Set__i32__make_instance(object items) except *: + cdef vector[cset[cint32_t]] c_inst + if items is None: + return cmove(c_inst) + for item in items: + if item is None: + raise TypeError("None is not of the type _typing.AbstractSet[int]") + if not isinstance(item, Set__i32): + item = Set__i32(item) + c_inst.push_back(Set__i32__make_instance(item)) + return cmove(c_inst) + +cdef object List__Set__i32__from_cpp(const vector[cset[cint32_t]]& c_vec) except *: + cdef list py_list = [] + cdef int idx = 0 + for idx in range(c_vec.size()): + py_list.append(Set__i32__from_cpp(c_vec[idx])) + return List__Set__i32(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef vector[cmap[string,string]] List__Map__string_string__make_instance(object items) except *: + cdef vector[cmap[string,string]] c_inst + if items is None: + return cmove(c_inst) + for item in items: + if item is None: + raise TypeError("None is not of the type _typing.Mapping[str, str]") + if not isinstance(item, Map__string_string): + item = Map__string_string(item) + c_inst.push_back(Map__string_string__make_instance(item)) + return cmove(c_inst) + +cdef object List__Map__string_string__from_cpp(const vector[cmap[string,string]]& c_vec) except *: + cdef list py_list = [] + cdef int idx = 0 + for idx in range(c_vec.size()): + py_list.append(Map__string_string__from_cpp(c_vec[idx])) + return List__Map__string_string(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef vector[string] List__binary__make_instance(object items) except *: + cdef vector[string] c_inst + if items is None: + return cmove(c_inst) + if isinstance(items, str): + raise TypeError("If you really want to pass a string into a _typing.Sequence[bytes] field, explicitly convert it first.") + for item in items: + if not isinstance(item, bytes): + raise TypeError(f"{item!r} is not of type bytes") + c_inst.push_back(item) + return cmove(c_inst) + +cdef object List__binary__from_cpp(const vector[string]& c_vec) except *: + cdef list py_list = [] + cdef int idx = 0 + for idx in range(c_vec.size()): + py_list.append(bytes(c_vec[idx])) + return List__binary(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef cset[string] Set__binary__make_instance(object items) except *: + cdef cset[string] c_inst + if items is None: + return cmove(c_inst) + if isinstance(items, str): + raise TypeError("If you really want to pass a string into a _typing.AbstractSet[bytes] field, explicitly convert it first.") + for item in items: + if not isinstance(item, bytes): + raise TypeError(f"{item!r} is not of type bytes") + c_inst.insert(item) + return cmove(c_inst) + +cdef object Set__binary__from_cpp(const cset[string]& c_set) except *: + cdef list py_items = [] + cdef __set_iter[cset[string]] iter = __set_iter[cset[string]](c_set) + cdef string citem + for i in range(c_set.size()): + iter.genNextItem(citem) + py_items.append(bytes(citem)) + return Set__binary(frozenset(py_items), thrift.py3.types._fbthrift_set_private_ctor) + +cdef vector[_module_cbindings.cAnEnum] List__AnEnum__make_instance(object items) except *: + cdef vector[_module_cbindings.cAnEnum] c_inst + if items is None: + return cmove(c_inst) + for item in items: + if not isinstance(item, AnEnum): + raise TypeError(f"{item!r} is not of type AnEnum") + c_inst.push_back(<_module_cbindings.cAnEnum>item) + return cmove(c_inst) + +cdef object List__AnEnum__from_cpp(const vector[_module_cbindings.cAnEnum]& c_vec) except *: + cdef list py_list = [] + cdef int idx = 0 + for idx in range(c_vec.size()): + py_list.append(translate_cpp_enum_to_python(AnEnum, c_vec[idx])) + return List__AnEnum(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef _module_cbindings._std_unordered_map[cint32_t,cint32_t] _std_unordered_map__Map__i32_i32__make_instance(object items) except *: + cdef _module_cbindings._std_unordered_map[cint32_t,cint32_t] c_inst + if items is None: + return cmove(c_inst) + for key, item in items.items(): + if not isinstance(key, int): + raise TypeError(f"{key!r} is not of type int") + key = key + if not isinstance(item, int): + raise TypeError(f"{item!r} is not of type int") + item = item + + c_inst[key] = item + return cmove(c_inst) + +cdef object _std_unordered_map__Map__i32_i32__from_cpp(const _module_cbindings._std_unordered_map[cint32_t,cint32_t]& c_map) except *: + cdef dict py_items = {} + cdef __map_iter[_module_cbindings._std_unordered_map[cint32_t,cint32_t]] iter = __map_iter[_module_cbindings._std_unordered_map[cint32_t,cint32_t]](c_map) + cdef cint32_t ckey = 0 + cdef cint32_t cval = 0 + for i in range(c_map.size()): + iter.genNextKeyVal(ckey, cval) + py_items[ckey] = cval + return _std_unordered_map__Map__i32_i32(py_items, private_ctor_token=thrift.py3.types._fbthrift_map_private_ctor) + +cdef _module_cbindings._MyType _MyType__List__i32__make_instance(object items) except *: + cdef _module_cbindings._MyType c_inst + if items is None: + return cmove(c_inst) + for item in items: + if not isinstance(item, int): + raise TypeError(f"{item!r} is not of type int") + item = item + c_inst.push_back(item) + return cmove(c_inst) + +cdef object _MyType__List__i32__from_cpp(const _module_cbindings._MyType& 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 _MyType__List__i32(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef _module_cbindings._MyType _MyType__Set__i32__make_instance(object items) except *: + cdef _module_cbindings._MyType c_inst + if items is None: + return cmove(c_inst) + for item in items: + if not isinstance(item, int): + raise TypeError(f"{item!r} is not of type int") + item = item + c_inst.insert(item) + return cmove(c_inst) + +cdef object _MyType__Set__i32__from_cpp(const _module_cbindings._MyType& c_set) except *: + cdef list py_items = [] + cdef __set_iter[_module_cbindings._MyType] iter = __set_iter[_module_cbindings._MyType](c_set) + cdef cint32_t citem = 0 + for i in range(c_set.size()): + iter.genNextItem(citem) + py_items.append(citem) + return _MyType__Set__i32(frozenset(py_items), thrift.py3.types._fbthrift_set_private_ctor) + +cdef _module_cbindings._MyType _MyType__Map__i32_i32__make_instance(object items) except *: + cdef _module_cbindings._MyType c_inst + if items is None: + return cmove(c_inst) + for key, item in items.items(): + if not isinstance(key, int): + raise TypeError(f"{key!r} is not of type int") + key = key + if not isinstance(item, int): + raise TypeError(f"{item!r} is not of type int") + item = item + + c_inst[key] = item + return cmove(c_inst) + +cdef object _MyType__Map__i32_i32__from_cpp(const _module_cbindings._MyType& c_map) except *: + cdef dict py_items = {} + cdef __map_iter[_module_cbindings._MyType] iter = __map_iter[_module_cbindings._MyType](c_map) + cdef cint32_t ckey = 0 + cdef cint32_t cval = 0 + for i in range(c_map.size()): + iter.genNextKeyVal(ckey, cval) + py_items[ckey] = cval + return _MyType__Map__i32_i32(py_items, private_ctor_token=thrift.py3.types._fbthrift_map_private_ctor) + +cdef _module_cbindings._py3_simple_AdaptedList _py3_simple_AdaptedList__List__i32__make_instance(object items) except *: + cdef _module_cbindings._py3_simple_AdaptedList c_inst + if items is None: + return cmove(c_inst) + for item in items: + if not isinstance(item, int): + raise TypeError(f"{item!r} is not of type int") + item = item + c_inst.push_back(item) + return cmove(c_inst) + +cdef object _py3_simple_AdaptedList__List__i32__from_cpp(const _module_cbindings._py3_simple_AdaptedList& 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 _py3_simple_AdaptedList__List__i32(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef _module_cbindings._py3_simple_AdaptedSet _py3_simple_AdaptedSet__Set__i32__make_instance(object items) except *: + cdef _module_cbindings._py3_simple_AdaptedSet c_inst + if items is None: + return cmove(c_inst) + for item in items: + if not isinstance(item, int): + raise TypeError(f"{item!r} is not of type int") + item = item + c_inst.insert(item) + return cmove(c_inst) + +cdef object _py3_simple_AdaptedSet__Set__i32__from_cpp(const _module_cbindings._py3_simple_AdaptedSet& c_set) except *: + cdef list py_items = [] + cdef __set_iter[_module_cbindings._py3_simple_AdaptedSet] iter = __set_iter[_module_cbindings._py3_simple_AdaptedSet](c_set) + cdef cint32_t citem = 0 + for i in range(c_set.size()): + iter.genNextItem(citem) + py_items.append(citem) + return _py3_simple_AdaptedSet__Set__i32(frozenset(py_items), thrift.py3.types._fbthrift_set_private_ctor) + +cdef _module_cbindings._py3_simple_AdaptedMap _py3_simple_AdaptedMap__Map__i32_i32__make_instance(object items) except *: + cdef _module_cbindings._py3_simple_AdaptedMap c_inst + if items is None: + return cmove(c_inst) + for key, item in items.items(): + if not isinstance(key, int): + raise TypeError(f"{key!r} is not of type int") + key = key + if not isinstance(item, int): + raise TypeError(f"{item!r} is not of type int") + item = item + + c_inst[key] = item + return cmove(c_inst) + +cdef object _py3_simple_AdaptedMap__Map__i32_i32__from_cpp(const _module_cbindings._py3_simple_AdaptedMap& c_map) except *: + cdef dict py_items = {} + cdef __map_iter[_module_cbindings._py3_simple_AdaptedMap] iter = __map_iter[_module_cbindings._py3_simple_AdaptedMap](c_map) + cdef cint32_t ckey = 0 + cdef cint32_t cval = 0 + for i in range(c_map.size()): + iter.genNextKeyVal(ckey, cval) + py_items[ckey] = cval + return _py3_simple_AdaptedMap__Map__i32_i32(py_items, private_ctor_token=thrift.py3.types._fbthrift_map_private_ctor) + +cdef cmap[cint32_t,double] Map__i32_double__make_instance(object items) except *: + cdef cmap[cint32_t,double] c_inst + if items is None: + return cmove(c_inst) + for key, item in items.items(): + if not isinstance(key, int): + raise TypeError(f"{key!r} is not of type int") + key = key + if not isinstance(item, (float, int)): + raise TypeError(f"{item!r} is not of type float") + + c_inst[key] = item + return cmove(c_inst) + +cdef object Map__i32_double__from_cpp(const cmap[cint32_t,double]& c_map) except *: + cdef dict py_items = {} + cdef __map_iter[cmap[cint32_t,double]] iter = __map_iter[cmap[cint32_t,double]](c_map) + cdef cint32_t ckey = 0 + cdef double cval = 0 + for i in range(c_map.size()): + iter.genNextKeyVal(ckey, cval) + py_items[ckey] = cval + return Map__i32_double(py_items, private_ctor_token=thrift.py3.types._fbthrift_map_private_ctor) + +cdef vector[cmap[cint32_t,double]] List__Map__i32_double__make_instance(object items) except *: + cdef vector[cmap[cint32_t,double]] c_inst + if items is None: + return cmove(c_inst) + for item in items: + if item is None: + raise TypeError("None is not of the type _typing.Mapping[int, float]") + if not isinstance(item, Map__i32_double): + item = Map__i32_double(item) + c_inst.push_back(Map__i32_double__make_instance(item)) + return cmove(c_inst) + +cdef object List__Map__i32_double__from_cpp(const vector[cmap[cint32_t,double]]& c_vec) except *: + cdef list py_list = [] + cdef int idx = 0 + for idx in range(c_vec.size()): + py_list.append(Map__i32_double__from_cpp(c_vec[idx])) + return List__Map__i32_double(py_list, thrift.py3.types._fbthrift_list_private_ctor) + +cdef cmap[_module_cbindings.cAnEnumRenamed,cint32_t] Map__AnEnumRenamed_i32__make_instance(object items) except *: + cdef cmap[_module_cbindings.cAnEnumRenamed,cint32_t] c_inst + if items is None: + return cmove(c_inst) + for key, item in items.items(): + if not isinstance(key, AnEnumRenamed): + raise TypeError(f"{key!r} is not of type AnEnumRenamed") + if not isinstance(item, int): + raise TypeError(f"{item!r} is not of type int") + item = item + + c_inst[<_module_cbindings.cAnEnumRenamed>key] = item + return cmove(c_inst) + +cdef object Map__AnEnumRenamed_i32__from_cpp(const cmap[_module_cbindings.cAnEnumRenamed,cint32_t]& c_map) except *: + cdef dict py_items = {} + cdef __map_iter[cmap[_module_cbindings.cAnEnumRenamed,cint32_t]] iter = __map_iter[cmap[_module_cbindings.cAnEnumRenamed,cint32_t]](c_map) + cdef _module_cbindings.cAnEnumRenamed ckey + cdef cint32_t cval = 0 + for i in range(c_map.size()): + iter.genNextKeyVal(ckey, cval) + py_items[translate_cpp_enum_to_python(AnEnumRenamed, ckey)] = cval + return Map__AnEnumRenamed_i32(py_items, private_ctor_token=thrift.py3.types._fbthrift_map_private_ctor) + + +A_BOOL = True +A_BYTE = 8 +THE_ANSWER = 42 +A_NUMBER = 84 +A_BIG_NUMBER = 102 +A_REAL_NUMBER = 3.14 +A_FAKE_NUMBER = 3.0 +A_WORD = "Good word" +SOME_BYTES = b"bytes" +A_STRUCT = SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(constant_shared_ptr(_module_cbindings.cA_STRUCT())) +EMPTY = SimpleStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(constant_shared_ptr(_module_cbindings.cEMPTY())) +WORD_LIST = List__string__from_cpp(_module_cbindings.cWORD_LIST()) +SOME_MAP = List__Map__i32_double__from_cpp(_module_cbindings.cSOME_MAP()) +DIGITS = Set__i32__from_cpp(_module_cbindings.cDIGITS()) +A_CONST_MAP = Map__string_SimpleStruct__from_cpp(_module_cbindings.cA_CONST_MAP()) +ANOTHER_CONST_MAP = Map__AnEnumRenamed_i32__from_cpp(_module_cbindings.cANOTHER_CONST_MAP()) +IOBufPtr = _fbthrift_iobuf.IOBuf +IOBuf = _fbthrift_iobuf.IOBuf +AdaptedTypeDef = SimpleStruct +foo_bar = bytes +CustomBool = bool +CustomInteger = int +CustomDouble = float +CustomString = str +CustomBinary = bytes +CustomList = _MyType__List__i32 +CustomSet = _MyType__Set__i32 +CustomMap = _MyType__Map__i32_i32 +CustomStruct = SimpleStruct +AdaptedBool = bool +AdaptedInteger = int +AdaptedDouble = float +AdaptedString = str +AdaptedBinary = bytes +AdaptedList = _py3_simple_AdaptedList__List__i32 +AdaptedSet = _py3_simple_AdaptedSet__Set__i32 +AdaptedMap = _py3_simple_AdaptedMap__Map__i32_i32 +AdaptedStruct = SimpleStruct diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_empty.pyx b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_empty.pyx new file mode 100644 index 00000000000..fc5c9c65919 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_empty.pyx @@ -0,0 +1,9 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# +# pump UP the NODE count +# PUMP up THE node COUNT +# pump UP the NODE count diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_fields.pxd b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_fields.pxd new file mode 100644 index 00000000000..4c9b7178c16 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_fields.pxd @@ -0,0 +1,183 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +from libc.stdint cimport ( + int8_t as cint8_t, + int16_t as cint16_t, + int32_t as cint32_t, + int64_t as cint64_t, + uint16_t as cuint16_t, + uint32_t as cuint32_t, +) +from libcpp.string cimport string +from libcpp cimport bool as cbool, nullptr, nullptr_t +from cpython cimport bool as pbool +from libcpp.memory cimport shared_ptr, unique_ptr +from libcpp.vector cimport vector +from libcpp.set cimport set as cset +from libcpp.map cimport map as cmap, pair as cpair +from libcpp.unordered_map cimport unordered_map as cumap +cimport folly.iobuf as _fbthrift_iobuf + +from thrift.python.exceptions cimport cTException +cimport thrift.py3.exceptions +cimport thrift.py3.types +from thrift.python.std_libcpp cimport string_view as __cstring_view +from thrift.py3.types cimport ( + bstring, + bytes_to_string, + field_ref as __field_ref, + optional_field_ref as __optional_field_ref, + required_field_ref as __required_field_ref, + terse_field_ref as __terse_field_ref, + StructFieldsSetter as __StructFieldsSetter +) +from thrift.python.protocol cimport Protocol as __Protocol +from folly.optional cimport cOptional as __cOptional + + +cimport module.types as _module_types +cimport module.cbindings as _module_cbindings + + + +ctypedef void (*__SimpleException_FieldsSetterFunc)(__SimpleException_FieldsSetter, object) except * + +cdef class __SimpleException_FieldsSetter(__StructFieldsSetter): + cdef _module_cbindings.cSimpleException* _struct_cpp_obj + cdef cumap[__cstring_view, __SimpleException_FieldsSetterFunc] _setters + + @staticmethod + cdef __SimpleException_FieldsSetter _fbthrift_create(_module_cbindings.cSimpleException* struct_cpp_obj) + cdef void _set_field_0(self, _fbthrift_value) except * + + +ctypedef void (*__OptionalRefStruct_FieldsSetterFunc)(__OptionalRefStruct_FieldsSetter, object) except * + +cdef class __OptionalRefStruct_FieldsSetter(__StructFieldsSetter): + cdef _module_cbindings.cOptionalRefStruct* _struct_cpp_obj + cdef cumap[__cstring_view, __OptionalRefStruct_FieldsSetterFunc] _setters + + @staticmethod + cdef __OptionalRefStruct_FieldsSetter _fbthrift_create(_module_cbindings.cOptionalRefStruct* struct_cpp_obj) + cdef void _set_field_0(self, _fbthrift_value) except * + + +ctypedef void (*__SimpleStruct_FieldsSetterFunc)(__SimpleStruct_FieldsSetter, object) except * + +cdef class __SimpleStruct_FieldsSetter(__StructFieldsSetter): + cdef _module_cbindings.cSimpleStruct* _struct_cpp_obj + cdef cumap[__cstring_view, __SimpleStruct_FieldsSetterFunc] _setters + + @staticmethod + cdef __SimpleStruct_FieldsSetter _fbthrift_create(_module_cbindings.cSimpleStruct* struct_cpp_obj) + cdef void _set_field_0(self, _fbthrift_value) except * + cdef void _set_field_1(self, _fbthrift_value) except * + cdef void _set_field_2(self, _fbthrift_value) except * + cdef void _set_field_3(self, _fbthrift_value) except * + cdef void _set_field_4(self, _fbthrift_value) except * + cdef void _set_field_5(self, _fbthrift_value) except * + cdef void _set_field_6(self, _fbthrift_value) except * + cdef void _set_field_7(self, _fbthrift_value) except * + + +ctypedef void (*__HiddenTypeFieldsStruct_FieldsSetterFunc)(__HiddenTypeFieldsStruct_FieldsSetter, object) except * + +cdef class __HiddenTypeFieldsStruct_FieldsSetter(__StructFieldsSetter): + cdef _module_cbindings.cHiddenTypeFieldsStruct* _struct_cpp_obj + cdef cumap[__cstring_view, __HiddenTypeFieldsStruct_FieldsSetterFunc] _setters + + @staticmethod + cdef __HiddenTypeFieldsStruct_FieldsSetter _fbthrift_create(_module_cbindings.cHiddenTypeFieldsStruct* struct_cpp_obj) + + +ctypedef void (*__ComplexStruct_FieldsSetterFunc)(__ComplexStruct_FieldsSetter, object) except * + +cdef class __ComplexStruct_FieldsSetter(__StructFieldsSetter): + cdef _module_cbindings.cComplexStruct* _struct_cpp_obj + cdef cumap[__cstring_view, __ComplexStruct_FieldsSetterFunc] _setters + + @staticmethod + cdef __ComplexStruct_FieldsSetter _fbthrift_create(_module_cbindings.cComplexStruct* struct_cpp_obj) + cdef void _set_field_0(self, _fbthrift_value) except * + cdef void _set_field_1(self, _fbthrift_value) except * + cdef void _set_field_2(self, _fbthrift_value) except * + cdef void _set_field_3(self, _fbthrift_value) except * + cdef void _set_field_4(self, _fbthrift_value) except * + cdef void _set_field_5(self, _fbthrift_value) except * + cdef void _set_field_6(self, _fbthrift_value) except * + cdef void _set_field_7(self, _fbthrift_value) except * + cdef void _set_field_8(self, _fbthrift_value) except * + + +ctypedef void (*__BinaryUnionStruct_FieldsSetterFunc)(__BinaryUnionStruct_FieldsSetter, object) except * + +cdef class __BinaryUnionStruct_FieldsSetter(__StructFieldsSetter): + cdef _module_cbindings.cBinaryUnionStruct* _struct_cpp_obj + cdef cumap[__cstring_view, __BinaryUnionStruct_FieldsSetterFunc] _setters + + @staticmethod + cdef __BinaryUnionStruct_FieldsSetter _fbthrift_create(_module_cbindings.cBinaryUnionStruct* struct_cpp_obj) + cdef void _set_field_0(self, _fbthrift_value) except * + + +ctypedef void (*__CustomFields_FieldsSetterFunc)(__CustomFields_FieldsSetter, object) except * + +cdef class __CustomFields_FieldsSetter(__StructFieldsSetter): + cdef _module_cbindings.cCustomFields* _struct_cpp_obj + cdef cumap[__cstring_view, __CustomFields_FieldsSetterFunc] _setters + + @staticmethod + cdef __CustomFields_FieldsSetter _fbthrift_create(_module_cbindings.cCustomFields* struct_cpp_obj) + cdef void _set_field_0(self, _fbthrift_value) except * + cdef void _set_field_1(self, _fbthrift_value) except * + cdef void _set_field_2(self, _fbthrift_value) except * + cdef void _set_field_3(self, _fbthrift_value) except * + cdef void _set_field_4(self, _fbthrift_value) except * + cdef void _set_field_5(self, _fbthrift_value) except * + cdef void _set_field_6(self, _fbthrift_value) except * + cdef void _set_field_7(self, _fbthrift_value) except * + cdef void _set_field_8(self, _fbthrift_value) except * + + +ctypedef void (*__CustomTypedefFields_FieldsSetterFunc)(__CustomTypedefFields_FieldsSetter, object) except * + +cdef class __CustomTypedefFields_FieldsSetter(__StructFieldsSetter): + cdef _module_cbindings.cCustomTypedefFields* _struct_cpp_obj + cdef cumap[__cstring_view, __CustomTypedefFields_FieldsSetterFunc] _setters + + @staticmethod + cdef __CustomTypedefFields_FieldsSetter _fbthrift_create(_module_cbindings.cCustomTypedefFields* struct_cpp_obj) + cdef void _set_field_0(self, _fbthrift_value) except * + cdef void _set_field_1(self, _fbthrift_value) except * + cdef void _set_field_2(self, _fbthrift_value) except * + cdef void _set_field_3(self, _fbthrift_value) except * + cdef void _set_field_4(self, _fbthrift_value) except * + cdef void _set_field_5(self, _fbthrift_value) except * + cdef void _set_field_6(self, _fbthrift_value) except * + cdef void _set_field_7(self, _fbthrift_value) except * + cdef void _set_field_8(self, _fbthrift_value) except * + + +ctypedef void (*__AdaptedTypedefFields_FieldsSetterFunc)(__AdaptedTypedefFields_FieldsSetter, object) except * + +cdef class __AdaptedTypedefFields_FieldsSetter(__StructFieldsSetter): + cdef _module_cbindings.cAdaptedTypedefFields* _struct_cpp_obj + cdef cumap[__cstring_view, __AdaptedTypedefFields_FieldsSetterFunc] _setters + + @staticmethod + cdef __AdaptedTypedefFields_FieldsSetter _fbthrift_create(_module_cbindings.cAdaptedTypedefFields* struct_cpp_obj) + cdef void _set_field_0(self, _fbthrift_value) except * + cdef void _set_field_1(self, _fbthrift_value) except * + cdef void _set_field_2(self, _fbthrift_value) except * + cdef void _set_field_3(self, _fbthrift_value) except * + cdef void _set_field_4(self, _fbthrift_value) except * + cdef void _set_field_5(self, _fbthrift_value) except * + cdef void _set_field_6(self, _fbthrift_value) except * + cdef void _set_field_7(self, _fbthrift_value) except * + cdef void _set_field_8(self, _fbthrift_value) except * + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_fields.pyx b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_fields.pyx new file mode 100644 index 00000000000..83e9ac4aa35 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_fields.pyx @@ -0,0 +1,642 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# +cimport cython as __cython +from cython.operator cimport dereference as deref +from libcpp.utility cimport move as cmove +from thrift.py3.types cimport ( + assign_unique_ptr, + assign_shared_ptr, + assign_shared_const_ptr, + bytes_to_string, + make_unique, + make_shared, + make_const_shared, +) +cimport thrift.py3.types +from thrift.py3.types cimport ( + reset_field as __reset_field, + StructFieldsSetter as __StructFieldsSetter +) + +from thrift.py3.types cimport const_pointer_cast +from thrift.python.types cimport BadEnum as _fbthrift_BadEnum + + +import module.types as _module_types + + +@__cython.auto_pickle(False) +cdef class __SimpleException_FieldsSetter(__StructFieldsSetter): + + @staticmethod + cdef __SimpleException_FieldsSetter _fbthrift_create(_module_cbindings.cSimpleException* struct_cpp_obj): + cdef __SimpleException_FieldsSetter __fbthrift_inst = __SimpleException_FieldsSetter.__new__(__SimpleException_FieldsSetter) + __fbthrift_inst._struct_cpp_obj = struct_cpp_obj + __fbthrift_inst._setters[__cstring_view("err_code")] = __SimpleException_FieldsSetter._set_field_0 + return __fbthrift_inst + + cdef void set_field(__SimpleException_FieldsSetter self, const char* name, object value) except *: + cdef __cstring_view cname = __cstring_view(name) + cdef cumap[__cstring_view, __SimpleException_FieldsSetterFunc].iterator found = self._setters.find(cname) + if found == self._setters.end(): + raise TypeError(f"invalid field name {name.decode('utf-8')}") + deref(found).second(self, value) + + cdef void _set_field_0(self, _fbthrift_value) except *: + # for field err_code + if _fbthrift_value is None: + __reset_field[_module_cbindings.cSimpleException](deref(self._struct_cpp_obj), 0) + return + if not isinstance(_fbthrift_value, int): + raise TypeError(f'err_code is not a { int !r}.') + _fbthrift_value = _fbthrift_value + deref(self._struct_cpp_obj).err_code_ref().assign(_fbthrift_value) + + +@__cython.auto_pickle(False) +cdef class __OptionalRefStruct_FieldsSetter(__StructFieldsSetter): + + @staticmethod + cdef __OptionalRefStruct_FieldsSetter _fbthrift_create(_module_cbindings.cOptionalRefStruct* struct_cpp_obj): + cdef __OptionalRefStruct_FieldsSetter __fbthrift_inst = __OptionalRefStruct_FieldsSetter.__new__(__OptionalRefStruct_FieldsSetter) + __fbthrift_inst._struct_cpp_obj = struct_cpp_obj + __fbthrift_inst._setters[__cstring_view("optional_blob")] = __OptionalRefStruct_FieldsSetter._set_field_0 + return __fbthrift_inst + + cdef void set_field(__OptionalRefStruct_FieldsSetter self, const char* name, object value) except *: + cdef __cstring_view cname = __cstring_view(name) + cdef cumap[__cstring_view, __OptionalRefStruct_FieldsSetterFunc].iterator found = self._setters.find(cname) + if found == self._setters.end(): + raise TypeError(f"invalid field name {name.decode('utf-8')}") + deref(found).second(self, value) + + cdef void _set_field_0(self, _fbthrift_value) except *: + # for field optional_blob + if _fbthrift_value is None: + __reset_field[_module_cbindings.cOptionalRefStruct](deref(self._struct_cpp_obj), 0) + return + if not isinstance(_fbthrift_value, _fbthrift_iobuf.IOBuf): + raise TypeError(f'optional_blob is not a { _fbthrift_iobuf.IOBuf !r}.') + deref(self._struct_cpp_obj).optional_blob_ref().assign((<_fbthrift_iobuf.IOBuf?>_fbthrift_value).c_clone()) + + +@__cython.auto_pickle(False) +cdef class __SimpleStruct_FieldsSetter(__StructFieldsSetter): + + @staticmethod + cdef __SimpleStruct_FieldsSetter _fbthrift_create(_module_cbindings.cSimpleStruct* struct_cpp_obj): + cdef __SimpleStruct_FieldsSetter __fbthrift_inst = __SimpleStruct_FieldsSetter.__new__(__SimpleStruct_FieldsSetter) + __fbthrift_inst._struct_cpp_obj = struct_cpp_obj + __fbthrift_inst._setters[__cstring_view("is_on")] = __SimpleStruct_FieldsSetter._set_field_0 + __fbthrift_inst._setters[__cstring_view("tiny_int")] = __SimpleStruct_FieldsSetter._set_field_1 + __fbthrift_inst._setters[__cstring_view("small_int")] = __SimpleStruct_FieldsSetter._set_field_2 + __fbthrift_inst._setters[__cstring_view("nice_sized_int")] = __SimpleStruct_FieldsSetter._set_field_3 + __fbthrift_inst._setters[__cstring_view("big_int")] = __SimpleStruct_FieldsSetter._set_field_4 + __fbthrift_inst._setters[__cstring_view("real")] = __SimpleStruct_FieldsSetter._set_field_5 + __fbthrift_inst._setters[__cstring_view("smaller_real")] = __SimpleStruct_FieldsSetter._set_field_6 + __fbthrift_inst._setters[__cstring_view("something")] = __SimpleStruct_FieldsSetter._set_field_7 + return __fbthrift_inst + + cdef void set_field(__SimpleStruct_FieldsSetter self, const char* name, object value) except *: + cdef __cstring_view cname = __cstring_view(name) + cdef cumap[__cstring_view, __SimpleStruct_FieldsSetterFunc].iterator found = self._setters.find(cname) + if found == self._setters.end(): + raise TypeError(f"invalid field name {name.decode('utf-8')}") + deref(found).second(self, value) + + cdef void _set_field_0(self, _fbthrift_value) except *: + # for field is_on + if _fbthrift_value is None: + __reset_field[_module_cbindings.cSimpleStruct](deref(self._struct_cpp_obj), 0) + return + if not isinstance(_fbthrift_value, bool): + raise TypeError(f'is_on is not a { bool !r}.') + deref(self._struct_cpp_obj).is_on_ref().assign(_fbthrift_value) + + cdef void _set_field_1(self, _fbthrift_value) except *: + # for field tiny_int + if _fbthrift_value is None: + __reset_field[_module_cbindings.cSimpleStruct](deref(self._struct_cpp_obj), 1) + return + if not isinstance(_fbthrift_value, int): + raise TypeError(f'tiny_int is not a { int !r}.') + _fbthrift_value = _fbthrift_value + deref(self._struct_cpp_obj).tiny_int_ref().assign(_fbthrift_value) + + cdef void _set_field_2(self, _fbthrift_value) except *: + # for field small_int + if _fbthrift_value is None: + __reset_field[_module_cbindings.cSimpleStruct](deref(self._struct_cpp_obj), 2) + return + if not isinstance(_fbthrift_value, int): + raise TypeError(f'small_int is not a { int !r}.') + _fbthrift_value = _fbthrift_value + deref(self._struct_cpp_obj).small_int_ref().assign(_fbthrift_value) + + cdef void _set_field_3(self, _fbthrift_value) except *: + # for field nice_sized_int + if _fbthrift_value is None: + __reset_field[_module_cbindings.cSimpleStruct](deref(self._struct_cpp_obj), 3) + return + if not isinstance(_fbthrift_value, int): + raise TypeError(f'nice_sized_int is not a { int !r}.') + _fbthrift_value = _fbthrift_value + deref(self._struct_cpp_obj).nice_sized_int_ref().assign(_fbthrift_value) + + cdef void _set_field_4(self, _fbthrift_value) except *: + # for field big_int + if _fbthrift_value is None: + __reset_field[_module_cbindings.cSimpleStruct](deref(self._struct_cpp_obj), 4) + return + if not isinstance(_fbthrift_value, int): + raise TypeError(f'big_int is not a { int !r}.') + _fbthrift_value = _fbthrift_value + deref(self._struct_cpp_obj).big_int_ref().assign(_fbthrift_value) + + cdef void _set_field_5(self, _fbthrift_value) except *: + # for field real + if _fbthrift_value is None: + __reset_field[_module_cbindings.cSimpleStruct](deref(self._struct_cpp_obj), 5) + return + if not isinstance(_fbthrift_value, (float, int)): + raise TypeError(f'real is not a { float !r}.') + deref(self._struct_cpp_obj).real_ref().assign(_fbthrift_value) + + cdef void _set_field_6(self, _fbthrift_value) except *: + # for field smaller_real + if _fbthrift_value is None: + __reset_field[_module_cbindings.cSimpleStruct](deref(self._struct_cpp_obj), 6) + return + if not isinstance(_fbthrift_value, (float, int)): + raise TypeError(f'smaller_real is not a { float !r}.') + deref(self._struct_cpp_obj).smaller_real_ref().assign(_fbthrift_value) + + cdef void _set_field_7(self, _fbthrift_value) except *: + # for field something + if _fbthrift_value is None: + __reset_field[_module_cbindings.cSimpleStruct](deref(self._struct_cpp_obj), 7) + return + deref(self._struct_cpp_obj).something_ref().assign(_module_types._std_unordered_map__Map__i32_i32__make_instance(_fbthrift_value)) + + +@__cython.auto_pickle(False) +cdef class __HiddenTypeFieldsStruct_FieldsSetter(__StructFieldsSetter): + + @staticmethod + cdef __HiddenTypeFieldsStruct_FieldsSetter _fbthrift_create(_module_cbindings.cHiddenTypeFieldsStruct* struct_cpp_obj): + cdef __HiddenTypeFieldsStruct_FieldsSetter __fbthrift_inst = __HiddenTypeFieldsStruct_FieldsSetter.__new__(__HiddenTypeFieldsStruct_FieldsSetter) + __fbthrift_inst._struct_cpp_obj = struct_cpp_obj + return __fbthrift_inst + + cdef void set_field(__HiddenTypeFieldsStruct_FieldsSetter self, const char* name, object value) except *: + cdef __cstring_view cname = __cstring_view(name) + cdef cumap[__cstring_view, __HiddenTypeFieldsStruct_FieldsSetterFunc].iterator found = self._setters.find(cname) + if found == self._setters.end(): + raise TypeError(f"invalid field name {name.decode('utf-8')}") + deref(found).second(self, value) + + +@__cython.auto_pickle(False) +cdef class __ComplexStruct_FieldsSetter(__StructFieldsSetter): + + @staticmethod + cdef __ComplexStruct_FieldsSetter _fbthrift_create(_module_cbindings.cComplexStruct* struct_cpp_obj): + cdef __ComplexStruct_FieldsSetter __fbthrift_inst = __ComplexStruct_FieldsSetter.__new__(__ComplexStruct_FieldsSetter) + __fbthrift_inst._struct_cpp_obj = struct_cpp_obj + __fbthrift_inst._setters[__cstring_view("structOne")] = __ComplexStruct_FieldsSetter._set_field_0 + __fbthrift_inst._setters[__cstring_view("structTwo")] = __ComplexStruct_FieldsSetter._set_field_1 + __fbthrift_inst._setters[__cstring_view("an_integer")] = __ComplexStruct_FieldsSetter._set_field_2 + __fbthrift_inst._setters[__cstring_view("name")] = __ComplexStruct_FieldsSetter._set_field_3 + __fbthrift_inst._setters[__cstring_view("an_enum")] = __ComplexStruct_FieldsSetter._set_field_4 + __fbthrift_inst._setters[__cstring_view("some_bytes")] = __ComplexStruct_FieldsSetter._set_field_5 + __fbthrift_inst._setters[__cstring_view("sender")] = __ComplexStruct_FieldsSetter._set_field_6 + __fbthrift_inst._setters[__cstring_view("cdef_")] = __ComplexStruct_FieldsSetter._set_field_7 + __fbthrift_inst._setters[__cstring_view("bytes_with_cpp_type")] = __ComplexStruct_FieldsSetter._set_field_8 + return __fbthrift_inst + + cdef void set_field(__ComplexStruct_FieldsSetter self, const char* name, object value) except *: + cdef __cstring_view cname = __cstring_view(name) + cdef cumap[__cstring_view, __ComplexStruct_FieldsSetterFunc].iterator found = self._setters.find(cname) + if found == self._setters.end(): + raise TypeError(f"invalid field name {name.decode('utf-8')}") + deref(found).second(self, value) + + cdef void _set_field_0(self, _fbthrift_value) except *: + # for field structOne + if _fbthrift_value is None: + __reset_field[_module_cbindings.cComplexStruct](deref(self._struct_cpp_obj), 0) + return + if not isinstance(_fbthrift_value, _module_types.SimpleStruct): + raise TypeError(f'structOne is not a { _module_types.SimpleStruct !r}.') + deref(self._struct_cpp_obj).structOne_ref().assign(deref((<_module_types.SimpleStruct?> _fbthrift_value)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + + cdef void _set_field_1(self, _fbthrift_value) except *: + # for field structTwo + if _fbthrift_value is None: + __reset_field[_module_cbindings.cComplexStruct](deref(self._struct_cpp_obj), 1) + return + if not isinstance(_fbthrift_value, _module_types.SimpleStruct): + raise TypeError(f'structTwo is not a { _module_types.SimpleStruct !r}.') + deref(self._struct_cpp_obj).structTwo_ref().assign(deref((<_module_types.SimpleStruct?> _fbthrift_value)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + + cdef void _set_field_2(self, _fbthrift_value) except *: + # for field an_integer + if _fbthrift_value is None: + __reset_field[_module_cbindings.cComplexStruct](deref(self._struct_cpp_obj), 2) + return + if not isinstance(_fbthrift_value, int): + raise TypeError(f'an_integer is not a { int !r}.') + _fbthrift_value = _fbthrift_value + deref(self._struct_cpp_obj).an_integer_ref().assign(_fbthrift_value) + + cdef void _set_field_3(self, _fbthrift_value) except *: + # for field name + if _fbthrift_value is None: + __reset_field[_module_cbindings.cComplexStruct](deref(self._struct_cpp_obj), 3) + return + if not isinstance(_fbthrift_value, str): + raise TypeError(f'name is not a { str !r}.') + deref(self._struct_cpp_obj).name_ref().assign(cmove(bytes_to_string(_fbthrift_value.encode('utf-8')))) + + cdef void _set_field_4(self, _fbthrift_value) except *: + # for field an_enum + if _fbthrift_value is None: + __reset_field[_module_cbindings.cComplexStruct](deref(self._struct_cpp_obj), 4) + return + if not isinstance(_fbthrift_value, _fbthrift_BadEnum) and not isinstance(_fbthrift_value, _module_types.AnEnum): + raise TypeError(f'field an_enum value: {repr(_fbthrift_value)} is not of the enum type { _module_types.AnEnum }.') + deref(self._struct_cpp_obj).an_enum_ref().assign(<_module_cbindings.cAnEnum>_fbthrift_value) + + cdef void _set_field_5(self, _fbthrift_value) except *: + # for field some_bytes + if _fbthrift_value is None: + __reset_field[_module_cbindings.cComplexStruct](deref(self._struct_cpp_obj), 5) + return + if not isinstance(_fbthrift_value, bytes): + raise TypeError(f'some_bytes is not a { bytes !r}.') + deref(self._struct_cpp_obj).some_bytes_ref().assign(cmove(bytes_to_string(_fbthrift_value))) + + cdef void _set_field_6(self, _fbthrift_value) except *: + # for field sender + if _fbthrift_value is None: + __reset_field[_module_cbindings.cComplexStruct](deref(self._struct_cpp_obj), 6) + return + if not isinstance(_fbthrift_value, str): + raise TypeError(f'sender is not a { str !r}.') + deref(self._struct_cpp_obj).sender_ref().assign(cmove(bytes_to_string(_fbthrift_value.encode('utf-8')))) + + cdef void _set_field_7(self, _fbthrift_value) except *: + # for field cdef_ + if _fbthrift_value is None: + __reset_field[_module_cbindings.cComplexStruct](deref(self._struct_cpp_obj), 7) + return + if not isinstance(_fbthrift_value, str): + raise TypeError(f'cdef_ is not a { str !r}.') + deref(self._struct_cpp_obj).cdef__ref().assign(cmove(bytes_to_string(_fbthrift_value.encode('utf-8')))) + + cdef void _set_field_8(self, _fbthrift_value) except *: + # for field bytes_with_cpp_type + if _fbthrift_value is None: + __reset_field[_module_cbindings.cComplexStruct](deref(self._struct_cpp_obj), 8) + return + if not isinstance(_fbthrift_value, bytes): + raise TypeError(f'bytes_with_cpp_type is not a { bytes !r}.') + deref(self._struct_cpp_obj).bytes_with_cpp_type_ref().assign(_module_cbindings.foo_Bar(cmove(_fbthrift_value))) + + +@__cython.auto_pickle(False) +cdef class __BinaryUnionStruct_FieldsSetter(__StructFieldsSetter): + + @staticmethod + cdef __BinaryUnionStruct_FieldsSetter _fbthrift_create(_module_cbindings.cBinaryUnionStruct* struct_cpp_obj): + cdef __BinaryUnionStruct_FieldsSetter __fbthrift_inst = __BinaryUnionStruct_FieldsSetter.__new__(__BinaryUnionStruct_FieldsSetter) + __fbthrift_inst._struct_cpp_obj = struct_cpp_obj + __fbthrift_inst._setters[__cstring_view("u")] = __BinaryUnionStruct_FieldsSetter._set_field_0 + return __fbthrift_inst + + cdef void set_field(__BinaryUnionStruct_FieldsSetter self, const char* name, object value) except *: + cdef __cstring_view cname = __cstring_view(name) + cdef cumap[__cstring_view, __BinaryUnionStruct_FieldsSetterFunc].iterator found = self._setters.find(cname) + if found == self._setters.end(): + raise TypeError(f"invalid field name {name.decode('utf-8')}") + deref(found).second(self, value) + + cdef void _set_field_0(self, _fbthrift_value) except *: + # for field u + if _fbthrift_value is None: + __reset_field[_module_cbindings.cBinaryUnionStruct](deref(self._struct_cpp_obj), 0) + return + if not isinstance(_fbthrift_value, _module_types.BinaryUnion): + raise TypeError(f'u is not a { _module_types.BinaryUnion !r}.') + deref(self._struct_cpp_obj).u_ref().assign(deref((<_module_types.BinaryUnion?> _fbthrift_value)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + + +@__cython.auto_pickle(False) +cdef class __CustomFields_FieldsSetter(__StructFieldsSetter): + + @staticmethod + cdef __CustomFields_FieldsSetter _fbthrift_create(_module_cbindings.cCustomFields* struct_cpp_obj): + cdef __CustomFields_FieldsSetter __fbthrift_inst = __CustomFields_FieldsSetter.__new__(__CustomFields_FieldsSetter) + __fbthrift_inst._struct_cpp_obj = struct_cpp_obj + __fbthrift_inst._setters[__cstring_view("bool_field")] = __CustomFields_FieldsSetter._set_field_0 + __fbthrift_inst._setters[__cstring_view("integer_field")] = __CustomFields_FieldsSetter._set_field_1 + __fbthrift_inst._setters[__cstring_view("double_field")] = __CustomFields_FieldsSetter._set_field_2 + __fbthrift_inst._setters[__cstring_view("string_field")] = __CustomFields_FieldsSetter._set_field_3 + __fbthrift_inst._setters[__cstring_view("binary_field")] = __CustomFields_FieldsSetter._set_field_4 + __fbthrift_inst._setters[__cstring_view("list_field")] = __CustomFields_FieldsSetter._set_field_5 + __fbthrift_inst._setters[__cstring_view("set_field")] = __CustomFields_FieldsSetter._set_field_6 + __fbthrift_inst._setters[__cstring_view("map_field")] = __CustomFields_FieldsSetter._set_field_7 + __fbthrift_inst._setters[__cstring_view("struct_field")] = __CustomFields_FieldsSetter._set_field_8 + return __fbthrift_inst + + cdef void set_field(__CustomFields_FieldsSetter self, const char* name, object value) except *: + cdef __cstring_view cname = __cstring_view(name) + cdef cumap[__cstring_view, __CustomFields_FieldsSetterFunc].iterator found = self._setters.find(cname) + if found == self._setters.end(): + raise TypeError(f"invalid field name {name.decode('utf-8')}") + deref(found).second(self, value) + + cdef void _set_field_0(self, _fbthrift_value) except *: + # for field bool_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomFields](deref(self._struct_cpp_obj), 0) + return + if not isinstance(_fbthrift_value, bool): + raise TypeError(f'bool_field is not a { bool !r}.') + deref(self._struct_cpp_obj).bool_field_ref().assign(_fbthrift_value) + + cdef void _set_field_1(self, _fbthrift_value) except *: + # for field integer_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomFields](deref(self._struct_cpp_obj), 1) + return + if not isinstance(_fbthrift_value, int): + raise TypeError(f'integer_field is not a { int !r}.') + _fbthrift_value = _fbthrift_value + deref(self._struct_cpp_obj).integer_field_ref().assign(_fbthrift_value) + + cdef void _set_field_2(self, _fbthrift_value) except *: + # for field double_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomFields](deref(self._struct_cpp_obj), 2) + return + if not isinstance(_fbthrift_value, (float, int)): + raise TypeError(f'double_field is not a { float !r}.') + deref(self._struct_cpp_obj).double_field_ref().assign(_fbthrift_value) + + cdef void _set_field_3(self, _fbthrift_value) except *: + # for field string_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomFields](deref(self._struct_cpp_obj), 3) + return + if not isinstance(_fbthrift_value, str): + raise TypeError(f'string_field is not a { str !r}.') + deref(self._struct_cpp_obj).string_field_ref().assign(cmove(bytes_to_string(_fbthrift_value.encode('utf-8')))) + + cdef void _set_field_4(self, _fbthrift_value) except *: + # for field binary_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomFields](deref(self._struct_cpp_obj), 4) + return + if not isinstance(_fbthrift_value, bytes): + raise TypeError(f'binary_field is not a { bytes !r}.') + deref(self._struct_cpp_obj).binary_field_ref().assign(_module_cbindings._MyType(cmove(_fbthrift_value))) + + cdef void _set_field_5(self, _fbthrift_value) except *: + # for field list_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomFields](deref(self._struct_cpp_obj), 5) + return + deref(self._struct_cpp_obj).list_field_ref().assign(_module_types._MyType__List__i32__make_instance(_fbthrift_value)) + + cdef void _set_field_6(self, _fbthrift_value) except *: + # for field set_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomFields](deref(self._struct_cpp_obj), 6) + return + deref(self._struct_cpp_obj).set_field_ref().assign(_module_types._MyType__Set__i32__make_instance(_fbthrift_value)) + + cdef void _set_field_7(self, _fbthrift_value) except *: + # for field map_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomFields](deref(self._struct_cpp_obj), 7) + return + deref(self._struct_cpp_obj).map_field_ref().assign(_module_types._MyType__Map__i32_i32__make_instance(_fbthrift_value)) + + cdef void _set_field_8(self, _fbthrift_value) except *: + # for field struct_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomFields](deref(self._struct_cpp_obj), 8) + return + if not isinstance(_fbthrift_value, _module_types.SimpleStruct): + raise TypeError(f'struct_field is not a { _module_types.SimpleStruct !r}.') + deref(self._struct_cpp_obj).struct_field_ref().assign(deref((<_module_types.SimpleStruct?> _fbthrift_value)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + + +@__cython.auto_pickle(False) +cdef class __CustomTypedefFields_FieldsSetter(__StructFieldsSetter): + + @staticmethod + cdef __CustomTypedefFields_FieldsSetter _fbthrift_create(_module_cbindings.cCustomTypedefFields* struct_cpp_obj): + cdef __CustomTypedefFields_FieldsSetter __fbthrift_inst = __CustomTypedefFields_FieldsSetter.__new__(__CustomTypedefFields_FieldsSetter) + __fbthrift_inst._struct_cpp_obj = struct_cpp_obj + __fbthrift_inst._setters[__cstring_view("bool_field")] = __CustomTypedefFields_FieldsSetter._set_field_0 + __fbthrift_inst._setters[__cstring_view("integer_field")] = __CustomTypedefFields_FieldsSetter._set_field_1 + __fbthrift_inst._setters[__cstring_view("double_field")] = __CustomTypedefFields_FieldsSetter._set_field_2 + __fbthrift_inst._setters[__cstring_view("string_field")] = __CustomTypedefFields_FieldsSetter._set_field_3 + __fbthrift_inst._setters[__cstring_view("binary_field")] = __CustomTypedefFields_FieldsSetter._set_field_4 + __fbthrift_inst._setters[__cstring_view("list_field")] = __CustomTypedefFields_FieldsSetter._set_field_5 + __fbthrift_inst._setters[__cstring_view("set_field")] = __CustomTypedefFields_FieldsSetter._set_field_6 + __fbthrift_inst._setters[__cstring_view("map_field")] = __CustomTypedefFields_FieldsSetter._set_field_7 + __fbthrift_inst._setters[__cstring_view("struct_field")] = __CustomTypedefFields_FieldsSetter._set_field_8 + return __fbthrift_inst + + cdef void set_field(__CustomTypedefFields_FieldsSetter self, const char* name, object value) except *: + cdef __cstring_view cname = __cstring_view(name) + cdef cumap[__cstring_view, __CustomTypedefFields_FieldsSetterFunc].iterator found = self._setters.find(cname) + if found == self._setters.end(): + raise TypeError(f"invalid field name {name.decode('utf-8')}") + deref(found).second(self, value) + + cdef void _set_field_0(self, _fbthrift_value) except *: + # for field bool_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomTypedefFields](deref(self._struct_cpp_obj), 0) + return + if not isinstance(_fbthrift_value, bool): + raise TypeError(f'bool_field is not a { bool !r}.') + deref(self._struct_cpp_obj).bool_field_ref().assign(_fbthrift_value) + + cdef void _set_field_1(self, _fbthrift_value) except *: + # for field integer_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomTypedefFields](deref(self._struct_cpp_obj), 1) + return + if not isinstance(_fbthrift_value, int): + raise TypeError(f'integer_field is not a { int !r}.') + _fbthrift_value = _fbthrift_value + deref(self._struct_cpp_obj).integer_field_ref().assign(_fbthrift_value) + + cdef void _set_field_2(self, _fbthrift_value) except *: + # for field double_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomTypedefFields](deref(self._struct_cpp_obj), 2) + return + if not isinstance(_fbthrift_value, (float, int)): + raise TypeError(f'double_field is not a { float !r}.') + deref(self._struct_cpp_obj).double_field_ref().assign(_fbthrift_value) + + cdef void _set_field_3(self, _fbthrift_value) except *: + # for field string_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomTypedefFields](deref(self._struct_cpp_obj), 3) + return + if not isinstance(_fbthrift_value, str): + raise TypeError(f'string_field is not a { str !r}.') + deref(self._struct_cpp_obj).string_field_ref().assign(cmove(bytes_to_string(_fbthrift_value.encode('utf-8')))) + + cdef void _set_field_4(self, _fbthrift_value) except *: + # for field binary_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomTypedefFields](deref(self._struct_cpp_obj), 4) + return + if not isinstance(_fbthrift_value, bytes): + raise TypeError(f'binary_field is not a { bytes !r}.') + deref(self._struct_cpp_obj).binary_field_ref().assign(_module_cbindings._MyType(cmove(_fbthrift_value))) + + cdef void _set_field_5(self, _fbthrift_value) except *: + # for field list_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomTypedefFields](deref(self._struct_cpp_obj), 5) + return + deref(self._struct_cpp_obj).list_field_ref().assign(_module_types._MyType__List__i32__make_instance(_fbthrift_value)) + + cdef void _set_field_6(self, _fbthrift_value) except *: + # for field set_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomTypedefFields](deref(self._struct_cpp_obj), 6) + return + deref(self._struct_cpp_obj).set_field_ref().assign(_module_types._MyType__Set__i32__make_instance(_fbthrift_value)) + + cdef void _set_field_7(self, _fbthrift_value) except *: + # for field map_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomTypedefFields](deref(self._struct_cpp_obj), 7) + return + deref(self._struct_cpp_obj).map_field_ref().assign(_module_types._MyType__Map__i32_i32__make_instance(_fbthrift_value)) + + cdef void _set_field_8(self, _fbthrift_value) except *: + # for field struct_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cCustomTypedefFields](deref(self._struct_cpp_obj), 8) + return + if not isinstance(_fbthrift_value, _module_types.SimpleStruct): + raise TypeError(f'struct_field is not a { _module_types.SimpleStruct !r}.') + deref(self._struct_cpp_obj).struct_field_ref().assign(deref((<_module_types.SimpleStruct?> _fbthrift_value)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + + +@__cython.auto_pickle(False) +cdef class __AdaptedTypedefFields_FieldsSetter(__StructFieldsSetter): + + @staticmethod + cdef __AdaptedTypedefFields_FieldsSetter _fbthrift_create(_module_cbindings.cAdaptedTypedefFields* struct_cpp_obj): + cdef __AdaptedTypedefFields_FieldsSetter __fbthrift_inst = __AdaptedTypedefFields_FieldsSetter.__new__(__AdaptedTypedefFields_FieldsSetter) + __fbthrift_inst._struct_cpp_obj = struct_cpp_obj + __fbthrift_inst._setters[__cstring_view("bool_field")] = __AdaptedTypedefFields_FieldsSetter._set_field_0 + __fbthrift_inst._setters[__cstring_view("integer_field")] = __AdaptedTypedefFields_FieldsSetter._set_field_1 + __fbthrift_inst._setters[__cstring_view("double_field")] = __AdaptedTypedefFields_FieldsSetter._set_field_2 + __fbthrift_inst._setters[__cstring_view("string_field")] = __AdaptedTypedefFields_FieldsSetter._set_field_3 + __fbthrift_inst._setters[__cstring_view("binary_field")] = __AdaptedTypedefFields_FieldsSetter._set_field_4 + __fbthrift_inst._setters[__cstring_view("list_field")] = __AdaptedTypedefFields_FieldsSetter._set_field_5 + __fbthrift_inst._setters[__cstring_view("set_field")] = __AdaptedTypedefFields_FieldsSetter._set_field_6 + __fbthrift_inst._setters[__cstring_view("map_field")] = __AdaptedTypedefFields_FieldsSetter._set_field_7 + __fbthrift_inst._setters[__cstring_view("struct_field")] = __AdaptedTypedefFields_FieldsSetter._set_field_8 + return __fbthrift_inst + + cdef void set_field(__AdaptedTypedefFields_FieldsSetter self, const char* name, object value) except *: + cdef __cstring_view cname = __cstring_view(name) + cdef cumap[__cstring_view, __AdaptedTypedefFields_FieldsSetterFunc].iterator found = self._setters.find(cname) + if found == self._setters.end(): + raise TypeError(f"invalid field name {name.decode('utf-8')}") + deref(found).second(self, value) + + cdef void _set_field_0(self, _fbthrift_value) except *: + # for field bool_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cAdaptedTypedefFields](deref(self._struct_cpp_obj), 0) + return + if not isinstance(_fbthrift_value, bool): + raise TypeError(f'bool_field is not a { bool !r}.') + deref(self._struct_cpp_obj).bool_field_ref().assign(_fbthrift_value) + + cdef void _set_field_1(self, _fbthrift_value) except *: + # for field integer_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cAdaptedTypedefFields](deref(self._struct_cpp_obj), 1) + return + if not isinstance(_fbthrift_value, int): + raise TypeError(f'integer_field is not a { int !r}.') + _fbthrift_value = _fbthrift_value + deref(self._struct_cpp_obj).integer_field_ref().assign(_fbthrift_value) + + cdef void _set_field_2(self, _fbthrift_value) except *: + # for field double_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cAdaptedTypedefFields](deref(self._struct_cpp_obj), 2) + return + if not isinstance(_fbthrift_value, (float, int)): + raise TypeError(f'double_field is not a { float !r}.') + deref(self._struct_cpp_obj).double_field_ref().assign(_fbthrift_value) + + cdef void _set_field_3(self, _fbthrift_value) except *: + # for field string_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cAdaptedTypedefFields](deref(self._struct_cpp_obj), 3) + return + if not isinstance(_fbthrift_value, str): + raise TypeError(f'string_field is not a { str !r}.') + deref(self._struct_cpp_obj).string_field_ref().assign(cmove(bytes_to_string(_fbthrift_value.encode('utf-8')))) + + cdef void _set_field_4(self, _fbthrift_value) except *: + # for field binary_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cAdaptedTypedefFields](deref(self._struct_cpp_obj), 4) + return + if not isinstance(_fbthrift_value, bytes): + raise TypeError(f'binary_field is not a { bytes !r}.') + deref(self._struct_cpp_obj).binary_field_ref().assign(_module_cbindings._py3_simple_AdaptedBinary(cmove(_fbthrift_value))) + + cdef void _set_field_5(self, _fbthrift_value) except *: + # for field list_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cAdaptedTypedefFields](deref(self._struct_cpp_obj), 5) + return + deref(self._struct_cpp_obj).list_field_ref().assign(_module_types._py3_simple_AdaptedList__List__i32__make_instance(_fbthrift_value)) + + cdef void _set_field_6(self, _fbthrift_value) except *: + # for field set_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cAdaptedTypedefFields](deref(self._struct_cpp_obj), 6) + return + deref(self._struct_cpp_obj).set_field_ref().assign(_module_types._py3_simple_AdaptedSet__Set__i32__make_instance(_fbthrift_value)) + + cdef void _set_field_7(self, _fbthrift_value) except *: + # for field map_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cAdaptedTypedefFields](deref(self._struct_cpp_obj), 7) + return + deref(self._struct_cpp_obj).map_field_ref().assign(_module_types._py3_simple_AdaptedMap__Map__i32_i32__make_instance(_fbthrift_value)) + + cdef void _set_field_8(self, _fbthrift_value) except *: + # for field struct_field + if _fbthrift_value is None: + __reset_field[_module_cbindings.cAdaptedTypedefFields](deref(self._struct_cpp_obj), 8) + return + if not isinstance(_fbthrift_value, _module_types.SimpleStruct): + raise TypeError(f'struct_field is not a { _module_types.SimpleStruct !r}.') + deref(self._struct_cpp_obj).struct_field_ref().assign(deref((<_module_types.SimpleStruct?> _fbthrift_value)._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE)) + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_impl_FBTHRIFT_ONLY_DO_NOT_USE.py b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_impl_FBTHRIFT_ONLY_DO_NOT_USE.py new file mode 100644 index 00000000000..7f73bff7346 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_impl_FBTHRIFT_ONLY_DO_NOT_USE.py @@ -0,0 +1,152 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + +import enum +import thrift.py3.types +import module.thrift_enums as _fbthrift_python_enums + +_fbthrift__module_name__ = "module.types" + + + +class AnEnum(thrift.py3.types.CompiledEnum): + NOTSET = 0 + ONE = 1 + TWO = 2 + THREE = 3 + FOUR = 4 + + __module__ = _fbthrift__module_name__ + __slots__ = () + + @staticmethod + def __get_metadata__(): + return _fbthrift_python_enums.gen_metadata_enum_AnEnum() + + @staticmethod + def __get_thrift_name__(): + return "module.AnEnum" + + def _to_python(self): + return _fbthrift_python_enums.AnEnum(self._fbthrift_value_) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + return self._fbthrift_value_ + + def __lt__(self, other): + if isinstance(other, AnEnum): + return self._fbthrift_value_ < other._fbthrift_value_ + + raise NotImplementedError( + "'<' only implemented for comparisons with AnEnum" + ) + + def __int__(self): + return self._fbthrift_value_ + + def __index__(self): + return self._fbthrift_value_ + + + + +class AnEnumRenamed(thrift.py3.types.CompiledEnum): + name_ = 0 + value_ = 1 + renamed_ = 2 + + __module__ = _fbthrift__module_name__ + __slots__ = () + + @staticmethod + def __get_metadata__(): + return _fbthrift_python_enums.gen_metadata_enum_AnEnumRenamed() + + @staticmethod + def __get_thrift_name__(): + return "module.AnEnumRenamed" + + def _to_python(self): + return _fbthrift_python_enums.AnEnumRenamed(self._fbthrift_value_) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + return self._fbthrift_value_ + + def __lt__(self, other): + if isinstance(other, AnEnumRenamed): + return self._fbthrift_value_ < other._fbthrift_value_ + + raise NotImplementedError( + "'<' only implemented for comparisons with AnEnumRenamed" + ) + + def __int__(self): + return self._fbthrift_value_ + + def __index__(self): + return self._fbthrift_value_ + + + + +class Flags(thrift.py3.types.Flag): + flag_A = 1 + flag_B = 2 + flag_C = 4 + flag_D = 8 + + __module__ = _fbthrift__module_name__ + __slots__ = () + + @staticmethod + def __get_metadata__(): + return _fbthrift_python_enums.gen_metadata_enum_Flags() + + @staticmethod + def __get_thrift_name__(): + return "module.Flags" + + def _to_python(self): + return _fbthrift_python_enums.Flags(self._fbthrift_value_) + + def _to_py3(self): + return self + + def _to_py_deprecated(self): + return self._fbthrift_value_ + + def __lt__(self, other): + if isinstance(other, Flags): + return self._fbthrift_value_ < other._fbthrift_value_ + + raise NotImplementedError( + "'<' only implemented for comparisons with Flags" + ) + + def __int__(self): + return self._fbthrift_value_ + + def __index__(self): + return self._fbthrift_value_ + + + + + +class __BinaryUnionType(enum.Enum): + iobuf_val = 1 + EMPTY = 0 + + __module__ = _fbthrift__module_name__ + __slots__ = () + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_reflection.py b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_reflection.py new file mode 100644 index 00000000000..ae820603047 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/module/types_reflection.py @@ -0,0 +1,938 @@ +# +# Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# @generated +# + + +import folly.iobuf as _fbthrift_iobuf + +from thrift.py3.reflection import ( + NumberType as __NumberType, + StructType as __StructType, + Qualifier as __Qualifier, + StructSpec as __StructSpec, + ListSpec as __ListSpec, + SetSpec as __SetSpec, + MapSpec as __MapSpec, + FieldSpec as __FieldSpec, +) + + +import module.types as _module_types + + + +def get_reflection__SimpleException() -> __StructSpec: + spec: __StructSpec = __StructSpec._fbthrift_create( + name="SimpleException", + kind=__StructType.EXCEPTION, + annotations={ + }, + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=1, + name="err_code", + py_name="err_code", + type=int, + kind=__NumberType.I16, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + return spec +def get_reflection__OptionalRefStruct() -> __StructSpec: + spec: __StructSpec = __StructSpec._fbthrift_create( + name="OptionalRefStruct", + kind=__StructType.STRUCT, + annotations={ + }, + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=1, + name="optional_blob", + py_name="optional_blob", + type=_fbthrift_iobuf.IOBuf, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.OPTIONAL, + default=None, + annotations={ + }, + ), + ) + return spec +def get_reflection__SimpleStruct() -> __StructSpec: + spec: __StructSpec = __StructSpec._fbthrift_create( + name="SimpleStruct", + kind=__StructType.STRUCT, + annotations={ + }, + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=1, + name="is_on", + py_name="is_on", + type=bool, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=2, + name="tiny_int", + py_name="tiny_int", + type=int, + kind=__NumberType.BYTE, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=3, + name="small_int", + py_name="small_int", + type=int, + kind=__NumberType.I16, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=4, + name="nice_sized_int", + py_name="nice_sized_int", + type=int, + kind=__NumberType.I32, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=5, + name="big_int", + py_name="big_int", + type=int, + kind=__NumberType.I64, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=6, + name="real", + py_name="real", + type=float, + kind=__NumberType.DOUBLE, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=7, + name="smaller_real", + py_name="smaller_real", + type=float, + kind=__NumberType.FLOAT, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=9, + name="something", + py_name="something", + type=_module_types._std_unordered_map__Map__i32_i32, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + return spec +def get_reflection__HiddenTypeFieldsStruct() -> __StructSpec: + spec: __StructSpec = __StructSpec._fbthrift_create( + name="HiddenTypeFieldsStruct", + kind=__StructType.STRUCT, + annotations={ + }, + ) + return spec +def get_reflection__ComplexStruct() -> __StructSpec: + spec: __StructSpec = __StructSpec._fbthrift_create( + name="ComplexStruct", + kind=__StructType.STRUCT, + annotations={ + }, + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=1, + name="structOne", + py_name="structOne", + type=_module_types.SimpleStruct, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=2, + name="structTwo", + py_name="structTwo", + type=_module_types.SimpleStruct, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=3, + name="an_integer", + py_name="an_integer", + type=int, + kind=__NumberType.I32, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=4, + name="name", + py_name="name", + type=str, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=5, + name="an_enum", + py_name="an_enum", + type=_module_types.AnEnum, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=6, + name="some_bytes", + py_name="some_bytes", + type=bytes, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=7, + name="from", + py_name="sender", + type=str, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=8, + name="cdef", + py_name="cdef_", + type=str, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=9, + name="bytes_with_cpp_type", + py_name="bytes_with_cpp_type", + type=bytes, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + return spec +def get_reflection__BinaryUnion() -> __StructSpec: + spec: __StructSpec = __StructSpec._fbthrift_create( + name="BinaryUnion", + kind=__StructType.UNION, + annotations={ + """cpp.noncomparable""": """1""", }, + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=1, + name="iobuf_val", + py_name="iobuf_val", + type=_fbthrift_iobuf.IOBuf, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + return spec +def get_reflection__BinaryUnionStruct() -> __StructSpec: + spec: __StructSpec = __StructSpec._fbthrift_create( + name="BinaryUnionStruct", + kind=__StructType.STRUCT, + annotations={ + """cpp.noncomparable""": """1""", }, + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=1, + name="u", + py_name="u", + type=_module_types.BinaryUnion, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + return spec +def get_reflection__CustomFields() -> __StructSpec: + spec: __StructSpec = __StructSpec._fbthrift_create( + name="CustomFields", + kind=__StructType.STRUCT, + annotations={ + }, + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=1, + name="bool_field", + py_name="bool_field", + type=bool, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=2, + name="integer_field", + py_name="integer_field", + type=int, + kind=__NumberType.I64, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=3, + name="double_field", + py_name="double_field", + type=float, + kind=__NumberType.DOUBLE, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=4, + name="string_field", + py_name="string_field", + type=str, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=5, + name="binary_field", + py_name="binary_field", + type=bytes, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=6, + name="list_field", + py_name="list_field", + type=_module_types._MyType__List__i32, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=7, + name="set_field", + py_name="set_field", + type=_module_types._MyType__Set__i32, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=8, + name="map_field", + py_name="map_field", + type=_module_types._MyType__Map__i32_i32, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=9, + name="struct_field", + py_name="struct_field", + type=_module_types.SimpleStruct, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + return spec +def get_reflection__CustomTypedefFields() -> __StructSpec: + spec: __StructSpec = __StructSpec._fbthrift_create( + name="CustomTypedefFields", + kind=__StructType.STRUCT, + annotations={ + }, + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=1, + name="bool_field", + py_name="bool_field", + type=bool, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=2, + name="integer_field", + py_name="integer_field", + type=int, + kind=__NumberType.I64, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=3, + name="double_field", + py_name="double_field", + type=float, + kind=__NumberType.DOUBLE, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=4, + name="string_field", + py_name="string_field", + type=str, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=5, + name="binary_field", + py_name="binary_field", + type=bytes, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=6, + name="list_field", + py_name="list_field", + type=_module_types._MyType__List__i32, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=7, + name="set_field", + py_name="set_field", + type=_module_types._MyType__Set__i32, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=8, + name="map_field", + py_name="map_field", + type=_module_types._MyType__Map__i32_i32, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=9, + name="struct_field", + py_name="struct_field", + type=_module_types.SimpleStruct, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + return spec +def get_reflection__AdaptedTypedefFields() -> __StructSpec: + spec: __StructSpec = __StructSpec._fbthrift_create( + name="AdaptedTypedefFields", + kind=__StructType.STRUCT, + annotations={ + }, + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=1, + name="bool_field", + py_name="bool_field", + type=bool, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=2, + name="integer_field", + py_name="integer_field", + type=int, + kind=__NumberType.I64, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=3, + name="double_field", + py_name="double_field", + type=float, + kind=__NumberType.DOUBLE, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=4, + name="string_field", + py_name="string_field", + type=str, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=5, + name="binary_field", + py_name="binary_field", + type=bytes, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=6, + name="list_field", + py_name="list_field", + type=_module_types._py3_simple_AdaptedList__List__i32, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=7, + name="set_field", + py_name="set_field", + type=_module_types._py3_simple_AdaptedSet__Set__i32, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=8, + name="map_field", + py_name="map_field", + type=_module_types._py3_simple_AdaptedMap__Map__i32_i32, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + spec.add_field( + __FieldSpec._fbthrift_create( + id=9, + name="struct_field", + py_name="struct_field", + type=_module_types.SimpleStruct, + kind=__NumberType.NOT_A_NUMBER, + qualifier=__Qualifier.UNQUALIFIED, + default=None, + annotations={ + }, + ), + ) + return spec +def get_reflection__List__i16() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=int, + kind=__NumberType.I16, + ) + +def get_reflection__List__i32() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=int, + kind=__NumberType.I32, + ) + +def get_reflection__List__i64() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=int, + kind=__NumberType.I64, + ) + +def get_reflection__List__string() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=str, + kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__List__SimpleStruct() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=_module_types.SimpleStruct, + kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__Set__i32() -> __SetSpec: + return __SetSpec._fbthrift_create( + value=int, + kind=__NumberType.I32, + ) + +def get_reflection__Set__string() -> __SetSpec: + return __SetSpec._fbthrift_create( + value=str, + kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__Map__string_string() -> __MapSpec: + return __MapSpec._fbthrift_create( + key=str, + key_kind=__NumberType.NOT_A_NUMBER, + value=str, + value_kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__Map__string_SimpleStruct() -> __MapSpec: + return __MapSpec._fbthrift_create( + key=str, + key_kind=__NumberType.NOT_A_NUMBER, + value=_module_types.SimpleStruct, + value_kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__Map__string_i16() -> __MapSpec: + return __MapSpec._fbthrift_create( + key=str, + key_kind=__NumberType.NOT_A_NUMBER, + value=int, + value_kind=__NumberType.I16, + ) + +def get_reflection__List__List__i32() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=_module_types.List__i32, + kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__Map__string_i32() -> __MapSpec: + return __MapSpec._fbthrift_create( + key=str, + key_kind=__NumberType.NOT_A_NUMBER, + value=int, + value_kind=__NumberType.I32, + ) + +def get_reflection__Map__string_Map__string_i32() -> __MapSpec: + return __MapSpec._fbthrift_create( + key=str, + key_kind=__NumberType.NOT_A_NUMBER, + value=_module_types.Map__string_i32, + value_kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__List__Set__string() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=_module_types.Set__string, + kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__Map__string_List__SimpleStruct() -> __MapSpec: + return __MapSpec._fbthrift_create( + key=str, + key_kind=__NumberType.NOT_A_NUMBER, + value=_module_types.List__SimpleStruct, + value_kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__List__List__string() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=_module_types.List__string, + kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__List__Set__i32() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=_module_types.Set__i32, + kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__List__Map__string_string() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=_module_types.Map__string_string, + kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__List__binary() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=bytes, + kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__Set__binary() -> __SetSpec: + return __SetSpec._fbthrift_create( + value=bytes, + kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__List__AnEnum() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=_module_types.AnEnum, + kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection___std_unordered_map__Map__i32_i32() -> __MapSpec: + return __MapSpec._fbthrift_create( + key=int, + key_kind=__NumberType.I32, + value=int, + value_kind=__NumberType.I32, + ) + +def get_reflection___MyType__List__i32() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=int, + kind=__NumberType.I32, + ) + +def get_reflection___MyType__Set__i32() -> __SetSpec: + return __SetSpec._fbthrift_create( + value=int, + kind=__NumberType.I32, + ) + +def get_reflection___MyType__Map__i32_i32() -> __MapSpec: + return __MapSpec._fbthrift_create( + key=int, + key_kind=__NumberType.I32, + value=int, + value_kind=__NumberType.I32, + ) + +def get_reflection___py3_simple_AdaptedList__List__i32() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=int, + kind=__NumberType.I32, + ) + +def get_reflection___py3_simple_AdaptedSet__Set__i32() -> __SetSpec: + return __SetSpec._fbthrift_create( + value=int, + kind=__NumberType.I32, + ) + +def get_reflection___py3_simple_AdaptedMap__Map__i32_i32() -> __MapSpec: + return __MapSpec._fbthrift_create( + key=int, + key_kind=__NumberType.I32, + value=int, + value_kind=__NumberType.I32, + ) + +def get_reflection__Map__i32_double() -> __MapSpec: + return __MapSpec._fbthrift_create( + key=int, + key_kind=__NumberType.I32, + value=float, + value_kind=__NumberType.DOUBLE, + ) + +def get_reflection__List__Map__i32_double() -> __ListSpec : + return __ListSpec._fbthrift_create( + value=_module_types.Map__i32_double, + kind=__NumberType.NOT_A_NUMBER, + ) + +def get_reflection__Map__AnEnumRenamed_i32() -> __MapSpec: + return __MapSpec._fbthrift_create( + key=_module_types.AnEnumRenamed, + key_kind=__NumberType.NOT_A_NUMBER, + value=int, + value_kind=__NumberType.I32, + ) + diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/python/metadata.cpp b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/python/metadata.cpp new file mode 100644 index 00000000000..0c391fb6b3e --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/python/metadata.cpp @@ -0,0 +1,29 @@ +/** + * Autogenerated by Thrift for thrift/annotation/python.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#include "thrift/compiler/test/fixtures/py3/gen-py3/python/metadata.h" + +namespace facebook { +namespace thrift { +namespace annotation { +namespace python { +::apache::thrift::metadata::ThriftMetadata python_getThriftModuleMetadata() { + ::apache::thrift::metadata::ThriftServiceMetadataResponse response; + ::apache::thrift::metadata::ThriftMetadata& metadata = *response.metadata_ref(); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + return metadata; +} +} // namespace facebook +} // namespace thrift +} // namespace annotation +} // namespace python diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/python/metadata.h b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/python/metadata.h new file mode 100644 index 00000000000..c039ac6102b --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/python/metadata.h @@ -0,0 +1,22 @@ +/** + * Autogenerated by Thrift for thrift/annotation/python.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#pragma once + +#include + +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/python_metadata.h" + +namespace facebook { +namespace thrift { +namespace annotation { +namespace python { +::apache::thrift::metadata::ThriftMetadata python_getThriftModuleMetadata(); +} // namespace facebook +} // namespace thrift +} // namespace annotation +} // namespace python diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/python/types.h b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/python/types.h new file mode 100644 index 00000000000..2f83bd25905 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/python/types.h @@ -0,0 +1,155 @@ +/** + * Autogenerated by Thrift for thrift/annotation/python.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#pragma once + +#include +#include + +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/python_data.h" +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/python_types.h" +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/python_metadata.h" +namespace thrift { +namespace py3 { + + + +template<> +inline void reset_field<::facebook::thrift::annotation::python::Py3Hidden>( + ::facebook::thrift::annotation::python::Py3Hidden& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::python::PyDeprecatedHidden>( + ::facebook::thrift::annotation::python::PyDeprecatedHidden& obj, uint16_t index) { + switch (index) { + case 0: + obj.reason_ref().copy_from(default_inst<::facebook::thrift::annotation::python::PyDeprecatedHidden>().reason_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::python::Flags>( + ::facebook::thrift::annotation::python::Flags& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::python::Name>( + ::facebook::thrift::annotation::python::Name& obj, uint16_t index) { + switch (index) { + case 0: + obj.name_ref().copy_from(default_inst<::facebook::thrift::annotation::python::Name>().name_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::python::Adapter>( + ::facebook::thrift::annotation::python::Adapter& obj, uint16_t index) { + switch (index) { + case 0: + obj.name_ref().copy_from(default_inst<::facebook::thrift::annotation::python::Adapter>().name_ref()); + return; + case 1: + obj.typeHint_ref().copy_from(default_inst<::facebook::thrift::annotation::python::Adapter>().typeHint_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::python::UseCAPI>( + ::facebook::thrift::annotation::python::UseCAPI& obj, uint16_t index) { + switch (index) { + case 0: + obj.serialize_ref().copy_from(default_inst<::facebook::thrift::annotation::python::UseCAPI>().serialize_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::python::Py3EnableCppAdapter>( + ::facebook::thrift::annotation::python::Py3EnableCppAdapter& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::python::Py3Hidden>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::python::PyDeprecatedHidden>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::python::Flags>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::python::Name>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::python::Adapter>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::python::UseCAPI>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::python::Py3EnableCppAdapter>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} +} // namespace py3 +} // namespace thrift diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/scope/metadata.cpp b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/scope/metadata.cpp new file mode 100644 index 00000000000..6810802bf6b --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/scope/metadata.cpp @@ -0,0 +1,37 @@ +/** + * Autogenerated by Thrift for thrift/annotation/scope.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#include "thrift/compiler/test/fixtures/py3/gen-py3/scope/metadata.h" + +namespace facebook { +namespace thrift { +namespace annotation { +::apache::thrift::metadata::ThriftMetadata scope_getThriftModuleMetadata() { + ::apache::thrift::metadata::ThriftServiceMetadataResponse response; + ::apache::thrift::metadata::ThriftMetadata& metadata = *response.metadata_ref(); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + return metadata; +} +} // namespace facebook +} // namespace thrift +} // namespace annotation diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/scope/metadata.h b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/scope/metadata.h new file mode 100644 index 00000000000..41d3352e83d --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/scope/metadata.h @@ -0,0 +1,20 @@ +/** + * Autogenerated by Thrift for thrift/annotation/scope.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#pragma once + +#include + +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/scope_metadata.h" + +namespace facebook { +namespace thrift { +namespace annotation { +::apache::thrift::metadata::ThriftMetadata scope_getThriftModuleMetadata(); +} // namespace facebook +} // namespace thrift +} // namespace annotation diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/scope/types.h b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/scope/types.h new file mode 100644 index 00000000000..38725fa7a5f --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/scope/types.h @@ -0,0 +1,310 @@ +/** + * Autogenerated by Thrift for thrift/annotation/scope.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#pragma once + +#include +#include + +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/scope_data.h" +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/scope_types.h" +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/scope_metadata.h" +namespace thrift { +namespace py3 { + + + +template<> +inline void reset_field<::facebook::thrift::annotation::Transitive>( + ::facebook::thrift::annotation::Transitive& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Program>( + ::facebook::thrift::annotation::Program& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Struct>( + ::facebook::thrift::annotation::Struct& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Union>( + ::facebook::thrift::annotation::Union& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Exception>( + ::facebook::thrift::annotation::Exception& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Field>( + ::facebook::thrift::annotation::Field& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Typedef>( + ::facebook::thrift::annotation::Typedef& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Service>( + ::facebook::thrift::annotation::Service& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Interaction>( + ::facebook::thrift::annotation::Interaction& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Function>( + ::facebook::thrift::annotation::Function& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::EnumValue>( + ::facebook::thrift::annotation::EnumValue& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Const>( + ::facebook::thrift::annotation::Const& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Structured>( + ::facebook::thrift::annotation::Structured& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Interface>( + ::facebook::thrift::annotation::Interface& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::RootDefinition>( + ::facebook::thrift::annotation::RootDefinition& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Definition>( + ::facebook::thrift::annotation::Definition& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::DisableSchemaConst>( + ::facebook::thrift::annotation::DisableSchemaConst& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Transitive>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Program>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Struct>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Union>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Exception>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Field>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Typedef>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Service>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Interaction>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Function>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::EnumValue>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Const>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Structured>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Interface>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::RootDefinition>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Definition>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::DisableSchemaConst>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} +} // namespace py3 +} // namespace thrift diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/thrift/metadata.cpp b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/thrift/metadata.cpp new file mode 100644 index 00000000000..521f984cb5a --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/thrift/metadata.cpp @@ -0,0 +1,37 @@ +/** + * Autogenerated by Thrift for thrift/annotation/thrift.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#include "thrift/compiler/test/fixtures/py3/gen-py3/thrift/metadata.h" + +namespace facebook { +namespace thrift { +namespace annotation { +::apache::thrift::metadata::ThriftMetadata thrift_getThriftModuleMetadata() { + ::apache::thrift::metadata::ThriftServiceMetadataResponse response; + ::apache::thrift::metadata::ThriftMetadata& metadata = *response.metadata_ref(); + ::apache::thrift::detail::md::EnumMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + ::apache::thrift::detail::md::StructMetadata::gen(metadata); + return metadata; +} +} // namespace facebook +} // namespace thrift +} // namespace annotation diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/thrift/metadata.h b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/thrift/metadata.h new file mode 100644 index 00000000000..1af172cf5c5 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/thrift/metadata.h @@ -0,0 +1,20 @@ +/** + * Autogenerated by Thrift for thrift/annotation/thrift.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#pragma once + +#include + +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/thrift_metadata.h" + +namespace facebook { +namespace thrift { +namespace annotation { +::apache::thrift::metadata::ThriftMetadata thrift_getThriftModuleMetadata(); +} // namespace facebook +} // namespace thrift +} // namespace annotation diff --git a/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/thrift/types.h b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/thrift/types.h new file mode 100644 index 00000000000..9f62b2b0e69 --- /dev/null +++ b/thrift/compiler/test/fixtures/py3/out/py3_legacy_container_converters/gen-py3/thrift/types.h @@ -0,0 +1,311 @@ +/** + * Autogenerated by Thrift for thrift/annotation/thrift.thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +#pragma once + +#include +#include + +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/thrift_data.h" +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/thrift_types.h" +#include "thrift/compiler/test/fixtures/py3/gen-cpp2/thrift_metadata.h" +namespace thrift { +namespace py3 { + + + +template<> +inline void reset_field<::facebook::thrift::annotation::Experimental>( + ::facebook::thrift::annotation::Experimental& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::ReserveIds>( + ::facebook::thrift::annotation::ReserveIds& obj, uint16_t index) { + switch (index) { + case 0: + obj.ids_ref().copy_from(default_inst<::facebook::thrift::annotation::ReserveIds>().ids_ref()); + return; + case 1: + obj.id_ranges_ref().copy_from(default_inst<::facebook::thrift::annotation::ReserveIds>().id_ranges_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::RequiresBackwardCompatibility>( + ::facebook::thrift::annotation::RequiresBackwardCompatibility& obj, uint16_t index) { + switch (index) { + case 0: + obj.field_name_ref().copy_from(default_inst<::facebook::thrift::annotation::RequiresBackwardCompatibility>().field_name_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::TerseWrite>( + ::facebook::thrift::annotation::TerseWrite& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Box>( + ::facebook::thrift::annotation::Box& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Mixin>( + ::facebook::thrift::annotation::Mixin& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::SerializeInFieldIdOrder>( + ::facebook::thrift::annotation::SerializeInFieldIdOrder& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::BitmaskEnum>( + ::facebook::thrift::annotation::BitmaskEnum& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::ExceptionMessage>( + ::facebook::thrift::annotation::ExceptionMessage& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::InternBox>( + ::facebook::thrift::annotation::InternBox& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Serial>( + ::facebook::thrift::annotation::Serial& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Uri>( + ::facebook::thrift::annotation::Uri& obj, uint16_t index) { + switch (index) { + case 0: + obj.value_ref().copy_from(default_inst<::facebook::thrift::annotation::Uri>().value_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::Priority>( + ::facebook::thrift::annotation::Priority& obj, uint16_t index) { + switch (index) { + case 0: + obj.level_ref().copy_from(default_inst<::facebook::thrift::annotation::Priority>().level_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::DeprecatedUnvalidatedAnnotations>( + ::facebook::thrift::annotation::DeprecatedUnvalidatedAnnotations& obj, uint16_t index) { + switch (index) { + case 0: + obj.items_ref().copy_from(default_inst<::facebook::thrift::annotation::DeprecatedUnvalidatedAnnotations>().items_ref()); + return; + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::AllowReservedIdentifier>( + ::facebook::thrift::annotation::AllowReservedIdentifier& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline void reset_field<::facebook::thrift::annotation::AllowReservedFilename>( + ::facebook::thrift::annotation::AllowReservedFilename& obj, uint16_t index) { + switch (index) { + } +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Experimental>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::ReserveIds>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::RequiresBackwardCompatibility>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::TerseWrite>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Box>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Mixin>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::SerializeInFieldIdOrder>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::BitmaskEnum>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::ExceptionMessage>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::InternBox>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Serial>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Uri>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::Priority>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::DeprecatedUnvalidatedAnnotations>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::AllowReservedIdentifier>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} + +template<> +inline const std::unordered_map& PyStructTraits< + ::facebook::thrift::annotation::AllowReservedFilename>::namesmap() { + static const folly::Indestructible map { + { + } + }; + return *map; +} +} // namespace py3 +} // namespace thrift diff --git a/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module0/converter.pyx b/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module0/converter.pyx index 755779d2c0e..f7a407a003f 100644 --- a/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module0/converter.pyx +++ b/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module0/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cStruct] Struct_convert_to_cpp(object inst) cdef object Struct_from_cpp(const shared_ptr[_fbthrift_cbindings.cStruct]& c_struct): return _fbthrift_ctypes.Struct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module1/converter.pyx b/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module1/converter.pyx index 94bbbbf1f79..d1df6b90206 100644 --- a/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module1/converter.pyx +++ b/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module1/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cStruct] Struct_convert_to_cpp(object inst) cdef object Struct_from_cpp(const shared_ptr[_fbthrift_cbindings.cStruct]& c_struct): return _fbthrift_ctypes.Struct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module2/converter.pyx b/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module2/converter.pyx index ad08723801c..a598e6f52d5 100644 --- a/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module2/converter.pyx +++ b/thrift/compiler/test/fixtures/qualified/out/py3/gen-py3/module2/converter.pyx @@ -21,3 +21,4 @@ cdef shared_ptr[_fbthrift_cbindings.cBigStruct] BigStruct_convert_to_cpp(object cdef object BigStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.cBigStruct]& c_struct): return _fbthrift_ctypes.BigStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/refs/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/refs/out/py3/gen-py3/module/converter.pyx index bdd438ab39f..e38a1192764 100644 --- a/thrift/compiler/test/fixtures/refs/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/refs/out/py3/gen-py3/module/converter.pyx @@ -129,3 +129,4 @@ cdef shared_ptr[_fbthrift_cbindings.cStructWithString] StructWithString_convert_ cdef object StructWithString_from_cpp(const shared_ptr[_fbthrift_cbindings.cStructWithString]& c_struct): return _fbthrift_ctypes.StructWithString._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/req-opt/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/req-opt/out/py3/gen-py3/module/converter.pyx index ff40c04e70b..f5bd77f35fc 100644 --- a/thrift/compiler/test/fixtures/req-opt/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/req-opt/out/py3/gen-py3/module/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return _fbthrift_ctypes.Foo._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/serialization_field_order/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/serialization_field_order/out/py3/gen-py3/module/converter.pyx index e83917c1b18..a4757a9f4b8 100644 --- a/thrift/compiler/test/fixtures/serialization_field_order/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/serialization_field_order/out/py3/gen-py3/module/converter.pyx @@ -21,3 +21,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo2] Foo2_convert_to_cpp(object inst) exce cdef object Foo2_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo2]& c_struct): return _fbthrift_ctypes.Foo2._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/single_file_service/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/single_file_service/out/py3/gen-py3/module/converter.pyx index 32b4f9d0999..55c53804d7b 100644 --- a/thrift/compiler/test/fixtures/single_file_service/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/single_file_service/out/py3/gen-py3/module/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return _fbthrift_ctypes.Foo._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/single_file_service/out/py3_module_structs/gen-py3/module_structs/converter.pyx b/thrift/compiler/test/fixtures/single_file_service/out/py3_module_structs/gen-py3/module_structs/converter.pyx index 8fb9de29222..b8dbd59635b 100644 --- a/thrift/compiler/test/fixtures/single_file_service/out/py3_module_structs/gen-py3/module_structs/converter.pyx +++ b/thrift/compiler/test/fixtures/single_file_service/out/py3_module_structs/gen-py3/module_structs/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFoo] Foo_convert_to_cpp(object inst) except cdef object Foo_from_cpp(const shared_ptr[_fbthrift_cbindings.cFoo]& c_struct): return _fbthrift_ctypes.Foo._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/sink/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/sink/out/py3/gen-py3/module/converter.pyx index 8e5c2f4d42b..cff049cbbc6 100644 --- a/thrift/compiler/test/fixtures/sink/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/sink/out/py3/gen-py3/module/converter.pyx @@ -51,3 +51,4 @@ cdef shared_ptr[_fbthrift_cbindings.cSinkException2] SinkException2_convert_to_c cdef object SinkException2_from_cpp(const shared_ptr[_fbthrift_cbindings.cSinkException2]& c_struct): return _fbthrift_ctypes.SinkException2._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/stream/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/stream/out/py3/gen-py3/module/converter.pyx index 247b79f6278..74511da267d 100644 --- a/thrift/compiler/test/fixtures/stream/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/stream/out/py3/gen-py3/module/converter.pyx @@ -27,3 +27,4 @@ cdef shared_ptr[_fbthrift_cbindings.cFooEx2] FooEx2_convert_to_cpp(object inst) cdef object FooEx2_from_cpp(const shared_ptr[_fbthrift_cbindings.cFooEx2]& c_struct): return _fbthrift_ctypes.FooEx2._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/templated-deserialize/out/py3/gen-py3/module/converter.pyx b/thrift/compiler/test/fixtures/templated-deserialize/out/py3/gen-py3/module/converter.pyx index bbd4e497e9b..b9b37341f98 100644 --- a/thrift/compiler/test/fixtures/templated-deserialize/out/py3/gen-py3/module/converter.pyx +++ b/thrift/compiler/test/fixtures/templated-deserialize/out/py3/gen-py3/module/converter.pyx @@ -21,3 +21,4 @@ cdef shared_ptr[_fbthrift_cbindings.ccontainerStruct] containerStruct_convert_to cdef object containerStruct_from_cpp(const shared_ptr[_fbthrift_cbindings.ccontainerStruct]& c_struct): return _fbthrift_ctypes.containerStruct._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/a/converter.pyx b/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/a/converter.pyx index 7102cda40d6..7ccd4c2c870 100644 --- a/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/a/converter.pyx +++ b/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/a/converter.pyx @@ -15,3 +15,4 @@ cdef shared_ptr[_fbthrift_cbindings.cA] A_convert_to_cpp(object inst) except*: cdef object A_from_cpp(const shared_ptr[_fbthrift_cbindings.cA]& c_struct): return _fbthrift_ctypes.A._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/b/converter.pyx b/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/b/converter.pyx index 0db8113ece6..bb187a639f7 100644 --- a/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/b/converter.pyx +++ b/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/b/converter.pyx @@ -9,3 +9,4 @@ cimport b.types as _fbthrift_ctypes + diff --git a/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/c/converter.pyx b/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/c/converter.pyx index ea8fc7a82ed..b968b409ff4 100644 --- a/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/c/converter.pyx +++ b/thrift/compiler/test/fixtures/transitive-deps/out/py3_a/gen-py3/c/converter.pyx @@ -21,3 +21,4 @@ cdef shared_ptr[_fbthrift_cbindings.cE] E_convert_to_cpp(object inst) except*: cdef object E_from_cpp(const shared_ptr[_fbthrift_cbindings.cE]& c_struct): return _fbthrift_ctypes.E._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/b/converter.pyx b/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/b/converter.pyx index 0db8113ece6..bb187a639f7 100644 --- a/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/b/converter.pyx +++ b/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/b/converter.pyx @@ -9,3 +9,4 @@ cimport b.types as _fbthrift_ctypes + diff --git a/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/c/converter.pyx b/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/c/converter.pyx index ea8fc7a82ed..b968b409ff4 100644 --- a/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/c/converter.pyx +++ b/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/c/converter.pyx @@ -21,3 +21,4 @@ cdef shared_ptr[_fbthrift_cbindings.cE] E_convert_to_cpp(object inst) except*: cdef object E_from_cpp(const shared_ptr[_fbthrift_cbindings.cE]& c_struct): return _fbthrift_ctypes.E._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) + diff --git a/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/s/converter.pyx b/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/s/converter.pyx index 73f062af8f7..47802bd58a0 100644 --- a/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/s/converter.pyx +++ b/thrift/compiler/test/fixtures/transitive-deps/out/py3_s/gen-py3/s/converter.pyx @@ -9,3 +9,4 @@ cimport s.types as _fbthrift_ctypes + diff --git a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/included/converter.pyx b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/included/converter.pyx index a994b0259f9..cfb440ff6ef 100644 --- a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/included/converter.pyx +++ b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/included/converter.pyx @@ -9,3 +9,4 @@ cimport apache.thrift.fixtures.types.included.types as _fbthrift_ctypes + diff --git a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/converter.pyx b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/converter.pyx index 8f412864f0c..44553434e62 100644 --- a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/converter.pyx +++ b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/converter.pyx @@ -207,3 +207,4 @@ cdef shared_ptr[_fbthrift_cbindings.cStructWithDoubleUnderscores] StructWithDoub cdef object StructWithDoubleUnderscores_from_cpp(const shared_ptr[_fbthrift_cbindings.cStructWithDoubleUnderscores]& c_struct): return _fbthrift_ctypes.StructWithDoubleUnderscores._create_FBTHRIFT_ONLY_DO_NOT_USE(c_struct) +