Return the package config or context and normalize some of the 
        values
438454
def _default_ctx(self):
        
        if not self.in_app_directory:
            print("Warning: {} does not exist. Using the default.".format(
                self.package))
            ctx = {}

        else:
            with open(self.package) as f:
                ctx = dict(yaml.load(f, Loader=yaml.RoundTripLoader))

        if self.in_app_directory:
            # Update the env for each platform
            excluded = list(ctx.get('excluded', []))

            for env in [ctx['ios'], ctx['android']]:
                if 'python_build_dir' not in env:
                    env['python_build_dir'] = expanduser(abspath('build/python'))
                if 'conda_prefix' not in env:
                    env['conda_prefix'] = os.environ.get(
                        'CONDA_PREFIX', expanduser(abspath('venv')))

                # Join the shared and local exclusions
                env['excluded'] = list(env.get('excluded', [])) + excluded

        return ctx
1342304
def get_config_from_package(package):
    
    package_x = package.split('.')
    package_conf = {}
    package_conf['class'] = package_x[-1]
    package_conf['module'] = '.'.join(package_x[:-1][:])
    return package_conf
172470
def _configuration(self, *args, **kwargs):
        '''
        
        '''

        data = dict()
        self.db.open()
        for pkg in self.db.get(Package):
            configs = list()
            for pkg_cfg in self.db.get(PackageCfgFile, eq={'pkgid': pkg.id}):
                configs.append(pkg_cfg.path)
            data[pkg.name] = configs

        if not data:
            raise InspectorQueryException("No inspected configuration yet available.")

        return data
535118
def get_configs(__pkg: str, __name: str = 'config') -> List[str]:
    
    dirs = [user_config(__pkg), ]
    dirs.extend(path.expanduser(path.sep.join([d, __pkg]))
                for d in getenv('XDG_CONFIG_DIRS', '/etc/xdg').split(':'))
    configs = []
    for dname in reversed(dirs):
        test_path = path.join(dname, __name)
        if path.exists(test_path):
            configs.append(test_path)
    return configs
788968
def get_config():
        
        db_type = os.environ['DB_TYPE']
        db_host = os.environ['DB_HOST']
        db_user = os.environ['DB_USER']
        db_database = os.environ['DB_NAME']
        db_password = os.environ['DB_PASSWORD']
        db_prefix = os.environ['DB_PREFIX']

        check = Migration.check_packages(db_type)

        return check, {
            db_type: {
                'driver': db_type.strip(),
                'host': db_host.strip(),
                'database': db_database.strip(),
                'user': db_user.strip(),
                'password': db_password.strip(),
                'prefix': db_prefix.strip()
            }
        }
1322390
def norm_package_version(version):
    """"""
    if version:
        version = ','.join(v.strip() for v in version.split(',')).strip()

        if version.startswith('(') and version.endswith(')'):
            version = version[1:-1]

        version = ''.join(v for v in version if v.strip())
    else:
        version = ''

    return version
801393
def get_configure(self,
                      repo=None,
                      name=None,
                      groups=None,
                      main_cfg=False):
        
        constraints = locals()
        del constraints['main_cfg']
        status = (True, None)
        template_dict = {}
        return_str = ''
        if main_cfg:
            vent_cfg = Template(self.vent_config)
            for section in vent_cfg.sections()[1]:
                template_dict[section] = {}
                for vals in vent_cfg.section(section)[1]:
                    template_dict[section][vals[0]] = vals[1]
        else:
            # all possible vent.template options stored in plugin_manifest
            options = ['info', 'service', 'settings', 'docker', 'gpu']
            tools = Template(System().manifest).constrain_opts(
                constraints, options)[0]
            if tools:
                # should only be one tool
                tool = list(tools.keys())[0]
                # load all vent.template options into dict
                for section in tools[tool]:
                    template_dict[section] = json.loads(tools[tool][section])
            else:
                status = (False, "Couldn't get vent.template information")
        if status[0]:
            # display all those options as they would in the file
            for section in template_dict:
                return_str += '[' + section + ']\n'
                # ensure instances shows up in configuration
                for option in template_dict[section]:
                    if option.startswith('#'):
                        return_str += option + '\n'
                    else:
                        return_str += option + ' = '
                        return_str += template_dict[section][option] + '\n'
                return_str += '\n'
            # only one newline at end of file
            status = (True, return_str[:-1])
        return status
194383
function config_resolve({context}) {
    return () => {
        let config_part = {
            /*
            resolveLoader: {modules: [
             // __dirname+'/',
                pathModule.join(__dirname, "../node_modules"),
            ]},
            */
            context,
        };
        const extra_paths = (process.env['NODE_PATH']||'').split(':').filter(Boolean);
        if( extra_paths.length > 0 ) {
            config_part = {
                ...config_part,
                resolve: {modules: [
                    "node_modules",
                    ...extra_paths,
                ]},
            };
        }
        return config_part;
    };
}
93722
function normalize_package_src() {
    const PKG_DIR = path.join(__dirname, '..', config.dir.pkg);
    glob.sync('**/?(*.js|*.css)', {
        cwd: PKG_DIR,
        nodir: true,
        ignore: [
            config.dir.external + '/**/*',
            config.dir.res + '/**/*',
            config.dir.template + '/**/*',
        ],
    }).forEach((file) => {
        console.log('  normalize... ' + file);
        const ext = path.extname(file);
        const basename = path.basename(file, ext);
        const srcPath = path.join(PKG_DIR, file);

        let src = fs.readFileSync(srcPath).toString().replace(/^\ufeff/gm, '');
        if (!/^\/\**!+/.test(src)) {
            // set banner
            const node = srcmap.getNodeFromCode(src);
            node.prepend(banner(ext, basename) + '\n');
            src = srcmap.getCodeFromNode(node);
        }
        src = normalize_src(src, {
            srcmapRename: (srcPath) => {
                const regex_src = new RegExp('^' + config.dir.src + '\\/');
                return srcPath
                    .replace(`webpack://${LIBRARY}/`, `webpack:///`)
                    .replace('webpack:///' + config.dir.src + '/', SOURCE_MAP_NAMESPACE)
                    .replace('webpack:/webpack', 'webpack:///webpack')
                    .replace('webpack:/external', 'webpack:///external/')
                    .replace('webpack:///~', 'webpack:///node_modules')
                    .replace(/\.\.\//g, '')
                    .replace(regex_src, SOURCE_MAP_NAMESPACE + config.dir.src + '/')
                    .replace(/platforms\/\w+\//, SOURCE_MAP_NAMESPACE + config.dir.src + '/')
                ;
            },
            multiline: 'css' === ext.toLowerCase(),
        });
        fs.writeFileSync(srcPath, src);
    });
}
289150
function(context, childPkg){
		var curAddress = childPkg.origFileUrl;
		var parentAddress = utils.path.parentNodeModuleAddress(childPkg.origFileUrl);
		while(parentAddress) {
			var packageAddress = parentAddress+"/"+childPkg.name+"/package.json";
			var parentPkg =	context.paths[packageAddress];
			if(parentPkg && SemVer.valid(parentPkg.version)) {
				if(SemVer.satisfies(parentPkg.version, childPkg.version)) {
					return parentPkg.fileUrl;
				} else {
					return curAddress;
				}
			}
			parentAddress = utils.path.parentNodeModuleAddress(packageAddress);
			curAddress = packageAddress;
		}
		return curAddress;
	}
429756
def avail_approaches(pkg):
    '''
    '''
    methods = [modname for importer, modname, ispkg in
               pkgutil.walk_packages(path=pkg.__path__)
               if modname not in
               ['common_args', 'directions', 'sobol_sequence']]
    return methods
940589
def ExtractConfig(self):
    """"""
    logging.info("Extracting config file from .pkg.")
    pkg_path = os.environ.get("PACKAGE_PATH", None)
    if pkg_path is None:
      logging.error("Could not locate package, giving up.")
      return

    zf = zipfile.ZipFile(pkg_path, mode="r")
    fd = zf.open("config.yaml")
    install_dir = os.path.dirname(config.CONFIG.parser.filename)

    # We write this config to disk so that Intialize can find the build.yaml
    # referenced inside the config as a relative path. This config isn't used
    # after install time.
    installer_config = os.path.join(install_dir, "installer_config.yaml")
    with open(installer_config, "wb") as f:
      f.write(fd.read())

    packaged_config = config.CONFIG.MakeNewConfig()
    packaged_config.Initialize(
        filename=installer_config, parser=config_lib.YamlParser)

    new_config = config.CONFIG.MakeNewConfig()
    new_config.SetWriteBack(config.CONFIG["Config.writeback"])

    for info in config.CONFIG.type_infos:
      try:
        new_value = packaged_config.GetRaw(info.name, None)
      except type_info.TypeValueError:
        continue

      try:
        old_value = config.CONFIG.GetRaw(info.name, None)

        if not new_value or new_value == old_value:
          continue
      except type_info.TypeValueError:
        pass

      new_config.SetRaw(info.name, new_value)

    new_config.Write()
    logging.info("Config file extracted successfully.")

    logging.info("Extracting additional files.")

    for zinfo in zf.filelist:
      basename = os.path.basename(zinfo.filename)
      if basename != "config.yaml":
        with open(os.path.join(install_dir, basename), "wb") as f:
          f.write(zf.open(zinfo.filename).read())
320510
def normalize_variables(cls, variables):
        
        # if the version is False, empty string, etc, throw it out
        if variables.get('version', True) in ('', False, '_NO_VERSION', None):
            del variables['version']
        return super(PackageResource, cls).normalize_variables(variables)
248668
def parse_config(file_name='/usr/local/etc/pkg.conf'):
    '''
    
    '''
    ret = {}
    if not os.path.isfile(file_name):
        return 'Unable to find {0} on file system'.format(file_name)

    with salt.utils.files.fopen(file_name) as ifile:
        for line in ifile:
            line = salt.utils.stringutils.to_unicode(line)
            if line.startswith('#') or line.startswith('\n'):
                pass
            else:
                key, value = line.split('\t')
                ret[key] = value
    ret['config_file'] = file_name
    return ret
1115015
def get_config():
    """"""
    # these strings are filled in when 'setup.py versioneer' creates
    # _version.py
    cfg = VersioneerConfig()
    cfg.VCS = "git"
    cfg.style = "pep440-post"
    cfg.tag_prefix = ""
    cfg.parentdir_prefix = "None"
    cfg.versionfile_source = "canmatrix/_version.py"
    cfg.verbose = False
    return cfg
231392
function parseConfig (configpath) {
  if (program.input) {
    configpath = {
      input: program.input,
      output: program.output || '.'
    };
  }

  return configpath;
}
285735
def _repack_pkgs(pkgs, normalize=True):
    '''
    
    '''
    if normalize and 'pkg.normalize_name' in __salt__:
        _normalize_name = __salt__['pkg.normalize_name']
    else:
        _normalize_name = lambda pkgname: pkgname
    return dict(
        [
            (_normalize_name(six.text_type(x)), six.text_type(y) if y is not None else y)
            for x, y in six.iteritems(salt.utils.data.repack_dictlist(pkgs))
        ]
    )