text:
<envelope xmlns="http://marklogic.com/entity-services">
  <headers>
    <smart-mastering:id xmlns:smart-mastering="http://marklogic.com/smart-mastering">87c2f600-7488-429a-862c-0b2a5f6c6e1e</smart-mastering:id>
    <smart-mastering:id xmlns:smart-mastering="http://marklogic.com/smart-mastering">f57e1093-4c68-46d7-910c-150825ab2edc</smart-mastering:id>
    <smart-mastering:sources xmlns:smart-mastering="http://marklogic.com/smart-mastering">
      <smart-mastering:source>
        <smart-mastering:name>SOURCE3</smart-mastering:name>
        <smart-mastering:import-id>mdm-import-a96735af-f7c3-4f95-9ea1-f884bc395e0f</smart-mastering:import-id>
        <smart-mastering:user>admin</smart-mastering:user>
        <smart-mastering:dateTime>2018-04-26T16:40:16.760311Z</smart-mastering:dateTime>
        <smart-mastering:one-first>2017-04-26T16:40:02.1386Z</smart-mastering:one-first>
        <smart-mastering:two-first>2018-04-26T16:40:02.1386Z</smart-mastering:two-first>
      </smart-mastering:source>
    </smart-mastering:sources>
    <unconfigured>unconfigured value 3a</unconfigured>
    <shallow xmlns="">shallow value 3</shallow>
    <custom xmlns="" xmlns:has="has" xmlns:endswith="endswith">
      <this><has:a><deep><path>deep value 3</path></deep></has:a></this>
      <this><has:a><deep><endswith:ns>endswith value 3</endswith:ns></deep></has:a></this>
      <unconfigured>unconfigured value 3b</unconfigured>
    </custom>
  </headers>
  <triples xmlns:sem="http://marklogic.com/semantics">
    <sem:triple>
      <sem:subject>http://marklogic.com/sm-core/lindsey-jones</sem:subject>
      <sem:predicate>http://marklogic.com/sm-core/lives-in</sem:predicate>
      <sem:object>http://dbpedia.org/resource/Scranton,_Pennsylvania</sem:object>
    </sem:triple>
    <sem:triple>
      <sem:subject>http://marklogic.com/sm-core/lindsey-jones</sem:subject>
      <sem:predicate>http://marklogic.com/sm-core/ssn</sem:predicate>
      <sem:object datatype="http://www.w3.org/2001/XMLSchema#string">393225353</sem:object>
    </sem:triple>
    <sem:triple>
      <sem:subject>http://marklogic.com/sm-core/scranton</sem:subject>
      <sem:predicate>http://marklogic.com/sm-core/is-in</sem:predicate>
      <sem:object datatype="http://www.w3.org/2001/XMLSchema#string">Pennsylvania</sem:object>
    </sem:triple>
  </triples>
  <instance>
    <info>
      <title>MDM</title>
      <version>1.0.0</version>
    </info>
    <MDM xmlns="">
      <Person>
        <PersonType>
          <PersonName>
            <PersonNameType>
              <PersonSurName>JONES</PersonSurName>
              <PersonGivenName>LINDSEY</PersonGivenName>
            </PersonNameType>
          </PersonName>
          <Address>
            <AddressType>
              <LocationState>PA</LocationState>
              <AddressPrivateMailboxText>45</AddressPrivateMailboxText>
              <AddressSecondaryUnitText>JANA</AddressSecondaryUnitText>
              <LocationPostalCode>18505</LocationPostalCode>
              <LocationCityName>SCRANTON</LocationCityName>
            </AddressType>
          </Address>
          <IncidentCategoryCodeDate/>
          <id>3270654369</id>
          <PersonBirthDate>19801001</PersonBirthDate>
          <CaseAmount>1287.9</CaseAmount>
          <CustomThing>3</CustomThing>
          <OnlyOne>3</OnlyOne>
          <PersonSSNIdentification>
            <PersonSSNIdentificationType>
              <IdentificationID>393225353</IdentificationID>
            </PersonSSNIdentificationType>
          </PersonSSNIdentification>
          <Revenues>
            <RevenuesType>
              <Revenue>4332</Revenue>
            </RevenuesType>
          </Revenues>
          <CaseStartDate>20110406</CaseStartDate>
        </PersonType>
      </Person>
    </MDM>
  </instance>
  <attachments/>
</envelope>


text:
/**
 *
 */
package com.blockwithme.lessobjects.juint;

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

import java.util.List;
import java.util.Random;

import com.blockwithme.lessobjects.SchemaFormat;
import com.blockwithme.lessobjects.Struct;
import com.blockwithme.lessobjects.fields.optional.BooleanOptionalField;
import com.blockwithme.lessobjects.fields.optional.ByteOptionalField;
import com.blockwithme.lessobjects.fields.optional.CharOptionalField;
import com.blockwithme.lessobjects.fields.optional.DoubleOptionalField;
import com.blockwithme.lessobjects.fields.optional.FloatOptionalField;
import com.blockwithme.lessobjects.fields.optional.LongOptionalField;
import com.blockwithme.lessobjects.fields.optional.ShortOptionalField;
import com.blockwithme.lessobjects.fields.primitive.BooleanField;
import com.blockwithme.lessobjects.fields.primitive.ByteField;
import com.blockwithme.lessobjects.fields.primitive.CharField;
import com.blockwithme.lessobjects.fields.primitive.DoubleField;
import com.blockwithme.lessobjects.fields.primitive.FloatField;
import com.blockwithme.lessobjects.fields.primitive.IntField;
import com.blockwithme.lessobjects.fields.primitive.LongField;
import com.blockwithme.lessobjects.fields.primitive.ShortField;
import com.blockwithme.prim.BooleanConverter;
import com.blockwithme.prim.ByteConverter;
import com.blockwithme.prim.CharConverter;
import com.blockwithme.prim.ConverterRegistry;
import com.blockwithme.prim.DoubleConverter;
import com.blockwithme.prim.FloatConverter;
import com.blockwithme.prim.IntConverter;
import com.blockwithme.prim.LongConverter;
import com.blockwithme.prim.ShortConverter;

// CHECKSTYLE IGNORE FOR NEXT 600 LINES
@SuppressWarnings({ "PMD", "all" })
public class TestData {

    public static class BooleanObject {

        boolean content;

        public BooleanObject(final boolean theContent) {
            content = theContent;
        }

        public String toString() {
            return new Boolean(content).toString();
        }
    }

    public static final class BooleanPrimConverter implements
            BooleanConverter<BooleanObject> {
        @Override
        public int bits() {
            return 1;
        }

        @Override
        public boolean fromObject(final BooleanObject obj) {
            if (obj == null) {
                return false;
            }
            return obj.content;
        }

        @Override
        public BooleanObject toObject(final boolean value) {
            return new BooleanObject(value);
        }

        @Override
        public Class<BooleanObject> type() {
            return BooleanObject.class;
        }
    }

    public static class ByteObject {

        byte content;

        public ByteObject(final byte theContent) {
            content = theContent;
        }

        public String toString() {
            return new Byte(content).toString();
        }
    }

    public static final class BytePrimConverter implements
            ByteConverter<ByteObject> {
        @Override
        public int bits() {
            return 8;
        }

        @Override
        public byte fromObject(final ByteObject obj) {
            if (obj == null) {
                return 0;
            }
            return obj.content;
        }

        @Override
        public ByteObject toObject(final byte value) {
            return new ByteObject(value);
        }

        @Override
        public Class<ByteObject> type() {
            return ByteObject.class;
        }
    }

    public static class CharObject {

        char content;

        public CharObject(final char theContent) {
            content = theContent;
        }

        public String toString() {
            return new Character(content).toString();
        }
    }

    public static final class CharPrimConverter implements
            CharConverter<CharObject> {
        @Override
        public int bits() {
            return 16;
        }

        @Override
        public char fromObject(final CharObject obj) {
            if (obj == null) {
                return 0;
            }
            return obj.content;
        }

        @Override
        public CharObject toObject(final char value) {
            return new CharObject(value);
        }

        @Override
        public Class<CharObject> type() {
            return CharObject.class;
        }
    }

    public static class DoubleObject {

        double content;

        public DoubleObject(final double theContent) {
            content = theContent;
        }

        public String toString() {
            return new Double(content).toString();
        }
    }

    public static final class DoublePrimConverter implements
            DoubleConverter<DoubleObject> {
        @Override
        public int bits() {
            return 64;
        }

        @Override
        public double fromObject(final DoubleObject obj) {
            if (obj == null) {
                return 0d;
            }
            return obj.content;
        }

        @Override
        public DoubleObject toObject(final double value) {
            return new DoubleObject(value);
        }

        @Override
        public Class<DoubleObject> type() {
            return DoubleObject.class;
        }
    }

    public static class FloatObject {

        float content;

        public FloatObject(final float theContent) {
            content = theContent;
        }

        public String toString() {
            return new Float(content).toString();
        }
    }

    public static final class FloatPrimConverter implements
            FloatConverter<FloatObject> {
        @Override
        public int bits() {
            return 32;
        }

        @Override
        public float fromObject(final FloatObject obj) {
            if (obj == null) {
                return 0f;
            }
            return obj.content;
        }

        @Override
        public FloatObject toObject(final float value) {
            return new FloatObject(value);
        }

        @Override
        public Class<FloatObject> type() {
            return FloatObject.class;
        }
    }

    public static class IntObject {

        int content;

        public IntObject(final int theContent) {
            content = theContent;
        }

        public String toString() {
            return new Integer(content).toString();
        }
    }

    public static final class IntPrimConverter implements
            IntConverter<IntObject> {
        @Override
        public int bits() {
            return 32;
        }

        @Override
        public int fromObject(final IntObject obj) {
            if (obj == null) {
                return 0;
            }
            return obj.content;
        }

        @Override
        public IntObject toObject(final int value) {
            return new IntObject(value);
        }

        @Override
        public Class<IntObject> type() {
            return IntObject.class;
        }
    }

    public static class LongObject {

        long content;

        public LongObject(final long theContent) {
            content = theContent;
        }

        public String toString() {
            return new Long(content).toString();
        }
    }

    public static final class LongPrimConverter implements
            LongConverter<LongObject> {
        @Override
        public int bits() {
            return 64;
        }

        @Override
        public long fromObject(final LongObject obj) {
            if (obj == null) {
                return 0l;
            }
            return obj.content;
        }

        @Override
        public LongObject toObject(final long value) {
            return new LongObject(value);
        }

        @Override
        public Class<LongObject> type() {
            return LongObject.class;
        }
    }

    public static class ShortObject {

        short content;

        public ShortObject(final short theContent) {
            content = theContent;
        }

        public String toString() {
            return new Short(content).toString();
        }
    }

    public static final class ShortPrimConverter implements
            ShortConverter<ShortObject> {
        @Override
        public int bits() {
            return 16;
        }

        @Override
        public short fromObject(final ShortObject obj) {
            if (obj == null) {
                return 0;
            }
            return obj.content;
        }

        @Override
        public ShortObject toObject(final short value) {
            return new ShortObject(value);
        }

        @Override
        public Class<ShortObject> type() {
            return ShortObject.class;
        }
    }

    protected static final int _CAPACITY = 10;

    protected static final Random rand = new Random(System.currentTimeMillis());

    /** The registry. */
    public static ConverterRegistry registry;

    /** The factory. */
    protected CompiledStorage[] COMPILED;

    static {
        registry = new ConverterRegistry();
        registry.register(new BooleanPrimConverter(), BooleanObject.class);
        registry.register(new BytePrimConverter(), ByteObject.class);
        registry.register(new CharPrimConverter(), CharObject.class);
        registry.register(new DoublePrimConverter(), DoubleObject.class);
        registry.register(new FloatPrimConverter(), FloatObject.class);
        registry.register(new IntPrimConverter(), IntObject.class);
        registry.register(new LongPrimConverter(), LongObject.class);
        registry.register(new ShortPrimConverter(), ShortObject.class);

    }

    protected static boolean[] booleans() {

        final boolean[] booleans = new boolean[_CAPACITY];
        for (int i = 0; i < _CAPACITY; i++) {
            booleans[i] = rand.nextBoolean();
        }
        return booleans;
    }

    protected static byte[] bytes() {

        final byte[] bytes = new byte[_CAPACITY];
        for (int i = 0; i < _CAPACITY; i++) {
            bytes[i] = (byte) rand.nextInt();
        }
        return bytes;
    }

    protected static char[] chars() {

        final char[] chars = new char[_CAPACITY];
        for (int i = 0; i < _CAPACITY; i++) {
            chars[i] = (char) rand.nextInt();
        }
        return chars;
    }

    protected static double[] doubles() {

        final double[] doubles = new double[_CAPACITY];
        for (int i = 0; i < _CAPACITY; i++) {
            doubles[i] = rand.nextDouble();
        }
        return doubles;
    }

    protected static TestEnum[] enums() {

        final TestEnum[] allEnums = TestEnum.class.getEnumConstants();
        final TestEnum[] randomEnums = new TestEnum[_CAPACITY];
        for (int i = 0; i < _CAPACITY; i++) {
            randomEnums[i] = allEnums[Math
                    .abs(rand.nextInt() % allEnums.length)];
        }
        return randomEnums;
    }

    protected static float[] floats() {

        final float[] floats = new float[_CAPACITY];
        for (int i = 0; i < _CAPACITY; i++) {
            floats[i] = rand.nextFloat();
        }
        return floats;
    }

    protected static long[] int_longs() {

        final long[] int_longs = new long[_CAPACITY];
        for (int i = 0; i < _CAPACITY; i++) {
            int_longs[i] = Long.valueOf(Integer.toBinaryString(rand.nextInt()),
                    2);
        }
        return int_longs;
    }

    protected static int[] ints() {

        final int[] ints = new int[_CAPACITY];
        for (int i = 0; i < _CAPACITY; i++) {
            ints[i] = rand.nextInt();
        }
        return ints;
    }

    protected static long[] longs() {

        final long[] longs = new long[_CAPACITY];
        for (int i = 0; i < _CAPACITY; i++) {
            longs[i] = rand.nextLong();
        }
        return longs;
    }

    protected static short[] shorts() {

        final short[] shorts = new short[_CAPACITY];
        for (int i = 0; i < _CAPACITY; i++) {
            shorts[i] = (short) rand.nextInt();
        }
        return shorts;
    }

    protected static String[] strings() {

        final String[] strings = new String[_CAPACITY];
        for (int i = 0; i < _CAPACITY; i++) {
            strings[i] = "str" + strings[i];
        }
        return strings;
    }

    public static void checkSchema(final Struct compiledStructs) {
        final String jsonSchema = compiledStructs
                .schemaString(SchemaFormat.JSON);
        final Struct deserialized = Struct.fromSchemaString(jsonSchema,
                SchemaFormat.JSON);
        final String jsonSchema2 = deserialized.schemaString(SchemaFormat.JSON);
        // System.out.println("compiledStructs:\n" + compiledStructs);
        // System.out.println("deserialized:\n" + deserialized);
        assertEquals(compiledStructs, deserialized);
        assertEquals(jsonSchema, jsonSchema2);
        assertEquals(compiledStructs.signature(), deserialized.signature());
        assertTrue(compiledStructs.isCompatible(deserialized));
    }

    protected int checkBooleanChange(final BooleanField bField1, final int i,
            final List<Object> events, int changeCount) {

        final Object actual = events.get(changeCount);
        assertEquals(bField1.name() + i, actual);
        changeCount++;
        assertEquals("old: true", events.get(changeCount++));
        assertEquals("new: false", events.get(changeCount++));
        return changeCount;
    }

    protected int checkBooleanChange(final BooleanOptionalField bOptional,
            final int i, final List<Object> events, int changeCount) {

        final Object actual = events.get(changeCount);
        assertEquals(bOptional.name() + i, actual);
        changeCount++;
        assertEquals("old: true", events.get(changeCount++));
        assertEquals("new: false", events.get(changeCount++));
        return changeCount;
    }

    protected int checkByteChange(final ByteField byteField, final int i,
            final List<Object> events, int changeCount, final byte[] bytes) {

        final Object actual = events.get(changeCount);
        assertEquals(byteField.name() + i, actual);
        changeCount++;
        assertEquals("old: " + bytes[i], events.get(changeCount++));
        assertEquals("new: 0", events.get(changeCount++));
        return changeCount;
    }

    protected int checkByteChange(final ByteOptionalField byteOptional, final int i,
            final List<Object> events, int changeCount, final byte[] bytes) {

        final Object actual = events.get(changeCount);
        assertEquals(byteOptional.name() + i, actual);
        changeCount++;
        assertEquals("old: " + bytes[i], events.get(changeCount++));
        assertEquals("new: " + (byte) 0, events.get(changeCount++));
        return changeCount;
    }

    protected int checkCharChange(final CharField charField, final int i,
            final List<Object> events, int changeCount, final char[] chars) {

        final Object actual = events.get(changeCount);
        assertEquals(charField.name() + i, actual);
        changeCount++;
        assertEquals("old: " + chars[i], events.get(changeCount++));
        assertEquals("new: " + (char) 0, events.get(changeCount++));
        return changeCount;
    }

    protected int checkCharChange(final CharOptionalField cOptional, final int i,
            final List<Object> events, int changeCount, final char[] chars) {

        final Object actual = events.get(changeCount);
        assertEquals(cOptional.name() + i, actual);
        changeCount++;
        assertEquals("old: " + chars[i], events.get(changeCount++));
        assertEquals("new: " + (char) 0, events.get(changeCount++));
        return changeCount;
    }

    protected int checkDoubleChange(final DoubleField doubleField, final int i,
            final List<Object> events, int changeCount, final double[] doubles) {

        final Object actual = events.get(changeCount);
        assertEquals(doubleField.name() + i, actual);
        changeCount++;
        assertEquals("old: " + doubles[i], events.get(changeCount++));
        assertEquals("new: " + 0d, events.get(changeCount++));
        return changeCount;
    }

    protected int checkDoubleChange(final DoubleOptionalField dOptional,
            final int i, final List<Object> events, int changeCount,
            final double[] doubles) {

        final Object actual = events.get(changeCount);
        assertEquals(dOptional.name() + i, actual);
        changeCount++;
        assertEquals("old: " + doubles[i], events.get(changeCount++));
        assertEquals("new: " + 0d, events.get(changeCount++));
        return changeCount;
    }

    protected int checkFloatChange(final FloatField floatField, final int i,
            final List<Object> events, int changeCount, final float[] floats) {

        final Object actual = events.get(changeCount);
        assertEquals(floatField.name() + i, actual);
        changeCount++;
        assertEquals("old: " + floats[i], events.get(changeCount++));
        assertEquals("new: " + (float) 0, events.get(changeCount++));
        return changeCount;
    }

    protected int checkFloatChange(final FloatOptionalField fOptional, final int i,
            final List<Object> events, int changeCount, final double[] floats) {

        final Object actual = events.get(changeCount);
        assertEquals(fOptional.name() + i, actual);
        changeCount++;
        assertEquals("old: " + floats[i], events.get(changeCount++));
        assertEquals("new: " + 0f, events.get(changeCount++));
        return changeCount;
    }

    protected int checkIntChange(final IntField newFullIntField, final int i,
            final List<Object> events, int changeCount, final int[] ints) {

        final Object actual = events.get(changeCount);
        assertEquals(newFullIntField.name() + i, actual);
        changeCount++;
        assertEquals("old: " + ints[i], events.get(changeCount++));
        assertEquals("new: " + 0, events.get(changeCount++));
        return changeCount;
    }

    protected int checkLongChange(final LongField LongField, final int i,
            final List<Object> events, int changeCount, final long[] longs) {

        final Object actual = events.get(changeCount);
        assertEquals(LongField.name() + i, actual);
        changeCount++;
        assertEquals("old: " + longs[i], events.get(changeCount++));
        assertEquals("new: " + 0l, events.get(changeCount++));
        return changeCount;
    }

    protected int checkLongChange(final LongOptionalField lOptional, final int i,
            final List<Object> events, int changeCount, final long[] longs) {

        final Object actual = events.get(changeCount);
        assertEquals(lOptional.name() + i, actual);
        changeCount++;
        assertEquals("old: " + longs[i], events.get(changeCount++));
        assertEquals("new: " + 0l, events.get(changeCount++));
        return changeCount;
    }

    protected int checkShortChange(final ShortField shortField, final int i,
            final List<Object> events, int changeCount, final short[] shorts) {

        final Object actual = events.get(changeCount);
        assertEquals(shortField.name() + i, actual);
        changeCount++;
        assertEquals("old: " + shorts[i], events.get(changeCount++));
        assertEquals("new: " + 0, events.get(changeCount++));
        return changeCount;
    }

    protected int checkShortChange(final ShortOptionalField sOptional, final int i,
            final List<Object> events, int changeCount, final short[] shorts) {

        final Object actual = events.get(changeCount++);
        assertEquals(sOptional.name() + i, actual);
        assertEquals("old: " + shorts[i], events.get(changeCount++));
        assertEquals("new: " + (short) 0, events.get(changeCount++));
        return changeCount;
    }

}

redpajama_set_name: RedPajamaGithub


text:
<?php namespace Rubyan\Oracle;

class Oracle {

    private $_connection;
    protected $stid = null;

    public function enabled()
    {
        return function_exists('oci_connect');
    }

    public function __construct(array $config)
    {
        $this->_connection = oci_connect(
            $config['username'],
            $config['password'],
            $config['host'] . ":" . $config['port'] . "/" . $config['instance_name'],
            $config['charset']);

        if (!$this->_connection) {
            $e = oci_error();
            trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
        }
    }

    // query
    public function query($sql)
    {
        $stid = oci_parse($this->_connection, $sql)  ;
        oci_execute($stid);
        return $stid;
    }

 /**
     * Run a SQL or PL/SQL statement
     *
     * Call like:
     *     Db::execute("insert into mytab values (:c1, :c2)",
     *                  [[":c1", $c1, -1],
     *                                      [":c2", $c2, -1]])
     *
     * For returned bind values:
     *     Db::execute("begin :r := myfunc(:p); end",
     *                  [[":r", &$r, 20],
     *                                    [":p", $p, -1]])
     *
     * Note: this performs a commit.
     *
     * @param string $sql The statement to run
     * @param array $bindvars Binds. An array of (bv_name, php_variable, length)
     */
    public function execute($sql, $bindvars = []) {
        $this->stid = oci_parse($this->_connection, $sql);

        foreach ($bindvars as $bv) {
            // oci_bind_by_name(resource, bv_name, php_variable, length)
            oci_bind_by_name($this->stid, $bv[0], $bv[1], $bv[2]);
        }
        //oci_set_action($this->_connection, $action);
        oci_execute($this->stid);              // will auto commit
    }

    /**
     * Run a query and return all rows.
     *
     * @param string $sql A query to run and return all rows
     * @param array $bindvars Binds. An array of (bv_name, php_variable, length)
     * @return array An array of rows
     */
    public function execFetchAll($sql, $bindvars = []) {
        $this->execute($sql, $bindvars);
        oci_fetch_all($this->stid, $res, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
        $this->stid = null;  // free the statement resource
        return($res);
    }

    // Get oci connection
    public function getConnection()
    {
        return $this->_connection;
    }

    public function __destruct()
    {
        if ($this->stid) {
            oci_free_statement($this->stid);
        }
        if ($this->_connection)
        {
            oci_close($this->_connection);
        }
    }

}


text:
#include "Shape.h"
#include <gfx2/nmesh2.h>
//#include <mathlib/sphere.h>
//#include <mathlib/line.h>
//#ifdef MAX_SDWORD
//#undef MAX_SDWORD
//#endif
//#define BAN_OPCODE_AUTOLINK
//#include <opcode/Opcode.h>

// An shape containing a triangle mesh. Can be initialized from in-memory nMesh2.
// Based on CMeshShape (C) 2003 RadonLabs GmbH and A.Sysoev's tutorial

class nMesh2;

namespace Physics
{

class CMeshShape: public CShape
{
	DeclareRTTI;
	DeclareFactory(CMeshShape);

protected:

	friend class CRay;

	//static Opcode::SphereCollider	OPCSphereCollider;	// an OPCODE sphere collider
	//Opcode::SphereCache				OPCSphereCache;		// an OPCODE sphere cache
	//static Opcode::RayCollider		OPCRayCollider;		// an OPCODE ray collider
	//static Opcode::CollisionFaces	OPCFaces;			// face cache for ray collider

	nString			FileName;
	nMesh2*			pInitMesh;
	float*			pVBuffer;
	int*			pIBuffer;
	int				VertexCount;
	int				VertexWidth;
	int				IndexCount;
	dTriMeshDataID	ODETriMeshDataID;
	dGeomID			ODETriMeshID;

	bool			LoadFromFile(nMeshLoader& MeshLoader);

public:

	CMeshShape();
	virtual ~CMeshShape();

	virtual void	Init(Data::PParams Desc);
	virtual bool	Attach(dSpaceID SpaceID);
	virtual void	Detach();
	virtual void	RenderDebug(const matrix44& ParentTfm);

	//int				DoSphereCollide(const sphere& Sphere, uint*& OutFaceIndices);
	//bool			DoRayCheck(const line3& Line, vector3& Contact);

	void			SetMesh(nMesh2* pMesh) { n_assert(pMesh->IsValid()); pInitMesh = pMesh; }
	void			SetFileName(const nString& Name) { FileName = Name; }
	const nString&	GetFileName() const { return FileName; }
	const float*	GetVertexBuffer() const { return pVBuffer; }
	const int*		GetIndexBuffer() const { return pIBuffer; }
	int				GetNumVertices() const { return VertexCount; }
	int				GetVertexWidth() const { return VertexWidth; }
	int				GetNumIndices() const { return IndexCount; }
};

RegisterFactory(CMeshShape);

}

#endif


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\ShipmentCode */
/* @var $form yii\widgets\ActiveForm */
?>

    <?= Html::activeLabel($model, 'code', ['class' => "control-label"]) ?>
    <?= Html::activeTextInput($model, 'code',['maxlength' => true, 'class' => "form-control"]) ?>

    <?= Html::activeLabel($model, 'type', ['class' => "control-label"]) ?>
    <?= Html::activeTextInput($model, 'type',['maxlength' => true, 'class' => "form-control"]) ?>


text:
package imagepicker.jose.com.imagepicker;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.FrameLayout;

/**
 * Created on 9/4/15.
 */
public class SquareFrameLayout extends FrameLayout {
    public SquareFrameLayout(Context context) {
        super(context);
    }

    public SquareFrameLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public SquareFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public SquareFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int widthSize = MeasureSpec.getSize(widthMeasureSpec);
        int newHeightSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY);
        super.onMeasure(widthMeasureSpec, newHeightSpec);
    }
}


text:
<?php

namespace Codete\FormGeneratorBundle\DependencyInjection\Compiler;

/**
 * @author Maciej Malarz <malarzm@gmail.com>
 */
class ConfigurationModifiersCompilerPass extends AbstractCompilerPass
{
    const TAG = 'form_generator.configuration_modifier';

    /**
     * @inheritdoc
     */
    protected function getMethodToCall()
    {
        return 'addFormConfigurationModifier';
    }

    /**
     * @inheritdoc
     */
    protected function getTagName()
    {
        return self::TAG;
    }
}


text:
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport"    content="width=device-width, initial-scale=1">
    <meta name="description" content="{{ site.description }}">
    <meta name="keywords"    content="{% for i in site.keywords %}{{ i }} {% endfor %}">
    <meta name="theme-color" content="#5BC0DE">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700">
    <link rel="stylesheet" href="{{ site.baseurl }}/assets/css/vendor/syntax.css">
    <link rel="stylesheet" href="{{ site.baseurl }}/assets/css/vendor/snackjs.min.css">
    <link rel="stylesheet" href="{{ site.baseurl }}/assets/css/main.css">
    <title>{% if page.title %}{{ page.title }} | {% endif %}{{ site.title }}</title>
  </head>
  <body>


text:
package com.facebook.buck.apple;

import com.facebook.buck.rules.BuildRule;
import com.facebook.buck.rules.BuildRuleParams;
import com.facebook.buck.rules.BuildRuleResolver;
import com.facebook.buck.rules.BuildRuleType;
import com.facebook.buck.rules.Description;
import com.facebook.buck.rules.NoopBuildRule;
import com.facebook.buck.rules.SourcePath;
import com.facebook.buck.rules.SourcePathResolver;
import com.facebook.infer.annotation.SuppressFieldNotInitialized;
import com.google.common.base.Optional;

import java.util.Map;
import java.util.Set;

/**
 * Description for an apple_resource rule which copies resource files to the built bundle.
 */
public class AppleResourceDescription implements Description<AppleResourceDescription.Arg> {

  public static final BuildRuleType TYPE = BuildRuleType.of("apple_resource");

  @Override
  public BuildRuleType getBuildRuleType() {
    return TYPE;
  }

  @Override
  public Arg createUnpopulatedConstructorArg() {
    return new Arg();
  }

  @Override
  public <A extends Arg> BuildRule createBuildRule(
      BuildRuleParams params,
      BuildRuleResolver resolver,
      A args) {
    return new NoopBuildRule(params, new SourcePathResolver(resolver));
  }

  @SuppressFieldNotInitialized
  public static class Arg {
    public Set<SourcePath> dirs;
    public Set<SourcePath> files;
    public Optional<Map<String, Map<String, SourcePath>>> variants;
  }
}


text:
package org.locationtech.geomesa.arrow.io

import org.apache.arrow.vector.ipc.message.IpcOption
import org.junit.runner.RunWith
import org.locationtech.geomesa.arrow.vector.SimpleFeatureVector.SimpleFeatureEncoding
import org.locationtech.geomesa.features.ScalaSimpleFeature
import org.locationtech.geomesa.utils.geotools.SimpleFeatureTypes
import org.locationtech.geomesa.utils.io.WithClose
import org.specs2.mutable.Specification
import org.specs2.runner.JUnitRunner

import java.io.{ByteArrayInputStream, ByteArrayOutputStream}

@RunWith(classOf[JUnitRunner])
class DictionaryBuildingWriterTest extends Specification {

  val sft = SimpleFeatureTypes.createType("test", "name:String,dtg:Date,*geom:Point:srid=4326")
  val features = (0 until 10).map { i =>
    ScalaSimpleFeature.create(sft, s"0$i", s"name0${i % 2}", s"2017-03-15T00:0$i:00.000Z", s"POINT (4$i 5$i)")
  }

  val ipcOpts = new IpcOption() // TODO test legacy opts

  "SimpleFeatureVector" should {
    "dynamically encode dictionary values" >> {
      val out = new ByteArrayOutputStream()
      WithClose(new DictionaryBuildingWriter(sft, Seq("name"), SimpleFeatureEncoding.Max, ipcOpts)) { writer =>
        features.foreach(writer.add)
        writer.encode(out)
      }
      WithClose(SimpleFeatureArrowFileReader.streaming(() => new ByteArrayInputStream(out.toByteArray))) { reader =>
        reader.dictionaries must haveSize(1)
        reader.dictionaries.get("name") must beSome
        reader.dictionaries("name").iterator.toSeq must containTheSameElementsAs(Seq("name00", "name01"))

        WithClose(reader.features())(f => f.map(ScalaSimpleFeature.copy).toSeq mustEqual features)
      }
    }
  }
}


text:
<?php

namespace Badcow\DNS\Parser;

class Normaliser
{
    /**
     * @var StringIterator
     */
    private $string;

    /**
     * @var string
     */
    private $normalisedString = '';

    /**
     * Normaliser constructor.
     *
     * @param string $zone
     */
    public function __construct(string $zone)
    {
        //Remove Windows line feeds and tabs
        $zone = str_replace([Tokens::CARRIAGE_RETURN, Tokens::TAB], ['', Tokens::SPACE], $zone);

        $this->string = new StringIterator($zone);
    }

    /**
     * @param string $zone
     *
     * @return string
     *
     * @throws ParseException
     */
    public static function normalise(string $zone): string
    {
        return (new self($zone))->process();
    }

    /**
     * @return string
     *
     * @throws ParseException
     */
    public function process(): string
    {
        while ($this->string->valid()) {
            $this->handleTxt();
            $this->handleComment();
            $this->handleMultiline();
            $this->append();
        }

        $this->removeWhitespace();

        return $this->normalisedString;
    }

    /**
     * Ignores the comment section.
     */
    private function handleComment(): void
    {
        if ($this->string->isNot(Tokens::SEMICOLON)) {
            return;
        }

        while ($this->string->isNot(Tokens::LINE_FEED) && $this->string->valid()) {
            $this->string->next();
        }
    }

    /**
     * Handle text inside of double quotations. When this function is called, the String pointer MUST be at the
     * double quotation mark.
     *
     * @throws ParseException
     */
    private function handleTxt(): void
    {
        if ($this->string->isNot(Tokens::DOUBLE_QUOTES)) {
            return;
        }

        $this->append();

        while ($this->string->isNot(Tokens::DOUBLE_QUOTES)) {
            if (!$this->string->valid()) {
                throw new ParseException('Unbalanced double quotation marks. End of file reached.');
            }

            //If escape character
            if ($this->string->is(Tokens::BACKSLASH)) {
                $this->append();
            }

            if ($this->string->is(Tokens::LINE_FEED)) {
                throw new ParseException('Line Feed found within double quotation marks context.', $this->string);
            }

            $this->append();
        }
    }

    /**
     * Move multi-line records onto single line.
     *
     * @throws ParseException
     */
    private function handleMultiline(): void
    {
        if ($this->string->isNot(Tokens::OPEN_BRACKET)) {
            return;
        }

        $this->string->next();
        while ($this->string->valid()) {
            $this->handleTxt();
            $this->handleComment();

            if ($this->string->is(Tokens::LINE_FEED)) {
                $this->string->next();
                continue;
            }

            if ($this->string->is(Tokens::CLOSE_BRACKET)) {
                $this->string->next();

                return;
            }

            $this->append();
        }

        throw new ParseException('End of file reached. Unclosed bracket.');
    }

    /**
     * Remove superfluous whitespace characters from string.
     */
    private function removeWhitespace(): void
    {
        $string = preg_replace('/ {2,}/', Tokens::SPACE, $this->normalisedString);
        $lines = [];

        foreach (explode(Tokens::LINE_FEED, $string) as $line) {
            if ('' !== $line = trim($line)) {
                $lines[] = $line;
            }
        }
        $this->normalisedString = implode(Tokens::LINE_FEED, $lines);
    }

    /**
     * Add current entry to normalisedString and moves iterator to next entry.
     */
    private function append()
    {
        $this->normalisedString .= $this->string->current();
        $this->string->next();
    }
}


text:
describe Filemaker::Errors do

  context '-1 to 100 errors' do
    it 'raises UnknownError for -1' do
      expect do
        Filemaker::Errors.raise_error_by_code(-1)
      end.to raise_error Filemaker::Errors::UnknownError
    end

    it 'raises UserCancelledError for 1' do
      expect do
        Filemaker::Errors.raise_error_by_code(1)
      end.to raise_error Filemaker::Errors::UserCancelledError
    end

    it 'raises MemoryError for 2' do
      expect do
        Filemaker::Errors.raise_error_by_code(2)
      end.to raise_error Filemaker::Errors::MemoryError
    end

    it 'raises CommandNotAvailableError for 3' do
      expect do
        Filemaker::Errors.raise_error_by_code(3)
      end.to raise_error Filemaker::Errors::CommandNotAvailableError
    end

    it 'raises CommandUnknownError for 4' do
      expect do
        Filemaker::Errors.raise_error_by_code(4)
      end.to raise_error Filemaker::Errors::CommandUnknownError
    end

    it 'raises CommandInvalidError for 5' do
      expect do
        Filemaker::Errors.raise_error_by_code(5)
      end.to raise_error Filemaker::Errors::CommandInvalidError
    end

    it 'raises FileReadOnlyError for 6' do
      expect do
        Filemaker::Errors.raise_error_by_code(6)
      end.to raise_error Filemaker::Errors::FileReadOnlyError
    end

    it 'raises OutOfMemoryError for 7' do
      expect do
        Filemaker::Errors.raise_error_by_code(7)
      end.to raise_error Filemaker::Errors::OutOfMemoryError
    end

    it 'raises EmptyResultError for 8' do
      expect do
        Filemaker::Errors.raise_error_by_code(8)
      end.to raise_error Filemaker::Errors::EmptyResultError
    end

    it 'raises InsufficientPrivilegesError for 9' do
      expect do
        Filemaker::Errors.raise_error_by_code(9)
      end.to raise_error Filemaker::Errors::InsufficientPrivilegesError
    end

    it 'raises RequestedDataMissingError for 10' do
      expect do
        Filemaker::Errors.raise_error_by_code(10)
      end.to raise_error Filemaker::Errors::RequestedDataMissingError
    end
  end

  context '100 to 199 errors' do
    it 'raises FileMissingError for 100' do
      expect do
        Filemaker::Errors.raise_error_by_code(100)
      end.to raise_error Filemaker::Errors::FileMissingError
    end

    it 'raises RecordMissingError for 101' do
      expect do
        Filemaker::Errors.raise_error_by_code(101)
      end.to raise_error Filemaker::Errors::RecordMissingError
    end

    it 'raises FieldMissingError for 102' do
      expect do
        Filemaker::Errors.raise_error_by_code(102)
      end.to raise_error Filemaker::Errors::FieldMissingError
    end

    it 'raises ScriptMissingError for 104' do
      expect do
        Filemaker::Errors.raise_error_by_code(104)
      end.to raise_error Filemaker::Errors::ScriptMissingError
    end

    it 'raises LayoutMissingError for 105' do
      expect do
        Filemaker::Errors.raise_error_by_code(105)
      end.to raise_error Filemaker::Errors::LayoutMissingError
    end

    it 'raises TableMissingError for 106' do
      expect do
        Filemaker::Errors.raise_error_by_code(106)
      end.to raise_error Filemaker::Errors::TableMissingError
    end

    it 'raises MissingError for 116' do
      expect do
        Filemaker::Errors.raise_error_by_code(106)
      end.to raise_error Filemaker::Errors::MissingError
    end
  end

  context '200 to 299 errors' do
    it 'raises RecordAccessDeniedError for 200' do
      expect do
        Filemaker::Errors.raise_error_by_code(200)
      end.to raise_error Filemaker::Errors::RecordAccessDeniedError
    end

    it 'raises FieldCannotBeModifiedError for 201' do
      expect do
        Filemaker::Errors.raise_error_by_code(201)
      end.to raise_error Filemaker::Errors::FieldCannotBeModifiedError
    end

    it 'raises FieldAccessDeniedError for 202' do
      expect do
        Filemaker::Errors.raise_error_by_code(202)
      end.to raise_error Filemaker::Errors::FieldAccessDeniedError
    end
  end

  context '300 to 399 errors' do
    it 'raises FileLockedError for 300' do
      expect do
        Filemaker::Errors.raise_error_by_code(300)
      end.to raise_error Filemaker::Errors::FileLockedError
    end

    it 'raises FileLockedError for 301' do
      expect do
        Filemaker::Errors.raise_error_by_code(301)
      end.to raise_error Filemaker::Errors::RecordInUseError
    end

    it 'raises TableInUseError for 302' do
      expect do
        Filemaker::Errors.raise_error_by_code(302)
      end.to raise_error Filemaker::Errors::TableInUseError
    end

    it 'raises RecordModificationIdMismatchError for 306' do
      expect do
        Filemaker::Errors.raise_error_by_code(306)
      end.to raise_error Filemaker::Errors::RecordModificationIdMismatchError
    end
  end

  context '400 to 499 errors' do
    it 'raises FindCriteriaEmptyError for 400' do
      expect do
        Filemaker::Errors.raise_error_by_code(400)
      end.to raise_error Filemaker::Errors::FindCriteriaEmptyError
    end

    it 'raises NoRecordsFoundError for 401' do
      expect do
        Filemaker::Errors.raise_error_by_code(401)
      end.to raise_error Filemaker::Errors::NoRecordsFoundError
    end
  end

  context '500 to 599 errors' do
    it 'raises DateValidationError for 500' do
      expect do
        Filemaker::Errors.raise_error_by_code(500)
      end.to raise_error Filemaker::Errors::DateValidationError
    end

    it 'raises TimeValidationError for 501' do
      expect do
        Filemaker::Errors.raise_error_by_code(501)
      end.to raise_error Filemaker::Errors::TimeValidationError
    end

    it 'raises NumberValidationError for 502' do
      expect do
        Filemaker::Errors.raise_error_by_code(502)
      end.to raise_error Filemaker::Errors::NumberValidationError
    end

    it 'raises RangeValidationError for 503' do
      expect do
        Filemaker::Errors.raise_error_by_code(503)
      end.to raise_error Filemaker::Errors::RangeValidationError
    end

    it 'raises UniquenessValidationError for 504' do
      expect do
        Filemaker::Errors.raise_error_by_code(504)
      end.to raise_error Filemaker::Errors::UniquenessValidationError
    end

    it 'raises ExistingValidationError for 505' do
      expect do
        Filemaker::Errors.raise_error_by_code(505)
      end.to raise_error Filemaker::Errors::ExistingValidationError
    end

    it 'raises ValueListValidationError for 506' do
      expect do
        Filemaker::Errors.raise_error_by_code(506)
      end.to raise_error Filemaker::Errors::ValueListValidationError
    end

    it 'raises CalculationValidationError for 507' do
      expect do
        Filemaker::Errors.raise_error_by_code(507)
      end.to raise_error Filemaker::Errors::CalculationValidationError
    end

    it 'raises InvalidFindModeValueValidationError for 508' do
      expect do
        Filemaker::Errors.raise_error_by_code(508)
      end.to raise_error Filemaker::Errors::InvalidFindModeValueValidationError
    end

    it 'raises MaximumCharactersValidationError for 511' do
      expect do
        Filemaker::Errors.raise_error_by_code(511)
      end.to raise_error Filemaker::Errors::MaximumCharactersValidationError
    end
  end

  context '800 to 899 errors' do
    it 'raises UnableToCreateFileError for 800' do
      expect do
        Filemaker::Errors.raise_error_by_code(800)
      end.to raise_error Filemaker::Errors::UnableToCreateFileError
    end

    it 'raises UnableToCreateTempFileError for 801' do
      expect do
        Filemaker::Errors.raise_error_by_code(801)
      end.to raise_error Filemaker::Errors::UnableToCreateTempFileError
    end

    it 'raises UnableToOpenFileError for 802' do
      expect do
        Filemaker::Errors.raise_error_by_code(802)
      end.to raise_error Filemaker::Errors::UnableToOpenFileError
    end
  end

end


text:
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

{{> header}}

        {{#if showCancel}}
          Cancel
        {{else}}
          <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
        {{/if}}
        {{#if showSubmit}}
          <button class="btn btn-default submit" {{#if canSubmit}}{{else}}disabled="true"{{/if}}>Submit</button>
        {{/if}}


text:
namespace extensions {

// static
void KeepAliveImpl::Create(content::BrowserContext* context,
                           const Extension* extension,
                           mojo::InterfaceRequest<KeepAlive> request) {
  mojo::BindToRequest(new KeepAliveImpl(context, extension), &request);
}

KeepAliveImpl::KeepAliveImpl(content::BrowserContext* context,
                             const Extension* extension)
    : context_(context), extension_(extension) {
  ProcessManager::Get(context_)->IncrementLazyKeepaliveCount(extension_);
}

KeepAliveImpl::~KeepAliveImpl() {
  ProcessManager::Get(context_)->DecrementLazyKeepaliveCount(extension_);
}

}  // namespace extensions


text:
"""All fitters from fitters directory."""

from .fitters import BaseFitter
from .fitters.beta_geo_fitter import BetaGeoFitter
from .fitters.beta_geo_beta_binom_fitter import BetaGeoBetaBinomFitter
from .fitters.modified_beta_geo_fitter import ModifiedBetaGeoFitter
from .fitters.pareto_nbd_fitter import ParetoNBDFitter
from .fitters.gamma_gamma_fitter import GammaGammaFitter

__all__ = ('BetaGeoFitter', 'ParetoNBDFitter', 'GammaGammaFitter',
           'ModifiedBetaGeoFitter', 'BetaGeoBetaBinomFitter')


text:
package slicers;

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

import soot.Body;
import soot.Local;
import soot.PatchingChain;
import soot.SootMethod;
import soot.Unit;
import soot.Value;
import soot.ValueBox;
import soot.jimple.AssignStmt;
import soot.jimple.StaticInvokeExpr;
import soot.tagkit.AnnotationTag;
import soot.tagkit.VisibilityAnnotationTag;
import soot.toolkits.graph.ExceptionalUnitGraph;
import soot.toolkits.graph.MHGPostDominatorsFinder;
import util.DependentsTag;

public class JimpleFutureTagger {

	private Body b;
	private ExceptionalUnitGraph g;
	/**
	 * Tag only Units that are in pc. The units in pc are meant to be
	 * auto-threaded therefore need to be tagged with units they affect
	 *
	 * @param b
	 *            method body
	 * @param pc
	 *            Units that should be auto-threaded
	 */
	public JimpleFutureTagger(Body b, PatchingChain<Unit> pc) {
		this.b = b;
		initialize();
	}

	public JimpleFutureTagger(Body b) {
		this.b = b;
		initialize();
	}
	private void initialize(){
		g = new ExceptionalUnitGraph(b);
	}
	/**
	 * Tag each assignment of variable with a set of all statements that read
	 * this variable later in the program
	 *
	 * @param pc
	 *            The statements we want to tag, i.e. find out who depends on.
	 *            The method calls we want to auto-thread.
	 */
	public void onePassTag(PatchingChain<Unit> pc){
		Map<Local,Set<Unit>> localsOfInterest = new HashMap<Local,Set<Unit>>();//variable to defining unit
		List<ValueBox> useBoxes;

		//calculate dominator relations
		MHGPostDominatorsFinder<Unit> postDomFinder = new MHGPostDominatorsFinder<Unit>(g);

		for(Unit u:b.getUnits()){
			if(pc.contains(u) && u instanceof AssignStmt){//def locals are of interest here
				AssignStmt stmt = (AssignStmt) u;
				if (stmt.containsInvokeExpr()
						&& (stmt.getInvokeExpr() instanceof StaticInvokeExpr)
						&& !stmt.getInvokeExpr().getMethod().isNative()
						&& hasThreadMeAnnotation(stmt.getInvokeExpr().getMethod())
						&& !b.getMethod().getName().equals(SootMethod.staticInitializerName)){
					assert pc.getSuccOf(u) instanceof AssignStmt;
					Value defVal = ((AssignStmt) pc.getSuccOf(u)).getLeftOp();
					if(defVal instanceof Local){
						Local l = (Local)defVal;
						if(!localsOfInterest.containsKey(l))
							localsOfInterest.put(l, new HashSet<Unit>());
						Set<Unit> preDefUnits = localsOfInterest.get(l);

						//destructive only of u is post-dominator to previous assignment
						for(Unit preDef:preDefUnits)
							if(postDomFinder.isDominatedBy(preDef, u))
								preDefUnits.remove(preDef);
						preDefUnits.add(u);
					}
				}
			}

			useBoxes = u.getUseBoxes();
			if(useBoxes.isEmpty())
				continue;

			for(ValueBox useVB:useBoxes){
				Value useVal = useVB.getValue();
				if(useVal instanceof Local){
					Local l = (Local) useVal;
					if(localsOfInterest.keySet().contains(l)){
						Set<Unit> defUnits = localsOfInterest.get(l);
						for(Unit defUnit:defUnits){
							//for cases like def before conditional that defines all
							//if(defInAllPaths(defUnit,u,l,localsOfInterest))
								//localsOfInterest.get(l).remove(defUnit);

							if(!defUnit.hasTag(DependentsTag.name))
								defUnit.addTag(new DependentsTag(useVal, useVal.getType()));
							((DependentsTag) defUnit.getTag(DependentsTag.name)).addDependent(u);
							//System.out.println("Unit "+u+"\n\tdepends on unit\n\t"+defUnit+"\n\twith local "+l);
						}
					}
				}
				else{
					//System.out.println("Non-local use value: "+useVal);
				}
			}
		}
		System.out.println("Done tagging.");
	}

	private boolean hasThreadMeAnnotation(SootMethod method) {
		VisibilityAnnotationTag vtag = (VisibilityAnnotationTag) method.getTag("VisibilityAnnotationTag");
		if (vtag == null) {
			return false;
		}
		for (AnnotationTag tag : vtag.getAnnotations()) {
			if (tag.getType().endsWith("$ThreadMe;")) {
				return true;
			}
		}
		return false;
	}
}


text:
module Pwb
  class PageContent < ApplicationRecord
    # Join model for creating content for page
    # Would have been easier in the short run to have pages simply belong_to
    # content directly.
    # This join table provides flexibility in the long run to allow the
    # same content to be used by different pages
    # with different settings for sorting and visibility
    # Might have been better to call this model PagePlaceholder
    belongs_to :page
    belongs_to :content
    belongs_to :website
    # https://stackoverflow.com/questions/5856838/scope-with-join-on-has-many-through-association

    validate :content_id_not_changed

    # page_part_key
    validates_presence_of :page_part_key

    # this join model is used for sorting and visibility
    # (instead of a value on the content itself) as it
    # will allow use of same content by different pages
    # with different settings for sorting and visibility

    scope :ordered_visible, -> () { where(visible_on_page: true).order('sort_order asc') }

    # if the page_content represents a rails_page_part, will return the page_part_key
    # else will return the raw html
    # def get_html_or_page_part_key
    #   if self.is_rails_part
    #     # page_part_key
    #     return page_part_key
    #   else
    #     return content.present? ? content.raw : nil
    #   end
    # end

    def as_json(options = nil)
      super({only: [
               "sort_order", "visible_on_page"
             ],
             methods: ["content", "content_page_part_key"]
             }.merge(options || {}))
    end

    def content_page_part_key
      content.present? ? content.page_part_key : ""
    end

    private

    def content_id_not_changed
      if content_id_changed? && persisted?
        if content_id_was.blank?
          nil
        else
          errors.add(:content_id, "Change of content_id not allowed!")
        end
      end
    end
  end
end


text:
baseball = [[180, 78.4],
            [215, 102.7],
            [210, 98.5],
            [188, 75.2]]

# Import numpy
import numpy as np

# Create a 2D Numpy array from baseball: np_baseball
np_baseball = np.array(baseball)

# Print out the type of np_baseball
print(type(np_baseball))

# Print out the shape of np_baseball
print(np_baseball.shape)


text:
package org.mockito.internal.configuration.injection.scanner;

import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.mockito.internal.util.MockUtil;
import org.mockito.internal.util.reflection.FieldReader;

import java.lang.reflect.Field;
import java.util.Set;

import static org.mockito.internal.util.collections.Sets.newMockSafeHashSet;

/**
 * Scan mocks, and prepare them if needed.
 */
public class MockScanner {
    private final MockUtil mockUtil = new MockUtil();
    private final Object instance;
    private final Class<?> clazz;

    /**
     * Creates a MockScanner.
     *
     * @param instance The test instance
     * @param clazz    The class in the type hierarchy of this instance.
     */
    public MockScanner(Object instance, Class<?> clazz) {
        this.instance = instance;
        this.clazz = clazz;
    }

    /**
     * Add the scanned and prepared mock instance to the given collection.
     *
     *

     * The preparation of mocks consists only in defining a MockName if not already set.
     *

     *
     * @param mocks Set of mocks
     */
    public void addPreparedMocks(Set<Object> mocks) {
        mocks.addAll(scan());
    }

    /**
     * Scan and prepare mocks for the given testClassInstance and clazz in the type hierarchy.
     *
     * @return A prepared set of mock
     */
    private Set<Object> scan() {
        Set<Object> mocks = newMockSafeHashSet();
        for (Field field : clazz.getDeclaredFields()) {
            // mock or spies only
            FieldReader fieldReader = new FieldReader(instance, field);

            Object mockInstance = preparedMock(fieldReader.read(), field);
            if (mockInstance != null) {
                mocks.add(mockInstance);
            }
        }
        return mocks;
    }

    private Object preparedMock(Object instance, Field field) {
        if (isAnnotatedByMockOrSpy(field)) {
            return instance;
        } else if (isMockOrSpy(instance)) {
            mockUtil.maybeRedefineMockName(instance, field.getName());
            return instance;
        }
        return null;
    }

    private boolean isAnnotatedByMockOrSpy(Field field) {
        return null != field.getAnnotation(Spy.class)
                || null != field.getAnnotation(Mock.class)
                || null != field.getAnnotation(MockitoAnnotations.Mock.class);
    }

    private boolean isMockOrSpy(Object instance) {
        return mockUtil.isMock(instance)
                || mockUtil.isSpy(instance);
    }
}


text:
from __future__ import annotations

from functools import cached_property
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from ddev.utils.fs import Path

class RepositoryConfig:
    def __init__(self, data: dict):
        self.__data = data

    @property
    def data(self) -> dict:
        return self.__data

    @cached_property
    def overrides(self) -> dict:
        overrides = self.data.get('overrides', {})
        if not isinstance(overrides, dict):
            raise TypeError('Repository configuration `overrides` must be a table')

        return overrides

    @cached_property
    def display_name_overrides(self) -> dict:
        display_name_overrides = self.overrides.get('display-name', {})
        if not isinstance(display_name_overrides, dict):
            raise TypeError('Repository configuration `overrides.display-name` must be a table')

        return display_name_overrides

    @classmethod
    def from_toml_file(cls, path: Path) -> RepositoryConfig:
        from ddev.utils.toml import load_toml_file

        return cls(load_toml_file(path))


text:
set -ev

#
# Generate thrift files so the static code analysis includes an analysis
# of the files the thrift compiler spits out.  If running interactively
# set the NOBUILD environment variable to skip the boot/config/make phase.
#

if [[ -z "$NOBUILD" ]]; then
  ./bootstrap.sh
  ./configure --enable-tutorial=no
  make -j3 precross
fi

#
# C/C++ static code analysis with cppcheck
# add --error-exitcode=1 to --enable=all as soon as everything is fixed
#
# Python code style check with flake8
#
# search for TODO etc within source tree
# some statistics about the code base
# some info about the build machine

# Compiler cppcheck (All)
cppcheck --force --quiet --inline-suppr --enable=all -j2 compiler/cpp/src

# C++ cppcheck (All)
cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp

# C Glib cppcheck (All)
cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib

# Silent error checks
# See THRIFT-4371 : flex generated code triggers "possible null pointer dereference" in yy_init_buffer
cppcheck --force --quiet --inline-suppr --suppress="*:thrift/thriftl.cc" --error-exitcode=1 -j2 compiler/cpp/src
cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib

# Python code style
flake8 --ignore=W504,E501 lib/py
flake8 --exclude=tutorial/py/build tutorial/py
# THRIFT-4371 : generated files are excluded because they haven't been scrubbed yet
flake8 --ignore=E501 --exclude="*/gen-py*/*",test/py/build test/py
flake8 test/py.twisted
flake8 test/py.tornado
flake8 --ignore=E501 test/test.py
flake8 --ignore=E501,E722 test/crossrunner
flake8 test/features

# PHP code style
composer install --quiet
./vendor/bin/phpcs

# TODO etc
echo FIXMEs: `grep -r FIXME * | wc -l`
echo  HACKs: `grep -r HACK * | wc -l`
echo  TODOs: `grep -r TODO * | wc -l`

# LoC
sloccount .

# System Info
dpkg -l
uname -a


text:
"use strict";
var assert = require("assert");
var testUtils = require("./helpers/util.js");

var Promise2 = require("../../js/debug/promise.js")();

var using = Promise.using;
var delay = Promise.delay;
var error = new Error("");
var id = 0;
function Resource() {
    this.isClosed = false;
    this.closesCalled = 0;
    this.commited = false;
    this.rollbacked = false;
    this.id = id++;

}

Resource.prototype.commit = function () {
    if (this.commited || this.rollbacked) {
        throw new Error("was already commited or rolled back")
    }
    this.commited = true;
};

Resource.prototype.commitAsync = function () {
    return Promise.delay(1).bind(this).then(this.commit)
}

Resource.prototype.rollback = function () {
    if (this.commited || this.rollbacked) {
        throw new Error("was already commited or rolled back")
    }
    this.rollbacked = true;
};

Resource.prototype.rollbackAsync = function () {
    return Promise.delay(1).bind(this).then(this.rollback)
}

Resource.prototype.closeAsync = function() {
    return Promise.delay(1).bind(this).then(this.close);
};

Resource.prototype.close = function() {
    this.closesCalled++;
    if (this.isClosed) {
        return;
    }
    this.isClosed = true;
};

Resource.prototype.closeError = function() {
    throw error;
};

Resource.prototype.query = function(value) {
    return Promise.delay(value, 1);
};

function _connect() {
    return new Promise(function(resolve) {
        setTimeout(function(){
            resolve(new Resource())
        }, 1);
    });
}

function _connect2() {
    return new Promise2(function(resolve) {
        setTimeout(function(){
            resolve(new Resource())
        }, 1);
    });
}

function connectCloseAsync(arr, value) {
    return _connect().disposer(function(resource){
        return resource.closeAsync().then(function() {
            arr.push(value);
        });
    });
}

function promiseForConnectCloseAsync(arr, value) {
    return Promise.delay(1).then(function() {
        return connectCloseAsync(arr, value);
    });
}

function connect() {
    return _connect().disposer(Resource.prototype.close);
}

function connect2() {
    return _connect2().disposer(Resource.prototype.close);
}

function connectCloseError() {
    return _connect().disposer(Resource.prototype.closeError);
}

function connectError() {
    return new Promise(function(resolve, reject) {
        setTimeout(function(){
            reject(error);
        }, 1);
    });
}

function transactionDisposer(tx, outcome) {
    outcome.isFulfilled() ? tx.commit() : tx.rollback();
}

function transactionDisposerAsync(tx, outcome) {
    return outcome.isFulfilled() ? tx.commitAsync() : tx.rollbackAsync();
}

function transaction() {
    return _connect().disposer(transactionDisposer);
}

function transactionWithImmediatePromiseAfterConnect() {
    return _connect().then(function (connection) {
      return Promise.resolve(connection).then(function(c) { return c; })
    }).disposer(transactionDisposer);
}

function transactionWithEventualPromiseAfterConnect() {
    return _connect().then(function (connection) {
      return Promise.delay(1).thenReturn(connection);
    }).disposer(transactionDisposer);
}

function transactionAsync() {
    return _connect().disposer(transactionDisposerAsync);
}

describe("Promise.using", function() {
    specify("simple happy case", function() {
        var res;

        return using(connect(), function(connection){
            res = connection;
        }).then(function() {
            assert(res.isClosed);
            assert.equal(res.closesCalled, 1);
        });
    });

    specify("simple async happy case", function() {
        var res;
        var async = false;

        return using(connect(), function(connection) {
            res = connection;
            return Promise.delay(1).then(function() {
                async = true;
            });
        }).then(function() {
            assert(async);
            assert(res.isClosed);
            assert.equal(res.closesCalled, 1);
        });
    });

    specify("simple unhappy case", function() {
        var a = connect();
        var promise = a._promise;
        var b = connectError();
        return using(b, a, function(a, b) {
            assert(false);
        }).then(assert.fail, function() {
            assert(promise.value().isClosed);
            assert.equal(promise.value().closesCalled, 1);
        })
    });

    specify("calls async disposers sequentially", function() {
         var a = [];
         var _res3 = connectCloseAsync(a, 3);
         var _res2 = connectCloseAsync(a, 2);
         var _res1 = connectCloseAsync(a, 1);
         return using(_res1, _res2, _res3, function(res1, res2, res3) {
            _res1 = res1;
            _res2 = res2;
            _res3 = res3;
         }).then(function() {
            assert.deepEqual(a, [1,2,3]);
            assert(_res1.isClosed);
            assert(_res2.isClosed);
            assert(_res3.isClosed);
            assert(_res1.closesCalled == 1);
            assert(_res2.closesCalled == 1);
            assert(_res3.closesCalled == 1);
         });
    });

    specify("calls async disposers sequentially when assert.failing", function() {
         var a = [];
         var _res3 = connectCloseAsync(a, 3);
         var _res2 = connectCloseAsync(a, 2);
         var _res1 = connectCloseAsync(a, 1);
         var p1 = _res1.promise();
         var p2 = _res2.promise();
         var p3 = _res3.promise();
         var e = new Error();
         var promise = Promise.delay(1).thenThrow(e);
         return using(_res1, _res2, _res3, promise, function() {

         }).then(assert.fail, function(err) {
            assert.deepEqual(a, [1,2,3]);
            assert(p1.value().isClosed);
            assert(p2.value().isClosed);
            assert(p3.value().isClosed);
            assert(p1.value().closesCalled == 1);
            assert(p2.value().closesCalled == 1);
            assert(p3.value().closesCalled == 1);
            assert(e === err)
         });
    });

    specify("calls promised async disposers sequentially", function() {
         var a = [];
         var _res3 = promiseForConnectCloseAsync(a, 3);
         var _res2 = promiseForConnectCloseAsync(a, 2);
         var _res1 = promiseForConnectCloseAsync(a, 1);
         return using(_res1, _res2, _res3, function(res1, res2, res3) {
            assert(res1 instanceof Resource)
            assert(res2 instanceof Resource)
            assert(res3 instanceof Resource)
            _res1 = res1;
            _res2 = res2;
            _res3 = res3;
         }).then(function() {
            assert.deepEqual(a, [1,2,3]);
            assert(_res1.isClosed);
            assert(_res2.isClosed);
            assert(_res3.isClosed);
            assert(_res1.closesCalled == 1);
            assert(_res2.closesCalled == 1);
            assert(_res3.closesCalled == 1);
         });
    });

    specify("calls promised async disposers sequentially when assert.failing", function() {
         var a = [];
         var _res3 = promiseForConnectCloseAsync(a, 3);
         var _res2 = promiseForConnectCloseAsync(a, 2);
         var _res1 = promiseForConnectCloseAsync(a, 1);
         var e = new Error();
         var promise = Promise.delay(1).thenThrow(e);
         return using(_res1, _res2, _res3, promise, function() {

         }).then(assert.fail, function(err) {
            assert.deepEqual(a, [1,2,3]);
            assert(_res1.value().promise().value().isClosed);
            assert(_res2.value().promise().value().isClosed);
            assert(_res3.value().promise().value().isClosed);
            assert(_res1.value().promise().value().closesCalled == 1);
            assert(_res2.value().promise().value().closesCalled == 1);
            assert(_res3.value().promise().value().closesCalled == 1);
            assert(e === err)
         });
    });

    specify("mixed promise, promise-for-disposer and disposer", function() {
         var a = [];
         var _res3 = promiseForConnectCloseAsync(a, 3);
         var _res2 = connectCloseAsync(a, 2);
         var _res1 = Promise.delay(10, 1);
         return using(_res1, _res2, _res3, function(res1, res2, res3) {
            assert(res1 === 10);
            assert(res2 instanceof Resource);
            assert(res3 instanceof Resource);
            _res1 = res1;
            _res2 = res2;
            _res3 = res3;
         }).then(function() {
            assert.deepEqual(a, [2,3]);
            assert(_res2.isClosed);
            assert(_res3.isClosed);
            assert(_res2.closesCalled == 1);
            assert(_res3.closesCalled == 1);
         });
    });

    specify("successful transaction", function() {
        var _tx;
        return using(transaction(), function(tx) {
            _tx = tx;
            return tx.query(1).then(function() {
                return tx.query(2);
            })
        }).then(function(){
            assert(_tx.commited);
            assert(!_tx.rollbacked);
        });
    });

    specify("successful async transaction", function() {
        var _tx;
        return using(transactionAsync(), function(tx) {
            _tx = tx;
            return tx.query(1).then(function() {
                return tx.query(3);
            })
        }).then(function(){
            assert(_tx.commited);
            assert(!_tx.rollbacked);
        })
    })

    specify("successful transaction with an immediate promise before disposer creation", function() {
        var _tx;
        return using(transactionWithImmediatePromiseAfterConnect(), function(tx) {
            _tx = tx;
            return tx.query(1);
        }).then(function(){
            assert(_tx.commited);
            assert(!_tx.rollbacked);
        });
    });

    specify("successful transaction with an eventual promise before disposer creation", function() {
        var _tx;
        return using(transactionWithEventualPromiseAfterConnect(), function(tx) {
            _tx = tx;
            return tx.query(1);
        }).then(function(){
            assert(_tx.commited);
            assert(!_tx.rollbacked);
        });
    });

    specify("assert.fail transaction", function() {
        var _tx;
        return using(transaction(), function(tx) {
            _tx = tx;
            return tx.query(1).then(function() {
                throw new Error();
            })
        }).then(assert.fail, function(){
            assert(!_tx.commited);
            assert(_tx.rollbacked);
        });
    });

    specify("assert.fail async transaction", function() {
        var _tx;
        return using(transactionAsync(), function(tx) {
            _tx = tx;
            return tx.query(1).then(function() {
                throw new Error();
            })
        }).then(assert.fail, function(){
            assert(!_tx.commited);
            assert(_tx.rollbacked);
        });
    });

    specify("with using coming from another Promise instance", function() {
        var res;
        return Promise2.using(connect(), function(connection){
            res = connection;
        }).then(function() {
            assert(res.isClosed);
            assert.equal(res.closesCalled, 1);
        });
    });

    specify("with using coming from another Promise instance other way around", function() {
        var res;
        return Promise.using(connect2(), function(connection){
            res = connection;
        }).then(function() {
            assert(res.isClosed);
            assert.equal(res.closesCalled, 1);
        });
    });

    if (testUtils.isNodeJS) {
        specify("disposer throwing should throw in node process", function() {
            var err = new Error();
            var disposer = Promise.resolve().disposer(function() {
                throw err;
            });
            using(disposer, function(){});
            return testUtils.awaitGlobalException(function(e) {
                assert.strictEqual(e, err);
            });
        });
    }

    specify("Return rejected promise with less than 2 arguments", function() {
        return Promise.using(1).caught(Promise.TypeError, function(e) {});
    });

    specify("Throw if disposer is not passed a function", function() {
        try {
            Promise.resolve().disposer({});
        } catch (e) {
            return Promise.resolve();
        }
        assert.fail();
    });

    specify("Mixed rejected disposers are not called", function() {
        var err = new Error("rejected should not be called");
        var a = Promise.delay(1).thenThrow(err).disposer(function() {
            done(err);
        });
        var b = Promise.delay(1).thenReturn(connect());
        return Promise.using(a, b, function() {
            done(new Error("should not be here"));
        }).then(assert.fail, function(e) {
            assert.strictEqual(b.value()._promise.value().isClosed, true);
            assert.strictEqual(b.value()._promise.value().closesCalled, 1);
        });
    });

    specify("Return rejected promise when last argument is not function", function() {
        return Promise.using({}, {}, {}, {}).caught(Promise.TypeError, function(e) {});
    });
})


text:
//
//  YPBool.h
//  YAPDFKit
//
//  Created by Aliona on 26.05.14.
//  Copyright (c) 2014 Ptenster. All rights reserved.
//  Copyright © 2016-2019 Lingewoud. All rights reserved.

#import <Foundation/Foundation.h>

/**
 * Тип PDF Boolean *
 * Принимает значения true или false.
 */
@interface YPBool : NSObject

/**
 * Значение: true или false
 */
@property (nonatomic) BOOL value;

@end


text:
import istanbul from '../utils/node!istanbul';
import minimatch from '../utils/node!minimatch';

function mixin(destination/*, ...mixins*/) {
    for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i];
        for (var key in source) {
            destination[key] = source[key];
        }
    }
    return destination;
}

function overrideThresholds (key, overrides) {
    var thresholds = {};

    // First match wins
    Object.keys(overrides).some(function (pattern) {
        if (minimatch(normalize(key), pattern, {dot: true})) {
            thresholds = overrides[pattern];
            return true;
        }
    });

    return thresholds;
}

function removeFiles (covObj, patterns) {
    var obj = {};

    Object.keys(covObj).forEach(function (key) {
        // Do any patterns match the resolved key
        var found = patterns.some(function (pattern) {
            return minimatch(normalize(key), pattern, {dot: true});
        });

        // if no patterns match, keep the key
        if (!found) {
            obj[key] = covObj[key];
        }
    })

    return obj;
}

export default function checkThreshold(checkOpt, collector) {
    var defaultThresholds = {
			global: {
				statements: 0,
				branches: 0,
				lines: 0,
				functions: 0,
				excludes: []
			},
			each: {
				statements: 0,
				branches: 0,
				lines: 0,
				functions: 0,
				excludes: [],
				overrides: {}
			}
		};

    var thresholds = {
        global: mixin(defaultThresholds.global, checkOpt.global),
        each: mixin(defaultThresholds.each, checkOpt.each)
    };

    var rawCoverage = collector.getFinalCoverage();
    var globalResults = istanbul.utils.summarizeCoverage(removeFiles(rawCoverage, thresholds.global.excludes));
    var eachResults = removeFiles(rawCoverage, thresholds.each.excludes);

    // Summarize per-file results and mutate original results.
    Object.keys(eachResults).forEach(function (key) {
        eachResults[key] = istanbul.utils.summarizeFileCoverage(eachResults[key]);
    });

    var coverageFailed = false;

    function check (name, thresholds, actuals) {
        var keys = [
            'statements',
            'branches',
            'lines',
            'functions'
        ];

        keys.forEach(function (key) {
            var actual = actuals[key].pct;
            var actualUncovered = actuals[key].total - actuals[key].covered;
            var threshold = thresholds[key];

            if (threshold < 0) {
                if (threshold * -1 < actualUncovered) {
                    coverageFailed = true;
                    console.error('Uncovered count for ' + key + ' (' + actualUncovered + 	') exceeds ' + name + ' threshold (' + -1 * threshold + ')');
                }
            } else {
                if (actual < threshold) {
                    coverageFailed = true;
                    console.error('Coverage for ' + key + ' (' + actual + '%) does not meet ' + name + ' threshold (' + threshold + '%)');
                }
            }
        });
    }

    check('global', thresholds.global, globalResults);

    Object.keys(eachResults).forEach(function (key) {
        var keyThreshold = mixin(thresholds.each, overrideThresholds(key, thresholds.each.overrides));
        check('per-file' + ' (' + key + ') ', keyThreshold, eachResults[key]);
    })

    return coverageFailed;
}


text:
class EvilEvents::Core::Events::Notifier::Worker::Job
  # @return [EvilEvents::Core::Events::Subscriber]
  #
  # @api private
  # @since 0.3.0
  attr_reader :subscriber

  # @return [EvilEvents::Core::Events::AbstractEvent]
  #
  # @api private
  # @since 0.3.0
  attr_reader :event

  # @param event [EvilEvents::Core::Events::AbstractEvent]
  # @param subscriber [EvilEvents::Core::Events::Subscriber]
  #
  # @api private
  # @since 0.3.0
  def initialize(event, subscriber)
    @event = event
    @subscriber = subscriber
  end

  # @return void
  #
  # @api private
  # @since 0.3.0
  def perform
    subscriber.notify(event)
  end
end


text:
'use strict';

/* eslint-env jest */

/** @type {any} */
const baseLhr5_ = require('../fixtures/lh-5-6-0-verge-a.json');
/** @type {any} */
const baseLhr6_ = require('../fixtures/lh-6-0-0-coursehero-a.json');
/** @type {any} */
const baseLhr62_ = require('../fixtures/lh-6-2-0-coursehero-a.json');
/** @type {any} */
const baseLhr641_ = require('../fixtures/lh-6-4-1-coursehero-a.json');
/** @type {any} */
const baseLhr700_ = require('../fixtures/lh-7-0-0-coursehero-a.json');
/** @type {any} */
const baseLhr800_ = require('../fixtures/lh-8-0-0-coursehero-a.json');
/** @type {any} */
const baselhr930_ = require('../fixtures/lh-9-3-0-coursehero-a.json');
const {definitions} = require('../../src/api/statistic-definitions.js');

describe('Statistic Definitions', () => {
  /** @type {LH.Result} */
  const baseLhr5 = baseLhr5_;
  /** @type {LH.Result} */
  const baseLhr6 = baseLhr6_;
  /** @type {LH.Result} */
  const baseLhr62 = baseLhr62_;
  /** @type {LH.Result} */
  const baseLhr641 = baseLhr641_;
  /** @type {LH.Result} */
  const baseLhr700 = baseLhr700_;
  /** @type {LH.Result} */
  const baseLhr800 = baseLhr800_;
  /** @type {LH.Result} */
  const baselhr930 = baselhr930_;

  describe('meta_lighthouse_version()', () => {
    const run = definitions.meta_lighthouse_version;

    it('should extract the version', () => {
      expect(run([baseLhr5])).toEqual({value: 50600});
      expect(run([baseLhr6])).toEqual({value: 60000});
      expect(run([baseLhr62])).toEqual({value: 60200});
      expect(run([baseLhr641])).toEqual({value: 60401});
      expect(run([baseLhr700])).toEqual({value: 70000});
      expect(run([baseLhr800])).toEqual({value: 80000});
      expect(run([baselhr930])).toEqual({value: 90300});
      expect(run([{...baseLhr5, lighthouseVersion: '1.2.3-beta.0'}])).toEqual({value: 10203});
    });

    it('should fallback to 0 for bad versions', () => {
      expect(run([{...baseLhr5, lighthouseVersion: 'empty'}])).toEqual({value: 0});
      expect(run([{...baseLhr5, lighthouseVersion: '5.6'}])).toEqual({value: 0});
    });
  });

  describe('audit_interactive_median()', () => {
    const run = definitions.audit_interactive_median;

    it('should extract the median value', () => {
      const low = JSON.parse(JSON.stringify(baseLhr5));
      const high = JSON.parse(JSON.stringify(baseLhr5));
      low.audits.interactive.numericValue = 1e3;
      high.audits.interactive.numericValue = 100e3;
      expect(run([low, high, baseLhr5]).value).toBeCloseTo(43223.58);
      expect(run([baseLhr6, low, high]).value).toBeCloseTo(20253.43);
      expect(run([high, baseLhr62, low]).value).toBeCloseTo(19669.83);
      expect(run([high, baseLhr641, low]).value).toBeCloseTo(19945.48);
      expect(run([high, baseLhr700, low]).value).toBeCloseTo(21206.92);
      expect(run([high, baseLhr800, low]).value).toBeCloseTo(20822.103);
      expect(run([high, baselhr930, low]).value).toBeCloseTo(20525.578);
    });
  });

  describe('category_performance_median()', () => {
    const run = definitions.category_performance_median;

    it('should extract the median value', () => {
      const low = JSON.parse(JSON.stringify(baseLhr5));
      const high = JSON.parse(JSON.stringify(baseLhr5));
      low.categories.performance.score = 0.01;
      high.categories.performance.score = 0.99;
      expect(run([low, high, baseLhr5]).value).toBeCloseTo(0.18);
      expect(run([baseLhr6, low, high]).value).toBeCloseTo(0.16);
      expect(run([high, baseLhr62, low]).value).toBeCloseTo(0.28);
      expect(run([high, baseLhr641, low]).value).toBeCloseTo(0.2);
      expect(run([high, baseLhr700, low]).value).toBeCloseTo(0.18);
      expect(run([high, baseLhr800, low]).value).toBeCloseTo(0.24);
      expect(run([high, baselhr930, low]).value).toBeCloseTo(0.23);
    });
  });

  describe('category_performance_min()', () => {
    const run = definitions.category_performance_min;

    it('should extract the min value', () => {
      const low = JSON.parse(JSON.stringify(baseLhr5));
      const high = JSON.parse(JSON.stringify(baseLhr5));
      low.categories.performance.score = 0.01;
      high.categories.performance.score = 0.99;
      expect(run([low, high, baseLhr5]).value).toBeCloseTo(0.01);
      expect(run([baseLhr6, low, high]).value).toBeCloseTo(0.01);
      expect(run([high, baseLhr62, low]).value).toBeCloseTo(0.01);
      expect(run([high, baseLhr641, low]).value).toBeCloseTo(0.01);
      expect(run([high, baseLhr700, low]).value).toBeCloseTo(0.01);
      expect(run([high, baseLhr800, low]).value).toBeCloseTo(0.01);
      expect(run([high, baselhr930, low]).value).toBeCloseTo(0.01);
    });
  });

  describe('category_performance_max()', () => {
    const run = definitions.category_performance_max;

    it('should extract the max value', () => {
      const low = JSON.parse(JSON.stringify(baseLhr5));
      const high = JSON.parse(JSON.stringify(baseLhr5));
      low.categories.performance.score = 0.01;
      high.categories.performance.score = 0.99;
      expect(run([low, high, baseLhr5]).value).toBeCloseTo(0.99);
      expect(run([baseLhr6, low, high]).value).toBeCloseTo(0.99);
      expect(run([high, baseLhr62, low]).value).toBeCloseTo(0.99);
      expect(run([high, baseLhr641, low]).value).toBeCloseTo(0.99);
      expect(run([high, baseLhr700, low]).value).toBeCloseTo(0.99);
      expect(run([high, baseLhr800, low]).value).toBeCloseTo(0.99);
      expect(run([high, baselhr930, low]).value).toBeCloseTo(0.99);
    });
  });

  describe('auditgroup_a11y-aria_*()', () => {
    it('should extract the group count', () => {
      expect(definitions['auditgroup_a11y-aria_pass']([baseLhr5])).toEqual({value: 7});
      expect(definitions['auditgroup_a11y-aria_pass']([baseLhr6])).toEqual({value: 10});
      expect(definitions['auditgroup_a11y-aria_pass']([baseLhr62])).toEqual({value: 10});
      expect(definitions['auditgroup_a11y-aria_pass']([baseLhr641])).toEqual({value: 10});
      expect(definitions['auditgroup_a11y-aria_pass']([baseLhr700])).toEqual({value: 10});
      expect(definitions['auditgroup_a11y-aria_pass']([baseLhr800])).toEqual({value: 6});
      expect(definitions['auditgroup_a11y-aria_pass']([baselhr930])).toEqual({value: 8});
      expect(definitions['auditgroup_a11y-color-contrast_fail']([baseLhr5])).toEqual({value: 0});
      expect(definitions['auditgroup_a11y-color-contrast_fail']([baseLhr6])).toEqual({value: 1});
      expect(definitions['auditgroup_a11y-color-contrast_fail']([baseLhr62])).toEqual({value: 1});
      expect(definitions['auditgroup_a11y-color-contrast_fail']([baseLhr641])).toEqual({value: 1});
      expect(definitions['auditgroup_a11y-color-contrast_fail']([baseLhr700])).toEqual({value: 1});
      expect(definitions['auditgroup_a11y-color-contrast_fail']([baseLhr800])).toEqual({value: 1});
      expect(definitions['auditgroup_a11y-color-contrast_fail']([baselhr930])).toEqual({value: 1});
      expect(definitions['auditgroup_a11y-aria_na']([baseLhr5])).toEqual({value: 0});
      expect(definitions['auditgroup_a11y-aria_na']([baseLhr6])).toEqual({value: 2});
      expect(definitions['auditgroup_a11y-aria_na']([baseLhr62])).toEqual({value: 2});
      expect(definitions['auditgroup_a11y-aria_na']([baseLhr641])).toEqual({value: 2});
      expect(definitions['auditgroup_a11y-aria_na']([baseLhr700])).toEqual({value: 7});
      expect(definitions['auditgroup_a11y-aria_na']([baseLhr800])).toEqual({value: 11});
      expect(definitions['auditgroup_a11y-aria_na']([baselhr930])).toEqual({value: 9});
    });
  });
});


text:
#include "stkdata.h"
#include "../stkpl/StkPl.h"

// Constructor
ColumnDefStr::ColumnDefStr()
{
	m_MaxLength = 256;
}

// Constructor
ColumnDefStr::ColumnDefStr(const wchar_t* ColumnName, int MaxLength)
{
	StkPlWcsNCpy(m_ColumnName, COLUMN_NAME_SIZE, ColumnName, COLUMN_NAME_SIZE - 1);
	m_ColumnName[COLUMN_NAME_SIZE - 1] = L'\0';
	m_ColumnType = COLUMN_TYPE_STR;
	m_MaxLength = MaxLength;
}

// Destructor
ColumnDefStr::~ColumnDefStr()
{
}

// Set maximum length of string
// [in] int : maximum length
void ColumnDefStr::SetMaxLength(int MaxLength)
{
	m_MaxLength = MaxLength;
}

// Get maximum length of string
// [out] int : maximum length
int ColumnDefStr::GetMaxLength()
{
	return m_MaxLength;
}


text:
<?php

class Bootphp_Cache_MemcacheTag extends Cache_Memcache implements Cache_Tagging
{
    /**
     * Constructs the memcache object
     *
     * @param  array  $config  configuration
     * @throws  Cache_Exception
     */
    protected function __construct(array $config)
    {
        parent::__construct($config);

        if (!method_exists($this->_memcache, 'tag_add')) {
            throw new Cache_Exception('Memcached-tags PHP plugin not present. Please see http://code.google.com/p/memcached-tags/ for more information');
        }
    }

    /**
     * Set a value based on an id with tags
     *
     * @param   string   $id        id
     * @param   mixed    $data      data
     * @param   integer  $lifetime  lifetime [Optional]
     * @param   array    $tags      tags [Optional]
     * @return  boolean
     */
    public function set_with_tags($id, $data, $lifetime = null, array $tags = null)
    {
        $id = $this->_sanitize_id($id);

        $result = $this->set($id, $data, $lifetime);

        if ($result and $tags) {
            foreach ($tags as $tag) {
                $this->_memcache->tag_add($tag, $id);
            }
        }

        return $result;
    }

    /**
     * Delete cache entries based on a tag
     *
     * @param   string  $tag  tag
     * @return  boolean
     */
    public function delete_tag($tag)
    {
        return $this->_memcache->tag_delete($tag);
    }

    /**
     * Find cache entries based on a tag
     *
     * @param   string  $tag  tag
     * @return  void
     * @throws  Cache_Exception
     */
    public function find($tag)
    {
        throw new Cache_Exception('Memcached-tags does not support finding by tag');
    }

}


text:
{% for node in pagelist %}
{% if navgroup == null or navgroup == node.navgroup %}
{% if page.url == node.url %}

    {{ node.title }}

{% else %}

    {{ node.title }}

{% endif %}
{% endif %}
{% endfor %}
{% assign pagelist = nil %}
{% assign navgroup = nil %}


text:
/**
* <auto-generated />
* This file was generated by a StringTemplate 4 template.
* Don't change it directly as your change would get overwritten. Instead, make changes
* to the .stg file (i.e. the StringTemplate 4 template file) and save it to regenerate this file.
*
* For more infor on StringTemplate 4 template please go to -
* https://github.com/antlr/antlrcs
*
* @author  Kola Oyewumi
* @version 1.0.0
* @since   2017-01-03
*
* A class which represents the oauth_nonce table.
*/

package com.sugaronrest.modules;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.sugaronrest.restapicalls.Module;
import com.sugaronrest.restapicalls.CustomDateDeserializer;
import com.sugaronrest.restapicalls.CustomDateSerializer;

@Module(name = "", tablename = "oauth_nonce")
@JsonRootName(value = "oauth_nonce")
@JsonIgnoreProperties(ignoreUnknown = true)
public class OauthNonce {
    public String getConskey() {
        return conskey;
    }

    public void setConskey(String value) {
        conskey = value;
    }
    public String getNonce() {
        return nonce;
    }

    public void setNonce(String value) {
        nonce = value;
    }
    public Long getNonceTs() {
        return nonceTs;
    }

    public void setNonceTs(Long value) {
        nonceTs = value;
    }

    @JsonProperty("conskey")
    private String conskey;

    @JsonProperty("nonce")
    private String nonce;

    @JsonProperty("nonce_ts")
    private Long nonceTs;

}


text:
<?php
namespace Fuel\Migrations;

class First
{
    function up()
    {
        \DBUtil::create_table('ping', array(
            'id' => array('type' => 'int', 'constraint' => 11, 'auto_increment' => true, 'unsigned' => true),
            'termid' => array('type' => 'int', 'constraint' => 11),
            'param_datetime' => array('type' => 'datetime'),
            'param_unixtime' => array('type' => 'int', 'constraint' => 11),
            'created_at' => array('type' => 'datetime'),
        ), array('id'), false, 'InnoDB');
        \DBUtil::create_index('ping', 'param_datetime', 'ping_param_datetime');

        \DBUtil::create_table('point', array(
            'id' => array('type' => 'int', 'constraint' => 11, 'auto_increment' => true, 'unsigned' => true),
            'termid' => array('type' => 'int', 'constraint' => 11),
            'type' => array('type' => 'int', 'constraint' => 11),
            'value' => array('type' => 'int', 'constraint' => 11),
            'created_at' => array('type' => 'datetime'),
        ), array('id'), false, 'InnoDB');

        \DBUtil::create_index('point', 'type', 'point_type');
        \DBUtil::create_index('point', 'value', 'point_value');
    }

    function down()
    {
        \DBUtil::drop_table('ping');
        \DBUtil::drop_table('point');
    }
}


text:
/// <reference path="mongoose-promise.d.ts" />

import * as mongoose from 'mongoose';

var cb = function () {};

var mongopromise: mongoose.Promise<number>;
mongopromise.addBack(function (err, arg) {
  err.stack;
  arg.toFixed();
}).addBack(function (err, arg1, arg2) {
  err.stack;
  arg1.toFixed();
  arg2.toFixed();
});
mongopromise.addCallback(function (arg) {
  arg.toFixed();
}).addCallback(function (arg1, arg2) {
  arg1.toFixed();
  arg2.toFixed();
});
mongopromise.addErrback(function (err) {
  err.stack;
}).addErrback(cb);
mongopromise.catch(function (err) {
  err.stack;
}).catch(cb);
mongopromise.end();
mongopromise.error(999).error([]);
mongopromise.on('init', cb).on('init', cb);
mongopromise.reject({}).reject('').reject(new Error('hi'));
mongopromise.resolve(new Error('hi'), {}).resolve();
mongopromise.then(function (arg) {
  arg.toFixed();
  return 9;
}, function (err) {
  err.stack;
  return 9;
}).then(function (arg1, arg2) {
  arg1.toFixed();
  arg2.toFixed();
});
mongopromise.complete();
/* static properties */
mongoose.Promise.ES6(function (complete: any, error: any) {
  complete.apply(this);
  error.apply(this);
});
/* Practical Examples */
interface IUser extends mongoose.Document {
  name: string;
  age: number;
}
var UserSchema = new mongoose.Schema({
  name: String,
  age: Number
});
var UserModel: mongoose.Model<IUser> = mongoose.model<IUser>('Model', UserSchema);
UserModel.findOne({}).exec().fulfill();
UserModel.find({}).exec().then(() => {}).catch(() => {}).reject('');


text:
package jstypewithdefault;

import jsinterop.annotations.JsType;

public class SomeJsType implements Interface {}

@JsType
interface Interface {
  default void defaultMethod() {}
}


text:
void connect(char* ip, int port, int* socketfd)
{
	int char_number;
	struct sockaddr_in server_address;
	struct hostent *server;

	*socketfd = socket(AF_INET, SOCK_STREAM, 0);
	bzero((char *) &server_address, sizeof(server_address));
	if (*socketfd < 0)
		throw Exeption("Server not found");
	server = gethostbyname(ip);
	if (server == 0)
		throw Exeption("Perver not found");
	server_address.sin_family = AF_INET;
	bcopy((char *)server->h_addr, (char *)&server_address.sin_addr.s_addr,server->h_length);
	server_address.sin_port = htons(port);
	if (connect(*socketfd,(struct sockaddr *)&server_address,sizeof(server_address)) == -1)
		throw Exeption("Connection error");
}

void send_message(string message, int sockfd)
{
    string buff;
    buff = message;
    if(buff.size()>MAX_BUFFER_SIZE)
        throw Exeption("Too long message");
    int nwrite = write(sockfd, buff.c_str(), MAX_BUFFER_SIZE);
    if(nwrite<=0){
        throw Exeption("Connection error");
    }
}

void build_server(int socketfd, struct sockaddr_in *server_address, int port_number)
{
	bzero((char *) server_address, sizeof(server_address));
	server_address->sin_family = AF_INET;
	server_address->sin_port = htons(port_number);
	server_address->sin_addr.s_addr = INADDR_ANY;

	if (bind(socketfd, (struct sockaddr *) server_address, sizeof(*server_address)) ==-1){
		throw Exeption("binding has problem!\n");
    }
	if(listen(socketfd,7)==-1)
		throw Exeption("problem in listening!");
}


text:
module UntypedLambda.Reduction
  ( betaReduce
  , headNormalForm
  )
where

import Data.Set (Set)
import qualified Data.Set as Set
import qualified Data.Map as Map

import UntypedLambda.Syntax

headNormalForm :: Term -> Term
headNormalForm = until (\t -> betaReduce t == t) betaReduce

betaReduce :: Term -> Term
betaReduce (App (Abs v t1) t2) = subst v t2 t1
betaReduce t = t

subst :: String -> Term -> Term -> Term
subst ident term1 term2 = let term1' = unclash term1 (vars term2)
                              term2' = unclash term2 (vars term1')
                          in subst' ident term1' term2'
  where
    subst' v t1 t2@(Var i)    = if i == v then t1 else t2
    subst' v t1    (Abs i t2) = Abs i (subst' v t1 t2)
    subst' v t1    (App t2 t3)    = App (subst' v t1 t2) (subst' v t1 t3)
    subst' _ _  t2                = t2

unclash :: Term -> Set String -> Term
unclash term cl = unclash' term cl Map.empty
  where
    unclash' (Var ident) _ renames = Var $ Map.findWithDefault ident ident renames
    unclash' orig@(Abs ident t) clashing renames = if ident `Set.member` clashing then
                                                     let ident'    = freshVar ident clashing
                                                         clashing' = Set.insert ident' clashing
                                                         renames'  = Map.insert ident ident' renames
                                                     in (Abs ident' (unclash' t clashing' renames'))
                                                   else orig
    unclash' (App t1 t2) clashing renames = App (unclash' t1 clashing renames) (unclash' t2 clashing renames)
    unclash' t _ _ = t

freshVar :: String -> Set String -> String
freshVar ident used = let ident' = ident ++ "'"
                      in if ident' `Set.member` used then freshVar ident' used else ident'