Re-download all submissions and reset the page index
340910
def refresh_content(self, order=None, name=None):
        
        order = order or self.content.order

        # Preserve the query if staying on the current page
        if name is None:
            query = self.content.query
        else:
            query = None

        name = name or self.content.name

        # Hack to allow an order specified in the name by prompt_subreddit() to
        # override the current default
        if order == 'ignore':
            order = None

        with self.term.loader('Refreshing page'):
            self.content = SubredditContent.from_name(
                self.reddit, name, self.term.loader, order=order, query=query)
        if not self.term.loader.exception:
            self.nav = Navigator(self.content.get)
122531
function resetState() {
                    setStatus(DataSourceStatus.ready);

                    // Track count promises
                    getCountPromise = null;

                    // Track whether listDataAdapter.endEdits needs to be called
                    beginEditsCalled = false;

                    // Track whether finishNotifications should be called after each edit
                    editsInProgress = false;

                    // Track whether the first queued edit should be attempted
                    firstEditInProgress = false;

                    // Queue of edis that have yet to be completed
                    editQueue = {};
                    editQueue.next = editQueue;
                    editQueue.prev = editQueue;

                    // Track whether there are currently edits queued
                    editsQueued = false;

                    // If an edit has returned noResponse, the edit queue will be reapplied when the next refresh is requested
                    waitForRefresh = false;

                    // Change to count while multiple edits are taking place
                    countDelta = 0;

                    // True while the indices are temporarily in a bad state due to multiple edits
                    indexUpdateDeferred = false;

                    // Next temporary key to use
                    nextTempKey = 0;

                    // Set of fetches for which results have not yet arrived
                    fetchesInProgress = {};

                    // Queue of complete callbacks for fetches
                    fetchCompleteCallbacks = [];

                    // Tracks the count returned explicitly or implicitly by the data adapter
                    knownCount = CountResult.unknown;

                    // Sentinel objects for list of slots
                    // Give the start sentinel an index so we can always use predecessor + 1.
                    slotsStart = {
                        firstInSequence: true,
                        lastInSequence: true,
                        index: -1
                    };
                    slotListEnd = {
                        firstInSequence: true,
                        lastInSequence: true
                    };
                    slotsEnd = {
                        firstInSequence: true,
                        lastInSequence: true
                    };
                    slotsStart.next = slotListEnd;
                    slotListEnd.prev = slotsStart;
                    slotListEnd.next = slotsEnd;
                    slotsEnd.prev = slotListEnd;

                    // Map of request IDs to slots
                    handleMap = {};

                    // Map of keys to slots
                    keyMap = {};

                    // Map of indices to slots
                    indexMap = {};
                    indexMap[-1] = slotsStart;

                    // Count of slots that have been released but not deleted
                    releasedSlots = 0;

                    lastSlotReleased = null;

                    // At most one call to reduce the number of refresh slots should be posted at any given time
                    reduceReleasedSlotCountPosted = false;

                    // Multiple refresh requests are coalesced
                    refreshRequested = false;

                    // Requests do not cause fetches while a refresh is in progress
                    refreshInProgress = false;

                    // Refresh requests yield the same promise until a refresh completes
                    refreshSignal = null;
                }
1152518
def reload_site(self):
        """"""
        rev = int(self.db.get('site:rev'))
        if rev != self.revision and self.db.exists('site:rev'):
            timeline = self.db.lrange('site:timeline', 0, -1)
            self._timeline = []
            for data in timeline:
                data = json.loads(data.decode('utf-8'))
                self._timeline.append(Post(data[0], self.config, data[1],
                                           data[2], data[3], self.messages,
                                           self._site.compilers[data[4]]))

            self._read_indexlist('posts')
            self._read_indexlist('all_posts')
            self._read_indexlist('pages')

            self.revision = rev
            self.logger.info("Site updated to revision {0}.".format(rev))
        elif rev == self.revision and self.db.exists('site:rev'):
            pass
        else:
            self.logger.warn("Site needs rescanning.")
237475
def clear(self):
        """"""
        if self.prefix is not None:
            self._current_page = [self.prefix]
            self._count = len(self.prefix) + 1 # prefix + newline
        else:
            self._current_page = []
            self._count = 0
        self._pages = []
607275
def reset
      self.time = if config["time"]
                    Utils.parse_date(config["time"].to_s, "Invalid time in _config.yml.")
                  else
                    Time.now
                  end
      self.layouts = {}
      self.pages = []
      self.static_files = []
      self.data = {}
      @post_attr_hash = {}
      @site_data = nil
      @collections = nil
      @documents = nil
      @docs_to_write = nil
      @regenerator.clear_cache
      @liquid_renderer.reset
      @site_cleaner = nil
      frontmatter_defaults.reset

      raise ArgumentError, "limit_posts must be a non-negative number" if limit_posts.negative?

      Jekyll::Cache.clear_if_config_changed config
      Jekyll::Hooks.trigger :site, :after_reset, self
    end
251573
def refresh(self):
        '''
        
        '''
        kwd = {
            'pager': '',
            'title': '最近文档',
        }
        self.render('wiki_page/wiki_list.html',
                    view=MWiki.query_dated(16),
                    format_date=tools.format_date,
                    kwd=kwd,
                    userinfo=self.userinfo)
808794
def reset_bars(self):
        
        self.url_progressbar.reset()
        self.url_progressbar.show([0, 0])

        self.issn_progressbar.reset()

        self.urlbox_error.reset()
        self.issnbox_error.reset()

        InputController._reset_typeaheads()
471862
def open_submission(self):
        
        url = self.get_selected_item().get('submission_permalink')
        if url:
            self.selected_page = self.open_submission_page(url)
705865
def copy_reset(self):
        """"""
        # Reset settings
        self._filters = []
        self._filter_or = False
        self._paginate = True
        self._paginate_count = 0
        self._result_count = None
        self._result_limit = 500
        self._result_start = 0
217916
def Reset(self):
    """"""
    self._displayed = 0
    self._currentpagelines = 0
    self._lastscroll = 1
    self._lines_to_show = self._cli_lines
1281649
public void reset(int resultCount, int pageSize, boolean fireChanged) {

        m_lastPage = resultCount == 0 ? 0 : (resultCount - 1) / pageSize;
        m_resultCount = resultCount;
        m_pageSize = pageSize;
        setPage(0, false);
        updateButtons();
        if (fireChanged) {
            firePageChanged(0);
        }
    }
27839
function refreshIndex () {
    ctrl.selectedIndex = getNearestSafeIndex(ctrl.selectedIndex);
    ctrl.focusIndex    = getNearestSafeIndex(ctrl.focusIndex);
  }
1081704
def download(self):
    """"""
    # Structure of the download directory:
    # submission_dir=LOCAL_SUBMISSIONS_DIR/submission_id
    # submission_dir/s.ext   <-- archived submission
    # submission_dir/extracted      <-- extracted submission

    # Check whether submission is already there
    if self.extracted_submission_dir:
      return
    self.submission_dir = os.path.join(LOCAL_SUBMISSIONS_DIR,
                                       self.submission_id)
    if (os.path.isdir(self.submission_dir)
        and os.path.isdir(os.path.join(self.submission_dir, 'extracted'))):
      # submission already there, just re-read metadata
      self.extracted_submission_dir = os.path.join(self.submission_dir,
                                                   'extracted')
      with open(os.path.join(self.extracted_submission_dir, 'metadata.json'),
                'r') as f:
        meta_json = json.load(f)
      self.container_name = str(meta_json[METADATA_CONTAINER])
      self.entry_point = str(meta_json[METADATA_ENTRY_POINT])
      return
    # figure out submission location in the Cloud and determine extractor
    submission_cloud_path = os.path.join('gs://', self.storage_bucket,
                                         self.submission.path)
    extract_command_tmpl = None
    extension = None
    for k, v in iteritems(EXTRACT_COMMAND):
      if submission_cloud_path.endswith(k):
        extension = k
        extract_command_tmpl = v
        break
    if not extract_command_tmpl:
      raise WorkerError('Unsupported submission extension')
    # download archive
    try:
      os.makedirs(self.submission_dir)
      tmp_extract_dir = os.path.join(self.submission_dir, 'tmp')
      os.makedirs(tmp_extract_dir)
      download_path = os.path.join(self.submission_dir, 's' + extension)
      try:
        logging.info('Downloading submission from %s to %s',
                     submission_cloud_path, download_path)
        shell_call(['gsutil', 'cp', submission_cloud_path, download_path])
      except subprocess.CalledProcessError as e:
        raise WorkerError('Can''t copy submission locally', e)
      # extract archive
      try:
        shell_call(extract_command_tmpl,
                   src=download_path, dst=tmp_extract_dir)
      except subprocess.CalledProcessError as e:
        # proceed even if extraction returned non zero error code,
        # sometimes it's just warning
        logging.warning('Submission extraction returned non-zero error code. '
                        'It may be just a warning, continuing execution. '
                        'Error: %s', e)
      try:
        make_directory_writable(tmp_extract_dir)
      except subprocess.CalledProcessError as e:
        raise WorkerError('Can''t make submission directory writable', e)
      # determine root of the submission
      tmp_root_dir = tmp_extract_dir
      root_dir_content = [d for d in os.listdir(tmp_root_dir)
                          if d != '__MACOSX']
      if (len(root_dir_content) == 1
          and os.path.isdir(os.path.join(tmp_root_dir, root_dir_content[0]))):
        tmp_root_dir = os.path.join(tmp_root_dir, root_dir_content[0])
      # move files to extract subdirectory
      self.extracted_submission_dir = os.path.join(self.submission_dir,
                                                   'extracted')
      try:
        shell_call(['mv', os.path.join(tmp_root_dir),
                    self.extracted_submission_dir])
      except subprocess.CalledProcessError as e:
        raise WorkerError('Can''t move submission files', e)
      # read metadata file
      try:
        with open(os.path.join(self.extracted_submission_dir, 'metadata.json'),
                  'r') as f:
          meta_json = json.load(f)
      except IOError as e:
        raise WorkerError(
            'Can''t read metadata.json for submission "{0}"'.format(
                self.submission_id),
            e)
      try:
        self.container_name = str(meta_json[METADATA_CONTAINER])
        self.entry_point = str(meta_json[METADATA_ENTRY_POINT])
        type_from_meta = METADATA_JSON_TYPE_TO_TYPE[meta_json[METADATA_TYPE]]
      except KeyError as e:
        raise WorkerError('Invalid metadata.json file', e)
      if type_from_meta != self.type:
        raise WorkerError('Inconsistent submission type in metadata: '
                          + type_from_meta + ' vs ' + self.type)
    except WorkerError as e:
      self.extracted_submission_dir = None
      sudo_remove_dirtree(self.submission_dir)
      raise
370288
def index():
    
    context = {'postform': NewPostForm(),
               'pageform': NewPageForm(),
               'delform': DeleteForm()}

    n = request.args.get('all')
    if n is None:
        wants_now = None
    else:
        wants_now = n == '1'

    if wants_now is None and current_user.wants_all_posts:
        wants = True
    else:
        wants = wants_now

    if current_user.can_edit_all_posts and wants:
        posts = site.all_posts
        pages = site.pages
    else:
        wants = False
        posts = []
        pages = []
        for p in site.timeline:
            if (p.meta('author.uid') and
                    p.meta('author.uid') != str(current_user.uid)):
                continue
            if p.is_post:
                posts.append(p)
            else:
                pages.append(p)

    context['posts'] = posts
    context['pages'] = pages
    context['title'] = 'Posts & Pages'
    context['wants'] = wants
    return render('coil_index.tmpl', context)
203455
function (pageRequest) {
            var url = pageRequest.url;
            if (ariaUtilsType.isString(url)) {
                this._addInCache(url, pageRequest.pageId);
                if (!this._poppedState) {
                    if (pageRequest.replace) {
                        this._history.replaceState(pageRequest.data, pageRequest.title, url);
                    } else {
                        this._history.pushState(pageRequest.data, pageRequest.title, url);
                    }
                }
                this._poppedState = false;
            }
        }
118163
def reset_experiment(experiment):
    """"""
    redis = _get_redis_connection()
    experiment = Experiment.find(redis, experiment)
    if experiment:
        experiment.reset()
    return redirect(url_for('.index'))
812178
function(err, res) {
    var queuedLink = null;
    if (res && res.hits && res.hits.hits.length) {
      var hit = res.hits.hits[0]._source;
      var queued = hit.queued;
      queuedLink = { uri: hit.uri, queued: queued, total: res.hits.total };
      queued.lastAttempt = new Date().toISOString();
      queued.attempts = queued.attempts + 1;
      hit.queued = queued;

      // update accesses
      contentLib.indexContentItem(hit, {state: 'queued', member: queued.member}, function(err, res) {
        // process the link
        if (!err) {
          callback(null, queuedLink);
        } else {
          utils.passingError(err);
        }
      });
    } else {
      callback(err, null);
    }
  }