mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 04:21:13 +00:00
Fix python type annotation output when not enabled (#7983)
Fixes #7971 Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
@@ -815,8 +815,12 @@ class PythonGenerator : public BaseGenerator {
|
||||
|
||||
if (!parser_.opts.one_file && !parser_.opts.python_no_type_prefix_suffix) {
|
||||
// Generate method without struct name.
|
||||
code += "def Start" + field_method +
|
||||
"Vector(builder, numElems: int) -> int:\n";
|
||||
if (parser_.opts.python_typing) {
|
||||
code += "def Start" + field_method +
|
||||
"Vector(builder, numElems: int) -> int:\n";
|
||||
} else {
|
||||
code += "def Start" + field_method + "Vector(builder, numElems):\n";
|
||||
}
|
||||
code += Indent + "return " + struct_type + "Start";
|
||||
code += field_method + "Vector(builder, numElems)\n\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user