Naming convention for defining the union creator function
const auto enum_fn = namer_.Function(enum_def);
code += "\n";
code += "def " + enum_fn + "Creator(unionType, table):";
https://github.com/google/flatbuffers/blob/master/src/idl_gen_python.cpp#L2594
Differs to the naming convention for calling it
auto union_type = namer_.Type(enum_def);
if (parser_.opts.include_dependence_headers) {
union_type = namer_.NamespacedType(enum_def) + "." + union_type;
}
code += GenIndents(2) + "self." + field_field + " = " + union_type +
"Creator(" + "self." + field_field + "Type, " + struct_var + "." +
field_method + "())";
}
https://github.com/google/flatbuffers/blob/master/src/idl_gen_python.cpp#L2029
I solved this locally by changing:
auto union_type = namer_.Type(enum_def);
to:
auto union_type = namer_.Function(enum_def);
I have not accounted for
if (parser_.opts.include_dependence_headers) {
union_type = namer_.NamespacedType(enum_def) + "." + union_type;
}
This may need an additional method
std::string NamespacedFunction(const Definition& def) const {
return NamespacedString(def.defined_namespace, Function(def.name));
}
but i have not tested this the name namespace functionality