Discard if long shorter than abbr, or if abbr token(s) are in the long token(s).
337229
def _filter_candidates(self, tokens, candidates):
        """"""
        results = []
        for abbr_span, long_span in candidates:
            abbr = tokens[abbr_span[0]:abbr_span[1]]
            long = tokens[long_span[0]:long_span[1]]
            if not all(a in long for a in abbr) and len(''.join(long)) > len(''.join(abbr)):
                results.append((abbr_span, long_span))
        return results
638117
function shorten(term, match, opts) {
  var matchOpts = {pre: opts.pre, post: opts.post};
  var shared = util.getUnion(term, match.dir);
  var cutoff = shared.lastIndexOf(path.sep) + 1;
  match.dir = match.dir.slice(cutoff);
  match.shared = shared.slice(0, cutoff);

  var filepath = path.join(match.dir, match.file);
  term = getRelativeTerm(term, match.shared);

  var relativeMatch = fuzzy.match(term, filepath, matchOpts);
  if(relativeMatch) {
    match.rendered = relativeMatch.rendered;
  }
}
395591
private void discardReadBytesIfNecessary(ByteBuf buffer) {

        float usedRatio = (float) buffer.readerIndex() / buffer.capacity();

        if (usedRatio >= discardReadBytesRatio && buffer.refCnt() != 0) {
            buffer.discardReadBytes();
        }
    }
175203
def strip_stop(tokens, start, result):
    """"""
    for e in result:
        for child in e.iter():
            if child.text.endswith('.'):
                child.text = child.text[:-1]
    return result
240445
def check_length(value, length):
    
    _length = len(value)
    if _length != length:
        raise ValueError("length must be %d, not %d" % \
                         (length, _length))
326411
def trim(self, len_):
        
        other = Version(None)
        other.tokens = self.tokens[:len_]
        other.seps = self.seps[:len_ - 1]
        return other
140016
def discard_last(self, indices):
        """"""
        for i in indices:
            self.buffer_expire[i] = self.buffer_expire[i][:-1]
            self.buffer[i] = self.buffer[i][:-1]
605155
def trim(self, length):
        """"""
        if length > 0:
            for child in self.children.values(): child.trim(length-1)
        else:
            if hasattr(self, 'count'): self.count = sum(map(lambda x: x.count, self))
            self.children = OrderedDict()
257890
def min_length?(value, length)
			has_min_length = coerce_bool (value.length >= length)
			unless has_min_length
				@error = "Error, expected value to have at least #{length} characters, got: #{value.length}"
			end
			has_min_length
		end
684790
private void trimToSize() {
		if (wordsInUse != words.length) {
			words = Arrays.copyOf(words, wordsInUse);
			checkInvariants();
		}
	}
253230
public static Function<? super ReactiveSeq<Long>, ? extends ReactiveSeq<Long>> skipLongs(long skip){

        return a->a.longs(i->i,s->s.skip(skip));
    }
1192213
function endsinArr(token, suffixes) {
  var i, longest = '';
  for (i = 0; i < suffixes.length; i++) {
    if (endsin(token, suffixes[i]) && suffixes[i].length > longest.length)
      longest = suffixes[i];
  }

  return longest;
}
1122900
def excluded_length(self):
        """"""
        return sum([shot.length for shot in self.shots if Exclude.LENGTH in shot.flags or Exclude.TOTAL in shot.flags])
633682
def truncate(string, index):
    """"""
    if len(string) > index and index > 0:
        string = string[:index - 1] + u('…')
    return string
949447
def do_truncate(parser, token):
    
    _, count = token.split_contents()

    nodelist = parser.parse(('more', 'endtruncate',))
    token = parser.next_token()
    if token.contents == 'more':
        nodelist_more = parser.parse(('endtruncate',))
        parser.delete_first_token()
    else:
        nodelist_more = None
    return TruncateNode(count, nodelist, nodelist_more)
619304
def shorten(original_chars, chars, length_without_trailing)
      truncated = []
      char_width = display_width(chars[0])
      while length_without_trailing - char_width > 0
        orig_char = original_chars.shift
        char = chars.shift
        break unless char
        while orig_char != char # consume ansi
          ansi = true
          truncated << orig_char
          orig_char = original_chars.shift
        end
        truncated << char
        char_width = display_width(char)
        length_without_trailing -= char_width
      end
      truncated << ["\e[0m"] if ansi
      truncated
    end
10826
function sameLength(a, b) {
    return typeof a === typeof b &&
      a && b &&
      a.length === b.length;
  }