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

import java.io.Serializable;

import com.amazonaws.AmazonWebServiceRequest;

/**
 * Container for the parameters to the {@link com.amazonaws.services.redshift.AmazonRedshift#describeTags(DescribeTagsRequest) DescribeTags operation}.
 *

 * Returns a list of tags. You can return tags from a specific resource
 * by specifying an ARN, or you can return all tags for a given type of
 * resource, such as clusters, snapshots, and so on.
 *

 *

 * The following are limitations for DescribeTags :
 *
 *

 *
You cannot specify an ARN and a resource-type value together in
 * the same request.

 *
You cannot use the MaxRecords and
 * Marker parameters together with the ARN parameter.

 *
The MaxRecords parameter can be a range from 10 to
 * 50 results to return in a request.

 *
 *

 *
 *

 *

 * If you specify both tag keys and tag values in the same request,
 * Amazon Redshift returns all resources that match any combination of
 * the specified keys and values. For example, if you have
 * owner and environment for tag keys, and
 * admin and test for tag values, all resources
 * that have any combination of those values are returned.
 *

 *

 * If both tag keys and values are omitted from the request, resources
 * are returned regardless of whether they have tag keys or values
 * associated with them.
 *

 *
 * @see com.amazonaws.services.redshift.AmazonRedshift#describeTags(DescribeTagsRequest)
 */
public class DescribeTagsRequest extends AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     * The Amazon Resource Name (ARN) for which you want to describe the tag
     * or tags. For example,
     * arn:aws:redshift:us-east-1:123456789:cluster:t1.
     */
    private String resourceName;

    /**
     * The type of resource with which you want to view tags. Valid resource
     * types are:

Cluster

CIDR/IP

EC2 security
     * group

Snapshot

Cluster security group

     *
Subnet group

HSM connection

HSM certificate

     *
Parameter group

Snapshot copy grant

 For
     * more information about Amazon Redshift resource types and constructing
     * ARNs, go to Constructing
     * an Amazon Redshift Amazon Resource Name (ARN) in the Amazon
     * Redshift Cluster Management Guide.
     */
    private String resourceType;

    /**
     * The maximum number or response records to return in each call. If the
     * number of remaining response records exceeds the specified
     * MaxRecords value, a value is returned in a
     * marker field of the response. You can retrieve the next
     * set of records by retrying the command with the returned
     * marker value.
     */
    private Integer maxRecords;

    /**
     * A value that indicates the starting point for the next set of response
     * records in a subsequent request. If a value is returned in a response,
     * you can retrieve the next set of records by providing this returned
     * marker value in the marker parameter and retrying the
     * command. If the marker field is empty, all response
     * records have been retrieved for the request.
     */
    private String marker;

    /**
     * A tag key or keys for which you want to return all matching resources
     * that are associated with the specified key or keys. For example,
     * suppose that you have resources tagged with keys called
     * owner and environment. If you specify both
     * of these tag keys in the request, Amazon Redshift returns a response
     * with all resources that have either or both of these tag keys
     * associated with them.
     */
    private com.amazonaws.internal.ListWithAutoConstructFlag<String> tagKeys;

    /**
     * A tag value or values for which you want to return all matching
     * resources that are associated with the specified value or values. For
     * example, suppose that you have resources tagged with values called
     * admin and test. If you specify both of these
     * tag values in the request, Amazon Redshift returns a response with all
     * resources that have either or both of these tag values associated with
     * them.
     */
    private com.amazonaws.internal.ListWithAutoConstructFlag<String> tagValues;

    /**
     * The Amazon Resource Name (ARN) for which you want to describe the tag
     * or tags. For example,
     * arn:aws:redshift:us-east-1:123456789:cluster:t1.
     *
     * @return The Amazon Resource Name (ARN) for which you want to describe the tag
     *         or tags. For example,
     *         arn:aws:redshift:us-east-1:123456789:cluster:t1.
     */
    public String getResourceName() {
        return resourceName;
    }

    /**
     * The Amazon Resource Name (ARN) for which you want to describe the tag
     * or tags. For example,
     * arn:aws:redshift:us-east-1:123456789:cluster:t1.
     *
     * @param resourceName The Amazon Resource Name (ARN) for which you want to describe the tag
     *         or tags. For example,
     *         arn:aws:redshift:us-east-1:123456789:cluster:t1.
     */
    public void setResourceName(String resourceName) {
        this.resourceName = resourceName;
    }

    /**
     * The Amazon Resource Name (ARN) for which you want to describe the tag
     * or tags. For example,
     * arn:aws:redshift:us-east-1:123456789:cluster:t1.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param resourceName The Amazon Resource Name (ARN) for which you want to describe the tag
     *         or tags. For example,
     *         arn:aws:redshift:us-east-1:123456789:cluster:t1.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeTagsRequest withResourceName(String resourceName) {
        this.resourceName = resourceName;
        return this;
    }

    /**
     * The type of resource with which you want to view tags. Valid resource
     * types are:

Cluster

CIDR/IP

EC2 security
     * group

Snapshot

Cluster security group

     *
Subnet group

HSM connection

HSM certificate

     *
Parameter group

Snapshot copy grant

 For
     * more information about Amazon Redshift resource types and constructing
     * ARNs, go to Constructing
     * an Amazon Redshift Amazon Resource Name (ARN) in the Amazon
     * Redshift Cluster Management Guide.
     *
     * @return The type of resource with which you want to view tags. Valid resource
     *         types are:

Cluster

CIDR/IP

EC2 security
     *         group

Snapshot

Cluster security group

     *
Subnet group

HSM connection

HSM certificate

     *
Parameter group

Snapshot copy grant

 For
     *         more information about Amazon Redshift resource types and constructing
     *         ARNs, go to Constructing
     *         an Amazon Redshift Amazon Resource Name (ARN) in the Amazon
     *         Redshift Cluster Management Guide.
     */
    public String getResourceType() {
        return resourceType;
    }

    /**
     * The type of resource with which you want to view tags. Valid resource
     * types are:

Cluster

CIDR/IP

EC2 security
     * group

Snapshot

Cluster security group

     *
Subnet group

HSM connection

HSM certificate

     *
Parameter group

Snapshot copy grant

 For
     * more information about Amazon Redshift resource types and constructing
     * ARNs, go to Constructing
     * an Amazon Redshift Amazon Resource Name (ARN) in the Amazon
     * Redshift Cluster Management Guide.
     *
     * @param resourceType The type of resource with which you want to view tags. Valid resource
     *         types are:

Cluster

CIDR/IP

EC2 security
     *         group

Snapshot

Cluster security group

     *
Subnet group

HSM connection

HSM certificate

     *
Parameter group

Snapshot copy grant

 For
     *         more information about Amazon Redshift resource types and constructing
     *         ARNs, go to Constructing
     *         an Amazon Redshift Amazon Resource Name (ARN) in the Amazon
     *         Redshift Cluster Management Guide.
     */
    public void setResourceType(String resourceType) {
        this.resourceType = resourceType;
    }

    /**
     * The type of resource with which you want to view tags. Valid resource
     * types are:

Cluster

CIDR/IP

EC2 security
     * group

Snapshot

Cluster security group

     *
Subnet group

HSM connection

HSM certificate

     *
Parameter group

Snapshot copy grant

 For
     * more information about Amazon Redshift resource types and constructing
     * ARNs, go to Constructing
     * an Amazon Redshift Amazon Resource Name (ARN) in the Amazon
     * Redshift Cluster Management Guide.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param resourceType The type of resource with which you want to view tags. Valid resource
     *         types are:

Cluster

CIDR/IP

EC2 security
     *         group

Snapshot

Cluster security group

     *
Subnet group

HSM connection

HSM certificate

     *
Parameter group

Snapshot copy grant

 For
     *         more information about Amazon Redshift resource types and constructing
     *         ARNs, go to Constructing
     *         an Amazon Redshift Amazon Resource Name (ARN) in the Amazon
     *         Redshift Cluster Management Guide.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeTagsRequest withResourceType(String resourceType) {
        this.resourceType = resourceType;
        return this;
    }

    /**
     * The maximum number or response records to return in each call. If the
     * number of remaining response records exceeds the specified
     * MaxRecords value, a value is returned in a
     * marker field of the response. You can retrieve the next
     * set of records by retrying the command with the returned
     * marker value.
     *
     * @return The maximum number or response records to return in each call. If the
     *         number of remaining response records exceeds the specified
     *         MaxRecords value, a value is returned in a
     *         marker field of the response. You can retrieve the next
     *         set of records by retrying the command with the returned
     *         marker value.
     */
    public Integer getMaxRecords() {
        return maxRecords;
    }

    /**
     * The maximum number or response records to return in each call. If the
     * number of remaining response records exceeds the specified
     * MaxRecords value, a value is returned in a
     * marker field of the response. You can retrieve the next
     * set of records by retrying the command with the returned
     * marker value.
     *
     * @param maxRecords The maximum number or response records to return in each call. If the
     *         number of remaining response records exceeds the specified
     *         MaxRecords value, a value is returned in a
     *         marker field of the response. You can retrieve the next
     *         set of records by retrying the command with the returned
     *         marker value.
     */
    public void setMaxRecords(Integer maxRecords) {
        this.maxRecords = maxRecords;
    }

    /**
     * The maximum number or response records to return in each call. If the
     * number of remaining response records exceeds the specified
     * MaxRecords value, a value is returned in a
     * marker field of the response. You can retrieve the next
     * set of records by retrying the command with the returned
     * marker value.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param maxRecords The maximum number or response records to return in each call. If the
     *         number of remaining response records exceeds the specified
     *         MaxRecords value, a value is returned in a
     *         marker field of the response. You can retrieve the next
     *         set of records by retrying the command with the returned
     *         marker value.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeTagsRequest withMaxRecords(Integer maxRecords) {
        this.maxRecords = maxRecords;
        return this;
    }

    /**
     * A value that indicates the starting point for the next set of response
     * records in a subsequent request. If a value is returned in a response,
     * you can retrieve the next set of records by providing this returned
     * marker value in the marker parameter and retrying the
     * command. If the marker field is empty, all response
     * records have been retrieved for the request.
     *
     * @return A value that indicates the starting point for the next set of response
     *         records in a subsequent request. If a value is returned in a response,
     *         you can retrieve the next set of records by providing this returned
     *         marker value in the marker parameter and retrying the
     *         command. If the marker field is empty, all response
     *         records have been retrieved for the request.
     */
    public String getMarker() {
        return marker;
    }

    /**
     * A value that indicates the starting point for the next set of response
     * records in a subsequent request. If a value is returned in a response,
     * you can retrieve the next set of records by providing this returned
     * marker value in the marker parameter and retrying the
     * command. If the marker field is empty, all response
     * records have been retrieved for the request.
     *
     * @param marker A value that indicates the starting point for the next set of response
     *         records in a subsequent request. If a value is returned in a response,
     *         you can retrieve the next set of records by providing this returned
     *         marker value in the marker parameter and retrying the
     *         command. If the marker field is empty, all response
     *         records have been retrieved for the request.
     */
    public void setMarker(String marker) {
        this.marker = marker;
    }

    /**
     * A value that indicates the starting point for the next set of response
     * records in a subsequent request. If a value is returned in a response,
     * you can retrieve the next set of records by providing this returned
     * marker value in the marker parameter and retrying the
     * command. If the marker field is empty, all response
     * records have been retrieved for the request.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param marker A value that indicates the starting point for the next set of response
     *         records in a subsequent request. If a value is returned in a response,
     *         you can retrieve the next set of records by providing this returned
     *         marker value in the marker parameter and retrying the
     *         command. If the marker field is empty, all response
     *         records have been retrieved for the request.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeTagsRequest withMarker(String marker) {
        this.marker = marker;
        return this;
    }

    /**
     * A tag key or keys for which you want to return all matching resources
     * that are associated with the specified key or keys. For example,
     * suppose that you have resources tagged with keys called
     * owner and environment. If you specify both
     * of these tag keys in the request, Amazon Redshift returns a response
     * with all resources that have either or both of these tag keys
     * associated with them.
     *
     * @return A tag key or keys for which you want to return all matching resources
     *         that are associated with the specified key or keys. For example,
     *         suppose that you have resources tagged with keys called
     *         owner and environment. If you specify both
     *         of these tag keys in the request, Amazon Redshift returns a response
     *         with all resources that have either or both of these tag keys
     *         associated with them.
     */
    public java.util.List<String> getTagKeys() {
        if (tagKeys == null) {
              tagKeys = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              tagKeys.setAutoConstruct(true);
        }
        return tagKeys;
    }

    /**
     * A tag key or keys for which you want to return all matching resources
     * that are associated with the specified key or keys. For example,
     * suppose that you have resources tagged with keys called
     * owner and environment. If you specify both
     * of these tag keys in the request, Amazon Redshift returns a response
     * with all resources that have either or both of these tag keys
     * associated with them.
     *
     * @param tagKeys A tag key or keys for which you want to return all matching resources
     *         that are associated with the specified key or keys. For example,
     *         suppose that you have resources tagged with keys called
     *         owner and environment. If you specify both
     *         of these tag keys in the request, Amazon Redshift returns a response
     *         with all resources that have either or both of these tag keys
     *         associated with them.
     */
    public void setTagKeys(java.util.Collection<String> tagKeys) {
        if (tagKeys == null) {
            this.tagKeys = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<String> tagKeysCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(tagKeys.size());
        tagKeysCopy.addAll(tagKeys);
        this.tagKeys = tagKeysCopy;
    }

    /**
     * A tag key or keys for which you want to return all matching resources
     * that are associated with the specified key or keys. For example,
     * suppose that you have resources tagged with keys called
     * owner and environment. If you specify both
     * of these tag keys in the request, Amazon Redshift returns a response
     * with all resources that have either or both of these tag keys
     * associated with them.
     *

     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setTagKeys(java.util.Collection)} or {@link
     * #withTagKeys(java.util.Collection)} if you want to override the
     * existing values.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param tagKeys A tag key or keys for which you want to return all matching resources
     *         that are associated with the specified key or keys. For example,
     *         suppose that you have resources tagged with keys called
     *         owner and environment. If you specify both
     *         of these tag keys in the request, Amazon Redshift returns a response
     *         with all resources that have either or both of these tag keys
     *         associated with them.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeTagsRequest withTagKeys(String... tagKeys) {
        if (getTagKeys() == null) setTagKeys(new java.util.ArrayList<String>(tagKeys.length));
        for (String value : tagKeys) {
            getTagKeys().add(value);
        }
        return this;
    }

    /**
     * A tag key or keys for which you want to return all matching resources
     * that are associated with the specified key or keys. For example,
     * suppose that you have resources tagged with keys called
     * owner and environment. If you specify both
     * of these tag keys in the request, Amazon Redshift returns a response
     * with all resources that have either or both of these tag keys
     * associated with them.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param tagKeys A tag key or keys for which you want to return all matching resources
     *         that are associated with the specified key or keys. For example,
     *         suppose that you have resources tagged with keys called
     *         owner and environment. If you specify both
     *         of these tag keys in the request, Amazon Redshift returns a response
     *         with all resources that have either or both of these tag keys
     *         associated with them.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeTagsRequest withTagKeys(java.util.Collection<String> tagKeys) {
        if (tagKeys == null) {
            this.tagKeys = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<String> tagKeysCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(tagKeys.size());
            tagKeysCopy.addAll(tagKeys);
            this.tagKeys = tagKeysCopy;
        }

        return this;
    }

    /**
     * A tag value or values for which you want to return all matching
     * resources that are associated with the specified value or values. For
     * example, suppose that you have resources tagged with values called
     * admin and test. If you specify both of these
     * tag values in the request, Amazon Redshift returns a response with all
     * resources that have either or both of these tag values associated with
     * them.
     *
     * @return A tag value or values for which you want to return all matching
     *         resources that are associated with the specified value or values. For
     *         example, suppose that you have resources tagged with values called
     *         admin and test. If you specify both of these
     *         tag values in the request, Amazon Redshift returns a response with all
     *         resources that have either or both of these tag values associated with
     *         them.
     */
    public java.util.List<String> getTagValues() {
        if (tagValues == null) {
              tagValues = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              tagValues.setAutoConstruct(true);
        }
        return tagValues;
    }

    /**
     * A tag value or values for which you want to return all matching
     * resources that are associated with the specified value or values. For
     * example, suppose that you have resources tagged with values called
     * admin and test. If you specify both of these
     * tag values in the request, Amazon Redshift returns a response with all
     * resources that have either or both of these tag values associated with
     * them.
     *
     * @param tagValues A tag value or values for which you want to return all matching
     *         resources that are associated with the specified value or values. For
     *         example, suppose that you have resources tagged with values called
     *         admin and test. If you specify both of these
     *         tag values in the request, Amazon Redshift returns a response with all
     *         resources that have either or both of these tag values associated with
     *         them.
     */
    public void setTagValues(java.util.Collection<String> tagValues) {
        if (tagValues == null) {
            this.tagValues = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<String> tagValuesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(tagValues.size());
        tagValuesCopy.addAll(tagValues);
        this.tagValues = tagValuesCopy;
    }

    /**
     * A tag value or values for which you want to return all matching
     * resources that are associated with the specified value or values. For
     * example, suppose that you have resources tagged with values called
     * admin and test. If you specify both of these
     * tag values in the request, Amazon Redshift returns a response with all
     * resources that have either or both of these tag values associated with
     * them.
     *

     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setTagValues(java.util.Collection)} or {@link
     * #withTagValues(java.util.Collection)} if you want to override the
     * existing values.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param tagValues A tag value or values for which you want to return all matching
     *         resources that are associated with the specified value or values. For
     *         example, suppose that you have resources tagged with values called
     *         admin and test. If you specify both of these
     *         tag values in the request, Amazon Redshift returns a response with all
     *         resources that have either or both of these tag values associated with
     *         them.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeTagsRequest withTagValues(String... tagValues) {
        if (getTagValues() == null) setTagValues(new java.util.ArrayList<String>(tagValues.length));
        for (String value : tagValues) {
            getTagValues().add(value);
        }
        return this;
    }

    /**
     * A tag value or values for which you want to return all matching
     * resources that are associated with the specified value or values. For
     * example, suppose that you have resources tagged with values called
     * admin and test. If you specify both of these
     * tag values in the request, Amazon Redshift returns a response with all
     * resources that have either or both of these tag values associated with
     * them.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param tagValues A tag value or values for which you want to return all matching
     *         resources that are associated with the specified value or values. For
     *         example, suppose that you have resources tagged with values called
     *         admin and test. If you specify both of these
     *         tag values in the request, Amazon Redshift returns a response with all
     *         resources that have either or both of these tag values associated with
     *         them.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeTagsRequest withTagValues(java.util.Collection<String> tagValues) {
        if (tagValues == null) {
            this.tagValues = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<String> tagValuesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(tagValues.size());
            tagValuesCopy.addAll(tagValues);
            this.tagValues = tagValuesCopy;
        }

        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getResourceName() != null) sb.append("ResourceName: " + getResourceName() + ",");
        if (getResourceType() != null) sb.append("ResourceType: " + getResourceType() + ",");
        if (getMaxRecords() != null) sb.append("MaxRecords: " + getMaxRecords() + ",");
        if (getMarker() != null) sb.append("Marker: " + getMarker() + ",");
        if (getTagKeys() != null) sb.append("TagKeys: " + getTagKeys() + ",");
        if (getTagValues() != null) sb.append("TagValues: " + getTagValues() );
        sb.append("}");
        return sb.toString();
    }

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

        hashCode = prime * hashCode + ((getResourceName() == null) ? 0 : getResourceName().hashCode());
        hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode());
        hashCode = prime * hashCode + ((getMaxRecords() == null) ? 0 : getMaxRecords().hashCode());
        hashCode = prime * hashCode + ((getMarker() == null) ? 0 : getMarker().hashCode());
        hashCode = prime * hashCode + ((getTagKeys() == null) ? 0 : getTagKeys().hashCode());
        hashCode = prime * hashCode + ((getTagValues() == null) ? 0 : getTagValues().hashCode());
        return hashCode;
    }

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

        if (obj instanceof DescribeTagsRequest == false) return false;
        DescribeTagsRequest other = (DescribeTagsRequest)obj;

        if (other.getResourceName() == null ^ this.getResourceName() == null) return false;
        if (other.getResourceName() != null && other.getResourceName().equals(this.getResourceName()) == false) return false;
        if (other.getResourceType() == null ^ this.getResourceType() == null) return false;
        if (other.getResourceType() != null && other.getResourceType().equals(this.getResourceType()) == false) return false;
        if (other.getMaxRecords() == null ^ this.getMaxRecords() == null) return false;
        if (other.getMaxRecords() != null && other.getMaxRecords().equals(this.getMaxRecords()) == false) return false;
        if (other.getMarker() == null ^ this.getMarker() == null) return false;
        if (other.getMarker() != null && other.getMarker().equals(this.getMarker()) == false) return false;
        if (other.getTagKeys() == null ^ this.getTagKeys() == null) return false;
        if (other.getTagKeys() != null && other.getTagKeys().equals(this.getTagKeys()) == false) return false;
        if (other.getTagValues() == null ^ this.getTagValues() == null) return false;
        if (other.getTagValues() != null && other.getTagValues().equals(this.getTagValues()) == false) return false;
        return true;
    }

    @Override
    public DescribeTagsRequest clone() {

            return (DescribeTagsRequest) super.clone();
    }

}


text:
from time import time

stringify = lambda a: map(lambda x: str(x), a)

class Timer:

    def __init__(self):
        self.time = time()

    def start(self, *args):
        self.time = time()
        print ' '.join(stringify(args))

    def end(self, *args):
        diff = time() - self.time
        print '....', ' '.join(stringify(args)), '[' + str(diff) + ' sec]', '\n'

timer = Timer()
__all__ = [ timer ]

redpajama_set_name: RedPajamaGithub


text:
<?php

if (!function_exists('cropp'))
{
    function cropp($source, $isAssetWrap = true)
    {
        return \Yaro\Cropp\Cropp::make($source, $isAssetWrap);
    } // end cropp
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Grevillea 8(no. 46): 57 (1879)

#### Original name
Cyphella zelandica Cooke & W. Phillips, 1879

### Remarks
null


text:
import { should } from 'chai'; // eslint-disable-line import/extensions
import storedPixelDataToCanvasImageData from '../../src/internal/storedPixelDataToCanvasImageData.js';

should();

describe('storedPixelDataToCanvasImageData', function () {
  before(function () {
    this.lut = [0, 255];
    // Arrange
    this.image = {
      maxPixelValue: 1,
      width: 1,
      height: 2,
      stats: {}
    };
  });

  beforeEach(function () {
    this.canvasImageDataData = [255, 255, 255, 128, 255, 255, 255, 128];
  });

  describe('Uint16Array', function () {
    before(function () {
      this.image.getPixelData = function () {
        return new Uint16Array([0, 1]);
      };
    });

    it('storedPixelDataToCanvasImageData minPixel = 0', function () {
      this.image.minPixelValue = 0;

      // Act
      storedPixelDataToCanvasImageData(this.image, this.lut, this.canvasImageDataData);

      this.canvasImageDataData.should.be.deep.equal([255, 255, 255, 0, 255, 255, 255, 255]);
    });

    it('storedPixelDataToCanvasImageData minPixel > 0', function () {
      this.image.minPixelValue = 1;
      this.image.getPixelData = function () {
        return new Uint16Array([1, 1]);
      };

      // Act
      storedPixelDataToCanvasImageData(this.image, this.lut, this.canvasImageDataData);

      this.canvasImageDataData.should.be.deep.equal([255, 255, 255, 255, 255, 255, 255, 255]);
    });
  });

  describe('int16Array', function () {
    before(function () {
      // Arrange
      this.lut = [0, 255];
      this.image = {
        minPixelValue: -1,
        maxPixelValue: 0,
        width: 1,
        height: 2,
        getPixelData () {
          return new Int16Array([-1, 0]);
        },
        stats: {}
      };
    });

    beforeEach(function () {
      this.canvasImageDataData = [255, 255, 255, 128, 255, 255, 255, 128];
    });

    it('storedPixelDataToCanvasImageData minPixel < 0', function () {
      // Act
      storedPixelDataToCanvasImageData(this.image, this.lut, this.canvasImageDataData);

      this.canvasImageDataData.should.be.deep.equal([255, 255, 255, 0, 255, 255, 255, 255]);
    });

    it('storedPixelDataToCanvasImageData minPixel > 0', function () {
      this.image.minPixelValue = 1;
      this.image.getPixelData = function () {
        return new Int16Array([1, 0]);
      };

      // Act
      storedPixelDataToCanvasImageData(this.image, this.lut, this.canvasImageDataData);

      this.canvasImageDataData.should.be.deep.equal([255, 255, 255, 255, 255, 255, 255, 0]);
    });
  });

  describe('regular Array', function () {
    it('storedPixelDataToCanvasImageData minPixel < 0', function () {
      this.image.minPixelValue = -1;
      this.image.maxPixelValue = 0;
      this.image.getPixelData = function () {
        return [-1, 0];
      };

      storedPixelDataToCanvasImageData(this.image, this.lut, this.canvasImageDataData);

      this.canvasImageDataData.should.be.deep.equal([255, 255, 255, 0, 255, 255, 255, 255]);
    });
  });
});


text:
<ion-view title="Screen 2">
  <ion-content class="scroll-content has-header has-tabs-top padding" has-tabs="true">

Screen 2

  </ion-content>
</ion-view>


text:
<?php

namespace HealthCareAbroad\InstitutionBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class InstitutionBundle extends Bundle
{
}


text:
/* -*-C++-*-
****************************************************************************
*
* File:         ComTdb.cpp
* Description:  Class implementation for the base class of Task Definition
*               Blocks (TDBs). TDBs are generated by the SQL compiler
*               and describe executor operators such as join, scan, ...
*
* Created:      5/6/98
* Language:     C++
*
*
*
*
****************************************************************************
*/

#include "Platform.h"

// -----------------------------------------------------------------------
// TBM after completion of decoupling work.
// -----------------------------------------------------------------------
#include "exp_stdh.h"
#include "ComTdb.h"
#include "ComPackDefs.h"
#include "exp_clause_derived.h"
#include "float.h"

// -----------------------------------------------------------------------
// Inclusion of all subclasses header needed for fixupVTblPtrCom().
// -----------------------------------------------------------------------
#include "ComTdbAll.h"

// -----------------------------------------------------------------------
// Used in constructor to retrieve PCODE environment variables.
// -----------------------------------------------------------------------
#ifndef __EID
/*static char *GetEnv(char *eye, char *prefix)
{
  char buffer[32];
  for(int i=0; i<28 && prefix[i]; i++)
    buffer[i] = prefix[i];

  for(int j=0; j<4; j++)
    buffer[i+j] = eye[j];

  buffer[i+j] = 0;

  return getenv(buffer);
}*/
#endif

// LCOV_EXCL_START
// This method is called only if params parameter is sent to ComTdb constructor
// and no where in the code the ComTdb constructor is being called with
// params paramter.  It was tested by removing the the param parameter
// from the cosntructor and compiling.
void ComTdbParams::getValues(Cardinality &estimatedRowCount,
			     ExCriDescPtr &criDown,
			     ExCriDescPtr &criUp,
			     queue_index &sizeDown,
			     queue_index &sizeUp,
#ifdef NA_64BIT
                             // dg64 - match signature
			     Int32  &numBuffers,
#else
			     Lng32 &numBuffers,
#endif
#ifdef NA_64BIT
                             // dg64 - match signature
			     UInt32  &bufferSize,
#else
			     ULng32 &bufferSize,
#endif
			     Int32 &firstNRows)
{
  estimatedRowCount = estimatedRowCount_;
  criDown = criDown_;
  criUp = criUp_;
  sizeDown = sizeDown_;
  sizeUp = sizeUp_;
  numBuffers = numBuffers_;
  firstNRows = firstNRows_;
}
// LCOV_EXCL_STOP

// -----------------------------------------------------------------------
// TDB constructor & Destructor
// -----------------------------------------------------------------------
NA_EIDPROC ComTdb::ComTdb(
     ex_node_type type,
     const char *eye,
     Cardinality estRowsUsed,
     ex_cri_desc *criDown,
     ex_cri_desc *criUp,
     queue_index sizeDown,
     queue_index sizeUp,
#ifdef NA_64BIT
     // dg64 - match signature
     Int32  numBuffers,
#else
     Lng32 numBuffers,
#endif
#ifdef NA_64BIT
     // dg64 - match signature
     UInt32  bufferSize,
#else
     ULng32 bufferSize,
#endif
     Lng32          uniqueId,
     ULng32 initialQueueSizeDown,
     ULng32 initialQueueSizeUp,
     short         queueResizeLimit,
     short         queueResizeFactor,
     ComTdbParams * params)
  : criDescDown_(criDown),
    criDescUp_(criUp),
    queueSizeDown_(sizeDown),
    queueSizeUp_(sizeUp),
    numBuffers_(numBuffers),
    bufferSize_(bufferSize),
    expressionMode_(ex_expr::PCODE_NONE),
    flags_(0),
    tdbId_(uniqueId),
    initialQueueSizeDown_(initialQueueSizeDown),
    initialQueueSizeUp_(initialQueueSizeUp),
    queueResizeLimit_(queueResizeLimit),
    queueResizeFactor_(queueResizeFactor),
    NAVersionedObject(type),
    firstNRows_(-1),
    overflowMode_(OFM_DISK)
{
  // ---------------------------------------------------------------------
  // Copy the eye catcher
  // ---------------------------------------------------------------------
  str_cpy_all((char *) &eyeCatcher_, eye, 4);

// LCOV_EXCL_START
// This constructor is never called with params parameter
  if (params)
    {
      params->getValues(estRowsUsed, criDescDown_, criDescUp_,
			queueSizeDown_, queueSizeUp_,
			numBuffers_, bufferSize_,
			firstNRows_);
    }
// LCOV_EXCL_STOP

  collectStatsType_ = NO_STATS;

  estRowsUsed_ = estRowsUsed;

  // any float field in child TDB is to be interpreted as IEEE float.
  flags_ |= FLOAT_FIELDS_ARE_IEEE;

}

NA_EIDPROC ComTdb::ComTdb()
  : NAVersionedObject(-1),
  overflowMode_(OFM_DISK)
{

}

NA_EIDPROC ComTdb::~ComTdb()
{
  // ---------------------------------------------------------------------
  // Change the eye catcher
  // ---------------------------------------------------------------------
  str_cpy_all((char *) &eyeCatcher_, eye_FREE, 4);

}

NA_EIDPROC Long ComTdb::pack(void *space)
{
  criDescDown_.pack(space);
  criDescUp_.pack(space);
  parentTdb_.pack(space);

  return NAVersionedObject::pack(space);
}

NA_EIDPROC Lng32 ComTdb::unpack(void * base, void * reallocator)
{
  if(criDescDown_.unpack(base, reallocator)) return -1;
  if(criDescUp_.unpack(base, reallocator)) return -1;
  if(parentTdb_.unpack(base, reallocator)) return -1;
  return NAVersionedObject::unpack(base, reallocator);
}

// -----------------------------------------------------------------------
// Used by the internal SHOWPLAN command to get attributes of a TDB in a
// string.
// -----------------------------------------------------------------------
NA_EIDPROC void ComTdb::displayContents(Space * space,ULng32 flag)
{

#ifndef __EID
  char buf[100];
  str_sprintf(buf, "Contents of %s [%d]:", getNodeName(),getExplainNodeId());
  Int32 j = str_len(buf);
  space->allocateAndCopyToAlignedSpace(buf, j, sizeof(short));
  for (Int32 k = 0; k < j; k++) buf[k] = '-';
  buf[j] = '\n';
  buf[j+1] = 0;
  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  if(flag & 0x00000008)
    {
  		str_sprintf(buf,"For ComTdb :");
		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

		str_sprintf(buf,"Class Version = %d, Class Size = %d",
                  getClassVersionID(),getClassSize());
  		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  		str_sprintf(buf,"InitialQueueSizeDown = %d, InitialQueueSizeUp = %d",
                   getInitialQueueSizeDown(),getInitialQueueSizeUp());
  		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  		str_sprintf(buf,"queueResizeLimit = %d, queueResizeFactor = %d",
                     getQueueResizeLimit(),getQueueResizeFactor());
  		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  		str_sprintf(buf, "queueSizeDown = %d, queueSizeUp = %d, numBuffers = %d, bufferSize = %d",
	        getMaxQueueSizeDown(), getMaxQueueSizeUp(), numBuffers_, bufferSize_);
  		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  		str_sprintf(buf, "estimatedRowUsed = %f, estimatedRowsAccessed = %f, expressionMode = %d",
                  estRowsUsed_, estRowsAccessed_, expressionMode_);
  		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  		str_sprintf(buf, "Flag = %b",flags_);
  		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  		if (firstNRows() >= 0)
    		{
      		str_sprintf(buf, "Request Type: GET_N (%d) ", firstNRows());
      		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    		}
    }
 #endif

  if(flag & 0x00000001)
    {
      displayExpression(space,flag);
      displayChildren(space,flag);
    }
}

NA_EIDPROC void ComTdb::displayExpression(Space *space,ULng32 flag)
{
  char buf[100];

  str_sprintf(buf, "\n# of Expressions = %d\n", numExpressions());
  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  if(flag & 0x00000006)
    {
      for (Int32 i = 0; i < numExpressions(); i++)
	{
	  if (getExpressionNode(i))
#pragma nowarn(1506)   // warning elimination
	    getExpressionNode(i)->displayContents(space, expressionMode_,
#pragma warn(1506)  // warning elimination
						  (char *)getExpressionName(i),flag);
	  else
	    {
#ifndef __EID
	      str_sprintf(buf, "Expression: %s is NULL\n", (char *)getExpressionName(i));
	      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
#endif
	    }
	}
    }
  else
    {
      for (Int32 i = 0; i < numExpressions(); i++)
	{
	  if (getExpressionNode(i))
	    {
	      str_sprintf(buf, "Expression: %s is not NULL", (char *)getExpressionName(i));
	      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	    }
	  else
	    {
	      str_sprintf(buf, "Expression: %s is NULL", (char *)getExpressionName(i));
	      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	    }
	}
    }
}

NA_EIDPROC void ComTdb::displayChildren(Space *space,ULng32 flag)
{
  for (Int32 i = 0; i < numChildren(); i++)
    {
      // currTdb->getChildForGUI(i)->displayContents(space);
      if (getChild(i)) ((ComTdb *)getChild(i))->displayContents(space,flag);
    }
}

// -----------------------------------------------------------------------
// This method fixes up a TDB object which is retrieved from disk or
// received from another process to the Compiler-aware version of the TDB
// for its node type. There is a similar method called fixupVTblPtrExe()
// implemented in the executor project which fixes up a TDB object to the
// Executor version of the TDB.
// -----------------------------------------------------------------------
// LCOV_EXCL_START
NA_EIDPROC void ComTdb::fixupVTblPtrCom()
{
}
// LCOV_EXCL_STOP

// -----------------------------------------------------------------------
// This method returns the virtual function table pointer for an object
// with the given class ID as a "compiler TDB" (the one without a build()
// method defined). There is a similar method called findVTblPtrExe()
// implemented in the executor project (in ExComTdb.cpp) which returns
// the pointer for an "executor TDB".
// -----------------------------------------------------------------------
NA_EIDPROC char *ComTdb::findVTblPtrCom(short classID)
{
  char *vtblptr = NULL;
  switch (classID)
  {

    case ex_FIRST_N:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbFirstN);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_HASH_GRBY:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbHashGrby);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_SORT_GRBY:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbSortGrby);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_TRANSPOSE:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbTranspose);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_UNPACKROWS:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbUnPackRows);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_PACKROWS:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbPackRows);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_SAMPLE:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbSample);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_LEAF_TUPLE:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbTupleLeaf);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_NON_LEAF_TUPLE:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbTupleNonLeaf);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_COMPOUND_STMT:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbCompoundStmt);
#pragma warn(1506)  // warning elimination
      break;
    }

#ifndef __EID

    case ex_TUPLE:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbTuple);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_SEQUENCE_FUNCTION:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbSequence);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_CONTROL_QUERY:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbControl);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_ROOT:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbRoot);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_ONLJ:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbOnlj);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_HASHJ:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbHashj);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_MJ:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbMj);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_UNION:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbUnion);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_EXPLAIN:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExplain);
#pragma warn(1506)  // warning elimination
      break;
    }

#if 0
// unused feature, done as part of SQ SQL code cleanup effort
    case ex_SEQ:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbSeq);
#pragma warn(1506)  // warning elimination
      break;
    }
#endif // if 0

    case ex_SORT:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbSort);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_SPLIT_TOP:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbSplitTop);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_SPLIT_BOTTOM:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbSplitBottom);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_SEND_TOP:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbSendTop);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_SEND_BOTTOM:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbSendBottom);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_STATS:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbStats);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_STORED_PROC:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbStoredProc);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_TUPLE_FLOW:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbTupleFlow);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_TRANSACTION:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbTransaction);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_DDL:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbDDL);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_DDL_WITH_STATUS:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbDDLwithStatus);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_DESCRIBE:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbDescribe);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_EXE_UTIL:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtil);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_MAINTAIN_OBJECT:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilMaintainObject);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_LONG_RUNNING:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilLongRunning);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_DISPLAY_EXPLAIN:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilDisplayExplain);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_DISPLAY_EXPLAIN_COMPLEX:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilDisplayExplainComplex);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_LOAD_VOLATILE_TABLE:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilLoadVolatileTable);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_PROCESS_VOLATILE_TABLE:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbProcessVolatileTable);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_CLEANUP_VOLATILE_TABLES:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilCleanupVolatileTables);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_GET_VOLATILE_INFO:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilGetVolatileInfo);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_PROCESS_INMEMORY_TABLE:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbProcessInMemoryTable);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_CREATE_TABLE_AS:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilCreateTableAs);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_FAST_DELETE:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilFastDelete);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_HIVE_TRUNCATE:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilHiveTruncate);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_GET_STATISTICS:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilGetStatistics);
#pragma warn(1506)  // warning elimination
      break;
    }
 case ex_LOB_INFO:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilLobInfo);
#pragma warn(1506)  // warning elimination
      break;
    }
   case ex_GET_METADATA_INFO:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilGetMetadataInfo);
#pragma warn(1506)  // warning elimination
      break;
    }

   case ex_GET_HIVE_METADATA_INFO:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilGetHiveMetadataInfo);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_GET_UID:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilGetUID);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_GET_QID:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilGetQID);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_POP_IN_MEM_STATS:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilPopulateInMemStats);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_SET_TIMEOUT:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbTimeout);
#pragma warn(1506)  // warning elimination
      break;
    }
    case ex_FAST_EXTRACT:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbFastExtract);
#pragma warn(1506)  // warning elimination
      break;
    }
    case ex_UDR:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbUdr);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_PROBE_CACHE:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbProbeCache);
#pragma warn(1506)  // warning elimination
      break;
    }

    case ex_CANCEL:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbCancel);
#pragma warn(1506)  // warning elimination
      break;
    }

  case ex_SHOW_SET:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilShowSet);
#pragma warn(1506)  // warning elimination
      break;
    }

  case ex_AQR:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilAQR);
#pragma warn(1506)  // warning elimination
      break;
    }

  case ex_GET_ERROR_INFO:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilGetErrorInfo);
#pragma warn(1506)  // warning elimination
      break;
    }

  case ex_HDFS_SCAN:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbHdfsScan);
#pragma warn(1506)  // warning elimination
    }
    break;

  case ex_HIVE_MD_ACCESS:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilHiveMDaccess);
#pragma warn(1506)  // warning elimination
    }
    break;

  case ex_HBASE_ACCESS:
    {
      GetVTblPtr(vtblptr, ComTdbHbaseAccess);
    }
    break;

  case ex_HBASE_COPROC_AGGR:
    {
      GetVTblPtr(vtblptr, ComTdbHbaseCoProcAggr);
    }
    break;

  case ex_ARQ_WNR_INSERT:
    {
#pragma nowarn(1506)   // warning elimination
      GetVTblPtr(vtblptr,ComTdbExeUtilAqrWnrInsert);
#pragma warn(1506)  // warning elimination
      break;
    }

#endif
    default:
      break;
// LCOV_EXCL_STOP
  }
  return vtblptr;
}


text:
from PyQt4.QtGui import QColor, QSizePolicy, QPalette, QPen, QFont
from PyQt4.QtCore import Qt, QRectF

import pyqtgraph as pg
import numpy as np

from Orange.data import Table, Domain
from Orange.data.variable import ContinuousVariable, StringVariable
from Orange.regression.linear import (RidgeRegressionLearner, PolynomialLearner,
                                      LinearRegressionLearner, LinearModel)
from Orange.regression import Learner
from Orange.preprocess.preprocess import Preprocess
from Orange.widgets import settings, gui
from Orange.widgets.utils import itemmodels
from Orange.widgets.utils.owlearnerwidget import OWBaseLearner
from Orange.widgets.utils.sql import check_sql_input
from Orange.canvas import report

class OWUnivariateRegression(OWBaseLearner):
    name = "Univariate Polynomial Regression"
    description = "Univariate regression with polynomial expansion."
    icon = "icons/UnivariateRegression.svg"

    inputs = [("Learner", Learner, "set_learner")]

    outputs = [("Coefficients", Table)]

    LEARNER = PolynomialLearner

    learner_name = settings.Setting("Univariate Regression")

    polynomialexpansion = settings.Setting(1)

    x_var_index = settings.ContextSetting(0)
    y_var_index = settings.ContextSetting(1)

    want_main_area = True

    def add_main_layout(self):

        self.data = None
        self.preprocessors = None
        self.learner = None

        self.scatterplot_item = None
        self.plot_item = None

        self.x_label = 'x'
        self.y_label = 'y'

        box = gui.vBox(self.controlArea, "Variables")

        self.x_var_model = itemmodels.VariableListModel()
        self.comboBoxAttributesX = gui.comboBox(
            box, self, value='x_var_index', label="Input: ",
            orientation=Qt.Horizontal, callback=self.apply, contentsLength=12)
        self.comboBoxAttributesX.setSizePolicy(
            QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.comboBoxAttributesX.setModel(self.x_var_model)
        gui.doubleSpin(
            gui.indentedBox(box),
            self, "polynomialexpansion", 0, 10,
            label="Polynomial expansion:", callback=self.apply)

        gui.separator(box, height=8)
        self.y_var_model = itemmodels.VariableListModel()
        self.comboBoxAttributesY = gui.comboBox(
            box, self, value="y_var_index", label="Target: ",
            orientation=Qt.Horizontal, callback=self.apply, contentsLength=12)
        self.comboBoxAttributesY.setSizePolicy(
            QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.comboBoxAttributesY.setModel(self.y_var_model)

        gui.rubber(self.controlArea)

        # main area GUI
        self.plotview = pg.PlotWidget(background="w")
        self.plot = self.plotview.getPlotItem()

        axis_color = self.palette().color(QPalette.Text)
        axis_pen = QPen(axis_color)

        tickfont = QFont(self.font())
        tickfont.setPixelSize(max(int(tickfont.pixelSize() * 2 // 3), 11))

        axis = self.plot.getAxis("bottom")
        axis.setLabel(self.x_label)
        axis.setPen(axis_pen)
        axis.setTickFont(tickfont)

        axis = self.plot.getAxis("left")
        axis.setLabel(self.y_label)
        axis.setPen(axis_pen)
        axis.setTickFont(tickfont)

        self.plot.setRange(xRange=(0.0, 1.0), yRange=(0.0, 1.0),
                           disableAutoRange=True)

        self.mainArea.layout().addWidget(self.plotview)

    def send_report(self):
        if self.data is None:
            return
        caption = report.render_items_vert((
             ("Polynomial Expansion: ", self.polynomialexpansion),
        ))
        self.report_plot(self.plot)
        if caption:
            self.report_caption(caption)

    def clear(self):
        self.data = None
        self.clear_plot()

    def clear_plot(self):
        if self.plot_item is not None:
            self.plot_item.setParentItem(None)
            self.plotview.removeItem(self.plot_item)
            self.plot_item = None

        if self.scatterplot_item is not None:
            self.scatterplot_item.setParentItem(None)
            self.plotview.removeItem(self.scatterplot_item)
            self.scatterplot_item = None

        self.plotview.clear()

    @check_sql_input
    def set_data(self, data):
        self.clear()
        self.data = data
        if data is not None:
            cvars = [var for var in data.domain.variables if var.is_continuous]
            class_cvars = [var for var in data.domain.class_vars if var.is_continuous]

            self.x_var_model[:] = cvars
            self.y_var_model[:] = cvars

            nvars = len(cvars)
            nclass = len(class_cvars)
            self.x_var_index = min(max(0, self.x_var_index), nvars - 1)
            if nclass > 0:
                self.y_var_index = min(max(0, nvars-nclass), nvars - 1)
            else:
                self.y_var_index = min(max(0, nvars-1), nvars - 1)

    def set_learner(self, learner):
        self.learner = learner

    def handleNewSignals(self):
        self.apply()

    def plot_scatter_points(self, x_data, y_data):
        if self.scatterplot_item:
            self.plotview.removeItem(self.scatterplot_item)
        self.n_points = len(x_data)
        self.scatterplot_item = pg.ScatterPlotItem(
            x=x_data, y=y_data, data=np.arange(self.n_points),
            symbol="o", size=10, pen=pg.mkPen(0.2), brush=pg.mkBrush(0.7),
            antialias=True)
        self.scatterplot_item.opts["useCache"] = False
        self.plotview.addItem(self.scatterplot_item)
        self.plotview.replot()

    def set_range(self, x_data, y_data):
        min_x, max_x = np.nanmin(x_data), np.nanmax(x_data)
        min_y, max_y = np.nanmin(y_data), np.nanmax(y_data)
        self.plotview.setRange(
            QRectF(min_x, min_y, max_x - min_x, max_y - min_y),
            padding=0.025)
        self.plotview.replot()

    def plot_regression_line(self, x_data, y_data):
        if self.plot_item:
            self.plotview.removeItem(self.plot_item)
        self.plot_item = pg.PlotCurveItem(
            x=x_data, y=y_data,
            pen=pg.mkPen(QColor(255, 0, 0), width=3),
            antialias=True
        )
        self.plotview.addItem(self.plot_item)
        self.plotview.replot()

    def apply(self):
        learner = self.learner
        predictor = None

        if self.data is not None:

            degree = int(self.polynomialexpansion)
            learner = self.LEARNER(preprocessors=self.preprocessors,
                                   degree=degree,
                                   learner=LinearRegressionLearner() if self.learner is None
                                    else learner)

            attributes = self.x_var_model[self.x_var_index]
            class_var = self.y_var_model[self.y_var_index]
            data_table = Table(Domain([attributes], class_vars=[class_var]), self.data)

            learner.name = self.learner_name
            predictor = learner(data_table)

            preprocessed_data = data_table
            if self.preprocessors is not None:
                for preprocessor in self.preprocessors:
                    preprocessed_data = preprocessor(preprocessed_data)

            x = preprocessed_data.X.ravel()
            y = preprocessed_data.Y.ravel()

            linspace = np.linspace(min(x), max(x), 1000).reshape(-1,1)
            values = predictor(linspace, predictor.Value)

            self.plot_scatter_points(x, y)

            self.plot_regression_line(linspace.ravel(), values.ravel())

            x_label = self.x_var_model[self.x_var_index]
            axis = self.plot.getAxis("bottom")
            axis.setLabel(x_label)

            y_label = self.y_var_model[self.y_var_index]
            axis = self.plot.getAxis("left")
            axis.setLabel(y_label)

            self.set_range(x, y)

        self.send("Learner", learner)
        self.send("Predictor", predictor)

        # Send model coefficents
        model = None
        if predictor is not None:
            model = predictor.model
            if hasattr(model, "model"):
                model = model.model
            elif hasattr(model, "skl_model"):
                model = model.skl_model
        if model is not None and hasattr(model, "coef_"):
            domain = Domain([ContinuousVariable("coef", number_of_decimals=7)],
                            metas=[StringVariable("name")])
            coefs = [model.intercept_ + model.coef_[0]] + list(model.coef_[1:])
            names = ["1", x_label] + \
                    ["{}^{}".format(x_label, i) for i in range(2, degree + 1)]
            coef_table = Table(domain, list(zip(coefs, names)))
            self.send("Coefficients", coef_table)
        else:
            self.send("Coefficients", None)

if __name__ == "__main__":
    import sys
    from PyQt4.QtGui import QApplication

    a = QApplication(sys.argv)
    ow = OWUnivariateRegression()
    learner = RidgeRegressionLearner(alpha=1.0)
    polylearner = PolynomialLearner(learner, degree=2)
    d = Table('iris')
    ow.set_data(d)
    ow.set_learner(learner)
    ow.show()
    a.exec_()
    ow.saveSettings()


text:
sleep 1
curl fileserver:8080/lorem.txt


text:
This is a simple treasure generator meant to choose an item from a predefined treasure list.  Each entry in the list is assigned odds based on a few different algorithms.  The odds create a weighted lottery from which an item is chosen randomly.  Higher level/value items are given a lower chance to be pulled from a common/cheaper item.

1. **Level + Rarity:** Each item is ranked based on its level compared to the party level, modified against it's rarity.  A highe
2. **Sell Value:** Each item is ranked based on its sell value.
3. **Even Stevens:** Each item is given the same rank evenly.

This project consists of a Generator class which can be used on its own, as well as a web frontend.

You can also [view the live web project](http://projects.tryingtothink.com/dnd/treasure/).


text:
require 'optparse'
module Enginevib
  # Defines the Launcher module which must be defined in Main.rb
  module Launcher
    attr_accessor :options

    def launch
      start_scheduler
    rescue SystemExit, Interrupt
      puts 'Good bye!' # May not be printed since we are using curses.
    end

    def parse_arguments
      @options = {
        simulation_mode: true,
        serial_port: nil
      }
      OptionParser.new do |opts|
        opts.banner = 'Usage: enginevib [options]'
        on_simulation_mode(opts)
        on_serial_port(opts)
        on_help(opts)
      end.parse!
    end

    private

    def on_simulation_mode(opts)
      opts.on('-s',
              '--simulation-mode',
              'Enables the simulation mode and ignores --serial-port') do |s|
        @options[:simulation_mode] = s
      end
    end

    def on_serial_port(opts)
      opts.on('-pSERIAL_PORT',
              '--serial-port=SERIAL_PORT',
              'Serial device to read data from. Example: /dev/ttys005') do |p|
        @options[:serial_port] = p
      end
    end

    def on_help(opts)
      opts.on('-h', '--help', 'Prints this help') do
        puts opts
        exit
      end
    end
  end
end


text:
<?php

namespace Drupal\Tests\rest\Unit\EventSubscriber;

use Drupal\Component\Serialization\Json;
use Drupal\Core\Cache\CacheableResponseInterface;
use Drupal\Core\Render\RenderContext;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Routing\RouteMatch;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\rest\EventSubscriber\ResourceResponseSubscriber;
use Drupal\rest\ModifiedResourceResponse;
use Drupal\rest\ResourceResponse;
use Drupal\rest\ResourceResponseInterface;
use Drupal\serialization\Encoder\JsonEncoder;
use Drupal\serialization\Encoder\XmlEncoder;
use Drupal\Tests\UnitTestCase;
use Prophecy\Argument;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Routing\Route;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\SerializerInterface;

/**
 * @coversDefaultClass \Drupal\rest\EventSubscriber\ResourceResponseSubscriber
 * @group rest
 */
class ResourceResponseSubscriberTest extends UnitTestCase {

  /**
   * @covers ::onResponse
   * @dataProvider providerTestSerialization
   */
  public function testSerialization($data, $expected_response = FALSE) {
    $request = new Request();
    $route_match = new RouteMatch('test', new Route('/rest/test', ['_rest_resource_config' => 'restplugin'], ['_format' => 'json']));

    $handler_response = new ResourceResponse($data);
    $resource_response_subscriber = $this->getFunctioningResourceResponseSubscriber($route_match);
    $event = new ResponseEvent(
      $this->prophesize(HttpKernelInterface::class)->reveal(),
      $request,
      HttpKernelInterface::MASTER_REQUEST,
      $handler_response
    );
    $resource_response_subscriber->onResponse($event);

    // Content is a serialized version of the data we provided.
    $this->assertEquals($expected_response !== FALSE ? $expected_response : Json::encode($data), $event->getResponse()->getContent());
  }

  public function providerTestSerialization() {
    return [
      // The default data for \Drupal\rest\ResourceResponse.
      'default' => [NULL, ''],
      'empty string' => [''],
      'simple string' => ['string'],
      // cSpell:disable-next-line
      'complex string' => ['Complex \ string $%^&@ with unicode ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΣὨ'],
      'empty array' => [[]],
      'numeric array' => [['test']],
      'associative array' => [['test' => 'foobar']],
      'boolean true' => [TRUE],
      'boolean false' => [FALSE],
      // @todo Not supported. https://www.drupal.org/node/2427811
      // [new \stdClass()],
      // [(object) ['test' => 'foobar']],
    ];
  }

  /**
   * @covers ::getResponseFormat
   *
   * Note this does *not* need to test formats being requested that are not
   * accepted by the server, because the routing system would have already
   * prevented those from reaching the controller.
   *
   * @dataProvider providerTestResponseFormat
   */
  public function testResponseFormat($methods, array $supported_response_formats, array $supported_request_formats, $request_format, array $request_headers, $request_body, $expected_response_format, $expected_response_content_type, $expected_response_content) {
    foreach ($request_headers as $key => $value) {
      unset($request_headers[$key]);
      $key = strtoupper(str_replace('-', '_', $key));
      $request_headers[$key] = $value;
    }

    foreach ($methods as $method) {
      $request = Request::create('/rest/test', $method, [], [], [], $request_headers, $request_body);
      // \Drupal\Core\StackMiddleware\NegotiationMiddleware normally takes care
      // of this so we'll hard code it here.
      if ($request_format) {
        $request->setRequestFormat($request_format);
      }

      $route_requirements = $this->generateRouteRequirements($supported_response_formats, $supported_request_formats);

      $route_match = new RouteMatch('test', new Route('/rest/test', ['_rest_resource_config' => $this->randomMachineName()], $route_requirements));

      $resource_response_subscriber = new ResourceResponseSubscriber(
        $this->prophesize(SerializerInterface::class)->reveal(),
        $this->prophesize(RendererInterface::class)->reveal(),
        $route_match
      );

      $this->assertSame($expected_response_format, $resource_response_subscriber->getResponseFormat($route_match, $request));
    }
  }

  /**
   * @covers ::onResponse
   * @covers ::getResponseFormat
   * @covers ::renderResponseBody
   * @covers ::flattenResponse
   *
   * @dataProvider providerTestResponseFormat
   */
  public function testOnResponseWithCacheableResponse($methods, array $supported_response_formats, array $supported_request_formats, $request_format, array $request_headers, $request_body, $expected_response_format, $expected_response_content_type, $expected_response_content) {
    foreach ($request_headers as $key => $value) {
      unset($request_headers[$key]);
      $key = strtoupper(str_replace('-', '_', $key));
      $request_headers[$key] = $value;
    }

    foreach ($methods as $method) {
      $request = Request::create('/rest/test', $method, [], [], [], $request_headers, $request_body);
      // \Drupal\Core\StackMiddleware\NegotiationMiddleware normally takes care
      // of this so we'll hard code it here.
      if ($request_format) {
        $request->setRequestFormat($request_format);
      }

      $route_requirements = $this->generateRouteRequirements($supported_response_formats, $supported_request_formats);

      $route_match = new RouteMatch('test', new Route('/rest/test', ['_rest_resource_config' => $this->randomMachineName()], $route_requirements));

      // The RequestHandler must return a ResourceResponseInterface object.
      $handler_response = new ResourceResponse($method !== 'DELETE' ? ['REST' => 'Drupal'] : NULL);
      $this->assertInstanceOf(ResourceResponseInterface::class, $handler_response);
      $this->assertInstanceOf(CacheableResponseInterface::class, $handler_response);

      // The ResourceResponseSubscriber must then generate a response body and
      // transform it to a plain CacheableResponse object.
      $resource_response_subscriber = $this->getFunctioningResourceResponseSubscriber($route_match);
      $event = new ResponseEvent(
        $this->prophesize(HttpKernelInterface::class)->reveal(),
        $request,
        HttpKernelInterface::MASTER_REQUEST,
        $handler_response
      );
      $resource_response_subscriber->onResponse($event);
      $final_response = $event->getResponse();
      $this->assertNotInstanceOf(ResourceResponseInterface::class, $final_response);
      $this->assertInstanceOf(CacheableResponseInterface::class, $final_response);
      $this->assertSame($expected_response_content_type, $final_response->headers->get('Content-Type'));
      $this->assertEquals($expected_response_content, $final_response->getContent());
    }
  }

  /**
   * @covers ::onResponse
   * @covers ::getResponseFormat
   * @covers ::renderResponseBody
   * @covers ::flattenResponse
   *
   * @dataProvider providerTestResponseFormat
   */
  public function testOnResponseWithUncacheableResponse($methods, array $supported_response_formats, array $supported_request_formats, $request_format, array $request_headers, $request_body, $expected_response_format, $expected_response_content_type, $expected_response_content) {
    foreach ($request_headers as $key => $value) {
      unset($request_headers[$key]);
      $key = strtoupper(str_replace('-', '_', $key));
      $request_headers[$key] = $value;
    }

    foreach ($methods as $method) {
      $request = Request::create('/rest/test', $method, [], [], [], $request_headers, $request_body);
      // \Drupal\Core\StackMiddleware\NegotiationMiddleware normally takes care
      // of this so we'll hard code it here.
      if ($request_format) {
        $request->setRequestFormat($request_format);
      }

      $route_requirements = $this->generateRouteRequirements($supported_response_formats, $supported_request_formats);

      $route_match = new RouteMatch('test', new Route('/rest/test', ['_rest_resource_config' => $this->randomMachineName()], $route_requirements));

      // The RequestHandler must return a ResourceResponseInterface object.
      $handler_response = new ModifiedResourceResponse($method !== 'DELETE' ? ['REST' => 'Drupal'] : NULL);
      $this->assertInstanceOf(ResourceResponseInterface::class, $handler_response);
      $this->assertNotInstanceOf(CacheableResponseInterface::class, $handler_response);

      // The ResourceResponseSubscriber must then generate a response body and
      // transform it to a plain Response object.
      $resource_response_subscriber = $this->getFunctioningResourceResponseSubscriber($route_match);
      $event = new ResponseEvent(
        $this->prophesize(HttpKernelInterface::class)->reveal(),
        $request,
        HttpKernelInterface::MASTER_REQUEST,
        $handler_response
      );
      $resource_response_subscriber->onResponse($event);
      $final_response = $event->getResponse();
      $this->assertNotInstanceOf(ResourceResponseInterface::class, $final_response);
      $this->assertNotInstanceOf(CacheableResponseInterface::class, $final_response);
      $this->assertSame($expected_response_content_type, $final_response->headers->get('Content-Type'));
      $this->assertEquals($expected_response_content, $final_response->getContent());
    }
  }

  /**
   * @return array
   *   0. methods to test
   *   1. supported formats for route requirements
   *   2. request format
   *   3. request headers
   *   4. request body
   *   5. expected response format
   *   6. expected response content type
   *   7. expected response body
   */
  public function providerTestResponseFormat() {
    $json_encoded = Json::encode(['REST' => 'Drupal']);
    $xml_encoded = "<?xml version=\"1.0\"?>\n<response><REST>Drupal</REST></response>\n";

    $safe_method_test_cases = [
      'safe methods: client requested format (JSON)' => [
        // @todo add 'HEAD' in https://www.drupal.org/node/2752325
        ['GET'],
        ['xml', 'json'],
        [],
        'json',
        [],
        NULL,
        'json',
        'application/json',
        $json_encoded,
      ],
      'safe methods: client requested format (XML)' => [
        // @todo add 'HEAD' in https://www.drupal.org/node/2752325
        ['GET'],
        ['xml', 'json'],
        [],
        'xml',
        [],
        NULL,
        'xml',
        'text/xml',
        $xml_encoded,
      ],
      'safe methods: client requested no format: response should use the first configured format (JSON)' => [
        // @todo add 'HEAD' in https://www.drupal.org/node/2752325
        ['GET'],
        ['json', 'xml'],
        [],
        FALSE,
        [],
        NULL,
        'json',
        'application/json',
        $json_encoded,
      ],
      'safe methods: client requested no format: response should use the first configured format (XML)' => [
        // @todo add 'HEAD' in https://www.drupal.org/node/2752325
        ['GET'],
        ['xml', 'json'],
        [],
        FALSE,
        [],
        NULL,
        'xml',
        'text/xml',
        $xml_encoded,
      ],
    ];

    $unsafe_method_bodied_test_cases = [
      'unsafe methods with response (POST, PATCH): client requested no format, response should use request body format (JSON)' => [
        ['POST', 'PATCH'],
        ['xml', 'json'],
        ['xml', 'json'],
        FALSE,
        ['Content-Type' => 'application/json'],
        $json_encoded,
        'json',
        'application/json',
        $json_encoded,
      ],
      'unsafe methods with response (POST, PATCH): client requested no format, response should use request body format (XML)' => [
        ['POST', 'PATCH'],
        ['xml', 'json'],
        ['xml', 'json'],
        FALSE,
        ['Content-Type' => 'text/xml'],
        $xml_encoded,
        'xml',
        'text/xml',
        $xml_encoded,
      ],
      'unsafe methods with response (POST, PATCH): client requested format other than request body format (JSON): response format should use requested format (XML)' => [
        ['POST', 'PATCH'],
        ['xml', 'json'],
        ['xml', 'json'],
        'xml',
        ['Content-Type' => 'application/json'],
        $json_encoded,
        'xml',
        'text/xml',
        $xml_encoded,
      ],
      'unsafe methods with response (POST, PATCH): client requested format other than request body format (XML), but is allowed for the request body (JSON)' => [
        ['POST', 'PATCH'],
        ['xml', 'json'],
        ['xml', 'json'],
        'json',
        ['Content-Type' => 'text/xml'],
        $xml_encoded,
        'json',
        'application/json',
        $json_encoded,
      ],
      'unsafe methods with response (POST, PATCH): client requested format other than request body format when only XML is allowed as a content type format' => [
        ['POST', 'PATCH'],
        ['xml'],
        ['json'],
        'json',
        ['Content-Type' => 'text/xml'],
        $xml_encoded,
        'json',
        'application/json',
        $json_encoded,
      ],
      'unsafe methods with response (POST, PATCH): client requested format other than request body format when only JSON is allowed as a content type format' => [
        ['POST', 'PATCH'],
        ['json'],
        ['xml'],
        'xml',
        ['Content-Type' => 'application/json'],
        $json_encoded,
        'xml',
        'text/xml',
        $xml_encoded,
      ],
    ];

    $unsafe_method_bodyless_test_cases = [
      'unsafe methods without response bodies (DELETE): client requested no format, response should have no format' => [
        ['DELETE'],
        ['xml', 'json'],
        ['xml', 'json'],
        FALSE,
        ['Content-Type' => 'application/json'],
        NULL,
        'xml',
        NULL,
        '',
      ],
      'unsafe methods without response bodies (DELETE): client requested format (XML), response should have no format' => [
        ['DELETE'],
        ['xml', 'json'],
        ['xml', 'json'],
        'xml',
        ['Content-Type' => 'application/json'],
        NULL,
        'xml',
        NULL,
        '',
      ],
      'unsafe methods without response bodies (DELETE): client requested format (JSON), response should have no format' => [
        ['DELETE'],
        ['xml', 'json'],
        ['xml', 'json'],
        'json',
        ['Content-Type' => 'application/json'],
        NULL,
        'json',
        NULL,
        '',
      ],
    ];

    return $safe_method_test_cases + $unsafe_method_bodied_test_cases + $unsafe_method_bodyless_test_cases;
  }

  /**
   * @return \Drupal\rest\EventSubscriber\ResourceResponseSubscriber
   */
  protected function getFunctioningResourceResponseSubscriber(RouteMatchInterface $route_match) {
    // Create a dummy of the renderer service.
    $renderer = $this->prophesize(RendererInterface::class);
    $renderer->executeInRenderContext(Argument::type(RenderContext::class), Argument::type('callable'))
      ->will(function ($args) {
        $callable = $args[1];
        return $callable();
      });

    // Instantiate the ResourceResponseSubscriber we will test.
    $resource_response_subscriber = new ResourceResponseSubscriber(
      new Serializer([], [new JsonEncoder(), new XmlEncoder()]),
      $renderer->reveal(),
      $route_match
    );

    return $resource_response_subscriber;
  }

  /**
   * Generates route requirements based on supported formats.
   *
   * @param array $supported_response_formats
   *   The supported response formats to add to the route requirements.
   * @param array $supported_request_formats
   *   The supported request formats to add to the route requirements.
   *
   * @return array
   *   An array of route requirements.
   */
  protected function generateRouteRequirements(array $supported_response_formats, array $supported_request_formats) {
    $route_requirements = [
      '_format' => implode('|', $supported_response_formats),
    ];
    if (!empty($supported_request_formats)) {
      $route_requirements['_content_type_format'] = implode('|', $supported_request_formats);
    }

    return $route_requirements;
  }

}