If the token string inside *tokens[index]* matches *replace*, return
    *replacement*. *right_of_equal*, and *inside_parens* are used to determine
    whether or not this token is safe to obfuscate.
330281
def obfuscate_variable(
        tokens,
        index,
        replace,
        replacement,
        right_of_equal,
        inside_parens,
        inside_function):
    
    def return_replacement(replacement):
        VAR_REPLACEMENTS[replacement] = replace
        return replacement
    tok = tokens[index]
    token_type = tok[0]
    token_string = tok[1]
    if index > 0:
        prev_tok = tokens[index-1]
    else: # Pretend it's a newline (for simplicity)
        prev_tok = (54, '\n', (1, 1), (1, 2), '#\n')
    prev_tok_string = prev_tok[1]
    try:
        next_tok = tokens[index+1]
    except IndexError: # Pretend it's a newline
        next_tok = (54, '\n', (1, 1), (1, 2), '#\n')
    if token_string == "import":
        return '__skipline__'
    if next_tok[1] == '.':
        if token_string in imported_modules:
            return None
    if token_string == "=":
        return '__right_of_equal__'
    if token_string == "(":
        return '__open_paren__'
    if token_string == ")":
        return '__close_paren__'
    if token_string == ",":
        return '__comma__'
    if token_type != tokenize.NAME:
        return None # Skip this token
    if token_string.startswith('__'):
        return None
    if prev_tok_string == 'def':
        return '__skipnext__' # Don't want to touch functions
    if token_string == replace and prev_tok_string != '.':
        if inside_function:
            if token_string not in keyword_args[inside_function]:
                if not right_of_equal:
                    if not inside_parens:
                        return return_replacement(replacement)
                    else:
                        if next_tok[1] != '=':
                            return return_replacement(replacement)
                elif not inside_parens:
                    return return_replacement(replacement)
                else:
                    if next_tok[1] != '=':
                        return return_replacement(replacement)
        elif not right_of_equal:
            if not inside_parens:
                return return_replacement(replacement)
            else:
                if next_tok[1] != '=':
                    return return_replacement(replacement)
        elif right_of_equal and not inside_parens:
            return return_replacement(replacement)
323918
function attemptReplace(token, pattern, replacement, callback) {
    var result = null;
    
    if((typeof pattern == 'string') && token.substr(0 - pattern.length) == pattern)
        result = token.replace(new RegExp(pattern + '$'), replacement);
    else if((pattern instanceof RegExp) && token.match(pattern))
        result = token.replace(pattern, replacement);
        
    if(result && callback)
        return callback(result);
    else
        return result;
}
694829
function replace(src, token, value) {
    var idx = src.indexOf(token);
    if (idx == -1) {
        return;
    }
    return src.substr(0, idx) + value + src.substr(idx + token.length);
}
1095198
public static boolean safeEquals(String a, String b) {
        if (a.length() != b.length()) {
            return false;
        } else {
            char equal = 0;
            for (int i = 0; i < a.length(); i++) {
                equal |= a.charAt(i) ^ b.charAt(i);
            }
            return equal == 0;
        }
    }
1088029
private Token match(Token.Kind kind) {
		checkNotEof();
		Token token = tokens.get(index++);
		if (token.kind != kind) {
			syntaxError("expecting \"" + kind + "\" here", token);
		}
		return token;
	}
811853
def deep_equal(a, b):
    
    if is_any_string_type(a) and is_any_string_type(b):
        if isinstance(a, six.binary_type):
            a = six.text_type(a, encoding='utf-8')
        if isinstance(b, six.binary_type):
            b = six.text_type(b, encoding='utf-8')
        return a == b
    return a == b and isinstance(a, type(b)) and isinstance(b, type(a))
673397
private static boolean hasBreakToken(AnalyzedTokenReadings[] tokens) {
    for (int i = 0; i < tokens.length && i < MAX_TOKEN_TO_CHECK; i++) {
      if (tokens[i].getToken().equals("-") || tokens[i].getToken().equals("—") || tokens[i].getToken().equals("–")) {
        return true;
      }
    }
    return false;
  }
859099
function checkString(i) {
  if (i >= tokensLength) {
    return 0;
  }

  if (tokens[i].type === TokenType.StringSQ ||
      tokens[i].type === TokenType.StringDQ) {
    return 1;
  }

  return 0;
}
797439
function attemptReplacePatterns(token, replacements, measureThreshold) {
  var replacement = null;

  for(var i = 0; i < replacements.length; i++) {
    if(!measureThreshold || measure(attemptReplace(token, replacements[i][0], '')) > measureThreshold)
      replacement = attemptReplace(token, replacements[i][0], replacements[i][1]);

    if(replacement)
      break;
  }

  return replacement;
}
1364818
private static boolean contentEquals(String s, char[] chars, int start, int length) {
		if (s.length() != length) {
			return false;
		}
		for (int i = 0; i < length; i++) {
			if (chars[start + i] != s.charAt(i)) {
				return false;
			}
		}
		return true;
	}
1091378
private boolean isVarEscaped(char[] array, int currentIndex)
    {
        int i = currentIndex - 1;

        while (i >= 0 && array[i] == '\\') {
            --i;
        }

        return (currentIndex - i) % 2 == 0;
    }
1112956
function removeTokenFromString(token, string) {
        var tokens = split(string),
            index = tokens.indexOf(token);
        if (index !== -1) {
          tokens.splice(index, 1);
        }
        return tokens.join(' ');
      }
1340593
private boolean isTokenNumberParsable(State state, String token) {
        if (token.isEmpty()) {
            return true;
        }
        return state.mDouble.reset(token).matches();
    }
820185
def guess_unmatched(self, token):
        
        # Check if this is probably an apartment:
        if token.lower() in ['apt', 'apartment']:
            return False
            # Stray dashes are likely useless
        if token.strip() == '-':
            return True
            # Almost definitely not a street if it is one or two characters long.
        if len(token) <= 2:
            return False
            # Let's check for a suffix-less street.
        if self.street_suffix is None and self.street is None and self.street_prefix is None and self.house_number is None:
            # Streets will just be letters
            if re.match(r"[A-Za-z]", token):
                if self.line_number >= 0:
                    pass
                #                    print "{0}: Guessing suffix-less street: ".format(self.line_number), token
                else:
                #                    print "Guessing suffix-less street: ", token
                    pass
                self.street = self._clean(token.capitalize())
                return True
        return False
1275381
private boolean isPosTokenMatched(AnalyzedToken token) {
    if (posToken == null || posToken.posTag == null) {
      // if no POS set defaulting to true
      return true;
    }
    if (token.getPOSTag() == null) {
      return posToken.posUnknown && token.hasNoTag();
    }
    boolean match;
    if (posToken.regExp) {
      Matcher mPos = posToken.posPattern.matcher(token.getPOSTag());
      match = mPos.matches();
    } else {
      match = posToken.posTag.equals(token.getPOSTag());
    }
    if (!match && posToken.posUnknown) { // ignore helper tags
      match = token.hasNoTag();
    }
    return match;
  }
201450
def star_sep_check(self, original, loc, tokens):
        """"""
        return self.check_py("3", "keyword-only argument separator (add 'match' to front to produce universal code)", original, loc, tokens)
1025802
function isRemovedToken(context, token) {
  var removedNodes = context.removedNodes;
  var nodeIdx = removedNodes.length - 1;

  // Find the last removed node which could possibly contain this token.
  while (nodeIdx >= 0 && startOf(removedNodes[nodeIdx]) > startOf(token)) {
    nodeIdx--;
  }

  var node = removedNodes[nodeIdx];

  // This token couldn't be removed if not contained within the removed node.
  if (nodeIdx === -1 || endOf(node) < endOf(token)) {
    return false;
  }

  // Iterate through the tokens contained by the removed node to find a match.
  var tokens = context.ast.tokens;
  var tokenIdx = findTokenIndex(tokens, startOf(node));
  while (endOf(tokens[tokenIdx]) <= endOf(node)) {
    if (token === tokens[tokenIdx]) {
      return true;
    }
    tokenIdx++;
  }

  return false;
}