Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
bins = None if idx else {}
for b in range(n_bins):
bin_id, loffset, n_chunks = unpack_bid_loffset_nchunk(self._io.read(16))
if idx:
if bin_id == self._UNMAP_BIN:
assert n_chunks == 2, 'Bin 3740 is supposed to have 2 chunks. This has {}'.format(n_chunks)
unmapped = bai.Unmapped(*unpack_unmapped(self._io.read(32)))
self.unmapped[ref_id] = unmapped
else:
if not n_chunks == 0:
self._io.seek(16 * n_chunks, 1)
else:
chunks = self.get_chunks(n_chunks)
bins[bin_id] = CsiBin(loffset, chunks)
else:
return bins