Return a heightmap, representing the highest solid blocks in this chunk.
172304
def generate_heightmap(self, buffer=False, as_array=False):
        """"""
        non_solids = [0, 8, 9, 10, 11, 38, 37, 32, 31]
        if buffer:
            return BytesIO(pack(">i", 256)+self.generate_heightmap()) # Length + Heightmap, ready for insertion into Chunk NBT
        else:
            bytes = []
            for z in range(16):
                for x in range(16):
                    for y in range(127, -1, -1):
                        offset = y + z*128 + x*128*16
                        if (self.blocksList[offset] not in non_solids or y == 0):
                            bytes.append(y+1)
                            break
            if (as_array):
                return bytes
            else:
                return array.array('B', bytes).tostring()
182138
def atlasdb_get_lastblock( con=None, path=None ):
    
    row = None
    with AtlasDBOpen(con=con, path=path) as dbcon:

        sql = "SELECT MAX(block_height) FROM zonefiles;"
        args = ()

        cur = dbcon.cursor()
        res = atlasdb_query_execute( cur, sql, args )

        row = {}
        for r in res:
            row.update(r)
            break

    return row['MAX(block_height)']
1165477
def get_blocks_struct(self):
        """"""
        cur_x = 0
        cur_y = 0
        cur_z = 0
        blocks = {}
        for block_id in self.blocksList:
            blocks[(cur_x,cur_y,cur_z)] = block_id
            cur_y += 1
            if (cur_y > 127):
                cur_y = 0
                cur_z += 1
                if (cur_z > 15):
                    cur_z = 0
                    cur_x += 1
        return blocks
458132
def get_index_range(blockchain_name, blockchain_client, impl, working_dir):
    

    start_block = config.get_first_block_id(impl)
    try:
        current_block = get_blockchain_height(blockchain_name, blockchain_client)
    except Exception, e:
        log.exception(e)
        return None, None

    saved_block = StateEngine.get_lastblock(impl, working_dir)

    if saved_block is None:
        saved_block = 0
    elif saved_block == current_block:
        start_block = saved_block
    elif saved_block < current_block:
        start_block = saved_block + 1

    return start_block, current_block
784405
def get_last_block(self, cur=None):
        
        sql = 'SELECT MAX(block_height) FROM {};'.format(self.subdomain_table)
        cursor = None
        if cur is None:
            cursor = self.conn.cursor()
        else:
            cursor = cur

        rows = db_query_execute(cursor, sql, ())
        height = 0
        try:
            rowdata = rows.fetchone()
            height = rowdata['MAX(block_height)']
        except:
            height = 0

        return height
421934
def assemble(self):
        """"""
        first_block = ray.get(self.objectids[(0, ) * self.ndim])
        dtype = first_block.dtype
        result = np.zeros(self.shape, dtype=dtype)
        for index in np.ndindex(*self.num_blocks):
            lower = DistArray.compute_block_lower(index, self.shape)
            upper = DistArray.compute_block_upper(index, self.shape)
            result[[slice(l, u) for (l, u) in zip(lower, upper)]] = ray.get(
                self.objectids[index])
        return result
526184
def top(n, width=WIDTH, style=STYLE):
    """"""
    return hrule(n, width, linestyle=STYLES[style].top)
191381
def min_width(self) -> int:
        """"""
        return max(
            max(len(e) for e in self.content.split('\n')),
            # Only horizontal lines can cross 0 width blocks.
            int(any([self.top, self.bottom]))
        )
87605
def heightmap_normalize(
    hm: np.ndarray, mi: float = 0.0, ma: float = 1.0
) -> None:
    
    lib.TCOD_heightmap_normalize(_heightmap_cdata(hm), mi, ma)
1203562
def _update_visible_blocks(self, *args):
        
        self._visible_blocks[:] = []
        block = self.firstVisibleBlock()
        block_nbr = block.blockNumber()
        top = int(self.blockBoundingGeometry(block).translated(
            self.contentOffset()).top())
        bottom = top + int(self.blockBoundingRect(block).height())
        ebottom_top = 0
        ebottom_bottom = self.height()
        while block.isValid():
            visible = (top >= ebottom_top and bottom <= ebottom_bottom)
            if not visible:
                break
            if block.isVisible():
                self._visible_blocks.append((top, block_nbr, block))
            block = block.next()
            top = bottom
            bottom = top + int(self.blockBoundingRect(block).height())
            block_nbr = block.blockNumber()
912069
def _make_local_block(x, depth, batch, heads, num_blocks, block_length):
  """"""
  prev_block = tf.slice(x, [0, 0, 0, 0, 0],
                        [-1, -1, num_blocks - 1, -1, -1])
  cur_block = tf.slice(x, [0, 0, 1, 0, 0], [-1, -1, -1, -1, -1])
  local_block = tf.concat([prev_block, cur_block], 3)
  return tf.reshape(local_block,
                    [batch, heads, num_blocks - 1, block_length * 2, depth])
134827
def get_chunks(data, chunks=None):
    """"""

    if chunks is None:

        if hasattr(data, 'chunklen') and hasattr(data, 'shape'):
            # bcolz carray, chunk first dimension only
            return (data.chunklen,) + data.shape[1:]

        elif hasattr(data, 'chunks') and hasattr(data, 'shape') and \
                len(data.chunks) == len(data.shape):
            # h5py dataset or zarr array
            return data.chunks

        else:
            # fall back to something simple, ~4Mb chunks of first dimension
            row = np.asarray(data[0])
            chunklen = max(1, (2**22) // row.nbytes)
            if row.shape:
                chunks = (chunklen,) + row.shape
            else:
                chunks = (chunklen,)
            return chunks

    else:

        return chunks
900913
private float getColumnBottom() {
        if (desiredHeight == AUTOMATIC) {
            return document.bottom();
        } else {
            return Math.max(top - (desiredHeight - totalHeight), document.bottom());
        }
    }
321905
def heightmap_set_value(hm: np.ndarray, x: int, y: int, value: float) -> None:
    
    if hm.flags["C_CONTIGUOUS"]:
        warnings.warn(
            "Assign to this heightmap with hm[i,j] = value\n"
            "consider using order='F'",
            DeprecationWarning,
            stacklevel=2,
        )
        hm[y, x] = value
    elif hm.flags["F_CONTIGUOUS"]:
        warnings.warn(
            "Assign to this heightmap with hm[x,y] = value",
            DeprecationWarning,
            stacklevel=2,
        )
        hm[x, y] = value
    else:
        raise ValueError("This array is not contiguous.")
1186021
def stacksize(self):
        
        return max(scanl(
            op.add,
            0,
            map(op.attrgetter('stack_effect'), self.instrs),
        ))
1262509
def height(cls, path):
        
        if os.path.exists( path ):
            sb = os.stat( path )
            h = (sb.st_size / BLOCK_HEADER_SIZE) - 1
            return h
        else:
            return None
1265571
def height(self) -> int:
        """"""
        max_y = -1.0
        for _, y in self.entries.keys():
            max_y = max(max_y, y)
        for h in self.horizontal_lines:
            max_y = max(max_y, h.y)
        for v in self.vertical_lines:
            max_y = max(max_y, v.y1, v.y2)
        return 1 + int(max_y)