is raised if the format is invalid.
964514
public static function decode_websocket_events($body)
    {
        $out = array();
        $start = 0;
        while ($start < strlen($body)) {
            $at = strpos($body, "\r\n", $start);
            if ($at === false) {
                throw new \RuntimeException('bad format');
            }
            $typeline = substr($body, $start, $at - $start);
            $start = $at + 2;
            $at = strpos($typeline, ' ');
            $e = null;
            if (!($at === false)) {
                $etype = substr($typeline, 0, $at);
                $clen = intval('0x' . substr($typeline, $at + 1), 16);
                $content = substr($body, $start, $clen);
                $start += $clen + 2;
                $e = new WebSocketEvent($etype, $content);
            } else {
                $e = new WebSocketEvent($typeline);
            }
            $out[] = $e;
        }
        return $out;
    }
213557
public static boolean isFormatCorrect(String fileName, ReadOnlyStorageFormat format) {
        switch(format) {
            case READONLY_V0:
            case READONLY_V1:
                if(fileName.matches("^[\\d]+_[\\d]+\\.(data|index)")) {
                    return true;
                } else {
                    return false;
                }

            case READONLY_V2:
                if(fileName.matches("^[\\d]+_[\\d]+_[\\d]+\\.(data|index)")) {
                    return true;
                } else {
                    return false;
                }

            default:
                throw new VoldemortException("Format type not supported");
        }
    }
973997
def requires_conversion(cls, fileset, file_format):
        """"""
        if file_format is None:
            return False
        try:
            filset_format = fileset.format
        except AttributeError:
            return False  # Field input
        else:
            return (file_format != filset_format)
1289076
def validate(input)
      (check_exists(required_inputs, input) &&
        check_format(input_formats, input)) || 
      (raise Errors::InvalidInput, "Invalid input for #{self.class.name}")
    end
1079327
def raise_invalid_type_exception(self):
        """"""
        message = 'Expecting element type of %s' % (
            self._parameter.element_type.__name__)
        err = ValueError(message)
        return err
647699
public static function isSupportedFormat($format)
    {
        if (!is_string($format)) {
            throw new Exception\InvalidArgumentException(__METHOD__ . " file_format must be a string");
        }
        return in_array((string) $format, self::$supportedFormats);
    }
1132929
private static boolean missingFormatArgs(String value) {
    try {
      Formatter.check(value);
    } catch (MissingFormatArgumentException e) {
      return true;
    } catch (Exception ignored) {
      // we don't care about other errors (it isn't supposed to be a format string)
    }
    return false;
  }
1269414
def _validate_format(req):
        '''
        
        '''
        #check for all required keys
        for key in SLOJSONRPC._min_keys:
            if not key in req:
                logging.debug('JSONRPC: Fmt Error: Need key "%s"' % key)
                raise SLOJSONRPCError(-32600)

        #check all keys if allowed
        for key in req.keys():
            if not key in SLOJSONRPC._allowed_keys:
                logging.debug('JSONRPC: Fmt Error: Not allowed key "%s"' % key)
                raise SLOJSONRPCError(-32600)

        #needs to be jsonrpc 2.0
        if req['jsonrpc'] != '2.0':
            logging.debug('JSONRPC: Fmt Error: "jsonrpc" needs to be "2.0"')
            raise SLOJSONRPCError(-32600)
473962
def raise_on_invalid(self, setting=True, **overrides):
        """"""
        return self.where(raise_on_invalid=setting, **overrides)
420951
def validate(result)
      if result.ntuples == 0
        raise NotFound
      elsif result.ntuples > 1
        raise TooManyChoices
      end
    end
34863
def _raise_exception(self, eobj, edata=None):
        """"""
        _, _, tbobj = sys.exc_info()
        if edata:
            emsg = self._format_msg(eobj["msg"], edata)
            _rwtb(eobj["type"], emsg, tbobj)
        else:
            _rwtb(eobj["type"], eobj["msg"], tbobj)
139598
private function validateGreaterThan(): bool
    {
        if ($this->options['inclusive'] === true) {
            $isValid = \mb_strlen($this->value, 'UTF-8') >= $this->options['length'] ? true : false;
            if (!$isValid) {
                $this->setError(self::VALIDATOR_ERROR_STRING_LENGTH_MUST_BE_HIGHER_OR_EQUAL_TO_MIN);
            }
            return $isValid;
        }

        $isValid = \mb_strlen($this->value, 'UTF-8') > $this->options['length'] ? true : false;
        if (!$isValid) {
            $this->setError(self::VALIDATOR_ERROR_STRING_LENGTH_MUST_BE_HIGHER_THAN_MIN);
        }
        return $isValid;
    }
639181
public function isValid($value)
    {
        $this->_setValue($value);
        if (!is_string($value) && !is_int($value)) {
            $this->_error(self::INVALID);
            return false;
        }

        $format = $this->getFormat();
        if (!preg_match($format, $value)) {
            $this->_error(self::NO_MATCH);
            return false;
        }

        return true;
    }
649109
private boolean isValidAttrValue(String value) {
        final float parseFloat;
        try {
            parseFloat = Float.parseFloat(value);
        } catch (NumberFormatException e) {
            return false;
        }
        return parseFloat >= 1;
    }
3556
private function isValidFormat($date)
    {
        foreach ($this->formats as $format) {
            if (date($format, strtotime($date)) == $date) {
                return true;
            }
        }

        return false;
    }
34753
def assert_valid_value(value)
      unless valid?(value)
        raise Property::InvalidValueError.new(self,value)
      end
      true
    end
1259044
def _validate_format(self, format, kwargs):
        
        kwargs = kwargs.copy()

        # validate
        try:
            kwargs['format'] = _FORMAT_MAP[format.lower()]
        except KeyError:
            raise TypeError("invalid HDFStore format specified [{0}]"
                            .format(format))

        return kwargs