Split the elements in a tuple/interval, while handling well-formatted commas in large numbers
(expr: str)
| 219 | |
| 220 | |
| 221 | def split_tuple(expr: str): |
| 222 | """ |
| 223 | Split the elements in a tuple/interval, while handling well-formatted commas in large numbers |
| 224 | """ |
| 225 | expr = _strip_properly_formatted_commas(expr) |
| 226 | if len(expr) == 0: |
| 227 | return [] |
| 228 | if ( |
| 229 | len(expr) > 2 |
| 230 | and expr[0] in TUPLE_CHARS |
| 231 | and expr[-1] in TUPLE_CHARS |
| 232 | and all([ch not in expr[1:-1] for ch in TUPLE_CHARS]) |
| 233 | ): |
| 234 | elems = [elem.strip() for elem in expr[1:-1].split(",")] |
| 235 | else: |
| 236 | elems = [expr] |
| 237 | return elems |
| 238 | |
| 239 | |
| 240 | def grade_answer(given_answer: str, ground_truth: str) -> bool: |
no test coverage detected