text:
const struct in6_addr in6addr_any = {{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}};
const struct in6_addr in6addr_loopback = {{{0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}}};

void esix_socket_init()
{
	int i=ESIX_MAX_SOCK;
	while(i-->0)
		esix_sockets[i].state = CLOSED;
}

int esix_queue_data(int sock, const void *data, int len, struct sockaddr_in6 *sockaddr, enum direction direction)
{
	//sock queue element
	struct sock_queue *sqe, *cur_sqe;
	int i;
	u8_t *buf;

	//don't queue up more than ESIX_QUEUE_DEPHT packets
	cur_sqe = esix_sockets[sock].queue;
	for(i=0; cur_sqe != NULL ; i++)
	{
		if(i >= ESIX_QUEUE_DEPHT)
			return -1;

		cur_sqe = cur_sqe->next_e;
	}

	switch(esix_sockets[sock].proto)
	{
		case SOCK_DGRAM:
			if((buf = esix_w_malloc(len+sizeof(struct sockaddr_in6))) == NULL )
				return -1;

			esix_memcpy(buf, sockaddr, sizeof(struct sockaddr_in6));
			esix_memcpy(buf+sizeof(struct sockaddr_in6), data, len);
		break;
		case SOCK_STREAM:
			if((buf = esix_w_malloc(len)) == NULL )
				return -1;

			esix_memcpy(buf, data, len);
		break;
		default:
			return -1;
		break;
	}

	if((sqe = esix_w_malloc(sizeof(struct sock_queue))) == NULL)
	{
		esix_w_free(buf);
		return -1;
	}

	sqe->data 	= buf;
	sqe->data_len 	= len;
	sqe->next_e	= NULL;

	if(direction == IN)
		sqe->qe_type 	= RECV_PKT;
	else
	{
		sqe->qe_type	= SENT_PKT;
		sqe->seqn 	= esix_sockets[sock].seqn;
		sqe->t_sent 	= esix_get_time();
	}

	//there's no element in the list.
	if(esix_sockets[sock].queue == NULL)
		esix_sockets[sock].queue = sqe;
	else
	{
		//find the end of the list
		cur_sqe = esix_sockets[sock].queue;
		while(cur_sqe->next_e != NULL)
			cur_sqe = cur_sqe->next_e;

		cur_sqe->next_e	= sqe;
	}

	return len;
}

int sendto(int sock, const void *buf, int len, u8_t flags, const struct sockaddr_in6 *to, int to_len)
{
	int i;
	//only to be used with UDP
	if(esix_sockets[sock].proto != SOCK_DGRAM)
		return -1;

	// check the source address
	if(esix_memcmp(&esix_sockets[sock].laddr, &in6addr_any, 16) == 0)
	{
		if(((i = esix_intf_get_type_address(GLOBAL)) <0) &&
			(i = esix_intf_get_type_address(LINK_LOCAL)) <0)
			return -1;

		esix_udp_send(&addrs[i]->addr, (struct ip6_addr*) &to->sin6_addr,
			esix_sockets[sock].lport, to->sin6_port, buf, len);
	}
	else
		esix_udp_send(&esix_sockets[sock].laddr, (struct ip6_addr*) &to->sin6_addr,
			esix_sockets[sock].lport, to->sin6_port, buf, len);

	return 0;
}

int connect(int sock, const struct sockaddr_in6 *daddr, int len)
{
	int i;
	if(esix_sockets[sock].proto == SOCK_STREAM)
	{
		if(esix_sockets[sock].state != RESERVED &&
			esix_sockets[sock].state != CLOSED)
			return -1;

		if((i=esix_intf_pick_source_address((struct ip6_addr*) daddr)) < 0)
			return -1;

		//connect() launches the tcp establishment procedure
		esix_sockets[sock].ackn = 0;
		esix_sockets[sock].rport = daddr->sin6_port;
		esix_memcpy(&esix_sockets[sock].raddr, &daddr->sin6_addr, 16);
		esix_sockets[sock].state = SYN_SENT;

		//send a SYN packet
		esix_tcp_send(&esix_sockets[sock].laddr, &esix_sockets[sock].raddr,
			esix_sockets[sock].lport, esix_sockets[sock].rport,
			esix_sockets[sock].seqn+1, esix_sockets[sock].ackn, SYN, NULL, 0);
	}
	else if(esix_sockets[sock].proto == SOCK_DGRAM)
	{
		 if(esix_sockets[sock].state != LISTEN &&
			esix_sockets[sock].state != ESTABLISHED)
			return -1;

		//this puts us in so called udp connected mode
		//only the source addr & port can talk to this socket
		esix_sockets[sock].rport = daddr->sin6_port;
		esix_memcpy(&esix_sockets[sock].raddr, &daddr->sin6_addr, 16);
		esix_sockets[sock].state = ESTABLISHED;
	}
	else return -1;

	return 0;
}

//finds (and unlink, if specified) the first element of type qe_type in a socket event queue
//and returns a pointer.
struct sock_queue * esix_socket_find_e(int sock, enum qe_type qe_type, enum action action)
{
	struct sock_queue *sqe;
	struct sock_queue *prev_sqe;

	//empty queue
	if(esix_sockets[sock].queue == NULL)
		return NULL;

	sqe 		= esix_sockets[sock].queue;
	prev_sqe	= sqe;
	//find the first available eligible packet in queue
	//and keep a reference to the previous queue element
	while(sqe->qe_type != qe_type)
	{
		//we reached the end of the list
		if(sqe->next_e == NULL)
			return NULL;

		prev_sqe= sqe;
		sqe 	= sqe->next_e;
	}

	//remove packet from queue
	if(action == EVICT)
	{
		//first element needs special treatment
		if(esix_sockets[sock].queue == sqe)
			esix_sockets[sock].queue = sqe->next_e;
		else
			prev_sqe->next_e = sqe->next_e;
	}

	return sqe;
}

int recv(int sock, void *buf, int max_len, u8_t flags)
{
	return recvfrom(sock, buf, max_len, flags, NULL, NULL);
}

int recvfrom(int sock, void *buf, int max_len, int flags, struct sockaddr_in6 *sockaddr, int *sockaddr_len)
{
	//TODO : watch lockups due to OOM
	int len;

	if(esix_sockets[sock].proto == SOCK_STREAM && esix_sockets[sock].state != ESTABLISHED)
		return -1;

	struct sock_queue *sqe = esix_socket_find_e(sock, RECV_PKT, EVICT);
	if(sqe == NULL)
		return 0;

	//TODO : hmm data loss warning here
	if(max_len < sqe->data_len)
		len = max_len;
	else
		len = sqe->data_len;

	switch(esix_sockets[sock].proto)
	{
		case SOCK_DGRAM:
			//copy the sockaddr_in6 struct
			if(sockaddr != NULL)
				esix_memcpy(sockaddr, sqe->data, sizeof(struct sockaddr_in6));
			//actual data
			esix_memcpy(buf, sqe->data+sizeof(struct sockaddr_in6), len);
		break;

		case SOCK_STREAM:
			//fill up the sockaddr_in6 struct with socket info
			//as TCP can only receive data in connected state
			if(sockaddr != NULL)
			{
				sockaddr->sin6_port = esix_sockets[sock].rport;
				esix_memcpy(&sockaddr->sin6_addr, &esix_sockets[sock].raddr, 16);
			}
			//actual data
			esix_memcpy(buf, sqe->data, len);
		break;
	}

	if(sockaddr_len != NULL)
		*sockaddr_len = sizeof(struct sockaddr_in6);

	//free data buffer and socket queue element
	esix_w_free(sqe->data);
	esix_w_free(sqe);

	return len;
}

int accept(int sock, struct sockaddr_in6 *saddr, int *sockaddr_len)
{
	int session_sock;
	struct sock_queue *sqe = esix_socket_find_e(sock, CHILD_SOCK, EVICT);
	if(sqe == NULL)
		return -1;

	session_sock = sqe->socknum;
	esix_w_free(sqe);

	if(saddr != NULL)
	{
		esix_memcpy(&saddr->sin6_addr, &esix_sockets[sock].raddr, 16);
		saddr->sin6_port = esix_sockets[sock].rport;
	}

	return session_sock;
}

//creates a session socket (actually only used by TCP when accept()'ing a client connection)
int esix_socket_create_child(const struct ip6_addr *saddr, const struct ip6_addr *daddr, u16_t sport, u16_t dport, u8_t proto)
{
	struct sock_queue *sqe, *cur_sqe;
	//check if we're actually listening, if we are, create a new socket entry,
	//flag it as established and return its socket descriptor.
	int server_sock, session_sock;

	if((server_sock = esix_find_socket(saddr, daddr, sport, dport, proto, FIND_LISTEN)) < 0)
		return -1;

	//we found the server socket. try to create a service socket
	if((session_sock = socket(AF_INET6, proto, 0)) < 0)
		return -1;

	if((sqe = esix_w_malloc(sizeof(struct sock_queue))) == NULL)
	{
		esix_sockets[session_sock].state = CLOSED;
		return -1;
	}

	//there's no element in the list.
	if(esix_sockets[server_sock].queue == NULL)
		esix_sockets[server_sock].queue = sqe;
	else
	{
		//find the end of the list
		cur_sqe = esix_sockets[server_sock].queue;
		while(cur_sqe->next_e != NULL)
			cur_sqe = cur_sqe->next_e;
		cur_sqe->next_e	= sqe;
	}

	sqe->qe_type = CHILD_SOCK;
	sqe->socknum = session_sock;
	sqe->next_e  = NULL;

	//copy remote addr stuff
	esix_memcpy(&esix_sockets[session_sock].raddr, saddr, 16);
	esix_sockets[session_sock].rport = sport;
	esix_sockets[session_sock].proto = proto;
	esix_memcpy(&esix_sockets[session_sock].laddr, daddr, 16);
	esix_sockets[session_sock].lport = dport;
	esix_sockets[session_sock].state = SYN_RECEIVED;

	return session_sock;
}

int esix_find_socket(const struct ip6_addr *saddr, const struct ip6_addr *daddr, u16_t sport, u16_t dport, u8_t proto, u8_t mask)
{
	int i=0;
	while(i<ESIX_MAX_SOCK)
	{
		//loop through the socket table until we find a match
		//first, look at protocol and port numbers.
		//then, let's see if either the packet was sent to the socket's
		//local address or if the socket is listening on all interfaces
		if(esix_sockets[i].proto == proto && esix_sockets[i].lport == dport &&
			((esix_memcmp(daddr, &esix_sockets[i].laddr, 16) == 0) ||
			(esix_memcmp(&esix_sockets[i].laddr, &in6addr_any, 16) == 0)))
		{
			switch(mask)
			{
				case FIND_ANY:
					return i;
				break;

				case FIND_LISTEN:
					if(esix_sockets[i].state == LISTEN)
						return i;
				break;

				case FIND_CONNECTED:
					if(esix_sockets[i].state != CLOSED &&
						esix_sockets[i].state != RESERVED &&
						(esix_memcmp(&esix_sockets[i].raddr, saddr, 16) == 0) &&
						esix_sockets[i].rport == sport)
						return i;
				break;
			}

		}
		i++;
	}
	//we couldn't find any socket capable of handling this packet.
	return -1;
}

int socket(const int family, const u8_t type, const u8_t proto)
{
	int i;
	//TODO : allow the same socket number on TCP & UDP

	//we only support inet6
	if(family != AF_INET6)
		return -1;

	//find a free port number
	while(1)
	{
		if(++esix_last_port > LAST_PORT || esix_last_port < FIRST_PORT)
			esix_last_port = FIRST_PORT;

		if(esix_port_available(esix_last_port) == 0)
			break;
	}

	//find a free socket number
	i=0;
	while(i<ESIX_MAX_SOCK)
	{
		//we found a free socket holder
		if(esix_sockets[i].state == CLOSED)
		{
			esix_sockets[i].state = RESERVED;
			esix_sockets[i].proto = type; //mmmm...
			esix_sockets[i].lport = esix_last_port;
			esix_sockets[i].rport = 0;
			esix_memcpy(&esix_sockets[i].laddr, &in6addr_any, 16);
			esix_memcpy(&esix_sockets[i].raddr, &in6addr_any, 16);
			esix_sockets[i].seqn = 0; //TODO : should be random
			esix_sockets[i].ackn = 0;
			esix_sockets[i].rexmit_date = 0;
			esix_sockets[i].queue = NULL;

			return i;
		}
		i++;
	}

	//the socket table is most likely full
	uart_printf("socket : ressource temp. unavailable\n");
	return -1;
}

int bind(const int socknum, const struct sockaddr_in6 *sockaddr, const int len)
{
	int i=0;
	if(len != sizeof(struct sockaddr_in6))
		return -1;

	//loop through the socket list to find if the port is available
	while(i<ESIX_MAX_SOCK)
	{
		if(esix_sockets[i].state != CLOSED &&
			esix_sockets[i].lport == sockaddr->sin6_port)
			return -1;
		i++;
	}

	//now check that we actually own the requested adress
	//if it's all zeroes, OK
	if(esix_memcmp(&in6addr_any, &sockaddr->sin6_addr, 16) == 0)
	{
		esix_sockets[socknum].lport = sockaddr->sin6_port;
		esix_memcpy(&esix_sockets[socknum].laddr, &in6addr_any, 16);
		return 0;
	}
	else //check that we own the address
	{
		i=0;
		while(i<ESIX_MAX_IPADDR)
		{
			if(addrs[i] != NULL &&
				esix_memcmp(&addrs[i]->addr, &sockaddr->sin6_addr, 16) == 0)
			{
				esix_sockets[socknum].lport = sockaddr->sin6_port;
				esix_memcpy(&addrs[i]->addr, &sockaddr->sin6_addr, 16);
				return 0;
			}
		}
	}
	return -1;

}

int listen(int socket, int blacklog)
{
	if(esix_sockets[socket].state == RESERVED)
	{
		esix_sockets[socket].state = LISTEN;
		return 0;
	}
	return -1;
}

int close(const int socknum)
{
	if(esix_sockets[socknum].state == CLOSED ||
		esix_sockets[socknum].state == CLOSING)
		return -1;

	if(esix_sockets[socknum].proto == SOCK_STREAM)
	{
		switch(esix_sockets[socknum].state)
		{
			//FIXME : this is way too harsh
			case SYN_SENT:
			case SYN_RECEIVED:
			case CLOSING:
			case ESTABLISHED:
				esix_tcp_send(&esix_sockets[socknum].laddr,
						&esix_sockets[socknum].raddr,
						esix_sockets[socknum].lport,
						esix_sockets[socknum].rport,
						esix_sockets[socknum].seqn,
						esix_sockets[socknum].ackn,
							RST|ACK, NULL, 0);
			break;
			default :
			break;
		}
	}
	//uart_printf("close : closing %x\n", socknum);
	esix_sockets[socknum].state = CLOSING;
	esix_socket_free_queue(socknum);
	esix_sockets[socknum].state = CLOSED;

	return 0;
}

void esix_socket_free_queue(int socknum)
{
	struct sock_queue *sqe;

	//purge the socket element list, one by one
	while(esix_sockets[socknum].queue != NULL)
	{
		//grab the first available element
		sqe = esix_sockets[socknum].queue;
		//remove the current element
		esix_sockets[socknum].queue = sqe->next_e;
		//free its payload, if any
		if(sqe->qe_type == RECV_PKT || sqe->qe_type == SENT_PKT)
			esix_w_free(sqe->data);
		//finally free it.
		esix_w_free(sqe);
	}
}

int send(const int socknum, const void *buf, const int len, const u8_t flags)
{
	//send can be used with both TCP or UDP sockets but in case of
	//UDP we need to make sure we're in connected state
	if(esix_sockets[socknum].state != ESTABLISHED)
		return -1;

	if(esix_sockets[socknum].proto == SOCK_STREAM)
	{
		//queue the segment first,
		//if it fails, bail out and tell the user.
		if(esix_queue_data(socknum, buf, len, NULL, OUT) < 0)
			return 0;

		//now that we made sure we saved it, try to send it.
		//we can always retransmit it if needed.
		esix_tcp_send(&esix_sockets[socknum].laddr,
					&esix_sockets[socknum].raddr,
					esix_sockets[socknum].lport,
					esix_sockets[socknum].rport,
					esix_sockets[socknum].seqn,
					esix_sockets[socknum].ackn,
					PSH|ACK, buf, len);

		esix_sockets[socknum].seqn+= len;
		esix_sockets[socknum].rexmit_date = esix_get_time() + 2;

		return len;
	}
	else if(esix_sockets[socknum].proto == SOCK_DGRAM)
	{
		//not saving sent UDP packets
		esix_udp_send(&esix_sockets[socknum].laddr,
					&esix_sockets[socknum].raddr,
					esix_sockets[socknum].lport,
					esix_sockets[socknum].rport,
					buf, len);
		return len;
	}
	else
		//should never happen
		return -1;
}

int esix_port_available(const u16_t port)
{
	int i=0;
	while(i<ESIX_MAX_SOCK)
	{
		if(esix_sockets[i].state != CLOSED &&
			esix_sockets[i].lport == port)
			return -1;
		i++;
	}
	return 0;
}

//expires every sent packet with (seq number + payload_len) < ackn
int esix_socket_expire_e(int s, u32_t ackn)
{
	int i=0;
	struct sock_queue *sqe, *prev_sqe, *tmp;
	sqe = prev_sqe = esix_sockets[s].queue;

	//find the first available eligible packet in queue
	//and keep a reference to the previous queue element
	while(sqe != NULL)
	{
		if(sqe->qe_type == SENT_PKT)
		{
			if(sqe->seqn + sqe->data_len <= ackn)
			{
				tmp = sqe;
				//first element needs special treatment
				if(esix_sockets[s].queue == sqe)
					esix_sockets[s].queue = sqe->next_e;
				else
					prev_sqe->next_e = sqe->next_e;

				//update pointer to move forward
					sqe 	= sqe->next_e;

				//free the element and its data
				esix_w_free(tmp->data);
				esix_w_free(tmp);

				i++;
			}
			else
				break; //we're done here.
		}
		else
		{
			prev_sqe= sqe;
			sqe 	= sqe->next_e;
		}
	}

	return i;
}

//in charge of retransmission / time outs
void esix_socket_housekeep()
{
	int s;
	struct sock_queue *sqe;
	for(s=0; s<ESIX_MAX_SOCK; s++)
	{
		//either retransmission is disabled or scheduled for
		//a later time on this socket
		if(esix_sockets[s].rexmit_date == 0 ||
			esix_sockets[s].rexmit_date > esix_get_time())
			continue;

		//show time. find the first available packet and resend it.
		if((sqe = esix_socket_find_e(s, SENT_PKT, KEEP)) != NULL)
		{
			if(esix_get_time() - sqe->t_sent > MAX_RETX_TIME)
			{
				//we've been trying far too long
				esix_tcp_send(&esix_sockets[s].laddr,
						&esix_sockets[s].raddr, esix_sockets[s].lport,
						esix_sockets[s].rport, esix_sockets[s].seqn,
						esix_sockets[s].ackn, RST|ACK, NULL, 0);
				esix_sockets[s].state = CLOSING;
				esix_socket_free_queue(s);
				esix_sockets[s].state = CLOSED;
				uart_printf("esix_socket_housekeep : socket %x timed out, closing.\n", s);
				continue;
			}

			//first update the retransmission date
			//exp backoff fashion
			esix_sockets[s].rexmit_date = esix_get_time() +
				((esix_get_time() - sqe->t_sent)^2);

			esix_tcp_send(&esix_sockets[s].laddr,
				&esix_sockets[s].raddr, esix_sockets[s].lport,
				esix_sockets[s].rport,	sqe->seqn,
				esix_sockets[s].ackn,	PSH|ACK,
				sqe->data, sqe->data_len);

		}
		else
		{
			//no more packet to rexmit : either the ACKs we received
			//triggered enough retransmissions or evicted multiple packets from the queue.
			//disable retransmission.
			//uart_printf("socket_housekeep : rexmit set on %x but nothing to retransmit\n", s);
			esix_sockets[s].rexmit_date = 0;
		}
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_pressed="true">
        <bitmap android:src="@drawable/next_pressed"/>
    </item>

    <item>
        <bitmap android:src="@drawable/next"/>
    </item>

</selector><!-- From: file:/D:/development/android/projects/mirabilis/br.com.mirabilis/br.com.mirabilis/res/drawable/next_selector.xml -->

redpajama_set_name: RedPajamaGithub


text:
from google.cloud import aiplatform_v1beta1

def sample_cancel_data_labeling_job():
    # Create a client
    client = aiplatform_v1beta1.JobServiceClient()

    # Initialize request argument(s)
    request = aiplatform_v1beta1.CancelDataLabelingJobRequest(
        name="name_value",
    )

    # Make the request
    client.cancel_data_labeling_job(request=request)

# [END aiplatform_generated_aiplatform_v1beta1_JobService_CancelDataLabelingJob_sync]


text:
package testvariants

import (
	"fmt"
	"sort"
	"testing"
	"time"

	"cloud.google.com/go/spanner"
	. "github.com/smartystreets/goconvey/convey"
	"google.golang.org/grpc/codes"
	"google.golang.org/protobuf/proto"
	"google.golang.org/protobuf/types/known/durationpb"
	"google.golang.org/protobuf/types/known/timestamppb"

	"go.chromium.org/luci/common/clock/testclock"
	"go.chromium.org/luci/common/proto/mask"
	. "go.chromium.org/luci/common/testing/assertions"
	"go.chromium.org/luci/resultdb/internal/invocations"
	"go.chromium.org/luci/resultdb/internal/pagination"
	"go.chromium.org/luci/resultdb/internal/spanutil"
	"go.chromium.org/luci/resultdb/internal/testutil"
	"go.chromium.org/luci/resultdb/internal/testutil/insert"
	"go.chromium.org/luci/resultdb/pbutil"
	pb "go.chromium.org/luci/resultdb/proto/v1"
	"go.chromium.org/luci/server/span"
)

func TestQueryTestVariants(t *testing.T) {
	Convey(`QueryTestVariants`, t, func() {
		ctx := testutil.SpannerTestContext(t)

		q := &Query{
			InvocationIDs:      invocations.NewIDSet("inv0", "inv1"),
			PageSize:           100,
			ResultLimit:        10,
			ResponseLimitBytes: DefaultResponseLimitBytes,
		}

		fetch := func(q *Query) (tvs []*pb.TestVariant, token string, err error) {
			ctx, cancel := span.ReadOnlyTransaction(ctx)
			defer cancel()
			return q.Fetch(ctx)
		}

		mustFetch := func(q *Query) (tvs []*pb.TestVariant, token string) {
			tvs, token, err := fetch(q)
			So(err, ShouldBeNil)
			return
		}

		fetchAll := func(q *Query, f func(tvs []*pb.TestVariant)) {
			for {
				tvs, token, err := fetch(q)
				So(err, ShouldBeNil)
				if token == "" {
					break
				}
				f(tvs)

				// The page token should always advance, it should
				// never remain the same.
				So(token, ShouldNotEqual, q.PageToken)
				q.PageToken = token
			}
		}

		getTVStrings := func(tvs []*pb.TestVariant) []string {
			tvStrings := make([]string, len(tvs))
			for i, tv := range tvs {
				tvStrings[i] = fmt.Sprintf("%d/%s/%s", int32(tv.Status), tv.TestId, tv.VariantHash)
			}
			return tvStrings
		}

		testutil.MustApply(ctx, insert.Invocation("inv0", pb.Invocation_ACTIVE, nil))
		testutil.MustApply(ctx, insert.Invocation("inv1", pb.Invocation_ACTIVE, nil))
		testutil.MustApply(ctx, testutil.CombineMutations(
			insert.TestResults("inv0", "T1", nil, pb.TestStatus_PASS, pb.TestStatus_FAIL),
			insert.TestResults("inv0", "T2", nil, pb.TestStatus_PASS),
			insert.TestResults("inv0", "T5", nil, pb.TestStatus_FAIL),
			insert.TestResults(
				"inv0", "T6", nil,
				pb.TestStatus_PASS, pb.TestStatus_PASS, pb.TestStatus_PASS,
				pb.TestStatus_PASS, pb.TestStatus_PASS, pb.TestStatus_PASS,
				pb.TestStatus_PASS, pb.TestStatus_PASS, pb.TestStatus_PASS,
				pb.TestStatus_PASS, pb.TestStatus_PASS, pb.TestStatus_PASS,
			),
			insert.TestResults("inv0", "T7", nil, pb.TestStatus_PASS),
			insert.TestResults("inv0", "T8", nil, pb.TestStatus_PASS, pb.TestStatus_FAIL),
			insert.TestResults("inv0", "T9", nil, pb.TestStatus_PASS),
			insert.TestResults("inv1", "T1", nil, pb.TestStatus_PASS),
			insert.TestResults("inv1", "T2", nil, pb.TestStatus_FAIL),
			insert.TestResults("inv1", "T3", nil, pb.TestStatus_PASS, pb.TestStatus_PASS),
			insert.TestResults("inv1", "T5", pbutil.Variant("a", "b"), pb.TestStatus_FAIL, pb.TestStatus_PASS),
			insert.TestResults(
				"inv1", "Ty", nil,
				pb.TestStatus_FAIL, pb.TestStatus_FAIL, pb.TestStatus_FAIL,
				pb.TestStatus_FAIL, pb.TestStatus_FAIL, pb.TestStatus_FAIL,
				pb.TestStatus_FAIL, pb.TestStatus_FAIL, pb.TestStatus_FAIL,
				pb.TestStatus_FAIL, pb.TestStatus_FAIL, pb.TestStatus_FAIL,
			),
			insert.TestResults("inv1", "Tx", nil, pb.TestStatus_SKIP),
			insert.TestResults("inv1", "Tz", nil, pb.TestStatus_SKIP, pb.TestStatus_SKIP),

			insert.TestExonerations("inv0", "T1", nil, pb.ExonerationReason_OCCURS_ON_OTHER_CLS,
				pb.ExonerationReason_NOT_CRITICAL, pb.ExonerationReason_OCCURS_ON_MAINLINE),
			insert.TestExonerations("inv0", "T2", nil, pb.ExonerationReason_UNEXPECTED_PASS, 1),
		)...)

		// Insert an additional TestResult for comparing TestVariant.Results.Result.
		startTime := timestamppb.New(testclock.TestRecentTimeUTC.Add(-2 * time.Minute))
		duration := &durationpb.Duration{Seconds: 0, Nanos: 234567000}
		strPairs := pbutil.StringPairs(
			"buildername", "blder",
			"test_suite", "foo_unittests",
			"test_id_prefix", "ninja://tests:tests/")

		tmd := &pb.TestMetadata{
			Name: "T4",
			Location: &pb.TestLocation{
				FileName: "//t4.go",
				Line:     54,
			}}
		tmdBytes, _ := proto.Marshal(tmd)

		failureReason := &pb.FailureReason{
			PrimaryErrorMessage: "primary error msg",
		}
		failureReasonBytes, _ := proto.Marshal(failureReason)

		testutil.MustApply(ctx,
			spanutil.InsertMap("TestResults", map[string]interface{}{
				"InvocationId":    invocations.ID("inv1"),
				"TestId":          "T4",
				"ResultId":        "0",
				"Variant":         pbutil.Variant("a", "b"),
				"VariantHash":     pbutil.VariantHash(pbutil.Variant("a", "b")),
				"CommitTimestamp": spanner.CommitTimestamp,
				"IsUnexpected":    true,
				"Status":          pb.TestStatus_FAIL,
				"RunDurationUsec": pbutil.MustDuration(duration).Microseconds(),
				"StartTime":       startTime,
				"SummaryHtml":     spanutil.Compressed("SummaryHtml"),
				"FailureReason":   spanutil.Compressed(failureReasonBytes),
				"Tags":            pbutil.StringPairsToStrings(strPairs...),
				"TestMetadata":    spanutil.Compressed(tmdBytes),
			}),
		)

		// Tx has an expected skip so it should be FLAKY instead of UNEXPECTEDLY_SKIPPED.
		testutil.MustApply(ctx,
			spanutil.InsertMap("TestResults", map[string]interface{}{
				"InvocationId":    invocations.ID("inv1"),
				"TestId":          "Tx",
				"ResultId":        "1",
				"Variant":         nil,
				"VariantHash":     pbutil.VariantHash(nil),
				"CommitTimestamp": spanner.CommitTimestamp,
				"IsUnexpected":    false,
				"Status":          pb.TestStatus_SKIP,
				"RunDurationUsec": pbutil.MustDuration(duration).Microseconds(),
				"StartTime":       startTime,
				"SummaryHtml":     spanutil.Compressed("SummaryHtml"),
				"Tags":            pbutil.StringPairsToStrings(strPairs...),
				"TestMetadata":    spanutil.Compressed(tmdBytes),
			}),
		)

		Convey(`Unexpected works`, func() {
			tvs, _ := mustFetch(q)
			tvStrings := getTVStrings(tvs)
			So(tvStrings, ShouldResemble, []string{
				"10/T4/c467ccce5a16dc72",
				"10/T5/e3b0c44298fc1c14",
				"10/Ty/e3b0c44298fc1c14",
				"20/Tz/e3b0c44298fc1c14",
				"30/T5/c467ccce5a16dc72",
				"30/T8/e3b0c44298fc1c14",
				"30/Tx/e3b0c44298fc1c14",
				"40/T1/e3b0c44298fc1c14",
				"40/T2/e3b0c44298fc1c14",
			})

			So(tvs[0].Results, ShouldResembleProto, []*pb.TestResultBundle{
				{
					Result: &pb.TestResult{
						Name:        "invocations/inv1/tests/T4/results/0",
						ResultId:    "0",
						Expected:    false,
						Status:      pb.TestStatus_FAIL,
						StartTime:   startTime,
						Duration:    duration,
						SummaryHtml: "SummaryHtml",
						FailureReason: &pb.FailureReason{
							PrimaryErrorMessage: "primary error msg",
						},
						Tags: strPairs,
					},
				},
			})
			So(tvs[0].TestMetadata, ShouldResembleProto, tmd)
			sort.Slice(tvs[7].Exonerations, func(i, j int) bool {
				return tvs[7].Exonerations[i].ExplanationHtml < tvs[7].Exonerations[j].ExplanationHtml
			})
			So(tvs[7].Exonerations[0], ShouldResembleProto, &pb.TestExoneration{
				ExplanationHtml: "explanation 0",
				Reason:          pb.ExonerationReason_OCCURS_ON_OTHER_CLS,
			})

			So(tvs[7].Exonerations[1], ShouldResembleProto, &pb.TestExoneration{
				ExplanationHtml: "explanation 1",
				Reason:          pb.ExonerationReason_NOT_CRITICAL,
			})
			So(tvs[7].Exonerations[2], ShouldResembleProto, &pb.TestExoneration{
				ExplanationHtml: "explanation 2",
				Reason:          pb.ExonerationReason_OCCURS_ON_MAINLINE,
			})
			So(tvs[8].Exonerations[0], ShouldResembleProto, &pb.TestExoneration{
				ExplanationHtml: "explanation 0",
				Reason:          pb.ExonerationReason_UNEXPECTED_PASS,
			})
			So(len(tvs[2].Results), ShouldEqual, 10)
		})

		Convey(`Expected works`, func() {
			q.PageToken = pagination.Token("EXPECTED", "", "")
			tvs, _ := mustFetch(q)
			So(getTVStrings(tvs), ShouldResemble, []string{
				"50/T3/e3b0c44298fc1c14",
				"50/T6/e3b0c44298fc1c14",
				"50/T7/e3b0c44298fc1c14",
				"50/T9/e3b0c44298fc1c14",
			})
			So(len(tvs[0].Results), ShouldEqual, 2)
		})

		Convey(`Field mask works`, func() {
			Convey(`with minimum field mask`, func() {
				verifyFields := func(tvs []*pb.TestVariant) {
					for _, tv := range tvs {
						// Check all results have and only have .TestId, .VariantHash,
						// .Status populated.
						// Those fields should be included even when not specified.
						So(tv.TestId, ShouldNotBeEmpty)
						So(tv.VariantHash, ShouldNotBeEmpty)
						So(tv.Status, ShouldNotBeEmpty)
						So(tv, ShouldResembleProto, &pb.TestVariant{
							TestId:      tv.TestId,
							VariantHash: tv.VariantHash,
							Status:      tv.Status,
						})
					}
				}

				Convey(`with non-expected test variants`, func() {
					q.Mask = mask.MustFromReadMask(
						&pb.TestVariant{},
						"test_id",
					)
					tvs, _ := mustFetch(q)
					verifyFields(tvs)

					// TestId should still be populated even when not specified.
					q.Mask = mask.MustFromReadMask(
						&pb.TestVariant{},
						"status",
					)
					tvs, _ = mustFetch(q)
					verifyFields(tvs)
				})

				Convey(`with expected test variants`, func() {
					// Ensure the last test result (ordered by TestId, then by VariantHash)
					// is expected, so we can verify that the tail is trimmed properly.
					testutil.MustApply(ctx,
						insert.TestResults("inv1", "Tz0", nil, pb.TestStatus_PASS)...,
					)
					q.PageToken = pagination.Token("EXPECTED", "", "")

					q.Mask = mask.MustFromReadMask(
						&pb.TestVariant{},
						"test_id",
					)
					tvs, _ := mustFetch(q)
					verifyFields(tvs)
					So(tvs[len(tvs)-1].TestId, ShouldEqual, "Tz0")

					// TestId should still be populated even when not specified.
					q.Mask = mask.MustFromReadMask(
						&pb.TestVariant{},
						"status",
					)
					tvs, _ = mustFetch(q)
					verifyFields(tvs)
					So(tvs[len(tvs)-1].TestId, ShouldEqual, "Tz0")
				})

			})

			Convey(`with full field mask`, func() {
				q.Mask = mask.MustFromReadMask(
					&pb.TestVariant{},
					"*",
				)

				verifyFields := func(tvs []*pb.TestVariant) {
					for _, tv := range tvs {
						So(tv.TestId, ShouldNotBeEmpty)
						So(tv.VariantHash, ShouldNotBeEmpty)
						So(tv.Status, ShouldNotBeEmpty)
						So(tv.Variant, ShouldNotBeEmpty)
						So(tv.Results, ShouldNotBeEmpty)
						So(tv.TestMetadata, ShouldNotBeEmpty)

						if tv.Status == pb.TestVariantStatus_EXONERATED {
							So(tv.Exonerations, ShouldNotBeEmpty)
						}

						for _, result := range tv.Results {
							So(result.Result.Name, ShouldNotBeEmpty)
							So(result.Result.ResultId, ShouldNotBeEmpty)
							So(result.Result.Expected, ShouldNotBeEmpty)
							So(result.Result.Status, ShouldNotBeEmpty)
							So(result.Result.SummaryHtml, ShouldNotBeBlank)
							So(result.Result.Duration, ShouldNotBeNil)
							So(result.Result.Tags, ShouldNotBeNil)
							if tv.TestId == "T4" {
								So(result.Result.FailureReason, ShouldNotBeNil)
							}
							So(result, ShouldResembleProto, &pb.TestResultBundle{
								Result: &pb.TestResult{
									Name:          result.Result.Name,
									ResultId:      result.Result.ResultId,
									Expected:      result.Result.Expected,
									Status:        result.Result.Status,
									SummaryHtml:   result.Result.SummaryHtml,
									StartTime:     result.Result.StartTime,
									Duration:      result.Result.Duration,
									Tags:          result.Result.Tags,
									FailureReason: result.Result.FailureReason,
								},
							})
						}

						for _, exoneration := range tv.Exonerations {
							So(exoneration.ExplanationHtml, ShouldNotBeEmpty)
							if tv.TestId != "T2" {
								So(exoneration.Reason, ShouldNotBeZeroValue)
							}
							So(exoneration, ShouldResembleProto, &pb.TestExoneration{
								ExplanationHtml: exoneration.ExplanationHtml,
								Reason:          exoneration.Reason,
							})
						}

						So(tv, ShouldResembleProto, &pb.TestVariant{
							TestId:       tv.TestId,
							VariantHash:  tv.VariantHash,
							Status:       tv.Status,
							Results:      tv.Results,
							Exonerations: tv.Exonerations,
							Variant:      tv.Variant,
							TestMetadata: tv.TestMetadata,
						})
					}
				}

				Convey(`with non-expected test variants`, func() {
					tvs, _ := mustFetch(q)
					verifyFields(tvs)
				})

				Convey(`with expected test variants`, func() {
					// Ensure the last test result (ordered by TestId, then by VariantHash)
					// is expected, so we can verify that the tail is trimmed properly.
					testutil.MustApply(ctx,
						insert.TestResults("inv1", "Tz0", nil, pb.TestStatus_PASS)...,
					)
					q.PageToken = pagination.Token("EXPECTED", "", "")
					tvs, _ := mustFetch(q)
					verifyFields(tvs)
					So(tvs[len(tvs)-1].TestId, ShouldEqual, "Tz0")
				})
			})
		})

		Convey(`paging works`, func() {
			page := func(token string, expectedTVLen int32, expectedTVStrings []string) string {
				q.PageToken = token
				tvs, nextToken := mustFetch(q)
				So(getTVStrings(tvs), ShouldResemble, expectedTVStrings)
				return nextToken
			}

			q.PageSize = 15
			nextToken := page("", 8, []string{
				"10/T4/c467ccce5a16dc72",
				"10/T5/e3b0c44298fc1c14",
				"10/Ty/e3b0c44298fc1c14",
				"20/Tz/e3b0c44298fc1c14",
				"30/T5/c467ccce5a16dc72",
				"30/T8/e3b0c44298fc1c14",
				"30/Tx/e3b0c44298fc1c14",
				"40/T1/e3b0c44298fc1c14",
				"40/T2/e3b0c44298fc1c14",
			})
			So(nextToken, ShouldEqual, pagination.Token("EXPECTED", "", ""))

			nextToken = page(nextToken, 1, []string{
				"50/T3/e3b0c44298fc1c14",
			})
			So(nextToken, ShouldEqual, pagination.Token("EXPECTED", "T5", "e3b0c44298fc1c14"))

			nextToken = page(nextToken, 2, []string{
				"50/T6/e3b0c44298fc1c14",
				"50/T7/e3b0c44298fc1c14",
			})
			So(nextToken, ShouldEqual, pagination.Token("EXPECTED", "T8", "e3b0c44298fc1c14"))

			nextToken = page(nextToken, 1, []string{"50/T9/e3b0c44298fc1c14"})
			So(nextToken, ShouldEqual, "CghFWFBFQ1RFRAoCVHkKEGUzYjBjNDQyOThmYzFjMTQ=")

			nextToken = page(nextToken, 0, []string{})
			So(nextToken, ShouldEqual, "")
		})

		Convey(`Page Token`, func() {
			Convey(`wrong number of parts`, func() {
				q.PageToken = pagination.Token("testId", "variantHash")
				_, _, err := q.Fetch(ctx)
				So(err, ShouldHaveAppStatus, codes.InvalidArgument, "invalid page_token")
			})

			Convey(`first part not tvStatus`, func() {
				q.PageToken = pagination.Token("50", "testId", "variantHash")
				_, _, err := q.Fetch(ctx)
				So(err, ShouldHaveAppStatus, codes.InvalidArgument, "invalid page_token")
			})
		})

		Convey(`status filter works`, func() {
			Convey(`only unexpected`, func() {
				q.Predicate = &pb.TestVariantPredicate{Status: pb.TestVariantStatus_UNEXPECTED}
				tvs, token := mustFetch(q)
				tvStrings := getTVStrings(tvs)
				So(tvStrings, ShouldResemble, []string{
					"10/T4/c467ccce5a16dc72",
					"10/T5/e3b0c44298fc1c14",
					"10/Ty/e3b0c44298fc1c14",
				})
				So(token, ShouldEqual, "")
			})

			Convey(`only expected`, func() {
				q.Predicate = &pb.TestVariantPredicate{Status: pb.TestVariantStatus_EXPECTED}
				tvs, _ := mustFetch(q)
				So(getTVStrings(tvs), ShouldResemble, []string{
					"50/T3/e3b0c44298fc1c14",
					"50/T6/e3b0c44298fc1c14",
					"50/T7/e3b0c44298fc1c14",
					"50/T9/e3b0c44298fc1c14",
				})
				So(len(tvs[0].Results), ShouldEqual, 2)
			})

			Convey(`any unexpected or exonerated`, func() {
				q.Predicate = &pb.TestVariantPredicate{Status: pb.TestVariantStatus_UNEXPECTED_MASK}
				tvs, _ := mustFetch(q)
				So(getTVStrings(tvs), ShouldResemble, []string{
					"10/T4/c467ccce5a16dc72",
					"10/T5/e3b0c44298fc1c14",
					"10/Ty/e3b0c44298fc1c14",
					"20/Tz/e3b0c44298fc1c14",
					"30/T5/c467ccce5a16dc72",
					"30/T8/e3b0c44298fc1c14",
					"30/Tx/e3b0c44298fc1c14",
					"40/T1/e3b0c44298fc1c14",
					"40/T2/e3b0c44298fc1c14",
				})
			})
		})

		Convey(`ResultLimit works`, func() {
			q.ResultLimit = 2
			tvs, _ := mustFetch(q)

			for _, tv := range tvs {
				So(len(tv.Results), ShouldBeLessThanOrEqualTo, q.ResultLimit)
			}
		})

		Convey(`ResponseLimitBytes works`, func() {
			q.ResponseLimitBytes = 1

			var allTVs []*pb.TestVariant
			fetchAll(q, func(tvs []*pb.TestVariant) {
				// Expect at most one test variant per page.
				So(len(tvs), ShouldBeLessThanOrEqualTo, 1)
				allTVs = append(allTVs, tvs...)
			})

			// All test variants should be returned.
			So(getTVStrings(allTVs), ShouldResemble, []string{
				"10/T4/c467ccce5a16dc72",
				"10/T5/e3b0c44298fc1c14",
				"10/Ty/e3b0c44298fc1c14",
				"20/Tz/e3b0c44298fc1c14",
				"30/T5/c467ccce5a16dc72",
				"30/T8/e3b0c44298fc1c14",
				"30/Tx/e3b0c44298fc1c14",
				"40/T1/e3b0c44298fc1c14",
				"40/T2/e3b0c44298fc1c14",
				"50/T3/e3b0c44298fc1c14",
				"50/T6/e3b0c44298fc1c14",
				"50/T7/e3b0c44298fc1c14",
				"50/T9/e3b0c44298fc1c14",
			})
		})

		Convey(`PageSize works`, func() {
			q.PageSize = 1

			var allTVs []*pb.TestVariant
			fetchAll(q, func(tvs []*pb.TestVariant) {
				// Expect at most one test variant per page.
				So(len(tvs), ShouldBeLessThanOrEqualTo, 1)
				allTVs = append(allTVs, tvs...)
			})

			// All test variants should be returned.
			So(getTVStrings(allTVs), ShouldResemble, []string{
				"10/T4/c467ccce5a16dc72",
				"10/T5/e3b0c44298fc1c14",
				"10/Ty/e3b0c44298fc1c14",
				"20/Tz/e3b0c44298fc1c14",
				"30/T5/c467ccce5a16dc72",
				"30/T8/e3b0c44298fc1c14",
				"30/Tx/e3b0c44298fc1c14",
				"40/T1/e3b0c44298fc1c14",
				"40/T2/e3b0c44298fc1c14",
				"50/T3/e3b0c44298fc1c14",
				"50/T6/e3b0c44298fc1c14",
				"50/T7/e3b0c44298fc1c14",
				"50/T9/e3b0c44298fc1c14",
			})
		})

		Convey(`Empty Invocation works`, func() {
			q.InvocationIDs = invocations.NewIDSet("invnotexists")

			var allTVs []*pb.TestVariant
			fetchAll(q, func(tvs []*pb.TestVariant) {
				allTVs = append(allTVs, tvs...)
			})
			So(allTVs, ShouldHaveLength, 0)
		})
	})
}

func TestAdjustResultLimit(t *testing.T) {
	t.Parallel()
	Convey(`AdjustResultLimit`, t, func() {
		Convey(`OK`, func() {
			So(AdjustResultLimit(50), ShouldEqual, 50)
		})
		Convey(`Too big`, func() {
			So(AdjustResultLimit(1e6), ShouldEqual, resultLimitMax)
		})
		Convey(`Missing or 0`, func() {
			So(AdjustResultLimit(0), ShouldEqual, resultLimitDefault)
		})
	})
}


text:
<?php
namespace CodeNet\KKClient\Resource;

use CodeNet\KKClient\Resource;

class InpostMachine extends Resource
{
    /**
     * @var string
     */
    protected $name;

    /**
     * @var string
     */
    protected $description;

    /**
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * @param string $description
     */
    public function setDescription($description)
    {
        $this->description = $description;
    }

    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

}


text:
package com.ickstream.protocol.service.playlists;

import com.ickstream.protocol.common.ChunkedResponse;

import java.util.ArrayList;
import java.util.List;

public class FindPlaylistsResponse extends ChunkedResponse {
    private List<Playlist> items = new ArrayList<Playlist>();

    public List<Playlist> getItems() {
        return items;
    }

    public void setItems(List<Playlist> items) {
        this.items = items;
    }
}


text:
package io.chlipchat;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.eventbus.EventBus;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.handler.StaticHandler;
import io.vertx.ext.web.handler.sockjs.BridgeEventType;
import io.vertx.ext.web.handler.sockjs.BridgeOptions;
import io.vertx.ext.web.handler.sockjs.PermittedOptions;
import io.vertx.ext.web.handler.sockjs.SockJSHandler;

import java.time.Instant;

public class Server extends AbstractVerticle {

    //TODO: need to have login

    public static final String ADDRESS_CHAT_TO_SERVER = "chat.to.server";
    public static final String ADDRESS_CHAT_TO_CLIENT = "chat.to.client";
    public static final String ADDRESS_MAINTENANCE = "chat.MAINTENANCE";
    public static final String USERS_MAP_NAME = "users";

    @Override
    public void start() throws Exception {
        JsonArray messages = new JsonArray();

        Router router = Router.router(vertx);

        BridgeOptions opts = new BridgeOptions()
                .addInboundPermitted(new PermittedOptions().setAddress(ADDRESS_CHAT_TO_SERVER))
                .addOutboundPermitted(new PermittedOptions().setAddress(ADDRESS_CHAT_TO_CLIENT))
                .addOutboundPermitted(new PermittedOptions().setAddress(ADDRESS_MAINTENANCE));

        router.route("/webjars/*").handler(webjarsHandler());
        router.route("/eventbus/*").handler(sockJSHandler(opts));
        router.route().handler(staticHandler());

        vertx.createHttpServer().requestHandler(router::accept).listen(8080);
        EventBus eb = vertx.eventBus();

        eb.consumer(ADDRESS_CHAT_TO_SERVER).handler(message -> {
            JsonObject body = (JsonObject) message.body();
            if("init".equals(body.getString("cmd"))) {
                message.reply(messages);
                eb.publish(ADDRESS_MAINTENANCE, new JsonObject()
                        .put("cmd", "userJoined")
                        .put("login", body.getString("login"))
                        .put("handlerID", body.getString("handlerID")));
                vertx.sharedData().getLocalMap(USERS_MAP_NAME)
                        .put(body.getString("handlerID"), new JsonObject()
                                .put("login", body.getString("login"))
                                .put("handlerID",body.getString("handlerID")));
            }
            else if("user-list".equals(body.getString("cmd"))) {
                JsonArray userList = new JsonArray();
                vertx.sharedData().getLocalMap(USERS_MAP_NAME).values()
                        .stream()
                        .forEach(user -> userList.add(user));
                message.reply(userList);
            }
            else {
                body.put("instant", Instant.now());
                messages.add(body);
                eb.publish(ADDRESS_CHAT_TO_CLIENT, body);
            }
        });
    }

    private SockJSHandler sockJSHandler(BridgeOptions opts) {
        return SockJSHandler.create(vertx).bridge(opts, event -> {
            if(event.type() == BridgeEventType.SOCKET_CREATED) {
                event.socket().write(Buffer.buffer(new JsonObject()
                        .put("type", "rec")
                        .put("body", new JsonObject()
                                .put("handlerID", event.socket().writeHandlerID())
                                .put("cmd", "handlerID")
                        )
                        .put("address", ADDRESS_MAINTENANCE).encode()));
            }
            if(event.type() == BridgeEventType.SOCKET_CLOSED) {
                vertx.eventBus().publish(ADDRESS_MAINTENANCE, new JsonObject()
                        .put("cmd", "userLeft")
                        .put("login", ((JsonObject) vertx.sharedData().getLocalMap(USERS_MAP_NAME).get(event.socket().writeHandlerID())).getString("login"))
                        .put("handlerID", event.socket().writeHandlerID()));
                vertx.sharedData().getLocalMap(USERS_MAP_NAME).remove(event.socket().writeHandlerID());
            }
            event.complete(true);
        });
    }

    private StaticHandler staticHandler() {
        return StaticHandler.create()
                .setCachingEnabled(false);
    }

    private StaticHandler webjarsHandler() {
        return StaticHandler.create()
                .setWebRoot("META-INF/resources/webjars")
                .setCachingEnabled(false);
    }
}


text:
'use strict';

import type {
  FetchPolicy,
  GraphQLResponse,
  IEnvironment,
  Observable,
  OperationDescriptor,
  ReaderFragment,
  RenderPolicy,
} from 'relay-runtime';

const SuspenseResource = require('../SuspenseResource');
const {getCacheForType, getCacheSignal} = require('./RelayReactCache');
const invariant = require('invariant');
const {
  RelayFeatureFlags,
  __internal: {fetchQuery: fetchQueryInternal},
} = require('relay-runtime');
const warning = require('warning');

type QueryCacheCommitable = () => () => void;

type QueryResult = {
  fragmentNode: ReaderFragment,
  fragmentRef: mixed,
};

// Note that the status of a cache entry will be 'resolved' when partial
// rendering is allowed, even if a fetch is ongoing. The pending status
// is specifically to indicate that we should suspend.
// Note also that the retainCount is different from the retain count of
// an operation, which is maintained by the Environment. This retain
// count is used in Legacy Timeouts mode to count how many components
// are mounted that use the entry, plus one count for the temporary retain
// before any components have mounted. It is unused when Legacy Timeouts
// mode is off.
type QueryCacheEntryStatus =
  | {
      status: 'resolved',
      result: QueryResult,
    }
  | {
      status: 'pending',
      promise: Promise<void>,
    }
  | {
      status: 'rejected',
      error: Error,
    };

type QueryCacheEntry = {
  ...QueryCacheEntryStatus,
  onCommit: QueryCacheCommitable,
  suspenseResource: SuspenseResource | null,
};

const DEFAULT_FETCH_POLICY = 'store-or-network';

const WEAKMAP_SUPPORTED = typeof WeakMap === 'function';

interface IMap<K, V> {
  delete(key: K): boolean;
  get(key: K): V | void;
  set(key: K, value: V): IMap<K, V>;
}

type QueryCacheKey = string;

class QueryCache {
  _map: IMap<IEnvironment, Map<QueryCacheKey, QueryCacheEntry>>;

  constructor() {
    this._map = WEAKMAP_SUPPORTED ? new WeakMap() : new Map();
  }

  get(environment: IEnvironment, key: QueryCacheKey): QueryCacheEntry | void {
    let forEnv = this._map.get(environment);
    if (!forEnv) {
      forEnv = new Map();
      this._map.set(environment, forEnv);
    }
    return forEnv.get(key);
  }

  set(
    environment: IEnvironment,
    key: QueryCacheKey,
    value: QueryCacheEntry,
  ): void {
    let forEnv = this._map.get(environment);
    if (!forEnv) {
      forEnv = new Map();
      this._map.set(environment, forEnv);
    }
    forEnv.set(key, value);
  }

  delete(environment: IEnvironment, key: QueryCacheKey): void {
    const forEnv = this._map.get(environment);
    if (!forEnv) {
      return;
    }
    forEnv.delete(key);
    if (forEnv.size === 0) {
      this._map.delete(environment);
    }
  }
}

function createQueryCache(): QueryCache {
  return new QueryCache();
}

const noopOnCommit = () => {
  return () => undefined;
};

const noopPromise = new Promise<void>(() => {});

function getQueryCacheKey(
  operation: OperationDescriptor,
  fetchPolicy: FetchPolicy,
  renderPolicy: RenderPolicy,
  fetchKey?: ?string | ?number,
): QueryCacheKey {
  return `${fetchPolicy}-${renderPolicy}-${operation.request.identifier}-${
    fetchKey ?? ''
  }`;
}

function constructQueryResult(operation: OperationDescriptor): QueryResult {
  const rootFragmentRef = {
    __id: operation.fragment.dataID,
    __fragments: {
      [operation.fragment.node.name]: operation.request.variables,
    },
    __fragmentOwner: operation.request,
  };
  return {
    fragmentNode: operation.request.node.fragment,
    fragmentRef: rootFragmentRef,
  };
}

function makeInitialCacheEntry() {
  return {
    status: 'pending',
    promise: noopPromise,
    onCommit: noopOnCommit,
    suspenseResource: null,
  };
}

function getQueryResultOrFetchQuery_REACT_CACHE(
  environment: IEnvironment,
  queryOperationDescriptor: OperationDescriptor,
  options?: {
    fetchPolicy?: FetchPolicy,
    renderPolicy?: RenderPolicy,
    fetchKey?: ?string | ?number,
    fetchObservable?: Observable<GraphQLResponse>,
  },
): [QueryResult, QueryCacheCommitable] {
  const fetchPolicy = options?.fetchPolicy ?? DEFAULT_FETCH_POLICY;
  const renderPolicy =
    options?.renderPolicy ?? environment.UNSTABLE_getDefaultRenderPolicy();

  const cache = getCacheForType(createQueryCache);

  const cacheKey = getQueryCacheKey(
    queryOperationDescriptor,
    fetchPolicy,
    renderPolicy,
    options?.fetchKey,
  );

  const initialEntry = cache.get(environment, cacheKey);

  function updateCache(
    updater: QueryCacheEntryStatus => QueryCacheEntryStatus,
  ) {
    let currentEntry = cache.get(environment, cacheKey);
    if (!currentEntry) {
      currentEntry = makeInitialCacheEntry();
      cache.set(environment, cacheKey, currentEntry);
    }
    // $FlowExpectedError[prop-missing] Extra properties are passed in -- this is fine
    const newStatus: {...} = updater(currentEntry);
    // $FlowExpectedError[cannot-spread-inexact] Flow cannot understand that this is valid...
    cache.set(environment, cacheKey, {...currentEntry, ...newStatus});
    // ... but we can because QueryCacheEntry spreads QueryCacheEntryStatus, so spreading
    // a QueryCacheEntryStatus into a QueryCacheEntry will result in a valid QueryCacheEntry.
  }

  // Initiate a query to fetch the data if needed:
  if (RelayFeatureFlags.USE_REACT_CACHE_LEGACY_TIMEOUTS) {
    let entry;
    if (initialEntry === undefined) {
      onCacheMiss(
        environment,
        queryOperationDescriptor,
        fetchPolicy,
        renderPolicy,
        updateCache,
        options?.fetchObservable,
      );
      const createdEntry = cache.get(environment, cacheKey);
      invariant(
        createdEntry !== undefined,
        'An entry should have been created by onCacheMiss. This is a bug in Relay.',
      );
      entry = createdEntry;
    } else {
      entry = initialEntry;
    }
    if (!entry.suspenseResource) {
      entry.suspenseResource = new SuspenseResource(() => {
        const retention = environment.retain(queryOperationDescriptor);
        return {
          dispose: () => {
            retention.dispose();
            cache.delete(environment, cacheKey);
          },
        };
      });
    }
    if (entry.onCommit === noopOnCommit) {
      entry.onCommit = () => {
        invariant(
          entry.suspenseResource,
          'SuspenseResource should have been initialized. This is a bug in Relay.',
        );
        const retention = entry.suspenseResource.permanentRetain(environment);
        return () => {
          retention.dispose();
        };
      };
    }
    entry.suspenseResource.temporaryRetain(environment);
  } else {
    if (initialEntry === undefined) {
      // This is the behavior we eventually want: We retain the query until the
      // presiding Cache component unmounts, at which point the AbortSignal
      // will be triggered.
      onCacheMiss(
        environment,
        queryOperationDescriptor,
        fetchPolicy,
        renderPolicy,
        updateCache,
        options?.fetchObservable,
      );

      // Since this is the first time rendering, retain the query. React will
      // trigger the abort signal when this cache entry is no longer needed.
      const retention = environment.retain(queryOperationDescriptor);

      const dispose = () => {
        retention.dispose();
        cache.delete(environment, cacheKey);
      };
      const abortSignal = getCacheSignal();
      abortSignal.addEventListener('abort', dispose, {once: true});
    }
  }

  const entry = cache.get(environment, cacheKey); // could be a different entry now if synchronously resolved
  invariant(
    entry !== undefined,
    'An entry should have been created by onCacheMiss. This is a bug in Relay.',
  );
  switch (entry.status) {
    case 'pending':
      throw entry.promise;
    case 'rejected':
      throw entry.error;
    case 'resolved':
      return [entry.result, entry.onCommit];
  }
  invariant(false, 'switch statement should be exhaustive');
}

function onCacheMiss(
  environment: IEnvironment,
  operation: OperationDescriptor,
  fetchPolicy: FetchPolicy,
  renderPolicy: RenderPolicy,
  updateCache: ((QueryCacheEntryStatus) => QueryCacheEntryStatus) => void,
  customFetchObservable?: Observable<GraphQLResponse>,
): void {
  // NB: Besides checking if the data is available, calling `check` will write missing
  // data to the store using any missing data handlers specified in the environment.
  const queryAvailability = environment.check(operation);
  const queryStatus = queryAvailability.status;
  const hasFullQuery = queryStatus === 'available';
  const canPartialRender =
    hasFullQuery || (renderPolicy === 'partial' && queryStatus !== 'stale');

  let shouldFetch;
  let shouldRenderNow;
  switch (fetchPolicy) {
    case 'store-only': {
      shouldFetch = false;
      shouldRenderNow = true;
      break;
    }
    case 'store-or-network': {
      shouldFetch = !hasFullQuery;
      shouldRenderNow = canPartialRender;
      break;
    }
    case 'store-and-network': {
      shouldFetch = true;
      shouldRenderNow = canPartialRender;
      break;
    }
    case 'network-only':
    default: {
      shouldFetch = true;
      shouldRenderNow = false;
      break;
    }
  }

  if (shouldFetch) {
    executeOperationAndKeepUpToDate(
      environment,
      operation,
      updateCache,
      customFetchObservable,
    );
    updateCache(existing => {
      switch (existing.status) {
        case 'resolved':
          return existing;
        case 'rejected':
          return existing;
        case 'pending':
          return shouldRenderNow
            ? {
                status: 'resolved',
                result: constructQueryResult(operation),
              }
            : existing;
      }
    });
  } else {
    invariant(
      shouldRenderNow,
      'Should either fetch or be willing to render. This is a bug in Relay.',
    );
    updateCache(_existing => ({
      status: 'resolved',
      result: constructQueryResult(operation),
    }));
  }
}

function executeOperationAndKeepUpToDate(
  environment: IEnvironment,
  operation: OperationDescriptor,
  updateCache: ((QueryCacheEntryStatus) => QueryCacheEntryStatus) => void,
  customFetchObservable?: Observable<GraphQLResponse>,
) {
  let resolvePromise;
  const promise = new Promise<void>(r => {
    resolvePromise = r;
  });
  // $FlowExpectedError[prop-missing] Expando to annotate Promises.
  promise.displayName = 'Relay(' + operation.request.node.operation.name + ')';

  let isFirstPayload = true;

  // FIXME We may still need to cancel network requests for live queries.
  const fetchObservable =
    customFetchObservable ?? fetchQueryInternal(environment, operation);
  fetchObservable.subscribe({
    start: subscription => {},
    error: error => {
      if (isFirstPayload) {
        updateCache(_existing => ({
          status: 'rejected',
          error,
        }));
      } else {
        // TODO:T92030819 Remove this warning and actually throw the network error
        // To complete this task we need to have a way of precisely tracking suspendable points
        warning(
          false,
          'getQueryResultOrFetchQuery: An incremental payload for query `%` returned an error: `%`:`%`.',
          operation.request.node.operation.name,
          error.message,
          error.stack,
        );
      }
      resolvePromise();
      isFirstPayload = false;
    },
    next: response => {
      // Stop suspending on the first payload because of streaming, defer, etc.
      updateCache(_existing => ({
        status: 'resolved',
        result: constructQueryResult(operation),
      }));
      resolvePromise();
      isFirstPayload = false;
    },
  });

  // If the above subscription yields a value synchronously, then one of the updates
  // above will have already happened and we'll now be in a resolved or rejected state.
  // But in the usual case, we save the promise to the entry here:
  updateCache(existing =>
    existing.status === 'pending' ? {status: 'pending', promise} : existing,
  );
}

module.exports = getQueryResultOrFetchQuery_REACT_CACHE;


text:
package com.facebook.litho;

import static com.facebook.litho.testing.MeasureSpecTestingUtilsKt.exactly;
import static com.facebook.litho.testing.MeasureSpecTestingUtilsKt.unspecified;
import static org.assertj.core.api.Assertions.assertThat;

import android.graphics.drawable.ColorDrawable;
import android.view.View;
import com.facebook.litho.config.TempComponentsConfigurations;
import com.facebook.litho.it.R;
import com.facebook.litho.testing.LegacyLithoViewRule;
import com.facebook.litho.testing.testrunner.LithoTestRunner;
import com.facebook.rendercore.testing.ViewAssertions;
import com.facebook.rendercore.testing.match.MatchNode;
import com.facebook.rendercore.testing.match.ViewMatchNode;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(LithoTestRunner.class)
public class ApplyStylesTest {

  public @Rule LegacyLithoViewRule mLegacyLithoViewRule = new LegacyLithoViewRule();

  @Before
  public void setup() {
    TempComponentsConfigurations.setShouldAddHostViewForRootComponent(true);
  }

  @Test
  public void styles_withWidthHeightStyle_appliesWidthHeight() {
    mLegacyLithoViewRule
        .setSizeSpecs(unspecified(), unspecified())
        .setRoot(
            Column.create(mLegacyLithoViewRule.getContext(), 0, R.style.ApplyStylesTest_WidthHeight)
                .build())
        .measure()
        .layout()
        .attachToWindow();

    assertThat(mLegacyLithoViewRule.getLithoView().getWidth()).isEqualTo(37);
    assertThat(mLegacyLithoViewRule.getLithoView().getHeight()).isEqualTo(100);
  }

  @Test
  public void styles_withMinWidthHeightStyle_appliesMinWidthHeight() {
    mLegacyLithoViewRule
        .setSizeSpecs(unspecified(), unspecified())
        .setRoot(
            Column.create(
                    mLegacyLithoViewRule.getContext(), 0, R.style.ApplyStylesTest_MinWidthHeight)
                .build())
        .measure()
        .layout()
        .attachToWindow();

    assertThat(mLegacyLithoViewRule.getLithoView().getWidth()).isEqualTo(50);
    assertThat(mLegacyLithoViewRule.getLithoView().getHeight()).isEqualTo(75);
  }

  @Test
  public void styles_withPaddingLeftTopRightBottomStyle_appliesPadding() {
    mLegacyLithoViewRule
        .setSizeSpecs(exactly(100), exactly(100))
        .setRoot(
            Row.create(
                    mLegacyLithoViewRule.getContext(),
                    0,
                    R.style.ApplyStylesTest_PaddingLeftTopRightBottom)
                .child(Column.create(mLegacyLithoViewRule.getContext()).flexGrow(1).wrapInView())
                .build())
        .measure()
        .layout()
        .attachToWindow();

    ViewAssertions.assertThat(mLegacyLithoViewRule.getLithoView())
        .matches(
            ViewMatchNode.forType(LithoView.class)
                .child(
                    ViewMatchNode.forType(View.class)
                        .bounds(10, 20, 100 - 10 - 30, 100 - 20 - 40)));
  }

  @Test
  public void styles_withPaddingAllStyle_appliesPadding() {
    mLegacyLithoViewRule
        .setSizeSpecs(exactly(100), exactly(100))
        .setRoot(
            Row.create(mLegacyLithoViewRule.getContext(), 0, R.style.ApplyStylesTest_PaddingAll)
                .child(Column.create(mLegacyLithoViewRule.getContext()).flexGrow(1).wrapInView())
                .build())
        .measure()
        .layout()
        .attachToWindow();

    ViewAssertions.assertThat(mLegacyLithoViewRule.getLithoView())
        .matches(
            ViewMatchNode.forType(LithoView.class)
                .child(
                    ViewMatchNode.forType(View.class)
                        .bounds(15, 15, 100 - 15 - 15, 100 - 15 - 15)));
  }

  @Ignore("T66670905")
  @Test
  public void styles_withPaddingStartEndStyle_appliesPadding() {
    mLegacyLithoViewRule
        .setSizeSpecs(exactly(100), exactly(100))
        .setRoot(
            Row.create(
                    mLegacyLithoViewRule.getContext(), 0, R.style.ApplyStylesTest_PaddingStartEnd)
                .child(Column.create(mLegacyLithoViewRule.getContext()).flexGrow(1).wrapInView())
                .build())
        .measure()
        .layout()
        .attachToWindow();

    ViewAssertions.assertThat(mLegacyLithoViewRule.getLithoView())
        .matches(
            ViewMatchNode.forType(LithoView.class)
                .child(ViewMatchNode.forType(View.class).bounds(20, 0, 100 - 20 - 40, 100)));
  }

  @Test
  public void styles_withMarginLeftTopRightBottomStyle_appliesMargin() {
    mLegacyLithoViewRule
        .setSizeSpecs(exactly(100), exactly(100))
        .setRoot(
            Row.create(mLegacyLithoViewRule.getContext())
                .child(
                    Column.create(
                            mLegacyLithoViewRule.getContext(),
                            0,
                            R.style.ApplyStylesTest_MarginLeftTopRightBottom)
                        .flexGrow(1)
                        .wrapInView())
                .build())
        .measure()
        .layout()
        .attachToWindow();

    ViewAssertions.assertThat(mLegacyLithoViewRule.getLithoView())
        .matches(
            ViewMatchNode.forType(LithoView.class)
                .child(
                    ViewMatchNode.forType(View.class)
                        .bounds(10, 20, 100 - 10 - 30, 100 - 20 - 40)));
  }

  @Test
  public void styles_withMarginAllStyle_appliesMargin() {
    mLegacyLithoViewRule
        .setSizeSpecs(exactly(100), exactly(100))
        .setRoot(
            Row.create(mLegacyLithoViewRule.getContext())
                .child(
                    Column.create(
                            mLegacyLithoViewRule.getContext(), 0, R.style.ApplyStylesTest_MarginAll)
                        .flexGrow(1)
                        .wrapInView())
                .build())
        .measure()
        .layout()
        .attachToWindow();

    ViewAssertions.assertThat(mLegacyLithoViewRule.getLithoView())
        .matches(
            ViewMatchNode.forType(LithoView.class)
                .child(
                    ViewMatchNode.forType(View.class)
                        .bounds(15, 15, 100 - 15 - 15, 100 - 15 - 15)));
  }

  @Ignore("T66670905")
  @Test
  public void styles_withMarginStartEndStyle_appliesMargin() {
    mLegacyLithoViewRule
        .setSizeSpecs(exactly(100), exactly(100))
        .setRoot(
            Row.create(mLegacyLithoViewRule.getContext())
                .child(
                    Column.create(
                            mLegacyLithoViewRule.getContext(),
                            0,
                            R.style.ApplyStylesTest_MarginStartEnd)
                        .flexGrow(1)
                        .wrapInView())
                .build())
        .measure()
        .layout()
        .attachToWindow();

    ViewAssertions.assertThat(mLegacyLithoViewRule.getLithoView())
        .matches(
            ViewMatchNode.forType(LithoView.class)
                .child(ViewMatchNode.forType(View.class).bounds(10, 0, 100 - 10 - 30, 100)));
  }

  @Test
  public void styles_withBackgroundForegroundStyle_appliesBackgroundAndForeground() {
    mLegacyLithoViewRule
        .setSizeSpecs(exactly(100), exactly(100))
        .setRoot(
            Row.create(mLegacyLithoViewRule.getContext())
                .wrapInView()
                .child(
                    Column.create(
                            mLegacyLithoViewRule.getContext(),
                            0,
                            R.style.ApplyStylesTest_BackgroundForeground)
                        .flexGrow(1)
                        .wrapInView())
                .build())
        .measure()
        .layout()
        .attachToWindow();

    final ComponentHost innerHost =
        (ComponentHost) mLegacyLithoViewRule.getLithoView().getChildAt(0);

    ViewAssertions.assertThat(innerHost)
        .matches(
            ViewMatchNode.forType(ComponentHost.class)
                .child(
                    ViewMatchNode.forType(ComponentHost.class)
                        .prop("background", MatchNode.forType(ColorDrawable.class))));
  }

  @Test
  public void
      styles_withAccessibilityAndContentDescriptionStyle_appliesAccessibilityAndContentDescription() {
    mLegacyLithoViewRule
        .setSizeSpecs(exactly(100), exactly(100))
        .setRoot(
            Row.create(mLegacyLithoViewRule.getContext())
                .wrapInView()
                .child(
                    Column.create(
                            mLegacyLithoViewRule.getContext(),
                            0,
                            R.style.ApplyStylesTest_AccessibilityAndContentDescription)
                        .flexGrow(1)
                        .wrapInView())
                .build())
        .measure()
        .layout()
        .attachToWindow();

    final ComponentHost innerHost =
        (ComponentHost) mLegacyLithoViewRule.getLithoView().getChildAt(0);

    ViewAssertions.assertThat(innerHost)
        .matches(
            ViewMatchNode.forType(ComponentHost.class)
                .child(
                    ViewMatchNode.forType(ComponentHost.class)
                        .prop("contentDescription", "Test Content Description")
                        .prop("isImportantForAccessibility", true)));
  }

  @Test
  public void styles_withDuplicateParentStateStyle_appliesDuplicateParentState() {
    mLegacyLithoViewRule
        .setSizeSpecs(exactly(100), exactly(100))
        .setRoot(
            Row.create(mLegacyLithoViewRule.getContext())
                .wrapInView()
                .child(
                    Column.create(
                            mLegacyLithoViewRule.getContext(),
                            0,
                            R.style.ApplyStylesTest_DuplicateParentState)
                        .flexGrow(1)
                        .wrapInView())
                .build())
        .measure()
        .layout()
        .attachToWindow();

    final ComponentHost innerHost =
        (ComponentHost) mLegacyLithoViewRule.getLithoView().getChildAt(0);

    ViewAssertions.assertThat(innerHost)
        .matches(
            ViewMatchNode.forType(ComponentHost.class)
                .child(
                    ViewMatchNode.forType(ComponentHost.class)
                        .prop("isDuplicateParentStateEnabled", true)));
  }

  @After
  public void restoreConfiguration() {
    TempComponentsConfigurations.restoreShouldAddHostViewForRootComponent();
  }
}


text:
package it.crs4.pydoop.examples.pterasort;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import org.apache.hadoop.io.WritableUtils;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;

/**
 * An input split consisting of a range of numbers.
 * This mimics the original RangeInputSplit, but we have to extend
 * FileSplit to make pipes happy.
 */
public class RangeInputSplit extends FileSplit {

  long firstRow;
  long rowCount;

  public RangeInputSplit() {}

  public RangeInputSplit(long offset, long length) {
    firstRow = offset;
    rowCount = length;
  }

  @Override
  public Path getPath() {
    return new Path("file:///dev/null");  // not a real FileSplit
  }

  @Override
  public long getStart() {
    return 0;
  }

  @Override
  public long getLength() {
    return 0;
  }

  @Override
  public String[] getLocations() {
    return new String[]{};
  }

  @Override
  public void readFields(DataInput in) throws IOException {
    firstRow = WritableUtils.readVLong(in);
    rowCount = WritableUtils.readVLong(in);
  }

  @Override
  public void write(DataOutput out) throws IOException {
    WritableUtils.writeVLong(out, firstRow);
    WritableUtils.writeVLong(out, rowCount);
  }

}


text:
"""An object to represent arc records"""

import re

from hanzo.warctools.record import ArchiveRecord, ArchiveParser
from hanzo.warctools.archive_detect import register_record_type

# URL<sp>IP-address<sp>Archive-date<sp>Content-type<sp>
#Result-code<sp>Checksum<sp>Location<sp> Offset<sp>Filename<sp>
#Archive-length<nl>
#
@ArchiveRecord.HEADERS(
    URL = 'URL',
    IP = 'IP-address',
    DATE = 'Archive-date',
    CONTENT_TYPE = 'Content-type',
    CONTENT_LENGTH = 'Archive-length',
    RESULT_CODE = 'Result-code',
    CHECKSUM = 'Checksum',
    LOCATION = 'Location',
    OFFSET = 'Offset',
    FILENAME = 'Filename',
)
class ArcRecord(ArchiveRecord):
    """Represents a record in an arc file."""
    def __init__(self, headers=None, content=None, errors=None):
        ArchiveRecord.__init__(self, headers, content, errors)

    @property
    def type(self):
        return "response"

    def _write_to(self, out, nl):
        #TODO: empty method?
        pass

    @classmethod
    def make_parser(cls):
        """Constructs a parser for arc records."""
        return ArcParser()

class ArcRecordHeader(ArcRecord):
    """Represents the headers in an arc record."""
    def __init__(self, headers=None, content=None, errors=None, version=None,
                 raw_headers=None):
        ArcRecord.__init__(self, headers, content, errors)
        self.version = version
        self.raw_headers = raw_headers

    @property
    def type(self):
        return "filedesc"

    def raw(self):
        """Return the raw representation of this record."""
        return "".join(self.raw_headers) + self.content[1]

def rx(pat):
    """Helper function to compile a regular expression with the IGNORECASE
    flag."""
    return re.compile(pat, flags=re.IGNORECASE)

nl_rx = rx('^\r\n|\r|\n$')
length_rx = rx('^%s$' % ArcRecord.CONTENT_LENGTH) #pylint: disable-msg=E1101
type_rx = rx('^%s$' % ArcRecord.CONTENT_TYPE)     #pylint: disable-msg=E1101
SPLIT = re.compile(r'\b\s|\s\b').split

class ArcParser(ArchiveParser):
    """A parser for arc archives."""

    def __init__(self):
        self.version = 0
        # we don't know which version to parse initially - a v1 or v2 file so
        # we read the filedesc because the order and number of the headers
        # change between versions.

        # question? will we get arc fragments?
        # should we store both headers & detect records by header length?
        # if we don't know

        self.headers = []
        self.trailing_newlines = 0

    def parse(self, stream, offset, line=None):
        """Parses a stream as an arc archive and returns an Arc record along
        with the offset in the stream of the end of the record."""
        record = None
        content_type = None
        content_length = None
        if line is None:
            line = stream.readline()

        while not line.rstrip():
            if not line:
                return (None, (), offset)
            self.trailing_newlines -= 1
            line = stream.readline()

        if line.startswith('filedesc:'):
            raw_headers = []
            raw_headers.append(line)
            # read headers named in body of record
            # to assign names to header, to read body of record
            arc_version_line = stream.readline()
            raw_headers.append(arc_version_line)
            arc_names_line = stream.readline()
            raw_headers.append(arc_names_line)

            arc_version = arc_version_line.strip()

            # configure parser instance
            self.version = arc_version.split()[0]
            self.headers = arc_names_line.strip().split()

            # now we have read header field in record body
            # we can extract the headers from the current record,
            # and read the length field

            # which is in a different place with v1 and v2

            # read headers
            arc_headers = self.parse_header_list(line)

            # extract content, ignoring header lines parsed already
            content_type, content_length, errors = \
                self.get_content_headers(arc_headers)

            content_length = content_length \
                - len(arc_version_line) \
                - len(arc_names_line)

            record = ArcRecordHeader(headers=arc_headers,
                                     version=arc_version,
                                     errors=errors,
                                     raw_headers=raw_headers)
        else:
            if not self.headers:
                raise StandardError('missing filedesc')
            headers = self.parse_header_list(line)
            content_type, content_length, errors = \
                self.get_content_headers(headers)

            record = ArcRecord(headers = headers, errors=errors)

        line = None

        if content_length:
            content = []
            length = 0
            while length < content_length:
                line = stream.readline()
                if not line:
                    # print 'no more data'
                    break
                content.append(line)
                length += len(line)
            content = "".join(content)
            content, line = \
                content[0:content_length], content[content_length+1:]
            record.content = (content_type, content)

        if line:
            record.error('trailing data at end of record', line)
        if  line == '':
            self.trailing_newlines = 1

        return (record, (), offset)

    def trim(self, stream):
        return ()

    def parse_header_list(self, line):
        # some people use ' ' as the empty value. lovely.
        line = line.rstrip('\r\n')
        values = SPLIT(line)
        if len(self.headers) != len(values):
            if self.headers[0] in (ArcRecord.URL, ArcRecord.CONTENT_TYPE):
                # fencepost
                values = [s[::-1] for s in reversed(SPLIT(line[::-1], len(self.headers)-1))]
            else:
                values = SPLIT(line, len(self.headers)-1)

        if len(self.headers) != len(values):
            raise StandardError('missing headers %s %s'%(",".join(values), ",".join(self.headers)))

        return zip(self.headers, values)

    @staticmethod
    def get_content_headers(headers):
        content_type = None
        content_length = None
        errors = []

        for name, value in headers:
            if type_rx.match(name):
                if value:
                    content_type = value
                else:
                    errors.append(('invalid header', name, value))
            elif length_rx.match(name):
                try:
                    content_length = int(value)
                except ValueError:
                    errors.append(('invalid header', name, value))

        return content_type, content_length, errors

register_record_type(re.compile('^filedesc://'), ArcRecord)


text:
require 'sinatra/base'

module Sinatra
  module SimpleAuth
    module Helpers
      def authorized?
        session[:arni]
      end

      def auth!(password)
        if password == settings.password
          session[:arni] = true
          redirect_back_or_default(settings.home)
        end
        redirect to('/login')
      end

      def logout!
        session.clear
        redirect to('/')
      end

      def protected!
        unless authorized?
          store_location
          redirect to('/login')
        end
      end

      def store_location
        session[:return_to] = request.fullpath if request.get?
      end

      protected
      def redirect_back_or_default(default)
        if session[:return_to] && session[:return_to] !=~ /^\/login\/?$/
          redirect session.delete(:return_to)
        end
        redirect to(default)
      end

    end

    def self.registered(app)
      app.helpers SimpleAuth::Helpers

      app.set :password, 'password'
      app.set :home, '/'

      app.post '/login/?' do
        auth!(params[:password])
      end

      app.delete '/logout/?' do
        logout!
      end

      app.get '/logout/?' do
        logout!
      end
    end

  end

  register SimpleAuth
end


text:
            Posted on

            by

            Deleted User

Input

Output

          input

          output

    <form name="vm.form.submissionForm" class="form-horizontal" ng-submit="vm.submit()" novalidate>

      Language:
      <select name="languageSelect" id="languageSelect"
              ng-options="option.name for option in vm.availableOptions track by option.id"
              ng-model="vm.selectedOption">
      </select>
        <input type="file" nv-file-select uploader="vm.uploader" name="submissionFile"  accept=".py, .rb, .js"  required>
        Files must not exceed 10 KB
      <button type="submit" class="btn btn-default">Submit</button>
    </form>


text:
{% spaceless %}
<!DOCTYPE html>

        {% load gears staticfiles %}
        <title>{% block title %}{{ project_name }}{% endblock %}</title>
        <meta charset="utf-8">
        <link type="image/png" href="" rel="icon">
        <link href="" rel="apple-touch-icon">
        {% block assets_css %}
            {% css_asset_tag 'stylesheets/application.css' %}
        {% endblock assets_css %}
        {% block extra_style %}{% endblock %}

            {% block content %}{% endblock %}

        {% block assets_js %}
            {% js_asset_tag "javascripts/application.js" %}
        {% endblock assets_js %}

{% endspaceless %}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#303F9F</color>
    <color name="colorAccent">#FF4081</color>

    <color name="primaryText">#212121</color>
    <color name="secondaryText">#BDBDBD</color>
    <color name="errorText">#DB4437</color>
</resources>


text:
module Faker
  module SwansonQuote
    extend ModuleUtils
    extend self

    def sentence
      SWANSON_QUOTES.sample
    end

    def sentences(num = 3)
      sentences_with_duplicates = (1..num+10).map { sentence }
      sentences_with_duplicates.uniq[1..num]
    end

    def paragraph(sentence_count = 3)
      sentences_with_duplicates = (1..sentence_count+10).map { sentence }
      sentences_with_duplicates.uniq[1..sentence_count+rand(4)].join(' ')
    end

    def paragraphs(num = 3)
      paragraphs_with_duplicates = (1..num+10).map { paragraph }
      paragraphs_with_duplicates.uniq[1..num]
    end

    SWANSON_QUOTES = k [
      "I have been developing the Swanson Pyramid of Greatness for years.",
      "The less I know about other people's affairs, the happier I am.",
      "April really is the whole package.",
      "You had me at meat tornado.",
      "The Four Horsemeals of the Eggporkalypse.",
      "It's like yoga, except I still get to kill something.",
      "Birthdays were invented by Hallmark to sell cards.",
      "Clear alcohols are for rich women on diets.",
      "I don't want to paint with a broad brush here, but every single contractor in the world is a miserable, incompetent thief.",
      "Never half-ass two things, whole-ass one thing.",
      "From gladiators into Swansons.",
      "The government is a greedy piglet that suckles on a taxpayer's teat until they have sore, chapped nipples.",
      "Turkey can never beat cow.",
      "There is only one bad word: taxes.",
      "Child labor laws are ruining this country.",
      "Shorts over six inches are capri pants, shorts under six inches are European.",
      "Only women shave beneath the neck.",
      "I work hard to make sure my department is as small and as ineffective as possible.",
      "Jerry's work is often adequate.",
      "When I eat it is the food that is scared.",
      "The important thing is your dream has been crushed.",
      "Every two weeks I need to sand down my toe nails.",
      "It is a beautiful night for the end of the world.",
      "We have one activity planned, not getting killed.",
      "We use that stuff to burn warts off mules.",
      "I hope the rest of your day is cool beans.",
      "You have come up with a plan so spectacularly horrible that it might ruin the entire department.",
      "I hear it has a dope aftertaste.",
      "Everyone shut up and look at me.",
      "I'm just making sure no one ever has to eat this.",
      "Is that a fried turkey leg inside a grilled hamburger.",
      "Do not stand too close when you light an ex-wife effigy.",
      "You may have thought you heard me say I wanted a lot of bacon and eggs, but what I said was: Give me all the bacon and eggs you have."
    ]
  end
end


text:
namespace NCondition
{

CConditionExpression::CConditionExpression()
    : mEngine(new QJSEngine)
{
}

void CConditionExpression::doCondition(const NCondition::CCondition& condition, const QString& args)
{
    if (!condition.mCommand.isEmpty())
    {
        const NCommand::CCommandsMap& commands = *CConfig::getInstance().mCommandMap;
        if (commands.mCommandMap.contains(condition.mCommand))
        {
            NCommand::CCommandExecutor::getInstance().doCommand(commands.mCommandMap[condition.mCommand], args);
        }
        else
        {
            LOG_WARN << "Command of expression not fouund in command list";
        }
    }
}

void CConditionExpression::setProperty(const QString& property, const QJSValue& value)
{
    if (mEngine->globalObject().hasProperty(property))
    {
        const auto prevValue = mEngine->globalObject().property(property);
        mEngine->globalObject().setProperty("PREV_" + property, prevValue);
    }
    mEngine->globalObject().setProperty(property, value);

}

CConditionExpression::Ptr CConditionExpression::getInstance()
{
    static Ptr ptr(new CConditionExpression);
    return ptr;
}

void CConditionExpression::checkAllExpression()
{
    std::unique_lock<std::mutex> lockForce(mMutex, std::try_to_lock);
    if(lockForce.owns_lock())
    {
        for (const auto& pattern : NText::CTextBuffer::getInstance().getMap().keys())
        {
            const auto& list = NText::CTextBuffer::getInstance().getMap()[pattern];
            if (!list.isEmpty())
            {
                setProperty(pattern, list.last().mDataCurrent);
            }
            else
            {
                mEngine->globalObject().deleteProperty(pattern);
            }
        }

        setProperty("HOUR", CDateTime::getCurrentHour());

        setProperty("MINUTE", CDateTime::getCurrentMinute());
        setProperty("SECOND", CDateTime::getCurrentSecond());
        setProperty("DAY_OF_WEEK", CDateTime::getCurrentDayOfWeek());

        setProperty("IS_HOME", CConfig::getInstance().mRunStatus.mHomeStatus
                                            == CRunStatus::HomeStatus::HOME_IN);

        bool hasMotionAlert = false;
        for (size_t i = 0; i < CImageBuffer::getBufferInstance().getBuffersSize(); i++)
        {
            QString s = "BUFF_" + QString::number(i);
            bool value = CImageBuffer::getBufferInstance().getHasAlert(i);
            hasMotionAlert |= value;
            setProperty(s, value);
        }

        setProperty("HAS_MOTION", hasMotionAlert);

        for (const auto& condition : CConfig::getInstance().mConditionList->mConditions)
        {
            LOG_DEBUG << "do expression" << condition.mExpression;
            QJSValue result =  mEngine->evaluate(condition.mExpression).toBool();

            if (result.isError())
            {
                LOG_WARN << "error in expression"  << "\n"
                         << result.property("lineNumber").toInt()
                         << "\n" << ":" << result.toString()
                         << " in expression " << condition.mExpression;
            }
            else
            {
                QString debugStr = "debugStr";
                QString infoStr = "infoStr";
                QString warnStr = "warnStr";
                QString argsStr = "args";
                if (mEngine->globalObject().hasProperty(debugStr))
                {
                    LOG_DEBUG << mEngine->globalObject().property(debugStr).toString();
                }
                if (mEngine->globalObject().hasProperty(infoStr))
                {
                    LOG_INFO << mEngine->globalObject().property(infoStr).toString();
                }
                if (mEngine->globalObject().hasProperty(warnStr))
                {
                    LOG_WARN << mEngine->globalObject().property(warnStr).toString();
                }
                QString argsForCommand;
                if (mEngine->globalObject().hasProperty(argsStr))
                {
                    argsForCommand = mEngine->globalObject().property(argsStr).toString();
                }
                if (result.toBool())
                {
                    doCondition(condition, argsForCommand);
                }
            }

        }
    }

}

}


text:
//TODO: Merge in with existing implementation, as this is lacking other features we already have and need (exclusions, etc
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ServiceStack.Caching;
using ServiceStack.Metadata;
using ServiceStack;
using ServiceStack.DataAnnotations;
using ServiceStack.Discovery.Redis;
using ServiceStack.Text;
using System.Text.RegularExpressions;
using ServiceStack.Logging;
using System.Diagnostics;

namespace ServiceStack.SimpleCloudControl.Caching
{
    [Restrict(VisibilityTo = RequestAttributes.None, AccessTo = RequestAttributes.InProcess)]
    [Exclude(Feature.Metadata)]
    public class SHCClearKeys
    {
        /// <summary>
        /// Source Node Id
        /// </summary>
        public Guid NodeId { get; set; }
        /// <summary>
        /// Keys to remove from local cache
        /// </summary>
        public List<string> Keys { get; set; }
        /// <summary>
        /// Invalidate all local cache
        /// </summary>
        public bool? FlushLocal { get; set; }
    }

    public class SimpleHybridCacheFeature :IPlugin
    {
        public SimpleHybridCacheFeature(Regex blackListKeysRegex = null)
        {
            HybridClient = new SimpleHybridCache(blackListKeysRegex);
        }
        public SimpleHybridCache HybridClient { get; private set; }

        public void Register(IAppHost appHost)
        {
            var feature = HostContext.GetPlugin<RedisServiceDiscoveryFeature>();
            if (feature == null)
                throw new Exception("SimpleCloudControlFeature is required for this SimpleHybridCacheFeature to operate.");
            feature.Config.Meta.Add("HybridCache", string.Empty);
            appHost.Register<ICacheClient>(HybridClient);
            appHost.Register<ICacheClientExtended>(HybridClient);
        }
    }

    public class SimpleHybridCacheServices : Service
    {
        private readonly SimpleHybridCache HybridClient = HostContext.GetPlugin<SimpleHybridCacheFeature>().HybridClient;
        private readonly Guid NodeId = HostContext.GetPlugin<RedisServiceDiscoveryFeature>().NodeId;

        public void Any(SHCClearKeys req)
        {
            req.PrintDump();
            if (req.NodeId != NodeId) //coming from another node deleting keys
            {
                if (req.FlushLocal.GetValueOrDefault())
                {
                    HybridClient.FlushLocal();
                }
                else if (req.Keys.Any())
                {
                    HybridClient.RemoveAll(req.Keys);
                }
            }
        }
    }

    public class SimpleHybridCache : ICacheClientExtended
    {
        public bool BlackListEnabled
        {
            get
            {
                return BlackListKeysRegex != null;
            }
        }
        public Regex BlackListKeysRegex { get; set; }

        private readonly SimpleCloudControlFeature CloudControl = HostContext.AppHost.GetPlugin<SimpleCloudControlFeature>();
        private readonly Guid NodeId = HostContext.GetPlugin<RedisServiceDiscoveryFeature>().NodeId;
        private ICacheClient RedisCache
        {
            get { return HostContext.AppHost.GetCacheClient(null); }
        }

        /// <summary>
        /// Maintains private local cache to not pollute HostContext Local cache
        /// </summary>
        private readonly MemoryCacheClient LocalCache = new MemoryCacheClient();
        private readonly ILog Log = LogManager.GetLogger(typeof(SimpleHybridCache));

        public SimpleHybridCache()
        {
            Log.Debug("SimpleHybridCache Started.");
        }

        public SimpleHybridCache(Regex blackListKeysRegex = null) : base()
        {
            BlackListKeysRegex = blackListKeysRegex;
        }

        public bool Add<T>(string key, T value, TimeSpan expiresIn)
        {
            if (BlackListEnabled && !BlackListKeysRegex.IsMatch(key))
                LocalCache.Add(key, value, expiresIn);
            return RedisCache.Add(key, value, expiresIn);
        }

        public bool Add<T>(string key, T value, DateTime expiresAt)
        {
            if (BlackListEnabled && !BlackListKeysRegex.IsMatch(key))
                LocalCache.Add(key, value, expiresAt);
            return RedisCache.Add(key, value, expiresAt);
        }

        public bool Add<T>(string key, T value)
        {
            if (BlackListEnabled && !BlackListKeysRegex.IsMatch(key))
                LocalCache.Add(key, value);
            return RedisCache.Add(key, value);
        }

        public long Decrement(string key, uint amount)
        {
            return RedisCache.Decrement(key, amount);
        }

        public void FlushAll()
        {
            NotifyFlush();
            RedisCache.FlushAll();
        }

        public void FlushLocal()
        {
            NotifyFlush();
        }

        public T Get<T>(string key)
        {
            T data;
            if (BlackListEnabled && !BlackListKeysRegex.IsMatch(key))
            {
                data = LocalCache.Get<T>(key);
                if (data == null)
                {
                    data = RedisCache.Get<T>(key);
                    if (data != null)
                    {
                        //Check TTL, apply if exists
                        var ttl = RedisCache.GetTimeToLive(key);
                        if (ttl.HasValue)
                        {
                            LocalCache.Add(key, data, ttl.Value);
                        }
                        else
                        {
                            LocalCache.Add(key, data);
                        }
                    }
                }
            }
            else
            {
                data = RedisCache.Get<T>(key);
            }
            return data;
        }

        public IDictionary<string, T> GetAll<T>(IEnumerable<string> keys)
        {
            return RedisCache.GetAll<T>(keys);
        }

        public long Increment(string key, uint amount)
        {
            return RedisCache.Increment(key, amount);
        }

        public bool Remove(string key)
        {
            RedisCache.Remove(key);
            NotifyDelete(key);
            return LocalCache.Remove(key);
        }

        public void RemoveAll(IEnumerable<string> keys)
        {
            NotifyDelete(keys);
            RedisCache.RemoveAll(keys);
            LocalCache.RemoveAll(keys);
        }

        public bool Replace<T>(string key, T value, TimeSpan expiresIn)
        {
            NotifyDelete(key);
            if (BlackListEnabled && BlackListKeysRegex.IsMatch(key))
            {
                return RedisCache.Replace(key, value, expiresIn);
            }
            else
            {
                RedisCache.Replace(key, value, expiresIn);
                return LocalCache.Replace(key, value, expiresIn);
            }
        }

        public bool Replace<T>(string key, T value, DateTime expiresAt)
        {
            NotifyDelete(key);
            if (BlackListEnabled && BlackListKeysRegex.IsMatch(key))
            {
                return RedisCache.Replace(key, value, expiresAt);
            }
            else
            {
                RedisCache.Replace(key, value, expiresAt);
                return LocalCache.Replace(key, value, expiresAt);
            }
        }

        public bool Replace<T>(string key, T value)
        {
            NotifyDelete(key);
            if (BlackListEnabled && BlackListKeysRegex.IsMatch(key))
            {
                return RedisCache.Replace(key, value);
            }
            else
            {
                RedisCache.Replace(key, value);
                return LocalCache.Replace(key, value);
            }
        }

        public bool Set<T>(string key, T value, TimeSpan expiresIn)
        {
            NotifyDelete(key);
            if (BlackListEnabled && BlackListKeysRegex.IsMatch(key))
            {
                return RedisCache.Set(key, value, expiresIn);
            }
            else
            {
                RedisCache.Set(key, value, expiresIn);
                return LocalCache.Set(key, value, expiresIn);
            }
        }

        public bool Set<T>(string key, T value, DateTime expiresAt)
        {
            NotifyDelete(key);
            if (BlackListEnabled && BlackListKeysRegex.IsMatch(key))
            {
                return RedisCache.Set(key, value, expiresAt);
            }
            else
            {
                RedisCache.Set(key, value, expiresAt);
                return LocalCache.Set(key, value, expiresAt);
            }
        }

        public bool Set<T>(string key, T value)
        {
            NotifyDelete(key);
            if (BlackListEnabled && BlackListKeysRegex.IsMatch(key))
            {
                return RedisCache.Set(key, value);
            }
            else
            {
                RedisCache.Set(key, value);
                return LocalCache.Set(key, value);
            }
        }

        public void SetAll<T>(IDictionary<string, T> values)
        {
            NotifyDelete(values.Keys);
            RedisCache.SetAll(values);
            LocalCache.SetAll(values);
        }

        public IEnumerable<string> GetKeysByPattern(string pattern)
        {
            return RedisCache.GetKeysByPattern(pattern);
        }

        public TimeSpan? GetTimeToLive(string key)
        {
            return RedisCache.GetTimeToLive(key);
        }

        public void RemoveByPattern(string pattern)
        {
            var keys = GetKeysByPattern(pattern);
            if (keys.Any())
            {
                NotifyDelete(keys);
                LocalCache.RemoveByPattern(pattern);
                RedisCache.RemoveAll(keys);
            }
        }

        public void RemoveByRegex(string regex)
        {
            RemoveByPattern(regex.Replace(".*", "*").Replace(".+", "?"));
        }

        public void Dispose()
        {
            //Ignore
        }

        private void NotifyFlush()
        {
            Debug.Print("SHC NotifyFlush Flush");
            CloudControl.SendMessage(new SHCClearKeys() { FlushLocal = true, NodeId = CloudControl.NodeId });
        }

        private void NotifyDelete(IEnumerable<string> keys)
        {
            Debug.Print("SHC NotifiyDelete Keys:{0}".Fmt(keys.ToJsv()));
            CloudControl.SendMessage(new SHCClearKeys() { FlushLocal = true, NodeId = CloudControl.NodeId, Keys = keys.ToList() });
        }
        private void NotifyDelete(string key)
        {
            Debug.Print("SHC NotifiyDelete Key:{0}".Fmt(key));
            CloudControl.SendMessage(new SHCClearKeys() { FlushLocal = true, NodeId = CloudControl.NodeId, Keys = key.InList() });
        }
    }
}


text:
public class Job implements Runnable {
  int job number;
  Job (int job number) {
    this.jobNumber = jobNumber;
  }
  public void run (){
  // undertake required work, here we will emulate it by sleeping for a period
  System.out.println("Job: " +jobNumber + " is being processed by thread : " +Thread.currentThread ().getName());
  try {
        Thread.sleep((int) (1000));
  }
  catch (Interrupted Exception e){
    // no cathching as example should not experience interruptions.
    }
  System.out.println("job: "+ jobNumber + "is ending in thread : " +Thread.currentThread().getName());
  }
}


text:
<?php
namespace Echosign\Responses;

use Echosign\Interfaces\ApiResponse;
use Echosign\Util;

/**
 * Class DocumentLibraryItems
 * @package Echosign\Responses
 */
class DocumentLibraryItems implements ApiResponse
{
    /**
     * @var array
     */
    protected $libraryDocumentList = [ ];

    /**
     * @var array
     */
    protected $response;

    public function __construct( array $response )
    {
        $this->response            = $response;
        $this->libraryDocumentList = Util::array_get( $response, 'libraryDocumentList' );
    }

    /**
     * @return array
     */
    public function getLibraryDocumentList()
    {
        return $this->libraryDocumentList;
    }

    /**
     * @return array
     */
    public function getResponse()
    {
        return $this->response;
    }

}


text:
/**
 * Start package.
 *
 * @author Egor Evtyukov (mailto:eed@ttyl.email)
 * @version $Id$
 */
package ru.job4j.tracker.start;


text:
.class final Lcom/android/server/policy/ImmersiveModeConfirmation$H;
.super Landroid/os/Handler;
.source "ImmersiveModeConfirmation.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/policy/ImmersiveModeConfirmation;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x12
    name = "H"
.end annotation

# static fields
.field private static final HIDE:I = 0x2

.field private static final SHOW:I = 0x1

# instance fields
.field final synthetic this$0:Lcom/android/server/policy/ImmersiveModeConfirmation;

# direct methods
.method private constructor <init>(Lcom/android/server/policy/ImmersiveModeConfirmation;)V
    .locals 0
    .param p1, "this$0"    # Lcom/android/server/policy/ImmersiveModeConfirmation;

    .prologue
    .line 339
    iput-object p1, p0, Lcom/android/server/policy/ImmersiveModeConfirmation$H;->this$0:Lcom/android/server/policy/ImmersiveModeConfirmation;

    invoke-direct {p0}, Landroid/os/Handler;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Lcom/android/server/policy/ImmersiveModeConfirmation;Lcom/android/server/policy/ImmersiveModeConfirmation$H;)V
    .locals 0
    .param p1, "this$0"    # Lcom/android/server/policy/ImmersiveModeConfirmation;

    .prologue
    invoke-direct {p0, p1}, Lcom/android/server/policy/ImmersiveModeConfirmation$H;-><init>(Lcom/android/server/policy/ImmersiveModeConfirmation;)V

    return-void
.end method

# virtual methods
.method public handleMessage(Landroid/os/Message;)V
    .locals 1
    .param p1, "msg"    # Landroid/os/Message;

    .prologue
    .line 345
    iget v0, p1, Landroid/os/Message;->what:I

    packed-switch v0, :pswitch_data_0

    .line 344
    :goto_0
    return-void

    .line 347
    :pswitch_0
    iget-object v0, p0, Lcom/android/server/policy/ImmersiveModeConfirmation$H;->this$0:Lcom/android/server/policy/ImmersiveModeConfirmation;

    invoke-static {v0}, Lcom/android/server/policy/ImmersiveModeConfirmation;->-wrap1(Lcom/android/server/policy/ImmersiveModeConfirmation;)V

    goto :goto_0

    .line 350
    :pswitch_1
    iget-object v0, p0, Lcom/android/server/policy/ImmersiveModeConfirmation$H;->this$0:Lcom/android/server/policy/ImmersiveModeConfirmation;

    invoke-static {v0}, Lcom/android/server/policy/ImmersiveModeConfirmation;->-wrap0(Lcom/android/server/policy/ImmersiveModeConfirmation;)V

    goto :goto_0

    .line 345
    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method