text:
package com.smalljellybean.listingworks.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.smalljellybean.listingworks.R;
import com.smalljellybean.listingworks.domain.Catalogue;
import com.yalantis.flipviewpager.adapter.BaseFlipAdapter;
import com.yalantis.flipviewpager.utils.FlipSettings;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class CatalogueAdapter extends BaseFlipAdapter<Catalogue> {

    private Context context;
    private final int PAGES = 3;
    private int[] IDS_INTEREST = {R.id.category_1, R.id.category_2, R.id.category_3, R.id.category_4, R.id.category_5};

    public CatalogueAdapter(Context context, List<Catalogue> items, FlipSettings settings) {
        super(context, items, settings);
        this.context = context;
    }

    @Override
    public View getPage(int position, View convertView, ViewGroup parent, Catalogue item1, Catalogue item2) {
        final CatalogueHolder holder;

        if (convertView == null) {
            holder = new CatalogueHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.catalogue_merge_page, parent, false);
            holder.leftCatalogue = (ImageView) convertView.findViewById(R.id.first);
            holder.rightCatalogue = (ImageView) convertView.findViewById(R.id.second);
            holder.infoPage = LayoutInflater.from(context).inflate(R.layout.catalogue_info, parent, false);
            holder.name = (TextView) holder.infoPage.findViewById(R.id.catalogue_name);

            for (int id : IDS_INTEREST)
                holder.categories.add((TextView) holder.infoPage.findViewById(id));

            convertView.setTag(holder);
        } else {
            holder = (CatalogueHolder) convertView.getTag();
        }

        switch (position) {
            case 1:
                holder.leftCatalogue.setImageResource(item1.getImageResId());
                if (item2 != null)
                    holder.rightCatalogue.setImageResource(item2.getImageResId());
                break;
            default:
                fillHolder(holder, position == 0 ? item1 : item2);
                holder.infoPage.setTag(holder);
                return holder.infoPage;
        }
        return convertView;
    }

    @Override
    public int getPagesCount() {
        return PAGES;
    }

    private void fillHolder(CatalogueHolder holder, Catalogue catalogue) {
        if (catalogue == null)
            return;
        Iterator<TextView> iViews = holder.categories.iterator();
        Iterator<String> iInterests = catalogue.getCategories().iterator();
        while (iViews.hasNext() && iInterests.hasNext())
            iViews.next().setText(iInterests.next());
        holder.infoPage.setBackgroundColor(context.getResources().getColor(catalogue.getBackground()));
        holder.name.setText(catalogue.getName());
    }

    class CatalogueHolder {
        ImageView leftCatalogue;
        ImageView rightCatalogue;
        View infoPage;

        List<TextView> categories = new ArrayList<>();
        TextView name;
    }
}


text:
import Ember from 'ember';

export default Ember.Object.extend({
  setVisitor: function(visitor) {
    window.Caliper.config.visitor = visitor;
  }
});

redpajama_set_name: RedPajamaGithub


text:
==================================================

## NAME

  service account

## SYNOPSIS

  Config Connector compatible YAML files to create a service account in your desired project, and grant a specific member a role (default to `roles/iam.serviceAccountKeyAdmin`) for accessing the service account that just created.

## CONSUMPTION

  1. Clone GoogleCloudPlatform/cloud-foundation-toolkit repository:

      ```bash
      git clone https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit.git
      ```

  1. Go to the service account folder:

      ```bash
      cd cloud-foundation-toolkit/config-connector/solutions/iam/helm/service-account
      ```

## REQUIREMENTS

1. GKE Cluster with Config Connector and [Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity#enable_workload_identity_on_a_new_cluster).
1. [Helm](../../../README.md#helm)

## USAGE

All steps are run from the current directory ([config-connector/solutions/iam/helm/service-account](.)).

1. Review and update the values in `./values.yaml`.

1. Validate and install the sample with Helm.

    ```bash
    # validate your chart
    helm lint . --set iamPolicyMember.iamMember=user:name@example.com

    # check the output of your chart
    helm template . --set iamPolicyMember.iamMember=user:name@example.com

    # Do a dryrun on your chart and address issues if there are any
    helm install . --dry-run --set iamPolicyMember.iamMember=user:name@example.com --generate-name

    # install your chart
    helm install . --set iamPolicyMember.iamMember=user:name@example.com --generate-name
    ```

1. _Optionally_, you can customize optional values by explicitly setting them when installing the solution:
    ```bash
    # install your chart with a new service account name
    helm install . --set serviceAccount.name=new-service-account,iamPolicyMember.iamMember=user:name@example.com --generate-name
    ```
    Or,
    ```bash
    # install your chart with a new role
    helm install . --set iamPolicyMember.role=roles/iam.serviceAccountTokenCreator,iamPolicyMember.iamMember=user:name@example.com --generate-name
    ```
    Or set them both in one command.

1. Check the created helm release to verify the installation:
    ```bash
    helm list
    ```
    Check the status of the service account resource by running:
    ```bash
    kubectl describe iamserviceaccount [service account name]
    ```
    Check the status of the IAM Policy Member:
    ```bash
    kubectl describe iampolicymember iampolicymember-service-account
    ```

1. Clean up the installation:

    ```bash
    # list Helm releases to obtain release name
    helm list

    # delete release specifying release name from the previous command output.
    helm delete [release_name]
    ```

## LICENSE

Apache 2.0 - See [LICENSE](/LICENSE) for more information.


text:
class Users::BaseController < ApplicationController
  before_action :require_user
  before_action :set_section

  private

  def require_user
    redirect_to root_path unless current_user.present?
  end

  def set_section
    @section = nil
  end
end


text:
CQGnuPlotMultiplot::
CQGnuPlotMultiplot(CQGnuPlot *plot) :
 CGnuPlotMultiplot(plot)
{
}

QString
CQGnuPlotMultiplot::
title() const
{
  return CGnuPlotMultiplot::title().c_str();
}

void
CQGnuPlotMultiplot::
setTitle(const QString &s)
{
  CGnuPlotMultiplot::setTitle(s.toStdString());
}

QFont
CQGnuPlotMultiplot::
titleFont() const
{
  return CQFontUtil::toQFont(CGnuPlotMultiplot::titleFont());
}

void
CQGnuPlotMultiplot::
setTitleFont(const QFont &f)
{
  CGnuPlotMultiplot::setTitleFont(CQFontUtil::fromQFont(f));
}


text:
/*****************************************************************************
*
* expini - ex_put_init
*
* author - Sandia National Laboratories
*          Larry A. Schoof - Original
*          James A. Schutt - 8 byte float and standard C definitions
*          Vic Yarberry    - Added headers and error logging
*
*
* environment - UNIX
*
* entry conditions -
*   input parameters:
*       int     exoid                   exodus file id
*       char*   title                   title of file
*       int     num_dim                 number of dimensions (per node)
*       int     num_nodes               number of nodes
*       int     num_elem                number of elements
*       int     num_elem_blk            number of element blocks
*       int     num_node_sets           number of node sets
*       int     num_side_sets           number of side sets
*
* exit conditions -
*
* revision history -
*
*  Id
*
*****************************************************************************/

#include "exodusII.h"
#include "exodusII_int.h"
#include <string.h>

/*
 * writes the initialization parameters to the EXODUS II file
 */

int ex_put_init (int   exoid,
                 const char *title,
                 int   num_dim,
                 int   num_nodes,
                 int   num_elem,
                 int   num_elem_blk,
                 int   num_node_sets,
                 int   num_side_sets)
{
  int numdimdim, numnoddim, elblkdim, strdim, dim[2], dimid, varid;

  char errmsg[MAX_ERR_LENGTH];

  exerrval = 0; /* clear error code */

  if ((ncdimid (exoid, DIM_NUM_DIM)) != -1)
    {
      exerrval = EX_MSG;
      sprintf(errmsg,
              "Error: initialization already done for file id %d",exoid);
      ex_err("ex_put_init",errmsg,exerrval);
      return (EX_FATAL);
    }

  /* put file into define mode */

  if (ncredef (exoid) == -1)
    {
      exerrval = ncerr;
      sprintf(errmsg,
              "Error: failed to put file id %d into define mode", exoid);
      ex_err("ex_put_init",errmsg,exerrval);
      return (EX_FATAL);
    }

  /* define some attributes... */

  if (ncattput (exoid, NC_GLOBAL, (const char*) ATT_TITLE,
                NC_CHAR, strlen(title)+1, (void *)title) == -1)
    {
      exerrval = ncerr;
      sprintf(errmsg,
              "Error: failed to define title attribute to file id %d", exoid);
      ex_err("ex_put_init",errmsg,exerrval);
      goto error_ret;         /* exit define mode and return */
    }

  /* ...and some dimensions... */

  if ((numdimdim = ncdimdef (exoid, DIM_NUM_DIM, (long)num_dim)) == -1)
    {
      exerrval = ncerr;
      sprintf(errmsg,
              "Error: failed to define number of dimensions in file id %d",exoid);
      ex_err("ex_put_init",errmsg,exerrval);
      goto error_ret;         /* exit define mode and return */
    }

  /*
   * Need to handle "empty file" that may be the result of a strange
   * load balance or some other strange run.  Note that if num_node
   * == 0, then num_elem must be zero since you cannot have elements
   * with no nodes. It *is* permissible to have zero elements with
   * non-zero node count.
   */

  if (num_nodes > 0) {
    if ((numnoddim = ncdimdef (exoid, DIM_NUM_NODES, (long)num_nodes)) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to define number of nodes in file id %d",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        goto error_ret;         /* exit define mode and return */
      }
  }

  if (num_elem > 0) {
    if (num_nodes <=  0) {
      exerrval = EX_MSG;
      sprintf(errmsg,
              "Error: Cannot have non-zero element count if node count is zero.in file id %d",exoid);
      ex_err("ex_put_init",errmsg,exerrval);
      goto error_ret;         /* exit define mode and return */
    }

    if ((ncdimdef (exoid, DIM_NUM_ELEM, (long)num_elem)) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to define number of elements in file id %d",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        goto error_ret;         /* exit define mode and return */
      }
  }

  /* Can have nonzero num_elem_blk even if num_elem == 0 */
  if (num_elem_blk > 0) {
    if ((elblkdim = ncdimdef (exoid, DIM_NUM_EL_BLK, (long)num_elem_blk)) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to define number of element blocks in file id %d",
                exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        goto error_ret;         /* exit define mode and return */
      }

    /* ...and some variables */

    /* element block id status array */

    dim[0] = elblkdim;
    if ((varid = ncvardef (exoid, VAR_STAT_EL_BLK, NC_LONG, 1, dim)) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to define element block status array in file id %d",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        goto error_ret;         /* exit define mode and return */
      }

#if 0
    /*   store property name as attribute of property array variable */
    if ((ncattput (exoid, varid, ATT_PROP_NAME, NC_CHAR, 7, "STATUS")) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to store element block property name %s in file id %d",
                "STATUS",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        return (EX_FATAL);
      }
#endif

    /* element block id array */

    if ((varid = ncvardef (exoid, VAR_ID_EL_BLK, NC_LONG, 1, dim)) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to define element block id array in file id %d",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        goto error_ret;         /* exit define mode and return */
      }

    /*   store property name as attribute of property array variable */
    if ((ncattput (exoid, varid, ATT_PROP_NAME, NC_CHAR, 3, "ID")) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to store element block property name %s in file id %d",
                "ID",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        return (EX_FATAL);
      }
  }

  /* node set id array: */

  if (num_node_sets > 0) {

    if ((dimid = ncdimdef (exoid, DIM_NUM_NS, (long)num_node_sets)) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to define number of node sets in file id %d",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        goto error_ret;         /* exit define mode and return */
      }

    /* node set id status array: */

    dim[0] = dimid;
    if ((varid = ncvardef (exoid, VAR_NS_STAT, NC_LONG, 1, dim)) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to create node sets status array in file id %d",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        goto error_ret;         /* exit define mode and return */
      }

#if 0
    /*   store property name as attribute of property array variable */
    if ((ncattput (exoid, varid, ATT_PROP_NAME, NC_CHAR, 7, "STATUS")) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to store node set property name %s in file id %d",
                "ID",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        return (EX_FATAL);
      }
#endif

    /* node set id array: */

    dim[0] = dimid;
    if ((varid = ncvardef (exoid, VAR_NS_IDS, NC_LONG, 1, dim)) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to create node sets property array in file id %d",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        goto error_ret;         /* exit define mode and return */
      }

    /*   store property name as attribute of property array variable */
    if ((ncattput (exoid, varid, ATT_PROP_NAME, NC_CHAR, 3, "ID")) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to store node set property name %s in file id %d",
                "ID",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        return (EX_FATAL);
      }

  }

  /* side set id array: */

  if (num_side_sets > 0) {

    if ((dimid = ncdimdef (exoid, DIM_NUM_SS, (long)num_side_sets)) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to define number of side sets in file id %d",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        goto error_ret;         /* exit define mode and return */
      }

    /* side set id status array: */

    dim[0] = dimid;
    if ((varid = ncvardef (exoid, VAR_SS_STAT, NC_LONG, 1, dim)) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to define side set status in file id %d",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        goto error_ret;         /* exit define mode and return */
      }

#if 0
    /*   store property name as attribute of property array variable */
    if ((ncattput (exoid, varid, ATT_PROP_NAME, NC_CHAR, 7, "STATUS")) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to store side set property name %s in file id %d",
                "ID",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        return (EX_FATAL);
      }
#endif

    /* side set id array: */

    if ((varid = ncvardef (exoid, VAR_SS_IDS, NC_LONG, 1, dim)) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to define side set property in file id %d",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        goto error_ret;         /* exit define mode and return */
      }

    /*   store property name as attribute of property array variable */
    if ((ncattput (exoid, varid, ATT_PROP_NAME, NC_CHAR, 3, "ID")) == -1)
      {
        exerrval = ncerr;
        sprintf(errmsg,
                "Error: failed to store side set property name %s in file id %d",
                "ID",exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        return (EX_FATAL);
      }

  }

  /*
   * To reduce the maximum dataset sizes, the storage of the nodal
   * coordinates and the nodal variables was changed from a single
   * dataset to a dataset per component or variable.  However, we
   * want to maintain some form of compatability with the old
   * exodusII version.  It is easy to do this on read; however, we
   * also want to be able to store in the old format using the new
   * library.
   *
   * The mode is set in the ex_create call. The setting can be checked
   * via the ATT_FILESIZE attribute in the file (1=large,
   * 0=normal). Also handle old files that do not contain this
   * attribute.
   */

  if (num_nodes > 0) {
    if (ex_large_model(exoid) == 1) {
      /* node coordinate arrays -- separate storage... */

      /*
       * Check that storage required for coordinates  is less
       * than 2GB which is maximum size permitted by netcdf
       * (in large file mode). 1<<29 == max number of integer items.
       */
      int shift = nc_flt_code(exoid) == NC_DOUBLE ? 28 : 29;
      if (num_nodes  > (1<<shift)) {
        exerrval = EX_BADPARAM;
        sprintf(errmsg,
                "Error: Size to store nodal coordinates exceeds 2GB in file id %d",
                exoid);
        ex_err("ex_put_init",errmsg,exerrval);
        return (EX_FATAL);
      }

      dim[0] = numnoddim;
      if (num_dim > 0) {
        if (ncvardef (exoid, VAR_COORD_X, nc_flt_code(exoid), 1, dim) == -1)
          {
            exerrval = ncerr;
            sprintf(errmsg,
                    "Error: failed to define node x coordinate array in file id %d",exoid);
            ex_err("ex_put_init",errmsg,exerrval);
            goto error_ret;         /* exit define mode and return */
          }
      }

      if (num_dim > 1) {
        if (ncvardef (exoid, VAR_COORD_Y, nc_flt_code(exoid), 1, dim) == -1)
          {
            exerrval = ncerr;
            sprintf(errmsg,
                    "Error: failed to define node y coordinate array in file id %d",exoid);
            ex_err("ex_put_init",errmsg,exerrval);
            goto error_ret;         /* exit define mode and return */
          }
      }

      if (num_dim > 2) {
        if (ncvardef (exoid, VAR_COORD_Z, nc_flt_code(exoid), 1, dim) == -1)
          {
            exerrval = ncerr;
            sprintf(errmsg,
                    "Error: failed to define node z coordinate array in file id %d",exoid);
            ex_err("ex_put_init",errmsg,exerrval);
            goto error_ret;         /* exit define mode and return */
          }
      }
    } else {
      /* node coordinate arrays: -- all stored together (old method) */

      dim[0] = numdimdim;
      dim[1] = numnoddim;
      if (ncvardef (exoid, VAR_COORD, nc_flt_code(exoid), 2, dim) == -1)
        {
          exerrval = ncerr;
          sprintf(errmsg,
                  "Error: failed to define node coordinate array in file id %d",exoid);
          ex_err("ex_put_init",errmsg,exerrval);
          goto error_ret;         /* exit define mode and return */
        }
    }
  }

  /* inquire previously defined dimensions  */
  if ((strdim = ncdimid (exoid, DIM_STR)) < 0)
    {
      exerrval = ncerr;
      sprintf(errmsg,
              "Error: failed to get string length in file id %d",exoid);
      ex_err("ex_put_init",errmsg,exerrval);
      goto error_ret;         /* exit define mode and return */
    }

  /* coordinate names array */

  dim[0] = numdimdim;
  dim[1] = strdim;

  if (ncvardef (exoid, VAR_NAME_COOR, NC_CHAR, 2, dim) == -1)
    {
      exerrval = ncerr;
      sprintf(errmsg,
              "Error: failed to define coordinate name array in file id %d",exoid);
      ex_err("ex_put_init",errmsg,exerrval);
      goto error_ret;         /* exit define mode and return */
    }

  /* leave define mode */
#if 1
  if (ncendef (exoid) == -1)
    {
      exerrval = ncerr;
      sprintf(errmsg,
              "Error: failed to complete variable definitions in file id %d",exoid);
      ex_err("ex_put_init",errmsg,exerrval);
      return (EX_FATAL);
    }

#else
  /* estimate (guess) size of header of netCDF file */
  header_size = 1200 +
    num_elem_blk * 800 +
    num_node_sets * 220 +
    num_side_sets * 300;

  if (header_size > MAX_HEADER_SIZE) header_size = MAX_HEADER_SIZE;

  /* estimate (guess) size of fixed size variable section of netCDF file */

  if (nc_flt_code(exoid) == NC_DOUBLE)
    iows = 8;
  else
    iows = 4;

  fixed_var_size = num_dim * num_nodes * iows +
    num_nodes * sizeof(int) +
    num_elem * 16 * sizeof(int) +
    num_elem_blk * sizeof(int) +
    num_node_sets * num_nodes/100 * sizeof(int) +
    num_node_sets * num_nodes/100 * iows +
    num_node_sets * sizeof(int) +
    num_side_sets * num_elem/100 * 2 * sizeof(int) +
    num_side_sets * num_elem/100 * iows +
    num_side_sets * sizeof(int);

  /* With netcdf-3.4, this produces very large files on the
   * SGI.  Also with netcdf-3.5beta3
   */
  /*
   * This is also causing other problems on other systems .. disable for now
   */
  if (nc__enddef (exoid,
                  header_size, NC_ALIGN_CHUNK,
                  fixed_var_size, NC_ALIGN_CHUNK) == -1)
    {
      exerrval = ncerr;
      sprintf(errmsg,
              "Error: failed to complete variable definitions in file id %d",exoid);
      ex_err("ex_put_init",errmsg,exerrval);
      return (EX_FATAL);
    }

#endif
  return (EX_NOERR);

  /* Fatal error: exit definition mode and return */
 error_ret:
  if (ncendef (exoid) == -1)     /* exit define mode */
    {
      sprintf(errmsg,
              "Error: failed to complete definition for file id %d",
              exoid);
      ex_err("ex_put_init",errmsg,exerrval);
    }
  return (EX_FATAL);
}


text:
package org.bdgenomics.adam.rdd.read

import com.esotericsoftware.kryo.{ Kryo, Serializer }
import com.esotericsoftware.kryo.io.{ Output, Input }
import org.bdgenomics.utils.misc.Logging
import org.apache.spark.rdd.RDD
import org.bdgenomics.adam.serialization.AvroSerializer
import org.bdgenomics.formats.avro.{
  AlignmentRecord,
  Fragment
}
import scala.collection.JavaConversions._

private class FragmentIterator(
    reads: Iterator[AlignmentRecord]) extends Iterator[Iterable[AlignmentRecord]] with Serializable {

  private var readIter: BufferedIterator[AlignmentRecord] = reads.buffered

  def hasNext: Boolean = {
    readIter.hasNext
  }

  def next: Iterable[AlignmentRecord] = {

    // get the read name
    val readName = readIter.head.getReadName

    // take the reads that have this read name
    readIter.takeWhile(_.getReadName == readName).toIterable
  }
}

/**
 * Companion object for building SingleReadBuckets.
 */
private[read] object SingleReadBucket extends Logging {

  private def fromGroupedReads(reads: Iterable[AlignmentRecord]): SingleReadBucket = {
    // split by mapping
    val (mapped, unmapped) = reads.partition(_.getReadMapped)
    val (primaryMapped, secondaryMapped) = mapped.partition(_.getPrimaryAlignment)

    // TODO: consider doing validation here
    // (e.g. read says mate mapped but it doesn't exist)
    new SingleReadBucket(primaryMapped, secondaryMapped, unmapped)
  }

  /**
   * Builds an RDD of SingleReadBuckets from a queryname sorted RDD of AlignmentRecords.
   *
   * @param rdd The RDD of AlignmentRecords to build the RDD of single read
   *   buckets from.
   * @return Returns an RDD of SingleReadBuckets.
   *
   * @note We do not validate that the input RDD is sorted by read name.
   */
  def fromQuerynameSorted(rdd: RDD[AlignmentRecord]): RDD[SingleReadBucket] = {
    rdd.mapPartitions(iter => new FragmentIterator(iter).map(fromGroupedReads))
  }

  /**
   * Builds an RDD of SingleReadBuckets from an RDD of AlignmentRecords.
   *
   * @param rdd The RDD of AlignmentRecords to build the RDD of single read
   *   buckets from.
   * @return Returns an RDD of SingleReadBuckets.
   */
  def apply(rdd: RDD[AlignmentRecord]): RDD[SingleReadBucket] = {
    rdd.groupBy(p => (p.getRecordGroupName, p.getReadName))
      .map(kv => {
        val (_, reads) = kv

        fromGroupedReads(reads)
      })
  }

  def apply(fragment: Fragment): SingleReadBucket = {
    fromGroupedReads(fragment.getAlignments.toIterable)
  }
}

/**
 * A representation of all of the read alignments that came from a single sequenced
 * fragment.
 *
 * @param primaryMapped All read alignments that are primary alignments.
 * @param secondaryMapped All read alignments that are non-primary (i.e.,
 *   secondary or supplementary alignments).
 * @param unmapped All reads from the fragment that are unmapped.
 */
private[adam] case class SingleReadBucket(
    primaryMapped: Iterable[AlignmentRecord] = Iterable.empty,
    secondaryMapped: Iterable[AlignmentRecord] = Iterable.empty,
    unmapped: Iterable[AlignmentRecord] = Iterable.empty) {

  /**
   * @return The union of the primary, secondary, and unmapped buckets.
   */
  def allReads = {
    primaryMapped ++ secondaryMapped ++ unmapped
  }

  /**
   * Converts to an Avro Fragment record.
   *
   * @return Converts this bucket to a Fragment type, which does not have the
   *   various alignment buckets, but is otherwise equivalent.
   */
  def toFragment: Fragment = {
    // take union of all reads, as we will need this for building and
    // want to pay the cost exactly once
    val unionReads = allReads

    // start building fragment
    val builder = Fragment.newBuilder()
      .setReadName(unionReads.head.getReadName)
      .setAlignments(seqAsJavaList(allReads.toSeq))

    // is an insert size defined for this fragment?
    primaryMapped.headOption
      .foreach(r => {
        Option(r.getInferredInsertSize).foreach(is => {
          builder.setFragmentSize(is.toInt)
        })
      })

    // set record group name, if known
    Option(unionReads.head.getRecordGroupName)
      .foreach(n => builder.setRunId(n))

    builder.build()
  }
}

class SingleReadBucketSerializer extends Serializer[SingleReadBucket] {
  val recordSerializer = new AvroSerializer[AlignmentRecord]()

  def writeArray(kryo: Kryo, output: Output, reads: Seq[AlignmentRecord]): Unit = {
    output.writeInt(reads.size, true)
    for (read <- reads) {
      recordSerializer.write(kryo, output, read)
    }
  }

  def readArray(kryo: Kryo, input: Input): Seq[AlignmentRecord] = {
    val numReads = input.readInt(true)
    (0 until numReads).foldLeft(List[AlignmentRecord]()) {
      (a, b) => recordSerializer.read(kryo, input, classOf[AlignmentRecord]) :: a
    }
  }

  def write(kryo: Kryo, output: Output, groupedReads: SingleReadBucket) = {
    writeArray(kryo, output, groupedReads.primaryMapped.toSeq)
    writeArray(kryo, output, groupedReads.secondaryMapped.toSeq)
    writeArray(kryo, output, groupedReads.unmapped.toSeq)
  }

  def read(kryo: Kryo, input: Input, klazz: Class[SingleReadBucket]): SingleReadBucket = {
    val primaryReads = readArray(kryo, input)
    val secondaryReads = readArray(kryo, input)
    val unmappedReads = readArray(kryo, input)
    new SingleReadBucket(primaryReads, secondaryReads, unmappedReads)
  }
}


text:
#pragma checksum "..\..\Background.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "55CBA88BCD9C9C85C5E0AB5579543C3A"
//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具生成。
//     运行时版本:4.0.30319.18408
//
//     对此文件的更改可能会导致不正确的行为,并且如果
//     重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;

namespace StartConnector {

    /// <summary>
    /// Background
    /// </summary>
    public partial class Background : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {

        private bool _contentLoaded;

        /// <summary>
        /// InitializeComponent
        /// </summary>
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
        public void InitializeComponent() {
            if (_contentLoaded) {
                return;
            }
            _contentLoaded = true;
            System.Uri resourceLocater = new System.Uri("/StartConnector;component/background.xaml", System.UriKind.Relative);

            #line 1 "..\..\Background.xaml"
            System.Windows.Application.LoadComponent(this, resourceLocater);

            #line default
            #line hidden
        }

        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
            this._contentLoaded = true;
        }
    }
}


text:
package org.wso2.andes.configuration;

import org.wso2.andes.AMQException;

/**
 * Indicates a failure to parse a property expansion. See {@link PropertyUtils} for the code that does property
 * expansions.
 *
 *

CRC Card

 *
 Responsibilities  Collaboration
 *
 Represent failure to expand a property name into a value.
 *

 *
 * @todo Not an AMQP exception as no status code.
 */
public class PropertyException extends AMQException
{
    public PropertyException(String message, Throwable cause)
    {
        super(null, message, cause);
    }
}


text:
package rest

import (
	"bufio"
	"bytes"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"net/url"
	"testing"
)

func TestInputStreamReader(t *testing.T) {
	resultString := "Test output"
	s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
		w.Write([]byte(resultString))
	}))
	defer s.Close()
	u, err := url.Parse(s.URL)
	if err != nil {
		t.Errorf("Error parsing server URL: %v", err)
		return
	}
	streamer := &LocationStreamer{
		Location: u,
	}
	readCloser, _, _, err := streamer.InputStream("v1beta1", "text/plain")
	if err != nil {
		t.Errorf("Unexpected error when getting stream: %v", err)
		return
	}
	defer readCloser.Close()
	result, err := ioutil.ReadAll(readCloser)
	if string(result) != resultString {
		t.Errorf("Stream content does not match. Got: %s. Expected: %s.", string(result), resultString)
	}
}

func TestInputStreamNullLocation(t *testing.T) {
	streamer := &LocationStreamer{
		Location: nil,
	}
	readCloser, _, _, err := streamer.InputStream("v1beta1", "text/plain")
	if err != nil {
		t.Errorf("Unexpected error when getting stream with null location: %v", err)
	}
	if readCloser != nil {
		t.Errorf("Expected stream to be nil. Got: %#v", readCloser)
	}
}

type testTransport struct {
	body string
	err  error
}

func (tt *testTransport) RoundTrip(req *http.Request) (*http.Response, error) {
	r := bufio.NewReader(bytes.NewBufferString(tt.body))
	return http.ReadResponse(r, req)
}

func fakeTransport(mime, message string) http.RoundTripper {
	content := fmt.Sprintf("HTTP/1.1 200 OK\nContent-Type: %s\n\n%s", mime, message)
	return &testTransport{body: content}
}

func TestInputStreamContentType(t *testing.T) {
	location, _ := url.Parse("http://www.example.com")
	streamer := &LocationStreamer{
		Location:  location,
		Transport: fakeTransport("application/json", "hello world"),
	}
	readCloser, _, contentType, err := streamer.InputStream("v1beta1", "text/plain")
	if err != nil {
		t.Errorf("Unexpected error when getting stream: %v", err)
		return
	}
	defer readCloser.Close()
	if contentType != "application/json" {
		t.Errorf("Unexpected content type. Got: %s. Expected: application/json", contentType)
	}
}

func TestInputStreamTransport(t *testing.T) {
	message := "hello world"
	location, _ := url.Parse("http://www.example.com")
	streamer := &LocationStreamer{
		Location:  location,
		Transport: fakeTransport("text/plain", message),
	}
	readCloser, _, _, err := streamer.InputStream("v1beta1", "text/plain")
	if err != nil {
		t.Errorf("Unexpected error when getting stream: %v", err)
		return
	}
	defer readCloser.Close()
	result, err := ioutil.ReadAll(readCloser)
	if string(result) != message {
		t.Errorf("Stream content does not match. Got: %s. Expected: %s.", string(result), message)
	}
}


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("../../index");
/**
 * Column decorator is used to mark a specific class property as a table column.
 * Only properties decorated with this decorator will be persisted to the database when entity be saved.
 */
function Column(typeOrOptions, options) {
    var type;
    if (typeof typeOrOptions === "string" || typeOrOptions instanceof Function) {
        type = typeOrOptions;
    }
    else if (typeOrOptions) {
        options = typeOrOptions;
        type = typeOrOptions.type;
    }
    return function (object, propertyName) {
        if (typeOrOptions instanceof Function) {
            var reflectMetadataType = Reflect && Reflect.getMetadata ? Reflect.getMetadata("design:type", object, propertyName) : undefined;
            var isArray = reflectMetadataType === Array || (options && (options.isArray === true || options.array === true)) ? true : false;
            var args = {
                target: object.constructor,
                propertyName: propertyName,
                isArray: isArray,
                prefix: options && options.prefix !== undefined ? options.prefix : undefined,
                type: typeOrOptions
            };
            index_1.getMetadataArgsStorage().embeddeds.push(args);
        }
        else {
            // if type is not given implicitly then try to guess it
            if (!type) {
                var reflectMetadataType = Reflect && Reflect.getMetadata ? Reflect.getMetadata("design:type", object, propertyName) : undefined;
                if (reflectMetadataType)
                    type = reflectMetadataType; // todo: need to determine later on driver level
            }
            // if column options are not given then create a new empty options
            if (!options)
                options = {};
            // check if there is no type in column options then set type from first function argument, or guessed one
            if (!options.type && type)
                options = Object.assign({ type: type }, options);
            // create and register a new column metadata
            var args = {
                target: object.constructor,
                propertyName: propertyName,
                mode: "regular",
                options: options
            };
            index_1.getMetadataArgsStorage().columns.push(args);
        }
    };
}
exports.Column = Column;

//# sourceMappingURL=Column.js.map


text:
module MakeItSo
  def self.source_root(template_category = nil)
    root = File.join(File.dirname(__FILE__), '../templates')
    template_category.nil? ? root : File.join(root, template_category.to_s)
  end
end

require "make_it_so/version"

require "make_it_so/rails"

require "make_it_so/command_line_interface"
require "generators/rails_app_generator"
require "generators/sinatra_app_generator"


text:
from fabric.api import *

def hello_world():
    """
    Say hello to the world
    """
    print "hello world"


text:
package org.apache.uima.collection.impl.metadata.cpe;

import java.util.ArrayList;

import org.apache.uima.collection.metadata.CpeSofaMapping;
import org.apache.uima.collection.metadata.CpeSofaMappings;
import org.apache.uima.resource.metadata.impl.MetaDataObject_impl;
import org.apache.uima.resource.metadata.impl.PropertyXmlInfo;
import org.apache.uima.resource.metadata.impl.XmlizationInfo;
import org.apache.uima.util.InvalidXMLException;
import org.apache.uima.util.XMLParser;
import org.apache.uima.util.XMLParser.ParsingOptions;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;

/**
 * The Class CpeSofaMappingsImpl.
 */
public class CpeSofaMappingsImpl extends MetaDataObject_impl implements CpeSofaMappings {

  /** The Constant serialVersionUID. */
  private static final long serialVersionUID = -4193487704594409253L;

  /** The sofa name mappings. */
  private ArrayList sofaNameMappings = new ArrayList();

  /*
   * (non-Javadoc)
   *
   * @see org.apache.uima.resource.metadata.impl.MetaDataObject_impl#getXmlizationInfo()
   */
  @Override
  protected XmlizationInfo getXmlizationInfo() {
    return XMLIZATION_INFO;
  }

  /**
   * Overridden to read "name" and "value" attributes.
   *
   * @param aElement
   *          the a element
   * @param aParser
   *          the a parser
   * @param aOptions
   *          the a options
   * @throws InvalidXMLException
   *           the invalid XML exception
   * @see org.apache.uima.resource.metadata.impl.MetaDataObject_impl#buildFromXMLElement(org.w3c.dom.Element,
   *      org.apache.uima.util.XMLParser, org.apache.uima.util.XMLParser.ParsingOptions)
   */
  @Override
  public void buildFromXMLElement(Element aElement, XMLParser aParser, ParsingOptions aOptions)
          throws InvalidXMLException {
    NodeList nodes = aElement.getChildNodes();
    for (int i = 0; i < nodes.getLength(); i++) {
      Node node = nodes.item(i);
      if (node instanceof Element) {
        CpeSofaMapping sofaMapping = new CpeSofaMappingImpl();
        NamedNodeMap atts = node.getAttributes();
        if (atts.getNamedItem("componentSofaName") != null
                && atts.getNamedItem("componentSofaName").getNodeValue() != null) {
          sofaMapping.setComponentSofaName(atts.getNamedItem("componentSofaName").getNodeValue());
        }
        if (atts.getNamedItem("cpeSofaName") != null
                && atts.getNamedItem("cpeSofaName").getNodeValue() != null) {
          sofaMapping.setCpeSofaName(atts.getNamedItem("cpeSofaName").getNodeValue());
        }
        sofaNameMappings.add(sofaMapping);
      }
    }
  }

  /*
   * (non-Javadoc)
   *
   * @see
   * org.apache.uima.resource.metadata.impl.MetaDataObject_impl#toXML(org.xml.sax.ContentHandler,
   * boolean)
   */
  @Override
  public void toXML(ContentHandler aContentHandler, boolean aWriteDefaultNamespaceAttribute)
          throws SAXException {
    XmlizationInfo inf = getXmlizationInfo();

    // write the element's start tag
    // get attributes (can be provided by subclasses)
    AttributesImpl attrs = getXMLAttributes();
    // add default namespace attr if desired
    if (aWriteDefaultNamespaceAttribute) {
      if (inf.namespace != null) {
        attrs.addAttribute("", "xmlns", "xmlns", null, inf.namespace);
      }
    }

    // start element
    aContentHandler.startElement(inf.namespace, inf.elementTagName, inf.elementTagName, attrs);

    // write child elements
    for (int i = 0; i < sofaNameMappings.size(); i++) {
      ((CpeSofaMapping) sofaNameMappings.get(i)).toXML(aContentHandler,
              aWriteDefaultNamespaceAttribute);
    }

    // end element
    aContentHandler.endElement(inf.namespace, inf.elementTagName, inf.elementTagName);
  }

  /** The Constant XMLIZATION_INFO. */
  static final private XmlizationInfo XMLIZATION_INFO = new XmlizationInfo("sofaNameMappings",
          new PropertyXmlInfo[] { new PropertyXmlInfo("sofaNameMapping", null), });

  /**
   * Gets the sofa name mappings.
   *
   * @return sofa name mappings
   */
  @Override
  public CpeSofaMapping[] getSofaNameMappings() {
    CpeSofaMapping[] sofaMappings = new CpeSofaMapping[sofaNameMappings.size()];
    return (CpeSofaMapping[]) sofaNameMappings.toArray(sofaMappings);
  }

  /**
   * Sets the sofa name mappings.
   *
   * @param sofaMappings
   *          the new sofa name mappings
   */
  @Override
  public void setSofaNameMappings(CpeSofaMapping[] sofaMappings) {
    for (int i = 0; sofaMappings != null && i < sofaMappings.length; i++) {
      sofaNameMappings.add(sofaMappings[i]);
    }
    // sofaNameMappings = list;
  }

}


text:
{% extends "nodemanager/node.html" %}

{% load url from future %}
{% load i18n %}
{% load static %}

{% block content %}

{{ block.super }}

TODO: explain
Empty groups ignored

        <button type="button" class="close" data-dismiss="modal">×</button>

Rename group...

New name:

        <input id="group_new_name" type="text" name="new_name" value=""/>

        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
        <button id="rename_confirm" type="button" class="btn btn-primary" onclick="rename_group();">Rename group</button>

            blah1s

            blah2

                <button class="btn btn-xs btn-primary dropdown-toggle" data-toggle="dropdown"></button>

Rename group

Action 2

                You can drag this panel.

                <button class="btn btn-xs btn-primary dropdown-toggle" data-toggle="dropdown"></button>

Rename group

TODO: Remove group

<button class="btn btn-default" onclick="add_group();">
Add another group...
</button>

<button class="btn btn-default" onclick="submit_merge();">
Save entries...
</button>

<button class="btn btn-danger" onclick="">
Finalize submission...
</button>

{% endblock %}  {# block content #}

{% block extra_js %}

{{ block.super }}

{% endblock %}  {# block extra_js #}


text:
#pragma once
#include "RenderObjects.h"
#include "Camera.h"
/*
This class is an interface used to override the way objects are rendered
*/
class IRenderProgram{
public:
	virtual void Draw(RenderObject* obj, Camera &cam)  = 0; // draw things to screen
	virtual void Init() = 0; // initialize shaders and other variables
	virtual void Apply() = 0; // Apply things that should be applyed before
	const bool GetDefered(){ return m_Defered; }
protected:
	bool m_Defered;	//this is to tell the renderer wether it should finish the defered rendering stage before it should render this object
};


text:
package org.apache.drill.test.framework.resourcemanagement;

import com.google.common.base.Preconditions;
import org.apache.drill.test.framework.*;
import org.apache.drill.test.framework.common.DrillJavaTestBase;
import org.apache.drill.test.framework.common.DrillTestNGDefaults;
import org.apache.log4j.Logger;
import org.testng.Assert;
import org.testng.annotations.*;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;

import static org.apache.drill.test.framework.DrillTestDefaults.DRILL_HOME;
import static org.apache.drill.test.framework.DrillTestDefaults.DRILL_RM_OVERRIDE_CONF_FILENAME;
import static org.apache.drill.test.framework.common.DrillTestNGDefaults.FUNCTIONAL_GROUP;
import static org.apache.drill.test.framework.common.DrillTestNGDefaults.NO_RESOURCE_POOL_ERROR;
import static org.apache.drill.test.framework.common.DrillTestNGDefaults.BASIC_RM_CONFIG_NAME;

@SuppressWarnings("Duplicates")
@Test(groups = FUNCTIONAL_GROUP)
public class QueueSelectionTests extends DrillJavaTestBase {
    private static final Logger LOG = Logger.getLogger(QueueSelectionTests.class);

    @BeforeClass(alwaysRun = true, description = "Invoked before all tests in the class")
    private void setup() throws IOException {
        cleanup(false);
        DrillRMConfig config = DrillRMConfig.load(BASIC_RM_CONFIG_NAME);
        Utils.applyRMConfigToDrillCluster(config, drillCluster);
        Utils.restartDrillbits(drillCluster);
    }

    @AfterClass(alwaysRun = true, description = "Invoked after all tests in the class are executed")
    private void cleanup() {
        cleanup(true);
    }

    private void cleanup(final boolean restart) {
        Preconditions.checkNotNull(connectionPool,
                "Cleanup failed! Connection pool has not be instantiated");
        Preconditions.checkNotNull(drillCluster,
                "Cleanup failed! Drill cluster information is unavailable");
        drillCluster.runCommand("rm -rf " + DRILL_HOME + "/conf/" + DRILL_RM_OVERRIDE_CONF_FILENAME);
        if(restart) {
            Utils.restartDrillbits(drillCluster);
        }
    }

    /**
     * Test validates that the tag is evaluated and the right queue is picked based on the tag.
     *
     * @throws IOException
     */
    @Test(groups = FUNCTIONAL_GROUP)
    public void testTagSelectorBasic() throws IOException {
        final String query = "SELECT o_orderkey " +
                "FROM orders " +
                "ORDER BY o_orderkey " +
                "DESC limit 1";

        //Set expectations
        final long expectedOrderId = 60000;
        final String queryTag = "dev";
        final String expectedPoolName = "DevPool";
        final int expectedRowCount = 1;

        //Build a connection with queryTag
        final Properties props = Utils.createConnectionProperties(
                "dfs.drilltestdirtpch01parquet", null, queryTag);

        try(Connection conn = ConnectionPool
                .createConnection(
                        DrillTestNGDefaults.CONNECTION_URL_FOR_DRILLBIT(drillCluster.getHosts().get(0)),
                        props);
            Statement stmt = conn.createStatement();
            ResultSet res = stmt.executeQuery(query)) {
            final String queryId = Utils.getQueryID(res); //Get query id
            LOG.info("QueryID: " + queryId + " - Query: " + query);

            final DrillQueryProfile queryProfile = Utils.getQueryProfile(queryId); //Get query profile

            //Validate that the query was allowed into the queue
            Assert.assertEquals(queryProfile.queueName, expectedPoolName,
                    "QueryID: " + queryId + " - The pool names do not match!");
            LOG.info("QueryID: " + queryId + ", Queue: " + queryProfile.queueName);

            //Validate the data returned.
            long rowCount = 0;
            while(res.next()) {
                rowCount++;
                Assert.assertEquals(res.getLong("o_orderkey"), expectedOrderId,
                        "QueryID: " + queryId + " - OrderId expected did not match");

            }
            Assert.assertEquals(rowCount, expectedRowCount,
                    "QueryID: " + queryId + " - Number of rows returned did not match!");
        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail(e.getMessage());
        }
    }

    /**
     * Test validates that user in Acl is evaluated and the right queue is picked based on the Acl.
     *
     * @throws IOException
     */
    @Test(groups = FUNCTIONAL_GROUP)
    public void testAclSelectorForUser() throws IOException {
        final String query = "SELECT o_orderkey " +
                "FROM orders " +
                "ORDER BY o_orderkey " +
                "DESC limit 1";

        //Set expectations
        final long expectedOrderId = 60000;
        final String expectedPoolName = "TestPool";
        final int expectedRowCount = 1;
        final String expectedUser = "bob";

        //Build a connection with only schema
        final Properties props = Utils.createConnectionProperties(
                "dfs.drilltestdirtpch01parquet", null, null);

        try(Connection conn = ConnectionPool
                .createConnection(
                        DrillTestNGDefaults.CONNECTION_URL_FOR_DRILLBIT(drillCluster.getHosts().get(0)),
                        expectedUser, //Provide username for the connection
                        null,
                        props);

            Statement stmt = conn.createStatement();
            ResultSet res = stmt.executeQuery(query)) {
            final String queryId = Utils.getQueryID(res); //Get query id
            LOG.info("Query ID: " + queryId + ", Query: " + query);

            final DrillQueryProfile queryProfile = Utils.getQueryProfile(queryId); //Get query profile

            //Validate that the query was allowed into the queue
            Assert.assertEquals(queryProfile.queueName, expectedPoolName, "The pool names do not match!");
            LOG.info("QueryID: " + queryId + ", Queue: " + queryProfile.queueName);

            long rowCount = 0;
            while(res.next()) {
                rowCount++;
                Assert.assertEquals(res.getLong("o_orderkey"), expectedOrderId,
                        "OrderId expected did not match");

            }
            Assert.assertEquals(rowCount, expectedRowCount, "Number of rows returned did not match!");
            Assert.assertEquals(queryProfile.user, expectedUser);
        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail(e.getMessage());
        }
    }

    /**
     * Test validates where multiple queues are eligible to admit a query, based on tag,
     * but the bestfit queue is selected.
     *
     * @throws IOException
     */
    @Test(groups = FUNCTIONAL_GROUP)
    public void testTagSelectBestFitPool() throws IOException {
        final String query = "SELECT o_orderkey " +
                "FROM orders " +
                "ORDER BY o_orderkey " +
                "DESC limit 1";
        final String queryTag = "dev,test"; //Set tag such that both dev and test are eligible

        //Set expectations
        final long expectedOrderId = 60000;
        final String expectedPoolName = "DevPool"; //As per "bestfit" policy
        final int expectedRowCount = 1;
        final String user = "bob";

        final Properties props = Utils.createConnectionProperties(
                "dfs.drilltestdirtpch01parquet", null, queryTag);

        try(Connection conn = ConnectionPool
                .createConnection(DrillTestNGDefaults.CONNECTION_URL_FOR_DRILLBIT(
                        drillCluster.getHosts().get(0)),
                        user,
                        null,
                        props); //Create a connection based on hostname and properties

            Statement stmt = conn.createStatement();
            ResultSet res = stmt.executeQuery(query)) {
            final String queryId = Utils.getQueryID(res); //Get query id
            LOG.info("Query ID: " + queryId + ", Query: " + query);

            final DrillQueryProfile queryProfile = Utils.getQueryProfile(queryId); //Get query profile

            Assert.assertEquals(queryProfile.user, user, "Query user did not match for queryID: " +
                    queryId + " !");

            //Validate that the query was allowed into the queue
            Assert.assertEquals(queryProfile.queueName, expectedPoolName, "The pool names do not match!");
            LOG.info("QueryID: " + queryId + ", Queue: " + queryProfile.queueName);

            long rowCount = 0;
            while(res.next()) {
                rowCount++;
                Assert.assertEquals(res.getLong("o_orderkey"), expectedOrderId,
                        "OrderId expected did not match");

            }
            Assert.assertEquals(rowCount, expectedRowCount, "Number of rows returned did not match!");
        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail(e.getMessage());
        }
    }

    /**
     * Test to validate that the query is not admitted since there are no tags and Acls do not match
     * any of the queues.
     * Also validates the error message.
     *
     * @throws IOException
     */
    @Test(groups = FUNCTIONAL_GROUP)
    public void testUnknownUserDoesNotAllowQuery() throws IOException {
        final String query = "SELECT o_orderkey " +
                "FROM orders " +
                "ORDER BY o_orderkey " +
                "DESC limit 1";
        final Properties props = Utils.createConnectionProperties("dfs.drilltestdirtpch01parquet",
                null, null); //NO Query Tags

        try(Connection conn = ConnectionPool
                .createConnection(DrillTestNGDefaults.CONNECTION_URL_FOR_DRILLBIT(drillCluster.getHosts().get(0)),
                        "anonymous",
                        null,
                        props);
            Statement stmt = conn.createStatement();
            ResultSet res = stmt.executeQuery(query)) {
            final String queryId = Utils.getQueryID(res); //Get query id
            LOG.info("Query ID: " + queryId + ", Query: " + query);

            Utils.getQueryProfile(queryId); //Get query profile
            Assert.fail("Did not receive expected exception: " + NO_RESOURCE_POOL_ERROR);
        } catch (Exception e) {
            if (e.getMessage().contains(NO_RESOURCE_POOL_ERROR)) {
                LOG.info("Received expected exception: " + e.getMessage());
            } else {
                e.printStackTrace();
                Assert.fail(e.getMessage());
            }
        }
    }

    /**
     * Validates that an unknown tag is not wrongly admitted into the queue.
     *
     * @throws IOException
     */
    @Test(groups = FUNCTIONAL_GROUP)
    public void testUnknownTagDoesNotAllowQuery() {
        final String query = "SELECT o_orderkey " +
                "FROM orders " +
                "ORDER BY o_orderkey " +
                "DESC limit 1";
        final String queryTag = "marketing"; //This tag is not configured for basic RM template
        final Properties props = Utils.createConnectionProperties("dfs.drilltestdirtpch01parquet",
                null, queryTag); //NO Query Tags

        try(Connection conn = ConnectionPool
                .createConnection(DrillTestNGDefaults.CONNECTION_URL_FOR_DRILLBIT(drillCluster.getHosts().get(0)),
                        props);
            Statement stmt = conn.createStatement();
            ResultSet res = stmt.executeQuery(query)) {
            final String queryId = Utils.getQueryID(res); //Get query id
            LOG.info("Query ID: " + queryId + ", Query: " + query);

            Utils.getQueryProfile(queryId); //Get query profile
            Assert.fail("Did not receive expected exception: " + NO_RESOURCE_POOL_ERROR);
        } catch (Exception e) {
            if (e.getMessage().contains(NO_RESOURCE_POOL_ERROR)) {
                LOG.info("Received expected exception: " + e.getMessage());
            } else {
                e.printStackTrace();
                Assert.fail(e.getMessage());
            }
        }
    }
}


text:
class Follow < ActiveRecord::Base
  belongs_to :following, class_name: 'User'
  belongs_to :user

  after_create  :save_notification
  after_destroy :delete_notification

  private

  def save_notification
    Notification.create do |n|
      n.user        = following
      n.action_user = user
      n.trackable   = self
      n.action      = 'follows.create'
    end
  end

  def delete_notification
    Notification.where(trackable_type: 'Follow', trackable_id: id).destroy_all
  end
end


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HUX.Receivers;
using HUX.Interaction;
using HUX.Focus;

public class LobbyPlayerReceivers : InteractionReceiver
{
    protected override void OnTapped(GameObject obj, InteractionManager.InteractionEventArgs eventArgs)
    {
        //txt.text = obj.name + " : OnTapped";
        switch (obj.name)
        {
            case "JoinButton":
                {
                    var lobbyPlayer = gameObject.GetComponent<HoloLensLobbyPlayer>();
                    lobbyPlayer.SendReadyToBeginMessage();
                    break;
                }
        }
        base.OnTapped(obj, eventArgs);
    }

    protected override void OnHoldStarted(GameObject obj, InteractionManager.InteractionEventArgs eventArgs)
    {
        //txt.text = obj.name + " : OnHoldStarted";
        base.OnHoldStarted(obj, eventArgs);
    }

    protected override void OnFocusEnter(GameObject obj, FocusArgs args)
    {
        //txt.text = obj.name + " : OnFocusEnter";
        base.OnFocusEnter(obj, args);
    }

    protected override void OnFocusExit(GameObject obj, FocusArgs args)
    {
        //txt.text = obj.name + " : OnFocusExit";
        base.OnFocusExit(obj, args);
    }
}


text:
require 'nn'
require 'cudnn'
require 'cunn'

local function build(nChannels, nOutChannels, type, bottleneck, bnWidth)
   local net = nn.Sequential()
   local innerChannels = nChannels
   bnWidth = bnWidth or 4
   if bottleneck == true then
      innerChannels = math.min(innerChannels, bnWidth * nOutChannels)
      net:add(cudnn.SpatialConvolution(nChannels, innerChannels, 1,1, 1,1, 0,0))
      net:add(cudnn.SpatialBatchNormalization(innerChannels))
      net:add(cudnn.ReLU(true))
   end
   if type == 'normal' then
      net:add(cudnn.SpatialConvolution(innerChannels, nOutChannels, 3,3, 1,1, 1,1))
   elseif type == 'down' then
      net:add(cudnn.SpatialConvolution(innerChannels, nOutChannels, 3,3, 2,2, 1,1))
   elseif type == 'up' then
      net:add(cudnn.SpatialFullConvolution(innerChannels, nOutChannels, 3,3, 2,2, 1,1, 1,1))
   else
      error("Please implement me: " .. type)
   end
   net:add(cudnn.SpatialBatchNormalization(nOutChannels))
   net:add(cudnn.ReLU(true))
   return net
end

local function build_net_normal(nChannels, nOutChannels, bottleneck, bnWidth)
   local net_warp = nn.Sequential()
   local net = nn.ParallelTable()
   net:add(nn.Identity())
   net:add(build(nChannels, nOutChannels, 'normal', bottleneck, bnWidth))
   net_warp:add(net):add(nn.JoinTable(2))
   return net_warp
end

local function build_net_down_normal(nChannels1, nChannels2, nOutChannels, bottleneck, bnWidth1, bnWidth2)
   local net_warpper = nn.Sequential()
   local net = nn.ParallelTable()
   assert(nOutChannels % 2 == 0, 'Growth rate invalid!')
   net:add(nn.Identity())
   net:add(build(nChannels1, nOutChannels/2, 'down', bottleneck, bnWidth1))
   net:add(build(nChannels2, nOutChannels/2, 'normal', bottleneck, bnWidth2))
   net_warpper:add(net):add(nn.JoinTable(2))
   return net_warpper
end

----------------
--- MSDNet_Layer_first:
---      the input layer of MSDNet
--- input: a tensor (orginal image)
--- output: a table of nScale tensors
----------------

local MSDNet_Layer_first, parent = torch.class('nn.MSDNet_Layer_first', 'nn.Container')

function MSDNet_Layer_first:__init(nChannels, nOutChannels, opt)
   parent.__init(self)

   self.train = true
   self.nChannels = nChannels
   self.nOutChannels = nOutChannels

   self.opt = opt

   self.modules = {}
   -- transform raw input to first layer
   self.modules[1] = nn.Sequential()
   if opt.dataset == 'cifar10' or opt.dataset == 'cifar100' then
      self.modules[1]:add(cudnn.SpatialConvolution(nChannels, nOutChannels*opt.grFactor[1], 3,3, 1,1, 1,1))
      self.modules[1]:add(cudnn.SpatialBatchNormalization(nOutChannels*opt.grFactor[1]))
      self.modules[1]:add(cudnn.ReLU(true))
   elseif opt.dataset == 'imagenet' then
      self.modules[1]:add(cudnn.SpatialConvolution(nChannels,nOutChannels*opt.grFactor[1], 7,7, 2,2, 3,3))
      self.modules[1]:add(nn.SpatialBatchNormalization(nOutChannels*opt.grFactor[1]))
      self.modules[1]:add(cudnn.ReLU(true))
      self.modules[1]:add(nn.SpatialMaxPooling(3,3,2,2,1,1))
   end

   local nIn = nOutChannels * opt.grFactor[1]
   for i = 2, opt.nScales do
      self.modules[i] = nn.Sequential()
      self.modules[i]:add(cudnn.SpatialConvolution(nIn, nOutChannels*opt.grFactor[i], 3,3, 2,2, 1,1))
      self.modules[i]:add(cudnn.SpatialBatchNormalization(nOutChannels*opt.grFactor[i]))
      self.modules[i]:add(cudnn.ReLU(true))
      nIn = nOutChannels*opt.grFactor[i]
   end

   self.gradInput = torch.CudaTensor()
   self.output = {}
end

function MSDNet_Layer_first:updateOutput(input)
   for i = 1, self.opt.nScales do
      self.output[i] = self.output[i] or input.new()
      local tmp_input = (i==1) and input or self.output[i-1]
      local tmp_output = self:rethrowErrors(self.modules[i], i, 'updateOutput', tmp_input)
      self.output[i]:resizeAs(tmp_output):copy(tmp_output)
   end
   return self.output
end

function MSDNet_Layer_first:updateGradInput(input, gradOutput)
   self.gradInput = self.gradInput or input.new()
   self.gradInput:resizeAs(input):zero()
   for i = self.opt.nScales-1, 1, -1 do
      gradOutput[i]:add(self.modules[i+1]:updateGradInput(self.output[i], gradOutput[i+1]))
   end
   self.gradInput:resizeAs(input):copy(self.modules[1]:updateGradInput(input, gradOutput[1]))
   return self.gradInput
end

function MSDNet_Layer_first:accGradParameters(input, gradOutput, scale)
   scale = scale or 1
   for i = self.opt.nScales, 2, -1 do
      self.modules[i]:accGradParameters(self.output[i-1], gradOutput[i], scale)
   end
   self.modules[1]:accGradParameters(input, gradOutput[1], scale)
end

function MSDNet_Layer_first:__tostring__()
   local tab = '  '
   local line = '\n'
   local next = '  |`-> '
   local lastNext = '   `-> '
   local ext = '  |    '
   local extlast = '       '
   local last = '   ... -> '
   local str = 'MSDNet_Layer_first'
   str = str .. ' {' .. line .. tab .. '{input}'
   for i=1,#self.modules do
      if i == #self.modules then
         str = str .. line .. tab .. lastNext .. '(' .. i .. '): ' .. tostring(self.modules[i]):gsub(line, line .. tab .. extlast)
      else
         str = str .. line .. tab .. next .. '(' .. i .. '): ' .. tostring(self.modules[i]):gsub(line, line .. tab .. ext)
      end
   end
   str = str .. line .. tab .. last .. '{output}'
   str = str .. line .. '}'
   return str
end

----------------
--- MSDNet_Layer (without upsampling):
---      subsequent layers of MSDNet
--- input: a table of `nScales` tensors
--- output: a table of `nScales` tensors
----------------

local MSDNet_Layer, parent = torch.class('nn.MSDNet_Layer', 'nn.Container')

function MSDNet_Layer:__init(nChannels, nOutChannels, opt, inScales, outScales)
   parent.__init(self)

   self.train = true
   self.nChannels = nChannels
   self.nOutChannels = nOutChannels
   self.opt = opt
   self.inScales = inScales or opt.nScales
   self.outScales = outScales or opt.nScales
   self.nScales = opt.nScales
   self.discard = self.inScales - self.outScales
   assert(self.discard<=1, 'Double check inScales'..self.inScales..'and outScales: '..self.outScales)

   local offset = self.nScales - self.outScales
   self.modules = {}
   local isTrans = self.outScales<self.inScales
   if isTrans then
      local nIn1, nIn2, nOut = nChannels*opt.grFactor[offset], nChannels*opt.grFactor[offset+1], opt.grFactor[offset+1]*nOutChannels
      self.modules[1] = build_net_down_normal(nIn1, nIn2, nOut, opt.bottleneck, opt.bnFactor[offset], opt.bnFactor[offset+1])
   else
      self.modules[1] = build_net_normal(nChannels*opt.grFactor[offset+1], opt.grFactor[offset+1]*nOutChannels, opt.bottleneck, opt.bnFactor[offset+1])
   end
   for i = 2, self.outScales do
      local nIn1, nIn2, nOut = nChannels*opt.grFactor[offset+i-1], nChannels*opt.grFactor[offset+i], opt.grFactor[offset+i]*nOutChannels
      self.modules[i] = build_net_down_normal(nIn1, nIn2, nOut, opt.bottleneck, opt.bnFactor[offset+i-1], opt.bnFactor[offset+i])
   end

   self.real_input = {}
   self.gradInput = {}
   self.gIn = {}
   self.output = {}

   self.modules = self.modules

end

function MSDNet_Layer:updateOutput(input)

   local discard = self.discard
   if self.inScales == self.outScales then
      self.real_input[1] = {input[1], input[1]}
      for i = 2, self.outScales do
         self.real_input[i] = {input[i], input[i-1], input[i]}
      end
   else
      for i = 1, self.outScales do -- !!!
         self.real_input[i] = {input[discard+i], input[discard+i-1], input[discard+i]}
      end
   end

   for i = 1, self.outScales do
      self.output[i] = self:rethrowErrors(self.modules[i], i, 'updateOutput', self.real_input[i])
   end

   return self.output
end

function MSDNet_Layer:updateGradInput(input, gradOutput)

   -- self.gradInput = self.gradInput or {}
   local offset = self.offset
   self.gIn = self.gIn or {}

   for i = 1, self.inScales do
      self.gradInput[i] = self.gradInput[i] or input[i].new()
   end

   for i = 1, self.outScales do
      self.gIn[i] = self.modules[i]:updateGradInput(self.real_input[i], gradOutput[i])
   end

   if self.inScales == self.outScales then
      if self.outScales == 1 then
         self.gradInput[1]:resizeAs(self.gIn[1][1]):copy(self.gIn[1][1])
                    :add(self.gIn[1][2])
      else
         self.gradInput[1]:resizeAs(self.gIn[1][1]):copy(self.gIn[1][1])
                             :add(self.gIn[1][2]):add(self.gIn[2][2])
      end
      for i = 2, self.inScales-1 do
         self.gradInput[i]:resizeAs(self.gIn[i][1]):copy(self.gIn[i][1])
                       :add(self.gIn[i][3]):add(self.gIn[i+1][2])
      end

   else
      self.gradInput[1]:resizeAs(self.gIn[1][2]):copy(self.gIn[1][2])
      for i = 2, self.inScales - 1 do
         self.gradInput[i]:resizeAs(self.gIn[i-1][1]):copy(self.gIn[i-1][1])
                       :add(self.gIn[i-1][3]):add(self.gIn[i][2])
      end
   end
   if self.inScales > 1 then
      self.gradInput[self.inScales]:resizeAs(self.gIn[self.outScales][1])
      :copy(self.gIn[self.outScales][1]):add(self.gIn[self.outScales][3])
   end

   return self.gradInput

end

function MSDNet_Layer:accGradParameters(input, gradOutput, scale)

   scale = scale or 1
   for i = 1, self.outScales do
      self.modules[i]:accGradParameters(self.real_input[i], gradOutput[i], scale)
   end
end

function MSDNet_Layer:clearState()
   -- don't call set because it might reset referenced tensors
   local function clear(f)
      if self[f] then
         if torch.isTensor(self[f]) then
            self[f] = self[f].new()
         elseif type(self[f]) == 'table' then
            self[f] = {}
         else
            self[f] = nil
         end
      end
   end
   clear('output')
   clear('gradInput')
   clear('real_input')
   clear('gIn')
   if self.modules then
      for i,module in pairs(self.modules) do
         module:clearState()
      end
   end
   return self
end

function MSDNet_Layer:__tostring__()
   local tab = '  '
   local line = '\n'
   local next = '  |`-> '
   local lastNext = '   `-> '
   local ext = '  |    '
   local extlast = '       '
   local last = '   ... -> '
   local str = 'MSDNet_Layer'
   str = str .. ' {' .. line .. tab .. '{input}'
   for i = 1,#self.modules do
      if i == #self.modules then
         str = str .. line .. tab .. lastNext .. '(' .. i .. '): ' .. tostring(self.modules[i]):gsub(line, line .. tab .. extlast)
      else
         str = str .. line .. tab .. next .. '(' .. i .. '): ' .. tostring(self.modules[i]):gsub(line, line .. tab .. ext)
      end
   end
   str = str .. line .. tab .. last .. '{output}'
   str = str .. line .. '}'
   return str
end


text:
package tars.logic.parser;

import static tars.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import tars.commons.exceptions.IllegalValueException;
import tars.commons.exceptions.InvalidRangeException;
import tars.commons.util.StringUtil;
import tars.logic.commands.Command;
import tars.logic.commands.DoCommand;
import tars.logic.commands.IncorrectCommand;

/**
 * Do command parser
 */
public class DoCommandParser extends CommandParser {

    private static final String INVALID_RANGE =
            "Start index should be before end index.";

    /**
     * Parses arguments in the context of the delete task command.
     *
     * @param args full command args string
     * @return the prepared command
     */
    @Override
    public Command prepareCommand(String args) {
        args = args.trim();

        if (StringUtil.EMPTY_STRING.equals(args)) {
            return new IncorrectCommand(String.format(
                    MESSAGE_INVALID_COMMAND_FORMAT, DoCommand.MESSAGE_USAGE));
        }

        try {
            String rangeIndex = StringUtil.indexString(args);
            args = rangeIndex;
        } catch (InvalidRangeException ire) {
            return new IncorrectCommand(String.format(INVALID_RANGE
                    + StringUtil.STRING_NEWLINE + DoCommand.MESSAGE_USAGE));
        } catch (IllegalValueException ive) {
            return new IncorrectCommand(String.format(
                    MESSAGE_INVALID_COMMAND_FORMAT, DoCommand.MESSAGE_USAGE));
        }

        return new DoCommand(args);
    }

}


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

namespace RecordLion.RecordsManager.Client
{
    public class ClientPagedItems<T> : IClientPagedItems<T>
    {
        public ClientPagedItems()
        {
        }

        public int Page { get; set; }

        public int PageCount { get; set; }

        public int TotalCount { get; set; }

        public int ItemCount
        {
            get
            {
                return (this.Items == null) ? 0 : this.Items.Count();
            }
        }

        public IEnumerable<T> Items { get; set; }
    }
}


text:
from __future__ import absolute_import, division, unicode_literals, print_function
import os
import time
import subprocess

from jerjerrod.config import RCFILE
from jerjerrod.caching import DiskCache
from jerjerrod.projects import get_all_projects

# expire project list after 1 second
_SUB = None
_SUBTIME = None
_SUBEXPIRE = 60 * 60

# we want a cache for the config stuff
_CFGCACHE = {}
_CFGTIME = None

def _refresh(force):
    global _SUB, _SUBTIME
    if _SUB:
        # TODO: garbage-collect the thing if it's finished
        retval = _SUB.poll()
        if retval is not None:
            _SUB = None if retval == 0 else False
            _SUBTIME = time.time()
        return

    if _SUB is False:
        return

    # if its expired, start a new one
    if _SUBTIME is not None and (time.time() - _SUBTIME) < _SUBEXPIRE and not force:
        return

    cmd = ["jerjerrod", "namesbystatus", "JERJERROD:CHANGED"]
    _SUB = subprocess.Popen(cmd)

def wsscancount(pl):
    _refresh(False)

    ret = []
    if _SUB is not None:
        ret.append(
            {
                "contents": "!!!" if _SUB is False else "***",
                "highlight_groups": ["JERJERROD:SCANNING"],
                #'divider_highlight_group': 'JERJERROD:SEPARATOR',
            }
        )
    return ret

_CFGCHECKTIME = None
# check the config file's mtime at most once very 3 seconds
_CFGCHECKFREQ = 3

def _expirecfgcache():
    global _CFGCHECKTIME, _CFGCACHE, _CFGTIME

    if _CFGCHECKTIME is not None and (time.time() - _CFGCHECKTIME) < _CFGCHECKFREQ:
        return

    # we're going to stat the RCFILE to see if it has changed
    _CFGCHECKTIME = time.time()
    mtime = os.stat(RCFILE).st_mtime

    # if the file's mtime is different to last time, we want to destroy our
    # cache
    if mtime != _CFGTIME:
        _CFGTIME = mtime
        _CFGCACHE = {}

def wsnames(pl, category):
    _expirecfgcache()
    assert category in (
        "JERJERROD:CHANGED",
        "JERJERROD:UNTRACKED",
        "JERJERROD:UNPUSHED",
        "JERJERROD:UNKNOWN",
    )
    names = []
    cache = DiskCache()
    ignored = cache.getignorelist()

    for proj in get_all_projects(cache, _CFGCACHE):
        if proj.project_path in ignored:
            continue
        status = proj.getstatus(False)
        if status == "JERJERROD:UNKNOWN" and _SUB is None:
            _refresh(True)
        if status == category:
            names.append(proj.getname())

    # never show more than 5 names in the 'unknown' category
    count = len(names)
    if category == "JERJERROD:UNKNOWN" and count > 5:
        names = names[:5]
        names.append("(+{} more)".format(count - 5))

    ret = []
    if len(names):
        ret.append(
            {
                "contents": " ".join(names),
                "highlight_groups": [category],
                "divider_highlight_group": "JERJERROD:SEPARATOR",
            }
        )
    return ret


text:
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <services>
        <service id="api_platform.graphql.executor" class="ApiPlatform\Core\GraphQl\Executor" public="false" />

        <!-- Resolvers -->

        <service id="api_platform.graphql.resolver.factory.collection" class="ApiPlatform\Core\GraphQl\Resolver\Factory\CollectionResolverFactory" public="false">
            <argument type="service" id="api_platform.collection_data_provider" />
            <argument type="service" id="api_platform.subresource_data_provider" />
            <argument type="service" id="serializer" />
            <argument type="service" id="api_platform.identifiers_extractor.cached" />
            <argument type="service" id="api_platform.metadata.resource.metadata_factory" />
            <argument type="service" id="api_platform.security.resource_access_checker" on-invalid="null" />
            <argument type="service" id="request_stack" />
            <argument>%api_platform.collection.pagination.enabled%</argument>
        </service>

        <service id="api_platform.graphql.resolver.factory.item_mutation" class="ApiPlatform\Core\GraphQl\Resolver\Factory\ItemMutationResolverFactory" public="false">
            <argument type="service" id="api_platform.iri_converter" />
            <argument type="service" id="api_platform.data_persister" />
            <argument type="service" id="serializer" />
            <argument type="service" id="api_platform.metadata.resource.metadata_factory" />
            <argument type="service" id="api_platform.security.resource_access_checker" on-invalid="null" />
            <argument type="service" id="api_platform.validator" on-invalid="null" />
        </service>

        <service id="api_platform.graphql.resolver.item" class="ApiPlatform\Core\GraphQl\Resolver\ItemResolver" public="false">
            <argument type="service" id="api_platform.iri_converter" />
            <argument type="service" id="serializer" />
            <argument type="service" id="api_platform.metadata.resource.metadata_factory" />
            <argument type="service" id="api_platform.security.resource_access_checker" on-invalid="ignore" />
        </service>

        <service id="api_platform.graphql.resolver.resource_field" class="ApiPlatform\Core\GraphQl\Resolver\ResourceFieldResolver" public="false">
            <argument type="service" id="api_platform.iri_converter" />
        </service>

        <service id="api_platform.graphql.schema_builder" class="ApiPlatform\Core\GraphQl\Type\SchemaBuilder" public="false">
            <argument type="service" id="api_platform.metadata.property.name_collection_factory" />
            <argument type="service" id="api_platform.metadata.property.metadata_factory" />
            <argument type="service" id="api_platform.metadata.resource.name_collection_factory" />
            <argument type="service" id="api_platform.metadata.resource.metadata_factory" />
            <argument type="service" id="api_platform.graphql.resolver.factory.collection" />
            <argument type="service" id="api_platform.graphql.resolver.factory.item_mutation" />
            <argument type="service" id="api_platform.graphql.resolver.item" />
            <argument type="service" id="api_platform.graphql.resolver.resource_field" />
            <argument type="service" id="api_platform.filter_locator" />
            <argument>%api_platform.collection.pagination.enabled%</argument>
        </service>

        <!-- Action -->

        <service id="api_platform.graphql.action.entrypoint" class="ApiPlatform\Core\GraphQl\Action\EntrypointAction" public="true">
            <argument type="service" id="api_platform.graphql.schema_builder" />
            <argument type="service" id="api_platform.graphql.executor" />
            <argument type="service" id="twig" />
            <argument>%kernel.debug%</argument>
            <argument>%api_platform.graphql.graphiql.enabled%</argument>
            <argument>%api_platform.title%</argument>
        </service>

        <!-- Serializer -->

        <service id="api_platform.graphql.normalizer.item" class="ApiPlatform\Core\GraphQl\Serializer\ItemNormalizer" public="false">
            <argument type="service" id="api_platform.metadata.property.name_collection_factory" />
            <argument type="service" id="api_platform.metadata.property.metadata_factory" />
            <argument type="service" id="api_platform.iri_converter" />
            <argument type="service" id="api_platform.resource_class_resolver" />
            <argument type="service" id="api_platform.property_accessor" />
            <argument type="service" id="api_platform.name_converter" on-invalid="ignore" />
            <argument type="service" id="serializer.mapping.class_metadata_factory" on-invalid="ignore" />
            <argument type="service" id="api_platform.item_data_provider" on-invalid="ignore" />
            <argument>%api_platform.allow_plain_identifiers%</argument>

            <tag name="serializer.normalizer" priority="8" />
        </service>
    </services>

</container>