(iterable: Iterable[T], key: Callable[[T], bool])
| 246 | |
| 247 | |
| 248 | def split_iterable(iterable: Iterable[T], key: Callable[[T], bool]) -> Tuple[List[T], List[T]]: |
| 249 | left, right = [], [] |
| 250 | for item in iterable: |
| 251 | if key(item): |
| 252 | left.append(item) |
| 253 | else: |
| 254 | right.append(item) |
| 255 | return left, right |
| 256 | |
| 257 | |
| 258 | def unwrap_context(exc: Exception) -> Optional[Exception]: |