Instantiate client.
182157
def instantiate_client(_unused_client, _unused_to_delete):
    """"""

    # [START client_create_default]
    from google.cloud import logging

    client = logging.Client()
    # [END client_create_default]

    credentials = object()
    # [START client_create_explicit]
    from google.cloud import logging

    client = logging.Client(project="my-project", credentials=credentials)
367365
function createClient(redisClientOptions) {
  const client = redis.createClient(redisClientOptions);
  if (!client._options) {
    client._options = redisClientOptions;
  }
  return client;
}
355036
public function init()
    {
        if ($this->isEnabled()) {
            $this->client = \PHPDaemon\Clients\IRC\Pool::getInstance();
        }
    }
53256
def create(self, **kwargs):
        """"""
        url_str = self.base_url
        if 'tenant_id' in kwargs:
            url_str = url_str + '?tenant_id=%s' % kwargs['tenant_id']
            del kwargs['tenant_id']

        data = kwargs['jsonbody'] if 'jsonbody' in kwargs else kwargs
        body = self.client.create(url=url_str, json=data)
        return body
815139
def create_client():
    """"""
    result = False
    if g.client_id in drivers:
        result = True
    return jsonify({'Success': result})
809780
def _make_client(self):
    """"""
    self._logger.debug('setting initial watchman timeout to %s', self._startup_timeout)
    return StreamableWatchmanClient(sockpath=self.socket,
                                    transport='local',
                                    timeout=self._startup_timeout)
955027
protected function constructHttpClient()
    {
        $hasHttpClient = (null !== $this->httpClient);

        $this->httpClient = new HttpClient($this->getOptions());

        if (!$hasHttpClient) {
            $this->httpClient->registerDefaults();
        }
    }
473857
function createClient() {
	rpc.emit('createClient', 'test', {
		nick : 'simpleircbot',
		user : 'testuser',
		server : 'localhost',
		realname: 'realbot',
		port: 6667,
		secure: false,
		retryCount: 2,
		retryWait: 3000
	});
}
1180576
def add_clients(session, verbose):
  """"""
  for ctype in ['Genuine', 'Impostor']:
    for cdid in userid_clients:
      cid = ctype + '_%d' % cdid
      if verbose>1: print("  Adding user '%s' of type '%s'..." % (cid, ctype))
      session.add(Client(cid, ctype, cdid))
29689
async def startup(self, app):
        """"""
        if self.cfg.fake:
            if not FakeConnection:
                raise PluginException('Install fakeredis for fake connections.')

            self.conn = await FakeConnection.create()
            if self.cfg.pubsub:
                self.pubsub_conn = self.conn

        else:
            try:
                if self.cfg.poolsize <= 1:
                    self.conn = await asyncio.wait_for(
                        asyncio_redis.Connection.create(
                            host=self.cfg.host, port=self.cfg.port,
                            password=self.cfg.password, db=self.cfg.db,
                        ), self.cfg.timeout)
                else:
                    self.conn = await asyncio.wait_for(asyncio_redis.Pool.create(
                        host=self.cfg.host, port=self.cfg.port,
                        password=self.cfg.password, db=self.cfg.db,
                        poolsize=self.cfg.poolsize,
                    ), self.cfg.timeout)
                if self.cfg.pubsub:
                    self.pubsub_conn = await asyncio.wait_for(
                        asyncio_redis.Connection.create(
                            host=self.cfg.host, port=self.cfg.port,
                            password=self.cfg.password, db=self.cfg.db,
                        ), self.cfg.timeout
                    )
            except asyncio.TimeoutError:
                raise PluginException('Muffin-redis connection timeout.')

        if self.cfg.pubsub:
            self.pubsub_subscription = await self.pubsub_conn.start_subscribe()
            self.pubsub_reader = ensure_future(self._pubsub_reader_proc(), loop=self.app.loop)
836400
def api(name, url, token, **kwargs):
    """"""
    return Client(token).api(name, url, **kwargs)
718605
def __make_client(self):
        ""
        notice('Making client, getting server connection', self.color)
        self.mode = 'c'
        addr = utils.get_existing_server_addr()
        sock = utils.get_client_sock(addr)
        self.__s = sock
        with self.__client_list_lock:
            self.clients = deque()
        self.threads = deque()
958532
def create_new_client(self, give_focus=True, filename='', is_cython=False,
                          is_pylab=False, is_sympy=False, given_name=None):
        """"""
        self.master_clients += 1
        client_id = dict(int_id=to_text_string(self.master_clients),
                         str_id='A')
        cf = self._new_connection_file()
        show_elapsed_time = self.get_option('show_elapsed_time')
        reset_warning = self.get_option('show_reset_namespace_warning')
        ask_before_restart = self.get_option('ask_before_restart')
        client = ClientWidget(self, id_=client_id,
                              history_filename=get_conf_path('history.py'),
                              config_options=self.config_options(),
                              additional_options=self.additional_options(
                                      is_pylab=is_pylab,
                                      is_sympy=is_sympy),
                              interpreter_versions=self.interpreter_versions(),
                              connection_file=cf,
                              menu_actions=self.menu_actions,
                              options_button=self.options_button,
                              show_elapsed_time=show_elapsed_time,
                              reset_warning=reset_warning,
                              given_name=given_name,
                              ask_before_restart=ask_before_restart,
                              css_path=self.css_path)

        # Change stderr_dir if requested
        if self.test_dir is not None:
            client.stderr_dir = self.test_dir

        self.add_tab(client, name=client.get_name(), filename=filename)

        if cf is None:
            error_msg = self.permission_error_msg.format(jupyter_runtime_dir())
            client.show_kernel_error(error_msg)
            return

        # Check if ipykernel is present in the external interpreter.
        # Else we won't be able to create a client
        if not CONF.get('main_interpreter', 'default'):
            pyexec = CONF.get('main_interpreter', 'executable')
            has_spyder_kernels = programs.is_module_installed(
                                                        'spyder_kernels',
                                                        interpreter=pyexec,
                                                        version='>=1.0.0')
            if not has_spyder_kernels:
                client.show_kernel_error(
                        _("Your Python environment or installation doesn't "
                          "have the <tt>spyder-kernels</tt> module or the "
                          "right version of it installed. "
                          "Without this module is not possible for "
                          "Spyder to create a console for you.<br><br>"
                          "You can install it by running in a system terminal:"
                          "<br><br>"
                          "<tt>conda install spyder-kernels</tt>"
                          "<br><br>or<br><br>"
                          "<tt>pip install spyder-kernels</tt>"))
                return

        self.connect_client_to_kernel(client, is_cython=is_cython,
                                      is_pylab=is_pylab, is_sympy=is_sympy)
        if client.shellwidget.kernel_manager is None:
            return
        self.register_client(client)
889291
def create(self, request, *args, **kwargs):
        """"""
        if not request.user.is_authenticated:
            raise exceptions.NotFound

        return super().create(request, *args, **kwargs)
787791
def on_connect(client):
    """"""
    client.nick(client.user.nick)
    client.userinfo(client.user.username, client.user.realname)
789253
def _constructClient(client_version, username, user_domain, password, project_name, project_domain,
                         auth_url):
        """"""
        loader = loading.get_plugin_loader('password')

        # These only work with v3
        if user_domain is not None or project_domain is not None:
            auth = loader.load_from_options(auth_url=auth_url, username=username, user_domain_name=user_domain,
                                            password=password, project_name=project_name, project_domain_name=project_domain)
        else:
            auth = loader.load_from_options(auth_url=auth_url, username=username,
                                            password=password, project_name=project_name)

        sess = session.Session(auth=auth)
        return client.Client(client_version, session=sess)
77077
def add(self):
        """"""

        yield self.client.create(self.path)
        yield self.client.create(self.path + "/type", self.name)
        yield self.client.create(self.path + "/state")
        yield self.client.create(self.path + "/machines", "[]")

        log.debug("registered service '%s' at %s." % (self.name, self.path))