text:
package machinelearning

import (
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/defaults"
	"github.com/aws/aws-sdk-go/aws/request"
	"github.com/aws/aws-sdk-go/aws/service"
	"github.com/aws/aws-sdk-go/aws/service/serviceinfo"
	"github.com/aws/aws-sdk-go/internal/protocol/jsonrpc"
	"github.com/aws/aws-sdk-go/internal/signer/v4"
)

// Definition of the public APIs exposed by Amazon Machine Learning
type MachineLearning struct {
	*service.Service
}

// Used for custom service initialization logic
var initService func(*service.Service)

// Used for custom request initialization logic
var initRequest func(*request.Request)

// New returns a new MachineLearning client.
func New(config *aws.Config) *MachineLearning {
	service := &service.Service{
		ServiceInfo: serviceinfo.ServiceInfo{
			Config:       defaults.DefaultConfig.Merge(config),
			ServiceName:  "machinelearning",
			APIVersion:   "2014-12-12",
			JSONVersion:  "1.1",
			TargetPrefix: "AmazonML_20141212",
		},
	}
	service.Initialize()

	// Handlers
	service.Handlers.Sign.PushBack(v4.Sign)
	service.Handlers.Build.PushBack(jsonrpc.Build)
	service.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal)
	service.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta)
	service.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError)

	// Run custom service initialization if present
	if initService != nil {
		initService(service)
	}

	return &MachineLearning{service}
}

// newRequest creates a new request for a MachineLearning operation and runs any
// custom request initialization.
func (c *MachineLearning) newRequest(op *request.Operation, params, data interface{}) *request.Request {
	req := c.NewRequest(op, params, data)

	// Run custom request initialization if present
	if initRequest != nil {
		initRequest(req)
	}

	return req
}


text:
package be.peopleware.bean_V;

/**
 *
Delegates are objects used internally in a <dfn>delegating bean</dfn>
 *   to do work for the bean. Because different instances of a delegate type
 *   can be used in different types of delegating beans, this is a potent
 *   form of reuse. Delegating beans keep private the fact that
 *   they are using a delegate for certain tasks internally. When delegation
 *   is acknowledged to public users, please use an ActiveProperty
 *   (see Beedra).

 *
Delegates know which bean and which property they work for.
 *   This knowledge can, e.g., be used to throw
 *   {@link be.peopleware.bean_V.PropertyException}s.
 *   Delegates are not beans themselves (there is no default
 *   constructor). The properties introduced in this class
 *   are immutable.

 *
Delegates cannot be made {@link Cloneable} or
 *   {@link java.io.Serializable}.
 *   The {@link Object#equals(Object)} should not be overridden.
 *   Instead, a {@link #hasSameValues(Object)} method is offered.

 *
Here is the delegate use idiom:

 *

 * …
 * public class <var>MyDelegatingBean</var> … {
 *
 *   /*<constructors>*/
 *   //------------------------------------------------------------------
 *
 *   public <var>MyDelegatingBean</var>(…) {
 *     …
 *   }
 *
 *   /*</constructors>*/
 *
 *   …
 *
 *   /*<property name="<var>propertyName</var>">*/
 *   //------------------------------------------------------------------
 *
 *   …
 *   <var>public delegation methods to access delegate functionality</var>
 *   …
 *
 *   /**
 *    * …
 *    * @invar $<var>myDelegate</var> != null;
 *    * @invar $<var>myDelegate</var>.getDelegatingBean() == this;
 *    */
 *   private <var>MyDelegate</var> $<var>myDelegate</var> = new <var>MyDelegate</var>(this, "<var>propertyName</var>");
 *
 *   /*</property>*/
 *
 *   …
 * }
 *

 *
It often makes sense to specify the actual <var>MyDelegate</var> class
 *   as a private or protected inner class or even anonymous inner class of
 *   <var>MyDelegatingBean</var>.

 *
From the above idiom it should be clear that the constructor of the
 *   delegate is called during the initialization phase of the
 *   delegating instance. Furthermore, a reference to this
 *   delegating-instance-under-construction is passed into the
 *   delegate constructor at this time. Since the initialization phase
 *   of the delegating instance is not necessarily completed yet (it
 *   probably isn't), the delegating instance does not yet necessarily
 *   adhere to its type invariants. This means that you can create
 *   giant problems if the delegate constructor accesses the delegating
 *   instance in any way. The constructor of a delegate should
 *   only store the reference to the delegating bean, and never ever
 *   access that instance in any way. Storing the reference
 *   to the delegating instance is done by the constructor in this class.

 *
Note for use in the context of Hibernate

 *
When used in the context of Hibernate, delegates are often
 *   treated as Hibernate <dfn>components</dfn>. When a delegating
 *   bean is initialised from persistent storage, it is created
 *   with a default constructor. Then, components are created with a default
 *   constructor, and set on the delegating bean. In essence, it
 *   would be advisable to change Hibernate not to do this. Normal behavior
 *   with delegates is that they are constructed, initialized and set
 *   during initialization (construction) of the delegating bean, and
 *   that they are stored in final instance variables. Hibernate should
 *   be aware of this, and be coerced not to create new delegate instances,
 *   but fill the values of the existing delegates. This is considered
 *   too difficult for now.

 *   To accomodate the use of delegates as components in a Hibernate
 *   context, methods are offered that make it possible
 *   to create a instance of the delegate without the delegating bean
 *   and property name set.
 *   The delegating bean and property name should then be set through
 *   {@link #setDelegatingBean(Object)} and {@link #setPropertyName(String)}
 *   immediately after construction. To achieve this, the delegating
 *   bean needs to apply delegation with the following idiom:

 *

 * …
 * public class <var>MyDelegatingBean</var> … {
 *
 *   /*<constructors>*/
 *   //------------------------------------------------------------------
 *
 *   public <var>MyDelegatingBean</var>(…) {
 *     …
 *     set<var>MyDelegate</var>(new <var>MyDelegate</var>());
 *       /* this new <var>MyDelegate</var> will be overwritten if it is
 *        * Hibernate that is initializing this new <var>MyDelegatingBean</var>.
 *        * There is no way to work around this inefficiency.
 *        */
 *     …
 *   }
 *
 *   /*</constructors>*/
 *
 *   …
 *
 *   /*<property name="<var>propertyName</var>">*/
 *   //------------------------------------------------------------------
 *
 *   …
 *   <var>public delegation methods to access delegate functionality</var>
 *   …
 *
 *   /**
 *    * This method is package accessible, because it will be used
 *    * to read the delegate by Hibernate.
 *    *
 *    * @basic
 *    */
 *   <var>MyDelegate</var> get<var>MyDelegate</var>() {
 *     return $<var>myDelegate</var>;
 *   }
 *
 *   /**
 *    * This method is package accessible, because it will be used
 *    * to set the delegate by Hibernate.
 *    *
 *    * @param <var>myDelegate</var>
 *    *        The new delegate for this delegating bean.
 *    * @pre <var>myDelegate</var> != null;
 *    * @pre <var>myDelegate</var>.getDelegatingBean() == null;
 *    * @post new.get<var>MyDelegate</var>() == <var>myDelegate</var>;
 *    * @post new.get<var>MyDelegate</var>().getDelegatingBean() == this;
 *    * @post new.get<var>MyDelegate</var>().getPropertyName().equals("<var>propertyName</var>");
 *    */
 *   void set<var>MyDelegate</var>(<var>MyDelegate</var> <var>myDelegate</var>) {
 *     assert <var>myDelegate</var> != null;
 *     assert <var>myDelegate</var>.getDelegatingBean() == null;
 *     $<var>myDelegate</var> = <var>myDelegate</var>;
 *     $<var>myDelegate</var>.setDelegatingBean(this);
 *     $<var>myDelegate</var>.setPropertyName("<var>propertyName</var>");
 *   }
 *
 *   /**
 *    * …
 *    * This delegate variable cannot be made final, because when
 *    * used as a component in a Hibernate context, it will be
 *    * overwritten immediately after construction.
 *    *
 *    * @invar $<var>myDelegate</var> != null;
 *    * @invar $<var>myDelegate</var>.getDelegatingBean() == this;
 *    */
 *   private <var>MyDelegate</var> $<var>myDelegate</var>;
 *
 *   /*</property>*/
 *
 *   …
 * }
 *

 *
The Hibernate hbm file then should have an entry based
 *   on the following idiom:

 *

 * <?xml version="1.0"?>
 * <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
 * <hibernate-mapping>
 *  <…class name="<var>….MyDelegatingBean</var>" …>
 *    …
 *    <component name="<var>myDelegate</var>"
 *               class="<var>….MyDelegate</var>"
 *               access="method">
 *      <var>field and collection mappings of the delegate</var>
 *    </component>
 *    …
 *  </…class>
 * </hibernate-mapping>
 *

 *
This setup to accomodate Hibernate should be considered a
 *   workaround until a fundamental solution is found or
 *   created. These methods are labelled deprecated for easy trace
 *   later.

 *
 * @idea (jand): Change Hibernate to accomodate for delegates in the way
 *       described above. Investigate whether the current extension mechanisms
 *       can be used (doubtful). Otherwise, contact the Hibernate developers to
 *       see what the scope of the change would be. It is highly likely that
 *       this requires a new kind of element in the hbm files.
 *
 * @author    Jan Dockx
 * @author    PeopleWare n.v.
 *
 * @invar     getDelegatingBean() != null;
 * @invar     (getPropertyName() != null) && (getPropertyName().length() > 0);
 * @invar     !Cloneable.class.isAssignableFrom(getClass());
 * @invar     !java.io.Serializable.class.isAssignableFrom(getClass());
 * @invar     (forall Object o; ; equals(o) == (this == o));
 *                do not override the equals method
 */
public class Delegate {

  /*
*/
  //------------------------------------------------------------------

  /** {@value} */
  public static final String CVS_REVISION = "$Revision$"; //$NON-NLS-1$
  /** {@value} */
  public static final String CVS_DATE = "$Date$"; //$NON-NLS-1$
  /** {@value} */
  public static final String CVS_STATE = "$State$"; //$NON-NLS-1$
  /** {@value} */
  public static final String CVS_TAG = "$Name$"; //$NON-NLS-1$

  /*
*/

  /*<construction>*/
  //------------------------------------------------------------------

  /**
   * @param     delegatingBean
   *            The bean that delegates to this.
   * @param     propertyName
   *            The name of the property for which delegatingBean
   *            uses this.
   *
   * @pre       delegatingBean != null;
   * @pre       (propertyName != null) && (propertyName.length() > 0);
   * @post      new.getDelegatingBean() == delegatingBean;
   * @post      new.getpropertyName().equals(propertyName);
   */
  public Delegate(final Object delegatingBean, final String propertyName) {
    assert delegatingBean != null : "delegatingBean != null"; //$NON-NLS-1$
    assert (propertyName != null) && propertyName.length() > 0
           : "(propertyName != null) && getPropertyName().length() > 0"; //$NON-NLS-1$
    $delegatingBean = delegatingBean;
    $propertyName = propertyName;
  }

  /**
   * This method is here only to accomodate Hibernate. See
   * the class description above. Type invariants are not ok
   * when this constructor is used. The user should call
   * {@link #setDelegatingBean(Object)}
   * immediately after calling this constructor. Users should
   * create a subtype that does feature a default constructor,
   * where this constructor is called. This migh be possible
   * in many circumstances, since the property name is dependent
   * on the type of the delegate (static) and not on a particular
   * instance, as {@link #getDelegatingBean()} is.
   *
   * @deprecated
   *
   * @param     propertyName
   *            The name of the property for which delegatingBean
   *            uses this.
   *
   * @pre       (propertyName != null) && (propertyName.length() > 0);
   * @post      new.getDelegatingBean() == null;
   * @post      new.getpropertyName().equals(propertyName);
   */
  public Delegate(final String propertyName) {
    assert (propertyName != null) && propertyName.length() > 0
            : "(propertyName != null) && getPropertyName().length() > 0"; //$NON-NLS-1$
    $propertyName = propertyName;
  }

  /**
   * This method is here only to accomodate Hibernate. See
   * the class description above. Type invariants are not ok
   * when this constructor is used. The user should call
   * {@link #setDelegatingBean(Object)} and {@link #setPropertyName(String)}
   * immediately after calling this constructor.
   *
   * @deprecated
   *
   * @post  new.getDelegatingBean() == null;
   * @post  new.getPropertyName() == null;
   */
  public Delegate() {
    // NOP
  }

  /*</construction>*/

  /*<property name="delegatingBean">*/
  //------------------------------------------------------------------

  /**
   * The object we are a delegate for.
   *
   * @basic
   */
  public final Object getDelegatingBean() {
    return $delegatingBean;
  }

  /**
   * This method is here only to accomodate Hibernate. See
   * the class description above.
   *
   * @deprecated
   *
   * @param delegatingBean
   *        The new delegating bean
   * @pre   delegatingBean != null;
   * @post  new.getDelegatingBean() == delegatingBean;
   */
  public final void setDelegatingBean(final Object delegatingBean) {
    $delegatingBean = delegatingBean;
  }

  /**
   * @invar     $delegatingBean != null;
   */
  private Object $delegatingBean;

  /*</property>*/

  /*<property name="propertyName">*/
  //------------------------------------------------------------------

  /**
   * The name of the property we are the delegate for.
   *
   * @basic
   */
  public final String getPropertyName() {
    return $propertyName;
  }

  /**
   * This method is here only to accomodate Hibernate. See
   * the class description above.
   *
   * @deprecated
   *
   * @param propertyName
   *        The new property name
   * @pre   propertyName != null;
   * @pre   propertyName.length() > 0;
   * @post  new.getPropertyName().equals(propertyName);
   *
   */
  public final void setPropertyName(final String propertyName) {
    assert propertyName != null;
    assert propertyName.length() > 0;
    $propertyName = propertyName;
  }

  /**
   * @invar     $propertyName != null;
   * @invar     $propertyName.length() > 0;
   */
  private String $propertyName;

  /*</property>*/

  /**
   * This instance has the same values as the instance o.
   * In contrast to {@link #equals(Object)} compares referential
   * equality. The delegating bean and the property name are not
   * taken into account.
   *
   * @param     o
   *            The object to compare values with.
   * @return    result ==>  (o != null) && (getClass() == o.getClass());
   */
  public boolean hasSameValues(final Object o) {
    return (o != null) && (getClass() == o.getClass());
  }

  /**
   * A String that lists all data in this object. This string does not
   * contain the delegating bean, but it does list the property name.
   *
   * @return ", " + getPropertyName() + ": ";
   */
  protected String unclosedPropertiesString() {
     return ", " + getPropertyName() + ": "; //$NON-NLS-1$ //$NON-NLS-2$
  }

}

redpajama_set_name: RedPajamaGithub


text:
import os
import logging
import pytest
import shlex
from time import sleep
from subprocess import Popen, PIPE, call
from tests.common.impala_cluster import ImpalaCluster

SHELL_CMD = "%s/bin/impala-shell.sh" % os.environ['IMPALA_HOME']
DEFAULT_QUERY = 'select 1'
TEST_DB = "tmp_shell"
TEST_TBL = "tbl1"
QUERY_FILE_PATH = os.path.join(os.environ['IMPALA_HOME'], 'tests', 'shell')

class TestImpalaShell(object):
  """A set of sanity tests for the Impala shell commandiline parameters.

  The tests need to maintain Python 2.4 compatibility as a sub-goal of having
  shell tests is to ensure that it's not broken in systems running Python 2.4.
  The tests need a running impalad instance in order to execute queries.

  TODO:
     * Test individual modules.
     * Test the shell in interactive mode.
     * Add a test for a kerberized impala.
  """

  @classmethod
  def setup_class(cls):
    cls.__create_shell_data()

  @classmethod
  def teardown_class(cls):
    run_impala_shell_cmd('-q "drop table if exists %s.%s"' % (TEST_DB, TEST_TBL))
    run_impala_shell_cmd('-q "drop database if exists %s"' % TEST_DB)

  @classmethod
  def __create_shell_data(cls):
    # Create a temporary table and populate it with test data.
    stmts = ['create database if not exists %s' % TEST_DB,
             'create table if not exists %s.%s (i integer, s string)' % (TEST_DB,\
                                                                         TEST_TBL),
             "insert into %s.%s values (1, 'a'),(1, 'b'),(3, 'b')" % (TEST_DB, TEST_TBL)
            ]
    args = '-q "%s"' % (';'.join(stmts))
    run_impala_shell_cmd(args)

  @pytest.mark.execute_serially
  def test_no_args(self):
    args = '-q "%s"' % DEFAULT_QUERY
    run_impala_shell_cmd(args)

  @pytest.mark.execute_serially
  def test_multiple_queries(self):
    queries = ';'.join([DEFAULT_QUERY] * 3)
    args = '-q "%s" -B' % queries
    run_impala_shell_cmd(args)

  @pytest.mark.execute_serially
  def test_default_db(self):
    args = '-d %s -q "describe %s" --quiet' % (TEST_DB, TEST_TBL)
    run_impala_shell_cmd(args)
    args = '-q "describe %s"' % TEST_TBL
    run_impala_shell_cmd(args, expect_success=False)

  @pytest.mark.execute_serially
  def test_refresh_on_connect(self):
    args = '-r -q "%s"' % DEFAULT_QUERY
    result = run_impala_shell_cmd(args)
    assert 'Invalidating Metadata' in result.stderr, result.stderr

  @pytest.mark.execute_serially
  def test_unsecure_message(self):
    results = run_impala_shell_cmd("")
    assert "Starting Impala Shell without Kerberos authentication" in results.stderr

  @pytest.mark.execute_serially
  def test_print_header(self):
    args = '--print_header -B --output_delim="," -q "select * from %s.%s"' % (TEST_DB,
                                                                              TEST_TBL)
    result = run_impala_shell_cmd(args)
    result_rows = result.stdout.strip().split('\n')
    assert len(result_rows) == 4
    assert result_rows[0].split(',') == ['i', 's']
    args = '-B --output_delim="," -q "select * from %s.%s"' % (TEST_DB, TEST_TBL)
    result = run_impala_shell_cmd(args)
    result_rows = result.stdout.strip().split('\n')
    assert len(result_rows) == 3

  @pytest.mark.execute_serially
  def test_kerberos_option(self):
    args = "-k"
    # The command will fail because we're trying to connect to a kerberized impalad.
    results = run_impala_shell_cmd(args, expect_success=False)
    # Check that impala is using the right service name.
    assert "Using service name 'impala'" in results.stderr
    assert "Starting Impala Shell using Kerberos authentication" in results.stderr
    # Check that Impala warns the user if klist does not exist on the system, or if
    # no kerberos tickets are initialized.
    try:
      call(["klist"])
      expected_error_msg = ("-k requires a valid kerberos ticket but no valid kerberos "
          "ticket found.")
      assert expected_error_msg in results.stderr
    except OSError:
      assert 'klist not found on the system' in results.stderr
    # Make sure we don't try to re-connect
    assert "retrying the connection with a secure transport" not in results.stderr
    # Change the service name
    args += " -s foobar"
    results = run_impala_shell_cmd(args, expect_success=False)
    assert "Using service name 'foobar'" in results.stderr

  @pytest.mark.execute_serially
  def test_continue_on_error(self):
    args = '-c -q "select foo; select bar;"'
    run_impala_shell_cmd(args)
    # Should fail
    args = '-q "select foo; select bar;"'
    run_impala_shell_cmd(args, expect_success=False)

  @pytest.mark.execute_serially
  def test_execute_queries_from_file(self):
    args = '-f %s/test_file_comments.sql --quiet -B' % QUERY_FILE_PATH
    result = run_impala_shell_cmd(args)
    output = result.stdout
    args = '-f %s/test_file_no_comments.sql --quiet -B' % QUERY_FILE_PATH
    result = run_impala_shell_cmd(args)
    assert output == result.stdout, "Queries with comments not parsed correctly"

  @pytest.mark.execute_serially
  def test_completed_query_errors(self):
    args = ('-q "set abort_on_error=false;'
        ' select count(*) from functional_seq_snap.bad_seq_snap" --quiet')
    result = run_impala_shell_cmd(args)
    assert 'WARNINGS:' in result.stderr
    assert 'Bad synchronization marker' in result.stderr
    assert 'Expected: ' in result.stderr
    assert 'Actual: ' in result.stderr
    assert 'Problem parsing file' in result.stderr

  @pytest.mark.execute_serially
  def test_output_format(self):
    expected_output = ['1'] * 3
    args = '-q "select 1,1,1" -B --quiet'
    result = run_impala_shell_cmd(args)
    actual_output = [r.strip() for r in result.stdout.split('\t')]
    assert actual_output == expected_output
    result = run_impala_shell_cmd(args + ' --output_delim="|"')
    actual_output = [r.strip() for r in result.stdout.split('|')]
    assert actual_output == expected_output
    result = run_impala_shell_cmd(args + ' --output_delim="||"',
                                  expect_success=False)
    assert "Illegal delimiter" in result.stderr

  @pytest.mark.execute_serially
  def test_do_methods(self):
    """Ensure that the do_ methods in the shell work.

    Some of the do_ methods are implicitly tested in other tests, and as part of the test
    setup.
    """
    # explain
    args = '-q "explain select 1"'
    run_impala_shell_cmd(args)
    # show
    args = '-q "show tables"'
    run_impala_shell_cmd(args)
    # with
    args = '-q "with t1 as (select 1) select * from t1"'
    run_impala_shell_cmd(args)
    # set
    # spaces around the = sign
    args = '-q "set default_order_by_limit  =   10"'
    run_impala_shell_cmd(args)
    # no spaces around the = sign
    args = '-q "set default_order_by_limit=10"'
    run_impala_shell_cmd(args)
    # test query options displayed
    args = '-q "set"'
    result_set = run_impala_shell_cmd(args)
    assert 'MEM_LIMIT: [0]' in result_set.stdout
    # test values displayed after setting value
    args = '-q "set mem_limit=1g;set"'
    result_set = run_impala_shell_cmd(args)
    # single list means one instance of mem_limit in displayed output
    assert 'MEM_LIMIT: 1g' in result_set.stdout
    assert 'MEM_LIMIT: [0]' not in result_set.stdout
    # Negative tests for set
    # use : instead of =
    args = '-q "set default_order_by_limit:10"'
    run_impala_shell_cmd(args, expect_success=False)
    # use 2 = signs
    args = '-q "set default_order_by_limit=10=50"'
    run_impala_shell_cmd(args, expect_success=False)
    # describe and desc should return the same result.
    args = '-q "describe %s.%s" -B' % (TEST_DB, TEST_TBL)
    result_describe = run_impala_shell_cmd(args)
    args = '-q "desc %s.%s" -B' % (TEST_DB, TEST_TBL)
    result_desc = run_impala_shell_cmd(args)
    assert result_describe.stdout == result_desc.stdout

  @pytest.mark.execute_serially
  def test_summary(self):
    args = "-q 'select count(*) from functional.alltypes; summary;'"
    result_set = run_impala_shell_cmd(args)
    assert "03:AGGREGATE" in result_set.stdout

    args = "-q 'summary;'"
    result_set = run_impala_shell_cmd(args)
    assert "Could not retrieve summary for query" in result_set.stderr

    args = "-q 'show tables; summary;'"
    result_set = run_impala_shell_cmd(args)
    assert "Summary not available" in result_set.stderr

    # Test queries without an exchange
    args = "-q 'select 1; summary;'"
    result_set = run_impala_shell_cmd(args)
    assert "00:UNION" in result_set.stdout

  @pytest.mark.execute_serially
  def test_queries_closed(self):
    """Regression test for IMPALA-897"""
    args = '-f %s/test_close_queries.sql --quiet -B' % QUERY_FILE_PATH
    cmd = "%s %s" % (SHELL_CMD, args)
    # Execute the shell command async
    p = Popen(shlex.split(cmd), shell=False, stdout=PIPE, stderr=PIPE)

    impala_cluster = ImpalaCluster()
    impalad = impala_cluster.impalads[0].service
    # The last query in the test SQL script will sleep for 10 seconds, so sleep
    # here for 5 seconds and verify the number of in-flight queries is 1.
    sleep(5)
    assert 1 == impalad.get_num_in_flight_queries()
    assert get_shell_cmd_result(p).rc == 0
    assert 0 == impalad.get_num_in_flight_queries()

  @pytest.mark.execute_serially
  def test_get_log_once(self):
    """Test that get_log() is always called exactly once."""
    # Query with fetch
    args = '-q "select * from functional.alltypeserror"'
    result = run_impala_shell_cmd(args)
    assert result.stderr.count('WARNINGS') == 1

    # Insert query (doesn't fetch)
    INSERT_TBL = "alltypes_get_log"
    DROP_ARGS = '-q "drop table if exists %s.%s"' % (TEST_DB, INSERT_TBL)
    run_impala_shell_cmd(DROP_ARGS)
    args = '-q "create table %s.%s like functional.alltypeserror"' % (TEST_DB, INSERT_TBL)
    run_impala_shell_cmd(args)
    args = '-q "insert overwrite %s.%s partition(year, month)' \
           'select * from functional.alltypeserror"' % (TEST_DB, INSERT_TBL)
    result = run_impala_shell_cmd(args)
    assert result.stderr.count('WARNINGS') == 1
    run_impala_shell_cmd(DROP_ARGS)

class ImpalaShellResult(object):
  def __init__(self):
    self.rc = 0
    self.stdout = str()
    self.stderr = str()

def run_impala_shell_cmd(shell_args, expect_success=True):
  """Runs the Impala shell on the commandline.

  'shell_args' is a string which represents the commandline options.
  Returns a ImpalaShellResult.
  """
  cmd = "%s %s" % (SHELL_CMD, shell_args)
  p = Popen(shlex.split(cmd), shell=False, stdout=PIPE, stderr=PIPE)
  result = get_shell_cmd_result(p)
  if expect_success:
    assert result.rc == 0, "Cmd %s was expected to succeed: %s" % (cmd, result.stderr)
  else:
    assert result.rc != 0, "Cmd %s was expected to fail" % cmd
  return result

def get_shell_cmd_result(process):
  result = ImpalaShellResult()
  result.stdout, result.stderr = process.communicate()
  result.rc = process.returncode
  return result


text:
#include "AVSCommon/Utils/Logger/LogEntry.h"

#include <cstring>
#include <iomanip>

namespace alexaClientSDK {
namespace avsCommon {
namespace utils {
namespace logger {

/// List of characters we need to escape.
static constexpr auto RESERVED_METADATA_CHARS = R"(\,=:)";

/// Escape sequence for '%'.
static constexpr auto ESCAPED_METADATA_ESCAPE = R"(\\)";

/// Escape sequence for ','.
static constexpr auto ESCAPED_PAIR_SEPARATOR = R"(\,)";

/// Escape sequence for ':'.
static constexpr auto ESCAPED_SECTION_SEPARATOR = R"(\:)";

/// Escape sequence for '='.
static constexpr auto ESCAPED_KEY_VALUE_SEPARATOR = R"(\=)";

/// Reserved in metadata sequences for escaping other reserved values.
static constexpr char METADATA_ESCAPE = '\\';

/// Reserved in metadata sequences to separate key,value pairs.
static constexpr char PAIR_SEPARATOR = ',';

/// Reserved in metadata sequences to separate them from a preceding event and an optional terminal message.
static constexpr char SECTION_SEPARATOR = ':';

/// String for boolean TRUE
static constexpr auto BOOL_TRUE = "true";

/// String for boolean FALSE
static constexpr auto BOOL_FALSE = "false";

/// Array of strings for obfuscation.
/// @see LogEntry::obfuscatePrivateData()
static constexpr const char* const DENYLIST[] = {"ssid"};

LogEntry::LogEntry(const char* source, const char* event) : m_hasMetadata(false) {
    if (source) {
        m_stream << source;
    }
    m_stream << SECTION_SEPARATOR;
    if (event) {
        m_stream << event;
    }
}

LogEntry::LogEntry(const std::string& source, const char* event) : LogEntry(source.c_str(), event) {
}

LogEntry::LogEntry(const std::string& source, const std::string& event) : LogEntry(source.c_str(), event.c_str()) {
}

LogEntry& LogEntry::d(const char* key, const char* value) {
    prefixKeyValuePair();
    if (!key) {
        key = "";
    }
    m_stream << key << KEY_VALUE_SEPARATOR;
    appendEscapedString(value);
    return *this;
}

LogEntry& LogEntry::d(const char* key, const std::string& value) {
    return d(key, value.c_str());
}

LogEntry& LogEntry::d(const char* key, bool value) {
    return d(key, value ? BOOL_TRUE : BOOL_FALSE);
}

LogEntry& LogEntry::m(const char* message) {
    prefixMessage();
    if (message) {
        m_stream << message;
    }
    return *this;
}

LogEntry& LogEntry::m(const std::string& message) {
    prefixMessage();
    m_stream << message;
    return *this;
}

LogEntry& LogEntry::p(const char* key, const void* ptr) {
    return d(key, ptr);
}

const char* LogEntry::c_str() const {
    return m_stream.c_str();
}

void LogEntry::prefixKeyValuePair() {
    if (m_hasMetadata) {
        m_stream << PAIR_SEPARATOR;
    } else {
        m_stream << SECTION_SEPARATOR;
        m_hasMetadata = true;
    }
}

void LogEntry::prefixMessage() {
    if (!m_hasMetadata) {
        m_stream << SECTION_SEPARATOR;
    }
    m_stream << SECTION_SEPARATOR;
}

void LogEntry::appendEscapedString(const char* in) {
    if (!in) {
        return;
    }
    auto pos = in;
    // A little insurance against an infinite loop.
    auto maxCount = strlen(in);
    while (maxCount-- > 0 && *pos != 0) {
        auto next = strpbrk(pos, RESERVED_METADATA_CHARS);
        if (next) {
            m_stream.write(pos, next - pos);
            switch (*next) {
                case METADATA_ESCAPE:
                    m_stream << ESCAPED_METADATA_ESCAPE;
                    break;
                case PAIR_SEPARATOR:
                    m_stream << ESCAPED_PAIR_SEPARATOR;
                    break;
                case SECTION_SEPARATOR:
                    m_stream << ESCAPED_SECTION_SEPARATOR;
                    break;
                case KEY_VALUE_SEPARATOR:
                    m_stream << ESCAPED_KEY_VALUE_SEPARATOR;
                    break;
            }
            pos = next + 1;
        } else {
            m_stream << pos;
            return;
        }
    }
}

LogEntry& LogEntry::obfuscatePrivateData(const char* key, const std::string& value) {
    // if value contains any  private label, obfuscate the section after the label
    // since it can (but shouldn't) contain multiple,  obfuscate from the earliest one found onward
    auto firstPosition = value.length();

    const size_t count = sizeof(DENYLIST) / sizeof(DENYLIST[0]);
    for (size_t index = 0; index < count; ++index) {
        const auto privateLabel = DENYLIST[index];
        const auto privateLabelLen = std::strlen(privateLabel);
        auto it = std::search(
            value.begin(),
            value.end(),
            privateLabel,
            privateLabel + privateLabelLen,
            [](char valueChar, char denyListChar) { return std::tolower(valueChar) == std::tolower(denyListChar); });
        if (it != value.end()) {
            // capture the least value
            auto thisPosition = std::distance(value.begin(), it) + privateLabelLen;
            if (thisPosition < firstPosition) {
                firstPosition = thisPosition;
            }
        }
    }

    if (firstPosition <= value.length()) {
        // hash everything after the label itself
        auto labelPart = value.substr(0, firstPosition);
        auto obfuscatedPart = std::to_string(std::hash<std::string>{}(value.substr(firstPosition)));
        return d(key, labelPart + obfuscatedPart);
    }
    return d(key, value);
}

}  // namespace logger
}  // namespace utils
}  // namespace avsCommon
}  // namespace alexaClientSDK


text:
require 'docker'

module SS
  module EsSupport
    module_function

    def es_port
      @es_port ||= rand(29_200..39_200)
    end

    def es_port=(port)
      @es_port = port
    end

    def es_url
      "http://localhost:#{SS::EsSupport.es_port}"
    end

    def docker_image_id
      @docker_image_id ||= "shirasagi/elasticsearch"
    end

    def docker_container_borrowed
      @docker_borrowed
    end

    def docker_container_borrowed=(borrowed)
      @docker_borrowed = borrowed
    end

    def docker_container
      @docker_container
    end

    def docker_container=(container)
      @docker_container = container
    end

    def init
      RSpec.configuration.extend(SS::EsSupport::Hooks, es: true)
      RSpec.configuration.after(:suite) do
        SS::EsSupport.after_suite
      end
    end

    def before_example
      container = SS::EsSupport.docker_container
      return if container.present? # already running

      ENV["ES_CONTAINER_ID"].try do |container_id|
        if container_id.present?
          container = Docker::Container.get(container_id) rescue nil
        end
        if container
          SS::EsSupport.docker_container_borrowed = true
          SS::EsSupport.docker_container = container
          es_port = container.info["HostConfig"]["PortBindings"]["9200/tcp"][0]["HostPort"].to_i
          SS::EsSupport.es_port = es_port

          puts "use container '#{container.id[0, 12]}' listening on #{es_port}"
        end
      end

      container = SS::EsSupport.docker_container
      return if container.present? # already running

      image_id = SS::EsSupport.docker_image_id
      image = Docker::Image.get(image_id) rescue nil
      if image.blank?
        puts "image '#{image_id}' is not found"
        return
      end

      es_port = SS::EsSupport.es_port
      container = Docker::Container.create(
        'Image' => image_id,
        'ExposedPorts' => { '9200/tcp' => {} },
        'Env' => %w(discovery.type=single-node),
        'HostConfig' => {
          'PortBindings' => {
            '9200/tcp' => [{ 'HostPort' => es_port.to_s }]
          }
        }
      )

      container.start
      Timeout.timeout(60) do
        loop do
          break if container.logs(stdout: true).include?("Cluster health status changed from [YELLOW] to [GREEN]")

          sleep 0.1
        end
      end

      SS::EsSupport.docker_container_borrowed = false
      SS::EsSupport.docker_container = container
      puts "image '#{image_id}' successfully launched as container '#{container.id[0, 12]}' listening on #{es_port}"
    rescue => e
      puts "#{e}: failed to start '#{SS::EsSupport.docker_image_id}'"
      puts container.logs(stdout: true) if container
      raise
    end

    def after_example
    end

    def after_suite
      container = SS::EsSupport.docker_container
      return if container.blank?

      SS::EsSupport.docker_container = nil
      unless SS::EsSupport.docker_container_borrowed
        container.stop
        container.delete(force: true)
        puts "container '#{container.id[0, 12]}' is deleted"
      end
    end

    module Hooks
      def self.extended(obj)
        obj.class_eval do
          delegate :es_url, to: ::SS::EsSupport
        end

        obj.before(:example) do
          SS::EsSupport.before_example

          if site.elasticsearch_hosts.blank?
            site.elasticsearch_hosts = SS::EsSupport.es_url
            site.save!
          end
        end
        obj.after(:example) do
          SS::EsSupport.after_example
        end
      end
    end
  end
end

SS::EsSupport.init


text:
<?php

return [
    /**
     * The main language of the application, the lines of this language will be
     * filled by the exact key values by default.
     */
    'base_language' => 'en',

    /**
     * PHP function we'll be looking for in your project files to collect
     * un-translated keys.
     */
    'localization_methods' => ['__'],

    /**
     * Configurations for the route group that serves the Langman Controller.
     */
    'route_group_config' => [
        'middleware' => ['web'],
        'namespace' => 'Themsaid\LangmanGUI'
    ]
];


text:
@class ResignManager;

@interface AppDelegate : NSObject <NSApplicationDelegate>

@property (weak) IBOutlet NSTextField *SelectedIPATextField;
@property (weak) IBOutlet NSComboBox *CertificateComboBox;
@property (weak) IBOutlet NSTextField *ProvisioningProfileTextField;
@property (weak) IBOutlet NSTextField *IPAOutputPathTextField;
@property (weak) IBOutlet NSTextField *StatusTextField;
@property (weak) IBOutlet NSProgressIndicator *ResignProgressIndicator;
@property (weak) IBOutlet NSButton *DetailsBtn;

- (IBAction)onSelectIPABtnClick:(id)sender;
- (IBAction)onIPAOutputBtnClick:(id)sender;
- (IBAction)onCertificateComboBoxSelected:(id)sender;
- (IBAction)onSelectProvisioningProfileBtnClick:(id)sender;

- (IBAction)onDetailsBtnClick:(id)sender;

- (IBAction)onResignBtnClick:(id)sender;

@end


text:
'use strict';

import axios from 'axios';
import cheerio from 'cheerio';
import randomUA from 'random-ua';

import { stripCommas } from './utils';

/**
 * A method to scrape forex from www.xe.com
 * @param  String amount
 * @param  String base
 * @return String
 */
async function convertForex(amount, fromCurrency, toCurrency) {
  try {
    const response = await axios.get(`http://www.xe.com/currencyconverter/convert/?Amount=${amount}&From=${fromCurrency}&To=${toCurrency}`, {
      headers: {
        'User-Agent': randomUA.generate(),
      },
    });
    const {
      data,
    } = response;
    const $ = cheerio.load(data);
    const result = $('span.uccResultAmount').text().replace('GHS', '').replace(/\s\s*$/, '');
    const a = {
      amount: result,
      exchangeRate: Number(stripCommas(result.toString()) / stripCommas(amount.toString())).toFixed(2),
    };

    return a;
  } catch (error) {
    throw error;
  }
}

const ref = {
  amount: null,
  from: 'USD',
  to: 'EUR',
};

async function to(currency) {
  if (currency && typeof currency === 'string' && currency.length === 3) {
    ref.to = currency;
    const res = await convertForex(ref.amount, ref.from, ref.to);
    return res;
  }
  throw new Error('Please pass a valid ISO Currency code.');
}

function from(currency) {
  if (currency && typeof currency === 'string' && currency.length === 3) {
    ref.from = currency;
    return {
      to,
    };
  }
  throw new Error('Please pass a valid ISO Currency code.');
}

export default function Forex(amount) {
  if (amount && Number(amount)) {
    ref.amount = amount;
    return {
      from,
    };
  }
  throw new Error('Please pass a valid amount.');
}


text:
package com.sequenceiq.datalake.job;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.util.Collections;
import java.util.Optional;

import javax.inject.Inject;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import com.sequenceiq.cloudbreak.api.endpoint.v4.autoscales.AutoscaleV4Endpoint;
import com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status;
import com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response;
import com.sequenceiq.cloudbreak.client.CloudbreakInternalCrnClient;
import com.sequenceiq.cloudbreak.client.CloudbreakServiceCrnEndpoints;
import com.sequenceiq.cloudbreak.event.ResourceEvent;
import com.sequenceiq.cloudbreak.quartz.statuschecker.service.StatusCheckerJobService;
import com.sequenceiq.datalake.entity.DatalakeStatusEnum;
import com.sequenceiq.datalake.entity.SdxCluster;
import com.sequenceiq.datalake.entity.SdxStatusEntity;
import com.sequenceiq.datalake.job.SdxClusterStatusCheckerJobTest.TestAppContext;
import com.sequenceiq.datalake.repository.SdxClusterRepository;
import com.sequenceiq.datalake.service.sdx.status.SdxStatusService;
import com.sequenceiq.flow.core.FlowLogService;

import io.opentracing.Tracer;

@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = TestAppContext.class)
class SdxClusterStatusCheckerJobTest {

    private static final Long SDX_ID = 456L;

    private static final Long STACK_ID = 123L;

    @Inject
    private SdxClusterStatusCheckerJob underTest;

    @Inject
    private StatusCheckerJobService jobService;

    @MockBean
    private SdxClusterRepository sdxClusterRepository;

    @MockBean
    private CloudbreakInternalCrnClient cloudbreakInternalCrnClient;

    @MockBean
    private SdxStatusService sdxStatusService;

    @MockBean
    private Tracer tracer;

    @MockBean
    private FlowLogService flowLogService;

    @Mock
    private CloudbreakServiceCrnEndpoints cloudbreakServiceCrnEndpoints;

    @Mock
    private AutoscaleV4Endpoint autoscaleV4Endpoint;

    @Mock
    private JobExecutionContext jobExecutionContext;

    private SdxCluster sdxCluster;

    private StackStatusV4Response stack;

    private SdxStatusEntity status;

    private JobDataMap jobDataMap;

    @BeforeEach
    void setUp() {
        underTest.setLocalId(SDX_ID.toString());
        underTest.setRemoteResourceCrn(STACK_ID.toString());

        sdxCluster = new SdxCluster();
        sdxCluster.setClusterName("data-lake-cluster");
        when(sdxClusterRepository.findById(SDX_ID)).thenReturn(Optional.of(sdxCluster));

        stack = new StackStatusV4Response();
        when(cloudbreakInternalCrnClient.withInternalCrn()).thenReturn(cloudbreakServiceCrnEndpoints);
        when(cloudbreakServiceCrnEndpoints.autoscaleEndpoint()).thenReturn(autoscaleV4Endpoint);
        when(autoscaleV4Endpoint.getStatusByCrn(STACK_ID.toString())).thenReturn(stack);

        status = new SdxStatusEntity();
        status.setDatalake(sdxCluster);
        when(sdxStatusService.getActualStatusForSdx(sdxCluster)).thenReturn(status);

        jobDataMap = new JobDataMap();
        when(jobExecutionContext.getMergedJobDataMap()).thenReturn(jobDataMap);

        when(flowLogService.isOtherFlowRunning(any())).thenReturn(false);
    }

    @Test
    public void doNotExecuteTracedJobWhenThereIsARunningFlow() {
        JobExecutionContext context = Mockito.mock(JobExecutionContext.class);
        when(flowLogService.isOtherFlowRunning(any())).thenReturn(true);
        underTest.executeTracedJob(context);
        verify(cloudbreakInternalCrnClient, times(0)).withInternalCrn();
    }

    @Test
    void available() throws JobExecutionException {
        setUpSdxStatus(DatalakeStatusEnum.RUNNING);
        stack.setStatus(Status.AVAILABLE);

        underTest.executeTracedJob(jobExecutionContext);

        verify(sdxStatusService, never()).setStatusForDatalakeAndNotify(any(), any(ResourceEvent.class), anyString(), eq(sdxCluster));
    }

    @Test
    void ambiguousToClusterUnreachable() throws JobExecutionException {
        setUpSdxStatus(DatalakeStatusEnum.CLUSTER_AMBIGUOUS);
        stack.setStatus(Status.UNREACHABLE);
        stack.setStatusReason("connection failure");

        underTest.executeTracedJob(jobExecutionContext);

        verify(sdxStatusService, times(1)).setStatusForDatalakeAndNotify(eq(DatalakeStatusEnum.CLUSTER_UNREACHABLE),
                eq(ResourceEvent.CLUSTER_AMBARI_CLUSTER_SYNCHRONIZED),
                any(),
                eq("connection failure"),
                eq(sdxCluster));
    }

    @Test
    void ambiguousToNodeFailure() throws JobExecutionException {
        setUpSdxStatus(DatalakeStatusEnum.CLUSTER_AMBIGUOUS);
        stack.setStatus(Status.NODE_FAILURE);
        stack.setStatusReason("cm agent down");

        underTest.executeTracedJob(jobExecutionContext);

        verify(sdxStatusService, times(1)).setStatusForDatalakeAndNotify(eq(DatalakeStatusEnum.NODE_FAILURE),
                eq(ResourceEvent.CLUSTER_AMBARI_CLUSTER_SYNCHRONIZED),
                any(),
                eq("cm agent down"),
                eq(sdxCluster));
    }

    @Test
    void runningToDeletedOnProviderSide() throws JobExecutionException {
        setUpSdxStatus(DatalakeStatusEnum.RUNNING);
        stack.setStatus(Status.DELETED_ON_PROVIDER_SIDE);

        underTest.executeTracedJob(jobExecutionContext);

        verify(sdxStatusService, times(1)).setStatusForDatalakeAndNotify(eq(DatalakeStatusEnum.DELETED_ON_PROVIDER_SIDE),
                eq(ResourceEvent.SDX_CLUSTER_DELETED_ON_PROVIDER_SIDE),
                eq(""),
                eq(sdxCluster));
        verify(jobService, times(1)).scheduleLongIntervalCheck(any(), any());
    }

    @Test
    void deletedOnProviderSideToRunning() throws JobExecutionException {
        setUpSdxStatus(DatalakeStatusEnum.DELETED_ON_PROVIDER_SIDE);
        stack.setStatus(Status.AVAILABLE);
        stack.setClusterStatus(Status.AVAILABLE);
        jobDataMap.put(StatusCheckerJobService.SYNC_JOB_TYPE, StatusCheckerJobService.LONG_SYNC_JOB_TYPE);

        underTest.executeTracedJob(jobExecutionContext);

        verify(sdxStatusService, times(1)).setStatusForDatalakeAndNotify(eq(DatalakeStatusEnum.RUNNING),
                eq(ResourceEvent.CLUSTER_AMBARI_CLUSTER_SYNCHRONIZED),
                eq(Collections.singleton("data-lake-cluster")),
                eq(""),
                eq(sdxCluster));
        verify(jobService, times(1)).schedule(any(), any());
    }

    @Test
    void longSyncJobShouldntChangeScheduleWhenDeletedOnProviderSide() throws JobExecutionException {
        setUpSdxStatus(DatalakeStatusEnum.DELETED_ON_PROVIDER_SIDE);
        stack.setStatus(Status.DELETED_ON_PROVIDER_SIDE);
        jobDataMap.put(StatusCheckerJobService.SYNC_JOB_TYPE, StatusCheckerJobService.LONG_SYNC_JOB_TYPE);

        underTest.executeTracedJob(jobExecutionContext);

        verify(sdxStatusService, times(0)).setStatusForDatalakeAndNotify(any(), any(), any(), any(), eq(sdxCluster));
        verify(jobService, times(0)).schedule(any());
        verify(jobService, times(0)).scheduleLongIntervalCheck(any());
    }

    @Test
    void deletedOnProviderSideToDeleted() throws JobExecutionException {
        setUpSdxStatus(DatalakeStatusEnum.DELETED_ON_PROVIDER_SIDE);
        stack.setStatus(Status.DELETE_COMPLETED);
        jobDataMap.put(StatusCheckerJobService.SYNC_JOB_TYPE, StatusCheckerJobService.LONG_SYNC_JOB_TYPE);

        underTest.executeTracedJob(jobExecutionContext);

        verify(sdxStatusService, times(1)).setStatusForDatalakeAndNotify(eq(DatalakeStatusEnum.STACK_DELETED),
                eq(ResourceEvent.SDX_CLUSTER_DELETION_FINISHED),
                eq(""),
                eq(sdxCluster));
        verify(jobService, times(1)).unschedule(any());
    }

    @Test
    void stoppedToRunning() throws JobExecutionException {
        setUpSdxStatus(DatalakeStatusEnum.STOPPED);
        stack.setStatus(Status.AVAILABLE);
        stack.setClusterStatus(Status.AVAILABLE);

        underTest.executeTracedJob(jobExecutionContext);

        verify(sdxStatusService, times(1)).setStatusForDatalakeAndNotify(eq(DatalakeStatusEnum.RUNNING),
                eq(ResourceEvent.CLUSTER_AMBARI_CLUSTER_SYNCHRONIZED),
                eq(Collections.singleton("data-lake-cluster")),
                eq(""),
                eq(sdxCluster));
    }

    private void setUpSdxStatus(DatalakeStatusEnum status) {
        this.status.setStatus(status);
    }

    @Configuration
    @Import(SdxClusterStatusCheckerJob.class)
    @PropertySource("classpath:application.yml")
    static class TestAppContext {

        @MockBean
        private StatusCheckerJobService jobService;

    }
}


text:
<?php

namespace Controller;

interface UserControllerInterface {}

?>


text:
@class SHCDocument;
@class SHCReceipt;

@interface SHCModelManager : NSObject

@property (strong, nonatomic, readonly) NSManagedObjectContext *managedObjectContext;

+ (instancetype)sharedManager;

- (void)updateRootResourceWithAttributes:(NSDictionary *)attributes;
- (void)updateBankAccountWithAttributes:(NSDictionary *)attributes;
- (void)updateCardAttributes:(NSDictionary *)attributes;
- (void)updateDocumentsInFolderWithName:(NSString *)folderName attributes:(NSDictionary *)attributes;
- (void)updateDocument:(SHCDocument *)document withAttributes:(NSDictionary *)attributes;
- (void)deleteDocument:(SHCDocument *)document;
- (void)updateReceiptsInMailboxWithDigipostAddress:(NSString *)digipostAddress attributes:(NSDictionary *)attributes;
- (void)deleteReceipt:(SHCReceipt *)receipt;
- (void)deleteAllObjects;
- (NSEntityDescription *)rootResourceEntity;
- (NSEntityDescription *)mailboxEntity;
- (NSEntityDescription *)folderEntity;
- (NSEntityDescription *)documentEntity;
- (NSEntityDescription *)attachmentEntity;
- (NSEntityDescription *)invoiceEntity;
- (NSEntityDescription *)receiptEntity;
- (NSDate *)rootResourceCreatedAt;
- (void)logExecuteFetchRequestWithError:(NSError *)error;
- (void)logSavingManagedObjectContextWithError:(NSError *)error;

@end


text:
apt-get update
apt-get install -y redis-server

# Show versions
dpkg -la | grep redis-server


text:
<md-dialog class="quota-dialog">
  <md-dialog-content>

Upgrade to premium

      You've reached your quota limit. To enable unlimited files, please upgrade to a premium account.

  </md-dialog-content>
  <md-dialog-actions>
    <md-button ng-click="close()" class="md-primary">
      Close
    </md-button>
    <md-button ng-click="$emit('clUpgradeToPremium')" class="md-primary">
      Go premium
    </md-button>
  </md-dialog-actions>
</md-dialog>


text:
/*
 * SVG Step Chart
 * @Version:1.1.0
 * @CreatedOn:13-Sep-2016
 * @Author:SmartChartsNXT
 * @description: SVG Step Chart, that support multiple series, and zoom window.
 * @JSFiddle:
 * @Sample caller code::

  SmartChartsNXT.ready(function(){
    let stepChart = new SmartChartsNXT.StepChart({
      "title":"Multi Series Chart",
      "subTitle":"Step Chart",
      "targetElem":"chartContainer",
      "canvasBorder":false,
      "bgColor":"none",
      "showLegend":true,
      "noRiser":false,
      "showAreaOffset":true,
      "animated": true,
      "hideHorizontalScroller":false,
      "toolTip":{
        "content":'
'+
              '
{{point.series.name}} has produces
' +
              '
a total Sales of Rs. {{point.value}}
'+
              '
on {{point.label}}
' +
              '
'
      },
      "dataSet":{
        "xAxis":{
          "title":"Date"
        },
        "yAxis":{
          "title":"Total Sales",
          "prefix":"Rs. "
        },
        "series":[
          {
            "lineWidth":2,
            "color":"#FFC107",
            "name": 'Raphael',
            "data": [
              {label:"Jan",value:"2311"},{label:"Feb",value:"553"},{label:"Mar",value:"196"},{label:"Apr",value:"4422"},
              {label:"May",value:"3312"},{label:"Jun",value:"663"},{label:"Jul",value:"9663"},{label:"Aug",value:"114"},
              {label:"Sep",value:"2231"},{label:"Oct",value:"55"},{label:"Nov",value:"274"},{label:"Dec",value:"3467"}
            ]
          },
          {
            "lineWidth":2,
            "color":"#F44336",
            "areaOpacity":"0.5",
            "name": 'Wilson',
            "data": [
              {label:"Jan",value:"6446"},{label:"Feb",value:"333"},{label:"Mar",value:"470"},{label:"Apr",value:"8472"},
              {label:"May",value:"1212"},{label:"Jun",value:"6446"},{label:"Jul",value:"8472"},{label:"Aug",value:"114"},
              {label:"Sep",value:"432"},{label:"Oct",value:"3543"},{label:"Nov",value:"114"},{label:"Dec",value:"333"}
            ]
          }
        ]
      },
      events: {
          afterRender: function (e) {
            console.log(e, "event after rendering complete");
          },
          onInit: function (e) {
            console.log(e, "event onInit");
          },
          afterParseData: function (e) {
            console.log(e, "event afterParseData");
          },
          beforeSave: function (e) {
            console.log(e, "event beforeSave");
          },
          afterSave: function (e) {
            console.log(e, "event afterSave");
          },
            beforePrint: function (e) {
            console.log(e, "event beforePrint");
          },
          afterPrint: function (e) {
            console.log(e, "event afterPrint");
          }
        },
        zoomWindow:{
          "leftIndex":10,
          "rightIndex":20
        }
    });
  });

 */

"use strict";

let CoordinateChart = require("./../../base/coordinateChart");
let Point = require("./../../core/point");
let HorizontalScroller = require("./../../components/horizontalScroller");
let ZoomOutBox = require("./../../components/zoomOutBox");

class StepChart extends CoordinateChart {

  constructor(opts) {
    super(opts);
    try {
      let self = this;
      this.CHART_DATA = this.util.extends({
        chartCenter: 0,
        maxima: 0,
        minima: 0,
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 0,
        gridBoxWidth: 0,
        gridBoxHeight: 0,
        hScrollBoxHeight: opts.hideHorizontalScroller ? 0 : 60,
        fullSeries: [],
        fsScaleX: 0,
        vLabelWidth: 70,
        hLabelHeight: 80,
        windowLeftIndex: 0,
        windowRightIndex: -1,
        longestSeries: 0,
        series: [],
        mouseDown: 0,
        newDataSet: [],
        newCatgList: [],
        zoomOutBoxWidth: 40,
        zoomOutBoxHeight: 40
      }, this.CHART_DATA);

      this.CHART_OPTIONS = this.util.extends({}, this.CHART_OPTIONS);
      this.CHART_CONST = this.util.extends({
        FIX_WIDTH: 800,
        FIX_HEIGHT: 600,
        MIN_WIDTH: 250,
        MIN_HEIGHT: 400,
        hGridCount: 9
      }, this.CHART_CONST);

      this.EVENT_BINDS = {
        onLegendClickBind: self.onLegendClick.bind(self),
        onMouseMoveBind: self.onMouseMove.bind(self),
        onMouseLeaveBind: self.onMouseLeave.bind(self),
        onZoomOutBind: self.onZoomOut.bind(self),
        onWindowResizeBind: self.onWindowResize.bind(self, self.init),
        onHTextLabelHoverBind: self.onHTextLabelHover.bind(self),
        onHTextLabelMouseLeaveBind: self.onHTextLabelMouseLeave.bind(self),
        onLeftSliderMoveBind: self.onLeftSliderMove.bind(self),
        onRightSliderMoveBind: self.onRightSliderMove.bind(self),
        onHorizontalScrollBind: self.onHorizontalScroll.bind(self)
      };
      this.init();

      if (this.CHART_OPTIONS.animated !== false) {
        this.showAnimatedView();
      }
    } catch (ex) {
      ex.errorIn = `Error in StepChart with runId:${this.getRunId()}`;
      this.showErrorScreen(opts, ex, ex.errorIn);
      throw ex;
    }
  }

  init() {
    super.initBase();
    this.initDataSet();
    this.CHART_DATA.chartCenter = new Point(this.CHART_DATA.svgCenter.x, this.CHART_DATA.svgCenter.y + 50);
    this.CHART_DATA.marginLeft = ((-1) * this.CHART_DATA.scaleX / 2) + 100;
    this.CHART_DATA.marginRight = ((-1) * this.CHART_DATA.scaleX / 2) + 20;
    this.CHART_DATA.marginTop = ((-1) * this.CHART_DATA.scaleY / 2) + 120;
    this.CHART_DATA.marginBottom = ((-1) * this.CHART_DATA.scaleY / 2) + this.CHART_DATA.hScrollBoxHeight + 90;

    let longestSeries = 0;
    let longSeriesLen = 0;
    for (let index = 0; index < this.CHART_OPTIONS.dataSet.series.length; index++) {

      if (this.CHART_OPTIONS.dataSet.series[index].data.length > longSeriesLen) {
        longestSeries = index;
        longSeriesLen = this.CHART_OPTIONS.dataSet.series[index].data.length;
      }
    }
    this.CHART_DATA.longestSeries = longestSeries;

    /* Will set initial zoom window */
    if (this.CHART_OPTIONS.zoomWindow) {
      if (this.CHART_OPTIONS.zoomWindow.leftIndex && this.CHART_OPTIONS.zoomWindow.leftIndex >= 0 && (this.CHART_OPTIONS.zoomWindow.leftIndex * 2) < (longSeriesLen * 2) - 1) {
        this.CHART_DATA.windowLeftIndex = this.CHART_OPTIONS.zoomWindow.leftIndex * 2;
      }
      if (this.CHART_OPTIONS.zoomWindow.rightIndex && (this.CHART_OPTIONS.zoomWindow.rightIndex * 2) > (this.CHART_OPTIONS.zoomWindow.leftIndex * 2) && (this.CHART_OPTIONS.zoomWindow.rightIndex * 2) <= (longSeriesLen * 2) - 1) {
        this.CHART_DATA.windowRightIndex = this.CHART_OPTIONS.zoomWindow.rightIndex * 2;
      } else {
        this.CHART_DATA.windowRightIndex = (longSeriesLen * 2) - 1;
      }
    } else {
      this.CHART_DATA.windowRightIndex = (longSeriesLen * 2) - 1;
    }

    this.prepareChart();
    this.tooltip.createTooltip(this);
  } /*End init()*/

  initDataSet() {
    this.CHART_DATA.fullSeries = [];
    this.CHART_DATA.series = [];
    this.CHART_DATA.newDataSet = [];
    this.CHART_DATA.newCatgList = [];
    this.CHART_DATA.windowLeftIndex = 0;
    this.CHART_DATA.windowRightIndex = -1;
  } /*End initDataSet()*/

  prepareChart() {
    this.prepareDataSet();
    let strSVG = "";
    strSVG += "<g>";
    strSVG += "  <text id='txtTitleGrp' fill='#717171' font-family='Lato' >";
    strSVG += "    <tspan id='txtTitle' x='" + (100 / this.CHART_CONST.FIX_WIDTH * this.CHART_OPTIONS.width) + "' y='" + (50 / this.CHART_CONST.FIX_HEIGHT * this.CHART_OPTIONS.height) + "' font-size='20'><\/tspan>";
    strSVG += "    <tspan id='txtSubtitle' x='125' y='80' font-size='13'><\/tspan>";
    strSVG += "  <\/text>";
    strSVG += "<\/g>";

    strSVG += "<g id='legendContainer'>";
    strSVG += "<\/g>";

    strSVG += "<g id='verticalLabelContainer'>";
    strSVG += "<\/g>";

    strSVG += "<g id='horizontalLabelContainer'>";
    strSVG += "<\/g>";

    strSVG += "<g id='scrollerCont'>";
    strSVG += "</g>";

    strSVG += "<path id='hLine' fill='none' stroke='#333' stroke-width='1' opacity='1' pointer-events='none'></path>";
    strSVG += "<path id='vLine' fill='none' stroke='#333' stroke-width='1' opacity='1' pointer-events='none'></path>";
    this.CHART_DATA.chartSVG.insertAdjacentHTML("beforeend", strSVG);

    /*Set Title of chart*/
    this.CHART_DATA.chartSVG.querySelector("#txtTitleGrp #txtTitle").textContent = this.CHART_OPTIONS.title;
    this.CHART_DATA.chartSVG.querySelector("#txtSubtitle").textContent = this.CHART_OPTIONS.subTitle;

    for (let index = 0; index < this.CHART_OPTIONS.dataSet.series.length; index++) {
      this.appendGradFill(index);
    }

    this.CHART_DATA.gridBoxWidth = (this.CHART_DATA.svgCenter.x * 2) - this.CHART_DATA.marginLeft - this.CHART_DATA.marginRight;
    this.CHART_DATA.gridBoxHeight = (this.CHART_DATA.svgCenter.y * 2) - this.CHART_DATA.marginTop - this.CHART_DATA.marginBottom;
    this.CHART_DATA.gridHeight = (((this.CHART_DATA.svgCenter.y * 2) - this.CHART_DATA.marginTop - this.CHART_DATA.marginBottom) / (this.CHART_CONST.hGridCount - 1));

    this.grid.createGrid(this, this.CHART_DATA.chartSVG, this.CHART_DATA.marginLeft, this.CHART_DATA.marginTop, this.CHART_DATA.gridBoxWidth, this.CHART_DATA.gridBoxHeight, this.CHART_DATA.gridHeight, this.CHART_CONST.hGridCount);

    if (!this.CHART_OPTIONS.hideHorizontalScroller) {
      this.prepareFullSeriesDataset();
      this.hScroller = new HorizontalScroller(this,
        this.CHART_DATA.chartSVG,
        "scrollerCont",
        this.CHART_DATA.marginLeft,
        this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight + this.CHART_DATA.hLabelHeight,
        this.CHART_DATA.gridBoxWidth,
        this.CHART_DATA.hScrollBoxHeight
      );

      /* ploting full series actual points */
      for (let index = 0; index < this.CHART_DATA.fullSeries.length; index++) {
        this.drawFullSeries(this.CHART_DATA.fullSeries[index], index);
      }
    }

    /*Creating horizontal and vertical subtitles*/
    strSVG = "<text id='hTextSubTitle' fill='#717171' font-family='Lato'  x='" + (this.CHART_DATA.marginLeft + (this.CHART_DATA.gridBoxWidth / 2) - 30) + "' y='" + (this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight + 70) + "' font-size='18' >" + this.CHART_OPTIONS.dataSet.xAxis.title + "<\/text>";
    strSVG += "<text id='vTextSubTitle' fill='#717171' font-family='Lato'  x='" + (this.CHART_DATA.marginLeft - 30) + "' y='" + (this.CHART_DATA.marginTop + (this.CHART_DATA.gridBoxHeight / 2) - 5) + "' font-size='18' >" + this.CHART_OPTIONS.dataSet.yAxis.title + "<\/text>";
    this.CHART_DATA.chartSVG.insertAdjacentHTML("beforeend", strSVG);

    if (this.hScroller) {
      this.zoomOutBox = new ZoomOutBox(
        this,
        this.CHART_DATA.chartSVG,
        this.CHART_DATA.marginTop - this.CHART_DATA.zoomOutBoxHeight,
        this.CHART_DATA.marginLeft + this.CHART_DATA.gridBoxWidth - this.CHART_DATA.zoomOutBoxWidth,
        this.CHART_DATA.zoomOutBoxWidth,
        this.CHART_DATA.zoomOutBoxHeight
      );
    }

    this.reDrawSeries();

    if (this.hScroller) {
      this.hScroller.resetSliderPos("left", this.CHART_DATA.fullSeries[this.CHART_DATA.longestSeries][this.CHART_DATA.windowLeftIndex].x);
      this.hScroller.resetSliderPos("right", this.CHART_DATA.fullSeries[this.CHART_DATA.longestSeries][this.CHART_DATA.windowRightIndex].x);
    }
  } /*End prepareChart()*/

  prepareFullSeriesDataset() {
    let scaleX = this.CHART_DATA.fsScaleX = (this.CHART_DATA.gridBoxWidth / this.CHART_OPTIONS.dataSet.series[this.CHART_DATA.longestSeries].data.length);
    let scaleYfull = (this.CHART_DATA.hScrollBoxHeight / this.CHART_DATA.maxima);

    for (let index = 0; index < this.CHART_OPTIONS.dataSet.series.length; index++) {
      let arrPointsSet = [];
      let d = [];
      let dataSet = this.CHART_OPTIONS.dataSet.series[index].data;
      for (let dataCount = 0; dataCount < dataSet.length; dataCount++) {
        let p1 = new Point(this.CHART_DATA.marginLeft + (dataCount * scaleX), ((this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight + this.CHART_DATA.hScrollBoxHeight + this.CHART_DATA.hLabelHeight) - (dataSet[dataCount].value * scaleYfull) + (this.CHART_DATA.minima * scaleYfull)));
        let p2 = new Point(this.CHART_DATA.marginLeft + (dataCount * scaleX) + (scaleX), ((this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight + this.CHART_DATA.hScrollBoxHeight + this.CHART_DATA.hLabelHeight) - (dataSet[dataCount].value * scaleYfull) + (this.CHART_DATA.minima * scaleYfull)));
        d.push(!dataCount ? "M" : "L");
        d.push.apply(d, [p1.x, p1.y, "L", p2.x, p2.y]);
        arrPointsSet.push(p1);
        arrPointsSet.push(p2);
      }
      this.CHART_DATA.fullSeries.push(arrPointsSet);
    }
  } /* End prepareFullSeriesDataset() */

  drawFullSeries(arrPointsSet, index) {
    let line = [];
    let strSeries = "<g id='fullSeries_" + index + "' class='fullSeries'>";
    line.push.apply(line, ["M", arrPointsSet[0].x, arrPointsSet[0].y]);
    for (var dataCount = 1; dataCount < arrPointsSet.length; dataCount++) {
      line.push.apply(line, ["L", arrPointsSet[dataCount].x, arrPointsSet[dataCount].y]);
    }
    strSeries += "<path id='fLine_" + index + "' stroke='#000' fill='none' d='" + line.join(" ") + "' stroke-width='1' opacity='0.6'></path>";
    strSeries += "<g>";
    let hChartScrollerCont = this.CHART_DATA.chartSVG.querySelector("#scrollerCont #hChartScrollerCont");
    if (hChartScrollerCont) {
      hChartScrollerCont.insertAdjacentHTML("beforeend", strSeries);
    }
  } /*End drawFullSeries()*/

  prepareDataSet(dataSet) {
    let self = this;
    let maxSet = [];
    let minSet = [];
    let categories = [];
    dataSet = dataSet || this.CHART_OPTIONS.dataSet.series;

    for (let i = 0; i < dataSet.length; i++) {
      let arrData = [];
      for (let j = 0; j < dataSet[i].data.length; j++) {
        arrData.push(dataSet[i].data[j].value);
        if (j > categories.length - 1) {
          categories.push(dataSet[i].data[j].label);
        }
      }
      let maxVal = Math.max.apply(null, arrData);
      let minVal = Math.min.apply(null, arrData);
      maxSet.push(maxVal);
      minSet.push(minVal);
      dataSet[i].color = dataSet[i].color || this.util.getColor(i);
    }
    this.CHART_OPTIONS.dataSet.xAxis.categories = categories;
    this.CHART_DATA.maxima = Math.max.apply(null, maxSet);
    this.CHART_DATA.minima = Math.min.apply(null, minSet);
    this.CHART_DATA.maxima = this.round(this.CHART_DATA.maxima);

    //fire Event afterParseData
    let afterParseDataEvent = new this.event.Event("afterParseData", {
      srcElement: self
    });
    this.event.dispatchEvent(afterParseDataEvent);
  } /*End prepareDataSet()*/

  createSeries(dataSet, index, scaleX) {
    let d = [];
    let area = [];
    let elemSeries = this.CHART_DATA.chartSVG.querySelector("#series_area_" + index);
    let elemActualSeries = this.CHART_DATA.chartSVG.querySelector("#series_actual_" + index);
    if (elemSeries) {
      elemSeries.parentNode.removeChild(elemSeries);
    }
    if (elemActualSeries) {
      elemActualSeries.parentNode.removeChild(elemActualSeries);
    }

    if (dataSet.length < 1) {
      return void 0;
    }

    let interval = scaleX || (this.CHART_DATA.gridBoxWidth / (dataSet.length));
    let scaleY = (this.CHART_DATA.gridBoxHeight / this.CHART_DATA.maxima);
    let arrPointsSet = [];

    /* ploting actual points */
    let strSeries = "<g id='series_actual_" + index + "' class='series' pointer-events='none'>";
    for (let dataCount = 0; dataCount < dataSet.length; dataCount++) {
      let p1 = new Point(this.CHART_DATA.marginLeft + (dataCount * interval) + 1, ((this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight) - (dataSet[dataCount].value * scaleY)));
      let p2 = new Point(this.CHART_DATA.marginLeft + (dataCount * interval) + (interval) + 1, ((this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight) - (dataSet[dataCount].value * scaleY)));
      if (dataCount === 0) {
        d.push("M");
        area.push("M");
      } else if (this.CHART_OPTIONS.noRiser) {
        d.push("M");
        area.push("L");
      } else {
        d.push("L");
        area.push("L");
      }

      d.push.apply(d, [p1.x, p1.y, "L", p2.x, p2.y]);
      area.push.apply(area, [p1.x, p1.y, "L", p2.x, p2.y]);
      arrPointsSet.push(p1);
      arrPointsSet.push(p2);
    }

    this.CHART_DATA.series.push(arrPointsSet);
    let color = this.CHART_OPTIONS.dataSet.series[index].color || this.util.getColor(index);
    let strokeWidth = this.CHART_OPTIONS.dataSet.series[index].lineWidth || 2;
    let areaOpacity = this.CHART_OPTIONS.dataSet.series[index].areaOpacity || 0.2;

    strSeries += "<path stroke='" + color + "' fill='none' d='" + d.join(" ") + "' stroke-width='" + strokeWidth + "' opacity='1' shape-rendering='optimizeSpeed'></path>";
    strSeries += "</g>";
    this.CHART_DATA.chartSVG.insertAdjacentHTML("beforeend", strSeries);

    if (this.CHART_OPTIONS.noAreaOffset) {
      color = "none";
    }
    if (dataSet.length > 10) {
      strSeries = "<g id='series_area_" + index + "' class='series' pointer-events='none'>";
      if (dataSet.length > 2) {
        area.push.apply(area, ["L", arrPointsSet[arrPointsSet.length - 1].x, (this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight), arrPointsSet[0].x, (this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight)], "Z");
      }
      strSeries += "<path id='area_" + index + "' fill='" + color + "' d='" + area.join(" ") + "' stroke-width='" + strokeWidth + "' stroke='none'opacity='" + areaOpacity + "'></path>";
    } else {
      strSeries = "<g id='series_area_" + index + "' class='columns series' pointer-events='none'>";
      let colHalfWidth = (interval) / 2;
      for (let dataCount = 0; dataCount < dataSet.length; dataCount++) {
        let p = new Point(this.CHART_DATA.marginLeft + (dataCount * interval) + (interval / 2) + 1, ((this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight) - (dataSet[dataCount].value * scaleY)));
        let col = [
          "M", p.x - colHalfWidth, p.y,
          "L", p.x + colHalfWidth, p.y,
          "L", p.x + colHalfWidth, (this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight),
          "L", p.x - colHalfWidth, (this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight),
          "Z"
        ];
        strSeries += "<path id='column_" + index + "_" + dataCount + "' stroke='" + color + "'  fill='" + color + "' d='" + col.join(" ") + "' stroke-width='1' opacity='" + ((dataCount + 1) * 0.1) + "'></path>";
      }
    }
    strSeries += "</g>";
    this.CHART_DATA.chartSVG.insertAdjacentHTML("beforeend", strSeries);
  } /*End createSeries()*/

  appendGradFill(index) {
    /*Creating gradient fill for area*/
    let color = this.CHART_OPTIONS.dataSet.series[index].color || this.util.getColor(index);
    let areaOpacity = this.CHART_OPTIONS.dataSet.series[index].areaOpacity || 0.5;
    let strSVG = "";
    strSVG += "<defs>";
    strSVG += "  <linearGradient gradientUnits = 'userSpaceOnUse' id='" + this.CHART_OPTIONS.targetElem + "-stepchart-gradLinear" + index + "' x1='0%' y1='0%' x2='100%' y2='0%'>";
    strSVG += "  <stop offset='0%' style='stop-color:white;stop-opacity:" + areaOpacity + "' />";
    strSVG += "  <stop offset='100%' style='stop-color:" + color + ";stop-opacity:" + areaOpacity + "' />";
    strSVG += "  </linearGradient>";
    strSVG += "</defs>";
    this.CHART_DATA.chartSVG.insertAdjacentHTML("beforeend", strSVG);
  } /*End appendGradFill()*/

  resetTextPositions(categories) {
    let txtTitleLen = this.CHART_DATA.chartSVG.querySelector("#txtTitleGrp #txtTitle").getComputedTextLength();
    let txtSubTitleLen = this.CHART_DATA.chartSVG.querySelector("#txtTitleGrp #txtSubtitle").getComputedTextLength();
    let txtTitleGrp = this.CHART_DATA.chartSVG.querySelector("#txtTitleGrp");

    if (txtTitleLen > this.CHART_CONST.FIX_WIDTH) {
      let fontSize = this.CHART_DATA.chartSVG.querySelector("#txtTitleGrp #txtTitle").getAttribute("font-size");
      this.CHART_DATA.chartSVG.querySelector("#txtTitleGrp #txtTitle").setAttribute("font-size", fontSize - 5);
      this.CHART_DATA.chartSVG.querySelector("#txtTitleGrp #txtTitle").getComputedTextLength();
      fontSize = this.CHART_DATA.chartSVG.querySelector("#txtTitleGrp #txtSubtitle").getAttribute("font-size");
      this.CHART_DATA.chartSVG.querySelector("#txtTitleGrp #txtSubtitle").setAttribute("font-size", fontSize - 3);
      txtSubTitleLen = this.CHART_DATA.chartSVG.querySelector("#txtTitleGrp #txtSubtitle").getComputedTextLength();
    }

    txtTitleGrp.querySelector("#txtTitle").setAttribute("x", (this.CHART_DATA.svgCenter.x - (txtTitleLen / 2)));
    txtTitleGrp.querySelector("#txtTitle").setAttribute("y", 70);
    txtTitleGrp.querySelector("#txtSubtitle").setAttribute("x", (this.CHART_DATA.svgCenter.x - (txtSubTitleLen / 2)));
    txtTitleGrp.querySelector("#txtSubtitle").setAttribute("y", 90);

    let vTxtSubTitle = this.CHART_DATA.chartSVG.querySelector("#vTextSubTitle");
    vTxtSubTitle.setAttribute("transform", "matrix(0,-1,1,0," + (this.CHART_DATA.marginLeft - this.CHART_DATA.vLabelWidth - 10) + "," + (this.CHART_DATA.svgCenter.y) + ")");
    vTxtSubTitle.setAttribute("x", 0);
    vTxtSubTitle.setAttribute("y", 0);

  } /*End resetTextPositions()*/

  bindEvents() {
    let gridRect = this.CHART_DATA.chartSVG.querySelector("#gridRect");
    if (gridRect) {
      gridRect.removeEventListener("mousemove", this.EVENT_BINDS.onMouseMoveBind);
      gridRect.addEventListener("mousemove", this.EVENT_BINDS.onMouseMoveBind, false);
      gridRect.removeEventListener("click", this.EVENT_BINDS.onMouseMoveBind);
      gridRect.addEventListener("click", this.EVENT_BINDS.onMouseMoveBind, false);
      gridRect.removeEventListener("mousleave", this.EVENT_BINDS.onMouseLeaveBind);
      gridRect.addEventListener("mouseleave", this.EVENT_BINDS.onMouseLeaveBind, false);
    }

    /*Add events for onZoomOut */
    this.event.off("onZoomOut", this.EVENT_BINDS.onZoomOutBind);
    this.event.on("onZoomOut", this.EVENT_BINDS.onZoomOutBind);

    /*Add events for Horizontal Text label hover */
    this.event.off("onHTextLabelHover", this.EVENT_BINDS.onHTextLabelHoverBind);
    this.event.on("onHTextLabelHover", this.EVENT_BINDS.onHTextLabelHoverBind);
    this.event.off("onHTextLabelMouseLeave", this.EVENT_BINDS.onHTextLabelMouseLeaveBind);
    this.event.on("onHTextLabelMouseLeave", this.EVENT_BINDS.onHTextLabelMouseLeaveBind);

    /*Add events for Horizontal chart scroller */
    this.event.off("onLeftSliderMove", this.EVENT_BINDS.onLeftSliderMoveBind);
    this.event.on("onLeftSliderMove", this.EVENT_BINDS.onLeftSliderMoveBind);
    this.event.off("onRightSliderMove", this.EVENT_BINDS.onRightSliderMoveBind);
    this.event.on("onRightSliderMove", this.EVENT_BINDS.onRightSliderMoveBind);
    this.event.off("onHorizontalScroll", this.EVENT_BINDS.onHorizontalScrollBind);
    this.event.on("onHorizontalScroll", this.EVENT_BINDS.onHorizontalScrollBind);

    /*Add events for legends to show/hide a series */
    this.event.off("onLegendClick", this.EVENT_BINDS.onLegendClickBind);
    this.event.on("onLegendClick", this.EVENT_BINDS.onLegendClickBind);

    /*Add events for resize chart window */
    window.removeEventListener('resize', this.EVENT_BINDS.onWindowResizeBind);
    window.addEventListener('resize', this.EVENT_BINDS.onWindowResizeBind, true);

  } /*End bindEvents()*/

  onHTextLabelHover(e) {
    let mousePointer = this.ui.cursorPoint(this.CHART_OPTIONS.targetElem, e.originEvent);
    this.tooltip.updateTip(mousePointer, "#555", e.originEvent.target.getAttribute("title"));
  } /*End onHTextLabelHover() */

  onHTextLabelMouseLeave(e) {
    this.tooltip.hide();
  } /*End onHTextLabelMouseLeave()*/

  onMouseMove(e) {
    try {
      e.stopPropagation();
      let mousePointer = this.ui.cursorPoint(this.CHART_OPTIONS.targetElem, e);
      let gridBox = this.CHART_DATA.chartSVG.querySelector("#hGrid").getBBox();
      if (mousePointer.x >= gridBox.x && mousePointer.x < (gridBox.x + this.CHART_DATA.gridBoxWidth) && mousePointer.y >= gridBox.y && mousePointer.y < (gridBox.y + this.CHART_DATA.gridBoxHeight)) {
        let multiSeriesPoints = [];
        for (let i = 0; i < this.CHART_DATA.series.length; i++) {
          if (!this.CHART_DATA.chartSVG.querySelector("#series_area_" + i) || this.CHART_DATA.chartSVG.querySelector("#series_area_" + i).style.display === "none") {
            continue;
          }
          for (let j = 0; j < this.CHART_DATA.series[i].length - 1; j++) {
            if (mousePointer.x > this.CHART_DATA.series[i][j].x && mousePointer.x < this.CHART_DATA.series[i][j + 1].x) {
              multiSeriesPoints.push({
                seriesIndex: i,
                pointIndex: j + 1,
                point: this.CHART_DATA.series[i][j + 1]
              });
            }
          }
          if (mousePointer.x < this.CHART_DATA.series[i][0].x) {
            multiSeriesPoints.push({
              seriesIndex: i,
              pointIndex: 0,
              point: this.CHART_DATA.series[i][0]
            });
          }
        }
        if (multiSeriesPoints.length === 0) {
          return;
        }

        let toolTipPoint, npIndex, indx;
        for (let i = 0; i < multiSeriesPoints.length; i++) {
          if (mousePointer.y > multiSeriesPoints[i].point.y || this.CHART_DATA.series.length === 1) {
            toolTipPoint = multiSeriesPoints[i].point;
            npIndex = multiSeriesPoints[i].pointIndex;
            indx = multiSeriesPoints[i].seriesIndex;
          }
        }
        if (!indx && multiSeriesPoints.length > 0) {
          toolTipPoint = multiSeriesPoints[0].point;
          npIndex = multiSeriesPoints[0].pointIndex;
          indx = multiSeriesPoints[0].seriesIndex;
        }

        if (npIndex % 2 === 0) {
          toolTipPoint = new Point((this.CHART_DATA.series[indx][npIndex].x + this.CHART_DATA.series[indx][npIndex + 1].x) / 2, toolTipPoint.y);
        } else {
          toolTipPoint = new Point((this.CHART_DATA.series[indx][npIndex].x + this.CHART_DATA.series[indx][npIndex - 1].x) / 2, toolTipPoint.y);
        }

        /*Create vertical line*/
        let vLinePath = ["M", toolTipPoint.x, toolTipPoint.y, "L", toolTipPoint.x, this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight];
        let vLine = this.CHART_DATA.chartSVG.querySelector("#vLine");
        if (vLine) {
          vLine.setAttribute("d", vLinePath.join(" "));
          vLine.parentNode.removeChild(vLine);
          this.CHART_DATA.chartSVG.appendChild(vLine);
        }

        if (toolTipPoint) {
          let elms = this.CHART_DATA.chartSVG.querySelectorAll(".tooTipPoint");
          for (let i = 0; i < elms.length; i++) {
            elms[i].parentNode.removeChild(elms[i]);
          }

          let color = this.CHART_OPTIONS.dataSet.series[indx].color || this.util.getColor(indx);
          let radius = this.CHART_OPTIONS.dataSet.series[indx].markerRadius || 4;
          this.geom.createDot(toolTipPoint, "#FFF", (radius + 2), 1, "tooTipPoint", this.CHART_DATA.chartSVG, color);
          this.geom.createDot(toolTipPoint, color, radius, 1, "tooTipPoint", this.CHART_DATA.chartSVG);

          let toolTipRow1, toolTipRow2;
          toolTipRow1 = (this.CHART_OPTIONS.dataSet.xAxis.title + " " + this.CHART_DATA.newCatgList[Math.ceil((npIndex - 1) / 2)]);
          toolTipRow2 = (this.CHART_OPTIONS.dataSet.yAxis.title + " " + (this.CHART_OPTIONS.dataSet.yAxis.prefix || "") + " " + this.CHART_DATA.newDataSet[indx].data[Math.ceil((npIndex - 1) / 2)].value);

          /*point should be available globally*/
          var point = this.CHART_DATA.newDataSet[indx].data[Math.ceil((npIndex - 1) / 2)];
          point["series"] = {
            name: this.CHART_OPTIONS.dataSet.series[indx].name
          };

          if (this.CHART_OPTIONS.toolTip && this.CHART_OPTIONS.toolTip.content) {
            let toolTipContent = this.CHART_OPTIONS.toolTip.content.replace(/{{/g, "${").replace(/}}/g, "}");
            let genContent = this.util.assemble(toolTipContent, "point");
            this.tooltip.updateTip(toolTipPoint, color, genContent(point), "html");
          } else {
            this.tooltip.updateTip(toolTipPoint, color, toolTipRow1, toolTipRow2);
          }

          this.CHART_DATA.chartSVG.querySelector("#vLine").style.display = "block";
        }
      }
    } catch (ex) {
      ex.errorIn = `Error in StepChart with runId:${this.getRunId()}`;
      throw ex;
    }
  } /*End onMouseMove()*/

  onMouseLeave() {
    this.tooltip.hide();
    this.CHART_DATA.chartSVG.querySelectorAll(".tooTipPoint");
    let elms = this.CHART_DATA.chartSVG.querySelectorAll(".tooTipPoint");
    for (let i = 0; i < elms.length; i++) {
      elms[i].parentNode.removeChild(elms[i]);
    }

    let vLine = this.CHART_DATA.chartSVG.querySelector("#vLine");
    if (vLine) {
      vLine.style.display = "none";
    }

  } /*End onMouseLeave()*/

  onLegendClick(e) {
    let seriesIndex = e.legendIndex;
    let areaBorder = this.CHART_DATA.chartSVG.querySelector("#series_area_" + seriesIndex);
    let areaActual = this.CHART_DATA.chartSVG.querySelector("#series_actual_" + seriesIndex);
    let color = e.legendData.color;
    let doShow = e.toggeled ? "none" : "block";
    if (areaBorder) {
      areaBorder.style.display = doShow;
    }
    if (areaActual) {
      areaActual.style.display = doShow;
    }
  } /*End onLegendClick()*/

  onHorizontalScroll(e) {
    if (this.CHART_DATA.windowLeftIndex > 0 || this.CHART_DATA.windowRightIndex < this.CHART_DATA.fullSeries[this.CHART_DATA.longestSeries].length - 1) {
      this.zoomOutBox.show();
    } else {
      this.zoomOutBox.hide();
    }
  }

  onLeftSliderMove(e) {
    let sliderPos = e.sliderPosition;
    for (let j = 0; j < this.CHART_DATA.fullSeries[this.CHART_DATA.longestSeries].length - 1; j++) {
      if (sliderPos.x >= this.CHART_DATA.fullSeries[this.CHART_DATA.longestSeries][j].x && sliderPos.x <= this.CHART_DATA.fullSeries[this.CHART_DATA.longestSeries][j + 1].x) {
        this.CHART_DATA.windowLeftIndex = j;
      }
    }
    this.reDrawSeries();
  } /*End onLeftSliderMove()*/

  onRightSliderMove(e) {
    let sliderPos = e.sliderPosition;
    for (let j = 1; j < this.CHART_DATA.fullSeries[this.CHART_DATA.longestSeries].length; j++) {
      if (sliderPos.x >= this.CHART_DATA.fullSeries[this.CHART_DATA.longestSeries][j - 1].x && sliderPos.x <= this.CHART_DATA.fullSeries[this.CHART_DATA.longestSeries][j].x) {
        this.CHART_DATA.windowRightIndex = j;
      }
    }
    this.reDrawSeries();
  } /*End onRightSliderMove()*/

  reDrawSeries() {
    let self = this;
    this.CHART_DATA.newDataSet = [];
    this.CHART_DATA.newCatgList = [];
    let scaleX = this.CHART_DATA.gridBoxWidth / this.CHART_OPTIONS.dataSet.series[this.CHART_DATA.longestSeries].data.slice(Math.ceil(this.CHART_DATA.windowLeftIndex / 2), Math.ceil((this.CHART_DATA.windowRightIndex) / 2)).length;
    for (let i = this.CHART_DATA.windowLeftIndex; i <= this.CHART_DATA.windowRightIndex; i++) {
      this.CHART_DATA.newCatgList.push(this.CHART_OPTIONS.dataSet.xAxis.categories[i % this.CHART_OPTIONS.dataSet.xAxis.categories.length]);
    }

    for (let setIndex = 0; setIndex < this.CHART_OPTIONS.dataSet.series.length; setIndex++) {
      let set = {};
      for (let key in this.CHART_OPTIONS.dataSet.series[setIndex]) {
        if (key === "data") {
          set["data"] = this.CHART_OPTIONS.dataSet.series[setIndex].data.slice(Math.ceil(this.CHART_DATA.windowLeftIndex / 2), Math.ceil((this.CHART_DATA.windowRightIndex) / 2));
        } else {
          set[key] = JSON.parse(JSON.stringify(this.CHART_OPTIONS.dataSet.series[setIndex][key]));
        }
      }
      this.CHART_DATA.newDataSet.push(set);
    }
    this.prepareDataSet(this.CHART_DATA.newDataSet);

    this.vLabel.createVerticalLabel(this,
      "verticalLabelContainer",
      this.CHART_DATA.marginLeft,
      this.CHART_DATA.marginTop,
      this.CHART_DATA.maxima,
      0,
      this.CHART_DATA.vLabelWidth,
      this.CHART_DATA.gridHeight,
      this.CHART_CONST.hGridCount,
      this.CHART_OPTIONS.dataSet.yAxis.prefix
    );

    this.hLabel.createHorizontalLabel(this,
      "horizontalLabelContainer",
      this.CHART_DATA.marginLeft,
      this.CHART_DATA.marginTop + this.CHART_DATA.gridBoxHeight,
      this.CHART_DATA.gridBoxWidth,
      this.CHART_DATA.hLabelHeight,
      this.CHART_OPTIONS.dataSet.xAxis.categories,
      scaleX
    );

    this.CHART_DATA.series = [];
    let legendSet = [];
    for (let i = 0; i < this.CHART_DATA.newDataSet.length; i++) {
      this.createSeries(this.CHART_DATA.newDataSet[i].data, i, scaleX);
      if (this.CHART_OPTIONS.showLegend) {
        legendSet.push({
          label: self.CHART_DATA.newDataSet[i].name,
          value: "",
          color: self.CHART_DATA.newDataSet[i].color
        });
      }
    }
    this.legendBox.createLegends(this, "legendContainer", {
      left: self.CHART_DATA.marginLeft,
      top: self.CHART_DATA.marginTop - 35,
      legendSet: legendSet,
      type: "horizontal",
      border: false,
      isToggleType: true
    });

    this.resetTextPositions(this.CHART_OPTIONS.dataSet.xAxis.categories);
    this.bindEvents();
    this.onMouseLeave();
    this.render();
  } /*End reDrawSeries()*/

  onZoomOut(e) {
    this.CHART_DATA.windowLeftIndex = 0;
    this.CHART_DATA.windowRightIndex = (this.CHART_OPTIONS.dataSet.series[this.CHART_DATA.longestSeries].data.length * 2) - 1;
    this.hScroller.resetSliderPos("left", this.CHART_DATA.fullSeries[this.CHART_DATA.longestSeries][this.CHART_DATA.windowLeftIndex].x);
    this.hScroller.resetSliderPos("right", this.CHART_DATA.fullSeries[this.CHART_DATA.longestSeries][this.CHART_DATA.windowRightIndex].x);
    this.reDrawSeries();
  } /*End onZoomOut()*/

  round(val) {
    val = Math.round(val);
    let digitCount = val.toString().length;
    let nextVal = Math.pow(10, digitCount - 1);
    let roundVal = Math.ceil(val / nextVal) * nextVal;
    if (val < roundVal / 2) {
      return roundVal / 2;
    } else {
      return roundVal;
    }
  } /*End round()*/

  showAnimatedView() {
    let dataSet = [];
    let self = this;
    let scaleX = this.CHART_DATA.gridBoxWidth / this.CHART_OPTIONS.dataSet.series[this.CHART_DATA.longestSeries].data.slice(Math.ceil(this.CHART_DATA.windowLeftIndex / 2), Math.ceil((this.CHART_DATA.windowRightIndex) / 2)).length;
    let pointIndex = 0;

    for (let i = 0; i < this.CHART_OPTIONS.dataSet.series.length; i++) {
      let set = {
        "data": this.CHART_OPTIONS.dataSet.series[i].data.slice(Math.ceil(this.CHART_DATA.windowLeftIndex / 2), Math.ceil((this.CHART_DATA.windowRightIndex) / 2))
      };
      dataSet.push(set);
    }
    this.prepareDataSet(dataSet);
    this.CHART_DATA.series = [];

    let maxLen = 0;
    for (let i = 0; i < dataSet.length; i++) {
      let len = dataSet[i].data.length;
      if (len > maxLen) {
        maxLen = len;
      }
    }

    /*if there is more than 50 points then skip the animation*/
    if (maxLen > 50) {
      pointIndex = maxLen;
    }
    let timoutId = setInterval(function () {

      for (let index = 0; index < dataSet.length; index++) {
        self.createSeries(dataSet[index].data.slice(0, pointIndex), index, scaleX);
      }

      if (pointIndex === maxLen) {
        clearInterval(timoutId);
        self.reDrawSeries();
      }
      pointIndex++;
    }, 50);
  } /*End showAnimatedView()*/

} /*End of StepChart()*/

module.exports = StepChart;


text:
#ifndef _LINUX_THREADS_H
#define _LINUX_THREADS_H
#define NR_CPUS 1
#define MIN_THREADS_LEFT_FOR_ROOT 4
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000)
#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 :   (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
#endif


text:
#pragma once
#include <aws/snowball/Snowball_EXPORTS.h>
#include <aws/snowball/model/WirelessConnection.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace Snowball
{
namespace Model
{

  /**
   *
Specifies the device configuration for an Snowcone job.

See
   * Also:
   AWS
   * API Reference

   */
  class AWS_SNOWBALL_API SnowconeDeviceConfiguration
  {
  public:
    SnowconeDeviceConfiguration();
    SnowconeDeviceConfiguration(Aws::Utils::Json::JsonView jsonValue);
    SnowconeDeviceConfiguration& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
Configures the wireless connection for the Snowcone device.

     */
    inline const WirelessConnection& GetWirelessConnection() const{ return m_wirelessConnection; }

    /**
     *
Configures the wireless connection for the Snowcone device.

     */
    inline bool WirelessConnectionHasBeenSet() const { return m_wirelessConnectionHasBeenSet; }

    /**
     *
Configures the wireless connection for the Snowcone device.

     */
    inline void SetWirelessConnection(const WirelessConnection& value) { m_wirelessConnectionHasBeenSet = true; m_wirelessConnection = value; }

    /**
     *
Configures the wireless connection for the Snowcone device.

     */
    inline void SetWirelessConnection(WirelessConnection&& value) { m_wirelessConnectionHasBeenSet = true; m_wirelessConnection = std::move(value); }

    /**
     *
Configures the wireless connection for the Snowcone device.

     */
    inline SnowconeDeviceConfiguration& WithWirelessConnection(const WirelessConnection& value) { SetWirelessConnection(value); return *this;}

    /**
     *
Configures the wireless connection for the Snowcone device.

     */
    inline SnowconeDeviceConfiguration& WithWirelessConnection(WirelessConnection&& value) { SetWirelessConnection(std::move(value)); return *this;}

  private:

    WirelessConnection m_wirelessConnection;
    bool m_wirelessConnectionHasBeenSet = false;
  };

} // namespace Model
} // namespace Snowball
} // namespace Aws


text:
require 'spec_helper'

describe GoogleApps::ClientLogin do
  let(:client) { GoogleApps::ClientLogin.new(domain: 'example.com') }

  before do
    stub_request(:post, "https://www.google.com/accounts/ClientLogin").
        with(:body => {"Email" => "joe@example.com", "Passwd" => "p4ssw0rd", "accountType" => "HOSTED", "service" => "apps"},
             :headers => {'Content-Type' => 'application/x-www-form-urlencoded'}).
        to_return(body: "auth=best-token-ever")
    client.authenticate!('joe@example.com', 'p4ssw0rd')
  end

  it_should_behave_like :google_client

  it "sets the right auth headers for ClientLogin" do
    stub = stub_request(:get, "http://someurl.com/path/").
        with(:headers => {'Authorization' => 'GoogleLogin auth=best-token-ever'})
    client.make_request(:get, 'http://someurl.com/path/')
    stub.should have_been_requested
  end
end


text:
export interface TabClasses {
    /** Styles applied to the root element. */
    root: string;
    /** Styles applied to the root element if both `icon` and `label` are provided. */
    labelIcon: string;
    /** Styles applied to the root element if the parent [`Tabs`](/api/tabs/) has `textColor="inherit"`. */
    textColorInherit: string;
    /** Styles applied to the root element if the parent [`Tabs`](/api/tabs/) has `textColor="primary"`. */
    textColorPrimary: string;
    /** Styles applied to the root element if the parent [`Tabs`](/api/tabs/) has `textColor="secondary"`. */
    textColorSecondary: string;
    /** State class applied to the root element if `selected={true}` (controlled by the Tabs component). */
    selected: string;
    /** State class applied to the root element if `disabled={true}` (controlled by the Tabs component). */
    disabled: string;
    /** Styles applied to the root element if `fullWidth={true}` (controlled by the Tabs component). */
    fullWidth: string;
    /** Styles applied to the root element if `wrapped={true}`. */
    wrapped: string;
}
export declare type TabClassKey = keyof TabClasses;
export declare function getTabUtilityClass(slot: string): string;
declare const tabClasses: TabClasses;
export default tabClasses;


text:
\begin{quote}test test
test

\end{quote}
\begin{quote}test
test
test

\end{quote}
test

>this is not a quote


text:
<?php

if( !defined( 'ABSPATH') ) exit();

class RevSliderElementsBase {

	protected $db;

	public function __construct(){

		$this->db = new RevSliderDB();
	}

}

/**
 * old classname extends new one (old classnames will be obsolete soon)
 * @since: 5.0
 **/
class UniteElementsBaseRev extends RevSliderElementsBase {}
?>


text:
package Google::Ads::AdWords::v201809::ExemptionRequest;
use strict;
use warnings;

__PACKAGE__->_set_element_form_qualified(1);

sub get_xmlns { 'https://adwords.google.com/api/adwords/cm/v201809' };

our $XML_ATTRIBUTE_CLASS;
undef $XML_ATTRIBUTE_CLASS;

sub __get_attr_class {
    return $XML_ATTRIBUTE_CLASS;
}

use Class::Std::Fast::Storable constructor => 'none';
use base qw(Google::Ads::SOAP::Typelib::ComplexType);

{ # BLOCK to scope variables

my %key_of :ATTR(:get<key>);

__PACKAGE__->_factory(
    [ qw(        key

    ) ],
    {
        'key' => \%key_of,
    },
    {
        'key' => 'Google::Ads::AdWords::v201809::PolicyViolationKey',
    },
    {

        'key' => 'key',
    }
);

} # end BLOCK

1;

=pod

=head1 NAME

Google::Ads::AdWords::v201809::ExemptionRequest

=head1 DESCRIPTION

Perl data type class for the XML Schema defined complexType
ExemptionRequest from the namespace https://adwords.google.com/api/adwords/cm/v201809.

A request to be exempted from a {@link PolicyViolationError}.

=head2 PROPERTIES

The following properties may be accessed using get_PROPERTY / set_PROPERTY
methods:

=over

=item * key

=back

=head1 METHODS

=head2 new

Constructor. The following data structure may be passed to new():

=head1 AUTHOR

Generated by SOAP::WSDL

=cut


text:
        How SaveSnap for Snapchat works:

        When you receive a snap from the Snapchat, Launch SaveSnap for Snapchat.

        After successful login you can see the list of the snaps you have received.

        Tap the one (which has available to download status) you wish to view and wait until fetch is finished.

        After download is complete, you can view the snap as many times as you want and share it directly to social networks or wave to the library.

        Please note! If you open the message in the Snapchat first, you will not be able to save the content in SaveSnap for Snapchat.


text:
package com.pengrad.telegrambot.model.request;

import java.io.Serializable;

public class InputInvoiceMessageContent extends InputMessageContent implements Serializable {

    private final static long serialVersionUID = 0L;

    private String title;
    private String description;

    private String payload;
    private String provider_token;

    private String currency;
    private LabeledPrice[] prices;

    private Integer max_tip_amount;
    private Integer[] suggested_tip_amount;

    private String provider_data;

    private String photo_url;
    private Integer photo_size;
    private Integer photo_width;
    private Integer photo_height;

    private boolean need_name;
    private boolean need_phone_number;
    private boolean need_email;
    private boolean need_shipping_address;
    private boolean send_phone_number_to_provider;
    private boolean send_email_to_provider;

    private boolean is_flexible;

    public InputInvoiceMessageContent(String title, String description, String payload, String providerToken, String currency, LabeledPrice[] prices) {
        this.title = title;
        this.description = description;
        this.payload = payload;
        this.provider_token = providerToken;
        this.currency = currency;
        this.prices = prices;
    }

    public InputInvoiceMessageContent maxTipAmount(Integer maxTipAmount) {
        this.max_tip_amount = maxTipAmount;
        return this;
    }

    public InputInvoiceMessageContent suggestedTipAmount(Integer[] suggestedTipAmount) {
        this.suggested_tip_amount = suggestedTipAmount;
        return this;
    }

    public InputInvoiceMessageContent providerData(String providerData) {
        this.provider_data = providerData;
        return this;
    }

    public InputInvoiceMessageContent photoUrl(String photoUrl) {
        this.photo_url = photoUrl;
        return this;
    }

    public InputInvoiceMessageContent photoSize(Integer photoSize) {
        this.photo_size = photoSize;
        return this;
    }

    public InputInvoiceMessageContent photoWidth(Integer photoWidth) {
        this.photo_width = photoWidth;
        return this;
    }

    public InputInvoiceMessageContent photoHeight(Integer photoHeight) {
        this.photo_height = photoHeight;
        return this;
    }

    public InputInvoiceMessageContent needName(boolean needName) {
        this.need_name = needName;
        return this;
    }

    public InputInvoiceMessageContent needPhoneNumber(boolean needPhoneNumber) {
        this.need_phone_number = needPhoneNumber;
        return this;
    }

    public InputInvoiceMessageContent needEmail(boolean needEmail) {
        this.need_email = needEmail;
        return this;
    }

    public InputInvoiceMessageContent needShippingAddress(boolean needShippingAddress) {
        this.need_shipping_address = needShippingAddress;
        return this;
    }

    public InputInvoiceMessageContent sendPhoneNumberToProvider(boolean sendPhoneNumberToProvider) {
        this.send_phone_number_to_provider = sendPhoneNumberToProvider;
        return this;
    }

    public InputInvoiceMessageContent sendEmailToProvider(boolean sendEmailToProvider) {
        this.send_email_to_provider = sendEmailToProvider;
        return this;
    }

    public InputInvoiceMessageContent isFlexible(boolean isFlexible) {
        this.is_flexible = isFlexible;
        return this;
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<ldswebml type="image" uri="/media-library/images/temples/brigham-city-utah#brigham-city-utah-temple-dedication-day-1027033" xml:lang="eng" locale="eng" status="publish" xmlns:its="http://www.w3.org/2005/11/its">
  <search-meta>
      <uri-title its:translate="no">brigham-city-utah-temple-dedication-day-1027033</uri-title>
      <source>brigham-city-utah-temple-dedication-day-1027033</source>
      <publication-type its:translate="no">image</publication-type>
      <media-type its:translate="no">image</media-type>
      <publication value="ldsorg">LDS.org</publication>
      <publication-date value="2012-12-14">2012-12-14</publication-date>
      <title/>
      <description/>
      <collections>
          <collection its:translate="no">global-search</collection>
          <collection its:translate="no">media</collection>
          <collection its:translate="no">images</collection>
      </collections>
      <subjects>
          <subject>Brigham City (Utah)</subject>
          <subject>Brigham City Utah Temple</subject>
          <subject>Casey</subject>
          <subject>Robert</subject>
          <subject>Exterior</subject>
          <subject>Temple Dedications</subject>
          <subject>Temples</subject>
          <subject>Temples -- Dedication services</subject>
      </subjects>
  </search-meta>
  <no-search>
      <path>http://media.ldscdn.org/images/media-library/temples/brigham-city-utah/brigham-city-utah-temple-dedication-day-1027033-gallery.jpg</path>
      <images>
          http://media.ldscdn.org/images/media-library/temples/brigham-city-utah/brigham-city-utah-temple-dedication-day-1027033-thumbnail.jpg
      </images>
          <download-urls>
              <download-url>
                  Mobile
                  <size>106 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/temples/brigham-city-utah/brigham-city-utah-temple-dedication-day-1027033-mobile.jpg</path>
              </download-url>
              <download-url>
                  Tablet
                  <size>145 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/temples/brigham-city-utah/brigham-city-utah-temple-dedication-day-1027033-tablet.jpg</path>
              </download-url>
          </download-urls>
  </no-search>
</ldswebml>