Parses text to a list of strings if possible; strips quotes and whitespace.
(text: str)
| 30 | |
| 31 | |
| 32 | def parse_to_list(text: str) -> Optional[List[str]]: |
| 33 | """ |
| 34 | Parses text to a list of strings if possible; strips quotes and whitespace. |
| 35 | """ |
| 36 | if not isinstance(text, str): |
| 37 | return None |
| 38 | try: |
| 39 | parsed = ast.literal_eval(text) |
| 40 | except Exception: |
| 41 | return None |
| 42 | if isinstance(parsed, list): |
| 43 | return [str(x).strip(" '") for x in parsed] |
| 44 | return None |
| 45 | |
| 46 | |
| 47 | def to_float(text: str) -> Optional[float]: |
no outgoing calls
no test coverage detected