Did I find the right examples for you? yes no

All Samples(4)  |  Call(1)  |  Derive(0)  |  Import(3)
<driver>://<username>:<password>@<host>:<port>/<database>

        def parsedsn(dsnstring, **defaults):
    "://:@:/"
    dsn = dict((x, None) for x in "driver username password host port database".split())
    dsn.update(defaults)
    dsn["driver"], _, rest = dsnstring.partition("://")
    if '@' in rest:
        user, _, rest = rest.partition('@')
        if ':' in user:
            user, _, dsn["password"] = user.partition(':')
        dsn["user"] = user
    if '/' in rest:
        host, _, dsn["database"] = rest.partition('/')
    if ':' in host:
        host, _, dsn["port"] = host.partition(':')
    dsn["host"] = host
    if dsn["port"] is not None:
        dsn["port"] = int(dsn["port"])

    return dsn
        


src/t/s/tsar-HEAD/lib/tsar/commands.py   tsar(Download)
from . import model
from .client import Tsar
from .util import parsedsn
 
class Command(LoggingApp):
    def pre_run(self):
        dsn = parsedsn(self.params.dsn)
        del(dsn["username"])
        del(dsn["driver"])
        dsn["db"] = dsn.pop("database")

src/t/s/tsar-HEAD/lib/tsar/web.py   tsar(Download)
from .commands import (
    Application, CommandLineMixin, DaemonizingMixin, LoggingMixin)
from .util import Decorator, adiff, derive, differentiators, json, parsedsn, trim
 
__all__ = ["Records", "service"]

src/t/s/tsar-HEAD/lib/tsar/collectors/redis.py   tsar(Download)
from .commands import Collector
from ..commands import DBMixin
from ..util import parsedsn
 
class Redis(DBMixin, Collector):