Creates SWAG client from the current context.
485991
def create_swag_from_ctx(ctx):
    """"""
    swag_opts = {}
    if ctx.type == 'file':
        swag_opts = {
            'swag.type': 'file',
            'swag.data_dir': ctx.data_dir,
            'swag.data_file': ctx.data_file
        }
    elif ctx.type == 's3':
        swag_opts = {
            'swag.type': 's3',
            'swag.bucket_name': ctx.bucket_name,
            'swag.data_file': ctx.data_file,
            'swag.region': ctx.region
        }
    elif ctx.type == 'dynamodb':
        swag_opts = {
            'swag.type': 'dynamodb',
            'swag.region': ctx.region
        }
    return SWAGManager(**parse_swag_config_options(swag_opts))
1285678
def generate_swagger_html(swagger_static_root, swagger_json_url):
    
    tmpl = _get_template("swagger.html")
    return tmpl.render(
        swagger_root=swagger_static_root, swagger_json_url=swagger_json_url
    )
1285135
public S buildService(final WebContext context, final IndirectClient client, final String state) {
        init();

        final String finalCallbackUrl = client.computeFinalCallbackUrl(context);

        return getApi().createService(this.key, this.secret, finalCallbackUrl, this.scope, null, state, this.responseType, null,
                this.httpClientConfig, null);
    }
113832
private function createSwooleClient()
    {
        if (!extension_loaded('swoole')) {
            return null;
        }

        $client = new \swoole_client(SWOOLE_SOCK_TCP);
        $option = [
            'package_max_length' => 2000000,
            'socket_buffer_size' => 1024 * 1024 * 2,
        ];
        $client->set($option);
        $async_config = $this->engine->getConfigVar('async');
        if (!$client->connect($async_config['async']['server']['host'], $async_config['async']['server']['port'])) {
            static::$swooleClientConnected = false;
            return null;
        }

        static::$swooleClientConnected = true;
        return $client;
    }
522240
def execute_with_client(quiet=False,
                        bootstrap_server=False,
                        create_client=True):
    """"""
    def wrapper(f):

        def wrapper2(self, *args, **kwargs):
            client = self.current_client(
                quiet=quiet,
                bootstrap_server=bootstrap_server,
                create_client=create_client)
            if client and client.running:
                return f(self, client, *args, **kwargs)
        return wrapper2

    return wrapper
645886
def create(context, resource, **kwargs):
    """"""
    data = utils.sanitize_kwargs(**kwargs)
    uri = '%s/%s' % (context.dci_cs_api, resource)
    r = context.session.post(uri, timeout=HTTP_TIMEOUT,
                             json=data)
    return r
1366148
function createThingme (opts) {
    opts = defaultOptions(opts);
    validateThings(opts.things);
    return createWebservice(opts);
}
1339744
def make_client(instance):
    """"""
    neutron_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS,
    )
    instance.initialize()
    url = instance._url
    url = url.rstrip("/")
    client = neutron_client(username=instance._username,
                            project_name=instance._project_name,
                            password=instance._password,
                            region_name=instance._region_name,
                            auth_url=instance._auth_url,
                            endpoint_url=url,
                            endpoint_type=instance._endpoint_type,
                            token=instance._token,
                            auth_strategy=instance._auth_strategy,
                            insecure=instance._insecure,
                            ca_cert=instance._ca_cert,
                            retries=instance._retries,
                            raise_errors=instance._raise_errors,
                            session=instance._session,
                            auth=instance._auth)
    return client
123262
function(client) {
		this.client = client;
		if(gui.hasModule('gui-spirits@wunderbyte.com')) {
			if(client instanceof gui.Spirit) {
				this.spirit = client || null;
				this.context = window; // otherwise web worker scenario, maybe deprecate
			}
		}
		this.onconstruct();
	}
438430
protected function createLaravelDriver(): Sdk\Client
    {
        return \tap($this->createHttpClient(), function ($client) {
            if (isset($this->config['client_id']) || isset($this->config['client_secret'])) {
                $client->setClientId($this->config['client_id'])
                        ->setClientSecret($this->config['client_secret']);
            }

            if (isset($this->config['access_token'])) {
                $client->setAccessToken($this->config['access_token']);
            }
        });
    }
746105
private function createClient(): Client
    {
        $stack = new HandlerStack();
        $stack->setHandler(new CurlHandler());

        if ($this->user === null) {
            $stack->push(GuzzleJWTMiddleware::authTokenMiddleware(
                $this->tenant->getAddonKey(),
                $this->tenant->getSharedSecret()
            ));
        } else {
            $stack->push(GuzzleJWTMiddleware::authUserTokenMiddleware(
                $this->tenant->getOauthClientId(),
                $this->tenant->getSharedSecret(),
                $this->tenant->getBaseUrl(),
                $this->user
            ));
        }

        return new Client(['handler' => $stack]);
    }
103624
def create_context(self, message_queue, task_id):
        
        params = (self.settings.dest_directory, self.file_url.json_data, self.seek_amt, self.bytes_to_read)
        return DownloadContext(self.settings, params, message_queue, task_id)
836400
def api(name, url, token, **kwargs):
    """"""
    return Client(token).api(name, url, **kwargs)
352028
function create(modulePath, moduleStack, options) {

        // the 'FromPlugin' suffix is used when a project wants to override a plugin module
        if (modulePath === /.*FromPlugin/) {
            modulePath = modulePath.substring(0, modulePath.length - 10);
        }
        modulePath = modulePath.toLowerCase();

        // first check the cache to see if we already loaded it
        if (this.cache[modulePath]) {
            return this.cache[modulePath];
        }

        // if module not in server modules, return null
        var flapjack = this.serverModules[modulePath];
        if (!flapjack) {
            return null;
        }

        // switch to server if exists
        flapjack = flapjack.server ? flapjack.server : flapjack;

        // if flapjack is not a function, just return it (i.e. its just a normal require()
        if (!_.isFunction(flapjack)) {
            this.cache[modulePath] = flapjack;
            return flapjack;
        }

        this.cache[modulePath] = this.injector.injectFlapjack(flapjack, moduleStack, options);
        return this.cache[modulePath];
    }
574494
def bind_client(self, new):
        """"""
        top = self._stack[-1]
        self._stack[-1] = (new, top[1])
757966
def create_asset(self, **kwargs):
        
        asset = predix.admin.asset.Asset(**kwargs)
        asset.create()

        client_id = self.get_client_id()
        if client_id:
            asset.grant_client(client_id)

        asset.add_to_manifest(self)
        return asset
592934
def create(cls, api_context, public_key_string):
        

        api_client = client.ApiClient(api_context)
        body_bytes = cls.generate_request_body_bytes(
            public_key_string
        )
        response_raw = api_client.post(cls._ENDPOINT_URL_POST, body_bytes, {})

        return cls._from_json_array_nested(response_raw)