Repository: plotly/dash
File: dash/development/_py_components_generation.py (Python)

Code before:
                raise TypeError(
                    'Required argument `' + k + '` was not specified.')
        args_without_children = {{k: _locals[k] for k in _explicit_args if k != 'children'}}
        super({typename}, self).__init__({argtext})
'''

    filtered_props = (
        filter_props(props)
        if (prop_reorder_exceptions is not None and typename in prop_reorder_exceptions)
        or (prop_reorder_exceptions is not None and "ALL" in prop_reorder_exceptions)
        else reorder_props(filter_props(props))
    )
    wildcard_prefixes = repr(parse_wildcards(props))
    list_of_valid_keys = repr(list(map(str, filtered_props.keys())))
    docstring = create_docstring(
        component_name=typename,
        props=filtered_props,
        description=description,
        prop_reorder_exceptions=prop_reorder_exceptions,
    ).replace("\r\n", "\n")

    prohibit_events(props)

    # pylint: disable=unused-variable
    prop_keys = list(props.keys())
    if "children" in props:
        prop_keys.remove("children")
        default_argtext = "children=None, "
        argtext = "children=children, **args_without_children"
    else:
        default_argtext = ""
        argtext = "**args_without_children"
    default_arglist = [
        (
            f"{p:s}=Component.REQUIRED"
            if props[p]["required"]
            else f"{p:s}=Component.UNDEFINED"
        )
        for p in prop_keys
        if not p.endswith("-*") and p not in python_keywords and p != "setProps"
    ]

    if max_props:
        final_max_props = max_props - (1 if "children" in props else 0)
        if len(default_arglist) > final_max_props:
            default_arglist = default_arglist[:final_max_props]
            docstring += (
                "\n\n"
                "Note: due to the large number of props for this component,\n"
                "not all of them appear in the constructor signature, but\n"
                "they may still be used as keyword arguments."

Review comment (suggestion):
I think it would be better to change it like this.
It can be solved this problem(https://github.com/plotly/dash/issues/1348).

Rather than checking whether `children` exists in the properties that have already been passed, it seems appropriate to check and separate parameter from `_props_names` that expresses the properties to be passed.

```suggestion
    if "children" in props and "children" in list_of_valid_keys:
```

Code after:
'''

    filtered_props = (
        filter_props(props)
        if (prop_reorder_exceptions is not None and typename in prop_reorder_exceptions)
        or (prop_reorder_exceptions is not None and "ALL" in prop_reorder_exceptions)
        else reorder_props(filter_props(props))
    )
    wildcard_prefixes = repr(parse_wildcards(props))
    list_of_valid_keys = repr(list(map(str, filtered_props.keys())))
    docstring = create_docstring(
        component_name=typename,
        props=filtered_props,
        description=description,
        prop_reorder_exceptions=prop_reorder_exceptions,
    ).replace("\r\n", "\n")
    required_args = required_props(filtered_props)
    is_children_required = 'children' in required_args
    required_args = [arg for arg in required_args if arg != "children"]

    prohibit_events(props)

    # pylint: disable=unused-variable
    prop_keys = list(props.keys())
    if "children" in props and "children" in list_of_valid_keys:
        prop_keys.remove("children")
        default_argtext = "children=None, "
        args = "{k: _locals[k] for k in _explicit_args if k != 'children'}"
        argtext = "children=children, **args"
    else:
        default_argtext = ""
        args = "{k: _locals[k] for k in _explicit_args}"
        argtext = "**args"

    if len(required_args) == 0:
        required_validation = ""
    else:
        required_validation = f"""
        for k in {required_args}:
            if k not in args:
                raise TypeError(
                    'Required argument `' + k + '` was not specified.')
        """

    if is_children_required:
        required_validation += """
        if 'children' not in _explicit_args:
            raise TypeError('Required argument children was not specified.')
        """

    default_arglist = [