Skip to content
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

Using custom_attributes of Source and Sink classes fails #1059

Closed
richartkeil opened this issue Mar 1, 2024 · 1 comment · Fixed by #1060
Closed

Using custom_attributes of Source and Sink classes fails #1059

richartkeil opened this issue Mar 1, 2024 · 1 comment · Fixed by #1060

Comments

@richartkeil
Copy link
Contributor

Currently, using custom_attributes of Source and Sink classes will lead to an exception. A similar issue was addressed in #1032, but the fix did not cover these classes. #929 Seems also to be related to this.

If there isn't more to it, I'll create a PR for a fix.

Reproduction

Setup fresh venv, run only pip install oemof-solph to get the following dependencies:

blinker==1.7.0
dill==0.3.8
networkx==3.2.1
numpy==1.26.4
oemof.network==0.5.0
oemof.solph==0.5.2
oemof.tools==0.4.3
pandas==2.2.1
ply==3.11
Pyomo==6.7.1
python-dateutil==2.9.0
pytz==2024.1
six==1.16.0
tzdata==2024.1

Run the following script:

from oemof.solph import components

components.Source(custom_attributes={"foo": "bar"})
components.Sink(custom_attributes={"foo": "bar"})

Get the exception:

Traceback (most recent call last):
  File "/Users/richartkeil/.../bug.py", line 3, in <module>
    components.Sink(custom_attributes={"foo": "bar"})
  File "/Users/richartkeil/.../.venv/lib/python3.12/site-packages/oemof/solph/components/_sink.py", line 66, in __init__
    super().__init__(label=label, inputs=inputs, **custom_attributes)
TypeError: Node.__init__() got an unexpected keyword argument 'foo'

(same for _source.py)

@p-snft
Copy link
Member

p-snft commented Mar 6, 2024

Thanks for implementing this. (To be explicit for the others: The custom_attributes of nodes were never doing anything.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants