text:
/* jshint maxlen: false */

'use strict';

var createAPIRequest = require('../../lib/apirequest');

/**
 * Google Monitoring API
 *
 * Manages your Stackdriver monitoring data and configurations. Projects must be associated with a Stackdriver account, except for the following methods: [monitoredResourceDescriptors.list](v3/projects.monitoredResourceDescriptors/list), [monitoredResourceDescriptors.get](v3/projects.monitoredResourceDescriptors/get), [metricDescriptors.list](v3/projects.metricDescriptors/list), [metricDescriptors.get](v3/projects.metricDescriptors/get), and [timeSeries.list](v3/projects.timeSeries/list).
 *
 * @example
 * var google = require('googleapis');
 * var monitoring = google.monitoring('v3');
 *
 * @namespace monitoring
 * @type {Function}
 * @version v3
 * @variation v3
 * @param {object=} options Options for Monitoring
 */
function Monitoring(options) { // eslint-disable-line
  var self = this;
  self._options = options || {};

  self.projects = {

    collectdTimeSeries: {

      /**
       * monitoring.projects.collectdTimeSeries.create
       *
       * @desc Creates a new time series with the given data points. This method is only for use in `collectd`-related code, including the Google Monitoring Agent. See [google.monitoring.v3.MetricService.CreateTimeSeries] instead.
       *
       * @alias monitoring.projects.collectdTimeSeries.create
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The project in which to create the time series. The format is `"projects/PROJECT_ID_OR_NUMBER"`.
       * @param {object} params.resource Request body data
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      create: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}/collectdTimeSeries',
            method: 'POST'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      }
    },

    groups: {

      /**
       * monitoring.projects.groups.list
       *
       * @desc Lists the existing groups.
       *
       * @alias monitoring.projects.groups.list
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The project whose groups are to be listed. The format is `"projects/{project_id_or_number}"`.
       * @param {string=} params.childrenOfGroup A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. Returns groups whose `parentName` field contains the group name. If no groups have this parent, the results are empty.
       * @param {string=} params.ancestorsOfGroup A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. Returns groups that are ancestors of the specified group. The groups are returned in order, starting with the immediate parent and ending with the most distant ancestor. If the specified group has no immediate parent, the results are empty.
       * @param {string=} params.descendantsOfGroup A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. Returns the descendants of the specified group. This is a superset of the results returned by the `childrenOfGroup` filter, and includes children-of-children, and so forth.
       * @param {integer=} params.pageSize A positive number that is the maximum number of results to return.
       * @param {string=} params.pageToken If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      list: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}/groups',
            method: 'GET'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      },

      /**
       * monitoring.projects.groups.get
       *
       * @desc Gets a single group.
       *
       * @alias monitoring.projects.groups.get
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The group to retrieve. The format is `"projects/{project_id_or_number}/groups/{group_id}"`.
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      get: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}',
            method: 'GET'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      },

      /**
       * monitoring.projects.groups.create
       *
       * @desc Creates a new group.
       *
       * @alias monitoring.projects.groups.create
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The project in which to create the group. The format is `"projects/{project_id_or_number}"`.
       * @param {boolean=} params.validateOnly If true, validate this request but do not create the group.
       * @param {object} params.resource Request body data
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      create: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}/groups',
            method: 'POST'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      },

      /**
       * monitoring.projects.groups.update
       *
       * @desc Updates an existing group. You can change any group attributes except `name`.
       *
       * @alias monitoring.projects.groups.update
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The name of this group. The format is `"projects/{project_id_or_number}/groups/{group_id}"`. When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to `CreateGroup` and a unique `{group_id}` that is generated automatically. @OutputOnly
       * @param {boolean=} params.validateOnly If true, validate this request but do not update the existing group.
       * @param {object} params.resource Request body data
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      update: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}',
            method: 'PUT'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      },

      /**
       * monitoring.projects.groups.delete
       *
       * @desc Deletes an existing group.
       *
       * @alias monitoring.projects.groups.delete
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The group to delete. The format is `"projects/{project_id_or_number}/groups/{group_id}"`.
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      delete: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}',
            method: 'DELETE'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      },

      members: {

        /**
         * monitoring.projects.groups.members.list
         *
         * @desc Lists the monitored resources that are members of a group.
         *
         * @alias monitoring.projects.groups.members.list
         * @memberOf! monitoring(v3)
         *
         * @param {object} params Parameters for request
         * @param {string} params.name The group whose members are listed. The format is `"projects/{project_id_or_number}/groups/{group_id}"`.
         * @param {integer=} params.pageSize A positive number that is the maximum number of results to return.
         * @param {string=} params.pageToken If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.
         * @param {string=} params.filter An optional [list filter](/monitoring/api/learn_more#filtering) describing the members to be returned. The filter may reference the type, labels, and metadata of monitored resources that comprise the group. For example, to return only resources representing Compute Engine VM instances, use this filter: resource.type = "gce_instance"
         * @param {string=} params.interval.endTime Required. The end of the interval. The interval includes this time.
         * @param {string=} params.interval.startTime If this value is omitted, the interval is a point in time, `endTime`. If `startTime` is present, it must be earlier than (less than) `endTime`. The interval begins after `startTime`—it does not include `startTime`.
         * @param {callback} callback The callback that handles the response.
         * @return {object} Request object
         */
        list: function (params, callback) {
          var parameters = {
            options: {
              url: 'https://monitoring.googleapis.com/v3/{name}/members',
              method: 'GET'
            },
            params: params,
            requiredParams: ['name'],
            pathParams: ['name'],
            context: self
          };

          return createAPIRequest(parameters, callback);
        }
      }
    },

    monitoredResourceDescriptors: {

      /**
       * monitoring.projects.monitoredResourceDescriptors.list
       *
       * @desc Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account.
       *
       * @alias monitoring.projects.monitoredResourceDescriptors.list
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The project on which to execute the request. The format is `"projects/{project_id_or_number}"`.
       * @param {string=} params.filter An optional [filter](/monitoring/api/v3/filters) describing the descriptors to be returned. The filter can reference the descriptor's type and labels. For example, the following filter returns only Google Compute Engine descriptors that have an `id` label: resource.type = starts_with("gce_") AND resource.label:id
       * @param {integer=} params.pageSize A positive number that is the maximum number of results to return.
       * @param {string=} params.pageToken If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      list: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}/monitoredResourceDescriptors',
            method: 'GET'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      },

      /**
       * monitoring.projects.monitoredResourceDescriptors.get
       *
       * @desc Gets a single monitored resource descriptor. This method does not require a Stackdriver account.
       *
       * @alias monitoring.projects.monitoredResourceDescriptors.get
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The monitored resource descriptor to get. The format is `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. The `{resource_type}` is a predefined type, such as `cloudsql_database`.
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      get: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}',
            method: 'GET'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      }
    },

    metricDescriptors: {

      /**
       * monitoring.projects.metricDescriptors.list
       *
       * @desc Lists metric descriptors that match a filter. This method does not require a Stackdriver account.
       *
       * @alias monitoring.projects.metricDescriptors.list
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The project on which to execute the request. The format is `"projects/{project_id_or_number}"`.
       * @param {string=} params.filter If this field is empty, all custom and system-defined metric descriptors are returned. Otherwise, the [filter](/monitoring/api/v3/filters) specifies which metric descriptors are to be returned. For example, the following filter matches all [custom metrics](/monitoring/custom-metrics): metric.type = starts_with("custom.googleapis.com/")
       * @param {integer=} params.pageSize A positive number that is the maximum number of results to return.
       * @param {string=} params.pageToken If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      list: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}/metricDescriptors',
            method: 'GET'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      },

      /**
       * monitoring.projects.metricDescriptors.get
       *
       * @desc Gets a single metric descriptor. This method does not require a Stackdriver account.
       *
       * @alias monitoring.projects.metricDescriptors.get
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The metric descriptor on which to execute the request. The format is `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example value of `{metric_id}` is `"compute.googleapis.com/instance/disk/read_bytes_count"`.
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      get: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}',
            method: 'GET'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      },

      /**
       * monitoring.projects.metricDescriptors.create
       *
       * @desc Creates a new metric descriptor. User-created metric descriptors define [custom metrics](/monitoring/custom-metrics).
       *
       * @alias monitoring.projects.metricDescriptors.create
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The project on which to execute the request. The format is `"projects/{project_id_or_number}"`.
       * @param {object} params.resource Request body data
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      create: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}/metricDescriptors',
            method: 'POST'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      },

      /**
       * monitoring.projects.metricDescriptors.delete
       *
       * @desc Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can be deleted.
       *
       * @alias monitoring.projects.metricDescriptors.delete
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The metric descriptor on which to execute the request. The format is `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example of `{metric_id}` is: `"custom.googleapis.com/my_test_metric"`.
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      delete: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}',
            method: 'DELETE'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      }
    },

    timeSeries: {

      /**
       * monitoring.projects.timeSeries.list
       *
       * @desc Lists time series that match a filter. This method does not require a Stackdriver account.
       *
       * @alias monitoring.projects.timeSeries.list
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The project on which to execute the request. The format is "projects/{project_id_or_number}".
       * @param {string=} params.filter A [monitoring filter](/monitoring/api/v3/filters) that specifies which time series should be returned. The filter must specify a single metric type, and can additionally specify metric labels and other information. For example: metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND metric.label.instance_name = "my-instance-name"
       * @param {string=} params.interval.endTime Required. The end of the interval. The interval includes this time.
       * @param {string=} params.interval.startTime If this value is omitted, the interval is a point in time, `endTime`. If `startTime` is present, it must be earlier than (less than) `endTime`. The interval begins after `startTime`—it does not include `startTime`.
       * @param {string=} params.aggregation.alignmentPeriod The alignment period for per-[time series](TimeSeries) alignment. If present, `alignmentPeriod` must be at least 60 seconds. After per-time series alignment, each time series will contain data points only on the period boundaries. If `perSeriesAligner` is not specified or equals `ALIGN_NONE`, then this field is ignored. If `perSeriesAligner` is specified and does not equal `ALIGN_NONE`, then this field must be defined; otherwise an error is returned.
       * @param {string=} params.aggregation.perSeriesAligner The approach to be used to align individual time series. Not all alignment functions may be applied to all time series, depending on the metric type and value type of the original time series. Alignment may change the metric type or the value type of the time series. Time series data must be aligned in order to perform cross-time series reduction. If `crossSeriesReducer` is specified, then `perSeriesAligner` must be specified and not equal `ALIGN_NONE` and `alignmentPeriod` must be specified; otherwise, an error is returned.
       * @param {string=} params.aggregation.crossSeriesReducer The approach to be used to combine time series. Not all reducer functions may be applied to all time series, depending on the metric type and the value type of the original time series. Reduction may change the metric type of value type of the time series. Time series data must be aligned in order to perform cross-time series reduction. If `crossSeriesReducer` is specified, then `perSeriesAligner` must be specified and not equal `ALIGN_NONE` and `alignmentPeriod` must be specified; otherwise, an error is returned.
       * @param {string=} params.aggregation.groupByFields The set of fields to preserve when `crossSeriesReducer` is specified. The `groupByFields` determine how the time series are partitioned into subsets prior to applying the aggregation function. Each subset contains time series that have the same value for each of the grouping fields. Each individual time series is a member of exactly one subset. The `crossSeriesReducer` is applied to each subset of time series. Fields not specified in `groupByFields` are aggregated away. If `groupByFields` is not specified, the time series are aggregated into a single output time series. If `crossSeriesReducer` is not defined, this field is ignored.
       * @param {string=} params.orderBy Specifies the order in which the points of the time series should be returned. By default, results are not ordered. Currently, this field must be left blank.
       * @param {string=} params.view Specifies which information is returned about the time series.
       * @param {integer=} params.pageSize A positive number that is the maximum number of results to return. When `view` field sets to `FULL`, it limits the number of `Points` server will return; if `view` field is `HEADERS`, it limits the number of `TimeSeries` server will return.
       * @param {string=} params.pageToken If this field is not empty then it must contain the `nextPageToken` value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      list: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}/timeSeries',
            method: 'GET'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      },

      /**
       * monitoring.projects.timeSeries.create
       *
       * @desc Creates or adds data to one or more time series. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response.
       *
       * @alias monitoring.projects.timeSeries.create
       * @memberOf! monitoring(v3)
       *
       * @param {object} params Parameters for request
       * @param {string} params.name The project on which to execute the request. The format is `"projects/{project_id_or_number}"`.
       * @param {object} params.resource Request body data
       * @param {callback} callback The callback that handles the response.
       * @return {object} Request object
       */
      create: function (params, callback) {
        var parameters = {
          options: {
            url: 'https://monitoring.googleapis.com/v3/{name}/timeSeries',
            method: 'POST'
          },
          params: params,
          requiredParams: ['name'],
          pathParams: ['name'],
          context: self
        };

        return createAPIRequest(parameters, callback);
      }
    }
  };
}

module.exports = Monitoring;


text:
require 'spec_helper'

module Aws
  module Polly

    describe Presigner do

      before(:each) do
        allow(Time).to receive(:now).and_return(now)
        allow(now).to receive(:utc).and_return(utc)
        allow(utc).to receive(:strftime).and_return(datetime)
      end

      let(:now) { double('now') }
      let(:utc) { double('utc-time') }
      let(:datetime) { '20160101T112233Z' }
      let(:credentials) { Credentials.new('akid', 'secret') }
      let(:region) { 'us-west-2' }

      describe '#initialize' do

        it 'requires :credentials' do
          expect {
            Presigner.new(region: region)
          }.to raise_error(
            KeyError, /credentials/
          )
        end

        it 'requries :region' do
          expect {
            Presigner.new(credentials: credentials)
          }.to raise_error(
            KeyError, /region/
          )
        end

      end

      describe '#presigned_url' do

        it 'can presign #synthesize_speech correctly' do
          expected_url = "https://polly.us-west-2.amazonaws.com/v1/speech?"\
            "LexiconNames=mno&LexiconNames=abc&OutputFormat=mp3&SampleRate=128&"\
            "Text=Hello%20World&TextType=text&VoiceId=Ewa&"\
            "X-Amz-Algorithm=AWS4-HMAC-SHA256&"\
            "X-Amz-Credential=akid%2F20160101%2F"\
            "us-west-2%2Fpolly%2Faws4_request&"\
            "X-Amz-Date=20160101T112233Z&X-Amz-Expires=900&"\
            "X-Amz-SignedHeaders=host&"\
            "X-Amz-Signature=956ef486286b12f43ffc02dd09eae03cfea4cd8dfb30e0fab3f23de4e131195a"

          pre = Presigner.new(region: region, credentials: credentials)
          params = {
            lexicon_names: [ 'mno', 'abc' ],
            output_format: 'mp3',
            sample_rate: '128',
            text: 'Hello World',
            text_type: 'text',
            voice_id: 'Ewa'
          }

          actual_url = pre.synthesize_speech_presigned_url(params)
          expect(actual_url).to eq(expected_url)
        end

      end

    end

  end
end

redpajama_set_name: RedPajamaGithub


text:
'''
© 2012-2013 eBay Software Foundation
Authored by: Tim Keefer
Licensed under CDDL 1.0
'''

import os

from ebaysdk.soa import Connection as BaseConnection
from ebaysdk.utils import dict2xml, getNodeText

class Connection(BaseConnection):
    """
    Not to be confused with Finding service

    Implements FindItemServiceNextGen

    https://wiki.vip.corp.ebay.com/display/apdoc/FindItemServiceNextGen

    This class is a bit hackish, it subclasses SOAService, but removes
    SOAP support. FindItemServiceNextGen works fine with standard XML
    and lets avoid all of the ugliness associated with SOAP.

    >>> from ebaysdk.shopping import Connection as Shopping
    >>> s = Shopping(config_file=os.environ.get('EBAY_YAML'))
    >>> retval = s.execute('FindPopularItems', {'QueryKeywords': 'Python'})
    >>> nodes = s.response_dom().getElementsByTagName('ItemID')
    >>> itemIds = [getNodeText(n) for n in nodes]
    >>> len(itemIds) > 0
    True
    >>> f = Connection(debug=False, config_file=os.environ.get('EBAY_YAML'))
    >>> records = f.find_items_by_ids(itemIds)
    >>> len(records) > 0
    True
    """

    def __init__(self, site_id='EBAY-US', debug=False, consumer_id=None,
                 domain='apifindingcore.vip.ebay.com', **kwargs):

        super(Connection, self).__init__(consumer_id=consumer_id,
                                         domain=domain,
                                         app_config=None,
                                         site_id=site_id,
                                         debug=debug, **kwargs)

        self.config.set('domain', 'apifindingcore.vip.ebay.com')
        self.config.set('service', 'FindItemServiceNextGen', force=True)
        self.config.set('https', False)
        self.config.set(
            'uri', "/services/search/FindItemServiceNextGen/v1", force=True)
        self.config.set('consumer_id', consumer_id)

        self.read_set = None

        self.datetime_nodes += ['lastupdatetime', 'timestamp']
        self.base_list_nodes += ['finditemsbyidsresponse.record']

    def build_request_headers(self, verb):
        return {
            "X-EBAY-SOA-SERVICE-NAME": self.config.get('service', ''),
            "X-EBAY-SOA-SERVICE-VERSION": self.config.get('version', ''),
            "X-EBAY-SOA-GLOBAL-ID": self.config.get('siteid', ''),
            "X-EBAY-SOA-OPERATION-NAME": verb,
            "X-EBAY-SOA-CONSUMER-ID": self.config.get('consumer_id', ''),
            "Content-Type": "text/xml"
        }

    def findItemsByIds(self, ebay_item_ids,
                       read_set=['ITEM_ID', 'TITLE', 'SELLER_NAME', 'ALL_CATS', 'ITEM_CONDITION_NEW']):

        self.read_set = read_set
        read_set_node = []

        for rtype in self.read_set:
            read_set_node.append({
                'member': {
                    'namespace': 'ItemDictionary',
                    'name': rtype
                }
            })

        args = {'id': ebay_item_ids, 'readSet': read_set_node}
        self.execute('findItemsByIds', args)
        return self.mappedResponse()

    def mappedResponse(self):
        records = []

        for r in self.response.dict().get('record', []):
            mydict = dict()
            i = 0

            for values_dict in r.get('value', {}):

                if values_dict is None:
                    continue

                for key, value in values_dict.items():
                    value_data = None
                    if type(value) == list:
                        value_data = [x for x in value]
                    else:
                        value_data = value

                    mydict.update({self.read_set[i]: value_data})

                    i = i + 1

            records.append(mydict)

        return records

    def find_items_by_ids(self, *args, **kwargs):
        return self.findItemsByIds(*args, **kwargs)

    def build_request_data(self, verb, data, verb_attrs):
        xml = "<?xml version='1.0' encoding='utf-8'?>"
        xml += "<" + verb + "Request"
        xml += ' xmlns="http://www.ebay.com/marketplace/search/v1/services"'
        xml += '>'
        xml += dict2xml(data, self.escape_xml)
        xml += "</" + verb + "Request>"

        return xml


text:
class undefined_tok :
	public mips_token
{
public:
	undefined_tok(unsigned int tok_row, unsigned int tok_col);
	~undefined_tok(void);
};

#endif


text:
package eventsub

import (
	"encoding/json"
	"fmt"
	"strings"

	"github.com/gempir/gempbot/internal/dto"
	"github.com/gempir/gempbot/internal/humanize"
	"github.com/gempir/gempbot/internal/log"
	"github.com/nicklaw5/helix/v2"
)

func (esm *EventsubManager) SubscribePredictions(userID string) {
	response, err := esm.helixClient.CreateEventSubSubscription(userID, esm.cfg.WebhookApiBaseUrl+"/api/eventsub?type="+helix.EventSubTypeChannelPredictionBegin, "channel.prediction.begin")
	if err != nil {
		log.Errorf("Error subscribing: %s", err)
		return
	}

	log.Infof("[%d] created subscription %s", response.StatusCode, response.ErrorMessage)
	for _, sub := range response.Data.EventSubSubscriptions {
		log.Infof("new sub in %s %s", userID, sub.Type)
		esm.db.AddEventSubSubscription(userID, sub.ID, sub.Version, sub.Type, "")
	}

	response, err = esm.helixClient.CreateEventSubSubscription(userID, esm.cfg.WebhookApiBaseUrl+"/api/eventsub?type="+helix.EventSubTypeChannelPredictionLock, "channel.prediction.lock")
	if err != nil {
		log.Errorf("Error subscribing: %s", err)
		return
	}

	log.Infof("[%d] created subscription %s", response.StatusCode, response.ErrorMessage)
	for _, sub := range response.Data.EventSubSubscriptions {
		log.Infof("new sub in %s %s", userID, sub.Type)
		esm.db.AddEventSubSubscription(userID, sub.ID, sub.Version, sub.Type, "")
	}

	response, err = esm.helixClient.CreateEventSubSubscription(userID, esm.cfg.WebhookApiBaseUrl+"/api/eventsub?type="+helix.EventSubTypeChannelPredictionEnd, "channel.prediction.end")
	if err != nil {
		log.Errorf("Error subscribing: %s", err)
		return
	}

	log.Infof("[%d] created subscription %s", response.StatusCode, response.ErrorMessage)
	for _, sub := range response.Data.EventSubSubscriptions {
		log.Infof("new sub in %s %s", userID, sub.Type)
		esm.db.AddEventSubSubscription(userID, sub.ID, sub.Version, sub.Type, "")
	}
}

func (esm *EventsubManager) HandlePredictionBegin(event []byte) {
	var data helix.EventSubChannelPredictionBeginEvent
	err := json.Unmarshal(event, &data)
	if err != nil {
		log.Errorf("Failed to decode event: %s", err)
		return
	}

	log.Infof("predictionBegin %s", data.StartedAt)
	if data.ID == "" {
		return
	}

	lockedTime := &data.LocksAt.Time
	if lockedTime.IsZero() {
		lockedTime = nil
	}

	titles := []string{}
	for _, outcome := range data.Outcomes {
		titles = append(titles, outcome.Title)
	}

	esm.chatClient.Say(
		data.BroadcasterUserLogin,
		fmt.Sprintf("PogChamp prediction: %s [ %s ] ending in %s",
			data.Title,
			strings.Join(titles, " | "),
			humanize.TimeUntil(data.StartedAt.Time, data.LocksAt.Time),
		),
	)
}

func (esm *EventsubManager) HandlePredictionLock(event []byte) {
	var data helix.EventSubChannelPredictionLockEvent
	err := json.Unmarshal(event, &data)
	if err != nil {
		log.Errorf("Failed to decode event: %s", err)
		return
	}

	log.Infof("predictionLock %s", data.LockedAt)
	if data.ID == "" {
		return
	}

	lockedTime := &data.LockedAt.Time
	if lockedTime.IsZero() {
		lockedTime = nil
	}

	esm.chatClient.Say(
		data.BroadcasterUserLogin,
		fmt.Sprintf("FBtouchdown locked submissions for: %s",
			data.Title,
		),
	)
}

func (esm *EventsubManager) HandlePredictionEnd(event []byte) {
	var data helix.EventSubChannelPredictionEndEvent
	err := json.Unmarshal(event, &data)
	if err != nil {
		log.Errorf("Failed to decode event: %s", err)
		return
	}

	log.Infof("predictionEnd %s", data.Status)
	if data.ID == "" {
		return
	}

	endTime := &data.EndedAt.Time
	if endTime.IsZero() {
		endTime = nil
	}

	var winningOutcome helix.EventSubOutcome

	for _, outcome := range data.Outcomes {
		if data.WinningOutcomeID == outcome.ID {
			winningOutcome = outcome
		}
	}

	if strings.ToUpper(data.Status) == dto.PredictionStatusCanceled {
		esm.chatClient.Say(
			data.BroadcasterUserLogin,
			fmt.Sprintf("NinjaGrumpy canceled prediction: %s",
				data.Title,
			),
		)
	} else {
		esm.chatClient.Say(
			data.BroadcasterUserLogin,
			fmt.Sprintf("PogChamp ended prediction: %s Winner: %s %s",
				data.Title,
				getColorEmoji(winningOutcome),
				winningOutcome.Title,
			),
		)
	}
}

func getColorEmoji(outcome helix.EventSubOutcome) string {
	if outcome.Color == dto.Outcome_First {
		return "🟦"
	}

	return "🟪"
}


text:
package org.locke.biokit.biology.genetics.dna.analysis.motif.enumerator;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.locke.biokit.biology.genetics.dna.Dna;
import org.locke.biokit.chemistry.molecule.compounds.polymers.analysis.motif.MotifMatrix;
import org.locke.biokit.chemistry.molecule.compounds.polymers.analysis.motif.enumerator.MotifEnumerator;
import org.locke.biokit.chemistry.molecule.compounds.polymers.collections.PolymerArrayList;
import org.locke.biokit.testing.BioKitTest;
import org.locke.superkit.language.scalars.numbers.count.Count;

public class DnaMotifEnumeratorTest extends BioKitTest
{
	@Test
	public void test()
	{
		final MotifEnumerator enumerator = new MotifEnumerator(Count.THREE, Count.ONE);
		final PolymerArrayList dna = new PolymerArrayList();
		dna.add(new Dna("ATTTGGC"));
		dna.add(new Dna("TGCCTTA"));
		dna.add(new Dna("CGGTATC"));
		dna.add(new Dna("GAAAATT"));
		final MotifMatrix results = enumerator.find(dna);
		assertEquals(Count.FOUR, results.size());
		assertEquals(dnaSet("ATT", "ATA", "GTT", "TTT"), results.asSet());
	}
}


text:
src/lib/swig-clxx/
```````````````````

This subtree contains swig_ library used to generate wrappers for *target
languages* (other than C/C++). The typical library use is to ``%include``
appropriate ``.li.i`` files in a target-language-specific ``.i`` interface
files.

By wrapping our C++ code, most of the functionality implemented here in C++ is
available also in other languages. The list of target languages may be further
extended with relatively low effort.

This is the top level ``swig-clxx`` library directory for clxx project. The
sub-directory ``clxx/`` starts a hierarchy which resembles the hierarchy of
``#/src/lib/clxx/`` directory (the hash ``#`` denotes top-level source
directory). For example, we have following correspondence:

- ``#/src/lib/clxx/ ->  clxx/``
- ``#/src/lib/clxx/cl/ -> clxx/cl/``
- ``[...]``

There are some extra directories:

==================== ========================================================
Subdirectory          Description
==================== ========================================================
``clxx/std``          contains modules that wrap things from standard C++
                      library, such as exceptions, strings and so on
==================== ========================================================

file types
::::::::::

You'll find four types of files here

- ``.li.i``, language-independent swig interface, one for each output module
  to be generated,
- ``.i.hpp``, interface header, one for each ``.li.i`` file,
- ``.swg``, - language-dependent swig library, one for each header in
  ``#/src/lib/clxx``.,
- ``.li.swg``, language-independent swig library, one for each ``.swg`` file.

The intended way to generate a module using this library is to just create a
language-specific interface file ``*.i`` which set's up appropriate ``%module``
and include corresponding ``*.li.i`` file, for example:

.. code-block::

    // clxx/cl/platforms.i
    %module(package="clxx") platforms
    %include <clxx/cl/platforms.li.i>

See files under ``#/src/lib/python-clxx`` for details.

When generating wrappers with swig, the top-level directory of this subtree, i.e
``#/src/lib/swig-clxx`` must be in swig's include path (the ``-I`` flag).

files that enter bindings: the ``.swg`` files
:::::::::::::::::::::::::::::::::::::::::::::

This subtree provides one ``.swg`` and one ``.li.swg`` file for each ``.hpp``,
whose interfaces may be potentially wrapped with swig. For example, we have
following correspondence:

- ``#/src/lib/clxx/common/exception.hpp -> clxx/common/exception.swg, clxx/common/exceptions.li.swg``
- ``#/src/lib/clxx/cl/device.hpp -> clxx/cl/device.swg, clxx/cl/device.li.swg``
- ``[...]``

The inclusion order is the following:

- file ``.i`` shall include its corresponding ``.li.i`` file,
- file ``.li.i`` includes one or more ``.swg`` files to gather module contents,
- file ``.swg`` includes its corresponding ``.li.swg`` file.

The ``.li.swg`` files are language-independent wrapper definitions. The
``.swg`` files are language dependent, and may be redefined under target
language subdirectories to provide workarounds and language-specific features.
For example, the wrappers for ``#/src/lib/clxx/cl/platform.hpp`` involve following
files

- ``clxx/cl/platform.li.swg`` - language independent part of the wrapper, includes
  ``#/src/lib/clxx/cl/platform.hpp``,
- ``clxx/cl/platform.swg`` - default language-dependent ``.swg`` file,
- ``python/clxx/cl/platform.swg`` - language-dependent ``.swg`` file for python.

The default ``.swg`` files will almost always contain just the
``%include <*.li.swg>`` directive (all necessary and language-agnostic code is
already in the ``.li.swg`` file).

target subtree(s) with bindings definition(s)
:::::::::::::::::::::::::::::::::::::::::::::

Bindings for particular languages are compiled from separate subtrees of clxx
source tree. For example, bindings for python are defined under
``#/src/lib/python-clxx/``. We'll call them  *target subtrees*.

A target subtree contains ``SConscript`` files which drive the compilation of
swig ``.i`` interfaces located under the target subtree. Usually, these target
``.i`` files define modules for target language and just ``%include``
appropriate ``.li.i`` files from this swig library to make-up the body of the
module.

When generating wrappers with swig, the top-level directory of the target
tree (``#/src/lib/python-clxx``, for example) must be in swig's include path
(the ``-I`` flag). The same applies to it's corresponding directory in variant
dir (``#/build/lib/python-clxx`` for example).

files that define modules: the ``.li.i`` and ``.i`` files
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

There are several files in this subtree that end with ``.li.i``. These are
"module files". An ``.li.i`` file usually includes all the contents of a
module located in ``.swg`` files (mentioned previously). It, however, has
no ``%module`` directive.

The ``.li.i`` files are designated for %inclusion in target ``.i`` files.
It is responsibility of the target subtree to define module names and location of
``.i`` files (target subtree layout don't have to be same as the swig
subtree). For python language, for example, we have such a correspondence:

- ``#/build/lib/python-clxx/clxx/common/exceptions.i`` %includes ``clxx/common/exceptions.li.i``
- ``#/build/lib/python-clxx/clxx/cl/platforms.i`` %includes ``clxx/cl/platforms.li.i``

.. _swig: https://swig.org

.. <!--- vim: set expandtab tabstop=2 shiftwidth=2 syntax=rst: -->