Merge two simple selectors, for the purposes of the LCS algorithm below.

    In practice this returns the more specific selector if one is a subset of
    the other, else it returns None.
346901
def _merge_simple_selectors(a, b):
    
    # TODO what about combinators
    if a.is_superset_of(b):
        return b
    elif b.is_superset_of(a):
        return a
    else:
        return None
62550
private Entry mergeLists(Entry a, Entry b) {
        if (a == null) return b;
        if (b == null) return a;

        // splice the two circular lists together like a Mobius strip
        final Entry aOldNext = a.next;
        a.next = b.next;
        a.next.previous = a;
        b.next = aOldNext;
        b.next.previous = b;

        return comparator.compare(a.priority, b.priority) < 0 ? a : b;
    }
238901
def merge(x, y):
    
    z = []
    i = 0
    j = 0
    while i < len(x) or j < len(y):
        if j == len(y) or i < len(x) and x[i] <= y[j]:  # priority on x
            z.append(x[i])
            i += 1
        else:
            z.append(y[j])
            j += 1
    return z
105280
protected boolean mergeSegments() {
		// can't merge a single line
		if( splits.size <= 2 )
			return false;

		boolean change = false;
		work.reset();

		// first point is always at the start
		work.add(splits.data[0]);

		for( int i = 0; i < splits.size-2; i++ ) {
			if( selectSplitBetween(splits.data[i],splits.data[i+2]) < 0 ) {
				// merge the two lines by not adding it
				change = true;
			} else {
				work.add(splits.data[i + 1]);
			}
		}

		// and end
		work.add(splits.data[splits.size-1]);

		// swap the two lists
		GrowQueue_I32 tmp = work;
		work = splits;
		splits = tmp;

		return change;
	}
1308573
function merge(src1, src2) {
    var merged = {};
    extend(merged, src1);
    extend(merged, src2);
    return merged;
}
428930
def merge(self, other):
        
        other = self.coerce(other)
        if self.is_equal(other):
            # pick among dependencies
            return self
        elif other.is_entailed_by(self):
            # other is a subset of self
            return self
        elif self.is_entailed_by(other):
            # self is a subset of other.
            self.values = other.values.copy()
        elif self.is_contradictory(other):
            raise Contradiction("Cannot merge set with %s" % (str(other)))
        else:
            # merge mutual information
            if self.values:
                self.values = self.values.intersection(other.values)
            else:
                self.values = other.values.copy()
        return self
815327
def merge(self, other):
        
        other = self.coerce(other)
        if self.is_equal(other):
            # pick among dependencies
            return self
        elif self.is_contradictory(other):
            raise Contradiction("Cannot merge set with %s" % (str(other)))
        else:
            # self may be a subset of other 
            # or other may be a subset of self
            # merge mutual information
            if self.values:
                self.values = self.values.union(other.values)
            else:
                self.values = other.values.copy()
        return self
132562
def merge(self, other_rel):
        
        if other_rel.thresholds.size == self.thresholds.size and np.all(other_rel.thresholds == self.thresholds):
            self.frequencies += other_rel.frequencies
        else:
            print("Input table thresholds do not match.")
1272372
function hasSimilarSelectors(selectors1, selectors2) {
    var cursor1 = selectors1.head;

    while (cursor1 !== null) {
        var cursor2 = selectors2.head;

        while (cursor2 !== null) {
            if (cursor1.data.compareMarker === cursor2.data.compareMarker) {
                return true;
            }

            cursor2 = cursor2.next;
        }

        cursor1 = cursor1.next;
    }

    return false;
}
1147711
def mergeBboxes(bbox1, bbox2):
    
    if isContained(bbox1, bbox2):
        return bbox2
    elif isContained(bbox2, bbox1):
        return bbox1
    else:
        return (
            min(bbox1[0], bbox2[0]),
            min(bbox1[1], bbox2[1]),
            max(bbox1[2], bbox2[2]),
            max(bbox1[3], bbox2[3]),
        )
395892
public void mergeWith(OptionalBoolean other) {
		if (state == other.state) {
			// no change in state
		} else if (state == State.UNSET) {
			state = other.state;
		} else if (other.state == State.UNSET) {
			// no change in state
		} else {
			state = State.CONFLICTING;
		}
	}
144769
def _one_contains_other(s1, s2):
    
    return min(len(s1), len(s2)) == len(s1 & s2)
151016
def _merge_a_into_b(self, a, b):
        
        from easydict import EasyDict as edict
        if type(a) is not edict:
            return

        for k, v in a.items():
            # a must specify keys that are in b
            if k not in b:
                raise KeyError('{} is not a valid config key'.format(k))

            # the types must match, too
            old_type = type(b[k])
            if old_type is not type(v):
                if isinstance(b[k], np.ndarray):
                    v = np.array(v, dtype=b[k].dtype)
                else:
                    raise ValueError(('Type mismatch ({} vs. {}) '
                                      'for config key: {}').format(type(b[k]),
                                                                   type(v), k))

            # recursively merge dicts
            if type(v) is edict:
                try:
                    self._merge_a_into_b(a[k], b[k])
                except:
                    print('Error under config key: {}'.format(k))
                    raise
            else:
                b[k] = v
        return b
1043762
function (a, b) {
			return getSpecificityScore(element, b.selectorText) - getSpecificityScore(element, a.selectorText);
		}
1346457
function merge( a, l, m, r ) {
    const n1 = m - l + 1;
    const n2 = r - m;
    const L = a.slice( l, m + 1 );
    const R = a.slice( m + 1, 1 + r );

    let i = 0, j = 0, k = l;
    while( i < n1 && j < n2 ) {
        if( L[ i ][ 0 ] <= R[ j ][ 0 ] ) {
            a[ k ] = L[ i ];
            i++;
        } else {
            a[ k ] = R[ j ];
            j++;
        }
        k++;
    }

    while( i < n1 ) {
        a[ k ] = L[ i ];
        i++;
        k++;
    }

    while( j < n2 ) {
        a[ k ] = R[ j ];
        j++;
        k++;
    }
}
532805
def div(a, b):
    
    if a is None:
        if b is None:
            return None
        else:
            return 1 / b
    elif b is None:
        return a
    return a / b
126178
void mergeEdges_(int edge1, int edge2) {
		// dbg_check_edge_(edge1);
		int cluster_1 = getEdgeCluster(edge1, 0);
		int cluster2 = getEdgeCluster(edge1, 1);
		int cluster21 = getEdgeCluster(edge2, 0);
		int cluster22 = getEdgeCluster(edge2, 1);

		int originVertices1 = getEdgeOriginVertices(edge1);
		int originVertices2 = getEdgeOriginVertices(edge2);
		m_edge_vertices.concatenateLists(originVertices1, originVertices2);
		if (edge2 == getClusterFirstEdge(cluster_1))
			setClusterFirstEdge_(cluster_1, edge1);
		if (edge2 == getClusterFirstEdge(cluster2))
			setClusterFirstEdge_(cluster2, edge1);

		disconnectEdge_(edge2);// disconnects the edge2 from the clusters.
		deleteEdge_(edge2);

		if (!((cluster_1 == cluster21 && cluster2 == cluster22) || (cluster2 == cluster21 && cluster_1 == cluster22))) {
			// Merged edges have different clusters (clusters have not yet been
			// merged)
			// merge clusters before merging the edges
			getClusterXY(cluster_1, pt_1);
			getClusterXY(cluster21, pt_2);
			if (pt_1.isEqual(pt_2)) {
				if (cluster_1 != cluster21) {
					mergeClusters_(cluster_1, cluster21);
					assert (!m_modified_clusters.hasElement(cluster21));
				}
				if (cluster2 != cluster22) {
					mergeClusters_(cluster2, cluster22);
					assert (!m_modified_clusters.hasElement(cluster22));
				}
			} else {
				if (cluster2 != cluster21) {
					mergeClusters_(cluster2, cluster21);
					assert (!m_modified_clusters.hasElement(cluster21));
				}
				if (cluster_1 != cluster22) {
					mergeClusters_(cluster_1, cluster22);
					assert (!m_modified_clusters.hasElement(cluster22));
				}
			}
		} else {
			// Merged edges have equal clusters.
		}
		// dbg_check_edge_(edge1);
	}