Variadic argument version of :func:`~eth.tools.builder.chain.import_block`
499040
def import_blocks(*blocks: BaseBlock) -> Callable[[BaseChain], BaseChain]:
    
    @functools.wraps(import_blocks)
    def _import_blocks(chain: BaseChain) -> BaseChain:
        for block in blocks:
            chain.import_block(block)
        return chain

    return _import_blocks
1248922
def visit_Block(self, node, frame):
        """"""
        level = 0
        if frame.toplevel:
            # if we know that we are a child template, there is no need to
            # check if we are one
            if self.has_known_extends:
                return
            if self.extends_so_far > 0:
                self.writeline('if parent_template is None:')
                self.indent()
                level += 1

        if node.scoped:
            context = self.derive_context(frame)
        else:
            context = self.get_context_ref()

        if supports_yield_from and not self.environment.is_async and \
           frame.buffer is None:
            self.writeline('yield from context.blocks[%r][0](%s)' % (
                           node.name, context), node)
        else:
            loop = self.environment.is_async and 'async for' or 'for'
            self.writeline('%s event in context.blocks[%r][0](%s):' % (
                           loop, node.name, context), node)
            self.indent()
            self.simple_write('event', frame)
            self.outdent()

        self.outdent(level)
664867
def blocks(self, *args, **kwargs):
    
    return Stream(blocks(iter(self), *args, **kwargs))
1290139
def extend_to_block_definition(block_definition)
      RuntimeContext.new(builder, block_definition, parent_runtime_context: self).tap do |rc|
        rc.runtime_args = self.runtime_args
      end
    end
353468
def method_missing(name, *args, &block)
      if args.empty? && !block_given? && @arg_names.include?(name)
        @args[name]
      else
        super
      end
    end
1344695
def standard_parsing_functions(Block, Tx):
    
    def stream_block(f, block):
        assert isinstance(block, Block)
        block.stream(f)

    def stream_blockheader(f, blockheader):
        assert isinstance(blockheader, Block)
        blockheader.stream_header(f)

    def stream_tx(f, tx):
        assert isinstance(tx, Tx)
        tx.stream(f)

    def parse_int_6(f):
        b = f.read(6) + b'\0\0'
        return struct.unpack(b, "<L")[0]

    def stream_int_6(f, v):
        f.write(struct.pack(v, "<L")[:6])

    more_parsing = [
        ("A", (PeerAddress.parse, lambda f, peer_addr: peer_addr.stream(f))),
        ("v", (InvItem.parse, lambda f, inv_item: inv_item.stream(f))),
        ("T", (Tx.parse, stream_tx)),
        ("B", (Block.parse, stream_block)),
        ("z", (Block.parse_as_header, stream_blockheader)),
        ("1", (lambda f: struct.unpack("B", f.read(1))[0], lambda f, v: f.write(struct.pack("B", v)))),
        ("6", (parse_int_6, stream_int_6)),
        ("O", (lambda f: True if f.read(1) else False,
               lambda f, v: f.write(b'' if v is None else struct.pack("B", v)))),
    ]
    all_items = list(STREAMER_FUNCTIONS.items())
    all_items.extend(more_parsing)
    return all_items
631376
def p_namedblock(self, p):
        ''
        p[0] = Block(p[4], p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
63651
function partition(predicate, thisArg) {
    return function (source) {
        return [
            Object(_filter__WEBPACK_IMPORTED_MODULE_1__["filter"])(predicate, thisArg)(source),
            Object(_filter__WEBPACK_IMPORTED_MODULE_1__["filter"])(Object(_util_not__WEBPACK_IMPORTED_MODULE_0__["not"])(predicate, thisArg))(source)
        ];
    };
}
525283
def _convert(self, block_node):
        

        if not type(block_node) is BlockNode:
            return block_node

        block = self.project.factory.block(block_node.addr, block_node.size)

        ail_block = ailment.IRSBConverter.convert(block.vex, self._ail_manager)
        return ail_block
976870
def add_function(self, func):
        
        for block in func.blocks:
            self.add_obj(block.addr, block)
412333
def build_block(self):
        
        header_bytes = self.block_header.SerializeToString()
        block = Block(header=header_bytes,
                      header_signature=self._header_signature)
        block.batches.extend(self.batches)
        return block
238427
def build_from_block(*args, &block)
      pre_block
      Docile.dsl_eval(self, *args, &block) if block
      post_block
      self
    end
388780
def mine_block(self, *args: Any, **kwargs: Any) -> BaseBlock:
        
        mined_block = self.get_vm(self.header).mine_block(*args, **kwargs)

        self.validate_block(mined_block)

        self.chaindb.persist_block(mined_block)
        self.header = self.create_header_from_parent(mined_block.header)
        return mined_block
696619
def construct_xblock(self, block_type, scope_ids, field_data=None, *args, **kwargs):
        
        """
        return self.construct_xblock_from_class(
            cls=self.load_block_type(block_type),
            scope_ids=scope_ids,
            field_data=field_data,
            *args, **kwargs
        )
841758
def genesis_block_load(module_path=None):
    
    if os.environ.get('BLOCKSTACK_GENESIS_BLOCK_PATH') is not None:
        log.warning('Using envar-given genesis block')
        module_path = os.environ['BLOCKSTACK_GENESIS_BLOCK_PATH']

    genesis_block = None
    genesis_block_stages = None

    if module_path:
        log.debug('Load genesis block from {}'.format(module_path))
        genesis_block_path = module_path
        try:
            genesis_block_mod = imp.load_source('genesis_block', genesis_block_path)
            genesis_block = genesis_block_mod.GENESIS_BLOCK
            genesis_block_stages = genesis_block_mod.GENESIS_BLOCK_STAGES

            if BLOCKSTACK_TEST:
                print ''
                print 'genesis block'
                print json.dumps(genesis_block, indent=4, sort_keys=True)
                print ''

        except Exception as e:
            log.exception(e)
            log.fatal('Failed to load genesis block')
            os.abort()

    else:
        log.debug('Load built-in genesis block')
        genesis_block = get_genesis_block()
        genesis_block_stages = get_genesis_block_stages()

    try:
        for stage in genesis_block_stages:
            jsonschema.validate(GENESIS_BLOCK_SCHEMA, stage)

        jsonschema.validate(GENESIS_BLOCK_SCHEMA, genesis_block)

        set_genesis_block(genesis_block)
        set_genesis_block_stages(genesis_block_stages)

        log.debug('Genesis block has {} stages'.format(len(genesis_block_stages)))
        for i, stage in enumerate(genesis_block_stages):
            log.debug('Stage {} has {} row(s)'.format(i+1, len(stage['rows'])))

    except Exception as e:
        log.fatal("Invalid genesis block")
        os.abort()

    return True
424312
def app(&block)
      raise ArgumentError, "Block is required" unless block_given?
      lambda do |env|
        Rango::Router.set_rack_env(env)
        request = Rango::Request.new(env)
        response = Rack::Response.new
        body = block.call(request, response)
        # TODO: check how rack test if object is stringable, probably not this way
        raise ArgumentError, "It has to return a valid rack body, #{body.inspect} returned" unless body.respond_to?(:each) || body.is_a?(String)
        response.write(body)
        array = response.finish
        [array[0], array[1], body] # we don't want to have Rack::Response instance instead body, it's mess!
      end
    end
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)]