The remaining occurrences (same requirements as all_occurrences)
977607
def remaining_occurrences(from = nil, options = {})
      require_terminating_rules
      from ||= TimeUtil.now(@start_time)
      enumerate_occurrences(from, nil, options).to_a
    end
815482
def get_plain_text(self):
        """"""
        ret = []
        for occ in self.occurrences:
            ret.extend(occ.get_plain_text())
        return ret
950134
def write_remaining(self):
        
        if not self.results:
            return
        with db.execution_context():
            with db.atomic():
                Result.insert_many(self.results).execute()
        del self.results[:]
1303451
def all_children(flag=nil)
		also_foreign = (flag==:also_foreign)
		arr = []
		ecore = self.class.ecore
		# Awful hack to forbid the same reference is visited twice when
		# two references with the same name are found
		already_used_references = []
		ecore.eAllReferences.sort_by{|r| r.name}.select {|r| r.containment}.each do |ref|
			unless already_used_references.include?(ref.name)
				res = self.send(ref.name.to_sym)
				if ref.many
					d = arr.count
					res.each do |el|
						arr << el unless res==nil
					end
				elsif res!=nil
					d = arr.count
					arr << res
				end
				already_used_references << ref.name
			end
		end
		if also_foreign
			arr.concat(self.foreign_asts)
		end
		arr
	end
888075
def all(self, timeout=None, max_concurrency=64, auto_batch=True):
        
        return self.fanout('all', timeout=timeout,
                           max_concurrency=max_concurrency,
                           auto_batch=auto_batch)
999771
def get_occurrence(self, occ):
        
        return self.lookup.pop(
            (occ.event, occ.original_start, occ.original_end),
            occ)
385393
def get_all_recurrings(self, params=None):
        
        if not params:
            params = {}
        return self._iterate_through_pages(self.get_recurrings_per_page, resource=RECURRINGS, **{'params': params})
424129
def DisplayIndexAsDictionary(word_occurrences):
    
    word_keys = word_occurrences.keys()
    for num, word in enumerate(word_keys):
        line_nums = word_occurrences[word]
        print(word + " ")
        if num > 3:
            break
1251181
def iscontinuous(self):
        """"""
        return all(self[i].end == self[i+1].start for i in range(len(self) - 1))
34982
def _get_aggregated_info(self):
        
        agg_results = {}
        for key in self.aggregated_info['occurrences']:
            agg_results[key] = {
                'occurrences': self.aggregated_info['occurrences'].get(key),
                'coverage': (float(self.aggregated_info['occurrences']
                                   .get(key))/float(self.get_metadata('items_count')))*100
            }
        return agg_results
892944
def specific_occurrence_source_data_criteria(force_sources=nil)
      return [] if @source_data_criteria.nil?
      matching = @source_data_criteria.select {|dc| !dc.specific_occurrence.nil?}

      if force_sources
        existing = matching.map(&:id)
        matching.concat @source_data_criteria.select {|dc| !existing.include?(dc.id) && force_sources.include?(dc.id)} 
      end

      matching
    end
279376
def alliterativity
      words = self.downcase.gsub(/[^a-z\s]/, '').split
      leading_letters = words.map(&:chr)
      
      # { 'a' => 3, 'b' => 1, ... }
      leading_letter_counts = leading_letters.inject({}) do |result, letter|
        result[letter] ||= 0
        result[letter] += 1
        result
      end
      
      most_used_count = leading_letter_counts.max_by { |kv| kv.last }.pop
      most_used_count.to_f / words.length
    end
1341640
def last(n = nil)
      require_terminating_rules
      occurrences = enumerate_occurrences(start_time).to_a
      n.nil? ? occurrences.last : occurrences[-n..-1]
    end
622970
def repeat_all(self, count=2):
        
        try:
            return self.__class__(''.join(str(self) * count))
        except TypeError:
            raise TypeError(
                '`count` must be an integer. Got: {!r}'.format(count)
            )
433411
def construct(self, data):
		
		occurrences = {}
		main_occurrences = {}

		# occurrences of devel packages
		for pkg in data["data"]["dependencies"]:
			package = pkg["package"]
			for item in pkg["dependencies"]:
				dep = item["name"]
				if package != ".":
					deps = map(lambda l: "%s/%s" % (package, l), item["location"])
				else:
					deps = item["location"]
				if dep not in occurrences:
					occurrences[dep] = deps
				else:
					occurrences[dep] = occurrences[dep] + deps

		self.occurrences = occurrences

		# occurrences of main packages
		for main in data["data"]["main"]:
			filename = main["filename"]
			for dep in main["dependencies"]:
				if dep not in main_occurrences:
					main_occurrences[dep] = [filename]
				else:
					main_occurrences[dep].append(filename)

		self.main_occurrences = main_occurrences
	
		# test directories
		self.test_directories = sorted(map(lambda l: l["test"], data["data"]["tests"]))

		# provided devel packages
		self.provided_packages = sorted(data["data"]["packages"])

		# imported paths in devel packages
		imported_packages = []
		imported_native_packages = []
		for path in occurrences:
			try:
				self.ipparser.parse(path)
			except ValueError:
				continue

			if self.ipparser.isNative():
				imported_native_packages.append(path)
			else:
				imported_packages.append(path)

		self.imported_packages = sorted(imported_packages)
		self.imported_native_packages = sorted(imported_native_packages)

		# main packages
		self.main_packages = map(lambda l: l["filename"], data["data"]["main"])
506012
protected function ensureNotEmpty() {
        $this->currentInstance = 0;
        while ($this->resourceIterator->valid() && !$this->load($this->resourceIterator->current(), 0)) {
            $this->resourceIterator->next();
        }
    }
651154
def next_occurrences(num, from = nil, options = {})
      from = TimeUtil.match_zone(from, start_time) || TimeUtil.now(start_time)
      enumerate_occurrences(from + 1, nil, options).take(num)
    end