Rough check that the embedded program in the object is valid.
519723
def validate_program(self):
        """"""
        terminals = [0]
        for node in self.program:
            if isinstance(node, _Function):
                terminals.append(node.arity)
            else:
                terminals[-1] -= 1
                while terminals[-1] == 0:
                    terminals.pop()
                    terminals[-1] -= 1
        return terminals == [-1]
976333
def validate(self):
        """"""
        # Literals representing boolean values or None are correctly representable and supported.
        if self.value is None or self.value is True or self.value is False:
            return

        # Literal safe strings are correctly representable and supported.
        if isinstance(self.value, six.string_types):
            validate_safe_string(self.value)
            return

        # Literal ints are correctly representable and supported.
        if isinstance(self.value, int):
            return

        # Literal empty lists, and non-empty lists of safe strings, are
        # correctly representable and supported.
        if isinstance(self.value, list):
            if len(self.value) > 0:
                for x in self.value:
                    validate_safe_string(x)
            return

        raise GraphQLCompilationError(u'Cannot represent literal: {}'.format(self.value))
828650
def validate(obj, schema):
  """"""
  if not framework.EvaluationContext.current().validate:
    # Short circuit evaluation when disabled
    return obj

  # Validate returned object according to its own schema
  if hasattr(obj, 'tuple_schema'):
    obj.tuple_schema.validate(obj)
  # Validate object according to externally imposed schema
  if schema:
    schema.validate(obj)
  return obj
174045
def checkmagic(self):
        """"""
        #magic is at EOF; if we're embedded, we need to figure where that is
        if self.len:
            self.lib.seek(self.start+self.len, 0)
        else:
            self.lib.seek(0, 2)
        filelen = self.lib.tell()
        if self.len:
            self.lib.seek(self.start+self.len-self.TRLLEN, 0)
        else:
            self.lib.seek(-self.TRLLEN, 2)
        (magic, totallen, tocpos, toclen, pyvers) = struct.unpack(self.TRLSTRUCT,
                            self.lib.read(self.TRLLEN))
        if magic != self.MAGIC:
            raise RuntimeError("%s is not a valid %s archive file"
                               % (self.path, self.__class__.__name__))
        self.pkgstart = filelen - totallen
        if self.len:
            if totallen != self.len or self.pkgstart != self.start:
                raise RuntimeError, "Problem with embedded archive in %s" % self.path
        self.tocpos, self.toclen = tocpos, toclen
445831
def is_in(property_name, set_values, *, present_optional=False, message=None):
    """"""
    def check(val):
      """Checks that a value is contained within a scope-enclosed set."""
      if val is None:
        return present_optional
      else:
        return val in set_values

    return Validation(check, property_name, message)
625721
def is_valid(self):
        """"""
        for lineedit in self.lineedits:
            if lineedit in self.validate_data and lineedit.isEnabled():
                validator, invalid_msg = self.validate_data[lineedit]
                text = to_text_string(lineedit.text())
                if not validator(text):
                    QMessageBox.critical(self, self.get_name(),
                                     "%s:<br><b>%s</b>" % (invalid_msg, text),
                                     QMessageBox.Ok)
                    return False
        return True
680299
def is_valid(cls, arg):
        
        return (isinstance(arg, (int, long)) and (arg >= 0)) or \
            isinstance(arg, str)
1039103
function _isValidObject(object) {
	if (!object || Array.isArray(object) || typeof(object) !== 'object') {
		logger('AMBUSH_INVALID_DATA');
		return false;
	}

	return true;
}
988977
def _is_valid_value(self):
        

        comp_str = self._encoded_value

        value_pattern = []
        value_pattern.append("^((")
        value_pattern.append("~[")
        value_pattern.append(CPEComponent1_1._STRING)
        value_pattern.append("]+")
        value_pattern.append(")|(")
        value_pattern.append("[")
        value_pattern.append(CPEComponent1_1._STRING)
        value_pattern.append("]+(![")
        value_pattern.append(CPEComponent1_1._STRING)
        value_pattern.append("]+)*")
        value_pattern.append("))$")

        value_rxc = re.compile("".join(value_pattern))
        return value_rxc.match(comp_str) is not None
1116478
function checkObj(instance, objTypeDef, path, additionalProp, errors) {

	if (typeof objTypeDef =='object') {
		if (typeof instance != 'object' || Array.isArray(instance)) {
			errors.push({
				property: path,
				message: "an object is required"
			});
		}

		for(var i in objTypeDef) {
			if (objTypeDef.hasOwnProperty(i) && !(i.charAt(0) == '_' && i.charAt(1) == '_')) {
				var value = instance[i];
				var propDef = objTypeDef[i];
				checkProp(value,propDef,path,i, errors);
			}
		}
	}

	for(i in instance) {
		if (instance.hasOwnProperty(i)
				&& !(i.charAt(0) == '_'
				&& i.charAt(1) == '_')
				&& objTypeDef
				&& !objTypeDef[i]
				&& additionalProp === false)
		{
			errors.push({
				property: path,
				message: (typeof value) + "The property " + i +
					" is not defined in the schema and the schema does not allow additional properties"
			});
		}

		var requires = objTypeDef && objTypeDef[i] && objTypeDef[i].requires;
		if (requires && !(requires in instance)) {
			errors.push({
				property: path,
				message: "the presence of the property " + i + " requires that "
					+ requires + " also be present"
			});
		}

		value = instance[i];
		if (objTypeDef && typeof objTypeDef == 'object' && !(i in objTypeDef)) {
			checkProp(value, additionalProp, path, i, errors);
		}

		if (!gCheckPropChange && value && value.$schema) {
			errors = errors.concat(checkProp(value, value.$schema, path, i, errors));
		}
	}

	return errors;
}
198262
def is_valid(self, qstr=None):
        """"""
        if qstr is None:
            qstr = self.currentText()
        return osp.isfile(to_text_string(qstr))
521696
def valid(self, value, include_name=True):
		

		# Call the parent valid method and return the result
		return super(Tree, self).valid(value, include_name and [self._name] or [])
39598
def validate():
    """"""

    errors = dict()
    for test in (test_architecture,
                 test_pyqt_availability,
                 test_pyblish_availability,
                 test_qtconf_availability,
                 test_qtconf_correctness,
                 test_qt_availability):
        try:
            test()
        except Exception as e:
            errors[test] = e

    if not errors:
        print("=" * 78)
        print()
        print(""" - Success!

{exe} is well suited to run Pyblish QML""".format(exe=sys.executable))
        print()
        print("=" * 78)

        return True

    print("=" * 78)
    print()
    print(" - Failed")
    print()
    for test, error in errors.iteritems():
        print(test.__name__)
        print("    %s" % error)
    print()
    print("=" * 78)

    return False
1056771
def assert_valid(self, instance, value=None):
        """"""
        valid = super(Tuple, self).assert_valid(instance, value)
        if not valid:
            return False
        if value is None:
            value = instance._get(self.name)
            if value is None:
                return True
        if (
                (self.min_length is not None and len(value) < self.min_length)
                or
                (self.max_length is not None and len(value) > self.max_length)
        ):
            self.error(
                instance=instance,
                value=value,
                extra='(Length is {})'.format(len(value)),
            )
        for val in value:
            if not self.prop.assert_valid(instance, val):
                return False
        return True
1355984
def assert_valid(self, instance, value=None):
        """"""
        valid = super(Dictionary, self).assert_valid(instance, value)
        if not valid:
            return False
        if value is None:
            value = instance._get(self.name)
        if value is None:
            return True
        if self.key_prop or self.value_prop:
            for key, val in iteritems(value):
                if self.key_prop:
                    self.key_prop.assert_valid(instance, key)
                if self.value_prop:
                    self.value_prop.assert_valid(instance, val)
        return True
837168
def is_valid(self):
        
        return (
            self.requirement is not None and self.requirement.optional
        ) or bool(self._future_value)
269849
def check_validity(self):
        """""""
        # pianoroll
        if not isinstance(self.pianoroll, np.ndarray):
            raise TypeError("`pianoroll` must be a numpy array.")
        if not (np.issubdtype(self.pianoroll.dtype, np.bool_)
                or np.issubdtype(self.pianoroll.dtype, np.number)):
            raise TypeError("The data type of `pianoroll` must be np.bool_ or "
                            "a subdtype of np.number.")
        if self.pianoroll.ndim != 2:
            raise ValueError("`pianoroll` must have exactly two dimensions.")
        if self.pianoroll.shape[1] != 128:
            raise ValueError("The length of the second axis of `pianoroll` "
                             "must be 128.")
        # program
        if not isinstance(self.program, int):
            raise TypeError("`program` must be int.")
        if self.program < 0 or self.program > 127:
            raise ValueError("`program` must be in between 0 to 127.")
        # is_drum
        if not isinstance(self.is_drum, bool):
            raise TypeError("`is_drum` must be bool.")
        # name
        if not isinstance(self.name, string_types):
            raise TypeError("`name` must be a string.")