(
params: Optional[_CoreAnyExecuteParams],
)
| 69 | |
| 70 | |
| 71 | def _distill_params_20( |
| 72 | params: Optional[_CoreAnyExecuteParams], |
| 73 | ) -> _CoreMultiExecuteParams: |
| 74 | if params is None: |
| 75 | return _Empty_Tuple |
| 76 | # Assume list is more likely than tuple |
| 77 | elif isinstance(params, list) or isinstance(params, tuple): |
| 78 | # collections_abc.MutableSequence # avoid abc.__instancecheck__ |
| 79 | if len(params) == 0: |
| 80 | warn_deprecated( |
| 81 | "Empty parameter sequence passed to execute(). " |
| 82 | "This use is deprecated and will raise an exception in a " |
| 83 | "future SQLAlchemy release", |
| 84 | "2.1", |
| 85 | ) |
| 86 | elif not _is_mapping(params[0]): |
| 87 | raise exc.ArgumentError( |
| 88 | "List argument must consist only of dictionaries" |
| 89 | ) |
| 90 | return params |
| 91 | elif _is_mapping(params): |
| 92 | return [params] # type: ignore[list-item] |
| 93 | else: |
| 94 | raise exc.ArgumentError("mapping or list expected for parameters") |
| 95 | |
| 96 | |
| 97 | # _is_mapping_or_tuple could be inlined if pure python perf is a problem |
no test coverage detected