text:
'use strict';

var Request = require('./request');

module.exports = Heroku;

function Heroku(options) {
  this.options = options;
}

Heroku.createClient = function createClient(options) {
  return new Heroku(options);
};

Heroku.configure = function configure(config) {
  var cache = config.cache;
  var key   = config.key || process.env.HEROKU_CLIENT_ENCRYPTION_SECRET;

  if (cache === true) {
    cache = require('memjs').Client.create();
  }

  if (cache) {
    if (typeof(cache.get) !== 'function' || typeof(cache.set) !== 'function') {
      console.error('cache must define get(key, cb(err, value)) and set(key, value) functions');
      process.exit(1);
    }

    if (!key) {
      console.error('Must supply key or set HEROKU_CLIENT_ENCRYPTION_SECRET environment variable in order to cache');
      process.exit(1);
    }

    Request.connectCacheClient({
      cache: cache,
      key  : key
    });
  }

  return this;
};

Heroku.request = Request.request;

Heroku.prototype.request = function request(options, callback) {
  var key;

  if (typeof(options) === 'function') {
    callback = options;
    options  = this.options;
  } else {
    for (key in this.options) {
      if (this.options.hasOwnProperty(key)) {
        if (!options.hasOwnProperty(key)) {
          options[key] = this.options[key];
        }
      }
    }
  }

  return Request.request(options, function requestCallback(err, body) {
    if (callback) { callback(err, body); }
  });
};

Heroku.prototype.get = function get(path, callback) {
  return this.request({ method: 'GET', path: path }, callback);
};

Heroku.prototype.post = function post(path, body, callback) {
  if (typeof body === 'function') {
    callback = body;
    body = {};
  }

  return this.request({ method: 'POST', path: path, body: body }, callback);
};

Heroku.prototype.patch = function patch(path, body, callback) {
  if (typeof body === 'function') {
    callback = body;
    body = {};
  }

  return this.request({ method: 'PATCH', path: path, body: body }, callback);
};

Heroku.prototype.delete = function _delete(path, callback) {
  return this.request({ method: 'DELETE', path: path }, callback);
};

require('./resourceBuilder').build();


text:
require 'spec_helper'
module Alf
  class Database
    describe Connection, "assert!" do

      let(:conn){ sap_conn }

      context 'with the result is not empty' do
        subject{ conn.assert!{ suppliers } }

        it{ should be_true }
      end

      context 'with the result is empty' do
        subject{ conn.assert!{ restrict(suppliers, ->{false}) } }

        it 'raises a AssertionError' do
          lambda{
            subject
          }.should raise_error(FactAssertionError)
        end
      end

      context 'with an error message' do
        subject{ conn.assert!("foo"){ restrict(suppliers, ->{false}) } }

        it 'raises a AssertionError' do
          lambda{
            subject
          }.should raise_error(FactAssertionError, /foo/)
        end
      end

    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Splash\Local\Objects\Order;

use Mage;
use Mage_Catalog_Exception;
use Mage_Sales_Model_Order      as MageOrder;
use Mage_Sales_Model_Order_Payment;
use Splash\Core\SplashCore      as Splash;

/**
 * Magento 1 Customers CRUD Functions
 */
trait CRUDTrait
{
    /**
     * Load Request Object
     *
     * @param string $objectId Object id
     *
     * @return mixed
     */
    public function load($objectId)
    {
        //====================================================================//
        // Stack Trace
        Splash::log()->trace();
        //====================================================================//
        // Safety Checks
        if (empty($objectId)) {
            return Splash::log()->errTrace("Missing Id.");
        }
        /** @var MageOrder $model */
        $model = Mage::getModel('sales/order');
        /** @var false|MageOrder $order */
        $order = $model->load((int) $objectId);
        if (!$order || ($order->getEntityId() != $objectId)) {
            return Splash::log()->errTrace("Unable to load Customer Order (".$objectId.").");
        }
        //====================================================================//
        // Load Linked Objects
        $this->loadPayment($order);
        $this->loadTracking($order);

        return $order;
    }

    /**
     * Create Request Object
     *
     * @return false|object New Object
     */
    public function create()
    {
        //====================================================================//
        // Stack Trace
        Splash::log()->trace();
        //====================================================================//
        // Check Required Fields
        if (!$this->verifyRequiredFields()) {
            return false;
        }
        //====================================================================//
        // Create Empty Customer Order
        /** @var MageOrder $order */
        $order = Mage::getModel('sales/order');
        //====================================================================//
        // Setup Order External Id to Know this is a Splash Created Order
        $order->setExtOrderId(self::SPLASH_LABEL);
        // Set Is Virtual Order => No Billing or Shipping Address
        $order->setIsVirtual(1);
        // Set Default Payment Method
        $order->setData('payment', array('method' => 'checkmo'));
        /** @var Mage_Sales_Model_Order_Payment $orderPayment */
        $orderPayment = Mage::getModel('sales/order_payment');
        // Set Sales Order Payment
        $order->setPayment($orderPayment->setMethod('checkmo'));
        // Set Order Initial Status
        $order->setState(MageOrder::STATE_NEW, "pending", 'Just Created by SplashSync Module', true);
        //====================================================================//
        // Set Currency To Default Store Values
        $defaultCurrency = Mage::app()->getStore()->getBaseCurrencyCode();
        $order->setGlobalCurrencyCode($defaultCurrency);
        $order->setOrderCurrencyCode($defaultCurrency);
        $order->setBaseCurrencyCode($defaultCurrency);
        $order->setBaseToOrderRate(1);
        //====================================================================//
        // Save Object
        try {
            $order->save();
        } catch (Mage_Catalog_Exception $ex) {
            return Splash::log()->report($ex);
        }
        //====================================================================//
        // Load Linked Objects
        $this->loadPayment($order);

        return $order;
    }

    /**
     * Update Request Object
     *
     * @param bool $needed Is This Update Needed
     *
     * @return false|string Object Id
     */
    public function update($needed)
    {
        //====================================================================//
        // Stack Trace
        Splash::log()->trace();
        if (!$needed) {
            return $this->object->getEntityId();
        }
        //====================================================================//
        // Update order Totals
        $this->updateOrderTotals();
        //====================================================================//
        // Verify Update Is Required
        if (false == $needed) {
            return $this->object->getEntityId();
        }
        //====================================================================//
        // If Id Given = > Update Object
        //====================================================================//
        try {
            $this->object->save();
        } catch (Mage_Catalog_Exception $ex) {
            return Splash::log()->report($ex);
        }

        if ($this->object->_hasDataChanges) {
            return Splash::log()->errTrace("Unable to Update Order (".$this->object->getEntityId().").");
        }
        Splash::object("Order")->lock($this->object->getEntityId());

        return $this->object->getEntityId();
    }

    /**
     * Delete requested Object
     *
     * @param int $objectId Object Id.  If NULL, Object needs to be created.
     *
     * @return bool
     */
    public function delete($objectId = null)
    {
        //====================================================================//
        // Stack Trace
        Splash::log()->trace();
        //====================================================================//
        // Execute Generic Magento Delete Function ...
        return $this->coreDelete('sales/order', $objectId);
    }
}


text:
package org.hippoecm.repository;

import javax.jcr.Node;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.Value;

import org.hippoecm.repository.api.HippoNodeType;
import org.hippoecm.repository.api.HippoSession;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onehippo.repository.testutils.RepositoryTestCase;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class CopyNodeTest extends RepositoryTestCase {

    @Test
    public void testVirtualTreeCopy() throws RepositoryException {
        Node node, root = session.getRootNode().addNode("test","nt:unstructured");
        root.addMixin("mix:referenceable");
        node = root.addNode("documents");
        node = node.addNode("document","hippo:testdocument");
        node.addMixin("mix:versionable");
        node.setProperty("aap", "noot");
        session.save();
        node = root.addNode("navigation");
        node = node.addNode("search",HippoNodeType.NT_FACETSELECT);
        node.setProperty(HippoNodeType.HIPPO_DOCBASE, session.getRootNode().getNode("test").getIdentifier());
        node.setProperty(HippoNodeType.HIPPO_FACETS, new String[0]);
        node.setProperty(HippoNodeType.HIPPO_VALUES, new String[0]);
        node.setProperty(HippoNodeType.HIPPO_MODES, new String[0]);
        session.save();

        assertTrue(root.getNode("navigation").getNode("search").hasNode("documents"));
        assertTrue(root.getNode("navigation").getNode("search").getNode("documents").hasNode("document"));

        ((HippoSession)session).copy(root.getNode("navigation"), "/test/copy");
        session.save();
        session.refresh(false);

        root = session.getRootNode().getNode("test");
        assertTrue(root.getNode("copy").getNode("search").hasNode("documents"));
        assertTrue(root.getNode("copy").getNode("search").getNode("documents").hasNode("document"));
    }

    @Test
    public void testMultiValuedPropertyCopied() throws Exception {
        build(new String[] {
                "/test", "nt:unstructured",
                "/test/node", "hippo:testrelaxed",
        }, session);
        session.save();
        session.refresh(false);
        Node node = session.getRootNode().getNode("test/node");
        node.setProperty("string", new Value[0], PropertyType.STRING);
        node.setProperty("double", new Value[0], PropertyType.DOUBLE);
        session.save();
        Node copy = ((HippoSession) session).copy(node, "/test/copy");
        assertEquals(PropertyType.STRING, copy.getProperty("string").getType());
        assertEquals(PropertyType.DOUBLE, copy.getProperty("double").getType());
    }

}


text:
package webapp

import (
	"fmt"
	"time"
)

// Html is bounded in the ViewModel to allow helper functions to be called from the view.
type Html struct {
	ViewModel *ViewModel
	Context   *Context
}

// Human() display's a basic type to a more human readible format.
func (this *Html) Human(value interface{}) string {
	switch val := value.(type) {
	case time.Time:
		return val.Format("2006-01-02 15:04")
	default:
		return fmt.Sprintf("%v", value)
	}
	return "human"
}


text:
package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	strfmt "github.com/go-openapi/strfmt"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/swag"
)

// OpenpitrixCreateAppVersionRequest openpitrix create app version request
// swagger:model openpitrixCreateAppVersionRequest
type OpenpitrixCreateAppVersionRequest struct {

	// required, id of app to create new version
	AppID string `json:"app_id,omitempty"`

	// description of app of specific version
	Description string `json:"description,omitempty"`

	// required, version name eg.[0.1.0|0.1.3|...]
	Name string `json:"name,omitempty"`

	// package of app of specific version
	Package strfmt.Base64 `json:"package,omitempty"`

	// optional: vmbased/helm
	Type string `json:"type,omitempty"`
}

// Validate validates this openpitrix create app version request
func (m *OpenpitrixCreateAppVersionRequest) Validate(formats strfmt.Registry) error {
	var res []error

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

// MarshalBinary interface implementation
func (m *OpenpitrixCreateAppVersionRequest) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *OpenpitrixCreateAppVersionRequest) UnmarshalBinary(b []byte) error {
	var res OpenpitrixCreateAppVersionRequest
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
				android:gravity="center"
				android:layout_width="match_parent"
				android:layout_height="match_parent">

	<ImageView android:id="@+id/user_avatar"
			   android:scaleType="centerInside"
			   android:layout_margin="8dp"
			   android:layout_alignParentStart="true"
			   android:layout_alignParentLeft="true"
			   android:layout_width="50dp"
			   android:layout_height="50dp"/>

	<TextView android:id="@+id/user_name"
			  android:layout_centerVertical="true"
			  android:gravity="center_vertical"
			  android:layout_toRightOf="@+id/user_avatar"
			  android:layout_toEndOf="@+id/user_avatar"
			  android:layout_toLeftOf="@+id/remove_friend_btn"
			  android:layout_toStartOf="@+id/remove_friend_btn"
			  android:layout_width="match_parent"
			  android:layout_height="36dp"/>

	<Button
		android:id="@+id/message_friend_btn"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_margin="8dp"
		android:layout_toLeftOf="@id/remove_friend_btn"
		android:text="Message" />

	<Button
		android:id="@+id/remove_friend_btn"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_alignParentEnd="true"
		android:layout_alignParentRight="true"
		android:layout_margin="8dp"
		android:text="Remove" />

</RelativeLayout>


text:
using System;

namespace Permadelete.ApplicationManagement
{
    public class EntryPoint
    {
        // Note:
        // Permadelete is a singleton application, meaning only one instance should be running at a time.
        // The implementation is based on the Microsoft's WPF samples
        // Link: https://github.com/Microsoft/WPF-Samples/tree/master/Application%20Management/SingleInstanceDetection

        [STAThread]
        public static void Main(string[] args)
        {
            var manager = new SingletonManager();
            manager.Run(args);
        }
    }
}


text:
const html = require('choo/html')
let listening

module.exports = (props, actions) => {
  if (props.results.length && !listening) {
    listening = true
    document.addEventListener('click', onClick)
  }

  return html`

      <input
       name="searchInput"
       placeholder="Search..."
       oninput=${onInput}}
       class="input">

          ${props.results.map(result => html`

               select(result)}>
                ${result.prefLabel || result.label}

          `)}

`

  function onInput (e) {
    const value = e.target.value
    actions.search(value)
  }

  function select (result) {
    actions.select(result)
    closeDropdown()
  }

  function closeDropdown () {
    document.removeEventListener('click', onClick)
    actions.search(null)
    listening = false
  }

  function onClick (e) {
    const el = document.getElementById('autocomplete')
    const clickedOutside = e.target !== el && !el.contains(e.target)
    if (clickedOutside) { closeDropdown() }
  }
}


text:
package com.amazonaws.services.polly;

import org.w3c.dom.*;

import java.net.*;
import java.util.*;

import javax.annotation.Generated;

import org.apache.commons.logging.*;

import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;
import com.amazonaws.auth.presign.PresignerParams;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;

import com.amazonaws.services.polly.AmazonPollyClientBuilder;

import com.amazonaws.AmazonServiceException;

import com.amazonaws.services.polly.model.*;
import com.amazonaws.services.polly.model.transform.*;

/**
 * Client for accessing Amazon Polly. All service calls made using this client are blocking, and will not return until
 * the service call completes.
 *

 *

 * Amazon Polly is a web service that makes it easy to synthesize speech from text.
 *

 *

 * The Amazon Polly service provides API operations for synthesizing high-quality speech from plain text and Speech
 * Synthesis Markup Language (SSML), along with managing pronunciations lexicons that enable you to get the best results
 * for your application domain.
 *

 */
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AmazonPollyClient extends AmazonWebServiceClient implements AmazonPolly {

    /** Provider for AWS credentials. */
    private final AWSCredentialsProvider awsCredentialsProvider;

    private static final Log log = LogFactory.getLog(AmazonPolly.class);

    /** Default signing name for the service. */
    private static final String DEFAULT_SIGNING_NAME = "polly";

    /** Client configuration factory providing ClientConfigurations tailored to this client */
    protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();

    private final AdvancedConfig advancedConfig;

    private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory(
            new JsonClientMetadata()
                    .withProtocolVersion("1.1")
                    .withSupportsCbor(false)
                    .withSupportsIon(false)
                    .withContentTypeOverride("application/json")
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("InvalidS3BucketException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.InvalidS3BucketExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("InvalidSampleRateException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.InvalidSampleRateExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("SynthesisTaskNotFoundException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.SynthesisTaskNotFoundExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("MaxLexiconsNumberExceededException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.MaxLexiconsNumberExceededExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("MaxLexemeLengthExceededException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.MaxLexemeLengthExceededExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("UnsupportedPlsAlphabetException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.UnsupportedPlsAlphabetExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("LanguageNotSupportedException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.LanguageNotSupportedExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("TextLengthExceededException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.TextLengthExceededExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("InvalidLexiconException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.InvalidLexiconExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("SsmlMarksNotSupportedForTextTypeException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.SsmlMarksNotSupportedForTextTypeExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("InvalidS3KeyException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.InvalidS3KeyExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("InvalidSnsTopicArnException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.InvalidSnsTopicArnExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("MarksNotSupportedForFormatException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.MarksNotSupportedForFormatExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("InvalidTaskIdException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.InvalidTaskIdExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("UnsupportedPlsLanguageException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.UnsupportedPlsLanguageExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("LexiconNotFoundException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.LexiconNotFoundExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("LexiconSizeExceededException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.LexiconSizeExceededExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("InvalidSsmlException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.InvalidSsmlExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("InvalidNextTokenException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.InvalidNextTokenExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("EngineNotSupportedException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.EngineNotSupportedExceptionUnmarshaller.getInstance()))
                    .addErrorMetadata(
                            new JsonErrorShapeMetadata().withErrorCode("ServiceFailureException").withExceptionUnmarshaller(
                                    com.amazonaws.services.polly.model.transform.ServiceFailureExceptionUnmarshaller.getInstance()))
                    .withBaseServiceExceptionClass(com.amazonaws.services.polly.model.AmazonPollyException.class));

    /**
     * Constructs a new client to invoke service methods on Amazon Polly. A credentials provider chain will be used that
     * searches for credentials in this order:
     *

     *
Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY

     *
Java System Properties - aws.accessKeyId and aws.secretKey

     *
Instance profile credentials delivered through the Amazon EC2 metadata service

     *

     *
     *

     * All service calls made using this new client object are blocking, and will not return until the service call
     * completes.
     *
     * @see DefaultAWSCredentialsProviderChain
     * @deprecated use {@link AmazonPollyClientBuilder#defaultClient()}
     */
    @Deprecated
    public AmazonPollyClient() {
        this(DefaultAWSCredentialsProviderChain.getInstance(), configFactory.getConfig());
    }

    /**
     * Constructs a new client to invoke service methods on Amazon Polly. A credentials provider chain will be used that
     * searches for credentials in this order:
     *

     *
Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY

     *
Java System Properties - aws.accessKeyId and aws.secretKey

     *
Instance profile credentials delivered through the Amazon EC2 metadata service

     *

     *
     *

     * All service calls made using this new client object are blocking, and will not return until the service call
     * completes.
     *
     * @param clientConfiguration
     *        The client configuration options controlling how this client connects to Amazon Polly (ex: proxy settings,
     *        retry counts, etc.).
     *
     * @see DefaultAWSCredentialsProviderChain
     * @deprecated use {@link AmazonPollyClientBuilder#withClientConfiguration(ClientConfiguration)}
     */
    @Deprecated
    public AmazonPollyClient(ClientConfiguration clientConfiguration) {
        this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration);
    }

    /**
     * Constructs a new client to invoke service methods on Amazon Polly using the specified AWS account credentials.
     *
     *

     * All service calls made using this new client object are blocking, and will not return until the service call
     * completes.
     *
     * @param awsCredentials
     *        The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
     * @deprecated use {@link AmazonPollyClientBuilder#withCredentials(AWSCredentialsProvider)} for example:
     *             {@code AmazonPollyClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build();}
     */
    @Deprecated
    public AmazonPollyClient(AWSCredentials awsCredentials) {
        this(awsCredentials, configFactory.getConfig());
    }

    /**
     * Constructs a new client to invoke service methods on Amazon Polly using the specified AWS account credentials and
     * client configuration options.
     *
     *

     * All service calls made using this new client object are blocking, and will not return until the service call
     * completes.
     *
     * @param awsCredentials
     *        The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
     * @param clientConfiguration
     *        The client configuration options controlling how this client connects to Amazon Polly (ex: proxy settings,
     *        retry counts, etc.).
     * @deprecated use {@link AmazonPollyClientBuilder#withCredentials(AWSCredentialsProvider)} and
     *             {@link AmazonPollyClientBuilder#withClientConfiguration(ClientConfiguration)}
     */
    @Deprecated
    public AmazonPollyClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration) {
        super(clientConfiguration);
        this.awsCredentialsProvider = new StaticCredentialsProvider(awsCredentials);
        this.advancedConfig = AdvancedConfig.EMPTY;
        init();
    }

    /**
     * Constructs a new client to invoke service methods on Amazon Polly using the specified AWS account credentials
     * provider.
     *
     *

     * All service calls made using this new client object are blocking, and will not return until the service call
     * completes.
     *
     * @param awsCredentialsProvider
     *        The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
     * @deprecated use {@link AmazonPollyClientBuilder#withCredentials(AWSCredentialsProvider)}
     */
    @Deprecated
    public AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider) {
        this(awsCredentialsProvider, configFactory.getConfig());
    }

    /**
     * Constructs a new client to invoke service methods on Amazon Polly using the specified AWS account credentials
     * provider and client configuration options.
     *
     *

     * All service calls made using this new client object are blocking, and will not return until the service call
     * completes.
     *
     * @param awsCredentialsProvider
     *        The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
     * @param clientConfiguration
     *        The client configuration options controlling how this client connects to Amazon Polly (ex: proxy settings,
     *        retry counts, etc.).
     * @deprecated use {@link AmazonPollyClientBuilder#withCredentials(AWSCredentialsProvider)} and
     *             {@link AmazonPollyClientBuilder#withClientConfiguration(ClientConfiguration)}
     */
    @Deprecated
    public AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) {
        this(awsCredentialsProvider, clientConfiguration, null);
    }

    /**
     * Constructs a new client to invoke service methods on Amazon Polly using the specified AWS account credentials
     * provider, client configuration options, and request metric collector.
     *
     *

     * All service calls made using this new client object are blocking, and will not return until the service call
     * completes.
     *
     * @param awsCredentialsProvider
     *        The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
     * @param clientConfiguration
     *        The client configuration options controlling how this client connects to Amazon Polly (ex: proxy settings,
     *        retry counts, etc.).
     * @param requestMetricCollector
     *        optional request metric collector
     * @deprecated use {@link AmazonPollyClientBuilder#withCredentials(AWSCredentialsProvider)} and
     *             {@link AmazonPollyClientBuilder#withClientConfiguration(ClientConfiguration)} and
     *             {@link AmazonPollyClientBuilder#withMetricsCollector(RequestMetricCollector)}
     */
    @Deprecated
    public AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration,
            RequestMetricCollector requestMetricCollector) {
        super(clientConfiguration, requestMetricCollector);
        this.awsCredentialsProvider = awsCredentialsProvider;
        this.advancedConfig = AdvancedConfig.EMPTY;
        init();
    }

    public static AmazonPollyClientBuilder builder() {
        return AmazonPollyClientBuilder.standard();
    }

    /**
     * Constructs a new client to invoke service methods on Amazon Polly using the specified parameters.
     *
     *

     * All service calls made using this new client object are blocking, and will not return until the service call
     * completes.
     *
     * @param clientParams
     *        Object providing client parameters.
     */
    AmazonPollyClient(AwsSyncClientParams clientParams) {
        this(clientParams, false);
    }

    /**
     * Constructs a new client to invoke service methods on Amazon Polly using the specified parameters.
     *
     *

     * All service calls made using this new client object are blocking, and will not return until the service call
     * completes.
     *
     * @param clientParams
     *        Object providing client parameters.
     */
    AmazonPollyClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) {
        super(clientParams);
        this.awsCredentialsProvider = clientParams.getCredentialsProvider();
        this.advancedConfig = clientParams.getAdvancedConfig();
        init();
    }

    private void init() {
        setServiceNameIntern(DEFAULT_SIGNING_NAME);
        setEndpointPrefix(ENDPOINT_PREFIX);
        // calling this.setEndPoint(...) will also modify the signer accordingly
        setEndpoint("polly.us-east-1.amazonaws.com");
        HandlerChainFactory chainFactory = new HandlerChainFactory();
        requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/polly/request.handlers"));
        requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/polly/request.handler2s"));
        requestHandler2s.addAll(chainFactory.getGlobalHandlers());
    }

    /**
     *

     * Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region. A lexicon which has been
     * deleted is not available for speech synthesis, nor is it possible to retrieve it using either the
     * GetLexicon or ListLexicon APIs.
     *

     *

     * For more information, see Managing
     * Lexicons.
     *

     *
     * @param deleteLexiconRequest
     * @return Result of the DeleteLexicon operation returned by the service.
     * @throws LexiconNotFoundException
     *         Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its
     *         name is misspelled or specifying a lexicon that is in a different region.

     *

     *         Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name
     *         is spelled correctly. Then try again.
     * @throws ServiceFailureException
     *         An unknown condition has caused a service failure.
     * @sample AmazonPolly.DeleteLexicon
     * @see AWS API
     *      Documentation
     */
    @Override
    public DeleteLexiconResult deleteLexicon(DeleteLexiconRequest request) {
        request = beforeClientExecution(request);
        return executeDeleteLexicon(request);
    }

    @SdkInternalApi
    final DeleteLexiconResult executeDeleteLexicon(DeleteLexiconRequest deleteLexiconRequest) {

        ExecutionContext executionContext = createExecutionContext(deleteLexiconRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<DeleteLexiconRequest> request = null;
        Response<DeleteLexiconResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new DeleteLexiconRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteLexiconRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Polly");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteLexicon");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            HttpResponseHandler<AmazonWebServiceResponse<DeleteLexiconResult>> responseHandler = protocolFactory.createResponseHandler(
                    new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteLexiconResultJsonUnmarshaller());
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a
     * specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice
     * name.
     *

     *

     * When synthesizing speech ( SynthesizeSpeech ), you provide the voice ID for the voice you want from
     * the list of voices returned by DescribeVoices.
     *

     *

     * For example, you want your news reader application to read news in a specific language, but giving a user the
     * option to choose the voice. Using the DescribeVoices operation you can provide the user with a list
     * of available voices to select from.
     *

     *

     * You can optionally specify a language code to filter the available voices. For example, if you specify
     * en-US, the operation returns a list of all available US English voices.
     *

     *

     * This operation requires permissions to perform the polly:DescribeVoices action.
     *

     *
     * @param describeVoicesRequest
     * @return Result of the DescribeVoices operation returned by the service.
     * @throws InvalidNextTokenException
     *         The NextToken is invalid. Verify that it's spelled correctly, and then try again.
     * @throws ServiceFailureException
     *         An unknown condition has caused a service failure.
     * @sample AmazonPolly.DescribeVoices
     * @see AWS API
     *      Documentation
     */
    @Override
    public DescribeVoicesResult describeVoices(DescribeVoicesRequest request) {
        request = beforeClientExecution(request);
        return executeDescribeVoices(request);
    }

    @SdkInternalApi
    final DescribeVoicesResult executeDescribeVoices(DescribeVoicesRequest describeVoicesRequest) {

        ExecutionContext executionContext = createExecutionContext(describeVoicesRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<DescribeVoicesRequest> request = null;
        Response<DescribeVoicesResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new DescribeVoicesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeVoicesRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Polly");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeVoices");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            HttpResponseHandler<AmazonWebServiceResponse<DescribeVoicesResult>> responseHandler = protocolFactory.createResponseHandler(
                    new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeVoicesResultJsonUnmarshaller());
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more
     * information, see Managing
     * Lexicons.
     *

     *
     * @param getLexiconRequest
     * @return Result of the GetLexicon operation returned by the service.
     * @throws LexiconNotFoundException
     *         Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its
     *         name is misspelled or specifying a lexicon that is in a different region.

     *

     *         Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name
     *         is spelled correctly. Then try again.
     * @throws ServiceFailureException
     *         An unknown condition has caused a service failure.
     * @sample AmazonPolly.GetLexicon
     * @see AWS API
     *      Documentation
     */
    @Override
    public GetLexiconResult getLexicon(GetLexiconRequest request) {
        request = beforeClientExecution(request);
        return executeGetLexicon(request);
    }

    @SdkInternalApi
    final GetLexiconResult executeGetLexicon(GetLexiconRequest getLexiconRequest) {

        ExecutionContext executionContext = createExecutionContext(getLexiconRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<GetLexiconRequest> request = null;
        Response<GetLexiconResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new GetLexiconRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getLexiconRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Polly");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetLexicon");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            HttpResponseHandler<AmazonWebServiceResponse<GetLexiconResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
                    .withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetLexiconResultJsonUnmarshaller());
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Retrieves a specific SpeechSynthesisTask object based on its TaskID. This object contains information about the
     * given speech synthesis task, including the status of the task, and a link to the S3 bucket containing the output
     * of the task.
     *

     *
     * @param getSpeechSynthesisTaskRequest
     * @return Result of the GetSpeechSynthesisTask operation returned by the service.
     * @throws InvalidTaskIdException
     *         The provided Task ID is not valid. Please provide a valid Task ID and try again.
     * @throws ServiceFailureException
     *         An unknown condition has caused a service failure.
     * @throws SynthesisTaskNotFoundException
     *         The Speech Synthesis task with requested Task ID cannot be found.
     * @sample AmazonPolly.GetSpeechSynthesisTask
     * @see AWS
     *      API Documentation
     */
    @Override
    public GetSpeechSynthesisTaskResult getSpeechSynthesisTask(GetSpeechSynthesisTaskRequest request) {
        request = beforeClientExecution(request);
        return executeGetSpeechSynthesisTask(request);
    }

    @SdkInternalApi
    final GetSpeechSynthesisTaskResult executeGetSpeechSynthesisTask(GetSpeechSynthesisTaskRequest getSpeechSynthesisTaskRequest) {

        ExecutionContext executionContext = createExecutionContext(getSpeechSynthesisTaskRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<GetSpeechSynthesisTaskRequest> request = null;
        Response<GetSpeechSynthesisTaskResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new GetSpeechSynthesisTaskRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getSpeechSynthesisTaskRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Polly");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetSpeechSynthesisTask");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            HttpResponseHandler<AmazonWebServiceResponse<GetSpeechSynthesisTaskResult>> responseHandler = protocolFactory.createResponseHandler(
                    new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
                    new GetSpeechSynthesisTaskResultJsonUnmarshaller());
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
     *

     *
     * @param listLexiconsRequest
     * @return Result of the ListLexicons operation returned by the service.
     * @throws InvalidNextTokenException
     *         The NextToken is invalid. Verify that it's spelled correctly, and then try again.
     * @throws ServiceFailureException
     *         An unknown condition has caused a service failure.
     * @sample AmazonPolly.ListLexicons
     * @see AWS API
     *      Documentation
     */
    @Override
    public ListLexiconsResult listLexicons(ListLexiconsRequest request) {
        request = beforeClientExecution(request);
        return executeListLexicons(request);
    }

    @SdkInternalApi
    final ListLexiconsResult executeListLexicons(ListLexiconsRequest listLexiconsRequest) {

        ExecutionContext executionContext = createExecutionContext(listLexiconsRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<ListLexiconsRequest> request = null;
        Response<ListLexiconsResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new ListLexiconsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listLexiconsRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Polly");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListLexicons");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            HttpResponseHandler<AmazonWebServiceResponse<ListLexiconsResult>> responseHandler = protocolFactory.createResponseHandler(
                    new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListLexiconsResultJsonUnmarshaller());
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks
     * by their status, for example, allowing users to list only tasks that are completed.
     *

     *
     * @param listSpeechSynthesisTasksRequest
     * @return Result of the ListSpeechSynthesisTasks operation returned by the service.
     * @throws InvalidNextTokenException
     *         The NextToken is invalid. Verify that it's spelled correctly, and then try again.
     * @throws ServiceFailureException
     *         An unknown condition has caused a service failure.
     * @sample AmazonPolly.ListSpeechSynthesisTasks
     * @see AWS
     *      API Documentation
     */
    @Override
    public ListSpeechSynthesisTasksResult listSpeechSynthesisTasks(ListSpeechSynthesisTasksRequest request) {
        request = beforeClientExecution(request);
        return executeListSpeechSynthesisTasks(request);
    }

    @SdkInternalApi
    final ListSpeechSynthesisTasksResult executeListSpeechSynthesisTasks(ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest) {

        ExecutionContext executionContext = createExecutionContext(listSpeechSynthesisTasksRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<ListSpeechSynthesisTasksRequest> request = null;
        Response<ListSpeechSynthesisTasksResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new ListSpeechSynthesisTasksRequestProtocolMarshaller(protocolFactory).marshall(super
                        .beforeMarshalling(listSpeechSynthesisTasksRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Polly");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListSpeechSynthesisTasks");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            HttpResponseHandler<AmazonWebServiceResponse<ListSpeechSynthesisTasksResult>> responseHandler = protocolFactory.createResponseHandler(
                    new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
                    new ListSpeechSynthesisTasksResultJsonUnmarshaller());
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Stores a pronunciation lexicon in an Amazon Web Services Region. If a lexicon with the same name already exists
     * in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it
     * might take some time before the lexicon is available to the SynthesizeSpeech operation.
     *

     *

     * For more information, see Managing
     * Lexicons.
     *

     *
     * @param putLexiconRequest
     * @return Result of the PutLexicon operation returned by the service.
     * @throws InvalidLexiconException
     *         Amazon Polly can't find the specified lexicon. Verify that the lexicon's name is spelled correctly, and
     *         then try again.
     * @throws UnsupportedPlsAlphabetException
     *         The alphabet specified by the lexicon is not a supported alphabet. Valid values are x-sampa
     *         and ipa.
     * @throws UnsupportedPlsLanguageException
     *         The language specified in the lexicon is unsupported. For a list of supported languages, see Lexicon Attributes.
     * @throws LexiconSizeExceededException
     *         The maximum size of the specified lexicon would be exceeded by this operation.
     * @throws MaxLexemeLengthExceededException
     *         The maximum size of the lexeme would be exceeded by this operation.
     * @throws MaxLexiconsNumberExceededException
     *         The maximum number of lexicons would be exceeded by this operation.
     * @throws ServiceFailureException
     *         An unknown condition has caused a service failure.
     * @sample AmazonPolly.PutLexicon
     * @see AWS API
     *      Documentation
     */
    @Override
    public PutLexiconResult putLexicon(PutLexiconRequest request) {
        request = beforeClientExecution(request);
        return executePutLexicon(request);
    }

    @SdkInternalApi
    final PutLexiconResult executePutLexicon(PutLexiconRequest putLexiconRequest) {

        ExecutionContext executionContext = createExecutionContext(putLexiconRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<PutLexiconRequest> request = null;
        Response<PutLexiconResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new PutLexiconRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putLexiconRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Polly");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutLexicon");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            HttpResponseHandler<AmazonWebServiceResponse<PutLexiconResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
                    .withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutLexiconResultJsonUnmarshaller());
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Allows the creation of an asynchronous synthesis task, by starting a new SpeechSynthesisTask. This
     * operation requires all the standard information needed for speech synthesis, plus the name of an Amazon S3 bucket
     * for the service to store the output of the synthesis task and two optional parameters (
     * OutputS3KeyPrefix and SnsTopicArn). Once the synthesis task is created, this operation
     * will return a SpeechSynthesisTask object, which will include an identifier of this task as well as
     * the current status. The SpeechSynthesisTask object is available for 72 hours after starting the
     * asynchronous synthesis task.
     *

     *
     * @param startSpeechSynthesisTaskRequest
     * @return Result of the StartSpeechSynthesisTask operation returned by the service.
     * @throws TextLengthExceededException
     *         The value of the "Text" parameter is longer than the accepted limits. For the
     *         SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of
     *         which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the
     *         maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not
     *         counted as billed characters.
     * @throws InvalidS3BucketException
     *         The provided Amazon S3 bucket name is invalid. Please check your input with S3 bucket naming requirements
     *         and try again.
     * @throws InvalidS3KeyException
     *         The provided Amazon S3 key prefix is invalid. Please provide a valid S3 object key name.
     * @throws InvalidSampleRateException
     *         The specified sample rate is not valid.
     * @throws InvalidSnsTopicArnException
     *         The provided SNS topic ARN is invalid. Please provide a valid SNS topic ARN and try again.
     * @throws InvalidSsmlException
     *         The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try
     *         again.
     * @throws EngineNotSupportedException
     *         This engine is not compatible with the voice that you have designated. Choose a new voice that is
     *         compatible with the engine or change the engine and restart the operation.
     * @throws LexiconNotFoundException
     *         Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its
     *         name is misspelled or specifying a lexicon that is in a different region.

     *

     *         Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name
     *         is spelled correctly. Then try again.
     * @throws ServiceFailureException
     *         An unknown condition has caused a service failure.
     * @throws MarksNotSupportedForFormatException
     *         Speech marks are not supported for the OutputFormat selected. Speech marks are only
     *         available for content in json format.
     * @throws SsmlMarksNotSupportedForTextTypeException
     *         SSML speech marks are not supported for plain text-type input.
     * @throws LanguageNotSupportedException
     *         The language specified is not currently supported by Amazon Polly in this capacity.
     * @sample AmazonPolly.StartSpeechSynthesisTask
     * @see AWS
     *      API Documentation
     */
    @Override
    public StartSpeechSynthesisTaskResult startSpeechSynthesisTask(StartSpeechSynthesisTaskRequest request) {
        request = beforeClientExecution(request);
        return executeStartSpeechSynthesisTask(request);
    }

    @SdkInternalApi
    final StartSpeechSynthesisTaskResult executeStartSpeechSynthesisTask(StartSpeechSynthesisTaskRequest startSpeechSynthesisTaskRequest) {

        ExecutionContext executionContext = createExecutionContext(startSpeechSynthesisTaskRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<StartSpeechSynthesisTaskRequest> request = null;
        Response<StartSpeechSynthesisTaskResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new StartSpeechSynthesisTaskRequestProtocolMarshaller(protocolFactory).marshall(super
                        .beforeMarshalling(startSpeechSynthesisTaskRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Polly");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartSpeechSynthesisTask");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            HttpResponseHandler<AmazonWebServiceResponse<StartSpeechSynthesisTaskResult>> responseHandler = protocolFactory.createResponseHandler(
                    new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
                    new StartSpeechSynthesisTaskResultJsonUnmarshaller());
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML.
     * Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by
     * English voices) unless phoneme mapping is used. For more information, see How it Works.
     *

     *
     * @param synthesizeSpeechRequest
     * @return Result of the SynthesizeSpeech operation returned by the service.
     * @throws TextLengthExceededException
     *         The value of the "Text" parameter is longer than the accepted limits. For the
     *         SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of
     *         which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the
     *         maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not
     *         counted as billed characters.
     * @throws InvalidSampleRateException
     *         The specified sample rate is not valid.
     * @throws InvalidSsmlException
     *         The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try
     *         again.
     * @throws LexiconNotFoundException
     *         Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its
     *         name is misspelled or specifying a lexicon that is in a different region.

     *

     *         Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name
     *         is spelled correctly. Then try again.
     * @throws ServiceFailureException
     *         An unknown condition has caused a service failure.
     * @throws MarksNotSupportedForFormatException
     *         Speech marks are not supported for the OutputFormat selected. Speech marks are only
     *         available for content in json format.
     * @throws SsmlMarksNotSupportedForTextTypeException
     *         SSML speech marks are not supported for plain text-type input.
     * @throws LanguageNotSupportedException
     *         The language specified is not currently supported by Amazon Polly in this capacity.
     * @throws EngineNotSupportedException
     *         This engine is not compatible with the voice that you have designated. Choose a new voice that is
     *         compatible with the engine or change the engine and restart the operation.
     * @sample AmazonPolly.SynthesizeSpeech
     * @see AWS API
     *      Documentation
     */
    @Override
    public SynthesizeSpeechResult synthesizeSpeech(SynthesizeSpeechRequest request) {
        request = beforeClientExecution(request);
        return executeSynthesizeSpeech(request);
    }

    @SdkInternalApi
    final SynthesizeSpeechResult executeSynthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest) {

        ExecutionContext executionContext = createExecutionContext(synthesizeSpeechRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<SynthesizeSpeechRequest> request = null;
        Response<SynthesizeSpeechResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new SynthesizeSpeechRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(synthesizeSpeechRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Polly");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SynthesizeSpeech");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            HttpResponseHandler<AmazonWebServiceResponse<SynthesizeSpeechResult>> responseHandler = protocolFactory.createResponseHandler(
                    new JsonOperationMetadata().withPayloadJson(false).withHasStreamingSuccessResponse(true), new SynthesizeSpeechResultJsonUnmarshaller());
            response = invoke(request, responseHandler, executionContext);

            request.addHandlerContext(HandlerContextKey.HAS_STREAMING_OUTPUT, Boolean.TRUE);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     * Returns additional metadata for a previously executed successful, request, typically used for debugging issues
     * where a service isn't acting as expected. This data isn't considered part of the result data returned by an
     * operation, so it's available through this separate, diagnostic interface.
     *

     * Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
     * information for an executed request, you should use this method to retrieve it as soon as possible after
     * executing the request.
     *
     * @param request
     *        The originally executed request
     *
     * @return The response metadata for the specified request, or null if none is available.
     */
    public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
        return client.getResponseMetadataForRequest(request);
    }

    /**
     * Normal invoke with authentication. Credentials are required and may be overriden at the request level.
     **/
    private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
            ExecutionContext executionContext) {

        return invoke(request, responseHandler, executionContext, null, null);
    }

    /**
     * Normal invoke with authentication. Credentials are required and may be overriden at the request level.
     **/
    private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
            ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) {

        executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider));

        return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait);
    }

    /**
     * Invoke with no authentication. Credentials are not required and any credentials set on the client or request will
     * be ignored for this operation.
     **/
    private <X, Y extends AmazonWebServiceRequest> Response<X> anonymousInvoke(Request<Y> request,
            HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler, ExecutionContext executionContext) {

        return doInvoke(request, responseHandler, executionContext, null, null);
    }

    /**
     * Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the
     * ExecutionContext beforehand.
     **/
    private <X, Y extends AmazonWebServiceRequest> Response<X> doInvoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
            ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) {

        if (discoveredEndpoint != null) {
            request.setEndpoint(discoveredEndpoint);
            request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery");
        } else if (uriFromEndpointTrait != null) {
            request.setEndpoint(uriFromEndpointTrait);
        } else {
            request.setEndpoint(endpoint);
        }

        request.setTimeOffset(timeOffset);

        HttpResponseHandler<AmazonServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata());

        return client.execute(request, responseHandler, errorResponseHandler, executionContext);
    }

    @com.amazonaws.annotation.SdkInternalApi
    static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() {
        return protocolFactory;
    }

    @Override
    public void shutdown() {
        super.shutdown();
    }

    @Override
    public com.amazonaws.services.polly.presign.AmazonPollyPresigners presigners() {
        return new com.amazonaws.services.polly.presign.AmazonPollyPresigners(PresignerParams.builder().endpoint(endpoint)
                .credentialsProvider(awsCredentialsProvider).signerProvider(getSignerProvider()).build());
    }

}


text:
module Noodall
  class Site
    class << self

      attr_accessor :map, :permalinks

      def build!
        return false unless map.is_a?(Hash)
        map.each do |permalink, attributes|
          build_node(permalink, attributes)
        end
      end

      def contains?(permalink)
        self.permalinks ||= []
        return false unless map.is_a?(Hash)
        return true if map.keys.include?(permalink)
        map.values.each do |attrubutes|
          extract_permalinks(attrubutes)
        end
        return permalinks.include?(permalink)
      end

      private

      def extract_permalinks(attributes)
        children = attributes['children']
        if children
          self.permalinks = permalinks | children.keys
          children.values.each do |attributes|
            extract_permalinks(attributes)
          end
        end
      end

      def build_node(permalink, attr)
        attributes = attr.dup
        klass_name = attributes.delete('type')
        children = attributes.delete('children')

        node = Noodall::Node.first(:permalink => permalink) || create_node(klass_name, attributes.merge(:permalink => permalink))
        children.each do |permalink, attributes|
          build_node(permalink, attributes.merge(:parent => node))
        end if children
      end

      def create_node(klass_name, attributes)
        if defined?(Factory) && FactoryGirl.factories[klass_name.underscore.to_sym]
          Factory(klass_name.underscore, attributes)
        else
          klass_name.constantize.create!(attributes)
        end
      end

    end
  end
end


text:
Welcome to adoc

A source documentation tool

  <form role="user" ng-controller="UserCtrl" ng-submit="newUser(nuser)" style="margin-top:20px;">
    <input class="form-control" type="text" placeholder="name" ng-model="nuser.name" required>
    <input class="form-control" type="email" placeholder="email" ng-model="nuser.email" required>
    <input class="form-control" type="password" placeholder="password" ng-model="nuser.password" required>
    <button class="btn btn-primary btn-block" type="submit">Create Account</button>

{{err.data.errors}}

  </form>


text:
from .controllers import party_import_from_sample_file
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.contrib import messages
from import_export_ctcl.controllers import CTCL_SAMPLE_XML_FILE
from django.contrib.auth.decorators import login_required
import wevote_functions.admin

logger = wevote_functions.admin.get_logger(__name__)

@login_required
def party_import_from_xml_view(request):

    results = party_import_from_sample_file(CTCL_SAMPLE_XML_FILE)

    if not results['success']:
        messages.add_message(request, messages.ERROR, results['status'])
    else:
        messages.add_message(request, messages.INFO, 'Party import completed. '
                                                     'Saved: {saved}, Updated: {updated}, '
                                                     'Not processed: {not_processed}'
                                                     ''.format(saved=results['saved'],
                                                               updated=results['updated'],
                                                               not_processed=results['not_processed']))
    return HttpResponseRedirect(reverse('admin_tools:admin_home', args=()))


text:
id: version-7.0.0-babel-plugin-transform-strict-mode
title: @babel/plugin-transform-strict-mode
sidebar_label: transform-strict-mode
original_id: babel-plugin-transform-strict-mode
---

This plugin may be enabled via `@babel/plugin-transform-modules-commonjs`.
If you wish to disable it you can either turn `strict` off or pass
`strictMode: false` as an option to the commonjs transform.

## Example

**In**

```javascript
foo();
```

**Out**

```javascript
"use strict";

foo();
```

## Installation

```sh
npm install --save-dev @babel/plugin-transform-strict-mode
```

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
  "plugins": ["@babel/plugin-transform-strict-mode"]
}
```

### Via CLI

```sh
babel --plugins @babel/plugin-transform-strict-mode script.js
```

### Via Node API

```javascript
require("@babel/core").transform("code", {
  plugins: ["@babel/plugin-transform-strict-mode"]
});
```


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#90CAF9"/>
    <corners android:radius="10dp"/>
    <padding
        android:left="10dp"
        android:top="10dp"
        android:right="10dp"
        android:bottom="10dp"
        />
</shape>


text:
#ifndef OSMIUM_IO_DETAIL_QUEUE_UTIL_HPP
#define OSMIUM_IO_DETAIL_QUEUE_UTIL_HPP

#include <cassert>
#include <exception>
#include <future>
#include <string>
#include <utility>

#include <osmium/memory/buffer.hpp>
#include <osmium/thread/queue.hpp>

namespace osmium {

    namespace io {

        namespace detail {

            template <typename T>
            using future_queue_type = osmium::thread::Queue<std::future<T>>;

            /**
             * This type of queue contains buffers with OSM data in them.
             * The "end of file" is marked by an invalid Buffer.
             * The buffers are wrapped in a std::future so that they can also
             * transport exceptions. The future also helps with keeping the
             * data in order.
             */
            using future_buffer_queue_type = future_queue_type<osmium::memory::Buffer>;

            /**
             * This type of queue contains OSM file data in the form it is
             * stored on disk, ie encoded as XML, PBF, etc.
             * The "end of file" is marked by an empty string.
             * The strings are wrapped in a std::future so that they can also
             * transport exceptions. The future also helps with keeping the
             * data in order.
             */
            using future_string_queue_type = future_queue_type<std::string>;

            template <typename T>
            inline void add_to_queue(future_queue_type<T>& queue, T&& data) {
                std::promise<T> promise;
                queue.push(promise.get_future());
                promise.set_value(std::forward<T>(data));
            }

            template <typename T>
            inline void add_to_queue(future_queue_type<T>& queue, std::exception_ptr&& exception) {
                std::promise<T> promise;
                queue.push(promise.get_future());
                promise.set_exception(std::move(exception));
            }

            template <typename T>
            inline void add_end_of_data_to_queue(future_queue_type<T>& queue) {
                add_to_queue<T>(queue, T{});
            }

            inline bool at_end_of_data(const std::string& data) noexcept {
                return data.empty();
            }

            inline bool at_end_of_data(osmium::memory::Buffer& buffer) noexcept {
                return !buffer;
            }

            template <typename T>
            class queue_wrapper {

                future_queue_type<T>& m_queue;
                bool m_has_reached_end_of_data;

            public:

                explicit queue_wrapper(future_queue_type<T>& queue) :
                    m_queue(queue),
                    m_has_reached_end_of_data(false) {
                }

                ~queue_wrapper() noexcept {
                    drain();
                }

                void drain() {
                    while (!m_has_reached_end_of_data) {
                        try {
                            pop();
                        } catch (...) {
                            // Ignore any exceptions.
                        }
                    }
                }

                bool has_reached_end_of_data() const noexcept {
                    return m_has_reached_end_of_data;
                }

                T pop() {
                    T data;
                    if (!m_has_reached_end_of_data) {
                        std::future<T> data_future;
                        m_queue.wait_and_pop(data_future);
                        assert(data_future.valid());
                        data = std::move(data_future.get());
                        if (at_end_of_data(data)) {
                            m_has_reached_end_of_data = true;
                        }
                    }
                    return data;
                }

            }; // class queue_wrapper

        } // namespace detail

    } // namespace io

} // namespace osmium

#endif // OSMIUM_IO_DETAIL_QUEUE_UTIL_HPP


text:
<?php

namespace AppBundle\Manager\Entity\Common\Assignments;

use AppBundle\Entity\Assignments\MagazineBranchAssignment;
use AppBundle\Entity\Main\Branch;
use AppBundle\Entity\Main\Magazine;
use AppBundle\Manager\Entity\Base\AssignmentManager;
use Symfony\Component\HttpFoundation\Request;

class MagazineBranchAssignmentManager extends AssignmentManager {

	public function createFromRequest(Request $request) {
		$entry = parent::createFromRequest($request);
		/** @var MagazineBranchAssignment $entry */

		$entry->setMagazine($this->paramsManager->getParamByClass($request, Magazine::class));
		$entry->setBranch($this->paramsManager->getParamByClass($request, Branch::class));

		return $entry;
	}

	public function createFromTemplate($template) {
		$entry = parent::createFromTemplate($template);
		/** @var MagazineBranchAssignment $entry */

		$entry->setMagazine($template->getMagazine());
		$entry->setBranch($template->getBranch());

		return $entry;
	}

	protected function getEntityType() {
		return MagazineBranchAssignment::class;
	}
}


text:
export OMP_NUM_THREADS=4
export EXTRAE_CONFIG_FILE=extrae.xml
export EXTRAE_HOME=@sub_PREFIXDIR@
source ${EXTRAE_HOME}/etc/extrae.sh

./pi_instrumented


text:
package org.ovirt.engine.core.bll;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import javax.inject.Inject;

import org.ovirt.engine.core.common.AuditLogType;
import org.ovirt.engine.core.common.VdcObjectType;
import org.ovirt.engine.core.common.action.AddVmPoolWithVmsParameters;
import org.ovirt.engine.core.common.action.LockProperties;
import org.ovirt.engine.core.common.action.VdcActionType;
import org.ovirt.engine.core.common.action.VdcReturnValueBase;
import org.ovirt.engine.core.common.action.VmManagementParametersBase;
import org.ovirt.engine.core.common.businessentities.VM;
import org.ovirt.engine.core.common.businessentities.VmPool;
import org.ovirt.engine.core.common.errors.EngineMessage;
import org.ovirt.engine.core.common.locks.LockingGroup;
import org.ovirt.engine.core.common.queries.IdQueryParameters;
import org.ovirt.engine.core.common.queries.VdcQueryReturnValue;
import org.ovirt.engine.core.common.queries.VdcQueryType;
import org.ovirt.engine.core.common.utils.Pair;
import org.ovirt.engine.core.common.validation.group.CreateEntity;
import org.ovirt.engine.core.common.validation.group.UpdateEntity;
import org.ovirt.engine.core.compat.Guid;
import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase;

@DisableInPrepareMode
@NonTransactiveCommandAttribute(forceCompensation = true)
public class UpdateVmPoolWithVmsCommand<T extends AddVmPoolWithVmsParameters> extends CommonVmPoolWithVmsCommand<T>  implements RenamedEntityInfoProvider{

    private VmPool oldPool;
    @Inject
    private VmPoolMonitor vmPoolMonitor;

    /**
     * Constructor for command creation when compensation is applied on startup
     */
    protected UpdateVmPoolWithVmsCommand(Guid commandId) {
        super(commandId);
    }

    public UpdateVmPoolWithVmsCommand(T parameters) {
        super(parameters);
    }

    @Override
    protected Guid getPoolId() {
        getVmPoolDao().update(getVmPool());
        return getVmPool().getVmPoolId();
    }

    @Override
    protected LockProperties applyLockProperties(LockProperties lockProperties) {
        return lockProperties.withScope(LockProperties.Scope.Execution);
    }

    @Override
    protected Map<String, Pair<String, String>> getExclusiveLocks() {
        return Collections.singletonMap(getVmPoolId().toString(),
                LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM_POOL, getVmPoolIsBeingUpdatedMessage()));
    }

    private String getVmPoolIsBeingUpdatedMessage() {
        StringBuilder builder = new StringBuilder(EngineMessage.ACTION_TYPE_FAILED_VM_POOL_IS_BEING_UPDATED.name());
        if (getVmPool() != null) {
            builder.append(String.format("$VmPoolName %1$s", getVmPool().getName()));
        }
        return builder.toString();
    }

    @Override
    protected boolean validate() {
        if (!super.validate()) {
            return false;
        }

        oldPool = getVmPoolDao().get(getVmPool().getVmPoolId());
        if (oldPool == null) {
            return failValidation(EngineMessage.VM_POOL_CANNOT_UPDATE_POOL_NOT_FOUND);
        }

        if (getParameters().getVmsCount() < 0) {
            return failValidation(EngineMessage.VM_POOL_CANNOT_DECREASE_VMS_FROM_POOL);
        }

        return true;
    }

    @Override
    protected void setActionMessageParameters() {
        super.setActionMessageParameters();
        addValidationMessage(EngineMessage.VAR__ACTION__UPDATE);
    }

    @Override
    public AuditLogType getAuditLogTypeValue() {
        return isAddVmsSucceded() ? AuditLogType.USER_UPDATE_VM_POOL_WITH_VMS
                : AuditLogType.USER_UPDATE_VM_POOL_WITH_VMS_FAILED;
    }

    @Override
    protected void executeCommand() {
        VdcQueryReturnValue currentVmsInPoolQuery =
                runInternalQuery(VdcQueryType.GetAllPoolVms, new IdQueryParameters(getVmPool().getVmPoolId()));
        List<VM> poolVmsBeforeAdd = currentVmsInPoolQuery.getSucceeded() ? currentVmsInPoolQuery.<List<VM>>getReturnValue() : null;

        super.executeCommand();
        if (getSucceeded()) {
            updatePoolVms(poolVmsBeforeAdd);
        }
        vmPoolMonitor.triggerPoolMonitoringJob();
    }

    private void updatePoolVms(List<VM> vmsInPool) {
        boolean isUpdatedPoolLatest = getParameters().getVmStaticData().isUseLatestVersion(); // new latest value

        if (vmsInPool != null && !vmsInPool.isEmpty()) {

            // Check one VM in order to decide if template version was changed
            boolean isUpdateNeeded = isUpdateVmRequired(vmsInPool.get(0));

            // if a change in template version was detected --> update all pool vms
            if (isUpdateNeeded) {
                VmTemplateHandler.lockVmTemplateInTransaction(getParameters().getVmStaticData().getVmtGuid(),
                        getCompensationContext());
                for (VM vm : vmsInPool) {
                    VmManagementParametersBase updateParams = new VmManagementParametersBase(vm);
                    updateParams.getVmStaticData().setUseLatestVersion(isUpdatedPoolLatest);
                    if (!isUpdatedPoolLatest) {
                        updateParams.getVmStaticData().setVmtGuid(getParameters().getVmStaticData().getVmtGuid());
                    }

                    VdcReturnValueBase result =
                            runInternalActionWithTasksContext(
                                    VdcActionType.UpdateVm,
                                    updateParams,
                                    getLock()
                            );
                    getTaskIdList().addAll(result.getInternalVdsmTaskIdList());
                    setSucceeded(getSucceeded() && result.getSucceeded());
                }
                VmTemplateHandler.unlockVmTemplate(getParameters().getVmStaticData().getVmtGuid());
            }
        }
    }

    private boolean isUpdateVmRequired(VM poolVm) {
        Guid currentTempVersion = null; // old template version (based on current vm data)
        boolean isCurrentLatest = false; // old latest status
        if (poolVm.isNextRunConfigurationExists()) {
            VdcQueryReturnValue qRetNextRun =
                    getBackend().runInternalQuery(VdcQueryType.GetVmNextRunConfiguration,
                            new IdQueryParameters(poolVm.getId()));
            if (qRetNextRun.getSucceeded()) {
                final VM nextRunVm =
                        qRetNextRun.getReturnValue();
                if (nextRunVm != null) { // template version was changed, the cause still needs to be checked
                    currentTempVersion = nextRunVm.getVmtGuid();
                    isCurrentLatest = nextRunVm.isUseLatestVersion();
                }
            }
        } else {
            currentTempVersion = poolVm.getVmtGuid();
            isCurrentLatest = poolVm.isUseLatestVersion();
        }

        boolean isLatestPropertyChanged = isCurrentLatest != getParameters().getVmStaticData().isUseLatestVersion();

        // template ID changed but latest is not set, as it would cause false-positives
        boolean isTemplateIdChanged = false;
        Guid newPoolTemplateVersion = getParameters().getVmStaticData().getVmtGuid();
        if (newPoolTemplateVersion != null) {
            isTemplateIdChanged = !newPoolTemplateVersion.equals(currentTempVersion) && !isCurrentLatest;
        }

        return isLatestPropertyChanged || isTemplateIdChanged;
    }

    @Override
    public String getEntityType() {
        return VdcObjectType.VmPool.getVdcObjectTranslation();
    }

    @Override
    public String getEntityOldName() {
        return oldPool.getName();
    }

    @Override
    public String getEntityNewName() {
        return getParameters().getVmPool().getName();
    }

    @Override
    public void setEntityId(AuditLogableBase logable) {
    }

    @Override
    protected List<Class<?>> getValidationGroups() {
        addValidationGroup(CreateEntity.class);
        addValidationGroup(UpdateEntity.class);
        return super.getValidationGroups();
    }
}


text:
import static I.FOO;

// "Replace Implements with Static Import" "true"
public class X {
  void foo() {
    System.out.println(FOO);
  }
}

interface I {
  String FOO = "foo";
}


text:
package db.postgresql.protocol.v3.io;

import db.postgresql.protocol.v3.ProtocolException;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CoderResult;
import java.nio.charset.CharacterCodingException;

public class FixedStream implements Stream {

    private final ByteBuffer recvBuffer;
    private final ByteBuffer sendBuffer;
    private final Charset encoding;

    public FixedStream(final int size, final Charset encoding) {
        this.recvBuffer = ByteBuffer.allocate(size);
        this.sendBuffer = ByteBuffer.allocate(size);
        this.encoding = encoding;
    }

    public ByteBuffer getRecvBuffer() { return recvBuffer; }
    public ByteBuffer getSendBuffer() { return sendBuffer; }

    public void close() { }
    public Charset getEncoding() { return encoding; }

    public void send(final boolean sendAll) { }
    public void recv() { }
    public void recv(final int atLeast) { }
    public void recv(final int atLeast, final int tries) { }
    public void advance(final int size) { recvBuffer.position(recvBuffer.position() + size); }

    public Stream put(final ByteBuffer buffer) { sendBuffer.put(buffer); return this; }
    public Stream put(final byte b) { sendBuffer.put(b); return this; }
    public Stream put(final byte[] bytes) { sendBuffer.put(bytes); return this; }
    public Stream putShort(final short s) { sendBuffer.putShort(s); return this; }
    public Stream putInt(final int i) { sendBuffer.putInt(i); return this; }
    public Stream putNull() { sendBuffer.put(NULL); return this; }

    public Stream putCharSequence(final CharSequence seq) {
        return putCharSequence(seq, encoding);
    }

    public Stream putCharSequence(final CharSequence seq, final Charset encoding) {
        final CharBuffer charBuffer = CharBuffer.wrap(seq);
        final CharsetEncoder encoder = encoding.newEncoder();
        encoder.encode(charBuffer, recvBuffer, false);
        encoder.encode(charBuffer, recvBuffer, true);
        return this;
    }

    public Stream putString(final String str) {
        return putCharSequence(str);
    }

    public ByteBuffer view(final int max) {
        ByteBuffer v = recvBuffer.slice();
        if(v.remaining() > max) {
            v.limit(max);
        }

        return v;
    }

    public ByteBuffer getBuffer(final ByteBuffer buffer) {
        buffer.put(recvBuffer);
        return buffer;
    }

    public byte get() { return recvBuffer.get(); }
    public byte get(final int tries) { return get(); }
    public byte[] get(final byte[] dst, final int offset, final int length) {
        recvBuffer.get(dst, offset, length);
        return dst;
    }

    public byte[] get(byte[] dst, int offset, int length, int tries) {
        return get(dst, offset, length);
    }

    public byte[] get(byte[] dst) {
        return get(dst, 0, dst.length);
    }

    public byte[] get(byte[] dst, int tries) {
        return get(dst);
    }

    public String nullString() {
        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream(256);
            byte b;
            while((b = get()) != NULL) {
                baos.write(b);
            }

            return baos.toString(encoding.name());
        }
        catch(UnsupportedEncodingException ex) {
            throw new ProtocolException(ex);
        }
    }

    public String nullString(final int size) {
        byte[] bytes = get(new byte[size]);
        int length = (bytes[bytes.length - 1] == (byte) 0) ? bytes.length - 1 : bytes.length;
        return new String(bytes, 0, length, encoding);
    }

    public String nullString(final int size, final int tries) {
        return nullString(size);
    }

    public short getShort() { return recvBuffer.getShort(); }
    public short getShort(int tries) { return getShort(); }
    public int getInt() { return recvBuffer.getInt(); }
    public int getInt(final int tries) { return getInt(); }
    public byte getNull() { return get(); }
    public byte getNull(int tries) { return get(); }

    public CharBuffer getCharBuffer(final int numBytes) {
        ByteBuffer view = recvBuffer.slice();
        view.limit(numBytes);
        advance(numBytes);

        try {
            final CharsetDecoder decoder = encoding.newDecoder();
            return decoder.decode(view);
        }
        catch(CharacterCodingException ex) {
            throw new ProtocolException(ex);
        }
    }
}


text:
import React from 'react';
import { NavLink } from 'react-router-dom';

class Nav extends React.Component {
  render() {
    return (

          <NavLink exact activeClassName='active' to='/'>Home</NavLink>

          <NavLink activeClassName='active' to='/chat'>Chat</NavLink>

    );
  }
}
export default Nav;


text:
.. _settings:
.. module:: gcframe.settings
   :synopsis: Configurable settings that affect the behavior of the middleware
              and decorators.

Settings
========

Overview
--------

There are a couple of configurable settings that define the content of the
``X-UA-Compatible`` HTTP response header. Realistically, virtually no one will
need to modify these. But if you do, simply set a custom value for them in your
:file:`settings.py`.

Available Settings
------------------

.. _GCF_IE_COMPATIBILITY_MODE:

GCF_IE_COMPATIBILITY_MODE
~~~~~~~~~~~~~~~~~~~~~~~~~

The default value is ``'Edge'``. This means that if :abbr:`GCF (Google Chrome
Frame)` is not activated :abbr:`IE (Internet Explorer)` will use the highest
compatibility mode available. Other values include:

* ``None``
* ``'5'``
* ``'6'``
* ``'7'``
* ``'EmulateIE7'``
* ``'8'``

A value of ``None``, will turn off compatibility mode changing. Other values
correspond to various Internet Explorer browser modes. Virtually everyone will
be best served by using the default value of ``'Edge'``.

.. seealso::

   More information on compatibility modes can be found in the MSDN article
   `META Tags and Locking in Future Compatibility`_.

.. _META Tags and Locking in Future Compatibility: http://msdn.microsoft.com/library/cc817574.aspx

.. _GCF_IE_ACTIVATION_METHOD:

GCF_IE_ACTIVATION_METHOD
~~~~~~~~~~~~~~~~~~~~~~~~

Default value is ``'1'``. This means that all versions of IE with GCF installed
will activate it. Other options include:

* ``'IE6'``
* ``'IE7'``
* ``'IE8'``

These values activate GCF only on the named IE version and older. Newer
versions will behave according to the value of :ref:`GCF_IE_COMPATIBILITY_MODE`.
Again, few people will need to change this setting. A value of ``'1'``
will likely serve you best.

.. seealso::

   The `GCF developer documentation`_ has more information regarding activation
   methods.

.. _GCF developer documentation: http://www.chromium.org/developers/how-tos/chrome-frame-getting-started


text:
<!DOCTYPE html>

        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="msapplication-tap-highlight" content="no" />

        <link rel="stylesheet" type="text/css" href="css/index.css" />

        <link rel="stylesheet" media="screen  and (max-device-width:590px) and (orientation: portrait) and  (-webkit-max-device-pixel-ratio: 1.5),
screen  and  (min-device-width:600px) and (max-device-width:1000px) and (orientation: portrait) and  (-webkit-max-device-pixel-ratio: 2.4),
screen and (min-device-width:1000px) and  (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2.5)" type="text/css" href="css/index-smartphones-portrait.css" />

		<title>Pizzam</title>

 Leider gibt es keine Internetverbindung.  Der Besuch unseres Internetportals und unser Bringdienst-E-Shops ist nicht möglich. Schließen Sie bitte die App um später zu probieren.