Create the Dash component prop docstring Parameters ---------- prop_name: str Name of the Dash component prop type_object: dict react-docgen-generated prop type dictionary required: bool Component is required? description: str Dash compone
(
prop_name,
type_object,
required,
description,
indent_num,
)
| 282 | |
| 283 | |
| 284 | def create_prop_docstring_jl( |
| 285 | prop_name, |
| 286 | type_object, |
| 287 | required, |
| 288 | description, |
| 289 | indent_num, |
| 290 | ): |
| 291 | """ |
| 292 | Create the Dash component prop docstring |
| 293 | Parameters |
| 294 | ---------- |
| 295 | prop_name: str |
| 296 | Name of the Dash component prop |
| 297 | type_object: dict |
| 298 | react-docgen-generated prop type dictionary |
| 299 | required: bool |
| 300 | Component is required? |
| 301 | description: str |
| 302 | Dash component description |
| 303 | indent_num: int |
| 304 | Number of indents to use for the context block |
| 305 | (creates 2 spaces for every indent) |
| 306 | is_flow_type: bool |
| 307 | Does the prop use Flow types? Otherwise, uses PropTypes |
| 308 | Returns |
| 309 | ------- |
| 310 | str |
| 311 | Dash component prop docstring |
| 312 | """ |
| 313 | jl_type_name = get_jl_type(type_object=type_object) |
| 314 | |
| 315 | indent_spacing = " " * indent_num |
| 316 | if "\n" in jl_type_name: |
| 317 | return ( |
| 318 | "{indent_spacing}- `{name}` ({is_required}): {description}. " |
| 319 | "{name} has the following type: {type}".format( |
| 320 | indent_spacing=indent_spacing, |
| 321 | name=prop_name, |
| 322 | type=jl_type_name, |
| 323 | description=description, |
| 324 | is_required="required" if required else "optional", |
| 325 | ) |
| 326 | ) |
| 327 | return "{indent_spacing}- `{name}` ({type}{is_required}){description}".format( |
| 328 | indent_spacing=indent_spacing, |
| 329 | name=prop_name, |
| 330 | type="{}; ".format(jl_type_name) if jl_type_name else "", |
| 331 | description=(": {}".format(description) if description != "" else ""), |
| 332 | is_required="required" if required else "optional", |
| 333 | ) |
| 334 | |
| 335 | |
| 336 | # this logic will permit passing blank Julia prefixes to |
no test coverage detected
searching dependent graphs…