Default (old) getChoiceIndex implementation - english-compatible
547532
function (_choice, _choicesLength) {
    _choice = Math.abs(_choice);

    if (_choicesLength === 2) {
      return _choice
        ? _choice > 1
          ? 1
          : 0
        : 1
    }

    return _choice ? Math.min(_choice, 2) : 0
  }
605001
@Override
    public String getValue() {
        switch (getSelectedIndex()) {
        case 0:
            if (internVal == null) return null;
            internVal = getValue1();
            return internVal;
        case 1:
            internVal = getValue2();
            return internVal;
        default:
            return null;
        }
    }
783618
def atIndices(indexable, indices, default=__unique):
    
    """
    if default is __unique:
        return [indexable[i] for i in indices]
    else:
        res = []
        for i in indices:
            try:
                res.append(indexable[i])
            except (IndexError, KeyError):
                res.append(default)
        return res
530443
function getChoices() {
    return {
      apiIdentifiers: () => {
        return plugin.loadApis()
        .then(apis => {
          if (!apis.length) {
            icli.print(icli.format.error('This project does not contain any API.'));
            process.exit(1);
          }
          return _.map(apis, api => {
            return {
              value: api.getIdentifier(),
              name: icli.format.info(api.getIdentifier()) + (api.spec.info && api.spec.info.title ? ' - ' + api.spec.info.title : '')
            };
          });
        });
      },
      region: [
        {
          value: 'us-east-1',
          name: icli.format.info('us-east-1') + '      US East (N. Virginia)',
          short: 'us-east-1 - US East (N. Virginia)'
        }, {
          value: 'us-east-2',
          name: icli.format.info('us-east-2') + '      US East (Ohio)',
          short: 'us-east-2 - US East (Ohio)'
        }, {
          value: 'us-west-1',
          name: icli.format.info('us-west-1') + '      US West (N. California)',
          short: 'us-west-1 - US West (N. California)'
        }, {
          value: 'us-west-2',
          name: icli.format.info('us-west-2') + '      US West (Oregon)',
          short: 'us-west-2 - US West (Oregon)'
        }, {
          value: 'ca-central-1',
          name: icli.format.info('ca-central-1') + '   Canada (Central)',
          short: 'ca-central-1 - Canada (Central)'
        }, {
          value: 'sa-east-1',
          name: icli.format.info('sa-east-1') + '      South America (São Paulo)',
          short: 'sa-east-1 - South America (São Paulo)'
        }, {
          value: 'eu-west-1',
          name: icli.format.info('eu-west-1') + '      EU (Ireland)',
          short: 'eu-west-1 - EU (Ireland)'
        }, {
          value: 'eu-west-2',
          name: icli.format.info('eu-west-2') + '      EU (London)',
          short: 'eu-west-2 - EU (London)'
        }, {
          value: 'eu-west-3',
          name: icli.format.info('eu-west-3') + '      EU (Paris)',
          short: 'eu-west-3 - EU (Paris)'
        }, {
          value: 'eu-central-1',
          name: icli.format.info('eu-central-1') + '   EU (Frankfurt)',
          short: 'eu-central-1 - EU (Frankfurt)'
        }, {
          value: 'ap-south-1',
          name: icli.format.info('ap-south-1') + '     Asia Pacific (Mumbai)',
          short: 'ap-south-1 - Asia Pacific (Mumbai)'
        }, {
          value: 'ap-northeast-1',
          name: icli.format.info('ap-northeast-1') + ' Asia Pacific (Tokyo)',
          short: 'ap-northeast-1 - Asia Pacific (Tokyo)'
        }, {
          value: 'ap-northeast-2',
          name: icli.format.info('ap-northeast-2') + ' Asia Pacific (Seoul)',
          short: 'ap-northeast-2 - Asia Pacific (Seoul)'
        }, {
          value: 'ap-northeast-3',
          name: icli.format.info('ap-northeast-3') + ' Asia Pacific (Osaka-Local)',
          short: 'ap-northeast-3 - Asia Pacific (Osaka-Local)'
        }, {
          value: 'ap-southeast-1',
          name: icli.format.info('ap-southeast-1') + ' Asia Pacific (Singapore)',
          short: 'ap-southeast-1 - Asia Pacific (Singapore)'
        }, {
          value: 'ap-southeast-2',
          name: icli.format.info('ap-southeast-2') + ' Asia Pacific (Sydney)',
          short: 'ap-southeast-2 - Asia Pacific (Sydney)'
        }
      ]
    };
  }
496339
def get_parent_active_language_choices(parent_object, exclude_current=False):
    
    assert parent_object is not None, "Missing parent_object!"

    from .db import ContentItem
    qs = ContentItem.objects \
        .parent(parent_object, limit_parent_language=False) \
        .values_list('language_code', flat=True).distinct()

    languages = set(qs)

    if exclude_current:
        parent_lang = get_parent_language_code(parent_object)
        languages.discard(parent_lang)

    if parler_appsettings.PARLER_LANGUAGES and not parler_appsettings.PARLER_SHOW_EXCLUDED_LANGUAGE_TABS:
        site_id = get_parent_site_id(parent_object)
        try:
            lang_dict = parler_appsettings.PARLER_LANGUAGES[site_id]
        except KeyError:
            lang_dict = ()

        allowed_languages = set(item['code'] for item in lang_dict)
        languages &= allowed_languages

    # No multithreading issue here, object is instantiated for this user only.
    choices = [(lang, str(get_language_title(lang))) for lang in languages if lang]
    choices.sort(key=lambda tup: tup[1])
    return choices
1300091
private I_CmsSearchIndex getIndex() {

        I_CmsSearchIndex index = null;
        // get the configured index or the selected index
        if (isInitialCall()) {
            // the search form is in the initial state
            // get the configured index
            index = OpenCms.getSearchManager().getIndex(getSettings().getUserSettings().getWorkplaceSearchIndexName());
        } else {
            // the search form is not in the inital state, the submit button was used already or the
            // search index was changed already
            // get the selected index in the search dialog
            index = OpenCms.getSearchManager().getIndex(getJsp().getRequest().getParameter("indexName.0"));
        }
        return index;
    }
719360
private void setLocale(Locale l, boolean select) {
		Locale oldLocale = locale;
		locale = l;
		int n = 0;

		if (select) {
			for (int i = 0; i < localeCount; i++) {
				if (locales[i].getCountry().length() > 0) {
					if (locales[i].equals(locale))
						setSelectedIndex(n);
					n += 1;
				}
			}
		}

		firePropertyChange("locale", oldLocale, locale);
		if(component != null) {
		    component.setLocale(l);
		}
	}
174607
def __Languages_comboBox_set_default_view_state(self):
        

        if not self.__container.has_editor_tab():
            return

        editor = self.__container.get_current_editor()
        index = self.Languages_comboBox.findText(editor.language.name)

        self.Languages_comboBox.setCurrentIndex(index)
216212
def GetValue(self):
    '''
    
    '''
    self.AssertInitialization('Choice')
    if self._widget.GetValue() == self._DEFAULT_VALUE:
      return None
    return ' '.join(
      [self._action.option_strings[0] if self._action.option_strings else '',  # get the verbose copy if available
       self._widget.GetValue()])
896967
public String convertIndexToDisStr(int index)
    {
        if (index == CalendarEntry.ANNIVERSARY_ID)
            return ANNIVERSARY;
        if (index == CalendarEntry.APPOINTMENT_ID)
            return APPOINTMENT;
        return null;
    }
27419
function getIndexLogTranslations(type = TYPE_WIDGETS) {
  const params = { type: t(`TYPE_${type}`) };

  return {
    logStart: `  ${t('INDEXING_TYPE', params)}`,
    logEnd: `  ${t('INDEXED_TYPE', params)}`,
    logNotFound: `  ${t('NO_EXTENSIONS_FOUND_FOR_TYPE', params)}`,
  };
}
470435
String getOption(String[] options, int index) {
        if ((options != null) && (options.length > index)) {
            return options[index];
        }
        return null;
    }
671301
def options(self):
        
        if self.is_optionhandler:
            return typeconv.string_array_to_list(javabridge.call(self.jobject, "getOptions", "()[Ljava/lang/String;"))
        else:
            return []
1183794
def list_get(l, idx, default=None):
    
    try:
        if l[idx]:
            return l[idx]
        else:
            return default
    except IndexError:
        return default
1257951
public static SelectOptions getOptionsForLanguageStatic(Locale setLocale, Locale prevLocale) {

        // get available locales from the workplace manager
        List<Locale> locales = OpenCms.getWorkplaceManager().getLocales();
        List<String> options = new ArrayList<String>(locales.size());
        List<String> values = new ArrayList<String>(locales.size());
        int checkedIndex = 0;
        int counter = 0;
        Iterator<Locale> i = locales.iterator();
        while (i.hasNext()) {
            Locale currentLocale = i.next();
            // add all locales to the select box
            String language = currentLocale.getDisplayLanguage(setLocale);
            if (CmsStringUtil.isNotEmpty(currentLocale.getCountry())) {
                language = language + " (" + currentLocale.getDisplayCountry(setLocale) + ")";
            }
            if (CmsStringUtil.isNotEmpty(currentLocale.getVariant())) {
                language = language + " (" + currentLocale.getDisplayVariant(setLocale) + ")";
            }
            options.add(language);
            values.add(currentLocale.toString());
            if (prevLocale.toString().equals(currentLocale.toString())) {
                // mark the currently active locale
                checkedIndex = counter;
            }
            counter++;
        }
        SelectOptions selectOptions = new SelectOptions(options, values, checkedIndex);
        return selectOptions;
    }
704885
@Deprecated
    public Object getOptionObject(String opt)
    {
        try
        {
            return getParsedOptionValue(opt);
        }
        catch (ParseException pe)
        {
            System.err.println("Exception found converting " + opt + " to desired type: " + pe.getMessage());
            return null;
        }
    }
433755
def index(ctx, view):
    """"""
    adapter = ctx.obj['adapter']
    if view:
        click.echo(adapter.indexes())
        return
    adapter.ensure_indexes()