Retrieve JVM options when running the Java version of VarDict.
484434
def _get_jvm_opts(data, out_file):
    
    if get_vardict_command(data) == "vardict-java":
        resources = config_utils.get_resources("vardict", data["config"])
        jvm_opts = resources.get("jvm_opts", ["-Xms750m", "-Xmx4g"])
        jvm_opts += broad.get_default_jvm_opts(os.path.dirname(out_file))
        return "export VAR_DICT_OPTS='%s' && " % " ".join(jvm_opts)
    else:
        return ""
140254
def variable_names(self):
        
        result = []
        names = javabridge.call(self.jobject, "getVariableNames", "()Ljava/util/Set;")
        for name in javabridge.iterate_collection(names):
            result.append(javabridge.to_string(name))
        return result
262281
def convert_old_variant_handle(handle_dict):
    """"""
    old_variables = handle_dict.get("variables", {})
    variables = dict(repository_type="filesystem")

    for old_key, key in variant_key_conversions.iteritems():
        value = old_variables.get(old_key)
        #if value is not None:
        variables[key] = value

    path = handle_dict["path"]
    filename = os.path.basename(path)
    if os.path.splitext(filename)[0] == "package":
        key = "filesystem.variant"
    else:
        key = "filesystem.variant.combined"

    return dict(key=key, variables=variables)
143013
private final int getJavaVersionAsInt() {
		if (JAVA_VERSION == null) {
			return 0;
		}

		String str = JAVA_VERSION.substring(0, 1);

		str = str + JAVA_VERSION.substring(2, 3);

		if (JAVA_VERSION.length() >= 5) {
			str = str + JAVA_VERSION.substring(4, 5);
		} else {
			str = str + "0";
		}

		return Integer.parseInt(str);
	}
1339853
def _get_options(ret=None):
    '''
    
    '''
    attrs = {
        'api_token': 'api_token',
        'api_url': 'api_url',
        'tags': 'tags',
        'sls_states': 'sls_states'
    }

    _options = salt.returners.get_returner_options(
        __virtualname__,
        ret,
        attrs,
        __salt__=__salt__,
        __opts__=__opts__)

    _options['api_url'] = _options.get('api_url', 'api.appoptics.com')
    _options['sls_states'] = _options.get('sls_states', [])
    _options['tags'] = _options.get('tags', {
        'host_hostname_alias': __salt__['grains.get']('id')
    })

    log.debug('Retrieved appoptics options: %s', _options)
    return _options
818333
public Dictionary<String, ?> getServiceProps() {
        Hashtable<String, Object> d = new Hashtable<String, Object>();
        d.put(BootstrapConstants.INTERNAL_COMMAND_LINE_ARG_LIST, getArgs());
        String version = System.getProperty(BootstrapConstants.JAVA_SPEC_VERSION);
        String vendor = System.getProperty(BootstrapConstants.JAVA_VENDOR);
        try {
            if (version != null)
                d.put(BootstrapConstants.JAVA_SPEC_VERSION, VersionUtility.stringToVersion(version));
            if (vendor != null)
                d.put(BootstrapConstants.JAVA_VENDOR, vendor.toLowerCase());
        } catch (IllegalArgumentException iae) {

        }

        // wlp.process.type
        d.put(BootstrapConstants.LOC_PROPERTY_PROCESS_TYPE, frameworkMgr.config.getProcessType());

        return d;
    }
613168
def find_jvm_dll_file(java_home_dir=None, fail=False):
    

    logger.debug("Searching for JVM shared library file")

    if java_home_dir:
        jvm_dll_path = _find_jvm_dll_file(java_home_dir)
        if jvm_dll_path:
            return jvm_dll_path

    jvm_dll_path = os.environ.get('JPY_JVM_DLL', None)
    if jvm_dll_path:
        return jvm_dll_path

    for name in JRE_HOME_VARS:
        java_home_dir = os.environ.get(name, None)
        if java_home_dir:
            jvm_dll_path = _find_jvm_dll_file(java_home_dir)
            if jvm_dll_path:
                return jvm_dll_path

    jvm_dll_path = ctypes.util.find_library(JVM_LIB_NAME)
    if jvm_dll_path:
        logger.debug("No JVM shared library file found in all search paths. Using fallback %s" % repr(jvm_dll_path))
    elif fail:
        raise RuntimeError("can't find any JVM shared library")

    return jvm_dll_path
849743
def find_program_variables(code):
    
    vars = {}
    lines = code.split('\n')
    for line in lines:
        m = re.match(r"\s*" + re_prog_var_declaration + r"\s*(=|;)", line)
        if m is not None:
            vtype, dtype, names = m.groups()[:3]
            for name in names.split(','):
                vars[name.strip()] = (vtype, dtype)
    return vars
269711
def Version():
  """"""

  version_ini = VersionPath()

  config = configparser.SafeConfigParser()
  config.read(version_ini)
  return dict(
      packageversion=config.get("Version", "packageversion"),
      major=config.getint("Version", "major"),
      minor=config.getint("Version", "minor"),
      revision=config.getint("Version", "revision"),
      release=config.getint("Version", "release"))
67794
def get_options(self, section='default', opt_keys=None, vars=None):
        
        vars = vars if vars else self.default_vars
        conf = self.parser
        opts = {}
        if opt_keys is None:
            if conf is None:
                opt_keys = {}
            else:
                if not self.robust or conf.has_section(section):
                    opt_keys = conf.options(section)
                else:
                    opt_keys = {}
        else:
            logger.debug('conf: %s' % conf)
            copts = conf.options(section) if conf else {}
            opt_keys = set(opt_keys).intersection(set(copts))
        for option in opt_keys:
            logger.debug(f'option: {option}, vars: {vars}')
            opts[option] = conf.get(section, option, vars=vars)
        return opts
1341631
def get_runtime_version(self):  # pylint: disable=no-self-use
        
        import platform

        version_info = '\n\n'
        version_info += 'Python ({}) {}'.format(platform.system(), sys.version)
        version_info += '\n\n'
        version_info += 'Python location \'{}\''.format(sys.executable)
        version_info += '\n'
        return version_info
645072
def find_java_home(cratedb_version: tuple) -> str:
    
    if MIN_VERSION_FOR_JVM11 <= cratedb_version < (4, 0):
        # Supports 8 to 11+, use whatever is set
        return os.environ.get('JAVA_HOME', '')
    if cratedb_version < MIN_VERSION_FOR_JVM11:
        return _find_matching_java_home(lambda ver: ver[0] == 8)
    else:
        return _find_matching_java_home(lambda ver: ver[0] >= 11)
586347
def get_versions(default=DEFAULT, verbose=False):
    """"""


    # returns dict with two keys: 'version' and 'full'
    assert versionfile_source is not None, "please set versioneer.versionfile_source"
    assert tag_prefix is not None, "please set versioneer.tag_prefix"
    assert parentdir_prefix is not None, "please set versioneer.parentdir_prefix"
    assert VCS is not None, "please set versioneer.VCS"

    # I am in versioneer.py, which must live at the top of the source tree,
    # which we use to compute the root directory. py2exe/bbfreeze/non-CPython
    # don't have __file__, in which case we fall back to sys.argv[0] (which
    # ought to be the setup.py script). We prefer __file__ since that's more
    # robust in cases where setup.py was invoked in some weird way (e.g. pip)
    root = get_root()
    versionfile_abs = os.path.join(root, versionfile_source)

    # extract version from first of _version.py, VCS command (e.g. 'git
    # describe'), parentdir. This is meant to work for developers using a
    # source checkout, for users of a tarball created by 'setup.py sdist',
    # and for users of a tarball/zipball created by 'git archive' or github's
    # download-from-tag feature or the equivalent in other VCSes.

    # Try to get the version info from the VCS-specific replacement keywords.

    get_keywords_f = vcs_function(VCS, "get_keywords")
    versions_from_keywords_f = vcs_function(VCS, "versions_from_keywords")
    if get_keywords_f and versions_from_keywords_f:
        vcs_keywords = get_keywords_f(versionfile_abs)
        ver = versions_from_keywords_f(vcs_keywords, tag_prefix)
        if ver:
            if verbose: print("got version from expanded keyword %s" % ver)
            return ver

    # Try to get the version info from _version.py .

    ver = versions_from_file(versionfile_abs)
    if ver:
        if verbose: print("got version from file %s %s" % (versionfile_abs,ver))
        return ver

    # Try to get the version info from the VCS, directly.

    versions_from_vcs_f = vcs_function(VCS, "versions_from_vcs")
    if versions_from_vcs_f:
        ver = versions_from_vcs_f(tag_prefix, root, verbose)
        if ver:
            if verbose: print("got version from VCS %s" % ver)
            return ver

    # Try to get the version info from the directory's naming.

    ver = versions_from_parentdir(parentdir_prefix, root, verbose)
    if ver:
        if verbose: print("got version from parentdir %s" % ver)
        return ver

    if verbose: print("got version from default %s" % default)
    return default
980396
def get_environment_var(varstr):
    """"""
    mo=_get_env_var.match(to_String(varstr))
    if mo:
        var = mo.group(1)
        if var[0] == '{':
            return var[1:-1]
        else:
            return var
    else:
        return None
755109
def _get_options(ret=None):
    '''
    
    '''
    defaults = {'host': 'salt',
                'user': 'salt',
                'pass': 'salt',
                'db': 'salt',
                'port': 3306,
                'ssl_ca': None,
                'ssl_cert': None,
                'ssl_key': None}

    attrs = {'host': 'host',
             'user': 'user',
             'pass': 'pass',
             'db': 'db',
             'port': 'port',
             'ssl_ca': 'ssl_ca',
             'ssl_cert': 'ssl_cert',
             'ssl_key': 'ssl_key'}

    _options = salt.returners.get_returner_options(__virtualname__,
                                                   ret,
                                                   attrs,
                                                   __salt__=__salt__,
                                                   __opts__=__opts__,
                                                   defaults=defaults)
    # post processing
    for k, v in six.iteritems(_options):
        if isinstance(v, six.string_types) and v.lower() == 'none':
            # Ensure 'None' is rendered as None
            _options[k] = None
        if k == 'port':
            # Ensure port is an int
            _options[k] = int(v)

    return _options
454907
def _get_from_bin(self):
        
        # Find the real interpreter installation path
        java_bin = os.path.realpath(self._java)
        if os.path.exists(java_bin):
            # Get to the home directory
            java_home = os.path.abspath(os.path.join(os.path.dirname(java_bin),
                                                     '..'))

            # Look for the JVM library
            return self.find_libjvm(java_home)
1070519
@Override
    public String[] getjavaVMs() {
        final String methodName = "getjavaVMs";
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(tc, methodName, this);

        ArrayList<String> jvmArrayList = new ArrayList<String>();
        ObjectName obnToFind = null;//WebSphere:name=JVM,J2EEServer=com.ibm.ws.jca.jdbc.mbean.fat,j2eeType=JVM
        final String obnStr = "WebSphere:j2eeType=JVM,*";
        final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        try {
            obnToFind = new ObjectName(obnStr);
        } catch (MalformedObjectNameException e) {
            //Should never happen because we are building the ObjectName without any user input
            if (trace && tc.isDebugEnabled())
                Tr.debug(tc, "Unable to create ObjectName with the string: " + obnStr, e);
        }
        Set<ObjectInstance> matchingMbeanList = mbs.queryMBeans(obnToFind, null);
        if (matchingMbeanList.size() == 0) {
            if (trace && tc.isDebugEnabled())
                Tr.debug(tc, methodName + ": matchingMbeanList.size(): " + matchingMbeanList.size()
                             + ", We didn't find any Mbean matching: " + obnStr);
            if (trace && tc.isEntryEnabled())
                Tr.exit(tc, methodName, this);
            return null;
        } else {
            for (ObjectInstance bean : matchingMbeanList) {
                if (trace && tc.isDebugEnabled())
                    Tr.debug(tc, "**  Found a matching MBean: " + bean.getObjectName().toString());
                jvmArrayList.add(bean.getObjectName().toString());
            }
        }

        if (trace && tc.isEntryEnabled())
            Tr.exit(tc, methodName, this);

        return jvmArrayList.toArray(new String[jvmArrayList.size()]);
    }