Parse repeated 'key:value' options into a dict. Coerce numeric and bool.
(opts_list)
| 80 | |
| 81 | |
| 82 | def _parse_options(opts_list): |
| 83 | """Parse repeated 'key:value' options into a dict. Coerce numeric and bool.""" |
| 84 | out = {} |
| 85 | for opt in opts_list or []: |
| 86 | if ":" not in opt: |
| 87 | continue |
| 88 | key, value = opt.split(":", 1) |
| 89 | key = key.strip() |
| 90 | value = value.strip() |
| 91 | if _is_int(value): |
| 92 | out[key] = int(value) |
| 93 | elif _is_float(value): |
| 94 | out[key] = float(value) |
| 95 | elif value.lower() in ("true", "false"): |
| 96 | out[key] = value.lower() == "true" |
| 97 | else: |
| 98 | out[key] = value |
| 99 | return out |
| 100 | |
| 101 | |
| 102 | def _generate_audio_sync(servicer, payload, dst_path): |