diff options
author | inaryart <51652878+inaryart@users.noreply.github.com> | 2022-10-29 08:37:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-29 00:37:27 +0000 |
commit | 15f32c69075d06658228580b92b147b3432ecbb7 (patch) | |
tree | b501d7caf4506a8f7d49eb8cd0b658fab037a404 /src | |
parent | 051afd8825e4adff7dbedac02f961d95a3914fef (diff) | |
download | flatbuffers-15f32c69075d06658228580b92b147b3432ecbb7.tar.gz flatbuffers-15f32c69075d06658228580b92b147b3432ecbb7.tar.bz2 flatbuffers-15f32c69075d06658228580b92b147b3432ecbb7.zip |
python: object generation prefix and suffix (#7565)
Co-authored-by: Derek Bailey <derekbailey@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/idl_gen_python.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/idl_gen_python.cpp b/src/idl_gen_python.cpp index 52fc6e5a..38a5bc10 100644 --- a/src/idl_gen_python.cpp +++ b/src/idl_gen_python.cpp @@ -1160,8 +1160,8 @@ class PythonGenerator : public BaseGenerator { code += field_type + "()"; } code += ") is not None:"; - code += GenIndents(3) + "self." + field_field + " = " + field_type + - "T.InitFromObj(" + struct_var + "." + field_method + "("; + code += GenIndents(3) + "self." + field_field + " = " + namer_.ObjectType(field_type) + + + ".InitFromObj(" + struct_var + "." + field_method + "("; // A struct's accessor requires a struct buf instance. if (struct_def.fixed && field.value.type.base_type == BASE_TYPE_STRUCT) { code += field_type + "()"; @@ -1211,8 +1211,8 @@ class PythonGenerator : public BaseGenerator { "(i) is None:"; code += GenIndents(5) + "self." + field_field + ".append(None)"; code += GenIndents(4) + "else:"; - code += GenIndents(5) + one_instance + " = " + field_type + - "T.InitFromObj(" + struct_var + "." + field_method + "(i))"; + code += GenIndents(5) + one_instance + " = " + namer_.ObjectType(field_type) + + ".InitFromObj(" + struct_var + "." + field_method + "(i))"; code += GenIndents(5) + "self." + field_field + ".append(" + one_instance + ")"; } @@ -1242,8 +1242,8 @@ class PythonGenerator : public BaseGenerator { "(i) is None:"; code += GenIndents(5) + "self." + field_field + ".append(None)"; code += GenIndents(4) + "else:"; - code += GenIndents(5) + one_instance + " = " + field_type + - "T.InitFromObj(" + struct_var + "." + field_method + "(i))"; + code += GenIndents(5) + one_instance + " = " + namer_.ObjectType(field_type) + + ".InitFromObj(" + struct_var + "." + field_method + "(i))"; code += GenIndents(5) + "self." + field_field + ".append(" + one_instance + ")"; } |