text:
package com.sksamuel.elastic4s

import io.circe._
import io.circe.jawn._

import scala.annotation.implicitNotFound

/**
 * Automatic HitAs and Indexable derivation
 *
 * == Usage ==
 *
 * {{{
 *  import io.circe.generic.auto._
 *  import com.sksamuel.elastic4s.circe._
 *
 *  case class City(id: Int, name: String)
 *
 *  // index
 *  index into "places" / "cities" id cityId source City(1, "munich")
 *
 *  // search and parse
 *  val resp = client.execute {
 *    search in "places" / "cities"
 *  }.await
 *
 *  val cities = resp.as[City]
 *
 * }}}
 */
package object circe {

  @implicitNotFound(
    "No Decoder for type ${T} found. Use 'import io.circe.generic.auto._' or provide an implicit Decoder instance ")
  implicit def hitReaderWithCirce[T](implicit decoder: Decoder[T]): HitReader[T] = new HitReader[T] {
    override def read(hit: Hit): Either[Throwable, T] = decode[T](hit.sourceAsString)
  }

  @implicitNotFound(
    "No Encoder for type ${T} found. Use 'import io.circe.generic.auto._' or provide an implicit Encoder instance ")
  implicit def indexableWithCirce[T](implicit encoder: Encoder[T], printer: Json => String = Printer.noSpaces.pretty): Indexable[T] = new Indexable[T] {
    override def json(t: T): String = printer(encoder(t))
  }
}


text:
import 'styles/global.css'

export default function App({ Component, pageProps }) {
  return <Component {...pageProps} />
}

redpajama_set_name: RedPajamaGithub


text:
package com.opengamma.master.config;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotEquals;
import static org.testng.Assert.assertNull;

import java.util.Arrays;
import java.util.List;

import org.joda.beans.JodaBeanUtils;
import org.testng.annotations.Test;
import org.threeten.bp.Instant;

import com.opengamma.core.config.impl.ConfigItem;
import com.opengamma.id.UniqueId;
import com.opengamma.master.config.ConfigDocument.Meta;
import com.opengamma.master.historicaltimeseries.impl.HistoricalTimeSeriesRating;
import com.opengamma.master.historicaltimeseries.impl.HistoricalTimeSeriesRatingFieldNames;
import com.opengamma.master.historicaltimeseries.impl.HistoricalTimeSeriesRatingRule;
import com.opengamma.util.test.AbstractFudgeBuilderTestCase;
import com.opengamma.util.test.TestGroup;

/**
 * Tests for {@link ConfigDocument}.
 */
@Test(groups = TestGroup.UNIT)
public class ConfigDocumentTest extends AbstractFudgeBuilderTestCase {
  private static final List<HistoricalTimeSeriesRatingRule> RULES = Arrays.asList(
      HistoricalTimeSeriesRatingRule.of(HistoricalTimeSeriesRatingFieldNames.DATA_PROVIDER_NAME, "value1", 0),
      HistoricalTimeSeriesRatingRule.of(HistoricalTimeSeriesRatingFieldNames.DATA_SOURCE_NAME, "value2", 1));
  private static final HistoricalTimeSeriesRating RATING = HistoricalTimeSeriesRating.of(RULES);
  private static final ConfigItem<HistoricalTimeSeriesRating> ITEM = ConfigItem.of(RATING);
  private static final UniqueId UID = UniqueId.of("conf", "1");
  private static final String NAME = "CONFIG";
  private static final Instant VERSION_FROM = Instant.ofEpochSecond(100);
  private static final Instant VERSION_TO = Instant.ofEpochSecond(200);
  private static final Instant CORRECTION_FROM = Instant.ofEpochSecond(150);
  private static final Instant CORRECTION_TO = Instant.ofEpochSecond(250);
  static {
    ITEM.setName(NAME);
  }

  /**
   * Tests that the name cannot be null.
   */
  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNullName() {
    new ConfigDocument(RATING, HistoricalTimeSeriesRating.class, null, UID, VERSION_FROM, VERSION_TO, CORRECTION_FROM, CORRECTION_TO);
  }

  /**
   * Tests constructor equivalence.
   */
  @Test
  public void testConstructors() {
    ConfigItem<?> item = ITEM.clone();
    item.setUniqueId(UID);
    final ConfigDocument doc = new ConfigDocument(item);
    doc.setVersionFromInstant(VERSION_FROM);
    doc.setVersionToInstant(VERSION_TO);
    doc.setCorrectionFromInstant(CORRECTION_FROM);
    doc.setCorrectionToInstant(CORRECTION_TO);
    final ConfigDocument other = new ConfigDocument(RATING, HistoricalTimeSeriesRating.class, NAME, UID, VERSION_FROM, VERSION_TO, CORRECTION_FROM,
        CORRECTION_TO);
    // config doesn't have a uid
    assertNotEquals(doc.getUniqueId(), other.getUniqueId());
    JodaBeanUtils.equalIgnoring(doc, other, ConfigDocument.meta().metaProperty("uniqueId"));
    final NamelessConfig config = NamelessConfig.of(53);
    config.setUniqueId(UID);
    item = ConfigItem.of(config);
    doc.setConfig(item);
    other.setConfig(item);
    assertEquals(doc, other);
  }

  /**
   * Tests the unique id getter.
   */
  @Test
  public void testGetUniqueId() {
    final ConfigDocument doc = new ConfigDocument(ITEM);
    assertNull(doc.getUniqueId());
    doc.setConfig(null);
    assertNull(doc.getUniqueId());
    final ConfigItem<HistoricalTimeSeriesRating> item = ITEM.clone();
    item.setName(NAME);
    item.setUniqueId(UID);
    doc.setConfig(item);
    assertEquals(doc.getUniqueId(), UID);
    doc.setUniqueId(null);
    item.setUniqueId(UID);
    assertEquals(doc.getUniqueId(), UID);
  }

  /**
   * Tests the unique id setter.
   */
  @Test
  public void testSetUniqueId() {
    final ConfigItem<HistoricalTimeSeriesRating> item = ITEM.clone();
    item.setUniqueId(UID);
    item.setName(NAME);
    final ConfigDocument doc = new ConfigDocument(item);
    final UniqueId uid1 = UniqueId.of("uid", "2");
    final UniqueId uid2 = UniqueId.of("uid", "3");
    assertEquals(doc.getUniqueId(), UID);
    assertEquals(item.getUniqueId(), UID);
    assertEquals(doc.getObjectId(), item.getUniqueId().getObjectId());
    doc.setUniqueId(uid1);
    assertEquals(doc.getUniqueId(), uid1);
    assertEquals(item.getUniqueId(), uid1);
    assertEquals(doc.getObjectId(), item.getUniqueId().getObjectId());
    doc.setConfig(null);
    doc.setUniqueId(uid2);
    assertEquals(doc.getUniqueId(), uid2);
    assertEquals(item.getUniqueId(), uid1);
  }

  /**
   * Tests the name getter.
   */
  @Test
  public void testGetName() {
    final ConfigItem<HistoricalTimeSeriesRating> item = ITEM.clone();
    ConfigDocument doc = new ConfigDocument(item);
    assertEquals(doc.getName(), NAME);
    doc.setConfig(null);
    assertEquals(doc.getName(), NAME);
    item.setName(NAME);
    doc.setConfig(item);
    assertEquals(doc.getName(), NAME);
    doc = new ConfigDocument(ConfigItem.of(NamelessConfig.of(6)));
    assertNull(doc.getName());
  }

  /**
   * Tests the name setter.
   */
  @Test
  public void testSetName() {
    final ConfigItem<HistoricalTimeSeriesRating> item = ITEM.clone();
    item.setName(NAME);
    ConfigDocument doc = new ConfigDocument(item);
    final String name1 = "CONFIG1";
    final String name2 = "CONFIG2";
    assertEquals(doc.getName(), NAME);
    assertEquals(item.getName(), NAME);
    doc.setName(name1);
    assertEquals(doc.getName(), name1);
    assertEquals(item.getName(), name1);
    doc.setConfig(null);
    doc.setName(name2);
    assertEquals(doc.getName(), name2);
    assertEquals(item.getName(), name1);
    doc = new ConfigDocument(ConfigItem.of(NamelessConfig.of(6)));
    doc.setName(name1);
    assertEquals(doc.getName(), name1);
  }

  /**
   * Tests the config setter.
   */
  @Test
  public void testConfigSetter() {
    final ConfigItem<HistoricalTimeSeriesRating> item = ITEM.clone();
    ConfigDocument doc = new ConfigDocument(item);
    doc.setConfig(null); // fine
    assertNull(doc.getConfig());
    doc.setConfig(item);
    assertEquals(doc.getConfig(), ITEM);
    assertEquals(doc.getName(), NAME);
    assertNull(doc.getUniqueId());
    item.setUniqueId(UID);
    assertEquals(doc.getConfig(), item);
    assertEquals(doc.getName(), NAME);
    assertEquals(doc.getUniqueId(), UID);
    item.setUniqueId(null);
    assertEquals(doc.getConfig(), ITEM);
    assertEquals(doc.getName(), NAME);
    assertEquals(doc.getUniqueId(), UID);
    final ConfigItem<NamelessConfig> nameless = ConfigItem.of(NamelessConfig.of(4));
    doc = new ConfigDocument(nameless);
    assertNull(doc.getName());
    assertNull(doc.getUniqueId());
    // bit artificial but it does mean the name isn't populated
    doc.setConfig(nameless);
    assertEquals(doc.getConfig(), nameless);
    assertNull(doc.getName());
    assertNull(doc.getUniqueId());
    nameless.setUniqueId(UID);
    doc.setConfig(nameless);
    assertEquals(doc.getConfig(), nameless);
    assertNull(doc.getName());
    assertEquals(doc.getUniqueId(), UID);
    nameless.setUniqueId(null);
    doc = new ConfigDocument(nameless);
    doc.setName(NAME);
    doc.setConfig(nameless);
    assertEquals(doc.getConfig(), nameless);
    assertEquals(doc.getName(), NAME);
    assertNull(doc.getUniqueId());
    doc.setUniqueId(UID);
    doc.setConfig(nameless);
    assertEquals(doc.getConfig(), nameless);
    assertEquals(doc.getName(), NAME);
    assertEquals(doc.getUniqueId(), UID);
  }

  /**
   * Test value getter.
   */
  @Test
  public void testValueGetter() {
    final ConfigDocument doc = new ConfigDocument(ITEM);
    assertEquals(doc.getValue(), ITEM);
    final ConfigItem<NamelessConfig> item = ConfigItem.of(NamelessConfig.of(2));
    doc.setConfig(item);
    assertEquals(doc.getValue(), item);
  }

  /**
   * Tests the type getter.
   */
  @Test
  public void testTypeGetter() {
    final ConfigDocument doc = new ConfigDocument(ITEM);
    assertEquals(doc.getType(), HistoricalTimeSeriesRating.class);
    final ConfigItem<NamelessConfig> item = ConfigItem.of(NamelessConfig.of(2));
    doc.setConfig(item);
    assertEquals(doc.getType(), NamelessConfig.class);
    doc.setConfig(null);
    assertNull(doc.getType());
  }

  /**
   * Tests the object.
   */
  @Test
  public void testObject() {
    final ConfigDocument doc = new ConfigDocument(ITEM);
    final ConfigDocument other = new ConfigDocument(ITEM.clone());
    assertEquals(doc, doc);
    assertEquals(doc.toString(),
        "ConfigDocument{versionFromInstant=null, versionToInstant=null, correctionFromInstant=null, "
            + "correctionToInstant=null, config=ConfigItem{value=HistoricalTimeSeriesRating{rules=[HistoricalTimeSeriesRatingRule{fieldName=dataProvider, "
            + "fieldValue=value1, rating=0}, HistoricalTimeSeriesRatingRule{fieldName=dataSource, fieldValue=value2, rating=1}]}, "
            + "uniqueId=null, name=CONFIG, type=class com.opengamma.master.historicaltimeseries.impl.HistoricalTimeSeriesRating}, uniqueId=null}");
    assertEquals(doc, other);
    assertEquals(doc.hashCode(), other.hashCode());
    ConfigItem<?> item = ConfigItem.of(HistoricalTimeSeriesRating.of(Arrays.asList(RULES.get(0))));
    item.setName(NAME);
    other.setConfig(item);
    assertNotEquals(doc, other);
    item = ConfigItem.of(NamelessConfig.of(6));
    other.setConfig(item);
    assertNotEquals(doc, other);
    item = ITEM.clone();
    other.setConfig(item);
    other.setCorrectionFromInstant(CORRECTION_FROM);
    assertNotEquals(doc, other);
    other.setCorrectionFromInstant(CORRECTION_FROM);
    other.setCorrectionToInstant(CORRECTION_TO);
    assertNotEquals(doc, other);
    other.setCorrectionToInstant(CORRECTION_TO);
    other.setVersionFromInstant(VERSION_FROM);
    assertNotEquals(doc, other);
    other.setVersionFromInstant(VERSION_FROM);
    other.setVersionToInstant(VERSION_TO);
    assertNotEquals(doc, other);
    other.setVersionToInstant(VERSION_TO);
    other.setUniqueId(UniqueId.of("uid", "2"));
    assertNotEquals(doc, other);
  }

  /**
   * Tests the bean.
   */
  @Test
  public void testBean() {
    final ConfigItem<HistoricalTimeSeriesRating> item = ITEM.clone();
    item.setUniqueId(UID);
    final ConfigDocument doc = new ConfigDocument(item);
    doc.setCorrectionFromInstant(CORRECTION_FROM);
    doc.setCorrectionToInstant(CORRECTION_TO);
    doc.setVersionFromInstant(VERSION_FROM);
    doc.setVersionToInstant(VERSION_TO);
    assertEquals(doc.propertyNames().size(), 6);
    final Meta bean = doc.metaBean();
    assertEquals(bean.config().get(doc), item);
    assertEquals(bean.correctionFromInstant().get(doc), CORRECTION_FROM);
    assertEquals(bean.correctionToInstant().get(doc), CORRECTION_TO);
    assertEquals(bean.uniqueId().get(doc), UID);
    assertEquals(bean.versionFromInstant().get(doc), VERSION_FROM);
    assertEquals(bean.versionToInstant().get(doc), VERSION_TO);
    assertEquals(doc.property("config").get(), item);
    assertEquals(doc.property("correctionFromInstant").get(), CORRECTION_FROM);
    assertEquals(doc.property("correctionToInstant").get(), CORRECTION_TO);
    assertEquals(doc.property("uniqueId").get(), UID);
    assertEquals(doc.property("versionFromInstant").get(), VERSION_FROM);
    assertEquals(doc.property("versionToInstant").get(), VERSION_TO);
  }

  /**
   * Tests a cycle.
   */
  @Test
  public void testCycle() {
    final ConfigDocument doc = new ConfigDocument(RATING, HistoricalTimeSeriesRating.class, NAME, UID, VERSION_FROM, VERSION_TO, CORRECTION_FROM,
        CORRECTION_TO);
    assertEncodeDecodeCycle(ConfigDocument.class, doc);
  }

  /**
   *
   */
  private static final class NamelessConfig {

    public static NamelessConfig of(final int n) {
      return new NamelessConfig(n);
    }

    private final int _n;
    private UniqueId _uid;

    private NamelessConfig(final int n) {
      _n = n;
    }

    public void setUniqueId(final UniqueId uid) {
      _uid = uid;
    }

    @Override
    public int hashCode() {
      return _n;
    }

    @Override
    public boolean equals(final Object o) {
      return o instanceof NamelessConfig && _n == ((NamelessConfig) o)._n && _uid.equals(((NamelessConfig) o)._uid);
    }
  }
}


text:
"""
Python setup file for the time_out app.

In order to register your app at pypi.python.org, create an account at
pypi.python.org and login, then register your new app like so:

    python setup.py register

If your name is still free, you can now make your first release but first you
should check if you are uploading the correct files:

    python setup.py sdist

Inspect the output thoroughly. There shouldn't be any temp files and if your
app includes staticfiles or templates, make sure that they appear in the list.
If something is wrong, you need to edit MANIFEST.in and run the command again.

If all looks good, you can make your first release:

    python setup.py sdist upload

For new releases, you need to bump the version number in
time_out/__init__.py and re-run the above command.

For more information on creating source distributions, see
http://docs.python.org/2/distutils/sourcedist.html

"""
import os
from setuptools import setup, find_packages
import time_out as app

def read(fname):
    try:
        return open(os.path.join(os.path.dirname(__file__), fname)).read()
    except IOError:
        return ''

setup(
    name="django-time-out",
    version=app.__version__,
    description=read('DESCRIPTION'),
    long_description=read('README.rst'),
    license='The MIT License',
    platforms=['OS Independent'],
    keywords='django, time-out, maintenance mode',
    author='Glyn Jackson',
    author_email='me.org',
    url="https://github.com/sparky300/django-time-out",
    packages=find_packages(),
    include_package_data=True,
    install_requires=[
        'django',
    ],
)


text:
inline std::string MakeAddress(std::string hostname, uint16_t port) {
  std::stringstream ss;
  ss << hostname << ":" << port;
  return ss.str();
}

inline void MicroToTv(uint64_t val, struct timeval *tv) {
  uint64_t secs = val / 1000000;
  uint64_t usecs = val % 1000000;

  tv->tv_sec = secs;
  tv->tv_usec = usecs;
}

inline uint64_t TvToNano(struct timeval *tv) {
  return (((uint64_t)tv->tv_sec) * 1000000 + tv->tv_usec) * 1000;
}

inline void NanoToTv(uint64_t val, struct timeval *tv) {
  uint64_t secs = val / 1000000000;
  uint64_t usecs = (val % 1000000000) / 1000;

  tv->tv_sec = secs;
  tv->tv_usec = usecs;
}

inline double TvToDouble(struct timeval *tv) {
  return tv->tv_sec + static_cast<double>(tv->tv_usec) / 1000000;
}

inline void DoubleToTv(double val, struct timeval *tv) {
  uint64_t secs = (int64_t)val;
  uint64_t usecs = (int64_t)((val - secs) * 1000000);

  tv->tv_sec = secs;
  tv->tv_usec = usecs;
}

inline uint64_t GetTimeAccurateNano() {
#if USE_CLOCK_GETTIME
  struct timespec ts;
  clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
  return ((uint64_t)ts.tv_sec) * 1000000000 + ts.tv_nsec;
#else
  struct timeval tv;
  gettimeofday(&tv, nullptr);
  return TvToNano(&tv);
#endif
}

inline uint64_t GetTimeNano() {
  struct timeval tv;
  gettimeofday(&tv, nullptr);
  return TvToNano(&tv);
}

inline double GetTimeAccurate() {
#if USE_CLOCK_GETTIME
  struct timespec ts;
  clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
  return ts.tv_sec + static_cast<double>(ts.tv_nsec) / 1000000000;
#else
  struct timeval tv;
  gettimeofday(&tv, nullptr);
  return TvToDouble(&tv);
#endif
}

inline double GetTime() {
  struct timeval tv;
  gettimeofday(&tv, nullptr);
  return TvToDouble(&tv);
}

inline addrinfo *ResolveHost(std::string hostname, uint16_t port) {
  addrinfo hints;
  addrinfo *result = nullptr;
  int err;

  // Set to resolve IP address
  std::memset(&hints, 0, sizeof(hints));
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_family = AF_INET;

  // Resolve
  if ((err = getaddrinfo(hostname.c_str(), NULL, &hints, &result)) != 0) {
    DIE("Could not resolve %s, got error %d\n", hostname.c_str(), err);
  }

  // Set port in ai_addr, treat as IPv4
  ((struct sockaddr_in *)(result->ai_addr))->sin_port = htobe16(port);

  return result;
}

void sleep_time(double duration);

#endif  // OLDISIM_UTIL_H


text:
#include <mfc/dialogs.h>

#include <win32/verinfo.h>

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

CString CMFCUtlAboutDlg::m_VerInfo=_T("");
CString CMFCUtlAboutDlg::m_Copyright=_T("");

/////////////////////////////////////////////////////////////////////////////

CMFCUtlAboutDlg::CMFCUtlAboutDlg (const int nDlgID, const int nVersionID, const int nCopyrightID, CWnd *pParent)
 : CDialog(nDlgID), m_pWnd(pParent), m_nVersionID(nVersionID), m_nCopyrightID(nCopyrightID)
{
	//{{AFX_DATA_INIT(CMFCUtlAboutDlg)
	//}}AFX_DATA_INIT
}

/////////////////////////////////////////////////////////////////////////////

void CMFCUtlAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMFCUtlAboutDlg)
	//}}AFX_DATA_MAP
}

/////////////////////////////////////////////////////////////////////////////

#define MAX_VINFO		64
#define MAX_CPYRGHT	64

BOOL CMFCUtlAboutDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	if (m_nVersionID != (-1))
	{
		CString	strAbout=_T("");
		if (m_pWnd != NULL)
		{
			CString	dlgTitle=_T("");
			m_pWnd->GetWindowText(dlgTitle);

			strAbout += dlgTitle;
		}

		if (m_VerInfo.IsEmpty())
		{
			TCHAR		szVerInfo[MAX_VINFO+2]=_T("");
			HRESULT	vhr=GetAppVersionProductVersion(NULL, szVerInfo, MAX_VINFO);
			if (ERROR_SUCCESS == vhr)
				m_VerInfo = szVerInfo;
		}

		if (!m_VerInfo.IsEmpty())
		{
			if (!strAbout.IsEmpty())
				strAbout += _T(" ");
			strAbout += m_VerInfo;
		}

		SetDlgItemText(m_nVersionID, strAbout);
	}

	if (m_nCopyrightID != (-1))
	{
		if (m_Copyright.IsEmpty())
		{
			TCHAR		szCopyright[MAX_CPYRGHT+2]=_T("");
			HRESULT	chr=GetAppVersionLegalCopyright(NULL, szCopyright, MAX_CPYRGHT);
			if (ERROR_SUCCESS == chr)
				m_Copyright = szCopyright;
		}

		SetDlgItemText(m_nCopyrightID, m_Copyright);
	}

	CMenu	*sysMenu=GetSystemMenu(FALSE);
	if (sysMenu != NULL)
		sysMenu->ModifyMenu(SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

/////////////////////////////////////////////////////////////////////////////

BEGIN_MESSAGE_MAP(CMFCUtlAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CMFCUtlAboutDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////


text:
namespace Atata
{
    /// <summary>
    /// Represents an event that occurs when <see cref="PageObject{TOwner}"/> is de-initialized.
    /// </summary>
    public class PageObjectDeInitEvent
    {
        public PageObjectDeInitEvent(UIComponent pageObject)
        {
            PageObject = pageObject;
        }

        /// <summary>
        /// Gets the page object.
        /// </summary>
        public UIComponent PageObject { get; }
    }
}


text:
package org.springframework.cloud.client.loadbalancer;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.springframework.http.HttpHeaders;
import org.springframework.http.client.AbstractClientHttpResponse;
import org.springframework.http.client.ClientHttpResponse;

/**
 * {@link RetryableStatusCodeException} that captures a {@link ClientHttpResponse}.
 *
 * @author Ryan Baxter
 */
public class ClientHttpResponseStatusCodeException extends RetryableStatusCodeException {

	private final ClientHttpResponseWrapper response;

	/**
	 * Constructor.
	 * @param serviceId The service ID.
	 * @param response The response object.
	 * @param body The response body.
	 * @throws IOException Thrown if the {@link ClientHttpResponse} response code cannot
	 * be retrieved.
	 */
	public ClientHttpResponseStatusCodeException(String serviceId, ClientHttpResponse response, byte[] body)
			throws IOException {
		super(serviceId, response.getStatusCode().value(), response, null);
		this.response = new ClientHttpResponseWrapper(response, body);
	}

	@Override
	public ClientHttpResponse getResponse() {
		return this.response;
	}

	static class ClientHttpResponseWrapper extends AbstractClientHttpResponse {

		private ClientHttpResponse response;

		private byte[] body;

		ClientHttpResponseWrapper(ClientHttpResponse response, byte[] body) {
			this.response = response;
			this.body = body;
		}

		@Override
		public int getRawStatusCode() throws IOException {
			return this.response.getStatusCode().value();
		}

		@Override
		public String getStatusText() throws IOException {
			return this.response.getStatusText();
		}

		@Override
		public void close() {
			this.response.close();
		}

		@Override
		public InputStream getBody() {
			return new ByteArrayInputStream(this.body);
		}

		@Override
		public HttpHeaders getHeaders() {
			return this.response.getHeaders();
		}

	}

}


text:
<?php

namespace Doctrine\ORM\Mapping\Driver;

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver as AbstractAnnotationDriver;
use Doctrine\ORM\Events;

/**
 * The AnnotationDriver reads the mapping metadata from docblock annotations.
 *
 * @since 2.0
 * @author Benjamin Eberlei <kontakt@beberlei.de>
 * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
 * @author Jonathan H. Wage <jonwage@gmail.com>
 * @author Roman Borschel <roman@code-factory.org>
 */
class AnnotationDriver extends AbstractAnnotationDriver
{
    /**
     * {@inheritDoc}
     */
    protected $entityAnnotationClasses = array(
        'Doctrine\ORM\Mapping\Entity' => 1,
        'Doctrine\ORM\Mapping\MappedSuperclass' => 2,
    );

    /**
     * {@inheritDoc}
     */
    public function loadMetadataForClass($className, ClassMetadata $metadata)
    {
        /* @var $metadata \Doctrine\ORM\Mapping\ClassMetadataInfo */
        $class = $metadata->getReflectionClass();
        if ( ! $class) {
            // this happens when running annotation driver in combination with
            // static reflection services. This is not the nicest fix
            $class = new \ReflectionClass($metadata->name);
        }

        $classAnnotations = $this->reader->getClassAnnotations($class);

        if ($classAnnotations) {
            foreach ($classAnnotations as $key => $annot) {
                if ( ! is_numeric($key)) {
                    continue;
                }

                $classAnnotations[get_class($annot)] = $annot;
            }
        }

        // Evaluate Entity annotation
        if (isset($classAnnotations['Doctrine\ORM\Mapping\Entity'])) {
            $entityAnnot = $classAnnotations['Doctrine\ORM\Mapping\Entity'];
            if ($entityAnnot->repositoryClass !== null) {
                $metadata->setCustomRepositoryClass($entityAnnot->repositoryClass);
            }
            if ($entityAnnot->readOnly) {
                $metadata->markReadOnly();
            }
        } else if (isset($classAnnotations['Doctrine\ORM\Mapping\MappedSuperclass'])) {
            $mappedSuperclassAnnot = $classAnnotations['Doctrine\ORM\Mapping\MappedSuperclass'];
            $metadata->setCustomRepositoryClass($mappedSuperclassAnnot->repositoryClass);
            $metadata->isMappedSuperclass = true;
        } else if (isset($classAnnotations['Doctrine\ORM\Mapping\Embeddable'])) {
            $metadata->isEmbeddedClass = true;
        } else {
            throw MappingException::classIsNotAValidEntityOrMappedSuperClass($className);
        }

        // Evaluate Table annotation
        if (isset($classAnnotations['Doctrine\ORM\Mapping\Table'])) {
            $tableAnnot = $classAnnotations['Doctrine\ORM\Mapping\Table'];
            $primaryTable = array(
                'name' => $tableAnnot->name,
                'schema' => $tableAnnot->schema
            );

            if ($tableAnnot->indexes !== null) {
                foreach ($tableAnnot->indexes as $indexAnnot) {
                    $index = array('columns' => $indexAnnot->columns);

                    if ( ! empty($indexAnnot->flags)) {
                        $index['flags'] = $indexAnnot->flags;
                    }

                    if ( ! empty($indexAnnot->name)) {
                        $primaryTable['indexes'][$indexAnnot->name] = $index;
                    } else {
                        $primaryTable['indexes'][] = $index;
                    }
                }
            }

            if ($tableAnnot->uniqueConstraints !== null) {
                foreach ($tableAnnot->uniqueConstraints as $uniqueConstraintAnnot) {
                    $uniqueConstraint = array('columns' => $uniqueConstraintAnnot->columns);

                    if ( ! empty($uniqueConstraintAnnot->name)) {
                        $primaryTable['uniqueConstraints'][$uniqueConstraintAnnot->name] = $uniqueConstraint;
                    } else {
                        $primaryTable['uniqueConstraints'][] = $uniqueConstraint;
                    }
                }
            }

            if ($tableAnnot->options) {
                $primaryTable['options'] = $tableAnnot->options;
            }

            $metadata->setPrimaryTable($primaryTable);
        }

        // Evaluate @Cache annotation
        if (isset($classAnnotations['Doctrine\ORM\Mapping\Cache'])) {
            $cacheAnnot = $classAnnotations['Doctrine\ORM\Mapping\Cache'];
            $cacheMap   = array(
                'region' => $cacheAnnot->region,
                'usage'  => constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $cacheAnnot->usage),
            );

            $metadata->enableCache($cacheMap);
        }

        // Evaluate NamedNativeQueries annotation
        if (isset($classAnnotations['Doctrine\ORM\Mapping\NamedNativeQueries'])) {
            $namedNativeQueriesAnnot = $classAnnotations['Doctrine\ORM\Mapping\NamedNativeQueries'];

            foreach ($namedNativeQueriesAnnot->value as $namedNativeQuery) {
                $metadata->addNamedNativeQuery(array(
                    'name'              => $namedNativeQuery->name,
                    'query'             => $namedNativeQuery->query,
                    'resultClass'       => $namedNativeQuery->resultClass,
                    'resultSetMapping'  => $namedNativeQuery->resultSetMapping,
                ));
            }
        }

        // Evaluate SqlResultSetMappings annotation
        if (isset($classAnnotations['Doctrine\ORM\Mapping\SqlResultSetMappings'])) {
            $sqlResultSetMappingsAnnot = $classAnnotations['Doctrine\ORM\Mapping\SqlResultSetMappings'];

            foreach ($sqlResultSetMappingsAnnot->value as $resultSetMapping) {
                $entities = array();
                $columns  = array();
                foreach ($resultSetMapping->entities as $entityResultAnnot) {
                    $entityResult = array(
                        'fields'                => array(),
                        'entityClass'           => $entityResultAnnot->entityClass,
                        'discriminatorColumn'   => $entityResultAnnot->discriminatorColumn,
                    );

                    foreach ($entityResultAnnot->fields as $fieldResultAnnot) {
                        $entityResult['fields'][] = array(
                            'name'      => $fieldResultAnnot->name,
                            'column'    => $fieldResultAnnot->column
                        );
                    }

                    $entities[] = $entityResult;
                }

                foreach ($resultSetMapping->columns as $columnResultAnnot) {
                    $columns[] = array(
                        'name' => $columnResultAnnot->name,
                    );
                }

                $metadata->addSqlResultSetMapping(array(
                    'name'          => $resultSetMapping->name,
                    'entities'      => $entities,
                    'columns'       => $columns
                ));
            }
        }

        // Evaluate NamedQueries annotation
        if (isset($classAnnotations['Doctrine\ORM\Mapping\NamedQueries'])) {
            $namedQueriesAnnot = $classAnnotations['Doctrine\ORM\Mapping\NamedQueries'];

            if ( ! is_array($namedQueriesAnnot->value)) {
                throw new \UnexpectedValueException("@NamedQueries should contain an array of @NamedQuery annotations.");
            }

            foreach ($namedQueriesAnnot->value as $namedQuery) {
                if ( ! ($namedQuery instanceof \Doctrine\ORM\Mapping\NamedQuery)) {
                    throw new \UnexpectedValueException("@NamedQueries should contain an array of @NamedQuery annotations.");
                }
                $metadata->addNamedQuery(array(
                    'name'  => $namedQuery->name,
                    'query' => $namedQuery->query
                ));
            }
        }

        // Evaluate InheritanceType annotation
        if (isset($classAnnotations['Doctrine\ORM\Mapping\InheritanceType'])) {
            $inheritanceTypeAnnot = $classAnnotations['Doctrine\ORM\Mapping\InheritanceType'];
            $metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceTypeAnnot->value));

            if ($metadata->inheritanceType != \Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_NONE) {
                // Evaluate DiscriminatorColumn annotation
                if (isset($classAnnotations['Doctrine\ORM\Mapping\DiscriminatorColumn'])) {
                    $discrColumnAnnot = $classAnnotations['Doctrine\ORM\Mapping\DiscriminatorColumn'];
                    $metadata->setDiscriminatorColumn(array(
                        'name' => $discrColumnAnnot->name,
                        'type' => $discrColumnAnnot->type,
                        'length' => $discrColumnAnnot->length,
                        'columnDefinition'    => $discrColumnAnnot->columnDefinition
                    ));
                } else {
                    $metadata->setDiscriminatorColumn(array('name' => 'dtype', 'type' => 'string', 'length' => 255));
                }

                // Evaluate DiscriminatorMap annotation
                if (isset($classAnnotations['Doctrine\ORM\Mapping\DiscriminatorMap'])) {
                    $discrMapAnnot = $classAnnotations['Doctrine\ORM\Mapping\DiscriminatorMap'];
                    $metadata->setDiscriminatorMap($discrMapAnnot->value);
                }
            }
        }

        // Evaluate DoctrineChangeTrackingPolicy annotation
        if (isset($classAnnotations['Doctrine\ORM\Mapping\ChangeTrackingPolicy'])) {
            $changeTrackingAnnot = $classAnnotations['Doctrine\ORM\Mapping\ChangeTrackingPolicy'];
            $metadata->setChangeTrackingPolicy(constant('Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_' . $changeTrackingAnnot->value));
        }

        // Evaluate annotations on properties/fields
        /* @var $property \ReflectionProperty */
        foreach ($class->getProperties() as $property) {
            if ($metadata->isMappedSuperclass && ! $property->isPrivate()
                ||
                $metadata->isInheritedField($property->name)
                ||
                $metadata->isInheritedAssociation($property->name)
                ||
                $metadata->isInheritedEmbeddedClass($property->name)) {
                continue;
            }

            $mapping = array();
            $mapping['fieldName'] = $property->getName();

            // Check for JoinColumn/JoinColumns annotations
            $joinColumns = array();

            if ($joinColumnAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\JoinColumn')) {
                $joinColumns[] = $this->joinColumnToArray($joinColumnAnnot);
            } else if ($joinColumnsAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\JoinColumns')) {
                foreach ($joinColumnsAnnot->value as $joinColumn) {
                    $joinColumns[] = $this->joinColumnToArray($joinColumn);
                }
            }

            // Field can only be annotated with one of:
            // @Column, @OneToOne, @OneToMany, @ManyToOne, @ManyToMany
            if ($columnAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Column')) {
                if ($columnAnnot->type == null) {
                    throw MappingException::propertyTypeIsRequired($className, $property->getName());
                }

                $mapping = $this->columnToArray($property->getName(), $columnAnnot);

                if ($idAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Id')) {
                    $mapping['id'] = true;
                }

                if ($generatedValueAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\GeneratedValue')) {
                    $metadata->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_' . $generatedValueAnnot->strategy));
                }

                if ($this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Version')) {
                    $metadata->setVersionMapping($mapping);
                }

                $metadata->mapField($mapping);

                // Check for SequenceGenerator/TableGenerator definition
                if ($seqGeneratorAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\SequenceGenerator')) {
                    $metadata->setSequenceGeneratorDefinition(array(
                        'sequenceName' => $seqGeneratorAnnot->sequenceName,
                        'allocationSize' => $seqGeneratorAnnot->allocationSize,
                        'initialValue' => $seqGeneratorAnnot->initialValue
                    ));
                } else if ($this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\TableGenerator')) {
                    throw MappingException::tableIdGeneratorNotImplemented($className);
                } else if ($customGeneratorAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\CustomIdGenerator')) {
                    $metadata->setCustomGeneratorDefinition(array(
                        'class' => $customGeneratorAnnot->class
                    ));
                }
            } else if ($oneToOneAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\OneToOne')) {
                if ($idAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Id')) {
                    $mapping['id'] = true;
                }

                $mapping['targetEntity'] = $oneToOneAnnot->targetEntity;
                $mapping['joinColumns'] = $joinColumns;
                $mapping['mappedBy'] = $oneToOneAnnot->mappedBy;
                $mapping['inversedBy'] = $oneToOneAnnot->inversedBy;
                $mapping['cascade'] = $oneToOneAnnot->cascade;
                $mapping['orphanRemoval'] = $oneToOneAnnot->orphanRemoval;
                $mapping['fetch'] = $this->getFetchMode($className, $oneToOneAnnot->fetch);
                $metadata->mapOneToOne($mapping);
            } else if ($oneToManyAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\OneToMany')) {
                $mapping['mappedBy'] = $oneToManyAnnot->mappedBy;
                $mapping['targetEntity'] = $oneToManyAnnot->targetEntity;
                $mapping['cascade'] = $oneToManyAnnot->cascade;
                $mapping['indexBy'] = $oneToManyAnnot->indexBy;
                $mapping['orphanRemoval'] = $oneToManyAnnot->orphanRemoval;
                $mapping['fetch'] = $this->getFetchMode($className, $oneToManyAnnot->fetch);

                if ($orderByAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\OrderBy')) {
                    $mapping['orderBy'] = $orderByAnnot->value;
                }

                $metadata->mapOneToMany($mapping);
            } else if ($manyToOneAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\ManyToOne')) {
                if ($idAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Id')) {
                    $mapping['id'] = true;
                }

                $mapping['joinColumns'] = $joinColumns;
                $mapping['cascade'] = $manyToOneAnnot->cascade;
                $mapping['inversedBy'] = $manyToOneAnnot->inversedBy;
                $mapping['targetEntity'] = $manyToOneAnnot->targetEntity;
                $mapping['fetch'] = $this->getFetchMode($className, $manyToOneAnnot->fetch);
                $metadata->mapManyToOne($mapping);
            } else if ($manyToManyAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\ManyToMany')) {
                $joinTable = array();

                if ($joinTableAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\JoinTable')) {
                    $joinTable = array(
                        'name' => $joinTableAnnot->name,
                        'schema' => $joinTableAnnot->schema
                    );

                    foreach ($joinTableAnnot->joinColumns as $joinColumn) {
                        $joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumn);
                    }

                    foreach ($joinTableAnnot->inverseJoinColumns as $joinColumn) {
                        $joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumn);
                    }
                }

                $mapping['joinTable'] = $joinTable;
                $mapping['targetEntity'] = $manyToManyAnnot->targetEntity;
                $mapping['mappedBy'] = $manyToManyAnnot->mappedBy;
                $mapping['inversedBy'] = $manyToManyAnnot->inversedBy;
                $mapping['cascade'] = $manyToManyAnnot->cascade;
                $mapping['indexBy'] = $manyToManyAnnot->indexBy;
                $mapping['orphanRemoval'] = $manyToManyAnnot->orphanRemoval;
                $mapping['fetch'] = $this->getFetchMode($className, $manyToManyAnnot->fetch);

                if ($orderByAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\OrderBy')) {
                    $mapping['orderBy'] = $orderByAnnot->value;
                }

                $metadata->mapManyToMany($mapping);
            } else if ($embeddedAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Embedded')) {
                $mapping['class'] = $embeddedAnnot->class;
                $mapping['columnPrefix'] = $embeddedAnnot->columnPrefix;
                $metadata->mapEmbedded($mapping);
            }

            // Evaluate @Cache annotation
            if (($cacheAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Cache')) !== null) {
                $metadata->enableAssociationCache($mapping['fieldName'], array(
                    'usage'         => constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $cacheAnnot->usage),
                    'region'        => $cacheAnnot->region,
                ));
            }
        }

        // Evaluate AssociationOverrides annotation
        if (isset($classAnnotations['Doctrine\ORM\Mapping\AssociationOverrides'])) {
            $associationOverridesAnnot = $classAnnotations['Doctrine\ORM\Mapping\AssociationOverrides'];

            foreach ($associationOverridesAnnot->value as $associationOverride) {
                $override   = array();
                $fieldName  = $associationOverride->name;

                // Check for JoinColumn/JoinColumns annotations
                if ($associationOverride->joinColumns) {
                    $joinColumns = array();
                    foreach ($associationOverride->joinColumns as $joinColumn) {
                        $joinColumns[] = $this->joinColumnToArray($joinColumn);
                    }
                    $override['joinColumns'] = $joinColumns;
                }

                // Check for JoinTable annotations
                if ($associationOverride->joinTable) {
                    $joinTableAnnot = $associationOverride->joinTable;
                    $joinTable      = array(
                        'name'      => $joinTableAnnot->name,
                        'schema'    => $joinTableAnnot->schema
                    );

                    foreach ($joinTableAnnot->joinColumns as $joinColumn) {
                        $joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumn);
                    }

                    foreach ($joinTableAnnot->inverseJoinColumns as $joinColumn) {
                        $joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumn);
                    }

                    $override['joinTable'] = $joinTable;
                }

                $metadata->setAssociationOverride($fieldName, $override);
            }
        }

        // Evaluate AttributeOverrides annotation
        if (isset($classAnnotations['Doctrine\ORM\Mapping\AttributeOverrides'])) {
            $attributeOverridesAnnot = $classAnnotations['Doctrine\ORM\Mapping\AttributeOverrides'];
            foreach ($attributeOverridesAnnot->value as $attributeOverrideAnnot) {
                $attributeOverride = $this->columnToArray($attributeOverrideAnnot->name, $attributeOverrideAnnot->column);
                $metadata->setAttributeOverride($attributeOverrideAnnot->name, $attributeOverride);
            }
        }

        // Evaluate EntityListeners annotation
        if (isset($classAnnotations['Doctrine\ORM\Mapping\EntityListeners'])) {
            $entityListenersAnnot = $classAnnotations['Doctrine\ORM\Mapping\EntityListeners'];

            foreach ($entityListenersAnnot->value as $item) {
                $listenerClassName = $metadata->fullyQualifiedClassName($item);

                if ( ! class_exists($listenerClassName)) {
                    throw MappingException::entityListenerClassNotFound($listenerClassName, $className);
                }

                $hasMapping     = false;
                $listenerClass  = new \ReflectionClass($listenerClassName);
                /* @var $method \ReflectionMethod */
                foreach ($listenerClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
                    // find method callbacks.
                    $callbacks  = $this->getMethodCallbacks($method);
                    $hasMapping = $hasMapping ?: ( ! empty($callbacks));

                    foreach ($callbacks as $value) {
                        $metadata->addEntityListener($value[1], $listenerClassName, $value[0]);
                    }
                }
                // Evaluate the listener using naming convention.
                if ( ! $hasMapping ) {
                    EntityListenerBuilder::bindEntityListener($metadata, $listenerClassName);
                }
            }
        }

        // Evaluate @HasLifecycleCallbacks annotation
        if (isset($classAnnotations['Doctrine\ORM\Mapping\HasLifecycleCallbacks'])) {
            /* @var $method \ReflectionMethod */
            foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {

                foreach ($this->getMethodCallbacks($method) as $value) {

                    $metadata->addLifecycleCallback($value[0], $value[1]);
                }
            }
        }
    }

    /**
     * Attempts to resolve the fetch mode.
     *
     * @param string $className The class name.
     * @param string $fetchMode The fetch mode.
     *
     * @return integer The fetch mode as defined in ClassMetadata.
     *
     * @throws MappingException If the fetch mode is not valid.
     */
    private function getFetchMode($className, $fetchMode)
    {
        if( ! defined('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $fetchMode)) {
            throw MappingException::invalidFetchMode($className,  $fetchMode);
        }

        return constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $fetchMode);
    }

    /**
     * Parses the given method.
     *
     * @param \ReflectionMethod $method
     *
     * @return array
     */
    private function getMethodCallbacks(\ReflectionMethod $method)
    {
        $callbacks   = array();
        $annotations = $this->reader->getMethodAnnotations($method);

        foreach ($annotations as $annot) {
            if ($annot instanceof \Doctrine\ORM\Mapping\PrePersist) {
                $callbacks[] = array($method->name, Events::prePersist);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PostPersist) {
                $callbacks[] = array($method->name, Events::postPersist);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PreUpdate) {
                $callbacks[] = array($method->name, Events::preUpdate);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PostUpdate) {
                $callbacks[] = array($method->name, Events::postUpdate);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PreRemove) {
                $callbacks[] = array($method->name, Events::preRemove);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PostRemove) {
                $callbacks[] = array($method->name, Events::postRemove);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PostLoad) {
                $callbacks[] = array($method->name, Events::postLoad);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PreFlush) {
                $callbacks[] = array($method->name, Events::preFlush);
            }
        }

        return $callbacks;
    }

    /**
     * Parse the given JoinColumn as array
     *
     * @param JoinColumn $joinColumn
     * @return array
     */
    private function joinColumnToArray(JoinColumn $joinColumn)
    {
        return array(
            'name' => $joinColumn->name,
            'unique' => $joinColumn->unique,
            'nullable' => $joinColumn->nullable,
            'onDelete' => $joinColumn->onDelete,
            'columnDefinition' => $joinColumn->columnDefinition,
            'referencedColumnName' => $joinColumn->referencedColumnName,
        );
    }

    /**
     * Parse the given Column as array
     *
     * @param string $fieldName
     * @param Column $column
     *
     * @return array
     */
    private function columnToArray($fieldName, Column $column)
    {
        $mapping = array(
            'fieldName' => $fieldName,
            'type'      => $column->type,
            'scale'     => $column->scale,
            'length'    => $column->length,
            'unique'    => $column->unique,
            'nullable'  => $column->nullable,
            'precision' => $column->precision
        );

        if ($column->options) {
            $mapping['options'] = $column->options;
        }

        if (isset($column->name)) {
            $mapping['columnName'] = $column->name;
        }

        if (isset($column->columnDefinition)) {
            $mapping['columnDefinition'] = $column->columnDefinition;
        }

        return $mapping;
    }

    /**
     * Factory method for the Annotation Driver.
     *
     * @param array|string          $paths
     * @param AnnotationReader|null $reader
     *
     * @return AnnotationDriver
     */
    static public function create($paths = array(), AnnotationReader $reader = null)
    {
        if ($reader == null) {
            $reader = new AnnotationReader();
        }

        return new self($reader, $paths);
    }
}


text:
package org.sparkcommerce.openadmin.server.security.ldap;

import org.apache.commons.lang.StringUtils;
import org.sparkcommerce.openadmin.server.security.domain.AdminPermission;
import org.sparkcommerce.openadmin.server.security.domain.AdminRole;
import org.sparkcommerce.openadmin.server.security.domain.AdminUser;
import org.sparkcommerce.openadmin.server.security.domain.AdminUserImpl;
import org.sparkcommerce.openadmin.server.security.service.AdminSecurityService;
import org.sparkcommerce.openadmin.server.security.service.AdminUserDetails;
import org.springframework.ldap.core.DirContextOperations;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.ldap.userdetails.LdapUserDetailsMapper;

import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.annotation.Resource;

/**
 * This is used to map LDAP principal and authorities into SC security model.
 *
 * @author Kelly Tisdell
 *
 */
public class SparkAdminLdapUserDetailsMapper extends LdapUserDetailsMapper {

    @Resource(name = "blAdminSecurityService")
    protected AdminSecurityService securityService;

    protected Map<String, String[]> roleNameSubstitutions;

    @Override
    public UserDetails mapUserFromContext(DirContextOperations ctx, String username, Collection<? extends GrantedAuthority> authorities) {
        HashSet<String> newRoles = new HashSet<String>();

        if (roleNameSubstitutions != null && !roleNameSubstitutions.isEmpty()) {
            for (GrantedAuthority authority : authorities) {
                if (roleNameSubstitutions.containsKey(authority.getAuthority())) {
                    String[] roles = roleNameSubstitutions.get(authority.getAuthority());
                    for (String role : roles) {
                        newRoles.add(role.trim());
                    }
                } else {
                    newRoles.add(authority.getAuthority());
                }
            }
        } else {
            for (GrantedAuthority authority : authorities) {
                newRoles.add(authority.getAuthority());
            }
        }

        Collection<GrantedAuthority> newAuthorities = new HashSet<GrantedAuthority>();
        for (String perm : AdminSecurityService.DEFAULT_PERMISSIONS) {
            newAuthorities.add(new SimpleGrantedAuthority(perm));
        }

        HashSet<AdminRole> grantedRoles = new HashSet<AdminRole>();
        List<AdminRole> adminRoles = securityService.readAllAdminRoles();
        if (adminRoles != null) {
            for (AdminRole role : adminRoles) {
                if (newRoles.contains(role.getName())) {
                    grantedRoles.add(role);
                    Set<AdminPermission> permissions = role.getAllPermissions();
                    if (permissions != null && !permissions.isEmpty()) {
                        for (AdminPermission permission : permissions) {
                            if (permission.isFriendly()) {
                                for (AdminPermission childPermission : permission.getAllChildPermissions()) {
                                    newAuthorities.add(new SimpleGrantedAuthority(childPermission.getName()));
                                }
                            } else {
                                newAuthorities.add(new SimpleGrantedAuthority(permission.getName()));
                            }
                        }
                    }
                }
            }
        }

        String email = (String) ctx.getObjectAttribute("mail");
        String firstName = (String) ctx.getObjectAttribute("givenName");
        String lastName = (String) ctx.getObjectAttribute("sn");
        AdminUser adminUser = securityService.readAdminUserByUserName(username);
        if (adminUser == null) {
            adminUser = new AdminUserImpl();
            adminUser.setLogin(username);
        }

        if (StringUtils.isNotBlank(email)) {
            adminUser.setEmail(email);
        }

        StringBuilder name = new StringBuilder();
        if (StringUtils.isNotBlank(firstName)) {
            name.append(firstName).append(" ");
        }
        if (StringUtils.isNotBlank(lastName)) {
            name.append(lastName);
        }

        String fullName = name.toString();
        if (StringUtils.isNotBlank(fullName)) {
            adminUser.setName(fullName);
        } else {
            adminUser.setName(username);
        }

        adminUser = saveAdminUserAndSecurityData(adminUser, grantedRoles);

        return new AdminUserDetails(adminUser.getId(), username, "", true, true, true, true, newAuthorities);
    }

    protected AdminUser saveAdminUserAndSecurityData(AdminUser adminUser, Set<AdminRole> adminRoles) {
        //We have to do this because SC replies on the role relationships being stored in the DB
        Set<AdminRole> roleSet = adminUser.getAllRoles();
        //First, remove all roles associated with the user if they already existed
        if (roleSet != null) {
            //First, remove all role relationships in case they have changed
            roleSet.clear();
        } else {
            roleSet = new HashSet<AdminRole>();
            adminUser.setAllRoles(roleSet);
        }

        //Now, add all of the role relationships back.
        if (adminRoles != null) {
            for (AdminRole role : adminRoles) {
                roleSet.add(role);
            }
        }
        //Save the user data and all of the roles...
        return securityService.saveAdminUser(adminUser);
    }

    /**
     * This allows you to declaratively set a map containing values that will substitute role names from LDAP to Spark roles names in cases that they might be different.
     * For example, if you have a role specified in LDAP under "memberOf" with a DN of "Marketing Administrator", you might want to
     * map that to the role "ADMIN".  By default the prefix "ROLE_" will be pre-pended to this name. So to configure this, you would specify:
     *
     * <bean class="org.spark.loadtest.web.security.ActiveDirectoryUserDetailsContextMapper">
     *     <property name="roleMappings">
     *         <map>
     *             <entry key="Marketing_Administrator" value="ROLE_CATALOG_ADMIN"/>
     *         </map>
     *     </property>
     * </bean>
     *
     * With this configuration, all roles returned by LDAP that have a DN of "Marketing Administrator" will be converted to "ADMIN"
     * @param roleNameSubstitutions
     */
    public void setRoleNameSubstitutions(Map<String, String[]> roleNameSubstitutions) {
        this.roleNameSubstitutions = roleNameSubstitutions;
    }
}


text:
'''PandaCore.Tools.root_interface

Some tools defining interfaces between ROOT and other data structures.
Essentially wrappers around root_numpy
'''

import numpy as np
from PandaCore.Utils.root import root
import root_numpy as rnp
from array import array
from PandaCore.Utils.logging import Logger
import types

_logger = Logger('root_interface')
_hcounter = 0

# MISC -----------------------------------------------------------------
def rename_dtypes(xarr, repl, old_names = None):
    if old_names:
        for n in xarr.dtype.names:
            old_names.append(n)
    new_names = tuple((repl[x] for x in xarr.dtype.names))
    xarr.dtype.names = new_names

# FILE INPUT ------------------------------------------------------------
def read_branches(filenames, tree, branches, cut, treename = "events", xkwargs = {}):
    if not(filenames or treename) or (filenames and tree):
        _logger.error("root_interface.read_branches", "Exactly one of filenames and tree should be specified!")
        return None
    if branches:
        branches_ = list(set(branches)) # remove duplicates
    else:
        branches_ = None
    if filenames:
        return rnp.root2array(filenames = filenames,
                              treename = treename,
                              branches = branches_,
                              selection = cut,
                              **xkwargs)
    else:
        return rnp.tree2array(tree = tree,
                              branches = branches_,
                              selection = cut,
                              **xkwargs)

def read_files(filenames, branches, cut = None, treename = 'events', xkwargs = {}):
    return read_branches(filenames = filenames,
                         tree = None,
                         branches = branches,
                         cut = cut,
                         treename = treename,
                         xkwargs = xkwargs)

def read_tree(tree, branches, cut = None, xkwargs = {}):
    return read_branches(filenames = None,
                         tree = tree,
                         branches = branches,
                         cut = cut,
                         xkwargs = xkwargs)

# FILE OUTPUT --------------------------------------------------------------
def array_as_tree(xarr, treename = None, fcontext = None, xkwargs = {}):
    # combines array2tree and array2root but leaves TFile manipulation for the user
    context = None
    if fcontext:
        context = root.TDirectory.TContext(fcontext)
    tree = rnp.array2tree(xarr, treename, **xkwargs)
    if fcontext:
        fcontext.WriteTObject(tree, treename)
    if context:
        del context
    return tree

def _isfn(f):
    return type(f) == types.FunctionType

# HISTOGRAM MANIPULATION ---------------------------------------------------
def draw_hist(hist, xarr, fields, weight = None, mask=None):
    warr = xarr[weight] if (weight is not None) else None
    if (warr is not None) and len(warr.shape)>1:
        warr = warr[:,0]
    if mask is not None:
        mask = mask.flatten()

    if len(fields) == 1:
        if _isfn(fields[0]):
            varr = fields[0](xarr).flatten()
        else:
            varr = xarr[fields[0]].flatten()
        if mask is not None:
            varr = varr[mask]
    else:
        varr = [f(xarr).flatten() if _isfn(f) else xarr[f].flatten() for f in fields]
        if mask is not None:
            varr = [v[mask] for v in varr]
        varr = np.array(varr)
        varr = varr.transpose()
    return rnp.fill_hist(hist = hist, array = varr, weights = warr)

# Put everything into a class ---------------------------------------------
class Selector(object):
    def __init__(self):
        self.data = None
        self._nicknames = {}
    def to_dict(self):
        if self.data is None:
            return
        self.data = {k:self.data[k] for k in self.data.dtype.names}
    def flatten(self):
        if self.data is None:
            return
        self.to_dict()
        self.data = {k:v.flatten() for k,v in self.data.iteritems()}
    def read_files(self, *args, **kwargs):
        self.data = read_files(*args, **kwargs)
    def read_tree(self, *args, **kwargs):
        self.data = read_tree(*args, **kwargs)
    def rename(self, a, b = None):
        if b :
            self._nicknames[a] = b
        else:
            self._nicknames.update(a)
    def __setitem__(self, k, item):
        self.data[k] = item
    def __getitem__(self, k):
        if type(k)==list:
            keys = [self._nicknames[kk] if kk in self._nicknames else kk for kk in k]
        elif type(k)==str and k in self._nicknames:
            keys = self._nicknames[k]
        else:
            keys = k
        return self.data[keys]
    def clone(self, copy = False):
        other = Selector()
        other.rename(self._nicknames)
        if copy:
            other.data = np.copy(self.data)
        else:
            other.data = self.data
        return other
    def save(self, fpath, treename, opts = 'RECREATE'):
        f = root.TFile(fpath, opts)
        array_as_tree(self.data, treename, f)
        f.Close()
    def draw(self, fields, weight = None, mask = None, hbase = None, vbins = None, fbins = None):
        global _hcounter
        if hbase is not None:
            h = hbase.Clone()
        elif vbins is not None:
            h = root.TH1D('hSelector%i'%_hcounter, '', len(vbins)-1, array('f', vbins))
            _hcounter += 1
        else:
            h = root.TH1D('hSelector%i'%_hcounter, '', *fbins)
            _hcounter += 1
        if type(fields)==str:
            fields = [fields]
        draw_hist(h, self.data, fields, weight, mask)
        return h


text:
using System;

namespace CAESAR.Chess.Moves.Exceptions
{
    /// <summary>
    ///     The exception that is thrown when an <seealso cref="IMove" /> cannot be undone.
    /// </summary>
    public class CannotUndoMoveException : InvalidOperationException
    {
        /// <summary>
        ///     Initializes a new instance of the <seealso cref="CannotUndoMoveException" /> with the specified
        ///     <seealso cref="MoveOperationFailureReason" />.
        /// </summary>
        /// <param name="reason">The specified <seealso cref="MoveOperationFailureReason" />.</param>
        public CannotUndoMoveException(MoveOperationFailureReason reason = MoveOperationFailureReason.Unknown)
            : base("Cannot undo move")
        {
            Reason = reason;
        }

        /// <summary>
        ///     The <seealso cref="MoveOperationFailureReason" /> that the undo of the <seealso cref="IMove" /> failed.
        /// </summary>
        public MoveOperationFailureReason Reason { get; }
    }
}


text:
Following Along With Cameron's Class

Arthur is Following


text:
/*
 * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package java.awt.event;

import java.util.EventListener;

/**
 * The listener interface for receiving "interesting" mouse events
 * (press, release, click, enter, and exit) on a component.
 * (To track mouse moves and mouse drags, use the
 * MouseMotionListener.)
 *

 * The class that is interested in processing a mouse event
 * either implements this interface (and all the methods it
 * contains) or extends the abstract MouseAdapter class
 * (overriding only the methods of interest).
 *

 * The listener object created from that class is then registered with a
 * component using the component's addMouseListener
 * method. A mouse event is generated when the mouse is pressed, released
 * clicked (pressed and released). A mouse event is also generated when
 * the mouse cursor enters or leaves a component. When a mouse event
 * occurs, the relevant method in the listener object is invoked, and
 * the MouseEvent is passed to it.
 *
 * @author Carl Quinn
 *
 * @see MouseAdapter
 * @see MouseEvent
 * @see Tutorial: Writing a Mouse Listener
 *
 * @since 1.1
 */
public interface MouseListener extends EventListener {

    /**
     * Invoked when the mouse button has been clicked (pressed
     * and released) on a component.
     */
    public void mouseClicked(MouseEvent e);

    /**
     * Invoked when a mouse button has been pressed on a component.
     */
    public void mousePressed(MouseEvent e);

    /**
     * Invoked when a mouse button has been released on a component.
     */
    public void mouseReleased(MouseEvent e);

    /**
     * Invoked when the mouse enters a component.
     */
    public void mouseEntered(MouseEvent e);

    /**
     * Invoked when the mouse exits a component.
     */
    public void mouseExited(MouseEvent e);
}


text:
import {base64DecodeToBytes} from '../../../src/utils/base64';
import {utf8Decode} from '../../../src/utils/bytes';
import {AmpA4A} from '../../amp-a4a/0.1/amp-a4a';
import {dev, user} from '../../../src/log';

export class AmpAdNetworkFakeImpl extends AmpA4A {

  /**
   * @param {!Element} element
   */
  constructor(element) {
    super(element);
    user().assert(element.hasAttribute('src'),
        'Attribute src required for <amp-ad type="fake">: %s', element);
    user().assert(TextEncoder, '<amp-ad type="fake"> requires browser'
        + ' support for TextEncoder() function.');
  }

  /** @override */
  isValidElement() {
    // Note: true is the default, so this method is not strictly needed here.
    // But a network implementation might choose to implement a real check
    // in this method.
    return true;
  }

  /** @override */
  getAdUrl() {
    return '/extensions/amp-ad-network-fake-impl/0.1/data/' +
        this.element.getAttribute('src');
  }

  /** @override */
  extractCreativeAndSignature(responseText, unusedResponseHeaders) {
    return utf8Decode(responseText).then(deserialized => {
      const decoded = JSON.parse(deserialized);
      dev().info('AMP-AD-FAKE', 'Decoded response text =', decoded['creative']);
      dev().info('AMP-AD-FAKE', 'Decoded signature =', decoded['signature']);
      const encoder = new TextEncoder('utf-8');
      return {
        creative: encoder.encode(decoded['creative']).buffer,
        signature: base64DecodeToBytes(decoded['signature']),
      };
    });
  }
}

AMP.registerElement(
    'amp-ad-network-fake-impl', AmpAdNetworkFakeImpl);


text:
/**
 * @fileoverview A deserializer that decodes EE object trees from JSON DAGs.
 *
 */

goog.provide('ee.Deserializer');

goog.require('ee.ApiFunction');
goog.require('ee.ComputedObject');
goog.require('ee.CustomFunction');
goog.require('ee.Date');
goog.require('ee.Encodable');
goog.require('ee.Function');
goog.require('ee.Geometry');
goog.require('ee.api');
goog.require('ee.apiclient');
goog.require('ee.rpc_node');
goog.require('goog.array');
goog.require('goog.object');

/**
 * A deserializer for EE object trees.
 * @constructor
 */
ee.Deserializer = function() {};
// Exporting manually to avoid marking the class public in the docs.
goog.exportSymbol('ee.Deserializer', ee.Deserializer);

/**
 * Deserialize an object from a JSON string appropriate for API calls.
 * @param {string} json The JSON representation of the input.
 * @return {*} The deserialized object.
 * @export
 */
ee.Deserializer.fromJSON = function(json) {
  return ee.Deserializer.decode(JSON.parse(json));
};

/**
 * Decodes an object previously encoded using the EE API v2 (DAG) format.
 *
 * @param {*} json The serialied object to decode.
 * @return {*} The decoded object.
 * @export
 */
ee.Deserializer.decode = function(json) {
  if (('result' in json) && ('values' in json)) {
    return ee.Deserializer.decodeCloudApi(json);
  }
  const namedValues = {};

  // Incrementally decode scope entries if there are any.
  if (goog.isObject(json) && json['type'] === 'CompoundValue') {
    const scopes = json['scope'];
    for (let i = 0; i < scopes.length; i++) {
      const key = scopes[i][0];
      const value = scopes[i][1];
      if (key in namedValues) {
        throw new Error(`Duplicate scope key "${key}" in scope #${i}.`);
      }
      namedValues[key] = ee.Deserializer.decodeValue_(value, namedValues);
    }
    json = json['value'];
  }

  // Decode the final value.
  return ee.Deserializer.decodeValue_(json, namedValues);
};

/**
 * Decodes an object previously encoded using the EE API v2 (DAG) format. This
 * uses a provided scopre for ValueRef lookup and does not not allow the input
 * to be a CompoundValue.
 *
 * @param {*} json The serialied object to decode.
 * @param {!Object} namedValues The objects that can be referenced by ValueRefs.
 * @return {*} The decoded object.
 * @private
 */
ee.Deserializer.decodeValue_ = function(json, namedValues) {
  // Check for primitive values.
  if (json === null || typeof json === 'number' || typeof json === 'boolean' ||
      typeof json === 'string') {
    return json;
  }

  // Check for array values.
  if (Array.isArray(json)) {
    return goog.array.map(json, function(element) {
      return ee.Deserializer.decodeValue_(element, namedValues);
    });
  }

  // Ensure that we've got a proper object at this point.
  if (!goog.isObject(json) || typeof json === 'function') {
    throw new Error('Cannot decode object: ' + json);
  }

  // Check for explicitly typed values.
  const typeName = json['type'];
  switch (typeName) {
    case 'ValueRef':
      if (json['value'] in namedValues) {
        return namedValues[json['value']];
      } else {
        throw new Error('Unknown ValueRef: ' + json);
      }
    case 'ArgumentRef':
      const varName = json['value'];
      if (typeof varName !== 'string') {
        throw new Error('Invalid variable name: ' + varName);
      }
      return ee.CustomFunction.variable(Object, varName);
    case 'Date':
      const microseconds = json['value'];
      if (typeof microseconds !== 'number') {
        throw new Error('Invalid date value: ' + microseconds);
      }
      return new ee.Date(microseconds / 1000);
    case 'Bytes':
      const bytes = /** @type {string} */(json);
      return ee.Deserializer.roundTrip_(
          new ee.api.ValueNode({bytesValue: bytes}), bytes);
    case 'Invocation':
      let func;
      if ('functionName' in json) {
        func = ee.ApiFunction.lookup(json['functionName']);
      } else {
        func = ee.Deserializer.decodeValue_(json['function'], namedValues);
      }
      const args = goog.object.map(json['arguments'], function(element) {
        return ee.Deserializer.decodeValue_(element, namedValues);
      });
      return ee.Deserializer.invocation_(func, args);
    case 'Dictionary':
      return goog.object.map(json['value'], function(element) {
        return ee.Deserializer.decodeValue_(element, namedValues);
      });
    case 'Function':
      const body = ee.Deserializer.decodeValue_(json['body'], namedValues);
      const signature = {
        'name': '',
        'args': goog.array.map(json['argumentNames'], function(argName) {
          return {
            'name': argName,
            'type': 'Object',
            'optional': false
          };
        }),
        'returns': 'Object'
      };
      return new ee.CustomFunction(signature, function() { return body; });
    case 'Point':
    case 'MultiPoint':
    case 'LineString':
    case 'MultiLineString':
    case 'Polygon':
    case 'MultiPolygon':
    case 'LinearRing':
    case 'GeometryCollection':
      return new ee.Geometry(json);
    case 'CompoundValue':
      throw new Error('Nested CompoundValues are disallowed.');
    default:
      throw new Error('Unknown encoded object type: ' + typeName);
  }
};

/**
 * Ensures that values can still be round-tripped, for cases that are never
 * generated by production client code.
 * @param {!ee.api.ValueNode} node Node in the serialized object tree.
 * @param {string} value JSON representation of the value.
 * @return {!ee.Encodable}
 * @private
 */
ee.Deserializer.roundTrip_ = function(node, value) {
  class Reencoder extends ee.Encodable {
    /** @override */ encode(encoder) {
      return value;
    }
    /** @override */ encodeCloudValue(encoder) {
      return node;
    }
  }
  return new Reencoder();
};

/**
 * Creates an EE object that represents the application of `func` to `args`.
 * @param {*} func Object to be treated as a callable.
 * @param {!Object<string, *>} args Key-value map of arguments.
 * @return {!ee.ComputedObject}
 * @private
 */
ee.Deserializer.invocation_ = function(func, args) {
  if (func instanceof ee.Function) {
    return func.apply(args);  // Returns ComputedObject
  } else if (func instanceof ee.ComputedObject) {
    // We have to allow ComputedObjects for cases where invocations
    // return a function, e.g. Image.parseExpression().
    const funcComputed = /** @type {!ee.ComputedObject} */(func);
    class ComputedFunction extends ee.Function {
      /** @override @return {*} */
      encode(/** function(*):* */ encoder) {
        return funcComputed.encode(encoder);
      }
      /** @override @return {!ee.api.ValueNode} */
      encodeCloudInvocation(
          /** !ee.Encodable.Serializer */ serializer, /** ? */ args) {
        return ee.rpc_node.functionByReference(
            serializer.makeReference(funcComputed), args);
      }
    }
    // Don't need to set function signature, since we don't have to re-promote.
    return new ee.ComputedObject(new ComputedFunction(), args);
  }
  throw new Error('Invalid function value');
};

/**
 * Deserializes an object from the JSON string used in Cloud API calls.
 * @param {string} json The JSON representation of the input.
 * @return {*} The deserialized object.
 * @export
 */
ee.Deserializer.fromCloudApiJSON = function(json) {
  return ee.Deserializer.decodeCloudApi(JSON.parse(json));
};

/**
 * Decodes an object previously encoded using the EE Cloud API format.
 * @param {*} json The serialized object to decode.
 * @return {*} The decoded object.
 * @export
 */
ee.Deserializer.decodeCloudApi = function(json) {
  const expression = ee.apiclient.deserialize(ee.api.Expression, json);

  const decoded = {};
  const lookup = (reference, kind) => {
    if (!(reference in decoded)) {
      if (!(reference in expression.values)) {
        throw new Error(`Cannot find ${kind} ${reference}`);
      }
      decoded[reference] = decode(expression.values[reference]);
    }
    return decoded[reference];
  };

  const decode = (node) => {
    if (node.constantValue !== null) {
      return node.constantValue;
    } else if (node.arrayValue !== null) {
      return node.arrayValue.values.map(decode);
    } else if (node.dictionaryValue !== null) {
      return goog.object.map(node.dictionaryValue.values, decode);
    } else if (node.argumentReference !== null) {
      return ee.CustomFunction.variable(Object, node.argumentReference);
    } else if (node.functionDefinitionValue !== null) {
      return decodeFunctionDefinition(node.functionDefinitionValue);
    } else if (node.functionInvocationValue !== null) {
      return decodeFunctionInvocation(node.functionInvocationValue);
    } else if (node.bytesValue !== null) {
      return ee.Deserializer.roundTrip_(
          new ee.api.ValueNode({bytesValue: node.bytesValue}), node.bytesValue);
    } else if (node.integerValue !== null) {
      return ee.Deserializer.roundTrip_(
          new ee.api.ValueNode({integerValue: node.integerValue}),
          node.integerValue);
    } else if (node.valueReference !== null) {
      return lookup(node.valueReference, 'reference');
    }
    return null;  // From the null constantValue
  };

  const decodeFunctionDefinition = (defined) => {
    const body = lookup(defined.body, 'function body');
    const args = defined.argumentNames.map(
        name => ({name, type: 'Object', optional: false}));
    const signature = {args, name: '', returns: 'Object'};
    return new ee.CustomFunction(signature, () => body);
  };

  const decodeFunctionInvocation = (invoked) => {
    const func = invoked.functionReference ?
        lookup(invoked.functionReference, 'function') :
        ee.ApiFunction.lookup(invoked.functionName);
    const args = goog.object.map(invoked.arguments, decode);
    return ee.Deserializer.invocation_(func, args);
  };

  return lookup(expression.result, 'result value');
};


text:
<?php

namespace Fd\OfertaEducativaBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class DisciplinaRepository extends EntityRepository {

    public function qbAll() {
        return $this->createQueryBuilder('dsc');
    }

    public function findAll() {

        return $this->findear($this->qbAll()->orderBy('dsc.descripcion'));
    }

    public function qbAllOrdenado() {

        return $this->qbAll()
                        ->orderBy('dsc.descripcion');
    }

    public function findAllOrdenado() {
        return $this->findear($this->qbAllOrdenado());
    }

    public function findear($qb) {
        return $qb->getQuery()->getResult();
    }

}


text:
var mustache = require('mustache');
var Context = require('./context');
var Renderer = require('./renderer');

var mustem = exports = module.exports = {};

var pkg = require('../package.json');

mustem.name = pkg.name;
mustem.version = pkg.version;
mustem.tags = [ '{{', '}}' ];

// All high-level mustem.* functions use this writer.
var defaultRenderer = new Renderer();

/**
 * Clears all cached templates in the default writer.
 */
mustem.clearCache = function clearCache () {
  return defaultRenderer.clearCache();
};

/**
 * Parses and caches the given template in the default writer and returns the
 * array of tokens it contains. Doing this ahead of time avoids the need to
 * parse templates on the fly as they are rendered.
 */
mustem.parse = function parse (template, tags) {
  return defaultRenderer.parse(template, tags);
};

/**
 * Renders the `template` with the given `view` and `partials` using the
 * default writer.
 */
mustem.render = function render (template, view, partials) {
  if (typeof template !== 'string') {
    throw new TypeError('Invalid template! Template should be a "string" ' +
      'but "' + typeof template + '" was given as the first ' +
      'argument for mustem#render(template, view, partials)');
  }

  return defaultRenderer.render(template, view, partials);
};

// This is here for backwards compatibility with 0.4.x.,
/*eslint-disable */ // eslint wants camel cased function name
mustem.to_html = function to_html (template, view, partials, send) {
  /*eslint-enable*/

  var result = mustem.render(template, view, partials);

  if (isFunction(send)) {
    send(result);
  } else {
    return result;
  }
};

// Export the escaping function so that the user may override it.
// See https://github.com/janl/mustem.js/issues/244
mustem.escape = mustache.escape;

exports.Renderer = Renderer;
exports.Context = Context;