Returns a set of blocks which should be marked complete on view and haven't been yet.
508877
def blocks_to_mark_complete_on_view(self, blocks):
        
        blocks = {block for block in blocks if self.can_mark_block_complete_on_view(block)}
        completions = self.get_completions({block.location for block in blocks})
        return {block for block in blocks if completions.get(block.location, 0) < 1.0}
103938
def on_complete(&block)
      on do |_, value, reason|
        block.call(reason == nil, value, reason)
      end
    end
774820
public Set<String> getBlockingLockedResources() {

        Set<String> blockingResources = new HashSet<String>();
        Iterator<String> i = getResourceList().iterator();
        while (i.hasNext()) {
            String resName = i.next();
            try {
                blockingResources.addAll(getCms().getLockedResources(resName, getBlockingFilter()));
            } catch (CmsException e) {
                // error reading a resource, should usually never happen
                if (LOG.isErrorEnabled()) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
            if (Boolean.valueOf(getParamIncluderelated()).booleanValue()) {
                addLockedRelatedResources(resName, getBlockingFilter(), blockingResources);
            }
        }
        m_blockingLocks = blockingResources.size();
        return blockingResources;
    }
693126
def submit_completion(self, block_key, completion):
        
        return BlockCompletion.objects.submit_completion(
            user=self._user,
            course_key=self._course_key,
            block_key=block_key,
            completion=completion
        )
744957
protected void findUnusedBlocks() 
    {
        // fill the entire map with "not used" 
        Arrays.fill(m_map_, 0xff);
    
        // mark each block that _is_ used with 0
        for (int i = 0; i < m_indexLength_; ++ i) {
            m_map_[Math.abs(m_index_[i]) >> SHIFT_] = 0;
        }
    
        // never move the all-initial-value block 0
        m_map_[0] = 0;
    }
746629
def _onPrevBookmark(self):
        
        for block in qutepart.iterateBlocksBackFrom(self._qpart.textCursor().block().previous()):
            if self.isBlockMarked(block):
                self._qpart.setTextCursor(QTextCursor(block))
                return
481940
def has_completed(self):
        """"""
        objects_in_db = WorkflowObjectModel.query.filter(
            WorkflowObjectModel.id_workflow == self.uuid,
            WorkflowObjectModel.id_parent == None,  # noqa
        ).filter(WorkflowObjectModel.status.in_([
            workflow_object_class.known_statuses.COMPLETED
        ])).count()
        return objects_in_db == len(list(self.objects))
248342
def get_newest(blocks, layout_blocks):
    
    layout_temp = list(layout_blocks)

    for i in range(0, len(layout_temp)):
        for k in range(0, len(layout_blocks)):
            if blocks[layout_temp[i]].ec_hdr.image_seq != blocks[layout_blocks[k]].ec_hdr.image_seq:
                continue

            if blocks[layout_temp[i]].leb_num != blocks[layout_blocks[k]].leb_num:
                continue

            if blocks[layout_temp[i]].vid_hdr.sqnum > blocks[layout_blocks[k]].vid_hdr.sqnum:
                del layout_blocks[k]
                break

    return layout_blocks
1311393
public List<BlockMeta> getEvictableBlocks() {
    List<BlockMeta> filteredList = new ArrayList<>();

    for (BlockMeta blockMeta : mDir.getBlocks()) {
      long blockId = blockMeta.getBlockId();
      if (mManagerView.isBlockEvictable(blockId)) {
        filteredList.add(blockMeta);
      }
    }
    return filteredList;
  }
304850
def setPieceCompleted(pieceIndex, bool)
      eachBlockInPiece(pieceIndex) do |blockIndex|
        if bool
          @completeBlocks.set blockIndex
        else
          @completeBlocks.clear blockIndex
        end
      end
      if bool
        @completePieces.set pieceIndex
      else
        @completePieces.clear pieceIndex
      end
    end
864121
synchronized boolean contains(BlockInfo block) {
    for(LightWeightLinkedSet<BlockInfo> set:priorityQueues) {
      if(set.contains(block)) { return true; }
    }
    return false;
  }
1220534
def collect_blocks(self):
        
        if self.mode == 'spark':
            return self.values.tordd().sortByKey().values().collect()

        if self.mode == 'local':
            return self.values.values.flatten().tolist()
1211604
def final_objects(self):
        """"""
        return [obj for obj in self.database_objects
                if obj.status in [obj.known_statuses.COMPLETED]]
274251
def previous_blocks(self, quantity=-1):
        """"""
        blocks = (EighthBlock.objects.get_blocks_this_year().order_by(
            "-date", "-block_letter").filter(Q(date__lt=self.date) | (Q(date=self.date) & Q(block_letter__lt=self.block_letter))))
        if quantity == -1:
            return reversed(blocks)
        return reversed(blocks[:quantity])
54050
def complete(self):
        """"""
        if self._possible is None:
            self._possible = []
            for possible in self.names:
                c = Completion(self.context, self.names[possible], len(self.context.symbol))
                self._possible.append(c)

        return self._possible
1016455
def scorable_block_completion(sender, **kwargs):  # pylint: disable=unused-argument
    
    if not waffle.waffle().is_enabled(waffle.ENABLE_COMPLETION_TRACKING):
        return
    course_key = CourseKey.from_string(kwargs['course_id'])
    block_key = UsageKey.from_string(kwargs['usage_id'])
    block_cls = XBlock.load_class(block_key.block_type)
    if XBlockCompletionMode.get_mode(block_cls) != XBlockCompletionMode.COMPLETABLE:
        return
    if getattr(block_cls, 'has_custom_completion', False):
        return
    user = User.objects.get(id=kwargs['user_id'])
    if kwargs.get('score_deleted'):
        completion = 0.0
    else:
        completion = 1.0
    if not kwargs.get('grader_response'):
        BlockCompletion.objects.submit_completion(
            user=user,
            course_key=course_key,
            block_key=block_key,
            completion=completion,
        )
1284927
def is_complete(self):
        """"""

        return all(p.name in self.values for p in self.parameters if p.required)