Gets the set of feed item IDs from the function if it is of the form:
<code>IN(FEED_ITEM_ID,{xxx,xxx})</code>. Otherwise, returns an empty set.
323478
private static Set<Long> getFeedItemIdsFromArgument(Function function) {
    if (function.getLhsOperand().length == 1
        && function.getLhsOperand(0) instanceof RequestContextOperand) {
      RequestContextOperand requestContextOperand =
          (RequestContextOperand) function.getLhsOperand(0);
      if (RequestContextOperandContextType.FEED_ITEM_ID.equals(
          requestContextOperand.getContextType())
          && FunctionOperator.IN.equals(function.getOperator())) {
        return Arrays.stream(function.getRhsOperand())
            .filter(ConstantOperand.class::isInstance)
            .map(argument -> ((ConstantOperand) argument).getLongValue())
            .collect(Collectors.toSet());
      }
    }

    return new HashSet<>();
  }
292488
def items(self):
        
        if self.empty:
            return iter([])

        val = self.value
        if hasattr(val, "iteritems"):
            return val.iteritems()
        elif hasattr(val, "items"):
            return val.items()
        else:
            return iter(self)
366924
def ids(self):
        
        if config().identifiers() == 'text':
            ids = self._id_todo_map.keys()
        else:
            ids = [str(i + 1) for i in range(self.count())]
        return set(ids)
1029519
def _id_or_key(list_item):
    '''
    
    '''
    if isinstance(list_item, dict):
        if 'id' in list_item:
            return list_item['id']
        if 'key' in list_item:
            return list_item['key']
    return list_item
1362709
def datasetItems(self):
        
        out = {}
        for item in self.items():
            if isinstance(item, XChartDatasetItem):
                out[item.dataset()] = item
        return out
980435
def get_items(self, gos):
        """"""
        items = []
        for go_id in gos:
            items.extend(self.go2items.get(go_id, []))
        return set(items)
406908
def get_items(self):
        """"""
        ils = get_item_lookup_session(runtime=self._runtime, proxy=self._proxy)
        ils.use_federated_bank_view()
        items = []
        if self.has_items():
            for idstr in self._my_map['itemIds']:
                items.append(ils.get_item(Id(idstr)))
        return ItemList(items, runtime=self._runtime, proxy=self._proxy)
189455
def generic_in(self, **kwargs):
        ''''''
        query = {}
        for key, value in kwargs.items():
            if not value:
                continue
            # Optimize query for when there is only one value
            if isinstance(value, (list, tuple)) and len(value) == 1:
                value = value[0]
            if isinstance(value, (list, tuple)):
                if all(isinstance(v, basestring) for v in value):
                    ids = [ObjectId(v) for v in value]
                    query['{0}._ref.$id'.format(key)] = {'$in': ids}
                elif all(isinstance(v, DBRef) for v in value):
                    query['{0}._ref'.format(key)] = {'$in': value}
                elif all(isinstance(v, ObjectId) for v in value):
                    query['{0}._ref.$id'.format(key)] = {'$in': value}
            elif isinstance(value, ObjectId):
                query['{0}._ref.$id'.format(key)] = value
            elif isinstance(value, basestring):
                query['{0}._ref.$id'.format(key)] = ObjectId(value)
            else:
                self.error('expect a list of string, ObjectId or DBRef')
        return self(__raw__=query)
514649
function(fn){
      var items = this.getItems();

      for (var i = 0; i < items.length; i++)
        fn(items[i]);
    }
821876
def get_item_ids_metadata(self):
        """"""
        metadata = dict(self._item_ids_metadata)
        metadata.update({'existing_id_values': self.my_osid_object_form._my_map['itemIds']})
        return Metadata(**metadata)
41573
def ids(self):
        """"""
        as_list = [seq.description.split()[0] for seq in self]
        as_set = frozenset(as_list)
        assert len(as_set) == len(as_list)
        return as_set
497191
def are_in(items, collection):
    
    if not isinstance(items, (list, tuple)):
        items = (items, )
    return map(lambda x: x in collection, items)
184853
function(item) {
        if (item && Selectivity.isValidId(item.id) && isString(item.text)) {
            return item;
        } else {
            throw new Error('Item should have id (number or string) and text (string) properties');
        }
    }
207480
def _get_by_id(collection, id):
    '''
    
    '''
    matches = [item for item in collection if item.id == id]
    if not matches:
        raise ValueError('Could not find a matching item')
    elif len(matches) > 1:
        raise ValueError('The id matched {0} items, not 1'.format(len(matches)))
    return matches[0]
272986
def get_items(self):
        
        uids = self.get_uids()
        if not uids:
            return [SuperModel(self.context)]
        items = map(lambda uid: SuperModel(uid), uids)
        return self._resolve_number_of_copies(items)
1048786
def get_item_ids_for_assessment_part(self, assessment_part_id):
        """"""
        item_ids = []
        for question_map in self._my_map['questions']:
            if question_map['assessmentPartId'] == str(assessment_part_id):
                item_ids.append(Id(question_map['itemId']))
        return item_ids
664151
def getImgIds(self, imgIds=[], catIds=[]):
        '''
        
        '''
        imgIds = imgIds if _isArrayLike(imgIds) else [imgIds]
        catIds = catIds if _isArrayLike(catIds) else [catIds]

        if len(imgIds) == len(catIds) == 0:
            ids = self.imgs.keys()
        else:
            ids = set(imgIds)
            for i, catId in enumerate(catIds):
                if i == 0 and len(ids) == 0:
                    ids = set(self.catToImgs[catId])
                else:
                    ids &= set(self.catToImgs[catId])
        return list(ids)