MCPcopy Create free account
hub / github.com/dask/dask / _partition

Function _partition

dask/array/routines.py:2313–2321  ·  view source on GitHub ↗

Given a total and a divisor, return two tuples: A tuple containing `divisor` repeated the number of times it divides `total`, and length-1 or empty tuple containing the remainder when `total` is divided by `divisor`. If `divisor` factors `total`, i.e. if the remainder is 0, then `remaind

(total: int, divisor: int)

Source from the content-addressed store, hash-verified

2311
2312
2313def _partition(total: int, divisor: int) -> tuple[tuple[int, ...], tuple[int, ...]]:
2314 """Given a total and a divisor, return two tuples: A tuple containing `divisor`
2315 repeated the number of times it divides `total`, and length-1 or empty tuple
2316 containing the remainder when `total` is divided by `divisor`. If `divisor` factors
2317 `total`, i.e. if the remainder is 0, then `remainder` is empty.
2318 """
2319 multiples = (divisor,) * (total // divisor)
2320 remainder = (total % divisor,) if total % divisor else ()
2321 return multiples, remainder
2322
2323
2324def aligned_coarsen_chunks(chunks: list[int], multiple: int) -> tuple[int, ...]:

Callers 1

aligned_coarsen_chunksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected