Hello everyone! I wanted to know if there are prop...
# questions
u
Hello everyone! I wanted to know if there are proper ways of doing two things 1. Pass an input to a node, defined directly in the same python file. I have four nodes that have the exact same code inside, just changing the inputs and outputs, and generating a image with the analysis. I would like to pass a title for each generated image, and it would be cool passing as an input like "My awesome title". What I am doing currently is wrapping the function with four functions almost identical, receiving all the parameters and adding the title as input for the wrapped function, but I lose the functionality of seeing the code on Kedro viz.
Copy code
def xgboost_monotonic_reporting_(
    X_train,
    y_train,
    y_train_pred,
    X_test,
    y_test,
    y_test_pred,
    min_energy_cumsum_eval,
    max_energy_cumsum_eval,
):
    return xgboost_monotonic_reporting(
        "XGBoost Monotonic",
        X_train,
        y_train,
        y_train_pred,
        X_test,
        y_test,
        y_test_pred,
        min_energy_cumsum_eval,
        max_energy_cumsum_eval,
    )
2. How can I check the validity of my parameters? I have some parameters that must be 'value1' or 'value2' and otherwise rise an error, but i am not sure of where to insert this check Thanks for your help!
d
Can you use the stdlib
enum
for this? https://docs.python.org/3/library/enum.html
K 1
or maybe pydantic?
K 1
u
well the questions was more about where to insert this checks
d
I would do the checks as decorators to your python functions pandera style or in the parameter types themselves pydatic / enum style?
K 1
u
I will try that thanks!