(
params: Optional[_DBAPIAnyExecuteParams],
)
| 96 | |
| 97 | # _is_mapping_or_tuple could be inlined if pure python perf is a problem |
| 98 | def _distill_raw_params( |
| 99 | params: Optional[_DBAPIAnyExecuteParams], |
| 100 | ) -> _DBAPIMultiExecuteParams: |
| 101 | if params is None: |
| 102 | return _Empty_Tuple |
| 103 | elif isinstance(params, list): |
| 104 | # collections_abc.MutableSequence # avoid abc.__instancecheck__ |
| 105 | if len(params) > 0 and not _is_mapping_or_tuple(params[0]): |
| 106 | raise exc.ArgumentError( |
| 107 | "List argument must consist only of tuples or dictionaries" |
| 108 | ) |
| 109 | return params |
| 110 | elif _is_mapping_or_tuple(params): |
| 111 | return [params] # type: ignore[return-value] |
| 112 | else: |
| 113 | raise exc.ArgumentError("mapping or sequence expected for parameters") |
| 114 | |
| 115 | |
| 116 | @cython.cfunc |
no test coverage detected