gets the first 3 content objects in the `included_ids`
969927
def get_recirc_content(self, published=True, count=3):
        
        query = self.get_query()

        # check if query has included_ids & if there are any ids in it,
        # in case the ids have been removed from the array
        if not query.get('included_ids'):
            qs = Content.search_objects.search()
            qs = qs.query(
                TagBoost(slugs=self.tags.values_list("slug", flat=True))
            ).filter(
                ~Ids(values=[self.id])
            ).sort(
                "_score"
            )
            return qs[:count]

        # NOTE: set included_ids to just be the first 3 ids,
        # otherwise search will return last 3 items
        query['included_ids'] = query['included_ids'][:count]
        search = custom_search_model(Content, query, published=published, field_map={
            "feature_type": "feature_type.slug",
            "tag": "tags.slug",
            "content-type": "_type"
        })
        return search
572253
def __get_first_available_id(self):
        
        traps = self.get_all()
        if traps:
            used_ids = [0]
            for trap in traps:
                used_uris = trap.get('uri')
                used_ids.append(int(used_uris.split('/')[-1]))
            used_ids.sort()
            return self.__findFirstMissing(used_ids, 0, len(used_ids) - 1)
        else:
            return 1
204451
def get_content_title(self, obj):
        """"""
        return Content.objects.get(id=obj.content.id).title
442502
def getDirsToInclude(string):
    
    dirs = []
    a = string.strip()
    obj = a.split('-')

    if len(obj) == 1 and obj[0]:
        for module in obj:
            try:
                exec('import {}'.format(module))
            except ImportError:
                raise FileNotFoundError("The module '{}' does not"
                                        "exist".format(module))
            try:
                dirs.append('-I{}'.format(eval(module).get_include()))
            except AttributeError:
                print(NOT_NEEDED_MESSAGE.format(module))
    return dirs
737590
def _get_show_ids(self):
        
        # get the show page
        logger.info('Getting show ids')
        r = self.session.get(self.server_url + 'shows.php', timeout=10)
        r.raise_for_status()
        soup = ParserBeautifulSoup(r.content, ['lxml', 'html.parser'])

        # populate the show ids
        show_ids = {}
        for show in soup.select('td.version > h3 > a[href^="/show/"]'):
            show_ids[sanitize(show.text)] = int(show['href'][6:])
        logger.debug('Found %d show ids', len(show_ids))

        return show_ids
1357662
def previous(self):
        '''  '''
        try:
            return self.__class__.objects.for_model(self.content_object,
                                                    self.content_type).\
                            filter(order__gt=self.order).order_by('order')[0]
        except IndexError:
            return None
518495
def get_page_content(id):
    
    data = _json.loads(_api.rest("/" + str(id) + "?expand=body.storage"))
    return data["body"]["storage"]["value"]
593890
def _get_filtered_study_ids(shard, include_aliases=False):
    """"""
    from peyotl.phylesystem.helper import DIGIT_PATTERN
    k = shard.get_doc_ids()
    if shard.has_aliases and (not include_aliases):
        x = []
        for i in k:
            if DIGIT_PATTERN.match(i) or ((len(i) > 1) and (i[-2] == '_')):
                pass
            else:
                x.append(i)
        return x
344077
public function getExcludedIds()
    {
        $excludedIdsString = $this->getRequest()->get('excludedIds');

        return (null !== $excludedIdsString) ? array_filter(explode(',', $excludedIdsString)) : [];
    }
1028209
def _get_content_type_queryset(models_list):
    
    content_type_ids = {c.id for c in ContentType.objects.get_for_models(*models_list).values()}
    return ContentType.objects.filter(id__in=content_type_ids)
1355501
def _extract_from_included(self, data):
        
        return (item for item in self.included_data
                if item['type'] == data['type'] and
                str(item['id']) == str(data['id']))
1114986
function() {
		var allContentItems = [];

		var addChildren = function( contentItem ) {
			allContentItems.push( contentItem );

			if( contentItem.contentItems instanceof Array ) {
				for( var i = 0; i < contentItem.contentItems.length; i++ ) {
					addChildren( contentItem.contentItems[ i ] );
				}
			}
		};

		addChildren( this.root );

		return allContentItems;
	}
1192228
def get_parts(self, parts=None, reference_level=0):
        """"""
        if parts is None:
            parts = list()
            new_reference_level = reference_level
        else:
            self._level_in_section = self._level + reference_level
            new_reference_level = self._level_in_section
            parts.append(self.my_osid_object)
        if self._child_parts is None:
            if self.has_magic_children():
                self.generate_children()
            else:
                return parts
        for part in self._child_parts:
            part.get_parts(parts, new_reference_level)
            # Don't need to append here, because parts is passed by reference
            # so appending is redundant
            # child_parts = part.get_parts(parts, new_reference_level)
            # known_part_ids = [str(part.ident) for part in parts]
            #
            # for child_part in child_parts:
            #     if str(child_part.ident) not in known_part_ids:
            #         parts.append(child_part)
            #         known_part_ids.append(str(child_part.ident))
        return parts
1038095
def getIncludeDirectories(self, engineRoot, delimiter=' '):
		
		return delimiter.join(self.resolveRoot(self.includeDirs, engineRoot))
218152
def fetch_remaining_instances(self):
        """"""
        if self.remaining_items:
            self.remaining_items = ContentItem.objects.get_real_instances(self.remaining_items)
721826
def get_relations(self, rel_id=None, **kwargs):
        
        return self.get_elements(Relation, elem_id=rel_id, **kwargs)
24506
def _get_contents(self):
        """"""
        return [
            str(value) if is_lazy_string(value) else value
            for value in super(LazyNpmBundle, self)._get_contents()
        ]