Pit two sworn enemies against each other (separate with 'vs.')
549659
def fight(nick, rest):
	""
	if rest:
		vtype = random.choice(phrases.fight_victories)
		fdesc = random.choice(phrases.fight_descriptions)
		# valid separators are vs., v., and vs
		pattern = re.compile('(.*) (?:vs[.]?|v[.]) (.*)')
		matcher = pattern.match(rest)
		if not matcher:
			karma.Karma.store.change(nick.lower(), -1)
			args = (vtype, nick, fdesc)
			return "/me %s %s in %s for bad protocol." % args
		contenders = [c.strip() for c in matcher.groups()]
		random.shuffle(contenders)
		winner, loser = contenders
		karma.Karma.store.change(winner, 1)
		karma.Karma.store.change(loser, -1)
		return "%s %s %s in %s." % (winner, vtype, loser, fdesc)
123021
def within(self, other: "Interval", inclusive: bool = True) -> bool:
        
        if not other:
            return False
        if inclusive:
            return self.start >= other.start and self.end <= other.end
        else:
            return self.start > other.start and self.end < other.end
1011700
def overlaps(self, other):
        """"""
        if self > other:
            smaller, larger = other, self
        else:
            smaller, larger = self, other
        if larger.empty():
            return False
        if smaller._upper_value == larger._lower_value:
            return smaller._upper == smaller.CLOSED and larger._lower == smaller.CLOSED
        return larger._lower_value < smaller._upper_value
150299
def compare(operator,a,b):
    ""
    # todo(awinter): what about nested 3vl like "(a=b)=(c=d)". is that allowed by sql? It will choke here if there's a null involved.
    f=({'=':lambda a,b:a==b,'!=':lambda a,b:a!=b,'>':lambda a,b:a>b,'<':lambda a,b:a<b}[operator])
    return ThreeVL('u') if None in (a,b) else f(a,b)
598921
def ajAssims(self):
        
        for lin in lignesFichier(self.path("assimilations.la")):
            ass1, ass2 = tuple(lin.split(':'))
            self.lemmatiseur._assims[ass1] = ass2
            self.lemmatiseur._assimsq[atone(ass1)] = atone(ass2)
144769
def _one_contains_other(s1, s2):
    
    return min(len(s1), len(s2)) == len(s1 & s2)
405142
function compareCategories(a, b) {
  return a === b                 ?   0
  :      a === '(Uncategorised)' ?   1
  :      b === '(Uncategorised)' ?  -1
  :      /* otherwise */            compare(a, b);
}
565867
function(a, b) {
    if (a.pos < b.pos) return -1;
    if (a.pos > b.pos) return 1;

    if (a.mode < b.mode) return -1;
    if (a.mode > b.mode) return 1;

    if (a.mode === ENTER) {
      if (a.level < b.level) return -1;
      if (a.level > b.level) return 1;
    }

    if (a.mode === EXIT) {
      if (a.level > b.level) return -1;
      if (a.level < b.level) return 1;
    }

    return 0;
  }
593964
def overlaps_with(self, othermatch, strict=False):
        '''
        
        '''
        one = self.matches_entry(othermatch, strict)
        if strict:
            return one
        return one and othermatch.matches_entry(self, strict)
1374512
def Equals(self, other):
    
    return (self._approxEq(self.x, other.x)
            and self._approxEq(self.y, other.y)
            and self._approxEq(self.z, other.z))
582013
def _pred_sets_are_in_conflict(pred_set_a, pred_set_b):
    
    # pred_sets conflict if we cannot find one shared predicate that is "negated" in one
    # and "non-negated" in the other
    for pred_a, bool_a in pred_set_a:
        for pred_b, bool_b in pred_set_b:
            if pred_a is pred_b and bool_a != bool_b:
                return False
    return True
1228490
function compareRelids(a, b) {
            var aRel = self.getRelid(a),
                bRel = self.getRelid(b);

            if (aRel < bRel) {
                return -1;
            } else if (aRel > bRel) {
                return 1;
            } else {
                return 0;
            }
        }
1283023
def do_bb_intersect(a, b):
    """"""
    return a.p1.x <= b.p2.x \
        and a.p2.x >= b.p1.x \
        and a.p1.y <= b.p2.y \
        and a.p2.y >= b.p1.y
1121799
def opponent=(opponent)
      @opponent = case opponent
        when nil     then nil
        when Fixnum  then opponent
        when /^\s*$/ then nil
        else opponent.to_i
      end
      raise "invalid opponent number (#{opponent})" if @opponent == 0 && !opponent.to_s.match(/\d/)
      raise "opponent number and player number (#{@opponent}) must be different" if @opponent == player
      self.rateable = true if @opponent
    end
1326767
function(other) {
        var comps = ["a", "b", "c", "d"],
            i, len;

        for (i=0, len=comps.length; i < len; i++) {
            if (this[comps[i]] < other[comps[i]]) {
                return -1;
            } else if (this[comps[i]] > other[comps[i]]) {
                return 1;
            }
        }

        return 0;
    }
191199
def intersects(self, other):
        ''''''
        return self.CHROM == other.CHROM and self.POS <= other.ref_end_pos() and other.POS <= self.ref_end_pos()
1025344
function(_set1, _set2) {
        var flagEquals,
            newSet = [];
        for (var i = 0; i < _set1.length; i++) {
            flagEquals = false;
            for(var j = 0; j < _set2.length; j++) {
                if (_set1[i].asString == _set2[j].asString) {
                    flagEquals = true;
                    break;
                }
            }
            if (!flagEquals) {
                newSet.push(_set1[i]);
            }
        }

        return newSet;
    }