Parse all the language codes in a given list into ISO 639 Part 2 codes
    and optionally expand them with synonyms (i.e. other names for the same
    language).
517915
def list_to_alpha3(languages, synonyms=True):
    """"""
    codes = set([])
    for language in ensure_list(languages):
        code = iso_639_alpha3(language)
        if code is None:
            continue
        codes.add(code)
        if synonyms:
            codes.update(expand_synonyms(code))
    return codes
161887
function (code, items) {
        var langData = data[code];

        if (!langData) {
          data[code] = langData = {};
        }

        for (var name in items) {
          langData[name] = items[name];
        }

        this.setCode(code);
      }
1176482
def parse(binary, **params):
    """"""
    binary = io.BytesIO(binary)
    collection = list()
    with zipfile.ZipFile(binary, 'r') as zip_:
        for zip_info in zip_.infolist():
            content_type, encoding = mimetypes.guess_type(zip_info.filename)
            content = zip_.read(zip_info)
            content = content_encodings.get(encoding).decode(content)
            content = content_types.get(content_type).parse(content, **params)
            collection.apppend((zip_info.filename, content))
    return collection
87693
private List<Object> normalizeList(List<Object> list) {
    	List<Object> result = new ArrayList<Object>();
    	for (Object o : list) {
    		if (o == null) {
    			result.add(nullLiteral);
    		} else if (o instanceof Boolean) {
    			result.add(((Boolean) o).toString());
    		} else if (o instanceof List<?>) {
    			result.add(normalizeList((List<Object>) o));
    		} else if (o instanceof Map<?, ?>) {
    			result.add(normalizeMap((Map<String, Object>) o));
    		} else if (!(o instanceof Number)) {
    			result.add(o);
    		}
    	}
    	return result;
    }
1008618
def set_code_exprs(self, codes):
        """"""
        self.code_objs = dict()
        self._codes = []
        for code in codes:
            self.append_code_expr(code)
950359
def words_for_language(language_code):
    
    word_groups = word_groups_for_language(language_code)
    words = []

    for group in word_groups:
        words.extend(word_groups[group].keys())

    return words
1357556
def parse_list(text, off=0, trim=True):
    '''
    
    '''

    if not nextchar(text, off, '('):
        raise s_exc.BadSyntax(at=off, mesg='expected open paren for list')

    off += 1

    valus = []
    while off < len(text):

        _, off = nom(text, off, whites)

        valu, off = parse_valu(text, off)

        _, off = nom(text, off, whites)

        # check for foo=bar kw tuple syntax
        if nextchar(text, off, '='):

            _, off = nom(text, off + 1, whites)

            vval, off = parse_valu(text, off)

            _, off = nom(text, off, whites)

            valu = (valu, vval)

        valus.append(valu)

        _, off = nom_whitespace(text, off)

        if nextchar(text, off, ')'):
            return valus, off + 1

        if not nextchar(text, off, ','):
            raise s_exc.BadSyntax(at=off, text=text, mesg='expected comma in list')

        off += 1

    raise s_exc.BadSyntax(at=off, mesg='unexpected and of text during list')
281388
private List<String> parseTitles(State state, String line) {
        // Match using the parser
        List<String> titles = new ArrayList<>();
        state.mLineTokens.reset(line);
        while (state.mLineTokens.find()) {
            String value;
            if (state.mLineTokens.start(2) >= 0) {
                value = state.mLineTokens.group(2);
            } else {
                // If quoted, always use string
                value = state.mQuote.reset(state.mLineTokens.group(1)).replaceAll("\"");
            }
            titles.add(value);
        }
        return titles;
    }
661611
def parse_pseudo_lang(self, sel, m, has_selector):
        """"""

        values = m.group('values')
        patterns = []
        for token in RE_VALUES.finditer(values):
            if token.group('split'):
                continue
            value = token.group('value')
            if value.startswith(('"', "'")):
                parts = css_unescape(value[1:-1], True).split('-')
            else:
                parts = css_unescape(value).split('-')

            new_parts = []
            first = True
            for part in parts:
                if part == '*' and first:
                    new_parts.append('(?!x\b)[a-z0-9]+?')
                elif part != '*':
                    new_parts.append(('' if first else '(-(?!x\b)[a-z0-9]+)*?\\-') + re.escape(part))
                if first:
                    first = False
            patterns.append(re.compile(r'^{}(?:-.*)?$'.format(''.join(new_parts)), re.I))
        sel.lang.append(ct.SelectorLang(patterns))
        has_selector = True

        return has_selector
603517
public function compareToIsoList() {
		$isoList = $this->Languages->getOfficialIsoList();

		$languages = $this->Languages->find('all', []);

		$this->set(compact('isoList', 'languages'));
	}
225942
def setLanguages(self, languages):
        
        if isinstance(languages, six.string_types):
            languages = [languages]
        for lang in languages:
            assert len(lang) == 3, "Expected to get language in ISO3 code"
        self.topicPage["langs"] = languages
1356233
def extendlist(lst, i, value=''):
    """"""
    if i < len(lst):
        pass
    else:
        lst.extend([value, ] * (i - len(lst) + 1))
1161469
def as_languages(self):
        
        langs = []
        for culture_code in self.select_related('language', 'country').all():
            lang = culture_code.language
            lang.country = culture_code.country
            lang.culturecode = culture_code.code
            langs.append(lang)
        return langs
190386
private static Set<LexiconEntry> getLexiconEntriesFromParses(Collection<CcgParse> parses) {
    // Generate candidate lexicon entries from the correct max parses.
    Set<LexiconEntry> candidateEntries = Sets.newHashSet();
    for (CcgParse correctMaxParse : parses) {
      for (LexiconEntryInfo info : correctMaxParse.getSpannedLexiconEntries()) {
        CcgCategory category = info.getCategory();
        Object trigger = info.getLexiconTrigger();
        List<String> words = (List<String>) trigger;
                
        candidateEntries.add(new LexiconEntry(words, category));
      }
    }
    return candidateEntries;
  }
198950
def load_all(kls):
        """"""
        # Force expansion of contents to lists because we invalidate the iterator
        for region_code, loader in list(kls._region_available.items()):
            if loader is not None:  # pragma no cover
                loader(region_code)
                kls._region_available[region_code] = None
        for country_code, loader in list(kls._country_code_available.items()):
            if loader is not None:
                loader(country_code)
                kls._country_code_available[region_code] = None
206770
function parse(code, modules, options) {
        if (code === '') {
            // old version of esprima doesn't play nice with the empty string
            // and loc/range info so until we can upgrade hack in a single space
            code = ' ';
        }
        modules = modules ? loadedMacros.concat(modules) : modules;
        return parser.parse(expand(code, modules, options));
    }
1353838
def complete(self, code, *args):
        
        completions = []
        for word in self.split(code, self.separators):
            completions.append({'name': word})
        return completions