Create a new {@link Regions} instance that uses the given `agent` to
make its HTTP requests to the ESI interface.

@param agent The agent making actual requests
@returns An Regions API instance
509138
function makeRegions(agent) {
    let functor = function (id) {
        if (id === undefined) {
            return agent.request('get_universe_regions', undefined);
        }
        else {
            return new RegionImpl(agent, id);
        }
    };
    functor.search = search_1.makeDefaultSearch(agent, "region" /* REGION */);
    functor.names = function (ids) {
        if (ids === undefined) {
            return functor().then(allIds => functor.names(allIds));
        }
        else {
            return names_1.getNames(agent, "region" /* REGION */, ids);
        }
    };
    return functor;
}
925569
@SuppressWarnings({"checkstyle:npathcomplexity"})
	protected void fireAgentDestroyed(Agent agent) {
		final ListenerCollection<SpawnServiceListener> list;
		synchronized (getAgentLifecycleListenerMutex()) {
			list = this.agentLifecycleListeners.get(agent.getID());
		}
		final SpawnServiceListener[] ilisteners;
		if (list != null) {
			ilisteners = list.getListeners(SpawnServiceListener.class);
		} else {
			ilisteners = null;
		}
		final SpawnServiceListener[] ilisteners2 = this.globalListeners.getListeners(SpawnServiceListener.class);
		// Retrieve the agent's contexts
		final List<Pair<AgentContext, Address>> contextRegistrations = new ArrayList<>();
		try {
			final SynchronizedIterable<AgentContext> allContexts = BuiltinCapacityUtil.getContextsOf(agent);
			synchronized (allContexts.mutex()) {
				for (final AgentContext context : allContexts) {
					final EventSpace defSpace = context.getDefaultSpace();
					final Address address = defSpace.getAddress(agent.getID());
					contextRegistrations.add(Pair.of(context, address));
				}
			}
		} catch (RuntimeException e) {
			throw e;
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		// Local agent and framework destruction
		if (ilisteners != null) {
			for (final SpawnServiceListener l : ilisteners) {
				l.agentDestroy(agent);
			}
		}
		for (final SpawnServiceListener l : ilisteners2) {
			l.agentDestroy(agent);
		}
		// Fire AgentKilled into the associated contexts
		try {
			final UUID killedAgentId = agent.getID();
			final Scope<Address> scope = address -> {
				final UUID receiver = address.getUUID();
				return !receiver.equals(killedAgentId);
			};
			final String killedAgentType = agent.getClass().getName();
			for (final Pair<AgentContext, Address> registration : contextRegistrations) {
				final EventSpace defSpace = registration.getKey().getDefaultSpace();
				defSpace.emit(
						// No need to give an event source because it is explicitly set below.
						null,
						new AgentKilled(
								registration.getValue(), killedAgentId, killedAgentType),
						scope);
			}
		} catch (RuntimeException e) {
			throw e;
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
148367
public static ConcurrentMap<Class<? extends Capacity>, ClearableReference<Skill>> getSkillRepository(Agent agent) {
		return agent.$getSkillRepository();
	}
1122994
public long getId(final String agent) {
        try {
            return worker.getId(agent);
        } catch (final InvalidUserAgentError e) {
            LOGGER.error("Invalid user agent ({})", agent);
            throw new SnowizardException(Response.Status.BAD_REQUEST,
                    "Invalid User-Agent header", e);
        } catch (final InvalidSystemClock e) {
            LOGGER.error("Invalid system clock", e);
            throw new SnowizardException(Response.Status.INTERNAL_SERVER_ERROR,
                    e.getMessage(), e);
        }
    }
1001914
public String getUserAgent(FacesContext facesContext)
    {
        if (userAgent == null)
        {
            synchronized (this)
            {
                if (userAgent == null)
                {
                    Map<String, String[]> requestHeaders =
                            facesContext.getExternalContext().getRequestHeaderValuesMap();

                    if (requestHeaders != null &&
                            requestHeaders.containsKey("User-Agent"))
                    {
                        String[] userAgents = requestHeaders.get("User-Agent");
                        userAgent = userAgents.length > 0 ? userAgents[0] : null;
                    }
                }
            }
        }

        return userAgent;
    }
421256
public Agent newAgent(QualifiedName ag) {
	Agent res = of.createAgent();
	res.setId(ag);
	return res;
    }
683508
public static ApiUser getUserAgent(User sfsUser) {
        Object userAgent = sfsUser.getProperty(APIKey.USER);
        if(userAgent == null) 
            throw new RuntimeException("Can not get user agent");
        return (ApiUser)userAgent;
    }
631604
public RegionPageSectionBuilder region(final PageSectionContent.Region region) {
		switch (region) {
		case LEFT: // Use left region
			this.curRegionBox = this.leftRegionBox;
			break;
		case CENTER: // Use center region
			this.curRegionBox = this.centerRegionBox;
			break;
		case RIGHT: // Use right region
			this.curRegionBox = this.rightRegionBox;
			break;
		default: // Invalid footerRegionValue, use center region as default
			throw new IllegalStateException();
		}
		return this;
	}
1027050
def get_create_agent(agent_kwargs):
  

  def create_agent(sess, environment, summary_writer=None):
    """Creates a DQN agent.

    Simplified version of `dopamine.discrete_domains.train.create_agent`

    Args:
      sess: a session
      environment: an environment
      summary_writer: a summary writer.

    Returns:
      a DQN agent.
    """
    return BatchDQNAgent(
        env_batch_size=environment.batch_size,
        sess=sess,
        num_actions=environment.action_space.n,
        summary_writer=summary_writer,
        tf_device="/gpu:*",
        **agent_kwargs)

  return create_agent
1356730
public AgentRoster getAgentRoster() throws NotConnectedException, InterruptedException {
        if (agentRoster == null) {
            agentRoster = new AgentRoster(connection, workgroupJID);
        }

        // This might be the first time the user has asked for the roster. If so, we
        // want to wait up to 2 seconds for the server to send back the list of agents.
        // This behavior shields API users from having to worry about the fact that the
        // operation is asynchronous, although they'll still have to listen for changes
        // to the roster.
        int elapsed = 0;
        while (!agentRoster.rosterInitialized && elapsed <= 2000) {
            try {
                Thread.sleep(500);
            }
            catch (Exception e) {
                // Ignore
            }
            elapsed += 500;
        }
        return agentRoster;
    }
463994
function Region(name, state) {
        var _this = _super.call(this, name, state) || this;
        /** The [[Vertex]] instances that are children of this [[Region]]. */
        _this.vertices = new Array();
        _this.parent.regions.push(_this);
        _this.getRoot().clean = false;
        return _this;
    }
105408
static byte[] generateAgentJson(String agent, long coreId, long channelId) throws Exception {
        String id = paddedHex(coreId) + "/" + paddedHex(channelId);
        if (agent.length() > 200) {
            agent = agent.substring(0, 200);
        }

        HashMap<String, String> result = new HashMap<String, String>();
        result.put("a", agent);
        result.put("i", id);
        return DefaultObjectMapper.writeValueAsBytes(result);
    }
297306
public ImageDescriptor image(SarlAgent agent) {
		final JvmDeclaredType jvmElement = this.jvmModelAssociations.getInferredType(agent);
		return this.images.forAgent(
				agent.getVisibility(),
				this.adornments.get(jvmElement));
	}
59267
function createExecutor(url) {
  let agent = new http.Agent({ keepAlive: true });
  let client = url.then(url => new http.HttpClient(url, agent));
  let executor = new http.Executor(client);
  configureExecutor(executor);
  return executor;
}
1276018
@Override
    public void loadAgent(String agent, String options)
        throws AgentLoadException, AgentInitializationException, IOException
    {
        String args = agent;
        if (options != null) {
            args = args + "=" + options;
        }
        try {
            loadAgentLibrary("instrument", args);
        } catch (AgentLoadException x) {
            throw new InternalError("instrument library is missing in target VM");
        } catch (AgentInitializationException x) {
            /*
             * Translate interesting errors into the right exception and
             * message (FIXME: create a better interface to the instrument
             * implementation so this isn't necessary)
             */
            int rc = x.returnValue();
            switch (rc) {
                case JNI_ENOMEM:
                    throw new AgentLoadException("Insuffient memory");
                case ATTACH_ERROR_BADJAR:
                    throw new AgentLoadException("Agent JAR not found or no Agent-Class attribute");
                case ATTACH_ERROR_NOTONCP:
                    throw new AgentLoadException("Unable to add JAR file to system class path");
                case ATTACH_ERROR_STARTFAIL:
                    throw new AgentInitializationException("Agent JAR loaded but agent failed to initialize");
                default :
                    throw new AgentLoadException("Failed to load agent - unknown reason: " + rc);
            }
        }
    }
677574
public void addRegion(InfinispanBaseRegion region) {
		allRegions.put(ByteString.fromString(region.getCache().getName()), region);
	}
1218276
function Agent(options) {
  EventEmitter.call(this);
  this.setMaxListeners(0);

  options = assign({}, options);

  this._settings = options.settings;
  this._log = (options.log || defaultLogger).child({ component: 'http' });
  this.endpoints = {};

  // * Using an own HTTPS agent, because the global agent does not look at `NPN/ALPNProtocols` when
  //   generating the key identifying the connection, so we may get useless non-negotiated TLS
  //   channels even if we ask for a negotiated one. This agent will contain only negotiated
  //   channels.
  options.ALPNProtocols = supportedProtocols;
  options.NPNProtocols = supportedProtocols;
  this._httpsAgent = new https.Agent(options);

  this.sockets = this._httpsAgent.sockets;
  this.requests = this._httpsAgent.requests;
}