Return current option value if no value given. Create new
 object with given option set if value given.
774560
def option(key, *value)
      if value.empty?
        value = options[key]
        value = value[0] if value && value.size == 1
        value
      else
        options(key => value)
      end
    end
365142
def _load(self, value: Any):
        

        if value in self.empty_values:
            # If a default has been set for the field return it
            if self.default is not None:
                default = self.default
                value = default() if callable(default) else default
                return value

            # If no default is set and this field is required
            elif self.required:
                self.fail('required')

            # In all other cases just return `None` as we do not want to
            # run validations against an empty value
            else:
                return None

        # If choices exist then validate that value is be one of the choices
        if self.choices:
            value_list = value
            if not isinstance(value, (list, tuple)):
                value_list = [value]
            for v in value_list:
                if v not in self.choice_dict:
                    self.fail(
                        'invalid_choice', value=v,
                        choices=list(self.choice_dict))

        # Cast and Validate the value for this Field
        value = self._cast_to_type(value)

        # Call the rest of the validators defined for this Field
        self._run_validators(value)

        return value
969524
def get_option(self, key):
        """"""
        return self._options.get(key, self._default_options[key])
1325295
def get_opt( self, opt):
    
    if self.__options.has_key(opt):
      return self.__options[opt]
    return None
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
646000
public T get(@Nullable Map<FindOption<?>, ?> options) {
        if (options == null) {
            return defaultValue();
        }

        @SuppressWarnings("unchecked")
        final T value = (T) options.get(this);
        if (value == null) {
            return defaultValue();
        }

        return value;
    }
367787
public String getOptionValue(String opt)
    {
        String[] values = getOptionValues(opt);

        return (values == null) ? null : values[0];
    }
982173
def option(
        value,
        default='',
        omit_opts=False,
        omit_master=False,
        omit_pillar=False):
    '''
    
    '''
    if not omit_opts:
        if value in __opts__:
            return __opts__[value]
    if not omit_master:
        if value in __pillar__.get('master', {}):
            return __pillar__['master'][value]
    if not omit_pillar:
        if value in __pillar__:
            return __pillar__[value]
    if value in DEFAULTS:
        return DEFAULTS[value]
    return default
758836
@SuppressWarnings("unchecked")
    private UNode optionValueToUNode(String optName, Object optValue) {
        if (!(optValue instanceof Map)) {
            if (optValue == null) {
                optValue = "";
            }
            return UNode.createValueNode(optName, optValue.toString(), "option");
        }
        UNode optNode = UNode.createMapNode(optName, "option");
        Map<String, Object> suboptMap = (Map<String,Object>)optValue;
        for (String suboptName : suboptMap.keySet()) {
            optNode.addChildNode(optionValueToUNode(suboptName, suboptMap.get(suboptName)));
        }
        return optNode;
    }
618914
function(option) {
            var current = this.jsonQ_current,
                newObj = this.cloneObj(jsonQ()),
                newCurrent = newObj.jsonQ_current = [],
                prevPathStr = '',
                key = option.key,
                method = option.method;

            for (var i = 0, ln = current.length; i < ln; i++) {
                var pathC = current[i].path,
                    pathStr,
                    outofBound = false,
                    parPath = pathC.concat([]);

                //to run callback to apply top traverse logic
                if (method == 'parent') {
                    if (parPath.length === 0) {
                        outofBound = true;
                    } else {
                        parPath.pop();
                    }
                } else {
                    var keyIndex = parPath.lastIndexOf(key);
                    if (keyIndex == -1) {
                        outofBound = true;
                    } else {
                        parPath = parPath.slice(0, keyIndex + 1);
                    }
                }

                pathStr = JSON.stringify(parPath);

                if (prevPathStr != pathStr && !outofBound) {
                    newCurrent.push({
                        path: parPath
                    });
                }

                prevPathStr = pathStr;
            }

            //set other definition variables
            newObj.length = newCurrent.length;
            //to add selector
            newObj.selector.push({
                method: method,
                key: key
            });

            return newObj;
        }
1286291
def set_option(name, value):
    
    d = globals()

    if name in {'get_option', 'set_option'} or name not in d:
        from ..exceptions import PlotnineError
        raise PlotnineError("Unknown option {}".format(name))

    old = d[name]
    d[name] = value
    return old
594015
def get(self, option, default=undefined, cast=undefined):
        

        # We can't avoid __contains__ because value may be empty.
        if option in os.environ:
            value = os.environ[option]
        elif option in self.repository:
            value = self.repository[option]
        else:
            if isinstance(default, Undefined):
                raise UndefinedValueError('{} not found. Declare it as envvar or define a default value.'.format(option))

            value = default

        if isinstance(cast, Undefined):
            cast = self._cast_do_nothing
        elif cast is bool:
            cast = self._cast_boolean

        return cast(value)
972678
@Override
  protected Object getOptionValue(Queue<String> argq) {
    return Float.parseFloat(argq.remove());
  }
1125086
def eval_option_value(self, option):
        
        try:
            value = eval(option, {}, {})
        except (SyntaxError, NameError, TypeError):
            return option
        if type(value) in (str, bool, int, float):
            return value
        elif type(value) in (list, tuple):
            for v in value:
                if type(v) not in (str, bool, int, float):
                    self._write_error("Value of element of list object has wrong type %s" % v)
            return value
        return option
250570
def set(self, option, value=None):
        
        option = self._container.optionxform(option)
        if option in self.options():
            self.__getitem__(option).value = value
        else:
            self.__setitem__(option, value)
        return self
157870
def fetch(self, value_obj=None):
        '''  '''
        val = None
        try:
            val = next(self.__iterable)
        except StopIteration:
            return None
        if value_obj is None:
            value_obj = Value(value=val)
        else:
            value_obj.value = val
        return value_obj
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