MCPcopy Index your code
hub / github.com/plotly/dash / reorder_props

Function reorder_props

dash/development/_py_components_generation.py:447–465  ·  view source on GitHub ↗

If "children" is in props, then move it to the front to respect dash convention, then 'id', then the remaining props sorted by prop name Parameters ---------- props: dict Dictionary with {propName: propMetadata} structure Returns ------- dict Dictionary wi

(props)

Source from the content-addressed store, hash-verified

445
446
447def reorder_props(props):
448 """If "children" is in props, then move it to the front to respect dash
449 convention, then 'id', then the remaining props sorted by prop name
450 Parameters
451 ----------
452 props: dict
453 Dictionary with {propName: propMetadata} structure
454 Returns
455 -------
456 dict
457 Dictionary with {propName: propMetadata} structure
458 """
459
460 # Constructing an OrderedDict with duplicate keys, you get the order
461 # from the first one but the value from the last.
462 # Doing this to avoid mutating props, which can cause confusion.
463 props1 = [("children", "")] if "children" in props else []
464 props2 = [("id", "")] if "id" in props else []
465 return OrderedDict(props1 + props2 + sorted(list(props.items())))
466
467
468def filter_props(props, ignored_props=tuple()):

Callers 7

generate_class_stringFunction · 0.85
create_docstringFunction · 0.85
create_docstring_jlFunction · 0.85
generate_class_stringFunction · 0.85
generate_struct_fileFunction · 0.85
generate_class_stringFunction · 0.85
write_class_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…