text:
from RedisHelper import RedisHelper

obj = RedisHelper()
redis_sub = obj.subscribe()#调用订阅方法

while True:
    msg= redis_sub.parse_response()
    print (msg)


text:
import java.util.ArrayList;
import java.util.Iterator;
import org.nlogo.api.Argument;
import org.nlogo.api.Context;
import org.nlogo.api.Reporter;
import org.nlogo.api.ExtensionException;
import org.nlogo.api.LogoException;
import org.nlogo.core.LogoList;
import org.nlogo.api.LogoListBuilder;
import org.nlogo.core.Syntax;
import org.nlogo.core.SyntaxJ;
import org.nlogo.api.Color;

public class ScaleGradient implements Reporter {

  // Primitive arguments
  private LogoList colorLogoList = null;
  private double var = 0;
  private double min = 0;
  private double max = 0;

  // Preceptually reasonable gradation resolution of 256 different colors
  // for each pair of colors
  final static int SIZE = 256;

  // Static variables for cache handling
  private static LogoList colorLogoListCache = null;
  private static int[][] gradientArray =  null;

  public Syntax getSyntax() {
    int[] right = {
      Syntax.ListType(),   // n list with lists of 3 numbers [[r g b] [r g b] ...]
      Syntax.NumberType(), // number with the value to scale
      Syntax.NumberType(), // number with range1
      Syntax.NumberType()   // number with range2
    };
    int ret = Syntax.ListType(); // list with 3 numbers [r g b]
    return SyntaxJ.reporterSyntax(right , ret);
  }

  public Object report(Argument args[], Context context)
      throws ExtensionException {
    // Extract arguments
    try {
      colorLogoList = args[0].getList();
      var = args[1].getDoubleValue();
      min = args[2].getDoubleValue();
      max = args[3].getDoubleValue();
    }
    // Hope that they have the correct type
    catch (LogoException e) {
      throw new ExtensionException(e.getMessage());
    }

    // Validate colorList rgb arguments
    for (int i = 0; i < colorLogoList.length(); i++) {
      LogoList RGBList;
      if (colorLogoList.get(i) instanceof Double){
        RGBList = Color.getRGBListByARGB(Color.getARGBbyPremodulatedColorNumber(Color.modulateDouble((double) colorLogoList.get(i))));
      }
      else {
        RGBList = (LogoList) colorLogoList.get(i);
      }
      if (RGBList.length() == 4) {
        RGBList = RGBList.butLast();
      }
      validRGBList(RGBList);
    }

    // Normalize var, min, max
    double perc = 0.0;
    if (min > max) { // min and max are really reversed
      if (var < max) {
        perc = 1.0;
      }
      else if (var > min) {
        perc = 0.0;
      }
      else {
        double tempval = min - var;
        double tempmax = min - max;
        perc = tempval / tempmax;
      }
    }
    else {
      if (var > max) {
        perc = 1.0;
      }
      else if (var < min) {
        perc = 0.0;
      }
      else {
        double tempval = var - min;
        double tempmax = max - min;
        perc = tempval / tempmax;
      }
    }

    int index;
    if (colorLogoList.size() < 3 ) {
      index =  (int) Math.round(perc * (SIZE - 1)); // 0 and 255
    }
    else {
      index = (int) Math.round(perc * ( (SIZE - 1) + (SIZE)*(colorLogoList.size() - 2) )); // 255 + n * 256
    }

    // The order of the evaluation matters in statement below !
    if (colorLogoListCache == null ||
        !colorLogoListCache.equals( colorLogoList)) {

      // Store current list as cache
      colorLogoListCache = colorLogoList;

      // Create an array containing color instances of the arguments
      ArrayList<Object> colorList = new ArrayList<Object>();
      for (int i = 0; i < colorLogoList.length(); i++) {
        LogoList RGBList;
        if (colorLogoList.get(i) instanceof Double) {
          RGBList = Color.getRGBListByARGB(Color.getARGBbyPremodulatedColorNumber(Color.modulateDouble((double) colorLogoList.get(i))));
        }
        else {
          RGBList = (LogoList) colorLogoList.get(i);
        }
        if (RGBList.length() == 4) {
          RGBList = RGBList.butLast();
        }
        java.awt.Color color = new java.awt.Color (
            ((Double) RGBList.get(0)).intValue(),
            ((Double) RGBList.get(1)).intValue(),
            ((Double) RGBList.get(2)).intValue()
        );
        colorList.add(color);
      }

      // Create array with resulting gradient color instances

      gradientArray = new int [SIZE * (colorList.size() - 1)][3];
      for (int i = 0; i < (colorList.size() - 1); i++) {
        ColorGradient colorGradient = new ColorGradient(
            (java.awt.Color) colorList.get(i),
            (java.awt.Color) colorList.get(i + 1) ,
            SIZE);
        for (int j = 0; j < SIZE; j++) {
          gradientArray[j+ (SIZE * i)] = colorGradient.getGradientRGBArray()[j];
        }
      }
    }

    // Extract rgb values of resulting gradient color to a LogoList
    LogoListBuilder gradientList = new LogoListBuilder();
    try {
      gradientList.add(Double.valueOf(gradientArray[index][0]));
      gradientList.add(Double.valueOf(gradientArray[index][1]));
      gradientList.add(Double.valueOf(gradientArray[index][2]));
    }
    catch (ArrayIndexOutOfBoundsException e) {
      throw new ExtensionException(
          "Please e-mail send this error to bugs@ccl.northwestern.edu" +
          e.getMessage());
    }

    return gradientList.toLogoList();
  }

  private void validRGB(int c)
  throws ExtensionException {
    if (c < 0 || c > 255) {
      throw new ExtensionException( "RGB values must be 0-255" );
    }
  }

  void validRGBList(LogoList rgb)
  throws ExtensionException {
    if (rgb.size() == 3) {
      try {
        validRGB(((Double)rgb.get(0)).intValue());
        validRGB(((Double)rgb.get(1)).intValue());
        validRGB(((Double)rgb.get(2)).intValue());
        return;
      }
      catch (ClassCastException e) {
        // just fall through and throw the error below
        org.nlogo.api.Exceptions.ignore(e);
      }
    }
    else {
      throw new ExtensionException( "An rgb list must contain 3 numbers 0-255" +
                      "one of your rgb lists contains " +
                      rgb.size() + "numbers");
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Home extends CI_Controller{

  public function __construct()
  {
    parent::__construct();
    //Codeigniter : Write Less Do More
    if ($this->session->userdata('status') != "login") {
      redirect(base_url("index.php/auth"));
    }
  }

  function index()
  {
      $this->load->view("vadmin");
  }

}


text: .iframe-wrapper iframe { height: 250px; width: 350px; }


text:
package com.guyazhou.plugin.reviewboard.model;

import com.guyazhou.plugin.reviewboard.model.default_reviewer.DefaultReviewer;
import com.guyazhou.plugin.reviewboard.model.extension.Extension;
import com.guyazhou.plugin.reviewboard.model.hosting_service.HostingService;
import com.guyazhou.plugin.reviewboard.model.hosting_service_account.HostingServiceAccount;
import com.guyazhou.plugin.reviewboard.model.repository.Repository;
import com.guyazhou.plugin.reviewboard.model.review_request.ReviewRequest;
import com.guyazhou.plugin.reviewboard.model.search.Search;
import com.guyazhou.plugin.reviewboard.model.session.Session;
import com.guyazhou.plugin.reviewboard.model.user.User;
import com.guyazhou.plugin.reviewboard.model.validation.Validation;
import com.guyazhou.plugin.reviewboard.model.webhook.Webhook;

import java.util.List;

/**
 * @author YaZhou.Gu 2018/8/7
 */
public class Api {

    private List<DefaultReviewer> defaultReviewers;

    private List<Extension> extensions;

    private List<HostingService> hostingServices;

    private List<HostingServiceAccount> hostingServiceAccounts;

    private List<Repository> repositories;

    private List<Group> groups;

    private List<ReviewRequest> reviewRequests;

    private Search search;

    private Session session;

    private List<User> users;

    private Validation validation;

    private List<Webhook> webhooks;

}


text:
package iot.jcypher.database.embedded;

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

import org.neo4j.graphdb.Transaction;

import iot.jcypher.database.internal.DBUtil;
import iot.jcypher.query.result.JcError;
import iot.jcypher.transaction.internal.AbstractTransaction;

public class ETransactionImpl extends AbstractTransaction {

	private Transaction transaction;

	/**
	 * @param dbAccess
	 */
	public ETransactionImpl(AbstractEmbeddedDBAccess dbAccess) {
		super(dbAccess);
	}

	@Override
	public List<JcError> close() {
		List<JcError> errors;
		if (isClosed())
			throw new RuntimeException(ERR_CLOSED);
		if (!isMyThread())
			throw new RuntimeException(ERR_THREAD);

		AbstractEmbeddedDBAccess edba = getEDBAccess();
		edba.removeTx();
		if (this.transaction != null) {
			Transaction tx = getTransaction();
			if (failed)
				tx.failure();
			else
				tx.success();

			Throwable dbException = null;
			try {
				tx.close();
			} catch(Throwable e) {
				dbException = e;
			}
			errors = DBUtil.buildErrorList(null, dbException);
		} else
			errors = new ArrayList<JcError>();

		if (errors.size() > 0)
			failure();
		setClosed();

		return errors;
	}

	public Transaction getTransaction() {
		if (this.transaction == null) {
			AbstractEmbeddedDBAccess edba = getEDBAccess();
			this.transaction = edba.getGraphDB().beginTx();
		}
		return this.transaction;
	}

	private AbstractEmbeddedDBAccess getEDBAccess() {
		return (AbstractEmbeddedDBAccess)getDBAccess();
	}
}


text:
package gwt.shared.model;

import gwt.shared.model.SFinItem.Comm;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class SFiscalYear implements Serializable{

	private static final long serialVersionUID = 1L;

	private String keyString;
	private int beginMonth;
	private int beginYear;
	private int endMonth;
	private int endYear;
	private ArrayList<SJournalType> sJournalTypeList = new ArrayList<SJournalType>();
	private ArrayList<SDocType> sDocTypeList = new ArrayList<SDocType>();
	private ArrayList<SAccGrp> sAccGrpList = new ArrayList<SAccGrp>();
	private ArrayList<SAccChart> sAccChartList = new ArrayList<SAccChart>();
	private ArrayList<SFinHeader> sFinHeaderList = new ArrayList<SFinHeader>();
	private ArrayList<SJournalHeader> sJournalList = new ArrayList<SJournalHeader>();

	public SFiscalYear(){

	}

	public SFiscalYear(String keyString, int beginMonth, int beginYear, int endMonth, int endYear){
        this.keyString = keyString;
        this.beginMonth = beginMonth;
        this.beginYear = beginYear;
        this.endMonth = endMonth;
        this.endYear = endYear;
    }

	public String getKeyString(){
        return this.keyString;
    }

	public int getBeginMonth(){
	    return this.beginMonth;
	}

	public int getEndMonth(){
        return this.endMonth;
    }

	public int getBeginYear(){
        return this.beginYear;
    }

	public int getEndYear(){
        return this.endYear;
    }

	public List<SJournalType> getSJournalTypeList(){
        return Collections.unmodifiableList(sJournalTypeList);
    }

	public List<SDocType> getSDocTypeList(){
        return Collections.unmodifiableList(sDocTypeList);
    }

	public List<SAccGrp> getSAccGrpList(){
        return Collections.unmodifiableList(sAccGrpList);
    }

	public List<SAccChart> getSAccChartList(){
        return Collections.unmodifiableList(sAccChartList);
    }

	public List<SFinHeader> getSFinHeaderList(){
        return Collections.unmodifiableList(sFinHeaderList);
    }

	public List<SJournalHeader> getSJournalList(){
        return Collections.unmodifiableList(sJournalList);
    }

	public void setKeyString(String keyString){
	    this.keyString = keyString;
	}

    public void setBeginMonth(int beginMonth) {
        this.beginMonth = beginMonth;
    }

    public void setBeginYear(int beginYear) {
        this.beginYear = beginYear;
    }

    public void setEndMonth(int endMonth) {
        this.endMonth = endMonth;
    }

    public void setEndYear(int endYear) {
        this.endYear = endYear;
    }

    public void setSetup(SFiscalYear sFis){
        sJournalTypeList.clear();
        for(SJournalType sJournalType : sFis.getSJournalTypeList()){
            addSJournalType(sJournalType);
        }

        sDocTypeList.clear();
        for(SDocType sDocType : sFis.getSDocTypeList()){
            addSDocType(sDocType);
        }

        sAccGrpList.clear();
        for(SAccGrp sAccGrp : sFis.getSAccGrpList()){
            addSAccGrp(sAccGrp);
        }

        sAccChartList.clear();
        for(SAccChart sAccChart : sFis.getSAccChartList()){
            addSAccChart(sAccChart);
        }

        sFinHeaderList.clear();
        for(SFinHeader sFin : sFis.getSFinHeaderList()){
            addSFinHeader(sFin);
        }
    }

    public SJournalType getSJournalType(String journalTypeKeyString){
        for(SJournalType sJournalType : sJournalTypeList){
            if(sJournalType.getKeyString().equals(journalTypeKeyString)){
                return sJournalType;
            }
        }
        return null;
    }

    public void addSJournalType(SJournalType sJournalType){
        sJournalTypeList.add(sJournalType);
    }

    public SJournalType editSJournalType(SJournalType newSJournalType){
        for(SJournalType sJournalType : sJournalTypeList){
            if(sJournalType.getKeyString().equals(newSJournalType.getKeyString())){
                sJournalType.setName(newSJournalType.getName());
                sJournalType.setShortName(newSJournalType.getShortName());
                return sJournalType;
            }
        }
        return null;
    }

    public void removeSJournalType(String keyString){
        SJournalType sJournalType = getSJournalType(keyString);
        if(sJournalType != null){
            sJournalTypeList.remove(sJournalType);
        }
    }

    public SDocType getSDocType(String docTypeKeyString){
        for(SDocType sDocType : sDocTypeList){
            if(sDocType.getKeyString().equals(docTypeKeyString)){
                return sDocType;
            }
        }
        return null;
    }

    public void addSDocType(SDocType sDocType){
        sDocTypeList.add(sDocType);
    }

    public SDocType editSDocType(SDocType newSDocType){
        for(SDocType sDocType : sDocTypeList){
            if(sDocType.getKeyString().equals(newSDocType.getKeyString())){
                sDocType.setJournalTypeKeyString(newSDocType.getJournalTypeKeyString());
                sDocType.setCode(newSDocType.getCode());
                sDocType.setName(newSDocType.getName());
                sDocType.setJournalDesc(newSDocType.getJournalDesc());
                return sDocType;
            }
        }
        return null;
    }

    public void removeSDocType(String keyString){
        for(SDocType sDocType : sDocTypeList){
            if(sDocType.getKeyString().equals(keyString)){
                sDocTypeList.remove(sDocType);
                break;
            }
        }
    }

    public void updateSDocTypeJournalTypeShortName(){
        for (SDocType sDocType : sDocTypeList) {
            updateSDocTypeJournalTypeShortName(sDocType);
        }
    }

    public void updateSDocTypeJournalTypeShortName(SDocType sDocType){

        assert sDocType != null;
        assert sJournalTypeList != null && !sJournalTypeList.isEmpty();

        // Try to update journalTypeShortDesc
        SJournalType sJournalType = getSJournalType(sDocType.getJournalTypeKeyString());
        if(sJournalType != null){
            sDocType.setJournalTypeShortName(sJournalType.getShortName());
        }
    }

    public SAccGrp getSAccGrp(String accGrpKeyString){
        for(SAccGrp sAccGrp : sAccGrpList){
            if(sAccGrp.getKeyString().equals(accGrpKeyString)){
                return sAccGrp;
            }
        }
        return null;
    }

    public void addSAccGrp(SAccGrp sAccGrp){
        sAccGrpList.add(sAccGrp);
    }

    public SAccGrp editSAccGrp(SAccGrp newSAccGrp){
        for(SAccGrp sAccGrp : sAccGrpList){
            if(sAccGrp.getKeyString().equals(newSAccGrp.getKeyString())){
                sAccGrp.setName(newSAccGrp.getName());
                return sAccGrp;
            }
        }
        return null;
    }

    public void removeSAccGrp(String keyString){
        SAccGrp sAccGrp = getSAccGrp(keyString);
        if(sAccGrp != null){
            sAccGrpList.remove(sAccGrp);
        }
    }

    public SAccChart getSAccChart(String accChartKeyString){
        for(SAccChart sAccChart : sAccChartList){
            if(sAccChart.getKeyString().equals(accChartKeyString)){
                return sAccChart;
            }
        }
        return null;
    }

    public void addSAccChart(SAccChart sAccChart){
        sAccChartList.add(sAccChart);
    }

    public SAccChart editSAccChart(SAccChart newSAccChart){
        for(SAccChart sAccChart : sAccChartList){
            if(sAccChart.getKeyString().equals(newSAccChart.getKeyString())){
                sAccChart.setAccGroupKeyString(newSAccChart.getAccGroupKeyString());
                sAccChart.setParentAccChartKeyString(
                        newSAccChart.getParentAccChartKeyString());
                sAccChart.setNo(newSAccChart.getNo());
                sAccChart.setName(newSAccChart.getName());
                sAccChart.setType(newSAccChart.getType());
                sAccChart.setLevel(newSAccChart.getLevel());
                return sAccChart;
            }
        }
        return null;
    }

    public void removeSAccChart(String keyString){
        for(SAccChart sAccChart : sAccChartList){
            if(sAccChart.getKeyString().equals(keyString)){
                sAccChartList.remove(sAccChart);
                break;
            }
        }
    }

    public void updateSAccChartAccGrpName(){
        for(SAccChart sAccChart : sAccChartList){
            updateSAccChartAccGrpName(sAccChart);
        }
    }

    public void updateSAccChartAccGrpName(SAccChart sAccChart){

        assert sAccChart != null;
        assert sAccGrpList != null && !sAccGrpList.isEmpty();

        // Try to update accGrpName
        SAccGrp sAccGrp = getSAccGrp(sAccChart.getAccGroupKeyString());
        if(sAccGrp != null){
            sAccChart.setAccGroupName(sAccGrp.getName());
        }
    }

    public void updateSAccChartParentAccChartNo(){
        for(SAccChart sAccChart : sAccChartList){
            updateSAccChartParentAccChartNo(sAccChart);
        }
    }

    public void updateSAccChartParentAccChartNo(SAccChart sAccChart){
        assert sAccChart != null;

        // Try to update parentAccChartNo
        if(sAccChart.getParentAccChartKeyString() != null){
            SAccChart parentSAccChart = getSAccChart(
                    sAccChart.getParentAccChartKeyString());
            sAccChart.setParentAccChartNo(parentSAccChart.getNo());
            sAccChart.setParentAccChartLevel(parentSAccChart.getLevel());
        }
    }

    public void sortSAccChartList(){
        ArrayList<SAccChart> sortedList = new ArrayList<SAccChart>();
        for(SAccGrp sAccGrp : sAccGrpList){
            genSortedSAccChartList(sortedList, sAccGrp.getKeyString(), null);
        }
        sAccChartList = sortedList;
    }

    private void genSortedSAccChartList(ArrayList<SAccChart> sortedList,
            String accGrpKeyString, String parentKeyString){
        ArrayList<SAccChart> sameParentList = getSAccChartList(accGrpKeyString, parentKeyString);
        for(SAccChart each : sameParentList){
            sortedList.add(each);
            genSortedSAccChartList(sortedList, accGrpKeyString, each.getKeyString());
        }
    }

    private ArrayList<SAccChart> getSAccChartList(String accGrpKeyString,
            String parentKeyString){
        ArrayList<SAccChart> sortedList = new ArrayList<SAccChart>();
        boolean didPut;
        for(SAccChart sAccChart : sAccChartList){
            if(sAccChart.getAccGroupKeyString().equals(accGrpKeyString)){
                if((sAccChart.getParentAccChartKeyString() == null &&
                        sAccChart.getParentAccChartKeyString() == parentKeyString) ||
                        (sAccChart.getParentAccChartKeyString() !=null &&
                        sAccChart.getParentAccChartKeyString().equals(parentKeyString))){
                    didPut = false;
                    for(int i=0; i<sortedList.size(); i++){
                        if(sAccChart.getNo().compareTo(sortedList.get(i).getNo()) < 0){
                            sortedList.add(i, sAccChart);
                            didPut = true;
                            break;
                        }
                    }
                    if(!didPut){
                        sortedList.add(sAccChart);
                    }
                }
            }
        }
        return sortedList;
    }

    public SFinHeader getSFinHeader(String finHeaderKeyString){
        for(SFinHeader sFinHeader : sFinHeaderList){
            if(sFinHeader.getKeyString().equals(finHeaderKeyString)){
                return sFinHeader;
            }
        }
        return null;
    }

    public void addSFinHeader(SFinHeader sFinHeader){
        sFinHeaderList.add(sFinHeader);
    }

    public SFinHeader editSFinHeader(SFinHeader newSFinHeader){
        for(SFinHeader sFinHeader : sFinHeaderList){
            if(sFinHeader.getKeyString().equals(newSFinHeader.getKeyString())){
                sFinHeader.setName(newSFinHeader.getName());
                return sFinHeader;
            }
        }
        return null;
    }

    public void removeSFinHeader(String keyString){
        for(SFinHeader sFinHeader : sFinHeaderList){
            if(sFinHeader.getKeyString().equals(keyString)){
                sFinHeaderList.remove(sFinHeader);
                break;
            }
        }
    }

    public void updateSFinItemAccChartNo() {
        for (SFinHeader sFinHeader : sFinHeaderList) {
            for (SFinItem sFinItem : sFinHeader.getSFinItemList()) {
                updateSFinItemAccChartNo(sFinItem);
            }
        }
    }

    public void updateSFinItemAccChartNo(SFinItem sFinItem) {
        assert sFinItem != null;

        // Try to find accChartNo
        if(sFinItem.getComm().equals(Comm.ACCNO) && sFinItem.getArg() != null) {
            SAccChart sAccChart = getSAccChart(sFinItem.getArg());
            if(sAccChart != null){
                sFinItem.setAccChartNo(sAccChart.getNo());
            }
        }
    }

    public void setJournals(SFiscalYear sFis){
        sJournalList.clear();
        for(SJournalHeader sJournal : sFis.getSJournalList()){
            addSJournal(sJournal);
        }
    }

    public SJournalHeader getSJournal(String journalKeyString){
        for(SJournalHeader sJournal : sJournalList){
            if(sJournal.getKeyString().equals(journalKeyString)){
                return sJournal;
            }
        }
        return null;
    }

    public void addSJournal(SJournalHeader newSJournal){
        // Sorting by inserting a new item into the correct order,
        // better in performance.
        boolean isPut = false;
        for (int i = 0; i < sJournalList.size(); i++) {
            SJournalHeader sJournal = sJournalList.get(i);
            if (sJournal.compareDate(newSJournal.getDay(), newSJournal.getMonth(),
                    newSJournal.getYear()) > 0) {
                sJournalList.add(i, newSJournal);
                isPut = true;
                break;
            }
        }
        if (!isPut) {
            sJournalList.add(newSJournal);
        }
    }

    public SJournalHeader editSJournal(SJournalHeader newSJournal){
        boolean isFound = false;
        for(SJournalHeader sJournal : sJournalList){
            if(sJournal.getKeyString().equals(newSJournal.getKeyString())){
                sJournalList.remove(sJournal);
                isFound = true;
                break;
            }
        }
        if (isFound) {
            addSJournal(newSJournal);
            return newSJournal;
        }
        return null;
    }

    public void removeSJournal(String keyString){
        for(SJournalHeader sJournal : sJournalList){
            if(sJournal.getKeyString().equals(keyString)){
                sJournalList.remove(sJournal);
                break;
            }
        }
    }

    public void updateSJournalJournalTypeShortName(){
        for (SJournalHeader sJournal : sJournalList) {
            updateSJournalJournalTypeShortName(sJournal);
        }
    }

    public void updateSJournalJournalTypeShortName(SJournalHeader sJournal){

        assert sJournal != null;

        // Try to update JournalTypeShortName
        SDocType sDocType = getSDocType(sJournal.getDocTypeKeyString());
        if(sDocType != null){
            SJournalType sJournalType = getSJournalType(sDocType.getJournalTypeKeyString());
            if(sJournalType != null){
                sJournal.setJournalTypeShortName(sJournalType.getShortName());
            }
        }
    }

    public void updateSJournalDocTypeCode(){
        for (SJournalHeader sJournal : sJournalList) {
            updateSJournalDocTypeCode(sJournal);
        }
    }

    public void updateSJournalDocTypeCode(SJournalHeader sJournal){

        assert sJournal != null;

        // Try to update DocTypeCode
        SDocType sDocType = getSDocType(sJournal.getDocTypeKeyString());
        if(sDocType != null){
            sJournal.setDocTypeCode(sDocType.getCode());
        }
    }

    public void updateSJournalItemAccChartNo(){
        for (SJournalHeader sJournal : sJournalList) {
            updateSJournalItemAccChartNo(sJournal);
        }
    }

    public void updateSJournalItemAccChartNo(SJournalHeader sJournal){

        assert sJournal != null;

        for (SJournalItem sJournalItem : sJournal.getItemList()) {
            // Try to update AccChartNo
            SAccChart sAccChart = getSAccChart(sJournalItem.getAccChartKeyString());
            if(sAccChart != null){
                sJournalItem.setAccChartNo(sAccChart.getNo());
            }
        }
    }
}


text: fn test_success() {}


text:
from abc import ABC, abstractmethod

class Tag:
    def __init__(self):
        self.id = None
        self.display_name = None
        self.synonyms = None


text:
const m = attract('core/models');

module.exports = {
  create: async (req, res, next) => {
    try {
      const user = await m.user.create(req.body);
      return res.render('users', user);
    } catch (error) {
      return next(error);
    }
  },

  read: async (req, res) => {
    if (req.params.user) {
      return res.send(await m.user.findById(req.params.user));
    }

    return res.render('users', {
      section: 'Users',
      users: await m.user.find({ 'meta.status': 'active' })
    });
  },

  delete: async (req, res, next) => {
    try {
      const user = await m.user.findById(req.params.user).exec();
      await user.remove();
      return res.status(200).end();
    } catch (error) {
      return next(error);
    }
  }
};


text:
package org.fakekoji.server;

/*

  To deploy, run:
  mvn clean install
  cd target

  java -cp ./fake-koji-...-jar-with-dependencies.jar:logging.jar  org.fakekoji.JavaServer /path/.properties

  where logging.jar is any logging implementation. Apache xmlrpc are happy with apache logging.

 */

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.fakekoji.api.http.rest.OToolService;
import org.fakekoji.core.AccessibleSettings;
import org.fakekoji.xmlrpc.server.JavaServerConstants;
import org.fakekoji.api.http.filehandling.FileDownloadService;
import org.fakekoji.api.xmlrpc.XmlRpcKojiService;
import org.fakekoji.api.ssh.ScpService;

public class JavaServer {

    private static final Logger LOGGER = Logger.getLogger(JavaServerConstants.FAKE_KOJI_LOGGER);

    public static final int DEFAULT_WEBAPP_PORT = 80;

    private final XmlRpcKojiService xmlRpcKojiService;
    private final FileDownloadService fileDownloadService;
    private final ScpService scpService;
    private final OToolService oToolService;

    public JavaServer(AccessibleSettings settings) {
        this(settings, null);
    }

    public JavaServer(AccessibleSettings settings, OToolService oToolService) {
        xmlRpcKojiService = new XmlRpcKojiService(settings);
        fileDownloadService = new FileDownloadService(settings.getDbFileRoot(), settings.getFileDownloadPort());
        scpService = new ScpService(settings);
        this.oToolService = oToolService;
    }

    public void start() throws Exception {
        /* koji xmlRpc server*/
        LOGGER.info("Attempting to start XML-RPC Server...");
        xmlRpcKojiService.start();
        LOGGER.info("Started successfully on " + xmlRpcKojiService.getPort());
        /* koji download server*/
        LOGGER.info("Starting http server to return files.");
        fileDownloadService.start();
        LOGGER.info("Started successfully on " + fileDownloadService.getPort());
        /* ssh server to upload files to fakekoji */
        LOGGER.info("Starting sshd server to accept files.");
        scpService.start();
        LOGGER.info("Sshd server started successfully on " + scpService.getPort());
        if (oToolService != null) {
            LOGGER.info("Starting Rest API service");
            oToolService.start();
            LOGGER.info("Rest API service started successfully on " + oToolService.getPort());
        }
    }

    public void stop() {
        try {
            scpService.stop();
        } catch (IOException ex) {
            Logger.getLogger(JavaServer.class.getName()).log(Level.SEVERE, null, ex);
        }
        fileDownloadService.stop();
        xmlRpcKojiService.stop();
        if (oToolService != null) {
            oToolService.stop();
        }
    }

    public static void main(String[] args) throws Exception {

        if (args.length != 1) {
            throw new RuntimeException("Expected path to properties file"); // TODO: add description of each property
        }

        final String propertyFilePath = args[0];
        final Properties props = new Properties();
        props.load(new FileInputStream(new File(propertyFilePath)));

        final int xmlRpcPort;
        final int sshPort;
        final int fileDownloadPort;
        final int webappPort;

        xmlRpcPort = getPort(props, Property.XML_RPC_PORT, JavaServerConstants.DFAULT_RP2C_PORT);
        fileDownloadPort = getPort(props, Property.FILE_DOWNLOAD_PORT, xmlRpcPort + 1);
        sshPort = getPort(props, Property.SSH_PORT, xmlRpcPort - 26);
        webappPort = getPort(props, Property.WEBAPP_PORT, DEFAULT_WEBAPP_PORT);

        final AccessibleSettings settings = new AccessibleSettings(
                getRoot(props, Property.BUILD_DB_ROOT),
                getRoot(props, Property.REPOS_ROOT),
                getRoot(props, Property.CONFIGS_ROOT),
                getRoot(props, Property.JENKINS_JOBS_ROOT),
                getRoot(props, Property.JENKINS_JOB_ARCHIVE_ROOT),
                getRoot(props, Property.SCRIPTS_ROOT),
                parseUrl(props, Property.JENKINS_URL),
                xmlRpcPort,
                fileDownloadPort,
                sshPort,
                webappPort,
                asList(props, Property.REPORT_EXEC_DEFAULTPARAMS.value),
                asList(props, Property.REPORT_EXEC_DEFAULTCHARTPARAM.value)
        );

        final OToolService oToolService = new OToolService(settings);

        new JavaServer(settings, oToolService).start();
    }

    private static List<String> asList(Properties props, String key) {
        String args = props.getProperty(key);
        if (args == null || args.trim().isEmpty()){
            return new ArrayList<>();
        }
        String[] split = args.trim().split("\\s+");
        return Collections.unmodifiableList(Arrays.asList(split));
    }

    private enum Property {
        XML_RPC_PORT("port.xml.rpc"),
        FILE_DOWNLOAD_PORT("port.file.download"),
        SSH_PORT("port.ssh"),
        JENKINS_URL("url.jenkins"),
        WEBAPP_PORT("port.webapp"),
        REPOS_ROOT("root.repos"),
        BUILD_DB_ROOT("root.build.db"),
        JENKINS_JOBS_ROOT("root.jenkins.jobs"),
        JENKINS_JOB_ARCHIVE_ROOT("root.jenkins.job.archive"),
        CONFIGS_ROOT("root.configs"),
        SCRIPTS_ROOT("root.scripts"),
        REPORT_EXEC_DEFAULTPARAMS("report.exec.defaultparams"),
        REPORT_EXEC_DEFAULTCHARTPARAM("Sreport.exec.defaultchartparams");

        private final String value;

        Property(final String value) {
            this.value = value;
        }
    }

    private static URL parseUrl(final Properties props, final Property prop) throws MalformedURLException {
        return new URL(props.getProperty(prop.value));
    }

    private static int getPort(Properties props, Property prop, int defaultProp) {
        return Integer.valueOf(props.getProperty(prop.value, String.valueOf(defaultProp)));
    }

    private static File getRoot(Properties props, Property prop) {
        final String rootPath = props.getProperty(prop.value);
        if (rootPath == null) {
            throw new RuntimeException("Property " + prop.value + " not set!\n");
        }
        final File root = new File(rootPath);
        if (!root.exists()) {
            throw new RuntimeException("File " + root.getAbsolutePath() + " does not exist!\n");
        }
        if (!root.isDirectory()) {
            throw new RuntimeException(prop.value + " must be a directory!\n");
        }
        return root;
    }
}


text:
import * as Sequelize from 'sequelize';
import { Sequelize as SequelizeInterface } from 'sequelize';
import { ModelsInterface } from '../models';
import { GroupUserInstance } from "./group-user";

export interface UserAttribute {
  id: string;
  created_at?: Date;
  updated_at?: Date;
  deleted_at?: Date;
  first_name: string;
  last_name: string;
  username: string;
  language_code: string;
  team_id: number;
  illegal_click_count: number;
  GroupUser?: GroupUserInstance;
}

export interface UserInstance extends Sequelize.Instance<UserAttribute>, UserAttribute {
  GroupUser?: GroupUserInstance;
}

export interface UserModel extends Sequelize.Model<UserInstance, UserAttribute> {
}

export function defineUser<UserInstance, UserAttribute>(sequelize: SequelizeInterface) {
  const User = sequelize.define('User', {
    id: { type: Sequelize.BIGINT, primaryKey: true },
    created_at: { type: Sequelize.DATE, defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'), allowNull: false },
    updated_at: { type: Sequelize.DATE },
    deleted_at: { type: Sequelize.DATE },
    first_name: { type: Sequelize.STRING(50) },
    last_name: { type: Sequelize.STRING(50) },
    username: { type: Sequelize.STRING(50), unique: true },
    language_code: { type: Sequelize.STRING(50) },
    team_id: { type: Sequelize.INTEGER },
    illegal_click_count: { type: Sequelize.INTEGER, defaultValue: 0 }
  }, {
    tableName: 'users',
    timestamps: true,
    paranoid: true,
    underscored: true,
    classMethods: {
      associate: (models: ModelsInterface) => {
      }
    }
  });
  return User;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<migration name="Add spinacia oleracea varieties">
  <item-creation item="varieties#spinacia_oleracea_el_grinta" parent="spinacia_oleracea" itis_tsn="20709"/>
  <item-creation item="varieties#spinacia_oleracea_rocoon" parent="spinacia_oleracea" itis_tsn="20709"/>
</migration>


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis.CSharp.Emit;
using Microsoft.CodeAnalysis.Symbols;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.CSharp.Symbols
{
    /// <summary>
    /// Represents a field in a class, struct or enum
    /// </summary>
    internal abstract partial class FieldSymbol : Symbol, IFieldSymbolInternal
    {
        // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        // Changes to the public interface of this class should remain synchronized with the VB version.
        // Do not make any changes to the public interface without making the corresponding change
        // to the VB version.
        // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

        internal FieldSymbol()
        {
        }

        /// <summary>
        /// The original definition of this symbol. If this symbol is constructed from another
        /// symbol by type substitution then OriginalDefinition gets the original symbol as it was defined in
        /// source or metadata.
        /// </summary>
        public new virtual FieldSymbol OriginalDefinition
        {
            get
            {
                return this;
            }
        }

        protected override sealed Symbol OriginalSymbolDefinition
        {
            get
            {
                return this.OriginalDefinition;
            }
        }

        /// <summary>
        /// Gets the type of this field along with its annotations.
        /// </summary>
        public TypeWithAnnotations TypeWithAnnotations
        {
            get
            {
                return GetFieldType(ConsList<FieldSymbol>.Empty);
            }
        }

        public abstract FlowAnalysisAnnotations FlowAnalysisAnnotations { get; }

        /// <summary>
        /// Gets the type of this field.
        /// </summary>
        public TypeSymbol Type => TypeWithAnnotations.Type;

        internal abstract TypeWithAnnotations GetFieldType(ConsList<FieldSymbol> fieldsBeingBound);

        /// <summary>
        /// If this field serves as a backing variable for an automatically generated
        /// property or a field-like event, returns that
        /// property/event. Otherwise returns null.
        /// Note, the set of possible associated symbols might be expanded in the future to
        /// reflect changes in the languages.
        /// </summary>
        public abstract Symbol AssociatedSymbol { get; }

        /// <summary>
        /// Returns true if this field was declared as "readonly".
        /// </summary>
        public abstract bool IsReadOnly { get; }

        /// <summary>
        /// Returns true if this field was declared as "volatile".
        /// </summary>
        public abstract bool IsVolatile { get; }

        /// <summary>
        /// Returns true if this symbol requires an instance reference as the implicit receiver. This is false if the symbol is static.
        /// </summary>
        public virtual bool RequiresInstanceReceiver => !IsStatic;

        /// <summary>
        /// Returns true if this field was declared as "fixed".
        /// Note that for a fixed-size buffer declaration, this.Type will be a pointer type, of which
        /// the pointed-to type will be the declared element type of the fixed-size buffer.
        /// </summary>
        public virtual bool IsFixedSizeBuffer { get { return false; } }

        /// <summary>
        /// If IsFixedSizeBuffer is true, the value between brackets in the fixed-size-buffer declaration.
        /// If IsFixedSizeBuffer is false FixedSize is 0.
        /// Note that for fixed-a size buffer declaration, this.Type will be a pointer type, of which
        /// the pointed-to type will be the declared element type of the fixed-size buffer.
        /// </summary>
        public virtual int FixedSize { get { return 0; } }

        /// <summary>
        /// If this.IsFixedSizeBuffer is true, returns the underlying implementation type for the
        /// fixed-size buffer when emitted.  Otherwise returns null.
        /// </summary>
        internal virtual NamedTypeSymbol FixedImplementationType(PEModuleBuilder emitModule)
        {
            return null;
        }

        /// <summary>
        /// Returns true when field is a backing field for a captured frame pointer (typically "this").
        /// </summary>
        internal virtual bool IsCapturedFrame { get { return false; } }

        /// <summary>
        /// Returns true if this field was declared as "const" (i.e. is a constant declaration).
        /// Also returns true for an enum member.
        /// </summary>
        public abstract bool IsConst { get; }

        // Gets a value indicating whether this instance is metadata constant. A constant field is considered to be
        // metadata constant unless they are of type decimal, because decimals are not regarded as constant by the CLR.
        public bool IsMetadataConstant
        {
            get { return this.IsConst && (this.Type.SpecialType != SpecialType.System_Decimal); }
        }

        /// <summary>
        /// Returns false if the field wasn't declared as "const", or constant value was omitted or erroneous.
        /// True otherwise.
        /// </summary>
        public virtual bool HasConstantValue
        {
            get
            {
                if (!IsConst)
                {
                    return false;
                }

                ConstantValue constantValue = GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false);
                return constantValue != null && !constantValue.IsBad; //can be null in error scenarios
            }
        }

        /// <summary>
        /// If IsConst returns true, then returns the constant value of the field or enum member. If IsConst returns
        /// false, then returns null.
        /// </summary>
        public virtual object ConstantValue
        {
            get
            {
                if (!IsConst)
                {
                    return null;
                }

                ConstantValue constantValue = GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false);
                return constantValue == null ? null : constantValue.Value; //can be null in error scenarios
            }
        }

        internal abstract ConstantValue GetConstantValue(ConstantFieldsInProgress inProgress, bool earlyDecodingWellKnownAttributes);

        /// <summary>
        /// Gets the kind of this symbol.
        /// </summary>
        public sealed override SymbolKind Kind
        {
            get
            {
                return SymbolKind.Field;
            }
        }

        internal override TResult Accept<TArgument, TResult>(CSharpSymbolVisitor<TArgument, TResult> visitor, TArgument argument)
        {
            return visitor.VisitField(this, argument);
        }

        public override void Accept(CSharpSymbolVisitor visitor)
        {
            visitor.VisitField(this);
        }

        public override TResult Accept<TResult>(CSharpSymbolVisitor<TResult> visitor)
        {
            return visitor.VisitField(this);
        }

        /// <summary>
        /// Returns false because field can't be abstract.
        /// </summary>
        public sealed override bool IsAbstract
        {
            get
            {
                return false;
            }
        }

        /// <summary>
        /// Returns false because field can't be defined externally.
        /// </summary>
        public sealed override bool IsExtern
        {
            get
            {
                return false;
            }
        }

        /// <summary>
        /// Returns false because field can't be overridden.
        /// </summary>
        public sealed override bool IsOverride
        {
            get
            {
                return false;
            }
        }

        /// <summary>
        /// Returns false because field can't be sealed.
        /// </summary>
        public sealed override bool IsSealed
        {
            get
            {
                return false;
            }
        }

        /// <summary>
        /// Returns false because field can't be virtual.
        /// </summary>
        public sealed override bool IsVirtual
        {
            get
            {
                return false;
            }
        }

        /// <summary>
        /// True if this symbol has a special name (metadata flag SpecialName is set).
        /// </summary>
        internal abstract bool HasSpecialName { get; }

        /// <summary>
        /// True if this symbol has a runtime-special name (metadata flag RuntimeSpecialName is set).
        /// </summary>
        internal abstract bool HasRuntimeSpecialName { get; }

        /// <summary>
        /// True if this field is not serialized (metadata flag NotSerialized is set).
        /// </summary>
        internal abstract bool IsNotSerialized { get; }

        /// <summary>
        /// True if this field has a pointer type.
        /// </summary>
        /// <remarks>
        /// By default we defer to this.Type.IsPointerType()
        /// However in some cases this may cause circular dependency via binding a
        /// pointer that points to the type that contains the current field.
        /// Fortunately in those cases we do not need to force binding of the field's type
        /// and can just check the declaration syntax if the field type is not yet known.
        /// </remarks>
        internal virtual bool HasPointerType
        {
            get
            {
                return this.Type.IsPointerType();
            }
        }

        /// <summary>
        /// Describes how the field is marshalled when passed to native code.
        /// Null if no specific marshalling information is available for the field.
        /// </summary>
        /// <remarks>PE symbols don't provide this information and always return null.</remarks>
        internal abstract MarshalPseudoCustomAttributeData MarshallingInformation { get; }

        /// <summary>
        /// Returns the marshalling type of this field, or 0 if marshalling information isn't available.
        /// </summary>
        /// <remarks>
        /// By default this information is extracted from <see cref="MarshallingInformation"/> if available.
        /// Since the compiler does only need to know the marshalling type of symbols that aren't emitted
        /// PE symbols just decode the type from metadata and don't provide full marshalling information.
        /// </remarks>
        internal virtual UnmanagedType MarshallingType
        {
            get
            {
                var info = MarshallingInformation;
                return info != null ? info.UnmanagedType : 0;
            }
        }

        /// <summary>
        /// Offset assigned to the field when the containing type is laid out by the VM.
        /// Null if unspecified.
        /// </summary>
        internal abstract int? TypeLayoutOffset { get; }

        internal virtual FieldSymbol AsMember(NamedTypeSymbol newOwner)
        {
            Debug.Assert(this.IsDefinition);
            Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol.OriginalDefinition));
            return newOwner.IsDefinition ? this : new SubstitutedFieldSymbol(newOwner as SubstitutedNamedTypeSymbol, this);
        }

        #region Use-Site Diagnostics

        internal override DiagnosticInfo GetUseSiteDiagnostic()
        {
            if (this.IsDefinition)
            {
                return base.GetUseSiteDiagnostic();
            }

            return this.OriginalDefinition.GetUseSiteDiagnostic();
        }

        internal bool CalculateUseSiteDiagnostic(ref DiagnosticInfo result)
        {
            Debug.Assert(IsDefinition);

            // Check type, custom modifiers
            if (DeriveUseSiteDiagnosticFromType(ref result, this.TypeWithAnnotations))
            {
                return true;
            }

            // If the member is in an assembly with unified references,
            // we check if its definition depends on a type from a unified reference.
            if (this.ContainingModule.HasUnifiedReferences)
            {
                HashSet<TypeSymbol> unificationCheckedTypes = null;
                if (this.TypeWithAnnotations.GetUnificationUseSiteDiagnosticRecursive(ref result, this, ref unificationCheckedTypes))
                {
                    return true;
                }
            }

            return false;
        }

        /// <summary>
        /// Return error code that has highest priority while calculating use site error for this symbol.
        /// </summary>
        protected override int HighestPriorityUseSiteError
        {
            get
            {
                return (int)ErrorCode.ERR_BindToBogus;
            }
        }

        public sealed override bool HasUnsupportedMetadata
        {
            get
            {
                DiagnosticInfo info = GetUseSiteDiagnostic();
                return (object)info != null && info.Code == (int)ErrorCode.ERR_BindToBogus;
            }
        }

        #endregion

        /// <summary>
        /// Returns True when field symbol is not mapped directly to a field in the underlying tuple struct.
        /// </summary>
        public virtual bool IsVirtualTupleField
        {
            get
            {
                return false;
            }
        }

        /// <summary>
        /// Returns true if this is a field representing a Default element like Item1, Item2...
        /// </summary>
        public virtual bool IsDefaultTupleElement
        {
            get
            {
                return false;
            }
        }

        /// <summary>
        /// If this is a field of a tuple type, return corresponding underlying field from the
        /// tuple underlying type. Otherwise, null. In case of a malformed underlying type
        /// the corresponding underlying field might be missing, return null in this case too.
        /// </summary>
        public virtual FieldSymbol TupleUnderlyingField
        {
            get
            {
                return ContainingType.IsTupleType ? this : null;
            }
        }

        /// <summary>
        /// If this field represents a tuple element, returns a corresponding default element field.
        /// Otherwise returns null.
        /// </summary>
        public virtual FieldSymbol CorrespondingTupleField
        {
            get
            {
                return null;
            }
        }

        /// <summary>
        /// Returns true if a given field is a tuple element
        /// </summary>
        internal bool IsTupleElement()
        {
            return this.CorrespondingTupleField is object;
        }

        /// <summary>
        /// If this is a field representing a tuple element,
        /// returns the index of the element (zero-based).
        /// Otherwise returns -1
        /// </summary>
        public virtual int TupleElementIndex
        {
            get
            {
                return -1;
            }
        }

        bool IFieldSymbolInternal.IsVolatile => this.IsVolatile;

        protected override ISymbol CreateISymbol()
        {
            return new PublicModel.FieldSymbol(this);
        }

        public override bool Equals(Symbol other, TypeCompareKind compareKind)
        {
            if (other is SubstitutedFieldSymbol sfs)
            {
                return sfs.Equals(this, compareKind);
            }

            return base.Equals(other, compareKind);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}


text:
package org.phenoscape.scowl.ofn

import org.semanticweb.owlapi.apibinding.OWLManager
import org.semanticweb.owlapi.model._

import scala.jdk.CollectionConverters._

trait PropertyAxioms {

  private val factory = OWLManager.getOWLDataFactory

  object SubObjectPropertyOf {

    def apply(annotations: Set[OWLAnnotation], subProperty: OWLObjectPropertyExpression, superProperty: OWLObjectPropertyExpression): OWLSubObjectPropertyOfAxiom =
      factory.getOWLSubObjectPropertyOfAxiom(subProperty, superProperty, annotations.asJava)

    def apply(subProperty: OWLObjectPropertyExpression, superProperty: OWLObjectPropertyExpression): OWLSubObjectPropertyOfAxiom =
      apply(Set.empty, subProperty, superProperty)

    def unapply(axiom: OWLSubObjectPropertyOfAxiom): Option[(Set[OWLAnnotation], OWLObjectPropertyExpression, OWLObjectPropertyExpression)] =
      Option(axiom.getAnnotations.asScala.toSet, axiom.getSubProperty, axiom.getSuperProperty)

  }

  object SubObjectPropertyChainOf {

    def apply(annotations: Set[OWLAnnotation], subPropertyChain: List[OWLObjectPropertyExpression], superProperty: OWLObjectPropertyExpression): OWLSubPropertyChainOfAxiom =
      factory.getOWLSubPropertyChainOfAxiom(subPropertyChain.asJava, superProperty, annotations.asJava)

    def apply(subPropertyChain: List[OWLObjectPropertyExpression], superProperty: OWLObjectPropertyExpression): OWLSubPropertyChainOfAxiom =
      apply(Set.empty, subPropertyChain, superProperty)

    def unapply(axiom: OWLSubPropertyChainOfAxiom): Option[(Set[OWLAnnotation], List[OWLObjectPropertyExpression], OWLObjectPropertyExpression)] =
      Option(axiom.getAnnotations.asScala.toSet, axiom.getPropertyChain.asScala.toList, axiom.getSuperProperty)

  }

  object SubDataPropertyOf {

    def apply(annotations: Set[OWLAnnotation], subProperty: OWLDataPropertyExpression, superProperty: OWLDataPropertyExpression): OWLSubDataPropertyOfAxiom =
      factory.getOWLSubDataPropertyOfAxiom(subProperty, superProperty, annotations.asJava)

    def apply(subProperty: OWLDataPropertyExpression, superProperty: OWLDataPropertyExpression): OWLSubDataPropertyOfAxiom =
      apply(Set.empty, subProperty, superProperty)

    def unapply(axiom: OWLSubDataPropertyOfAxiom): Option[(Set[OWLAnnotation], OWLDataPropertyExpression, OWLDataPropertyExpression)] =
      Option(axiom.getAnnotations.asScala.toSet, axiom.getSubProperty, axiom.getSuperProperty)

  }

  object EquivalentObjectProperties {

    def apply(annotations: Set[OWLAnnotation], propertyExpressions: Set[OWLObjectPropertyExpression]): OWLEquivalentObjectPropertiesAxiom =
      factory.getOWLEquivalentObjectPropertiesAxiom(propertyExpressions.asJava, annotations.asJava)

    def apply(properties: OWLObjectPropertyExpression*): OWLEquivalentObjectPropertiesAxiom =
      apply(Set.empty[OWLAnnotation], properties.toSet)

    def apply(properties: Set[OWLObjectPropertyExpression]): OWLEquivalentObjectPropertiesAxiom =
      apply(Set.empty[OWLAnnotation], properties)

    def apply(annotations: OWLAnnotation*)(properties: OWLObjectPropertyExpression*): OWLEquivalentObjectPropertiesAxiom =
      apply(annotations.toSet, properties.toSet)

    def unapply(axiom: OWLEquivalentObjectPropertiesAxiom): Option[(Set[OWLAnnotation], Set[OWLObjectPropertyExpression])] =
      Option(axiom.getAnnotations.asScala.toSet, axiom.getProperties.asScala.toSet)

  }

  object EquivalentDataProperties {

    def apply(annotations: Set[OWLAnnotation], propertyExpressions: Set[OWLDataPropertyExpression]): OWLEquivalentDataPropertiesAxiom =
      factory.getOWLEquivalentDataPropertiesAxiom(propertyExpressions.asJava, annotations.asJava)

    def apply(properties: OWLDataPropertyExpression*): OWLEquivalentDataPropertiesAxiom =
      apply(Set.empty[OWLAnnotation], properties.toSet)

    def apply(properties: Set[OWLDataPropertyExpression]): OWLEquivalentDataPropertiesAxiom =
      apply(Set.empty[OWLAnnotation], properties)

    def apply(annotations: OWLAnnotation*)(properties: OWLDataPropertyExpression*): OWLEquivalentDataPropertiesAxiom =
      apply(annotations.toSet, properties.toSet)

    def unapply(axiom: OWLEquivalentDataPropertiesAxiom): Option[(Set[OWLAnnotation], Set[OWLDataPropertyExpression])] =
      Option(axiom.getAnnotations.asScala.toSet, axiom.getProperties.asScala.toSet)

  }

  object ObjectPropertyDomain {

    def apply(annotations: Set[OWLAnnotation], property: OWLObjectPropertyExpression, domain: OWLClassExpression): OWLObjectPropertyDomainAxiom =
      factory.getOWLObjectPropertyDomainAxiom(property, domain, annotations.asJava)

    def apply(property: OWLObjectPropertyExpression, domain: OWLClassExpression): OWLObjectPropertyDomainAxiom =
      apply(Set.empty, property, domain)

    def unapply(axiom: OWLObjectPropertyDomainAxiom): Option[(Set[OWLAnnotation], OWLObjectPropertyExpression, OWLClassExpression)] =
      Option(axiom.getAnnotations.asScala.toSet, axiom.getProperty, axiom.getDomain)

  }

  object ObjectPropertyRange {

    def apply(annotations: Set[OWLAnnotation], property: OWLObjectPropertyExpression, domain: OWLClassExpression): OWLObjectPropertyRangeAxiom =
      factory.getOWLObjectPropertyRangeAxiom(property, domain, annotations.asJava)

    def apply(property: OWLObjectPropertyExpression, domain: OWLClassExpression): OWLObjectPropertyRangeAxiom =
      apply(Set.empty, property, domain)

    def unapply(axiom: OWLObjectPropertyRangeAxiom): Option[(Set[OWLAnnotation], OWLObjectPropertyExpression, OWLClassExpression)] =
      Option(axiom.getAnnotations.asScala.toSet, axiom.getProperty, axiom.getRange)

  }

  object DataPropertyDomain {

    def apply(annotations: Set[OWLAnnotation], property: OWLDataPropertyExpression, domain: OWLClassExpression): OWLDataPropertyDomainAxiom =
      factory.getOWLDataPropertyDomainAxiom(property, domain, annotations.asJava)

    def apply(property: OWLDataPropertyExpression, domain: OWLClassExpression): OWLDataPropertyDomainAxiom =
      apply(Set.empty, property, domain)

    def unapply(axiom: OWLDataPropertyDomainAxiom): Option[(Set[OWLAnnotation], OWLDataPropertyExpression, OWLClassExpression)] =
      Option(axiom.getAnnotations.asScala.toSet, axiom.getProperty, axiom.getDomain)

  }

  object DataPropertyRange {

    def apply(annotations: Set[OWLAnnotation], property: OWLDataPropertyExpression, range: OWLDataRange): OWLDataPropertyRangeAxiom =
      factory.getOWLDataPropertyRangeAxiom(property, range, annotations.asJava)

    def apply(property: OWLDataPropertyExpression, range: OWLDataRange): OWLDataPropertyRangeAxiom =
      apply(Set.empty, property, range)

    def unapply(axiom: OWLDataPropertyRangeAxiom): Option[(Set[OWLAnnotation], OWLDataPropertyExpression, OWLDataRange)] =
      Option(axiom.getAnnotations.asScala.toSet, axiom.getProperty, axiom.getRange)

  }

  object InverseObjectProperties {

    def apply(annotations: Set[OWLAnnotation], property1: OWLObjectPropertyExpression, property2: OWLObjectPropertyExpression): OWLInverseObjectPropertiesAxiom =
      factory.getOWLInverseObjectPropertiesAxiom(property1, property2, annotations.asJava)

    def apply(property1: OWLObjectPropertyExpression, property2: OWLObjectPropertyExpression): OWLInverseObjectPropertiesAxiom =
      apply(Set.empty, property1, property2)

    def unapply(axiom: OWLInverseObjectPropertiesAxiom): Option[(Set[OWLAnnotation], OWLObjectPropertyExpression, OWLObjectPropertyExpression)] =
      Option(axiom.getAnnotations.asScala.toSet, axiom.getFirstProperty, axiom.getSecondProperty)

  }

  object DisjointObjectProperties {

    def apply(annotations: Set[OWLAnnotation], properties: Set[OWLObjectPropertyExpression]): OWLDisjointObjectPropertiesAxiom =
      factory.getOWLDisjointObjectPropertiesAxiom(properties.asJava, annotations.asJava)

    def apply(properties: OWLObjectPropertyExpression*): OWLDisjointObjectPropertiesAxiom =
      apply(Set.empty[OWLAnnotation], properties.toSet)

    def apply(properties: Set[OWLObjectPropertyExpression]): OWLDisjointObjectPropertiesAxiom =
      apply(Set.empty[OWLAnnotation], properties)

    def apply(annotations: OWLAnnotation*)(properties: OWLObjectPropertyExpression*): OWLDisjointObjectPropertiesAxiom =
      apply(annotations.toSet, properties.toSet)

    def unapply(axiom: OWLDisjointObjectPropertiesAxiom): Option[(Set[OWLAnnotation], Set[OWLObjectPropertyExpression])] =
      Option(axiom.getAnnotations.asScala.toSet, axiom.getProperties.asScala.toSet)

  }

  object DisjointDataProperties {

    def apply(annotations: Set[OWLAnnotation], properties: Set[OWLDataPropertyExpression]): OWLDisjointDataPropertiesAxiom =
      factory.getOWLDisjointDataPropertiesAxiom(properties.asJava, annotations.asJava)

    def apply(properties: OWLDataPropertyExpression*): OWLDisjointDataPropertiesAxiom =
      apply(Set.empty[OWLAnnotation], properties.toSet)

    def apply(properties: Set[OWLDataPropertyExpression]): OWLDisjointDataPropertiesAxiom =
      apply(Set.empty[OWLAnnotation], properties)

    def apply(annotations: OWLAnnotation*)(properties: OWLDataPropertyExpression*): OWLDisjointDataPropertiesAxiom =
      apply(annotations.toSet, properties.toSet)

    def unapply(axiom: OWLDisjointDataPropertiesAxiom): Option[(Set[OWLAnnotation], Set[OWLDataPropertyExpression])] =
      Option(axiom.getAnnotations.asScala.toSet, axiom.getProperties.asScala.toSet)

  }

  object SymmetricObjectProperty extends UnaryObjectPropertyAxiom[OWLSymmetricObjectPropertyAxiom, OWLObjectPropertyExpression] {

    val constructor = (pe: OWLObjectPropertyExpression, annotations: Set[OWLAnnotation]) =>
      factory.getOWLSymmetricObjectPropertyAxiom(pe, annotations.asJava)

  }

  object AsymmetricObjectProperty extends UnaryObjectPropertyAxiom[OWLAsymmetricObjectPropertyAxiom, OWLObjectPropertyExpression] {

    val constructor = (pe: OWLObjectPropertyExpression, annotations: Set[OWLAnnotation]) =>
      factory.getOWLAsymmetricObjectPropertyAxiom(pe, annotations.asJava)

  }

  object ReflexiveObjectProperty extends UnaryObjectPropertyAxiom[OWLReflexiveObjectPropertyAxiom, OWLObjectPropertyExpression] {

    val constructor = (pe: OWLObjectPropertyExpression, annotations: Set[OWLAnnotation]) =>
      factory.getOWLReflexiveObjectPropertyAxiom(pe, annotations.asJava)

  }

  object IrreflexiveObjectProperty extends UnaryObjectPropertyAxiom[OWLIrreflexiveObjectPropertyAxiom, OWLObjectPropertyExpression] {

    val constructor = (pe: OWLObjectPropertyExpression, annotations: Set[OWLAnnotation]) =>
      factory.getOWLIrreflexiveObjectPropertyAxiom(pe, annotations.asJava)

  }

  object FunctionalObjectProperty extends UnaryObjectPropertyAxiom[OWLFunctionalObjectPropertyAxiom, OWLObjectPropertyExpression] {

    val constructor = (pe: OWLObjectPropertyExpression, annotations: Set[OWLAnnotation]) =>
      factory.getOWLFunctionalObjectPropertyAxiom(pe, annotations.asJava)

  }

  object FunctionalDataProperty extends UnaryObjectPropertyAxiom[OWLFunctionalDataPropertyAxiom, OWLDataPropertyExpression] {

    val constructor = (pe: OWLDataPropertyExpression, annotations: Set[OWLAnnotation]) =>
      factory.getOWLFunctionalDataPropertyAxiom(pe, annotations.asJava)

  }

  object InverseFunctionalObjectProperty extends UnaryObjectPropertyAxiom[OWLInverseFunctionalObjectPropertyAxiom, OWLObjectPropertyExpression] {

    val constructor = (pe: OWLObjectPropertyExpression, annotations: Set[OWLAnnotation]) =>
      factory.getOWLInverseFunctionalObjectPropertyAxiom(pe, annotations.asJava)

  }

  object TransitiveObjectProperty extends UnaryObjectPropertyAxiom[OWLTransitiveObjectPropertyAxiom, OWLObjectPropertyExpression] {

    val constructor = (pe: OWLObjectPropertyExpression, annotations: Set[OWLAnnotation]) =>
      factory.getOWLTransitiveObjectPropertyAxiom(pe, annotations.asJava)

  }

}

trait UnaryObjectPropertyAxiom[T <: OWLUnaryPropertyAxiom[P], P <: OWLPropertyExpression] {

  def constructor: (P, Set[OWLAnnotation]) => T

  def apply(annotations: Set[OWLAnnotation], property: P): T = constructor(property, annotations)

  def apply(property: P): T = apply(Set.empty, property)

  def unapply(axiom: T): Option[(Set[OWLAnnotation], P)] =
    Option(axiom.getAnnotations.asScala.toSet, axiom.getProperty)
}


text:
package scratchobfuscator;

import java.io.File;

import org.junit.jupiter.api.Test;
import scratchobfuscator.ProgramOptions.ParseException;

import static org.junit.jupiter.api.Assertions.*;

public class ProgramOptionsTest
{
    private static final String RESOURCES_FOLDER = "./src/test/resources/";
    private static final String INPUT_EMPTY = RESOURCES_FOLDER + "input-empty.sb";
    private static final String INPUT_NONEXISTENT = RESOURCES_FOLDER + "input-does-not-exist.sb";
    private static final String OUTPUT_EMPTY = RESOURCES_FOLDER + "output-empty.sb";

    @Test
    public void resolvesAbsoluteFiles()
    {
        final File in = new File(INPUT_EMPTY);
        final File out = new File(OUTPUT_EMPTY);

        assertFalse(in.isAbsolute());
        assertFalse(out.isAbsolute());

        final ProgramOptions opts = new ProgramOptions(in, out);

        assertTrue(opts.getInputFile().isAbsolute());
        assertTrue(opts.getOutputFile().isAbsolute());
    }

    @Test
    public void parsesInputAndOutputPaths() throws ParseException
    {
        final ProgramOptions opts = ProgramOptions.parse(new String[] { INPUT_EMPTY, OUTPUT_EMPTY });

        assertEquals(new File(INPUT_EMPTY).getAbsoluteFile(), opts.getInputFile());
        assertEquals(new File(OUTPUT_EMPTY).getAbsoluteFile(), opts.getOutputFile());
    }

    @Test
    public void throwsWhenParseMissesOptions()
    {
        assertThrows(ParseException.class,
                () -> ProgramOptions.parse(new String[] { INPUT_EMPTY }));
    }

    @Test
    public void throwsWhenInputNotFound()
    {
        assertThrows(ParseException.class,
                () -> ProgramOptions.parse(new String[] {INPUT_NONEXISTENT, OUTPUT_EMPTY }));
    }

    @Test
    public void throwsWhenInputIsDirectory()
    {
        assertThrows(ParseException.class,
                () -> ProgramOptions.parse(new String[] { RESOURCES_FOLDER, OUTPUT_EMPTY }));
    }

    @Test
    public void throwsWhenOutputIsDirectory()
    {
        assertThrows(ParseException.class,
                () -> ProgramOptions.parse(new String[] { INPUT_EMPTY, RESOURCES_FOLDER }));
    }
}


text:
<?php

use yii\db\Migration;

class m170120_132543_create_table_news extends Migration
{
    public function up()
    {
        $sql = <<<SQL
CREATE TABLE `news` (
  `id` INT NOT NULL AUTO_INCREMENT COMMENT '',
  `display_name` VARCHAR(100)  COMMENT '',
  `short_description` TEXT COMMENT '',
  `description` TEXT COMMENT '',
  `content` TEXT COMMENT '',
  `image` VARCHAR(500) COMMENT '',
  `type` INT NULL COMMENT '',
  `created_at` INT COMMENT '',
  `updated_at` INT COMMENT '',
  `status` INT COMMENT '',
  `updated_by` INT COMMENT '',
PRIMARY KEY (`id`)  COMMENT '')
ENGINE = InnoDB CHARACTER SET = UTF8
COMMENT = 'create table news'
SQL;
        $this->execute($sql);
    }

    public function down()
    {
        echo "m170120_132543_create_table_news cannot be reverted.\n";

        return false;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}


text:
import numpy as np

import tvm
from tvm.contrib import graph_runtime

import nnvm.symbol as sym
import nnvm.compiler
from nnvm.testing.config import ctx_list

def test_update():
    w = sym.Variable("w")
    w2 = sym.Variable("w2")
    w = sym._assign(w, w + 1)
    w2 = sym._assign(w2, w + 1)

    dshape = (5, 3, 18, 18)
    shape_dict = {"w": dshape, "w2":dshape}
    dtype = "float32"

    def check(target, ctx):
        graph, lib, _ = nnvm.compiler.build(w2, target, shape_dict)

        m = graph_runtime.create(graph, lib, ctx)

        data = tvm.nd.array(np.random.uniform(size=dshape).astype(dtype))
        m.set_input("w", data)
        m.run()
        out = m.get_input("w2", tvm.nd.empty(dshape, dtype))
        np.testing.assert_allclose(out.asnumpy(), data.asnumpy() + 2, rtol=1e-5)

        m.run()
        out = m.get_input("w2", tvm.nd.empty(dshape, dtype))
        np.testing.assert_allclose(out.asnumpy(), data.asnumpy() + 3, rtol=1e-5)

    for target, ctx in ctx_list():
        check(target, ctx)

if __name__ == "__main__":
    test_update()


text:
package org.apache.pinot.controller.helix.core.realtime.segment;

import javax.annotation.Nullable;
import org.apache.pinot.common.metadata.segment.LLCRealtimeSegmentZKMetadata;
import org.apache.pinot.spi.stream.PartitionLevelStreamConfig;

/**
 * Interface for the flush threshold updating strategies
 * These implementations are responsible for updating the flush threshold (rows/time) for the given segment ZK metadata
 */
public interface FlushThresholdUpdater {

  /**
   * Updates the flush threshold for the given segment ZK metadata
   */
  void updateFlushThreshold(PartitionLevelStreamConfig streamConfig, LLCRealtimeSegmentZKMetadata newSegmentZKMetadata,
      CommittingSegmentDescriptor committingSegmentDescriptor,
      @Nullable LLCRealtimeSegmentZKMetadata committingSegmentZKMetadata, int maxNumPartitionsPerInstance);
}


text:
from argh import arg
from argh.exceptions import CommandError

import ast
import pnc_cli.common as common
import pnc_cli.cli_types as types
from pnc_cli import swagger_client
from pnc_cli import utils
from pnc_cli.pnc_api import pnc_api

import sys

def create_build_conf_object(**kwargs):
    created_build_configuration = swagger_client.BuildConfigurationRest()
    for key, value in kwargs.items():
        setattr(created_build_configuration, str(key), value)
    return created_build_configuration

def get_build_configuration_id_by_name(name):
    """
    Returns the id of the build configuration matching name
    :param name: name of build configuration
    :return: id of the matching build configuration, or None if no match found
    """
    response = utils.checked_api_call(pnc_api.build_configs, 'get_all', q='name==' + name).content
    if not response:
        return None
    return response[0].id

def get_build_configuration_by_name(name):
    """
    Returns the build configuration matching the name
    :param name: name of build configuration
    :return: The matching build configuration, or None if no match found
    """
    response = utils.checked_api_call(pnc_api.build_configs, 'get_all', q='name==' + name).content
    if not response:
        return None
    return response[0]

def config_id_exists(search_id):
    """
    Test if a build configuration matching search_id exists
    :param search_id: id to test for
    :return: True if a build configuration with search_id exists, False otherwise
    """
    response = utils.checked_api_call(pnc_api.build_configs, 'get_specific', id=search_id)
    if not response:
        return False
    return True

@arg("-i", "--id", help="ID of the BuildConfiguration to trigger.", type=types.existing_bc_id)
@arg("-n", "--name", help="Name of the BuildConfiguration to trigger.", type=types.existing_bc_name)
@arg("-rev", "--revision", help="Revision of the BuildConfiguration.", type=int)
@arg("--temporary-build", help="Temporary build")
@arg("--timestamp-alignment", help="Enable timestamp alignment for temporary build")
@arg("--no-build-dependencies", help="Don't build dependencies of this build configuration")
@arg("--keep-pod-on-failure", help="Keep pod on failure")
@arg("-f", "--force-rebuild", help="Force Rebuild (Deprecated)")
@arg("--rebuild-mode", help=common.REBUILD_MODES_DESC,
     choices=common.REBUILD_MODES, default=common.REBUILD_MODES_DEFAULT)
def build(id=None, name=None, revision=None,
          temporary_build=False, timestamp_alignment=False,
          no_build_dependencies=False,
          keep_pod_on_failure=False,
          force_rebuild=False,
          rebuild_mode=common.REBUILD_MODES_DEFAULT):
    """
    Trigger a BuildConfiguration by name or ID
    """
    data = build_raw(id, name, revision, temporary_build, timestamp_alignment, no_build_dependencies,
              keep_pod_on_failure, force_rebuild, rebuild_mode)
    if data:
        return utils.format_json(data)

def build_raw(id=None, name=None, revision=None,
          temporary_build=False, timestamp_alignment=False,
          no_build_dependencies=False,
          keep_pod_on_failure=False,
          force_rebuild=False,
          rebuild_mode=common.REBUILD_MODES_DEFAULT):

    if temporary_build is False and timestamp_alignment is True:
        print("Error: You can only activate timestamp alignment with the temporary build flag!")
        sys.exit(1)

    trigger_id = common.set_id(pnc_api.build_configs, id, name)

    if revision:
        response = utils.checked_api_call(pnc_api.build_configs, 'trigger_audited',
                                          id=trigger_id, rev=revision,
                                          temporary_build=temporary_build,
                                          timestamp_alignment=timestamp_alignment,
                                          build_dependencies=not no_build_dependencies,
                                          keep_pod_on_failure=keep_pod_on_failure,
                                          force_rebuild=force_rebuild,
                                          rebuild_mode=rebuild_mode)
    else:
        response = utils.checked_api_call(pnc_api.build_configs, 'trigger',
                                          id=trigger_id,
                                          temporary_build=temporary_build,
                                          timestamp_alignment=timestamp_alignment,
                                          build_dependencies=not no_build_dependencies,
                                          keep_pod_on_failure=keep_pod_on_failure,
                                          force_rebuild=force_rebuild,
                                          rebuild_mode=rebuild_mode)
    if response:
        return response.content

@arg("-i", "--id", help="ID of the BuildConfiguration to retrieve.", type=types.existing_bc_id)
@arg("-n", "--name", help="Name of the BuildConfiguration to retrieve.", type=types.existing_bc_name)
def get_build_configuration(id=None, name=None):
    """
    Retrieve a specific BuildConfiguration
    """
    data = get_build_configuration_raw(id, name)
    if data:
        return utils.format_json(data)

def get_build_configuration_raw(id=None, name=None):
    found_id = common.set_id(pnc_api.build_configs, id, name)
    response = utils.checked_api_call(pnc_api.build_configs, 'get_specific', id=found_id)
    if response:
        return response.content

@arg("id", help="ID of the BuildConfiguration to update.", type=types.existing_bc_id)
@arg("-n", "--name", help="Name of the BuildConfiguration to update.", type=types.valid_unique_bc_name)
@arg("-pid", "--project", help="ID of the Project to associate the BuildConfiguration with.",
     type=types.existing_project_id)
@arg("-e", "--environment", help="ID of the Environment for the new BuildConfiguration.",
     type=types.existing_environment_id)
@arg("-d", "--description", help="Description of the new build configuration.")
@arg("-r", "--repository-configuration", help="ID of the RepositoryConfiguration for the BuildConfiguration.")
@arg("-pvi", "--product-version-id", help="Associated ProductVersion ID.")
@arg("-srev", "--scm-revision", help="Revision of the sources in scm-url for this BuildConfiguration.")
@arg("-bs", "--build-script", help="Script to execute for the BuildConfiguration.")
@arg("-gp", "--generic-parameters", help="Set of arbitrary additional key=value pairs, such as CUSTOM_PME_PARAMETERS")
@arg("-rev", "--get-revision", help="Updates the BC and returns its Audited version")
def update_build_configuration(id, **kwargs):
    """
    Update an existing BuildConfiguration with new information

    :param id: ID of BuildConfiguration to update
    :param name: Name of BuildConfiguration to update
    :return:
    """
    data = update_build_configuration_raw(id, **kwargs)
    if data:
        return utils.format_json(data)

def update_build_configuration_raw(id, **kwargs):
    to_update_id = id

    bc_to_update = pnc_api.build_configs.get_specific(id=to_update_id).content

    project_id = kwargs.get('project')
    if project_id:
        project_rest = common.get_entity(pnc_api.projects, project_id)
        update_project = {'project': project_rest}
        kwargs.update(update_project)

    repository_id = kwargs.get('repository_configuration')
    if repository_id:
        repository_rest = common.get_entity(pnc_api.repositories, repository_id)
        update_repository = {'repository_configuration': repository_rest}
        kwargs.update(update_repository)

    env_id = kwargs.get('environment')
    if env_id:
        env_rest = common.get_entity(pnc_api.environments, env_id)
        update_env = {'environment': env_rest}
        kwargs.update(update_env)

    if isinstance(kwargs.get("generic_parameters"), str):
        kwargs["generic_parameters"] = ast.literal_eval(kwargs.get("generic_parameters"))

    for key, value in kwargs.items():
        if value is not None:
            setattr(bc_to_update, key, value)

    if kwargs.get('get_revision'):
        response = utils.checked_api_call(pnc_api.build_configs, 'update_and_get_audited', id=to_update_id,
                                          body=bc_to_update)
    else:
        response = utils.checked_api_call(pnc_api.build_configs, 'update', id=to_update_id, body=bc_to_update)

    if response:
        return response.content

@arg("-i", "--id", help="ID of the BuildConfiguration to delete.", type=types.existing_bc_id)
@arg("-n", "--name", help="Name of the BuildConfiguration to delete.", type=types.existing_bc_name)
def delete_build_configuration(id=None, name=None):
    """
    Delete an existing BuildConfiguration
    :param id:
    :param name:
    :return:
    """
    data = delete_build_configuration_raw(id, name)
    if data:
        return utils.format_json(data)

def delete_build_configuration_raw(id=None, name=None):
    to_delete_id = common.set_id(pnc_api.build_configs, id, name)
    # ensure that this build configuration is not a dependency of any other build configuration.
    # list_build_configurations is an insufficient check because eventually there will be too many entities to check them all.
    # a better REST method for dependency checking is needed
    for config in list_build_configurations_raw(page_size=1000000000):
        dep_ids = [str(val) for val in config.dependency_ids]
        if dep_ids is not None and str(to_delete_id) in dep_ids:
            raise CommandError(
                "BuildConfiguration ID {} is a dependency of BuildConfiguration {}.".format(to_delete_id, config.name))

    response = utils.checked_api_call(pnc_api.build_configs, 'delete_specific', id=to_delete_id)
    if response:
        return response.content

@arg("name", help="Name for the new BuildConfiguration.", type=types.valid_bc_name)
# allow specifying project by name?
@arg("project", help="ID of the Project to associate the BuildConfiguration with.", type=types.existing_project_id)
@arg("environment", help="ID of the Environment for the new BuildConfiguration.",
     type=types.existing_environment_id)
@arg("repository_configuration", help="ID of the RepositoryConfiguration with the sources of the BuildConfiguration.")
@arg("scm_revision", help="Revision of the sources in scm-url for this BuildConfiguration.")
@arg("build_script", help="Script to execute for the BuildConfiguration.")
@arg("-d", "--description", help="Description of the new build configuration.")
@arg("-pvi", "--product-version-id", help="Associated ProductVersion ID.")
@arg("-gp", "--generic-parameters", help="Set of arbitrary additional key=value pairs, such as CUSTOM_PME_PARAMETERS")
@arg("-dids", "--dependency-ids", type=int, nargs="+",
     help="List of BuildConfiguration IDs that are dependencies of this BuildConfiguration.")
# @arg("-bcsid", "--")
def create_build_configuration(**kwargs):
    """
    Create a new BuildConfiguration. BuildConfigurations represent the settings and configuration required to run a build of a specific version of the associated Project's source code.
    If a ProductVersion ID is provided, the BuildConfiguration will have access to artifacts which were produced for that version, but may not have been released yet.
    """
    data = create_build_configuration_raw(**kwargs)
    if data:
        return utils.format_json(data)

def create_build_configuration_raw(**kwargs):
    project_id = kwargs.get('project')
    project_rest = common.get_entity(pnc_api.projects, project_id)
    kwargs['project'] = project_rest
    repository_id = kwargs.get('repository_configuration')
    repository_rest = common.get_entity(pnc_api.repositories, repository_id)
    kwargs['repository_configuration'] = repository_rest
    env_id = kwargs.get('environment')
    env_rest = common.get_entity(pnc_api.environments, env_id)
    kwargs['environment'] = env_rest

    if kwargs.get("generic_parameters"):
        kwargs["generic_parameters"] = ast.literal_eval(kwargs.get("generic_parameters"))

    build_configuration = create_build_conf_object(**kwargs)
    response = utils.checked_api_call(
        pnc_api.build_configs, 'create_new', body=build_configuration)
    if response:
        return response.content

@arg("-i", "--id", help="ID of the Product to list BuildConfigurations for.", type=types.existing_product_id)
@arg("-n", "--name", help="Name of the Product to list BuildConfigurations for.", type=types.existing_bc_name)
@arg("-p", "--page-size", help="Limit the amount of build records returned", type=int)
@arg("--page-index", help="Select the index of page", type=int)
@arg("-s", "--sort", help="Sorting RSQL")
@arg("-q", help="RSQL query")
def list_build_configurations_for_product(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
    """
    List all BuildConfigurations associated with the given Product.
    """
    data = list_build_configurations_for_product_raw(id, name, page_size, page_index, sort, q)
    if data:
        return utils.format_json_list(data)

def list_build_configurations_for_product_raw(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
    found_id = common.set_id(pnc_api.products, id, name)
    response = utils.checked_api_call(pnc_api.build_configs, 'get_all_by_product_id', product_id=found_id, page_size=page_size,
                                      page_index=page_index,
                                      sort=sort, q=q)
    if response:
        return response.content

@arg("-i", "--id", help="ID of the Project to list BuildConfigurations for.", type=int)
@arg("-n", "--name", help="Name of the Project to list BuildConfigurations for.", type=types.valid_bc_name)
@arg("-p", "--page-size", help="Limit the amount of build records returned", type=int)
@arg("--page-index", help="Select the index of page", type=int)
@arg("-s", "--sort", help="Sorting RSQL")
@arg("-q", help="RSQL query")
def list_build_configurations_for_project(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
    """
    List all BuildConfigurations associated with the given Project.
    """
    data = list_build_configurations_for_project_raw(id, name, page_size, page_index, sort, q)
    if data:
        return utils.format_json_list(data)

def list_build_configurations_for_project_raw(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
    found_id = common.set_id(pnc_api.projects, id, name)
    response = utils.checked_api_call(pnc_api.build_configs, 'get_all_by_project_id', project_id=found_id, page_size=page_size,
                                      page_index=page_index,
                                      sort=sort, q=q)
    if response:
        return response.content

@arg("product_id", help="ID of the Product which contains the desired ProductVersion.",
     type=types.existing_product_id)
@arg("version_id", help="ID of the ProductVersion to list BuildConfigurations for.",
     type=types.existing_product_version)
@arg("-p", "--page-size", help="Limit the amount of build records returned")
@arg("--page-index", help="Select the index of page", type=int)
@arg("-s", "--sort", help="Sorting RSQL")
@arg("-q", help="RSQL query")
def list_build_configurations_for_product_version(product_id, version_id, page_size=200, page_index=0, sort="", q=""):
    """
    List all BuildConfigurations associated with the given ProductVersion
    """
    data = list_build_configurations_for_product_version_raw(product_id, version_id, page_size, page_index, sort, q)
    if data:
        return utils.format_json_list(data)

def list_build_configurations_for_product_version_raw(product_id, version_id, page_size=200, page_index=0, sort="", q=""):
    found_product_id = common.set_id(pnc_api.products, product_id, None)
    response = utils.checked_api_call(pnc_api.build_configs, 'get_all_by_product_version_id', product_id=found_product_id,
                                      version_id=version_id, page_size=page_size, page_index=page_index, sort=sort, q=q)
    if response:
        return response.content

@arg("-i", "--id", help="ID of the BuildConfiguration to list dependencies for.", type=types.existing_bc_id)
@arg("-n", "--name", help="Name of the BuildConfiguration to list dependencies for.", type=types.valid_bc_name)
@arg("-p", "--page-size", help="Limit the amount of build records returned")
@arg("--page-index", help="Select the index of page", type=int)
@arg("-s", "--sort", help="Sorting RSQL")
@arg("-q", help="RSQL query")
def list_dependencies(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
    data = list_dependencies_raw(id, name, page_size, page_index, sort, q)
    if data:
        return utils.format_json_list(data)

def list_dependencies_raw(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
    found_id = common.set_id(pnc_api.build_configs, id, name)
    response = utils.checked_api_call(pnc_api.build_configs, 'get_dependencies', id=found_id, page_size=page_size,
                                      page_index=page_index, sort=sort, q=q)
    if response:
        return response.content

@arg("-i", "--id", help="ID of the BuildConfiguration to add a dependency to.", type=types.existing_bc_id)
@arg("-n", "--name", help="Name of the BuildConfiguration to add a dependency to.", type=types.existing_bc_name)
@arg("-di", "--dependency-id", help="ID of an existing BuildConfiguration to add as a dependency.",
     type=types.existing_bc_id)
@arg("-dn", "--dependency-name", help="Name of an existing BuildConfiguration to add as a dependency.",
     type=types.existing_bc_name)
def add_dependency(id=None, name=None, dependency_id=None, dependency_name=None):
    """
    Add an existing BuildConfiguration as a dependency to another BuildConfiguration.
    """
    data = add_dependency_raw(id, name, dependency_id, dependency_name)
    if data:
        return utils.format_json_list(data)

def add_dependency_raw(id=None, name=None, dependency_id=None, dependency_name=None):
    add_to = common.set_id(pnc_api.build_configs, id, name)
    to_add = common.set_id(pnc_api.build_configs, dependency_id, dependency_name)

    dependency = pnc_api.build_configs.get_specific(id=to_add).content
    response = utils.checked_api_call(pnc_api.build_configs, 'add_dependency', id=add_to, body=dependency)
    if response:
        return response.content

@arg("-i", "--id", help="ID of the BuildConfiguration to remove a dependency from.", type=types.existing_bc_id)
@arg("-n", "--name", help="Name of the BuildConfiguration to remove a dependency from.", type=types.existing_bc_name)
@arg("-di", "--dependency-id", help="ID of the dependency BuildConfiguration to remove.", type=types.existing_bc_id)
@arg("-dn", "--dependency-name", help="Name of the dependency BuildConfiguration to remove.",
     type=types.existing_bc_name)
def remove_dependency(id=None, name=None, dependency_id=None, dependency_name=None):
    """
    Remove a BuildConfiguration from the dependency list of another BuildConfiguration
    """
    data = remove_dependency_raw(id, name, dependency_id, dependency_name)
    if data:
        return utils.format_json_list(data)

def remove_dependency_raw(id=None, name=None, dependency_id=None, dependency_name=None):
    found_id = common.set_id(pnc_api.build_configs, id, name)
    found_dep_id = common.set_id(pnc_api.build_configs, dependency_id, dependency_name)

    response = utils.checked_api_call(pnc_api.build_configs, 'remove_dependency', id=found_id, dependency_id=found_dep_id)
    if response:
        return response.content

@arg("-i", "--id", help="ID of the BuildConfiguration to list ProductVersions for.", type=types.existing_bc_id)
@arg("-n", "--name", help="Name of the BuildConfiguration to list ProductVersions for.", type=types.existing_bc_name)
@arg("-p", "--page-size", help="Limit the amount of build records returned", type=int)
@arg("--page-index", help="Select the index of page", type=int)
@arg("-s", "--sort", help="Sorting RSQL")
@arg("-q", help="RSQL query")
def list_product_versions_for_build_configuration(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
    """
    List all ProductVersions associated with a BuildConfiguration
    """
    data = list_product_versions_for_build_configuration_raw(id, name, page_size, page_index, sort, q)
    if data:
        return utils.format_json_list(data)

def list_product_versions_for_build_configuration_raw(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
    found_id = common.set_id(pnc_api.build_configs, id, name)
    response = utils.checked_api_call(pnc_api.build_configs, 'get_product_versions', id=found_id, page_size=page_size,
                                      page_index=page_index, sort=sort,
                                      q=q)
    if response:
        return response.content

@arg("-i", "--id", help="ID of the BuildConfiguration to add a ProductVersion to.", type=types.existing_bc_id)
@arg("-n", "--name", help="Name of the BuildConfiguration to add a ProductVersions to.", type=types.existing_bc_name)
@arg('product_version_id', help="ID of the ProductVersion to add.", type=types.existing_product_version)
def add_product_version_to_build_configuration(id=None, name=None, product_version_id=None):
    """
    Associate an existing ProductVersion with a BuildConfiguration
    """
    data = remove_product_version_from_build_configuration_raw(id, name, product_version_id)
    if data:
        return utils.format_json_list(data)

def add_product_version_to_build_configuration_raw(id=None, name=None, product_version_id=None):
    found_id = common.set_id(pnc_api.build_configs, id, name)

    to_add = common.get_entity(pnc_api.product_versions, product_version_id)
    response = utils.checked_api_call(pnc_api.build_configs, 'add_product_version', id=found_id, body=to_add)
    if response:
        return response.content

@arg("-i", "--id", help="ID of the BuildConfiguration to remove a ProductVersion from.", type=types.existing_bc_id)
@arg("-n", "--name", help="Name of the BuildConfiguration to remove a ProductVersions from.",
     type=types.existing_bc_name)
@arg('product_version_id', help="ID of the ProductVersion to remove.", type=types.existing_product_version)
def remove_product_version_from_build_configuration(id=None, name=None, product_version_id=None):
    """
    Remove a ProductVersion from association with a BuildConfiguration
    """
    data = remove_product_version_from_build_configuration_raw(id, name, product_version_id)
    if data:
        return utils.format_json_list(data)

def remove_product_version_from_build_configuration_raw(id=None, name=None, product_version_id=None):
    found_id = common.set_id(pnc_api.build_configs, id, name)
    response = utils.checked_api_call(pnc_api.build_configs, 'remove_product_version', id=found_id,
                                      product_version_id=product_version_id)
    if response:
        return response.content

@arg("-i", "--id", help="ID of the BuildConfiguration to list audited revisions for.", type=types.existing_bc_id)
@arg("-n", "--name", help="Name of the BuildConfiguration to list audited revisions for.", type=types.existing_bc_name)
@arg("-p", "--page-size", help="Limit the amount of build records returned", type=int)
@arg("--page-index", help="Select the index of page", type=int)
@arg("-s", "--sort", help="Sorting RSQL")
# TODO: PNC return BuildConfigurationAuditedPage instead of BuildConfigurationPage?
def list_revisions_of_build_configuration(id=None, name=None, page_size=200, page_index=0, sort=""):
    """
    List audited revisions of a BuildConfiguration
    """
    data = list_revisions_of_build_configuration_raw(id, name, page_size, page_index, sort)
    if data:
        return utils.format_json_list(data)

def list_revisions_of_build_configuration_raw(id=None, name=None, page_size=200, page_index=0, sort=""):
    found_id = common.set_id(pnc_api.build_configs, id, name)
    response = utils.checked_api_call(pnc_api.build_configs, 'get_revisions', id=found_id, page_size=page_size,
                                      page_index=page_index, sort=sort)
    if response:
        return response.content

@arg("-i", "--id", help="ID of the BuildConfiguration to retrieve a revision from.", type=types.existing_bc_id)
@arg("-n", "--name", help="Name of the BuildConfiguration to retrieve a revision from.", type=types.existing_bc_name)
@arg("revision_id", help="Number of the revision to retrieve.")
def get_revision_of_build_configuration(revision_id, id=None, name=None):
    """
    Get a specific audited revision of a BuildConfiguration
    """
    data = get_revision_of_build_configuration_raw(revision_id, id, name)
    if data:
        return utils.format_json(data)

def get_revision_of_build_configuration_raw(revision_id, id=None, name=None):
    found_id = common.set_id(pnc_api.build_configs, id, name)
    response = utils.checked_api_call(pnc_api.build_configs, 'get_revision', id=found_id, rev=revision_id)
    if response:
        return response.content

@arg("-p", "--page-size", help="Limit the amount of build records returned", type=int)
@arg("--page-index", help="Select the index of page", type=int)
@arg("-s", "--sort", help="Sorting RSQL")
@arg("-q", help="RSQL query")
def list_build_configurations(page_size=200, page_index=0, sort="", q=""):
    """
    List all BuildConfigurations
    """
    data = list_build_configurations_raw(page_size, page_index, sort, q)
    if data:
        return utils.format_json_list(data)

def list_build_configurations_raw(page_size=200, page_index=0, sort="", q=""):
    response = utils.checked_api_call(pnc_api.build_configs, 'get_all', page_size=page_size, page_index=page_index, sort=sort,
                                      q=q)
    if response:
        return response.content


text:
<?php

namespace Mage\Checkout\Test\Block\Multishipping;

use Mage\Checkout\Test\Block\Multishipping\Addresses\Items;
use Magento\Mtf\Client\ElementInterface;

/**
 * Checkout multishipping addresses block.
 */
class Addresses extends AbstractMultishipping
{
    /**
     * Selector for 'Enter a New Address' button.
     *
     * @var string
     */
    protected $enterNewAddress = '[data-action="add-new-customer-address"]';

    /**
     * Selector for items block.
     *
     * @var string
     */
    protected $itemsBlock = '#multiship-addresses-table';

    /**
     * Selector for 'Continue to Shipping Information' button.
     *
     * @var string
     */
    protected $continue = '[data-action="checkout-continue-shipping"]';

    /**
     * Click on 'Enter a New Address' button.
     *
     * @return void
     */
    public function clickEnterNewAddress()
    {
        $this->_rootElement->find($this->enterNewAddress)->click();
    }

    /**
     * Get path for items class.
     *
     * @return string
     */
    protected function getItemsClass()
    {
        return 'Mage\Checkout\Test\Block\Multishipping\Addresses\Items';
    }

    /**
     * Get items block element.
     *
     * @return ElementInterface
     */
    protected function getItemsBlockElement()
    {
        return $this->_rootElement->find($this->itemsBlock);
    }
}


text:
This repo is a companion to the blog post [Beyond Heroku: "Satellite" Delayed Job Workers on EC2](http://artsy.github.com/blog/2012/01/31/beyond-heroku-satellite-delayed-job-workers-on-ec2/). See that page for a more complete walk-through of how it's used.

These files _will_ require modification to be relevant to your environment. In particular:

* `config/heroku.yml`: your own shared environment variables, including AWS credentials
* `lib/tasks/satellite.rake`: `KEY_NAME`, `IMAGE_ID`, `FLAVOR_ID`
* `config/satellite/cookbooks/example_app/recipes/deploy.rb`: git repo
* `config/satellite/cookbooks/example_app/files/default/authorized_keys`: any keys for SSH authorization
* `config/satellite/cookbooks/example_app/files/id_dsa`: a new private key, authorized for the git repo
* references to `example_app` throughout should be updated with your app name

(c) 2012 Art.sy, Inc.


text:
<?php

namespace Rock\OnSymfony\CoreBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
// <Use> : Class Loader
use Symfony\Component\ClassLoader\UniversalClassLoader;
/**
 * This is the class that loads and manages your bundle configuration
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
 */
class RockOnSymfonyCoreExtension extends Extension
{
	public function __construct()
	{
	}
    /**
     * {@inheritDoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

		$dir = $config['directory'];
		$container->setParameter('rock.component.dir', $dir);

        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.xml');

		if(!$container->hasParameter('rock.packages'))
		{
			$container->setParameter('rock.packages', $container->getParameter('rock.packages.default'));
		}

    }
}


text:
namespace TK
{
	class Application;
	class Console;
	class CollidableObject;
	class Camera;

	class Script
	{
	public:
		Script(Application &app, Console &console, Camera &camera);
		~Script();

		Script(const Script &a) = default;
		Script &operator = (const Script &a) = default;

		TK_STATUS Run(const std::string &code);

		TK_STATUS InitializeBindings();

		TK_STATUS SetPlayerObject(CollidableObject *obj);

	protected:

		void lua_Exec(const std::string &command);

		template <class T>
		void lua_Print(const T &value)
		{
			std::string sv = Helpers::String::To(value);
			m_console_ref.Print(sv);
		}

	private:
		lua_State *m_lua;

		Application &m_application_ref;
		Console &m_console_ref;
		Camera &m_camera_ref;

		CollidableObject *m_player_object_ptr;
	};

	class Lua_TK_STATUS_wrapper
	{

	};
}