Returns the default selection from a choice menu
        Throws an error if this is not a choice parameter.
505620
def get_choice_selected_value(self):
        
        if 'choiceInfo' not in self.dto[self.name]:
            raise GPException('not a choice parameter')
        choice_info_dto = self.dto[self.name]['choiceInfo']
        if 'selectedValue' in choice_info_dto:
            return self.dto[self.name]['choiceInfo']['selectedValue']
        else:
            return None
515199
def get_input(prompt, default=None, choices=None, option_value=None):
    
    if option_value is not None:
        return option_value
    
    choices = choices or []
    while 1:
        r = input(prompt+' ').strip()
        if not r and default is not None:
            return default
        if choices:
            if r not in choices:
                r = None
            else:
                break
        else:
            break
    return r
1367800
def GetDefault(self, fd=None, default=None):
    """"""
    if callable(self.default):
      return self.default(fd)

    if self.default is not None:
      # We can't return mutable objects here or the default might change for all
      # objects of this class.
      if isinstance(self.default, rdfvalue.RDFValue):
        default = self.default.Copy()
        default.attribute_instance = self
        return self(default)
      else:
        return self(self.default)

    if isinstance(default, rdfvalue.RDFValue):
      default = default.Copy()
      default.attribute_instance = self

    return default
658693
def DefaultSelector():
    
    global _DEFAULT_SELECTOR
    if _DEFAULT_SELECTOR is None:
        if platform.python_implementation() == 'Jython':  # Platform-specific: Jython
            _DEFAULT_SELECTOR = JythonSelectSelector
        elif _can_allocate('kqueue'):
            _DEFAULT_SELECTOR = KqueueSelector
        elif _can_allocate('devpoll'):
            _DEFAULT_SELECTOR = DevpollSelector
        elif _can_allocate('epoll'):
            _DEFAULT_SELECTOR = EpollSelector
        elif _can_allocate('poll'):
            _DEFAULT_SELECTOR = PollSelector
        elif hasattr(select, 'select'):
            _DEFAULT_SELECTOR = SelectSelector
        else:  # Platform-specific: AppEngine
            raise RuntimeError('Platform does not have a selector.')
    return _DEFAULT_SELECTOR()
563133
def default_value(self):
        
        if self.has_default:
            if hasattr(self.default, '__call__'):
                return self.default()
            else:
                return self.default
        else:
            raise Exception("No default value specified")
192937
def choice_default_loader(self, pk):
        """"""
        try:
            obj = Choice.objects.get(pk=pk)
        except Choice.DoesNotExist:
            return None
        else:
            self.choice_default_add_related_pks(obj)
            return obj
411718
private void addDefaultsIfNeeded(ServletRequest req)
            throws JspException
    {
        if (_defaultSelections != null) {
            Iterator iterator = _defaultSelections.iterator();
            while (iterator.hasNext()) {
                Object selection = iterator.next();
                if (!_optionList.contains(selection)) {
                    addOption(req, selection.toString(), selection.toString());
                }
            }
        }
    }
1231776
private void checkAndApplyDefaultValue(Option o, Map<String, String> data) throws RequiredParametersException {
		if (hasNoDefaultValueAndNoValuePassedOnAlternativeName(o, data)) {
			throw new RequiredParametersException("No default value for undefined parameter " + o.getName());
		}
	}
746297
def compute_default_choice(self):
        """"""

        choices = self.choices

        if len(choices) == 0:
            return None

        high_choice = max(choices, key=lambda choice: choice.performance)
        self.redis.hset(EXPERIMENT_REDIS_KEY_TEMPLATE % self.name, "default-choice", high_choice.name)
        self.refresh()
        return high_choice
1233286
function (question, defaultValue) {
  var choiceValues = _.map(question.choices, function (choice) {
    if (typeof choice === 'object') {
      return choice.value;
    } else {
      return choice;
    }
  });

  return choiceValues.indexOf(defaultValue);
}
194459
def choice(opts, default=1, text='Please make a choice.'):
    
    opts_len = len(opts)
    opts_enum = enumerate(opts, 1)
    opts = list(opts)

    for key, opt in opts_enum:
        click.echo('[{k}] {o}'.format(k=key, o=opt[1] if isinstance(opt, tuple) else opt))

    click.echo('-' * 12)
    opt = click.prompt(text, default, type=click.IntRange(1, opts_len))
    opt = opts[opt - 1]
    return opt[0] if isinstance(opt, tuple) else opt
978227
def choice(*es):
    
    msg = 'Expected one of: {}'.format(', '.join(map(repr, es)))
    def match_choice(s, grm=None, pos=0):
        errs = []
        for e in es:
            try:
                return e(s, grm, pos)
            except PegreError as ex:
                errs.append((ex.message, ex.position))
        if errs:
            raise PegreChoiceError(errs, pos)
    return match_choice
977917
def choicebox(message='Pick something.', title='', choices=['program logic error - no choices specified']):
    
    return psidialogs.choice(message=message, title=title, choices=choices)
847532
function defaults(options, defaultOption) {
  options = options || {};
  for (var i in defaultOption) {
    if (own(defaultOption, i) && !(i in options)) options[i] = defaultOption[i];
  }
  return options
}
1326508
def get_choices(cls, category):
        """"""
        value = cls._DEFAULTS[category]
        if not isinstance(value, list):
            raise ValueError("{} does not offer choices".format(category))
        return value
473684
def ConfigureViewTypeChoices( self, event=None ):
        """"""
        self.viewTypeTool.SetItems( getattr( self.loader, 'ROOTS', [] ))
        if self.loader and self.viewType in self.loader.ROOTS:
            self.viewTypeTool.SetSelection( self.loader.ROOTS.index( self.viewType ))
            
        # configure the menu with the available choices...
        def chooser( typ ):
            def Callback( event ):
                if typ != self.viewType:
                    self.viewType = typ 
                    self.OnRootView( event )
            return Callback
        # Clear all previous items
        for item in self.viewTypeMenu.GetMenuItems():
            self.viewTypeMenu.DeleteItem( item )
        if self.loader and self.loader.ROOTS:
            for root in self.loader.ROOTS:
                item = wx.MenuItem( 
                    self.viewTypeMenu, -1, root.title(), 
                    _("View hierarchy by %(name)s")%{
                        'name': root.title(),
                    },
                    kind=wx.ITEM_RADIO,
                )
                item.SetCheckable( True )
                self.viewTypeMenu.AppendItem( item )
                item.Check( root == self.viewType )
                wx.EVT_MENU( self, item.GetId(), chooser( root ))
341374
def _pick_selected_option(cls):
        
        for option in cls.select_el:
            # if the select is empty
            if not hasattr(option, "selected"):
                return None

            if option.selected:
                return option.value

        return None