Check :func:`word_embedding_loader.loader.glove.check_valid` for the API.
174792
def check_valid(line0, line1):
    
    data0 = line0.split(b' ')
    if len(data0) != 2:
        return False
    # check if data0 is int values
    try:
        map(int, data0)
        _parse_line(line1, float)
    except:
        return False
    return True
538894
def check(self, spec, data):
        '''
        '''
        path_eval = self.path_eval
        for keypath, specvalue in spec.items():
            if keypath.startswith('$'):
                optext = keypath
                checkable = data
                args = (optext, specvalue, checkable)
                generator = self.dispatch_operator(*args)
            else:
                try:
                    checkable = path_eval(data, keypath)
                except self.InvalidPath:
                    # The spec referenced an item or attribute that
                    # doesn't exist. Fail!
                    return False
                generator = self.dispatch_literal(specvalue, checkable)
            for result in generator:
                if not result:
                    return False
        return True
1223836
def is_valid_method(model, resource=None):
    """"""
    validation_function_name = 'is_valid_{}'.format(
        request.method.lower())
    if hasattr(model, validation_function_name):
        return getattr(model, validation_function_name)(request, resource)
532486
def check_valid(self):
		
		for k,input in self.inputs.items():
			if k in self.valid_opts:
				for param in self.valid_opts[k]:
					if param is None or input is None:
						return True
					elif type(param) is str and '+' in param:
						if re.search(r'^'+param,str(input)):
							return True
					elif type(param) is bool and type(input) is bool:
						return True
					elif type(param) is list and type(input) is list:
						return True
					else:
						if str(input).lower() == str(param):
							return True
				raise ValueError("Invalid input for '%s' parameter. Options are: %s" % (k,' '.join(["'%s'," % str(o) for o in self.valid_opts[k]]) ))
			else:
				raise ValueError("Invalid parameter for '%s'. Params are: %s" % (self.__class__.__name__,', '.join(["'%s'" % p for p in self.valid_opts.keys()]) ))
983295
def validate_readable(option, value):
    
    if value is None:
        return value
    # First make sure its a string py3.3 open(True, 'r') succeeds
    # Used in ssl cert checking due to poor ssl module error reporting
    value = validate_string(option, value)
    open(value, 'r').close()
    return value
306326
def keys_are_valid(self, tag_value):
        """"""
        for key in ScheduleParser.raw_data(tag_value):
            if key not in ('on', 'off', 'tz'):
                return False
        return True
41311
def compat_serializer_check_is_valid(serializer):
    
    if DRFVLIST[0] >= 3:
        serializer.is_valid(raise_exception=True)
    else:
        if not serializer.is_valid():
            serializers.ValidationError('The serializer raises a validation error')
703511
def _is_valid_amendment_json(self, json_repr):
        """"""
        amendment = self._coerce_json_to_amendment(json_repr)
        if amendment is None:
            # invalid JSON, definitely broken
            return False
        aa = validate_amendment(amendment)
        errors = aa[0]
        for e in errors:
            _LOG.debug('> invalid JSON: {m}'.format(m=e.encode('utf-8')))
        if len(errors) > 0:
            return False
        return True
712600
function check(err, res, body) {
    if (err) {
        return this.machine(err);
    }
    var obj;
    try {
        obj = JSON.parse(body);
    } catch (e) {
        return this.machine(new Error('Failed to parse as JSON (' + e.message + ') the text: ' + body));
    }
    if (res.statusCode !== 200) {
        return this.machine(obj);
    }
    this.machine(err, obj);
}
34692
def assert_valid_input(cls, tag):
        """"""

        # Fail on unexpected types.
        if not cls.is_tag(tag):
            raise TypeError("Expected a BeautifulSoup 'Tag', but instead recieved type {}".format(type(tag)))
1203304
def is_answer_valid(self, ans):
        """"""
        return ans in [str(i+1) for i in range(len(self.choices))]
541815
def valid_status(*valid):
  """"""
  def decorator(func):
    @functools.wraps(func)
    def _valid_status(self, *args, **kwargs):
      if self.status not in valid:
        raise protocol.ProtocolError(
            "`%s` called while in state: %s, valid: (%s)" % (
                func.__name__, self.status, ",".join(map(str, valid))))
      return func(self, *args, **kwargs)
    return _valid_status
  return decorator
208699
def _is_valid_dkim(self, value):
        """"""
        validator_dict = {'h': lambda val: val in ['sha1', 'sha256'],
                          's': lambda val: val in ['*', 'email'],
                          't': lambda val: val in ['y', 's'],
                          'v': lambda val: val == 'DKIM1',
                          'k': lambda val: val == 'rsa',
                          'n': lambda _: True,
                          'g': lambda _: True}

        splitted = value.split('\\;')
        found_key = False
        for splitted_value in splitted:
            sub_split = map(lambda x: x.strip(), splitted_value.split("=", 1))
            if len(sub_split) < 2:
                return False
            key, value = sub_split[0], sub_split[1]
            if key == "p":
                is_valid_key = self._is_valid_dkim_key(value)
                if not is_valid_key:
                    return False
                found_key = True
            else:
                is_valid_key = validator_dict.get(key, lambda _: False)(value)
                if not is_valid_key:
                    return False
        return found_key
857768
def valid(cls, data, context=None):
        """"""
        return cls(cls.TagType.VALID, data, context)
752556
def is_valid(obj: JSGValidateable, log: Optional[Union[TextIO, Logger]] = None) -> bool:
    
    return obj._is_valid(log)
1083272
def _check_valid(key, val, valid):
    """"""
    if val not in valid:
        raise ValueError('%s must be one of %s, not "%s"'
                         % (key, valid, val))
745958
def ok_check(function, *args, **kwargs):
    ''''''
    req = function(*args, **kwargs)
    if req.content.lower() != 'ok':
        raise ClientException(req.content)
    return req.content