API to list block parents of multiple blocks. To be called by blockparents url with post call.

        :param block_names: list of block names [block_name1, block_name2, ...] (Required). Mwx length 1000.
        :type block_names: list
481677
def listBlocksParents(self):
        
        try :
            body = request.body.read()
            data = cjson.decode(body)
            data = validateJSONInputNoCopy("block", data, read=True)
            #Because CMSWEB has a 300 seconds responding time. We have to limit the array siz to make sure that
            #the API can be finished in 300 second. 
            # YG Nov-05-2015
            max_array_size = 1000
            if ( 'block_names' in data.keys() and isinstance(data['block_names'], list) and len(data['block_names'])>max_array_size):
                    dbsExceptionHandler("dbsException-invalid-input",
                                        "The Max list length supported in listBlocksParents is %s." %max_array_size, self.logger.exception)
            return self.dbsBlock.listBlockParents(data["block_name"])
        except dbsException as de:
            dbsExceptionHandler(de.eCode, de.message, self.logger.exception, de.serverError)
        except cjson.DecodeError as de:
            sError = "DBSReaderModel/listBlockParents. %s\n. Exception trace: \n %s" \
                    % (de, traceback.format_exc())
            msg = "DBSReaderModel/listBlockParents. %s" % de
            dbsExceptionHandler('dbsException-invalid-input2', msg, self.logger.exception, sError)
        except HTTPError as he:
            raise he
        except Exception as ex:
            sError = "DBSReaderModel/listBlockParents. %s\n. Exception trace: \n %s" \
                    % (ex, traceback.format_exc())
            dbsExceptionHandler('dbsException-server-error', dbsExceptionCode['dbsException-server-error'], self.logger.exception, sError)
1005207
def all_blocks(self):

        status = OrderedDict.fromkeys(parameters.BLOCKS.keys())
        status['13AE'] = ['discovery complete', '50', '24.05']
        status['13AO'] = ['discovery complete', '36', '24.40']
        status['13BL'] = ['discovery complete', '79', '24.48']
        status['14BH'] = ['discovery running', '-', '-']
        status['15AP'] = ['discovery running', '-', '-']
        status['15AM'] = ['discovery running', '-', '-']

        '''
        '''
        bks = []
        for block in status.iterkeys():
            bk = [block, self.num_block_images(block)]  # if set in the .fromkeys(), doesn't give a unique list
            if status[block] is not None:
                bk = bk + status[block]
            else:
                bk = bk + ['awaiting triplets', '-', '-']
            bks.append(bk)

        retval = {'blocks': bks, 'status': status}

        return retval
281856
def p_generate_named_block(self, p):
        ''
        p[0] = Block(p[4], p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
1218516
def _extend_nodelist(extends_node, context, instance_types):
    
    results = []

    # Find all blocks in the complete inheritance chain
    blocks = extends_node.blocks.copy()  # dict with all blocks in the current template
    _extend_blocks(extends_node, blocks, context)

    # Dive into all blocks of the page one by one
    all_block_names = list(blocks.keys())
    for block in list(blocks.values()):
        results += _scan_nodes(block.nodelist, context, instance_types, block, ignore_blocks=all_block_names)

    # Scan topmost template for nodes that exist outside of blocks
    parent_template = _find_topmost_template(extends_node, context)
    if not parent_template:
        return []
    else:
        results += _scan_nodes(parent_template.nodelist, context, instance_types, ignore_blocks=all_block_names)
        return results
628905
def keys(self):
        """"""
        names = []
        for i in range(self.n_blocks):
            names.append(self.get_block_name(i))
        return names
423551
def block name, param = nil, &b
      sp = ' '*2 if name == :lang || name == :languages
      body = yield self if block_given?
      param = ":#{param.to_s}" unless param.nil?
      "#{sp}#{name.to_s} #{param} do\n#{body}\n#{sp}end\n"
    end
520397
def list(self):
        
        params = {'user': self.user_id}
        response = self.session.get(self.url, params=params)
        blocks = response.data['blocks']
        return [Block(self, **block) for block in blocks]
1149929
function listBlocks(plugins) {
    return plugins
        .reverse()
        .reduce(function(result, plugin) {
            var blocks = plugin.getBlocks();
            return result.merge(blocks);
        }, Immutable.Map());
}
1325882
def iter_block_items(self):
        
        block_item_tags = (qn('w:p'), qn('w:tbl'), qn('w:sdt'))
        for child in self:
            if child.tag in block_item_tags:
                yield child
240
def get_surrounding_blocks(self):
        

        next = self.next_blocks()
        prev = self.previous_blocks()

        surrounding_blocks = list(chain(prev, [self], next))
        return surrounding_blocks
847324
def list_blocks(self):
        
        logger.debug("listing blocks")
        blocksList = BlocksList()
        result = self.library.Cli_ListBlocks(self.pointer, byref(blocksList))
        check_error(result, context="client")
        logger.debug("blocks: %s" % blocksList)
        return blocksList
1096963
def add_list_blocks_parser(subparsers, parent_parser):
    
    parser = subparsers.add_parser(
        'list-blocks',
        help='List blocks from different nodes.',
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog='',
        parents=[parent_parser, base_multinode_parser()])

    parser.add_argument(
        '-n',
        '--count',
        default=10,
        type=int,
        help='the number of blocks to list')
862831
public int lookupBlockName(String blockName) {
        Integer blockNoWrapper = blockNameToNoMap.get(blockName.toUpperCase());
        if (blockNoWrapper == null) {
            return -1;
        }
        int blockNo = blockNoWrapper.intValue();
        return blockNo;
    }
666786
def rpc_get_name_at( self, name, block_height, **con_info ):
        
        if not check_name(name):
            return {'error': 'invalid name', 'http_status': 400}

        if not check_block(block_height):
            return self.success_response({'record': None})

        db = get_db_state(self.working_dir)
        names_at = db.get_name_at( name, block_height, include_expired=False )
        db.close()
        
        ret = []
        for name_rec in names_at:
            if 'opcode' not in name_rec:
                name_rec['opcode'] = op_get_opcode_name(name_rec['op'])
            
            ret.append(self.sanitize_rec(name_rec))

        return self.success_response( {'records': ret} )
1159449
def formatted_mixin_params(mixin_node)
      params = mixin_node.params
      result = []

      if mixin_node.type == :mixin_call
        blocks = mixin_node.blocks

        other_children = (mixin_node.children - mixin_node.blocks - mixin_node.params)
        if other_children.count { |n| n.type != :newline } > 0
          def_block_node = AST::NodeRegistrator.create(:mixin_block, mixin_node.lineno)
          def_block_node.name = DEFAULT_BLOCK_NAME
          def_block_node.children = other_children

          blocks << def_block_node
        end

        if !blocks.empty?
          buff_code '__blocks = {}'

          blocks.each do |block|
            block_definition(block)
          end

          result << '__blocks.dup'
        else
          result << '{}'
        end
      elsif mixin_node.type == :mixin_decl
        result << '__blocks'
      end


      # normal params
      result += params.select { |n| n.type == :mixin_param }.map(&:value)
      result += params.select { |n| n.type == :mixin_key_param }.map { |param| "#{param.name}: #{param.value}" }

      result.join(', ')
    end
377469
def insert_basic_block(self, before, name=''):
        
        blk = Block(parent=self, name=name)
        self.blocks.insert(before, blk)
        return blk
1171312
def block_count(self):
        

        resp = self.call('block_count')

        for k, v in resp.items():
            resp[k] = int(v)

        return resp