Handles ``[-A:-B]`` (both bounds negative). Out-of-order bounds (``start >= stop``, e.g. ``[-2:-5]``) clamp to empty; otherwise the slice is emulated by flipping the ORDER BY, offsetting ``|stop|`` rows from the end, and limiting to ``|start| - |stop|`` rows. Examples::
(start: int, stop: int)
| 288 | |
| 289 | |
| 290 | def _reverse_range(start: int, stop: int) -> SliceBounds: |
| 291 | """ |
| 292 | Handles ``[-A:-B]`` (both bounds negative). Out-of-order bounds |
| 293 | (``start >= stop``, e.g. ``[-2:-5]``) clamp to empty; otherwise the |
| 294 | slice is emulated by flipping the ORDER BY, offsetting ``|stop|`` rows |
| 295 | from the end, and limiting to ``|start| - |stop|`` rows. |
| 296 | |
| 297 | Examples:: |
| 298 | |
| 299 | [-5:-2] → SliceBounds(limit=3, offset=2, reverse=True) |
| 300 | [-3:-1] → SliceBounds(limit=2, offset=1, reverse=True) |
| 301 | [-2:-5] → SliceBounds(limit=0, offset=0, reverse=True) # empty |
| 302 | |
| 303 | :param start: negative lower bound |
| 304 | :type start: int |
| 305 | :param stop: negative upper bound |
| 306 | :type stop: int |
| 307 | :return: ``SliceBounds(..., reverse=True)`` |
| 308 | :rtype: SliceBounds |
| 309 | """ |
| 310 | if start >= stop: |
| 311 | return SliceBounds(limit=0, offset=0, reverse=True) |
| 312 | return SliceBounds(limit=stop - start, offset=-stop, reverse=True) |
| 313 | |
| 314 | |
| 315 | def translate_list_to_dict( # noqa: CCR001 |
no test coverage detected