-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Forbid usage of *args
and **kwargs
in any node's __init__
#2362
Conversation
After a better inspection of the code, I realized that in fact we can't handle Given that This will mean modifying:
In the docstore cases, it will be enough to copy-paste the parent signature down to the subclasses. |
* Remove kwargs from ESDocStore subclasses * Remove kwargs from subclasses of SQLDocumentStore * Remove kwargs from Weaviate * Revert change in pinecone * Fix tests * Fix retriever test wirh weaviate * Change Exception into DocumentStoreError
* Remove FARMReader kwargs without trying to replace them functionally * Update Documentation & Code Style * enforce same index values before and after saving/loading eval dataframes (#2398) * Add tests for missing `__init__` and `super().__init__()` in custom nodes (#2350) * Add tests for missing init and super * Update Documentation & Code Style * change in with endswith * Move test in pipeline.py and change test in pipeline_yaml.py * Update Documentation & Code Style * Use caplog to test the warning * Update Documentation & Code Style * move tests into test_pipeline and use get_config * Update Documentation & Code Style * Unmock version name
**kwargs
*args
and **kwargs
in any node's __init__
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.
LGTM! To make the failing code-and-docs-check
pass, I think you need to apply black manually to haystack/nodes/_json_schema.py
and test/test_pipeline_yaml.py
.
It sometimes fails when it checks too early. Given that the Code Style action passed, I think it's safe to merge. Thanks! 👍 |
Problem:
**kwargs
.**kwargs
in its__init__
to transmit any unknown parameter to its superclass__init__
, the validation for that node is going to fail and the nade cannot be instantiated, as in many cases the content of**kwargs
is critical for the superclass.Solution
**kwargs
in the signature and, if detected, merge the superclass' schema with the subclass'.@TuanaCelik