Return package refs for given components
173391
def get_packages(self, component=None, components=[], packages=None):
        
        if component:
            components = [component]

        package_refs = []
        for snapshot in self.publish_snapshots:
            if component and snapshot['Component'] not in components:
                # We don't want packages for this component
                continue

            component_refs = self._get_packages(self.client, "snapshots", snapshot['Name'])
            if packages:
                # Filter package names
                for ref in component_refs:
                    if self.parse_package_ref(ref)[1] in packages:
                        package_refs.append(ref)
            else:
                package_refs.extend(component_refs)

        return package_refs
1053957
function getPackageDefinition(packageName) {
  var def = PACKAGE_DEFINITIONS[packageName];
  if (!def) {
    warn('Cannot find package ' + packageName + '!');
    warn('Exiting...');
    process.exit();
  }
  return def;
}
1076860
def _build_package_finder(self, options, index_urls, session):
        
        return PackageFinder(
            find_links=options.find_links,
            index_urls=index_urls,
            allow_all_prereleases=options.pre,
            trusted_hosts=options.trusted_hosts,
            session=session,
        )
298800
function findPackage(name, component) {
			var packages = expandForAll(component, joinPathWith(null, 'packages/*'));

			if (packages.length === 0) {
				// No packages found
				return null;
			}
			else if (packages.length === 1) {
				// Only one package: return it
				return packages[0];
			}
			else {
				// More than one package: try to guess
				return guessBestFile(name, packages);
			}
		}
585999
def find_related_modules(package, related_name_re='.+',
                         ignore_exceptions=False):
    """"""
    warnings.warn('find_related_modules has been deprecated.',
                  DeprecationWarning)
    package_elements = package.rsplit(".", 1)
    try:
        if len(package_elements) == 2:
            pkg = __import__(package_elements[0], globals(), locals(), [
                             package_elements[1]])
            pkg = getattr(pkg, package_elements[1])
        else:
            pkg = __import__(package_elements[0], globals(), locals(), [])
        pkg_path = pkg.__path__
    except AttributeError:
        return []

    # Find all modules named according to related_name
    p = re.compile(related_name_re)
    modules = []

    for name in find_modules(package, include_packages=True):
        if p.match(name.split('.')[-1]):
            try:
                modules.append(import_string(name, silent=ignore_exceptions))
            except Exception as e:
                if not ignore_exceptions:
                    raise e

    return modules
765086
function analyzeDependencies(component) {
  const checkList = ['base'];

  search(
    dependencyTree({
      directory: dir,
      filename: path.join(dir, component, 'index.js'),
      filter: path => !~path.indexOf('node_modules')
    }),
    component,
    checkList
  );

  if (!whiteList.includes(component)) {
    checkList.push(component);
  }

  return checkList.filter(item => checkComponentHasStyle(item));
}
770875
def refactor_module_to_package(self):
        """"""
        refactor = ModuleToPackage(self.project, self.resource)
        return self._get_changes(refactor)
70246
def _get_available_versions(self):
        '''
        
        '''
        solvables = self.zypper.nolock.xml.call('se', '-xv', self.name).getElementsByTagName('solvable')
        if not solvables:
            raise CommandExecutionError('No packages found matching \'{0}\''.format(self.name))

        return sorted(set([slv.getAttribute(self._attr_solvable_version)
                           for slv in solvables if slv.getAttribute(self._attr_solvable_version)]))
680565
function getPackageConfigMatch(loader, normalized) {
    var pkgName, exactMatch = false, configPath;
    for (var i = 0; i < loader.packageConfigPaths.length; i++) {
      var packageConfigPath = loader.packageConfigPaths[i];
      var p = packageConfigPaths[packageConfigPath] || (packageConfigPaths[packageConfigPath] = createPkgConfigPathObj(packageConfigPath));
      if (normalized.length < p.length)
        continue;
      var match = normalized.match(p.regEx);
      if (match && (!pkgName || (!(exactMatch && p.wildcard) && pkgName.length < match[1].length))) {
        pkgName = match[1];
        exactMatch = !p.wildcard;
        configPath = pkgName + packageConfigPath.substr(p.length);
      }
    }

    if (!pkgName)
      return;

    return {
      packageName: pkgName,
      configPath: configPath
    };
  }
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
218445
def filter_installed_packages(packages):
    """"""
    cache = apt_cache()
    _pkgs = []
    for package in packages:
        try:
            p = cache[package]
            p.current_ver or _pkgs.append(package)
        except KeyError:
            log('Package {} has no installation candidate.'.format(package),
                level='WARNING')
            _pkgs.append(package)
    return _pkgs
318169
def getAvailableClassesInPackage(package):
    
    l = list(x[1] for x in inspect.getmembers(package, inspect.isclass))

    modules = list(x[1] for x in inspect.getmembers(package, inspect.ismodule))
    for m in modules:
        l.extend(list(x[1] for x in inspect.getmembers(m, inspect.isclass)))
    l = [x for x in l if x.__name__[0] != "_"]
    n = 0
    while n < len(l):
        cls = l[n]
        if not cls.__module__.startswith(package.__name__):
            l.pop(n)
            n -= 1
        n += 1
    return l
230098
def get_arsc_info(arscobj):
    
    buff = ""
    for package in arscobj.get_packages_names():
        buff += package + ":\n"
        for locale in arscobj.get_locales(package):
            buff += "\t" + repr(locale) + ":\n"
            for ttype in arscobj.get_types(package, locale):
                buff += "\t\t" + ttype + ":\n"
                try:
                    tmp_buff = getattr(arscobj, "get_" + ttype + "_resources")(
                        package, locale).decode("utf-8", 'replace').split("\n")
                    for i in tmp_buff:
                        buff += "\t\t\t" + i + "\n"
                except AttributeError:
                    pass
    return buff
213404
def get_package_format_names(predicate=None):
    """"""
    return [
        k
        for k, v in six.iteritems(get_package_formats())
        if not predicate or predicate(k, v)
    ]
713269
function getExternals(packageInfo) {
  let externals = {
    // Hard coded externals
    'h3-js': 'h3',
    's2-geometry': 'S2'
  };
  const {peerDependencies = {}} = packageInfo;

  for (const depName in peerDependencies) {
    if (depName.startsWith('@deck.gl')) {
      // Instead of bundling the dependency, import from the global `deck` object
      externals[depName] = 'deck';
    }
  }

  if (externals['@deck.gl/core']) {
    // Do not bundle luma.gl if `core` is peer dependency
    externals = [
      externals,
      (context, request, callback) => {
        if (/^@?luma\.gl/.test(request)) {
          return callback(null, 'luma');
        }
        return callback();
      }
    ];
  }

  return externals;
}
676820
def _get_changed_cfg_pkgs(self, data):
        '''
        
        '''
        f_data = dict()
        for pkg_name, pkg_files in data.items():
            cfgs = list()
            cfg_data = list()
            if self.grains_core.os_data().get('os_family') == 'Debian':
                cfg_data = salt.utils.stringutils.to_str(self._syscall("dpkg", None, None, '--verify',
                                                           pkg_name)[0]).split(os.linesep)
            elif self.grains_core.os_data().get('os_family') in ['Suse', 'redhat']:
                cfg_data = salt.utils.stringutils.to_str(self._syscall("rpm", None, None, '-V', '--nodeps', '--nodigest',
                                                           '--nosignature', '--nomtime', '--nolinkto',
                                                           pkg_name)[0]).split(os.linesep)
            for line in cfg_data:
                line = line.strip()
                if not line or line.find(" c ") < 0 or line.split(" ")[0].find("5") < 0:
                    continue
                cfg_file = line.split(" ")[-1]
                if cfg_file in pkg_files:
                    cfgs.append(cfg_file)
            if cfgs:
                f_data[pkg_name] = cfgs

        return f_data
725303
def from_tuple(cls, components: tuple) -> 'ComponentRef':
        

        component_ref = ComponentRef(name=components[0], child=[])
        c = component_ref
        for component in components[1:]:
            c.child.append(ComponentRef(name=component, child=[]))
            c = c.child[0]
        return component_ref