MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / decode_slice

Function decode_slice

lib/sqlalchemy/util/langhelpers.py:219–230  ·  view source on GitHub ↗

decode a slice object as sent to __getitem__. takes into account the 2.5 __index__() method, basically.

(slc: slice)

Source from the content-addressed store, hash-verified

217
218
219def decode_slice(slc: slice) -> Tuple[Any, ...]:
220 """decode a slice object as sent to __getitem__.
221
222 takes into account the 2.5 __index__() method, basically.
223
224 """
225 ret: List[Any] = []
226 for x in slc.start, slc.stop, slc.step:
227 if hasattr(x, "__index__"):
228 x = x.__index__()
229 ret.append(x)
230 return tuple(ret)
231
232
233def _unique_symbols(used: Sequence[str], *bases: str) -> Iterator[str]:

Callers

nothing calls this directly

Calls 2

__index__Method · 0.80
appendMethod · 0.45

Tested by

no test coverage detected