MCPcopy Create free account
hub / github.com/apache/fory / parse_csv_list

Function parse_csv_list

benchmarks/python/benchmark.py:879–889  ·  view source on GitHub ↗
(value: str, allowed: Iterable[str], default: List[str])

Source from the content-addressed store, hash-verified

877
878
879def parse_csv_list(value: str, allowed: Iterable[str], default: List[str]) -> List[str]:
880 if value == "all":
881 return list(default)
882 selected = [item.strip().lower() for item in value.split(",") if item.strip()]
883 invalid = [item for item in selected if item not in allowed]
884 if invalid:
885 raise ValueError(
886 f"Invalid values: {', '.join(invalid)}. Allowed: {', '.join(sorted(allowed))}"
887 )
888 ordered = [item for item in default if item in selected]
889 return ordered
890
891
892def benchmark_number(base_number: int, datatype: str) -> int:

Callers 1

mainFunction · 0.85

Calls 1

listFunction · 0.50

Tested by

no test coverage detected