Return a new union or intersection type computed by removing a given set of types
from a given union or intersection type.
485847
function removeTypesFromUnionOrIntersection(type, typesToRemove) {
            var reducedTypes = [];
            for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
                var t = _a[_i];
                if (!typeIdenticalToSomeType(t, typesToRemove)) {
                    reducedTypes.push(t);
                }
            }
            return type.flags & 524288 /* Union */ ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes);
        }
482265
def union(self, streamSet):
        
        if(not isinstance(streamSet,set)) :
            raise TypeError("The union operator parameter must be a set object")
        if(len(streamSet) == 0):
            return self        
        op = self.topology.graph.addOperator("$Union$")
        op.addInputPort(outputPort=self.oport)
        for stream in streamSet:
            op.addInputPort(outputPort=stream.oport)
        oport = op.addOutputPort(schema=self.oport.schema)
        return Stream(self.topology, oport)
401986
def remove_alias(type_):
    
    if isinstance(type_, cpptypes.type_t):
        type_ref = type_
    elif isinstance(type_, typedef.typedef_t):
        type_ref = type_.decl_type
    else:
        # Not a valid input, just return it
        return type_
    if type_ref.cache.remove_alias:
        return type_ref.cache.remove_alias
    no_alias = __remove_alias(type_ref.clone())
    type_ref.cache.remove_alias = no_alias
    return no_alias
421013
def _get_union_type_name(type_names_to_union):
    """"""
    if not type_names_to_union:
        raise AssertionError(u'Expected a non-empty list of type names to union, received: '
                             u'{}'.format(type_names_to_union))
    return u'Union__' + u'__'.join(sorted(type_names_to_union))
78874
def _issubclass_Union(subclass, superclass, bound_Generic, bound_typevars,
            bound_typevars_readonly, follow_fwd_refs, _recursion_check):
    
    if not follow_fwd_refs:
        return _issubclass_Union_rec(subclass, superclass, bound_Generic, bound_typevars,
            bound_typevars_readonly, follow_fwd_refs, _recursion_check)
    try:
        # try to succeed fast, before we go the expensive way involving recursion checks
        return _issubclass_Union_rec(subclass, superclass, bound_Generic, bound_typevars,
            bound_typevars_readonly, False, _recursion_check)
    except pytypes.ForwardRefError:
        return _issubclass_Union_rec(subclass, superclass, bound_Generic, bound_typevars,
            bound_typevars_readonly, follow_fwd_refs, _recursion_check)
184754
def is_union_type(tp):
    
    if NEW_TYPING:
        return (tp is Union or
                isinstance(tp, _GenericAlias) and tp.__origin__ is Union)
    return type(tp) is _Union
642896
def workflow_remove_types(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/removeTypes' % object_id, input_params, always_retry=always_retry, **kwargs)
91270
public AsciiSet intersection(AsciiSet set) {
    final boolean[] intersectionMembers = new boolean[128];
    for (int i = 0; i < intersectionMembers.length; ++i) {
      intersectionMembers[i] = members[i] && set.members[i];
    }
    return new AsciiSet(intersectionMembers);
  }
252775
public static <T> Set<T> intersection(Set<T>... sets) {
		return intersection(Arrays.asList(sets));
	}
1030529
public static <T> Collection<T> union(Collection<T> coll1, Collection<T> coll2) {
		final ArrayList<T> list = new ArrayList<>();
		if (isEmpty(coll1)) {
			list.addAll(coll2);
		} else if (isEmpty(coll2)) {
			list.addAll(coll1);
		} else {
			final Map<T, Integer> map1 = countMap(coll1);
			final Map<T, Integer> map2 = countMap(coll2);
			final Set<T> elts = newHashSet(coll2);
			elts.addAll(coll1);
			int m;
			for (T t : elts) {
				m = Math.max(Convert.toInt(map1.get(t), 0), Convert.toInt(map2.get(t), 0));
				for (int i = 0; i < m; i++) {
					list.add(t);
				}
			}
		}
		return list;
	}
514692
def union(cls, *sets):
        
        import utool as ut
        lists_ = ut.flatten([list(s) for s in sets])
        return cls(lists_)
1227630
private static void removeDuplicateContracts(final Class<?> type, final Set<Class<?>> contracts) {
        if (contracts.isEmpty()) {
            return;
        }

        // remove interfaces already included in common type (e.g. Number and Serializable)
        Iterator<Class<?>> it = contracts.iterator();
        while (it.hasNext()) {
            if (it.next().isAssignableFrom(type)) {
                it.remove();
            }
        }

        // remove duplicate interfaces (e.g. List already include Collection and Iterable)
        it = contracts.iterator();
        while (it.hasNext()) {
            final Class<?> current = it.next();
            for (Class<?> iface : contracts) {
                if (!current.equals(iface) && current.isAssignableFrom(iface)) {
                    it.remove();
                    break;
                }
            }
        }
    }
1219014
private static List<Type> removeRedundantBounds(final Type[] bounds) {
        if (bounds.length == 1) {
            return Collections.singletonList(bounds[0]);
        }
        // if TypeVariable S has a bound T that is a TypeVariable, than S cannot have any other bounds, i.e. bounds.lenght == 1

        List<Type> result = new LinkedList<Type>();
        for (int i = 0; i < bounds.length; i++) {
            boolean isRedundant = false;
            for (int j = 0; j < bounds.length && i != j; j++) {
                if (Reflections.getRawType(bounds[i]).isAssignableFrom(Reflections.getRawType(bounds[j]))) {
                    isRedundant = true;
                    break;
                }
            }
            if (!isRedundant) {
                result.add(bounds[i]);
            }
        }

        return result;
    }
1371228
@SuppressWarnings("unchecked")
  private Object union(Linker linker, Object a, Object b) {
    if (a instanceof List) {
      return union((List<?>) a, (List<?>) b);
    } else if (a instanceof Map) {
      return union(linker, (Map<ProtoMember, Object>) a, (Map<ProtoMember, Object>) b);
    } else {
      linker.addError("conflicting options: %s, %s", a, b);
      return a; // Just return any placeholder.
    }
  }
752925
static JSType filterNoResolvedType(JSType type) {
    if (type.isNoResolvedType()) {
      // inf(UnresolvedType1, UnresolvedType2) needs to resolve
      // to the base unresolved type, so that the relation is symmetric.
      return type.getNativeType(JSTypeNative.NO_RESOLVED_TYPE);
    } else if (type.isUnionType()) {
      UnionType unionType = type.toMaybeUnionType();
      boolean needsFiltering = false;
      ImmutableList<JSType> alternatesList = unionType.getAlternates();
      for (int i = 0; i < alternatesList.size(); i++) {
        JSType alt = alternatesList.get(i);
        if (alt.isNoResolvedType()) {
          needsFiltering = true;
          break;
        }
      }

      if (needsFiltering) {
        UnionTypeBuilder builder = UnionTypeBuilder.create(type.registry);
        builder.addAlternate(type.getNativeType(JSTypeNative.NO_RESOLVED_TYPE));
        for (int i = 0; i < alternatesList.size(); i++) {
          JSType alt = alternatesList.get(i);
          if (!alt.isNoResolvedType()) {
            builder.addAlternate(alt);
          }
        }
        return builder.build();
      }
    }
    return type;
  }
927536
def _new_type(cls, args):
        

        fformat = ["%r" if f is None else "%s=%%r" % f for f in args]
        fformat = "(%s)" % ", ".join(fformat)

        class _ResultTuple(cls):
            __slots__ = ()
            _fformat = fformat
            if args:
                for i, a in enumerate(args):
                    if a is not None:
                        vars()[a] = property(itemgetter(i))
                del i, a

        return _ResultTuple
402648
def combine_type(observations):
    
    assert len(observations) > 0
    if len(observations) == 1:
        return observations[0]
    else:
        if simplify:
            simplify_for_Union(observations)
        return Union[tuple(observations)]