Finds apartment, unit, #, etc, regardless of spot in string. This needs to come after everything else has been ruled out,
        because it has a lot of false positives.
541680
def check_apartment_number(self, token):
        
        apartment_regexes = [r'#\w+ & \w+', '#\w+ rm \w+', "#\w+-\w", r'apt #{0,1}\w+', r'apartment #{0,1}\w+', r'#\w+',
                             r'# \w+', r'rm \w+', r'unit #?\w+', r'units #?\w+', r'- #{0,1}\w+', r'no\s?\d+\w*',
                             r'style\s\w{1,2}', r'\d{1,4}/\d{1,4}', r'\d{1,4}', r'\w{1,2}']
        for regex in apartment_regexes:
            if re.match(regex, token.lower()):
                self.apartment = self._clean(token)
                return True
            #        if self.apartment is None and re.match(apartment_regex_number, token.lower()):
            ##            print "Apt regex"
            #            self.apartment = token
            #            return True
            ## If we come on apt or apartment and already have an apartment number, add apt or apartment to the front
        if self.apartment and token.lower() in ['apt', 'apartment']:
        #            print "Apt in a_n"
            self.apartment = self._clean(token + ' ' + self.apartment)
            return True

        if not self.street_suffix and not self.street and not self.apartment:
        #            print "Searching for unmatched term: ", token, token.lower(),
            if re.match(r'\d?\w?', token.lower()):
                self.apartment = self._clean(token)
                return True
        return False
449290
def check(self, data):
        """"""
        if isinstance(data, Iterable):
            data = "".join(str(x) for x in data)
        try:
            data = str(data)
        except UnicodeDecodeError:
            return False
        return bool(data and self.__regexp.match(data))
163899
def matches(property_name, regex, *, present_optional=False, message=None):
    """"""
    def check(val):
      """Checks that a value matches a scope-enclosed regex."""
      if not val:
        return present_optional
      else:
        return True if regex.search(val) else False

    return Validation(check, property_name, message)
679974
def findall(pattern, string, *args, **kwargs):
    """"""

    flags = args[2] if len(args) > 2 else kwargs.get('flags', 0)
    return _re.findall(_apply_search_backrefs(pattern, flags), string, *args, **kwargs)
892848
def sanity_check_insdcio(handle, id_marker, fake_id_line):
    """"""
    found_id = False
    found_end_marker = False
    for line in handle:
        line = line.strip()
        if not line:
            continue
        if line.startswith(id_marker):
            found_id = True
            break
        if line.startswith('//'):
            found_end_marker = True
            break

    handle.seek(0)
    # We found an ID, file looks good.
    if found_id:
        return handle

    # If there's no ID and no end marker, just give up.
    if not found_end_marker:
        return handle

    # If we found an end marker but no ID, fake one.
    new_handle = StringIO()
    new_handle.write("%s\n" % fake_id_line)
    new_handle.write(handle.read())
    new_handle.seek(0)
    return new_handle
1119449
private boolean anyStringContainsNewLine(final String[] data) {
		boolean returnVal = false;
		for (int i = 0; i < data.length; i++) {
			if (Util.containsNewlines(data[i])) {
				returnVal = true;
			}
		}
		return returnVal;
	}
489141
function contains(origin, search, start) {
  'use strict';
  if (typeof start !== 'number') {
    start = 0;
  }
  if (start + search.length > origin.length) {
    return false;
  } else {
    return origin.indexOf(search, start) !== -1;
  }
}
100492
def clean(self, value):
        """"""

        if isinstance(value, six.string_types) and value.lower() == 'false':
            return False

        return bool(value)
371554
def findAllByBiSearch(self, strSeq) :
		""""""
		arr = self.encode(strSeq)
		lst = []
		self._dichFind(arr[0], self, 0, lst)
		return lst
577482
def is_exact(needle, haystack, start, end, matchnot):
    """"""
    return ((start >= 0 and end < len(haystack) and
             haystack[start:end] == needle) ^ matchnot)
1176105
@Override
    public synchronized void findNext(String str) {
        boolean found = false;
        int startLine = line;
        int startColumn = column + 1; //We always start one char after the cursor position.

        while (!found && startLine <= lines.size()) {
            String currentLine = getContent(startLine);
            String linePart = currentLine.length() > startColumn ? currentLine.substring(startColumn - 1) : "";
            if (linePart.contains(str)) {
                column = startColumn + linePart.indexOf(str);
                line = startLine;
                found = true;
            } else {
                startLine++;
                startColumn = 1;
            }
        }
    }
1060525
function findInsertLocation(matches, score) {
	const idx = binarySearch(matches, 0, matches.length, score);

	if(idx < 0) {
		// If the score was not found
		return - idx - 1;
	}

	/*
		* Something with the same score was found, make sure this item is
		* added after all previous items with the same score.
		*/
	for(let i=idx+1; i<matches.length; i++) {
		if(matches[i].score < score) return i;
	}

	return matches.length;
}
966502
function checkSubStr(targetStr, pos, searchStr) {
  if (searchStr === "" || pos < 0 || pos + searchStr.length > targetStr.length) {
    return false;
  }
  return targetStr.substr(pos, searchStr.length) === searchStr;
}
1260780
def check_until(self, regex):
        
        return self.search_full(regex, return_string=True, advance_pointer=False)
409547
def Detect(self, str_in):
    

    components = SplitIntoComponents(str_in)

    extracted_paths = set()
    for extractor in self.extractors:
      extracted_paths.update(extractor.Extract(components))

    results = set(extracted_paths)

    for post_processor in self.post_processors:
      processed_results = set()
      for result in results:
        processed_results.update(post_processor.Process(result))
      results = processed_results

    return results
1065640
def ContainsAddressStr(self, address):
        
        for key, contract in self._contracts.items():
            if contract.Address == address:
                return True
        return False
253058
function containsSingleMatch(str, arr) {
  var filtered = arr.filter(function(e) { return e.indexOf(str) === 0 })
  return filtered.length === 1
}