(raw_value: Any)
| 69 | |
| 70 | |
| 71 | def parse_string_list(raw_value: Any) -> List[str]: |
| 72 | if raw_value in (None, "", []): |
| 73 | return [] |
| 74 | if isinstance(raw_value, list): |
| 75 | values: List[str] = [] |
| 76 | for item in raw_value: |
| 77 | values.extend(parse_string_list(item)) |
| 78 | return [item for item in values if item] |
| 79 | if isinstance(raw_value, dict): |
| 80 | values = [] |
| 81 | for key, value in raw_value.items(): |
| 82 | values.append(str(key)) |
| 83 | values.extend(parse_string_list(value)) |
| 84 | return [item.strip() for item in values if item.strip()] |
| 85 | if isinstance(raw_value, str): |
| 86 | try: |
| 87 | parsed = json.loads(raw_value) |
| 88 | except json.JSONDecodeError: |
| 89 | parsed = None |
| 90 | if isinstance(parsed, (list, dict)): |
| 91 | return parse_string_list(parsed) |
| 92 | return [item.strip() for item in re.split(r"[,;|\n]+", raw_value) if item.strip()] |
| 93 | return [str(raw_value).strip()] if str(raw_value).strip() else [] |
| 94 | |
| 95 | |
| 96 | def seed_direction_phrases(raw_value: Any) -> List[str]: |
no outgoing calls
no test coverage detected