MCPcopy Create free account
hub / github.com/ActiveState/code / expand_array

Function expand_array

recipes/Python/578062_Markov/recipe-578062.py:267–276  ·  view source on GitHub ↗
(grid, block)

Source from the content-addressed store, hash-verified

265# - should be a block from a sudoku_key
266# - should have same unique bytes as the expanding grid
267def expand_array(grid, block):
268 cache = []
269 grid_size = len(grid)
270 block_size = len(block)
271 for byte in block:
272 index = grid.index(bytes([byte]))
273 for part in range(0, grid_size, block_size):
274 cache.append(grid[part+index:part+block_size])
275 cache.append(grid[part:part+index])
276 return b''.join(cache)
277
278################################################################################
279

Callers 1

make_gridFunction · 0.85

Calls 5

bytesFunction · 0.85
rangeFunction · 0.85
indexMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected