-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add codegen_util.load_generated_function
Defines the new function load_generated_function which is meant to be a more user friendly version of `load_generated_package` (which will be particularly more friendly should we no longer re-export all sub-modules of generated packages). Also, explains the arguments of `load_generated_package` in its doc-string. As an example of the expected usage of this function, for `co` a `Codegen` object: ``` python3 generated_paths = co.generate_function() func = load_generated_function(co.name, generated_paths.function_dir) ``` Tested in `test/symforce_codegen_util_test.py`
- Loading branch information
1 parent
443997a
commit 7f74579
Showing
4 changed files
with
83 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
test/test_data/codegen_util_test_data/example_pkg_1/example_pkg/func.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# ---------------------------------------------------------------------------- | ||
# SymForce - Copyright 2022, Skydio, Inc. | ||
# This source code is under the Apache 2.0 license found in the LICENSE file. | ||
# ---------------------------------------------------------------------------- | ||
|
||
|
||
def func() -> int: | ||
return 1 |
8 changes: 8 additions & 0 deletions
8
test/test_data/codegen_util_test_data/example_pkg_2/example_pkg/func.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# ---------------------------------------------------------------------------- | ||
# SymForce - Copyright 2022, Skydio, Inc. | ||
# This source code is under the Apache 2.0 license found in the LICENSE file. | ||
# ---------------------------------------------------------------------------- | ||
|
||
|
||
def func() -> int: | ||
return 2 |