Return filename used to represent a set of paired-end files. Assumes Illumina-style naming
    conventions where each file has _R1_ or _R2_ in its name.
327271
def interleaved_filename(file_path):
    """"""
    if not isinstance(file_path, tuple):
        raise OneCodexException("Cannot get the interleaved filename without a tuple.")
    if re.match(".*[._][Rr][12][_.].*", file_path[0]):
        return re.sub("[._][Rr][12]", "", file_path[0])
    else:
        warnings.warn("Paired-end filenames do not match--are you sure they are correct?")
        return file_path[0]
997750
def get_os_file_names(files):
        

        fnames = []
        for f in files:
            if utils.is_str(f):
                fnames.append(f)
            elif isinstance(f, file_configuration_t):
                if f.content_type in (
                        file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE,
                        file_configuration_t.CONTENT_TYPE.CACHED_SOURCE_FILE):

                    fnames.append(f.data)
            else:
                pass
        return fnames
239143
public static String getName(String fileName){
        int dot = fileName.lastIndexOf('.');
        return dot==-1 ? fileName : fileName.substring(0, dot);
    }
74340
def disambiguate_fname(files_path_list, filename):
    """"""
    fname = os.path.basename(filename)
    same_name_files = get_same_name_files(files_path_list, fname)
    if len(same_name_files) > 1:
        compare_path = shortest_path(same_name_files)
        if compare_path == filename:
            same_name_files.remove(path_components(filename))
            compare_path = shortest_path(same_name_files)    
        diff_path = differentiate_prefix(path_components(filename),
                                             path_components(compare_path))
        diff_path_length = len(diff_path)
        path_component = path_components(diff_path)
        if (diff_path_length > 20 and len(path_component) > 2):
            if path_component[0] != '/' and path_component[0] != '':
                path_component = [path_component[0], '...', 
                                          path_component[-1]]
            else:
                path_component = [path_component[2], '...', 
                                          path_component[-1]]
            diff_path = os.path.join(*path_component)
        fname = fname + " - " + diff_path    
    return fname
823053
def _discarded_reads2_out_file_name(self):
        """"""
        if self.Parameters['-4'].isOn():
            discarded_reads2 = self._absolute(str(self.Parameters['-4'].Value))
        else:
            raise ValueError(
                "No discarded-reads2 (flag -4) output path specified")
        return discarded_reads2
1091661
def filenames(self):
        
        if self._is_reader:
            assert self._filenames is not None
            return self._filenames
        else:
            return self.data_producer.filenames
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);
    }
623148
private String determineFileName(final Matcher matcher) {
        String fileName;
        if (StringUtils.isNotBlank(matcher.group(3))) {
            fileName = matcher.group(3);
        }
        else if (StringUtils.isNotBlank(matcher.group(7))) {
            fileName = matcher.group(7);
        }
        else {
            fileName = matcher.group(1);
        }
        if (StringUtils.isBlank(fileName)) {
            fileName = StringUtils.substringBetween(matcher.group(6), "'");
        }
        if (StringUtils.isBlank(fileName)) {
            fileName = "unknown.file";
        }
        return fileName;
    }
785666
def sort_filenames(filenames):
    
    basenames = [os.path.basename(x) for x in filenames]
    indexes = [i[0] for i in sorted(enumerate(basenames), key=lambda x:x[1])]
    return [filenames[x] for x in indexes]
727649
def _module_name(filename):
        

        absfile = os.path.abspath(filename)
        match = filename

        for base in [''] + sys.path:
            base = os.path.abspath(base)
            if absfile.startswith(base):
                match = absfile[len(base):]
                break

        return SUFFIX_RE.sub('', match).lstrip('/').replace('/', '.')
767182
def filename_match(filename, patterns, default=True):
    
    if not patterns:
        return default
    return any(fnmatch(filename, pattern) for pattern in patterns)
930486
def filename(self, prefix='', suffix='', extension='.py'):
        """"""
        return BASE_NAME.format(prefix, self.num, suffix, extension)
188904
def _filename(self, ifo, description, extension, segment):
        
        if extension.startswith('.'):
            extension = extension[1:]

        # Follow the frame convention of using integer filenames,
        # but stretching to cover partially covered seconds.
        start = int(segment[0])
        end = int(math.ceil(segment[1]))
        duration = str(end-start)
        start = str(start)

        return "%s-%s-%s-%s.%s" % (ifo, description.upper(), start,
                                   duration, extension)
219661
def _file_name(self, dtype_out_time, extension='nc'):
        """"""
        if dtype_out_time is None:
            dtype_out_time = ''
        out_lbl = utils.io.data_out_label(self.intvl_out, dtype_out_time,
                                          dtype_vert=self.dtype_out_vert)
        in_lbl = utils.io.data_in_label(self.intvl_in, self.dtype_in_time,
                                        self.dtype_in_vert)
        start_year = utils.times.infer_year(self.start_date)
        end_year = utils.times.infer_year(self.end_date)
        yr_lbl = utils.io.yr_label((start_year, end_year))
        return '.'.join(
            [self.name, out_lbl, in_lbl, self.model.name,
             self.run.name, yr_lbl, extension]
        ).replace('..', '.')
1055386
def get_file_named(self, fldr, xtn):
        
        res = []       # list of Sample objects
        for root, _, files in os.walk(fldr):
            for basename in files:
                if fnmatch.fnmatch(basename, xtn):
                    filename = os.path.join(root, basename)
                    res.append(filename)

        if len(res) > 0:   
            return res[0]
        else:
            return None
440103
def _rm_name_match(s1, s2):
  
  m_len = min(len(s1), len(s2))
  return s1[:m_len] == s2[:m_len]
1150466
def is_same_filename (filename1, filename2):
    """"""
    return os.path.realpath(filename1) == os.path.realpath(filename2)