Check that the content and structure of different fields are consistent
        with one another.
12341
def check_field_cohesion(self, present_label_fields):
        
        # Ensure all written annotation fields have the same length
        nannots = len(self.sample)

        for field in ['sample', 'num', 'subtype', 'chan', 'aux_note']+present_label_fields:
            if getattr(self, field) is not None:
                if len(getattr(self, field)) != nannots:
                    raise ValueError("The lengths of the 'sample' and '"+field+"' fields do not match")

        # Ensure all label fields are defined by the label map. This has to be checked because
        # it is possible the user defined (or lack of) custom_labels does not capture all the
        # labels present.
        for field in present_label_fields:
            defined_values = self.__label_map__[field].values

            if set(getattr(self, field)) - set(defined_values) != set():
                raise ValueError('\n'.join(['\nThe '+field+' field contains elements not encoded in the stardard WFDB annotation labels, or this object\'s custom_labels field',
                                      '- To see the standard WFDB annotation labels, call: show_ann_labels()',
                                      '- To transfer non-encoded symbol items into the aux_note field, call: self.sym_to_aux()',
                                      '- To define custom labels, set the custom_labels field as a list of tuple triplets with format: (label_store, symbol, description)']))

        return
883316
private static boolean shouldHasUniqueValues(List<Field> dataFields) {
        Set<String> dataValues = new HashSet<>();
        for (Field field : dataFields) {
            String value = field.getAnnotation(Plugin.Data.class).value();
            if (dataValues.contains(value)) {
                return false;
            }
            dataValues.add(value);
        }
        return true;
    }
332571
private boolean checkWriteConfiguration(List<CmsSearchField> fields) {

        if (fields == null) {
            return false;
        }
        Iterator<CmsSearchField> itFields = fields.iterator();
        while (itFields.hasNext()) {
            CmsLuceneField curField = (CmsLuceneField)itFields.next();
            if (curField.getMappings().isEmpty()) {
                return false;
            }
        }
        return true;
    }
1347451
def iter_valid_fields(meta):
    """"""

    # fetch field configuration and always add the id_field as exclude
    meta_fields = getattr(meta, 'fields', ())
    meta_exclude = getattr(meta, 'exclude', ())
    meta_exclude += (meta.document._meta.get('id_field'),)

    # walk through meta_fields or through the document fields to keep
    # meta_fields order in the form
    if meta_fields:
        for field_name in meta_fields:
            field = meta.document._fields.get(field_name)
            if field:
                yield (field_name, field)
    else:
        for field_name, field in meta.document._fields.iteritems():
            # skip excluded fields
            if field_name not in meta_exclude:
                yield (field_name, field)
253647
def in_same_table(self):
        """"""
        if self._tc.tbl is self._other_tc.tbl:
            return True
        return False
1171185
def is_consistent(self) -> bool:
        
        from ledger.compact_merkle_tree import CompactMerkleTree
        return self.nodeCount == CompactMerkleTree.get_expected_node_count(
            self.leafCount)
459367
def checkConsistency(self):
        
        for referenceName, (dataUrl, indexFile) in self._chromFileMap.items():
            varFile = pysam.VariantFile(dataUrl, index_filename=indexFile)
            try:
                for chrom in varFile.index:
                    chrom, _, _ = self.sanitizeVariantFileFetch(chrom)
                    if not isEmptyIter(varFile.fetch(chrom)):
                        self._checkMetadata(varFile)
                        self._checkCallSetIds(varFile)
            finally:
                varFile.close()
944397
def is_equal(self, other):
        
        properties = [
            'debug_mode',
            'use_rounding',
            'requested_extent',
            'crs',
            'analysis_extent',
            'datastore',
            'name',
            'title',
            'start_datetime',
            'end_datetime',
            'duration',
            'earthquake_function',
            # 'performance_log',  # I don't think need we need this one
            'hazard',
            'exposure',
            'aggregation',

            # Output layers on new IF object will have a different provenance
            # data with the one from original IF.

            # 'impact',
            # 'exposure_summary',
            # 'aggregate_hazard_impacted',
            # 'aggregation_summary',
            # 'analysis_impacted',
            # 'exposure_summary_table',

            'profiling',
        ]
        for if_property in properties:
            # Skip if it's debug mode for profiling
            if self.debug_mode:
                if if_property == 'profiling':
                    continue
            try:
                property_a = getattr(self, if_property)
                property_b = getattr(other, if_property)
                if not isinstance(property_a, type(property_b)):
                    message = (
                        'Different type of property %s.\nA: %s\nB: %s' % (
                            if_property, type(property_a), type(property_b)))
                    return False, message
                if isinstance(property_a, QgsMapLayer):
                    if byteify(property_a.keywords) != byteify(
                            property_b.keywords):
                        message = (
                            'Keyword Layer is not equal is %s' % if_property)
                        return False, message
                    if isinstance(property_a, QgsVectorLayer):
                        fields_a = [f.name() for f in property_a.fields()]
                        fields_b = [f.name() for f in property_b.fields()]
                        if fields_a != fields_b:
                            message = (
                                'Layer fields is not equal for %s' %
                                if_property)
                            return False, message
                        if (property_a.featureCount()
                                != property_b.featureCount()):
                            message = (
                                'Feature count is not equal for %s' %
                                if_property)
                            return False, message
                elif isinstance(property_a, QgsGeometry):
                    if not property_a.equals(property_b):
                        string_a = property_a.asWkt()
                        string_b = property_b.asWkt()
                        message = (
                            '[Non Layer] The not equal property is %s.\n'
                            'A: %s\nB: %s' % (if_property, string_a, string_b))
                        return False, message
                elif isinstance(property_a, DataStore):
                    if property_a.uri_path != property_b.uri_path:
                        string_a = property_a.uri_path
                        string_b = property_b.uri_path
                        message = (
                            '[Non Layer] The not equal property is %s.\n'
                            'A: %s\nB: %s' % (if_property, string_a, string_b))
                        return False, message
                else:
                    if property_a != property_b:
                        string_a = property_a
                        string_b = property_b
                        message = (
                            '[Non Layer] The not equal property is %s.\n'
                            'A: %s\nB: %s' % (if_property, string_a, string_b))
                        return False, message
            except AttributeError as e:
                message = (
                    'Property %s is not found. The exception is %s' % (
                        if_property, e))
                return False, message
            except IndexError as e:
                if if_property == 'impact':
                    continue
                else:
                    message = (
                        'Property %s is out of index. The exception is %s' % (
                            if_property, e))
                    return False, message
            except Exception as e:
                message = (
                    'Error on %s with error message %s' % (if_property, e))
                return False, message

        return True, ''
994749
def _matches_docs(self, docs, other_docs):
        """"""
        for doc, other_doc in zip(docs, other_docs):
            if not self._match_map(doc, other_doc):
                return False

        return True
154731
def check_unknown_fields(self, data, original_data):
        """"""
        if isinstance(original_data, list):
            for elem in original_data:
                self.check_unknown_fields(data, elem)
        else:
            for key in original_data:
                if key not in [
                        self.fields[field].attribute or field
                        for field in self.fields
                ]:
                    raise ValidationError(
                        'Unknown field name {}'.format(key), field_names=[key])
65291
def _check_fields(self, x, y):
		
		if x is None:
			if self.x is None:
				self.err(
					self._check_fields,
					"X field is not set: please specify a parameter")
				return
			x = self.x
		if y is None:
			if self.y is None:
				self.err(
					self._check_fields,
					"Y field is not set: please specify a parameter")
				return
			y = self.y
		return x, y
958851
private boolean checkStructure() {
        File ds;

        ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CATS + File.separator);
        if (!ds.exists())
            if (!ds.mkdir())
                return false;
        ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL + File.separator);
        if (!ds.exists())
            if (!ds.mkdir())
                return false;
        ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL_MISC + File.separator);
        if (!ds.exists())
            if (!ds.mkdir())
                return false;
        ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL_MISC + File.separator + name);
        if (!ds.exists())
            if (!ds.mkdir())
                return false;
        ds = new File(mapsetPath + File.separator + GrassLegacyConstans.FCELL + File.separator);
        if (!ds.exists())
            if (!ds.mkdir())
                return false;
        ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELLHD + File.separator);
        if (!ds.exists())
            if (!ds.mkdir())
                return false;
        ds = new File(mapsetPath + File.separator + GrassLegacyConstans.COLR + File.separator);
        if (!ds.exists())
            if (!ds.mkdir())
                return false;
        ds = new File(mapsetPath + File.separator + GrassLegacyConstans.HIST + File.separator);
        if (!ds.exists())
            if (!ds.mkdir())
                return false;
        return true;
    }
1170164
def same_content(ref_source, test_source, allow_removed_final_blank_line):
    """"""
    if ref_source == test_source:
        return True

    if not allow_removed_final_blank_line:
        return False

    # Is ref identical to test, plus one blank line?
    ref_source = ref_source.splitlines()
    test_source = test_source.splitlines()

    if not ref_source:
        return False

    if ref_source[:-1] != test_source:
        return False

    return _BLANK_LINE.match(ref_source[-1])
372663
private <T> boolean isKeyEquals(T t1, T t2, List<Field> fields) {
		if(t1 == null || t2 == null || fields == null) {
			 return false;
		}
		List<Field> keyFields = DOInfoReader.getKeyColumns(t1.getClass());
		if(keyFields == null || keyFields.isEmpty()) {
			return false;
		}
		for(Field keyField : keyFields) {
			Object key1 = DOInfoReader.getValue(keyField, t1);
			Object key2 = DOInfoReader.getValue(keyField, t2);
			if(key1 == null || key2 == null || !key1.equals(key2)) {
				return false;
			}
		}
		return true;
	}
672982
def _check_unique_together(cls):
        """"""
        if cls._meta.unique_together is None:
            return

        if not isinstance(cls._meta.unique_together, (tuple, list)):
            raise ConfigurationError(
                "'{}.unique_together' must be a list or tuple.".format(cls.__name__)
            )

        elif any(
            not isinstance(unique_fields, (tuple, list))
            for unique_fields in cls._meta.unique_together
        ):
            raise ConfigurationError(
                "All '{}.unique_together' elements must be lists or tuples.".format(cls.__name__)
            )

        else:
            for fields_tuple in cls._meta.unique_together:
                for field_name in fields_tuple:
                    field = cls._meta.fields_map.get(field_name)

                    if not field:
                        raise ConfigurationError(
                            "'{}.unique_together' has no '{}' "
                            "field.".format(cls.__name__, field_name)
                        )

                    if isinstance(field, ManyToManyField):
                        raise ConfigurationError(
                            "'{}.unique_together' '{}' field refers "
                            "to ManyToMany field.".format(cls.__name__, field_name)
                        )
1051594
function validateFields(contentType, cb) {
        if (_.isArray(contentType.fields)) {
            async.each(contentType.fields, validateField, function(err) {
                cb(err);
            });
        } else {
            cb();
        }
    }
1023806
def _check_file_field(self, field):
        """"""
        is_field = field in self.field_names
        is_file = self.__meta_metadata(field, 'field_type') == 'file'
        if not (is_field and is_file):
            msg = "'%s' is not a field or not a 'file' field" % field
            raise ValueError(msg)
        else:
            return True