func
Module to work with retrieving arguments functions
FuncDefaultParser
Bases: SourceParser
Builds the parser to extract default arguments from a function signature
This is the lowest-ranked parser.
Parameters:
-
label(str) –The debugging label to indicate an argument was set at the CLI.
-
rank(int) –The priority of the parser. Generally, we aim between [0,100] for human-readabilty.
Source code in src/argmerge/func.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
__call__
__call__(threshold_kwargs, change_ledger, f, debug=False)
Lowest level parser - retrieve function defaults as fallback arguments.
Parameters:
-
threshold_kwargs(dict[str, Any]) –kwargs passed around the @threshold decorator.
-
change_ledger(dict[str, dict[str, str | int]]) –Tracks when kwargs are updated inside the @threshold decorator.
-
f(Callable) –The function we wrap.
-
debug(bool, default:False) –Flag to turn on more logging. Defaults to False.
Returns:
-
tuple[dict, dict]–tuple[dict, dict]: an updated
threshold_kwargsandchange_ledger.
Source code in src/argmerge/func.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
FuncUpdater
Bases: SourceParser
Builds the parser to extract default arguments from a function signature
This is the highest-ranked parser.
Parameters:
-
label(str) –The debugging label to indicate an argument was set at Runtime by the developer.
-
rank(int) –The priority of the parser. Generally, we aim between [0,100] for human-readabilty.
Source code in src/argmerge/func.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
__call__
__call__(threshold_kwargs, change_ledger, func_kwargs, debug=False)
Update the external values with the function's runtime arguments.
Parameters:
-
threshold_kwargs(dict[str, Any]) –kwargs passed around the @threshold decorator.
-
change_ledger(dict[str, dict[str, str | int]]) –Tracks when kwargs are updated inside the @threshold decorator.
-
func_kwargs(dict[str, Any]) –The Runtime kwargs of the function.
-
debug(bool, default:False) –Flag to turn on more logging. Defaults to False.
Returns:
-
Returns(dict) – -
dict–tuple[dict, dict]: an updated
threshold_kwargsandchange_ledger.
Source code in src/argmerge/func.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |