set `selected` attribute for `options`
(options, value)
| 329 | |
| 330 | |
| 331 | def _set_options_selected(options, value): |
| 332 | """set `selected` attribute for `options`""" |
| 333 | if not isinstance(value, (list, tuple)): |
| 334 | value = [value] |
| 335 | for opt in options: |
| 336 | if opt['value'] in value: |
| 337 | opt['selected'] = True |
| 338 | return options |
| 339 | |
| 340 | |
| 341 | def select(label: str = '', options: List[Union[Dict[str, Any], Tuple, List, str]] = None, *, multiple: bool = None, |