Checks whether the FieldMask is valid for Message Descriptor.
433789
def IsValidForDescriptor(self, message_descriptor):
    """"""
    for path in self.paths:
      if not _IsValidPath(message_descriptor, path):
        return False
    return True
1087695
public boolean isFilterMatch(BaseMessageHeader messageHeader)
    {
        boolean bMatch = super.isFilterMatch(messageHeader);
        if (bMatch)
        {
            if (m_bPrivate)
                bMatch = false; // Only a matching SessionMessageHeader will be sent.
            if ((messageHeader != null)
                && (this.getObjectKey() != null)
                && (messageHeader instanceof SessionMessageHeader)
                && (((SessionMessageHeader)messageHeader).getObjectKey() != null)
                && (!this.getObjectKey().equals(((SessionMessageHeader)messageHeader).getObjectKey())))
                    bMatch = false;   // No match!
            else
                    bMatch = true;    // Match!
        }
        return bMatch;    // MATCH!!!
    }
756777
private void validateField(FieldDefinition fieldDef) {
        if (fieldDef.isScalarField()) {
            Utils.require(Utils.isEmpty(fieldDef.getAnalyzerName()),
                          "'analyzer' not allowed for OLAP application fields:" + fieldDef);
        } else if (fieldDef.isLinkType()) {
            Utils.require(!fieldDef.isSharded(),
                          "Link and xlink fields cannot be sharded: {}", fieldDef);
        }
    }
1034131
def has_descriptor(self, descriptor):
        
        for p in self.descriptors:
            if p in descriptor:
                return True
        return False
468802
public boolean hasField(final FieldDescriptorType descriptor) {
    if (descriptor.isRepeated()) {
      throw new IllegalArgumentException(
        "hasField() can only be called on non-repeated fields.");
    }

    return fields.get(descriptor) != null;
  }
779840
def _IsPresent(item):
  """"""

  if item[0].label == _FieldDescriptor.LABEL_REPEATED:
    return bool(item[1])
  elif item[0].cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
    return item[1]._is_present_in_parent
  else:
    return True
1162813
def validate_message(self, msg, *parameters):
        
        _, message_fields, header_fields = self._get_parameters_with_defaults(parameters)
        self._validate_message(msg, message_fields, header_fields)
868438
function isIOSMessageValid(message){

    if(!(message instanceof IOSMessage)){
        throw new Error('message is invalid');
    }

    if(parseInt(message.expireTime) !== message.expireTime || message.expireTime < 0 || message.expireTime > 60*60*24*3){
        throw new Error('expireTime is invalid');
    }

    if(parseInt(message.sendTime) !== message.sendTime || message.sendTime < 0){
        throw new Error('sendTime is invalid');
    }

    if(!isIOSCustomContentValid(message.customContent)){
        throw new Error('customContent is invalid');
    }

    if(!isAccessTimeValid(message.acceptTime)){
        throw new Error('acceptTime is invalid');
    }

    if(typeof message.alert !== 'string' && typeof message.alert !== 'object'){
        throw new Error('alert is invalid');
    }

    if((message.badge !== null) && (parseInt(message.badge) !== message.badge)){
        throw new Error('badge is invalid');
    }

    if((message.sound !== null ) && (typeof message.sound !== 'string')){
        throw new Error('sound is invalid');
    }

    if(message.loopTimes !== null && parseInt(message.loopTimes) != message.loopTimes){
        throw new Error('loopTimes is invalid');
    }

    if(message.loopInterval !== null && parseInt(message.loopInterval) != message.loopInterval){
        throw new Error('loopInterval is invalid');
    }

    return true;
}
941797
def verify(self, signature, msg):
        '''
        
        '''
        if not self.key:
            return False
        try:
            self.key.verify(signature + msg)
        except ValueError:
            return False
        return True
447010
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case APP:
      return isSetApp();
    case NUM_MESSAGES:
      return isSetNumMessages();
    case COMPRESSION:
      return isSetCompression();
    case CRC:
      return isSetCrc();
    case MESSAGES:
      return isSetMessages();
    }
    throw new IllegalStateException();
  }
865580
public static boolean isSanitizedContentMap(FieldDescriptor fieldDescriptor) {
    if (!fieldDescriptor.isMapField()) {
      return false;
    }
    Descriptor valueDesc = getMapValueMessageType(fieldDescriptor);
    if (valueDesc == null) {
      return false;
    }
    return SAFE_PROTO_TYPES.contains(valueDesc.getFullName());
  }
1270457
def validate(self, pkt, messages=None):
        
        valid = True

        for f in self.fields:
            try:
                value = getattr(pkt, f.name)
            except AttributeError:
                valid = False
                if messages is not None:
                    msg = "Telemetry field mismatch for packet '%s'.  "
                    msg += "Unable to retrieve value for %s in Packet."
                    values = self.name, f.name
                    messages.append(msg % values)
                break

            if f.validate(value, messages) is False:
                valid = False

        return valid
184016
public static boolean isSanitizedContentField(FieldDescriptor fieldDescriptor) {
    return fieldDescriptor.getType() == Type.MESSAGE
        && SAFE_PROTO_TYPES.contains(fieldDescriptor.getMessageType().getFullName());
  }
431998
public void checkMismatchedValidatorAnnotation(Field field, Map<String, Class<?>> genericMap) {
        doCheckMismatchedValidatorAnnotation(field, genericMap);
    }
1298977
private boolean isValidMsgName(Node nameNode) {
    if (nameNode.isName() || nameNode.isStringKey()) {
      return nameNode.getString().startsWith("MSG_");
    } else if (nameNode.isQualifiedName()) {
      return nameNode.getLastChild().getString().startsWith("MSG_");
    } else {
      return false;
    }
  }
541200
@Check(CheckType.FAST)
	public void checkFieldName(SarlField field) {
		final JvmField inferredType = this.associations.getJvmField(field);
		final QualifiedName name = Utils.getQualifiedName(inferredType);
		if (this.featureNames.isDisallowedName(name)) {
			final String validName = Utils.fixHiddenMember(field.getName());
			error(MessageFormat.format(
					Messages.SARLValidator_41,
					field.getName()),
					field,
					XTEND_FIELD__NAME,
					ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
					VARIABLE_NAME_DISALLOWED,
					validName);
		} else if (this.grammarAccess.getOccurrenceKeyword().equals(field.getName())) {
			error(MessageFormat.format(
					Messages.SARLValidator_41,
					this.grammarAccess.getOccurrenceKeyword()),
					field,
					XTEND_FIELD__NAME,
					ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
					VARIABLE_NAME_DISALLOWED);
		}
	}
825233
def is_valid(self):
        '''
        
        '''

        valid = super(RegistrationContactForm,self).is_valid()
        msgs = messages.get_messages(self._request)

        # We only want validation messages to show up once, so pop messages that have already show up
        # before checking to see if any messages remain to be shown.
        prior_messages = self._session.pop('prior_messages',[])
        remaining_messages = []

        for m in msgs:
            m_dict = {'message': m.message, 'level': m.level, 'extra_tags': m.extra_tags}
            if m_dict not in prior_messages:
                remaining_messages.append(m_dict)

        if remaining_messages:
            self._session['prior_messages'] = remaining_messages
            self._request.session.modified = True
            return False
        return valid