(settings)
return Cluster(
        router=Router,
        backend=Conn,
        **settings
    )
Creates a new Nydus cluster from the given settings.

    :param settings: Dictionary of the cluster settings.
    :returns: Configured instance of ``nydus.db.base.Cluster``.

    >>> redis = create_cluster({
    >>>     'backend': 'nydus.db.backends.redis.Redis',
    >>>     'router': 'nydus.db.routers.redis.PartitionRouter',
    >>>     'defaults': {
    >>>         'host': 'localhost',
    >>>         'port': 6379,
    >>>     },
    >>>     'hosts': {
    >>>         0: {'db': 0},
    >>>         1: {'db': 1},
    >>>         2: {'db': 2},
    >>>     }
    >>> })
Creates a new Nydus cluster from the given settings.
Creates a new Nydus cluster from the given settings .
def create_cluster(settings):
    """
    Creates a new Nydus cluster from the given settings.

    :param settings: Dictionary of the cluster settings.
    :returns: Configured instance of ``nydus.db.base.Cluster``.

    >>> redis = create_cluster({
    >>>     'backend': 'nydus.db.backends.redis.Redis',
    >>>     'router': 'nydus.db.routers.redis.PartitionRouter',
    >>>     'defaults': {
    >>>         'host': 'localhost',
    >>>         'port': 6379,
    >>>     },
    >>>     'hosts': {
    >>>         0: {'db': 0},
    >>>         1: {'db': 1},
    >>>         2: {'db': 2},
    >>>     }
    >>> })
    """
    # Pull in our client
    settings = copy.deepcopy(settings)
    backend = settings.pop('engine', settings.pop('backend', None))
    if isinstance(backend, basestring):
        Conn = import_string(backend)
    elif backend:
        Conn = backend
    else:
        raise KeyError('backend')

    # Pull in our cluster
    cluster = settings.pop('cluster', None)
    if not cluster:
        Cluster = Conn.get_cluster()
    elif isinstance(cluster, basestring):
        Cluster = import_string(cluster)
    else:
        Cluster = cluster

    # Pull in our router
    router = settings.pop('router', None)
    if not router:
        Router = BaseRouter
    elif isinstance(router, basestring):
        Router = import_string(router)
    else:
        Router = router

    # Build the connection cluster
    return Cluster(
        router=Router,
        backend=Conn,
        **settings
    )
def create_cluster ( settings ) : # Pull in our client settings = copy . deepcopy ( settings ) backend = settings . pop ( 'engine' , settings . pop ( 'backend' , None ) ) if isinstance ( backend , basestring ) : Conn = import_string ( backend ) elif backend : Conn = backend else : raise KeyError ( 'backend' ) # Pull in our cluster cluster = settings . pop ( 'cluster' , None ) if not cluster : Cluster = Conn . get_cluster ( ) elif isinstance ( cluster , basestring ) : Cluster = import_string ( cluster ) else : Cluster = cluster # Pull in our router router = settings . pop ( 'router' , None ) if not router : Router = BaseRouter elif isinstance ( router , basestring ) : Router = import_string ( router ) else : Router = router # Build the connection cluster return Cluster ( router = Router , backend = Conn , * * settings )