Return a list of IR blocks as a copy of the original, with EndOptional blocks removed.
335149
def remove_end_optionals(ir_blocks):
    """"""
    new_ir_blocks = []
    for block in ir_blocks:
        if not isinstance(block, EndOptional):
            new_ir_blocks.append(block)
    return new_ir_blocks
267826
def blocks(self):
        

        for block_addr, block in self._local_blocks.items():
            try:
                yield self._get_block(block_addr, size=block.size,
                                      byte_string=block.bytestr if isinstance(block, BlockNode) else None)
            except (SimEngineError, SimMemoryError):
                pass
285634
def getoneblock(astr, start, end):
    """"""
    alist = astr.split(start)
    astr = alist[-1]
    alist = astr.split(end)
    astr = alist[0]
    return astr
121777
def copy(self):
        

        ld = LiveDefinitions()
        ld._memory_map = self._memory_map.copy()
        ld._register_map = self._register_map.copy()
        ld._defs = self._defs.copy()

        return ld
1221882
def blocks2numList(blocks, n):
    """"""
    toProcess = copy.copy(blocks)
    returnList = []
    for numBlock in toProcess:
        inner = []
        for i in range(0, n):
            inner.append(numBlock % 256)
            numBlock >>= 8
        inner.reverse()
        returnList.extend(inner)
    return returnList
1142721
def _remove_unused_wires(block, keep_inputs=True):
    
    valid_wires = set()
    for logic_net in block.logic:
        valid_wires.update(logic_net.args, logic_net.dests)

    wire_removal_set = block.wirevector_set.difference(valid_wires)
    for removed_wire in wire_removal_set:
        if isinstance(removed_wire, Input):
            term = " optimized away"
            if keep_inputs:
                valid_wires.add(removed_wire)
                term = " deemed useless by optimization"

            print("Input Wire, " + removed_wire.name + " has been" + term)
        if isinstance(removed_wire, Output):
            PyrtlInternalError("Output wire, " + removed_wire.name + " not driven")

    block.wirevector_set = valid_wires
1141955
def copy(self, existing_inputs):
        """"""
        return PPOPolicyGraph(
            self.observation_space,
            self.action_space,
            self.config,
            existing_inputs=existing_inputs)
870
def remove_backtrack_blocks_from_fold(folded_ir_blocks):
    """"""
    new_folded_ir_blocks = []
    for block in folded_ir_blocks:
        if not isinstance(block, Backtrack):
            new_folded_ir_blocks.append(block)
    return new_folded_ir_blocks
437790
def _rebuild_blknos_and_blklocs(self):
        
        new_blknos = np.empty(self.shape[0], dtype=np.int64)
        new_blklocs = np.empty(self.shape[0], dtype=np.int64)
        new_blknos.fill(-1)
        new_blklocs.fill(-1)

        for blkno, blk in enumerate(self.blocks):
            rl = blk.mgr_locs
            new_blknos[rl.indexer] = blkno
            new_blklocs[rl.indexer] = np.arange(len(rl))

        if (new_blknos == -1).any():
            raise AssertionError("Gaps in blk ref_locs")

        self._blknos = new_blknos
        self._blklocs = new_blklocs
750395
def copy(self):
        '''
            
        '''
        ret = QueryBuilder()
        ret.filters = copy.copy(self.filters)
        return ret
860658
def processing_blocks(self):
        """"""
        pb_list = ProcessingBlockList()
        # TODO(BMo) realtime, offline etc.
        return json.dumps(dict(active=pb_list.active,
                               completed=pb_list.completed,
                               aborted=pb_list.aborted))
1149929
function listBlocks(plugins) {
    return plugins
        .reverse()
        .reduce(function(result, plugin) {
            var blocks = plugin.getBlocks();
            return result.merge(blocks);
        }, Immutable.Map());
}
831796
private int combineSubsetBlocks(Mode[] mode_type, int[] mode_length, int index_point) {
        /* bring together same type blocks */
        if (index_point > 1) {
            for (int i = 1; i < index_point; i++) {
                if (mode_type[i - 1] == mode_type[i]) {
                    /* bring together */
                    mode_length[i - 1] = mode_length[i - 1] + mode_length[i];
                    /* decrease the list */
                    for (int j = i + 1; j < index_point; j++) {
                        mode_length[j - 1] = mode_length[j];
                        mode_type[j - 1] = mode_type[j];
                    }
                    index_point--;
                    i--;
                }
            }
        }
        return index_point;
    }
1034343
def split(self):
        
        ranges = []
        for bound in self.bounds:
            range = VersionRange(None)
            range.bounds = [bound]
            ranges.append(range)
        return ranges
845723
def copy(self):
        

        vs = ValueSet(bits=self.bits)
        vs._regions = self._regions.copy()
        vs._region_base_addrs = self._region_base_addrs.copy()
        vs._reversed = self._reversed
        vs._si = self._si.copy()

        return vs
359171
def _map_block_index_to_location(ir_blocks):
    """"""
    block_index_to_location = {}
    # MarkLocation blocks occur after the blocks related to that location.
    # The core approach here is to buffer blocks until their MarkLocation is encountered
    # after which all buffered blocks can be associated with the encountered MarkLocation.location.
    current_block_ixs = []
    for num, ir_block in enumerate(ir_blocks):
        if isinstance(ir_block, blocks.GlobalOperationsStart):
            if len(current_block_ixs) > 0:
                unassociated_blocks = [ir_blocks[ix] for ix in current_block_ixs]
                raise AssertionError(
                    u'Unexpectedly encountered global operations before mapping blocks '
                    u'{} to their respective locations.'.format(unassociated_blocks))
            break
        current_block_ixs.append(num)
        if isinstance(ir_block, blocks.MarkLocation):
            for ix in current_block_ixs:
                block_index_to_location[ix] = ir_block.location
            current_block_ixs = []
    return block_index_to_location
761643
def lower_unary_transformations(ir_blocks):
    """"""
    def visitor_fn(expression):
        """Raise error if current expression is a UnaryTransformation."""
        if not isinstance(expression, expressions.UnaryTransformation):
            return expression
        raise NotImplementedError(
            u'UnaryTransformation expression "{}" encountered with IR blocks {} is unsupported by '
            u'the SQL backend.'.format(expression, ir_blocks)
        )

    new_ir_blocks = [
        block.visit_and_update_expressions(visitor_fn)
        for block in ir_blocks
    ]
    return new_ir_blocks