Open
Description
If using multiple inheritance than the **kwargs need to be generated independent from eSuperTypes
{%- macro generate_class_init_args(c) -%}
{% if c.eStructuralFeatures | list %}, *, {% endif -%}
{{ c.eStructuralFeatures | map(attribute='name') | map('re_sub', '$', '=None') | join(', ') }}
{%- if c.eSuperTypes %}, **kwargs{% endif %}
{%- endmacro %}
{%- macro generate_super_init_args(c, user_module=False) -%}
{%- if user_module and c.eStructuralFeatures -%}
{{ c.eStructuralFeatures | map(attribute='name') | map('re_sub', '(.+)', '\g<0>= \g<0>') | join(', ') }}
{%- endif %}
{%- if c.eSuperTypes %}{{', ' if user_module and c.eStructuralFeatures else ''}}**kwargs{% endif %}
{%- endmacro %}
Following use case:
class A
aattr1
aattr2
class B
battr1
battr2
class C(A,B)
C(aattr1=1, battr1=2)
A.__init__
looks like this def __init__(self, *, aattr1=None, aattr2=None)
This lead to the problem that A.__init__
is called with a keyword argument (battr1) which is not known by the init function.
BR
Andreas
Metadata
Metadata
Assignees
Labels
No labels