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

Function _decode

recipes/Python/578062_Markov/recipe-578062.py:423–435  ·  view source on GitHub ↗
(bytes_obj, byte_map, grid, index, block_size)

Source from the content-addressed store, hash-verified

421# block_size
422# - length of each edge in a grid
423def _decode(bytes_obj, byte_map, grid, index, block_size):
424 cache = bytes()
425 index = [0] + index
426 for byte in bytes_obj:
427 if byte in byte_map:
428 index.append(byte_map[byte])
429 index = index[1:]
430 decoded = eval_index(grid, block_size, index)
431 index[-1] = byte_map[decoded]
432 cache += bytes([decoded])
433 else:
434 cache += bytes([byte])
435 return cache, index[1:]
436
437# bytes_obj
438# - the bytes to decode

Callers 1

decryptFunction · 0.70

Calls 3

bytesFunction · 0.85
eval_indexFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected