Build the conf of the g5k provider from the vmong5k conf.
197841
def _build_g5k_conf(vmong5k_conf):
    """"""
    clusters = [m.cluster for m in vmong5k_conf.machines]
    sites = g5k_api_utils.get_clusters_sites(clusters)
    site_names = set(sites.values())
    if len(site_names) > 1:
        raise Exception("Multisite deployment not supported yet")
    site = site_names.pop()
    return _do_build_g5k_conf(vmong5k_conf, site)
865865
def _get_gatk_opts(config, names, tmp_dir=None, memscale=None, include_gatk=True, parallel_gc=False):
    
    if include_gatk and "gatk4" in dd.get_tools_off({"config": config}):
        opts = ["-U", "LENIENT_VCF_PROCESSING", "--read_filter",
                "BadCigar", "--read_filter", "NotPrimaryAlignment"]
    else:
        opts = []
    jvm_opts = ["-Xms750m", "-Xmx2g"]
    for n in names:
        resources = config_utils.get_resources(n, config)
        if resources and resources.get("jvm_opts"):
            jvm_opts = resources.get("jvm_opts")
            break
    if memscale:
        jvm_opts = config_utils.adjust_opts(jvm_opts, {"algorithm": {"memory_adjust": memscale}})
    jvm_opts += get_default_jvm_opts(tmp_dir, parallel_gc=parallel_gc)
    return jvm_opts + opts
971649
def _apply_cpu_config(config_spec, cpu_props):
    '''
    
    '''
    log.trace('Configuring virtual machine CPU '
              'settings cpu_props=%s', cpu_props)
    if 'count' in cpu_props:
        config_spec.numCPUs = int(cpu_props['count'])
    if 'cores_per_socket' in cpu_props:
        config_spec.numCoresPerSocket = int(cpu_props['cores_per_socket'])
    if 'nested' in cpu_props and cpu_props['nested']:
        config_spec.nestedHVEnabled = cpu_props['nested']  # True
    if 'hotadd' in cpu_props and cpu_props['hotadd']:
        config_spec.cpuHotAddEnabled = cpu_props['hotadd']  # True
    if 'hotremove' in cpu_props and cpu_props['hotremove']:
        config_spec.cpuHotRemoveEnabled = cpu_props['hotremove']
101591
def build_provider(self, stack):
        """"""
        return self.provider_builder.build(region=stack.region,
                                           profile=stack.profile)
1121032
def build_mmd(target_folder=DEFAULT_LIBRARY_DIR):
    """"""
    mmd_dir = tempfile.mkdtemp()
    mmd_repo = pygit2.clone_repository('https://github.com/jasedit/MultiMarkdown-5', mmd_dir,
                                       checkout_branch='fix_windows')
    mmd_repo.init_submodules()
    mmd_repo.update_submodules()
    build_dir = os.path.join(mmd_dir, 'build')
    old_pwd = os.getcwd()
    os.chdir(build_dir)

    cmake_cmd = ['cmake', '-DCMAKE_BUILD_TYPE=Release', '-DSHAREDBUILD=1', '..']
    if platform.system() == 'Windows':
        is_64bit = platform.architecture()[0] == '64bit'
        generator = 'Visual Studio 14 2015{0}'.format(' Win64' if is_64bit else '')
        cmake_cmd.insert(-1, '-G')
        cmake_cmd.insert(-1, '{0}'.format(generator))
    subprocess.call(cmake_cmd)
    PLATFORM_BUILDS[platform.system()]()

    lib_file = 'libMultiMarkdown' + SHLIB_EXT[platform.system()]
    if not os.path.exists(target_folder):
        os.mkdir(target_folder)
    src = os.path.join(build_dir, SHLIB_PREFIX[platform.system()], lib_file)
    dest = os.path.join(target_folder, lib_file)
    shutil.copyfile(src, dest)
    os.chdir(old_pwd)
    shutil.rmtree(mmd_dir, ignore_errors=True)
1211109
def allocate(self):
        """"""
        disk_path = self.provider_image

        self._hypervisor = libvirt.open(
            self.configuration.get('hypervisor', 'vbox:///session'))

        self._domain = domain_create(self._hypervisor, self.identifier,
                                     self.configuration['domain'], disk_path)
1361634
def from_config(self, k, v):
        
        if k == "setup":
            return from_commandline(v, classname=to_commandline(datagen.DataGenerator()))
        return super(DataGenerator, self).from_config(k, v)
850451
def conf_sets(self):
        ''''''
        with self._mutex:
            if not self._conf_sets:
                self._parse_configuration()
        return self._conf_sets
840762
def parse_config(h5path):
        """"""
        with h5py.File(h5path, mode="r") as fh5:
            h5attrs = dict(fh5.attrs)

        # Convert byte strings to unicode strings
        # https://github.com/h5py/h5py/issues/379
        for key in h5attrs:
            if isinstance(h5attrs[key], bytes):
                h5attrs[key] = h5attrs[key].decode("utf-8")

        config = Configuration()
        for key in h5attrs:
            section, pname = key.split(":")
            if pname not in dfn.config_funcs[section]:
                # Add the value as a string but issue a warning
                config[section][pname] = h5attrs[key]
                msg = "Unknown key '{}' in section [{}]!".format(
                    pname, section)
                warnings.warn(msg, UnknownKeyWarning)
            else:
                typ = dfn.config_funcs[section][pname]
                config[section][pname] = typ(h5attrs[key])
        return config
556288
def create(vm_, call=None):
    '''
    '''
    prov = get_configured_provider(vm_)
    if not prov:
        return
    # we cant use profile as a configuration key as it conflicts
    # with salt cloud internals
    profile = vm_.get(
        'lxc_profile',
        vm_.get('container_profile', None))

    event_data = vm_.copy()
    event_data['profile'] = profile

    __utils__['cloud.fire_event'](
        'event',
        'starting create',
        'salt/cloud/{0}/creating'.format(vm_['name']),
        args=__utils__['cloud.filter_event']('creating', event_data, ['name', 'profile', 'provider', 'driver']),
        sock_dir=__opts__['sock_dir'],
        transport=__opts__['transport']
    )

    ret = {'name': vm_['name'], 'changes': {}, 'result': True, 'comment': ''}
    if 'pub_key' not in vm_ and 'priv_key' not in vm_:
        log.debug('Generating minion keys for %s', vm_['name'])
        vm_['priv_key'], vm_['pub_key'] = salt.utils.cloud.gen_keys(
            salt.config.get_cloud_config_value(
                'keysize', vm_, __opts__))
    # get the minion key pair to distribute back to the container
    kwarg = copy.deepcopy(vm_)
    kwarg['host'] = prov['target']
    kwarg['profile'] = profile

    __utils__['cloud.fire_event'](
        'event',
        'requesting instance',
        'salt/cloud/{0}/requesting'.format(vm_['name']),
        args=__utils__['cloud.filter_event']('requesting', vm_, ['name', 'profile', 'provider', 'driver']),
        sock_dir=__opts__['sock_dir'],
        transport=__opts__['transport']
    )

    cret = _runner().cmd('lxc.cloud_init', [vm_['name']], kwarg=kwarg)
    ret['runner_return'] = cret
    ret['result'] = cret['result']
    if not ret['result']:
        ret['Error'] = 'Error while creating {0},'.format(vm_['name'])
    else:
        ret['changes']['created'] = 'created'

    # When using cloud states to manage LXC containers
    # __opts__['profile'] is not implicitly reset between operations
    # on different containers. However list_nodes will hide container
    # if profile is set in opts assuming that it have to be created.
    # But in cloud state we do want to check at first if it really
    # exists hence the need to remove profile from global opts once
    # current container is created.
    if 'profile' in __opts__:
        __opts__['internal_lxc_profile'] = __opts__['profile']
        del __opts__['profile']

    __utils__['cloud.fire_event'](
        'event',
        'created instance',
        'salt/cloud/{0}/created'.format(vm_['name']),
        args=__utils__['cloud.filter_event']('created', vm_, ['name', 'profile', 'provider', 'driver']),
        sock_dir=__opts__['sock_dir'],
        transport=__opts__['transport']
    )

    return ret
576195
def create_tensorflow_extension(nvcc_settings, device_info):
    
    import tensorflow as tf
    import glob

    use_cuda = (bool(nvcc_settings['cuda_available'])
        and tf.test.is_built_with_cuda())

    # Source and includes
    source_path = os.path.join('montblanc', 'impl', 'rime', 'tensorflow', 'rime_ops')
    sources = glob.glob(os.path.join(source_path, '*.cpp'))

    # Header dependencies
    depends = glob.glob(os.path.join(source_path, '*.h'))

    # Include directories
    tf_inc = tf.sysconfig.get_include()
    include_dirs = [os.path.join('montblanc', 'include'), source_path]
    include_dirs += [tf_inc, os.path.join(tf_inc, "external", "nsync", "public")]

    # Libraries
    library_dirs = [tf.sysconfig.get_lib()]
    libraries = ['tensorflow_framework']
    extra_link_args = ['-fPIC', '-fopenmp', '-g0']

    # Macros
    define_macros = [
        ('_MWAITXINTRIN_H_INCLUDED', None),
        ('_FORCE_INLINES', None),
        ('_GLIBCXX_USE_CXX11_ABI', 0)]

    # Common flags
    flags = ['-std=c++11']

    gcc_flags = flags + ['-g0', '-fPIC', '-fopenmp', '-O2']
    gcc_flags += ['-march=native', '-mtune=native']
    nvcc_flags = flags + []

    # Add cuda specific build information, if it is available
    if use_cuda:
        # CUDA source files
        sources += glob.glob(os.path.join(source_path, '*.cu'))
        # CUDA include directories
        include_dirs += nvcc_settings['include_dirs']
        # CUDA header dependencies
        depends += glob.glob(os.path.join(source_path, '*.cuh'))
        # CUDA libraries
        library_dirs += nvcc_settings['library_dirs']
        libraries += nvcc_settings['libraries']
        # Flags
        nvcc_flags += ['-x', 'cu']
        nvcc_flags += ['--compiler-options', '"-fPIC"']
        # --gpu-architecture=sm_xy flags
        nvcc_flags += cuda_architecture_flags(device_info)
        # Ideally this would be set in define_macros, but
        # this must be set differently for gcc and nvcc
        nvcc_flags += ['-DGOOGLE_CUDA=%d' % int(use_cuda)]

    return Extension(tensorflow_extension_name,
        sources=sources,
        include_dirs=include_dirs,
        depends=depends,
        library_dirs=library_dirs,
        libraries=libraries,
        define_macros=define_macros,
        # this syntax is specific to this build system
        # we're only going to use certain compiler args with nvcc and not with gcc
        # the implementation of this trick is in customize_compiler_for_nvcc() above
        extra_compile_args={ 'gcc': gcc_flags, 'nvcc': nvcc_flags },
        extra_link_args=extra_link_args,
    )
584004
def install(config):  # pragma: no cover
        """"""
        client = Client()
        client.prepare_connection()
        key_api = API(client)
        key_api.install()
947126
def vm_profiles_config(path,
                       providers,
                       env_var='SALT_CLOUDVM_CONFIG',
                       defaults=None):
    '''
    
    '''
    if defaults is None:
        defaults = VM_CONFIG_DEFAULTS

    overrides = salt.config.load_config(
        path, env_var, os.path.join(salt.syspaths.CONFIG_DIR, 'cloud.profiles')
    )

    default_include = overrides.get(
        'default_include', defaults['default_include']
    )
    include = overrides.get('include', [])

    overrides.update(
        salt.config.include_config(default_include, path, verbose=False)
    )
    overrides.update(
        salt.config.include_config(include, path, verbose=True)
    )
    return apply_vm_profiles_config(providers, overrides, defaults)
1276344
function buildConfig( wantedEnv )
{

    const isValid = wantedEnv &&
        wantedEnv.length > 0 && allowedEnvs.indexOf( wantedEnv ) !== -1;
    const validEnv = isValid ? wantedEnv : 'dev';

    return configs[ validEnv ];
}
118871
def _setup_fun_config(self, fun_conf):
        '''
        
        '''
        conf = copy.deepcopy(self.config)
        conf['file_client'] = 'local'
        conf['fun'] = ''
        conf['arg'] = []
        conf['kwarg'] = {}
        conf['cache_jobs'] = False
        conf['print_metadata'] = False
        conf.update(fun_conf)
        conf['fun'] = conf['fun'].split(':')[-1]  # Discard typing prefix

        return conf
180455
def configuration(parent_package='', top_path=None):
    """"""
    config = Configuration('', parent_package, top_path)

    F95FLAGS = get_compiler_flags()

    kwargs = {
        'libraries': [],
        'include_dirs': [],
        'library_dirs': [],
    }
    kwargs['extra_compile_args'] = F95FLAGS
    kwargs['f2py_options'] = ['--quiet']

    # numpy.distutils.fcompiler.FCompiler doesn't support .F95 extension
    compiler = FCompiler(get_default_fcompiler())
    compiler.src_extensions.append('.F95')
    compiler.language_map['.F95'] = 'f90'

    # collect all Fortran sources
    files = os.listdir('src')
    exclude_sources = ['PlanetsConstants.f95', 'PythonWrapper.f95']
    sources = [os.path.join('src', file) for file in files if
               file.lower().endswith(('.f95', '.c')) and file not in
               exclude_sources]

    # (from http://stackoverflow.com/questions/14320220/
    #              testing-python-c-libraries-get-build-path)):
    build_lib_dir = "{dirname}.{platform}-{version[0]}.{version[1]}"
    dirparams = {'dirname': 'temp',
                 'platform': sysconfig.get_platform(),
                 'version': sys.version_info}
    libdir = os.path.join('build', build_lib_dir.format(**dirparams))
    print('searching SHTOOLS in:', libdir)

    # Fortran compilation
    config.add_library('SHTOOLS',
                       sources=sources,
                       **kwargs)

    # SHTOOLS
    kwargs['libraries'].extend(['SHTOOLS'])
    kwargs['include_dirs'].extend([libdir])
    kwargs['library_dirs'].extend([libdir])

    # FFTW info
    fftw_info = get_info('fftw', notfound_action=2)
    dict_append(kwargs, **fftw_info)

    if sys.platform != 'win32':
        kwargs['libraries'].extend(['m'])

    # BLAS / Lapack info
    lapack_info = get_info('lapack_opt', notfound_action=2)
    blas_info = get_info('blas_opt', notfound_action=2)
    dict_append(kwargs, **blas_info)
    dict_append(kwargs, **lapack_info)

    config.add_extension('pyshtools._SHTOOLS',
                         sources=['src/pyshtools.pyf',
                                  'src/PythonWrapper.f95'],
                         **kwargs)

    return config
702641
public static function buildFkConfig()
    {
        $config = require Config::get('fk_adder.fk_datatypes_path');

        return collect($config)->map(function ($value, $fk) {
            list($datatype, $referenceTable) = (explode(',', $value.','));

            return new Fluent([
                'datatype' => trim($datatype),
                'referenceTable' => trim($referenceTable ?: BaseFk::guessReferenceTable($fk)),
            ]);
        });
    }