List files for an installed package
550662
def list_files(package, conn=None):
    '''
    
    '''
    close = False
    if conn is None:
        close = True
        conn = init()

    data = conn.execute('SELECT package FROM packages WHERE package=?', (package, ))
    if not data.fetchone():
        if close:
            conn.close()
        return None

    ret = []
    data = conn.execute('SELECT path, sum FROM files WHERE package=?', (package, ))
    for file_ in data.fetchall():
        ret.append(file_)
    if close:
        conn.close()

    return ret
991207
def pkg_list(self):
        
        options = [
            "-l",
            "--list"
        ]
        flag = ["--index", "--installed", "--name"]
        name = INDEX = installed = False
        for arg in self.args[2:]:
            if flag[0] == arg:
                INDEX = True
            if flag[1] in arg:
                installed = True
            if flag[2] == arg:
                name = True
            if arg not in flag:
                usage("")
                raise SystemExit()
        if (len(self.args) > 1 and len(self.args) <= 5 and
                self.args[0] in options):
            if self.args[1] in self.meta.repositories:
                PackageManager(binary=None).package_list(self.args[1],
                                                         name,
                                                         INDEX,
                                                         installed)
            else:
                usage(self.args[1])
        else:
            usage("")
342988
function listInstalledVer(name, dir) {
        var _child$spawnSync3 = _child_process2['default'].spawnSync(npmCommand, ['list', name, '--depth', '0', '--json'], { cwd: dir });

        var stdout = _child$spawnSync3.stdout;
        var error = _child$spawnSync3.error;
        var status = _child$spawnSync3.status;

        // the package is invalid or uninstalled
        if (error || 0 !== status) {
            return '';
        }

        return JSON.parse(stdout)['version'];
    }
1255233
async def packages(
            self, package_state: Union[int, str] = '',
            show_archived: bool = False) -> list:
        """"""
        packages_resp = await self._request(
            'post',
            API_URL_BUYER,
            json={
                'version': '1.0',
                'method': 'GetTrackInfoList',
                'param': {
                    'IsArchived': show_archived,
                    'Item': '',
                    'Page': 1,
                    'PerPage': 40,
                    'PackageState': package_state,
                    'Sequence': '0'
                },
                'sourcetype': 0
            })

        _LOGGER.debug('Packages response: %s', packages_resp)

        packages = []
        for package in packages_resp.get('Json', []):
            last_event = package.get('FLastEvent')
            if last_event:
                event = json.loads(last_event)
            else:
                event = {}

            kwargs = {
                'destination_country': package.get('FSecondCountry', 0),
                'friendly_name': package.get('FRemark'),
                'info_text': event.get('z'),
                'location': event.get('c'),
                'origin_country': package.get('FFirstCountry', 0),
                'package_type': package.get('FTrackStateType', 0),
                'status': package.get('FPackageState', 0)
            }
            packages.append(Package(package['FTrackNo'], **kwargs))
        return packages
115210
def list_installed():
    '''
    
    '''
    result = __salt__['pkg.version'](_package_name(), versions_as_list=True)
    if result is None:
        return []

    if six.PY2:
        return sorted(result, cmp=_cmp_version)
    else:
        return sorted(result, key=functools.cmp_to_key(_cmp_version))
81940
def list_files(path):
    """"""
    files = []
    if os.path.isdir(path):
        for stats in os.walk(path):
            for f in stats[2]:
                files.append(os.path.join(stats[0], f))
    elif os.path.isfile(path):
        files = [path]
    return files
900109
def _get_paths(self):
        """"""
        ret = []
        ret += ['%s/library/' % os.path.dirname(os.path.dirname(__file__))]        
        
        ret += self._extra_dirs
        for basedir in _basedirs:
            fullpath = os.path.join(basedir, self.subdir)
            if fullpath not in ret:
                ret.append(fullpath)
        ret += self.config.split(os.pathsep)
        ret += self._get_package_path()
        return ret
422571
def _list_dir(self):
        
        return [os.path.join(self._path, fn) for fn in os.listdir(self._path)
                if not fn.endswith(self._fs_transaction_suffix)]
228637
def find_package_data():
    

    l = list()
    for start in ('ambry/support', 'ambry/bundle/default_files'):
        for root, dirs, files in os.walk(start):

            for f in files:

                if f.endswith('.pyc'):
                    continue

                path = os.path.join(root, f).replace('ambry/', '')

                l.append(path)

    return {'ambry': l}
1194294
def file_list(load):
    '''
    
    '''
    if 'env' in load:
        # "env" is not supported; Use "saltenv".
        load.pop('env')

    ret = []

    if 'saltenv' not in load:
        return ret

    saltenv = load['saltenv']
    metadata = _init()

    if not metadata or saltenv not in metadata:
        return ret
    for bucket in _find_files(metadata[saltenv]):
        for buckets in six.itervalues(bucket):
            files = [f for f in buckets if not fs.is_file_ignored(__opts__, f)]
            ret += _trim_env_off_path(files, saltenv)

    return ret
1215033
def list_():
    '''
    
    '''
    cmd = 'pkgutil --pkgs'
    ret = salt.utils.mac_utils.execute_return_result(cmd)
    return ret.splitlines()
308693
def data(self):
        
        for pkg in self.installed:
            if os.path.isfile(self.meta.pkg_path + pkg):
                name = split_package(pkg)[0]
                for log in self.logs:
                    deps = Utils().read_file(self.dep_path + log)
                    for dep in deps.splitlines():
                        if name == dep:
                            if name not in self.dmap.keys():
                                self.dmap[name] = [log]
                                if not self.count_pkg:
                                    self.count_pkg = 1
                            else:
                                self.dmap[name] += [log]
        self.count_packages()
429356
def get_subpackages(name):
    """"""
    splist = []
    for dirpath, _dirnames, _filenames in os.walk(name):
        if osp.isfile(osp.join(dirpath, '__init__.py')):
            splist.append(".".join(dirpath.split(os.sep)))
    return splist
485634
def list_exes(self):
        """"""
        return [path.join(self.env_bin, f)
                for f
                in os.listdir(self.env_bin)]
966221
def view(self):
        
        print("")   # new line at start
        description, count = "", 0
        if self.repo == "sbo":
            description = SBoGrep(self.name).description()
        else:
            PACKAGES_TXT = Utils().read_file(self.lib)
            for line in PACKAGES_TXT.splitlines():
                if line.startswith(self.name + ":"):
                    description += line[len(self.name) + 2:] + "\n"
                    count += 1
                    if count == 11:
                        break
        if description:
            print("{0}{1}{2}".format(self.COLOR, description,
                                     self.meta.color["ENDC"]))
        else:
            self.msg.pkg_not_found("", self.name, "No matching", "\n")
            raise SystemExit(1)
        if description and self.repo == "sbo":
            print("")
557745
def get_installed_targets():
        """"""
        try:
            cache = cmsis_pack_manager.Cache(True, True)
            results = []
            for pack in ManagedPacks.get_installed_packs(cache=cache):
                pack_path = os.path.join(cache.data_path, pack.get_pack_name())
                pack = CmsisPack(pack_path)
                results += list(pack.devices)
            return sorted(results, key=lambda dev:dev.part_number)
        except FileNotFoundError:
            # cmsis-pack-manager can raise this exception if the cache is empty.
            pass
925650
def filter_installed_packages(packages):
    """"""
    yb = yum.YumBase()
    package_list = yb.doPackageLists()
    temp_cache = {p.base_package_name: 1 for p in package_list['installed']}

    _pkgs = [p for p in packages if not temp_cache.get(p, False)]
    return _pkgs