Converts a list of section objects or names to sectionIds needed for library sharing.
14963
def _getSectionIds(self, server, sections):
        
        if not sections: return []
        # Get a list of all section ids for looking up each section.
        allSectionIds = {}
        machineIdentifier = server.machineIdentifier if isinstance(server, PlexServer) else server
        url = self.PLEXSERVERS.replace('{machineId}', machineIdentifier)
        data = self.query(url, self._session.get)
        for elem in data[0]:
            allSectionIds[elem.attrib.get('id', '').lower()] = elem.attrib.get('id')
            allSectionIds[elem.attrib.get('title', '').lower()] = elem.attrib.get('id')
            allSectionIds[elem.attrib.get('key', '').lower()] = elem.attrib.get('id')
        log.debug(allSectionIds)
        # Convert passed in section items to section ids from above lookup
        sectionIds = []
        for section in sections:
            sectionKey = section.key if isinstance(section, LibrarySection) else section
            sectionIds.append(allSectionIds[sectionKey.lower()])
        return sectionIds
989867
def _dictlist_to_lists(dl, *keys):
    ''' 
    '''
    lists = []
    for k in keys:
        lists.append([])
    for item in dl:
        for i, key in enumerate(keys):
            x = item[key]
            if isinstance(x, unicode):
                x = str(x)
            lists[i].append(x)
    return lists
1371818
def ids(self, content_ids, object_ids):
        """"""
        result = []

        content_ids = self.split(content_ids, False)
        object_ids = self.split(object_ids)

        for cid in content_ids:
            result.append('{}:{}'.format(cid, ':'.join(object_ids)))

        return result
833720
def _objectify(items, container_name):
    """"""
    objects = []

    # Deal with objects and object pseudo-folders first, save subdirs for later
    for item in items:
        if item.get("subdir", None) is not None:
            object_cls = PseudoFolder
        else:
            object_cls = StorageObject

        objects.append(object_cls(item, container_name))

    return objects
1147909
public List<DSLMappingEntry> getEntries(final DSLMappingEntry.Section section) {
        final List<DSLMappingEntry> list = new LinkedList<DSLMappingEntry>();
        for ( final Iterator<DSLMappingEntry> it = this.entries.iterator(); it.hasNext(); ) {
            final DSLMappingEntry entry = it.next();
            if ( entry.getSection().equals( section ) ) {
                list.add( entry );
            }
        }
        return list;
    }
740462
def build_alias_summary_list(section)
            values = []
            @context.aliases.each do |al|
                next unless al.section == section
                res = {
                    'old_name' => al.old_name,
                    'new_name' => al.new_name,
                }
                if al.comment && !al.comment.empty?
                    res['desc'] = markup(al.comment, true)
                end
                values << res
            end
            values
        end
889803
def _parse_section_to_dict(cls, section_options, values_parser=None):
        
        value = {}
        values_parser = values_parser or (lambda val: val)
        for key, (_, val) in section_options.items():
            value[key] = values_parser(val)
        return value
533421
def get_sections(self):
        
        try:
            obj_list = self.__dict__['sections']
            return [Section(i) for i in obj_list]
        except KeyError:
            self._lazy_load()
            obj_list = self.__dict__['sections']
            return [Section(i) for i in obj_list]
1264141
def _init_hdrgo2sections(self):
        """"""
        hdrgo2sections = cx.defaultdict(list)
        for section_name, hdrgos in self.sections:
            for hdrgo in hdrgos:
                hdrgo2sections[hdrgo].append(section_name)
        return hdrgo2sections
1363861
def _merge_sections(sec_a, sec_b):
    '''
    '''
    sec_b.ids = list(sec_a.ids) + list(sec_b.ids[1:])
    sec_b.ntype = sec_a.ntype
    sec_b.pid = sec_a.pid

    sec_a.ids = []
    sec_a.pid = -1
    sec_a.ntype = 0
202877
private static void section4(List<AnnotationNotation> annotations, Map<String, String> mapIds) {
    for (AnnotationNotation annotation : annotations) {
      String notation = annotation.getAnnotation();
      notation = changeIDs(notation, mapIds);
      helm2notation.addAnnotation(new AnnotationNotation(notation));
    }
  }
1066922
def _parseSections(self, data):
        
        section_dict = {}
        lines = data.splitlines()
        idx = 0
        numlines = len(lines)
        section = None
        while idx < numlines:
            line = lines[idx]
            idx += 1
            mobj = re.match('^(\w[\w\s\(\)]+[\w\)])\s*:$', line)
            if mobj:
                section = mobj.group(1)
                section_dict[section] = []
            else:
                mobj = re.match('(\t|\s)\s*(\w.*)$', line)
                if mobj:
                    section_dict[section].append(mobj.group(2))
                else:
                    mobj = re.match('^(\w[\w\s\(\)]+[\w\)])\s*:\s*(\S.*)$', line)
                    if mobj:
                        section = None
                        if not section_dict.has_key(section):
                            section_dict[section] = []
                        section_dict[section].append(line)
                    else:
                        if not section_dict.has_key('PARSEERROR'):
                            section_dict['PARSEERROR'] = []
                        section_dict['PARSEERROR'].append(line)   
        return section_dict
220519
def _dict_to_list_ids(objects):
    '''
    
    '''
    list_with_ids = []
    for key, value in six.iteritems(objects):
        element = {'id': key}
        element.update(value)
        list_with_ids.append(element)
    return list_with_ids
23055
private static <E> List<E> toList(Iterable<E> iterable)
	{
		List<E> list = new ArrayList<>();
		iterable.forEach(list::add);
		return list;
	}
393704
@SuppressWarnings("unchecked")
	public static <T> List<T> toList(Class<T> elementType, Object value) {
		return (List<T>) toCollection(ArrayList.class, elementType, value);
	}
574428
private static List<Integer> convertList(List<String> list) {
        if (list == null) {
            return null;
        }
        List<Integer> ret = new ArrayList<Integer>(list.size());
        for (String v : list) {
            ret.add(StringUtils.toInt(v));
        }

        return ret;
    }
919838
def generate_sections(self):
        """"""
        sources = Dataset.objects.values(
            'source', 'source_slug'
        ).annotate(source_count=Count('source_slug'))

        return sorted([
            {
                'slug': source['source_slug'],
                'name': source['source'],
                'count': source['source_count']
            }
            for source in sources
        ], key=lambda k: k['count'], reverse=True)