text:
using System;
using System.ComponentModel;

namespace Azure.ResourceManager.DataBox.Models
{
    /// <summary> DataCenter code. </summary>
    public readonly partial struct DataCenterCode : IEquatable<DataCenterCode>
    {
        private readonly string _value;

        /// <summary> Initializes a new instance of <see cref="DataCenterCode"/>. </summary>
        /// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
        public DataCenterCode(string value)
        {
            _value = value ?? throw new ArgumentNullException(nameof(value));
        }

        private const string InvalidValue = "Invalid";
        private const string BY2Value = "BY2";
        private const string BY1Value = "BY1";
        private const string ORK70Value = "ORK70";
        private const string AM2Value = "AM2";
        private const string AMS20Value = "AMS20";
        private const string BY21Value = "BY21";
        private const string BY24Value = "BY24";
        private const string MWH01Value = "MWH01";
        private const string AMS06Value = "AMS06";
        private const string SSE90Value = "SSE90";
        private const string SYD03Value = "SYD03";
        private const string SYD23Value = "SYD23";
        private const string CBR20Value = "CBR20";
        private const string YTO20Value = "YTO20";
        private const string CWL20Value = "CWL20";
        private const string LON24Value = "LON24";
        private const string BOM01Value = "BOM01";
        private const string BL20Value = "BL20";
        private const string BL7Value = "BL7";
        private const string SEL20Value = "SEL20";
        private const string TYO01Value = "TYO01";
        private const string BN1Value = "BN1";
        private const string SN5Value = "SN5";
        private const string CYS04Value = "CYS04";
        private const string TYO22Value = "TYO22";
        private const string YTO21Value = "YTO21";
        private const string YQB20Value = "YQB20";
        private const string FRA22Value = "FRA22";
        private const string MAA01Value = "MAA01";
        private const string CPQ02Value = "CPQ02";
        private const string CPQ20Value = "CPQ20";
        private const string SIN20Value = "SIN20";
        private const string HKG20Value = "HKG20";
        private const string SG2Value = "SG2";
        private const string MEL23Value = "MEL23";
        private const string SEL21Value = "SEL21";
        private const string OSA20Value = "OSA20";
        private const string SHA03Value = "SHA03";
        private const string BJBValue = "BJB";
        private const string JNB22Value = "JNB22";
        private const string JNB21Value = "JNB21";
        private const string MNZ21Value = "MNZ21";
        private const string SN8Value = "SN8";
        private const string AUH20Value = "AUH20";
        private const string ZRH20Value = "ZRH20";
        private const string PUS20Value = "PUS20";
        private const string AdHocValue = "AdHoc";
        private const string CH1Value = "CH1";
        private const string DSM05Value = "DSM05";
        private const string DUB07Value = "DUB07";
        private const string PNQ01Value = "PNQ01";
        private const string SVG20Value = "SVG20";
        private const string OSA02Value = "OSA02";
        private const string OSA22Value = "OSA22";
        private const string PAR22Value = "PAR22";
        private const string BN7Value = "BN7";
        private const string SN6Value = "SN6";
        private const string BJS20Value = "BJS20";

        /// <summary> Invalid. </summary>
        public static DataCenterCode Invalid { get; } = new DataCenterCode(InvalidValue);
        /// <summary> BY2. </summary>
        public static DataCenterCode BY2 { get; } = new DataCenterCode(BY2Value);
        /// <summary> BY1. </summary>
        public static DataCenterCode BY1 { get; } = new DataCenterCode(BY1Value);
        /// <summary> ORK70. </summary>
        public static DataCenterCode ORK70 { get; } = new DataCenterCode(ORK70Value);
        /// <summary> AM2. </summary>
        public static DataCenterCode AM2 { get; } = new DataCenterCode(AM2Value);
        /// <summary> AMS20. </summary>
        public static DataCenterCode AMS20 { get; } = new DataCenterCode(AMS20Value);
        /// <summary> BY21. </summary>
        public static DataCenterCode BY21 { get; } = new DataCenterCode(BY21Value);
        /// <summary> BY24. </summary>
        public static DataCenterCode BY24 { get; } = new DataCenterCode(BY24Value);
        /// <summary> MWH01. </summary>
        public static DataCenterCode MWH01 { get; } = new DataCenterCode(MWH01Value);
        /// <summary> AMS06. </summary>
        public static DataCenterCode AMS06 { get; } = new DataCenterCode(AMS06Value);
        /// <summary> SSE90. </summary>
        public static DataCenterCode SSE90 { get; } = new DataCenterCode(SSE90Value);
        /// <summary> SYD03. </summary>
        public static DataCenterCode SYD03 { get; } = new DataCenterCode(SYD03Value);
        /// <summary> SYD23. </summary>
        public static DataCenterCode SYD23 { get; } = new DataCenterCode(SYD23Value);
        /// <summary> CBR20. </summary>
        public static DataCenterCode CBR20 { get; } = new DataCenterCode(CBR20Value);
        /// <summary> YTO20. </summary>
        public static DataCenterCode YTO20 { get; } = new DataCenterCode(YTO20Value);
        /// <summary> CWL20. </summary>
        public static DataCenterCode CWL20 { get; } = new DataCenterCode(CWL20Value);
        /// <summary> LON24. </summary>
        public static DataCenterCode LON24 { get; } = new DataCenterCode(LON24Value);
        /// <summary> BOM01. </summary>
        public static DataCenterCode BOM01 { get; } = new DataCenterCode(BOM01Value);
        /// <summary> BL20. </summary>
        public static DataCenterCode BL20 { get; } = new DataCenterCode(BL20Value);
        /// <summary> BL7. </summary>
        public static DataCenterCode BL7 { get; } = new DataCenterCode(BL7Value);
        /// <summary> SEL20. </summary>
        public static DataCenterCode SEL20 { get; } = new DataCenterCode(SEL20Value);
        /// <summary> TYO01. </summary>
        public static DataCenterCode TYO01 { get; } = new DataCenterCode(TYO01Value);
        /// <summary> BN1. </summary>
        public static DataCenterCode BN1 { get; } = new DataCenterCode(BN1Value);
        /// <summary> SN5. </summary>
        public static DataCenterCode SN5 { get; } = new DataCenterCode(SN5Value);
        /// <summary> CYS04. </summary>
        public static DataCenterCode CYS04 { get; } = new DataCenterCode(CYS04Value);
        /// <summary> TYO22. </summary>
        public static DataCenterCode TYO22 { get; } = new DataCenterCode(TYO22Value);
        /// <summary> YTO21. </summary>
        public static DataCenterCode YTO21 { get; } = new DataCenterCode(YTO21Value);
        /// <summary> YQB20. </summary>
        public static DataCenterCode YQB20 { get; } = new DataCenterCode(YQB20Value);
        /// <summary> FRA22. </summary>
        public static DataCenterCode FRA22 { get; } = new DataCenterCode(FRA22Value);
        /// <summary> MAA01. </summary>
        public static DataCenterCode MAA01 { get; } = new DataCenterCode(MAA01Value);
        /// <summary> CPQ02. </summary>
        public static DataCenterCode CPQ02 { get; } = new DataCenterCode(CPQ02Value);
        /// <summary> CPQ20. </summary>
        public static DataCenterCode CPQ20 { get; } = new DataCenterCode(CPQ20Value);
        /// <summary> SIN20. </summary>
        public static DataCenterCode SIN20 { get; } = new DataCenterCode(SIN20Value);
        /// <summary> HKG20. </summary>
        public static DataCenterCode HKG20 { get; } = new DataCenterCode(HKG20Value);
        /// <summary> SG2. </summary>
        public static DataCenterCode SG2 { get; } = new DataCenterCode(SG2Value);
        /// <summary> MEL23. </summary>
        public static DataCenterCode MEL23 { get; } = new DataCenterCode(MEL23Value);
        /// <summary> SEL21. </summary>
        public static DataCenterCode SEL21 { get; } = new DataCenterCode(SEL21Value);
        /// <summary> OSA20. </summary>
        public static DataCenterCode OSA20 { get; } = new DataCenterCode(OSA20Value);
        /// <summary> SHA03. </summary>
        public static DataCenterCode SHA03 { get; } = new DataCenterCode(SHA03Value);
        /// <summary> BJB. </summary>
        public static DataCenterCode BJB { get; } = new DataCenterCode(BJBValue);
        /// <summary> JNB22. </summary>
        public static DataCenterCode JNB22 { get; } = new DataCenterCode(JNB22Value);
        /// <summary> JNB21. </summary>
        public static DataCenterCode JNB21 { get; } = new DataCenterCode(JNB21Value);
        /// <summary> MNZ21. </summary>
        public static DataCenterCode MNZ21 { get; } = new DataCenterCode(MNZ21Value);
        /// <summary> SN8. </summary>
        public static DataCenterCode SN8 { get; } = new DataCenterCode(SN8Value);
        /// <summary> AUH20. </summary>
        public static DataCenterCode AUH20 { get; } = new DataCenterCode(AUH20Value);
        /// <summary> ZRH20. </summary>
        public static DataCenterCode ZRH20 { get; } = new DataCenterCode(ZRH20Value);
        /// <summary> PUS20. </summary>
        public static DataCenterCode PUS20 { get; } = new DataCenterCode(PUS20Value);
        /// <summary> AdHoc. </summary>
        public static DataCenterCode AdHoc { get; } = new DataCenterCode(AdHocValue);
        /// <summary> CH1. </summary>
        public static DataCenterCode CH1 { get; } = new DataCenterCode(CH1Value);
        /// <summary> DSM05. </summary>
        public static DataCenterCode DSM05 { get; } = new DataCenterCode(DSM05Value);
        /// <summary> DUB07. </summary>
        public static DataCenterCode DUB07 { get; } = new DataCenterCode(DUB07Value);
        /// <summary> PNQ01. </summary>
        public static DataCenterCode PNQ01 { get; } = new DataCenterCode(PNQ01Value);
        /// <summary> SVG20. </summary>
        public static DataCenterCode SVG20 { get; } = new DataCenterCode(SVG20Value);
        /// <summary> OSA02. </summary>
        public static DataCenterCode OSA02 { get; } = new DataCenterCode(OSA02Value);
        /// <summary> OSA22. </summary>
        public static DataCenterCode OSA22 { get; } = new DataCenterCode(OSA22Value);
        /// <summary> PAR22. </summary>
        public static DataCenterCode PAR22 { get; } = new DataCenterCode(PAR22Value);
        /// <summary> BN7. </summary>
        public static DataCenterCode BN7 { get; } = new DataCenterCode(BN7Value);
        /// <summary> SN6. </summary>
        public static DataCenterCode SN6 { get; } = new DataCenterCode(SN6Value);
        /// <summary> BJS20. </summary>
        public static DataCenterCode BJS20 { get; } = new DataCenterCode(BJS20Value);
        /// <summary> Determines if two <see cref="DataCenterCode"/> values are the same. </summary>
        public static bool operator ==(DataCenterCode left, DataCenterCode right) => left.Equals(right);
        /// <summary> Determines if two <see cref="DataCenterCode"/> values are not the same. </summary>
        public static bool operator !=(DataCenterCode left, DataCenterCode right) => !left.Equals(right);
        /// <summary> Converts a string to a <see cref="DataCenterCode"/>. </summary>
        public static implicit operator DataCenterCode(string value) => new DataCenterCode(value);

        /// <inheritdoc />
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override bool Equals(object obj) => obj is DataCenterCode other && Equals(other);
        /// <inheritdoc />
        public bool Equals(DataCenterCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);

        /// <inheritdoc />
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override int GetHashCode() => _value?.GetHashCode() ?? 0;
        /// <inheritdoc />
        public override string ToString() => _value;
    }
}


text:
#include "Material.h"

class Flat : public Material
{
private:
	Vector3 color;
public:
	Flat();
	Flat(const Vector3 &color);

	virtual Vector3 getBaseColor() const override;
	virtual Vector3 colorAt(const class Intersection &intersection, const class Ray &ray,
		const class World &world) const override;
};

#endif

redpajama_set_name: RedPajamaGithub


text:
package com.simplaapliko.shym.challenge.main;

import android.support.v7.widget.AppCompatRadioButton;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.simplaapliko.shym.challenge.R;

public class AnswerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

    public interface ClickListener {
        void onItemClicked(int position);
    }

    private final ClickListener clickListener;
    private final AppCompatRadioButton radioButton;
    private final TextView descriptionText;

    public AnswerViewHolder(View itemView, ClickListener clickListener) {
        super(itemView);
        this.clickListener = clickListener;
        itemView.setOnClickListener(this);
        radioButton = (AppCompatRadioButton) itemView.findViewById(R.id.radio_button);
        descriptionText = (TextView) itemView.findViewById(R.id.description);
    }

    public void bind(AnswerViewModel answer) {
        radioButton.setChecked(answer.isSelected());
        descriptionText.setText(answer.getAnswer());
    }

    @Override
    public void onClick(View v) {
        radioButton.setChecked(true);
        if (clickListener != null) {
            clickListener.onItemClicked(getAdapterPosition());
        }
    }
}


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

#ifndef sig_filter_INCL_
#define sig_filter_INCL_

/*! \file
\brief Declarations for sig::filter
*/

#include "libdat/grid.h"
#include "libdat/RowCol.h"
#include "libdat/SubExtents.h"
#include "libmath/math.h"

#include <functional>

namespace sig
{

/*! \brief Functions related to digital filtering operations.

\par Example
\dontinclude testsig/ufilter.cpp
\skip ExampleStart
\until ExampleEnd
*/

namespace filter
{
	//
	// Moving filter relationships
	//

	//
	// NOTE: Relationships:
	//
	//  H: (hunk size) aka window, patch, template
	//  M: (move size)
	//  F: (full size)
	//
	//  H = F - M + 1
	//  M = F - H + 1
	//  F = M + H - 1
	//

	//! Full size required for hunk (aka window) size to change by moveSize
	size_t
	hunkSizeFor
		( size_t const & moveSize
		, size_t const & fullSize
		);

	//! Extents of motion for hunk within fullsize area
	size_t
	moveSizeFor
		( size_t const & fullSize
		, size_t const & hunkSize
		);

	//! Extents of hunk that allow complete movement within full size
	size_t
	fullSizeFor
		( size_t const & hunkSize
		, size_t const & moveSize
		);

	//! Full size extents using hunkSizeFor on each dimension.
	dat::Extents
	hunkExtentsFor
		( dat::Extents const & moveExtents
		, dat::Extents const & fullExtents
		);

	//! Move extents using moveSizeFor on each dimension.
	dat::Extents
	moveExtentsFor
		( dat::Extents const & fullExtents
		, dat::Extents const & hunkExtents
		);

	//! Full extents using fullSizeFor on each dimension.
	dat::Extents
	fullExtentsFor
		( dat::Extents const & hunkExtents
		, dat::Extents const & moveExtents
		);

	//
	// General functions
	//

	//! Conventional Squared-Difference metric
	template <typename OutType, typename InType>
	struct SqDiff
	{
		//! Squared difference between values after cast to OutType
		inline
		OutType
		operator()
			( InType const & valA
			, InType const & valB
			) const
		{
			return math::sq(OutType(valA) - OutType(valB));
		}
	};

	//! Simple container for patch data statistics
	template <typename Type>
	struct HunkStats
	{
		Type theSumFull{ dat::nullValue<Type>() };
		Type theSumHunk{ dat::nullValue<Type>() };
		size_t theCount{ dat::nullValue<size_t>() };
	};

	//! Result of generic "product and sum" operation between source and patch
	template
		<typename OutType, typename InType, typename PixFunc, typename SumFunc>
	inline
	OutType
	hunkResponse
		( dat::grid<InType> const & sourceGrid
		, dat::RowCol const & sourceUL
		, dat::grid<InType> const & patchGrid
		, PixFunc const & pairMetricFunc
		, SumFunc const & patchSumFunc = std::plus<OutType>()
		, HunkStats<OutType> * const & ptStats = nullptr
		);

	//! Result after applying hunkResponse() to every offset within moveSize
	template
		<typename OutType, typename InType, typename PixFunc, typename SumFunc>
	inline
	dat::grid<OutType>
	moveResponseGrid
		( dat::grid<InType> const & sourceGrid
		, dat::Extents const & moveSize
		, dat::grid<InType> const & patchGrid
		, PixFunc const & pairMetricFunc
		, SumFunc const & patchSumFunc = std::plus<OutType>()
		);

	//! Unbiased SSD response. NOTE: OutType expected to be floating point
	template <typename OutType, typename InType>
	inline
	dat::grid<OutType>
	ssdResponseGrid
		( dat::grid<InType> const & sourceGrid
		, dat::Extents const & moveSize
		, dat::grid<InType> const & patchGrid
		, size_t const & maxNullCount = 0u
		);

}

}

// Inline definitions
#include "libsig/filter.inl"

#endif // sig_filter_INCL_


text:
'use strict';

async function main(bucketName, uriPrefix) {
  // [START aiplatform_delete_export_model_sample]
  /**
   * TODO(developer): Uncomment these variables before running the sample.\
   * (Not necessary if passing values as arguments)
   */

  // const bucketName = 'YOUR_BUCKET_NAME';
  // const uriPrefix = 'YOUR_GCS_URI_PREFIX'

  // Imports the Google Cloud Storage Client library
  const {Storage} = require('@google-cloud/storage');

  // Instantiates a client
  const storageClient = new Storage();

  async function deleteExportModel() {
    const options = {
      prefix: uriPrefix,
    };
    const [files] = await storageClient
      .bucket(`gs://${bucketName}`)
      .getFiles(options);
    for (const file of files) {
      await storageClient.bucket(`gs://${bucketName}`).file(file.name).delete();
    }
    console.log('Export model deleted');
  }
  deleteExportModel();
  // [END aiplatform_delete_export_model_sample]
}

process.on('unhandledRejection', err => {
  console.error(err.message);
  process.exitCode = 1;
});

main(...process.argv.slice(2));


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WebDaemonShared
{
    public class Routes
    {
		public const string kSubmitAddress = "/api/1/submitAddress";
		public const string kGetOrderStatus = "/api/1/getOrderStatus";
		public const string kGetStats = "/api/1/getStats";
		public const string kGetMarket = "/api/1/getMarket";
		public const string kGetAllMarkets = "/api/1/getAllMarkets";
		public const string kGetLastTransactions = "/api/1/getLastTransactions";
		public const string kGetMyLastTransactions = "/api/1/getMyLastTransactions";
		public const string kProduceReport = "/api/1/report";

		public const string kPushSenderToDeposit = "/api/1/pushSenderToDeposit";
		public const string kPushTransactions = "/api/1/pushTransactions";
		public const string kPushMarket = "/api/1/pushMarket";
		public const string kPushFees = "/api/1/pushFees";
		public const string kGetAllTransactionsSince = "/api/1/getAllTransactionsSince";
		public const string kPing = "/api/1/ping";
    }
}


text:
package org.apache.hadoop.hbase.regionserver.transactional;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NavigableSet;
import java.util.Set;
import java.util.Arrays;
import java.util.HashMap;

import org.apache.commons.codec.binary.Hex;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.Tag;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValue.Type;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher;
import org.apache.hadoop.hbase.regionserver.ScanType;
import org.apache.hadoop.hbase.regionserver.ScanInfo;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.wal.WAL;
import org.apache.hadoop.io.DataInputBuffer;
import org.apache.hadoop.hbase.client.SsccConst;
import java.util.concurrent.atomic.AtomicLong;

/**
 * Holds the state of a SSCC transaction.
 */
public class SsccTransactionState extends TransactionState{

    private static final Log LOG = LogFactory.getLog(SsccTransactionState.class);
    private List<byte[]>  putRows =  Collections.synchronizedList(new LinkedList<byte[]>());
    private List<Delete>  delRows =  Collections.synchronizedList(new LinkedList<Delete>());
    private List<Scan> scans = Collections.synchronizedList(new LinkedList<Scan>());
    private Map<String, byte[]> colUpdatedByTransaction = new HashMap<String, byte[]>();

    private long commitSequenceId;
    private long startId_;

    public SsccTransactionState(final long transactionId, final long rLogStartSequenceId, AtomicLong hlogSeqId,
    		final HRegionInfo regionInfo, HTableDescriptor htd, WAL hLog, boolean logging, long SsccSequenceId) {

       super(transactionId,rLogStartSequenceId,hlogSeqId,regionInfo,htd,hLog,logging,SsccSequenceId, /* region TX */ false);
       setStartId(SsccSequenceId);
       if(LOG.isTraceEnabled()) LOG.trace("SsccTransactionState : new state object for transid: " + transactionId + " with sequence: " + SsccSequenceId + " complete");
    }

    public SsccTransactionState(final long transactionId, final long rLogStartSequenceId, AtomicLong hlogSeqId,
            final HRegionInfo regionInfo, HTableDescriptor htd, WAL hLog, boolean logging, long SsccSequenceId,
            boolean regionTx) {

        super(transactionId,rLogStartSequenceId,hlogSeqId,regionInfo,htd,hLog,logging,SsccSequenceId,regionTx);
        setStartId(SsccSequenceId);
        if(LOG.isTraceEnabled()) LOG.trace("SsccTransactionState : new state object for transid: " + transactionId + " with sequence: " + SsccSequenceId + " complete");
    }

    public void addToColList(byte[] rowkey, byte[] collist)
    {
        synchronized(colUpdatedByTransaction){
            String keystr= new String(rowkey);
            if(colUpdatedByTransaction.containsKey(keystr) ==true)
            {
                colUpdatedByTransaction.remove(keystr);
                colUpdatedByTransaction.put(keystr, collist);
            }
            else
            {
                colUpdatedByTransaction.put(keystr, collist);
            }
        }
    }

    public byte[] getColList(byte[] rowkey)
    {
        String keystr= new String(rowkey);
        synchronized(colUpdatedByTransaction){
            if(colUpdatedByTransaction == null) return null;
            if(colUpdatedByTransaction.containsKey(keystr) ==true)
            {
                return colUpdatedByTransaction.get(keystr);
            }
            else
                return null;
        }
    }
    /**
     * Get the puts rowkeys in transaction order.
     *
     * @return Return the putRows.
     */
    public List<byte[]> getPutRows() {
        return putRows;
    }

    /**
     * Get the del rowkeys in transaction order.
     *
     * @return Return the putRows.
     */
    public List<Delete> getDelRows() {
        return delRows;
    }

    /**
     * add a rowkey into putRows
     */
    public void addToPutList(byte[] rowkey) {
       putRows.add(rowkey);
    }

    /**
     * add a rowkey into delRows
     */
    public void addToDelList(Delete del) {
       delRows.add(del);
    }

    public void clearStateResource()
    {
        //TODO, clear all resources here
        //should be invoked by retireTransaction
        delRows.clear();
        putRows.clear();
    }

    /**
     * Get the commitId for this transaction.
     *
     * @return Return the commitSequenceId.
     */
    public synchronized long getCommitId() {
        return commitSequenceId;
    }

    /**
     * Set the commitId for this transaction.
     *
     */
    public synchronized void setCommitId(final long Id) {
        this.commitSequenceId = Id;
    }

    /**
     * return true if the transaction perform write operations: put or delete.
     *
     */
    public boolean hasWrite() {
        return ( putRows.size() > 0  || delRows.size() > 0 );
    }

    /**
    */
    public static boolean isSelfDelete(Cell status, long startId)
    {
        return status.getTimestamp() == startId
            && SsccConst.isDeleteStatus(CellUtil.cloneValue(status));
    }

    public void setStartId(long startId)
    {
        startId_ = startId;
    }

    public long getStartId()
    {
        return startId_;
    }

    /**
      each row contains two metadata column in _mt CF: status and versions
      A row can be visible must meet following rules (SSCC algorithm):
      1. the current startID is in status list as key (timestamp of Cell), and its value in status indicate it is not deleted
         This is because the row is updated by this own transaction, so must be visible. A delete flag will be
         set in status value if the operation is DELETE.
      2. the current startID is not in status list as key, but it is in the version list
         This is the case the row is a commited row, updated by other transactions
         we need to find the last transaction do commit.
         If its startId is smaller than current transaction's startId, then this row is also visible. Otherwise, still
         not visible.

    */
    public boolean handleResult(Cell inputCell,List<Cell> statusList,List<Cell> versionList,List<Cell> colList, long gTransId)
    {
        byte[] status = null;
        byte[] version = null;
        long startId = getStartId();
        long commitId = 0;
        long maxCommitId = 0;
        long maxStartId = 0;
        boolean finalret = false;// (maxStartId == thisTs);
        long thisTs = inputCell.getTimestamp();

        byte[] cNm = CellUtil.cloneQualifier(inputCell);  //column name

        byte[] matcher = byteMerger("|".getBytes(),null);
        matcher = byteMerger(matcher, cNm);
        matcher = byteMerger(matcher,"|".getBytes());
        try{
            if(LOG.isTraceEnabled()) LOG.trace("handleResult : ENTER: matcher: " + matcher);//statusList size is " + statusList.size() + " versionList size is " + versionList.size() + "gid is " + gTransId);
            /*
            if(statusList==null && versionList == null) //non-transactional data, user put it directly
            {
                 //maybe we can set a CQD for this?
                 //Now, I make this one visible.
                return true;
            }
            */
            if(thisTs > startId)  //only for debug checking, like an assert
            {
                //check whether has mt_ family , if has ,doesn't display, if not, displays
                if(versionList==null && statusList==null){
                   if(LOG.isTraceEnabled()) LOG.trace("handleResult thisTs " + thisTs+ " > startId " + startId + ".  Assuming cell was inserted outside of SSCC and returning true");
                   return true;
                }
                else {
                   if(LOG.isTraceEnabled()) LOG.trace("handleResult thisTs " + thisTs+ " > startId " + startId + ".  Cell is inserted by another transaction");
                   return false;
                }
            }

            if (statusList != null)
            {
                byte[] lv_colList = null;
                if(colList != null)
                {
                    //get the collist for this startId
                    for( Cell c : colList )
                    {
                        if( c.getTimestamp() == startId )
                            lv_colList = byteMerger(lv_colList,CellUtil.cloneValue(c) );
                    }
                }
                if(statusList.size() > 0) {
                    // This row is currently being modified by some transaction(s).  Check to see if our transaction is responsible.
                    boolean updateByMe = false;
                    List<byte[]> statusValList =  new LinkedList<byte[]>();
                    for (Cell c : statusList)
                    {
                        byte[] cellValueBytes = CellUtil.cloneValue(c);
                        // Check the transactionId responsible for this row
                        if(LOG.isTraceEnabled()) LOG.trace("handleResult check status item if transactionId is self ? gTransId is "
                                  + gTransId + " to compare to " + SsccConst.getTransactionId(cellValueBytes));
                        if( gTransId == SsccConst.getTransactionId(cellValueBytes))
                        {
                            // This row is updated by the current transaction
                            if(SsccConst.isDeleteStatus(cellValueBytes) == true ) //this row is delete
                            {
                                //In Trafodion, we have to delete the whole row, instead of individual cell
                                if(LOG.isTraceEnabled()) LOG.trace("handleResult row is deleted by this transaction");
                                return false;
                            }
                            if(indexOf(lv_colList,matcher) != -1) // This cell is updated by me
                            {
                                statusValList.add(cellValueBytes);
                                if(LOG.isTraceEnabled()) LOG.trace("handleResult check status item if transactionId is self update");
                                updateByMe = true;
                            }
                            else
                                if(LOG.isTraceEnabled()) LOG.trace("this cell is not updated by me , matcher " + Bytes.toString(matcher) +  " lv_colList is " + Bytes.toString(lv_colList) );
                        }
                        else
                            if(LOG.isTraceEnabled()) LOG.trace("handleResult check status item if transactionId is NOT self gTransId is " + gTransId + " to compare to " + SsccConst.getTransactionId(cellValueBytes));
                    }
                    if (updateByMe == true)  // I am updating this cell, but is this the version update by me?
                    {
                        if(thisTs == startId)
                        {
                            boolean isit = SsccConst.isSelfUpdate(statusValList,startId);
                            if(LOG.isTraceEnabled()) LOG.trace("handleResult this is updated by me " + isit);
                            return isit;
                        }
                        else
                        {
                            if(LOG.isTraceEnabled()) LOG.trace("handleResult is not update by me for this row");
                            return false;
                        }
                    }
                    else {
                       if(LOG.isTraceEnabled()) LOG.trace("handleResult updateByMe is false");
                    }
                }
                else{
                   if(LOG.isTraceEnabled()) LOG.trace("StatusList is not > 0");

                }
            }
            if(versionList == null){
                if(LOG.isTraceEnabled()) LOG.trace("handleResult versionList is null, so return false, invisible row");
                return false;
            }

            // Status is empty: no active update of this row, so need to check the commit version
            // or status is not empty but current transaction not update it, still need to check the commit version
            boolean versionIsDelete=false;
            for(Cell v: versionList) {
                    version=CellUtil.cloneValue(v);
                    commitId=v.getTimestamp();
                    long itsStartId = SsccConst.getVersionStartID(version);

                    if (commitId > startId) {
                       if(LOG.isTraceEnabled()) LOG.trace("handleResult cell committed after our startId, ignoring");
                       continue;
                    }

                    //check if this col is updated by this commit?
                    boolean sameCommit = false;
                    byte[] allcollist = null;
                    if(colList != null)
                    {
                        for( Cell colc : colList)
                        {
                            if(LOG.isTraceEnabled()) LOG.trace("colc list, itstartid " + itsStartId + " colc.timestamp " + colc.getTimestamp() );
                            if(itsStartId == colc.getTimestamp() )
                            {
                                byte[] colVBytes = CellUtil.cloneValue(colc);
                                allcollist = byteMerger(allcollist,colVBytes);
                            }
                        }
                        boolean allocListIsNull = false;
                        if( allcollist == null) allocListIsNull = true;
                        else {
                            if(allcollist.length == 0)  allocListIsNull = true;
                        }
                        if(indexOf(allcollist,matcher) != -1  || allocListIsNull == true)
                        {
                            sameCommit = true;
                            if(LOG.isTraceEnabled()) LOG.trace("handleResult: check version item cid: " + commitId );
                            //find the last commited row, and its time must be before this transaction start
                            if(commitId > maxCommitId && commitId < getStartId())
                            {
                                maxCommitId= commitId;
                                maxStartId = SsccConst.getVersionStartID(version);
                                versionIsDelete = SsccConst.isDeleteVersion(version);
                            }
                        }
                        else {
                            if(LOG.isTraceEnabled()) LOG.trace("this cell is not updated by this commit version, matcher " + Arrays.toString(matcher) +  " collist is " + Arrays.toString(allcollist) );
                        }
                    }
                    else {
                      if(LOG.isTraceEnabled()) LOG.trace("handleResult colList is null");
                    }
            }
            if(maxStartId == 0 && commitId < getStartId()) // out of MAX_VERSION window, this row must be visible
            {
               if (commitId < getStartId()) {
                  if(LOG.isTraceEnabled()) LOG.trace("handleResult : this cell committed before our startId");
               }
               if(LOG.isTraceEnabled()) LOG.trace("handleResult : this cell is out of MAX_VERSION window check, returning true");
               return true;
            }
            finalret = (maxStartId == thisTs) && (versionIsDelete == false) ;
            if(LOG.isTraceEnabled()) LOG.trace("handleResult: finally return " + finalret + " maxId is " + maxStartId + " thisTs is " + thisTs);
        }
        catch( Exception e) {
           LOG.error("handleResult:  get Caught exception " + e.getMessage() + ""  );
        }
        return finalret;
    }

    public synchronized void addScan(final Scan scan) {
        if (LOG.isTraceEnabled()) LOG.trace(String.format("Adding scan for transaction [%s], from [%s] to [%s]", transactionId,
            scan.getStartRow(),scan.getStopRow()));
        scans.add(scan);
    }

    public static int indexOf(byte[] source, byte[] find) {
       if (source == null) {
          return -1;
       }
       if (find == null) {
          return -1;
       }
       if (find.length > source.length) {
          return -1;
       }
       final int maxIndex = source.length - find.length;
       final int maxLength = find.length;
       final byte firstByte = find[0];
       int index = 0;
       Loop:
       do {
          if (source[index] == firstByte) {
            for (int i = 1; i < maxLength; i++) {
              if (source[index + i] != find[i]) {
                 continue Loop;
              }
            }
            return index;
          }
       } while (++index <= maxIndex);
       return -1;
    }

    public boolean hasConflict(List<Cell> statusList,List<Cell> versionList, boolean stateless,long startId,long gTransId) {
        if(LOG.isTraceEnabled()) LOG.trace("Entry hasConflict, stateless: " + stateless + ", startId: " + startId + ", transId: " + gTransId );

        /*
        if(statusList==null && versionList == null) //non-transactional data, user put it directly
        {
             //maybe we can set a CQD for this?
             //Now, I make this one visible.
            return true;
        }
        */
        //if the status list is empty
        // no other update at this point
        if((statusList == null) && (stateless == true)){
            // Cannot have a conflict
            if(LOG.isTraceEnabled()) LOG.trace("hasConflict statusList is null for stateless update: no conflict");
            return false;
        }
        if (statusList != null) {
           //status is not null
           if((statusList.size() == 0) && (stateless == true)){
              // Cannot have a conflict with an empty statusList
              if(LOG.isTraceEnabled()) LOG.trace("hasConflict statusList size 0 for stateless update: no conflict");
              return false;
           }
           else {
              // StatusList > 0
              if(LOG.isTraceEnabled()) LOG.trace("hasConflict statusList size > 0");
              if(checkStatusListForConflict( statusList,stateless,startId,gTransId) == true) {
                 if(LOG.isTraceEnabled()) LOG.trace("hasConflict checkStatusListForConflict returned true");
                 return true;
              }
              else {
                 // If we are a stateless update we don't need to check the version
                 if (stateless) {
                    if(LOG.isTraceEnabled()) LOG.trace("hasConflict checkStatusListForConflict returned false and this is a stateless update:  Skipping version checks");
                    return false;
                 }
              }
           } //  statusList.size() > 0
        }  // statusList == null
        if(LOG.isTraceEnabled()) LOG.trace("hasConflict checking versionList for conflict");
        return checkVersionListForConflict( versionList,startId);
    }

    private boolean checkVersionListForConflict(List<Cell> versionList,long startId)
    {
        long TxId = this.getTransactionId();
        if(LOG.isTraceEnabled()) LOG.trace("checkVersionListForConflict: ENTER TxId: " + TxId + ", startId is " + startId );
        if(versionList == null)
        {
            if(LOG.isTraceEnabled()) LOG.trace("checkVersionListForConflict: TxId: " + TxId + ", versionList is null, return false");
            return false;
        }
        for(Cell v : versionList)
        {
            long cellTimestamp = v.getTimestamp();
            if(LOG.isTraceEnabled()) LOG.trace("checkVersionListForConflict: TxId: " + TxId + ", iterate the version list v.timestamp is " + cellTimestamp );
            if(startId < cellTimestamp ) //some transaction commit after I beginTransaction
            {
                if(LOG.isTraceEnabled()) LOG.trace("checkVersionListForConflict: TxId: " + TxId + ", startId: " + startId +
                          " is < timestamp: " + cellTimestamp + ".  Returning true" );
                return true;
            }
            if(LOG.isTraceEnabled()) LOG.trace("checkVersionListForConflict : TxId: " + TxId + ", 3");
        }
        if(LOG.isTraceEnabled()) LOG.trace("checkVersionListForConflict : TxId: " + TxId + ", 4");
        return false;
    }

    private boolean checkStatusListForConflict(List<Cell> statusList, boolean stateless,long startId,long gTransId)
    {
        long TxId = this.getTransactionId();
        if(LOG.isTraceEnabled()) LOG.trace("checkStatusListForConflict: ENTER TxId: " + TxId + ", with startId " + startId );
        if(statusList == null) return false;
        int count = statusList.size();
        if(LOG.isTraceEnabled()) LOG.trace("checkStatusListForConflict: TxId: " + TxId + ", statusList is not null, size: " + count);

        if(count == 0) {
           return false;
        }

        if(count == 1)
        {
            //get the status Cell
            Cell c = statusList.get(0);
            if(LOG.isTraceEnabled()) LOG.trace("startId is " + startId + " c.timestamp is " + c.getTimestamp() + " c.value is " + Arrays.toString(CellUtil.cloneValue(c)));
            if(c.getTypeByte() == KeyValue.Type.DeleteFamilyVersion.getCode() )
            {
                if(LOG.isTraceEnabled()) LOG.trace("the status cell is deleted");
                return false;
            }
            if(LOG.isTraceEnabled()) LOG.trace("checkStatusListForConflict : check gTransId " + gTransId + " with status's transactionId " + SsccConst.getTransactionId( CellUtil.cloneValue(c) ) );
            return !(gTransId==SsccConst.getTransactionId( CellUtil.cloneValue(c) ));
        }

        if(count > 1){
           if(LOG.isTraceEnabled()) LOG.trace("checkStatusListForConflict: statusList counter > 1, stateless: " + stateless);
           if (stateless != true) {
             return true; //there are more than 1 update, and this is a stateful update
           }
           for (Cell c : statusList) {
              if (SsccConst.getStatusValue(CellUtil.cloneValue(c)) == SsccConst.S_STATEFUL_BYTE) {
                 if(LOG.isTraceEnabled()) LOG.trace("checkStatusListForConflict: stateful update already pending");
                 return true; //there is already a stateful update
              }
           }
        }

        return false;
    }

    public static byte[] byteMerger(byte[] byte_1, byte[] byte_2){
        if (byte_1 == null)
        {
            if (byte_2 == null)
                return null;
            else
                return byte_2;
        }
        else
        {
            if (byte_2 == null)
                return byte_1;
        }

        byte[] byte_3 = new byte[byte_1.length+byte_2.length];
        System.arraycopy(byte_1, 0, byte_3, 0, byte_1.length);
        System.arraycopy(byte_2, 0, byte_3, byte_1.length, byte_2.length);
        return byte_3;
    }
    @Override
    public String toString() {
        return super.toString() + ", startId: " + getStartId() + ", commitId: " + getCommitId();
    }

    /**
     * before put ,check whether there has delete previous. if true remove the del
     */
    public void removeDelBeforePut(Put put, boolean stateless) {
        if (LOG.isTraceEnabled())
            LOG.trace("removeDelBeforePut, del list size : "+delRows.size());
        byte[] putRow = put.getRow();
        long putTimeStamp = startId_;

        for(int i=delRows.size()-1;i>=0;i--){
            byte[] delRow = delRows.get(i).getRow();
            if (LOG.isTraceEnabled()){
                long delTimeStamp = delRows.get(i).getTimeStamp();
                LOG.trace("putRow : "+Bytes.toString(putRow)+" , timeStamp : "+putTimeStamp+".  delRow : "+Bytes.toString(delRow)+" , timeStamp : "+delTimeStamp);
            }
            if (Arrays.equals(putRow, delRow) ) {
                delRows.remove(i);
            }
        }
    }
}


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.

#nullable disable

using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Xml;
using Roslyn.Test.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.UnitTests
{
    public class AssemblyPortabilityPolicyTests : TestBase
    {
        private const string correctAppConfigText = @"
<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
       <supportPortability PKT=""7cec85d7bea7798e"" enable=""false""/> <!-- platform -->
    </assemblyBinding>
  </runtime>
</configuration>
";
        private static void AssertIsEnabled(string appConfigPath, bool platform, bool nonPlatform, bool fusionOnly = false)
        {
            using (var policy = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfigPath))
            {
                // portability is suppressed if the identities are not equivalent

                Assert.Equal(platform, IsEquivalent(policy,
                    "System, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
                    "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));

                Assert.Equal(nonPlatform, IsEquivalent(policy,
                    "System.ComponentModel.Composition, Version=5.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
                    "System.ComponentModel.Composition, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
            }

            if (!fusionOnly)
            {
                using (var stream = new FileStream(appConfigPath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    var actual = AssemblyPortabilityPolicy.LoadFromXml(stream);
                    Assert.Equal(platform, !actual.SuppressSilverlightPlatformAssembliesPortability);
                    Assert.Equal(nonPlatform, !actual.SuppressSilverlightLibraryAssembliesPortability);
                }
            }
        }

        private static bool IsEquivalent(FusionAssemblyPortabilityPolicy policy, string reference, string ported)
        {
            bool equivalent;
            FusionAssemblyIdentityComparer.AssemblyComparisonResult result;

            int hr = FusionAssemblyIdentityComparer.DefaultModelCompareAssemblyIdentity(
                reference,
                false,
                ported,
                false,
                out equivalent,
                out result,
                policy.ConfigCookie);

            return result == FusionAssemblyIdentityComparer.AssemblyComparisonResult.EquivalentFullMatch;
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_Errors()
        {
            var appConfig = Temp.CreateFile();
            var stream = new FileStream(appConfig.Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

            // not XML:
            appConfig.WriteAllText("garbage");
            stream.Position = 0;
            Assert.Throws<COMException>(() => FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path));
            Assert.Throws<XmlException>(() => AssemblyPortabilityPolicy.LoadFromXml(stream));

            // missing root element:
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
");
            stream.Position = 0;

            Assert.Throws<COMException>(() => FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path));
            Assert.Throws<XmlException>(() => AssemblyPortabilityPolicy.LoadFromXml(stream));

            // duplicate attribute:
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
       <supportPortability PKT=""7cec85d7bea7798e"" PKT=""31bf3856ad364e35"" enable=""false""/>
    </assemblyBinding>
  </runtime>
</configuration>
");
            stream.Position = 0;

            Assert.Throws<COMException>(() => FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path));
            Assert.Throws<XmlException>(() => AssemblyPortabilityPolicy.LoadFromXml(stream));
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_LeadingWhitespace()
        {
            var appConfig = Temp.CreateFile();

            // whitespace in front of header:
            appConfig.WriteAllText(
@"   <?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
       <supportPortability PKT=""7cec85d7bea7798e"" enable=""false""/> <!-- platform -->
    </assemblyBinding>
  </runtime>
</configuration>
");
            var stream = new FileStream(appConfig.Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

            AssertIsEnabled(appConfig.Path, platform: false, nonPlatform: true, fusionOnly: true);
            Assert.Throws<XmlException>(() => AssemblyPortabilityPolicy.LoadFromXml(stream));
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_LinkedConfiguration()
        {
            var appConfig1 = Temp.CreateFile();
            var appConfig2 = Temp.CreateFile();

            appConfig1.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
        <linkedConfiguration href=""file://" + appConfig2.Path + @"""/>
        <supportPortability PKT=""7cec85d7bea7798e"" enable=""false""/> <!-- platform -->
    </assemblyBinding>
  </runtime>
</configuration>
");

            appConfig2.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
       <supportPortability PKT=""31bf3856ad364e35"" enable=""false""/> <!-- non-platform -->
    </assemblyBinding>
  </runtime>
</configuration>
");

            // Linked configuration isn't supported by fusion when reading portability elements (see CreateAssemblyConfigCookie)
            AssertIsEnabled(appConfig1.Path, platform: false, nonPlatform: true);
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_NoValues()
        {
            var appConfig = Temp.CreateFile();

            // ok, but no configuration:
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<goo>
</goo>
");
            AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true);

            // ok, but no runtime
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
</configuration>
");
            AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true);

            // ok, but no assembly binding
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
  </runtime>
</configuration>
");
            AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true);

            // no namespace
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <goo/>
  <runtime>
    <goo/>
    <assemblyBinding>
    </assemblyBinding>
    <goo/>
  </runtime>
  <goo/>
</configuration>
");
            AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true);
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_Values_MissingNamespace()
        {
            var appConfig = Temp.CreateFile();
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding>
       <supportPortability PKT=""7cec85d7bea7798e"" enable=""false""/> <!-- platform -->
       <supportPortability PKT=""31bf3856ad364e35"" enable=""false""/> <!-- non-platform -->
    </assemblyBinding>
  </runtime>
</configuration>
");
            AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true);
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_Values1()
        {
            var appConfig = Temp.CreateFile();

            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
       <supportPortability PKT=""7cec85d7bea7798e"" enable=""false""/>   <!-- platform -->
    </assemblyBinding>
  </runtime>
</configuration>
");
            AssertIsEnabled(appConfig.Path, platform: false, nonPlatform: true);
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_Values2()
        {
            var appConfig = Temp.CreateFile();

            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
       <supportPortability PKT=""31bf3856ad364e35"" enable=""false""/>  <!-- non-platform -->
    </assemblyBinding>
  </runtime>
</configuration>
");
            AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: false);
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_Values4()
        {
            var appConfig = Temp.CreateFile();
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
       <supportPortability PKT=""7cec85d7bea7798e"" enable=""true""/> <!-- platform -->
       <supportPortability PKT=""31bf3856ad364e35"" enable=""false""/> <!-- nonplatform -->
    </assemblyBinding>
  </runtime>
</configuration>
");
            AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: false);
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_DuplicateSupportPortability1()
        {
            var appConfig = Temp.CreateFile();
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
       <supportPortability PKT=""7cec85d7bea7798e"" enable=""true""/>   <!-- platform -->
       <supportPortability PKT=""7cec85d7bea7798e"" enable=""false""/>  <!-- platform -->
       <supportPortability PKT=""31bf3856ad364e35"" enable=""false""/> <!-- nonplatform -->
    </assemblyBinding>
  </runtime>
</configuration>
");
            AssertIsEnabled(appConfig.Path, platform: false, nonPlatform: false);
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_DuplicateSupportPortability2()
        {
            var appConfig = Temp.CreateFile();
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
       <supportPortability PKT=""7cec85d7bea7798e"" enable=""false""/> <!-- platform -->
       <supportPortability PKT=""31bf3856ad364e35"" enable=""false""/> <!-- nonplatform -->
       <supportPortability PKT=""7cec85d7bea7798e"" enable=""true""/>  <!-- platform -->
       <supportPortability PKT=""31bf3856ad364e35"" enable=""false""/> <!-- nonplatform -->
    </assemblyBinding>
  </runtime>
</configuration>
");
            AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: false);
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_UnknownAttributes2()
        {
            var appConfig = Temp.CreateFile();
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
       <supportPortability PKT=""7cec85d7bea7798e"" goo=""false""/> <!-- platform -->
       <supportPortability pkt=""7cec85d7bea7798e"" enable=""false""/> <!-- platform -->
       <supportPortability PKT=""31bf3856ad364e35"" Enable=""false""/> <!-- nonplatform -->
       <supportPortability enable=""false""/> <!-- platform -->
       <supportPortability PKT=""31Zf3856ad364e35"" enable=""false""/> <!-- garbage -->
       <supportPortability PKT=""9999999999999999"" enable=""false""/> <!-- garbage -->
       <supportPortability PKT="""" enable=""false""/> <!-- garbage -->
       <supportPortability PKT=""7cec85d7bea7798e"" enable=""""/> <!-- garbage -->
    </assemblyBinding>
  </runtime>
</configuration>
");
            AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true);
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_InterleavingElements()
        {
            var appConfig = Temp.CreateFile();
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <goo>
    <runtime>
      <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
         <supportPortability PKT=""7cec85d7bea7798e"" enable=""true""/> <!-- platform -->
         <supportPortability PKT=""31bf3856ad364e35"" enable=""false""/> <!-- nonplatform -->
      </assemblyBinding>
    </runtime>
  </goo>
</configuration>
");
            AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true);
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void LoadFromFile_EmptyElement()
        {
            var appConfig = Temp.CreateFile();
            appConfig.WriteAllText(
@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <goo>
    <runtime>
      <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"" />
    </runtime>
  </goo>
</configuration>
");
            AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true);
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void Fusion_Dispose()
        {
            var appConfig = Temp.CreateFile().WriteAllText(correctAppConfigText);

            var policy = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path);
            Assert.NotEqual(IntPtr.Zero, policy.ConfigCookie);
            policy.Dispose();
            Assert.Equal(IntPtr.Zero, policy.ConfigCookie);
            policy.Dispose();
            Assert.Equal(IntPtr.Zero, policy.ConfigCookie);
        }

        [ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.TestExecutionNeedsFusion)]
        public void Fusion_TestEquals()
        {
            var appConfig = Temp.CreateFile().WriteAllText(correctAppConfigText);

            var policy1 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path);
            var policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path);
            Assert.Equal(policy1, policy2);
            Assert.Equal(policy1.GetHashCode(), policy2.GetHashCode());

            appConfig.WriteAllText(correctAppConfigText);
            policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path);
            Assert.Equal(policy1, policy2);
            Assert.Equal(policy1.GetHashCode(), policy2.GetHashCode());

            appConfig = Temp.CreateFile().WriteAllText(correctAppConfigText);
            policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path);
            Assert.Equal(policy1, policy2);
            Assert.Equal(policy1.GetHashCode(), policy2.GetHashCode());

            appConfig.WriteAllText(@"
<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
       <supportPortability PKT=""01234567890abcdef"" enable=""false""/>
    </assemblyBinding>
  </runtime>
</configuration>");

            policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path);
            Assert.NotEqual(policy1, policy2);

            var appConfig2 = Temp.CreateFile().WriteAllText(correctAppConfigText);

            policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig2.Path);
            Assert.Equal(policy1, policy2);
            Assert.Equal(policy1.GetHashCode(), policy2.GetHashCode());
        }
    }
}


text:
try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup
import codecs
import os
import re

# Get the long description from the relevant file
with codecs.open('README.rst', encoding='utf-8') as f:
    long_description = f.read()
main_pkg = "qt_backport"
setup(
    name=main_pkg,
    version=open(main_pkg + "/VERSION", "r").read().strip(),
    description="Makes PySide/PyQt4 code work with Qt5 (using PyQt5)",
    long_description=long_description,
    url='https://github.com/rwarren/qt_backport',
    author='Russell Warren',
    author_email='russ@perspexis.com',
    license='MIT',
    classifiers=[
        'Development Status :: 3 - Alpha',
        'Intended Audience :: Developers',
        'Topic :: Software Development',
        "Topic :: Software Development :: User Interfaces",
        "Topic :: Software Development :: Libraries :: Python Modules",
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        "Operating System :: OS Independent",
    ],
    keywords='Qt PyQt4 PyQt5 PySide',
    packages=[main_pkg, "PyQt4", "PySide"],
    install_requires = [], #PyQt5 needed, but not PyPI friendly
    package_data={main_pkg: ["VERSION", ]},
    data_files=[],
    entry_points={},
)