Subroutine to fill in compatibility information for one pair of types.
515448
private void recordCompatibilityInfo(JMFType access, JSchema accSchema, JMFType encoding,
      JSchema encSchema) throws JMFSchemaViolationException
  {
    if (access instanceof JSPrimitive)
      if (encoding instanceof JSPrimitive)
        recordCompatibilityInfo((JSPrimitive)access, accSchema, (JSPrimitive)encoding,
          encSchema);
      else if (encoding instanceof JSVariant)
        checkForDeletingVariant(access, (JSVariant)encoding, false, accSchema, encSchema);
      else {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "Compatibility violation (type mismatch) for JSPrimitive");
        violation(access, encoding);
       }
    else if (access instanceof JSEnum)
      if (encoding instanceof JSEnum)
        recordCompatibilityInfo((JSEnum)access, accSchema, (JSEnum)encoding, encSchema);
      else if (encoding instanceof JSVariant)
        checkForDeletingVariant(access, (JSVariant)encoding, false, accSchema, encSchema);
      else {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "Compatibility violation (type mismatch) for JSEnum");
        violation(access, encoding);
      }
    else if (access instanceof JSDynamic)
      if (encoding instanceof JSDynamic)
        recordOnePair((JSField)access, accSchema, (JSField)encoding, encSchema);
      else if (encoding instanceof JSVariant)
        checkForDeletingVariant(access, (JSVariant)encoding, false, accSchema, encSchema);
      else {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "Compatibility violation (type mismatch) for JSDynamic");
        violation(access, encoding);
      }
    else if (access instanceof JSRepeated)
      if (encoding instanceof JSRepeated)
        recordCompatibilityInfo(((JSRepeated)access).getItemType(), accSchema,
          ((JSRepeated)encoding).getItemType(), encSchema);
      else if (encoding instanceof JSVariant)
        checkForDeletingVariant(access, (JSVariant)encoding, false, accSchema, encSchema);
      else {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "Compatibility violation (type mismatch) for JSRepeated");
        violation(access, encoding);
      }
    else if (access instanceof JSTuple)
      if (encoding instanceof JSTuple)
        recordCompatibilityInfo((JSTuple)access, accSchema, (JSTuple)encoding, encSchema);
      else if (encoding instanceof JSVariant)
        checkForDeletingVariant(access, (JSVariant)encoding, false, accSchema, encSchema);
      else {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JmfTr.debug(this, tc, "Compatibility violation (type mismatch) for JSTuple");
        violation(access, encoding);
      }
    else if (access instanceof JSVariant) {
      JSVariant accVar = (JSVariant)access;
      if (encoding instanceof JSVariant) {
        JSVariant encVar = (JSVariant)encoding;
        recordCompatibilityInfo(accVar, accSchema, encVar, encSchema);
      } else
        checkForDeletingVariant(encoding, accVar, true, accSchema, encSchema);
    }
  }
873416
private Result allSubTypes(List<PType> sub, List<PType> sup,
			boolean invignore)
	{
		if (sub.size() != sup.size())
		{
			return Result.No;
		} else
		{
			for (int i = 0; i < sub.size(); i++)
			{
				if (searchSubType(sub.get(i), sup.get(i), invignore) == Result.No)
				{
					return Result.No;
				}
			}
		}

		return Result.Yes;
	}
806291
public PType intersect(PType a, PType b)
	{
		Set<PType> tsa = new HashSet<PType>();
		Set<PType> tsb = new HashSet<PType>();

		// Obtain the fundamental type of BracketTypes, NamedTypes and OptionalTypes.
		boolean resolved = false;

		while (!resolved)
		{
			if (a instanceof ABracketType)
			{
				a = ((ABracketType) a).getType();
				continue;
			}

			if (b instanceof ABracketType)
			{
				b = ((ABracketType) b).getType();
				continue;
			}

			if (a instanceof ANamedInvariantType)
			{
				ANamedInvariantType nt = (ANamedInvariantType) a;

				if (nt.getInvDef() == null)
				{
					a = nt.getType();
					continue;
				}
			}

			if (b instanceof ANamedInvariantType)
			{
				ANamedInvariantType nt = (ANamedInvariantType) b;

				if (nt.getInvDef() == null)
				{
					b = nt.getType();
					continue;
				}
			}

			if (a instanceof AOptionalType && b instanceof AOptionalType)
			{
				a = ((AOptionalType) a).getType();
				b = ((AOptionalType) b).getType();
				continue;
			}

			resolved = true;
		}

		if (a instanceof AUnionType)
		{
			AUnionType uta = (AUnionType) a;
			tsa.addAll(uta.getTypes());
		} else
		{
			tsa.add(a);
		}

		if (b instanceof AUnionType)
		{
			AUnionType utb = (AUnionType) b;
			tsb.addAll(utb.getTypes());
		} else
		{
			tsb.add(b);
		}

		// Keep largest types which are compatible (eg. nat and int choses int)
		Set<PType> result = new HashSet<PType>();

		for (PType atype : tsa)
		{
			for (PType btype : tsb)
			{
				if (isSubType(atype, btype))
				{
					result.add(btype);
				} else if (isSubType(btype, atype))
				{
					result.add(atype);
				}
			}
		}

		if (result.isEmpty())
		{
			return null;
		} else
		{
			List<PType> list = new Vector<PType>();
			list.addAll(result);
			return AstFactory.newAUnionType(a.getLocation(), list);
		}
	}
1143828
def ismatch(a,b):
    """"""
    #Try the easy case
    if a == b:
        return True
    else:
        #Try isinstance in both orders
        try:
            if isinstance(a,b):
                return True
        except TypeError:
            try:
                if isinstance(b,a):
                    return True
            except TypeError:
                #Try isinstance(a, type(b)) in both orders
                try:
                    if isinstance(a,type(b)):
                        return True
                except TypeError:
                    try:
                        if isinstance(b,type(a)):
                            return True
                    except TypeError:
                        #Try the string representation
                        if str(a).lower() == str(b).lower():
                            return True
                        else:
                            return False
417807
def type_match(a, b):
    """"""
    # If the types are the same, return True
    if a['type'] == b['type']:
        return True
    # Otherwise, look at some special cases
    eq_groups = [
        {'ONT::GENE-PROTEIN', 'ONT::GENE', 'ONT::PROTEIN'},
        {'ONT::PHARMACOLOGIC-SUBSTANCE', 'ONT::CHEMICAL'}
        ]
    for eq_group in eq_groups:
        if a['type'] in eq_group and b['type'] in eq_group:
            return True
    return False
212151
def _merge_by_type(lhs, rhs, type_):
    """"""
    merger = _MERGE_BY_TYPE[type_.code]
    return merger(lhs, rhs, type_)
253403
function _compareTypes(typeA, typeB, sameTypes, propertyA, propertyB) {
  sameTypes = sameTypes || {}
  if (typeA === typeB) {
    if (typeA === types.class && propertyA && propertyB) {
      return propertyA.constructor.name === propertyB.constructor.name;
    }
    return true;
  }

  if (Object.keys(sameTypes).length === 0) {
    return false;
  }
  let typeKeyA;
  let typeKeyB;
  let foundMatch = false
  Object.keys(sameTypes).forEach((key) => {
    if (foundMatch) { return }
    const similar = sameTypes[key];
    if (similar.indexOf(typeA) > -1) {
      typeKeyA = key;
    }
    if (similar.indexOf(typeB) > -1) {
      typeKeyB = key;
    }
    if (typeKeyA && typeKeyB) { foundMatch = true }
  });
  return foundMatch && typeKeyA === typeKeyB;
}
19281
def require_compatible_version(compatible_version, word="File"):
    """"""
    if isinstance(compatible_version, str):
        compatible_version = parse_version(compatible_version)
    elif not isinstance(compatible_version, Version):
        raise ValueError("Type of `compatible_version` not understood.")
    
    current_version = parse_version(CURRENT_VERSION)
    if current_version < compatible_version:
        raise VersionError("{0} written for version >= {1}, this is {2}.".format(
            word, str(compatible_version), CURRENT_VERSION
        ))
289628
def is_compatible(self):
        """"""
        for pattern in OPTIONS['compatible_patterns']:
            if fnmatch(self.package.lower(), pattern):
                return True
        return False
1181959
def _handleLookupType2Format1(subtable):
    
    kerning = {}
    coverage = subtable.Coverage.glyphs
    valueFormat1 = subtable.ValueFormat1
    pairSets = subtable.PairSet
    for index, leftGlyphName in enumerate(coverage):
        pairSet = pairSets[index]
        for pairValueRecord in pairSet.PairValueRecord:
            rightGlyphName = pairValueRecord.SecondGlyph
            if valueFormat1:
                value = pairValueRecord.Value1
            else:
                value = pairValueRecord.Value2
            if hasattr(value, "XAdvance"):
                value = value.XAdvance
                kerning[leftGlyphName, rightGlyphName] = value
    return kerning
1211065
def suits_with_dtype(mn, mx, dtype):
    
    type_info = np.iinfo(dtype)
    if mx <= type_info.max and mn >= type_info.min:
        return True
    else:
        return False
1059114
def compatible(self, a, b):
        """"""
        return len(set([a] + self.descendants(a))
                   .intersection([b] + self.descendants(b))) > 0
1057042
def column_types_equal(a_coltype: TypeEngine, b_coltype: TypeEngine) -> bool:
      # noqa
    return str(a_coltype) == str(b_coltype)
429652
def _check_compatibility(self):
        """"""
        stored_descr = self._file_trace_description()
        try:
            for k, v in self._model_trace_description():
                assert(stored_descr[k][0] == v[0])
        except:
            raise ValueError(
                "The objects to tally are incompatible with the objects stored in the file.")
624824
private static boolean areFieldsCompatible(String sourceField, TypeInformation<?> inType, String targetField,
			TypeInformation<?> outType, boolean throwException) {

		try {
			// get source type information
			TypeInformation<?> sourceType = getExpressionTypeInformation(sourceField, inType);
			// get target type information
			TypeInformation<?> targetType = getExpressionTypeInformation(targetField, outType);
			return sourceType.equals(targetType);
		} catch (InvalidFieldReferenceException e) {
			if (throwException) {
				throw e;
			} else {
				return false;
			}
		}
	}
224761
def validate_type_ac_pair(type, ac):
    

    assert type in valid_pairs, "Unknown variant type " + type
    if valid_pairs[type].match(ac):
        return (ValidationLevel.VALID,
                "Accession ({ac}) is compatible with variant type {type}".format(ac=ac, type=type))
    elif invalid_pairs[type].match(ac):
        return (ValidationLevel.ERROR,
                "Accession ({ac}) is not compatible with variant type {type}".format(
                    ac=ac, type=type))
    else:
        return (ValidationLevel.WARNING,
                "Accession ({ac}) is not known to be compatible with variant type {type}".format(
                    ac=ac, type=type))
584531
def accepts(self):  # type: Union[Iterable[Type[T]], Type[Any]]
        """"""
        types = set()
        any_dispatch = False
        try:
            types.update(getattr(self.__class__, "put")._accepts)
            any_dispatch = True
        except AttributeError:
            pass
        try:
            types.update(getattr(self.__class__, "put_many")._accepts)
            any_dispatch = True
        except AttributeError:
            pass
        return types if any_dispatch else TYPE_WILDCARD