MCPcopy Index your code
hub / github.com/python/cpython / is_overlapping

Function is_overlapping

Lib/test/test_buffer.py:494–506  ·  view source on GitHub ↗

The structure 't' is overlapping if at least one memory location is visited twice while iterating through all possible tuples of indices.

(t)

Source from the content-addressed store, hash-verified

492 return p
493
494def is_overlapping(t):
495 """The structure 't' is overlapping if at least one memory location
496 is visited twice while iterating through all possible tuples of
497 indices."""
498 memlen, itemsize, ndim, shape, strides, offset = t
499 visited = 1<<memlen
500 for ind in indices(shape):
501 i = memory_index(ind, t)
502 bit = 1<<i
503 if visited & bit:
504 return True
505 visited |= bit
506 return False
507
508def rand_structure(itemsize, valid, maxdim=5, maxshape=16, shape=()):
509 """Return random structure:

Callers 1

Calls 2

indicesFunction · 0.85
memory_indexFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…