Return True if string is valid
198262
def is_valid(self, qstr=None):
        """"""
        if qstr is None:
            qstr = self.currentText()
        return osp.isfile(to_text_string(qstr))
732408
function isValid(desc) {
      if (desc.validator) {
        if (desc.validator instanceof RegExp) {
          return !desc.validator.test(value);
        }

        return !desc.validator(value);
      }
      return false;
    }
1169221
def validate_string_param(s, valid, param_name="param"):
    
    if s.lower() not in valid:
        raise YellowbrickValueError(
            "unknown {} '{}', chose from '{}'".format(
                param_name, s, ", ".join(valid)
            )
        )
1167904
private static String validString(Object data) throws IOException {
        // Null is ok
        if (data == null) {
            return "";
        }
        if (!(data instanceof String)) {
            throw new IOException("Invalid non-String value found!");
        }
        return (String) data;
    }
667004
def check_is_a_string(var, allow_none=False):
    
    if not is_a_string(var, allow_none=allow_none):
        raise TypeError("var must be a string, however type(var) is {}"
                        .format(type(var)))
680299
def is_valid(cls, arg):
        
        return (isinstance(arg, (int, long)) and (arg >= 0)) or \
            isinstance(arg, str)
868205
def bool_str(string):
    """'"""
    if string not in BOOL_STRS:
        raise ValueError('Invalid boolean string: "{}"'.format(string))
    return True if string == 'true' else False
1207667
def validate_str(s):
    """"""
    if not isinstance(s, six.string_types):
        raise ValueError("Did not found string!")
    return six.text_type(s)
95619
def valid_value?(v)
      v.respond_to?(:nan?) && v.nan? || v.nil? ? false : true
    end
698568
def is_valid(cls, arg):
        """"""
        if isinstance(arg, list):
            allInts = allStrings = True
            for elem in arg:
                allInts = allInts and ((elem == 0) or (elem == 1))
                allStrings = allStrings and elem in cls.bitNames

            if allInts or allStrings:
                return True
        return False
682024
def Validate(self, value, **_):
    """"""
    if isinstance(value, rdfvalue.RDFString):
      # TODO(hanuszczak): Use `str` here.
      return Text(value)

    if isinstance(value, Text):
      return value

    if isinstance(value, bytes):
      return value.decode("utf-8")

    raise type_info.TypeValueError("Not a valid unicode string: %r" % value)
857768
def valid(cls, data, context=None):
        """"""
        return cls(cls.TagType.VALID, data, context)
1175054
static boolean isCOctetStringNullOrNValValid(String value,
            int length) {
        if (value == null) {
            return true;
        }
        
        if (value.length() == 0) {
            return true;
        }
        
        if (value.length() == length - 1) {
            return true;
        }
        return false;
    }
449290
def check(self, data):
        """"""
        if isinstance(data, Iterable):
            data = "".join(str(x) for x in data)
        try:
            data = str(data)
        except UnicodeDecodeError:
            return False
        return bool(data and self.__regexp.match(data))
1294084
def is_valid_variable_name(string_to_check):
    

    try:

        parse('{} = None'.format(string_to_check))
        return True

    except (SyntaxError, ValueError, TypeError):

        return False
865299
public static function validate($string)
    {
        try {
            if (is_numeric($string) && (int)$string == $string) {
                $date = new DateTime('@' . $string);
            } else {
                $date = self::parse($string);
            }
        } catch (Exception $ex) {
            return false;
        }

        // String is empty or not a valid date
        if (empty($string) || $date === false) {
            return false;

            // String is a valid date
        } else {
            return true;
        }
    }
935036
def __isValidFilename(self, filename):
        """"""
        if filename and isinstance(filename, string_types):
            if re.match(r'^[\w\d\_\-\.]+$', filename, re.I):
                if self.__isValidTGZ(filename) or self.__isValidZIP(filename):
                    return True
        return False