Register new client
188726
def register_client(self, client, give_focus=True):
        """"""
        client.configure_shellwidget(give_focus=give_focus)

        # Local vars
        shellwidget = client.shellwidget
        control = shellwidget._control
        page_control = shellwidget._page_control

        # Create new clients with Ctrl+T shortcut
        shellwidget.new_client.connect(self.create_new_client)

        # For tracebacks
        control.go_to_error.connect(self.go_to_error)

        shellwidget.sig_pdb_step.connect(
                              lambda fname, lineno, shellwidget=shellwidget:
                              self.pdb_has_stopped(fname, lineno, shellwidget))

        # To handle %edit magic petitions
        shellwidget.custom_edit_requested.connect(self.edit_file)

        # Set shell cwd according to preferences
        cwd_path = ''
        if CONF.get('workingdir', 'console/use_project_or_home_directory'):
            cwd_path = get_home_dir()
            if (self.main.projects is not None and
                    self.main.projects.get_active_project() is not None):
                cwd_path = self.main.projects.get_active_project_path()
        elif CONF.get('workingdir', 'console/use_fixed_directory'):
            cwd_path = CONF.get('workingdir', 'console/fixed_directory')

        if osp.isdir(cwd_path) and self.main is not None:
            shellwidget.set_cwd(cwd_path)
            if give_focus:
                # Syncronice cwd with explorer and cwd widget
                shellwidget.get_cwd()

        # Connect text widget to Help
        if self.main.help is not None:
            control.set_help(self.main.help)
            control.set_help_enabled(CONF.get('help', 'connect/ipython_console'))

        # Connect client to our history log
        if self.main.historylog is not None:
            self.main.historylog.add_history(client.history_filename)
            client.append_to_history.connect(
                self.main.historylog.append_to_history)
        
        # Set font for client
        client.set_font( self.get_plugin_font() )
        
        # Connect focus signal to client's control widget
        control.focus_changed.connect(lambda: self.focus_changed.emit())
        
        shellwidget.sig_change_cwd.connect(self.set_working_directory)

        # Update the find widget if focus changes between control and
        # page_control
        self.find_widget.set_editor(control)
        if page_control:
            page_control.focus_changed.connect(lambda: self.focus_changed.emit())
            control.visibility_changed.connect(self.refresh_plugin)
            page_control.visibility_changed.connect(self.refresh_plugin)
            page_control.show_find_widget.connect(self.find_widget.show)
900191
def add(self, client_id, email_address, name, access_level, password):
        """"""
        body = {
            "EmailAddress": email_address,
            "Name": name,
            "AccessLevel": access_level,
            "Password": password}
        response = self._post("/clients/%s/people.json" %
                              client_id, json.dumps(body))
        return json_to_py(response)
832064
function register (server, options, next) {
  server.ext('onPreHandler', function maybeForceGzip (request, reply) {
    if (request.query.force_gzip === 'true') {
      request.info.acceptEncoding = 'gzip'
    }
    reply.continue()
  })

  next()
}
495946
public function register()
    {
        // Configuring all guzzle clients.
        $this->app->bind(ClientInterface::class, function () {
            // Guzzle client
            return new Client(['handler' => $this->app->make(HandlerStack::class)]);
        });

        $this->app->alias(ClientInterface::class, Client::class);

        // Bind if needed.
        $this->app->bind(HandlerStack::class, function () {
            return HandlerStack::create();
        });

        // If resolved, by this SP or another, add some layers.
        $this->app->resolving(HandlerStack::class, function (HandlerStack $stack) {
            // We cannot log with debugbar from the CLI
            if ($this->app->runningInConsole()) {
                return;
            }
            
            /** @var \DebugBar\DebugBar $debugBar */
            $debugBar = $this->app->make('debugbar');

            $stack->push(new Middleware(new Profiler($timeline = $debugBar->getCollector('time'))));
            $stack->unshift(new ExceptionMiddleware($debugBar->getCollector('exceptions')));

            /** @var \GuzzleHttp\MessageFormatter $formatter */
            $formatter = $this->app->make(MessageFormatter::class);
            $stack->unshift(GuzzleMiddleware::log($debugBar->getCollector('messages'), $formatter));

            // Also log to the default PSR logger.
            if ($this->app->bound(LoggerInterface::class)) {
                $logger = $this->app->make(LoggerInterface::class);

                // Don't log to the same logger twice.
                if ($logger === $debugBar->getCollector('messages')) {
                    return;
                }

                // Push the middleware on the stack.
                $stack->unshift(GuzzleMiddleware::log($logger, $formatter));
            }
        });
    }
553905
def client_create(self, name, password):
        
        body = {
            "name": name,
            "password": password
        }
        response = self._post(url.clients, body=body)
        self._check_response(response, 201)
        return self._create_response(response).get("client_id")
1355029
def register_plugin(self):
        """"""
        self.main.add_dockwidget(self)

        self.focus_changed.connect(self.main.plugin_focus_changed)
        self.edit_goto.connect(self.main.editor.load)
        self.edit_goto[str, int, str, bool].connect(
                         lambda fname, lineno, word, processevents:
                         self.main.editor.load(fname, lineno, word,
                                               processevents=processevents))
        self.main.editor.breakpoints_saved.connect(self.set_spyder_breakpoints)
        self.main.editor.run_in_current_ipyclient.connect(self.run_script)
        self.main.editor.run_cell_in_ipyclient.connect(self.run_cell)
        self.main.workingdirectory.set_current_console_wd.connect(
                                     self.set_current_client_working_directory)

        self.tabwidget.currentChanged.connect(self.update_working_directory)

        self._remove_old_stderr_files()
198102
protected function configureAndRegisterClient(): void
    {
        $this->app->singleton(static::$abstract, function () {
            $basePath = base_path();
            $userConfig = $this->app['config'][static::$abstract];

            // We do not want this setting to hit our main client because it's Laravel specific
            unset(
                $userConfig['breadcrumbs'],
                // this is kept for backwards compatibilty and can be dropped in a breaking release
                $userConfig['breadcrumbs.sql_bindings']
            );

            $options = \array_merge(
                [
                    'environment' => $this->app->environment(),
                    'prefixes' => [$basePath],
                    'project_root' => $basePath,
                    'in_app_exclude' => [$basePath . '/vendor'],
                    'integrations' => [new Integration],
                ],
                $userConfig
            );

            $clientBuilder = ClientBuilder::create($options);
            $clientBuilder->setSdkIdentifier(Version::SDK_IDENTIFIER);
            $clientBuilder->setSdkVersion(Version::SDK_VERSION);

            Hub::setCurrent(new Hub($clientBuilder->getClient()));

            return Hub::getCurrent();
        });
    }
1342883
def register(self):
        """"""
        loop = asyncio.new_event_loop()
        asyncio.set_event_loop(loop)
        loop.run_until_complete(self._register())
710798
def get_new_client(request_session=False):
    
    from .client import ConciergeClient
    client = ConciergeClient(access_key=os.environ["MS_ACCESS_KEY"],
                             secret_key=os.environ["MS_SECRET_KEY"],
                             association_id=os.environ["MS_ASSOCIATION_ID"])
    if request_session:
        client.request_session()
    return client
694481
async def register(self):
        
        url = '{}/Sessions'.format(self.construct_url(API_URL))
        params = {'api_key': self._api_key}

        reg = await self.api_request(url, params)
        if reg is None:
            self._registered = False
            _LOGGER.error('Unable to register emby client.')
        else:
            self._registered = True
            _LOGGER.info('Emby client registered!, Id: %s', self.unique_id)
            self._sessions = reg

            # Build initial device list.
            self.update_device_list(self._sessions)

            asyncio.ensure_future(self.socket_connection(), loop=self._event_loop)
1127589
function Register(client, path) {
  if (!(this instanceof Register)) return new Register(client);
  EventEmitter.call(this);
  this._client = client;
  this._path = path;
  // Register status. Supported 'unwatched' / 'pending' / 'watched'.
  this._status = 'unwatched';

  this._watcher = this._watcher.bind(this);
}
677217
def cli(obj, name, email, password, status, text):
    """"""
    client = obj['client']
    if not email:
        raise click.UsageError('Need "--email" to sign-up new user.')
    if not password:
        raise click.UsageError('Need "--password" to sign-up new user.')
    try:
        r = client.signup(name=name, email=email, password=password, status=status, attributes=None, text=text)
    except Exception as e:
        click.echo('ERROR: {}'.format(e))
        sys.exit(1)
    if 'token' in r:
        click.echo('Signed Up.')
    else:
        raise AuthError
310464
def register_plugin(self):
        """"""
        ipyconsole = self.main.ipyconsole
        treewidget = self.explorer.treewidget
        lspmgr = self.main.lspmanager

        self.main.add_dockwidget(self)
        self.explorer.sig_open_file.connect(self.main.open_file)
        self.register_widget_shortcuts(treewidget)

        treewidget.sig_delete_project.connect(self.delete_project)
        treewidget.sig_edit.connect(self.main.editor.load)
        treewidget.sig_removed.connect(self.main.editor.removed)
        treewidget.sig_removed_tree.connect(self.main.editor.removed_tree)
        treewidget.sig_renamed.connect(self.main.editor.renamed)
        treewidget.sig_renamed_tree.connect(self.main.editor.renamed_tree)
        treewidget.sig_create_module.connect(self.main.editor.new)
        treewidget.sig_new_file.connect(
            lambda t: self.main.editor.new(text=t))
        treewidget.sig_open_interpreter.connect(
            ipyconsole.create_client_from_path)
        treewidget.redirect_stdio.connect(
            self.main.redirect_internalshell_stdio)
        treewidget.sig_run.connect(
            lambda fname:
            ipyconsole.run_script(fname, osp.dirname(fname), '', False, False,
                                  False, True))

        # New project connections. Order matters!
        self.sig_project_loaded.connect(
            lambda v: self.main.workingdirectory.chdir(v))
        self.sig_project_loaded.connect(
            lambda v: self.main.set_window_title())
        self.sig_project_loaded.connect(lspmgr.reinitialize_all_clients)
        self.sig_project_loaded.connect(
            lambda v: self.main.editor.setup_open_files())
        self.sig_project_loaded.connect(self.update_explorer)
        self.sig_project_closed[object].connect(
            lambda v: self.main.workingdirectory.chdir(
                self.get_last_working_dir()))
        self.sig_project_closed.connect(
            lambda v: self.main.set_window_title())
        self.sig_project_closed.connect(lspmgr.reinitialize_all_clients)
        self.sig_project_closed.connect(
            lambda v: self.main.editor.setup_open_files())
        self.recent_project_menu.aboutToShow.connect(self.setup_menu_actions)

        self.main.pythonpath_changed()
        self.main.restore_scrollbar_position.connect(
                                               self.restore_scrollbar_position)
        self.sig_pythonpath_changed.connect(self.main.pythonpath_changed)
        self.main.editor.set_projects(self)
235929
public function register()
    {
        $this->app->bind('dadata_suggest', function () {
            return new ClientSuggest();
        });
        $this->app->bind('dadata_clean', function () {
            return new ClientClean();
        });

        $this->mergeConfigFrom(__DIR__.'/../config/dadata.php', 'dadata');
    }
522007
public Client<? extends Options, ? extends OptionsBuilder, ? extends RequestBuilder> newClient() {
        if (clientClassName == null) {
            return new DefaultClient();
        } else {
            try {
                return (Client) Thread.currentThread().getContextClassLoader().loadClass(clientClassName).newInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
355074
def subscribe(self, client):
        """"""
        self.clients.append(client)
        log("Subscribed client {} to channel {}".format(client, self.name))
422716
public function registerClientScript()
	{
		$chart = Yii::createComponent(
			array(
				'class' => 'booster.widgets.TbGoogleVisualizationChart',
				'visualization' => 'PieChart',
				'containerId' => $this->getId(),
				'data' => $this->data,
				'options' => $this->chartOptions
			)
		);
		$chart->init();
		$chart->run();

		/**
		 * create custom chart update by using the global chart variable
		 * @see TbGoogleVisualizationChart
		 */
		$this->column->grid->componentsAfterAjaxUpdate[__CLASS__] =
			'var $el = $("#' . $this->getId() . '");var data = $el.data("data");var opts = $el.data("options");
			data = google.visualization.arrayToDataTable(data);
			' . $chart->getId() . '=new google.visualization.PieChart(document.getElementById("' . $this->getId() . '"));
			' . $chart->getId() . '.draw(data,opts);';
	}