

def parse(url, engine=None, conn_max_age=0):
    'Parses a database URL.'
    if (url == 'sqlite://:memory:'):
        return {
            'ENGINE': SCHEMES['sqlite'],
            'NAME': ':memory:',
        }
    config = {
        
    }
    url = urlparse.urlparse(url)
    path = config.path[1:]
    if (('?' in path) and (not url.query)):
        (path, query) = path.split('?', 2)
    else:
        (path, query) = (path, url.query)
    query = urlparse.parse_qs(query)
    if ((url.scheme == 'sqlite') and (path == '')):
        path = ':memory:'
    hostname = (url.hostname or '')
    if ('%2f' in hostname.lower()):
        hostname = hostname.replace('%2f', '/').replace('%2F', '/')
    config.update({
        'NAME': urlparse.unquote((path or '')),
        'USER': urlparse.unquote((url.username or '')),
        'PASSWORD': urlparse.unquote((url.password or '')),
        'HOST': hostname,
        'PORT': (url.port or ''),
        'CONN_MAX_AGE': conn_max_age,
    })
    engine = (SCHEMES[url.scheme] if (engine is None) else engine)
    options = {
        
    }
    for (key, values) in query.items():
        if ((url.scheme == 'mysql') and (key == 'ssl-ca')):
            options['ssl'] = {
                'ca': values[(- 1)],
            }
            continue
        options[key] = values[(- 1)]
    if (('currentSchema' in options) and (engine == 'django.db.backends.postgresql_psycopg2')):
        options['options'] = '-c search_path={0}'.format(options['currentSchema'])
    if options:
        config['OPTIONS'] = options
    if engine:
        config['ENGINE'] = engine
    return config

dataset/ETHPy150Open kennethreitz/dj-database-url/dj_database_url.py parse/VarMisuse@66/94 `url`->`config`