Special method for hexmerge.py script to split file notation
    into 3 parts: (filename, start, end)

    @raise _BadFileNotation  when string cannot be safely split.
167117
def _get_file_and_addr_range(s, _support_drive_letter=None):
    
    if _support_drive_letter is None:
        _support_drive_letter = (os.name == 'nt')
    drive = ''
    if _support_drive_letter:
        if s[1:2] == ':' and s[0].upper() in ''.join([chr(i) for i in range_g(ord('A'), ord('Z')+1)]):
            drive = s[:2]
            s = s[2:]
    parts = s.split(':')
    n = len(parts)
    if n == 1:
        fname = parts[0]
        fstart = None
        fend = None
    elif n != 3:
        raise _BadFileNotation
    else:
        fname = parts[0]
        def ascii_hex_to_int(ascii):
            if ascii is not None:
                try:
                    return int(ascii, 16)
                except ValueError:
                    raise _BadFileNotation
            return ascii
        fstart = ascii_hex_to_int(parts[1] or None)
        fend = ascii_hex_to_int(parts[2] or None)
    return drive+fname, fstart, fend
545194
function (chunks, start, end) {
    var soff=0, eoff=0, i=0, j=0;
    for (i=0; i<chunks.length; i++) {
      if (soff + chunks[i].length > start)
        break;
      soff += chunks[i].length;
    }
    var strs = [];
    eoff = soff;
    for (j=i; j<chunks.length; j++) {
      strs.push(chunks[j]);
      if (eoff + chunks[j].length > end)
        break;
      eoff += chunks[j].length;
    }
    var s = strs.join('');
    return s.substring(start-soff, start-soff+(end-start));
  }
767557
def _handle_splits(_str):
    """"""
    _str = _str.replace('/', '-')
    _tmp_dict = {}

    if '-' in _str:
        start, stop = _str.split('-')
        if _check_number(start):
            start = regex.sub(r'[0-9]+\?*', start, stop)
        elif _check_number(stop):
            stop = regex.sub(r'[0-9]+\?*', stop, start)
    else:
        start = _str
        stop = _str
    _tmp_dict['start_raw'] = start
    _tmp_dict['stop_raw'] = stop

    _tmp_dict['start_epoch'] = _get_epoch(start)
    _tmp_dict['stop_epoch'] = _get_epoch(stop)

    return _tmp_dict
633627
def split_source(source_code):
    '''
    '''
    eol_chars = get_eol_chars(source_code)
    if eol_chars:
        return source_code.split(eol_chars)
    else:
        return [source_code]
1005159
def _split_str(self, field):
        
        field_items = field.split("|")
        if len(field_items) == 2:
            return field_items[0], field_items[1]
        elif len(field_items) == 1:
            return field_items[0], None
837227
def split_string(self, string, splitter='.', allow_empty=True):
        """"""
        i = 0
        rv = []
        need_split = False
        while i < len(string):
            m = re.compile(_KEY_NAME).match(string, i)
            if not need_split and m:
                i = m.end()
                body = m.group(1)
                if body[:3] == '"""':
                    body = self.converter.unescape(body[3:-3])
                elif body[:3] == "'''":
                    body = body[3:-3]
                elif body[0] == '"':
                    body = self.converter.unescape(body[1:-1])
                elif body[0] == "'":
                    body = body[1:-1]
                if not allow_empty and not body:
                    raise TomlDecodeError(
                        self.lineno,
                        'Empty section name is not allowed: %r' % string)
                rv.append(body)
                need_split = True
            elif need_split and string[i] == splitter:
                need_split = False
                i += 1
                continue
            else:
                raise TomlDecodeError(self.lineno,
                                      'Illegal section name: %r' % string)
        if not need_split:
            raise TomlDecodeError(
                self.lineno,
                'Empty section name is not allowed: %r' % string)
        return rv
468646
def _safe_name(file_name, sep):
    """"""
    file_name = stringify(file_name)
    if file_name is None:
        return
    file_name = ascii_text(file_name)
    file_name = category_replace(file_name, UNICODE_CATEGORIES)
    file_name = collapse_spaces(file_name)
    if file_name is None or not len(file_name):
        return
    return file_name.replace(WS, sep)
750113
def _split_iso9660_filename(fullname):
    # type: (bytes) -> Tuple[bytes, bytes, bytes]
    '''
    
    '''
    namesplit = fullname.split(b';')
    version = b''
    if len(namesplit) > 1:
        version = namesplit.pop()

    rest = b';'.join(namesplit)

    dotsplit = rest.split(b'.')
    if len(dotsplit) == 1:
        name = dotsplit[0]
        extension = b''
    else:
        name = b'.'.join(dotsplit[:-1])
        extension = dotsplit[-1]

    return (name, extension, version)
135733
def split(encoded):
    
    algorithm, iterations, salt, h = encoded.split('$', 3)
    return algorithm, iterations, salt, h
330045
public static String[] split(String fileName){
        int dot = fileName.lastIndexOf('.');
        if(dot==-1)
            return new String[]{ fileName, null };
        else
            return new String[] { fileName.substring(0, dot), fileName.substring(dot+1)};
    }
733465
def file_basename(self, file):
        '''
        
        '''
        valid_extensions = set(".tree",
                               ".tre")
        split_file = os.path.basename(file).split('.')
        base, suffix = '.'.join(split_file[:-1]), split_file[-1]

        if suffix in valid_extensions:
            return base
        else:
            logging.error("Invalid file extension found on file: %s" % file)
            logging.error("For trees, please provide a file with one of the \
following extensions: %s" % ' '.join(valid_extensions.keys()))
            raise InvalidFileExtensionError
166623
def lower_extension(filename):
    '''
    
    '''
    if '.' in filename:
        main, ext = os.path.splitext(filename)
        return main + ext.lower()
    # For consistency with os.path.splitext,
    # do not treat a filename without an extension as an extension.
    # That is, do not return filename.lower().
    return filename
922647
def explode_filename(name: str, scheme: str) -> dict:
    

    if not scheme:
        return split_filename(name)

    replacements = {
        'name': '(?P<name>.*)',
        'ext': '(?P<extension>.+)$',
        'index': '(?P<index>[0-9]{{{length}}})'
    }

    scheme_pattern = '^'
    empty_scheme_pattern = ''

    offset = 0
    while offset < len(scheme):
        char = scheme[offset]
        next_char = scheme[offset + 1] if (offset + 1) < len(scheme) else None

        if char in r'.()^$?*+\[]|':
            addition = '\\{}'.format(char)
            scheme_pattern += addition
            empty_scheme_pattern += addition
            offset += 1
            continue

        if char != '{':
            scheme_pattern += char
            empty_scheme_pattern += char
            offset += 1
            continue

        if next_char != '{':
            scheme_pattern += char
            empty_scheme_pattern += char
            offset += 1
            continue

        end_index = scheme.find('}}', offset)

        contents = scheme[offset:end_index].strip('{}').lower()

        if contents in replacements:
            scheme_pattern += replacements[contents]
        elif contents == ('#' * len(contents)):
            addition = replacements['index'].format(length=len(contents))
            scheme_pattern += addition
            empty_scheme_pattern += addition
        else:
            addition = '{{{}}}'.format(contents)
            scheme_pattern += addition
            empty_scheme_pattern += addition

        offset = end_index + 2

    match = re.compile(scheme_pattern).match(name)

    if not match:
        parts = split_filename(name)
        comparison = re.compile(empty_scheme_pattern.rstrip('-_: .\\'))
        match = comparison.match(parts['name'])
        if not match:
            return parts

    parts = match.groupdict()
    index = parts.get('index')
    index = int(index) if index else None

    return dict(
        index=index - 1,
        name=parts.get('name', ''),
        extension=parts.get('extension', 'py')
    )
880991
def _split_standard_name(self, standard_name):
        '''
        
        '''

        if isinstance(standard_name, basestring) and ' ' in standard_name:
            return standard_name.split(' ', 1)
        # if this isn't a string, then it doesn't make sense to split
        # -- treat value as standard name with no modifier
        else:
            return standard_name, None
962678
def split_line(self):
        
        # coordinate of the # symbol or end of the line (-1) if not found
        hash_or_end = self.line.find("#")
        temp = self.line[self.region_end:hash_or_end].strip(" |")
        self.coord_str = regex_paren.sub("", temp)

        # don't want any meta_str if there is no metadata found
        if hash_or_end >= 0:
            self.meta_str = self.line[hash_or_end:]
        else:
            self.meta_str = ""
281851
private void parseMultiParts(Buf src, BufRange body, KeyValueRanges data, BufRanges dataContentTypes,
	                             Map<String, List<Upload>> files, BufRange multipartBoundary, RapidoidHelper helper) {

		int start = body.start;
		int limit = body.limit();

		int sepLen = multipartBoundary.length + 2;
		int pos1 = -1, pos2;

		try {

			while ((pos2 = BytesUtil.find(src.bytes(), start, limit, helper.bytes, 0, sepLen, true)) >= 0) {
				if (pos1 >= 0 && pos2 >= 0) {
					int from = pos1 + sepLen + 2;
					int to = pos2 - 2;
					parseMultiPart(src, data, dataContentTypes, files, helper, from, to);
				}

				pos1 = pos2;
				start = pos2 + sepLen;
			}

		} catch (Throwable e) {
			Log.warn("Multipart parse error!", e);
			throw U.rte("Multipart data parse error!", e);
		}
	}
149372
def splitlines(self, keepends=False):
        
        # Py2 unicode.splitlines() takes keepends as an optional parameter,
        # not as a keyword argument as in Python 3 str.
        parts = super(newstr, self).splitlines(keepends)
        return [newstr(part) for part in parts]