Checks whether a given AST (abstract syntax tree) object represents a 
    metametadata dictionary.
185370
def IsMetaMetaDict(AST):
    
    isintpair = lambda x : (isinstance(x,Tuple) and (len(x.asList()) == 2) and 
                            isctype(x.asList()[0], int) and 
                            isctype(x.asList()[1], int))
    try:
        if ((len(AST.getChildren()) > 1) and 
            isinstance(AST.getChildren()[1], Stmt)):
            if isinstance(AST.getChildren()[1].getChildren()[0], Assign):
                [s, d] = AST.getChildren()[1].getChildren()[0].asList()
    except (TypeError, AttributeError):
        return False
    else:
        if (isinstance(s, AssName) and s.name == 'metametadata'):     
            if isinstance(d, Dict):
                return all([isctype(k, str) and 
                            (isctype(v, int) or isintpair(v)) 
                            for (k,v) in d.items])
949248
private boolean isSpecTopicMetaData(final String key, final String value) {
        if (ContentSpecUtilities.isSpecTopicMetaData(key)) {
            // Abstracts can be plain text so check an opening bracket exists
            if (key.equalsIgnoreCase(CommonConstants.CS_ABSTRACT_TITLE) || key.equalsIgnoreCase(
                    CommonConstants.CS_ABSTRACT_ALTERNATE_TITLE)) {
                final String fixedValue = value.trim().replaceAll("(?i)^" + key + "\\s*", "");
                return fixedValue.trim().startsWith("[");
            } else {
                return true;
            }
        } else {
            return false;
        }
    }
1209980
def is_list_of_dict_like(obj, attr=('keys', 'items')):
    
    try:
        if len(obj) == 0:
            return False
        return all([is_dict_like(i, attr) for i in obj])
    except Exception:
        return False
724159
public boolean validateMetaDataType(MetaDataType metaDataType, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return validate_EveryDefaultConstraint(metaDataType, diagnostics, context);
	}
1049034
def IsPropertyInMetaIgnoreCase(classId, key):
		
		if classId in _ManagedObjectMeta:
			for prop in _ManagedObjectMeta[classId]:
				if (prop.lower() == key.lower()):
					return _ManagedObjectMeta[classId][prop]
		if classId in _MethodFactoryMeta:
			for prop in _MethodFactoryMeta[classId]:
				if (prop.lower() == key.lower()):
					return _MethodFactoryMeta[classId][prop]
		return None
1025805
def _arevalid(self, datatype):
        ''''''
        # Datatype not specified
        if datatype not in self.meta:
            return datatype in Dap._optional_meta, []

        # Required datatype empty
        if datatype in self._required_meta and not self.meta[datatype]:
            return False, []

        # Datatype not a list
        if not isinstance(self.meta[datatype], list):
            return False, []

        # Duplicates found
        duplicates = set([x for x in self.meta[datatype] if self.meta[datatype].count(x) > 1])
        if duplicates:
            return False, list(duplicates)

        if datatype in self._badmeta:
            return False, self._badmeta[datatype]
        else:
            return True, []

        # Checking if all items are valid
        bad = []
        for item in self.meta[datatype]:
            if not Dap._meta_valid[datatype].match(item):
                bad.append(item)
        return len(bad) == 0, bad
1204965
def parse_meta(filename, data):
    
    if "." not in filename:
        raise MetaParsingException(
            "Can't recognize type of your metadata ('%s')!" % filename
        )

    suffix = filename.rsplit(".", 1)[1].lower()

    if suffix not in SUPPORTED_FILES:
        raise MetaParsingException("Can't parse file of type '%s'!" % suffix)

    fp = validator.FieldParser()
    for key, val in SUPPORTED_FILES[suffix](data).items():
        fp.process(key, val)

    return fp.get_epublication()
941176
def is_abstract_model(model):
    
    return hasattr(model, '_meta') and hasattr(model._meta, 'abstract') and model._meta.abstract
942691
private boolean isSynthetic(Method m) {
        if ((m.getAccessFlags() & Const.ACC_SYNTHETIC) != 0) {
            return true;
        }
        Attribute[] attrs = m.getAttributes();
        for (Attribute attr : attrs) {
            if (attr instanceof Synthetic) {
                return true;
            }
        }
        return false;
    }
1011272
def is_abstract(self) -> bool:
        
        meta_value = getattr(self.clsdict.get('Meta'), 'abstract', False)
        return self.clsdict.get(ABSTRACT_ATTR, meta_value) is True
768429
def treeNode_metaSet(self, astr_path, **kwargs):
            
            self.cdnode(astr_path)
            self.snode_current.metaData_print(self.b_printMetaData)
            return {'status': True}
1102582
private function isTranslation(ClassMetadata $meta)
    {
        return $this->getClassAnalyzer()->hasTrait($meta->getReflectionClass(), $this->translationTrait, true);
    }
160414
def is_sub_dict(sub_dict, dictionary):
    """"""
    for key in sub_dict.keys():
        if key not in dictionary:
            return False
        if (type(sub_dict[key]) is not dict) and (sub_dict[key] != dictionary[key]):
            return False
        if (type(sub_dict[key]) is dict) and (not is_sub_dict(sub_dict[key], dictionary[key])):
            return False
    return True
661881
def is_syntactic(self):
        """"""
        for term in self._terms:
            if isinstance(term, Wildcard) and not term.fixed_size:
                return False
            if is_operation(term) and issubclass(term, (AssociativeOperation, CommutativeOperation)):
                return False
        return True
1170648
function(oUnitTest) {
          var _,
              /**
               * An array-like object representing the <abbr title=
               * "abstract syntax tree">AST</abbr> obtained after consolidation.
               * @type {!TSyntacticCodeUnit}
               */
              oSyntacticCodeUnitActual =
                  exports.ast_consolidate(oParser.parse(oUnitTest.sInput)),
              /**
               * An array-like object representing the expected <abbr title=
               * "abstract syntax tree">AST</abbr>.
               * @type {!TSyntacticCodeUnit}
               */
              oSyntacticCodeUnitExpected = oParser.parse(
                  oUnitTest.hasOwnProperty('sOutput') ?
                  oUnitTest.sOutput : oUnitTest.sInput);

          delete oSyntacticCodeUnitActual.scope;
          oWalker = oProcessor.ast_walker();
          oWalker.with_walkers(
              oWalkersPurifiers,
              cContext(oWalker, oSyntacticCodeUnitActual));
          try {
            oAssert.deepEqual(
                oSyntacticCodeUnitActual,
                oSyntacticCodeUnitExpected);
          } catch (oException) {
            console.error(
                '########## A unit test has failed.\n' +
                oUnitTest.sTitle + '\n' +
                '#####  actual code  (' +
                oProcessor.gen_code(oSyntacticCodeUnitActual).length +
                ' bytes)\n' +
                oProcessor.gen_code(
                    oSyntacticCodeUnitActual,
                    oCodeGenerationOptions) + '\n' +
                '##### expected code (' +
                oProcessor.gen_code(oSyntacticCodeUnitExpected).length +
                ' bytes)\n' +
                oProcessor.gen_code(
                    oSyntacticCodeUnitExpected,
                    oCodeGenerationOptions));
          }
        }
1079170
private static List<String> validateDictionary(NaaccrDictionary dictionary, boolean isBaseDictionary, String naaccrVersion) {
        List<String> errors = new ArrayList<>();

        // some of the validation is based on the specification version; assume 1.0 if it's not available
        String specVersion = dictionary.getSpecificationVersion() == null ? SpecificationVersion.SPEC_1_0 : dictionary.getSpecificationVersion();
        if (!SpecificationVersion.isSpecificationSupported(specVersion))
            errors.add("'specificationVersion' attribute is not valid");

        if (dictionary.getDictionaryUri() == null || dictionary.getDictionaryUri().trim().isEmpty())
            errors.add("'dictionaryUri' attribute is required");

        boolean allowBlankNaaccrVersion = !isBaseDictionary && SpecificationVersion.compareSpecifications(specVersion, SpecificationVersion.SPEC_1_1) >= 0;
        if (!allowBlankNaaccrVersion && (dictionary.getNaaccrVersion() == null || dictionary.getNaaccrVersion().trim().isEmpty()))
            errors.add("'naaccrVersion' attribute is required");

        if (dictionary.getItems().isEmpty())
            errors.add("a dictionary must contain at least one item definition");

        Pattern idPattern = Pattern.compile("^[a-z][a-zA-Z0-9]+$");
        Set<String> naaccrIds = new HashSet<>();
        Set<Integer> naaccrNums = new HashSet<>();
        for (NaaccrDictionaryItem item : dictionary.getItems()) {
            // validate ID
            if (item.getNaaccrId() == null || item.getNaaccrId().trim().isEmpty())
                errors.add("'naaccrId' attribute is required");
            else if (!idPattern.matcher(item.getNaaccrId()).matches())
                errors.add("'naaccrId' attribute has a bad format (needs to start with a lower case letter, followed by letters and digits): " + item.getNaaccrId());
            else if (item.getNaaccrId().length() > 50)
                errors.add("'naaccrId' attribute can only be 50 characters long: " + item.getNaaccrId());
            else if (naaccrIds.contains(item.getNaaccrId()))
                errors.add("'naaccrId' attribute must be unique, already saw " + item.getNaaccrId());
            naaccrIds.add(item.getNaaccrId());

            // validate number
            if (item.getNaaccrNum() == null)
                errors.add("'naaccrNum' attribute is required");
            else if (naaccrNums.contains(item.getNaaccrNum()))
                errors.add("'naaccrNum' attribute must be unique, already saw " + item.getNaaccrNum());
            naaccrNums.add(item.getNaaccrNum());

            // validate name
            if (item.getNaaccrName() != null && item.getNaaccrName().length() > 50)
                errors.add("'naaccrName' attribute can only be 50 characters long: " + item.getNaaccrName());

            // validate length
            if (item.getLength() == null)
                errors.add("'length' attribute is required");

            // validate start column
            boolean allowBlankStartCol = !isBaseDictionary && SpecificationVersion.compareSpecifications(specVersion, SpecificationVersion.SPEC_1_1) >= 0;
            if (!allowBlankStartCol && item.getStartColumn() == null)
                errors.add("'startColumn' attribute is required");

            // validate parent element
            if (item.getParentXmlElement() == null || item.getParentXmlElement().trim().isEmpty())
                errors.add("'parentXmlElement' attribute is required");
            else if (!NaaccrXmlUtils.NAACCR_XML_TAG_ROOT.equals(item.getParentXmlElement()) && !NaaccrXmlUtils.NAACCR_XML_TAG_PATIENT.equals(item.getParentXmlElement())
                    && !NaaccrXmlUtils.NAACCR_XML_TAG_TUMOR.equals(item.getParentXmlElement()))
                errors.add("invalid value for 'parentXmlElement' attribute: " + item.getParentXmlElement());

            // validate record type (null means all types, so that's OK)
            if (item.getRecordTypes() != null && !item.getRecordTypes().matches("[AMCI](,[AMCI])*"))
                errors.add("invalid value for 'recordTypes' attribute: " + item.getRecordTypes());

            // validate data type
            String type = item.getDataType();
            if (type != null && (!NAACCR_DATA_TYPE_ALPHA.equals(type) && !NAACCR_DATA_TYPE_DIGITS.equals(type) && !NAACCR_DATA_TYPE_MIXED.equals(type)) && !NAACCR_DATA_TYPE_NUMERIC.equals(type)
                    && !NAACCR_DATA_TYPE_TEXT.equals(type) && !NAACCR_DATA_TYPE_DATE.equals(type))
                errors.add("invalid value for 'dataType' attribute: " + item.getDataType());

            // validate padding
            if (item.getPadding() != null && (!NAACCR_PADDING_LEFT_BLANK.equals(item.getPadding()) && !NAACCR_PADDING_LEFT_ZERO.equals(item.getPadding()) && !NAACCR_PADDING_RIGHT_BLANK.equals(
                    item.getPadding()) && !NAACCR_PADDING_RIGHT_ZERO.equals(item.getPadding())))
                errors.add("invalid value for 'padding' attribute: " + item.getPadding());

            // validate trimming
            if (item.getTrim() != null && (!NAACCR_TRIM_ALL.equals(item.getTrim()) && !NAACCR_TRIM_NONE.equals(item.getTrim())))
                errors.add("invalid value for 'trim' attribute: " + item.getTrim());

            // validate regex
            if (item.getRegexValidation() != null) {
                if (SpecificationVersion.compareSpecifications(specVersion, SpecificationVersion.SPEC_1_2) >= 0)
                    errors.add("invalid attribute 'regexValidation'");
                else {
                    try {
                        //noinspection ResultOfMethodCallIgnored
                        Pattern.compile(item.getRegexValidation());
                    }
                    catch (PatternSyntaxException e) {
                        errors.add("invalid value for 'regexValidation' attribute: " + item.getRegexValidation());
                    }
                }
            }
        }

        // validate grouped items; since those can only appear in base dictionaries, the validation is going to be minimal
        if (isBaseDictionary) {
            for (NaaccrDictionaryGroupedItem groupedItem : dictionary.getGroupedItems()) {
                // validate ID
                if (groupedItem.getNaaccrId() == null || groupedItem.getNaaccrId().trim().isEmpty())
                    errors.add("'naaccrId' attribute is required");
                else if (!idPattern.matcher(groupedItem.getNaaccrId()).matches())
                    errors.add("'naaccrId' attribute has a bad format (needs to start with a lower case letter, followed by letters and digits): " + groupedItem.getNaaccrId());
                else if (naaccrIds.contains(groupedItem.getNaaccrId()))
                    errors.add("'naaccrId' attribute for grouped item " + groupedItem.getNaaccrId() + " is not unique");
                naaccrIds.add(groupedItem.getNaaccrId());

                // validate number
                if (groupedItem.getNaaccrNum() == null)
                    errors.add("'naaccrNum' attribute for grouped item " + groupedItem.getNaaccrId() + " is missing");
                else if (naaccrNums.contains(groupedItem.getNaaccrNum()))
                    errors.add("'naaccrNum' attribute for grouped item " + groupedItem.getNaaccrId() + " must be unique, already saw " + groupedItem.getNaaccrNum());
                naaccrNums.add(groupedItem.getNaaccrNum());

                // validate start column
                if (groupedItem.getStartColumn() == null)
                    errors.add("'startColumn' attribute for grouped item " + groupedItem.getNaaccrId() + " is missing");
                else {
                    for (int idx = 0; idx < groupedItem.getContainedItemId().size(); idx++) {
                        NaaccrDictionaryItem containedItem = dictionary.getItemByNaaccrId(groupedItem.getContainedItemId().get(idx));
                        if (containedItem == null)
                            errors.add("grouped item " + groupedItem.getNaaccrId() + " references unknown item " + groupedItem.getContainedItemId().get(idx));
                        else if (idx == 0 && !groupedItem.getStartColumn().equals(containedItem.getStartColumn()))
                            errors.add("'startColumn' attribute for grouped item " + groupedItem.getNaaccrId() + " is not consistent with first contained item");
                    }
                }
            }
        }

        // user dictionary specific validation
        if (!isBaseDictionary) {
            String naaccrVersionToUse = dictionary.getNaaccrVersion() == null ? naaccrVersion : dictionary.getNaaccrVersion();
            // we can only do the following validity check if we know the NAACCR version...
            if (naaccrVersionToUse != null) {
                // we are going to need these...
                NaaccrDictionary baseDictionary = getBaseDictionaryByVersion(naaccrVersionToUse);
                NaaccrDictionary defaultUserDictionary = getDefaultUserDictionaryByVersion(naaccrVersionToUse);

                // we need the NAACCR numbers from the base dictionary...
                List<Integer> baseNumbers = baseDictionary.getItems().stream().map(NaaccrDictionaryItem::getNaaccrNum).collect(Collectors.toList());

                for (NaaccrDictionaryItem item : dictionary.getItems()) {

                    // can't use an internal base ID, ever
                    if (baseDictionary.getItemByNaaccrId(item.getNaaccrId()) != null)
                        errors.add("invalid value for 'naaccrId' attribute: " + item.getNaaccrId() + "; this ID is used in the standard dictionary");

                    // if an internal default user dictionary ID is used, then there are a bunch of attributes it can't re-defined.
                    NaaccrDictionaryItem defaultUserItem = defaultUserDictionary.getItemByNaaccrId(item.getNaaccrId());
                    if (defaultUserItem != null) {
                        if (!Objects.equals(defaultUserItem.getNaaccrNum(), item.getNaaccrNum()))
                            errors.add("invalid value for 'naaccrNum' attribute of item '" + item.getNaaccrId() + "'; should be set to " + defaultUserItem.getNaaccrNum());
                        if (!Objects.equals(defaultUserItem.getNaaccrName(), item.getNaaccrName()))
                            errors.add("invalid value for 'naaccrName' attribute of item '" + item.getNaaccrId() + "'; should be set to " + defaultUserItem.getNaaccrName());
                        if (item.getStartColumn() != null && !Objects.equals(defaultUserItem.getStartColumn(), item.getStartColumn()))
                            errors.add("invalid value for 'startColumn' attribute of item '" + item.getNaaccrId() + "'; should be set to " + defaultUserItem.getStartColumn());
                        if (!Objects.equals(defaultUserItem.getLength(), item.getLength()))
                            errors.add("invalid value for 'length' attribute of item '" + item.getNaaccrId() + "'; should be set to " + defaultUserItem.getLength());
                        if (!Objects.equals(defaultUserItem.getRecordTypes(), item.getRecordTypes()))
                            errors.add("invalid value for 'recordTypes' attribute of item '" + item.getNaaccrId() + "'; should be set to " + defaultUserItem.getRecordTypes());
                        if (!Objects.equals(defaultUserItem.getParentXmlElement(), item.getParentXmlElement()))
                            errors.add("invalid value for 'parentXmlElement' attribute of item '" + item.getNaaccrId() + "'; should be set to " + defaultUserItem.getParentXmlElement());
                        // I really hate that the defaults are not loaded right away in the Java bean; I think that was a mistake!
                        String defaultUserItemType = defaultUserItem.getDataType() == null ? NaaccrXmlDictionaryUtils.NAACCR_DATA_TYPE_TEXT : defaultUserItem.getDataType();
                        String itemType = item.getDataType() == null ? NaaccrXmlDictionaryUtils.NAACCR_DATA_TYPE_TEXT : item.getDataType();
                        if (!Objects.equals(defaultUserItemType, itemType))
                            errors.add("invalid value for 'dataType' attribute of item '" + item.getNaaccrId() + "'; should be set to " + defaultUserItemType);
                    }
                    else {

                        // number cannot be one of the numbers from the base dictionary
                        if (baseNumbers.contains(item.getNaaccrNum()))
                            errors.add("invalid value for 'naaccrNum' attribute: " + item.getNaaccrNum() + "; number is already defined in corresponding base dictionary");

                        // range must be very specific for a user dictionary (deprecated)
                        if (SpecificationVersion.compareSpecifications(specVersion, SpecificationVersion.SPEC_1_3) < 0)
                            if (item.getNaaccrNum() < 9500 || item.getNaaccrNum() > 99999)
                                errors.add("invalid value for 'naaccrNum' attribute: " + item.getNaaccrNum() + "; allowed range is 9500-99999");

                        // this is tricky, but an item must fall into the columns of one of the items defined in the corresponding items defined in the default user dictionary
                        if (item.getStartColumn() != null) {
                            boolean fallInAllowedRange = false;
                            for (NaaccrDictionaryItem defaultItem : defaultUserDictionary.getItems()) {
                                if (item.getStartColumn() >= defaultItem.getStartColumn() && item.getStartColumn() + item.getLength() <= defaultItem.getStartColumn() + defaultItem.getLength()) {
                                    fallInAllowedRange = true;
                                    break;
                                }
                            }
                            if (!fallInAllowedRange)
                                errors.add("invalid value for 'startColumn' and/or 'length' attributes; user-defined items can only override state requestor item, NPCR item, or reserved gaps");
                        }
                    }
                }
            }

            if (!dictionary.getGroupedItems().isEmpty())
                errors.add("user-defined dictionaries cannot defined grouped items");
        }

        return errors;
    }
1214172
public boolean metadataEquals(Map<String, byte[]> otherMetadata) {
    if (metadata == otherMetadata) {
      // Fast-path for common cases where the same actual default metadata instance may be used in
      // multiple different item infos.
      return true;
    }
    // No need to check if other `metadata` is not null,
    // because previous `if` checks if both of them are null.
    if (metadata == null || otherMetadata == null) {
      return false;
    }
    if (!metadata.keySet().equals(otherMetadata.keySet())) {
      return false;
    }

    // Compare each byte[] with Arrays.equals.
    for (Map.Entry<String, byte[]> metadataEntry : metadata.entrySet()) {
      if (!Arrays.equals(metadataEntry.getValue(), otherMetadata.get(metadataEntry.getKey()))) {
        return false;
      }
    }
    return true;
  }