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

Function generate_shape

dash/development/_py_prop_typing.py:55–76  ·  view source on GitHub ↗
(type_info, component_name: str, prop_name: str)

Source from the content-addressed store, hash-verified

53
54
55def generate_shape(type_info, component_name: str, prop_name: str):
56 props = []
57 name = pascal_case(prop_name)
58
59 for prop_key, prop_type in type_info["value"].items():
60 typed = get_prop_typing(
61 prop_type["name"], component_name, f"{prop_name}_{prop_key}", prop_type
62 )
63 if not prop_type.get("required"):
64 props.append(f' "{prop_key}": NotRequired[{typed}]')
65 else:
66 props.append(f' "{prop_key}": {typed}')
67
68 shapes.setdefault(component_name, {})
69 shapes[component_name][name] = textwrap.indent(
70 shape_template.format(
71 name=name, values=" {\n" + ",\n".join(props) + "\n }"
72 ),
73 " ",
74 )
75
76 return f'"{name}"'
77
78
79def generate_union(type_info, component_name: str, prop_name: str):

Callers

nothing calls this directly

Calls 5

pascal_caseFunction · 0.85
get_prop_typingFunction · 0.85
getMethod · 0.45
appendMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…