-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return parameter values from the
orderly.parameters
call.
Previously we would inject parameter values as global variables before the script starts executing. While this follows the behaviour of orderly2, it confuses a lot of Python tooling, including linters and type checkers. It also did not support executing orderly scripts outside of a packet context (eg. interactively). The `orderly.parameters` function now returns the parameter values as a dictionary, which we can get from the global context. When running outside of a packet context, it returns the parameters' default values.
- Loading branch information
Showing
8 changed files
with
73 additions
and
34 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
import orderly | ||
|
||
# TODO(mrc-5255): We'll rethink this strategy soon | ||
# ruff: noqa: F821 | ||
|
||
orderly.parameters(a=1, b=None) | ||
parameters = orderly.parameters(a=1, b=None) | ||
with open("result.txt", "w") as f: | ||
f.write(f"a: {a}\nb: {b}\n") # type: ignore | ||
f.write(f"a: {parameters['a']}\nb: {parameters['b']}\n") |
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