Import the provided ``block`` into the chain.
558819
def import_block(block: BaseBlock, chain: BaseChain) -> BaseChain:
    
    chain.import_block(block)
    return chain
610891
def _extend_blocks(result, blocks=None):
    
    from pandas.core.internals import BlockManager
    if blocks is None:
        blocks = []
    if isinstance(result, list):
        for r in result:
            if isinstance(r, list):
                blocks.extend(r)
            else:
                blocks.append(r)
    elif isinstance(result, BlockManager):
        blocks.extend(result.blocks)
    else:
        blocks.append(result)
    return blocks
847996
def add_basic_block(self, basic_block):
        """"""
        assert(isinstance(basic_block, BasicBlock))
        self.basic_block_list.append(basic_block)
1195042
function Block() {

  if( !(this instanceof Block) )
    return new Block()

  /** @type {Number} Entry / compression type */
  this.type = 0x00000000
  /** @type {String} Entry type name */
  this.description = 'UNKNOWN'
  /** @type {String} Comment ('+beg'|'+end' if type == COMMENT) */
  this.comment = ''
  /** @type {Number} Start sector of this chunk */
  this.sectorNumber = 0x0000000000000000
  /** @type {Number} Number of sectors in this chunk */
  this.sectorCount = 0x0000000000000000
  /** @type {Number} Start of chunk in data fork */
  this.compressedOffset = 0x0000000000000000
  /** @type {Number} Chunk's bytelength in data fork */
  this.compressedLength = 0x0000000000000000

}
516451
def mutable_block(self, x: int, y: int) -> Block:
        """"""
        if x < 0 or y < 0:
            raise IndexError('x < 0 or y < 0')
        return self._blocks[(x, y)]
367827
def p_generate_block(self, p):
        ''
        p[0] = Block(p[2], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
271066
def add_block(pBlock, pBehaviour = Languages::KEEP_LEVEL)
      return nil unless (pBlock.instance_of?Languages::BlockData)
      add_with_manager(pBlock, 'block', pBehaviour)
    end
621211
def block_partition(block, i):
    
    i += 1
    new_block = BasicBlock(block.asm[i:])
    block.mem = block.mem[:i]
    block.asm = block.asm[:i]
    block.update_labels()
    new_block.update_labels()

    new_block.goes_to = block.goes_to
    block.goes_to = IdentitySet()

    new_block.label_goes = block.label_goes
    block.label_goes = []

    new_block.next = new_block.original_next = block.original_next
    new_block.prev = block
    new_block.add_comes_from(block)

    if new_block.next is not None:
        new_block.next.prev = new_block
        new_block.next.add_comes_from(new_block)
        new_block.next.delete_from(block)

    block.next = block.original_next = new_block
    block.update_next_block()
    block.add_goes_to(new_block)

    return block, new_block
637541
def ProcessNewBlock(self, block):
        
        added = set()
        changed = set()
        deleted = set()

        try:
            # go through the list of transactions in the block and enumerate
            # over their outputs
            for tx in block.FullTransactions:

                for index, output in enumerate(tx.outputs):

                    # check to see if the outputs in the tx are in this wallet
                    state = self.CheckAddressState(output.ScriptHash)

                    if state & AddressState.InWallet > 0:

                        # if it's in the wallet, check to see if the coin exists yet
                        key = CoinReference(tx.Hash, index)

                        # if it exists, update it, otherwise create a new one
                        if key in self._coins.keys():
                            coin = self._coins[key]
                            coin.State |= CoinState.Confirmed
                            changed.add(coin)
                        else:
                            newcoin = Coin.CoinFromRef(coin_ref=key, tx_output=output, state=CoinState.Confirmed, transaction=tx)
                            self._coins[key] = newcoin
                            added.add(newcoin)

                        if state & AddressState.WatchOnly > 0:
                            self._coins[key].State |= CoinState.WatchOnly
                            changed.add(self._coins[key])

            # now iterate over the inputs of the tx and do the same
            for tx in block.FullTransactions:

                for input in tx.inputs:

                    if input in self._coins.keys():
                        if self._coins[input].Output.AssetId == Blockchain.SystemShare().Hash:
                            coin = self._coins[input]
                            coin.State |= CoinState.Spent | CoinState.Confirmed
                            changed.add(coin)

                        else:
                            deleted.add(self._coins[input])
                            del self._coins[input]

            for claimTx in [tx for tx in block.Transactions if tx.Type == TransactionType.ClaimTransaction]:

                for ref in claimTx.Claims:
                    if ref in self._coins.keys():
                        deleted.add(self._coins[ref])
                        del self._coins[ref]

            # update the current height of the wallet
            self._current_height += 1

            # in the case that another wallet implementation needs to do something
            # with the coins that have been changed ( ie persist to db ) this
            # method is called
            self.OnProcessNewBlock(block, added, changed, deleted)

            # this is not necessary at the moment, but any outside process
            # that wants to subscribe to the balance changed event could do
            # so from the BalanceChanged method
            if len(added) + len(deleted) + len(changed) > 0:
                self.BalanceChanged()

        except Exception as e:
            traceback.print_stack()
            traceback.print_exc()
            logger.error("could not process %s " % e)
80465
public function addBlock(Block $block)
	{
		if ($this->lock('block')) {
			$this->matchDiscriminator($block);
			if ($this->addUnique($this->blocks, $block)) {
				$block->setPlaceHolder($this);
			}
			$this->unlock('block');
		}
	}
379851
def acquire(self, block=True):
        """"""
        while True:
            # Try to set the lock
            if self.redis.set(self.name, self.value, px=self.timeout, nx=True):
                # It's ours until the timeout now
                return True
            # Lock is taken
            if not block:
                return False
            # If blocking, try again in a bit
            time.sleep(self.sleep)
86549
private void moveToNextBlock() {
		blk = new BlockId(blk.fileName(), blk.number() - 1);
		pg.read(blk);
		currentRec = (Integer) pg.getVal(LogMgr.LAST_POS, INTEGER).asJavaVal();
	}
1103880
def add_next_block(prev_block, data)
      if valid_block?(prev_block)
        blockchain << next_block(data)
      else
        raise InvalidBlockError
      end
    end
63442
def add_file(self, filename, block_size=4096):
        
        with open(filename, "rb") as f:
            for chunk in iter(lambda: f.read(block_size), b""):
                self.hash.update(chunk)
1363995
def add_comes_from(self, basic_block):
        
        if basic_block is None:
            return

        if self.lock:
            return

        # Return if already added
        if basic_block in self.comes_from:
            return

        self.lock = True
        self.comes_from.add(basic_block)
        basic_block.add_goes_to(self)
        self.lock = False
808931
def create_definition(self, block_type, slug=None):
        """"""
        prefix = "d"
        if slug:
            prefix += "_" + slug
        def_id = self._next_id(prefix)
        self._definitions[def_id] = block_type
        return def_id
705631
private static Block convertBlock(TBlock tblk) {
    return new Block(tblk.getBlockId(), 
                     tblk.getNumBytes(),
                     tblk.getGenerationStamp());
  }