Invokes the /container-xxxx/clone API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Cloning#API-method%3A-%2Fclass-xxxx%2Fclone
556734
def container_clone(object_id, input_params={}, always_retry=False, **kwargs):
    
    return DXHTTPRequest('/%s/clone' % object_id, input_params, always_retry=always_retry, **kwargs)
33109
def _makes_clone(_func, *args, **kw):
    
    self = args[0]._clone()
    _func(self, *args[1:], **kw)
    return self
1250382
function clone(obj, json) {
    if (json)
        return JSON.parse(JSON.stringify(obj));
    return _clone(obj);
}
312496
function clone() {
    var cloned = new this.constructor(this.client);
    cloned._method = this._method;
    cloned._single = assign({}, this._single);
    cloned._options = assign({}, this._options);
    cloned._statements = this._statements.slice();
    return cloned;
  }
103014
def clone(self, to_linode=None, region=None, service=None, configs=[], disks=[],
            label=None, group=None, with_backups=None):
        
        if to_linode and region:
            raise ValueError('You may only specify one of "to_linode" and "region"')

        if region and not service:
            raise ValueError('Specifying a region requires a "service" as well')

        if not isinstance(configs, list) and not isinstance(configs, PaginatedList):
            configs = [configs]
        if not isinstance(disks, list) and not isinstance(disks, PaginatedList):
            disks = [disks]

        cids = [ c.id if issubclass(type(c), Base) else c for c in configs ]
        dids = [ d.id if issubclass(type(d), Base) else d for d in disks ]

        params = {
            "linode_id": to_linode.id if issubclass(type(to_linode), Base) else to_linode,
            "region": region.id if issubclass(type(region), Base) else region,
            "type": service.id if issubclass(type(service), Base) else service,
            "configs": cids if cids else None,
            "disks": dids if dids else None,
            "label": label,
            "group": group,
            "with_backups": with_backups,
        }

        result = self._client.post('{}/clone'.format(Instance.api_endpoint), model=self, data=params)

        if not 'id' in result:
            raise UnexpectedResponseError('Unexpected response cloning Instance!', json=result)

        l = Instance(self._client, result['id'], result)
        return l
359431
def clone(self, callable=None, **overrides):
        
        old = {k: v for k, v in self.get_param_values()
               if k not in ['callable', 'name']}
        params = dict(old, **overrides)
        callable = self.callable if callable is None else callable
        return self.__class__(callable, **params)
597768
protected <T> T performCloneForCloneableMethod(T object, CloneDriver context) {

		Class<?> clazz = object.getClass();

		final T result;
		try {
			MethodHandle handle = context.getCloneMethod(clazz);
			result = (T) handle.invoke(object);
		} catch (Throwable e) {
			throw new IllegalStateException("Could not invoke clone() for instance of: " + clazz.getName(), e);
		}
		return result;
	}
574446
def copy(opts = {})
      res = connection.get("#{resource_uri}/#{@id}/copy", {:query => opts})
      self.class.verify_response res
      self.class.new(res["id"], nil, res)
    end
442123
def clone(self, label):
        
        result = self._client.post('{}/clone'.format(Volume.api_endpoint),
                model=self, data={'label': label})

        if not 'id' in result:
            raise UnexpectedResponseError('Unexpected response cloning volume!')

        return Volume(self._client, result['id'], result)
898194
public function apiAction() {
        /**
         * Prepare the server. Zend_Json_Server cannot work with batched requests natively,
         * so that's taken care of customly here. Therefore, autoEmitResponse is set to false
         * so the server doesn't print the response directly.
         */
        $server = new Zend_Json_Server();
        $server->setClass('Garp_Content_Manager_Proxy');
        $server->setAutoEmitResponse(false);

        if ($this->getRequest()->isPost()) {
            $post = $this->_getJsonRpcRequest();
            $batch = false;
            $responses = array();
            $requests = Zend_Json::decode($post, Zend_Json::TYPE_ARRAY);
            /**
             * Check if this was a batch request. In that case the array is a plain array of
             * arrays. If not, there will be a 'jsonrpc' key in the root of the array.
             */
            $batch = !array_key_exists('jsonrpc', $requests);
            if (!$batch) {
                $requests = array($requests);
            }
            foreach ($requests as $i => $request) {
                $request = $this->_reformJsonRpcRequest($request);
                $requestJson = Zend_Json::encode($request);
                $requestObj = new Zend_Json_Server_Request();
                $requestObj->loadJson($requestJson);
                $server->setRequest($requestObj);
                /**
                 * Note; response gets returned by reference, resulting in a $responses array
                 * containing all the same items.
                 * That's why clone is used here.
                 */
                $response = clone $server->handle();
                $responses[] = $response;
            }
            $response = $batch ? '[' . implode(',', $responses) . ']' : $responses[0];
        } else {
            $response = $server->getServiceMap();
        }
        $this->_helper->layout->setLayout('json');
        //  filter out escaped slashes, because they're annoying and not necessary.
        $response = str_replace('\/', '/', $response);
        $this->view->response = $response;
    }
459034
def copy(self, new_container, new_obj_name=None, extra_info=None):
        
        return self.container.copy_object(self, new_container,
                new_obj_name=new_obj_name)
618347
def clone_from_upstream(pkg_name, repo_url):
        """"""
        msg = "Spawning a cloning task for %s from upstream due to API req."
        LOG.info(msg % pkg_name)

        upstream_url = settings.UPSTREAM_BOWER_REGISTRY
        upstream_pkg = bowerlib.get_package(upstream_url, pkg_name)

        if upstream_pkg is None:
            raise Http404

        task = tasks.clone_repo.delay(pkg_name, upstream_pkg['url'])
        try:
            result = task.get(timeout=5)
        except tasks.TimeoutError:
            # Not done yet. What to return?
            raise ServiceUnavailable

        return result.to_package(repo_url)
1358969
function clone (obj, deep) {
  if (obj) {
    return deep ? deepClone(obj) : objectAssign(isPlainObject(obj) ? {} : [], obj)
  }
  return obj
}
1236588
def _clone(self):
        
        ubq = super(UpdateByQuery, self)._clone()

        ubq._response_class = self._response_class
        ubq._script = self._script.copy()
        ubq.query._proxied = self.query._proxied
        return ubq
531821
def _copy(self):
    """"""
    copied_uri = Uri(self.uri.scheme, self.uri.host, self.uri.port,
                     self.uri.path, self.uri.query.copy())
    new_request = HttpRequest(uri=copied_uri, method=self.method,
                              headers=self.headers.copy())
    new_request._body_parts = self._body_parts[:]
    return new_request
194918
async def batch_call_api(container, apis, timeout = 120.0):
    
    apiHandles = [(object(), api) for api in apis]
    apiEvents = [ModuleAPICall(handle, targetname, name, params = params)
                 for handle, (targetname, name, params) in apiHandles]
    apiMatchers = tuple(ModuleAPIReply.createMatcher(handle) for handle, _ in apiHandles)
    async def process():
        for e in apiEvents:
            await container.wait_for_send(e)
    container.subroutine(process(), False)
    eventdict = {}
    async def process2():
        ms = len(apiMatchers)
        matchers = Diff_(apiMatchers)
        while ms:
            ev, m = await matchers
            matchers = Diff_(matchers, remove=(m,))
            eventdict[ev.handle] = ev
    await container.execute_with_timeout(timeout, process2())
    for e in apiEvents:
        if e.handle not in eventdict:
            e.canignore = True
            container.scheduler.ignore(ModuleAPICall.createMatcher(e.handle))
    return [eventdict.get(handle, None) for handle, _ in apiHandles]
311956
def project_clone(object_id, input_params={}, always_retry=False, **kwargs):
    
    return DXHTTPRequest('/%s/clone' % object_id, input_params, always_retry=always_retry, **kwargs)