Convert a file name into the file plus required indexes.
164494
def file_plus_index(fname):
    
    exts = {".vcf": ".idx", ".bam": ".bai", ".vcf.gz": ".tbi", ".bed.gz": ".tbi",
            ".fq.gz": ".gbi"}
    ext = splitext_plus(fname)[-1]
    if ext in exts:
        return [fname, fname + exts[ext]]
    else:
        return [fname]
1112227
def to_file_url(filename):
    
    url = 'file://' + os.path.abspath(filename).replace(os.path.sep, '/')
    return url
1215171
def translate_filenames(filenames):
    """"""
    if is_windows():
        return filenames
    for index, filename in enumerate(filenames):
        filenames[index] = vboxsf_to_windows(filename)
1080260
private static int getIndexFromFilename(String fileName) {
        // remove the beginning of the file name
        String resStr = fileName.replace(
                latestMOTDSerializedFileName.substring(0, latestMOTDSerializedFileName.indexOf("{index}")), "");

        // remove the end of the file name
        resStr = resStr.replace(
                latestMOTDSerializedFileName.substring(latestMOTDSerializedFileName.indexOf("{index}") + 7), "");

        return Integer.parseInt(resStr);
    }
722373
def match_filenames(filenames, pattern):
    """"""
    matching = []

    for filename in filenames:
        if fnmatch(get_filebase(filename, pattern), globify(pattern)):
            matching.append(filename)

    return matching
652735
def process_file(filename):
    """"""
    try:
        with codecs.open(filename, encoding='utf-8', mode='r') as f:
            file_contents = f.read()
    except IOError:
        log.info('Unable to read file: %s', filename)
        return None
    data = json.loads(file_contents)
    title = ''
    body_content = ''
    if 'current_page_name' in data:
        path = data['current_page_name']
    else:
        log.info('Unable to index file due to no name %s', filename)
        return None
    if 'body' in data and data['body']:
        body = PyQuery(data['body'])
        body_content = body.text().replace(u'¶', '')
    else:
        log.info('Unable to index content for: %s', filename)
    if 'title' in data:
        title = data['title']
        if title.startswith('<'):
            title = PyQuery(data['title']).text()
    else:
        log.info('Unable to index title for: %s', filename)

    return {'headers': process_headers(data, filename),
            'content': body_content, 'path': path, 'title': title}
1002322
def from_filename(self, filename):
        '''
        
        '''
        i = len(self.base_directory)
        if filename[:i] != self.base_directory:
            raise ValueError('Filename needs to start with "%s";\nyou passed "%s".' % (self.base_directory, filename))

        if filename.endswith(self.extension):
            if len(self.extension) > 0:
                j = -len(self.extension)
            else:
                j = None
            return self.key_transformer.from_path(tuple(filename[i:j].strip('/').split('/')))
71660
def save_to_file(self, filename_prefix):
    """"""
    # Wrap in single quotes to make it easier to see the full subword when
    # it has spaces and make it easier to search with ctrl+f.
    filename = self._filename(filename_prefix)
    lines = ["'%s'" % s for s in self._subwords]
    self._write_lines_to_file(filename, lines)
1308488
def read(filename):
    """"""
    path = join(here, filename)
    with open(path, "r") as fin:
        return fin.read().strip()
1124837
function getFilenameWithoutExtension(filename) {
        var index = filename.lastIndexOf(".");
        return index === -1 ? filename : filename.slice(0, index);
    }
339577
def ext_from_filename(filename):
    
    try:
        base, ext = filename.lower().rsplit(".", 1)
    except ValueError:
        return ''
    ext = ".{0}".format(ext)
    all_exts = [x.extension for x in chain(magic_header_array,
                                           magic_footer_array)]

    if base[-4:].startswith("."):
        # For double extensions like like .tar.gz
        long_ext = base[-4:] + ext
        if long_ext in all_exts:
            return long_ext
    return ext
986230
def normalizeFilename(filename):
    
    result = os.path.expanduser(filename)
    result = os.path.abspath(result)
    return result
532403
def convert_to_path(name):
    """"""
    if name.startswith('.'):
        remainder = name.lstrip('.')
        dot_count = (len(name) - len(remainder))
        prefix = '../'*(dot_count-1)
    else:
        remainder = name
        dot_count = 0
        prefix = ''
    filename = prefix + os.path.join(*remainder.split('.'))
    return (filename, dot_count)
244316
def read_files(filenames, with_name=False):
    """"""
    text = [read_file(filename) for filename in filenames]
    if with_name:
        return dict(zip(filenames, text))
    return text
326286
def fromfilenames(cls, filenames, coltype=LIGOTimeGPS):
		
		cache = cls()
		for filename in filenames:
			cache.extend(cls.fromfile(open(filename), coltype=coltype))
		return cache
3331
def make_filenames(self, **kwargs):
        
        out_dict = dict(ft1file=self.ft1file(**kwargs),
                        ltcube=self.ltcube(**kwargs),
                        ccube=self.ccube(**kwargs),
                        bexpcube=self.bexpcube(**kwargs),
                        srcmaps=self.srcmaps(**kwargs),
                        mcube=self.mcube(**kwargs))
        return out_dict
890341
def generate_index_file(filename):
    """"""
    with open(filename, 'w') as file:
        content = open(os.path.join(os.path.dirname(__file__), 'templates/index_page.html'), 'r').read()
        file.write(content)