text:
namespace tesseract {

// Min and max window sizes.
const int kMinWinSize = 500;
const int kMaxWinSize = 2000;
// Window frame sizes need adding on to make the content fit.
const int kXWinFrameSize = 30;
const int kYWinFrameSize = 80;

// String names corresponding to the NetworkType enum.
// Keep in sync with NetworkType.
// Names used in Serialization to allow re-ordering/addition/deletion of
// layer types in NetworkType without invalidating existing network files.
static char const* const kTypeNames[NT_COUNT] = {
    "Invalid",     "Input",
    "Convolve",    "Maxpool",
    "Parallel",    "Replicated",
    "ParBidiLSTM", "DepParUDLSTM",
    "Par2dLSTM",   "Series",
    "Reconfig",    "RTLReversed",
    "TTBReversed", "XYTranspose",
    "LSTM",        "SummLSTM",
    "Logistic",    "LinLogistic",
    "LinTanh",     "Tanh",
    "Relu",        "Linear",
    "Softmax",     "SoftmaxNoCTC",
    "LSTMSoftmax", "LSTMBinarySoftmax",
    "TensorFlow",
};

Network::Network()
    : type_(NT_NONE),
      training_(TS_ENABLED),
      needs_to_backprop_(true),
      network_flags_(0),
      ni_(0),
      no_(0),
      num_weights_(0),
      forward_win_(nullptr),
      backward_win_(nullptr),
      randomizer_(nullptr) {}
Network::Network(NetworkType type, const STRING& name, int ni, int no)
    : type_(type),
      training_(TS_ENABLED),
      needs_to_backprop_(true),
      network_flags_(0),
      ni_(ni),
      no_(no),
      num_weights_(0),
      name_(name),
      forward_win_(nullptr),
      backward_win_(nullptr),
      randomizer_(nullptr) {}

// Suspends/Enables/Permanently disables training by setting the training_
// flag. Serialize and DeSerialize only operate on the run-time data if state
// is TS_DISABLED or TS_TEMP_DISABLE. Specifying TS_TEMP_DISABLE will
// temporarily disable layers in state TS_ENABLED, allowing a trainer to
// serialize as if it were a recognizer.
// TS_RE_ENABLE will re-enable layers that were previously in any disabled
// state. If in TS_TEMP_DISABLE then the flag is just changed, but if in
// TS_DISABLED, the deltas in the weight matrices are reinitialized so that a
// recognizer can be converted back to a trainer.
void Network::SetEnableTraining(TrainingState state) {
  if (state == TS_RE_ENABLE) {
    // Enable only from temp disabled.
    if (training_ == TS_TEMP_DISABLE) training_ = TS_ENABLED;
  } else if (state == TS_TEMP_DISABLE) {
    // Temp disable only from enabled.
    if (training_ == TS_ENABLED) training_ = state;
  } else {
    training_ = state;
  }
}

// Sets flags that control the action of the network. See NetworkFlags enum
// for bit values.
void Network::SetNetworkFlags(uint32_t flags) {
  network_flags_ = flags;
}

// Sets up the network for training. Initializes weights using weights of
// scale `range` picked according to the random number generator `randomizer`.
int Network::InitWeights(float range, TRand* randomizer) {
  randomizer_ = randomizer;
  return 0;
}

// Provides a pointer to a TRand for any networks that care to use it.
// Note that randomizer is a borrowed pointer that should outlive the network
// and should not be deleted by any of the networks.
void Network::SetRandomizer(TRand* randomizer) {
  randomizer_ = randomizer;
}

// Sets needs_to_backprop_ to needs_backprop and returns true if
// needs_backprop || any weights in this network so the next layer forward
// can be told to produce backprop for this layer if needed.
bool Network::SetupNeedsBackprop(bool needs_backprop) {
  needs_to_backprop_ = needs_backprop;
  return needs_backprop || num_weights_ > 0;
}

// Writes to the given file. Returns false in case of error.
bool Network::Serialize(TFile* fp) const {
  int8_t data = NT_NONE;
  if (!fp->Serialize(&data)) return false;
  STRING type_name = kTypeNames[type_];
  if (!type_name.Serialize(fp)) return false;
  data = training_;
  if (!fp->Serialize(&data)) return false;
  data = needs_to_backprop_;
  if (!fp->Serialize(&data)) return false;
  if (!fp->Serialize(&network_flags_)) return false;
  if (!fp->Serialize(&ni_)) return false;
  if (!fp->Serialize(&no_)) return false;
  if (!fp->Serialize(&num_weights_)) return false;
  if (!name_.Serialize(fp)) return false;
  return true;
}

static NetworkType getNetworkType(TFile* fp) {
  int8_t data;
  if (!fp->DeSerialize(&data)) return NT_NONE;
  if (data == NT_NONE) {
    STRING type_name;
    if (!type_name.DeSerialize(fp)) return NT_NONE;
    for (data = 0; data < NT_COUNT && type_name != kTypeNames[data]; ++data) {
    }
    if (data == NT_COUNT) {
      tprintf("Invalid network layer type:%s\n", type_name.string());
      return NT_NONE;
    }
  }
  return static_cast<NetworkType>(data);
}

// Reads from the given file. Returns nullptr in case of error.
// Determines the type of the serialized class and calls its DeSerialize
// on a new object of the appropriate type, which is returned.
Network* Network::CreateFromFile(TFile* fp) {
  NetworkType type;          // Type of the derived network class.
  TrainingState training;    // Are we currently training?
  bool needs_to_backprop;    // This network needs to output back_deltas.
  int32_t network_flags;     // Behavior control flags in NetworkFlags.
  int32_t ni;                // Number of input values.
  int32_t no;                // Number of output values.
  int32_t num_weights;       // Number of weights in this and sub-network.
  STRING name;               // A unique name for this layer.
  int8_t data;
  Network* network = nullptr;
  type = getNetworkType(fp);
  if (!fp->DeSerialize(&data)) return nullptr;
  training = data == TS_ENABLED ? TS_ENABLED : TS_DISABLED;
  if (!fp->DeSerialize(&data)) return nullptr;
  needs_to_backprop = data != 0;
  if (!fp->DeSerialize(&network_flags)) return nullptr;
  if (!fp->DeSerialize(&ni)) return nullptr;
  if (!fp->DeSerialize(&no)) return nullptr;
  if (!fp->DeSerialize(&num_weights)) return nullptr;
  if (!name.DeSerialize(fp)) return nullptr;

  switch (type) {
    case NT_CONVOLVE:
      network = new Convolve(name, ni, 0, 0);
      break;
    case NT_INPUT:
      network = new Input(name, ni, no);
      break;
    case NT_LSTM:
    case NT_LSTM_SOFTMAX:
    case NT_LSTM_SOFTMAX_ENCODED:
    case NT_LSTM_SUMMARY:
      network =
          new LSTM(name, ni, no, no, false, type);
      break;
    case NT_MAXPOOL:
      network = new Maxpool(name, ni, 0, 0);
      break;
    // All variants of Parallel.
    case NT_PARALLEL:
    case NT_REPLICATED:
    case NT_PAR_RL_LSTM:
    case NT_PAR_UD_LSTM:
    case NT_PAR_2D_LSTM:
      network = new Parallel(name, type);
      break;
    case NT_RECONFIG:
      network = new Reconfig(name, ni, 0, 0);
      break;
    // All variants of reversed.
    case NT_XREVERSED:
    case NT_YREVERSED:
    case NT_XYTRANSPOSE:
      network = new Reversed(name, type);
      break;
    case NT_SERIES:
      network = new Series(name);
      break;
    case NT_TENSORFLOW:
#ifdef INCLUDE_TENSORFLOW
      network = new TFNetwork(name);
#else
      tprintf("TensorFlow not compiled in! -DINCLUDE_TENSORFLOW\n");
#endif
      break;
    // All variants of FullyConnected.
    case NT_SOFTMAX:
    case NT_SOFTMAX_NO_CTC:
    case NT_RELU:
    case NT_TANH:
    case NT_LINEAR:
    case NT_LOGISTIC:
    case NT_POSCLIP:
    case NT_SYMCLIP:
      network = new FullyConnected(name, ni, no, type);
      break;
    default:
      break;
  }
  if (network) {
    network->training_ = training;
    network->needs_to_backprop_ = needs_to_backprop;
    network->network_flags_ = network_flags;
    network->num_weights_ = num_weights;
    if (!network->DeSerialize(fp)) {
      delete network;
      network = nullptr;
    }
  }
  return network;
}

// Returns a random number in [-range, range].
double Network::Random(double range) {
  ASSERT_HOST(randomizer_ != nullptr);
  return randomizer_->SignedRand(range);
}

// === Debug image display methods. ===
// Displays the image of the matrix to the forward window.
void Network::DisplayForward(const NetworkIO& matrix) {
#ifndef GRAPHICS_DISABLED  // do nothing if there's no graphics
  Pix* image = matrix.ToPix();
  ClearWindow(false, name_.string(), pixGetWidth(image),
              pixGetHeight(image), &forward_win_);
  DisplayImage(image, forward_win_);
  forward_win_->Update();
#endif  // GRAPHICS_DISABLED
}

// Displays the image of the matrix to the backward window.
void Network::DisplayBackward(const NetworkIO& matrix) {
#ifndef GRAPHICS_DISABLED  // do nothing if there's no graphics
  Pix* image = matrix.ToPix();
  STRING window_name = name_ + "-back";
  ClearWindow(false, window_name.string(), pixGetWidth(image),
              pixGetHeight(image), &backward_win_);
  DisplayImage(image, backward_win_);
  backward_win_->Update();
#endif  // GRAPHICS_DISABLED
}

#ifndef GRAPHICS_DISABLED
// Creates the window if needed, otherwise clears it.
void Network::ClearWindow(bool tess_coords, const char* window_name,
                          int width, int height, ScrollView** window) {
  if (*window == nullptr) {
    int min_size = std::min(width, height);
    if (min_size < kMinWinSize) {
      if (min_size < 1) min_size = 1;
      width = width * kMinWinSize / min_size;
      height = height * kMinWinSize / min_size;
    }
    width += kXWinFrameSize;
    height += kYWinFrameSize;
    if (width > kMaxWinSize) width = kMaxWinSize;
    if (height > kMaxWinSize) height = kMaxWinSize;
    *window = new ScrollView(window_name, 80, 100, width, height, width, height,
                             tess_coords);
    tprintf("Created window %s of size %d, %d\n", window_name, width, height);
  } else {
    (*window)->Clear();
  }
}

// Displays the pix in the given window. and returns the height of the pix.
// The pix is pixDestroyed.
int Network::DisplayImage(Pix* pix, ScrollView* window) {
  int height = pixGetHeight(pix);
  window->Image(pix, 0, 0);
  pixDestroy(&pix);
  return height;
}
#endif  // GRAPHICS_DISABLED

}  // namespace tesseract.


text:
/*****************************************************************************/
/**
*
* @file xbasic_types.h
*
*
* @note  Dummy File for backwards compatibility
*

*
* <pre>
* MODIFICATION HISTORY:
*
* Ver   Who    Date   Changes
* ----- ---- -------- -------------------------------------------------------
* 1.00a adk   1/31/14  Added in bsp common folder for backward compatibility
* </pre>
*
******************************************************************************/

#ifndef XBASIC_TYPES_H	/* prevent circular inclusions */
#define XBASIC_TYPES_H	/* by using protection macros */

/** @name Legacy types
 * Deprecated legacy types.
 * @{
 */
typedef unsigned char	Xuint8;		/**< unsigned 8-bit */
typedef char		Xint8;		/**< signed 8-bit */
typedef unsigned short	Xuint16;	/**< unsigned 16-bit */
typedef short		Xint16;		/**< signed 16-bit */
typedef unsigned long	Xuint32;	/**< unsigned 32-bit */
typedef long		Xint32;		/**< signed 32-bit */
typedef float		Xfloat32;	/**< 32-bit floating point */
typedef double		Xfloat64;	/**< 64-bit double precision FP */
typedef unsigned long	Xboolean;	/**< boolean (XTRUE or XFALSE) */

#if !defined __XUINT64__
typedef struct
{
	Xuint32 Upper;
	Xuint32 Lower;
} Xuint64;
#endif

/** @name New types
 * New simple types.
 * @{
 */
#ifndef __KERNEL__
#ifndef XIL_TYPES_H
typedef Xuint32         u32;
typedef Xuint16         u16;
typedef Xuint8          u8;
#endif
#else
#include <linux/types.h>
#endif

#ifndef TRUE
#  define TRUE		1
#endif

#ifndef FALSE
#  define FALSE		0
#endif

#ifndef NULL
#define NULL		0
#endif

/*
 * Xilinx NULL, TRUE and FALSE legacy support. Deprecated.
 * Please use NULL, TRUE and FALSE
 */
#define XNULL		NULL
#define XTRUE		TRUE
#define XFALSE		FALSE

/*
 * This file is deprecated and users
 * should use xil_types.h and xil_assert.h\n\r
 */
#warning  The xbasics_type.h file is deprecated and users should use xil_types.h and xil_assert.
#warning  Please refer the Standalone BSP UG647 for further details

#endif	/* end of protection macro */

redpajama_set_name: RedPajamaGithub


text:
import * as assert from 'assert';
import { URI } from 'vs/base/common/uri';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices';
import { AbstractResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
import { ILabelService } from 'vs/platform/label/common/label';
import { IFileService } from 'vs/platform/files/common/files';
import { EditorInputCapabilities, Verbosity } from 'vs/workbench/common/editor';
import { DisposableStore } from 'vs/base/common/lifecycle';

suite('ResourceEditorInput', () => {

	let disposables: DisposableStore;
	let instantiationService: IInstantiationService;

	class TestResourceEditorInput extends AbstractResourceEditorInput {

		readonly typeId = 'test.typeId';

		constructor(
			resource: URI,
			@ILabelService labelService: ILabelService,
			@IFileService fileService: IFileService
		) {
			super(resource, resource, labelService, fileService);
		}
	}

	setup(() => {
		disposables = new DisposableStore();
		instantiationService = workbenchInstantiationService(undefined, disposables);
	});

	teardown(() => {
		disposables.dispose();
	});

	test('basics', async () => {
		const resource = URI.from({ scheme: 'testResource', path: 'thePath/of/the/resource.txt' });

		const input = instantiationService.createInstance(TestResourceEditorInput, resource);

		assert.ok(input.getName().length > 0);

		assert.ok(input.getDescription(Verbosity.SHORT)!.length > 0);
		assert.ok(input.getDescription(Verbosity.MEDIUM)!.length > 0);
		assert.ok(input.getDescription(Verbosity.LONG)!.length > 0);

		assert.ok(input.getTitle(Verbosity.SHORT).length > 0);
		assert.ok(input.getTitle(Verbosity.MEDIUM).length > 0);
		assert.ok(input.getTitle(Verbosity.LONG).length > 0);

		assert.strictEqual(input.hasCapability(EditorInputCapabilities.Readonly), false);
		assert.strictEqual(input.hasCapability(EditorInputCapabilities.Untitled), true);
	});
});


text:
package com.ning.billing.recurly;

import java.util.UUID;

import org.joda.time.DateTime;

import com.ning.billing.recurly.model.Account;
import com.ning.billing.recurly.model.AddOn;
import com.ning.billing.recurly.model.Address;
import com.ning.billing.recurly.model.BillingInfo;
import com.ning.billing.recurly.model.Coupon;
import com.ning.billing.recurly.model.Plan;
import com.ning.billing.recurly.model.RecurlyUnitCurrency;
import com.ning.billing.recurly.model.Subscription;
import com.ning.billing.recurly.model.SubscriptionAddOn;
import com.ning.billing.recurly.model.SubscriptionAddOns;
import com.ning.billing.recurly.model.Transaction;

public class TestUtils {

    /**
     * Returns a random {@link String}.
     *
     * @return The random {@link String}
     */
    public static String randomString() {
        return UUID.randomUUID().toString().replace("-", "").substring(0, 5);
    }

    /**
     * Generates a String comprised of random alpha-numeric
     * chars upto the length as defined by the input param.
     *
     * @param n The length, in number of chars, of the returned
     *          String
     * @return A random alpah-numeric String
     */
    public static String getRandomAlphaNumString(final int n) {
        int offset = n;
        final String retValue = UUID.randomUUID().toString().replace("-", "");

        if (retValue.length() <= n) {
            offset = retValue.length() - 1;
        }
        return retValue.substring(0, offset);
    }

    /**
     * Generates a String comprised of random numeric
     * chars upto the length as defined by the input param.
     *
     * @param n The length, in number of chars, of the returned
     *          String
     * @return A random numeric String
     */
    public static String getRandomNumString(final int n) {
        return "" + new Double(Math.random() * 100).intValue();
    }

    /**
     * Returns a random {@link Integer} within the range 0 to upperRange
     *
     * @param upperRange The limit of the upperRange - the random returned value could be upto and including this value
     * @return The random integer - from within the range 0 to upperRange
     */
    public static Integer randomInteger(final int upperRange) {
        return (int) (Math.random() * upperRange);
    }

    public static String createTestCCNumber() {
        return "4111-1111-1111-1111";
    }

    public static String createTestCCVerificationNumber() {
        return "123";
    }

    public static String createTestCCMonth() {
        return "11";
    }

    public static String createTestCCYear() {
        return "2015";
    }

    /**
     * Creates a random {@link com.ning.billing.recurly.model.Account} object for testing use.
     *
     * @return The random {@link com.ning.billing.recurly.model.Account} object
     */
    public static Account createRandomAccount() {
        final Account account = new Account();
        account.setAcceptLanguage("en_US");
        account.setAccountCode(UUID.randomUUID().toString());
        account.setCompanyName(getRandomAlphaNumString(10));
        account.setEmail(getRandomAlphaNumString(4) + "@test.com");
        account.setFirstName(getRandomAlphaNumString(5));
        account.setLastName(getRandomAlphaNumString(6));

        final Address address = new Address();
        address.setAddress1(UUID.randomUUID().toString());
        address.setAddress2(UUID.randomUUID().toString());
        address.setCity(UUID.randomUUID().toString());
        address.setState(UUID.randomUUID().toString());
        address.setZip(49302);
        address.setCountry(UUID.randomUUID().toString());
        address.setPhone(UUID.randomUUID().toString());
        account.setAddress(address);

        return account;
    }

    /**
     * Creates a random {@link com.ning.billing.recurly.model.BillingInfo} object for testing use.
     *
     * @return The random {@link com.ning.billing.recurly.model.BillingInfo} object
     */
    public static BillingInfo createRandomBillingInfo() {
        final BillingInfo info = new BillingInfo();
        info.setAccount(createRandomAccount());
        info.setFirstName(getRandomAlphaNumString(5));
        info.setLastName(getRandomAlphaNumString(6));
        info.setCompany(getRandomAlphaNumString(10));
        info.setAddress1(getRandomAlphaNumString(10));
        info.setAddress2(getRandomAlphaNumString(10));
        info.setCity(getRandomAlphaNumString(10));
        info.setState(getRandomAlphaNumString(10));
        info.setZip(getRandomAlphaNumString(5));
        info.setCountry(getRandomAlphaNumString(5));
        info.setPhone(randomInteger(8));
        info.setVatNumber(getRandomNumString(8));
        //info.setIpAddress(LifecycleTest.getRandomAlphaNumString(5));
        info.setYear(createTestCCYear());
        info.setMonth(createTestCCMonth());
        info.setNumber(createTestCCNumber());
        info.setVerificationValue(createTestCCVerificationNumber());

        return info;
    }

    /**
     * Creates a random {@link com.ning.billing.recurly.model.Plan} object for testing use.
     *
     * @return The random {@link com.ning.billing.recurly.model.Plan} object
     */
    public static Plan createRandomPlan() {
        final Plan plan = new Plan();
        plan.setPlanCode(getRandomAlphaNumString(10));
        plan.setName(getRandomAlphaNumString(10));
        plan.setPlanIntervalLength(randomInteger(50) + 1);
        plan.setPlanIntervalUnit("months");
        plan.setSetupFeeInCents(createRandomPrice());
        plan.setUnitAmountInCents(createRandomPrice());

        return plan;
    }

    /**
     * Creates a random {@link Plan} object for testing use.
     */
    public static Plan createRandomPlan(final String currencyCode) {
        final Plan plan = createRandomPlan();
        plan.setSetupFeeInCents(createRandomSinglePrice(currencyCode));
        plan.setUnitAmountInCents(createRandomSinglePrice(currencyCode));

        return plan;
    }

    /**
     * Creates a random {@link RecurlyUnitCurrency} object for testing use.
     *
     * @return The random {@link RecurlyUnitCurrency} object
     */
    public static RecurlyUnitCurrency createRandomPrice() {
        final RecurlyUnitCurrency price = new RecurlyUnitCurrency();
        /*
        price.setUnitAmountEUR(LifecycleTest.randomInteger(10));
        price.setUnitAmountGBP(LifecycleTest.randomInteger(10));
        price.setUnitAmountUSD(LifecycleTest.randomInteger(10));
        price.setUnitAmountSEK(LifecycleTest.randomInteger(10));
        */
        price.setUnitAmountEUR(10);

        return price;
    }

    /**
     * Creates a random {@link RecurlyUnitCurrency} object for testing use. The Price
     * object
     *
     * @param currencyCode The currency for which we should return a random Price
     * @return The random {@link RecurlyUnitCurrency} object
     */
    public static RecurlyUnitCurrency createRandomSinglePrice(final String currencyCode) {
        final RecurlyUnitCurrency price = new RecurlyUnitCurrency();

        // using if's as we are not guaranteed to be on JDK7
        if (currencyCode.endsWith("EUR")) {
            price.setUnitAmountEUR(randomInteger(10));
        }

        if (currencyCode.endsWith("GBP")) {
            price.setUnitAmountGBP(randomInteger(10));
        }

        if (currencyCode.endsWith("USD")) {
            price.setUnitAmountUSD(randomInteger(10));
        }

        if (currencyCode.endsWith("SEK")) {
            price.setUnitAmountSEK(randomInteger(10));
        }

        return price;
    }

    /**
     * Creates a random currency {@link String} from the set:
     *

     *
EUR

     *
GBP

     *
USD

     *
SEK

     *

     *
     * @return The {@link String} code for the randomly chosen currency
     */
    public static String createRandomCurrency() {
        final String[] currencies = {"EUR", "GBP", "USD", "SEK"};
        return currencies[(int) (Math.random() * currencies.length)];
    }

    /**
     * Creates a random {@link com.ning.billing.recurly.model.Subscription} object for use in tests
     *
     * @param currencyCode The currency code for which the subscription will be charged in
     * @param plan         The associated plan
     * @param account      The associated account
     * @param planAddOns   AddOns for that subscription
     * @return The {@link com.ning.billing.recurly.model.Subscription} object
     */
    public static Subscription createRandomSubscription(final String currencyCode, final Plan plan, final Account account, final Iterable<AddOn> planAddOns) {
        final Subscription sub = new Subscription();
        // Make sure the quantity is > 0
        sub.setQuantity(randomInteger(10) + 1);
        sub.setCurrency(createRandomCurrency());
        sub.setPlanCode(plan.getPlanCode());
        sub.setAccount(account);
        sub.setUnitAmountInCents(randomInteger(10));
        sub.setCurrency(currencyCode);
        final SubscriptionAddOns addOns = new SubscriptionAddOns();
        for (final AddOn addOn : planAddOns) {
            addOns.add(createRandomSubscriptionAddOn(addOn.getAddOnCode()));
        }
        sub.setAddOns(addOns);

        return sub;
    }

    /**
     * Creates a random {@link Transaction} object for use in Tests
     *
     * @return The random {@link Transaction} object
     */
    public static Transaction createRandomTransaction() {
        final Transaction trans = new Transaction();
        trans.setAccount(createRandomAccount());
        trans.setAction(getRandomAlphaNumString(5));
        trans.setAmountInCents(getRandomNumString(100));
        trans.setTaxInCents(getRandomNumString(100));
        trans.setCurrency(createRandomCurrency());
        trans.setStatus(getRandomAlphaNumString(2));
        trans.setCreatedAt(DateTime.now());

        return trans;
    }

    /**
     * Creates a random {@link AddOn} for use in Tests.
     *
     * @return The random {@link AddOn}
     */
    public static AddOn createRandomAddOn() {
        final AddOn addOn = new AddOn();
        addOn.setAddOnCode(getRandomAlphaNumString(10));
        addOn.setName(getRandomAlphaNumString(10));
        addOn.setUnitAmountInCents(createRandomPrice());
        addOn.setDefaultQuantity(5);
        addOn.setDisplayQuantityOnHostedPage(false);
        return addOn;
    }

    /**
     * Creates a random {@link SubscriptionAddOn} for use in Tests.
     *
     * @param addOnCode AddOn code
     * @return The random {@link SubscriptionAddOn}
     */
    public static SubscriptionAddOn createRandomSubscriptionAddOn(final String addOnCode) {
        final SubscriptionAddOn addOn = new SubscriptionAddOn();
        addOn.setAddOnCode(addOnCode);
        addOn.setUnitAmountInCents(42);
        addOn.setQuantity(5);
        return addOn;
    }

    /**
     * Creates a random {@link AddOn} that has only a single price attached to it
     *
     * @param currencyCode The currency code for which the single price should be in. From the set:
     *                     EUR;
     * @return The random {@link AddOn}
     */
    public static AddOn createRandomAddOn(final String currencyCode) {
        final AddOn addOn = createRandomAddOn();
        addOn.setUnitAmountInCents(createRandomSinglePrice(currencyCode));

        return addOn;
    }

    /**
     * Creates a random {@link Coupon} object for use in Tests
     *
     * @return The random {@link Coupon} object
     */
    public static Coupon createRandomCoupon() {
        final Coupon coupon = new Coupon();
        coupon.setName(TestUtils.randomString());
        coupon.setCouponCode(TestUtils.randomString());
        coupon.setDiscountType("percent");
        coupon.setDiscountPercent("10");
        return coupon;
    }
}


text:
from __future__ import print_function
import sys

sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glrm import H2OGeneralizedLowRankEstimator

'''
PUBDEV-5493: GLRM return different results regardless of seed setting.
'''

def test_glrm_seeds():
  print("Importing iris_wheader.csv data...")
  irisH2O = h2o.upload_file(pyunit_utils.locate("smalldata/iris/iris_wheader.csv"))
  irisH2O.describe()
  initMethods = ["random", "svd", "plus_plus", "user"] # user mode without init values is equivalent to randomized
  seeds = [123456789, 987654321]

  for initM in initMethods:
    # first two models are trained with same seed and should be the same
    glrm_h2o_seed0 = setupTrainModel(initM, seeds[0])
    predict_seed0 = predGLRM(irisH2O, glrm_h2o_seed0)

    glrm_h2o_seed0Same = setupTrainModel(initM, seeds[0])
    predict_seed0Same = predGLRM(irisH2O, glrm_h2o_seed0Same)

    # trained with same seed, reconstructed datasets should be the same
    pyunit_utils.compare_frames_local(predict_seed0[0:4], predict_seed0Same[0:4],
                                      prob=1.0)  # compare and make sure reconstructed frames are the same

    # trained with different seed, reconstructed datasets should be different
    glrm_h2o_seed1 = setupTrainModel(initM, seeds[1])
    predict_seed1 = predGLRM(irisH2O, glrm_h2o_seed1)
    assert not (pyunit_utils.compare_frames_local(predict_seed0[0:4], predict_seed1[0:4], prob=1.0, returnResult=True)), \
      "GLRM return same results with different random seed."

def setupTrainModel(initM, seed):
  rank = 3
  gx = 0.25
  gy = 0.25
  trans = "STANDARDIZE"

  return H2OGeneralizedLowRankEstimator(k=rank, loss="Quadratic", gamma_x=gx, gamma_y=gy, transform=trans,
                                                init=initM, seed=seed)

def predGLRM(dataset, model):
  '''
  Simple method to train GLRM model and return prediction result.

  :param dataset: dataset to be scored and trained on
  :param model: glrm model to be trained
  :return: reconstructed dataframe.
  '''
  model.train(x=dataset.names, training_frame=dataset)
  return model.predict(dataset)

if __name__ == "__main__":
  pyunit_utils.standalone_test(test_glrm_seeds)
else:
  test_glrm_seeds()


text:
"""Fichier contenant l'ordre Ramer."""

from secondaires.navigation.constantes import VIT_RAMES
from secondaires.navigation.equipage.signaux import *

from ..ordre import *

class Ramer(Ordre):

    """Ordre ramer.

    Cet ordre demande au matelot tenant les rames spécifiées de
    ramer à une vitesse spécifiée. Cet ordre peut être utilisé pour
    demander de s'arrêter de ramer (pas de relâcher les rames).

    """

    cle = "ramer"
    etats_autorises = ("tenir_rames", )

    def __init__(self, matelot, navire, rames=None, vitesse=""):
        Ordre.__init__(self, matelot, navire, rames, vitesse)
        self.rames = rames
        self.vitesse = vitesse

    def executer(self):
        """Exécute l'ordre : tient les rames."""
        matelot = self.matelot
        personnage = matelot.personnage
        salle = personnage.salle
        rames = self.rames
        vitesse = self.vitesse
        vitesses = tuple(VIT_RAMES.keys()) + ("centre", "gauche", "droite")
        if salle is not rames.parent:
            yield SignalAbandonne("Je ne suis pas dans la salle des rames.")
        elif vitesse not in vitesses:
            yield SignalAbandonne("Je ne connais pas la vitesse {}.".format(
                    vitesse))

        if rames.tenu is not personnage:
            yield SignalAbandonne("Je ne tiens pas ces rames.")
        else:
            if vitesse == "centre":
                rames.centrer()
            elif vitesse == "droite":
                rames.virer_tribord()
            elif vitesse == "gauche":
                rames.virer_babord()
            else:
                rames.changer_vitesse(vitesse)

            while personnage.stats.endurance > 20:
                yield 3

            rames.relacher()
            yield SignalRelais("Je suis trop fatigué.")


text:
.class Lcom/android/server/enterprise/billing/EnterpriseConnectivity$1;
.super Landroid/telephony/PhoneStateListener;
.source "EnterpriseConnectivity.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/enterprise/billing/EnterpriseConnectivity;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field roaming:Z

.field final synthetic this$0:Lcom/android/server/enterprise/billing/EnterpriseConnectivity;

# direct methods
.method constructor <init>(Lcom/android/server/enterprise/billing/EnterpriseConnectivity;)V
    .locals 0

    iput-object p1, p0, Lcom/android/server/enterprise/billing/EnterpriseConnectivity$1;->this$0:Lcom/android/server/enterprise/billing/EnterpriseConnectivity;

    invoke-direct {p0}, Landroid/telephony/PhoneStateListener;-><init>()V

    return-void
.end method

# virtual methods
.method public onServiceStateChanged(Landroid/telephony/ServiceState;)V
    .locals 4

    iget-boolean v2, p0, Lcom/android/server/enterprise/billing/EnterpriseConnectivity$1;->roaming:Z

    invoke-virtual {p1}, Landroid/telephony/ServiceState;->getRoaming()Z

    move-result v3

    if-eq v2, v3, :cond_0

    invoke-virtual {p1}, Landroid/telephony/ServiceState;->getRoaming()Z

    move-result v2

    iput-boolean v2, p0, Lcom/android/server/enterprise/billing/EnterpriseConnectivity$1;->roaming:Z

    iget-object v2, p0, Lcom/android/server/enterprise/billing/EnterpriseConnectivity$1;->this$0:Lcom/android/server/enterprise/billing/EnterpriseConnectivity;

    invoke-static {v2}, Lcom/android/server/enterprise/billing/EnterpriseConnectivity;->-get2(Lcom/android/server/enterprise/billing/EnterpriseConnectivity;)Ljava/util/ArrayList;

    move-result-object v2

    invoke-interface {v2}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/android/server/enterprise/billing/EnterpriseConnectivity$Connection;

    const/16 v2, 0x3ef

    invoke-virtual {v0, v2}, Lcom/android/server/enterprise/billing/EnterpriseConnectivity$Connection;->sendMessage(I)V

    goto :goto_0

    :cond_0
    return-void
.end method