text:
package com.concordfax;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for FaxBroadcastJob complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="FaxBroadcastJob">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="JobScheduleStartType" type="{http://www.w3.org/2001/XMLSchema}int"/>
 *         <element name="JobScheduleStartDate" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="JobExpiryDate" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="SenderCSID" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="SenderName" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="SenderCompany" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="SenderPhone" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="SenderAddress1" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="SenderAddress2" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="SenderCity" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="SenderState" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="SenderZip" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="SenderCountry" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="CoverName" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="CoverSubject" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="Resolution" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="UserField1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="UserField2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="UserField3" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="UserField4" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="UserField5" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="ExceptionDestination" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="SenderFax" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="SoftwareClient" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="CoverText" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="UserField6" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="UserField7" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="UserField8" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="UserField9" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="UserField10" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="UserField11" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="UserField12" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FaxBroadcastJob", propOrder = {
    "jobScheduleStartType",
    "jobScheduleStartDate",
    "jobExpiryDate",
    "senderCSID",
    "senderName",
    "senderCompany",
    "senderPhone",
    "senderAddress1",
    "senderAddress2",
    "senderCity",
    "senderState",
    "senderZip",
    "senderCountry",
    "coverName",
    "coverSubject",
    "resolution",
    "userField1",
    "userField2",
    "userField3",
    "userField4",
    "userField5",
    "exceptionDestination",
    "senderFax",
    "softwareClient",
    "coverText",
    "userField6",
    "userField7",
    "userField8",
    "userField9",
    "userField10",
    "userField11",
    "userField12"
})
public class FaxBroadcastJob {

    @XmlElement(name = "JobScheduleStartType")
    protected int jobScheduleStartType;
    @XmlElement(name = "JobScheduleStartDate", required = true)
    protected String jobScheduleStartDate;
    @XmlElement(name = "JobExpiryDate", required = true)
    protected String jobExpiryDate;
    @XmlElement(name = "SenderCSID", required = true)
    protected String senderCSID;
    @XmlElement(name = "SenderName", required = true)
    protected String senderName;
    @XmlElement(name = "SenderCompany", required = true)
    protected String senderCompany;
    @XmlElement(name = "SenderPhone", required = true)
    protected String senderPhone;
    @XmlElement(name = "SenderAddress1", required = true)
    protected String senderAddress1;
    @XmlElement(name = "SenderAddress2", required = true)
    protected String senderAddress2;
    @XmlElement(name = "SenderCity", required = true)
    protected String senderCity;
    @XmlElement(name = "SenderState", required = true)
    protected String senderState;
    @XmlElement(name = "SenderZip", required = true)
    protected String senderZip;
    @XmlElement(name = "SenderCountry", required = true)
    protected String senderCountry;
    @XmlElement(name = "CoverName", required = true)
    protected String coverName;
    @XmlElement(name = "CoverSubject", required = true)
    protected String coverSubject;
    @XmlElement(name = "Resolution", required = true)
    protected String resolution;
    @XmlElement(name = "UserField1")
    protected String userField1;
    @XmlElement(name = "UserField2")
    protected String userField2;
    @XmlElement(name = "UserField3")
    protected String userField3;
    @XmlElement(name = "UserField4")
    protected String userField4;
    @XmlElement(name = "UserField5")
    protected String userField5;
    @XmlElement(name = "ExceptionDestination", required = true)
    protected String exceptionDestination;
    @XmlElement(name = "SenderFax", required = true)
    protected String senderFax;
    @XmlElement(name = "SoftwareClient", required = true)
    protected String softwareClient;
    @XmlElement(name = "CoverText", required = true)
    protected String coverText;
    @XmlElement(name = "UserField6")
    protected String userField6;
    @XmlElement(name = "UserField7")
    protected String userField7;
    @XmlElement(name = "UserField8")
    protected String userField8;
    @XmlElement(name = "UserField9")
    protected String userField9;
    @XmlElement(name = "UserField10")
    protected String userField10;
    @XmlElement(name = "UserField11")
    protected String userField11;
    @XmlElement(name = "UserField12")
    protected String userField12;

    /**
     * Gets the value of the jobScheduleStartType property.
     *
     */
    public int getJobScheduleStartType() {
        return jobScheduleStartType;
    }

    /**
     * Sets the value of the jobScheduleStartType property.
     *
     */
    public void setJobScheduleStartType(int value) {
        this.jobScheduleStartType = value;
    }

    /**
     * Gets the value of the jobScheduleStartDate property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getJobScheduleStartDate() {
        return jobScheduleStartDate;
    }

    /**
     * Sets the value of the jobScheduleStartDate property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setJobScheduleStartDate(String value) {
        this.jobScheduleStartDate = value;
    }

    /**
     * Gets the value of the jobExpiryDate property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getJobExpiryDate() {
        return jobExpiryDate;
    }

    /**
     * Sets the value of the jobExpiryDate property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setJobExpiryDate(String value) {
        this.jobExpiryDate = value;
    }

    /**
     * Gets the value of the senderCSID property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSenderCSID() {
        return senderCSID;
    }

    /**
     * Sets the value of the senderCSID property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSenderCSID(String value) {
        this.senderCSID = value;
    }

    /**
     * Gets the value of the senderName property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSenderName() {
        return senderName;
    }

    /**
     * Sets the value of the senderName property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSenderName(String value) {
        this.senderName = value;
    }

    /**
     * Gets the value of the senderCompany property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSenderCompany() {
        return senderCompany;
    }

    /**
     * Sets the value of the senderCompany property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSenderCompany(String value) {
        this.senderCompany = value;
    }

    /**
     * Gets the value of the senderPhone property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSenderPhone() {
        return senderPhone;
    }

    /**
     * Sets the value of the senderPhone property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSenderPhone(String value) {
        this.senderPhone = value;
    }

    /**
     * Gets the value of the senderAddress1 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSenderAddress1() {
        return senderAddress1;
    }

    /**
     * Sets the value of the senderAddress1 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSenderAddress1(String value) {
        this.senderAddress1 = value;
    }

    /**
     * Gets the value of the senderAddress2 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSenderAddress2() {
        return senderAddress2;
    }

    /**
     * Sets the value of the senderAddress2 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSenderAddress2(String value) {
        this.senderAddress2 = value;
    }

    /**
     * Gets the value of the senderCity property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSenderCity() {
        return senderCity;
    }

    /**
     * Sets the value of the senderCity property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSenderCity(String value) {
        this.senderCity = value;
    }

    /**
     * Gets the value of the senderState property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSenderState() {
        return senderState;
    }

    /**
     * Sets the value of the senderState property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSenderState(String value) {
        this.senderState = value;
    }

    /**
     * Gets the value of the senderZip property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSenderZip() {
        return senderZip;
    }

    /**
     * Sets the value of the senderZip property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSenderZip(String value) {
        this.senderZip = value;
    }

    /**
     * Gets the value of the senderCountry property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSenderCountry() {
        return senderCountry;
    }

    /**
     * Sets the value of the senderCountry property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSenderCountry(String value) {
        this.senderCountry = value;
    }

    /**
     * Gets the value of the coverName property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getCoverName() {
        return coverName;
    }

    /**
     * Sets the value of the coverName property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setCoverName(String value) {
        this.coverName = value;
    }

    /**
     * Gets the value of the coverSubject property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getCoverSubject() {
        return coverSubject;
    }

    /**
     * Sets the value of the coverSubject property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setCoverSubject(String value) {
        this.coverSubject = value;
    }

    /**
     * Gets the value of the resolution property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getResolution() {
        return resolution;
    }

    /**
     * Sets the value of the resolution property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setResolution(String value) {
        this.resolution = value;
    }

    /**
     * Gets the value of the userField1 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUserField1() {
        return userField1;
    }

    /**
     * Sets the value of the userField1 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUserField1(String value) {
        this.userField1 = value;
    }

    /**
     * Gets the value of the userField2 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUserField2() {
        return userField2;
    }

    /**
     * Sets the value of the userField2 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUserField2(String value) {
        this.userField2 = value;
    }

    /**
     * Gets the value of the userField3 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUserField3() {
        return userField3;
    }

    /**
     * Sets the value of the userField3 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUserField3(String value) {
        this.userField3 = value;
    }

    /**
     * Gets the value of the userField4 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUserField4() {
        return userField4;
    }

    /**
     * Sets the value of the userField4 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUserField4(String value) {
        this.userField4 = value;
    }

    /**
     * Gets the value of the userField5 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUserField5() {
        return userField5;
    }

    /**
     * Sets the value of the userField5 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUserField5(String value) {
        this.userField5 = value;
    }

    /**
     * Gets the value of the exceptionDestination property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getExceptionDestination() {
        return exceptionDestination;
    }

    /**
     * Sets the value of the exceptionDestination property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setExceptionDestination(String value) {
        this.exceptionDestination = value;
    }

    /**
     * Gets the value of the senderFax property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSenderFax() {
        return senderFax;
    }

    /**
     * Sets the value of the senderFax property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSenderFax(String value) {
        this.senderFax = value;
    }

    /**
     * Gets the value of the softwareClient property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSoftwareClient() {
        return softwareClient;
    }

    /**
     * Sets the value of the softwareClient property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSoftwareClient(String value) {
        this.softwareClient = value;
    }

    /**
     * Gets the value of the coverText property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getCoverText() {
        return coverText;
    }

    /**
     * Sets the value of the coverText property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setCoverText(String value) {
        this.coverText = value;
    }

    /**
     * Gets the value of the userField6 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUserField6() {
        return userField6;
    }

    /**
     * Sets the value of the userField6 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUserField6(String value) {
        this.userField6 = value;
    }

    /**
     * Gets the value of the userField7 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUserField7() {
        return userField7;
    }

    /**
     * Sets the value of the userField7 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUserField7(String value) {
        this.userField7 = value;
    }

    /**
     * Gets the value of the userField8 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUserField8() {
        return userField8;
    }

    /**
     * Sets the value of the userField8 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUserField8(String value) {
        this.userField8 = value;
    }

    /**
     * Gets the value of the userField9 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUserField9() {
        return userField9;
    }

    /**
     * Sets the value of the userField9 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUserField9(String value) {
        this.userField9 = value;
    }

    /**
     * Gets the value of the userField10 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUserField10() {
        return userField10;
    }

    /**
     * Sets the value of the userField10 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUserField10(String value) {
        this.userField10 = value;
    }

    /**
     * Gets the value of the userField11 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUserField11() {
        return userField11;
    }

    /**
     * Sets the value of the userField11 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUserField11(String value) {
        this.userField11 = value;
    }

    /**
     * Gets the value of the userField12 property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUserField12() {
        return userField12;
    }

    /**
     * Sets the value of the userField12 property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUserField12(String value) {
        this.userField12 = value;
    }

}


text:
package llbsolver

import (
	"context"
	"fmt"
	"strings"
	"sync"
	"time"

	"github.com/containerd/containerd/platforms"
	"github.com/mitchellh/hashstructure"
	"github.com/moby/buildkit/cache/remotecache"
	"github.com/moby/buildkit/client/llb"
	"github.com/moby/buildkit/frontend"
	gw "github.com/moby/buildkit/frontend/gateway/client"
	"github.com/moby/buildkit/session"
	"github.com/moby/buildkit/solver"
	"github.com/moby/buildkit/solver/errdefs"
	llberrdefs "github.com/moby/buildkit/solver/llbsolver/errdefs"
	"github.com/moby/buildkit/solver/pb"
	"github.com/moby/buildkit/util/flightcontrol"
	"github.com/moby/buildkit/worker"
	digest "github.com/opencontainers/go-digest"
	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
)

type llbBridge struct {
	builder                   solver.Builder
	frontends                 map[string]frontend.Frontend
	resolveWorker             func() (worker.Worker, error)
	eachWorker                func(func(worker.Worker) error) error
	resolveCacheImporterFuncs map[string]remotecache.ResolveCacheImporterFunc
	cms                       map[string]solver.CacheManager
	cmsMu                     sync.Mutex
	sm                        *session.Manager
}

func (b *llbBridge) loadResult(ctx context.Context, def *pb.Definition, cacheImports []gw.CacheOptionsEntry) (solver.CachedResult, error) {
	w, err := b.resolveWorker()
	if err != nil {
		return nil, err
	}
	ent, err := loadEntitlements(b.builder)
	if err != nil {
		return nil, err
	}
	var cms []solver.CacheManager
	for _, im := range cacheImports {
		cmID, err := cmKey(im)
		if err != nil {
			return nil, err
		}
		b.cmsMu.Lock()
		var cm solver.CacheManager
		if prevCm, ok := b.cms[cmID]; !ok {
			func(cmID string, im gw.CacheOptionsEntry) {
				cm = newLazyCacheManager(cmID, func() (solver.CacheManager, error) {
					var cmNew solver.CacheManager
					if err := inBuilderContext(context.TODO(), b.builder, "importing cache manifest from "+cmID, "", func(ctx context.Context, g session.Group) error {
						resolveCI, ok := b.resolveCacheImporterFuncs[im.Type]
						if !ok {
							return errors.Errorf("unknown cache importer: %s", im.Type)
						}
						ci, desc, err := resolveCI(ctx, g, im.Attrs)
						if err != nil {
							return err
						}
						cmNew, err = ci.Resolve(ctx, desc, cmID, w)
						return err
					}); err != nil {
						logrus.Debugf("error while importing cache manifest from cmId=%s: %v", cmID, err)
						return nil, err
					}
					return cmNew, nil
				})
			}(cmID, im)
			b.cms[cmID] = cm
		} else {
			cm = prevCm
		}
		cms = append(cms, cm)
		b.cmsMu.Unlock()
	}
	dpc := &detectPrunedCacheID{}

	edge, err := Load(def, dpc.Load, ValidateEntitlements(ent), WithCacheSources(cms), NormalizeRuntimePlatforms(), WithValidateCaps())
	if err != nil {
		return nil, errors.Wrap(err, "failed to load LLB")
	}

	if len(dpc.ids) > 0 {
		ids := make([]string, 0, len(dpc.ids))
		for id := range dpc.ids {
			ids = append(ids, id)
		}
		if err := b.eachWorker(func(w worker.Worker) error {
			return w.PruneCacheMounts(ctx, ids)
		}); err != nil {
			return nil, err
		}
	}

	res, err := b.builder.Build(ctx, edge)
	if err != nil {
		return nil, err
	}
	wr, ok := res.Sys().(*worker.WorkerRef)
	if !ok {
		return nil, errors.Errorf("invalid reference for exporting: %T", res.Sys())
	}
	if wr.ImmutableRef != nil {
		if err := wr.ImmutableRef.Finalize(ctx, false); err != nil {
			return nil, err
		}
	}
	return res, err
}

func (b *llbBridge) Solve(ctx context.Context, req frontend.SolveRequest, sid string) (res *frontend.Result, err error) {
	if req.Definition != nil && req.Definition.Def != nil && req.Frontend != "" {
		return nil, errors.New("cannot solve with both Definition and Frontend specified")
	}

	if req.Definition != nil && req.Definition.Def != nil {
		res = &frontend.Result{Ref: newResultProxy(b, req)}
		if req.Evaluate {
			_, err := res.Ref.Result(ctx)
			return res, err
		}
	} else if req.Frontend != "" {
		f, ok := b.frontends[req.Frontend]
		if !ok {
			return nil, errors.Errorf("invalid frontend: %s", req.Frontend)
		}
		res, err = f.Solve(ctx, b, req.FrontendOpt, req.FrontendInputs, sid, b.sm)
		if err != nil {
			return nil, errors.Wrapf(err, "failed to solve with frontend %s", req.Frontend)
		}
	} else {
		return &frontend.Result{}, nil
	}

	return
}

type resultProxy struct {
	cb         func(context.Context) (solver.CachedResult, error)
	def        *pb.Definition
	g          flightcontrol.Group
	mu         sync.Mutex
	released   bool
	v          solver.CachedResult
	err        error
	errResults []solver.Result
}

func newResultProxy(b *llbBridge, req frontend.SolveRequest) *resultProxy {
	rp := &resultProxy{
		def: req.Definition,
	}
	rp.cb = func(ctx context.Context) (solver.CachedResult, error) {
		res, err := b.loadResult(ctx, req.Definition, req.CacheImports)
		var ee *llberrdefs.ExecError
		if errors.As(err, &ee) {
			ee.EachRef(func(res solver.Result) error {
				rp.errResults = append(rp.errResults, res)
				return nil
			})
			// acquire ownership so ExecError finalizer doesn't attempt to release as well
			ee.OwnerBorrowed = true
		}
		return res, err
	}
	return rp
}

func (rp *resultProxy) Definition() *pb.Definition {
	return rp.def
}

func (rp *resultProxy) Release(ctx context.Context) (err error) {
	rp.mu.Lock()
	defer rp.mu.Unlock()
	for _, res := range rp.errResults {
		rerr := res.Release(ctx)
		if rerr != nil {
			err = rerr
		}
	}
	if rp.v != nil {
		if rp.released {
			logrus.Warnf("release of already released result")
		}
		rerr := rp.v.Release(ctx)
		if err != nil {
			return rerr
		}
	}
	rp.released = true
	return
}

func (rp *resultProxy) wrapError(err error) error {
	if err == nil {
		return nil
	}
	var ve *errdefs.VertexError
	if errors.As(err, &ve) {
		if rp.def.Source != nil {
			locs, ok := rp.def.Source.Locations[string(ve.Digest)]
			if ok {
				for _, loc := range locs.Locations {
					err = errdefs.WithSource(err, errdefs.Source{
						Info:   rp.def.Source.Infos[loc.SourceIndex],
						Ranges: loc.Ranges,
					})
				}
			}
		}
	}
	return err
}

func (rp *resultProxy) Result(ctx context.Context) (res solver.CachedResult, err error) {
	defer func() {
		err = rp.wrapError(err)
	}()
	r, err := rp.g.Do(ctx, "result", func(ctx context.Context) (interface{}, error) {
		rp.mu.Lock()
		if rp.released {
			rp.mu.Unlock()
			return nil, errors.Errorf("accessing released result")
		}
		if rp.v != nil || rp.err != nil {
			rp.mu.Unlock()
			return rp.v, rp.err
		}
		rp.mu.Unlock()
		v, err := rp.cb(ctx)
		if err != nil {
			select {
			case <-ctx.Done():
				if strings.Contains(err.Error(), context.Canceled.Error()) {
					return v, err
				}
			default:
			}
		}
		rp.mu.Lock()
		if rp.released {
			if v != nil {
				v.Release(context.TODO())
			}
			rp.mu.Unlock()
			return nil, errors.Errorf("evaluating released result")
		}
		rp.v = v
		rp.err = err
		rp.mu.Unlock()
		return v, err
	})
	if r != nil {
		return r.(solver.CachedResult), nil
	}
	return nil, err
}

func (b *llbBridge) ResolveImageConfig(ctx context.Context, ref string, opt llb.ResolveImageConfigOpt) (dgst digest.Digest, config []byte, err error) {
	w, err := b.resolveWorker()
	if err != nil {
		return "", nil, err
	}
	if opt.LogName == "" {
		opt.LogName = fmt.Sprintf("resolve image config for %s", ref)
	}
	id := ref // make a deterministic ID for avoiding duplicates
	if platform := opt.Platform; platform == nil {
		id += platforms.Format(platforms.DefaultSpec())
	} else {
		id += platforms.Format(*platform)
	}
	err = inBuilderContext(ctx, b.builder, opt.LogName, id, func(ctx context.Context, g session.Group) error {
		dgst, config, err = w.ResolveImageConfig(ctx, ref, opt, b.sm, g)
		return err
	})
	return dgst, config, err
}

type lazyCacheManager struct {
	id   string
	main solver.CacheManager

	waitCh chan struct{}
	err    error
}

func (lcm *lazyCacheManager) ID() string {
	return lcm.id
}
func (lcm *lazyCacheManager) Query(inp []solver.CacheKeyWithSelector, inputIndex solver.Index, dgst digest.Digest, outputIndex solver.Index) ([]*solver.CacheKey, error) {
	lcm.wait()
	if lcm.main == nil {
		return nil, nil
	}
	return lcm.main.Query(inp, inputIndex, dgst, outputIndex)
}
func (lcm *lazyCacheManager) Records(ck *solver.CacheKey) ([]*solver.CacheRecord, error) {
	lcm.wait()
	if lcm.main == nil {
		return nil, nil
	}
	return lcm.main.Records(ck)
}
func (lcm *lazyCacheManager) Load(ctx context.Context, rec *solver.CacheRecord) (solver.Result, error) {
	if err := lcm.wait(); err != nil {
		return nil, err
	}
	return lcm.main.Load(ctx, rec)
}
func (lcm *lazyCacheManager) Save(key *solver.CacheKey, s solver.Result, createdAt time.Time) (*solver.ExportableCacheKey, error) {
	if err := lcm.wait(); err != nil {
		return nil, err
	}
	return lcm.main.Save(key, s, createdAt)
}

func (lcm *lazyCacheManager) wait() error {
	<-lcm.waitCh
	return lcm.err
}

func newLazyCacheManager(id string, fn func() (solver.CacheManager, error)) solver.CacheManager {
	lcm := &lazyCacheManager{id: id, waitCh: make(chan struct{})}
	go func() {
		defer close(lcm.waitCh)
		cm, err := fn()
		if err != nil {
			lcm.err = err
			return
		}
		lcm.main = cm
	}()
	return lcm
}

func cmKey(im gw.CacheOptionsEntry) (string, error) {
	if im.Type == "registry" && im.Attrs["ref"] != "" {
		return im.Attrs["ref"], nil
	}
	i, err := hashstructure.Hash(im, nil)
	if err != nil {
		return "", err
	}
	return fmt.Sprintf("%s:%d", im.Type, i), nil
}

redpajama_set_name: RedPajamaGithub


text:
using AIWolf.Client.Base.Player;
using AIWolf.Client.Lib;
using AIWolf.Common.Data;
using AIWolf.Common.Net;
using System;
using System.Collections.Generic;

namespace AIWolf.Client.Base.Smpl
{
    class SampleMedium : AbstractMedium
    {
        // COする日にち
        int comingoutDay;

        // CO済みか否か
        bool isCameout;

        // 全体に霊能結果を報告済みのJudge
        List<Judge> declaredJudgedAgentList = new List<Judge>();

        bool isSaidAllInquestResult;

        AdvanceGameInfo agi = new AdvanceGameInfo();

        // 今日投票しようと思っているプレイヤー
        Agent planningVoteAgent;

        // 自分が最後に宣言した「投票しようと思っているプレイヤー」
        Agent declaredPlanningVoteAgent;

        // 会話をどこまで読んだか
        int readTalkListNum;

        public override void Initialize(GameInfo gameInfo, GameSetting gameSetting)
        {
            base.Initialize(gameInfo, gameSetting);

            comingoutDay = new Random().Next(3) + 1;
            isCameout = false;
        }

        public override void DayStart()
        {
            base.DayStart();

            // 投票するプレイヤーの初期化,設定
            declaredPlanningVoteAgent = null;
            planningVoteAgent = null;
            setPlanningVoteAgent();
            isSaidAllInquestResult = false;
            readTalkListNum = 0;
        }

        public override string Talk()
        {
            // CO,霊能結果,投票先の順に発話の優先度高

            // 未CO,かつ設定したCOする日にちを過ぎていたらCO
            if (!isCameout && Day >= comingoutDay)
            {
                isCameout = true;
                return TemplateTalkFactory.Comingout(Me, (Role)MyRole);
            }
            // COしているなら占い結果の報告
            else if (isCameout && !isSaidAllInquestResult)
            {
                foreach (Judge judge in MyJudgeList)
                {
                    if (!declaredJudgedAgentList.Contains(judge))
                    {
                        declaredJudgedAgentList.Add(judge);
                        return TemplateTalkFactory.Inquested(judge.Target, judge.Result);
                    }
                }
                isSaidAllInquestResult = true;
            }

            // 今日投票するプレイヤーの報告
            // 前に報告したプレイヤーと同じ場合は報告なし
            if (declaredPlanningVoteAgent != planningVoteAgent)
            {
                declaredPlanningVoteAgent = planningVoteAgent;
                return TemplateTalkFactory.Vote(planningVoteAgent);
            }
            else
            {
                return Common.Data.Talk.OVER;
            }
        }

        public override Agent Vote()
        {
            return planningVoteAgent;
        }

        public override void Finish()
        {
        }

        public override void Update(GameInfo gameInfo)
        {
            base.Update(gameInfo);

            List<Talk> talkList = gameInfo.TalkList;
            bool existInspectResult = false;

            // talkListからCO,占い結果の抽出
            for (int i = readTalkListNum; i < talkList.Count; i++)
            {
                Talk talk = talkList[i];
                Utterance utterance = new Utterance(talk.Content);
                switch (utterance.Topic)
                {

                    //カミングアウトの発話の場合
                    case Topic.COMINGOUT:
                        agi.ComingoutMap[talk.Agent] = utterance.Role;
                        if (utterance.Role == MyRole)
                        {
                            setPlanningVoteAgent();
                        }
                        break;

                    //占い結果の発話の場合
                    case Topic.DIVINED:
                        //AGIのJudgeListに結果を加える
                        Agent seerAgent = talk.Agent;
                        Agent inspectedAgent = utterance.Target;
                        Species inspectResult = (Species)utterance.Result;
                        Judge judge = new Judge(Day, seerAgent, inspectedAgent, inspectResult);
                        agi.AddInspectJudgeList(judge);

                        existInspectResult = true;
                        break;
                }
            }
            readTalkListNum = talkList.Count;

            // 新しい占い結果があれば投票先を変える.(新たに黒判定が出た,または投票先のプレイヤーに白判定が出た場合)
            if (existInspectResult)
            {
                setPlanningVoteAgent();
            }
        }

        public void setPlanningVoteAgent()
        {
            // 投票先を未設定,または人狼だと占われたプレイヤー以外を投票先にしている場合
            // 人狼だと占われたプレイヤーがいれば,投票先をそのプレイヤーに設定
            // いなければ生存プレイヤーからランダムに選択

            List<Agent> voteAgentCandidate = new List<Agent>();

            List<Agent> aliveAgentList = LatestDayGameInfo.AliveAgentList;
            aliveAgentList.Remove(Me);

            foreach (Agent agent in aliveAgentList)
            {
                // 自分以外に霊能COしているプレイヤーがいれば投票候補
                if (agi.ComingoutMap.ContainsKey(agent) && agi.ComingoutMap[agent] == Role.MEDIUM)
                {
                    voteAgentCandidate.Add(agent);
                }
            }

            foreach (Judge myJudge in MyJudgeList)
            {
                foreach (Judge otherJudge in agi.InspectJudgeList)
                {
                    if (!aliveAgentList.Contains(otherJudge.Agent))
                    {
                        continue;
                    }
                    // 自分と同じ相手について占っている場合
                    if (myJudge.Target.Equals(otherJudge.Target))
                    {
                        // 自分の占い(霊能)結果と異なる結果を出していたら投票候補
                        if (myJudge.Result != otherJudge.Result)
                        {
                            voteAgentCandidate.Add(otherJudge.Agent);
                        }
                    }
                }
            }

            // すでに投票先に指定しているプレイヤーが投票候補内に含まれていたらそのまま
            if (planningVoteAgent != null && voteAgentCandidate.Contains(planningVoteAgent))
            {
                return;
            }
            else
            {
                if (voteAgentCandidate.Count > 0)
                {
                    Random rand = new Random();
                    planningVoteAgent = voteAgentCandidate[rand.Next(voteAgentCandidate.Count)];
                }
                else
                {

                    // 投票候補がいない場合は占いで黒判定されているプレイヤーからランダムに選択
                    List<Agent> subVoteAgentCandidate = new List<Agent>();
                    foreach (Judge judge in agi.InspectJudgeList)
                    {
                        if (aliveAgentList.Contains(judge.Target) && judge.Result == Species.WEREWOLF)
                        {
                            subVoteAgentCandidate.Add(judge.Target);
                        }
                    }

                    if (subVoteAgentCandidate.Count > 0)
                    {
                        Random rand = new Random();
                        planningVoteAgent = subVoteAgentCandidate[rand.Next(subVoteAgentCandidate.Count)];
                    }
                    else
                    {
                        // 黒判定されているプレイヤーもいなければ生存プレイヤーからランダムに選択
                        Random rand = new Random();
                        planningVoteAgent = aliveAgentList[rand.Next(aliveAgentList.Count)];
                    }
                }
            }
        }
    }
}


text:
  float: none;
  display: inline-block
}
.x_axis path, .x_axis line, .y_axis path, .y_axis line {
  fill: none;
  stroke: black;
  shape-rendering: crispEdges
}
.x_axis text, .y_axis text {
  font-family: georgia;
  font-size: 13px
}
.holder {
  float: left;
  margin-left: 12px;
  margin-right: 0px;
  font-family: MuseoSlab500;
  font-size: 10px
}
.holder h3 {
  margin-left: 2px;
  margin-top: 8px;
  margin-bottom: 8px;
  font-size: 14px
}
.holder input[type="radio"] {
  display: none
}
.holder label {
  display: block;
  padding: 3px;
  margin: 2px;
  background: -webkit-linear-gradient(top, #bbbbbb, #999999);
  border-radius: 2px
}
.holder input[type="radio"]:checked + label {
  background: -webkit-linear-gradient(top, #666666, black);
  color: #fff;
  font-weight: normal
}
.radio_holder {
  width: 295px;
  margin-left: 5px;
  margin-right: 10px;
  height: 140px;
  display: inline-block;
  background: -webkit-linear-gradient(top, #eeeeee, #dddddd);
  box-shadow: 3px 3px 2px 2px #bbb
}
.legend {
  width: 310px;
  float: left
}
.axis_text {
  font-size: 20px
}

#map_canvas{
    width: 225px;
    height: 225px;
}


text:
package cli

import (
	"strings"

	"github.com/scaleway/scaleway-cli/pkg/commands"
	"github.com/scaleway/scaleway-cli/vendor/github.com/Sirupsen/logrus"
)

var cmdPs = &Command{
	Exec:        runPs,
	UsageLine:   "ps [OPTIONS]",
	Description: "List servers",
	Help:        "List servers. By default, only running servers are displayed.",
	Examples: `
    $ scw ps
    $ scw ps -a
    $ scw ps -l
    $ scw ps -n=10
    $ scw ps -q
    $ scw ps --no-trunc
    $ scw ps -f state=booted
    $ scw ps -f state=running
    $ scw ps -f state=stopped
    $ scw ps -f ip=212.47.229.26
    $ scw ps -f tags=prod
    $ scw ps -f tags=boot=live
    $ scw ps -f image=docker
    $ scw ps -f image=alpine
    $ scw ps -f image=UUIDOFIMAGE
    $ scw ps -f "state=booted image=docker tags=prod"
`,
}

func init() {
	cmdPs.Flag.BoolVar(&psA, []string{"a", "-all"}, false, "Show all servers. Only running servers are shown by default")
	cmdPs.Flag.BoolVar(&psL, []string{"l", "-latest"}, false, "Show only the latest created server, include non-running ones")
	cmdPs.Flag.IntVar(&psN, []string{"n"}, 0, "Show n last created servers, include non-running ones")
	cmdPs.Flag.BoolVar(&psNoTrunc, []string{"-no-trunc"}, false, "Don't truncate output")
	cmdPs.Flag.BoolVar(&psQ, []string{"q", "-quiet"}, false, "Only display numeric IDs")
	cmdPs.Flag.BoolVar(&psHelp, []string{"h", "-help"}, false, "Print usage")
	cmdPs.Flag.StringVar(&psFilters, []string{"f", "-filter"}, "", "Filter output based on conditions provided")
}

// Flags
var psA bool         // -a flag
var psL bool         // -l flag
var psQ bool         // -q flag
var psNoTrunc bool   // -no-trunc flag
var psN int          // -n flag
var psHelp bool      // -h, --help flag
var psFilters string // -f, --filter flag

func runPs(cmd *Command, rawArgs []string) error {
	if psHelp {
		return cmd.PrintUsage()
	}
	if len(rawArgs) != 0 {
		return cmd.PrintShortUsage()
	}

	args := commands.PsArgs{
		All:     psA,
		Latest:  psL,
		Quiet:   psQ,
		NoTrunc: psNoTrunc,
		NLast:   psN,
		Filters: make(map[string]string, 0),
	}
	if psFilters != "" {
		for _, filter := range strings.Split(psFilters, " ") {
			parts := strings.SplitN(filter, "=", 2)
			if len(parts) != 2 {
				logrus.Warnf("Invalid filter '%s', should be in the form 'key=value'", filter)
				continue
			}
			if _, ok := args.Filters[parts[0]]; ok {
				logrus.Warnf("Duplicated filter: %q", parts[0])
			} else {
				args.Filters[parts[0]] = parts[1]
			}
		}
	}
	ctx := cmd.GetContext(rawArgs)
	return commands.RunPs(ctx, args)
}


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const MIN_ADDR = 0;
const MAX_ADDR = 0x7FFFFFFF | 0;
exports.TEXT_MASK = 0x10000000;
exports.STACK_MASK = 0x40000000;
exports.OFFSET_MASK = 0x0FFFFFFF;
function isAddress(addr) {
    return addr === +addr && addr == (addr | 0) && MIN_ADDR <= addr &&
        addr <= MAX_ADDR;
}
exports.isAddress = isAddress;
function isTextAddress(addr) {
    return isAddress(addr) && (addr & exports.TEXT_MASK) !== 0;
}
exports.isTextAddress = isTextAddress;
function isStackAddress(addr) {
    return (addr & exports.STACK_MASK) !== 0;
}
exports.isStackAddress = isStackAddress;
function getAddressOffset(addr) {
    return (addr & exports.OFFSET_MASK);
}
exports.getAddressOffset = getAddressOffset;
//# sourceMappingURL=address.js.map


text:
package com.focusti.cervejaria.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import com.focusti.cervejaria.model.Venda;
import com.focusti.cervejaria.repository.helper.venda.VendasQueries;

@Repository
public interface Vendas extends JpaRepository<Venda, Long>, VendasQueries {

}


text:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true">
    <translate
        android:fromYDelta="0%"
        android:toYDelta="100%"
        android:duration="1000"
        />
</set>


text:
package org.apache.batik.ext.awt.geom;

import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;

/**
 * This class wraps a normal path into an extended path.
 * @author Thomas DeWeese
 * @version $Id$
 */
public class ShapeExtender implements ExtendedShape {
    Shape shape;

    public ShapeExtender(Shape shape) {
        this.shape = shape;
    }

    public boolean contains(double x, double y) {
        return shape.contains(x, y);
    }
    public boolean contains(double x, double y, double w, double h) {
        return shape.contains(x, y, w, h);
    }

    public boolean contains(Point2D p) {
        return shape.contains(p);
    }

    public boolean contains(Rectangle2D r) {
        return shape.contains(r);
    }

    public Rectangle getBounds() {
        return shape.getBounds();
    }

    public Rectangle2D getBounds2D() {
        return shape.getBounds2D();
    }

    public PathIterator getPathIterator(AffineTransform at) {
        return shape.getPathIterator(at);
    }

    public PathIterator getPathIterator(AffineTransform at, double flatness) {
        return shape.getPathIterator(at, flatness);
    }

    public ExtendedPathIterator getExtendedPathIterator() {
        return new EPIWrap(shape.getPathIterator(null));
    }

    public boolean intersects(double x, double y, double w, double h) {
        return shape.intersects(x, y, w, h);
    }

    public boolean intersects(Rectangle2D r) {
        return shape.intersects(r);
    }

    public static class EPIWrap implements ExtendedPathIterator {
        PathIterator pi = null;
        public EPIWrap(PathIterator pi) {
            this.pi = pi;
        }

        public int currentSegment() {
            float[] coords = new float[6];
            return pi.currentSegment(coords);
        }

        public int currentSegment(double[] coords) {
            return pi.currentSegment(coords); }

        public int currentSegment(float[] coords) {
            return pi.currentSegment(coords); }

        public int getWindingRule() {
            return pi.getWindingRule();
        }

        public boolean isDone() {
            return pi.isDone(); }

        public void next() {
            pi.next();
        }
    }
}


text:
title: Apache Pulsar Team
layout: content
---

<!--

    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.

-->

A successful project requires many people to play many roles. Some members write code or documentation,
while others are valuable as testers, submitting patches and suggestions.

The team is comprised of *Members* and *Contributors*. Members have direct access to the source of a
project and actively evolve the codebase. Contributors improve the project through submission of
patches and suggestions to the Members. The number of Contributors to the project is unbounded.
Get involved today. All contributions to the project are greatly appreciated.

## Committers

The following is a list of developers with commit privileges that have directly contributed to the
project in one way or another.

| Name               | Apache Id |      Organization       |      Roles      |
|:-------------------|:----------|:-----------------------:|:---------------:|
| Brad McMillen      | bradtm    |          Yahoo          | Committer, PPMC |
| Hiroyuki Sakai     | hrsakai   | Yahoo Japan Corporation | Committer, PPMC |
| Jai Asher          | jai1      |          Yahoo          | Committer, PPMC |
| Joe Francis        | joef      |          Yahoo          | Committer, PPMC |
| Ludwig Pummer      | ludwigp   |          Yahoo          | Committer, PPMC |
| Masahiro Sakamoto  | massakam  | Yahoo Japan Corporation | Committer, PPMC |
| Masakazu Kitajo    | maskit    |                         | Committer, PPMC |
| Matteo Merli       | mmerli    |        Streamlio        | Committer, PPMC |
| Nozomi Kurihara    | nkurihar  | Yahoo Japan Corporation | Committer, PPMC |
| Rajan Dhabalia     | rdhabalia |          Yahoo          | Committer, PPMC |
| Sahaya Andrews     | andrews   |          Yahoo          | Committer, PPMC |
| Sebastián Schepens | sschepens |      MercadoLibre       | Committer, PPMC |
| Siddharth Boobna   | sboobna   |       Salesforce        | Committer, PPMC |
| Yuki Shiga         | yushiga   | Yahoo Japan Corporation | Committer, PPMC |

## Mentors

The following people are the mentors of this incubator project

| Name                    | Apache Id |
|:------------------------|:---------:|
| David Fisher            |   wave    |
| Francis Christopher Liu |  toffer   |
| Jim Jagielski           |    jim    |
| P. Taylor Goetz         |  ptgoetz  |


text:
<?xml version="1.0" encoding="UTF-8"?>
<sem:triples uri="http://www.lds.org/vrl/geo-political/north-america-and-caribbean/mexico/sonora/ciudad-obregon-sonora-mexico" xmlns:sem="http://marklogic.com/semantics">
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/geo-political/north-america-and-caribbean/mexico/sonora/ciudad-obregon-sonora-mexico</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate>
    <sem:object datatype="xsd:string" xml:lang="eng">Ciudad Obregon (Sonora, Mexico)</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/geo-political/north-america-and-caribbean/mexico/sonora/ciudad-obregon-sonora-mexico</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate>
    <sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/geo-political/north-america-and-caribbean/mexico/sonora/ciudad-obregon-sonora-mexico</sem:subject>
    <sem:predicate>http://www.lds.org/core#entityType</sem:predicate>
    <sem:object datatype="sem:iri">http://www.schema.org/Place</sem:object>
  </sem:triple>
</sem:triples>


text:
package org.camunda.bpm.engine.test.bpmn.async;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.ExecutionListener;

public class AsyncListener implements ExecutionListener {

  public void notify(DelegateExecution execution) throws Exception {
    execution.setVariable("listener", "listener invoked");

  }

}


text:
package com.betfair.tornjak.monitor.overlay;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

import org.junit.Test;

/**
 * I test {@link RolePerms}
 *
 * @author kiersztynw
 *
 */
public class RolePermsTest {

	@Test
	public void testCanReadAttribute() {
		AccessRules accessRules = new AccessRules();
		accessRules.addMatcherAllowed(new RegExpMatcher(".*", ".*", ".*"));
		accessRules.addMatcherDisallowed(new RegExpMatcher(".*", ".*foo", ".*pass.*"));

		RolePerms rolePerms = new RolePerms();
		rolePerms.addAccessRules("jmxadmin", accessRules);

		assertThat(rolePerms.canReadAttribute("jmxadmin", "domain", "name=foo", "value"), is(true));
		assertThat(rolePerms.canReadAttribute("jmxadmin", "domain", "name=foo", "password"), is(false));
		assertThat(rolePerms.canReadAttribute("someOtherRole", "domain", "name=foo", "value"), is(false));
	}

	@Test
	public void testCanReadBasedOnDefaults() {
		RolePerms rolePerms = new RolePerms();
		assertThat(rolePerms.canReadAttribute("jmxadmin", "domain", "name=foo", "value"), is(false));
	}
}


text:
from datetime import datetime
# noinspection PyPackageRequirements
import json
import requests_mock
from unittest import mock
from vitrage.middleware.keycloak import KeycloakAuth
from vitrage.tests.functional.api.v1 import FunctionalTest
from webtest import TestRequest

TOKEN = {
    "iss": "http://127.0.0.1/auth/realms/my_realm",
    "aud": "openstack",
    "realm_access": {
        "roles": ["role1", "role2"]
    }
}

HEADERS = {
    'X-Auth-Token': str(TOKEN),
    'X-Project-Id': 'my_realm'
}

CERT_URL = 'http://127.0.0.1:9080/auth/realms/my_realm/' \
           'protocol/openid-connect/certs'

PUBLIC_KEY = json.loads("""
        {
            "keys": [
                {
                    "kid": "FJ86GcF3jTbNLOco4NvZkUCIUmfYCqoqtOQeMfbhNlE",
                    "kty": "RSA",
                    "alg": "RS256",
                    "use": "sig",
                    "n": "q1awrk7QK24Gmcy9Yb4dMbS-ZnO6",
                    "e": "AQAB"
                }
            ]
        }
        """)

EVENT_DETAILS = {
    'hostname': 'host123',
    'source': 'sample_monitor',
    'cause': 'another alarm',
    'severity': 'critical',
    'status': 'down',
    'monitor_id': 'sample monitor',
    'monitor_event_id': '456',
}

NO_TOKEN_ERROR_MSG = {'error': {
    'code': 401,
    'title': 'Unauthorized',
    'message': 'Auth token must be provided in "X-Auth-Token" header.',
}}

class KeycloakTest(FunctionalTest):

    def __init__(self, *args, **kwds):
        super(KeycloakTest, self).__init__(*args, **kwds)
        self.auth = 'keycloak'

    @staticmethod
    def _build_request():
        req = TestRequest.blank('/')
        req.headers = HEADERS
        return req

    @mock.patch('jwt.decode', return_value=TOKEN)
    @requests_mock.Mocker()
    def test_header_parsing(self, _, req_mock):

        # Imitate success response from KeyCloak.
        req_mock.get(CERT_URL, json=PUBLIC_KEY)

        req = self._build_request()
        auth = KeycloakAuth(mock.Mock(), self.conf)
        auth.process_request(req)

        self.assertEqual('Confirmed', req.headers['X-Identity-Status'])
        self.assertEqual('my_realm', req.headers['X-Project-Id'])
        self.assertEqual('role1,role2', req.headers['X-Roles'])
        self.assertEqual(1, req_mock.call_count)

    def test_in_keycloak_mode_no_token(self):
        resp = self.post_json('/topology/', expect_errors=True)

        self.assertEqual('401 Unauthorized', resp.status)
        self.assert_dict_equal(NO_TOKEN_ERROR_MSG, resp.json)

    @mock.patch('jwt.decode', return_value=TOKEN)
    @requests_mock.Mocker()
    def test_in_keycloak_mode_wrong_token(self, _, req_mock):

        # Imitate failure response from KeyCloak.
        req_mock.get(
            requests_mock.ANY,
            status_code=401,
            reason='Access token is invalid'
        )

        resp = self.post_json('/topology/',
                              params=None,
                              headers=HEADERS,
                              expect_errors=True)

        self.assertEqual('401 Unauthorized', resp.status)

    @mock.patch('jwt.decode', return_value=TOKEN)
    @requests_mock.Mocker()
    def test_in_keycloak_mode_auth_success(self, _, req_mock):

        # Imitate success response from KeyCloak.
        req_mock.get(CERT_URL, json=PUBLIC_KEY)

        with mock.patch('pecan.request') as request:
            resp = self.post_json('/event/',
                                  params={
                                      'time': datetime.now().isoformat(),
                                      'type': 'compute.host.down',
                                      'details': EVENT_DETAILS
                                  },
                                  headers=HEADERS)

            self.assertEqual(1, request.client.call.call_count)
            self.assertEqual('200 OK', resp.status)


text:
import org.wso2.carbon.identity.sso.agent.openid.AttributesRequestor;

import java.util.*;

public class SampleAttributesRequestor implements AttributesRequestor {

    List<String> requestedAttributes = new ArrayList<String>();
    Map<String, Boolean> requiredMap = new HashMap<String, Boolean>();
    Map<String, String> typeURIMap = new HashMap<String, String>();
    Map<String, Integer> countMap = new HashMap<String, Integer>();

    @Override
    public void init() {
        requestedAttributes.add("nickname");
        requiredMap.put("nickname", true);
        typeURIMap.put("nickname","http://axschema.org/namePerson/first");
        countMap.put("nickname",1);
        requestedAttributes.add("lastname");
        requiredMap.put("lastname", true);
        typeURIMap.put("lastname","http://axschema.org/namePerson/last");
        countMap.put("lastname",1);
        requestedAttributes.add("email");
        requiredMap.put("email", true);
        typeURIMap.put("email","http://axschema.org/contact/email");
        countMap.put("email",0);
        requestedAttributes.add("country");
        requiredMap.put("country", true);
        typeURIMap.put("country","http://axschema.org/contact/country/home");
        countMap.put("country",1);
        requestedAttributes.add("dob");
        requiredMap.put("dob", true);
        typeURIMap.put("dob","http://axschema.org/birthDate");
        countMap.put("dob",1);
    }

    @Override
    public String[] getRequestedAttributes(String s) {
        String[] attrArray = new String[requestedAttributes.size()];
        return requestedAttributes.toArray(attrArray);
    }

    @Override
    public boolean isRequired(String s, String s2) {
        return requiredMap.get(s2);
    }

    @Override
    public String getTypeURI(String s, String s2) {
        return typeURIMap.get(s2);
    }

    @Override
    public int getCount(String s, String s2) {
        return countMap.get(s2);
    }
}


text:
'use strict';

var EventEmitter = require('events').EventEmitter
  , slice = Array.prototype.slice;

/**
 * Default globals.
 */
var Logger = global.Logger = require('../')
  , Transport = global.Transport = require('../transports/transport')
  , Transports = global.Transports = require('../transports/');

/**
 * Fixtures.
 */
var fixtures = global.fixtures = {
    mongodb: 'mongodb://test:test@localhost:27017/myapp'
};

/**
 * Assertation.
 */
global.chai = require('chai');
global.chai.Assertion.includeStack = true;
global.expect = global.chai.expect;

/**
 * Produce a dummy transport that emits events for each called method.
 */
fixtures.transport = function transport() {
  var EE = new EventEmitter;

  /**
   * A small evented dummy that allows us to listen to different events.
   *
   * @api private
   */

  function dummy() {
    EE.emit.apply(EE, ['initialize'].concat(slice.call(arguments)));

    this.close = function close() {
      EE.emit.apply(EE, ['close'].concat(slice.call(arguments)));
    };

    this.write = function write() {
      EE.emit.apply(EE, ['write'].concat(slice.call(arguments)));
    };
  }

  // return the fake transport
  return {
      on: function on(name, fn) { EE.on(name, fn); }
    , dummy: dummy
  };
};

/**
 * Produce a dummy stream that emits events for each called method.
 */

fixtures.stream = function stream() {
  var EE = new EventEmitter;

  /**
   * A small evented dummy that allows us to listen to different events, it
   * needs to be an object.. As streams are seen as objects as well
   *
   * @api private
   */

  var dummy = {
      writable: true

    , end: function close() {
        EE.emit.apply(EE, ['end'].concat(slice.call(arguments)));
      }

    , write: function write() {
        EE.emit.apply(EE, ['write'].concat(slice.call(arguments)));
      }
  };

  // return the fake transport
  return {
      on: function on(name, fn) { EE.on(name, fn); }
    , dummy: dummy
  };
};


text:
#region The MIT License - Copyright (C) 2012-2016 Pieter Geerkens
/////////////////////////////////////////////////////////////////////////////////////////
//                PG Software Solutions - Monad Utilities
/////////////////////////////////////////////////////////////////////////////////////////
// The MIT License:
// ----------------
//
// Copyright (c) 2012-2016 Pieter Geerkens (email: pgeerkens@hotmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify,
// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to the following
// conditions:
//     The above copyright notice and this permission notice shall be
//     included in all copies or substantial portions of the Software.
//
//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
//     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
//     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//     NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
//     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
//     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
//     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
//     OTHER DEALINGS IN THE SOFTWARE.
/////////////////////////////////////////////////////////////////////////////////////////
#endregion
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;

using Xunit;

namespace PGSolutions.Monads {

    [ExcludeFromCodeCoverage]
    public class ReaderTests {
        [Fact]
        public static void ExecutionTest() {
            var isExecuted1 = false;
            var isExecuted2 = false;
            var isExecuted3 = false;
            var isExecuted4 = false;

            var culture = CultureInfo.InvariantCulture;

            Reader<int, int>               f1 = x => { isExecuted1 = true; return x + 1; };
            Reader<int, string>            f2 = x => { isExecuted2 = true; return x.ToString(culture); };
            Func<string, Reader<int, int>> f3 = x => y => { isExecuted3 = true; return x.Length + y; };
            Func<int, Func<int, int>>      f4 = x => y => { isExecuted4 = true; return x + y; };
            var query = from x in f1
                        from y in f2
                        from z in f3(y)
                        from _ in f1
                        let f4x = f4(x)
                        select f4x(z);
            Assert.False(isExecuted1,"Laziness: isExecuted1");
            Assert.False(isExecuted2,"Laziness: isExecuted2");
            Assert.False(isExecuted3,"Laziness: isExecuted3");
            Assert.False(isExecuted4,"Laziness: isExecuted4");
            Assert.Equal(1 + 1 + 1 + 1, query(1));//,"Equality");
            Assert.True(isExecuted1,"Execution: isExecuted1");
            Assert.True(isExecuted2,"Execution: isExecuted2");
            Assert.True(isExecuted3,"Execution: isExecuted3");
            Assert.True(isExecuted4,"Execution: isExecuted4");
        }
    }

    public class MonadLawTests {
        static Reader<Tuple<bool, string>, int> M = c => 2 + c.Item2.Length;
        static Func<int, Reader<Tuple<bool, string>, int>> addOne = x => c => x + 1;
        static Func<int, Reader<Tuple<bool, string>, int>> timesLength = x => c => x * c.Item2.Length;

        static Tuple<bool, string> config = Tuple.Create(true, "abc");

        /// Monad law 1: m.Monad().Bind(f) == f(m)
        [Fact]
        public static void MonadLaws() {
            Reader<Tuple<bool, string>, int> left = 1.ToReader<Tuple<bool, string>, int>().Bind(addOne);
            Reader<Tuple<bool, string>, int> right = addOne(1);
            //Contract.Assume(right != null);
            Assert.NotNull(right);
            Assert.Equal(left(config), right(config));
        }

        /// Monad law 2: M.Bind(Monad) == M
        [Fact]
        public static void MonadLaw2() {
            Tuple<bool, string> config = Tuple.Create(true, "abc");

            var expected = M.Bind(Reader.ToReader<Tuple<bool, string>, int>);
            var received = M;
            Assert.Equal(expected(config), received(config));
        }

        /// Monad law 3: M.Bind(f).Bind(g) == M.Bind(x => f(x).Bind(g))
        [Fact]
        public static void MonadLaw3() {
            var expected = M.Bind(addOne).Bind(timesLength);
            var received = M.Bind(x => addOne(x).Bind(timesLength));
            Assert.Equal(expected(config), received(config));
        }
    }

    public class TomAndJerryDependencyInjectionTest {
        [Fact]
        public static void TomAndJerryTest() {
            const string CrLf = "\r\n";
            const string expected = @"
Who is this? This is Tom!
Who is this? This is Jerry!";

            Reader<string, string> tom = env => env + "This is Tom!";
            Reader<string, string> jerry = env => env + "This is Jerry!";
            var query    = ( from t in tom
                             from j in jerry
                             select CrLf + t + CrLf + j
                           );

            var received = query("Who is this? ");
            Assert.Equal(expected, received);
        }
    }
}


text:
package testgrids

import (
	"context"
	"flag"
	"fmt"
	"io/ioutil"
	"net/mail"
	"os"
	"path"
	"path/filepath"
	"regexp"
	"strings"
	"testing"

	"k8s.io/apimachinery/pkg/util/sets"

	"github.com/GoogleCloudPlatform/testgrid/config"
	config_pb "github.com/GoogleCloudPlatform/testgrid/pb/config"
	prow_config "k8s.io/test-infra/prow/config"
	"k8s.io/test-infra/prow/flagutil"
	"k8s.io/test-infra/testgrid/pkg/configurator/configurator"
	"k8s.io/test-infra/testgrid/pkg/configurator/options"

	configflagutil "k8s.io/test-infra/prow/flagutil/config"
)

type SQConfig struct {
	Data map[string]string `yaml:"data,omitempty"`
}

var (
	companies = []string{
		"canonical",
		"cos",
		"cri-o",
		"istio",
		"googleoss",
		"google",
		"kopeio",
		"redhat",
		"ibm",
		"vmware",
		"gardener",
		"jetstack",
		"kyma",
		"kubevirt",
	}
	orgs = []string{
		"conformance",
		"kops",
		"presubmits",
		"sig",
		"wg",
		"provider",
		"kubernetes-clients",
	}
	dashboardPrefixes = [][]string{orgs, companies}

	// gcs prefixes populated by the kubernetes prow instance
	prowGcsPrefixes = []string{
		"kubernetes-jenkins/logs/",
		"kubernetes-jenkins/pr-logs/directory/",
	}
)

var defaultInputs options.MultiString = []string{"../../testgrids"}
var prowPath = flag.String("prow-config", "../../../config/prow/config.yaml", "Path to prow config")
var jobPath = flag.String("job-config", "../../jobs", "Path to prow job config")
var defaultYAML = flag.String("default", "../../testgrids/default.yaml", "Default yaml for testgrid")
var inputs options.MultiString
var protoPath = flag.String("config", "", "Path to TestGrid config proto")

// Shared testgrid config, loaded at TestMain.
var cfg *config_pb.Configuration

// Shared prow config, loaded at Test Main
var prowConfig *prow_config.Config

func TestMain(m *testing.M) {
	flag.Var(&inputs, "yaml", "comma-separated list of input YAML files or directories")
	flag.Parse()
	if *protoPath == "" {
		if len(inputs) == 0 {
			inputs = defaultInputs
		}
		// Generate proto from testgrid config
		tmpDir, err := ioutil.TempDir("", "testgrid-config-test")
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
		defer os.RemoveAll(tmpDir)
		tmpFile := path.Join(tmpDir, "test-proto")

		opt := options.Options{
			Inputs: inputs,
			ProwConfig: configflagutil.ConfigOptions{
				ConfigPath:    *prowPath,
				JobConfigPath: *jobPath,
			},
			DefaultYAML:     *defaultYAML,
			Output:          flagutil.NewStringsBeenSet(tmpFile),
			Oneshot:         true,
			StrictUnmarshal: true,
		}

		if err := configurator.RealMain(&opt); err != nil {
			fmt.Println(err)
			os.Exit(1)
		}

		protoPath = &tmpFile
	}

	var err error
	cfg, err = config.Read(context.Background(), *protoPath, nil)
	if err != nil {
		fmt.Printf("Could not load config: %v\n", err)
		os.Exit(1)
	}

	prowConfig, err = prow_config.Load(*prowPath, *jobPath, nil, "")
	if err != nil {
		fmt.Printf("Could not load prow configs: %v\n", err)
		os.Exit(1)
	}

	os.Exit(m.Run())
}

func TestConfig(t *testing.T) {
	// testgroup - occurrence map, validate testgroups
	testgroupMap := make(map[string]int32)

	for testgroupidx, testgroup := range cfg.TestGroups {
		// All testgroup must have a name and a query
		if testgroup.Name == "" || testgroup.GcsPrefix == "" {
			t.Errorf("Testgroup #%v (Name: '%v', GcsPrefix: '%v'): - Must have a name and gcs_prefix",
				testgroupidx, testgroup.Name, testgroup.GcsPrefix)
		}

		// All testgroup must not have duplicated names
		if testgroupMap[testgroup.Name] > 0 {
			t.Errorf("Duplicated Testgroup: %v", testgroup.Name)
		} else {
			testgroupMap[testgroup.Name] = 1
		}

		t.Run("Testgroup "+testgroup.Name, func(t *testing.T) {
			if !testgroup.IsExternal {
				t.Error("IsExternal must be true")
			}

			for hIdx, header := range testgroup.ColumnHeader {
				if header.ConfigurationValue == "" {
					t.Errorf("Column Header %d is empty", hIdx)
				}
			}

			for _, prowGcsPrefix := range prowGcsPrefixes {
				if strings.Contains(testgroup.GcsPrefix, prowGcsPrefix) {
					// The expectation is that testgroup.Name is the name of a Prow job and the GCSPrefix
					// follows the convention kubernetes-jenkins/logs/.../jobName
					// The final part of the prefix should be the job name.
					expected := filepath.Join(filepath.Dir(testgroup.GcsPrefix), testgroup.Name)
					if expected != testgroup.GcsPrefix {
						t.Errorf("GcsPrefix: Got %s; Want %s", testgroup.GcsPrefix, expected)
					}
					break // out of prowGcsPrefix for loop
				}
			}

			if testgroup.TestNameConfig != nil {
				if testgroup.TestNameConfig.NameFormat == "" {
					t.Error("Empty NameFormat")
				}

				if got, want := len(testgroup.TestNameConfig.NameElements), strings.Count(testgroup.TestNameConfig.NameFormat, "%"); got != want {
					t.Errorf("TestNameConfig has %d elements, format %s wants %d", got, testgroup.TestNameConfig.NameFormat, want)
				}
			}

			// All PR testgroup has num_columns_recent equals 20
			if strings.HasPrefix(testgroup.GcsPrefix, "kubernetes-jenkins/pr-logs/directory/") {
				if testgroup.NumColumnsRecent < 20 {
					t.Errorf("presubmit num_columns_recent want >=20, got %d", testgroup.NumColumnsRecent)
				}
			}
		})
	}

	// dashboard name set
	dashboardSet := sets.NewString()

	for dashboardidx, dashboard := range cfg.Dashboards {
		// All dashboard must have a name
		if dashboard.Name == "" {
			t.Errorf("Dashboard %v: - Must have a name", dashboardidx)
		}

		found := false
		for _, kind := range dashboardPrefixes {
			for _, prefix := range kind {
				if strings.HasPrefix(dashboard.Name, prefix) || dashboard.Name == prefix {
					found = true
					break
				}
			}
			if found {
				break
			}
		}
		if !found {
			t.Errorf("Dashboard %v: must prefix with one of: %v", dashboard.Name, dashboardPrefixes)
		}

		// All dashboard must not have duplicated names
		if dashboardSet.Has(dashboard.Name) {
			t.Errorf("Duplicated dashboard: %v", dashboard.Name)
		} else {
			dashboardSet.Insert(dashboard.Name)
		}

		// All dashboard must have at least one tab
		if len(dashboard.DashboardTab) == 0 {
			t.Errorf("Dashboard %v: - Must have more than one dashboardtab", dashboard.Name)
		}

		// dashboardtabSet is a set that checks duplicate tab name within each dashboard
		dashboardtabSet := sets.NewString()

		// dashboardtestgroupSet is a set that checks duplicate testgroups within each dashboard
		dashboardtestgroupSet := sets.NewString()

		// All notifications in dashboard must have a summary
		if len(dashboard.Notifications) != 0 {
			for notificationindex, notification := range dashboard.Notifications {
				if notification.Summary == "" {
					t.Errorf("Notification %v in dashboard %v: - Must have a summary", notificationindex, dashboard.Name)
				}
			}
		}

		for tabindex, dashboardtab := range dashboard.DashboardTab {

			// All dashboardtab must have a name and a testgroup
			if dashboardtab.Name == "" || dashboardtab.TestGroupName == "" {
				t.Errorf("Dashboard %v, tab %v: - Must have a name and a testgroup name", dashboard.Name, tabindex)
			}

			// All dashboardtab within a dashboard must not have duplicated names
			if dashboardtabSet.Has(dashboardtab.Name) {
				t.Errorf("Duplicated name in dashboard %s: %v", dashboard.Name, dashboardtab.Name)
			} else {
				dashboardtabSet.Insert(dashboardtab.Name)
			}

			// All dashboardtab within a dashboard must not have duplicated testgroupnames
			if dashboardtestgroupSet.Has(dashboardtab.TestGroupName) {
				t.Errorf("Duplicated testgroupnames in dashboard %s: %v", dashboard.Name, dashboardtab.TestGroupName)
			} else {
				dashboardtestgroupSet.Insert(dashboardtab.TestGroupName)
			}

			// All testgroup in dashboard must be defined in testgroups
			if testgroupMap[dashboardtab.TestGroupName] == 0 {
				t.Errorf("Dashboard %v, tab %v: - Testgroup %v must be defined first",
					dashboard.Name, dashboardtab.Name, dashboardtab.TestGroupName)
			} else {
				testgroupMap[dashboardtab.TestGroupName]++
			}
		}
	}

	// No dup of dashboard groups, and no dup dashboard in a dashboard group
	groupSet := sets.NewString()
	dashboardToGroupMap := make(map[string]string)

	for idx, dashboardGroup := range cfg.DashboardGroups {
		// All dashboard must have a name
		if dashboardGroup.Name == "" {
			t.Errorf("DashboardGroup %v: - DashboardGroup must have a name", idx)
		}

		found := false
		for _, kind := range dashboardPrefixes {
			for _, prefix := range kind {
				if strings.HasPrefix(dashboardGroup.Name, prefix) || prefix == dashboardGroup.Name {
					found = true
					break
				}
			}
			if found {
				break
			}
		}
		if !found {
			t.Errorf("Dashboard group %v: must prefix with one of: %v", dashboardGroup.Name, dashboardPrefixes)
		}

		// All dashboardgroup must not have duplicated names
		if groupSet.Has(dashboardGroup.Name) {
			t.Errorf("Duplicated dashboard: %v", dashboardGroup.Name)
		} else {
			groupSet.Insert(dashboardGroup.Name)
		}

		if dashboardSet.Has(dashboardGroup.Name) {
			t.Errorf("%v is both a dashboard and dashboard group name.", dashboardGroup.Name)
		}

		for _, dashboard := range dashboardGroup.DashboardNames {
			// All dashboard must not have duplicated names
			if assignedGroup, ok := dashboardToGroupMap[dashboard]; ok {
				t.Errorf("Duplicated dashboard %v in dashboard group %v and %v", dashboard, assignedGroup, dashboardGroup.Name)
			} else {
				dashboardToGroupMap[dashboard] = dashboardGroup.Name
			}

			if !dashboardSet.Has(dashboard) {
				t.Errorf("Dashboard %v needs to be defined before adding to a dashboard group!", dashboard)
			}

			if !strings.HasPrefix(dashboard, dashboardGroup.Name) {
				t.Errorf("Dashboard %v in group %v must have the group name as a prefix", dashboard, dashboardGroup.Name)
			}
		}
	}

	// Dashboards that match this dashboard group's prefix should be a part of it, unless this group is the prefix of the assigned group
	// (e.g. knative and knative-sandbox).
	for thisGroup := range groupSet {
		for dashboard := range dashboardSet {
			if strings.HasPrefix(dashboard, thisGroup+"-") {
				assignedGroup, ok := dashboardToGroupMap[dashboard]
				if !ok {
					t.Errorf("Dashboard %v should be in dashboard_group %v", dashboard, thisGroup)
				} else if assignedGroup != thisGroup && !strings.HasPrefix(assignedGroup, thisGroup) {
					t.Errorf("Dashboard %v should be in dashboard_group %v instead of dashboard_group %v", dashboard, thisGroup, assignedGroup)
				}
			}
		}
	}

	// All Testgroup should be mapped to one or more tabs
	missedTestgroups := false
	for testgroupname, occurrence := range testgroupMap {
		if occurrence == 1 {
			t.Errorf("Testgroup %v - defined but not used in any dashboards.", testgroupname)
			missedTestgroups = true
		}
	}
	if missedTestgroups {
		t.Logf("Note: Testgroups are automatically defined for postsubmits and periodics.")
		t.Logf("Testgroups can be added to a dashboard either by using the `testgrid-dashboards` annotation on the prowjob, or by adding them to testgrid/config.yaml")
	}
}

// TODO: These are all repos that don't have their presubmits in testgrid.
// Convince sig leads or subproject owners this is a bad idea and whittle this down
// to just kubernetes-security/
// Tracking issue: https://github.com/kubernetes/test-infra/issues/18159
var noPresubmitsInTestgridPrefixes = []string{
	"containerd/cri",
	"GoogleCloudPlatform/k8s-multicluster-ingress",
	"kubernetes-sigs/cluster-capacity",
	"kubernetes-sigs/gcp-filestore-csi-driver",
	"kubernetes-sigs/kind",
	"kubernetes-sigs/kubetest2",
	"kubernetes-sigs/oci-proxy",
	"kubernetes-sigs/kubebuilder-declarative-pattern",
	"kubernetes-sigs/scheduler-plugins",
	"kubernetes-sigs/service-catalog",
	"kubernetes-sigs/sig-storage-local-static-provisioner",
	"kubernetes-sigs/slack-infra",
	"kubernetes-sigs/testing_frameworks",
	"kubernetes/client-go",
	"kubernetes/cloud-provider-openstack",
	"kubernetes/dns",
	"kubernetes/enhancements",
	"kubernetes/ingress-gce",
	"kubernetes/kubeadm",
	"kubernetes/minikube",
	// This is the one entry that should be here
	"kubernetes-security/",
}

func hasAnyPrefix(s string, prefixes []string) bool {
	for _, prefix := range prefixes {
		if strings.HasPrefix(s, prefix) {
			return true
		}
	}
	return false
}

// A job is merge-blocking if it:
// - is not optional
// - reports (aka does not skip reporting)
// - always runs OR runs if some path changed
func isMergeBlocking(job prow_config.Presubmit) bool {
	return !job.Optional && !job.SkipReport && (job.AlwaysRun || job.RunIfChanged != "" || job.SkipIfOnlyChanged != "")
}

// All jobs in presubmits-kuberentes-blocking must be merge-blocking for kubernetes/kubernetes
// All jobs that are merge-blocking for kubernetes/kubernetes must be in presubmits-kubernetes-blocking
func TestPresubmitsKubernetesDashboards(t *testing.T) {
	var dashboard *config_pb.Dashboard
	repo := "kubernetes/kubernetes"
	dash := "presubmits-kubernetes-blocking"
	for _, d := range cfg.Dashboards {
		if d.Name == dash {
			dashboard = d
		}
	}
	if dashboard == nil {
		t.Fatalf("Missing dashboard: %s", dash)
	}
	testgroups := make(map[string]bool)
	for _, tab := range dashboard.DashboardTab {
		testgroups[tab.TestGroupName] = false
	}
	jobs := make(map[string]bool)
	for _, job := range prowConfig.AllStaticPresubmits([]string{repo}) {
		if isMergeBlocking(job) {
			jobs[job.Name] = false
		}
	}
	for job, seen := range jobs {
		if _, ok := testgroups[job]; !seen && !ok {
			t.Errorf("%s: job is merge-blocking for %s but missing from %s", job, repo, dash)
		}
		jobs[job] = true
	}
	for tg, seen := range testgroups {
		if _, ok := jobs[tg]; !seen && !ok {
			t.Errorf("%s: should not be in %s because not actually merge-blocking for %s", tg, dash, repo)
		}
		testgroups[tg] = true
	}
}

func TestKubernetesProwInstanceJobsMustHaveMatchingTestgridEntries(t *testing.T) {
	jobs := make(map[string]bool)

	for repo, presubmits := range prowConfig.PresubmitsStatic {
		// Assume that all jobs in the exceptionList are valid
		if hasAnyPrefix(repo, noPresubmitsInTestgridPrefixes) {
			for _, job := range presubmits {
				jobs[job.Name] = true
			}
			continue
		}
		for _, job := range presubmits {
			jobs[job.Name] = false
		}
	}

	for _, job := range prowConfig.AllStaticPostsubmits([]string{}) {
		jobs[job.Name] = false
	}

	for _, job := range prowConfig.AllPeriodics() {
		jobs[job.Name] = false
	}

	// Ignore any test groups that get their results from a gcs prefix
	// that is not populated by the kubernetes prow instance
	testgroups := make(map[string]bool)
	for _, testgroup := range cfg.TestGroups {
		for _, prowGcsPrefix := range prowGcsPrefixes {
			if strings.Contains(testgroup.GcsPrefix, prowGcsPrefix) {
				// The convention is that the job name is the final part of the GcsPrefix
				job := filepath.Base(testgroup.GcsPrefix)
				testgroups[job] = false
				break // to next testgroup
			}
		}
	}

	// Each job running in the kubernetes prow instance must have an
	// identically named test_groups entry in the kubernetes testgrid config
	for job := range jobs {
		if _, ok := testgroups[job]; ok {
			testgroups[job] = true
			jobs[job] = true
		}
	}

	// Conclusion
	for job, valid := range jobs {
		if !valid {
			t.Errorf("Job %v does not have a matching testgrid testgroup", job)
		}
	}

	for testgroup, valid := range testgroups {
		if !valid {
			t.Errorf("Testgrid group %v is supposed to be moved to have their presubmits in testgrid. See this issue: https://github.com/kubernetes/test-infra/issues/18159", testgroup)
		}
	}
}

func TestReleaseBlockingJobsMustHaveTestgridDescriptions(t *testing.T) {
	// TODO(spiffxp): start with master, enforce for all release branches
	re := regexp.MustCompile("^sig-release-master-(blocking|informing)$")
	for _, dashboard := range cfg.Dashboards {
		if !re.MatchString(dashboard.Name) {
			continue
		}
		suffix := re.FindStringSubmatch(dashboard.Name)[1]
		for _, dashboardtab := range dashboard.DashboardTab {
			intro := fmt.Sprintf("dashboard_tab %v/%v is release-%v", dashboard.Name, dashboardtab.Name, suffix)
			if dashboardtab.Name == "" {
				t.Errorf("%v: - Must have a name", intro)
			}
			if dashboardtab.TestGroupName == "" {
				t.Errorf("%v: - Must have a test_group_name", intro)
			}
			if dashboardtab.Description == "" {
				t.Errorf("%v: - Must have a description", intro)
			}
			// TODO(spiffxp): enforce for informing as well
			if suffix == "informing" {
				if !strings.HasPrefix(dashboardtab.Description, "OWNER: ") {
					t.Logf("NOTICE: %v: - Must have a description that starts with OWNER: ", intro)
				}
				if dashboardtab.AlertOptions == nil {
					t.Logf("NOTICE: %v: - Must have alert_options (ensure informing dashboard is listed first in testgrid-dashboards)", intro)
				} else if dashboardtab.AlertOptions.AlertMailToAddresses == "" {
					t.Logf("NOTICE: %v: - Must have alert_options.alert_mail_to_addresses", intro)
				}
			} else {
				if dashboardtab.AlertOptions == nil {
					t.Errorf("%v: - Must have alert_options (ensure blocking dashboard is listed first in testgrid-dashboards)", intro)
				} else if dashboardtab.AlertOptions.AlertMailToAddresses == "" {
					t.Errorf("%v: - Must have alert_options.alert_mail_to_addresses", intro)
				}
			}
		}
	}
}

func TestNoEmpyMailToAddresses(t *testing.T) {
	for _, dashboard := range cfg.Dashboards {
		for _, dashboardtab := range dashboard.DashboardTab {
			intro := fmt.Sprintf("dashboard_tab %v/%v", dashboard.Name, dashboardtab.Name)
			if dashboardtab.AlertOptions != nil {
				if dashboardtab.AlertOptions.AlertMailToAddresses == "" {
					continue
				}
				mails := strings.Split(dashboardtab.AlertOptions.AlertMailToAddresses, ",")
				for _, m := range mails {
					_, err := mail.ParseAddress(m)
					if err != nil {
						t.Errorf("%v: - invalid alert_mail_to_address '%v': %v", intro, m, err)
					}
				}
			}
		}
	}
}


text:
package org.gradle.groovy.scripts.internal;

import org.codehaus.groovy.ast.stmt.Statement;
import org.codehaus.groovy.control.CompilationUnit;
import org.gradle.api.specs.Spec;
import org.gradle.groovy.scripts.ScriptSource;
import org.gradle.groovy.scripts.Transformer;
import org.gradle.internal.Factory;
import org.gradle.model.dsl.internal.transform.ModelBlockTransformer;

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

public class BuildScriptTransformer implements Transformer, Factory<BuildScriptData> {

    private final Spec<? super Statement> filter;
    private final ScriptSource scriptSource;

    private final ImperativeStatementDetectingTransformer imperativeStatementDetectingTransformer = new ImperativeStatementDetectingTransformer();

    public BuildScriptTransformer(String classpathClosureName, ScriptSource scriptSource) {
        final List<String> blocksToIgnore = Arrays.asList(classpathClosureName, InitialPassStatementTransformer.PLUGINS);
        this.filter = new Spec<Statement>() {
            @Override
            public boolean isSatisfiedBy(Statement statement) {
                return AstUtils.detectScriptBlock(statement, blocksToIgnore) != null;
            }
        };
        this.scriptSource = scriptSource;
    }

    public void register(CompilationUnit compilationUnit) {
        new FilteringScriptTransformer(filter).register(compilationUnit);
        new TaskDefinitionScriptTransformer().register(compilationUnit);
        new FixMainScriptTransformer().register(compilationUnit);
        new StatementLabelsScriptTransformer().register(compilationUnit);
        new ModelBlockTransformer(scriptSource.getDisplayName(), scriptSource.getResource().getLocation().getURI()).register(compilationUnit);
        imperativeStatementDetectingTransformer.register(compilationUnit);
    }

    @Override
    public BuildScriptData create() {
        return new BuildScriptData(imperativeStatementDetectingTransformer.isImperativeStatementDetected());
    }
}


text:
package tagstash

import (
	"errors"
	"io"
	"strconv"
	"sync"
	"time"

	"github.com/aryszka/forget"
	"github.com/aryszka/keyval"
)

const forEver = time.Duration((^uint64(0)) >> 1)

type cache struct {
	forget *forget.Cache
	mx     *sync.Mutex
}

var (
	// ErrDamagedCacheData is returned when the cache detects damaged data.
	ErrDamagedCacheData = errors.New("damaged cache data")

	// ErrFailedToCacheEntry is returned when caching an entry failed, e.g. due to oversize.
	ErrFailedToCacheEntry = errors.New("failed to cache entry")
)

func newCache(o CacheOptions) *cache {
	if o.ExpectedItemSize < 64 {
		o.ExpectedItemSize = 64
	}

	return &cache{
		forget: forget.New(forget.Options{
			CacheSize: o.CacheSize,
			ChunkSize: o.ExpectedItemSize,
		}),
		mx: &sync.Mutex{},
	}
}

func readAll(r io.Reader, tag string) ([]*Entry, error) {
	var entries []*Entry
	kvr := keyval.NewEntryReader(r)
	for {
		e, err := kvr.ReadEntry()
		if err != nil {
			if err == io.EOF {
				break
			}

			return nil, err
		}

		tagIndex, err := strconv.Atoi(e.Val)
		if err != nil {
			return nil, err
		}

		if len(e.Key) != 1 {
			return nil, ErrDamagedCacheData
		}

		entries = append(entries, &Entry{
			Value:    e.Key[0],
			Tag:      tag,
			TagIndex: tagIndex,
		})
	}

	return entries, nil
}

func writeAll(w io.Writer, e []*Entry) error {
	kvw := keyval.NewEntryWriter(w)
	for _, ei := range e {
		err := kvw.WriteEntry(&keyval.Entry{
			Key: []string{ei.Value},
			Val: strconv.Itoa(ei.TagIndex),
		})

		if err != nil {
			return err
		}
	}

	return nil
}

func (c *cache) withTagEntries(tag string, op func([]*Entry) []*Entry) error {
	c.mx.Lock()
	defer c.mx.Unlock()

	var entries []*Entry
	if r, ok := c.forget.Get(tag); ok {
		defer r.Close()

		var err error
		entries, err = readAll(r, tag)
		if err != nil {
			return err
		}
	}

	entries = op(entries)

	w, ok := c.forget.Set(tag, forEver)
	if !ok {
		return ErrFailedToCacheEntry
	}

	defer w.Close()
	return writeAll(w, entries)
}

func (c *cache) Get(tags []string) ([]*Entry, error) {
	var entries []*Entry
	for _, t := range tags {
		r, ok := c.forget.Get(t)
		if !ok {
			continue
		}

		defer r.Close()
		tagEntries, err := readAll(r, t)
		if err != nil {
			return nil, err
		}

		entries = append(entries, tagEntries...)
	}

	return entries, nil
}

func (c *cache) Set(e *Entry) error {
	return c.withTagEntries(e.Tag, func(entries []*Entry) []*Entry {
		var exists bool
		for _, ei := range entries {
			if ei.Value == e.Value {
				ei.TagIndex = e.TagIndex
				exists = true
				break
			}
		}

		if !exists {
			entries = append(entries, e)
		}

		return entries
	})
}

func (c *cache) Remove(e *Entry) error {
	return c.withTagEntries(e.Tag, func(entries []*Entry) []*Entry {
		for i, ei := range entries {
			if ei.Value == e.Value {
				last := len(entries) - 1
				entries[last], entries = nil, append(entries[:i], entries[i+1:]...)
				break
			}
		}

		return entries
	})
}

func (c *cache) Delete(tag string) error {
	c.forget.Delete(tag)
	return nil
}

func (c *cache) Close() {
	c.forget.Close()
}


text:
class Gol01:

    def __init__(self):
        pass

    def setze_zelle_auf_lebendig(self):
        self.status = True
        return

    def setze_zelle_auf_tot(self):
        self.status = False
        return

    def naechste_generation(self):
        result = (self.anzahl_nachbarn == 3) or \
                 ((self.status == True) and (self.anzahl_nachbarn == 2))
        return result

    def zelle_hat_nachbarn(self, anzahl_nachbarn):
        self.anzahl_nachbarn = anzahl_nachbarn
        return

if __name__ == '__main__':
   pass


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Lagenidium ellipticum De Wild., 1893

### Remarks
null