mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-07 22:03:40 +00:00
[Python] Fix various codegen problems (#8292)
* [Python] Fix various codegen problems. This includes: - escaping keywords happens **after** converting the case: - currently, `table ClassT` generate `class = Class()` which is invalid Python; - imports in `one_file` mode use the filename rather than the type name when resolving module names; - use `filename_suffix` instead of the hardcoded `_generated` one; - generate empty files if no structs or enums are available. This makes the set of output files more predictable for Bazel. * [Python] Fix various codegen problems. This includes: - escaping keywords happens **after** converting the case: - currently, `table ClassT` generate `class = Class()` which is invalid Python; - imports in `one_file` mode use the filename rather than the type name when resolving module names; - use `filename_suffix` instead of the hardcoded `_generated` one; - generate empty files if no structs or enums are available. This makes the set of output files more predictable for Bazel.
This commit is contained in:
@@ -24,9 +24,9 @@ runtime_library_dir=${test_dir}/../python
|
||||
# Emit Python code for the example schema in the test dir:
|
||||
${test_dir}/../flatc -p -o ${gen_code_path} -I include_test monster_test.fbs --gen-object-api
|
||||
${test_dir}/../flatc -p -o ${gen_code_path} -I include_test monster_test.fbs --gen-object-api --gen-onefile
|
||||
${test_dir}/../flatc -p -o ${gen_code_path} -I include_test monster_extra.fbs --gen-object-api
|
||||
${test_dir}/../flatc -p -o ${gen_code_path} -I include_test arrays_test.fbs --gen-object-api
|
||||
${test_dir}/../flatc -p -o ${gen_code_path} -I include_test nested_union_test.fbs --gen-object-api
|
||||
${test_dir}/../flatc -p -o ${gen_code_path} -I include_test monster_extra.fbs --gen-object-api --python-typing --gen-compare
|
||||
${test_dir}/../flatc -p -o ${gen_code_path} -I include_test arrays_test.fbs --gen-object-api --python-typing
|
||||
${test_dir}/../flatc -p -o ${gen_code_path} -I include_test nested_union_test.fbs --gen-object-api --python-typing
|
||||
|
||||
# Syntax: run_tests <interpreter> <benchmark vtable dedupes>
|
||||
# <benchmark read count> <benchmark build count>
|
||||
|
||||
Reference in New Issue
Block a user