Loads a memory object from memory.

        :param page_idx: the index into the page
        :returns: a tuple of the object
548972
def load_mo(self, state, page_idx):
        

        try:
            key = next(self._storage.irange(maximum=page_idx, reverse=True))
        except StopIteration:
            return None
        else:
            return self._storage[key]
233451
def load_data(self, idx):
        """"""
        for name in self:
            ndim = getattr(self, '_%s_ndim' % name)
            diskflag = getattr(self, '_%s_diskflag' % name)
            ramflag = getattr(self, '_%s_ramflag' % name)
            if diskflag:
                file_ = getattr(self, '_%s_file' % name)
                length_tot = 1
                shape = []
                for jdx in range(ndim):
                    length = getattr(self, '_%s_length_%s' % (name, jdx))
                    length_tot *= length
                    shape.append(length)
                raw = file_.read(length_tot*8)
                values = struct.unpack(length_tot*'d', raw)
                if ndim:
                    values = numpy.array(values).reshape(shape)
                else:
                    values = values[0]
            elif ramflag:
                array = getattr(self, '_%s_array' % name)
                values = array[idx]
            if diskflag or ramflag:
                if ndim == 0:
                    setattr(self, name, values)
                else:
                    getattr(self, name)[:] = values
530207
private void loadIndexInMemory() throws Exception {
		// create the memory objects with the appropriate initial size
		if (numProductCentroids <= 256) {
			pqByteCodes = new TByteArrayList(maxNumVectors * numSubVectors);
		} else {
			pqShortCodes = new TShortArrayList(maxNumVectors * numSubVectors);
		}
		long start = System.currentTimeMillis();
		System.out.println("Loading persistent index in memory.");

		DatabaseEntry foundKey = new DatabaseEntry();
		DatabaseEntry foundData = new DatabaseEntry();

		ForwardCursor cursor = null;
		if (useDiskOrderedCursor) { // disk ordered cursor
			DiskOrderedCursorConfig docc = new DiskOrderedCursorConfig();
			cursor = iidToPqDB.openCursor(docc);
		} else {
			cursor = iidToPqDB.openCursor(null, null);
		}

		int counter = 0;
		while (cursor.getNext(foundKey, foundData, LockMode.DEFAULT) == OperationStatus.SUCCESS
				&& counter < maxNumVectors) {
			TupleInput input = TupleBinding.entryToInput(foundData);

			if (numProductCentroids <= 256) {
				byte[] code = new byte[numSubVectors];
				for (int i = 0; i < numSubVectors; i++) {
					code[i] = input.readByte();
				}
				pqByteCodes.add(code); // update ram based index
			} else {
				short[] code = new short[numSubVectors];
				for (int i = 0; i < numSubVectors; i++) {
					code[i] = input.readShort();
				}
				pqShortCodes.add(code); // update ram based index
			}
			counter++;
			if (counter % 1000 == 0) {
				System.out.println(counter + " vectors loaded in memory!");
			}
		}
		cursor.close();
		long end = System.currentTimeMillis();
		System.out.println(counter + " vectors loaded in " + (end - start) + " ms!");
	}
496177
def get_page_object_by_id(context, object_type, oid):
    
    if type(oid) != int:
        raise template.TemplateSyntaxError('page_object_by_id tag requires a integer argument')

    selected_object = None

    try:
        try:
            for obj in context['page']['content'][object_type]:
                sid = '{0:>s}:{1:>s}:{2:>s}:{3:>d}'.format(
                    obj.language, context['page']['page'].name, obj.type, oid
                )
                if obj.sid == sid:
                    selected_object = obj
                    break
        except TypeError:
            pass
    except KeyError:
        try:
            try:
                for obj in context['page']['ext_content'][object_type]:
                    sid = '{0:>s}:{1:>s}:{2:>s}:{3:>d}'.format(
                        obj.language, context['page']['page'].name, obj.type, oid
                    )
                    if obj.sid == sid:
                        selected_object = obj
                        break
            except TypeError:
                pass
        except KeyError:
            raise template.TemplateSyntaxError('wrong content type: {0:>s}'.format(object_type))
    return selected_object
677743
def get_row_dict(self, row_idx):
        

        try:
            row = self._rows[row_idx]
        except TypeError:
            row = self._rows[self._row_name_idx[row_idx]]

        if isinstance(row, dict):
            return row

        else:
            if row_idx not in self._row_memo:
                self._row_memo[row_idx] = dict((self._column_name_list[idx], v) for idx, v in enumerate(row) if v != self._default_value)

            return self._row_memo[row_idx]
1106616
def reload_current_page(self, *args, **kwds):
        '''
        '''
        index = self.notebook.get_current_page()
        self.notebook.get_nth_page(index).reload()
1359334
def page_index(self, page_index):
        

        if page_index is None:
            raise ValueError("Invalid value for `page_index`, must not be `None`")
        if page_index > 6:
            raise ValueError("Invalid value for `page_index`, must be a value less than or equal to `6`")
        if page_index < 0:
            raise ValueError("Invalid value for `page_index`, must be a value greater than or equal to `0`")

        self._page_index = page_index
518495
def get_page_content(id):
    
    data = _json.loads(_api.rest("/" + str(id) + "?expand=body.storage"))
    return data["body"]["storage"]["value"]
1350974
def page(self, *args):
        
        for arg in args:
            self.__pages__.append(arg)
        return self
1240217
def loadTopicPageFromER(self, uri):
        
        params = {
            "action": "getTopicPageJson",
            "includeConceptDescription": True,
            "includeTopicPageDefinition": True,
            "includeTopicPageOwner": True,
            "uri": uri
        }
        self.topicPage = self._createEmptyTopicPage()
        self.concept = self.eventRegistry.jsonRequest("/json/topicPage", params)
        self.topicPage.update(self.concept.get("topicPage", {}))
183884
def get_page_objects_by_type(context, object_type):
    
    try:
        objects = context['page']['content'][object_type]
    except KeyError:
        raise template.TemplateSyntaxError('wrong content type: {0:>s}'.format(object_type))
    return objects
398564
def select(self, idx):
        
        data = {}
        for k in self.data:
            data[k] = self.data[k][idx]
        return self._return(data=data)
625563
async def index_page(self, request):
        
        context = {"initial_state": self.schema.to_json()}

        return render_template(
            self.template,
            request,
            context,
            app_key=TEMPLATE_APP_KEY,
        )
126776
def load(self, fobj, index=None):
        
        if index is None:
            index = self._get_tab_index()
        page = self.pages[index]

        if fobj is None:
            return


        if not isinstance(fobj, tuple(page.clss_load)):
            raise RuntimeError('Object to load must be in {0!s} (not a {1!s})'.format(
             [x.__name__ for x in page.clss_load], fobj.__class__.__name__))

        page.editor.load(fobj)
        self._update_gui_text_tabs()
154778
def iter(self, pages=None):
        '''
        '''
        i = self._pages()
        if pages is not None:
            i = itertools.islice(i, pages)
        return i
236452
def get_method_by_idx(self, idx):
        
        if self.__cached_methods_idx == None:
            self.__cached_methods_idx = {}
            for i in self.classes.class_def:
                for j in i.get_methods():
                    self.__cached_methods_idx[j.get_method_idx()] = j

        try:
            return self.__cached_methods_idx[idx]
        except KeyError:
            return None
1085582
def _load(self, id, data):
        
        if isinstance(data, bytes):  # pragma: no cover Python >= 3.0
            data = data.decode('utf-8')

        document = json.loads(data)
        document['_id'] = id
        return document