Skip to content

Fix bug with algo param_names#947

Merged
lebrice merged 1 commit intodevelopfrom
lebrice/fix-algo-param-names-py37
Jun 10, 2022
Merged

Fix bug with algo param_names#947
lebrice merged 1 commit intodevelopfrom
lebrice/fix-algo-param-names-py37

Conversation

@lebrice
Copy link
Copy Markdown
Collaborator

@lebrice lebrice commented Jun 9, 2022

Fixes a bug when inferring the param names (configuration keys) for algorithms that inherit from typing.Generic, in python 3.7.

In python 3.7, the Generic class has a metaclass (GenericMeta or something similar), and inspect.signature(type(self)) would give
the signature of the metaclass's __call__ method, instead of the signature of the init of the class.

Also fixed a bug whereby it would include "self" and "args" from *args into the param names.
This wasn't causing issues because we check if self has an attribute with the given name before including it in the configuration.

Signed-off-by: Fabrice Normandin fabrice.normandin@gmail.com

In python 3.7, the Generic class has a metaclass (GenericMeta or
something similar), and inspect.signature(type(self)) would give
the signature of the metaclass's `__call__` method, instead of
the signature of the __init__ of the class.

Also fixed a bug whereby it would include "self" and "args" from
*args into the param names.
This wasn't causing issues because we check if `self` has an
attribute with the given name before including it in the
configuration.

Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
@lebrice lebrice changed the title Fix bug with algo param_names (see desc.) Fix bug with algo param_names Jun 9, 2022
@lebrice lebrice merged commit 0f8ee86 into develop Jun 10, 2022
@notoraptor notoraptor mentioned this pull request Aug 2, 2022
@bouthilx bouthilx added the bug Indicates an unexpected problem or unintended behavior label Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Indicates an unexpected problem or unintended behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants