:param settings: settings including connection settings
    :return: DSN url suitable for sqlalchemy and aiopg.
481416
def pg_dsn(settings: Settings) -> str:
    
    return str(URL(
        database=settings.DB_NAME,
        password=settings.DB_PASSWORD,
        host=settings.DB_HOST,
        port=settings.DB_PORT,
        username=settings.DB_USER,
        drivername='postgres',
    ))
642274
def config_settings_loader(request=None):
    
    conf = SPConfig()
    conf.load(copy.deepcopy(settings.SAML_CONFIG))
    return conf
758473
def get_settings(self):
        
        uri = "{}/settings".format(self.data["uri"])
        return self._helper.do_get(uri)
1119923
def getConf(cls, settings, options):
        ""
        ports = ['http_port', 'https_port', 'cache_port']
        for port_name in ports:
            port = getattr(settings, port_name.upper(), None)
            # only use the settings ports if the defaults were left unchanged
            default = getattr(defaults, port_name.upper())
            if port and options.get(port_name) == default:
                options[port_name] = port

        _opts = [
            ('key', 'hx_private_key'),
            ('cert', 'hx_certficate'),
            ('wsgi', 'wsgi_application')
        ]
        for opt_name, settings_name in _opts:
            opt = getattr(settings, settings_name.upper(), None)
            if opt:
                options[opt_name] = opt

        if not options['settings']:
            options['settings'] = environ['DJANGO_SETTINGS_MODULE']
        return options
635932
def db(self, connection_string=None):
        """"""

        connection_string = connection_string or self.settings["db"]

        if not hasattr(self, "_db_conns"):
            self._db_conns = {}
        if not connection_string in self._db_conns:
            self._db_conns[connection_string] = oz.sqlalchemy.session(connection_string=connection_string)

        return self._db_conns[connection_string]
621966
def make_dsn(
    *,
    driver: str,
    user: str = None,
    password: str = None,
    host: str = None,
    port: str = None,
    name: str = None,
    query: Dict[str, Any] = None,
) -> str:
    
    s = driver + '://'
    if user is not None:
        s += _rfc_1738_quote(user)
        if password is not None:
            s += ':' + _rfc_1738_quote(password)
        s += '@'
    if host is not None:
        if ':' in host:
            s += '[{}]'.format(host)
        else:
            s += host
    if port is not None:
        s += ':{}'.format(int(port))
    if name is not None:
        s += '/' + name
    query = query or {}
    if query:
        keys = list(query)
        keys.sort()
        s += '?' + '&'.join('{}={}'.format(k, query[k]) for k in keys)
    return s
665774
def settings_to_cmd_args(settings_dict):
    
    args = ['mysql']
    db = settings_dict['OPTIONS'].get('db', settings_dict['NAME'])
    user = settings_dict['OPTIONS'].get('user', settings_dict['USER'])
    passwd = settings_dict['OPTIONS'].get('passwd', settings_dict['PASSWORD'])
    host = settings_dict['OPTIONS'].get('host', settings_dict['HOST'])
    port = settings_dict['OPTIONS'].get('port', settings_dict['PORT'])
    cert = settings_dict['OPTIONS'].get('ssl', {}).get('ca')
    defaults_file = settings_dict['OPTIONS'].get('read_default_file')
    # Seems to be no good way to set sql_mode with CLI.

    if defaults_file:
        args += ["--defaults-file=%s" % defaults_file]
    if user:
        args += ["--user=%s" % user]
    if passwd:
        args += ["--password=%s" % passwd]
    if host:
        if '/' in host:
            args += ["--socket=%s" % host]
        else:
            args += ["--host=%s" % host]
    if port:
        args += ["--port=%s" % port]
    if cert:
        args += ["--ssl-ca=%s" % cert]
    if db:
        args += [db]
    return args
1132532
def format_sql_connectivity_update_settings(result):
    '''
    
    '''
    from collections import OrderedDict
    # Only display parameters that have content
    order_dict = OrderedDict()
    if result.connectivity_type is not None:
        order_dict['connectivityType'] = result.connectivity_type
    if result.port is not None:
        order_dict['port'] = result.port
    if result.sql_auth_update_user_name is not None:
        order_dict['sqlAuthUpdateUserName'] = result.sql_auth_update_user_name

    return order_dict
195848
def _redis_connect(cls, settings):
        
        if 'tornadoredis' not in globals():
            import tornadoredis
        kwargs = {'host': settings.get('host', cls.REDIS_HOST),
                  'port': settings.get('port', cls.REDIS_PORT),
                  'selected_db': settings.get('db', cls.REDIS_DB)}
        LOGGER.info('Connecting to %(host)s:%(port)s DB %(selected_db)s',
                    kwargs)
        cls._redis_client = tornadoredis.Client(**kwargs)
        cls._redis_client.connect()
715569
def dns_get_conf(self, domainName, environment):
        
        response = self.client.service.dns_get_conf(domainName, environment)
        dns_config = CotendoDNS(response)
        return dns_config
1338911
def get_settings(self, index=None):
        
        path = make_path(index, "_settings")
        return self.conn._send_request('GET', path)
344326
def settings():
    
    # Get the user-provided settings
    user_settings = dict(getattr(django_settings, _settings_key, {}))
    user_settings_keys = set(user_settings.keys())
    # Check for required but missing settings
    missing = _required_settings_keys - user_settings_keys
    if missing:
        raise AuthzConfigurationError(
            'Missing required {} config: {}'.format(_settings_key, missing))
    # Check for unknown settings
    unknown = user_settings_keys - _available_settings_keys
    if unknown:
        raise AuthzConfigurationError(
            'Unknown {} config params: {}'.format(_settings_key, unknown))
    # Merge defaults with provided settings
    defaults = _available_settings_keys - user_settings_keys
    user_settings.update({key: _available_settings[key] for key in defaults})

    _rectify(user_settings)
    return types.MappingProxyType(user_settings)
1160925
def db_url(self, var=DEFAULT_DATABASE_ENV, default=NOTSET, engine=None):
        
        return self.db_url_config(self.get_value(var, default=default), engine=engine)
720419
def get_dsn(d):
    

    try:
        return d["dataSetName"]
    except Exception as e:
        logger_misc.warn("get_dsn: Exception: No datasetname found, unable to continue: {}".format(e))
        exit(1)
84596
def SettingsAddConnection(self, connection_settings):
    '''
    '''

    if 'uuid' not in connection_settings['connection']:
        connection_settings['connection']['uuid'] = str(uuid.uuid4())

    NM = dbusmock.get_object(MANAGER_OBJ)
    settings_obj = dbusmock.get_object(SETTINGS_OBJ)
    main_connections = settings_obj.ListConnections()

    # Mimic how NM names connections
    count = 0
    while True:
        connection_obj_path = dbus.ObjectPath(SETTINGS_OBJ + '/' + str(count))
        if connection_obj_path not in main_connections:
            break
        count += 1
    connection_path = str(connection_obj_path)

    self.AddObject(connection_path,
                   CSETTINGS_IFACE,
                   {
                       'Unsaved': False
                   },
                   [
                       ('Delete', '', '', 'self.ConnectionDelete(self)'),
                       ('GetSettings', '', 'a{sa{sv}}', 'ret = self.ConnectionGetSettings(self)'),
                       ('GetSecrets', 's', 'a{sa{sv}}', 'ret = self.ConnectionGetSecrets(self, args[0])'),
                       ('Update', 'a{sa{sv}}', '', 'self.ConnectionUpdate(self, args[0])'),
                   ])
    self.object_manager_emit_added(connection_path)

    connection_obj = dbusmock.get_object(connection_path)
    connection_obj.settings = connection_settings
    connection_obj.connection_path = connection_path
    connection_obj.ConnectionDelete = ConnectionDelete
    connection_obj.ConnectionGetSettings = ConnectionGetSettings
    connection_obj.ConnectionGetSecrets = ConnectionGetSecrets
    connection_obj.ConnectionUpdate = ConnectionUpdate

    main_connections.append(connection_path)
    settings_obj.Set(SETTINGS_IFACE, 'Connections', main_connections)

    settings_obj.EmitSignal(SETTINGS_IFACE, 'NewConnection', 'o', [connection_path])

    auto_connect = False
    if 'autoconnect' in connection_settings['connection']:
        auto_connect = connection_settings['connection']['autoconnect']

    if auto_connect:
        dev = None
        devices = NM.GetDevices()

        # Grab the first device.
        if len(devices) > 0:
            dev = devices[0]

        if dev:
            activate_connection(NM, connection_path, dev, connection_path)

    return connection_path
402651
def get_settings(options = {}, request_options = {})
      options['getVersion'] = 2 if !options[:getVersion] && !options['getVersion']
      client.get(Protocol.settings_uri(name, options).to_s, :read, request_options)
    end
865044
def simple_settings(cls):
    

    class Settings(ff.PersistenceSettings):
        _id = cls.__name__
        id_provider = ff.StaticIdProvider(_id)
        key_builder = ff.StringDelimitedKeyBuilder()
        database = ff.FileSystemDatabase(
            path=_id, key_builder=key_builder, createdirs=True)

    class Model(cls, Settings):
        pass

    Model.__name__ = cls.__name__
    Model.__module__ = cls.__module__
    return Model