Skip to content

Commit 73fd470

Browse files
committed
Also ignore props in docstring.
1 parent 69d134f commit 73fd470

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

dash/development/_py_components_generation.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,13 @@ def __init__(
107107
)
108108
wildcard_prefixes = repr(parse_wildcards(props))
109109
list_of_valid_keys = repr(list(map(str, filtered_props.keys())))
110+
custom_ignore = get_custom_ignore(custom_typing_module)
110111
docstring = create_docstring(
111112
component_name=typename,
112113
props=filtered_props,
113114
description=description,
114115
prop_reorder_exceptions=prop_reorder_exceptions,
116+
ignored_props=custom_ignore,
115117
).replace("\r\n", "\n")
116118
required_args = required_props(filtered_props)
117119
is_children_required = "children" in required_args
@@ -151,8 +153,6 @@ def __init__(
151153

152154
default_arglist = []
153155

154-
custom_ignore = get_custom_ignore(custom_typing_module)
155-
156156
for prop_key in prop_keys:
157157
prop = props[prop_key]
158158
if (
@@ -340,7 +340,13 @@ def required_props(props):
340340
return [prop_name for prop_name, prop in list(props.items()) if prop["required"]]
341341

342342

343-
def create_docstring(component_name, props, description, prop_reorder_exceptions=None):
343+
def create_docstring(
344+
component_name,
345+
props,
346+
description,
347+
prop_reorder_exceptions=None,
348+
ignored_props=tuple(),
349+
):
344350
"""Create the Dash component docstring.
345351
Parameters
346352
----------
@@ -377,7 +383,7 @@ def create_docstring(component_name, props, description, prop_reorder_exceptions
377383
indent_num=0,
378384
is_flow_type="flowType" in prop and "type" not in prop,
379385
)
380-
for p, prop in filter_props(props).items()
386+
for p, prop in filter_props(props, ignored_props).items()
381387
)
382388

383389
return (
@@ -442,7 +448,7 @@ def reorder_props(props):
442448
return OrderedDict(props1 + props2 + sorted(list(props.items())))
443449

444450

445-
def filter_props(props):
451+
def filter_props(props, ignored_props=tuple()):
446452
"""Filter props from the Component arguments to exclude:
447453
- Those without a "type" or a "flowType" field
448454
- Those with arg.type.name in {'func', 'symbol', 'instanceOf'}
@@ -487,7 +493,7 @@ def filter_props(props):
487493
filtered_props = copy.deepcopy(props)
488494

489495
for arg_name, arg in list(filtered_props.items()):
490-
if "type" not in arg and "flowType" not in arg:
496+
if arg_name in ignored_props or ("type" not in arg and "flowType" not in arg):
491497
filtered_props.pop(arg_name)
492498
continue
493499

0 commit comments

Comments
 (0)