This method returns the list of currently assigned librefs
512912
def assigned_librefs(self):
        

        code = """
        data _null_; retain libref; retain cobs 1; 
           set sashelp.vlibnam end=last;
           if cobs EQ 1 then
              put "LIBREFSSTART";
           cobs = 2;
           if libref NE libname then
              put "LIBREF=" libname;
           libref = libname;
           if last then
              put "LIBREFSEND";
        run;
        """

        if self.nosub:
            print(code)
            return None
        else:
           ll = self.submit(code, results='text')

        librefs = []
        log = ll['LOG'].rpartition('LIBREFSEND')[0].rpartition('LIBREFSSTART')
                                                                                  
        for i in range(log[2].count('LIBREF=')):                                    
           log = log[2].partition('LIBREF=')[2].partition('\n')                    
           librefs.append(log[0].strip())                                                         
                                                                                  
        return librefs
662232
def _list_existing(filesystem, glob, paths):
    
    globs = _constrain_glob(glob, paths)
    time_start = time.time()
    listing = []
    for g in sorted(globs):
        logger.debug('Listing %s', g)
        if filesystem.exists(g):
            listing.extend(filesystem.listdir(g))
    logger.debug('%d %s listings took %f s to return %d items',
                 len(globs), filesystem.__class__.__name__, time.time() - time_start, len(listing))
    return set(listing)
128254
def file_list(self, tgt_env):
        '''
        
        '''
        def _traverse(tree, blobs, prefix):
            '''
            Traverse through a pygit2 Tree object recursively, accumulating all
            the file paths and symlink info in the "blobs" dict
            '''
            for entry in iter(tree):
                if entry.oid not in self.repo:
                    # Entry is a submodule, skip it
                    continue
                obj = self.repo[entry.oid]
                if isinstance(obj, pygit2.Blob):
                    repo_path = salt.utils.path.join(
                        prefix, entry.name, use_posixpath=True)
                    blobs.setdefault('files', []).append(repo_path)
                    if stat.S_ISLNK(tree[entry.name].filemode):
                        link_tgt = self.repo[tree[entry.name].oid].data
                        blobs.setdefault('symlinks', {})[repo_path] = link_tgt
                elif isinstance(obj, pygit2.Tree):
                    _traverse(
                        obj, blobs, salt.utils.path.join(
                            prefix, entry.name, use_posixpath=True)
                    )

        files = set()
        symlinks = {}
        tree = self.get_tree(tgt_env)
        if not tree:
            # Not found, return empty objects
            return files, symlinks
        if self.root(tgt_env):
            try:
                # This might need to be changed to account for a root that
                # spans more than one directory
                oid = tree[self.root(tgt_env)].oid
                tree = self.repo[oid]
            except KeyError:
                return files, symlinks
            if not isinstance(tree, pygit2.Tree):
                return files, symlinks
            relpath = lambda path: os.path.relpath(path, self.root(tgt_env))
        else:
            relpath = lambda path: path
        blobs = {}
        if tree:
            _traverse(tree, blobs, self.root(tgt_env))
        add_mountpoint = lambda path: salt.utils.path.join(
            self.mountpoint(tgt_env), path, use_posixpath=True)
        for repo_path in blobs.get('files', []):
            files.add(add_mountpoint(relpath(repo_path)))
        for repo_path, link_tgt in six.iteritems(blobs.get('symlinks', {})):
            symlinks[add_mountpoint(relpath(repo_path))] = link_tgt
        return files, symlinks
528062
def ordered_dirs(self):
        
        return [item[0] for item in sorted(
            self.byte_contents.items(), key=lambda entry: entry[1].st_ino)]
1070209
def list_storages(self):
        '''
        '''
        # Filter out any storages used by xbmcswift2 so caller doesn't corrupt
        # them.
        return [name for name in os.listdir(self.storage_path)
                if not name.startswith('.')]
684174
def _GetDataStreams(self):
    
    if self._data_streams is None:
      self._data_streams = []
      if self._fsntfs_file_entry.has_default_data_stream():
        data_stream = NTFSDataStream(None)
        self._data_streams.append(data_stream)

      for fsntfs_data_stream in self._fsntfs_file_entry.alternate_data_streams:
        data_stream = NTFSDataStream(fsntfs_data_stream)
        self._data_streams.append(data_stream)

    return self._data_streams
7480
def filelist(jottapath, JFS):
    """"""
    log.debug("filelist %r", jottapath)
    try:
        jf = JFS.getObject(jottapath)
    except JFSNotFoundError:
        return set() # folder does not exist, so pretend it is an empty folder
    if not isinstance(jf, JFSFolder):
        return False
    return set([f.name for f in jf.files() if not f.is_deleted()])
216369
def get_file_list(self):
        
        if os.path.isdir(self.root_path):
            return [os.path.join(self.root_path, f) for f in os.listdir(self.root_path)
                    if os.path.isfile(os.path.join(self.root_path, f))]
        else:
            return [self.root_path]
475320
def _getOpenChoices(self):
        
        tsk = self._taskParsObj.getName()
        taskFiles = set()
        dirsSoFar = [] # this helps speed this up (skip unneeded globs)

        # last dir
        aDir = os.path.dirname(self._taskParsObj.filename)
        if len(aDir) < 1: aDir = os.curdir
        dirsSoFar.append(aDir)
        taskFiles.update(cfgpars.getCfgFilesInDirForTask(aDir, tsk))

        # current dir
        aDir = os.getcwd()
        if aDir not in dirsSoFar:
            dirsSoFar.append(aDir)
            taskFiles.update(cfgpars.getCfgFilesInDirForTask(aDir, tsk))

        # task's python pkg dir (if tsk == python pkg name)
        try:
            x, pkgf = cfgpars.findCfgFileForPkg(tsk, '.cfg', taskName=tsk,
                              pkgObj=self._taskParsObj.getAssocPkg())
            taskFiles.update( (pkgf,) )
        except cfgpars.NoCfgFileError:
            pass # no big deal - maybe there is no python package

        # user's own resourceDir
        aDir = self._rcDir
        if aDir not in dirsSoFar:
            dirsSoFar.append(aDir)
            taskFiles.update(cfgpars.getCfgFilesInDirForTask(aDir, tsk))

        # extra loc - see if they used the app's env. var
        aDir = dirsSoFar[0] # flag to skip this if no env var found
        envVarName = APP_NAME.upper()+'_CFG'
        if envVarName in os.environ: aDir = os.environ[envVarName]
        if aDir not in dirsSoFar:
            dirsSoFar.append(aDir)
            taskFiles.update(cfgpars.getCfgFilesInDirForTask(aDir, tsk))

        # At the very end, add an option which we will later interpret to mean
        # to open the file dialog.
        taskFiles = list(taskFiles) # so as to keep next item at end of seq
        taskFiles.sort()
        taskFiles.append("Other ...")

        return taskFiles
419108
def list(self, path=None, with_metadata=False, include_partitions=False):
        ''''''
        from os import walk
        import json

        l = {}

        if not path:
            start_path = self.cache_dir
        else:
            start_path = os.path.join(self.cache_dir, path)

        for root, dirs, files in os.walk(start_path):

            root = root.replace(self.cache_dir, '', 1).strip('/')

            if root.startswith('meta') or root.startswith('_'):
                continue

            if not include_partitions and root.count('/') > 0:
                continue  # partition files

            for f in files:
                rel_path = os.path.join(root, f)
                d = self.metadata(rel_path) if with_metadata else {}

                if d and 'identity' in d:
                    d['identity'] = json.loads(d['identity'])

                d['caches'] = [self.repo_id]

                l[rel_path] = d

        if self.upstream:
            for k, v in self.upstream.list(path, with_metadata, include_partitions).items():
                upstreams = (l[k]['caches'] if k in l else []) + \
                    v.get('caches', self.upstream.repo_id)

                l[k] = v
                l[k]['caches'] = upstreams

        return l
32835
def list(self):
        
        backups = []
        for d in glob(join(self.backup_directory, '*')):
            backups.append(WorkspaceBackup.from_path(d))
        backups.sort(key=lambda b: b.lastmod, reverse=True)
        return backups
284003
def _file_list(self, folder):
        ''''''
        rtn = []
        walk = self._walk_report(folder)
        for key,val in walk.items():
            for v in val:
                x=os.path.join(key,v)
                rtn.append(x)

        self.file_count = len(rtn)  #a count of the files we'll have in the final cleaned sosreport, for reporting
        return rtn
694079
def list(self):
        
        before, after = self.filename_template.split('%s', 1)
        filename_re = re.compile(r'%s(.{5,})%s$' % (re.escape(before),
                                                    re.escape(after)))
        result = []
        for filename in os.listdir(self.path):
            #: this is a session that is still being saved.
            if filename.endswith(_fs_transaction_suffix):
                continue
            match = filename_re.match(filename)
            if match is not None:
                result.append(match.group(1))
        return result
907658
def OSLibraries(self):
        
        if self.vc_ver <= 10.0:
            arch_subdir = self.pi.target_dir(hidex86=True, x64=True)
            return [os.path.join(self.si.WindowsSdkDir, 'Lib%s' % arch_subdir)]

        else:
            arch_subdir = self.pi.target_dir(x64=True)
            lib = os.path.join(self.si.WindowsSdkDir, 'lib')
            libver = self._sdk_subdir
            return [os.path.join(lib, '%sum%s' % (libver , arch_subdir))]
122729
def get_file_systems(self):
        
        result = {}
        if os.access('/proc/mounts', os.R_OK):
            file = open('/proc/mounts')
            for line in file:
                try:
                    mount = line.split()
                    device = mount[0]
                    mount_point = mount[1]
                    fs_type = mount[2]
                except (IndexError, ValueError):
                    continue

                # Skip the filesystem if it is not in the list of valid
                # filesystems
                if fs_type not in self.filesystems:
                    self.log.debug("Ignoring %s since it is of type %s " +
                                   " which is not in the list of filesystems.",
                                   mount_point, fs_type)
                    continue

                # Process the filters
                if self.exclude_reg.search(mount_point):
                    self.log.debug("Ignoring %s since it is in the " +
                                   "exclude_filter list.", mount_point)
                    continue

                if ((('/' in device or device == 'tmpfs') and
                     mount_point.startswith('/'))):
                    try:
                        stat = os.stat(mount_point)
                    except OSError:
                        self.log.debug("Path %s is not mounted - skipping.",
                                       mount_point)
                        continue

                    if stat.st_dev in result:
                        continue

                    result[stat.st_dev] = {
                        'device': os.path.realpath(device),
                        'mount_point': mount_point,
                        'fs_type': fs_type
                    }

            file.close()

        else:
            if not psutil:
                self.log.error('Unable to import psutil')
                return None

            partitions = psutil.disk_partitions(False)
            for partition in partitions:
                result[len(result)] = {
                    'device': os.path.realpath(partition.device),
                    'mount_point': partition.mountpoint,
                    'fs_type': partition.fstype
                }
            pass

        return result
181050
def files(self):
        """"""
        if self._files is None:
            fifo = SeriesFolder._search_files(self.path)
            self._files = [ff[0] for ff in fifo]
            self._formats = [ff[1] for ff in fifo]
        return self._files
118885
def listing(self):
        ""
        return ['.'.join([f,ext]) if ext else f for (f,ext) in self._files.keys()]