Optional

		Getter/Setter method for optional flag

		Args:
			value (bool): If set, the method is a setter

		Returns:
			bool | None
329869
def optional(self, value = None):
		

		# If there's no value, this is a getter
		if value is None:
			return this._optional

		# Else, set the flag
		else:
			this._optional = value and True or False
7334
def get_bool(self, key, default=None):
        
        value = self.get_str(key)
        if value is not None:
            return to_boolean(value)

        return default
698828
def nonce(self, value):
        

        if not isinstance(value, bool):
            raise TypeError(_pretty_message(
                '''
                nonce must be a boolean, not %s
                ''',
                _type_name(value)
            ))

        self._nonce = value
78370
def value_convert(self, value, value_type):
        
        CONVERSION_OPTIONS = {
            "str": str,
            "int": int,
            "float": float,
            # Treat booleans specially
            "bool": (lambda val: val.lower() in ("true", "1")),
            # Auto-guess the type
            "auto": self.make_value,
        }

        try:
            return CONVERSION_OPTIONS[value_type](value)
        except (TypeError, ValueError):
            self.notify_user("Bad type conversion")
            return None
312553
def _parse_boolean(value, default=False):
    
    if value is None:
        return default
    try:
        return bool(value)
    except ValueError:
        return default
1154531
def passes(self, value):
        
        try:
            if self._op.compare(value, self.value):
                return True, None
            else:
                return False, self.value
        except ValueError as err:
            return False, str(err)
4101
def flag_on?(column_value, bitset, flag)
      val = column_value || 0
      (val & bitset.const_get(flag)) != 0
    end
1343850
ArgumentsBuilder flag(String param, Boolean value) {
        if (Boolean.TRUE.equals(value)) {
            args.add(param);
        }
        return this;
    }
1028331
def encode(cls, value):
        
        if value not in [True, False]:
            raise InvalidValue('not a boolean')

        return b'1' if value else b''
1198414
def method(value, arg):
    
    if hasattr(value, str(arg)):
        return getattr(value, str(arg))
    return "[%s has no method %s]" % (value, arg)
896416
def setValue(self, value):
        
        if isinstance(value, Text):
            self.value = value
        else:
            self.value = Text(value)
        return self
878606
def validate_value(self, value):
        
        field = self.instance.preference.setup_field()
        value = field.to_python(value)
        field.validate(value)
        field.run_validators(value)
        return value
732650
def svalue(self, value):
        

        if value is not None:  # if value is not None
            self._value = None
            self._error = None

        self._svalue = value
375464
public void setBool(Boolean value) {
		this.checkNull(value);
		list.add(value);
		type.add(Boolean.class);
	}
317223
def set(self, value):
        

        if not isinstance(value, int_types) and not isinstance(value, str_cls):
            raise TypeError(unwrap(
                '''
                %s value must be an integer or a unicode string, not %s
                ''',
                type_name(self),
                type_name(value)
            ))

        if isinstance(value, str_cls):
            if value not in self._reverse_map:
                raise ValueError(unwrap(
                    '''
                    %s value "%s" is not a valid value
                    ''',
                    type_name(self),
                    value
                ))

            value = self._reverse_map[value]

        elif value not in self._map:
            raise ValueError(unwrap(
                '''
                %s value %s is not a valid value
                ''',
                type_name(self),
                value
            ))

        Integer.set(self, value)
671548
def checkValue(self,value,strict=0):
        
        v = self._coerceValue(value,strict)
        return self.checkOneValue(v,strict)
1258028
def setCurrentValue(self, value):
        
        enum = self.enum()
        if not enum:
            return
        
        if self.isCheckable():
            indexes = []
            for i in range(self.count()):
                try:
                    check_value = enum[nativestring(self.itemText(i))]
                except KeyError:
                    continue
                
                if check_value & value:
                    indexes.append(i)
            self.setCheckedIndexes(indexes)
        else:
            try:
                text = enum[value]
            except (AttributeError, KeyError):
                return
            
            self.setCurrentIndex(self.findText(text))