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

Function create_docstring

dash/development/_py_components_generation.py:360–408  ·  view source on GitHub ↗

Create the Dash component docstring. Parameters ---------- component_name: str Component name props: dict Dictionary with {propName: propMetadata} structure description: str Component description Returns ------- str Dash component docst

(
    component_name,
    props,
    description,
    prop_reorder_exceptions=None,
    ignored_props=tuple(),
)

Source from the content-addressed store, hash-verified

358
359
360def create_docstring(
361 component_name,
362 props,
363 description,
364 prop_reorder_exceptions=None,
365 ignored_props=tuple(),
366):
367 """Create the Dash component docstring.
368 Parameters
369 ----------
370 component_name: str
371 Component name
372 props: dict
373 Dictionary with {propName: propMetadata} structure
374 description: str
375 Component description
376 Returns
377 -------
378 str
379 Dash component docstring
380 """
381 # Ensure props are ordered with children first
382 props = (
383 props
384 if (
385 prop_reorder_exceptions is not None
386 and component_name in prop_reorder_exceptions
387 )
388 or (prop_reorder_exceptions is not None and "ALL" in prop_reorder_exceptions)
389 else reorder_props(props)
390 )
391
392 n = "n" if component_name[0].lower() in "aeiou" else ""
393 args = "\n".join(
394 create_prop_docstring(
395 prop_name=p,
396 type_object=prop["type"] if "type" in prop else prop["flowType"],
397 required=prop["required"],
398 description=prop["description"],
399 default=prop.get("defaultValue"),
400 indent_num=0,
401 is_flow_type="flowType" in prop and "type" not in prop,
402 )
403 for p, prop in filter_props(props, ignored_props).items()
404 )
405
406 return (
407 f"A{n} {component_name} component.\n{description}\n\nKeyword arguments:\n{args}"
408 )
409
410
411def prohibit_events(props):

Callers 3

test_docstringFunction · 0.90
test_docstringFunction · 0.90
generate_class_stringFunction · 0.85

Calls 4

reorder_propsFunction · 0.85
create_prop_docstringFunction · 0.85
filter_propsFunction · 0.70
getMethod · 0.45

Tested by 2

test_docstringFunction · 0.72
test_docstringFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…