Alternate version of Index that uses the embed master view.
175882
public function Embed($DiscussionID = '', $DiscussionStub = '', $Offset = '', $Limit = '') {
      $this->Title(T('Comments'));
      $this->AddDefinition('DoInform', '0'); // Suppress inform messages on embedded page.
      $this->AddDefinition('SelfUrl', Gdn::Request()->PathAndQuery());
      $this->AddDefinition('Embedded', TRUE);
      $this->CanEditComments = FALSE; // Don't show the comment checkboxes on the embed comments page
      $this->Theme = C('Garden.CommentsTheme', $this->Theme);
      Gdn_Theme::Section('Comments');

      // Add some css to help with the transparent bg on embedded comments
      if ($this->Head)
         $this->Head->AddString('<style type="text/css">
body { background: transparent !important; }
</style>');
      $Session = Gdn::Session();
      $this->AddJsFile('jquery.gardenmorepager.js');
      $this->AddJsFile('jquery.autogrow.js');
      $this->AddJsFile('discussion.js');
      $this->RemoveJsFile('autosave.js');
      $this->MasterView = 'empty';
      
      // Define incoming variables (prefer querystring parameters over method parameters)
      $DiscussionID = (is_numeric($DiscussionID) && $DiscussionID > 0) ? $DiscussionID : 0;
      $DiscussionID = GetIncomingValue('vanilla_discussion_id', $DiscussionID);
      $Offset = GetIncomingValue('Offset', $Offset);
      $Limit = GetIncomingValue('Limit', $Limit);
      $vanilla_identifier = GetIncomingValue('vanilla_identifier', '');
      // Only allow vanilla identifiers of 32 chars or less - md5 if larger
      if (strlen($vanilla_identifier) > 32) {
         $vanilla_identifier = md5($vanilla_identifier);
      }
      $vanilla_type = GetIncomingValue('vanilla_type', 'page');
      $vanilla_url = GetIncomingValue('vanilla_url', '');
      $vanilla_category_id = GetIncomingValue('vanilla_category_id', '');
      $ForeignSource = array(
         'vanilla_identifier' => $vanilla_identifier,
         'vanilla_type' => $vanilla_type,
         'vanilla_url' => $vanilla_url,
         'vanilla_category_id' => $vanilla_category_id
      );
      $this->SetData('ForeignSource', $ForeignSource);
      
      $SortComments = C('Garden.Embed.SortComments') == 'desc' ? 'desc' : 'asc';
      $this->SetData('SortComments', $SortComments);
      
      // Retrieve the discussion record.
      $Discussion = FALSE;
      if ($DiscussionID > 0) {
         $Discussion = $this->DiscussionModel->GetID($DiscussionID);
      } else if ($vanilla_identifier != '' && $vanilla_type != '') {
         $Discussion = $this->DiscussionModel->GetForeignID($vanilla_identifier, $vanilla_type);
      }
      
      if ($Discussion) {
         $this->SetData('Discussion', $Discussion, TRUE);
         $this->SetData('DiscussionID', $Discussion->DiscussionID, TRUE);
         $this->Title($this->Discussion->Name);

         // Actual number of comments, excluding the discussion itself
         $ActualResponses = $this->Discussion->CountComments;
         // Define the query offset & limit
         if (!is_numeric($Limit) || $Limit < 0)
            $Limit = C('Garden.Embed.CommentsPerPage', 30);

         $OffsetProvided = $Offset != '';
         list($Offset, $Limit) = OffsetLimit($Offset, $Limit);
         $this->Offset = $Offset;
         if (C('Vanilla.Comments.AutoOffset')) {
            if ($ActualResponses <= $Limit)
               $this->Offset = 0;

            if ($this->Offset == $ActualResponses)
               $this->Offset -= $Limit;
         } else if ($this->Offset == '')
            $this->Offset = 0;

         if ($this->Offset < 0)
            $this->Offset = 0;

         // Set the canonical url to have the proper page title.
         $this->CanonicalUrl(DiscussionUrl($Discussion, PageNumber($this->Offset, $Limit)));

         // Load the comments.
         $CurrentOrderBy = $this->CommentModel->OrderBy();
         if (StringBeginsWith(GetValueR('0.0', $CurrentOrderBy), 'c.DateInserted'))
            $this->CommentModel->OrderBy('c.DateInserted '.$SortComments); // allow custom sort

         $this->SetData('Comments', $this->CommentModel->Get($this->Discussion->DiscussionID, $Limit, $this->Offset), TRUE);
         
         if (count($this->CommentModel->Where()) > 0)
            $ActualResponses = FALSE;

         $this->SetData('_Count', $ActualResponses);

         // Build a pager
         $PagerFactory = new Gdn_PagerFactory();
         $this->EventArguments['PagerType'] = 'MorePager';
         $this->FireEvent('BeforeBuildPager');
         $this->Pager = $PagerFactory->GetPager($this->EventArguments['PagerType'], $this);
         $this->Pager->ClientID = 'Pager';
         $this->Pager->MoreCode = 'More Comments';
         $this->Pager->Configure(
            $this->Offset,
            $Limit,
            $ActualResponses,
            'discussion/embed/'.$this->Discussion->DiscussionID.'/'.Gdn_Format::Url($this->Discussion->Name).'/%1$s'
         );
         $this->Pager->CurrentRecords = $this->Comments->NumRows();
         $this->FireEvent('AfterBuildPager');
      }
      
      // Define the form for the comment input
      $this->Form = Gdn::Factory('Form', 'Comment');
      $this->Form->Action = Url('/vanilla/post/comment/');
      $this->Form->AddHidden('CommentID', '');
      $this->Form->AddHidden('Embedded', 'true'); // Tell the post controller that this is an embedded page (in case there are custom views it needs to pick up from a theme).
      $this->Form->AddHidden('DisplayNewCommentOnly', 'true'); // Only load/display the new comment after posting (don't load all new comments since the page last loaded).
      
      if ($this->Request->Get('title')) {
         $this->Form->SetValue('Name', $this->Request->Get('title'));
      }
      
      if ($Discussion) {
         $this->Form->AddHidden('DiscussionID', $Discussion->DiscussionID);
      }
      
      foreach ($ForeignSource as $Key => $Val) {
         // Drop the foreign source information into the form so it can be used if creating a discussion
         $this->Form->AddHidden($Key, $Val);
         // Also drop it into the definitions so it can be picked up for stashing comments
         $this->AddDefinition($Key, $Val);
      }

      // Retrieve & apply the draft if there is one:
      $Draft = FALSE;
      if (Gdn::Session()->UserID && $Discussion) {
         $DraftModel = new DraftModel();
         $Draft = $DraftModel->Get($Session->UserID, 0, 1, $Discussion->DiscussionID)->FirstRow();
         $this->Form->AddHidden('DraftID', $Draft ? $Draft->DraftID : '');
      }
      
      if ($Draft)
         $this->Form->SetFormValue('Body', $Draft->Body);
      else {
         // Look in the session stash for a comment
         $StashComment = $Session->Stash('CommentForForeignID_'.$ForeignSource['vanilla_identifier'], '', FALSE); 
         if ($StashComment)
            $this->Form->SetFormValue('Body', $StashComment);
      }
      
      // Deliver JSON data if necessary
      if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
         if ($this->Discussion) {
            $this->SetJson('LessRow', $this->Pager->ToString('less'));
            $this->SetJson('MoreRow', $this->Pager->ToString('more'));
         }
         $this->View = 'comments';
      }
      
      if ($SortComments == 'desc')
         $this->AddDefinition('PrependNewComments', '1');
      
      // Report the discussion id so js can use it.      
      if ($Discussion)
         $this->AddDefinition('DiscussionID', $Discussion->DiscussionID);
      
      $this->FireEvent('BeforeDiscussionRender');
      $this->Render();
   }
432716
@InterfaceAudience.Private
    protected Status updateIndexes(List<View> views) throws CouchbaseLiteException {
        List<ViewStore> storages = new ArrayList<ViewStore>();
        for (View view : views) {
            storages.add(view.viewStore);
        }
        return viewStore.updateIndexes(storages);
    }
1200825
def _inplace_subset_obs(self, index):
        
        adata_subset = self[index].copy()
        self._init_as_actual(adata_subset, dtype=self._X.dtype)
232844
def index(self, elem):
        """"""
        return _coconut.len(self._iter) - self._iter.index(elem) - 1
79355
def process_embed_override(href_embed=None,
                           embed_items=None,
                           embed_tracks=None,
                           embed_metadata=None,
                           embed_insights=None):
    """"""
    # Our defaults are None, which are the API defaults.
    final_items = None
    final_tracks = None
    final_metadata = None
    final_insights = None

    # First, figure out what was embedded in the original href.
    # If any of the embeds are there, flip the final to True
    if href_embed:
        if 'items' in href_embed:
            final_items = True
        if 'tracks' in href_embed:
            final_tracks = True
        if 'metadata' in href_embed:
            final_metadata = True
        if 'insights' in href_embed:
            final_insights = True

    # Second, override the what we have.
    # None >> Do nothing
    # True >> Set to True
    # False >> Set to None
    if embed_items is not None:
        if embed_items is True:
            final_items = True
        else:
            final_items = None
    if embed_tracks is not None:
        if embed_tracks is True:
            final_tracks = True
        else:
            final_tracks = None
    if embed_metadata is not None:
        if embed_metadata is True:
            final_metadata = True
        else:
            final_metadata = None
    if embed_insights is not None:
        if embed_insights is True:
            final_insights = True
        else:
            final_insights = None

    return process_embed(embed_items=final_items,
                         embed_tracks=final_tracks,
                         embed_metadata=final_metadata,
                         embed_insights=final_insights)
242542
def view():
    """"""
    if not initialized:
        raise NotInitialized

    marshalled_metrics_mmap.seek(0)
    try:
        uwsgi.lock()
        marshalled_view = marshalled_metrics_mmap.read(
            MAX_MARSHALLED_VIEW_SIZE)
    finally:
        uwsgi.unlock()
    return marshal.loads(marshalled_view)
519301
def current_index(self):
        """"""
        i = self._parent.proxy_model.mapToSource(self._parent.currentIndex())
        return i
662275
def _create_embedded_indices(self):
        '''
        
        '''
        try:
            self._target._embedded_indices.update(((k,(self,v)) for k,v in getattr(self._parser.typedef, 'inline_names', {}).items()))
        except AttributeError:
            pass
1095967
def itemFromIndex(self, index):
        
        sourceIndex = self.mapToSource(index)
        return self.sourceModel().itemFromIndex(sourceIndex)
759742
def _create_embedded_indices(self):
        '''
        
        '''
        try:
            _set(self, '_embedded_indices', dict((k,(self,v)) for k,v in getattr(self._parser.typedef, 'inline_names', {}).items()))
        except AttributeError:
            _set(self, '_embedded_indices', {})
647246
def itemAt( self, index ):
        
        layout = self.widget().layout()
        if ( 0 <= index and index < (layout.count() - 1) ):
            return layout.itemAt(index).widget()
        return None
1104452
private SearchIndex makeSuggestIndex(StaplerRequest req) {
        SearchIndexBuilder builder = new SearchIndexBuilder();
        for (Ancestor a : req.getAncestors()) {
            if (a.getObject() instanceof SearchableModelObject) {
                SearchableModelObject smo = (SearchableModelObject) a.getObject();
                builder.add(smo.getSearchIndex());
            }
        }
        return builder.make();
    }
831242
def samtools_index(self, bam_file):
        """"""
        cmd = self.tools.samtools + " index {0}".format(bam_file)
        return cmd
1312362
def view_meta_index():
    
    rst_files = [filename[2:-4] for filename in sorted(glob.glob("./*.rst"))]
    rst_files.reverse()
    return template('index',
                    type="view",
                    filelist=rst_files,
                    name="__index__",
                    extended_name=None,
                    history=[],
                    gitref=None,
                    is_repo=check_repo())
180196
function attachEmbeddedView(parentView, elementData, viewIndex, view) {
    var embeddedViews = elementData.viewContainer._embeddedViews;
    if (viewIndex === null || viewIndex === undefined) {
        viewIndex = embeddedViews.length;
    }
    view.viewContainerParent = parentView;
    addToArray(embeddedViews, viewIndex, view);
    attachProjectedView(elementData, view);
    Services.dirtyParentQueries(view);
    var prevView = viewIndex > 0 ? embeddedViews[viewIndex - 1] : null;
    renderAttachEmbeddedView(elementData, prevView, view);
}
178801
def map_index_val(index_val):
        """"""
        if index_val is None:
            return DynamoMappings.NONE_VAL

        index_val = str(index_val)
        if not index_val:
            return DynamoMappings.EMPTY_STR_VAL

        return index_val
518359
def replace_with(self, other):
        """"""
        self.after(other)
        self.parent.pop(self._own_index)
        return other