Confirm the validitiy of a given dict as an OpenXC message.

        Returns:
            ``True`` if the message contains at least a ``name`` and ``value``.
180294
def _validate(cls, message):
        
        valid = False
        if(('name' in message and 'value' in message) or
                ('id' in message and 'data' in message)):
            valid = True
        return valid
1120378
def validate_host(cert, name):
    
    cn = None
    for t, v in cert.get_subject().get_components():
        if t == b'CN':
            cn = v
            break

    if cn == name:
        return True

    # checking SAN
    s_name = name.decode('ascii')
    for i in range(cert.get_extension_count()):
        ext = cert.get_extension(i)
        if ext.get_short_name() == b'subjectAltName':
            s = str(ext)
            # SANs are usually have form like: DNS:hostname
            if s.startswith('DNS:') and s[4:] == s_name:
                return True

    # TODO handle wildcards
    return False
1119785
def _contains_incorrect_tx_origin_use(node):
        
        solidity_var_read = node.solidity_variables_read
        if solidity_var_read:
            return any(v.name == 'tx.origin' for v in solidity_var_read) and\
                   all(v.name != 'msg.sender' for v in solidity_var_read)
        return False
350663
def _IsValidPath(message_descriptor, path):
  """"""
  parts = path.split('.')
  last = parts.pop()
  for name in parts:
    field = message_descriptor.fields_by_name[name]
    if (field is None or
        field.label == FieldDescriptor.LABEL_REPEATED or
        field.type != FieldDescriptor.TYPE_MESSAGE):
      return False
    message_descriptor = field.message_type
  return last in message_descriptor.fields_by_name
527372
def is_valid(data):
        
        return bool(data) and \
            isinstance(data, dict) and \
            bool(data.get("swagger")) and \
            isinstance(data.get('paths'), dict)
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
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
233240
def assert_results_contain(check_results, expected_status, expected_msgcode=None):
  
  found = False
  for status, message in check_results:
    if status == expected_status and message.code == expected_msgcode:
      found = True
      break
  assert(found)
399026
function isValid(name, value) {
    var tests = {
        indent: function (value) {
            return (/^(\s*|\d*)$/).test(value);
        },
        openbrace: function (value) {
            return (['end-of-line', 'separate-line']).indexOf(value) !== -1;
        },
        autosemicolon: function (value) {
            return typeof value === 'boolean';
        }
    };

    return Boolean(tests[name] && tests[name](value));
}
94634
def is_valid(self, name, value):
        
        if name not in self.header_types:
            return False
        t = self.header_types[name]
        if t == ATTR_TYPE_DISCRETE:
            return isinstance(value, int)
        elif t == ATTR_TYPE_CONTINUOUS:
            return isinstance(value, (float, Decimal))
        return True
529639
def is_dxlink(x):
    '''
    
    '''
    if not isinstance(x, dict):
        return False
    if '$dnanexus_link' not in x:
        return False
    link = x['$dnanexus_link']
    if isinstance(link, basestring):
        return True
    elif isinstance(link, dict):
        return any(key in link for key in ('id', 'job'))
    return False
467251
def is_python_interpreter_valid_name(filename):
    """"""
    pattern = r'.*python(\d\.?\d*)?(w)?(.exe)?$'
    if re.match(pattern, filename, flags=re.I) is None:
        return False
    else:
        return True
184531
def valid_email(x: str) -> bool:
    
    if isinstance(x, str) and re.match(EMAIL_PATTERN, x):
        return True
    else:
        return False
803788
def isSignatureValid(expected, received):
    
    if expected:
        if not received or expected != received:
            return False
    else:
        if received:
            return False
    return True
753824
def validate_openbin_mode(mode, _valid_chars=frozenset("rwxab+")):
    # type: (Text, Union[Set[Text], FrozenSet[Text]]) -> None
    
    if "t" in mode:
        raise ValueError("text mode not valid in openbin")
    if not mode:
        raise ValueError("mode must not be empty")
    if mode[0] not in "rwxa":
        raise ValueError("mode must start with 'r', 'w', 'a' or 'x'")
    if not _valid_chars.issuperset(mode):
        raise ValueError("mode '{}' contains invalid characters".format(mode))
1006180
def isSigned(self, ns_uri, ns_key):
        
        return self.message.getKey(ns_uri, ns_key) in self.signed_fields
914178
def validate_crc(msg):
    
    if not struct.unpack('<H', get_crc(msg[:-2])) ==\
            struct.unpack('<H', msg[-2:]):
        raise CRCError('CRC validation failed.')