text:
package hudson.util.spring;

import groovy.lang.GroovyObjectSupport;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.ChildBeanDefinition;
import org.springframework.beans.factory.support.RootBeanDefinition;

import java.util.*;

/**
 * Default implementation of the BeanConfiguration interface
 *
 * Credit must go to Solomon Duskis and the
 * article: http://jroller.com/page/Solomon?entry=programmatic_configuration_in_spring
 *
 * @author Graeme
 * @since 0.3
 *
 */
class DefaultBeanConfiguration extends GroovyObjectSupport implements BeanConfiguration {

	private static final String AUTOWIRE = "autowire";
	private static final String CONSTRUCTOR_ARGS = "constructorArgs";
	private static final String DESTROY_METHOD = "destroyMethod";
	private static final String FACTORY_BEAN = "factoryBean";
	private static final String FACTORY_METHOD = "factoryMethod";
	private static final String INIT_METHOD = "initMethod";
	private static final String BY_NAME = "byName";
    private static final String PARENT = "parent";
    private static final String BY_TYPE = "byType";
    private static final String BY_CONSTRUCTOR = "constructor";
    private static final Set<String> DYNAMIC_PROPS = new HashSet<String>(Arrays.asList(AUTOWIRE, CONSTRUCTOR_ARGS, DESTROY_METHOD, FACTORY_BEAN, FACTORY_METHOD, INIT_METHOD, BY_NAME, BY_TYPE, BY_CONSTRUCTOR));
    private String parentName;

    @Override
    public Object getProperty(String property) {
		getBeanDefinition();
		if(wrapper.isReadableProperty(property)) {
			return wrapper.getPropertyValue(property);
		}
		else if(DYNAMIC_PROPS.contains(property)) {
			return null;
		}
		return super.getProperty(property);
	}

    @Override
    public void setProperty(String property, Object newValue) {
        if(PARENT.equals(property)) {
            setParent(newValue);
        }
        else {
            AbstractBeanDefinition bd = getBeanDefinition();
            if(AUTOWIRE.equals(property)) {
                if(BY_NAME.equals(newValue)) {
                    bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_NAME);
                }
                else if(BY_TYPE.equals(newValue)) {
                    bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE);
                }
                else if(Boolean.TRUE.equals(newValue)) {
                    bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_NAME);
                }
                else if(BY_CONSTRUCTOR.equals(newValue)) {
                    bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR);
                }
            }
            // constructorArgs
            else if(CONSTRUCTOR_ARGS.equals(property) && newValue instanceof List) {
                ConstructorArgumentValues cav = new ConstructorArgumentValues();
                List args = (List)newValue;
                for (Object e : args) {
                    cav.addGenericArgumentValue(e);
                }
                bd.setConstructorArgumentValues(cav);
            }
            // destroyMethod
            else if(DESTROY_METHOD.equals(property)) {
                if(newValue != null)
                    bd.setDestroyMethodName(newValue.toString());
            }
            // factoryBean
            else if(FACTORY_BEAN.equals(property)) {
                if(newValue != null)
                    bd.setFactoryBeanName(newValue.toString());
            }
            // factoryMethod
            else if(FACTORY_METHOD.equals(property)) {
                if(newValue != null)
                    bd.setFactoryMethodName(newValue.toString());
            }
            // initMethod
            else if(INIT_METHOD.equals(property)) {
                if(newValue != null)
                    bd.setInitMethodName(newValue.toString());
            }
            else if(wrapper.isWritableProperty(property)) {

                wrapper.setPropertyValue(property, newValue);
            }
            // autowire
            else {
                super.setProperty(property, newValue);
            }
        }
	}

	private Class clazz;
	private String name;
	private boolean singleton = true;
	private AbstractBeanDefinition definition;
	private Collection constructorArgs = Collections.EMPTY_LIST;
	private BeanWrapper wrapper;

	public DefaultBeanConfiguration(String name, Class clazz) {
		this.name = name;
		this.clazz = clazz;
	}

	public DefaultBeanConfiguration(String name, Class clazz, boolean prototype) {
		this(name,clazz,Collections.EMPTY_LIST);
		this.singleton = !prototype;
	}

	public DefaultBeanConfiguration(String name) {
		this(name,null,Collections.EMPTY_LIST);
	}

	public DefaultBeanConfiguration(Class clazz2) {
		this.clazz = clazz2;
	}

	public DefaultBeanConfiguration(String name2, Class clazz2, Collection args) {
		this.name = name2;
		this.clazz = clazz2;
		this.constructorArgs = args;
	}

	public DefaultBeanConfiguration(String name2, boolean prototype) {
		this(name2,null,Collections.EMPTY_LIST);
		this.singleton = !prototype;
	}

	public DefaultBeanConfiguration(Class clazz2, Collection constructorArguments) {
		this.clazz = clazz2;
		this.constructorArgs = constructorArguments;
	}

	public String getName() {
		return this.name;
	}

	public boolean isSingleton() {
		return this.singleton ;
	}

	public AbstractBeanDefinition getBeanDefinition() {
		if (definition == null)
			definition = createBeanDefinition();
		return definition;
	}

	protected AbstractBeanDefinition createBeanDefinition() {
		AbstractBeanDefinition bd;
		if(constructorArgs.size() > 0) {
			ConstructorArgumentValues cav = new ConstructorArgumentValues();
            for (Object constructorArg : constructorArgs) {
                cav.addGenericArgumentValue(constructorArg);
            }
            if(StringUtils.isBlank(parentName)) {
                bd = new RootBeanDefinition(clazz,cav,null);
            }
            else {
                bd = new ChildBeanDefinition(parentName,clazz,cav, null);
            }
            bd.setSingleton(singleton);
		}
		else {
            if(StringUtils.isBlank(parentName)) {
                bd = new RootBeanDefinition(clazz,singleton);
            }
            else {
                bd = new ChildBeanDefinition(parentName,clazz, null,null);
                bd.setSingleton(singleton);
            }

		}
		wrapper = new BeanWrapperImpl(bd);
		return bd;
	}

	public BeanConfiguration addProperty(String propertyName, Object propertyValue) {
		if(propertyValue instanceof BeanConfiguration) {
			propertyValue = ((BeanConfiguration)propertyValue).getBeanDefinition();
		}
		getBeanDefinition()
			.getPropertyValues()
			.addPropertyValue(propertyName,propertyValue);

		return this;
	}

	public BeanConfiguration setDestroyMethod(String methodName) {
		getBeanDefinition().setDestroyMethodName(methodName);
		return this;
	}

	public BeanConfiguration setDependsOn(String[] dependsOn) {
		getBeanDefinition().setDependsOn(dependsOn);
		return this;
	}

	public BeanConfiguration setFactoryBean(String beanName) {
		getBeanDefinition().setFactoryBeanName(beanName);

		return this;
	}

	public BeanConfiguration setFactoryMethod(String methodName) {
		getBeanDefinition().setFactoryMethodName(methodName);
		return this;
	}

	public BeanConfiguration setAutowire(String type) {
		if("byName".equals(type)) {
			getBeanDefinition().setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_NAME);
		}
		else if("byType".equals(type)){
			getBeanDefinition().setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);
		}
		return this;
	}

    public void setName(String beanName) {
        this.name = beanName;
    }

	public Object getPropertyValue(String name) {
		return getBeanDefinition()
					.getPropertyValues()
					.getPropertyValue(name)
					.getValue();
	}

	public boolean hasProperty(String name) {
		return getBeanDefinition().getPropertyValues().contains(name);
	}

	public void setPropertyValue(String property, Object newValue) {
		getBeanDefinition().getPropertyValues().addPropertyValue(property, newValue);
	}

    public BeanConfiguration setAbstract(boolean isAbstract) {
        getBeanDefinition().setAbstract(isAbstract);
        return this;
    }

    public void setParent(Object obj) {
        if(obj == null) throw new IllegalArgumentException("Parent bean cannot be set to a null runtime bean reference!");
        if(obj instanceof String)
            this.parentName = (String)obj;
        else if(obj instanceof RuntimeBeanReference) {
            this.parentName = ((RuntimeBeanReference)obj).getBeanName();
        }
        else if(obj instanceof BeanConfiguration) {
            this.parentName = ((BeanConfiguration)obj).getName();
        }
    }

}


text:
/// Copyright (c) 2012 Ecma International.  All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms").   Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
 * @path ch15/15.11/15.11.4/15.11.4.2/15.11.4.2-1.js
 * @description Error.prototype.name is not enumerable.
 */

function testcase() {
        for (var i in Error.prototype) {
            if (i==="name") {
                return false;
            }
        }
        return true;
}
runTestCase(testcase);

redpajama_set_name: RedPajamaGithub


text:
package org.glassfish.jaxb.core.v2.model.core;

import jakarta.xml.bind.annotation.XmlList;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import org.glassfish.jaxb.core.v2.model.annotation.AnnotationReader;
import org.glassfish.jaxb.core.v2.model.impl.ModelBuilderI;
import org.glassfish.jaxb.core.v2.model.nav.Navigator;

/**
 * Reference to a type in a model.
 *
 * TODO: isn't there a similarity between this and TypeUse in XJC?
 *
 * @author Kohsuke Kawaguchi
 */
public final class Ref<T,C> {
    /**
     * The type being referenced.
     * <p>
     * If the type is adapted, this field is the same as the adapter's default type.
     */
    public final T type;
    /**
     * If the reference has an adapter, non-null.
     */
    public final Adapter<T,C> adapter;
    /**
     * If the {@link #type} is an array and it is a value list,
     * true.
     */
    public final boolean valueList;

    public Ref(T type) {
        this(type,null,false);
    }

    public Ref(T type, Adapter<T, C> adapter, boolean valueList) {
        this.adapter = adapter;
        if(adapter!=null)
            type=adapter.defaultType;
        this.type = type;
        this.valueList = valueList;
    }

    public Ref(ModelBuilderI<T,C,?,?> builder, T type, XmlJavaTypeAdapter xjta, XmlList xl ) {
        this(builder.getReader(),builder.getNavigator(),type,xjta,xl);
    }

    public Ref(AnnotationReader<T,C,?,?> reader,
               Navigator<T,C,?,?> nav,
               T type, XmlJavaTypeAdapter xjta, XmlList xl ) {
        Adapter<T,C> adapter=null;
        if(xjta!=null) {
            adapter = new Adapter<>(xjta,reader,nav);
            type = adapter.defaultType;
        }

        this.type = type;
        this.adapter = adapter;
        this.valueList = xl!=null;
    }
}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.COMPONENT_GROUP_ADVANCED = exports.COMPONENT_GROUP_EXPANDABLE = exports.MULTISELECT = exports.SINGLESELECT = exports.RENDER_LOCATION_BOTTOM = exports.RENDER_LOCATION_CENTER = exports.RENDER_LOCATION_TOP = exports.RENDER_LOCATION_RIGHT = exports.RENDER_LOCATION_LEFT = exports.RENDER_LOCATION_DEFAULT = void 0;

/**
 * Constant for the "default" render location.
 *
 * All layout components (see {@link AbstractLayout}) must
 * support this render location.
 *
 * @type {string}
 */
var RENDER_LOCATION_DEFAULT = 'default';
/**
 * Constant for the "left" render location.
 *
 * @type {string}
 */

exports.RENDER_LOCATION_DEFAULT = RENDER_LOCATION_DEFAULT;
var RENDER_LOCATION_LEFT = 'left';
/**
 * Constant for the "right" render location.
 *
 * @type {string}
 */

exports.RENDER_LOCATION_LEFT = RENDER_LOCATION_LEFT;
var RENDER_LOCATION_RIGHT = 'right';
/**
 * Constant for the "top" render location.
 *
 * @type {string}
 */

exports.RENDER_LOCATION_RIGHT = RENDER_LOCATION_RIGHT;
var RENDER_LOCATION_TOP = 'top';
/**
 * Constant for the "center" render location.
 *
 * @type {string}
 */

exports.RENDER_LOCATION_TOP = RENDER_LOCATION_TOP;
var RENDER_LOCATION_CENTER = 'center';
/**
 * Constant for the "bottom" render location.
 *
 * @type {string}
 */

exports.RENDER_LOCATION_CENTER = RENDER_LOCATION_CENTER;
var RENDER_LOCATION_BOTTOM = 'bottom';
/**
 * Constant for single select selectMode for {@link AbstractFilterList}.
 *
 * @type {string}
 */

exports.RENDER_LOCATION_BOTTOM = RENDER_LOCATION_BOTTOM;
var SINGLESELECT = 'single';
/**
 * Constant for multi-select selectMode for {@link AbstractFilterList}.
 *
 * @type {string}
 */

exports.SINGLESELECT = SINGLESELECT;
var MULTISELECT = 'multi';
/**
 * Constant the "expandable" component group.
 *
 * Intended for the use case where you have expand
 * something, such as a search filter, that expands
 * the entire body in a floating panel to show results.
 *
 * @type {string}
 */

exports.MULTISELECT = MULTISELECT;
var COMPONENT_GROUP_EXPANDABLE = 'expandable';
/**
 * Constant the "advanced" component group.
 *
 * Intended for _Show advanced filters_ / _Show all filters_ and
 * similar use cases.
 *
 * @type {string}
 */

exports.COMPONENT_GROUP_EXPANDABLE = COMPONENT_GROUP_EXPANDABLE;
var COMPONENT_GROUP_ADVANCED = 'advanced'; // export const KEYBOARD_NAVIGATION_GROUP_KEY_UP_DOWN = 'key_up_down'

exports.COMPONENT_GROUP_ADVANCED = COMPONENT_GROUP_ADVANCED;


text:
#include <math.h>
#include <assert.h>
#include "pc_api_internal.h"

int
pc_patch_compute_extent(PCPATCH *pa)
{
	if ( ! pa ) return PC_FAILURE;
	switch ( pa->type )
	{
	case PC_NONE:
		return pc_patch_uncompressed_compute_extent((PCPATCH_UNCOMPRESSED*)pa);
	case PC_GHT:
		return pc_patch_ght_compute_extent((PCPATCH_GHT*)pa);
	case PC_DIMENSIONAL:
		return pc_patch_dimensional_compute_extent((PCPATCH_DIMENSIONAL*)pa);
	}
	return PC_FAILURE;
}

/**
* Calculate or re-calculate statistics for a patch.
*/
int
pc_patch_compute_stats(PCPATCH *pa)
{
	if ( ! pa ) return PC_FAILURE;

	switch ( pa->type )
	{
	case PC_NONE:
		return pc_patch_uncompressed_compute_stats((PCPATCH_UNCOMPRESSED*)pa);

	case PC_DIMENSIONAL:
	{
		PCPATCH_UNCOMPRESSED *pu = pc_patch_uncompressed_from_dimensional((PCPATCH_DIMENSIONAL*)pa);
		pc_patch_uncompressed_compute_stats(pu);
		pa->stats = pu->stats; pu->stats = NULL;
		pc_patch_uncompressed_free(pu);
		return PC_SUCCESS;
	}
	case PC_GHT:
	{
		PCPATCH_UNCOMPRESSED *pu = pc_patch_uncompressed_from_ght((PCPATCH_GHT*)pa);
		pc_patch_uncompressed_compute_stats(pu);
		pa->stats = pc_stats_clone(pu->stats);
		pc_patch_uncompressed_free(pu);
		return PC_SUCCESS;
	}
	default:
	{
		pcerror("%s: unknown compression type", __func__, pa->type);
		return PC_FAILURE;
	}
	}

	return PC_FAILURE;
}

void
pc_patch_free(PCPATCH *patch)
{
	if ( patch->stats )
	{
		pc_stats_free( patch->stats );
		patch->stats = NULL;
	}

	switch( patch->type )
	{
	case PC_NONE:
	{
		pc_patch_uncompressed_free((PCPATCH_UNCOMPRESSED*)patch);
		break;
	}
	case PC_GHT:
	{
		pc_patch_ght_free((PCPATCH_GHT*)patch);
		break;
	}
	case PC_DIMENSIONAL:
	{
		pc_patch_dimensional_free((PCPATCH_DIMENSIONAL*)patch);
		break;
	}
	default:
	{
		pcerror("%s: unknown compression type %d", __func__, patch->type);
		break;
	}
	}
}

PCPATCH *
pc_patch_from_pointlist(const PCPOINTLIST *ptl)
{
	return (PCPATCH*)pc_patch_uncompressed_from_pointlist(ptl);
}

PCPATCH *
pc_patch_compress(const PCPATCH *patch, void *userdata)
{
	uint32_t schema_compression = patch->schema->compression;
	uint32_t patch_compression = patch->type;

	switch ( schema_compression )
	{
	case PC_DIMENSIONAL:
	{
		if ( patch_compression == PC_NONE )
		{
			/* Dimensionalize, dimensionally compress, return */
			PCPATCH_DIMENSIONAL *pcdu = pc_patch_dimensional_from_uncompressed((PCPATCH_UNCOMPRESSED*)patch);
			PCPATCH_DIMENSIONAL *pcdd = pc_patch_dimensional_compress(pcdu, (PCDIMSTATS*)userdata);
			pc_patch_dimensional_free(pcdu);
			return (PCPATCH*)pcdd;
		}
		else if ( patch_compression == PC_DIMENSIONAL )
		{
			/* Make sure it's compressed, return */
			return (PCPATCH*)pc_patch_dimensional_compress((PCPATCH_DIMENSIONAL*)patch, (PCDIMSTATS*)userdata);
		}
		else if ( patch_compression == PC_GHT )
		{
			/* Uncompress, dimensionalize, dimensionally compress, return */
			PCPATCH_UNCOMPRESSED *pcu = pc_patch_uncompressed_from_ght((PCPATCH_GHT*)patch);
			PCPATCH_DIMENSIONAL *pcdu  = pc_patch_dimensional_from_uncompressed(pcu);
			PCPATCH_DIMENSIONAL *pcdc  = pc_patch_dimensional_compress(pcdu, NULL);
			pc_patch_dimensional_free(pcdu);
			return (PCPATCH*)pcdc;
		}
		else
		{
			pcerror("%s: unknown patch compression type %d", __func__, patch_compression);
		}
	}
	case PC_NONE:
	{
		if ( patch_compression == PC_NONE )
		{
			return (PCPATCH*)patch;
		}
		else if ( patch_compression == PC_DIMENSIONAL )
		{
			PCPATCH_UNCOMPRESSED *pcu = pc_patch_uncompressed_from_dimensional((PCPATCH_DIMENSIONAL*)patch);
			return (PCPATCH*)pcu;

		}
		else if ( patch_compression == PC_GHT )
		{
			PCPATCH_UNCOMPRESSED *pcu = pc_patch_uncompressed_from_ght((PCPATCH_GHT*)patch);
			return (PCPATCH*)pcu;
		}
		else
		{
			pcerror("%s: unknown patch compression type %d", __func__, patch_compression);
		}
	}
	case PC_GHT:
	{
		if ( patch_compression == PC_NONE )
		{
			PCPATCH_GHT *pgc = pc_patch_ght_from_uncompressed((PCPATCH_UNCOMPRESSED*)patch);
			if ( ! pgc ) pcerror("%s: ght compression failed", __func__);
			return (PCPATCH*)pgc;
		}
		else if ( patch_compression == PC_DIMENSIONAL )
		{
			PCPATCH_UNCOMPRESSED *pcu = pc_patch_uncompressed_from_dimensional((PCPATCH_DIMENSIONAL*)patch);
			PCPATCH_GHT *pgc = pc_patch_ght_from_uncompressed((PCPATCH_UNCOMPRESSED*)patch);
			pc_patch_uncompressed_free(pcu);
			return (PCPATCH*)pgc;
		}
		else if ( patch_compression == PC_GHT )
		{
			return (PCPATCH*)patch;
		}
		else
		{
			pcerror("%s: unknown patch compression type %d", __func__, patch_compression);
		}
	}
	default:
	{
		pcerror("%s: unknown schema compression type %d", __func__, schema_compression);
	}
	}

	pcerror("%s: fatal error", __func__);
	return NULL;
}

PCPATCH *
pc_patch_uncompress(const PCPATCH *patch)
{
	uint32_t patch_compression = patch->type;

	if ( patch_compression == PC_DIMENSIONAL )
	{
		PCPATCH_UNCOMPRESSED *pu = pc_patch_uncompressed_from_dimensional((PCPATCH_DIMENSIONAL*)patch);
		return (PCPATCH*)pu;
	}

	if ( patch_compression == PC_NONE )
	{
		return (PCPATCH*)patch;
	}

	if ( patch_compression == PC_GHT )
	{
		PCPATCH_UNCOMPRESSED *pu = pc_patch_uncompressed_from_ght((PCPATCH_GHT*)patch);
		return (PCPATCH*)pu;
	}

	return NULL;
}

PCPATCH *
pc_patch_from_wkb(const PCSCHEMA *s, uint8_t *wkb, size_t wkbsize)
{
	/*
	byte:     endianness (1 = NDR, 0 = XDR)
	uint32:   pcid (key to POINTCLOUD_SCHEMAS)
	uint32:   compression (0 = no compression, 1 = dimensional, 2 = GHT)
	uchar[]:  data (interpret relative to pcid and compression)
	*/
	uint32_t compression, pcid;
	PCPATCH *patch;

	if ( ! wkbsize )
	{
		pcerror("%s: zero length wkb", __func__);
	}

	/*
	* It is possible for the WKB compression to be different from the
	* schema compression at this point. The schema compression is only
	* forced at serialization time.
	*/
	pcid = wkb_get_pcid(wkb);
	compression = wkb_get_compression(wkb);

	if ( pcid != s->pcid )
	{
		pcerror("%s: wkb pcid (%d) not consistent with schema pcid (%d)", __func__, pcid, s->pcid);
	}

	switch ( compression )
	{
	case PC_NONE:
	{
		patch = pc_patch_uncompressed_from_wkb(s, wkb, wkbsize);
		break;
	}
	case PC_DIMENSIONAL:
	{
		patch = pc_patch_dimensional_from_wkb(s, wkb, wkbsize);
		break;
	}
	case PC_GHT:
	{
		patch = pc_patch_ght_from_wkb(s, wkb, wkbsize);
		break;
	}
	default:
	{
		/* Don't get here */
		pcerror("%s: unknown compression '%d' requested", __func__, compression);
		return NULL;
	}
	}

	if ( PC_FAILURE == pc_patch_compute_extent(patch) )
		pcerror("%s: pc_patch_compute_extent failed", __func__);

	if ( PC_FAILURE == pc_patch_compute_stats(patch) )
		pcerror("%s: pc_patch_compute_stats failed", __func__);

	return patch;

}

uint8_t *
pc_patch_to_wkb(const PCPATCH *patch, size_t *wkbsize)
{
	/*
	byte:     endianness (1 = NDR, 0 = XDR)
	uint32:   pcid (key to POINTCLOUD_SCHEMAS)
	uint32:   compression (0 = no compression, 1 = dimensional, 2 = GHT)
	uchar[]:  data (interpret relative to pcid and compression)
	*/
	switch ( patch->type )
	{
	case PC_NONE:
	{
		return pc_patch_uncompressed_to_wkb((PCPATCH_UNCOMPRESSED*)patch, wkbsize);
	}
	case PC_DIMENSIONAL:
	{
		return pc_patch_dimensional_to_wkb((PCPATCH_DIMENSIONAL*)patch, wkbsize);
	}
	case PC_GHT:
	{
		return pc_patch_ght_to_wkb((PCPATCH_GHT*)patch, wkbsize);
	}
	}
	pcerror("%s: unknown compression requested '%d'", __func__, patch->schema->compression);
	return NULL;
}

char *
pc_patch_to_string(const PCPATCH *patch)
{
	switch( patch->type )
	{
	case PC_NONE:
		return pc_patch_uncompressed_to_string((PCPATCH_UNCOMPRESSED*)patch);
	case PC_DIMENSIONAL:
		return pc_patch_dimensional_to_string((PCPATCH_DIMENSIONAL*)patch);
	case PC_GHT:
		return pc_patch_ght_to_string((PCPATCH_GHT*)patch);
	}
	pcerror("%s: unsupported compression %d requested", __func__, patch->type);
	return NULL;
}

PCPATCH *
pc_patch_from_patchlist(PCPATCH **palist, int numpatches)
{
	int i;
	uint32_t totalpoints = 0;
	PCPATCH_UNCOMPRESSED *paout;
	const PCSCHEMA *schema = NULL;
	uint8_t *buf;

	assert(palist);
	assert(numpatches);

	/* All schemas better be the same... */
	schema = palist[0]->schema;

	/* How many points will this output have? */
	for ( i = 0; i < numpatches; i++ )
	{
		if ( schema->pcid != palist[i]->schema->pcid )
		{
			pcerror("%s: inconsistent schemas in input", __func__);
			return NULL;
		}
		totalpoints += palist[i]->npoints;
	}

	/* Blank output */
	paout = pc_patch_uncompressed_make(schema, totalpoints);
	buf = paout->data;

	/* Uncompress dimensionals, copy uncompressed */
	for ( i = 0; i < numpatches; i++ )
	{
		const PCPATCH *pa = palist[i];

		/* Update bounds */
		pc_bounds_merge(&(paout->bounds), &(pa->bounds));

		switch ( pa->type )
		{
		case PC_DIMENSIONAL:
		{
			PCPATCH_UNCOMPRESSED *pu = pc_patch_uncompressed_from_dimensional((const PCPATCH_DIMENSIONAL*)pa);
			size_t sz = pu->schema->size * pu->npoints;
			memcpy(buf, pu->data, sz);
			buf += sz;
			pc_patch_free((PCPATCH*)pu);
			break;
		}
		case PC_GHT:
		{
			PCPATCH_UNCOMPRESSED *pu = pc_patch_uncompressed_from_ght((const PCPATCH_GHT*)pa);
			size_t sz = pu->schema->size * pu->npoints;
			memcpy(buf, pu->data, sz);
			buf += sz;
			pc_patch_uncompressed_free(pu);
			break;
		}
		case PC_NONE:
		{
			PCPATCH_UNCOMPRESSED *pu = (PCPATCH_UNCOMPRESSED*)pa;
			size_t sz = pu->schema->size * pu->npoints;
			memcpy(buf, pu->data, sz);
			buf += sz;
			break;
		}
		default:
		{
			pcerror("%s: unknown compression type (%d)", __func__, pa->type);
			break;
		}
		}
	}

	paout->npoints = totalpoints;

	if ( PC_FAILURE == pc_patch_uncompressed_compute_stats(paout) )
	{
		pcerror("%s: stats computation failed", __func__);
		return NULL;
	}

	return (PCPATCH*)paout;
}


text:
namespace Microsoft.Azure.Management.WebSites.Models
{
    using Newtonsoft.Json;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// Suggested utterances where the detector can be applicable
    /// </summary>
    public partial class QueryUtterancesResults
    {
        /// <summary>
        /// Initializes a new instance of the QueryUtterancesResults class.
        /// </summary>
        public QueryUtterancesResults()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the QueryUtterancesResults class.
        /// </summary>
        /// <param name="query">Search Query.</param>
        /// <param name="results">Array of utterance results for search
        /// query.</param>
        public QueryUtterancesResults(string query = default(string), IList<QueryUtterancesResult> results = default(IList<QueryUtterancesResult>))
        {
            Query = query;
            Results = results;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets search Query.
        /// </summary>
        [JsonProperty(PropertyName = "query")]
        public string Query { get; set; }

        /// <summary>
        /// Gets or sets array of utterance results for search query.
        /// </summary>
        [JsonProperty(PropertyName = "results")]
        public IList<QueryUtterancesResult> Results { get; set; }

    }
}


text:
package com.thelxg.data.models.features;

public class ScoreAPI {

    private String teams;

    private String results;

    public ScoreAPI() {
    }

    public ScoreAPI(String teams, String results) {
        this.teams = teams;
        this.results = results;
    }

    public String getTeams() {
        return teams;
    }

    public void setTeams(String teams) {
        this.teams = teams;
    }

    public String getResults() {
        return results;
    }

    public void setResults(String results) {
        this.results = results;
    }

    @Override
    public String toString() {
        return "{" +
                "teams:'" + teams + '\'' +
                ", results:'" + results + '\'' +
                '}';
    }
}


text:
function timeDiff(time1, time2) {
  // Assumes times are instantiated via new Date()
  var result = Math.abs(time1 - time2)/1000;
  if (result == 0) {
    return 'less than 0.001 seconds';
  } else if (result == 1) {
    return '1 second';
  } else {
    return result + ' seconds';
  }
};

exports.timer = function (problemNumber, main) {
  var timeStart = new Date(),
      result = main(true),
      timeEnd = new Date(),
  timeElapsed = timeDiff(timeStart, timeEnd);
  var statement = ['The answer to Euler Project, question ',
                   problemNumber, ' is: ',
                   result, '\n\nThis solution ran in ', timeElapsed];

  console.log(statement.join(''));
};


text:
;; Scheduling description for SPARClet.
;;   Copyright (C) 2002, 2007 Free Software Foundation, Inc.
;;
;; This file is part of GCC.
;;
;; GCC is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; GCC is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; <http://www.gnu.org/licenses/>.

;; The SPARClet is a single-issue processor.

(define_automaton "sparclet")

(define_cpu_unit "sl_load0,sl_load1,sl_load2,sl_load3" "sparclet")
(define_cpu_unit "sl_store,sl_imul" "sparclet")

(define_reservation "sl_load_any" "(sl_load0 | sl_load1 | sl_load2 | sl_load3)")
(define_reservation "sl_load_all" "(sl_load0 + sl_load1 + sl_load2 + sl_load3)")

(define_insn_reservation "sl_ld" 3
  (and (eq_attr "cpu" "tsc701")
   (eq_attr "type" "load,sload"))
  "sl_load_any, sl_load_any, sl_load_any")

(define_insn_reservation "sl_st" 3
  (and (eq_attr "cpu" "tsc701")
    (eq_attr "type" "store"))
  "(sl_store+sl_load_all)*3")

(define_insn_reservation "sl_imul" 5
  (and (eq_attr "cpu" "tsc701")
    (eq_attr "type" "imul"))
  "sl_imul*5")


text:
package org.virtue.game.content.ignores;

import org.virtue.utility.text.Base37Utility;

/**
 *
 * @author Im Frizzy <skype:kfriz1998>
 * @since Oct 12, 2014
 */
public class Ignore {

	/**
	 * Represents the {@code Ignore}'s username.
	 */
	private final long userhash;

	/**
	 * Represents the {@code Ignore}'s display name.
	 */
	private String displayName;

	/**
	 * Represents the previous display name of the {@code Ignore}
	 */
	private String prevName;

	/**
	 * Represents the note associated with this {@code Ignore}.
	 */
	private String note = "";

	/**
	 * Constructs a new {@code Ignore}.
	 */
	public Ignore(long userhash) {
		this.userhash = userhash;
	}

	/**
	 * Constructs a new {@code Ignore}.
	 */
	public Ignore(long userhash, String note) {
		this.userhash = userhash;
		this.note = note;
	}

	/**
	 * Sets the current and previous names for this ignore
	 * @param display The current display name
	 * @param prev The previous display name
	 */
	protected void setNames (String display, String prev) {
		this.displayName = display;
		this.prevName = prev;
	}

	/**
	 * Gets the {@code Ignore} user hash
	 * @return The user hash
	 */
	public long getHash () {
		return userhash;
	}

	/**
	 * Gets the username of the {@code Ignore}.
	 * @return the username
	 */
	public String getUsername() {
		return Base37Utility.decodeBase37(userhash);
	}

	/**
	 * Gets the display name of the {@code Ignore}.
	 * @return the displayName
	 */
	public String getDisplayName() {
		return displayName;
	}

	/**
	 * Gets the {@code Ignore} previous display name.
	 * @return the previous name
	 */
	public String getPrevName() {
		return prevName;
	}

	/**
	 * Gets the {@code Ignore} note.
	 * @return the note
	 */
	public String getNote () {
		return note;
	}

	/**
	 * Sets the {@code Ignore} note.
	 * @param note The note
	 */
	protected void setNote (String note) {
		this.note = note;
	}

}


text:
<?php
namespace ZeSecurity\IDS\Util;

class Locator
{
    /**
     * Expand the file path using the current include path
     * @static
     * @param string $file
     * @return string
     */
    public static function expandFilePath($file)
    {
        $ps = explode(PATH_SEPARATOR, ini_get('include_path'));
        foreach ($ps as $path) {
            if (file_exists($path . '/' . $file)) return $path . '/' . $file;
        }
        return $file;
    }
}


text:
package orchastack.core.jpa.container.jpa;

import java.util.Hashtable;
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import javax.sql.XADataSource;

import orchastack.core.jpa.container.tx.XADatasourceEnlistingWrapper;

import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;

public class JndiDataSourceHelper {
	/** Logger */
	private static final Logger _logger = Logger
			.getLogger(JndiDataSourceHelper.class.getName());

	private AtomicReference<DataSource> ds = new AtomicReference<DataSource>();

	private final String jndiName;
	private final String unitName;
	private final Bundle persistenceBundle;
	private final boolean jta;

	public JndiDataSourceHelper(String jndi, String unit,
			Bundle persistenceBundle, boolean jta) {
		jndiName = jndi;
		unitName = unit;
		this.persistenceBundle = persistenceBundle;
		this.jta = jta;
	}

	public DataSource getDs() {
		if (ds.get() == null) {
			try {

				BundleContext bCtx = persistenceBundle.getBundleContext();
				if (bCtx == null)
					throw new IllegalStateException(
							"persistence.bundle.not.active, "
									+ persistenceBundle.getSymbolicName());
				Object o = null;
				if (jndiName.startsWith("osgi:service")) {

					_logger.log(Level.FINE,
							"looking for OSGI Datasource service---");

					String[] nms = new String[3];
					int firstSlash = jndiName.indexOf("/", 0);
					int secondSlash = jndiName.indexOf("/", firstSlash + 1);
					nms[1] = jndiName.substring(firstSlash + 1, secondSlash);
					nms[2] = jndiName.substring(secondSlash + 1,
							jndiName.length());

					_logger.log(Level.FINE, "Datasource interface - " + nms[1]
							+ ", filter - " + nms[2]);

					if (nms[1] != null && !nms[1].equals("")) {
						ServiceReference ref = getServiceReference(bCtx,
								nms[1], nms[2], 6000);

						_logger.log(Level.FINE, "got Datasource reference - " + ref);

						if (ref != null) {
							o = bCtx.getService(ref);
						} else {
							String message = "service reference not.found for data source "
									+ jndiName;
							_logger.log(Level.SEVERE, message);
						}
					}
				} else {
					Hashtable<String, Object> props = new Hashtable<String, Object>();
					props.put("osgi.service.jndi.bundleContext", bCtx);

					InitialContext ctx = new InitialContext(props);

					o = ctx.lookup(jndiName);
				}

				if (o == null) {
					String message = "no.data.source.found --- " + jndiName
							+ persistenceBundle.getSymbolicName();
					_logger.log(Level.SEVERE, message);
					throw new NullPointerException(message);
				} else if (o instanceof XADataSource) {
					if (jta) {
						ds.compareAndSet(null,
								wrapXADataSource((XADataSource) o));
					} else {
						if (o instanceof DataSource)
							ds.compareAndSet(null, (DataSource) o);
						else
							throw new IllegalArgumentException(
									"xa.datasource.non.tx,"
											+ persistenceBundle
													.getSymbolicName() + ","
											+ jndiName);
					}
				} else if (o instanceof DataSource) {
					ds.compareAndSet(null, (DataSource) o);
				} else {
					throw new IllegalArgumentException("not.a.datasource, "
							+ persistenceBundle.getSymbolicName() + ", "
							+ jndiName);
				}
			} catch (NamingException e) {
				String message = "no.data.source.found," + jndiName
						+ persistenceBundle.getSymbolicName();
				_logger.log(Level.SEVERE, message, e);
				throw new RuntimeException(message, e);
			} catch (InvalidSyntaxException e) {
				_logger.log(Level.SEVERE,
						"syntax error to query OSGI service!", e);
				throw new RuntimeException(
						"syntax error to query OSGI service!", e);
			}
		}
		return ds.get();
	}

	private ServiceReference getServiceReference(BundleContext context,
			String clazz, String filter, int timeout)
			throws InvalidSyntaxException {
		ServiceReference ref = null;
		// Begin to wait ...
		long enter = System.currentTimeMillis();
		boolean exhausted = false;
		synchronized (this) {
			while (ref == null && !exhausted) {
				if (filter == null || filter.trim().equals("")) {
					_logger.log(Level.FINE,
							"looking for OSGI Datasource service without filter--");
					ref = context.getServiceReference(clazz);
				} else {
					ServiceReference[] refs = context.getServiceReferences(
							clazz, filter);
					if (refs != null && refs.length > 0) {
						ref = refs[0];
					}
				}
				try {
					wait(50);
				} catch (InterruptedException e) {
					// We was interrupted ....
				} finally {
					long end = System.currentTimeMillis();
					exhausted = (end - enter) > timeout;
					_logger.log(Level.FINE, "looking for Datasource -- "
							+ (end - enter));
				}
			}
		}

		return ref;
	}

	protected DataSource wrapXADataSource(XADataSource xaDs)
			throws IllegalStateException {
		boolean b;
		try {
			Class.forName("javax.transaction.TransactionManager");
			b = true;
		} catch (ClassNotFoundException cnfe) {
			b = false;
		}

		if (!b)
			throw new IllegalStateException("no.xa.wrapping");

		return new XADatasourceEnlistingWrapper(xaDs);
	}
}


text:
<?php
// Year And Month Setting
$setDate = strtotime('10 Years');
$tillDate = date('Y', $setDate);
$expirymon = idate('m');
$expiry_year = idate('Y');
$year = range($tillDate, date('Y'));
sort($year);
?>

<a href="<?php echo base_url(); ?>" title="Home">Home

                /

Checkout

Checkout

STEP2OF 3

                        NEED HELP ?

                        1300 416 708

1Shipping

                        <a href="<?php echo base_url(); ?>order/checkout" id="edit-shipping-info">Edit Shipping

                                    <?= $shipping_details['shipping_first_name'] . ' ' . $shipping_details['shipping_last_name']; ?>

                                    <?= $shipping_details['shipping_address'] . ' ' . $shipping_details['shipping_address2']; ?>

                                    <?= $shipping_details['shipping_city'] . ', ' . $shipping_details['shipping_state'] . ', ' . $shipping_details['shipping_zipcode']; ?>

                                    <?= $shipping_details['shipping_country']; ?>

2Payment

                    <a style="display:none;" href="<?php echo base_url(); ?>" id="edit-billing-info">Edit Payment

                        <form action="<?= base_url(); ?>order/order_review" method="post" id="dwfrm_billing" class="checkout-billing address" novalidate="novalidate">
                            <input type="text" style="display: none">
                            <input type="password" style="display: none">
                            <fieldset>
                                <input type="hidden" id="credit_card_vault_transaction" name="credit_card_vault_transaction" value="0">
                                <input type="hidden" name="dwfrm_billing_save" value="true">
                                <input type="hidden" name="order_id" value="<?= $order_id; ?>">
                                <input type="hidden" name="cart_total" id="cart_total" value="<?php echo $cart_total; ?>">
                                <input type="hidden" name="payment_method_nonce" id="payment_method_nonce">
                                <input type="hidden" name="card_last_two_for_review" id="card_last_two_for_review">
                                <input type="hidden" name="card_type_for_review" id="card_type_for_review">

                                    <? if ($shipping_details['address_option'] == 'true') { ?>
                                        <input class="input-checkbox" type="checkbox" checked="checked" name="dwfrm_billing_billingAddress_useAsBillingAddress" id="dwfrm_billing_billingAddress_useAsBillingAddress" value="true">
                                    <? } else { ?>
                                        <input class="input-checkbox" type="checkbox" name="dwfrm_billing_billingAddress_useAsBillingAddress" id="dwfrm_billing_billingAddress_useAsBillingAddress" value="true">
                                    <? } ?>
                                    Use Shipping Address for Billing Address

                                <div class="shipping-form-wrapper" <? if ($shipping_details['address_option'] == 'true') { ?>style="display:none;"<? } else { ?>style="display:block;"<? } ?>>

                                                First Name*

                                        <input class="input-text required" autocomplete="off" id="dwfrm_billing_billingAddress_addressFields_firstName" type="text" name="dwfrm_billing_billingAddress_addressFields_firstName" value="<? echo isset($dwfrm_billing_billingAddress_addressFields_firstName) ? $dwfrm_billing_billingAddress_addressFields_firstName : $billing_first_name; ?>" maxlength="50">

                                                Last Name*

                                        <input class="input-text required" autocomplete="off" id="dwfrm_billing_billingAddress_addressFields_lastName" type="text" name="dwfrm_billing_billingAddress_addressFields_lastName" value="<? echo isset($dwfrm_billing_billingAddress_addressFields_lastName) ? $dwfrm_billing_billingAddress_addressFields_lastName : $billing_last_name; ?>" maxlength="50">

                                                    Address*

                                            <input class="input-text required" autocomplete="off" id="dwfrm_billing_billingAddress_addressFields_address1" type="text" name="dwfrm_billing_billingAddress_addressFields_address1" value="<? echo isset($dwfrm_billing_billingAddress_addressFields_address1) ? $dwfrm_billing_billingAddress_addressFields_address1 : $billing_address; ?>" maxlength="70">

                                            <input class="input-text" autocomplete="off" id="dwfrm_billing_billingAddress_addressFields_address2" type="text" name="dwfrm_billing_billingAddress_addressFields_address2" value="<? echo isset($dwfrm_billing_billingAddress_addressFields_address2) ? $dwfrm_billing_billingAddress_addressFields_address2 : $billing_address2; ?>" maxlength="50">

                                                    Suburb*

                                            <input class="input-text required" autocomplete="off" id="dwfrm_billing_billingAddress_addressFields_city" type="text" name="dwfrm_billing_billingAddress_addressFields_city" value="<? echo isset($dwfrm_billing_billingAddress_addressFields_city) ? $dwfrm_billing_billingAddress_addressFields_city : $billing_city; ?>" maxlength="35">

                                                    Post Code*

                                            <input class="input-text postalCode notshipping required" autocomplete="off" id="dwfrm_billing_billingAddress_addressFields_zip" type="text" name="dwfrm_billing_billingAddress_addressFields_zip" value="<? echo isset($dwfrm_billing_billingAddress_addressFields_zip) ? $dwfrm_billing_billingAddress_addressFields_zip : $billing_zipcode; ?>" maxlength="10">

                                                    Country*

                                            <select class="input-select country required" id="dwfrm_billing_billingAddress_addressFields_country" name="dwfrm_billing_billingAddress_addressFields_country" style="-webkit-appearance: none;">
                                                <option class="select-option" label="Please select a Country" value="">Please select a Country</option>
                                                <option class="select-option" label="Australia" value="Australia" selected="selected">AUSTRALIA</option>
                                            </select>

                                                    Province / State*

                                            <select class="input-select required" id="dwfrm_billing_billingAddress_addressFields_states_state" name="dwfrm_billing_billingAddress_addressFields_states_state" style="-webkit-appearance: none;">
                                                <option class="select-option" label="SELECT A STATE" value="" <? echo set_select('dwfrm_billing_billingAddress_addressFields_states_state', '', TRUE); ?>>SELECT A STATE</option>

                                                <option class="select-option" label="ACT" value="ACT" <? echo set_select('dwfrm_billing_billingAddress_addressFields_states_state', 'ACT'); ?>>ACT</option>
                                                <option class="select-option" label="NSW" value="NSW" <? echo set_select('dwfrm_billing_billingAddress_addressFields_states_state', 'NSW'); ?>>NSW</option>
                                                <option class="select-option" label="NT" value="NT" <? echo set_select('dwfrm_billing_billingAddress_addressFields_states_state', 'NT'); ?>>NT</option>
                                                <option class="select-option" label="SA" value="SA" <? echo set_select('dwfrm_billing_billingAddress_addressFields_states_state', 'SA'); ?>>SA</option>
                                                <option class="select-option" label="TAS" value="TAS" <? echo set_select('dwfrm_billing_billingAddress_addressFields_states_state', 'TAS'); ?>>TAS</option>
                                                <option class="select-option" label="QLD" value="QLD" <? echo set_select('dwfrm_billing_billingAddress_addressFields_states_state', 'QLD'); ?>>QLD</option>
                                                <option class="select-option" label="VIC" value="VIC" <? echo set_select('dwfrm_billing_billingAddress_addressFields_states_state', 'VIC'); ?>>VIC</option>
                                                <option class="select-option" label="WA" value="WA" <? echo set_select('dwfrm_billing_billingAddress_addressFields_states_state', 'WA'); ?>>WA</option>

                                            </select>

                                                Phone*

                                        <input class="input-text phone required" autocomplete="off" id="dwfrm_billing_billingAddress_addressFields_phone" type="text" name="dwfrm_billing_billingAddress_addressFields_phone" value="<? echo isset($dwfrm_billing_billingAddress_addressFields_phone) ? $dwfrm_billing_billingAddress_addressFields_phone : $billing_phone; ?>" maxlength="20">

                                                Email*

                                        <input class="input-text email required" autocomplete="off" id="dwfrm_billing_billingAddress_email_emailAddress" type="text" name="dwfrm_billing_billingAddress_email_emailAddress" value="<? echo isset($dwfrm_billing_billingAddress_email_emailAddress) ? $dwfrm_billing_billingAddress_email_emailAddress : $billing_email; ?>" maxlength="50">

                                        <a title="See Privacy Policy" href="<?php echo base_url(); ?>info/policy" data-dlg-options="{"height":600}" class="dialogify">See Privacy Policy

                            </fieldset>
                            <input type="hidden" name="dwfrm_billing_securekey" value="175014917">
                            <input type="hidden" name="client_token" id="client_token" value="<?php echo $client_token; ?>">
                            <input type="hidden" name="customer_id" id="customer_id" value="<?php echo $customer_id; ?>">
                            <fieldset>
                                <legend>Payment details</legend>
                                <?php $this->load->view('order/payment_braintree_view.php'); ?>
                            </fieldset>

				<?php
                    if (ENVIRONMENT == 'production'):?>

                       <? if ($cart_items) {?>

                    <?php endif; ?>

3Order Review

    <?php $this->load->view('order/order_summary.php'); ?>


text:
from __future__ import print_function
from PIL import Image
from os.path import join
import os
import torch.utils.data as data
from .utils import download_url, check_integrity, list_dir, list_files

class Omniglot(data.Dataset):
    """`Omniglot <https://github.com/brendenlake/omniglot>`_ Dataset.
    Args:
        root (string): Root directory of dataset where directory
            ``omniglot-py`` exists.
        background (bool, optional): If True, creates dataset from the "background" set, otherwise
            creates from the "evaluation" set. This terminology is defined by the authors.
        transform (callable, optional): A function/transform that  takes in an PIL image
            and returns a transformed version. E.g, ``transforms.RandomCrop``
        target_transform (callable, optional): A function/transform that takes in the
            target and transforms it.
        download (bool, optional): If true, downloads the dataset zip files from the internet and
            puts it in root directory. If the zip files are already downloaded, they are not
            downloaded again.
    """
    folder = 'omniglot-py'
    download_url_prefix = 'https://github.com/brendenlake/omniglot/raw/master/python'
    zips_md5 = {
        'images_background': '68d2efa1b9178cc56df9314c21c6e718',
        'images_evaluation': '6b91aef0f799c5bb55b94e3f2daec811'
    }

    def __init__(self, root, background=True,
                 transform=None, target_transform=None,
                 download=False):
        self.root = join(os.path.expanduser(root), self.folder)
        self.background = background
        self.transform = transform
        self.target_transform = target_transform

        if download:
            self.download()

        if not self._check_integrity():
            raise RuntimeError('Dataset not found or corrupted.' +
                               ' You can use download=True to download it')

        self.target_folder = join(self.root, self._get_target_folder())
        self._alphabets = list_dir(self.target_folder)
        self._characters = sum([[join(a, c) for c in list_dir(join(self.target_folder, a))]
                                for a in self._alphabets], [])
        self._character_images = [[(image, idx) for image in list_files(join(self.target_folder, character), '.png')]
                                  for idx, character in enumerate(self._characters)]
        self._flat_character_images = sum(self._character_images, [])

    def __len__(self):
        return len(self._flat_character_images)

    def __getitem__(self, index):
        """
        Args:
            index (int): Index

        Returns:
            tuple: (image, target) where target is index of the target character class.
        """
        image_name, character_class = self._flat_character_images[index]
        image_path = join(self.target_folder, self._characters[character_class], image_name)
        image = Image.open(image_path, mode='r').convert('L')

        if self.transform:
            image = self.transform(image)

        if self.target_transform:
            character_class = self.target_transform(character_class)

        return image, character_class

    def _check_integrity(self):
        zip_filename = self._get_target_folder()
        if not check_integrity(join(self.root, zip_filename + '.zip'), self.zips_md5[zip_filename]):
            return False
        return True

    def download(self):
        import zipfile

        if self._check_integrity():
            print('Files already downloaded and verified')
            return

        filename = self._get_target_folder()
        zip_filename = filename + '.zip'
        url = self.download_url_prefix + '/' + zip_filename
        download_url(url, self.root, zip_filename, self.zips_md5[filename])
        print('Extracting downloaded file: ' + join(self.root, zip_filename))
        with zipfile.ZipFile(join(self.root, zip_filename), 'r') as zip_file:
            zip_file.extractall(self.root)

    def _get_target_folder(self):
        return 'images_background' if self.background else 'images_evaluation'


text:
import { isString, tail } from 'lodash'
import ColumnCompiler from './columncompiler'
import TableCompiler from './tablecompiler'
import SchemaCompiler from './compiler'

// Push a new query onto the compiled "sequence" stack,
// creating a new formatter, returning the compiler.
export function pushQuery(query) {
  if (!query) return;
  if (isString(query)) {
    query = {sql: query};
  }
  if (!query.bindings) {
    query.bindings = this.formatter.bindings;
  }
  this.sequence.push(query);

  let builder;
  if (this instanceof ColumnCompiler) {
    builder = this.columnBuilder;
  } else if (this instanceof TableCompiler) {
    builder = this.tableBuilder;
  } else if (this instanceof SchemaCompiler) {
    builder = this.builder;
  }

  this.formatter = this.client.formatter(builder);
}

// Used in cases where we need to push some additional column specific statements.
export function pushAdditional(fn) {
  const child = new this.constructor(this.client, this.tableCompiler, this.columnBuilder);
  fn.call(child, tail(arguments));
  this.sequence.additional = (this.sequence.additional || []).concat(child.sequence);
}