text:
package tasks // import "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3"

import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "google.golang.org/genproto/googleapis/api/annotations"

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package

// The HTTP method used to execute the task.
type HttpMethod int32

const (
	// HTTP method unspecified
	HttpMethod_HTTP_METHOD_UNSPECIFIED HttpMethod = 0
	// HTTP POST
	HttpMethod_POST HttpMethod = 1
	// HTTP GET
	HttpMethod_GET HttpMethod = 2
	// HTTP HEAD
	HttpMethod_HEAD HttpMethod = 3
	// HTTP PUT
	HttpMethod_PUT HttpMethod = 4
	// HTTP DELETE
	HttpMethod_DELETE HttpMethod = 5
)

var HttpMethod_name = map[int32]string{
	0: "HTTP_METHOD_UNSPECIFIED",
	1: "POST",
	2: "GET",
	3: "HEAD",
	4: "PUT",
	5: "DELETE",
}
var HttpMethod_value = map[string]int32{
	"HTTP_METHOD_UNSPECIFIED": 0,
	"POST":                    1,
	"GET":                     2,
	"HEAD":                    3,
	"PUT":                     4,
	"DELETE":                  5,
}

func (x HttpMethod) String() string {
	return proto.EnumName(HttpMethod_name, int32(x))
}
func (HttpMethod) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_target_d181648443660751, []int{0}
}

// App Engine HTTP queue.
//
// The task will be delivered to the App Engine application hostname
// specified by its [AppEngineHttpQueue][google.cloud.tasks.v2beta3.AppEngineHttpQueue] and [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest].
// The documentation for [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest] explains how the
// task's host URL is constructed.
//
// Using [AppEngineHttpQueue][google.cloud.tasks.v2beta3.AppEngineHttpQueue] requires
// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control)
// Google IAM permission for the project
// and the following scope:
//
// `https://www.googleapis.com/auth/cloud-platform`
type AppEngineHttpQueue struct {
	// Overrides for the
	// [task-level app_engine_routing][google.cloud.tasks.v2beta3.AppEngineHttpRequest.app_engine_routing].
	//
	// If set, `app_engine_routing_override` is used for all tasks in
	// the queue, no matter what the setting is for the
	// [task-level app_engine_routing][google.cloud.tasks.v2beta3.AppEngineHttpRequest.app_engine_routing].
	AppEngineRoutingOverride *AppEngineRouting `protobuf:"bytes,1,opt,name=app_engine_routing_override,json=appEngineRoutingOverride,proto3" json:"app_engine_routing_override,omitempty"`
	XXX_NoUnkeyedLiteral     struct{}          `json:"-"`
	XXX_unrecognized         []byte            `json:"-"`
	XXX_sizecache            int32             `json:"-"`
}

func (m *AppEngineHttpQueue) Reset()         { *m = AppEngineHttpQueue{} }
func (m *AppEngineHttpQueue) String() string { return proto.CompactTextString(m) }
func (*AppEngineHttpQueue) ProtoMessage()    {}
func (*AppEngineHttpQueue) Descriptor() ([]byte, []int) {
	return fileDescriptor_target_d181648443660751, []int{0}
}
func (m *AppEngineHttpQueue) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_AppEngineHttpQueue.Unmarshal(m, b)
}
func (m *AppEngineHttpQueue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_AppEngineHttpQueue.Marshal(b, m, deterministic)
}
func (dst *AppEngineHttpQueue) XXX_Merge(src proto.Message) {
	xxx_messageInfo_AppEngineHttpQueue.Merge(dst, src)
}
func (m *AppEngineHttpQueue) XXX_Size() int {
	return xxx_messageInfo_AppEngineHttpQueue.Size(m)
}
func (m *AppEngineHttpQueue) XXX_DiscardUnknown() {
	xxx_messageInfo_AppEngineHttpQueue.DiscardUnknown(m)
}

var xxx_messageInfo_AppEngineHttpQueue proto.InternalMessageInfo

func (m *AppEngineHttpQueue) GetAppEngineRoutingOverride() *AppEngineRouting {
	if m != nil {
		return m.AppEngineRoutingOverride
	}
	return nil
}

// App Engine HTTP request.
//
// The message defines the HTTP request that is sent to an App Engine app when
// the task is dispatched.
//
// This proto can only be used for tasks in a queue which has
// [app_engine_http_queue][google.cloud.tasks.v2beta3.Queue.app_engine_http_queue] set.
//
// Using [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest] requires
// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control)
// Google IAM permission for the project
// and the following scope:
//
// `https://www.googleapis.com/auth/cloud-platform`
//
// The task will be delivered to the App Engine app which belongs to the same
// project as the queue. For more information, see
// [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
// and how routing is affected by
// [dispatch files](https://cloud.google.com/appengine/docs/python/config/dispatchref).
//
// The [AppEngineRouting][google.cloud.tasks.v2beta3.AppEngineRouting] used to construct the URL that the task is
// delivered to can be set at the queue-level or task-level:
//
// * If set,
//    [app_engine_routing_override][google.cloud.tasks.v2beta3.AppEngineHttpQueue.app_engine_routing_override]
//    is used for all tasks in the queue, no matter what the setting
//    is for the
//    [task-level app_engine_routing][google.cloud.tasks.v2beta3.AppEngineHttpRequest.app_engine_routing].
//
//
// The `url` that the task will be sent to is:
//
// * `url =` [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] `+`
//   [relative_uri][google.cloud.tasks.v2beta3.AppEngineHttpRequest.relative_uri]
//
// The task attempt has succeeded if the app's request handler returns
// an HTTP response code in the range [`200` - `299`]. `503` is
// considered an App Engine system error instead of an application
// error. Requests returning error `503` will be retried regardless of
// retry configuration and not counted against retry counts.
// Any other response code or a failure to receive a response before the
// deadline is a failed attempt.
type AppEngineHttpRequest struct {
	// The HTTP method to use for the request. The default is POST.
	//
	// The app's request handler for the task's target URL must be able to handle
	// HTTP requests with this http_method, otherwise the task attempt will fail
	// with error code 405 (Method Not Allowed). See
	// [Writing a push task request handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
	// and the documentation for the request handlers in the language your app is
	// written in e.g.
	// [Python Request Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass).
	HttpMethod HttpMethod `protobuf:"varint,1,opt,name=http_method,json=httpMethod,proto3,enum=google.cloud.tasks.v2beta3.HttpMethod" json:"http_method,omitempty"`
	// Task-level setting for App Engine routing.
	//
	// If set,
	// [app_engine_routing_override][google.cloud.tasks.v2beta3.AppEngineHttpQueue.app_engine_routing_override]
	// is used for all tasks in the queue, no matter what the setting is for the
	// [task-level app_engine_routing][google.cloud.tasks.v2beta3.AppEngineHttpRequest.app_engine_routing].
	AppEngineRouting *AppEngineRouting `protobuf:"bytes,2,opt,name=app_engine_routing,json=appEngineRouting,proto3" json:"app_engine_routing,omitempty"`
	// The relative URI.
	//
	// The relative URI must begin with "/" and must be a valid HTTP relative URI.
	// It can contain a path and query string arguments.
	// If the relative URI is empty, then the root path "/" will be used.
	// No spaces are allowed, and the maximum length allowed is 2083 characters.
	RelativeUri string `protobuf:"bytes,3,opt,name=relative_uri,json=relativeUri,proto3" json:"relative_uri,omitempty"`
	// HTTP request headers.
	//
	// This map contains the header field names and values.
	// Headers can be set when the
	// [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
	// Repeated headers are not supported but a header value can contain commas.
	//
	// Cloud Tasks sets some headers to default values:
	//
	// * `User-Agent`: By default, this header is
	//   `"AppEngine-Google; (+http://code.google.com/appengine)"`.
	//   This header can be modified, but Cloud Tasks will append
	//   `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
	//   modified `User-Agent`.
	//
	// If the task has a [body][google.cloud.tasks.v2beta3.AppEngineHttpRequest.body], Cloud
	// Tasks sets the following headers:
	//
	// * `Content-Type`: By default, the `Content-Type` header is set to
	//   `"application/octet-stream"`. The default can be overridden by explicitly
	//   setting `Content-Type` to a particular media type when the
	//   [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
	//   For example, `Content-Type` can be set to `"application/json"`.
	// * `Content-Length`: This is computed by Cloud Tasks. This value is
	//   output only.   It cannot be changed.
	//
	// The headers below cannot be set or overridden:
	//
	// * `Host`
	// * `X-Google-*`
	// * `X-AppEngine-*`
	//
	// In addition, Cloud Tasks sets some headers when the task is dispatched,
	// such as headers containing information about the task; see
	// [request headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
	// These headers are set only when the task is dispatched, so they are not
	// visible when the task is returned in a Cloud Tasks response.
	//
	// Although there is no specific limit for the maximum number of headers or
	// the size, there is a limit on the maximum size of the [Task][google.cloud.tasks.v2beta3.Task]. For more
	// information, see the [CreateTask][google.cloud.tasks.v2beta3.CloudTasks.CreateTask] documentation.
	Headers map[string]string `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
	// HTTP request body.
	//
	// A request body is allowed only if the HTTP method is POST or PUT. It is
	// an error to set a body on a task with an incompatible [HttpMethod][google.cloud.tasks.v2beta3.HttpMethod].
	Body                 []byte   `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *AppEngineHttpRequest) Reset()         { *m = AppEngineHttpRequest{} }
func (m *AppEngineHttpRequest) String() string { return proto.CompactTextString(m) }
func (*AppEngineHttpRequest) ProtoMessage()    {}
func (*AppEngineHttpRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_target_d181648443660751, []int{1}
}
func (m *AppEngineHttpRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_AppEngineHttpRequest.Unmarshal(m, b)
}
func (m *AppEngineHttpRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_AppEngineHttpRequest.Marshal(b, m, deterministic)
}
func (dst *AppEngineHttpRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_AppEngineHttpRequest.Merge(dst, src)
}
func (m *AppEngineHttpRequest) XXX_Size() int {
	return xxx_messageInfo_AppEngineHttpRequest.Size(m)
}
func (m *AppEngineHttpRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_AppEngineHttpRequest.DiscardUnknown(m)
}

var xxx_messageInfo_AppEngineHttpRequest proto.InternalMessageInfo

func (m *AppEngineHttpRequest) GetHttpMethod() HttpMethod {
	if m != nil {
		return m.HttpMethod
	}
	return HttpMethod_HTTP_METHOD_UNSPECIFIED
}

func (m *AppEngineHttpRequest) GetAppEngineRouting() *AppEngineRouting {
	if m != nil {
		return m.AppEngineRouting
	}
	return nil
}

func (m *AppEngineHttpRequest) GetRelativeUri() string {
	if m != nil {
		return m.RelativeUri
	}
	return ""
}

func (m *AppEngineHttpRequest) GetHeaders() map[string]string {
	if m != nil {
		return m.Headers
	}
	return nil
}

func (m *AppEngineHttpRequest) GetBody() []byte {
	if m != nil {
		return m.Body
	}
	return nil
}

// App Engine Routing.
//
// Specifies the target URI. Since this target type dispatches tasks to secure
// app handlers, unsecure app handlers, and URIs restricted with
// [`login: admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref)
// the protocol (for example, HTTP or HTTPS) cannot be explictly specified.
// Task dispatches do not follow redirects and cannot target URI paths
// restricted with
// [`login: required`](https://cloud.google.com/appengine/docs/standard/python/config/appref)
// because tasks are not run as any user.
//
// For more information about services, versions, and instances see
// [An Overview of App Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine),
// [Microservices Architecture on Google App Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine),
// [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed),
// and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
type AppEngineRouting struct {
	// App service.
	//
	// By default, the task is sent to the service which is the default
	// service when the task is attempted.
	//
	// For some queues or tasks which were created using the App Engine
	// Task Queue API, [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] is not parsable
	// into [service][google.cloud.tasks.v2beta3.AppEngineRouting.service],
	// [version][google.cloud.tasks.v2beta3.AppEngineRouting.version], and
	// [instance][google.cloud.tasks.v2beta3.AppEngineRouting.instance]. For example, some tasks
	// which were created using the App Engine SDK use a custom domain
	// name; custom domains are not parsed by Cloud Tasks. If
	// [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] is not parsable, then
	// [service][google.cloud.tasks.v2beta3.AppEngineRouting.service],
	// [version][google.cloud.tasks.v2beta3.AppEngineRouting.version], and
	// [instance][google.cloud.tasks.v2beta3.AppEngineRouting.instance] are the empty string.
	Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
	// App version.
	//
	// By default, the task is sent to the version which is the default
	// version when the task is attempted.
	//
	// For some queues or tasks which were created using the App Engine
	// Task Queue API, [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] is not parsable
	// into [service][google.cloud.tasks.v2beta3.AppEngineRouting.service],
	// [version][google.cloud.tasks.v2beta3.AppEngineRouting.version], and
	// [instance][google.cloud.tasks.v2beta3.AppEngineRouting.instance]. For example, some tasks
	// which were created using the App Engine SDK use a custom domain
	// name; custom domains are not parsed by Cloud Tasks. If
	// [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] is not parsable, then
	// [service][google.cloud.tasks.v2beta3.AppEngineRouting.service],
	// [version][google.cloud.tasks.v2beta3.AppEngineRouting.version], and
	// [instance][google.cloud.tasks.v2beta3.AppEngineRouting.instance] are the empty string.
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	// App instance.
	//
	// By default, the task is sent to an instance which is available when
	// the task is attempted.
	//
	// Requests can only be sent to a specific instance if
	// [manual scaling is used in App Engine Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes).
	// App Engine Flex does not support instances. For more information, see
	// [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
	// and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
	Instance string `protobuf:"bytes,3,opt,name=instance,proto3" json:"instance,omitempty"`
	// Output only. The host that the task is sent to.
	//
	// The host is constructed from the domain name of the app associated with
	// the queue's project ID (for example <app-id>.appspot.com), and the
	// [service][google.cloud.tasks.v2beta3.AppEngineRouting.service], [version][google.cloud.tasks.v2beta3.AppEngineRouting.version],
	// and [instance][google.cloud.tasks.v2beta3.AppEngineRouting.instance]. Tasks which were created using
	// the App Engine SDK might have a custom domain name.
	//
	// For more information, see
	// [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed).
	Host                 string   `protobuf:"bytes,4,opt,name=host,proto3" json:"host,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *AppEngineRouting) Reset()         { *m = AppEngineRouting{} }
func (m *AppEngineRouting) String() string { return proto.CompactTextString(m) }
func (*AppEngineRouting) ProtoMessage()    {}
func (*AppEngineRouting) Descriptor() ([]byte, []int) {
	return fileDescriptor_target_d181648443660751, []int{2}
}
func (m *AppEngineRouting) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_AppEngineRouting.Unmarshal(m, b)
}
func (m *AppEngineRouting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_AppEngineRouting.Marshal(b, m, deterministic)
}
func (dst *AppEngineRouting) XXX_Merge(src proto.Message) {
	xxx_messageInfo_AppEngineRouting.Merge(dst, src)
}
func (m *AppEngineRouting) XXX_Size() int {
	return xxx_messageInfo_AppEngineRouting.Size(m)
}
func (m *AppEngineRouting) XXX_DiscardUnknown() {
	xxx_messageInfo_AppEngineRouting.DiscardUnknown(m)
}

var xxx_messageInfo_AppEngineRouting proto.InternalMessageInfo

func (m *AppEngineRouting) GetService() string {
	if m != nil {
		return m.Service
	}
	return ""
}

func (m *AppEngineRouting) GetVersion() string {
	if m != nil {
		return m.Version
	}
	return ""
}

func (m *AppEngineRouting) GetInstance() string {
	if m != nil {
		return m.Instance
	}
	return ""
}

func (m *AppEngineRouting) GetHost() string {
	if m != nil {
		return m.Host
	}
	return ""
}

func init() {
	proto.RegisterType((*AppEngineHttpQueue)(nil), "google.cloud.tasks.v2beta3.AppEngineHttpQueue")
	proto.RegisterType((*AppEngineHttpRequest)(nil), "google.cloud.tasks.v2beta3.AppEngineHttpRequest")
	proto.RegisterMapType((map[string]string)(nil), "google.cloud.tasks.v2beta3.AppEngineHttpRequest.HeadersEntry")
	proto.RegisterType((*AppEngineRouting)(nil), "google.cloud.tasks.v2beta3.AppEngineRouting")
	proto.RegisterEnum("google.cloud.tasks.v2beta3.HttpMethod", HttpMethod_name, HttpMethod_value)
}

func init() {
	proto.RegisterFile("google/cloud/tasks/v2beta3/target.proto", fileDescriptor_target_d181648443660751)
}

var fileDescriptor_target_d181648443660751 = []byte{
	// 511 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0x51, 0x6b, 0xd3, 0x50,
	0x14, 0x36, 0x4d, 0xbb, 0xae, 0xa7, 0x45, 0xc2, 0x65, 0x60, 0xe8, 0x44, 0x6a, 0x1f, 0xb4, 0x88,
	0x24, 0xd0, 0xbd, 0xc8, 0x44, 0x64, 0xb3, 0x71, 0x1d, 0x38, 0x1b, 0xb3, 0x14, 0x61, 0x3e, 0x84,
	0xdb, 0xf6, 0x90, 0x5e, 0xda, 0xdd, 0x1b, 0x6f, 0x6e, 0x02, 0x7d, 0xf4, 0xc9, 0xbf, 0x2d, 0xb9,
	0x49, 0xeb, 0xac, 0x3a, 0xc4, 0xb7, 0xf3, 0x7d, 0xf9, 0xce, 0x77, 0xee, 0xf9, 0xc2, 0x81, 0xe7,
	0xb1, 0x10, 0xf1, 0x1a, 0xdd, 0xf9, 0x5a, 0x64, 0x0b, 0x57, 0xd1, 0x74, 0x95, 0xba, 0xf9, 0x70,
	0x86, 0x8a, 0x9e, 0xb8, 0x8a, 0xca, 0x18, 0x95, 0x93, 0x48, 0xa1, 0x04, 0xe9, 0x96, 0x42, 0x47,
	0x0b, 0x1d, 0x2d, 0x74, 0x2a, 0x61, 0xf7, 0x71, 0x65, 0x42, 0x13, 0xe6, 0x52, 0xce, 0x85, 0xa2,
	0x8a, 0x09, 0x9e, 0x96, 0x9d, 0xfd, 0x6f, 0x06, 0x90, 0xb3, 0x24, 0xf1, 0x78, 0xcc, 0x38, 0x8e,
	0x95, 0x4a, 0x3e, 0x65, 0x98, 0x21, 0x59, 0xc1, 0x31, 0x4d, 0x92, 0x08, 0x35, 0x1d, 0x49, 0x91,
	0x29, 0xc6, 0xe3, 0x48, 0xe4, 0x28, 0x25, 0x5b, 0xa0, 0x6d, 0xf4, 0x8c, 0x41, 0x7b, 0xf8, 0xd2,
	0xf9, 0xfb, 0x58, 0x67, 0x67, 0x1a, 0x94, 0xcd, 0x81, 0x4d, 0xf7, 0x98, 0x49, 0xe5, 0xd6, 0xff,
	0x6e, 0xc2, 0xd1, 0x2f, 0x6f, 0x08, 0xf0, 0x6b, 0x86, 0xa9, 0x22, 0x17, 0xd0, 0x5e, 0x2a, 0x95,
	0x44, 0xb7, 0xa8, 0x96, 0x62, 0xa1, 0xa7, 0x3e, 0x1c, 0x3e, 0xbb, 0x6f, 0x6a, 0xd1, 0x7d, 0xa5,
	0xd5, 0x01, 0x2c, 0x77, 0x35, 0xb9, 0x01, 0xf2, 0xfb, 0x3a, 0x76, 0xed, 0x3f, 0xb6, 0xb0, 0xf6,
	0xb7, 0x20, 0x4f, 0xa1, 0x23, 0x71, 0x4d, 0x15, 0xcb, 0x31, 0xca, 0x24, 0xb3, 0xcd, 0x9e, 0x31,
	0x68, 0x05, 0xed, 0x2d, 0x37, 0x95, 0x8c, 0x7c, 0x86, 0xe6, 0x12, 0xe9, 0x02, 0x65, 0x6a, 0xd7,
	0x7b, 0xe6, 0xa0, 0x3d, 0x7c, 0xf3, 0x4f, 0x33, 0xef, 0x44, 0xe1, 0x8c, 0xcb, 0x7e, 0x8f, 0x2b,
	0xb9, 0x09, 0xb6, 0x6e, 0x84, 0x40, 0x7d, 0x26, 0x16, 0x1b, 0xbb, 0xd1, 0x33, 0x06, 0x9d, 0x40,
	0xd7, 0xdd, 0x53, 0xe8, 0xdc, 0x15, 0x13, 0x0b, 0xcc, 0x15, 0x6e, 0x74, 0x78, 0xad, 0xa0, 0x28,
	0xc9, 0x11, 0x34, 0x72, 0xba, 0xce, 0x50, 0x07, 0xd0, 0x0a, 0x4a, 0x70, 0x5a, 0x7b, 0x65, 0xf4,
	0x73, 0xb0, 0xf6, 0x37, 0x26, 0x36, 0x34, 0x53, 0x94, 0x39, 0x9b, 0x63, 0xe5, 0xb1, 0x85, 0xc5,
	0x97, 0x1c, 0x65, 0xca, 0x04, 0xaf, 0x9c, 0xb6, 0x90, 0x74, 0xe1, 0x90, 0xf1, 0x54, 0x51, 0x3e,
	0xc7, 0x2a, 0x8f, 0x1d, 0x2e, 0xde, 0xbc, 0x14, 0xa9, 0xb2, 0xeb, 0x9a, 0xd7, 0xf5, 0x8b, 0x2f,
	0x00, 0x3f, 0xff, 0x1c, 0x39, 0x86, 0x47, 0xe3, 0x30, 0xf4, 0xa3, 0x2b, 0x2f, 0x1c, 0x4f, 0x46,
	0xd1, 0xf4, 0xe3, 0xb5, 0xef, 0xbd, 0xbb, 0x7c, 0x7f, 0xe9, 0x8d, 0xac, 0x07, 0xe4, 0x10, 0xea,
	0xfe, 0xe4, 0x3a, 0xb4, 0x0c, 0xd2, 0x04, 0xf3, 0xc2, 0x0b, 0xad, 0x5a, 0x41, 0x8d, 0xbd, 0xb3,
	0x91, 0x65, 0x16, 0x94, 0x3f, 0x0d, 0xad, 0x3a, 0x01, 0x38, 0x18, 0x79, 0x1f, 0xbc, 0xd0, 0xb3,
	0x1a, 0xe7, 0x09, 0x3c, 0x99, 0x8b, 0xdb, 0x7b, 0x12, 0x3f, 0x6f, 0x87, 0xfa, 0x98, 0xfc, 0xe2,
	0x22, 0x7c, 0xe3, 0xe6, 0x6d, 0x25, 0x8d, 0xc5, 0x9a, 0xf2, 0xd8, 0x11, 0x32, 0x76, 0x63, 0xe4,
	0xfa, 0x5e, 0xdc, 0xf2, 0x13, 0x4d, 0x58, 0xfa, 0xa7, 0xab, 0x7c, 0xad, 0xd1, 0xec, 0x40, 0x6b,
	0x4f, 0x7e, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x26, 0x4d, 0x45, 0xc0, 0x03, 0x00, 0x00,
}


text:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class CoverDetectionScript : MonoBehaviour {
    [SerializeField] private bool isOccluding = false ; // A boolean that denotes if this object's colliders are occluding anything else.
    [Range(0, 1)][SerializeField] private float m_lerpForce = 0.2f; //The factor of LERP applied to the movement action. higher values mean more "inertia"
    [SerializeField] private float m_MaxSpeed = 10f;                    // The fastest the player can travel in the x axis.
    private CoverPositionController parentalHandler;

    private Rigidbody2D m_Rigidbody2D;

    [SerializeField] private List< Sprite > possibleSprites;

    void Awake()
    {
        if (parentalHandler == null) {
            parentalHandler = this.transform.parent.gameObject.GetComponent<CoverPositionController> ();
        }

        // Setting up references.
        m_Rigidbody2D = GetComponent<Rigidbody2D>();

        GetComponent<SpriteRenderer>().sprite = possibleSprites[Random.Range(0, possibleSprites.Count)];
    }

	/// <summary>
    /// Update is called once per draw frame-step
    /// </summary>
    /// <remarks>
    /// We're updating the color of the cover so the player can tell when it's 'lit'.
    /// </remarks>
	void Update () {
        /*if (isOccluding) {
            GetComponent<SpriteRenderer> ().color = Color.red;
        } else {
            GetComponent<SpriteRenderer> ().color = Color.white;
        }*/
	}

    /// <summary>
    /// This fires when a trigger collider contacts us.
    /// </summary>
    /// <remarks>
    /// We send a message to whoever hit us.
    /// We expect the player object to react.
    /// </remarks>
    /// <param name="other">The other collider that hit us.</param>
    void OnTriggerEnter2D ( Collider2D other ) {

        this.isOccluding = true;

        other.gameObject.SendMessage (
            "InCover",
            this.gameObject,
            SendMessageOptions.DontRequireReceiver );
    }

    /// <summary>
    /// This fires when a trigger collider un-contacts us.
    /// </summary>
    /// <remarks>
    /// We send a message to whoever hit us.
    /// and expect the player object to react.
    /// </remarks>
    /// <param name="other">The other collider that un-hit us.</param>
    void OnTriggerExit2D ( Collider2D other ) {

        this.isOccluding = false;

        other.gameObject.SendMessage (
            "OutOfCover",
            this.gameObject,
            SendMessageOptions.DontRequireReceiver );
    }

    /// <summary>
    /// Requests the character to move.
    /// </summary>
    /// <param name="move">Factor of movement on the x-axxis.</param>
    /// <remarks>
    /// This Method combines the requested value with the current to blend the two together.
    /// </remarks>
    public void Move(float moveXAxis)
    {
        // Move the character, simulating drag by lerping with current velocity.
        m_Rigidbody2D.velocity = Vector2.Lerp (
            new Vector2(moveXAxis*m_MaxSpeed, m_Rigidbody2D.velocity.y),
            m_Rigidbody2D.velocity,
            m_lerpForce );

    }
}

redpajama_set_name: RedPajamaGithub


text:
PRJDIR:=/home/webapps/visorepbd
RESDIR:=${PRJDIR}/deployresources
REPODIR:=${PRJDIR}
NGINXCONF:=visorepbd.nginx.conf

# antes hacer un cd ${REPODIR} && git pull
update: ${REPODIR}/package.json
	$(info [INFO]: Actualizando proyecto. Complete la operación con $ sudo make restart)
	$(info [INFO]: actualizando dependencias)
	cd ${REPODIR} && npm install

restart: updateresources ${RESDIR}/${NGINXCONF}
	$(info [INFO]: copiando configuración)
	sudo cp ${RESDIR}/${NGINXCONF} /etc/nginx/sites-available/
	$(info [INFO]: reiniciando servicios)
	sudo service nginx restart

installpackages:
	$(info [INFO]: instalación de paquetes)
	sudo aptitude install nginx git
	sudo aptitude install nodejs nodejs-legacy

configpackages:
	$(info [INFO]: copiando archivos de configuración de nginx)
	sudo cp ${RESDIR}/${NGINXCONF} /etc/nginx/sites-available/
	sudo ln -fs /etc/nginx/sites-available/${NGINXCONF} /etc/nginx/sites-enabled/${NGINXCONF}


text:
using System;
using System.Data.Entity.Core;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Infrastructure;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using vm.Aspects.Diagnostics;
using vm.Aspects.Diagnostics.ExternalMetadata;
using vm.Aspects.Facilities;
using vm.Aspects.Model.Metadata;
using vm.Aspects.Model.Repository;
using vm.Aspects.Model.Tests;

namespace vm.Aspects.Model.EFRepository.Tests
{
    /// <summary>
    /// Summary description for EFRepositoryTests
    /// </summary>
    [TestClass]
    public class EFRepositoryTests : IRepositoryTest<TestEFRepository>
    {
        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        [ClassInitialize()]
        public static void ClassInitialize(TestContext testContext)
        {
            try
            {
                ClassMetadataRegistrar
                    .RegisterMetadata()
                    .Register<UpdateException, UpdateExceptionDumpMetadata>()
                    .Register<DbUpdateException, DbUpdateExceptionDumpMetadata>()
                    .Register<ObjectStateEntry, ObjectStateEntryDumpMetadata>()
                    ;

                var shouldDump = DIContainer.IsInitialized;

                DIContainer.Initialize();

                lock (DIContainer.Root)
                {
                    var registrations = DIContainer.Root.GetRegistrationsSnapshot();

                    DIContainer.Root
                               .UnsafeRegister(Facility.Registrar, registrations, true)
                               .UnsafeRegister(TestEFRepository.Registrar, registrations, true)
                               ;
                }

                if (shouldDump)
                    DIContainer.Root.DebugDump();
            }
            catch (Exception x)
            {
                testContext.WriteLine("{0}", x.DumpString());
                throw;
            }
        }

        // Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void ClassCleanup()
        //{
        //}
        //
        // Use TestInitialize to run code before running each test
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        public static IRepository CreateRepository() => new TestEFRepository("ModelTests");

        protected override IRepository GetRepository() => CreateRepository();
    }
}


text:
package com.themoneypies.web;

import au.com.bytecode.opencsv.CSVWriter;
import com.themoneypies.domain.Entry;
import com.themoneypies.domain.Rule;
import com.themoneypies.parser.BT24EntryParser;
import com.themoneypies.parser.RulesParser;
import com.themoneypies.report.ReportFilter;
import com.themoneypies.repository.EntryRepository;
import com.themoneypies.repository.RuleRepository;
import com.themoneypies.service.EntryService;
import com.themoneypies.service.RuleService;
import com.themoneypies.util.FileUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Random;

@Controller
public class ImportController {
    private Logger logger = Logger.getLogger(getClass());

    @Autowired
    BT24EntryParser bt24EntryParser;

    @Autowired
    ReportFilter reportFilter;

    @Autowired
    EntryService entryService;

    @Autowired
    RulesParser rulesParser;

    @Autowired
    RuleService ruleService;

    @Autowired
    RuleRepository ruleRepository;

    @Autowired
    EntryRepository entryRepository;

    @RequestMapping(value = "/upload", method = RequestMethod.GET)
    public
    @ResponseBody
    String provideUploadInfo() {
        return "You can upload a file by posting to this same URL.";
    }

    @RequestMapping(value = "/import/transactions", method = RequestMethod.POST)
    public
    @ResponseBody
    String importTrasactions(@RequestParam("file") MultipartFile file) {
        if (!file.isEmpty()) {
            try {
                String fileText = FileUtils.getFileText(file.getBytes());
                List<Entry> entries = bt24EntryParser.getEntries(fileText);
                List<Entry> unique = reportFilter.removeDuplicates(entries);
                entryService.importEntries(unique);

                return "ok";
            } catch (Exception e) {
                return "Upload failed => " + e.getMessage();
            }
        } else {
            return "You failed to upload because the file was empty.";
        }
    }

    @RequestMapping(value = "/import/rules", method = RequestMethod.POST)
    public
    @ResponseBody
    String importRules(@RequestParam("file") MultipartFile file) {
        if (!file.isEmpty()) {
            try {
                String fileText = FileUtils.getFileText(file.getBytes());

                List<Rule> rules = rulesParser.getRules(fileText);
                ruleService.importRules(rules);

                return "ok";
            } catch (Exception e) {
                return "Upload failed => " + e.getMessage();
            }
        } else {
            return "You failed to upload because the file was empty.";
        }
    }

    @RequestMapping(value = "/download-rules")
    public void downloadRules(HttpServletResponse response) throws IOException {

        String csvFileName = "rules.csv";

        response.setContentType("text/csv");

        String headerKey = "Content-Disposition";
        String headerValue = String.format("attachment; filename=\"%s\"", csvFileName);
        response.setHeader(headerKey, headerValue);

        CSVWriter writer = new CSVWriter(response.getWriter(), ',', CSVWriter.NO_QUOTE_CHARACTER);
        List<Rule> rules = ruleRepository.findAll();
        for (Rule rule : rules) {
            String[] line = rule.getCsvLine();
            writer.writeNext(line);
        }
        writer.close();
    }

    @RequestMapping(value = "/randomize-transactions")
    @ResponseBody
    public String randomizeTransactions(@RequestParam Integer randomParam) {
        randomizeEntries(randomParam);
        return "ok";
    }

    public void randomizeEntries(Integer randomParam) {
        for (Entry entry : entryRepository.findAll()) {
            transformEntry(entry, randomParam);
        }
    }

    private void transformEntry(Entry entry, Integer randomParam) {
        BigDecimal credit = entry.getCredit();
        BigDecimal debit = entry.getDebit();

        BigDecimal newCredit = transformValue(credit, randomParam);
        BigDecimal newDebit = transformValue(debit, randomParam);

        entry.setCredit(newCredit);
        entry.setDebit(newDebit);

        entryRepository.save(entry);
    }

    private BigDecimal transformValue(BigDecimal value, Integer randomParam) {
        BigDecimal newValue = value;

        if (value.intValue() != 0) {
            Random random = new Random();
            boolean shouldAdd = random.nextBoolean();

            newValue = value.divide(new BigDecimal(randomParam), 2, BigDecimal.ROUND_CEILING);

            int percent = new BigDecimal(0.4).multiply(newValue).intValue();

            BigDecimal toAddOrSubtract;
            if (percent != 0) {
                toAddOrSubtract = new BigDecimal(random.nextInt(Math.abs(percent)));
            } else {
                toAddOrSubtract = new BigDecimal(0);
            }

            if (shouldAdd) {
                newValue = newValue.add(toAddOrSubtract);
            } else {
                newValue = newValue.subtract(toAddOrSubtract);
            }
        }
        return newValue;
    }
}


text:
package example.service;

import example.repo.Customer1483Repository;

import org.springframework.stereotype.Service;

@Service
public class Customer1483Service {
	public Customer1483Service(Customer1483Repository repo) {}
}


text:
define(
  'bolt.runtime.entry.NodeMain',

  [
    'bolt.runtime.api.Bolt',
    'bolt.runtime.api.DeferredBolt',
    'bolt.runtime.profile.NodeProfile',
    'bolt.runtime.reader.Reader'
  ],

  function (Bolt, DeferredBolt, NodeProfile, Reader) {
    return function () {
      var configure = function (configuration) {
        Reader.node(configuration, deferred.configured);
      };

      var deferred = DeferredBolt(configure, NodeProfile);
      var bolt = Bolt(deferred);

      module.exports = bolt;
    };
  }
);


text:
<?xml version="1.0" encoding="UTF-8"?>
<site>
   <feature url="features/com.b2international.snowowl.core.feature_8.7.2.qualifier.jar" id="com.b2international.snowowl.core.feature" version="8.7.2.qualifier">
      <category name="server-core"/>
   </feature>
   <feature url="features/com.b2international.snowowl.server.product.feature_8.7.2.qualifier.jar" id="com.b2international.snowowl.server.product.feature" version="8.7.2.qualifier">
      <category name="server-core"/>
   </feature>
   <feature url="features/com.b2international.snowowl.snomed.core.feature_8.7.2.qualifier.jar" id="com.b2international.snowowl.snomed.core.feature" version="8.7.2.qualifier">
      <category name="snomed-core"/>
   </feature>
   <feature url="features/com.b2international.snowowl.test.feature_8.7.2.qualifier.jar" id="com.b2international.snowowl.test.feature" version="8.7.2.qualifier">
      <category name="tests"/>
   </feature>
   <feature url="features/com.b2international.snowowl.snomed.core.rest.feature_8.7.2.qualifier.jar" id="com.b2international.snowowl.snomed.core.rest.feature" version="8.7.2.qualifier">
      <category name="snomed-core"/>
   </feature>
   <feature url="features/com.b2international.snowowl.core.rest.feature_8.7.2.qualifier.jar" id="com.b2international.snowowl.core.rest.feature" version="8.7.2.qualifier">
      <category name="server-core"/>
   </feature>
   <feature url="features/com.b2international.snowowl.fhir.rest.feature_8.7.2.qualifier.jar" id="com.b2international.snowowl.fhir.rest.feature" version="8.7.2.qualifier">
      <category name="server-core"/>
   </feature>
   <feature url="features/com.b2international.snowowl.snomed.cis.feature_8.7.2.qualifier.jar" id="com.b2international.snowowl.snomed.cis.feature" version="8.7.2.qualifier">
      <category name="snomed-core"/>
   </feature>
   <category-def name="server-core" label="Snow Owl Server Common"/>
   <category-def name="snomed-core" label="Snow Owl SNOMED CT extension"/>
   <category-def name="tests" label="Snow Owl Test Framework"/>
</site>


text:
struct ALCcontext;

void StartEventThrd(ALCcontext *ctx);
void StopEventThrd(ALCcontext *ctx);

#endif


text:
package org.apache.cassandra.net;

import java.io.BufferedOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicLong;

import org.apache.commons.lang.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.utils.FBUtilities;

public class OutboundTcpConnection extends Thread
{
    private static final Logger logger = LoggerFactory.getLogger(OutboundTcpConnection.class);

    private static final Message CLOSE_SENTINEL = new Message(FBUtilities.getBroadcastAddress(),
                                                              StorageService.Verb.INTERNAL_RESPONSE,
                                                              ArrayUtils.EMPTY_BYTE_ARRAY,
                                                              MessagingService.version_);

    private static final int OPEN_RETRY_DELAY = 100; // ms between retries

    // sending thread reads from "active" (one of queue1, queue2) until it is empty.
    // then it swaps it with "backlog."
    private volatile BlockingQueue<Entry> backlog = new LinkedBlockingQueue<Entry>();
    private volatile BlockingQueue<Entry> active = new LinkedBlockingQueue<Entry>();

    private final OutboundTcpConnectionPool poolReference;

    private DataOutputStream out;
    private Socket socket;
    private volatile long completed;
    private final AtomicLong dropped = new AtomicLong();

    public OutboundTcpConnection(OutboundTcpConnectionPool pool)
    {
        super("WRITE-" + pool.endPoint());
        this.poolReference = pool;
    }

    public void enqueue(Message message, String id)
    {
        expireMessages();
        try
        {
            backlog.put(new Entry(message, id, System.currentTimeMillis()));
        }
        catch (InterruptedException e)
        {
            throw new AssertionError(e);
        }
    }

    void closeSocket()
    {
        active.clear();
        backlog.clear();
        enqueue(CLOSE_SENTINEL, null);
    }

    void softCloseSocket()
    {
        enqueue(CLOSE_SENTINEL, null);
    }

    public void run()
    {
        while (true)
        {
            Entry entry = active.poll();
            if (entry == null)
            {
                // exhausted the active queue.  switch to backlog, once there's something to process there
                try
                {
                    entry = backlog.take();
                }
                catch (InterruptedException e)
                {
                    throw new AssertionError(e);
                }

                BlockingQueue<Entry> tmp = backlog;
                backlog = active;
                active = tmp;
            }

            Message m = entry.message;
            String id = entry.id;
            if (m == CLOSE_SENTINEL)
            {
                disconnect();
                continue;
            }
            if (entry.timestamp < System.currentTimeMillis() - DatabaseDescriptor.getRpcTimeout())
                dropped.incrementAndGet();
            else if (socket != null || connect())
                writeConnected(m, id);
            else
                // clear out the queue, else gossip messages back up.
                active.clear();
        }
    }

    public int getPendingMessages()
    {
        return active.size() + backlog.size();
    }

    public long getCompletedMesssages()
    {
        return completed;
    }

    public long getDroppedMessages()
    {
        return dropped.get();
    }

    private void writeConnected(Message message, String id)
    {
        try
        {
            write(message, id, out);
            completed++;
            if (active.peek() == null)
            {
                out.flush();
            }
        }
        catch (Exception e)
        {
            // Non IO exceptions is likely a programming error so let's not silence it
            if (!(e instanceof IOException))
                logger.error("error writing to " + poolReference.endPoint(), e);
            else if (logger.isDebugEnabled())
                logger.debug("error writing to " + poolReference.endPoint(), e);
            disconnect();
        }
    }

    public static void write(Message message, String id, DataOutputStream out) throws IOException
    {
        /*
         Setting up the protocol header. This is 4 bytes long
         represented as an integer. The first 2 bits indicate
         the serializer type. The 3rd bit indicates if compression
         is turned on or off. It is turned off by default. The 4th
         bit indicates if we are in streaming mode. It is turned off
         by default. The 5th-8th bits are reserved for future use.
         The next 8 bits indicate a version number. Remaining 15 bits
         are not used currently.
        */
        int header = 0;
        // Setting up the serializer bit
        header |= MessagingService.serializerType_.ordinal();
        // set compression bit.
        if (false)
            header |= 4;
        // Setting up the version bit
        header |= (message.getVersion() << 8);

        out.writeInt(MessagingService.PROTOCOL_MAGIC);
        out.writeInt(header);
        // compute total Message length for compatibility w/ 0.8 and earlier
        byte[] bytes = message.getMessageBody();
        int total = messageLength(message.header_, id, bytes);
        out.writeInt(total);
        out.writeUTF(id);
        Header.serializer().serialize(message.header_, out, message.getVersion());
        out.writeInt(bytes.length);
        out.write(bytes);
    }

    public static int messageLength(Header header, String id, byte[] bytes)
    {
        return 2 + FBUtilities.encodedUTF8Length(id) + header.serializedSize() + 4 + bytes.length;
    }

    private void disconnect()
    {
        if (socket != null)
        {
            try
            {
                socket.close();
            }
            catch (IOException e)
            {
                if (logger.isDebugEnabled())
                    logger.debug("exception closing connection to " + poolReference.endPoint(), e);
            }
            out = null;
            socket = null;
        }
    }

    private boolean connect()
    {
        if (logger.isDebugEnabled())
            logger.debug("attempting to connect to " + poolReference.endPoint());
        long start = System.currentTimeMillis();
        while (System.currentTimeMillis() < start + DatabaseDescriptor.getRpcTimeout())
        {
            try
            {
                socket = poolReference.newSocket();
                socket.setKeepAlive(true);
                socket.setTcpNoDelay(true);
                out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 4096));
                return true;
            }
            catch (IOException e)
            {
                socket = null;
                if (logger.isTraceEnabled())
                    logger.trace("unable to connect to " + poolReference.endPoint(), e);
                try
                {
                    Thread.sleep(OPEN_RETRY_DELAY);
                }
                catch (InterruptedException e1)
                {
                    throw new AssertionError(e1);
                }
            }
        }
        return false;
    }

    private void expireMessages()
    {
        while (true)
        {
            Entry entry = backlog.peek();
            if (entry == null || entry.timestamp >= System.currentTimeMillis() - DatabaseDescriptor.getRpcTimeout())
                break;

            Entry entry2 = backlog.poll();
            if (entry2 != entry)
            {
                // sending thread switched queues.  add this entry (from the "new" backlog)
                // at the end of the active queue, which keeps it in the same position relative to the other entries
                // without having to contend with other clients for the head-of-backlog lock.
                if (entry2 != null)
                    active.add(entry2);
                break;
            }

            dropped.incrementAndGet();
        }
    }

    private static class Entry
    {
        final Message message;
        final String id;
        final long timestamp;

        Entry(Message message, String id, long timestamp)
        {
            this.message = message;
            this.id = id;
            this.timestamp = timestamp;
        }
    }
}


text:
import sys

IS_PY3 = sys.version_info[0] == 3

if IS_PY3:
    from http.client import NO_CONTENT
    from email import encoders as Encoders
    from urllib.parse import quote, urlencode
    unicode = str
    bytes = bytes
else:
    from email import Encoders
    from httplib import NO_CONTENT
    from urllib import quote, urlencode
    unicode = unicode
    _orig_bytes = bytes
    bytes = lambda s, *a: _orig_bytes(s)


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    tools:context="kr.socar.rxjavastudy.MainActivity">

    <Button
        android:id="@+id/btn_async_subject"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="AsyncSubject"
        android:layout_marginTop="10dp"/>

    <Button
        android:id="@+id/btn_publish_subject"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="PublishSubject"
        android:layout_marginTop="10dp"
        />

    <Button
        android:id="@+id/btn_behavior_subject"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="BehaviorSubject"
        android:layout_marginTop="10dp"
        />

    <Button
        android:id="@+id/btn_replay_subject"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ReplaySubject"
        android:layout_marginTop="10dp"
        />

    <Button
        android:id="@+id/btn_observable_scriber"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Observable + Scriber"
        android:layout_marginTop="10dp"
        />

</LinearLayout>


text:
package models

import java.util.UUID
import javax.inject.{Singleton, Inject}

import models.daos.UserDAO
import org.opencompare.api.java.{PCM, PCMMetadata, PCMContainer}
import org.opencompare.api.java.impl.io.{KMFJSONExporter, KMFJSONLoader}
import play.api.libs.json._

import scala.collection.JavaConversions._
import scala.concurrent.Future
import play.api.libs.concurrent.Execution.Implicits.defaultContext

/**
 * Created by gbecan on 8/18/15.
 */
@Singleton
class PCMAPIUtils @Inject() (userDAO : UserDAO) {

  private val jsonLoader : KMFJSONLoader = new KMFJSONLoader()
  private val kmfExporter: KMFJSONExporter = new KMFJSONExporter

  /*
    Parse the json file and generate a container
   */
  def parsePCMContainers(jsonContent : JsValue) : List[PCMContainer] = {
    jsonLoader.load(Json.stringify(jsonContent)).toList
  }

  def serializePCMContainer(pcmContainer : PCMContainer) : Future[JsValue] = {
    val pcm = pcmContainer.getPcm
    val metadata = pcmContainer.getMetadata

    // Serialize PCM
    val jsonContainer = Json.parse(kmfExporter.export(pcmContainer)).as[JsObject]

    // Retrieve full name of creator
    val uuid = try {
      Some(UUID.fromString(metadata.getCreator))
    } catch {
      case e : IllegalArgumentException => None
    }

    val futureCreatorFullName = if (uuid.isDefined) {
      val futureCreatorInfo = userDAO.find(uuid.get)

      futureCreatorInfo map { creatorInfo =>
        if (creatorInfo.isDefined && creatorInfo.get.fullName.isDefined) {
          val fullName = creatorInfo.get.fullName.get

          jsonContainer ++ JsObject(Map(
            "metadata" -> JsObject(Map(
              "creatorFullName" -> JsString(fullName)
            ))
          ))
        } else {
          jsonContainer
        }
      }
    } else {
      Future.successful(jsonContainer)
    }

    futureCreatorFullName map { json =>
      json
    }
  }

}


text:
package proc

import (
	"github.com/go-delve/delve/pkg/dwarf/op"
	"golang.org/x/arch/x86/x86asm"
)

// PackageVars returns bi.packageVars (for tests)
func (bi *BinaryInfo) PackageVars() []packageVar {
	return bi.packageVars
}

func NewCompositeMemory(p *Target, pieces []op.Piece, base uint64) (*compositeMemory, error) {
	regs, err := p.CurrentThread().Registers()
	if err != nil {
		return nil, err
	}

	arch := p.BinInfo().Arch
	dwarfregs := arch.RegistersToDwarfRegisters(0, regs)
	dwarfregs.ChangeFunc = p.CurrentThread().SetReg

	mem, err := newCompositeMemory(p.Memory(), arch, *dwarfregs, pieces)
	if mem != nil {
		mem.base = base
	}
	return mem, err
}

func IsJNZ(inst archInst) bool {
	return inst.(*x86Inst).Op == x86asm.JNE
}


text:
"""Tests for the debug events writer Python class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from absl.testing import parameterized

import numpy as np

from tensorflow.core.protobuf import debug_event_pb2
from tensorflow.python.debug.lib import debug_events_monitors
from tensorflow.python.debug.lib import debug_events_reader
from tensorflow.python.debug.lib import dumping_callback
from tensorflow.python.debug.lib import dumping_callback_test_lib
from tensorflow.python.eager import def_function
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.platform import googletest
from tensorflow.python.platform import test

class TestMonitor(debug_events_monitors.BaseMonitor):

  def __init__(self, debug_data_reader):
    super(TestMonitor, self).__init__(debug_data_reader)
    # Mapping execution index to Execution data objects.
    self.executions = dict()
    # Mapping graph execution trace index to GraphExecutionTrace data objects.
    self.graph_execution_traces = dict()

  def on_execution(self, execution_index, execution):
    if execution_index in self.executions:
      raise ValueError("Duplicate execution index: %d" % execution_index)
    self.executions[execution_index] = execution

  def on_graph_execution_trace(self, graph_execution_trace_index,
                               graph_execution_trace):
    if graph_execution_trace_index in self.graph_execution_traces:
      raise ValueError("Duplicate graph-execution-trace index: %d" %
                       graph_execution_trace_index)
    self.graph_execution_traces[
        graph_execution_trace_index] = graph_execution_trace

class DebugEventsMonitorTest(dumping_callback_test_lib.DumpingCallbackTestBase,
                             parameterized.TestCase):

  @parameterized.named_parameters(
      ("NoTensor", "NO_TENSOR"),
      ("ConciseHealth", "CONCISE_HEALTH"),
      ("FullHealth", "FULL_HEALTH"),
      ("FullTensor", "FULL_TENSOR"),
  )
  def testOnExecutionIsCalled(self, tensor_debug_mode):
    writer = dumping_callback.enable_dump_debug_info(
        self.dump_root, tensor_debug_mode=tensor_debug_mode)
    x = constant_op.constant([[1, 2], [3, 4]], dtype=dtypes.float32)
    y = constant_op.constant([[-1], [1]], dtype=dtypes.float32)
    math_ops.matmul(x, y)
    writer.FlushNonExecutionFiles()
    writer.FlushExecutionFiles()

    with debug_events_reader.DebugDataReader(self.dump_root) as reader:
      test_monitor = TestMonitor(reader)
      reader.update()
      self.assertLen(test_monitor.executions, 1)
      self.assertEmpty(test_monitor.graph_execution_traces)
      execution = test_monitor.executions[0]
      self.assertTrue(execution.wall_time)
      self.assertEqual(execution.op_type, "MatMul")
      self.assertLen(execution.output_tensor_device_ids, 1)
      self.assertLen(execution.input_tensor_ids, 2)
      self.assertLen(execution.output_tensor_ids, 1)
      self.assertEqual(execution.num_outputs, 1)
      self.assertEqual(execution.graph_id, "")
      if tensor_debug_mode == "NO_TENSOR":
        self.assertIsNone(execution.debug_tensor_values)
      elif tensor_debug_mode == "CONCISE_HEALTH":
        self.assertLen(execution.debug_tensor_values, 1)
        # [tensor_id, element_count, neg_inf_count, pos_inf_count, nan_count].
        self.assertLen(execution.debug_tensor_values[0], 5)
      elif tensor_debug_mode == "FULL_HEALTH":
        self.assertLen(execution.debug_tensor_values, 1)
        # [tensor_id, device_id, dtype, rank, element_count,
        #  neg_inf_count, pos_inf_count, nan_count,
        #  neg_finite_count, zero_count, pos_finite_count].
        self.assertLen(execution.debug_tensor_values[0], 11)
      elif tensor_debug_mode == "FULL_TENSOR":
        # Full tensor values are not stored in the debug_tensor_values field.
        self.assertIsNone(execution.debug_tensor_values)
        self.assertAllClose(
            reader.execution_to_tensor_values(execution), [[[1.], [1.]]])

  @parameterized.named_parameters(
      ("ConciseHealth", "CONCISE_HEALTH"),
      ("FullHealth", "FULL_HEALTH"),
      ("FullTensor", "FULL_TENSOR"),
  )
  def testOnGraphExecutionTraceIsCalled(self, tensor_debug_mode):
    writer = dumping_callback.enable_dump_debug_info(
        self.dump_root, tensor_debug_mode=tensor_debug_mode)

    @def_function.function
    def unique_sum(xs):
      """Sum over the unique values, for testing."""
      unique_xs, indices = array_ops.unique(xs)
      return math_ops.reduce_sum(unique_xs), indices

    xs = constant_op.constant([2., 6., 8., 1., 2.], dtype=dtypes.float32)
    unique_sum(xs)
    writer.FlushNonExecutionFiles()
    writer.FlushExecutionFiles()

    with debug_events_reader.DebugDataReader(self.dump_root) as reader:
      test_monitor = TestMonitor(reader)
      reader.update()
      self.assertLen(test_monitor.executions, 1)

      execution = test_monitor.executions[0]
      self.assertTrue(execution.wall_time)
      self.assertStartsWith(execution.op_type, "__inference_unique_sum")
      self.assertLen(execution.output_tensor_device_ids, 2)
      self.assertLen(execution.input_tensor_ids, 1)
      self.assertLen(execution.output_tensor_ids, 2)
      self.assertEqual(execution.num_outputs, 2)
      self.assertTrue(execution.graph_id)

      traces = test_monitor.graph_execution_traces
      if tensor_debug_mode == "CONCISE_HEALTH":
        self.assertLen(traces, 3)  # [Placeholder:0, Unique:0 , Sum:0].
        self.assertEqual(traces[0].op_type, "Placeholder")
        self.assertEqual(traces[0].output_slot, 0)
        self.assertEqual(traces[1].op_type, "Unique")
        self.assertEqual(traces[1].output_slot, 0)
        # Unique:1 is not traced under CONCISE_HEALTH mode, as it's int-dtype.
        self.assertEqual(traces[2].op_type, "Sum")
        self.assertEqual(traces[2].output_slot, 0)
        # [tensor_id, element_count, neg_inf_count, pos_inf_count, nan_count].
        self.assertLen(traces[0].debug_tensor_value, 5)
        self.assertLen(traces[1].debug_tensor_value, 5)
        self.assertLen(traces[2].debug_tensor_value, 5)
      elif tensor_debug_mode == "FULL_HEALTH":
        self.assertLen(traces, 3)  # [Placeholder:0, Unique:0 , Sum:0].
        self.assertEqual(traces[0].op_type, "Placeholder")
        self.assertEqual(traces[0].output_slot, 0)
        self.assertEqual(traces[1].op_type, "Unique")
        self.assertEqual(traces[1].output_slot, 0)
        # Unique:1 is not traced under FULL_HEALTH mode, as it's int-dtype.
        self.assertEqual(traces[2].op_type, "Sum")
        self.assertEqual(traces[2].output_slot, 0)
        # [tensor_id, device_id, dtype, rank, element_count,
        #  neg_inf_count, pos_inf_count, nan_count,
        #  neg_finite_count, zero_count, pos_finite_count].
        self.assertLen(traces[0].debug_tensor_value, 11)
        self.assertLen(traces[1].debug_tensor_value, 11)
        self.assertLen(traces[2].debug_tensor_value, 11)
      elif tensor_debug_mode == "FULL_TENSOR":
        self.assertLen(traces, 4)  # [Placeholder:0, Unique:0, Unique:1, Sum:0].
        self.assertEqual(traces[0].op_type, "Placeholder")
        self.assertEqual(traces[0].output_slot, 0)
        self.assertIsNone(traces[0].debug_tensor_value)
        self.assertAllEqual(
            reader.graph_execution_trace_to_tensor_value(traces[0]),
            [2., 6., 8., 1., 2.])
        self.assertEqual(traces[1].op_type, "Unique")
        self.assertEqual(traces[1].output_slot, 0)
        self.assertIsNone(traces[1].debug_tensor_value)
        self.assertAllEqual(
            reader.graph_execution_trace_to_tensor_value(traces[1]),
            [2., 6., 8., 1.])
        self.assertEqual(traces[2].op_type, "Unique")
        self.assertEqual(traces[2].output_slot, 1)
        self.assertIsNone(traces[2].debug_tensor_value)
        self.assertAllEqual(
            reader.graph_execution_trace_to_tensor_value(traces[2]),
            [0, 1, 2, 3, 0])
        self.assertEqual(traces[3].op_type, "Sum")
        self.assertEqual(traces[3].output_slot, 0)
        self.assertIsNone(traces[3].debug_tensor_value)
        self.assertAllClose(
            reader.graph_execution_trace_to_tensor_value(traces[3]), 17.)

class AlertDataObjectsTest(test_util.TensorFlowTestCase):
  """Unit tests for alert-class objects."""

  def testInfNanMonitor(self):
    alert = debug_events_monitors.InfNanAlert(
        1234,
        "FooOp",
        1,
        size=1000,
        num_neg_inf=5,
        num_pos_inf=10,
        num_nan=20,
        execution_index=777,
        graph_execution_trace_index=888)
    self.assertEqual(alert.wall_time, 1234)
    self.assertEqual(alert.op_type, "FooOp")
    self.assertEqual(alert.output_slot, 1)
    self.assertEqual(alert.size, 1000)
    self.assertEqual(alert.num_neg_inf, 5)
    self.assertEqual(alert.num_pos_inf, 10)
    self.assertEqual(alert.num_nan, 20)
    self.assertEqual(alert.execution_index, 777)
    self.assertEqual(alert.graph_execution_trace_index, 888)

class InfNanMonitorTest(test_util.TensorFlowTestCase, parameterized.TestCase):

  def testInfNanMonitorStartsWithEmptyAlerts(self):
    mock_reader = test.mock.MagicMock()
    monitor = debug_events_monitors.InfNanMonitor(mock_reader)
    self.assertEmpty(monitor.alerts())

  def testInfNanMonitorOnExecutionUnderCurtHealthMode(self):
    mock_reader = test.mock.MagicMock()
    monitor = debug_events_monitors.InfNanMonitor(mock_reader)
    execution_digest = debug_events_reader.ExecutionDigest(
        1234, 1, "FooOp", output_tensor_device_ids=[0, 1])
    execution = debug_events_reader.Execution(
        execution_digest,
        "worker01", ["a1", "b2", "e3"],
        debug_event_pb2.TensorDebugMode.CURT_HEALTH,
        graph_id=None,
        input_tensor_ids=[12, 34],
        output_tensor_ids=[56, 78],
        debug_tensor_values=[[-1, 0], [-1, 1]])  # [tensor_id, any_inf_nan].
    monitor.on_execution(50, execution)

    self.assertLen(monitor.alerts(), 1)
    alert = monitor.alerts()[0]
    self.assertEqual(alert.wall_time, 1234)
    self.assertEqual(alert.op_type, "FooOp")
    self.assertEqual(alert.output_slot, 1)
    # The four fields below are unavailable under CURT_HEALTH mode by design.
    self.assertIsNone(alert.size)
    self.assertIsNone(alert.num_neg_inf)
    self.assertIsNone(alert.num_pos_inf)
    self.assertIsNone(alert.num_nan)
    self.assertEqual(alert.execution_index, 50)
    self.assertIsNone(alert.graph_execution_trace_index)

  @parameterized.named_parameters(
      ("ConciseHealth",
       debug_event_pb2.TensorDebugMode.CONCISE_HEALTH,
       # [tensor_id, size, num_neg_inf, num_pos_inf, num_nan].
       [[-1, 10, 1, 2, 3],
        [-1, 100, 0, 0, 0]]),
      ("FullHealth",
       debug_event_pb2.TensorDebugMode.FULL_HEALTH,
       # [tensor_id, device_id, dtype, rank, element_count,
       #  neg_inf_count, pos_inf_count, nan_count,
       #  neg_finite_count, zero_count, pos_finite_count].
       [[-1, -1, 1, 1, 10, 1, 2, 3, 0, 0, 0],
        [-1, -1, 1, 1, 100, 0, 0, 0, 10, 30, 60]]),
  )
  def testInfNanMonitorOnExecutionUnderHealthMode(self,
                                                  tensor_debug_mode,
                                                  debug_tensor_values):
    mock_reader = test.mock.MagicMock()
    monitor = debug_events_monitors.InfNanMonitor(mock_reader)
    execution_digest = debug_events_reader.ExecutionDigest(
        1234, 1, "BarOp", output_tensor_device_ids=[0, 1])

    execution = debug_events_reader.Execution(
        execution_digest,
        "worker01",
        ["a1", "b2", "e3"],
        tensor_debug_mode,
        graph_id=None,
        input_tensor_ids=[12, 34],
        output_tensor_ids=[56, 78],
        debug_tensor_values=debug_tensor_values)
    monitor.on_execution(60, execution)

    self.assertLen(monitor.alerts(), 1)
    alert = monitor.alerts()[0]
    self.assertEqual(alert.wall_time, 1234)
    self.assertEqual(alert.op_type, "BarOp")
    self.assertEqual(alert.output_slot, 0)
    self.assertEqual(alert.size, 10)
    self.assertEqual(alert.num_neg_inf, 1)
    self.assertEqual(alert.num_pos_inf, 2)
    self.assertEqual(alert.num_nan, 3)
    self.assertEqual(alert.execution_index, 60)
    self.assertIsNone(alert.graph_execution_trace_index)

  @parameterized.named_parameters(
      ("FloatsScalarWithInfAndNan", np.inf, np.float32, 1, 0, 1, 0),
      ("Floats2DWithInfAndNan", [[0, np.nan, np.nan, -np.inf]
                                ], np.float32, 4, 1, 0, 2),
      ("Floats1DWithoutInfOrNan", [0, -1e6, 1e6, 9e5], np.float32, 4, 0, 0, 0),
      ("Integers", [[0, 1000, -200, -300]], np.int32, 4, 0, 0, 0),
      ("Booleans", [False, True, False, False], np.int32, 4, 0, 0, 0),
  )
  def testInfNanMonitorOnExecutionUnderFullTensorModeWorks(
      self, tensor_value, dtype, expected_size, expected_num_neg_inf,
      expected_num_pos_inf, expected_num_nan):
    mock_reader = test.mock.MagicMock()
    mock_reader.execution_to_tensor_values.return_value = [
        np.array([[0.0, -1.0, 1.0]]),
        np.array(tensor_value, dtype=dtype)
    ]
    monitor = debug_events_monitors.InfNanMonitor(mock_reader)
    execution_digest = debug_events_reader.ExecutionDigest(
        1234,
        1,
        "__inference_bar_function_1234",
        output_tensor_device_ids=[0, 1])
    execution = debug_events_reader.Execution(
        execution_digest,
        "worker01", ["a1", "b2", "e3"],
        debug_event_pb2.TensorDebugMode.FULL_TENSOR,
        graph_id=None,
        input_tensor_ids=[12, 34],
        output_tensor_ids=[56, 78])
    monitor.on_execution(70, execution)

    if expected_num_neg_inf or expected_num_pos_inf or expected_num_nan:
      self.assertLen(monitor.alerts(), 1)
      alert = monitor.alerts()[0]
      self.assertEqual(alert.wall_time, 1234)
      self.assertEqual(alert.op_type, "__inference_bar_function_1234")
      self.assertEqual(alert.output_slot, 1)
      self.assertEqual(alert.size, expected_size)
      self.assertEqual(alert.num_neg_inf, expected_num_neg_inf)
      self.assertEqual(alert.num_pos_inf, expected_num_pos_inf)
      self.assertEqual(alert.num_nan, expected_num_nan)
      self.assertEqual(alert.execution_index, 70)
      self.assertIsNone(alert.graph_execution_trace_index, 70)
    else:
      self.assertEmpty(monitor.alerts())

  def testInfNaNMonitorOnGraphExecutionTraceCurtHealthMode(self):
    mock_reader = test.mock.MagicMock()
    monitor = debug_events_monitors.InfNanMonitor(mock_reader)
    trace_digest = debug_events_reader.GraphExecutionTraceDigest(
        1234, 1, "FooOp", "FooOp_1", 2, "g1")
    trace = debug_events_reader.GraphExecutionTrace(
        trace_digest, ["g0", "g1"],
        debug_event_pb2.TensorDebugMode.CURT_HEALTH,
        debug_tensor_value=[9, 1])  # [tensor_id, any_inf_nan].
    monitor.on_graph_execution_trace(55, trace)
    self.assertLen(monitor.alerts(), 1)
    alert = monitor.alerts()[0]
    self.assertEqual(alert.wall_time, 1234)
    self.assertEqual(alert.op_type, "FooOp")
    self.assertEqual(alert.output_slot, 2)
    # The four fields below are unavailable under CURT_HEALTH mode by design.
    self.assertIsNone(alert.size)
    self.assertIsNone(alert.num_neg_inf)
    self.assertIsNone(alert.num_pos_inf)
    self.assertIsNone(alert.num_nan)
    self.assertIsNone(alert.execution_index)
    self.assertEqual(alert.graph_execution_trace_index, 55)

  def testInfNaNMonitorOnGraphExecutionTraceConciseHealthMode(self):
    mock_reader = test.mock.MagicMock()
    monitor = debug_events_monitors.InfNanMonitor(mock_reader)
    trace_digest = debug_events_reader.GraphExecutionTraceDigest(
        1234, 1, "FooOp", "FooOp_1", 2, "g1")
    trace = debug_events_reader.GraphExecutionTrace(
        trace_digest,
        ["g0", "g1"],
        debug_event_pb2.TensorDebugMode.CONCISE_HEALTH,
        # [tensor_id, size, num_neg_inf, num_pos_inf, num_nan].
        debug_tensor_value=[9, 100, 3, 2, 1])
    monitor.on_graph_execution_trace(55, trace)

    self.assertLen(monitor.alerts(), 1)
    alert = monitor.alerts()[0]
    self.assertEqual(alert.wall_time, 1234)
    self.assertEqual(alert.op_type, "FooOp")
    self.assertEqual(alert.output_slot, 2)
    self.assertEqual(alert.size, 100)
    self.assertEqual(alert.num_neg_inf, 3)
    self.assertEqual(alert.num_pos_inf, 2)
    self.assertEqual(alert.num_nan, 1)
    self.assertEqual(alert.graph_execution_trace_index, 55)

  @parameterized.named_parameters(
      ("FloatsScalarWithInfAndNan", np.inf, np.float32, 1, 0, 1, 0),
      ("Floats2DWithInfAndNan", [[0, np.nan, np.nan, -np.inf]
                                ], np.float32, 4, 1, 0, 2),
      ("Floats1DWithoutInfOrNan", [0, -1e6, 1e6, 9e5], np.float32, 4, 0, 0, 0),
      ("Integers", [[0, 1000, -200, -300]], np.int32, 4, 0, 0, 0),
      ("Booleans", [False, True, False, False], np.int32, 4, 0, 0, 0),
  )
  def testInfNanMonitorOnGraphExecutionTraceUnderFullTensorModeWorks(
      self, tensor_value, dtype, expected_size, expected_num_neg_inf,
      expected_num_pos_inf, expected_num_nan):
    mock_reader = test.mock.MagicMock()
    mock_reader.graph_execution_trace_to_tensor_value.return_value = np.array(
        tensor_value, dtype=dtype)
    monitor = debug_events_monitors.InfNanMonitor(mock_reader)
    trace_digest = debug_events_reader.GraphExecutionTraceDigest(
        1234, 1, "BazOp", "name_scope_3/BazOp_1", 2, "g1")
    trace = debug_events_reader.GraphExecutionTrace(
        trace_digest, ["g0", "g1"], debug_event_pb2.TensorDebugMode.FULL_TENSOR)
    monitor.on_graph_execution_trace(80, trace)

    if expected_num_neg_inf or expected_num_pos_inf or expected_num_nan:
      self.assertLen(monitor.alerts(), 1)
      alert = monitor.alerts()[0]
      self.assertEqual(alert.wall_time, 1234)
      self.assertEqual(alert.op_type, "BazOp")
      self.assertEqual(alert.output_slot, 2)
      self.assertEqual(alert.size, expected_size)
      self.assertEqual(alert.num_neg_inf, expected_num_neg_inf)
      self.assertEqual(alert.num_pos_inf, expected_num_pos_inf)
      self.assertEqual(alert.num_nan, expected_num_nan)
      self.assertIsNone(alert.execution_index)
      self.assertEqual(alert.graph_execution_trace_index, 80)
    else:
      self.assertEmpty(monitor.alerts())

  def testLimitingInfNanMonitorAlertCountWorks(self):
    mock_reader = test.mock.MagicMock()
    monitor = debug_events_monitors.InfNanMonitor(mock_reader, limit=3)
    for i in range(10):
      execution_digest = debug_events_reader.ExecutionDigest(
          i * 1000, 1, "FooOp", output_tensor_device_ids=[0, 1])
      execution = debug_events_reader.Execution(
          execution_digest,
          "worker01", ["a1", "b2", "e3"],
          debug_event_pb2.TensorDebugMode.CURT_HEALTH,
          graph_id=None,
          input_tensor_ids=[12, 34],
          output_tensor_ids=[56, 78],
          debug_tensor_values=[[-1, 0], [-1, 1]])  # [tensor_id, any_inf_nan].
      monitor.on_execution(i, execution)

    alerts = monitor.alerts()
    self.assertLen(alerts, 3)
    for i, alert in enumerate(alerts):
      self.assertEqual(alert.wall_time, i * 1000)
      self.assertEqual(alert.op_type, "FooOp")
      self.assertEqual(alert.output_slot, 1)
      # The four fields below are unavailable under CURT_HEALTH mode by design.
      self.assertIsNone(alert.size)
      self.assertIsNone(alert.num_neg_inf)
      self.assertIsNone(alert.num_pos_inf)
      self.assertIsNone(alert.num_nan)
      self.assertEqual(alert.execution_index, i)
      self.assertIsNone(alert.graph_execution_trace_index)

if __name__ == "__main__":
  ops.enable_eager_execution()
  googletest.main()


text:
require 'sequent'
require 'sequent/support'
require 'erb'
require_relative 'lib/post'
require_relative 'app/projectors/post_projector'

require_relative 'config/initializers/sequent'

module MyApp

end


text:
@interface FitViewController () <LMReportViewDatasource>

@property (nonatomic, strong) LMReportView *reportView;

@end

@implementation FitViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = @"行高自适应";

    self.reportView = [[LMReportView alloc] init];
    self.reportView.datasource = self;
    self.reportView.style.autoFitHeight = YES;
    [self.view addSubview:self.reportView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];

    CGRect rect = self.view.bounds;
    rect = CGRectInset(rect, 16, 16);
    rect.origin.y += 60;
    rect.size.height -= 64;
    self.reportView.frame = rect;
}

#pragma mark - <LMReportViewDatasource>

- (NSInteger)numberOfRowsInReportView:(LMReportView *)reportView {
    return 10;
}

- (NSInteger)numberOfColsInReportView:(LMReportView *)reportView {
    return 10;
}

- (LMRGrid *)reportView:(LMReportView *)reportView gridAtIndexPath:(NSIndexPath *)indexPath {
    LMRGrid *grid = [[LMRGrid alloc] init];
    NSString *baseString = [NSString stringWithFormat:@"%ld-%ld", indexPath.row, indexPath.col];
    NSMutableString *text = [NSMutableString stringWithString:baseString];
    for (NSInteger i = 0; i < indexPath.row; i++) {
        [text appendString:@"\n"];
        [text appendString:baseString];
    }
    grid.text = text;
    return grid;
}

@end


text:
function [classes,adjmat] = classesBFS(varargin)
% Return a list of classes in breadth first search order
% Same inputs as getClasses
% PMTKneedsMatlab 2008

% This file is from pmtk3.googlecode.com

    classes = getClasses(varargin{:});
    if(isempty(classes)), fprintf('\nNo classes found in this directory.\n'); return; end
    classMap = enumerate(classes);
    adjmat = false(numel(classes));
    for c=1:numel(classes)
        supers = cellfuncell(@(n)n.Name,meta.class.fromName(classes{c}).SuperClasses);
        for s=1:numel(supers)
            if ismember(supers{s},classes), adjmat(classMap.(supers{s}),classMap.(classes{c})) = true;  end
        end
    end

    perm = topological_sort(adjmat);
    classes = classes(perm);
    adjmat = adjmat(perm,:);
    adjmat = adjmat(:,perm);

end


text:
/* ─────────────────────────╮
 │ @thebespokepixel/xo-tidy │ XO/ES Formatting and Fixup Engine.
 ╰──────────────────────────┴────────────────────────────────────────────────── */

import {resolve} from 'path'
import esFormatter from 'esformatter'
import {CLIEngine as ESLint} from 'eslint'
import stripANSI from 'strip-ansi'
import cardinal from 'cardinal'
import {stripIndent, stripIndents} from 'common-tags'
import {box} from '@thebespokepixel/string'
import esFormatterVarEach from 'esformatter-var-each'
import esFormatterDotNotation from 'esformatter-dot-notation'
import esFormatterParseint from 'esformatter-parseint'
import esFormatterSemicolons from 'esformatter-semicolons'
import esFormatterLimitLinebreaks from 'esformatter-limit-linebreaks'
import {console, clr} from '../index'

/**
 * A simple esFormatter plugin to ensure strict equals
 * @private
 * @type {esFormatterPlugin}
 */
const esFormatterNoEqNull = {
	/**
	 * Ensure strict equality with `undefined` rather than `Null`
	 * @private
	 * @param  {astToken} token The AST token from esFormatter
	 * @return {undefined} has side effects
	 */
	tokenAfter: token => {
		if (token.type === 'Punctuator') {
			if (/^(!|=)=$/.test(token.value) && token.next.next.type === 'Null') {
				token.value += '='
				token.next.next.value = 'undefined'
			}
		}
	}
}

esFormatter.register(esFormatterNoEqNull)
esFormatter.register(esFormatterVarEach)
esFormatter.register(esFormatterDotNotation)
esFormatter.register(esFormatterParseint)
esFormatter.register(esFormatterSemicolons)
esFormatter.register(esFormatterLimitLinebreaks)

/**
 * Create a configured ESformatter factory
 * @private
 * @param  {options} options - Job options
 * @return {Function} - Generate an ESFormatter configuration
 */
function configureESFormatter(options) {
	const ESFormatConfig = {
		root: true,
		allowShebang: true,
		indent: {value: '\t'},
		whiteSpace: {
			before: {
				IfStatementConditionalOpening: -1
			},
			after: {
				IfStatementConditionalClosing: -1,
				FunctionReservedWord: 1
			}
		},
		lineBreak: {after: {ClassDeclarationClosingBrace: 0}}
	}
	if (options.space > 0) {
		ESFormatConfig.indent.value = ' '.repeat(parseInt(options.space, 10))
	}

	console.debug(stripIndent`
		${clr.title}esFormatter Options${clr.title.out}:
	`)
	if (console.canWrite(5)) {
		console.pretty(ESFormatConfig, 2)
	}

	return () => esFormatter.rc(ESFormatConfig)
}

/**
 * Create a configured ESLint factory
 * @private
 * @param  {options} options - Job options
 * @return {Function} - Generate an ESLint configuration
 */
function configureESLint(options) {
	const ESLintConfig = {
		rules: options.rules
	}

	ESLintConfig.extends = 'xo'
	if (options.esnext) {
		ESLintConfig.extends = 'xo/esnext'
	}

	if (!options.semicolon) {
		ESLintConfig.rules.semi = [2, 'never']
	}

	if (options.space === false) {
		ESLintConfig.rules.indent = [
			2, 'tab', {
				SwitchCase: 1
			}
		]
	} else {
		ESLintConfig.rules.indent = [
			2, parseInt(options.space, 10), {
				SwitchCase: 0
			}
		]
	}

	ESLintConfig.rules['valid-jsdoc'] = [0]
	ESLintConfig.rules['require-jsdoc'] = [0]

	console.debug(stripIndent`
		${clr.title}ESlint Options${clr.title.out}:
	`)
	if (console.canWrite(5)) {
		console.pretty(ESLintConfig, 2)
	}

	return () => new ESLint({
		baseConfig: ESLintConfig,
		fix: true,
		rules: options.rules
	})
}

/**
 * The core formatting and fixing engine
 * @private
 */
class TidyBot {
	/**
	 * Create a new formatter instance for the supplied options.
	 * @param  {options} options - Job options.
	 * @return {TidyBot} - The formatting engine.
	 */
	constructor(options) {
		console.info(stripIndent`
			${clr.title}Compiled Options${clr.title.out}:
		`)
		if (console.canWrite(4)) {
			console.pretty(options, 2)
		}

		this.esFormatConfig = configureESFormatter(options)
		this.esLintConfig = configureESLint(options)
		this.linting = options.lint
		this.wantsColor = options.color
	}

	/**
	 * The formatting/linting pipeline.
	 * @param  {String} source   - The raw JavaScript to be formatted.
	 * @param  {String} filename - The job's real (or virtual) filename.
	 * @return {Object} The formatted output and linting report.
	 */
	format(source, filename = '') {
		let fixed
		let formatted

		try {
			source = esFormatter.format(source, this.esFormatConfig())
		} catch (err) {
			console.warn(`Error while applying formatting. (${err}). Trying to continue...`)
		}

		try {
			fixed = this.esLintConfig().executeOnText(source, filename, true)
		} catch (err) {
			console.warn(
				`Error while applying preflight linting/fixing. (${err}). Trying to continue...`
			)
		}

		if (fixed.results[0].output === undefined) {
			formatted = source
		} else {
			if (fixed.results[0].messages.length > 0) {
				console.debug(stripIndent`
					${clr.title}Linter Messages${clr.title.out}:
				`)
				if (console.canWrite(5)) {
					console.pretty(fixed.results[0].messages, 2)
				}
			}
			formatted = fixed.results[0].output
		}

		if (this.linting) {
			const title = box('xo-tidy linting report', {
				borderColor: 'yellow'
			})

			const lintReportContent = stripIndents`
				${cardinal.highlight(
					formatted.replace(/\t/g, '    '), {
						linenos: true
					})
				}

				${ESLint.getFormatter()(fixed.results).replace(resolve(__dirname, '../..'), '')}`

			const lintReport = `${title}\n${lintReportContent}`

			return this.wantsColor && process.stdout.isTTY ? lintReport : stripANSI(lintReport)
		}
		return formatted
	}
}

/**
 * Create an TidyBot Instance
 * @function
 * @param  {options} options - Shared job options
 * @return {TidyBot}           - Core linting and formatting logic.
 */
export default function createTidyBot(options) {
	return new TidyBot(options)
}