-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revision/explicit network kwargs #1032
Conversation
The changes also reveals some undiscovered bugs (mostly ignored parameters). This commit does not address these. So, it is expected that tests fail.
These labels were just ignored. With explicit kwargs, they cause errors.
At least in the latest versions, the keyword was just ignored. With explicitly named arguments only, it causes errors.
This parameter was unused and will cause errors with explicit keyword arguments.
The warnings need the network.Node to be initialised already.
To access e.g. .label, warn_ helpers need oemof.network.Entity to be initialised first.
When using the branch aimed to be merged in oemof/oemof-network#40, I locally observe an issues I do not understand, yet:
I do not see why this should be an error. |
The label seems to be set to allow calling workaround before Node is initialised.
ElectricalLine seems to be added to the EnergySystem as if it was a Node. This, however, is no longer possible as Flows do not have 'inputs'.
This is because the |
646fb82
to
f8131da
Compare
Coverage decreases because experimental |
@@ -117,8 +113,12 @@ def __init__( | |||
label=label, | |||
inputs=inputs, | |||
outputs=outputs, | |||
**custom_attributes, | |||
custom_properties=custom_attributes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Python, an attribute is a fixed term referring to a variable defined by the class in the scope of an object. The implementation that some though we had (but never had) in network added attributes
my_node = Node("name", some_feature= 5) # API was never implemented
my_node.some_feature # "some_feature" is an attribute, API was never implemented
# 5
However, the API now is
my_node = Node("name", custom_properties={"some_feature": 5})
my_node.custom_properties["some_feature"] # "some feature" is not an attribute
# 5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well custom_properties
is an attribute though 😆
Adapt to explicitly named arguments in oemof.network. Will need to be merged before the next release of network due to oemof/oemof-network#40.