required parameter: block_name
        returns:  [{child_parent_id_list: [(cid1, pid1), (cid2, pid2), ... (cidn, pidn)]}]
761563
def listFileParentsByLumi(self, block_name='', logical_file_name=[]):
        
        #self.logger.debug("lfn %s, block_name %s" % (logical_file_name, block_name))
        if not block_name:
            dbsExceptionHandler('dbsException-invalid-input', \
                "Child block_name is required for fileparents/listFileParentsByLumi api", self.logger.exception )
        with self.dbi.connection() as conn:
            sqlresult = self.fileparentbylumi.execute(conn, block_name, logical_file_name)
            return [{"child_parent_id_list":sqlresult}]
180156
def _child_as_list(self, pk, ck):
        
        return [self._values[pk][ck][k]
                for k in sorted(self._values[pk][ck].keys(),
                                key=lambda x: int(x))]
206546
def get_processing_block_ids():
    """"""
    ids = []
    for key in sorted(DB.keys(pattern='scheduling_block/*')):
        config = json.loads(DB.get(key))
        for processing_block in config['processing_blocks']:
            ids.append(processing_block['id'])
    return ids
832637
def get(self, block, name):
        
        return self._kvs.get(self._key(block, name))
499572
def parameter_blocks(self):
        ''''''
        bytes = 4. + sum(g.binary_size() for g in self.groups.values())
        return int(np.ceil(bytes / 512))
73530
def get_backup_blocks(cls, impl, working_dir):
        
        ret = []
        backup_dir = config.get_backups_directory(impl, working_dir)
        if not os.path.exists(backup_dir):
            return []

        for name in os.listdir( backup_dir ):
            if ".bak." not in name:
                continue 

            suffix = name.split(".bak.")[-1]
            try:
                block_id = int(suffix)
            except:
                continue 

            # must exist...
            backup_paths = cls.get_backup_paths(block_id, impl, working_dir)
            for p in backup_paths:
                if not os.path.exists(p):
                    # doesn't exist
                    block_id = None
                    continue

            if block_id is not None:
                # have backup at this block 
                ret.append(block_id)

        return ret
1202945
def get_name_at(name, block_id, include_expired=False, hostport=None, proxy=None):
    
    assert hostport or proxy, 'Need hostport or proxy'
    if proxy is None:
        proxy = connect_hostport(hostport)

    namerec_schema = {
        'type': 'object',
        'properties': NAMEOP_SCHEMA_PROPERTIES,
        'required': NAMEOP_SCHEMA_REQUIRED
    }

    namerec_list_schema = {
        'type': 'object',
        'properties': {
            'records': {
                'anyOf': [
                    {
                        'type': 'array',
                        'items': namerec_schema
                    },
                    {
                        'type': 'null',
                    },
                ],
            },
        },
        'required': [
            'records'
        ],
    }

    resp_schema = json_response_schema( namerec_list_schema )
    resp = {}
    try:
        if include_expired:
            resp = proxy.get_historic_name_at(name, block_id)
        if not include_expired or 'KeyError' in resp.get('error', ''):
            resp = proxy.get_name_at(name, block_id)

        assert resp, "No such name {} at block {}".format(name, block_id)

        resp = json_validate(resp_schema, resp)
        if json_is_error(resp):
            return resp

    except ValidationError as e:
        if BLOCKSTACK_DEBUG:
            log.exception(e)

        resp = {'error': 'Server response did not match expected schema.  You are likely communicating with an out-of-date Blockstack node.', 'http_status': 502}
        return resp

    except socket.timeout:
        log.error("Connection timed out")
        resp = {'error': 'Connection to remote host timed out.', 'http_status': 503}
        return resp

    except socket.error as se:
        log.error("Connection error {}".format(se.errno))
        resp = {'error': 'Connection to remote host failed.', 'http_status': 502}
        return resp

    except Exception as ee:
        if BLOCKSTACK_DEBUG:
            log.exception(ee)

        log.error("Caught exception while connecting to Blockstack node: {}".format(ee))
        resp = {'error': 'Failed to contact Blockstack node.  Try again with `--debug`.', 'http_status': 500}
        return resp

    return resp['records']
321712
def listFileChildren(self, logical_file_name='', block_name='', block_id=0):
        
        conn = self.dbi.connection()
        try:
            if not logical_file_name and not block_name and not block_id:
                dbsExceptionHandler('dbsException-invalid-input',\
                        "Logical_file_name, block_id or block_name is required for listFileChildren api")
            sqlresult = self.filechildlist.execute(conn, logical_file_name, block_name, block_id)
            d = {}
            result = []
            for i in range(len(sqlresult)):
                k = sqlresult[i]['logical_file_name']
                v = sqlresult[i]['child_logical_file_name']
                if k in d:
                    d[k].append(v)
                else:
                    d[k] = [v]
            for k, v in d.iteritems():
                r = {'logical_file_name':k, 'child_logical_file_name': v}
                result.append(r)
            return result
        finally:
            if conn:
                conn.close()
841317
def api_block_type_list
      arr = BlockType.where("parent_id is null and share = ?", true).reorder(:name).all.collect do |bt|
        { 'name' => bt.name, 'description' => bt.description }
      end      
      render :json => arr      
    end
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
1246541
def get_block(self, usage_id, for_parent=None):
        
        def_id = self.id_reader.get_definition_id(usage_id)
        try:
            block_type = self.id_reader.get_block_type(def_id)
        except NoSuchDefinition:
            raise NoSuchUsage(repr(usage_id))
        keys = ScopeIds(self.user_id, block_type, def_id, usage_id)
        block = self.construct_xblock(block_type, keys, for_parent=for_parent)
        return block
629574
def getSrcBlockParents(self, url, block):
        
        #blockname = block.replace("#", urllib.quote_plus('#'))
        #resturl = "%s/blockparents?block_name=%s" % (url, blockname)
        params={'block_name':block}
        return cjson.decode(self.callDBSService(url, 'blockparents', params, {}))
570767
def get_catchup_block_ids(self, last_known_block_id):
        '''
        
        '''
        # If latest known block is not the current chain head, catch up
        catchup_up_blocks = []
        chain_head = self._block_store.chain_head
        if chain_head and last_known_block_id != chain_head.identifier:
            # Start from the chain head and get blocks until we reach the
            # known block
            for block in self._block_store.get_predecessor_iter():
                # All the blocks if NULL_BLOCK_IDENTIFIER
                if last_known_block_id != NULL_BLOCK_IDENTIFIER:
                    if block.identifier == last_known_block_id:
                        break
                catchup_up_blocks.append(block.identifier)

        return list(reversed(catchup_up_blocks))
329600
def get_children(engine, parent_ids, rank='species', schema=None):
    

    if not parent_ids:
        return []

    nodes = schema + '.nodes' if schema else 'nodes'
    names = schema + '.names' if schema else 'names'

    cmd = ('select tax_id, tax_name, rank '
           'from {} join {} using (tax_id) '
           'where parent_id = :tax_id and is_primary').format(nodes, names)

    species = []
    for parent_id in parent_ids:
        result = engine.execute(sqlalchemy.sql.text(cmd), tax_id=parent_id)
        keys = list(result.keys())
        rows = [dict(list(zip(keys, row))) for row in result.fetchall()]
        for r in rows:
            if r['rank'] == rank and 'sp.' not in r['tax_name']:
                species.append(r)
        others = [r for r in rows if r['rank'] not in (rank, 'no_rank')]
        if others:
            _, s = get_children(engine, [r['tax_id'] for r in others])
            species.extend(s)

    return keys, species
49353
def get_pid_from_request(cls, changelist, request):
        
        val = request.GET.get(cls.PARENT_ID_QS_PARAM, False)
        pid = val or None

        try:
            del changelist.params[cls.PARENT_ID_QS_PARAM]

        except KeyError:
            pass

        return pid
1112970
def get_subdomains_count(db_path=None, zonefiles_dir=None):
    
    opts = get_blockstack_opts()
    if not is_subdomains_enabled(opts):
        log.warn("Subdomain support is disabled")
        return None

    if db_path is None:
        db_path = opts['subdomaindb_path']

    if zonefiles_dir is None:
        zonefiles_dir = opts['zonefiles']

    db = SubdomainDB(db_path, zonefiles_dir)
    return db.get_subdomains_count()
538260
def parents(self, alias, bank_id):
        
        return self._root + self._safe_alias(alias) + '/parent/ids/' + bank_id