text:
package com.google.cloud.compute.v1;

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.compute.v1.stub.FirewallsStub;
import com.google.cloud.compute.v1.stub.FirewallsStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * Service Description: The Firewalls API.
 *
 *
This class provides the ability to make remote calls to the backing service through method
 * calls that map to API methods. Sample code to get started:
 *
 *
{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
 *   String project = "project-309310695";
 *   String firewall = "firewall-562725632";
 *   Firewall response = firewallsClient.get(project, firewall);
 * }
 * }

 *
 *
Note: close() needs to be called on the FirewallsClient object to clean up resources such as
 * threads. In the example above, try-with-resources is used, which automatically calls close().
 *
 *
The surface of this class includes several types of Java methods for each of the API's
 * methods:
 *
 *

 *
A "flattened" method. With this type of method, the fields of the request type have been
 *       converted into function parameters. It may be the case that not all fields are available as
 *       parameters, and not every API method will have a flattened method entry point.
 *
A "request object" method. This type of method only takes one parameter, a request object,
 *       which must be constructed before the call. Not every API method will have a request object
 *       method.
 *
A "callable" method. This type of method takes no parameters and returns an immutable API
 *       callable object, which can be used to initiate calls to the service.
 *

 *
 *
See the individual methods for example code.
 *
 *
Many parameters require resource names to be formatted in a particular way. To assist with
 * these names, this class includes a format method for each type of name, and additionally a parse
 * method to extract the individual identifiers contained within names that are returned.
 *
 *
This class can be customized by passing in a custom instance of FirewallsSettings to create().
 * For example:
 *
 *
To customize credentials:
 *
 *
{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * FirewallsSettings firewallsSettings =
 *     FirewallsSettings.newBuilder()
 *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
 *         .build();
 * FirewallsClient firewallsClient = FirewallsClient.create(firewallsSettings);
 * }

 *
 *
To customize the endpoint:
 *
 *
{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * FirewallsSettings firewallsSettings =
 *     FirewallsSettings.newBuilder().setEndpoint(myEndpoint).build();
 * FirewallsClient firewallsClient = FirewallsClient.create(firewallsSettings);
 * }

 *
 *
Please refer to the GitHub repository's samples for more quickstart code snippets.
 */
@Generated("by gapic-generator-java")
public class FirewallsClient implements BackgroundResource {
  private final FirewallsSettings settings;
  private final FirewallsStub stub;

  /** Constructs an instance of FirewallsClient with default settings. */
  public static final FirewallsClient create() throws IOException {
    return create(FirewallsSettings.newBuilder().build());
  }

  /**
   * Constructs an instance of FirewallsClient, using the given settings. The channels are created
   * based on the settings passed in, or defaults for any settings that are not set.
   */
  public static final FirewallsClient create(FirewallsSettings settings) throws IOException {
    return new FirewallsClient(settings);
  }

  /**
   * Constructs an instance of FirewallsClient, using the given stub for making calls. This is for
   * advanced usage - prefer using create(FirewallsSettings).
   */
  public static final FirewallsClient create(FirewallsStub stub) {
    return new FirewallsClient(stub);
  }

  /**
   * Constructs an instance of FirewallsClient, using the given settings. This is protected so that
   * it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
   */
  protected FirewallsClient(FirewallsSettings settings) throws IOException {
    this.settings = settings;
    this.stub = ((FirewallsStubSettings) settings.getStubSettings()).createStub();
  }

  protected FirewallsClient(FirewallsStub stub) {
    this.settings = null;
    this.stub = stub;
  }

  public final FirewallsSettings getSettings() {
    return settings;
  }

  public FirewallsStub getStub() {
    return stub;
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Deletes the specified firewall.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   String project = "project-309310695";
   *   String firewall = "firewall-562725632";
   *   Operation response = firewallsClient.deleteAsync(project, firewall).get();
   * }
   * }

   *
   * @param project Project ID for this request.
   * @param firewall Name of the firewall rule to delete.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final OperationFuture<Operation, Operation> deleteAsync(String project, String firewall) {
    DeleteFirewallRequest request =
        DeleteFirewallRequest.newBuilder().setProject(project).setFirewall(firewall).build();
    return deleteAsync(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Deletes the specified firewall.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   DeleteFirewallRequest request =
   *       DeleteFirewallRequest.newBuilder()
   *           .setFirewall("firewall-562725632")
   *           .setProject("project-309310695")
   *           .setRequestId("requestId693933066")
   *           .build();
   *   Operation response = firewallsClient.deleteAsync(request).get();
   * }
   * }

   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  @BetaApi(
      "The surface for long-running operations is not stable yet and may change in the future.")
  public final OperationFuture<Operation, Operation> deleteAsync(DeleteFirewallRequest request) {
    return deleteOperationCallable().futureCall(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Deletes the specified firewall.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   DeleteFirewallRequest request =
   *       DeleteFirewallRequest.newBuilder()
   *           .setFirewall("firewall-562725632")
   *           .setProject("project-309310695")
   *           .setRequestId("requestId693933066")
   *           .build();
   *   OperationFuture<Operation, Operation> future =
   *       firewallsClient.deleteOperationCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }

   */
  public final OperationCallable<DeleteFirewallRequest, Operation, Operation>
      deleteOperationCallable() {
    return stub.deleteOperationCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Deletes the specified firewall.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   DeleteFirewallRequest request =
   *       DeleteFirewallRequest.newBuilder()
   *           .setFirewall("firewall-562725632")
   *           .setProject("project-309310695")
   *           .setRequestId("requestId693933066")
   *           .build();
   *   ApiFuture<Operation> future = firewallsClient.deleteCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }

   */
  public final UnaryCallable<DeleteFirewallRequest, Operation> deleteCallable() {
    return stub.deleteCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Returns the specified firewall.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   String project = "project-309310695";
   *   String firewall = "firewall-562725632";
   *   Firewall response = firewallsClient.get(project, firewall);
   * }
   * }

   *
   * @param project Project ID for this request.
   * @param firewall Name of the firewall rule to return.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Firewall get(String project, String firewall) {
    GetFirewallRequest request =
        GetFirewallRequest.newBuilder().setProject(project).setFirewall(firewall).build();
    return get(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Returns the specified firewall.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   GetFirewallRequest request =
   *       GetFirewallRequest.newBuilder()
   *           .setFirewall("firewall-562725632")
   *           .setProject("project-309310695")
   *           .build();
   *   Firewall response = firewallsClient.get(request);
   * }
   * }

   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Firewall get(GetFirewallRequest request) {
    return getCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Returns the specified firewall.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   GetFirewallRequest request =
   *       GetFirewallRequest.newBuilder()
   *           .setFirewall("firewall-562725632")
   *           .setProject("project-309310695")
   *           .build();
   *   ApiFuture<Firewall> future = firewallsClient.getCallable().futureCall(request);
   *   // Do something.
   *   Firewall response = future.get();
   * }
   * }

   */
  public final UnaryCallable<GetFirewallRequest, Firewall> getCallable() {
    return stub.getCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a firewall rule in the specified project using the data included in the request.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   String project = "project-309310695";
   *   Firewall firewallResource = Firewall.newBuilder().build();
   *   Operation response = firewallsClient.insertAsync(project, firewallResource).get();
   * }
   * }

   *
   * @param project Project ID for this request.
   * @param firewallResource The body resource for this request
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final OperationFuture<Operation, Operation> insertAsync(
      String project, Firewall firewallResource) {
    InsertFirewallRequest request =
        InsertFirewallRequest.newBuilder()
            .setProject(project)
            .setFirewallResource(firewallResource)
            .build();
    return insertAsync(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a firewall rule in the specified project using the data included in the request.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   InsertFirewallRequest request =
   *       InsertFirewallRequest.newBuilder()
   *           .setFirewallResource(Firewall.newBuilder().build())
   *           .setProject("project-309310695")
   *           .setRequestId("requestId693933066")
   *           .build();
   *   Operation response = firewallsClient.insertAsync(request).get();
   * }
   * }

   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  @BetaApi(
      "The surface for long-running operations is not stable yet and may change in the future.")
  public final OperationFuture<Operation, Operation> insertAsync(InsertFirewallRequest request) {
    return insertOperationCallable().futureCall(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a firewall rule in the specified project using the data included in the request.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   InsertFirewallRequest request =
   *       InsertFirewallRequest.newBuilder()
   *           .setFirewallResource(Firewall.newBuilder().build())
   *           .setProject("project-309310695")
   *           .setRequestId("requestId693933066")
   *           .build();
   *   OperationFuture<Operation, Operation> future =
   *       firewallsClient.insertOperationCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }

   */
  public final OperationCallable<InsertFirewallRequest, Operation, Operation>
      insertOperationCallable() {
    return stub.insertOperationCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a firewall rule in the specified project using the data included in the request.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   InsertFirewallRequest request =
   *       InsertFirewallRequest.newBuilder()
   *           .setFirewallResource(Firewall.newBuilder().build())
   *           .setProject("project-309310695")
   *           .setRequestId("requestId693933066")
   *           .build();
   *   ApiFuture<Operation> future = firewallsClient.insertCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }

   */
  public final UnaryCallable<InsertFirewallRequest, Operation> insertCallable() {
    return stub.insertCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Retrieves the list of firewall rules available to the specified project.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   String project = "project-309310695";
   *   for (Firewall element : firewallsClient.list(project).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }

   *
   * @param project Project ID for this request.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final ListPagedResponse list(String project) {
    ListFirewallsRequest request = ListFirewallsRequest.newBuilder().setProject(project).build();
    return list(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Retrieves the list of firewall rules available to the specified project.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   ListFirewallsRequest request =
   *       ListFirewallsRequest.newBuilder()
   *           .setFilter("filter-1274492040")
   *           .setMaxResults(1128457243)
   *           .setOrderBy("orderBy-1207110587")
   *           .setPageToken("pageToken873572522")
   *           .setProject("project-309310695")
   *           .setReturnPartialSuccess(true)
   *           .build();
   *   for (Firewall element : firewallsClient.list(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }

   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final ListPagedResponse list(ListFirewallsRequest request) {
    return listPagedCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Retrieves the list of firewall rules available to the specified project.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   ListFirewallsRequest request =
   *       ListFirewallsRequest.newBuilder()
   *           .setFilter("filter-1274492040")
   *           .setMaxResults(1128457243)
   *           .setOrderBy("orderBy-1207110587")
   *           .setPageToken("pageToken873572522")
   *           .setProject("project-309310695")
   *           .setReturnPartialSuccess(true)
   *           .build();
   *   ApiFuture<Firewall> future = firewallsClient.listPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Firewall element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }

   */
  public final UnaryCallable<ListFirewallsRequest, ListPagedResponse> listPagedCallable() {
    return stub.listPagedCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Retrieves the list of firewall rules available to the specified project.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   ListFirewallsRequest request =
   *       ListFirewallsRequest.newBuilder()
   *           .setFilter("filter-1274492040")
   *           .setMaxResults(1128457243)
   *           .setOrderBy("orderBy-1207110587")
   *           .setPageToken("pageToken873572522")
   *           .setProject("project-309310695")
   *           .setReturnPartialSuccess(true)
   *           .build();
   *   while (true) {
   *     FirewallList response = firewallsClient.listCallable().call(request);
   *     for (Firewall element : response.getItemsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }

   */
  public final UnaryCallable<ListFirewallsRequest, FirewallList> listCallable() {
    return stub.listCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Updates the specified firewall rule with the data included in the request. This method supports
   * PATCH semantics and uses the JSON merge patch format and processing rules.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   String project = "project-309310695";
   *   String firewall = "firewall-562725632";
   *   Firewall firewallResource = Firewall.newBuilder().build();
   *   Operation response = firewallsClient.patchAsync(project, firewall, firewallResource).get();
   * }
   * }

   *
   * @param project Project ID for this request.
   * @param firewall Name of the firewall rule to patch.
   * @param firewallResource The body resource for this request
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final OperationFuture<Operation, Operation> patchAsync(
      String project, String firewall, Firewall firewallResource) {
    PatchFirewallRequest request =
        PatchFirewallRequest.newBuilder()
            .setProject(project)
            .setFirewall(firewall)
            .setFirewallResource(firewallResource)
            .build();
    return patchAsync(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Updates the specified firewall rule with the data included in the request. This method supports
   * PATCH semantics and uses the JSON merge patch format and processing rules.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   PatchFirewallRequest request =
   *       PatchFirewallRequest.newBuilder()
   *           .setFirewall("firewall-562725632")
   *           .setFirewallResource(Firewall.newBuilder().build())
   *           .setProject("project-309310695")
   *           .setRequestId("requestId693933066")
   *           .build();
   *   Operation response = firewallsClient.patchAsync(request).get();
   * }
   * }

   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  @BetaApi(
      "The surface for long-running operations is not stable yet and may change in the future.")
  public final OperationFuture<Operation, Operation> patchAsync(PatchFirewallRequest request) {
    return patchOperationCallable().futureCall(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Updates the specified firewall rule with the data included in the request. This method supports
   * PATCH semantics and uses the JSON merge patch format and processing rules.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   PatchFirewallRequest request =
   *       PatchFirewallRequest.newBuilder()
   *           .setFirewall("firewall-562725632")
   *           .setFirewallResource(Firewall.newBuilder().build())
   *           .setProject("project-309310695")
   *           .setRequestId("requestId693933066")
   *           .build();
   *   OperationFuture<Operation, Operation> future =
   *       firewallsClient.patchOperationCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }

   */
  public final OperationCallable<PatchFirewallRequest, Operation, Operation>
      patchOperationCallable() {
    return stub.patchOperationCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Updates the specified firewall rule with the data included in the request. This method supports
   * PATCH semantics and uses the JSON merge patch format and processing rules.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   PatchFirewallRequest request =
   *       PatchFirewallRequest.newBuilder()
   *           .setFirewall("firewall-562725632")
   *           .setFirewallResource(Firewall.newBuilder().build())
   *           .setProject("project-309310695")
   *           .setRequestId("requestId693933066")
   *           .build();
   *   ApiFuture<Operation> future = firewallsClient.patchCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }

   */
  public final UnaryCallable<PatchFirewallRequest, Operation> patchCallable() {
    return stub.patchCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Updates the specified firewall rule with the data included in the request. Note that all fields
   * will be updated if using PUT, even fields that are not specified. To update individual fields,
   * please use PATCH instead.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   String project = "project-309310695";
   *   String firewall = "firewall-562725632";
   *   Firewall firewallResource = Firewall.newBuilder().build();
   *   Operation response = firewallsClient.updateAsync(project, firewall, firewallResource).get();
   * }
   * }

   *
   * @param project Project ID for this request.
   * @param firewall Name of the firewall rule to update.
   * @param firewallResource The body resource for this request
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final OperationFuture<Operation, Operation> updateAsync(
      String project, String firewall, Firewall firewallResource) {
    UpdateFirewallRequest request =
        UpdateFirewallRequest.newBuilder()
            .setProject(project)
            .setFirewall(firewall)
            .setFirewallResource(firewallResource)
            .build();
    return updateAsync(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Updates the specified firewall rule with the data included in the request. Note that all fields
   * will be updated if using PUT, even fields that are not specified. To update individual fields,
   * please use PATCH instead.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   UpdateFirewallRequest request =
   *       UpdateFirewallRequest.newBuilder()
   *           .setFirewall("firewall-562725632")
   *           .setFirewallResource(Firewall.newBuilder().build())
   *           .setProject("project-309310695")
   *           .setRequestId("requestId693933066")
   *           .build();
   *   Operation response = firewallsClient.updateAsync(request).get();
   * }
   * }

   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  @BetaApi(
      "The surface for long-running operations is not stable yet and may change in the future.")
  public final OperationFuture<Operation, Operation> updateAsync(UpdateFirewallRequest request) {
    return updateOperationCallable().futureCall(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Updates the specified firewall rule with the data included in the request. Note that all fields
   * will be updated if using PUT, even fields that are not specified. To update individual fields,
   * please use PATCH instead.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   UpdateFirewallRequest request =
   *       UpdateFirewallRequest.newBuilder()
   *           .setFirewall("firewall-562725632")
   *           .setFirewallResource(Firewall.newBuilder().build())
   *           .setProject("project-309310695")
   *           .setRequestId("requestId693933066")
   *           .build();
   *   OperationFuture<Operation, Operation> future =
   *       firewallsClient.updateOperationCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }

   */
  public final OperationCallable<UpdateFirewallRequest, Operation, Operation>
      updateOperationCallable() {
    return stub.updateOperationCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Updates the specified firewall rule with the data included in the request. Note that all fields
   * will be updated if using PUT, even fields that are not specified. To update individual fields,
   * please use PATCH instead.
   *
   *
Sample code:
   *
   *
{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (FirewallsClient firewallsClient = FirewallsClient.create()) {
   *   UpdateFirewallRequest request =
   *       UpdateFirewallRequest.newBuilder()
   *           .setFirewall("firewall-562725632")
   *           .setFirewallResource(Firewall.newBuilder().build())
   *           .setProject("project-309310695")
   *           .setRequestId("requestId693933066")
   *           .build();
   *   ApiFuture<Operation> future = firewallsClient.updateCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }

   */
  public final UnaryCallable<UpdateFirewallRequest, Operation> updateCallable() {
    return stub.updateCallable();
  }

  @Override
  public final void close() {
    stub.close();
  }

  @Override
  public void shutdown() {
    stub.shutdown();
  }

  @Override
  public boolean isShutdown() {
    return stub.isShutdown();
  }

  @Override
  public boolean isTerminated() {
    return stub.isTerminated();
  }

  @Override
  public void shutdownNow() {
    stub.shutdownNow();
  }

  @Override
  public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
    return stub.awaitTermination(duration, unit);
  }

  public static class ListPagedResponse
      extends AbstractPagedListResponse<
          ListFirewallsRequest, FirewallList, Firewall, ListPage, ListFixedSizeCollection> {

    public static ApiFuture<ListPagedResponse> createAsync(
        PageContext<ListFirewallsRequest, FirewallList, Firewall> context,
        ApiFuture<FirewallList> futureResponse) {
      ApiFuture<ListPage> futurePage =
          ListPage.createEmptyPage().createPageAsync(context, futureResponse);
      return ApiFutures.transform(
          futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor());
    }

    private ListPagedResponse(ListPage page) {
      super(page, ListFixedSizeCollection.createEmptyCollection());
    }
  }

  public static class ListPage
      extends AbstractPage<ListFirewallsRequest, FirewallList, Firewall, ListPage> {

    private ListPage(
        PageContext<ListFirewallsRequest, FirewallList, Firewall> context, FirewallList response) {
      super(context, response);
    }

    private static ListPage createEmptyPage() {
      return new ListPage(null, null);
    }

    @Override
    protected ListPage createPage(
        PageContext<ListFirewallsRequest, FirewallList, Firewall> context, FirewallList response) {
      return new ListPage(context, response);
    }

    @Override
    public ApiFuture<ListPage> createPageAsync(
        PageContext<ListFirewallsRequest, FirewallList, Firewall> context,
        ApiFuture<FirewallList> futureResponse) {
      return super.createPageAsync(context, futureResponse);
    }
  }

  public static class ListFixedSizeCollection
      extends AbstractFixedSizeCollection<
          ListFirewallsRequest, FirewallList, Firewall, ListPage, ListFixedSizeCollection> {

    private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) {
      super(pages, collectionSize);
    }

    private static ListFixedSizeCollection createEmptyCollection() {
      return new ListFixedSizeCollection(null, 0);
    }

    @Override
    protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) {
      return new ListFixedSizeCollection(pages, collectionSize);
    }
  }
}


text:
This repository contains sample code demonstrated during Cocoa Conf Boston 2014.

- **NetworkingDemo** is a kitchen-sink project containing various topics of iOS Networking
- **CoffeeTracker** is a Today Extension to track coffee consumption.  Uses a shared class and App Groups to share NSUserDefaults
- **FoodBook** is an app to share photos on a fake social network
- **Catify** demonstrates an Action Extension that requires pictures on a web page to animated cat gifs.

redpajama_set_name: RedPajamaGithub


text:
ENGINE.Powerup = function(args) {

  Utils.extend(this, {
    type: "medikit" /* default color if none is provided */
  }, args);

  this.sprites = {
    "medikit": [103, 66, 15, 15]
  };

  this.sprite = this.sprites[this.type];

  this.width = this.sprite[2];
  this.height = this.sprite[3];
  this.radius = Math.min(this.width, this.height) / 2 | 0;

};

ENGINE.Powerup.prototype = {

  constructor: ENGINE.Coin,

  collidable: true,

  collision: function(object) {

    if (object instanceof ENGINE.Player) {

      object.powerUp(this);
      this.collection.remove(this);

    }

  },

  step: function(delta) {
  },

  render: function(delta) {
    app.layer.drawRegion(app.images.spritesheet, this.sprite, this.x, this.y);
  }

};


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.fetchPushCertificates = exports.ensureAppId = exports.fetchAppleCertificates = exports.validateCredentialsForPlatform = exports.removeCredentialsForPlatform = exports.updateCredentialsForPlatform = exports.getCredentialsForPlatform = exports.credentialsExistForPlatformAsync = undefined;

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

let credentialsExistForPlatformAsync = exports.credentialsExistForPlatformAsync = (() => {
  var _ref = _asyncToGenerator(function* (metadata) {
    return fetchCredentials(metadata, false);
  });

  return function credentialsExistForPlatformAsync(_x) {
    return _ref.apply(this, arguments);
  };
})();

let getCredentialsForPlatform = exports.getCredentialsForPlatform = (() => {
  var _ref2 = _asyncToGenerator(function* (metadata) {
    return fetchCredentials(metadata, true);
  });

  return function getCredentialsForPlatform(_x2) {
    return _ref2.apply(this, arguments);
  };
})();

let fetchCredentials = (() => {
  var _ref3 = _asyncToGenerator(function* ({ username, experienceName, bundleIdentifier, platform }, decrypt) {
    // this doesn't hit our mac rpc channel, so it needs significantly less debugging
    const {
      err,
      credentials
    } = yield (_Api || _load_Api()).default.callMethodAsync('getCredentials', [], 'post', {
      username,
      experienceName,
      bundleIdentifier,
      platform,
      decrypt
    });

    if (err) {
      throw new Error('Error fetching credentials.');
    }

    return credentials;
  });

  return function fetchCredentials(_x3, _x4) {
    return _ref3.apply(this, arguments);
  };
})();

let updateCredentialsForPlatform = exports.updateCredentialsForPlatform = (() => {
  var _ref4 = _asyncToGenerator(function* (platform, newCredentials, metadata) {
    // this doesn't go through the mac rpc, no request id needed
    const {
      err,
      credentials
    } = yield (_Api || _load_Api()).default.callMethodAsync('updateCredentials', [], 'post', _extends({
      credentials: newCredentials,
      platform
    }, metadata));

    if (err || !credentials) {
      throw new Error('Error updating credentials.');
    }

    return;
  });

  return function updateCredentialsForPlatform(_x5, _x6, _x7) {
    return _ref4.apply(this, arguments);
  };
})();

let removeCredentialsForPlatform = exports.removeCredentialsForPlatform = (() => {
  var _ref5 = _asyncToGenerator(function* (platform, metadata) {
    // doesn't go through mac rpc, no request id needed
    const { err } = yield (_Api || _load_Api()).default.callMethodAsync('deleteCredentials', [], 'post', _extends({
      platform
    }, metadata));

    if (err) {
      throw new Error('Error deleting credentials.');
    }

    return;
  });

  return function removeCredentialsForPlatform(_x8, _x9) {
    return _ref5.apply(this, arguments);
  };
})();

let validateCredentialsForPlatform = exports.validateCredentialsForPlatform = (() => {
  var _ref6 = _asyncToGenerator(function* (platform, validationType, credentials, metadata) {
    const {
      requestId,
      isValid,
      error,
      errorCode,
      errorMessage
    } = yield (_Api || _load_Api()).default.callMethodAsync('validateCredentials', [], 'post', _extends({
      credentials,
      platform,
      validationType
    }, metadata));

    if (!isValid || error) {
      throw new (_XDLError || _load_XDLError()).default(errorCode, `Unable to validate credentials. Request ID ${requestId}, message: ${errorMessage}`);
    }

    return;
  });

  return function validateCredentialsForPlatform(_x10, _x11, _x12, _x13) {
    return _ref6.apply(this, arguments);
  };
})();

let fetchAppleCertificates = exports.fetchAppleCertificates = (() => {
  var _ref7 = _asyncToGenerator(function* (metadata) {
    const {
      requestId,
      err,
      success,
      error,
      errorCode,
      errorMessage
    } = yield (_Api || _load_Api()).default.callMethodAsync('fetchAppleCertificates', [], 'post', _extends({}, metadata));

    if (err || !success || error) {
      throw new (_XDLError || _load_XDLError()).default(errorCode, `Unable to fetch distribution certificate. Request ID ${requestId}, message: ${errorMessage}`);
    }

    return success;
  });

  return function fetchAppleCertificates(_x14) {
    return _ref7.apply(this, arguments);
  };
})();

let ensureAppId = exports.ensureAppId = (() => {
  var _ref8 = _asyncToGenerator(function* (metadata) {
    const {
      requestId,
      err,
      success,
      errorCode,
      errorMessage
    } = yield (_Api || _load_Api()).default.callMethodAsync('ensureAppId', [], 'post', _extends({}, metadata));

    if (err || !success) {
      throw new (_XDLError || _load_XDLError()).default(errorCode, `Unable to create app id. Request ID ${requestId}, message: ${errorMessage}`);
    }

    return success;
  });

  return function ensureAppId(_x15) {
    return _ref8.apply(this, arguments);
  };
})();

let fetchPushCertificates = exports.fetchPushCertificates = (() => {
  var _ref9 = _asyncToGenerator(function* (metadata) {
    const result = yield (_Api || _load_Api()).default.callMethodAsync('fetchPushCertificates', [], 'post', _extends({}, metadata));

    if (result.err || !result.success) {
      throw new (_XDLError || _load_XDLError()).default(result.errorCode, `Unable to fetch push certificate. Request ID ${result.requestId}, message: ${result.errorMessage}`);
    }

    return result.success;
  });

  return function fetchPushCertificates(_x16) {
    return _ref9.apply(this, arguments);
  };
})();

var _Api;

function _load_Api() {
  return _Api = _interopRequireDefault(require('./Api'));
}

var _XDLError;

function _load_XDLError() {
  return _XDLError = _interopRequireDefault(require('./XDLError'));
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
//# sourceMappingURL=__sourcemaps__/Credentials.js.map


text:
<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="filter">
		<field
			name="search"
			type="text"
			label="COM_CONTACT_FILTER_SEARCH_DESC"
			description="COM_CONTACT_FILTER_SEARCH_DESC"
			hint="JSEARCH_FILTER"
		/>
		<field
			name="published"
			type="status"
			label="JOPTION_SELECT_PUBLISHED"
			description="JOPTION_SELECT_PUBLISHED_DESC"
			onchange="this.form.submit();"
			>
			<option value="">JOPTION_SELECT_PUBLISHED</option>
		</field>
		<field
			name="category_id"
			type="category"
			label="JOPTION_FILTER_CATEGORY"
			extension="com_contact"
			description="JOPTION_FILTER_CATEGORY_DESC"
			onchange="this.form.submit();"
			published="0,1,2"
			>
			<option value="">JOPTION_SELECT_CATEGORY</option>
		</field>
		<field
			name="access"
			type="accesslevel"
			label="JOPTION_FILTER_ACCESS"
			description="JOPTION_FILTER_ACCESS_DESC"
			onchange="this.form.submit();"
			>
			<option value="">JOPTION_SELECT_ACCESS</option>
		</field>
		<field
			name="language"
			type="contentlanguage"
			label="JOPTION_FILTER_LANGUAGE"
			description="JOPTION_FILTER_LANGUAGE_DESC"
			onchange="this.form.submit();"
			>
			<option value="">JOPTION_SELECT_LANGUAGE</option>
			<option value="*">JALL</option>
		</field>
		<field
			name="tag"
			type="tag"
			mode="nested"
			label="JOPTION_FILTER_TAG"
			description="JOPTION_FILTER_TAG_DESC"
			onchange="this.form.submit();"
		>
			<option value="">JOPTION_SELECT_TAG</option>
		</field>
	</fields>
	<fields name="list">
		<field
			name="fullordering"
			type="list"
			label="COM_CONTACT_LIST_FULL_ORDERING"
			description="COM_CONTACT_LIST_FULL_ORDERING_DESC"
			onchange="this.form.submit();"
			default="a.name ASC"
			>
			<option value="">JGLOBAL_SORT_BY</option>
			<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
			<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
			<option value="a.published ASC">JSTATUS_ASC</option>
			<option value="a.published DESC">JSTATUS_DESC</option>
			<option value="a.name ASC">JGLOBAL_TITLE_ASC</option>
			<option value="a.name DESC">JGLOBAL_TITLE_DESC</option>
			<option value="category_title ASC">JCATEGORY_ASC</option>
			<option value="category_title DESC">JCATEGORY_DESC</option>
			<option value="ul.name ASC">COM_CONTACT_FIELD_LINKED_USER_LABEL_ASC</option>
			<option value="ul.name DESC">COM_CONTACT_FIELD_LINKED_USER_LABEL_DESC</option>
			<option value="a.featured ASC">JFEATURED_ASC</option>
			<option value="a.featured DESC">JFEATURED_DESC</option>
			<option value="a.access ASC">JGRID_HEADING_ACCESS_ASC</option>
			<option value="a.access DESC">JGRID_HEADING_ACCESS_DESC</option>
			<option value="a.language ASC">JGRID_HEADING_LANGUAGE_ASC</option>
			<option value="a.language DESC">JGRID_HEADING_LANGUAGE_DESC</option>
			<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
			<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>

		</field>
		<field
			name="limit"
			type="limitbox"
			class="input-mini"
			default="25"
			label="COM_CONTACT_LIST_LIMIT"
			description="COM_CONTACT_LIST_LIMIT_DESC"
			onchange="this.form.submit();"
		/>
	</fields>
</form>


text:
"""Run a local demo of the server-annotator system.

Performs the following:
- Starts the CMS server
- Uploads some audio content
- Restarts the CMS server
- Holds until the user shuts down the demo.

Note: It is advisable to use a private / incognito browser session to avoid
caching behavior, which can cause the web app to use stale source files.
"""
from __future__ import print_function

import argparse
import atexit
from builtins import input
import logging
import os
import requests
from requests.packages.urllib3.util.retry import Retry
from requests.adapters import HTTPAdapter
import signal
import subprocess

SERVER_PORT = 8080
PROCESSES = []

def kill(*proccesses):
    """Kills a list of processes.

    Parameters
    ----------
    processes: list
        List of process ids to be killed.
    """
    for proc in proccesses:
        os.killpg(os.getpgid(proc.pid), signal.SIGTERM)

@atexit.register
def kill_all():
    kill(*PROCESSES)

def launch_cms(port, noauth=False, max_retries=8):
    """Thin wrapper around kick-starting the CMS server.

    Parameters
    ----------
    port : int
        Port for running the server locally.

    noauth : bool, default=False
        If True, do not use authentication.

    Returns
    -------
    pid : int
        Process ID of the server.
    """
    flags = ['--debug']
    if noauth:
        flags += ['--noauth']

    cmd = "python {} --port {} --config {} {}".format(
        os.path.join('backend_server', 'main.py'), port,
        os.path.join('backend_server', '.config-local.yaml'), " ".join(flags))
    logging.info("server: {}".format(cmd))
    server = subprocess.Popen(cmd.split(" "), stdout=subprocess.PIPE,
                              preexec_fn=os.setsid)

    # Test that the server is on; will raise an exception after enough attempts
    session = requests.Session()
    adapter = HTTPAdapter(max_retries=Retry(total=max_retries,
                                            backoff_factor=0.1))
    session.mount('http://', adapter)
    try:
        session.get('http://localhost:{}'.format(port))
    except requests.exceptions.ConnectionError:
        kill(server)
        raise EnvironmentError(
            "Unable to confirm that the server started successfully.")
    return server

def run(port):
    """Main process to run the demo.

    Parameters
    ----------
    port: int
        Server port number.
    """
    # Some sanity checks
    if not os.path.isdir("backend_server"):
        raise EnvironmentError(
            "This script must be launched from OpenMic's root directory.")
    if not os.path.isdir("audio-annotator"):
        raise EnvironmentError("Audio Annotator not found: please run:\n\t"
                               "git submodule update --init")

    # Run the server
    server = launch_cms(port, noauth=True)

    # Upload audio to the server
    fnames = ["267508__mickleness__3nf.ogg",
              "345515__furbyguy__strings-piano.ogg"]
    for fn in fnames:
        fpath = os.path.abspath(os.path.join('data', 'audio', fn))
        requests.post('http://localhost:{}/api/v0.1/audio'.format(port),
                      files=dict(audio=open(fpath, 'rb')))
    kill(server)

    # Run the two servers
    PROCESSES.append(launch_cms(port, noauth=False))
    logging.info("Now serving at: http://localhost:{}".format(port))
    try:
        input("Press return to exit.\n")
    except KeyboardInterrupt:
        # Capturing Ctrl-C, to make sure we always shutdown the server
        pass
    logging.info("Shutting down server")

if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description="Run a local demo of the server-annotator system.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("-p",
                        dest="port",
                        default=SERVER_PORT,
                        type=int,
                        help="Server port number")
    args = parser.parse_args()

    # Setup the logger
    logging.basicConfig(format='%(asctime)s: %(levelname)s: %(message)s',
                        level=logging.INFO)

    # Call main process
    run(args.port)


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

        <meta http-equiv="X-UA-Compatible" content="IE=edge">

        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.9.1"/>

        <title>Traffic Assignment frameworK (TAsK): InitialiseSolution.h Source File</title>

        <link href="search/search.css" rel="stylesheet" type="text/css"/>

        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

                    Traffic Assignment frameworK (TAsK)

Main Page

Related Pages

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

InitialiseSolution.h

    1 #ifndef _INITIALISE_SOLUTION_

    2 #define _INITIALISE_SOLUTION_

    3

    4 #include "ShortestPath.h"

    5 #include "PairOD.h"

    6

    7 #include <stdlib.h>

    8 #include <cassert>

    9

   13 class InitialiseSolution {

   14     public:

   15         virtual ~InitialiseSolution(){};

   16

   22         virtual void initialiseItself(StarLink* link, PairOD *dest, int originIndex) = 0;

   23

   28         void initialiseSolution(PairOD *dest, ShortestPath *shPath, int originIndex){

   29

   30             StarLink *link = shPath->getInComeLink(dest->getIndex());

   31             assert(link != NULL);

   32             int nextDest = link->getNodeFromIndex();

   33

   34             while (link != NULL) {

   35                 initialiseItself(link, dest, originIndex);

   36                 nextDest = link->getNodeFromIndex();

   37                 link = shPath->getInComeLink(nextDest);

   38             }

   39         };

   40

   41

   42     protected:

   43         InitialiseSolution(){};

   44

   45 };

   46

   47 #endif

PairOD::getIndex

int getIndex() const

Definition: PairOD.cpp:22

StarLink

This class is a basic element of StarNetwork. It represents a link of the graph.

Definition: StarLink.h:8

StarLink::getNodeFromIndex

int getNodeFromIndex() const

Definition: StarLink.cpp:44

InitialiseSolution::initialiseSolution

void initialiseSolution(PairOD *dest, ShortestPath *shPath, int originIndex)

Definition: InitialiseSolution.h:28

InitialiseSolution::initialiseItself

virtual void initialiseItself(StarLink *link, PairOD *dest, int originIndex)=0

ShortestPath::getInComeLink

virtual StarLink * getInComeLink(int destIndex) const  =0

ShortestPath

This is an abstract class that defines the interface for single-objective shortest-path algorithms...

Definition: ShortestPath.h:11

InitialiseSolution

Abstract class that defines methods to initialise different container objects used in equilibration a...

Definition: InitialiseSolution.h:13

PairOD

This class implements a destination. It is a basic element of Origin class.

Definition: PairOD.h:8

<address class="footer">
Generated on Tue Mar 10 2015 15:45:14 for Traffic Assignment frameworK (TAsK) by

 1.8.9.1
</address>


text:
<!doctype html>

		<title>Zabuun - Learn Arabic for English Speakers</title>
		<meta name="description" content="">
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/head.php';?>

		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/ie8.php';?>
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/header.php';?>

			<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/side.php';?>

						Modern Standard Arabic (MSA) | Egyptian Colloquial Arabic (ECA) | Both

Everyday Life

Making a Complaint

  A: What have you done to my hair?
 B: I did exactly what you told me to do.
 A: I asked for a light trim, not for a butchering!
 B: I had to cut out all the split ends.
 A: I look like a grapefruit! My head is too round!
 B: It's a short bob, very stylish.
 A: It looks more like a bowl cut to me!
 B: It looks fantastic, don't exaggerate.
 A: I hate it! I'm not paying for this!
 B: You have to pay me for my labor!
 A: I'm never coming here ever again!
 B: Trust me, you won't be missed.

		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/footer.php';?>
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/scripts.php';?>


text:
<?php
namespace pistol88\order\logic;

use pistol88\order\interfaces\Element;

class ElementCancel
{
    public $element;

    public function execute()
    {
        $this->element->is_deleted = 1;
        $this->element->save();

        yii::createObject(['class' => CountCalculate::class, 'order' => $this->order])->execute();
        yii::createObject(['class' => CostCalculate::class, 'order' => $this->order])->execute();

        return true;
    }
}


text: golang error helper


text:
import * as cheerio from 'cheerio';
import * as prettyjson from 'prettyjson';
import * as requestPromise from 'request-promise';
import { ICrawlerInfo } from './../types/crawler-info';

const url: string = 'https://gatry.com/';

let getNews = html => {
	let $ = cheerio.load(html);
	let arr = [];
	$('.lista-promocoes .informacoes')
		.each((index, item) => arr.push({
			title: String($(item).find('h3').text()).trim(),
			preco: String($(item).find('.preco').text().trim()),
			url: String($(item).find('h3').find('a').attr('href')).trim(),
		}));
	return arr;
};

const crawlerInfo: ICrawlerInfo = {
    get: () => {
		requestPromise(url)
			.then(getNews)
			.then(prettyjson.render)
			.then(console.log);
	},
    url,
};

export default crawlerInfo;


text:
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2 generiert
// Siehe http://java.sun.com/xml/jaxb
// Änderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2016.02.05 um 06:25:30 PM CET
//

package org.onvif.ver10.schema;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;

/**
 *
Java-Klasse für NoiseReduction complex type.
 *
 *
Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
 *
 *

 * <complexType name="NoiseReduction">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="Level" type="{http://www.w3.org/2001/XMLSchema}float"/>
 *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *       <anyAttribute processContents='lax'/>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NoiseReduction", propOrder = {
    "level",
    "any"
})
public class NoiseReduction {

    @XmlElement(name = "Level")
    protected float level;
    @XmlAnyElement(lax = true)
    protected List<java.lang.Object> any;
    @XmlAnyAttribute
    private Map<QName, String> otherAttributes = new HashMap<QName, String>();

    /**
     * Ruft den Wert der level-Eigenschaft ab.
     *
     */
    public float getLevel() {
        return level;
    }

    /**
     * Legt den Wert der level-Eigenschaft fest.
     *
     */
    public void setLevel(float value) {
        this.level = value;
    }

    /**
     * Gets the value of the any property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the any property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getAny().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link Element }
     * {@link java.lang.Object }
     *
     *
     */
    public List<java.lang.Object> getAny() {
        if (any == null) {
            any = new ArrayList<java.lang.Object>();
        }
        return this.any;
    }

    /**
     * Gets a map that contains attributes that aren't bound to any typed property on this class.
     *
     *

     * the map is keyed by the name of the attribute and
     * the value is the string value of the attribute.
     *
     * the map returned by this method is live, and you can add new attribute
     * by updating the map directly. Because of this design, there's no setter.
     *
     *
     * @return
     *     always non-null
     */
    public Map<QName, String> getOtherAttributes() {
        return otherAttributes;
    }

}


text:
package cz.metacentrum.perun.core.implApi;

import cz.metacentrum.perun.core.api.ExtSource;
import cz.metacentrum.perun.core.api.Group;
import cz.metacentrum.perun.core.api.PerunSession;
import cz.metacentrum.perun.core.api.Vo;
import cz.metacentrum.perun.core.api.exceptions.ExtSourceAlreadyAssignedException;
import cz.metacentrum.perun.core.api.exceptions.ExtSourceAlreadyRemovedException;
import cz.metacentrum.perun.core.api.exceptions.ExtSourceExistsException;
import cz.metacentrum.perun.core.api.exceptions.ExtSourceNotAssignedException;
import cz.metacentrum.perun.core.api.exceptions.ExtSourceNotExistsException;
import cz.metacentrum.perun.core.api.exceptions.InternalErrorException;

import java.util.List;
import java.util.Map;

/**
 * @author Michal Prochazka <michalp@ics.muni.cz>
 *
 */
public interface ExtSourcesManagerImplApi {

	/**
	 * Initialize manager
	 */
	void initialize(PerunSession sess);

	/**
	 * Creates an external source.
	 *
	 * @param perunSession
	 * @param extSource
	 * @param attributes
	 *
	 * @return ExtSource object with newly associated ID.
	 *
	 * @throws InternalErrorException
	 * @throws ExtSourceExistsException
	 */
	ExtSource createExtSource(PerunSession perunSession, ExtSource extSource, Map<String, String> attributes) throws ExtSourceExistsException;

	/**
	 * Deletes an external source.
	 *
	 * @param perunSession
	 * @param extSource
	 *
	 * @throws ExtSourceAlreadyRemovedException if there are 0 rows affected by delete in DB
	 * @throws InternalErrorException
	 */
	void deleteExtSource(PerunSession perunSession, ExtSource extSource) throws ExtSourceAlreadyRemovedException;

	/**
	 * Updates extSource definition. It should be called only internally, because extSources are defined in the external XML file.
	 * It shouldn't be called from upper layers !!!
	 *
	 * @param sess
	 * @param extSource
	 * @throws InternalErrorException
	 */
	void updateExtSource(PerunSession sess, ExtSource extSource, Map<String, String> attributes) throws ExtSourceNotExistsException;

	/**
	 * Searches for the external source with specified id.
	 *
	 * @param perunSession
	 * @param id
	 *
	 * @return External source with specified id
	 *
	 * @throws InternalErrorException
	 * @throws ExtSourceNotExistsException
	 */
	ExtSource getExtSourceById(PerunSession perunSession, int id) throws ExtSourceNotExistsException;

	/**
	 * Searches for the external source using specified name.
	 *
	 * @param perunSession
	 * @param name
	 *
	 * @return External source with specified name
	 *
	 * @throws InternalErrorException
	 * @throws ExtSourceNotExistsException
	 */
	ExtSource getExtSourceByName(PerunSession perunSession, String name) throws ExtSourceNotExistsException;

	/**
	 * Get list of external sources associated to the VO.
	 *
	 * @param perunSession
	 * @param vo
	 *
	 * @return list of VO
	 *
	 * @throws InternalErrorException
	 */
	List<ExtSource> getVoExtSources(PerunSession perunSession, Vo vo);

	/**
	 * Get list of external sources associated with the GROUP.
	 *
	 * @param perunSession
	 * @param group
	 *
	 * @return list of external sources associated with the VO
	 *
	 * @throws InternalErrorException
	 */
	List<ExtSource> getGroupExtSources(PerunSession perunSession, Group group);

	/**
	 * Get list of all external sources.
	 *
	 * @param perunSession
	 *
	 * @return list of VO
	 *
	 * @throws InternalErrorException
	 */
	List<ExtSource> getExtSources(PerunSession perunSession);

	/**
	 * Associate external source definition with the VO.
	 *
	 * @param perunSession
	 * @param vo
	 * @param source
	 *
	 * @throws InternalErrorException
	 * @throws ExtSourceAlreadyAssignedException
	 */
	void addExtSource(PerunSession perunSession, Vo vo, ExtSource source) throws ExtSourceAlreadyAssignedException;

	/**
	 * Associate external source definition with the GROUP.
	 *
	 * @param perunSession
	 * @param group
	 * @param source
	 *
	 * @throws InternalErrorException
	 * @throws ExtSourceAlreadyAssignedException
	 */
	void addExtSource(PerunSession perunSession, Group group, ExtSource source) throws ExtSourceAlreadyAssignedException;

	/**
	 * Remove association of the external source from the VO.
	 *
	 * @param perunSession
	 * @param vo
	 * @param source
	 *
	 * @throws InternalErrorException
	 * @throws ExtSourceNotAssignedException
	 * @throws ExtSourceAlreadyRemovedException if there are 0 rows affected by remove in DB
	 */
	void removeExtSource(PerunSession perunSession, Vo vo, ExtSource source) throws ExtSourceNotAssignedException, ExtSourceAlreadyRemovedException;

	/**
	 * Remove association of the external source from the GROUP.
	 *
	 * @param perunSession
	 * @param group
	 * @param source
	 *
	 * @throws InternalErrorException
	 * @throws ExtSourceAlreadyRemovedException when 0 rows affected by removing from DB
	 * @throws ExtSourceNotAssignedException
	 */
	void removeExtSource(PerunSession perunSession, Group group, ExtSource source) throws ExtSourceNotAssignedException, ExtSourceAlreadyRemovedException;

	/**
	 * Get all users' id associate with the provided ExtSource
	 *
	 * @param perunSession
	 * @param source
	 *
	 * @return list of users' id associated with the provided ExtSource
	 *
	 * @throws InternalErrorException
	 */
	List<Integer> getAssociatedUsersIdsWithExtSource(PerunSession perunSession, ExtSource source);

	/**
	 * Check if extSource exists in underlaying data source.
	 *
	 * @param perunSession
	 * @param extSource
	 *
	 * @return true if extSource exists in underlaying data source, false otherwise
	 *
	 * @throws InternalErrorException
	 */
	boolean extSourceExists(PerunSession perunSession, ExtSource extSource);

	/**
	 * Check if extSource exists in underlaying data source.
	 *
	 * @param perunSession
	 * @param extSource
	 *
	 * @throws InternalErrorException
	 * @throws ExtSourceNotExistsException
	 */
	void checkExtSourceExists(PerunSession perunSession, ExtSource extSource) throws ExtSourceNotExistsException;

	/**
	 * Loads ext source definitions from the configuration file and updates entries stored in the DB.
	 *
	 * @param sess
	 */
	void loadExtSourcesDefinitions(PerunSession sess);

	/**
	 * Gets attributes for external source.
	 *
	 * @param extSource	External Source
	 * @return			Map of attributes for external source
	 * @throws InternalErrorException
	 */
	Map<String,String> getAttributes(ExtSource extSource);

	/**
	 * Returns all ExtSources with enabled synchronization
	 *
	 * @param sess PerunSession
	 * @return	List of External Sources with enabled synchronization
	 * @throws InternalErrorException
	 */
	List<ExtSource> getExtSourcesToSynchronize(PerunSession sess);
}


text:
<?xml version="1.0"?>
<document>
    <properties>
        <title>SourceForge</title>
    </properties>
    <meta name="keyword" content="wicket, web, j2ee, java, kick start"/>

The Wicket Quick Start project is hosted on the servers of SourceForge. This means
                that we get several stuff for free in order to manage the
                project. This website you are reading from is the central place
                where you will find documentation and project information.

For more information use one of the following links:

our SourceForge
                    summary page

the downloads
                    page

the mailing
                    lists

the trackers

</document>


text:
package org.apache.solr.search.function.cf;

import java.io.IOException;

import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.search.Scorer;
/**
 *
 * @author netboy 2014年9月8日下午7:01:33
 */
public interface FilterableCollector {
	public boolean matchs(int doc);

	public void setNextReader(AtomicReaderContext context) throws IOException;

	public void setScorer(Scorer scorer) throws IOException;
}


text:
/* A simple library to load images of various formats as SDL surfaces */

#ifndef SDL_IMAGE_H_
#define SDL_IMAGE_H_

#include "SDL.h"
#include "SDL_version.h"
#include "begin_code.h"

/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif

/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/
#define SDL_IMAGE_MAJOR_VERSION 2
#define SDL_IMAGE_MINOR_VERSION 0
#define SDL_IMAGE_PATCHLEVEL    4

/* This macro can be used to fill a version structure with the compile-time
 * version of the SDL_image library.
 */
#define SDL_IMAGE_VERSION(X)                        \
{                                                   \
    (X)->major = SDL_IMAGE_MAJOR_VERSION;           \
    (X)->minor = SDL_IMAGE_MINOR_VERSION;           \
    (X)->patch = SDL_IMAGE_PATCHLEVEL;              \
}

/**
 *  This is the version number macro for the current SDL_image version.
 */
#define SDL_IMAGE_COMPILEDVERSION \
    SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_PATCHLEVEL)

/**
 *  This macro will evaluate to true if compiled with SDL_image at least X.Y.Z.
 */
#define SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) \
    (SDL_IMAGE_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))

/* This function gets the version of the dynamically linked SDL_image library.
   it should NOT be used to fill a version structure, instead you should
   use the SDL_IMAGE_VERSION() macro.
 */
extern DECLSPEC const SDL_version * SDLCALL IMG_Linked_Version(void);

typedef enum
{
    IMG_INIT_JPG = 0x00000001,
    IMG_INIT_PNG = 0x00000002,
    IMG_INIT_TIF = 0x00000004,
    IMG_INIT_WEBP = 0x00000008
} IMG_InitFlags;

/* Loads dynamic libraries and prepares them for use.  Flags should be
   one or more flags from IMG_InitFlags OR'd together.
   It returns the flags successfully initialized, or 0 on failure.
 */
extern DECLSPEC int SDLCALL IMG_Init(int flags);

/* Unloads libraries loaded with IMG_Init */
extern DECLSPEC void SDLCALL IMG_Quit(void);

/* Load an image from an SDL data source.
   The 'type' may be one of: "BMP", "GIF", "PNG", etc.

   If the image format supports a transparent pixel, SDL will set the
   colorkey for the surface.  You can enable RLE acceleration on the
   surface afterwards by calling:
    SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
 */
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, const char *type);
/* Convenience functions */
extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file);
extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, int freesrc);

#if SDL_VERSION_ATLEAST(2,0,0)
/* Load an image directly into a render texture.
 */
extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture(SDL_Renderer *renderer, const char *file);
extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc);
extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTextureTyped_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc, const char *type);
#endif /* SDL 2.0 */

/* Functions to detect a file type, given a seekable source */
extern DECLSPEC int SDLCALL IMG_isICO(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isCUR(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isPNM(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isSVG(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isXV(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isWEBP(SDL_RWops *src);

/* Individual loading functions */
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadICO_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadCUR_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadBMP_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadGIF_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJPG_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadLBM_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPCX_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNM_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadSVG_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTGA_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXV_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadWEBP_RW(SDL_RWops *src);

extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm);

/* Individual saving functions */
extern DECLSPEC int SDLCALL IMG_SavePNG(SDL_Surface *surface, const char *file);
extern DECLSPEC int SDLCALL IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst);
extern DECLSPEC int SDLCALL IMG_SaveJPG(SDL_Surface *surface, const char *file, int quality);
extern DECLSPEC int SDLCALL IMG_SaveJPG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst, int quality);

/* We'll use SDL for reporting errors */
#define IMG_SetError    SDL_SetError
#define IMG_GetError    SDL_GetError

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"

#endif /* SDL_IMAGE_H_ */


text:
package org.brooth.jeta.tests.implementation;

import org.brooth.jeta.util.Implementation;

/**
 * @author Oleg Khalidov (brooth@gmail.com)
 */
@Implementation(value = AbstractPriority.class, priority = Integer.MIN_VALUE, staticConstructor = "newInstance")
public class PriorityLowImplementer extends AbstractPriority {

    private PriorityLowImplementer() {

    }

    public static PriorityLowImplementer newInstance() {
        return new PriorityLowImplementer();
    }

    @Override
    public String value() {
        return "low but via static constructor";
    }
}


text:
require "test_helper"

describe Diffbot::Request do
  subject do
    Diffbot::Request.new("DUMMY_TOKEN")
  end

  describe "#build_request" do
    after do
      Diffbot.instrumentor = nil
    end

    it "includes the method" do
      req = subject.build_request(:get)
      req[:method].must_equal(:get)
    end

    it "incldues the token in the query string" do
      req = subject.build_request(:get)
      req[:query][:token].must_equal("DUMMY_TOKEN")
    end

    it "includes passed-in query parameters in the query string" do
      req = subject.build_request(:get, a: 1, b: 2)

      req[:query].must_include(:a, :b)
      req[:query][:a].must_equal(1)
      req[:query][:b].must_equal(2)
    end

    it "sets an empty header hash so we can set headers afterwards" do
      req = subject.build_request(:get)
      req[:headers].must_equal({})
    end

    it "passes the instrumentor if present" do
      Diffbot.instrumentor = instrumentor = Object.new
      req = subject.build_request(:get)
      req[:instrumentor].must_equal(instrumentor)
      req[:instrumentor_name].must_equal("diffbot")
    end
  end

  describe "#perform" do
    before do
      Excon.stub(method: :get) do |params|
        body = params[:query].key?(:a) ? "Hello, A" : "Hello"
        { body: body, status: 200 }
      end
    end

    it "returns the raw response" do
      response = subject.perform(:get, "http://example.org")
      response.body.must_equal("Hello")
    end

    it "can pass query parameters" do
      response = subject.perform(:get, "http://example.org", a: 1)
      response.body.must_equal("Hello, A")
    end

    it "can modify the request" do
      response = subject.perform(:get, "http://example.org") do |req|
        req[:query][:a] = 1
      end
      response.body.must_equal("Hello, A")
    end
  end
end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Hist. Class. Discom. Eur. (Paris) 127 (1907)

#### Original name
Peziza byssacea P. Karst.

### Remarks
null


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2015 Red Hat, Inc. and/or its affiliates
    and other contributors as indicated by the @author tags.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

  <display-name>Hawkular Avail Creator</display-name>
  <description>A Bus listener that takes in *.status.code metrics and translates them into availability
    records, that are sent to Hawkular-Metrics and -Alerts.</description>

</web-app>


text:
#include <yage/physics/particlebody.h>

#include <cmath>

namespace yage
{

ParticleBody::ParticleBody(const Vector2d &position, double mass,
                           const Vector2d &velocity, bool gravity)
    : Body(position, mass, velocity, gravity)
{
}

void ParticleBody::applyForce(const Vector2d &force)
{
    force_ += force;
}

void ParticleBody::update()
{
    // set the time_step for 60fps
    double time_step = 1.0 / 60.0;

    // set the last acceleration
    Vector2d last_acceleration = acceleration_;

    // update the position of the body
    position_ += velocity_ * time_step +
                 (0.5 * last_acceleration * std::pow(time_step, 2));

    // update the acceleration
    if (gravity_) {
        acceleration_ =
            Vector2d(force_.x() / mass_, (GRAVITY + force_.y()) / mass_);
    } else {
        acceleration_ = Vector2d(force_.x() / mass_, force_.y() / mass_);
    }

    Vector2d avg_acceleration = (acceleration_ + last_acceleration) / 2.0;

    // update the velocity of the body
    velocity_ += avg_acceleration * time_step;
}

} // namespace yage


text:
namespace OpenTable.Features.Core.Interfaces
{
    public interface ITestDataObject
    {
    }
}


text:
package gudusoft.gsqlparser.sql2xml.model;

import org.simpleframework.xml.Element;

public class length_expression
{

	@Element(required = false)
	private char_length_expression char_length_expression;

	@Element(required = false)
	private octet_length_expression octet_length_expression;

	public char_length_expression getChar_length_expression( )
	{
		return char_length_expression;
	}

	public void setChar_length_expression(
			char_length_expression char_length_expression )
	{
		this.char_length_expression = char_length_expression;
	}

	public octet_length_expression getOctet_length_expression( )
	{
		return octet_length_expression;
	}

	public void setOctet_length_expression(
			octet_length_expression octet_length_expression )
	{
		this.octet_length_expression = octet_length_expression;
	}

}


text:
export default {
  lang: 'be',
  dir: 'ltr',
  common: {
    ok: 'Захаваць',
    cancel: 'Адмена',
    key_backspace: 'backspace',
    key_del: 'delete',
    key_down: 'down',
    key_up: 'up',
    more_opts: 'More Options',
    url: 'URL',
    width: 'Width',
    height: 'Height'
  },
  misc: {
    powered_by: 'Powered by'
  },
  ui: {
    toggle_stroke_tools: 'Show/hide more stroke tools',
    palette_info: 'Націсніце для змены колеру залівання, Shift-Click змяніць обводка',
    zoom_level: 'Змяненне маштабу',
    panel_action: 'Click to open side panel',
    quality: 'Quality:',
    pathNodeTooltip: 'Drag node to move it. Double-click node to change segment type',
    pathCtrlPtTooltip: 'Drag control point to adjust curve properties',
    pick_stroke_paint_opacity: 'Pick a Stroke Paint and Opacity',
    pick_fill_paint_opacity: 'Pick a Fill Paint and Opacity',
    group_identify_label: 'Group identification label',
    export_type_label: 'Select an image type for export:'
  },
  properties: {
    id: 'Identify the element',
    fill_color: 'Змяненне колеру залівання',
    stroke_color: 'Змяненне колеру інсульт',
    stroke_style: 'Змяненне стылю інсульт працяжнік',
    stroke_width: 'Змены шырыня штрых',
    pos_x: 'Change X coordinate',
    pos_y: 'Change Y coordinate',
    linecap_butt: 'Linecap: Butt',
    linecap_round: 'Linecap: Round',
    linecap_square: 'Linecap: Square',
    linejoin_bevel: 'Linejoin: Bevel',
    linejoin_miter: 'Linejoin: Miter',
    linejoin_round: 'Linejoin: Round',
    angle: 'Змены вугла павароту',
    blur: 'Change gaussian blur value',
    opacity: 'Старонка абранага пункта непразрыстасці',
    circle_cx: 'CX змене круга каардынаты',
    circle_cy: 'Змены гуртка CY каардынаты',
    circle_r: 'Старонка круга's радыус',
    ellipse_cx: 'Змены эліпса CX каардынаты',
    ellipse_cy: 'Змены эліпса CY каардынаты',
    ellipse_rx: 'Х змяненні эліпса радыюсам',
    ellipse_ry: 'Змены у эліпса радыюсам',
    line_x1: 'Змены лінія пачынае каардынаты х',
    line_x2: 'Змяненне за перыяд, скончыўся лінія каардынаты х',
    line_y1: 'Змены лінія пачынае Y каардынаты',
    line_y2: 'Змяненне за перыяд, скончыўся лінія Y каардынаты',
    rect_height: 'Змены прастакутнік вышынёй',
    rect_width: 'Змяненне шырыні прамавугольніка',
    corner_radius: 'Змены прастакутнік Corner Radius',
    image_width: 'Змены шырыня выявы',
    image_height: 'Змена вышыні выявы',
    image_url: 'Змяніць URL',
    node_x: "Change node's x coordinate",
    node_y: "Change node's y coordinate",
    seg_type: 'Change Segment type',
    straight_segments: 'Straight',
    curve_segments: 'Curve',
    text_contents: 'Змяненне зместу тэксту',
    font_family_label: 'Font:',
    font_family: 'Змены Сямейства шрыфтоў',
    font_size: 'Змяніць памер шрыфта',
    bold: 'Тоўсты тэкст',
    text_decoration_underline: 'Underline',
    text_decoration_linethrough: 'Line-Through',
    text_decoration_overline: 'Overline',
    italic: 'Нахілены тэкст',
    text_anchor_start: 'Align the text in start',
    text_anchor_middle: 'Align the text in middle',
    text_anchor_end: 'Align the text in end',
    text_letter_spacing: 'Change the letter spacing',
    text_word_spacing: 'Change the word spacing',
    text_length: 'Lets you specify the width of the space into which the text will draw',
    text_length_adjust: 'Length adjust',
    text_length_adjust_spacing: 'Spacing',
    text_length_adjust_spacing_and_glyphs: 'Spacing & Glyphs',
    class: 'Element class',
    serif: 'Serif',
    sans_serif: 'Sans-serif',
    cursive: 'Cursive',
    fantasy: 'Fantasy',
    monospace: 'Monospace',
    courier: 'Courier',
    helvetica: 'Helvetica',
    times: 'times',
    prefs_and_content: 'Store preferences and SVG content locally',
    prefs_only: 'Only store preferences locally',
    no_prefs_or_content: 'Do not store my preferences or SVG content locally',
    jgraduate_pad: 'Pad',
    jgraduate_reflect: 'Reflect',
    jgraduate_repeat: 'Repeat'
  },
  tools: {
    main_menu: 'Main Menu',
    bkgnd_color_opac: 'Змяненне колеру фону / непразрыстасць',
    connector_no_arrow: 'No arrow',
    fitToContent: 'Па памеры ўтрымання',
    fit_to_all: 'Па памеру ўсе змесціва',
    fit_to_canvas: 'Памер палатна',
    fit_to_layer_content: 'По размеру слой ўтрымання',
    fit_to_sel: 'Выбар памеру',
    align_relative_to: 'Выраўнаваць па дачыненні да ...',
    relativeTo: 'па параўнанні з:',
    page: 'старонка',
    largest_object: 'найбуйнейшы аб'ект',
    selected_objects: 'выбранымі аб'ектамі',
    smallest_object: 'маленькі аб'ект',
    export_img: 'Export',
    import_doc: 'Import SVG',
    align_to_page: 'Align Element to Page',
    align_bottom: 'Лінаваць па ніжнім краю',
    align_center: 'Лінаваць па цэнтру',
    align_left: 'Па левым краю',
    align_middle: 'Выраўнаваць Блізкага',
    align_right: 'Па правым краю',
    align_top: 'Лінаваць па верхнім краю',
    mode_select: 'Выберыце інструмент',
    mode_fhpath: 'Pencil Tool',
    mode_line: 'Line Tool',
    mode_rect: 'Rectangle Tool',
    mode_square: 'Square Tool',
    mode_fhrect: 'Свабоднай рукі Прастакутнік',
    mode_ellipse: 'Эліпс',
    mode_circle: 'Круг',
    mode_fhellipse: 'Свабоднай рукі Эліпс',
    mode_path: 'Poly Tool',
    mode_text: 'Тэкст Tool',
    mode_image: 'Image Tool',
    mode_zoom: 'Zoom Tool',
    no_embed: 'NOTE: This image cannot be embedded. It will depend on this path to be displayed',
    undo: 'Адмяніць',
    redo: 'Паўтор',
    tool_source: 'Змяніць зыходны',
    wireframe_mode: 'Wireframe Mode',
    clone: 'Clone Element(s)',
    del: 'Delete Element(s)',
    group_elements: 'Група элементаў',
    make_link: 'Make (hyper)link',
    set_link_url: 'Set link URL (leave empty to remove)',
    to_path: 'Convert to Path',
    reorient_path: 'Reorient path',
    ungroup: 'Элементы Разгруппировать',
    docprops: 'Уласцівасці дакумента',
    editor_homepage: 'SVG-Edit Home Page',
    move_bottom: 'Перамясціць уніз',
    move_top: 'Перамясціць угару',
    node_clone: 'Clone Node',
    node_delete: 'Delete Node',
    node_link: 'Link Control Points',
    add_subpath: 'Add sub-path',
    openclose_path: 'Open/close sub-path',
    source_save: 'Захаваць',
    cut: 'Cut',
    copy: 'Copy',
    paste: 'Paste',
    paste_in_place: 'Paste in Place',
    delete: 'Delete',
    group: 'Group',
    move_front: 'Bring to Front',
    move_up: 'Bring Forward',
    move_down: 'Send Backward',
    move_back: 'Send to Back',
    tool_unlink_use: 'Break link to reference element (make unique)',
    ellipse_circle_tool: 'Ellipse/Circle Tool',
    square_rect_tool: 'Square/Rect Tool',
    remember_this_choice: 'Remember this choice?',
    remember_this_choice_title: 'If you choose to opt out of storage while remembering this choice, the URL will change so as to avoid asking again.'
  },
  layers: {
    layer: 'Layer',
    layers: 'Layers',
    del: 'Выдаліць слой',
    move_down: 'Перамясціць слой на',
    new: 'Новы слой',
    rename: 'Перайменаваць Слой',
    move_up: 'Перамяшчэнне слоя да',
    dupe: 'Duplicate Layer',
    merge_down: 'Merge Down',
    merge_all: 'Merge All',
    move_elems_to: 'Move elements to:',
    move_selected: 'Move selected elements to a different layer'
  },
  config: {
    image_props: 'Image Properties',
    doc_title: 'Title',
    doc_dims: 'Canvas Dimensions',
    included_images: 'Included Images',
    image_opt_embed: 'Embed data (local files)',
    image_opt_ref: 'Use file reference',
    editor_prefs: 'Editor Preferences',
    language: 'Language',
    background: 'Editor Background',
    editor_img_url: 'Image URL',
    editor_bg_note: 'Note: Background will not be saved with image.',
    select_predefined: 'Выберыце прадвызначэньні:',
    units_and_rulers: 'Units & Rulers',
    show_rulers: 'Show rulers',
    base_unit: 'Base Unit:',
    grid: 'Grid',
    snapping_onoff: 'Snapping on/off',
    snapping_stepsize: 'Snapping Step-Size:',
    grid_color: 'Grid color',
    done: 'Done',
    change_xxx_color: 'Change xxx color',
    pick_paint_opavity: 'Pick a {{newValue}} Paint and Opacity',
    open_color_picker: 'Click To Open Color Picker',
    jpicker_title: 'Drag Markers To Pick A Color',
    jpicker_new_color: 'new',
    jpicker_current_color: 'current',
    jpicker_tooltip_colors_new_color: 'New Color - Press "OK" To Commit',
    jpicker_tooltip_colors_current_color: 'Click To Revert To Original Color',
    jpicker_tooltip_buttons_ok: 'Commit To This Color Selection',
    jpicker_tooltip_buttons_cancel: 'Cancel And Revert To Original Color',
    jpicker_tooltip_hue_radio: 'Set To "Hue" Color Mode',
    jpicker_tooltip_hue_textbox: 'Enter A "Hue" Value (0-360°)',
    jpicker_tooltip_saturation_radio: 'Set To "Saturation" Color Mode',
    jpicker_tooltip_saturation_textbox: 'Enter A "Saturation" Value (0-100%)',
    jpicker_tooltip_value_radio: 'Set To "Value" Color Mode',
    jpicker_tooltip_value_textbox: 'Enter A "Value" Value (0-100%)',
    jpicker_tooltip_red_radio: 'Set To "Red" Color Mode',
    jpicker_tooltip_red_textbox: 'Enter A "Red" Value (0-255)',
    jpicker_tooltip_green_radio: 'Set To "Green" Color Mode',
    jpicker_tooltip_green_textbox: 'Enter A "Green" Value (0-255)',
    jpicker_tooltip_blue_radio: 'Set To "Blue" Color Mode',
    jpicker_tooltip_blue_textbox: 'Enter A "Blue" Value (0-255)',
    jpicker_tooltip_alpha_radio: 'Set To "Alpha" Color Mode',
    jpicker_tooltip_alpha_textbox: 'Enter A "Alpha" Value (0-100)',
    jpicker_tooltip_hex_textbox: 'Enter A "Hex" Color Value (#000000-#ffffff)',
    jpicker_tooltip_hex_alpha: 'Enter A "Alpha" Value (#00-#ff)',
    jgraduate_solid_color: 'Solid Color',
    jgraduate_linear_gradient: 'Linear Gradient',
    jgraduate_radial_gradient: 'Radial Gradient',
    jgraduate_begin_point: 'Begin Point',
    jgraduate_enter_starting_x: 'Enter starting x value between 0.0 and 1.0',
    jgraduate_enter_starting_y: 'Enter starting y value between 0.0 and 1.0',
    jgraduate_end_point: 'End Point',
    jgraduate_enter_ending_x: 'Enter ending x value between 0.0 and 1.0',
    jgraduate_enter_ending_y: 'Enter ending y value between 0.0 and 1.0',
    jgraduate_center_point: 'Center Point',
    jgraduate_enter_value_x: 'Enter x value between 0.0 and 1.0',
    jgraduate_enter_value_y: 'Enter y value between 0.0 and 1.0',
    jgraduate_focal_point: 'Focal Point',
    jgraduate_match_center: 'Match center:',
    jgraduate_enter_focal_x: 'Enter x value between 0.0 and 1.0',
    jgraduate_enter_focal_y: 'Enter y value between 0.0 and 1.0',
    jgraduate_spread_method: 'Spread method',
    jgraduate_radius: 'Radius:',
    jgraduate_set_radius: 'Click to set radius',
    jgraduate_ellip: 'Ellip:',
    jgraduate_set_ellip: 'Click to set Ellip',
    jgraduate_angle: 'Angle:',
    jgraduate_set_angle: 'Click to set Angle',
    jgraduate_deg: 'deg:',
    jgraduate_opac: 'Opac:',
    jgraduate_set_opac: 'Click to set Opac'
  },
  notification: {
    invalidAttrValGiven: 'Invalid value given',
    noContentToFitTo: 'No content to fit to',
    dupeLayerName: 'There is already a layer named that!',
    enterUniqueLayerName: 'Please enter a unique layer name',
    enterNewLayerName: 'Please enter the new layer name',
    layerHasThatName: 'Layer already has that name',
    QmoveElemsToLayer: "Move selected elements to layer '%s'?",
    QwantToClear: 'Do you want to clear the drawing?\nThis will also erase your undo history!',
    QwantToOpen: 'Do you want to open a new file?\nThis will also erase your undo history!',
    QerrorsRevertToSource: 'There were parsing errors in your SVG source.\nRevert back to original SVG source?',
    QignoreSourceChanges: 'Ignore changes made to SVG source?',
    featNotSupported: 'Feature not supported',
    enterNewImgURL: 'Enter the new image URL',
    defsFailOnSave: 'NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.',
    loadingImage: 'Loading image, please wait...',
    saveFromBrowser: "Select 'Save As...' in your browser (possibly via file menu or right-click context-menu) to save this image as a {{type}} file.",
    noteTheseIssues: 'Also note the following issues: ',
    unsavedChanges: 'There are unsaved changes.',
    enterNewLinkURL: 'Enter the new hyperlink URL',
    errorLoadingSVG: 'Error: Unable to load SVG data',
    URLLoadFail: 'Unable to load from URL',
    retrieving: "Retrieving '%s' ...",
    popupWindowBlocked: 'Popup window may be blocked by browser',
    exportNoBlur: 'Blurred elements will appear as un-blurred',
    exportNoforeignObject: 'foreignObject elements will not appear',
    exportNoDashArray: 'Strokes will appear filled',
    exportNoText: 'Text may not appear as expected',
    editorPreferencesMsg: 'By default and where supported, SVG-Edit can store your editor preferences and SVG content locally on your machine so you do not need to add these back each time you load SVG-Edit. If, for privacy reasons, you do not wish to store this information on your machine, you can change away from the default option below.',
    source_dialog_note: 'Copy the contents of this box into a text editor, then save the file with a .svg extension.'
  }
}


text:
import escapeStringRegexp from 'escape-string-regexp'

export default function matcher (patterns: string[] | string) {
  if (typeof patterns === 'string') return matcherFromPattern(patterns)
  switch (patterns.length) {
  case 0: return () => false
  case 1: return matcherFromPattern(patterns[0])
  }
  const matchArr = patterns.map(matcherFromPattern)
  return (input: string) => matchArr.some((match) => match(input))
}

function matcherFromPattern (pattern: string) {
  if (pattern === '*') {
    return () => true
  }

  const escapedPattern = escapeStringRegexp(pattern).replace(/\\\*/g, '.*')
  if (escapedPattern === pattern) {
    return (input: string) => input === pattern
  }

  const regexp = new RegExp(`^${escapedPattern}$`)
  return (input: string) => regexp.test(input)
}