BREAKING CHANGE: User generated python function names will change.
Previously we would call symforce.python_util.camelcase_to_snakecase
on the name of a Codegen object to use as the name of the generated
function. Meanwhile, we would use the name of the Codegen object,
unmodified, as the name of the python file (unless the
generated_file_name argument is provided to
Codegen.generate_function, in which case we use that).
Unfortunately, in a number of places (like in numeric_factor.py and
factor.py) we assume that the name of the generated function matches
the name of the generated file it lives in. (Resulting in things
breaking if the name of the Codegen object is not already in
snake_case).
An example of this is Factor.generate.
To address this, in this commit I change the jinja template to use the
Codegen.name as the generated function name. This way, in the default
case, the generated function will match the file name. It also has the
benefit of offering the user more flexibility to set the name of their
generated functions.
Note, if Codegen.with_linearization is used, _factor is appended to
all names (so you might end up with a residual whose name and file is
CamelCase_factor).
BREAKING CHANGE: User generated python function names will change.
Previously we would call
symforce.python_util.camelcase_to_snakecase
on the name of aCodegen
object to use as the name of the generated function. Meanwhile, we would use the name of theCodegen
object, unmodified, as the name of the python file (unless thegenerated_file_name
argument is provided toCodegen.generate_function
, in which case we use that).Unfortunately, in a number of places (like in
numeric_factor.py
andfactor.py
) we assume that the name of the generated function matches the name of the generated file it lives in. (Resulting in things breaking if the name of theCodegen
object is not already in snake_case).An example of this is
Factor.generate
.To address this, in this commit I change the jinja template to use the
Codegen.name
as the generated function name. This way, in the default case, the generated function will match the file name. It also has the benefit of offering the user more flexibility to set the name of their generated functions.Note, if
Codegen.with_linearization
is used,_factor
is appended to all names (so you might end up with a residual whose name and file isCamelCase_factor
).Fixes: #299
Topic: issue_299