u"""
        Return a clone of given_app with ChordableDjangoBackend, if needed.
188117
def get_suitable_app(cls, given_app):
        
        """
        if not isinstance(getattr(given_app, 'backend', None), ChordableDjangoBackend):
            return_app = deepcopy(given_app)
            return_app.backend = ChordableDjangoBackend(return_app)
            return return_app
        else:
            return given_app
380174
def clone(self):
        ''' 
        '''
        qclone = Query(self.type, self.session)
        qclone.__query = deepcopy(self.__query)
        qclone._sort = deepcopy(self._sort)
        qclone._fields = deepcopy(self._fields)
        qclone._hints = deepcopy(self.hints)
        qclone._limit = deepcopy(self._limit)
        qclone._skip = deepcopy(self._skip)
        qclone._raw_output = deepcopy(self._raw_output)
        return qclone
211980
def clone(self):
    """"""
    return type(self)(self.__cmp, self.__key, self.__reverse, name = self.name, dataFormat = self._dataFormat)
233800
def clone(client):
        ''''''
        kwargs = client.redis.connection_pool.connection_kwargs
        kwargs['parser_class'] = redis.connection.PythonParser
        pool = redis.connection.ConnectionPool(**kwargs)
        return redis.Redis(connection_pool=pool)
508014
def clone(self, fp):
        """"""
        return self.__class__(fp,
                              self._mangle_from_,
                              None, # Use policy setting, which we've adjusted
                              policy=self.policy)
874355
def deploy_from_template(self, si, logger, data_holder, vcenter_data_model, reservation_id, cancellation_context):
        
        template_resource_model = data_holder.template_resource_model
        return self._deploy_a_clone(si,
                                    logger,
                                    data_holder.app_name,
                                    template_resource_model.vcenter_template,
                                    template_resource_model,
                                    vcenter_data_model,
                                    reservation_id,
                                    cancellation_context)
363453
def get_replica(request, pid):
    """"""
    _assert_node_is_authorized(request, pid)
    sciobj = d1_gmn.app.models.ScienceObject.objects.get(pid__did=pid)
    content_type_str = d1_gmn.app.object_format_cache.get_content_type(
        sciobj.format.format
    )
    # Replica is always a local file that can be handled with FileResponse()
    response = django.http.FileResponse(
        d1_gmn.app.sciobj_store.open_sciobj_file_by_pid(pid), content_type_str
    )
    d1_gmn.app.views.headers.add_sciobj_properties_headers_to_response(response, sciobj)
    # Log the replication of this object.
    d1_gmn.app.event_log.log_replicate_event(pid, request)
    return response
1051457
def to_app(app):
        
        from sevenbridges.models.app import App
        if not app:
            raise SbgError('App is required!')
        elif isinstance(app, App):
            return app.id
        elif isinstance(app, six.string_types):
            return app
        else:
            raise SbgError('Invalid app parameter!')
1187904
def clone(self):
    """"""
    return type(self)(name = self.name, dataFormat = self._dataFormat)
831499
def clone(self, spawn_mapping=None):
        
        c = self.spawn(spawn_mapping)
        self.register_clone(c)
        c.register_parent(self)
        return c
821853
def clone(self):
        """"""
        return Node(self.type, [ch.clone() for ch in self.children],
                    fixers_applied=self.fixers_applied)
302234
function (id, callback) {
    if (this.isReplaying) {
      if (this.replayingVms[id]) {
        return callback(null, this.replayingVms[id]);
      }
      if (this.replayingVmsToDelete[id]) {
        var vm = new viewmodel.ViewModel({ id: id }, this.repository);
        var clonedInitValues = _.cloneDeep(this.modelInitValues);
        for (var prop in clonedInitValues) {
          if (!vm.has(prop)) {
            vm.set(prop, clonedInitValues[prop]);
          }
        }
        this.replayingVms[vm.id] = vm;
        return callback(null, this.replayingVms[id]);
      }
    }
    var self = this;
    this.repository.get(id, function(err, vm) {
      if (err) {
        debug(err);
        return callback(err);
      }
      if (!vm) {
        err = new Error('No vm object returned!');
        debug(err);
        return callback(err);
      }
      var clonedInitValues = _.cloneDeep(self.modelInitValues);
      for (var prop in clonedInitValues) {
        if (!vm.has(prop)) {
          vm.set(prop, clonedInitValues[prop]);
        }
      }
      if (self.isReplaying) {
        if (!self.replayingVms[vm.id]) {
          self.replayingVms[vm.id] = vm;
        }
        return callback(null, self.replayingVms[vm.id]);
      }
      callback(null, vm);
    });
  }
1050955
def standalone(app):
    ''''''
    from udata import api, core, frontend

    core.init_app(app)
    frontend.init_app(app)
    api.init_app(app)

    register_features(app)

    return app
665905
def get_app():
    """"""
    from bottle import default_app
    default_app.push()
    for module in ("mongo_orchestration.apps.servers",
                   "mongo_orchestration.apps.replica_sets",
                   "mongo_orchestration.apps.sharded_clusters"):
        __import__(module)
    app = default_app.pop()
    return app
1207706
def resource(resource_id):
    """"""
    resource_obj = app.db.resource(resource_id)

    if 'raw' in request.args:
        return send_from_directory(os.path.dirname(resource_obj.path),
                                   os.path.basename(resource_obj.path))

    return render_template('resource.html', resource=resource_obj)
1165505
def clone(self, source_id, backup_id, size,
              volume_id=None, source_host=None):
        
        volume_id = volume_id or str(uuid.uuid4())
        return self.http_put('/volumes/%s' % volume_id,
                             params=self.unused({
                                 'source_host': source_host,
                                 'source_volume_id': source_id,
                                 'backup_id': backup_id,
                                 'size': size
                             }))
181932
def make_app():
    """"""
    from plnt import Plnt

    database_uri = os.environ.get("PLNT_DATABASE_URI")
    app = Plnt(database_uri or "sqlite:////tmp/plnt.db")
    app.bind_to_context()
    return app