Gets the X number of upcoming blocks (that will take place in the future). If there is no
        block in the future, the most recent block will be returned.

        Returns: A QuerySet of `EighthBlock` objects
343459
def get_upcoming_blocks(self, max_number=-1):
        

        now = datetime.datetime.now()

        # Show same day if it's before 17:00
        if now.hour < 17:
            now = now.replace(hour=0, minute=0, second=0, microsecond=0)

        blocks = self.order_by("date", "block_letter").filter(date__gte=now)

        if max_number == -1:
            return blocks

        return blocks[:max_number]
776061
def get_active_schedulings(self):
        """"""
        blocks = EighthBlock.objects.get_blocks_this_year()
        scheduled_activities = EighthScheduledActivity.objects.filter(activity=self)
        scheduled_activities = scheduled_activities.filter(block__in=blocks)

        return scheduled_activities
163660
def getBlocks(self):
        
        try:
            conn = self.dbi.connection()
            result = self.buflistblks.execute(conn)
            return result
        finally:
            if conn:
                conn.close()
1220347
def mine_blocks(num_blocks: int, chain: MiningChain) -> MiningChain:
    
    if not isinstance(chain, MiningChain):
        raise ValidationError('`mine_block` may only be used on MiningChain instances')
    for _ in range(num_blocks):
        chain.mine_block()
    return chain
786473
def get_nowait(self):
        
        new_get = Future()

        with self._lock:
            if not self._get.done():
                raise QueueEmpty
            get, self._get = self._get, new_get

        hole = get.result()
        if not hole.done():
            # Restore the unfinished hole.
            new_get.set_result(hole)
            raise QueueEmpty

        node = hole.result()
        value = node.value
        new_hole, node.next = node.next, None
        new_get.set_result(new_hole)
        return value
329419
def get_next_batch(self):
        
        if self.iterator is None:
            self.iterator = self.iteritems()

        count = 0
        while count < self.batch_size:
            count += 1
            yield next(self.iterator)
        self.logger.debug('Done reading batch')
602513
def _get_next_or_previous_by_order(self, is_next, **kwargs):
        
        lookup = self.with_respect_to()
        lookup["_order"] = self._order + (1 if is_next else -1)
        concrete_model = base_concrete_model(Orderable, self)
        try:
            queryset = concrete_model.objects.published
        except AttributeError:
            queryset = concrete_model.objects.filter
        try:
            return queryset(**kwargs).get(**lookup)
        except concrete_model.DoesNotExist:
            pass
337428
def get_blocks(self, chrom, start, end):
    
    if chrom not in self.block_trees:
      return []
    return self.block_trees[chrom].intersectingInterval(start, end)
866047
def scheduling_blocks():
    """"""
    sbi_list = SchedulingBlockInstanceList()
    return dict(active=sbi_list.active,
                completed=sbi_list.completed,
                aborted=sbi_list.aborted)
1354748
def have_all_block_data(self):
        
        if not (self.num_blocks_received == self.num_blocks_requested):
            log.debug("num blocks received = %s, num requested = %s" % (self.num_blocks_received, self.num_blocks_requested))
            return False

        return True
227789
def _create_blocks(self):
        

        obj, index = self._convert_freq()
        if index is not None:
            index = self._on

        # filter out the on from the object
        if self.on is not None:
            if obj.ndim == 2:
                obj = obj.reindex(columns=obj.columns.difference([self.on]),
                                  copy=False)
        blocks = obj._to_dict_of_blocks(copy=False).values()

        return blocks, obj, index
347710
def get_blocks(self, chrom, start, end):
    
    blocks = []
    for k in self.__get_keys(chrom, start, end):
      self.__switch_alig(k)
      blocks += self.current.get_blocks(chrom, start, end)
    return blocks
1171312
def block_count(self):
        

        resp = self.call('block_count')

        for k, v in resp.items():
            resp[k] = int(v)

        return resp
994675
def has_next_page(self):
        
        return self.current_page < math.ceil(self.total_count / self.per_page)
607013
def fetch_next_page(self):
        
        if self.response_future.has_more_pages:
            self.response_future.start_fetching_next_page()
            result = self.response_future.result()
            self._current_rows = result._current_rows  # ResultSet has already _set_current_rows to the appropriate form
        else:
            self._current_rows = []
832637
def get(self, block, name):
        
        return self._kvs.get(self._key(block, name))
1122605
def _start_watching_blocks(self):
        '''
        
        '''
        if sum(map(len, (self.solid_watchers, self.block_watchers))) == 1:
            eth.filter('latest').watch(self._new_block)