Return a QGAPIConnect object for v1 API pulling settings from config
    file.
515979
def connect(config_file=qcs.default_filename, section='info', remember_me=False, remember_me_always=False):
    
    # Retrieve login credentials.
    conf = qcconf.QualysConnectConfig(filename=config_file, section=section, remember_me=remember_me,
                                      remember_me_always=remember_me_always)
    connect = qcconn.QGConnector(conf.get_auth(),
                                 conf.get_hostname(),
                                 conf.proxies,
                                 conf.max_retries)
    logger.info("Finished building connector.")
    return connect
45150
def __get_default_settings(self):
        

        LOGGER.debug("> Accessing '{0}' default settings file!".format(UiConstants.settings_file))
        self.__default_settings = QSettings(
            umbra.ui.common.get_resource_path(UiConstants.settings_file), QSettings.IniFormat)
270194
async def get_config(self):
        
        app_facade = client.ApplicationFacade.from_connection(self.connection)

        log.debug(
            'Getting config for %s', self.name)

        return (await app_facade.Get(self.name)).config
527588
def getclient():
        '''
        
        '''
        if not Configuration.client_initialized:
            Configuration._initconf()
            Configuration.client_settings = Configuration.settings['client']
            Configuration.client_initialized = True
        return Configuration.client_settings
865332
def get_default_connection_info(self, provider_name):
        
        provider = self._provider_client.get_by_name(provider_name)
        if provider:
            return provider['defaultConnectionInfo']
        else:
            return {}
774014
def _get_setting(self, setting_dotted_name, default=None):
        
        name_list = setting_dotted_name.split('.')
        setting_obj = getattr(django.conf.settings, name_list[0], default)
        # if len(name_list) == 1:
        #   return setting_obj

        return functools.reduce(
            lambda o, a: o.get(a, default), [setting_obj] + name_list[1:]
        )
1019954
def _get_config(self, rel_path, view, api_version=1):
    
    self._require_min_api_version(api_version)
    params = view and dict(view=view) or None
    resp = self._get_resource_root().get(self._path() + '/' + rel_path,
        params=params)
    return json_to_config(resp, view == 'full')
794616
def load_configs(self):
        """"""
        if self.config is None:
            return False

        # Display a warning (deprecated) message if the monitor section exist
        if "monitor" in self.config.sections():
            logger.warning("A deprecated [monitor] section exists in the Glances configuration file. You should use the new Applications Monitoring Process module instead (http://glances.readthedocs.io/en/develop/aoa/amps.html).")

        header = "glances_"
        # For each AMP scrip, call the load_config method
        for s in self.config.sections():
            if s.startswith("amp_"):
                # An AMP section exists in the configuration file
                # If an AMP script exist in the glances/amps folder, use it
                amp_conf_name = s[4:]
                amp_script = os.path.join(amps_path, header + s[4:] + ".py")
                if not os.path.exists(amp_script):
                    # If not, use the default script
                    amp_script = os.path.join(amps_path, "glances_default.py")
                try:
                    amp = __import__(os.path.basename(amp_script)[:-3])
                except ImportError as e:
                    logger.warning("Missing Python Lib ({}), cannot load {} AMP".format(e, amp_conf_name))
                except Exception as e:
                    logger.warning("Cannot load {} AMP ({})".format(amp_conf_name, e))
                else:
                    # Add the AMP to the dictionary
                    # The key is the AMP name
                    # for example, the file glances_xxx.py
                    # generate self._amps_list["xxx"] = ...
                    self.__amps_dict[amp_conf_name] = amp.Amp(name=amp_conf_name, args=self.args)
                    # Load the AMP configuration
                    self.__amps_dict[amp_conf_name].load_config(self.config)
        # Log AMPs list
        logger.debug("AMPs list: {}".format(self.getList()))

        return True
1120510
def get_default_config_help(self):
        
        config = super(GraphitePickleHandler, self).get_default_config_help()

        config.update({
        })

        return config
1231798
def _parse_settings_eth(opts, iface_type, enabled, iface):
    '''
    
    '''
    adapters = salt.utils.odict.OrderedDict()
    adapters[iface] = salt.utils.odict.OrderedDict()

    adapters[iface]['type'] = iface_type

    adapters[iface]['data'] = salt.utils.odict.OrderedDict()
    iface_data = adapters[iface]['data']
    iface_data['inet'] = salt.utils.odict.OrderedDict()
    iface_data['inet6'] = salt.utils.odict.OrderedDict()

    if enabled:
        adapters[iface]['enabled'] = True

    if opts.get('hotplug', False):
        adapters[iface]['hotplug'] = True

    if opts.get('enable_ipv6', None) and opts.get('iface_type', '') == 'vlan':
        iface_data['inet6']['vlan_raw_device'] = (
            re.sub(r'\.\d*', '', iface))

    for addrfam in ['inet', 'inet6']:
        if iface_type not in ['bridge']:
            tmp_ethtool = _parse_ethtool_opts(opts, iface)
            if tmp_ethtool:
                ethtool = {}
                for item in tmp_ethtool:
                    ethtool[_ETHTOOL_CONFIG_OPTS[item]] = tmp_ethtool[item]

                iface_data[addrfam]['ethtool'] = ethtool
                # return a list of sorted keys to ensure consistent order
                iface_data[addrfam]['ethtool_keys'] = sorted(ethtool)

        if iface_type == 'bridge':
            bridging = _parse_bridge_opts(opts, iface)
            if bridging:
                iface_data[addrfam]['bridging'] = bridging
                iface_data[addrfam]['bridging_keys'] = sorted(bridging)
                iface_data[addrfam]['addrfam'] = addrfam

        elif iface_type == 'bond':
            bonding = _parse_settings_bond(opts, iface)
            if bonding:
                iface_data[addrfam]['bonding'] = bonding
                iface_data[addrfam]['bonding']['slaves'] = opts['slaves']
                iface_data[addrfam]['bonding_keys'] = sorted(bonding)
                iface_data[addrfam]['addrfam'] = addrfam

        elif iface_type == 'slave':
            adapters[iface]['master'] = opts['master']

            opts['proto'] = 'manual'
            iface_data[addrfam]['master'] = adapters[iface]['master']
            iface_data[addrfam]['addrfam'] = addrfam

        elif iface_type == 'vlan':
            iface_data[addrfam]['vlan_raw_device'] = re.sub(r'\.\d*', '', iface)
            iface_data[addrfam]['addrfam'] = addrfam

        elif iface_type == 'pppoe':
            tmp_ethtool = _parse_ethtool_pppoe_opts(opts, iface)
            if tmp_ethtool:
                for item in tmp_ethtool:
                    adapters[iface]['data'][addrfam][_DEB_CONFIG_PPPOE_OPTS[item]] = tmp_ethtool[item]
            iface_data[addrfam]['addrfam'] = addrfam

    opts.pop('mode', None)

    for opt, val in opts.items():
        inet = None
        if opt.startswith('ipv4'):
            opt = opt[4:]
            inet = 'inet'
            iface_data['inet']['addrfam'] = 'inet'
        elif opt.startswith('ipv6'):
            iface_data['inet6']['addrfam'] = 'inet6'
            opt = opt[4:]
            inet = 'inet6'
        elif opt in ['ipaddr', 'address', 'ipaddresses', 'addresses', 'gateway', 'proto']:
            iface_data['inet']['addrfam'] = 'inet'
            inet = 'inet'

        _opt = SALT_ATTR_TO_DEBIAN_ATTR_MAP.get(opt, opt)
        _debopt = _opt.replace('-', '_')

        for addrfam in ['inet', 'inet6']:
            (valid, value, errmsg) = _validate_interface_option(_opt, val, addrfam=addrfam)
            if not valid:
                continue
            if inet is None and _debopt not in iface_data[addrfam]:
                iface_data[addrfam][_debopt] = value
            elif inet == addrfam:
                iface_data[addrfam][_debopt] = value

    for opt in ['up_cmds', 'pre_up_cmds', 'post_up_cmds',
                'down_cmds', 'pre_down_cmds', 'post_down_cmds']:
        if opt in opts:
            iface_data['inet'][opt] = opts[opt]
            iface_data['inet6'][opt] = opts[opt]

    # Remove incomplete/disabled inet blocks
    for (addrfam, opt) in [('inet', 'enable_ipv4'), ('inet6', 'enable_ipv6')]:
        if opts.get(opt, None) is False:
            iface_data.pop(addrfam)
        elif iface_data[addrfam].get('addrfam', '') != addrfam:
            iface_data.pop(addrfam)

    return adapters
1175247
def get_default_config_help(self):
        
        config = super(zmqHandler, self).get_default_config_help()

        config.update({
            'port': '',
        })

        return config
694461
def _getGuiSettings(self):
        
        # Put the settings into a ConfigObj dict (don't use a config-spec)
        rcFile = self._rcDir+os.sep+APP_NAME.lower()+'.cfg'
        if os.path.exists(rcFile):
            try:
                return configobj.ConfigObj(rcFile)
            except:
                raise RuntimeError('Error parsing: '+os.path.realpath(rcFile))

            # tho, for simple types, unrepr=True eliminates need for .cfgspc
            # also, if we turn unrepr on, we don't need cfgGetBool
        else:
            return {}
24962
def get_config(self, config_filename):
        
        x = pyini.Ini(lazy=True, basepath=os.path.join(self.project_dir, 'apps'))
        for p in reversed(self.apps):
            app_path = get_app_dir(p)
            filename = os.path.join(app_path, config_filename)
            if os.path.exists(filename):
                x.read(filename)

        x.freeze()
        return x
202215
def get_QApplication(args=[]):
    """"""
    global _qapp
    if _qapp is None:
        QCoreApplication.setAttribute(Qt.AA_X11InitThreads)
        _qapp = QApplication(args)

    return _qapp
762385
def __get_config():
    '''
    
    '''
    if 'config' not in globals():
        return None
    cfg = globals().get('config', None)
    if cfg is None:
        return None

    if not isinstance(cfg, dict):
        return None
    return cfg
507231
def get_config(self, service, setting):
        
        try:
            return self.get_service(service)[setting]
        except KeyError:
            return getattr(self, setting + '_DEFAULT')
397524
def _load_config():
    '''
    
    '''
    config = {}

    if os.path.isfile('/usbkey/config'):
        with salt.utils.files.fopen('/usbkey/config', 'r') as config_file:
            for optval in config_file:
                optval = salt.utils.stringutils.to_unicode(optval)
                if optval[0] == '#':
                    continue
                if '=' not in optval:
                    continue
                optval = optval.split('=')
                config[optval[0].lower()] = optval[1].strip().strip('"')
    log.debug('smartos.config - read /usbkey/config: %s', config)
    return config