Validate input and return a Partitioning(Factory). It passes None through if no partitioning scheme is defined.
(scheme)
| 275 | |
| 276 | |
| 277 | def _ensure_partitioning(scheme): |
| 278 | """ |
| 279 | Validate input and return a Partitioning(Factory). |
| 280 | |
| 281 | It passes None through if no partitioning scheme is defined. |
| 282 | """ |
| 283 | if scheme is None: |
| 284 | pass |
| 285 | elif isinstance(scheme, str): |
| 286 | scheme = partitioning(flavor=scheme) |
| 287 | elif isinstance(scheme, list): |
| 288 | scheme = partitioning(field_names=scheme) |
| 289 | elif isinstance(scheme, (Partitioning, PartitioningFactory)): |
| 290 | pass |
| 291 | else: |
| 292 | raise ValueError( |
| 293 | f"Expected Partitioning or PartitioningFactory, got {type(scheme)}") |
| 294 | return scheme |
| 295 | |
| 296 | |
| 297 | def _ensure_format(obj): |
no test coverage detected