MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / _parse_args

Function _parse_args

pywebio/input.py:110–134  ·  view source on GitHub ↗

parse the raw parameters that pass to input functions - excludes: the parameters that don't appear in returned spec - remove the parameters whose value is None :return:(spec,valid_func)

(kwargs, excludes=())

Source from the content-addressed store, hash-verified

108
109
110def _parse_args(kwargs, excludes=()):
111 """parse the raw parameters that pass to input functions
112
113 - excludes: the parameters that don't appear in returned spec
114 - remove the parameters whose value is None
115
116 :return:(spec,valid_func)
117 """
118 kwargs = {k: v for k, v in kwargs.items() if v is not None and k not in excludes}
119 check_dom_name_value(kwargs.get('name', ''), '`name`')
120
121 kwargs.update(kwargs.get('other_html_attrs', {}))
122 kwargs.pop('other_html_attrs', None)
123
124 if kwargs.get('validate'):
125 kwargs['onblur'] = True
126 valid_func = kwargs.pop('validate', lambda _: None)
127
128 if kwargs.get('onchange'):
129 onchange_func = kwargs['onchange']
130 kwargs['onchange'] = True
131 else:
132 onchange_func = lambda _: None
133
134 return kwargs, valid_func, onchange_func
135
136
137def input(label: str = '', type: str = TEXT, *, validate: Callable[[Any], Optional[str]] = None, name: str = None,

Callers 8

inputFunction · 0.85
textareaFunction · 0.85
selectFunction · 0.85
checkboxFunction · 0.85
radioFunction · 0.85
actionsFunction · 0.85
file_uploadFunction · 0.85
sliderFunction · 0.85

Calls 2

check_dom_name_valueFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…