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

Detect _param_names from __init__ signature #867

Merged
merged 2 commits into from
Mar 31, 2022

Conversation

lebrice
Copy link
Collaborator

@lebrice lebrice commented Mar 29, 2022

Fixes #860 (just the __init__ part)

Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
# super().__init__(self, **kwargs), then what should the _arg_names be? Should we just raise a
# warning in that case? Or just assume that the algo will create its own configuration dict?
# (could also raise a warning only inside the `configuration` property, in the case where we
# can't fetch the value of the kwargs argument)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Algo configuration is expected to be compliant with algorithm's constructor signature, so that we can build an algorithm with AlgoClass(space, **configuration). I think we could safely ignore any of kwargs and rely on the signature.

Also, setting the attributes by passing them to super() is always very confusing to new contributiors. I would be in favor of deprecating this and force algos to set their attributes themselves using self.attr = attr.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so you're ok with these changes then? (I'll remove the comment)

Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
@bouthilx bouthilx added the enhancement Improves a feature or non-functional aspects (e.g., optimization, prettify, technical debt) label Mar 31, 2022
@lebrice lebrice merged commit 7e49dc3 into Epistimio:develop Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves a feature or non-functional aspects (e.g., optimization, prettify, technical debt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposition: Rework how configuration is saved through BaseAlgorithm.__init__
2 participants