根据book_idx计算开始和结束的chapter id
        :param book_idx:
        :type int:
        :return:
        :rtype:
176124
def _start_end_of_index(self, book_idx):
        
        start = (book_idx - 1) * self._max_chapters
        end = min(book_idx * self._max_chapters, len(self._chapters))
        return (start, end)
897327
def _index_into(self, idx, data):
        
        try:
            if is_dataframe(data):
                # Assume column indexing
                return data[idx]
            # Otherwise assume numpy array-like indexing
            return data[:,idx]
        except Exception as e:
            raise IndexError(
                "could not index column '{}' into type {}: {}".format(
                    self.columns, data.__class__.__name__, e
            ))
769613
def _handle_result_by_index(self, idx):
        
        if idx < 0:
            return None
        opts = dict(self.options)
        skip = opts.pop('skip', 0)
        limit = opts.pop('limit', None)
        py_to_couch_validate('skip', skip)
        py_to_couch_validate('limit', limit)
        if limit is not None and idx >= limit:
            # Result is out of range
            return dict()
        return self._ref(skip=skip+idx, limit=1, **opts)
1191212
def update_book(self, id, body, doc_type='book'):
        ''' 
        '''
        # note that we are NOT overwriting all the _source, just merging
        book = self.get_book_by_id(id)
        book['_source'].update(body)
        validated = validate_book(book['_source'])
        ret = self.es.index(index=self.index_name, id=id,
                            doc_type=doc_type, body=validated, version=book['_version'])
        return ret
1224051
def column_cells(self, column_idx):
        
        cells = self._cells
        idxs = range(column_idx, len(cells), self._column_count)
        return [cells[idx] for idx in idxs]
596389
function write_BrtBookView(idx, o) {
	if(!o) o = new_buf(29);
	o.write_shift(-4, 0);
	o.write_shift(-4, 460);
	o.write_shift(4,  28800);
	o.write_shift(4,  17600);
	o.write_shift(4,  500);
	o.write_shift(4,  idx);
	o.write_shift(4,  idx);
	var flags = 0x78;
	o.write_shift(1,  flags);
	return o.length > o.l ? o.slice(0, o.l) : o;
}
462322
def get_or_add_dLbl_for_point(self, idx):
        
        matches = self.xpath('c:dLbl[c:idx[@val="%d"]]' % idx)
        if matches:
            return matches[0]
        return self._insert_dLbl_in_sequence(idx)
1281539
public int bookmarkToIndex(Object bookmark, int iHandleType)
    {
        DataRecord thisBookmark = null;
        if (bookmark == null)
            return -1;
        for (int iTargetPosition = m_iCurrentRecordStart; iTargetPosition < m_iCurrentRecordEnd; iTargetPosition++)
        {
            thisBookmark = (DataRecord)this.elementAt(iTargetPosition);
            if (thisBookmark != null)
                if (bookmark.equals(thisBookmark.getHandle(iHandleType)))
                    return iTargetPosition;
        }
//+ Still not found, do a binary search through the recordlist for a matching key
        return -1;  // Not found
    }
848515
def anchor_idx(self):
        
        anchor = self.anchor
        if anchor in ["top", "bottom"]:
            return anchor
        return self.valid_elements.get_by_id(anchor).index_in_valids
106585
def book_name(self, number):
        ''''''
        try:
            name = self.cur.execute("SELECT name FROM book WHERE number = ?;", [number]).fetchone()
        except:
            self.error("cannot look up name of book number %s" % number)
        return(str(name[0]))
1158137
def verse_lookup(self, book_name, book_chapter, verse, cache_chapter = True):
        
        verses_list = self.get_chapter(
            book_name,
            str(book_chapter),
            cache_chapter = cache_chapter)
        return verses_list[int(verse) - 1]
397192
def get_dLbl(self, idx):
        
        dLbls = self.dLbls
        if dLbls is None:
            return None
        return dLbls.get_dLbl_for_point(idx)
652116
def idx_sequence(self):
        
        return [x[1] for x in sorted(zip(self._record, list(range(len(self._record)))))]
1302601
def index(self, i):
        
        if self.count(i) == 0:
            raise ValueError("{} is not in range".format(i))
        return (i - self._start) // self._step
709185
def _extract_pub(l, _root):
    
    logger_ts.info("enter _extract_pub")
    # For each publication entry
    for idx, pub in enumerate(l):
        logger_ts.info("processing publication #: {}".format(idx))
        # Get author data first, since that's the most ambiguously structured data.
        _root = _extract_authors(pub, idx, _root)
        # Go through data of this publication
        for k, v in pub.items():
            # Case 1: DOI ID. Don't need the rest of 'identifier' dict
            if k == 'identifier':
                try:
                    _root['pub' + str(idx + 1) + '_DOI'] = v[0]['id']
                except KeyError as e:
                    logger_ts.warn("_extract_pub: KeyError: no doi id: {}, {}".format(v, e))
            # Case 2: All other string entries
            else:
                if k != 'authors' and k != 'author':
                    _root['pub' + str(idx + 1) + '_' + k] = v
    return _root
1303304
def marker_index_document_id(self):
        
        params = '%s:%s:%s' % (self.index, self.doc_type, self.update_id)
        return hashlib.sha1(params.encode('utf-8')).hexdigest()
767768
def get_parent_book_nodes(self):
        
        parent_book_nodes = []
        for node in self._my_map['parentNodes']:
            parent_book_nodes.append(BookNode(
                node._my_map,
                runtime=self._runtime,
                proxy=self._proxy,
                lookup_session=self._lookup_session))
        return BookNodeList(parent_book_nodes)