Description
There is a positional argument misalignment in the Variable class. Initializing a Variable with a string (e.g., Variable("x")) causes the string to be assigned to input_variables instead of key.
Because strings are iterable, make_graph iterates over the characters, treating them as constants and creating an anonymous node. This leads to:
_is_input being False, making the variable unable to fetch data from a dictionary.
- key being assigned a random object ID (e.g., '140...) instead of the intended string.
Example of unexpected behavior
from neuromancer.constraint import Variable
# User intends to create an input variable with key "x"
v = Variable("x")
print(f"Is input: {v._is_input}") # Returns False, expected True
print(f"Key: {v.key}") # Returns random ID, expected "x"
Description
There is a positional argument misalignment in the Variable class. Initializing a Variable with a string (e.g.,
Variable("x")) causes the string to be assigned toinput_variablesinstead of key.Because strings are iterable, make_graph iterates over the characters, treating them as constants and creating an anonymous node. This leads to:
_is_inputbeing False, making the variable unable to fetch data from a dictionary.Example of unexpected behavior