Returns a new AccountProxy that has an account acquired. The
        account is chosen based on what the connected AccountManager
        selects for the given host.
486819
def for_host(parent, host):
        
        account = AccountProxy(parent)
        account.host = host
        if account.acquire():
            return account
        return None
372892
def _get_accounts_client(accounts_url, email, password):
    
    client = API(accounts_url, async=False, validate_cert=False)
    try:
        response = client.accounts.login.post(email=email, password=password)
        client.default_headers['Authorization'] = response['data']['token']
        return client
    except httpclient.HTTPError:
        msg = ('There was a problem logging into the accounts service.'
               ' Please check your email and password.')
        raise click.ClickException(click.style(msg, fg='red'))
276430
def get_remote_client(self, target_name, user=None, password=None):
        
        if user:
            base = self.get_user_client(user, password, populate=False)
        else:
            base = weakproxy(self)
        return RemoteXCLIClient(base, target_name, populate=True)
1162619
def namedb_get_account_diff(current, prior):
    
    if current['address'] != prior['address'] or current['type'] != prior['type']:
        raise ValueError("Accounts for two different addresses and/or token types")

    # NOTE: only possible since Python doesn't overflow :P
    return namedb_get_account_balance(current) - namedb_get_account_balance(prior)
1092370
function HostEntry(addr, src) {
  if (!(this instanceof HostEntry))
    return new HostEntry(addr, src);

  this.addr = addr || new NetAddress();
  this.src = src || new NetAddress();
  this.prev = null;
  this.next = null;
  this.used = false;
  this.refCount = 0;
  this.attempts = 0;
  this.lastSuccess = 0;
  this.lastAttempt = 0;

  if (addr)
    this.fromOptions(addr, src);
}
1323018
public AccountAcquisition updateAccountAcquisition(final String accountCode, final AccountAcquisition acquisition) {
        final String path = Account.ACCOUNT_RESOURCE + "/" + accountCode + AccountAcquisition.ACCOUNT_ACQUISITION_RESOURCE;
        return doPUT(path, acquisition, AccountAcquisition.class);
    }
1312535
function Account (client, opts) {
  var self = this
  if (!(self instanceof Account)) return new Account(client, opts)
  if (!opts) opts = {}

  self.client = client
}
70722
def create_bitcoind_service_proxy(
    rpc_username, rpc_password, server='127.0.0.1', port=8332, use_https=False):
    
    protocol = 'https' if use_https else 'http'
    uri = '%s://%s:%s@%s:%s' % (protocol, rpc_username, rpc_password,
        server, port)
    return AuthServiceProxy(uri)
991716
public final GoogleAccountCredential setSelectedAccountName(String accountName) {
    selectedAccount = accountManager.getAccountByName(accountName);
    // check if account has been deleted
    this.accountName = selectedAccount == null ? null : accountName;
    return this;
  }
143601
def get_account_service(self):
        """"""
        account_service_url = utils.get_subresource_path_by(self,
                                                            'AccountService')

        return (account_service.
                HPEAccountService(self._conn, account_service_url,
                                  redfish_version=self.redfish_version))
513399
protected Proxy copy(){
       Socks4Proxy copy = new Socks4Proxy(proxyIP,proxyPort,user);
       copy.directHosts = this.directHosts;
       copy.chainProxy = chainProxy;
       return copy;
    }
708122
def get_account(self, username):
        
        try:
            account = self.model.objects.get(
                **self._filter_user_by(username)
            )
        except self.model.DoesNotExist:
            return None
        return account
1262902
public ProxyAuthentication getProxyAuthentication() {
		// convert authentication to layerAuthentication so we only use one
		// TODO Remove when removing deprecated authentication field.
		if (layerAuthentication == null && authentication != null) {
			layerAuthentication = new LayerAuthentication();
			layerAuthentication.setAuthenticationMethod(LayerAuthenticationMethod.valueOf(authentication
					.getAuthenticationMethod().name()));
			layerAuthentication.setPassword(authentication.getPassword());
			layerAuthentication.setPasswordKey(authentication.getPasswordKey());
			layerAuthentication.setRealm(authentication.getRealm());
			layerAuthentication.setUser(authentication.getUser());
			layerAuthentication.setUserKey(authentication.getUserKey());
		}
		// TODO Remove when removing deprecated authentication field.
		return layerAuthentication;
	}
418168
def accounts(self, id=None):
        
        return Account.load(self, id) if id else Account.all(self)
1183294
def acquire_direct(self, address):
        
        if self.closed():
            raise ServiceUnavailable("Connection pool closed")
        with self.lock:
            try:
                connections = self.connections[address]
            except KeyError:
                connections = self.connections[address] = deque()

            connection_acquisition_start_timestamp = perf_counter()
            while True:
                # try to find a free connection in pool
                for connection in list(connections):
                    if connection.closed() or connection.defunct() or connection.timedout():
                        connections.remove(connection)
                        continue
                    if not connection.in_use:
                        connection.in_use = True
                        return connection
                # all connections in pool are in-use
                infinite_connection_pool = (self._max_connection_pool_size < 0 or
                                            self._max_connection_pool_size == float("inf"))
                can_create_new_connection = infinite_connection_pool or len(connections) < self._max_connection_pool_size
                if can_create_new_connection:
                    try:
                        connection = self.connector(address)
                    except ServiceUnavailable:
                        self.remove(address)
                        raise
                    else:
                        connection.pool = self
                        connection.in_use = True
                        connections.append(connection)
                        return connection

                # failed to obtain a connection from pool because the pool is full and no free connection in the pool
                span_timeout = self._connection_acquisition_timeout - (perf_counter() - connection_acquisition_start_timestamp)
                if span_timeout > 0:
                    self.cond.wait(span_timeout)
                    # if timed out, then we throw error. This time computation is needed, as with python 2.7, we cannot
                    # tell if the condition is notified or timed out when we come to this line
                    if self._connection_acquisition_timeout <= (perf_counter() - connection_acquisition_start_timestamp):
                        raise ClientError("Failed to obtain a connection from pool within {!r}s".format(
                            self._connection_acquisition_timeout))
                else:
                    raise ClientError("Failed to obtain a connection from pool within {!r}s".format(self._connection_acquisition_timeout))
527750
def get_account_from_name(self, name):
        
        for account in self.accounts:
            if account.get_name() == name:
                return account
        return None
745195
def _spec_from_via(self, proxied_inventory_name, via_spec):
        
        become_user, _, inventory_name = via_spec.rpartition('@')
        become_method, _, become_user = become_user.rpartition(':')

        # must use __contains__ to avoid a TypeError for a missing host on
        # Ansible 2.3.
        if self.host_vars is None or inventory_name not in self.host_vars:
            raise ansible.errors.AnsibleConnectionFailure(
                self.unknown_via_msg % (
                    via_spec,
                    proxied_inventory_name,
                )
            )

        via_vars = self.host_vars[inventory_name]
        return ansible_mitogen.transport_config.MitogenViaSpec(
            inventory_name=inventory_name,
            play_context=self._play_context,
            host_vars=dict(via_vars),  # TODO: make it lazy
            become_method=become_method or None,
            become_user=become_user or None,
        )