The essence of the reply_to_parent job...
974971
def do_reply_to_parent(workitem, delete=true)

      # propagate the cancel "flavour" back, so that one can know
      # why a branch got cancelled.

      flavour = if @msg.nil?
        nil
      elsif @msg['action'] == 'cancel'
        @msg['flavour'] || 'cancel'
      elsif h.state.nil?
        nil
      else
        @msg['flavour']
      end

      # deal with the timers and the schedules

      %w[ timeout_schedule_id job_id ].each do |sid|
        @context.storage.delete_schedule(h[sid]) if h[sid]
      end
        #
        # legacy schedule ids, to be removed for ruote 2.4.0

      @context.storage.delete_schedule(h.schedule_id) if h.schedule_id
        #
        # time-driven exps like cron, wait and once now all use h.schedule_id

      h.timers.each do |schedule_id, action|
        @context.storage.delete_schedule(schedule_id)
      end if h.timers

      # cancel flanking expressions if any

      cancel_flanks(h.state == 'dying' ? 'kill' : nil)

      # trigger or vanilla reply

      if h.state == 'failing' # on_error is implicit (#do_fail got called)

        trigger('on_error', workitem)

      elsif h.state == 'cancelling' && h.on_cancel

        trigger('on_cancel', workitem)

      elsif h.state == 'cancelling' && h.on_re_apply

        trigger('on_re_apply', workitem)

      elsif h.state == 'timing_out' && h.on_timeout

        trigger('on_timeout', workitem)

      elsif h.state == nil && h.on_reply

        trigger('on_reply', workitem)

      elsif h.flanking && h.state.nil?
        #
        # do vanish

        do_unpersist

      elsif h.lost && h.state.nil?
        #
        # do not reply, sit here (and wait for cancellation probably)

        do_persist

      elsif h.trigger && workitem['fields']["__#{h.trigger}__"]
        #
        # the "second take"

        trigger(h.trigger, workitem)

      else # vanilla reply

        filter(workitem) if h.state.nil?

        f = h.state.nil? && attribute(:vars_to_f)
        Ruote.set(workitem['fields'], f, h.variables) if f

        workitem['sub_wf_name'] = h.applied_workitem['sub_wf_name']
        workitem['sub_wf_revision'] = h.applied_workitem['sub_wf_revision']

        leave_tag(workitem) if h.tagname

        (do_unpersist || return) if delete
          # remove expression from storage

        if h.parent_id && ! h.attached

          @context.storage.put_msg(
            'reply',
            'fei' => h.parent_id,
            'workitem' => workitem.merge!('fei' => h.fei),
            'updated_tree' => h.updated_tree, # nil most of the time
            'flavour' => flavour)

        else

          @context.storage.put_msg(
            (h.forgotten || h.attached) ? 'ceased' : 'terminated',
            'wfid' => h.fei['wfid'],
            'fei' => h.fei,
            'workitem' => workitem,
            'variables' => h.variables,
            'flavour' => flavour)

          if
            h.state.nil? &&
            h.on_terminate == 'regenerate' &&
            ! (h.forgotten || h.attached)
          then
            @context.storage.put_msg(
              'regenerate',
              'wfid' => h.fei['wfid'],
              'tree' => h.original_tree,
              'workitem' => workitem,
              'variables' => h.variables,
              'flavour' => flavour)
              #'stash' =>
          end
        end
      end
    end
452115
def _handle_inspect_reply(self, rep):
        
        cursor = self._get_cursor()
        info = self._request_info.get('call_tip')
        if info and info.id == rep['parent_header']['msg_id'] and \
          info.pos == cursor.position():
            content = rep['content']
            if content.get('status') == 'ok' and content.get('found', False):
                signature = self.get_signature(content)
                if signature:
                    # TODO: Pass the language from the Console to the calltip
                    self._control.show_calltip(signature, color='#999999',
                                               is_python=True)
1278252
def responds_to_parent(&block)
      yield
      return unless performed?

      # Either pull out a redirect or the request body
      script =
        if response.headers['Location']
          "document.location.href = '#{self.class.helpers.escape_javascript response.headers.delete('Location').to_s}'"
        else
          response.body || ''
        end
      response.status = 200 if (300...400).cover? response.status

      # Eval in parent scope and replace document location of this frame
      # so back button doesn't replay action on targeted forms
      # loc = document.location to be set after parent is updated for IE
      # with(window.parent) - pull in variables from parent window
      # setTimeout - scope the execution in the windows parent for safari
      # window.eval - legal eval for Opera
      script = "<html><body><script type='text/javascript' charset='utf-8'>
        var loc = document.location;
        with(window.parent) { setTimeout(function() { window.eval('#{self.class.helpers.escape_javascript script}'); window.loc && loc.replace('about:blank'); }, 1) }
      </script></body></html>"

      # Clear out the previous render to prevent double render and then render
      if respond_to?(:erase_results, true)
        erase_results
      else
        instance_variable_set(:@_response_body, nil)
      end

      # We're returning HTML instead of JS now, content_type needed if not inside respond_to block
      render html: script.html_safe, content_type: 'text/html' # rubocop:disable Rails/OutputSafety
    end
928548
public function ReplyForm()
    {
        // Ensure replies are enabled
        if (!$this->getRepliesEnabled()) {
            return null;
        }

        // Check parent is available
        $parent = $this->Parent();
        if (!$parent || !$parent->exists()) {
            return null;
        }

        // Build reply controller
        $controller = CommentingController::create();
        $controller->setOwnerRecord($parent);
        $controller->setParentClass($parent->ClassName);
        $controller->setOwnerController(Controller::curr());

        return $controller->ReplyForm($this);
    }
1158139
def auto_reply_message(self):
        
        if self._auto_reply is None:
            r = requests.get('https://outlook.office.com/api/v2.0/me/MailboxSettings/AutomaticRepliesSetting',
                             headers=self._headers)
            check_response(r)
            self._auto_reply = r.json().get('InternalReplyMessage')

        return self._auto_reply
749547
def lookup(self, req, parent, name):
        
        self.reply_err(req, errno.ENOENT)
1335251
def do_email_reply(self, comment, entry, site):
        
        if not self.email_reply:
            return

        exclude_list = (
            self.mail_comment_notification_recipients
            + [author.email for author in entry.authors.all()]
            + [comment.email]
        )
        recipient_list = (
            set([other_comment.email
                 for other_comment in entry.comments
                 if other_comment.email])
            - set(exclude_list)
        )
        if not recipient_list:
            return

        template = loader.get_template(
            'comments/zinnia/entry/email/reply.txt')
        context = {
            'comment': comment,
            'entry': entry,
            'site': site,
            'protocol': PROTOCOL
        }
        subject = _('[%(site)s] New comment posted on "%(title)s"') % \
            {'site': site.name, 'title': entry.title}
        message = template.render(context)

        mail = EmailMessage(
            subject, message,
            settings.DEFAULT_FROM_EMAIL,
            bcc=recipient_list)
        mail.send(fail_silently=not settings.DEBUG)
1224083
def reply(self, text, loop_ms=500, max_len=None):
        """"""
        if type(text) != types.UnicodeType:
            # Assume that non-Unicode text is encoded as utf-8, which
            # should be somewhat safe in the modern world.
            text = text.decode("utf-8", "ignore")

        tokens = self.tokenizer.split(text)
        input_ids = map(self.graph.get_token_by_text, tokens)

        # filter out unknown words and non-words from the potential pivots
        pivot_set = self._filter_pivots(input_ids)

        # Conflate the known ids with the stems of their words
        if self.stemmer is not None:
            self._conflate_stems(pivot_set, tokens)

        # If we didn't recognize any word tokens in the input, pick
        # something random from the database and babble.
        if len(pivot_set) == 0:
            pivot_set = self._babble()

        score_cache = {}

        best_score = -1.0
        best_reply = None

        # Loop for approximately loop_ms milliseconds. This can either
        # take more (if the first reply takes a long time to generate)
        # or less (if the _generate_replies search ends early) time,
        # but it should stay roughly accurate.
        start = time.time()
        end = start + loop_ms * 0.001
        count = 0

        all_replies = []

        _start = time.time()
        for edges, pivot_node in self._generate_replies(pivot_set):
            reply = Reply(self.graph, tokens, input_ids, pivot_node, edges)

            if max_len and self._too_long(max_len, reply):
                continue

            key = reply.edge_ids
            if key not in score_cache:
                with trace_us("Brain.evaluate_reply_us"):
                    score = self.scorer.score(reply)
                    score_cache[key] = score
            else:
                # skip scoring, we've already seen this reply
                score = -1

            if score > best_score:
                best_reply = reply
                best_score = score

            # dump all replies to the console if debugging is enabled
            if log.isEnabledFor(logging.DEBUG):
                all_replies.append((score, reply))

            count += 1
            if time.time() > end:
                break

        if best_reply is None:
            # we couldn't find any pivot words in _babble(), so we're
            # working with an essentially empty brain. Use the classic
            # MegaHAL reply:
            return "I don't know enough to answer you yet!"

        _time = time.time() - _start

        self.scorer.end(best_reply)

        if log.isEnabledFor(logging.DEBUG):
            replies = [(score, reply.to_text())
                       for score, reply in all_replies]
            replies.sort()

            for score, text in replies:
                log.debug("%f %s", score, text)

        trace("Brain.reply_input_token_count", len(tokens))
        trace("Brain.known_word_token_count", len(pivot_set))

        trace("Brain.reply_us", _time)
        trace("Brain.reply_count", count, _time)
        trace("Brain.best_reply_score", int(best_score * 1000))
        trace("Brain.best_reply_length", len(best_reply.edge_ids))

        log.debug("made %d replies (%d unique) in %f seconds"
                  % (count, len(score_cache), _time))

        if len(text) > 60:
            msg = text[0:60] + "..."
        else:
            msg = text

        log.info("[%s] %d %f", msg, count, best_score)

        # look up the words for these tokens
        with trace_us("Brain.reply_words_lookup_us"):
            text = best_reply.to_text()

        return text
1108890
def responds_to_parent
      yield

      if performed?
        # We're returning HTML instead of JS or XML now
        response.headers['Content-Type'] = 'text/html; charset=UTF-8'

        # Either pull out a redirect or the request body
        script = if response.headers['Location']
                   # TODO: erase_redirect_results is missing in rails 3.0 has to be implemented
                   # erase redirect
                   "document.location.href = #{location.to_s.inspect}"
                 else
                   response.body
        end

        # Escape quotes, linebreaks and slashes, maintaining previously escaped slashes
        # Suggestions for improvement?
        script = (script || '')
                 .gsub('\\', '\\\\\\')
                 .gsub(/\r\n|\r|\n/, '\\n')
                 .gsub(/['"]/, '\\\\\&')
                 .gsub('</script>', '</scr"+"ipt>')

        # Clear out the previous render to prevent double render
        response.request.env['action_controller.instance'].instance_variable_set(:@_response_body, nil)

        # Eval in parent scope and replace document location of this frame
        # so back button doesn't replay action on targeted forms
        # loc = document.location to be set after parent is updated for IE
        # with(window.parent) - pull in variables from parent window
        # setTimeout - scope the execution in the windows parent for safari
        # window.eval - legal eval for Opera
        render plain: "<html><body><script type='text/javascript' charset='utf-8'>
  with(window.parent) { setTimeout(function() { window.eval('#{script}'); }, 1) };
  </script></body></html>".html_safe
      end
    end
416498
def reply_to(self, value):
        
        if isinstance(value, str):
            value = ReplyTo(value, None)
        if isinstance(value, tuple):
            value = ReplyTo(value[0], value[1])
        self._reply_to = value
542391
def parents(self, p_todo, p_only_direct=False):
        
        parents = self._depgraph.incoming_neighbors(
            hash(p_todo), not p_only_direct)
        return [self._tododict[parent] for parent in parents]
1107146
def parents(self):
        
        q = self.__parent__.parents()
        q.put(self)
        return q
374807
def parents
      @parents ||= begin
        arr = [@options[:parent] || @wiki.repo.commit(@wiki.ref)]
        arr.flatten!
        arr.compact!
        arr
      end
    end
474995
def parent(self, parent_object, limit_parent_language=True):
        
        return self.all().parent(parent_object, limit_parent_language)
216991
def rename(self, req, parent, name, newparent, newname):
        
        self.reply_err(req, errno.EROFS)
184967
def mknod(self, req, parent, name, mode, rdev):
        
        self.reply_err(req, errno.EROFS)
1217204
public function ReplyForm($comment)
    {
        // Enables multiple forms with different names to use the same handler
        $form = $this->CommentsForm();
        $form->setName('ReplyForm_' . $comment->ID);
        $form->setHTMLID(null);
        $form->addExtraClass('reply-form');

        // Load parent into reply form
        $form->loadDataFrom([
            'ParentCommentID' => $comment->ID
        ]);

        // Customise action
        $form->setFormAction($this->Link('reply', $comment->ID));

        $this->extend('updateReplyForm', $form);

        return $form;
    }