If two indices overlap, add suffixes to overlapping entries.

    If corresponding suffix is empty, the entry is simply converted to string.
195054
def items_overlap_with_suffix(left, lsuffix, right, rsuffix):
    
    to_rename = left.intersection(right)
    if len(to_rename) == 0:
        return left, right
    else:
        if not lsuffix and not rsuffix:
            raise ValueError('columns overlap but no suffix specified: '
                             '{rename}'.format(rename=to_rename))

        def renamer(x, suffix):
            """Rename the left and right indices.

            If there is overlap, and suffix is not None, add
            suffix, otherwise, leave it as-is.

            Parameters
            ----------
            x : original column name
            suffix : str or None

            Returns
            -------
            x : renamed column name
            """
            if x in to_rename and suffix is not None:
                return '{x}{suffix}'.format(x=x, suffix=suffix)
            return x

        lrenamer = partial(renamer, suffix=lsuffix)
        rrenamer = partial(renamer, suffix=rsuffix)

        return (_transform_index(left, lrenamer),
                _transform_index(right, rrenamer))
808757
private void expandAffixes(String pluralCount) {
        // expandAffix() will set currencyChoice to a non-null value if
        // appropriate AND if it is null.
        currencyChoice = null;

        // Reuse one StringBuffer for better performance
        StringBuffer buffer = new StringBuffer();
        if (posPrefixPattern != null) {
            expandAffix(posPrefixPattern, pluralCount, buffer);
            positivePrefix = buffer.toString();
        }
        if (posSuffixPattern != null) {
            expandAffix(posSuffixPattern, pluralCount, buffer);
            positiveSuffix = buffer.toString();
        }
        if (negPrefixPattern != null) {
            expandAffix(negPrefixPattern, pluralCount, buffer);
            negativePrefix = buffer.toString();
        }
        if (negSuffixPattern != null) {
            expandAffix(negSuffixPattern, pluralCount, buffer);
            negativeSuffix = buffer.toString();
        }
    }
649910
def _make_suffix(cov):
    """"""
    # Check if coverage object has data_suffix:
    if cov and cov.data_suffix is not None:
        # If True, the suffix will be autogenerated by coverage.py.
        # The suffixed data files will be automatically combined later.
        if cov.data_suffix is True:
            return True
        # Has a suffix, but we add our own extension
        return cov.data_suffix + '.nbval'
    return 'nbval'
907768
def suffix(tokens, operator_table):
    """"""
    operator, matched_tokens = operator_table.suffix.match(tokens)
    if operator:
        return TokenMatch(operator, None, matched_tokens)
861601
def p_suffix(self, length=None, elipsis=False):
        ""
        if length is not None:
            result = self.input[self.pos:self.pos + length]
            if elipsis and len(result) == length:
                result += "..."
            return result
        return self.input[self.pos:]
437188
def add_suffix(fullname, suffix):
    
    name, ext = os.path.splitext(fullname)
    return name + '_' + suffix + ext
577976
public static boolean match(final String stringToMatch, final String suffixes[])
	{
		for (final String suffix : suffixes)
		{
			final int suffixesLength = suffix.length();
			final int stringToMatchLength = stringToMatch.length();
			final int result = stringToMatchLength - suffixesLength;
			final String extensionToMatch = stringToMatch.substring(result, stringToMatchLength);
			final boolean equals = extensionToMatch.equalsIgnoreCase(suffix);
			if (stringToMatchLength >= suffixesLength && equals)
			{
				return true;
			}
		}
		return false;
	}
403481
private void fixActiveEdgeAfterSuffixLink(Suffix<T, S> suffix) {
        while (activeEdge != null && activeLength > activeEdge.getLength()) {
            activeLength = activeLength - activeEdge.getLength();
            activeNode = activeEdge.getTerminal();
            Object item = suffix.getItemXFromEnd(activeLength + 1);
            activeEdge = activeNode.getEdgeStarting(item);
        }
        resetActivePointToTerminal();
    }
1041901
def add_suffix(filename, suffix):
        
        path = filename.split("/")
        parts = path[-1].split(".")
        i = max(len(parts) - 2, 0)
        parts[i] = parts[i] + suffix
        path[-1] = ".".join(parts)
        return "/".join(path)
93139
public MeterIdPrefix appendWithTags(String suffix, Iterable<Tag> tags) {
        return new MeterIdPrefix(name(suffix), sortedImmutableTags(tags));
    }
979685
def strip_suffix(id):
    
    suffix = get_suffix(id)
    if not suffix:
        return id
    return re.split(suffix, id)[0]
1091852
public String joinEx(Object collection, String delim, String prefix, String suffix) {
		if (collection == null) {
			return StringUtils.collectionToDelimitedString(Collections.emptyList(), delim, prefix, suffix);
		} else if (collection instanceof Collection) {
			return StringUtils.collectionToDelimitedString((Collection<?>) collection, delim, prefix, suffix);
		} else if (collection.getClass().isArray()) {
			return StringUtils.collectionToDelimitedString(CollectionUtils.arrayToList(collection), delim, prefix, suffix);
		} else {
			return StringUtils.collectionToDelimitedString(Collections.singletonList(collection), delim, prefix, suffix);
		}
	}
567971
public static <T> String join(Iterator<T> iterator, CharSequence conjunction, String prefix, String suffix) {
		if (null == iterator) {
			return null;
		}

		final StringBuilder sb = new StringBuilder();
		boolean isFirst = true;
		T item;
		while (iterator.hasNext()) {
			if (isFirst) {
				isFirst = false;
			} else {
				sb.append(conjunction);
			}

			item = iterator.next();
			if (ArrayUtil.isArray(item)) {
				sb.append(ArrayUtil.join(ArrayUtil.wrap(item), conjunction, prefix, suffix));
			} else if (item instanceof Iterable<?>) {
				sb.append(join((Iterable<?>) item, conjunction, prefix, suffix));
			} else if (item instanceof Iterator<?>) {
				sb.append(join((Iterator<?>) item, conjunction, prefix, suffix));
			} else {
				sb.append(StrUtil.wrap(String.valueOf(item), prefix, suffix));
			}
		}
		return sb.toString();
	}
782757
def _suffixArrayWithTrace(s, SA, n, K, operations, totalOperations):
    
    if _trace:
        _traceSuffixArray(operations, totalOperations)

    n0 = (n + 2) // 3
    n1 = (n + 1) // 3
    n2 = n // 3
    n02 = n0 + n2

    SA12 = _array("i", [0] * (n02 + 3))
    SA0 = _array("i", [0] * n0)
    s0 = _array("i", [0] * n0)

    # s12 : positions of mod 1 and mod 2 suffixes
    s12 = _array("i", [i for i in range(n + (n0 - n1)) if i % 3])  # <- writing i%3 is more efficient than i%3!=0
    s12.extend([0] * 3)

    # lsb radix sort the mod 1 and mod 2 triples
    _radixPass(s12, SA12, s[2:], n02, K)
    if _trace:
        operations += n02
        _traceSuffixArray(operations, totalOperations)

    _radixPass(SA12, s12, s[1:], n02, K)
    if _trace:
        operations += n02
        _traceSuffixArray(operations, totalOperations)

    _radixPass(s12, SA12, s, n02, K)
    if _trace:
        operations += n02
        _traceSuffixArray(operations, totalOperations)

    # find lexicographic names of triples
    name = 0
    c = _array("i", [-1] * 3)
    for i in range(n02):
        cSA12 = s[SA12[i]:SA12[i] + 3]
        if cSA12 != c:
            name += 1
            c = cSA12

        if SA12[i] % 3 == 1:
            s12[SA12[i] // 3] = name  # left half
        else:
            s12[(SA12[i] // 3) + n0] = name  # right half

    if name < n02:  # recurse if names are not yet unique
        operations = _suffixArrayWithTrace(s12, SA12, n02, name + 1, operations, totalOperations)
        if _trace:
            _traceSuffixArray(operations, totalOperations)

        # store unique names in s12 using the suffix array
        for i, SA12_i in enumerate(SA12[:n02]):
            s12[SA12_i] = i + 1
    else:  # generate the suffix array of s12 directly
        if _trace:
            operations += _nbOperations(n02)
            _traceSuffixArray(operations, totalOperations)

        for i, s12_i in enumerate(s12[:n02]):
            SA12[s12_i - 1] = i

    # stably sort the mod 0 suffixes from SA12 by their first character
    j = 0
    for SA12_i in SA12[:n02]:
        if (SA12_i < n0):
            s0[j] = 3 * SA12_i
            j += 1

    _radixPass(s0, SA0, s, n0, K)
    if _trace:
        operations += n0
        _traceSuffixArray(operations, totalOperations)

    # merge sorted SA0 suffixes and sorted SA12 suffixes
    p = j = k = 0
    t = n0 - n1
    while k < n:
        if SA12[t] < n0:  # pos of current offset 12 suffix
            i = SA12[t] * 3 + 1
        else:
            i = (SA12[t] - n0) * 3 + 2

        j = SA0[p]  # pos of current offset 0 suffix

        if SA12[t] < n0:
            bool = (s[i], s12[SA12[t] + n0]) <= (s[j], s12[int(j / 3)])
        else:
            bool = (s[i], s[i + 1], s12[SA12[t] - n0 + 1]) <= (s[j], s[j + 1], s12[int(j / 3) + n0])

        if (bool):
            SA[k] = i
            t += 1
            if t == n02:  # done --- only SA0 suffixes left
                k += 1
                while p < n0:
                    SA[k] = SA0[p]
                    p += 1
                    k += 1

        else:
            SA[k] = j
            p += 1
            if p == n0:  # done --- only SA12 suffixes left
                k += 1
                while t < n02:
                    if SA12[t] < n0:  # pos of current offset 12 suffix
                        SA[k] = (SA12[t] * 3) + 1
                    else:
                        SA[k] = ((SA12[t] - n0) * 3) + 2
                    t += 1
                    k += 1
        k += 1
    return operations
1118802
def ComputeFortranSuffixes(suffixes, ppsuffixes):
    """"""
    assert len(suffixes) > 0
    s = suffixes[0]
    sup = s.upper()
    upper_suffixes = [_.upper() for _ in suffixes]
    if SCons.Util.case_sensitive_suffixes(s, sup):
        ppsuffixes.extend(upper_suffixes)
    else:
        suffixes.extend(upper_suffixes)
946870
public static String[] splitSuffix(String suffix) {
    String theSuffix = suffix;

    String[] parts;
    if (StringUtils.isBlank(theSuffix)) {
      // no suffix given - return empty list
      parts = new String[0];
    }
    else {
      // remove leading slash
      if (theSuffix.startsWith(ESCAPED_SLASH)) {
        theSuffix = theSuffix.substring(ESCAPED_SLASH.length());
      }

      // remove file extension
      theSuffix = StringUtils.substringBeforeLast(theSuffix, ".");

      // split the suffix to extract the paths of the selected components
      parts = StringUtils.split(theSuffix, SUFFIX_PART_DELIMITER);
    }

    return parts;
  }
295470
private void addMissingBlanks(final int index) {
        if (this.capacity <= index) {
            this.capacity = index * 2;
            final E[] newArr = (E[]) new Object[this.capacity];
            System.arraycopy(this.arr, 0, newArr, 0, this.size);
            this.arr = newArr;
        }
        if (this.blankElement != null) {
            Arrays.fill(this.arr, this.size, index, this.blankElement);
        }
        this.size = index + 1;
    }