Return tuple with filesystem and filename.
420836
def _get_fs(self, create_dir=True):
        """"""
        filedir = dirname(self.fileurl)
        filename = basename(self.fileurl)

        return (
            opener.opendir(filedir, writeable=True, create_dir=create_dir),
            filename
        )
982525
def filesystem(self):
        
        for item in self:
            if item.name.startswith('File System'):
                for s in item_status(item):
                    yield s
908485
def get_fs(path):
    """"""
    scheme = ''
    if '://' in path:
        scheme = path.partition('://')[0]

    for schemes, fs_class in FILE_EXTENSIONS:
        if scheme in schemes:
            return fs_class

    return FileSystem
208521
def _filenames_from_arg(filename):
    """"""
    if isinstance(filename, string_types):
        filenames = [filename]
    elif isinstance(filename, (list, tuple)):
        filenames = filename
    else:
        raise Exception('filename argument must be string, list or tuple')
    for fn in filenames:
        if not os.path.exists(fn):
            raise ValueError('file not found: %s' % fn)
        if not os.path.isfile(fn):
            raise ValueError('not a file: %s' % fn)
    return filenames
450223
def _get_fstype_from_parser(self, fstype=None):
        """"""
        if fstype:
            self.fstype = fstype
        elif self.index in self.disk.parser.fstypes:
            self.fstype = self.disk.parser.fstypes[self.index]
        elif '*' in self.disk.parser.fstypes:
            self.fstype = self.disk.parser.fstypes['*']
        elif '?' in self.disk.parser.fstypes and self.disk.parser.fstypes['?'] is not None:
            self.fstype = "?" + self.disk.parser.fstypes['?']
        else:
            self.fstype = ""

        if self.fstype in VOLUME_SYSTEM_TYPES:
            self.volumes.vstype = self.fstype
            self.fstype = 'volumesystem'

        # convert fstype from string to a FileSystemType object
        if not isinstance(self.fstype, filesystems.FileSystemType):
            if self.fstype.startswith("?"):
                fallback = FILE_SYSTEM_TYPES[self.fstype[1:]]
                self.fstype = filesystems.FallbackFileSystemType(fallback)
            else:
                self.fstype = FILE_SYSTEM_TYPES[self.fstype]
372617
def get_nt_filename (path):
    """"""
    unc, rest = os.path.splitunc(path)
    head, tail = os.path.split(rest)
    if not tail:
        return path
    for fname in os.listdir(unc+head):
        if fname.lower() == tail.lower():
            return os.path.join(get_nt_filename(unc+head), fname)
    log.error(LOG_CHECK, "could not find %r in %r", tail, head)
    return path
526464
def to_tuple(self):
        """"""
        return (
            self.data_type,
            self.unit,
            self.analysis_period,
            self.metadata
        )
700132
def to_tuple(self, iterable, surround="()", joiner=", "):
    """"""
    return "{0}{1}{2}".format(surround[0], joiner.join(iterable), surround[1])
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]
1296285
def build_info(name, path=None, module=None):
    """"""
    verlist = get_version_list(path, module)
    verlist[0] = name
    return tuple(verlist)
580704
def names(cls):
        """"""
        if not cls._files:
            for f in os.listdir(cls._image_path):
                if(not f.startswith('.') and
                   os.path.isfile(os.path.join(cls._image_path, f))):
                    cls._files.append(os.path.splitext(f)[0])

        return cls._files
1332761
def tuple_to_string(prog_tuple):
    """"""
    (roman, acc, suff) = prog_tuple
    if acc > 6:
        acc = 0 - acc % 6
    elif acc < -6:
        acc = acc % 6
    while acc < 0:
        roman = 'b' + roman
        acc += 1
    while acc > 0:
        roman = '#' + roman
        acc -= 1
    return roman + suff
392060
def get_filebase(path, pattern):
    """"""
    # A pattern can include directories
    tail_len = len(pattern.split(os.path.sep))
    return os.path.join(*str(path).split(os.path.sep)[-tail_len:])
1134522
def EnumerateFilesystemsFromClient(args):
  """"""
  del args  # Unused.

  filenames = ["/proc/mounts", "/etc/mtab"]

  for filename in filenames:
    for device, fs_type, mnt_point in CheckMounts(filename):
      yield rdf_client_fs.Filesystem(
          mount_point=mnt_point, type=fs_type, device=device)
1171889
def files(self, ftype=None):
        
        a = [self.join(i) for i in self]
        if ftype is not None:
            return [i for i in a if i.isfile() and i.filetype() == ftype]
        return [i for i in a if i.isfile()]
392275
def filename_to_module(filename):
    
    find = re.compile(r"^[^.|-]*")
    name = re.search(find, filename).group(0)
    return name
1074183
def get_file(self, name):
        
        files = self.get_output_files()
        for f in files:
            if f.get_name() == name:
                return f
        return None