text:
'use strict';

var webexapp = require('../lib'),
    express = require('express'),
    WebServer = webexapp.WebServer;

var server, app;

webexapp.setWebserverConfig({workers: 1}); // set number of workers to 1
server = new WebServer('body-parsing');

app = express();
app.post('/json', function (req, res) {
    res.send(JSON.stringify(req.body));
});
app.post('/urlencoded', function (req, res) {
    res.send(JSON.stringify(req.body));
});
app.post('/multipart', function (req, res) {
    // raw-stream available as req.rawBodyStream - pipe it something like busboy
    res.send('OK');
});

server.use('/', app);
server.run();

// POST to /json & /urlencoded


text:
def slices(series, length):
    pass

redpajama_set_name: RedPajamaGithub


text:
from bayesdb.client import Client
from cmd2 import Cmd
import sys

class BayesDBApp(Cmd):
  """Provides "interactive mode" features."""
  Cmd.redirector = '>>>'

  def __init__(self, client):
    self.client = client
    self.prompt = 'bql> '
    Cmd.__init__(self, 'tab')

  def do_show(self, line):
    self.client('show ' + str(line))

  def do_list(self, line):
    self.client('list ' + str(line))

  def do_analyze(self, line):
    self.client('analyze ' + str(line))

  def do_execute(self, line):
    self.client('execute ' + str(line))

  def do_drop(self, line):
    self.client('drop ' + str(line))

  def do_initialize(self, line):
    self.client('initialize ' + str(line))

  def do_create(self, line):
    self.client('create ' + str(line))

  def do_infer(self, line):
    self.client('infer ' + str(line))

  def do_select(self, line):
    self.client('select ' + str(line))

  def do_simulate(self, line):
    self.client('simulate ' + str(line))

  def do_save(self, line):
    self.client('save ' + str(line))

  def do_load(self, line):
    self.client('load ' + str(line))

  def do_estimate(self, line):
    self.client('estimate ' + str(line))

  def do_update(self, line):
    self.client('update ' + str(line))

  def do_help(self, line):
    self.client('help ' + str(line))

  def default(self, line):
    self.client(str(line))

def run_command_line():
  # Get command line arguments to specify hostname and port
  hostname = None
  port = None
  if len(sys.argv) > 1:
    # Treat the first argument as hostname[:port]
    input = sys.argv[1].split(':')
    hostname = input[0]
    if len(input) == 1:
      client = Client(hostname)
      print "Using hostname %s." % hostname
    if len(input) == 2:
      port = int(input[1])
      client = Client(hostname, port)
      print "Using hostname %s, port %d" % (hostname, port)
    elif len(input) > 2:
      print "Run with 'python bql [hostname[:port]]'"
  else:
    client = Client()

  print """Welcome to BayesDB. You may enter BQL commands directly into this prompt. Type 'help' for help, and 'quit' to quit."""
  app = BayesDBApp(client)
  app.cmdloop()

if __name__ == "__main__":
  run_command_line()


text:
// Utility class to format metrics to a string suitable for posting to
// TB stats server.
#ifndef O3D_STATSREPORT_FORMATTER_H__
#define O3D_STATSREPORT_FORMATTER_H__

#include <sstream>
#include "base/basictypes.h"
#include "metrics.h"

namespace stats_report {

// A utility class that knows how to turn metrics into a string for
// reporting to the Toolbar stats server.
class Formatter {
 public:
  // @param name the name of the application to report stats against
  Formatter(const char *name, uint32 measurement_secs);
  ~Formatter();

  // Add metric to the output string
  void AddMetric(MetricBase *metric);

  // Add typed metrics to the output string
  // @{
  void AddCount(const char *name, uint64 value);
  void AddTiming(const char *name, uint64 num, uint64 avg, uint64 min,
                 uint64 max);
  void AddInteger(const char *name, uint64 value);
  void AddBoolean(const char *name, bool value);
  // @}

  // Terminates the output string and returns it.
  // It is an error to add metrics after output() is called.
  const std::string output() {
    output_ << std::ends;
    return output_.str();
  }

 private:
  mutable std::ostringstream output_;

  DISALLOW_COPY_AND_ASSIGN(Formatter);
};

}  // namespace stats_report

#endif  // O3D_STATSREPORT_FORMATTER_H__


text:
package com.amazonaws.services.storagegateway.model;

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *

 * A JSON object containing one or more of the following fields:
 *

 *

 *

 *

 * CreateStorediSCSIVolumeInput$DiskId
 *

 *

 *

 *

 * CreateStorediSCSIVolumeInput$NetworkInterfaceId
 *

 *

 *

 *

 * CreateStorediSCSIVolumeInput$PreserveExistingData
 *

 *

 *

 *

 * CreateStorediSCSIVolumeInput$SnapshotId
 *

 *

 *

 *

 * CreateStorediSCSIVolumeInput$TargetName
 *

 *

 *

 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateStorediSCSIVolumeRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    private String gatewayARN;
    /**
     *

     * The unique identifier for the gateway local disk that is configured as a stored volume. Use ListLocalDisks to
     * list disk IDs for a gateway.
     *

     */
    private String diskId;
    /**
     *

     * The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new stored volume. Specify this field if
     * you want to create the iSCSI storage volume from a snapshot otherwise do not include this field. To list
     * snapshots for your account use DescribeSnapshots in the Amazon Elastic Compute Cloud API Reference.
     *

     */
    private String snapshotId;
    /**
     *

     * Specify this field as true if you want to preserve the data on the local disk. Otherwise, specifying this field
     * as false creates an empty volume.
     *

     *

     * Valid Values: true, false
     *

     */
    private Boolean preserveExistingData;
    /**
     *

     * The name of the iSCSI target used by initiators to connect to the target and as a suffix for the target ARN. For
     * example, specifying TargetName as myvolume results in the target ARN of
     * arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume. The
     * target name must be unique across all volumes of a gateway.
     *

     */
    private String targetName;
    /**
     *

     * The network interface of the gateway on which to expose the iSCSI target. Only IPv4 addresses are accepted. Use
     * DescribeGatewayInformation to get a list of the network interfaces available on a gateway.
     *

     *

     * Valid Values: A valid IP address.
     *

     */
    private String networkInterfaceId;

    /**
     * @param gatewayARN
     */

    public void setGatewayARN(String gatewayARN) {
        this.gatewayARN = gatewayARN;
    }

    /**
     * @return
     */

    public String getGatewayARN() {
        return this.gatewayARN;
    }

    /**
     * @param gatewayARN
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateStorediSCSIVolumeRequest withGatewayARN(String gatewayARN) {
        setGatewayARN(gatewayARN);
        return this;
    }

    /**
     *

     * The unique identifier for the gateway local disk that is configured as a stored volume. Use ListLocalDisks to
     * list disk IDs for a gateway.
     *

     *
     * @param diskId
     *        The unique identifier for the gateway local disk that is configured as a stored volume. Use ListLocalDisks to list disk IDs for a gateway.
     */

    public void setDiskId(String diskId) {
        this.diskId = diskId;
    }

    /**
     *

     * The unique identifier for the gateway local disk that is configured as a stored volume. Use ListLocalDisks to
     * list disk IDs for a gateway.
     *

     *
     * @return The unique identifier for the gateway local disk that is configured as a stored volume. Use ListLocalDisks to list disk IDs for a gateway.
     */

    public String getDiskId() {
        return this.diskId;
    }

    /**
     *

     * The unique identifier for the gateway local disk that is configured as a stored volume. Use ListLocalDisks to
     * list disk IDs for a gateway.
     *

     *
     * @param diskId
     *        The unique identifier for the gateway local disk that is configured as a stored volume. Use ListLocalDisks to list disk IDs for a gateway.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateStorediSCSIVolumeRequest withDiskId(String diskId) {
        setDiskId(diskId);
        return this;
    }

    /**
     *

     * The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new stored volume. Specify this field if
     * you want to create the iSCSI storage volume from a snapshot otherwise do not include this field. To list
     * snapshots for your account use DescribeSnapshots in the Amazon Elastic Compute Cloud API Reference.
     *

     *
     * @param snapshotId
     *        The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new stored volume. Specify this
     *        field if you want to create the iSCSI storage volume from a snapshot otherwise do not include this field.
     *        To list snapshots for your account use DescribeSnapshots in the Amazon Elastic Compute Cloud API Reference.
     */

    public void setSnapshotId(String snapshotId) {
        this.snapshotId = snapshotId;
    }

    /**
     *

     * The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new stored volume. Specify this field if
     * you want to create the iSCSI storage volume from a snapshot otherwise do not include this field. To list
     * snapshots for your account use DescribeSnapshots in the Amazon Elastic Compute Cloud API Reference.
     *

     *
     * @return The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new stored volume. Specify this
     *         field if you want to create the iSCSI storage volume from a snapshot otherwise do not include this field.
     *         To list snapshots for your account use DescribeSnapshots in the Amazon Elastic Compute Cloud API Reference.
     */

    public String getSnapshotId() {
        return this.snapshotId;
    }

    /**
     *

     * The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new stored volume. Specify this field if
     * you want to create the iSCSI storage volume from a snapshot otherwise do not include this field. To list
     * snapshots for your account use DescribeSnapshots in the Amazon Elastic Compute Cloud API Reference.
     *

     *
     * @param snapshotId
     *        The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new stored volume. Specify this
     *        field if you want to create the iSCSI storage volume from a snapshot otherwise do not include this field.
     *        To list snapshots for your account use DescribeSnapshots in the Amazon Elastic Compute Cloud API Reference.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateStorediSCSIVolumeRequest withSnapshotId(String snapshotId) {
        setSnapshotId(snapshotId);
        return this;
    }

    /**
     *

     * Specify this field as true if you want to preserve the data on the local disk. Otherwise, specifying this field
     * as false creates an empty volume.
     *

     *

     * Valid Values: true, false
     *

     *
     * @param preserveExistingData
     *        Specify this field as true if you want to preserve the data on the local disk. Otherwise, specifying this
     *        field as false creates an empty volume.

     *

     *        Valid Values: true, false
     */

    public void setPreserveExistingData(Boolean preserveExistingData) {
        this.preserveExistingData = preserveExistingData;
    }

    /**
     *

     * Specify this field as true if you want to preserve the data on the local disk. Otherwise, specifying this field
     * as false creates an empty volume.
     *

     *

     * Valid Values: true, false
     *

     *
     * @return Specify this field as true if you want to preserve the data on the local disk. Otherwise, specifying this
     *         field as false creates an empty volume.

     *

     *         Valid Values: true, false
     */

    public Boolean getPreserveExistingData() {
        return this.preserveExistingData;
    }

    /**
     *

     * Specify this field as true if you want to preserve the data on the local disk. Otherwise, specifying this field
     * as false creates an empty volume.
     *

     *

     * Valid Values: true, false
     *

     *
     * @param preserveExistingData
     *        Specify this field as true if you want to preserve the data on the local disk. Otherwise, specifying this
     *        field as false creates an empty volume.

     *

     *        Valid Values: true, false
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateStorediSCSIVolumeRequest withPreserveExistingData(Boolean preserveExistingData) {
        setPreserveExistingData(preserveExistingData);
        return this;
    }

    /**
     *

     * Specify this field as true if you want to preserve the data on the local disk. Otherwise, specifying this field
     * as false creates an empty volume.
     *

     *

     * Valid Values: true, false
     *

     *
     * @return Specify this field as true if you want to preserve the data on the local disk. Otherwise, specifying this
     *         field as false creates an empty volume.

     *

     *         Valid Values: true, false
     */

    public Boolean isPreserveExistingData() {
        return this.preserveExistingData;
    }

    /**
     *

     * The name of the iSCSI target used by initiators to connect to the target and as a suffix for the target ARN. For
     * example, specifying TargetName as myvolume results in the target ARN of
     * arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume. The
     * target name must be unique across all volumes of a gateway.
     *

     *
     * @param targetName
     *        The name of the iSCSI target used by initiators to connect to the target and as a suffix for the target
     *        ARN. For example, specifying TargetName as myvolume results in the target ARN of
     *        arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume.
     *        The target name must be unique across all volumes of a gateway.
     */

    public void setTargetName(String targetName) {
        this.targetName = targetName;
    }

    /**
     *

     * The name of the iSCSI target used by initiators to connect to the target and as a suffix for the target ARN. For
     * example, specifying TargetName as myvolume results in the target ARN of
     * arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume. The
     * target name must be unique across all volumes of a gateway.
     *

     *
     * @return The name of the iSCSI target used by initiators to connect to the target and as a suffix for the target
     *         ARN. For example, specifying TargetName as myvolume results in the target ARN of
     *         arn:aws
     *         :storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume. The
     *         target name must be unique across all volumes of a gateway.
     */

    public String getTargetName() {
        return this.targetName;
    }

    /**
     *

     * The name of the iSCSI target used by initiators to connect to the target and as a suffix for the target ARN. For
     * example, specifying TargetName as myvolume results in the target ARN of
     * arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume. The
     * target name must be unique across all volumes of a gateway.
     *

     *
     * @param targetName
     *        The name of the iSCSI target used by initiators to connect to the target and as a suffix for the target
     *        ARN. For example, specifying TargetName as myvolume results in the target ARN of
     *        arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume.
     *        The target name must be unique across all volumes of a gateway.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateStorediSCSIVolumeRequest withTargetName(String targetName) {
        setTargetName(targetName);
        return this;
    }

    /**
     *

     * The network interface of the gateway on which to expose the iSCSI target. Only IPv4 addresses are accepted. Use
     * DescribeGatewayInformation to get a list of the network interfaces available on a gateway.
     *

     *

     * Valid Values: A valid IP address.
     *

     *
     * @param networkInterfaceId
     *        The network interface of the gateway on which to expose the iSCSI target. Only IPv4 addresses are
     *        accepted. Use DescribeGatewayInformation to get a list of the network interfaces available on a
     *        gateway.

     *

     *        Valid Values: A valid IP address.
     */

    public void setNetworkInterfaceId(String networkInterfaceId) {
        this.networkInterfaceId = networkInterfaceId;
    }

    /**
     *

     * The network interface of the gateway on which to expose the iSCSI target. Only IPv4 addresses are accepted. Use
     * DescribeGatewayInformation to get a list of the network interfaces available on a gateway.
     *

     *

     * Valid Values: A valid IP address.
     *

     *
     * @return The network interface of the gateway on which to expose the iSCSI target. Only IPv4 addresses are
     *         accepted. Use DescribeGatewayInformation to get a list of the network interfaces available on a
     *         gateway.

     *

     *         Valid Values: A valid IP address.
     */

    public String getNetworkInterfaceId() {
        return this.networkInterfaceId;
    }

    /**
     *

     * The network interface of the gateway on which to expose the iSCSI target. Only IPv4 addresses are accepted. Use
     * DescribeGatewayInformation to get a list of the network interfaces available on a gateway.
     *

     *

     * Valid Values: A valid IP address.
     *

     *
     * @param networkInterfaceId
     *        The network interface of the gateway on which to expose the iSCSI target. Only IPv4 addresses are
     *        accepted. Use DescribeGatewayInformation to get a list of the network interfaces available on a
     *        gateway.

     *

     *        Valid Values: A valid IP address.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateStorediSCSIVolumeRequest withNetworkInterfaceId(String networkInterfaceId) {
        setNetworkInterfaceId(networkInterfaceId);
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getGatewayARN() != null)
            sb.append("GatewayARN: ").append(getGatewayARN()).append(",");
        if (getDiskId() != null)
            sb.append("DiskId: ").append(getDiskId()).append(",");
        if (getSnapshotId() != null)
            sb.append("SnapshotId: ").append(getSnapshotId()).append(",");
        if (getPreserveExistingData() != null)
            sb.append("PreserveExistingData: ").append(getPreserveExistingData()).append(",");
        if (getTargetName() != null)
            sb.append("TargetName: ").append(getTargetName()).append(",");
        if (getNetworkInterfaceId() != null)
            sb.append("NetworkInterfaceId: ").append(getNetworkInterfaceId());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof CreateStorediSCSIVolumeRequest == false)
            return false;
        CreateStorediSCSIVolumeRequest other = (CreateStorediSCSIVolumeRequest) obj;
        if (other.getGatewayARN() == null ^ this.getGatewayARN() == null)
            return false;
        if (other.getGatewayARN() != null && other.getGatewayARN().equals(this.getGatewayARN()) == false)
            return false;
        if (other.getDiskId() == null ^ this.getDiskId() == null)
            return false;
        if (other.getDiskId() != null && other.getDiskId().equals(this.getDiskId()) == false)
            return false;
        if (other.getSnapshotId() == null ^ this.getSnapshotId() == null)
            return false;
        if (other.getSnapshotId() != null && other.getSnapshotId().equals(this.getSnapshotId()) == false)
            return false;
        if (other.getPreserveExistingData() == null ^ this.getPreserveExistingData() == null)
            return false;
        if (other.getPreserveExistingData() != null && other.getPreserveExistingData().equals(this.getPreserveExistingData()) == false)
            return false;
        if (other.getTargetName() == null ^ this.getTargetName() == null)
            return false;
        if (other.getTargetName() != null && other.getTargetName().equals(this.getTargetName()) == false)
            return false;
        if (other.getNetworkInterfaceId() == null ^ this.getNetworkInterfaceId() == null)
            return false;
        if (other.getNetworkInterfaceId() != null && other.getNetworkInterfaceId().equals(this.getNetworkInterfaceId()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getGatewayARN() == null) ? 0 : getGatewayARN().hashCode());
        hashCode = prime * hashCode + ((getDiskId() == null) ? 0 : getDiskId().hashCode());
        hashCode = prime * hashCode + ((getSnapshotId() == null) ? 0 : getSnapshotId().hashCode());
        hashCode = prime * hashCode + ((getPreserveExistingData() == null) ? 0 : getPreserveExistingData().hashCode());
        hashCode = prime * hashCode + ((getTargetName() == null) ? 0 : getTargetName().hashCode());
        hashCode = prime * hashCode + ((getNetworkInterfaceId() == null) ? 0 : getNetworkInterfaceId().hashCode());
        return hashCode;
    }

    @Override
    public CreateStorediSCSIVolumeRequest clone() {
        return (CreateStorediSCSIVolumeRequest) super.clone();
    }

}


text:
/*
 * @test
 * @bug 6505888
 * @summary Tests UnmodifiableSortedSet encoding
 * @author Sergey Malenkov
 */

import java.util.Collections;
import java.util.SortedSet;
import java.util.TreeSet;

public final class java_util_Collections_UnmodifiableSortedSet extends AbstractTest<SortedSet<String>> {
    public static void main(String[] args) {
        new java_util_Collections_UnmodifiableSortedSet().test(true);
    }

    protected SortedSet<String> getObject() {
        SortedSet<String> set = new TreeSet<String>();
        set.add("string");
        return Collections.unmodifiableSortedSet(set);
    }

    protected SortedSet<String> getAnotherObject() {
        SortedSet<String> set = new TreeSet<String>();
        return Collections.unmodifiableSortedSet(set);
    }
}


text:
/*
 * Copyright (C) 1998, 1999, 2000,
 *
 * Arjuna Solutions Limited,
 * Newcastle upon Tyne,
 * Tyne and Wear,
 * UK.
 *
 * $Id: LockStore.java 2342 2006-03-30 13:06:17Z  $
 */

package com.arjuna.ats.txoj.lockstore;

import com.arjuna.ats.arjuna.common.Uid;
import com.arjuna.ats.arjuna.state.InputObjectState;
import com.arjuna.ats.arjuna.state.OutputObjectState;
import com.arjuna.ats.internal.txoj.Implementations;
import com.arjuna.ats.txoj.exceptions.LockStoreException;

/**
 * The lock store interface is the application's route to using a specific lock
 * store implementation. The interface dynamically binds to an implementation of
 * the right type.
 *
 * @author Mark Little (mark@arjuna.com)
 * @version $Id: LockStore.java 2342 2006-03-30 13:06:17Z $
 * @since JTS 1.0.
 */

public abstract class LockStore
{
    public abstract InputObjectState read_state (Uid u, String tName)
            throws LockStoreException;

    /**
     * Remove the state from the lock store.
     */

    public abstract boolean remove_state (Uid u, String tname);

    /**
     * Write the state to the lock store.
     */

    public abstract boolean write_committed (Uid u, String tName,
            OutputObjectState state);

    protected LockStore ()
    {
    }

    static
    {
        /*
         * Make sure the possible implementations are in the inventory.
         * Otherwise this is going to be a very short ride!
         */

        if (!Implementations.added())
            Implementations.initialise();
    }

}