Initialize a new block header with the `parent` header as the block's
        parent hash.
347458
def from_parent(cls,
                    parent: 'BlockHeader',
                    gas_limit: int,
                    difficulty: int,
                    timestamp: int,
                    coinbase: Address=ZERO_ADDRESS,
                    nonce: bytes=None,
                    extra_data: bytes=None,
                    transaction_root: bytes=None,
                    receipt_root: bytes=None) -> 'BlockHeader':
        
        header_kwargs = {
            'parent_hash': parent.hash,
            'coinbase': coinbase,
            'state_root': parent.state_root,
            'gas_limit': gas_limit,
            'difficulty': difficulty,
            'block_number': parent.block_number + 1,
            'timestamp': timestamp,
        }
        if nonce is not None:
            header_kwargs['nonce'] = nonce
        if extra_data is not None:
            header_kwargs['extra_data'] = extra_data
        if transaction_root is not None:
            header_kwargs['transaction_root'] = transaction_root
        if receipt_root is not None:
            header_kwargs['receipt_root'] = receipt_root

        header = cls(**header_kwargs)
        return header
537152
def generate_header_from_parent_header(
        compute_difficulty_fn: Callable[[BlockHeader, int], int],
        parent_header: BlockHeader,
        coinbase: Address,
        timestamp: Optional[int] = None,
        extra_data: bytes = b'') -> BlockHeader:
    
    if timestamp is None:
        timestamp = max(int(time.time()), parent_header.timestamp + 1)
    elif timestamp <= parent_header.timestamp:
        raise ValueError(
            "header.timestamp ({}) should be higher than"
            "parent_header.timestamp ({})".format(
                timestamp,
                parent_header.timestamp,
            )
        )
    header = BlockHeader(
        difficulty=compute_difficulty_fn(parent_header, timestamp),
        block_number=(parent_header.block_number + 1),
        gas_limit=compute_gas_limit(
            parent_header,
            gas_limit_floor=GENESIS_GAS_LIMIT,
        ),
        timestamp=timestamp,
        parent_hash=parent_header.hash,
        state_root=parent_header.state_root,
        coinbase=coinbase,
        extra_data=extra_data,
    )

    return header
897243
def init(self, initial):
        
        if initial <= 0:
            return False
        step = initial // BLOCK_SIZE
        with self._lock:
            init = self._atomic_long.compare_and_set(0, step + 1).result()
            if init:
                self._local = step
                self._residue = (initial % BLOCK_SIZE) + 1
            return init
820492
def _build_block_context(template, context):
    """"""

    # Ensure there's a BlockContext before rendering. This allows blocks in
    # ExtendsNodes to be found by sub-templates (allowing {{ block.super }} and
    # overriding sub-blocks to work).
    if BLOCK_CONTEXT_KEY not in context.render_context:
        context.render_context[BLOCK_CONTEXT_KEY] = BlockContext()
    block_context = context.render_context[BLOCK_CONTEXT_KEY]

    for node in template.nodelist:
        if isinstance(node, ExtendsNode):
            compiled_parent = node.get_parent(context)

            # Add the parent node's blocks to the context. (This ends up being
            # similar logic to ExtendsNode.render(), where we're adding the
            # parent's blocks to the context so a child can find them.)
            block_context.add_blocks(
                {n.name: n for n in compiled_parent.nodelist.get_nodes_by_type(BlockNode)})

            _build_block_context(compiled_parent, context)
            return compiled_parent

        # The ExtendsNode has to be the first non-text node.
        if not isinstance(node, TextNode):
            break
197897
def init_sub_blocks(*args)
      options = args.find { |a| a.is_a?(Hash) }
      @custom_attrs = (options ? options.dup : {}).with_indifferent_access
      # Delete these keys which are either meta data added by Origen or are already covered by
      # dedicated methods
      %w(parent name base_address reg_base_address base).each do |key|
        @custom_attrs.delete(key)
      end
      if options
        # Using reg_base_address for storage to avoid class with the original Origen base
        # address API, but will accept any of these
        @reg_base_address = options.delete(:reg_base_address) ||
                            options.delete(:base_address) || options.delete(:base) || 0
        if options[:_instance]                # to be deprecated as part of multi-instance removal below
          if @reg_base_address.is_a?(Array)
            @reg_base_address = @reg_base_address[options[:_instance]]
          elsif options[:base_address_step]
            @reg_base_address = @reg_base_address + (options[:_instance] * options[:base_address_step])
          end
        end
        @domain_names = [options.delete(:domain) || options.delete(:domains)].flatten.compact
        @domain_specified = !@domain_names.empty?
        @path = options.delete(:path)
        @abs_path = options.delete(:abs_path) || options.delete(:absolute_path)
      end
      if is_a?(SubBlock)
        options.each do |k, v|
          send("#{k}=", v)
        end
      end
    end
76988
def initialize(self):
        
        super(Block, self).initialize()

        block = self.block

        if block: #: This block is setting the content of another block
            #: Remove the existing blocks children
            if self.mode == 'replace':
                #: Clear the blocks children
                for c in block.children:
                    c.destroy()
            #: Add this blocks children to the other block
            block.insert_children(None, self.children)

        else: #: This block is inserting it's children into it's parent
            self.parent.insert_children(self, self.children)
162786
def to_mom( compiler )
      parfait_block = self.parfait_block(compiler)
      block_compiler = Risc::BlockCompiler.new( parfait_block , compiler.get_method )
      head = body.to_mom( block_compiler )
      block_compiler.add_mom(head)
      block_compiler
    end
1094773
def init (self, base_ref, base_url, parent_url, recursion_level,
              aggregate, line, column, page, name, url_encoding, extern):
        """"""
        super(FileUrl, self).init(base_ref, base_url, parent_url,
         recursion_level, aggregate, line, column, page, name, url_encoding, extern)
        self.scheme = u'file'
1246698
def add_header(self, name, value):
        
        self._headers.setdefault(_hkey(name), []).append(_hval(value))
761951
private void init() throws IOException {
        bsPutUByte('B');
        bsPutUByte('Z');

        this.data = new Data(this.blockSize100k);
        this.blockSorter = new BlockSort(this.data);

        // huffmanised magic bytes
        bsPutUByte('h');
        bsPutUByte('0' + this.blockSize100k);

        this.combinedCRC = 0;
        initBlock();
    }
1081572
def set_header(self, name, value):
        
        self._headers[_hkey(name)] = [_hval(value)]
701180
function() {
        if (!this.blocks) {
            this.createBlocks();
        }
        
        if (this.size && this.relativePosition) {
            var position = this.positionBlocks[this.relativePosition];
            for (var i = 0; i < position.blocks.length; i++) {
    
                var positionBlock = position.blocks[i];
                var block = this.blocks[i];
    
                // adjust sizes
                var l = positionBlock.anchor.left;
                var b = positionBlock.anchor.bottom;
                var r = positionBlock.anchor.right;
                var t = positionBlock.anchor.top;
    
                //note that we use the isNaN() test here because if the 
                // size object is initialized with a "auto" parameter, the 
                // size constructor calls parseFloat() on the string, 
                // which will turn it into NaN
                //
                var w = (isNaN(positionBlock.size.w)) ? this.size.w - (r + l) 
                                                      : positionBlock.size.w;
    
                var h = (isNaN(positionBlock.size.h)) ? this.size.h - (b + t) 
                                                      : positionBlock.size.h;
    
                block.div.style.width = (w < 0 ? 0 : w) + 'px';
                block.div.style.height = (h < 0 ? 0 : h) + 'px';
    
                block.div.style.left = (l != null) ? l + 'px' : '';
                block.div.style.bottom = (b != null) ? b + 'px' : '';
                block.div.style.right = (r != null) ? r + 'px' : '';            
                block.div.style.top = (t != null) ? t + 'px' : '';
    
                block.image.style.left = positionBlock.position.x + 'px';
                block.image.style.top = positionBlock.position.y + 'px';
            }
    
            this.contentDiv.style.left = this.padding.left + "px";
            this.contentDiv.style.top = this.padding.top + "px";
        }
    }
478128
void moveBlockToHead(BlockInfo b) {
    blockList = b.listRemove(blockList, this);
    blockList = b.listInsert(blockList, this, -1);
  }
847996
def add_basic_block(self, basic_block):
        """"""
        assert(isinstance(basic_block, BasicBlock))
        self.basic_block_list.append(basic_block)
1353478
function Headers(options) {
  if (!(this instanceof Headers))
    return new Headers(options);

  AbstractBlock.call(this);

  if (options)
    this.parseOptions(options);
}
877803
function init() {
        $this->blockname = get_class($this);
        $this->title = get_string('pluginname', $this->blockname);
    }
389682
private void beginMainBlock() {
        int blockNo = registerBlock(null); // =0
        BlockTabRec btr = blockTab[blockNo];
        btr.tPosBegin = 0;
        btr.tPosContentsBegin = 0;
        openBlocksTab[currentNestingLevel] = blockNo;
        currentNestingLevel++;
    }