(name, props, description, project_shortname, prefix)
| 444 | |
| 445 | |
| 446 | def generate_class_string(name, props, description, project_shortname, prefix): |
| 447 | # Ensure props are ordered with children first |
| 448 | filtered_props = reorder_props(filter_props(props)) |
| 449 | |
| 450 | prop_keys = list(filtered_props.keys()) |
| 451 | |
| 452 | docstring = ( |
| 453 | create_docstring_jl( |
| 454 | component_name=name, props=filtered_props, description=description |
| 455 | ) |
| 456 | .replace("\r\n", "\n") |
| 457 | .replace("$", "\\$") |
| 458 | ) |
| 459 | |
| 460 | wclist = get_wildcards_jl(props) |
| 461 | default_paramtext = "" |
| 462 | |
| 463 | # Filter props to remove those we don't want to expose |
| 464 | for item in prop_keys[:]: |
| 465 | if item.endswith("-*") or item == "setProps": |
| 466 | prop_keys.remove(item) |
| 467 | elif item in julia_keywords: |
| 468 | prop_keys.remove(item) |
| 469 | warnings.warn( |
| 470 | ( |
| 471 | 'WARNING: prop "{}" in component "{}" is a Julia keyword' |
| 472 | " - REMOVED FROM THE JULIA COMPONENT" |
| 473 | ).format(item, name), |
| 474 | stacklevel=2, |
| 475 | ) |
| 476 | |
| 477 | default_paramtext += ", ".join(":{}".format(p) for p in prop_keys) |
| 478 | |
| 479 | has_children = "children" in prop_keys |
| 480 | funcname = format_fn_name(prefix, name) |
| 481 | children_signatures = ( |
| 482 | jl_children_signatures.format(funcname=funcname) if has_children else "" |
| 483 | ) |
| 484 | children_definitions = ( |
| 485 | jl_children_definitions.format(funcname=funcname) if has_children else "" |
| 486 | ) |
| 487 | return jl_component_string.format( |
| 488 | funcname=format_fn_name(prefix, name), |
| 489 | docstring=docstring, |
| 490 | component_props=default_paramtext, |
| 491 | wildcard_symbols=stringify_wildcards(wclist, no_symbol=False), |
| 492 | wildcard_names=stringify_wildcards(wclist, no_symbol=True), |
| 493 | element_name=name, |
| 494 | module_name=project_shortname, |
| 495 | children_signatures=children_signatures, |
| 496 | children_definitions=children_definitions, |
| 497 | ) |
| 498 | |
| 499 | |
| 500 | def generate_struct_file(name, props, description, project_shortname, prefix): |
no test coverage detected
searching dependent graphs…