text:
var test     = require('tape'),
    rodabase = require('rodabase'),
    memdown  = require('memdown'),
    evernote = require('../'),
    H        = require('highland');

var roda = rodabase('./db', {db: memdown});
var store = roda('evernote');
var ever = evernote(store);
var tokens = require('./tokens.json');

//Evernbote API does not have expunge permission, cannot test expunge

tokens.forEach(function(token){
  var userId;
  var seq = 0;
  var defaultNotebookGuid;
  test('Full sync', function(t){
    var typeSeq = {};
    var stream = store.liveStream().reject(function(doc){
      if(!userId)
        userId = doc.userId;
      return doc.type === 'meta';
    }).each(function(doc){
      t.ok(doc.updateSequenceNum > (typeSeq[doc.type] || 0), 'Type Seq incremental');
      t.equal(doc.userId, userId, 'userId');
      t.ok(!!doc.guid && !!doc.type, 'Has type and guid');
      seq = doc.updateSequenceNum;
      typeSeq[doc.type] = seq;
    });
    ever.sync(token, function(err){
      t.notOk(err, 'Sync no error');
      stream.destroy();
      store.get(userId, function(err, meta){
        t.ok(meta.lastUpdateCount >= seq, 'lastUpdateCount >= seq');
        seq = meta.lastUpdateCount;
        defaultNotebookGuid = meta.defaultNotebookGuid;
        t.end();
      });
    });
  });
  var noteGuid, tag1Guid, ts1;
  var content = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-note SYSTEM '+
    '"http://xml.evernote.com/pub/enml2.dtd"><en-note>'+
    'Content '+(new Date())+'.</en-note>';

  test('Create note and tag', function(t){
    var ts = Date.now();
    ts1 = ts;
    store.post({
      type: 'note',
      userId: userId,
      title: "Create "+(new Date()),
      content: content,
      tags: [ts]
    }, function(err, doc){
      t.ok(doc.dirty, 'Dirty flag');
      t.ok(doc.contentDirty, 'Content dirty flag');
      t.ok(doc.created > ts, 'Created timestamp');
      t.ok(doc.updated > ts, 'Updated timestamp');
      t.ok(doc.active, 'Active');
      t.notOk(doc.tags, 'Tags field cleared');
      t.equal(doc.notebookGuid, defaultNotebookGuid, 'defaultNotebookGuid');
      t.notOk(doc.deleted, 'No deleted timestamp');

      store.get(doc.tagGuids[0], function(err, doc){
        t.ok(doc.dirty, 'Dirty flag');
        t.equal(doc.type, 'tag', 'type tag');
        t.equal(doc.userId, userId, 'userId');
        t.equal(doc.name, ts.toString(), 'tag name');
        ever.sync(token, function(err){
          t.notOk(err, 'Sync no error');
          store.get(userId, function(err, doc){
            t.ok(doc.lastUpdateCount >= seq, 'lastUpdateCount >= seq');
            seq = doc.lastUpdateCount;
            t.end();
          });
        });
      });

      store.liveStream().reject(function(doc){
        return doc.type === 'meta';
      }).take(4).toArray(function(list){
        var tagLink = list[0];
        var tag = list[1];
        var docLink = list[2];
        var doc = list[3];
        //tag link
        t.equal(tagLink.type, 'link', 'Tag Link');
        t.equal(tagLink.link, tag.guid, 'Link to tag guid');
        //tag
        tag1Guid = tag.guid;
        t.notOk(tag.dirty, 'Not dirty after sync');
        t.equal(tag.type, 'tag', 'type tag');
        t.equal(tag.userId, userId, 'userId');
        t.equal(tag.name, ts.toString(), 'tag name');
        t.ok(tag.updateSequenceNum > seq, 'Seq incremental');
        seq = tag.updateSequenceNum;
        //doc link
        t.equal(docLink.type, 'link', 'Doc Link');
        t.equal(docLink.link, doc.guid, 'Link to doc guid');
        //doc
        noteGuid = doc.guid;
        t.notOk(doc.dirty, 'Not dirty after sync');
        t.notOk(doc.contentDirty, 'Not content dirty after sync');
        t.equal(doc.type, 'note', 'Note type');
        t.equal(doc.userId, userId, 'userId');
        t.equal(doc.content, content, 'content');
        t.equal(doc.notebookGuid, defaultNotebookGuid, 'defaultNotebookGuid');
        t.equal(doc.tagGuids[0], tag1Guid, 'tag 1 Guid');
        t.ok(doc.updateSequenceNum > seq, 'Seq incremental');
        t.ok(doc.active, 'Active');
        seq = doc.updateSequenceNum;
      });
    });
  });
  var ts2, tag2Guid;
  test('Update note and tags', function(t){
    var tx;
    var ts = Date.now();
    ts2 = ts;
    tx = roda.transaction();
    store.put(noteGuid, {
      title: 'Dummy '+(new Date()),
      content: content
    }, tx); //dummy put
    store.put(noteGuid, {
      title: 'Update '+(new Date()),
      content: content,
      tags: [ts1, ts2]
    }, tx, function(err, doc){
      t.equal(doc.type, 'note', 'Note type');
      t.equal(doc.userId, userId, 'userId');
      t.equal(doc.guid, noteGuid, 'Doc guid');
      t.equal(doc.tagGuids[0], tag1Guid, 'tag1Guid');
      t.ok(doc.dirty, 'Dirty flag');
      t.notOk(doc.contentDirty, 'Not content dirty');
      t.ok(doc.updated >= ts, 'Updated timestamp');
      t.ok(doc.active, 'Active');
      t.notOk(doc.deleted, 'No deleted timestamp');
      store.get(doc.tagGuids[1], tx, function(err, doc){
        t.ok(doc.dirty, 'Dirty flag');
        t.equal(doc.type, 'tag', 'type tag');
        t.equal(doc.userId, userId, 'userId');
        t.equal(doc.name, ts.toString(), 'tag2 name');
      });
    });
    tx.commit(function(err){
      store.liveStream().reject(function(doc){
        return doc.type === 'meta';
      }).take(3).toArray(function(list){
        var tagLink = list[0];
        var tag = list[1];
        var doc = list[2];
        //tag link
        t.equal(tagLink.type, 'link', 'Tag Link');
        t.equal(tagLink.link, tag.guid, 'Link to tag guid');
        //tag
        tag2Guid = tag.guid;
        t.notOk(tag.dirty, 'Not dirty after sync');
        t.equal(tag.type, 'tag', 'type tag');
        t.equal(tag.userId, userId, 'userId');
        t.equal(tag.name, ts.toString(), 'tag2 name');
        t.ok(tag.updateSequenceNum > seq, 'Seq incremental');
        seq = tag.updateSequenceNum;
        //doc
        t.equal(doc.guid, noteGuid, 'Doc guid');
        t.notOk(doc.dirty, 'Not dirty after sync');
        t.notOk(doc.contentDirty, 'Not content dirty after sync');
        t.equal(doc.type, 'note', 'Note type');
        t.equal(doc.userId, userId, 'userId');
        t.equal(doc.content, content, 'content');
        t.deepEqual(doc.tagGuids, [tag1Guid, tag2Guid], 'tagGuids');
        t.ok(doc.updateSequenceNum > seq, 'Seq incremental');
        t.ok(doc.active, 'Active');
        seq = doc.updateSequenceNum;
      });
      ever.sync(token, function(err){
        t.notOk(err, 'Sync no error');
        store.get(userId, function(err, doc){
          t.ok(doc.lastUpdateCount >= seq, 'lastUpdateCount >= seq');
          seq = doc.lastUpdateCount;
          t.end();
        });
      });
    });
  });

  var notebookGuid;
  test('Create notebook', function(t){
    var tx = roda.transaction();
    var ts = Date.now();
    var name = Date.now().toString();
    store.post({
      type: 'notebook',
      userId: userId,
      name: name
    }, tx, function(err, doc){
      var id = doc._id;
      t.ok(doc.dirty, 'Dirty flag');
      t.equal(doc.type, 'notebook', 'Type notebook');
      t.equal(doc.name, name, 'notebook name');
      t.equal(doc.userId, userId, 'userId');

      store.put(noteGuid, {
        notebookGuid: id
      }, tx, function(err, doc){
        t.equal(doc.type, 'note', 'Note type');
        t.equal(doc.userId, userId, 'userId');
        t.equal(doc.guid, noteGuid, 'Doc guid');
        t.equal(doc.notebookGuid, id, 'Dirty notebookGuid');
        t.ok(doc.dirty, 'Dirty flag');
        t.notOk(doc.contentDirty, 'Not content dirty');
      });

      store.get(userId, tx, function(err, meta){
        meta.defaultNotebookGuid = id;
        store.put(userId, meta, tx, function(err, meta){
          t.equal(meta.defaultNotebookGuid, id, 'Dirty defaultNotebookGuid');
        });
      });
    });
    tx.commit(function(){
      store.post({
        type: 'notebook',
        userId: userId,
        name: name
      }, function(err, doc){
        t.ok(err.exists, 'No repeat notebook name');
      });
      store.liveStream().reject(function(doc){
        return doc.type === 'meta';
      }).take(3).toArray(function(list){
        var link = list[0];
        var notebook = list[1];
        var doc = list[2];
        //link
        t.equal(link.type, 'link', 'Link');
        t.equal(link.link, notebook.guid, 'Link to notebook guid');
        //notebook
        notebookGuid = notebook.guid;
        t.notOk(notebook.dirty, 'Not dirty after sync');
        t.equal(notebook.type, 'notebook', 'type notebook');
        t.equal(notebook.name, name, 'notebook name');
        t.equal(notebook.userId, userId, 'userId');
        t.ok(notebook.updateSequenceNum > seq, 'Seq incremental');
        seq = notebook.updateSequenceNum;
        //doc
        t.notOk(doc.dirty, 'Not dirty after sync');
        t.notOk(doc.contentDirty, 'Not content dirty after sync');
        t.equal(doc.type, 'note', 'Note type');
        t.equal(doc.userId, userId, 'userId');
        t.equal(doc.content, content, 'content');
        t.equal(doc.notebookGuid, notebookGuid, 'Sync notebookGuid');
        t.ok(doc.updateSequenceNum > seq, 'Seq incremental');
        t.ok(doc.active, 'Active');
        seq = doc.updateSequenceNum;
      });
      ever.sync(token, function(err){
        t.notOk(err, 'Sync no error');
        store.get(userId, function(err, meta){
          t.ok(meta.lastUpdateCount >= seq, 'lastUpdateCount >= seq');
          t.equal(meta.defaultNotebookGuid, notebookGuid, 'sync defaultNotebookGuid');
          seq = meta.lastUpdateCount;
          t.end();
        });
      });
    });
  });

  test('Update note content', function(t){
    var tx;
    var ts = Date.now();
    var content2 = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-note SYSTEM '+
      '"http://xml.evernote.com/pub/enml2.dtd"><en-note>'+
      'Content2 '+(new Date())+'.</en-note>';
    tx = roda.transaction();
    store.put(noteGuid, {
      title: 'Dummy'+(new Date()),
      content: content2
    }, tx); //dummy put
    store.put(noteGuid, {
      title: 'Update Content '+(new Date()),
      content: content2
    }, tx, function(err, doc){
      t.equal(doc.type, 'note', 'Note type');
      t.equal(doc.userId, userId, 'userId');
      t.equal(doc.guid, noteGuid, 'Doc guid');
      t.ok(doc.dirty, 'Dirty flag');
      t.ok(doc.contentDirty, 'Content dirty');
      t.ok(doc.updated >= ts, 'Updated timestamp');
      t.ok(doc.active, 'Active');
      t.notOk(doc.deleted, 'No deleted timestamp');
    });
    tx.commit(function(err){
      store.liveStream().reject(function(doc){
        return doc.type === 'meta';
      }).pull(function(err, doc){
        t.equal(doc.guid, noteGuid, 'Doc guid');
        t.notOk(doc.dirty, 'Not dirty after sync');
        t.notOk(doc.contentDirty, 'Not content dirty after sync');
        t.equal(doc.type, 'note', 'Note type');
        t.equal(doc.userId, userId, 'userId');
        t.equal(doc.content, content2, 'content');
        t.ok(doc.updateSequenceNum > seq, 'Seq incremental');
        t.ok(doc.active, 'Active');
        seq = doc.updateSequenceNum;
      });
      ever.sync(token, function(err){
        t.notOk(err, 'Sync no error');
        store.get(userId, function(err, doc){
          t.ok(doc.lastUpdateCount >= seq, 'lastUpdateCount >= seq');
          seq = doc.lastUpdateCount;
          t.end();
        });
      });
    });
  });
  test('Trash note', function(t){
    var ts = Date.now();
    store.put(noteGuid, {
      active: false
    }, function(err, doc){
      t.equal(doc.type, 'note', 'Note type');
      t.equal(doc.userId, userId, 'userId');
      t.equal(doc.guid, noteGuid, 'Doc guid');
      t.ok(doc.title, 'Has title');
      t.ok(doc.content, 'Has content');
      t.ok(doc.dirty, 'Dirty flag');
      t.notOk(doc.contentDirty, 'Not content dirty');
      t.ok(doc.deleted >= ts, 'Deleted timestamp');
      t.notOk(doc.active, 'Not active');
      store.liveStream().reject(function(doc){
        return doc.type === 'meta';
      }).pull(function(err, doc){
        t.equal(doc.type, 'note', 'Note type');
        t.equal(doc.userId, userId, 'userId');
        t.notOk(doc.dirty, 'Not dirty after sync');
        t.notOk(doc.contentDirty, 'Not content dirty after sync');
        t.ok(doc.deleted, 'Deleted timestamp');
        t.notOk(doc.active, 'Not active');
        seq = doc.updateSequenceNum;
      });
      ever.sync(token, function(err){
        t.notOk(err, 'Sync no error');
        store.get(userId, function(err, doc){
          t.ok(doc.lastUpdateCount >= seq, 'lastUpdateCount >= seq');
          seq = doc.lastUpdateCount;
          t.end();
        });
      });
    });
  });
  /*
  test('Incremental Sync', function(t){
    //create/update note from another client then sync
  });
  test('Tag Conflict', function(t){

  });
  */
});


text:
'use strict';

const inits = require('inits')
const monitor = require('../lib/monitor.js')

inits.standalone(monitor.start)

redpajama_set_name: RedPajamaGithub


text:
const Promise = require('es6-promise');
const highland = require('highland');

function chaiStream(chai, utils) {
  require('./assert')(chai, utils);
  require('./expect')(chai, utils);
}

module.exports = chaiStream;


text:
Kõnele
======

Kõnele is an Android app that offers speech-to-text services to other apps.
It contains the following main components:

  - RecognizerIntent activity
  - Voice keyboard that implements the input method editor (IME) API
  - SpeechRecognizer implementation that uses <https://github.com/alumae/kaldi-gstreamer-server>
  - SpeechRecognizer implementation that uses <https://github.com/alumae/ruby-pocketsphinx-server>

The main goals of this project is to offer support for Estonian speech recognition on the
Android platform, as well as grammar-based speech recognition for voice command applications.

For more information see <http://kaljurand.github.io/K6nele/>.

Compilation
-----------

Point to the SDK directory by setting the environment variable
`ANDROID_HOME`, e.g.

	ANDROID_HOME=${HOME}/myapps/android-sdk/

Then run

    gradle makeIcons
    gradle build
    gradle lint
    gradle assembleRelease

For the listing of more Gradle tasks, run:

	gradle tasks

If you have access to the release keystore then

  - point to its location by setting the environment variable `KEYSTORE`
  - set `KEY_ALIAS` to the key alias
  - create the file `gradle.properties` containing the lines:

		storePassword=<password1>
		keyPassword=<password2>

Tags
----

Version tags are set by e.g.

    git tag -a v1.1.02 -m 'version 1.1.02'

The last number should be even.

Contributions
-------------

The client for <https://github.com/alumae/kaldi-gstreamer-server>
was originally based on <https://github.com/truongdq54/kaldi-gstreamer-android-client>.


text:
import unittest

import numpy

import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition

class TestHuberLoss(unittest.TestCase):

    def setUp(self):
        self.shape = (4, 10)
        self.x = (numpy.random.random(self.shape) - 0.5) * 20
        self.x = self.x.astype(numpy.float32)
        self.t = numpy.random.random(self.shape).astype(numpy.float32)

    def check_forward(self, x_data, t_data):
        x = chainer.Variable(x_data)
        t = chainer.Variable(t_data)
        loss = functions.huber_loss(x, t, delta=1)
        self.assertEqual(loss.data.dtype, numpy.float32)
        loss_value = cuda.to_cpu(loss.data)

        diff_data = cuda.to_cpu(x_data) - cuda.to_cpu(t_data)
        expected_result = numpy.zeros(self.shape)
        mask = numpy.abs(diff_data) < 1
        expected_result[mask] = 0.5 * diff_data[mask]**2
        expected_result[~mask] = numpy.abs(diff_data[~mask]) - 0.5
        loss_expect = numpy.sum(expected_result, axis=1)
        gradient_check.assert_allclose(loss_value, loss_expect)

    @condition.retry(3)
    def test_forward_cpu(self):
        self.check_forward(self.x, self.t)

    @attr.gpu
    @condition.retry(3)
    def test_forward_gpu(self):
        self.check_forward(cuda.to_gpu(self.x), cuda.to_gpu(self.t))

    def check_backward(self, x_data, t_data):
        gradient_check.check_backward(
            functions.HuberLoss(delta=1),
            (x_data, t_data), None, eps=1e-2, atol=1e-3)

    @condition.retry(3)
    def test_backward_cpu(self):
        self.check_backward(self.x, self.t)

    @attr.gpu
    @condition.retry(3)
    def test_backward_gpu(self):
        self.check_backward(cuda.to_gpu(self.x), cuda.to_gpu(self.t))

testing.run_module(__name__, __file__)


text:
goog.provide('asteroids.nodes.WaitForStartNode');
goog.require('ash.core.Node');
goog.require('asteroids.components.WaitForStart');
/*
  * @constructor
 */
asteroids.nodes.WaitForStartNode = function() {
  return asteroids.nodes.WaitForStartNode.superClass_.constructor.apply(this, arguments);
}
goog.inherits(asteroids.nodes.WaitForStartNode, ash.core.Node);

/** @type {string} */
asteroids.nodes.WaitForStartNode.className = 'WaitForStartNode';

/** @type {Object.<string, Function} */
asteroids.nodes.WaitForStartNode.components = {
  wait: asteroids.components.WaitForStart
};

/** @type {asteroids.components.WaitForStart} */
asteroids.nodes.WaitForStartNode.prototype.wait = null;


text:
{% extends "analysis/baseanalisis.html" %}

{% block extra_js %}

</script>
{% endblock extra_js %}

{% block contenido %}

	<form action="." method="POST">{% csrf_token %}

{{form.tipo_estudio.label}}: {{form.tipo_estudio}}

{{form.fecha.label}}: {{form.fecha}}

{{form.area_accion.label}}: {{form.area_accion}}

{{form.sitio_accion.label}}: {{form.sitio_accion}}

{{form.plataforma.label}}: {{form.plataforma}}

		<input type="submit" value="Consultar" name="consulta" class="btn btn-success consultar"/>
	</form>

	{%if centinela = 1 %}

Please select an item from the left menu!

    {%endif%}
{% endblock contenido %}


text:
{-# LANGUAGE Haskell98 #-}
{-# LINE 1 "src/Data/Binary/Generic.hs" #-}

{-# LANGUAGE BangPatterns, CPP, FlexibleInstances, KindSignatures,
    ScopedTypeVariables, TypeOperators, TypeSynonymInstances #-}
{-# LANGUAGE Safe #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}

-----------------------------------------------------------------------------
-- |
-- Module      : Data.Binary.Generic
-- Copyright   : Bryan O'Sullivan
-- License     : BSD3-style (see LICENSE)
--
-- Maintainer  : Bryan O'Sullivan <bos@serpentine.com>
-- Stability   : unstable
-- Portability : Only works with GHC 7.2 and newer
--
-- Instances for supporting GHC generics.
--
-----------------------------------------------------------------------------
module Data.Binary.Generic
    (
    ) where

import Control.Applicative
import Data.Binary.Class
import Data.Binary.Get
import Data.Binary.Put
import Data.Bits
import Data.Word
import Data.Monoid ((<>))
import GHC.Generics
import Prelude -- Silence AMP warning.

-- Type without constructors
instance GBinaryPut V1 where
    gput _ = pure ()

instance GBinaryGet V1 where
    gget   = return undefined

-- Constructor without arguments
instance GBinaryPut U1 where
    gput U1 = pure ()

instance GBinaryGet U1 where
    gget    = return U1

-- Product: constructor with parameters
instance (GBinaryPut a, GBinaryPut b) => GBinaryPut (a :*: b) where
    gput (x :*: y) = gput x <> gput y

instance (GBinaryGet a, GBinaryGet b) => GBinaryGet (a :*: b) where
    gget = (:*:) <$> gget <*> gget

-- Metadata (constructor name, etc)
instance GBinaryPut a => GBinaryPut (M1 i c a) where
    gput = gput . unM1

instance GBinaryGet a => GBinaryGet (M1 i c a) where
    gget = M1 <$> gget

-- Constants, additional parameters, and rank-1 recursion
instance Binary a => GBinaryPut (K1 i a) where
    gput = put . unK1

instance Binary a => GBinaryGet (K1 i a) where
    gget = K1 <$> get

-- Borrowed from the cereal package.

-- The following GBinary instance for sums has support for serializing
-- types with up to 2^64-1 constructors. It will use the minimal
-- number of bytes needed to encode the constructor. For example when
-- a type has 2^8 constructors or less it will use a single byte to
-- encode the constructor. If it has 2^16 constructors or less it will
-- use two bytes, and so on till 2^64-1.

instance ( GSumPut  a, GSumPut  b
         , SumSize    a, SumSize    b) => GBinaryPut (a :+: b) where
    gput | (size - 1) <= fromIntegral (maxBound :: Word8) = putSum (0 :: Word8) (fromIntegral size) | (size - 1) <= fromIntegral (maxBound :: Word16) = putSum (0 :: Word16) (fromIntegral size) | (size - 1) <= fromIntegral (maxBound :: Word32) = putSum (0 :: Word32) (fromIntegral size) | (size - 1) <= fromIntegral (maxBound :: Word64) = putSum (0 :: Word64) (fromIntegral size)
         | otherwise = sizeError "encode" size
      where
        size = unTagged (sumSize :: Tagged (a :+: b) Word64)

instance ( GSumGet  a, GSumGet  b
         , SumSize    a, SumSize    b) => GBinaryGet (a :+: b) where
    gget | (size - 1) <= fromIntegral (maxBound :: Word8) = (get :: Get Word8) >>= checkGetSum (fromIntegral size) | (size - 1) <= fromIntegral (maxBound :: Word16) = (get :: Get Word16) >>= checkGetSum (fromIntegral size) | (size - 1) <= fromIntegral (maxBound :: Word32) = (get :: Get Word32) >>= checkGetSum (fromIntegral size) | (size - 1) <= fromIntegral (maxBound :: Word64) = (get :: Get Word64) >>= checkGetSum (fromIntegral size)
         | otherwise = sizeError "decode" size
      where
        size = unTagged (sumSize :: Tagged (a :+: b) Word64)

sizeError :: Show size => String -> size -> error
sizeError s size =
    error $ "Can't " ++ s ++ " a type with " ++ show size ++ " constructors"

------------------------------------------------------------------------

checkGetSum :: (Ord word, Num word, Bits word, GSumGet f)
            => word -> word -> Get (f a)
checkGetSum size code | code < size = getSum code size
                      | otherwise   = fail "Unknown encoding for constructor"
{-# INLINE checkGetSum #-}

class GSumGet f where
    getSum :: (Ord word, Num word, Bits word) => word -> word -> Get (f a)

class GSumPut f where
    putSum :: (Num w, Bits w, Binary w) => w -> w -> f a -> Put

instance (GSumGet a, GSumGet b) => GSumGet (a :+: b) where
    getSum !code !size | code < sizeL = L1 <$> getSum code           sizeL
                       | otherwise    = R1 <$> getSum (code - sizeL) sizeR
        where
          sizeL = size `shiftR` 1
          sizeR = size - sizeL

instance (GSumPut a, GSumPut b) => GSumPut (a :+: b) where
    putSum !code !size s = case s of
                             L1 x -> putSum code           sizeL x
                             R1 x -> putSum (code + sizeL) sizeR x
        where
          sizeL = size `shiftR` 1
          sizeR = size - sizeL

instance GBinaryGet a => GSumGet (C1 c a) where
    getSum _ _ = gget

instance GBinaryPut a => GSumPut (C1 c a) where
    putSum !code _ x = put code <> gput x

------------------------------------------------------------------------

class SumSize f where
    sumSize :: Tagged f Word64

newtype Tagged (s :: * -> *) b = Tagged {unTagged :: b}

instance (SumSize a, SumSize b) => SumSize (a :+: b) where
    sumSize = Tagged $ unTagged (sumSize :: Tagged a Word64) +
                       unTagged (sumSize :: Tagged b Word64)

instance SumSize (C1 c a) where
    sumSize = Tagged 1


text:
<!DOCTYPE html>

	<title>Leaflet debug page</title>

	<link rel="stylesheet" href="../../dist/leaflet.css" />

	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<link rel="stylesheet" href="../css/screen.css" />

	<button id="populate">Populate with 10 markers</button>


text:
import os
import optparse
import uuid
import time
import tornado
import scipy.io as sio
import scipy.sparse as sparse
from msmbuilder import tpt
from msmbuilder.msm import MarkovStateModel
from msmbuilder.msm._markovstatemodel import _transmat_mle_prinz
import networkx as nx
from networkx.readwrite import json_graph
from StringIO import StringIO
from pymongo import Connection
import newrelic.agent
import tornado.ioloop
from tornado.web import (RequestHandler, StaticFileHandler)
from tornado.httpclient import AsyncHTTPClient

# Set up NEWRELIC
newrelic.agent.initialize('newrelic.ini')

# Set up MONGO CLIENT
__DB__ = 'MONGOHQ_URL'

# Dict of Available Network Metrics
resize = {
    'pagerank': lambda x, y, z:
    nx.pagerank_scipy(x),
    '1st eigenvector': lambda x, y, z:
    dict(zip(range(z.shape[0]), y.populations_)),
    '2nd eigenvector': lambda x, y, z:
    dict(zip(range(z.shape[0]), y.left_eigenvectors_[:, 1])),
    'closeness centrality': lambda x, y, z:
    nx.closeness_centrality(x),
    'flow betweenness': lambda x, y, z:
    nx.approximate_current_flow_betweenness_centrality(x)
    }

# Declare async
HTTP_CLIENT = AsyncHTTPClient()

# -----------------------------------------------------------------------------
# TASKS
# -----------------------------------------------------------------------------

# Connect to MONGODB
def connect_to_mongo():
    if __DB__ in os.environ:
        c = Connection(os.environ[__DB__])
    else:
        print "if youre developing locally, you need to get the MONGOLAB_URI"
        print 'env variable. run "heroku config" at the command line and'
        print 'it should give you the right string'
        c = Connection()
    # THIS IS APP SPECIFIC. PLEASE CHANGE APPLICATION ID.
    return c.app22870053

# MAKES MSM GRAPH AND RETURNS JSON
def make_json_graph(msm, request):
    c = float(request.get_argument('cutoff'))
    e = str(request.get_argument('resize'))
    t = sparse.csr_matrix(msm.transmat_.copy())
    t.data[t.data < c] = 0.0
    t.eliminate_zeros()
    G = nx.from_scipy_sparse_matrix(t, create_using=nx.DiGraph())
    metric = resize[e](G, msm, t)
    nx.set_node_attributes(G, 'size', metric)
    G.remove_nodes_from(nx.isolates(G))
    return json_graph.node_link_data(G)

# MAKES TRANSITIONS PATHWAYS AND RETURNS JSON
def make_json_paths(msm, request):
    sources = map(int,
                  request.get_argument('sources').replace(" ", "").split(","))
    sinks = map(int, request.get_argument('sinks').replace(" ", "").split(","))
    n = int(request.get_argument('num_paths'))
    net_flux = tpt.net_fluxes(sources, sinks, msm)
    paths = tpt.paths(sources, sinks, net_flux, num_paths=n)
    G = nx.DiGraph()
    for j, i in enumerate(paths[0][::-1]):
        G.add_node(i[0], type="source")
        for k in range(1, len(i)):
            G.add_node(i[k], type="none")
            G.add_edge(i[k-1], i[k], weight=paths[1][::-1][j])
        G.add_node(i[-1], type="sink")
    return json_graph.node_link_data(G)

DATABASE = connect_to_mongo()
print DATABASE.collection_names()

# GET USER OPTIONS
def parse_cmdln():
    parser = optparse.OptionParser()
    parser.add_option('-p', '--port', dest='port', type='int', default=5000)
    (options, args) = parser.parse_args()
    return (options, args)

# CREATES HOST SESSION AND LOGS USER IP INFO
class Session(object):
    """REALLLY CRAPPY SESSIONS FOR TORNADO VIA MONGODB
    """
    collection = DATABASE.sessions

    def __init__(self, request):
        data = {
            'ip_address': request.remote_ip,
            'user_agent':  request.headers.get('User-Agent')
        }
        result = self.collection.find_one(data)
        if result is None:
            # create new data
            self.collection.insert(data)
            self.data = data
        else:
            self.data = result

    def get(self, attr, default=None):
        return self.data.get(attr, default)

    def put(self, attr, value):
        self.collection.remove(self.data)
        self.data[attr] = value
        self.collection.insert(self.data)

    def __repr__(self):
        return str(self.data)

# PREVENTS FREQUENT REQUESTS
class RunHandler(RequestHandler):
    # how often should we allow execution
    max_request_frequency = 10  # seconds

    def log(self, msg):
        print msg

    def get(self):
        if self.validate_request_frequency():
            request_id = str(uuid.uuid4())
            HTTP_CLIENT.fetch('localhost', method='POST', callback=self.log)
            self.write(request_id)

    def validate_request_frequency(self):
        """Check that the user isn't requesting to run too often"""
        session = Session(self.request)
        last_run = session.get('last_run')
        if last_run is not None:
            if (time.time() - last_run) < self.max_request_frequency:
                self.write("You're being a little too eager, no?")
                return False
        session.put('last_run', time.time())

        return True

# COUNTS REQUESTS
class IndexHandler(StaticFileHandler):
    def get(self):
        session = Session(self.request)
        session.put('indexcounts', session.get('indexcounts', 0) + 1)
        return super(IndexHandler, self).get('index.html')

# HANDLES UPLOADED CONTENT
class UploadHandler(tornado.web.RequestHandler):
    def post(self):
        io = StringIO(self.get_argument('matrix'))
        w = sio.mmread(io)
        msm = MarkovStateModel()
        msm.transmat_, msm.populations_ = _transmat_mle_prinz(w)
        msm.n_states_ = msm.populations_.shape[0]
        if bool(int(self.get_argument('mode'))):
            self.write(make_json_paths(msm, self))  # TP
        else:
            self.write(make_json_graph(msm, self))  # MSM

# -----------------------------------------------------------------------------
# STATIC CONTENT DECLARATIONS
# -----------------------------------------------------------------------------
application = tornado.web.Application([
    (r'/run', RunHandler),
    (r"/process", UploadHandler),
    (r'/', IndexHandler, {'path': 'public'}),
    (r'/js/(.*)', StaticFileHandler, {'path': 'public/js'}),
    (r'/css/(.*)', StaticFileHandler, {'path': 'public/css'}),
    (r'/images/(.*)', StaticFileHandler, {'path': 'public/images'}),
    (r'/help/(.*)', StaticFileHandler, {'path': 'public/help'}),
    ], debug=True)

# -----------------------------------------------------------------------------
# MAIN
# -----------------------------------------------------------------------------
if __name__ == "__main__":
    (options, args) = parse_cmdln()
    port = int(os.environ.get('PORT', options.port))
    application.listen(port)
    print "MSMExplorer is starting on port %s" % options.port
    tornado.ioloop.IOLoop.instance().start()


text:
Ohai.plugin(:Mdadm) do
  provides "mdadm"

  def create_raid_device_mash(stdout)
    device_mash = Mash.new
    device_mash[:device_counts] = Mash.new
    stdout.lines.each do |line|
      case line
      when /Version\s+: ([0-9.]+)/
        device_mash[:version] = Regexp.last_match[1].to_f
      when /Raid Level\s+: raid([0-9]+)/
        device_mash[:level] = Regexp.last_match[1].to_i
      when /Array Size.*\(([0-9.]+)/
        device_mash[:size] = Regexp.last_match[1].to_f
      when /State\s+: ([a-z]+)/
        device_mash[:state] = Regexp.last_match[1]
      when /Total Devices\s+: ([0-9]+)/
        device_mash[:device_counts][:total] = Regexp.last_match[1].to_i
      when /Raid Devices\s+: ([0-9]+)/
        device_mash[:device_counts][:raid] = Regexp.last_match[1].to_i
      when /Working Devices\s+: ([0-9]+)/
        device_mash[:device_counts][:working] = Regexp.last_match[1].to_i
      when /Failed Devices\s+: ([0-9]+)/
        device_mash[:device_counts][:failed] = Regexp.last_match[1].to_i
      when /Active Devices\s+: ([0-9]+)/
        device_mash[:device_counts][:active] = Regexp.last_match[1].to_i
      when /Spare Devices\s+: ([0-9]+)/
        device_mash[:device_counts][:spare] = Regexp.last_match[1].to_i
      end
    end
    device_mash
  end

  collect_data(:linux) do
    # gather a list of all raid arrays
    if File.exist?("/proc/mdstat")
      devices = {}
      File.open("/proc/mdstat").each do |line|
        if line =~ /(md[0-9]+)/
          device = Regexp.last_match[1]
          pieces = line.split(/\s+/)
          # there are variable numbers of fields until you hit the raid level
          # everything after that is members...
          # unless the array is inactive, in which case you don't get a raid
          # level.
          members = pieces.drop_while { |x| !x.start_with?("raid", "inactive") }
          # drop the 'raid' too

          members.shift unless members.empty?
          devices[device] = members.map { |s| s.match(/(.+)\[\d\]/)[1] }
        end
      end

      # create the mdadm mash and gather individual information if devices are present
      unless devices.empty?
        mdadm Mash.new
        devices.keys.sort.each do |device|
          mdadm[device] = Mash.new

          # gather detailed information on the array
          so = shell_out("mdadm --detail /dev/#{device}")

          # if the mdadm command was sucessful pass so.stdout to create_raid_device_mash to grab the tidbits we want
          mdadm[device] = create_raid_device_mash(so.stdout) if so.stdout
          mdadm[device]["members"] = devices[device]
        end
      end
    end
  end
end


text:
import uuidV4 from  'uuid/v4'
import {map} from 'lodash'
import {newRecording, newOverdub} from '../../../../types/recording'
import {startPlayback, stopPlayback} from '../../timelines/timelines'

export const MIDI_RECORDING_CREATED = 'MIDI_RECORDING_CREATED'
export const MIDI_RECORDING_CREATED_BY_PEER = 'MIDI_RECORDING_CREATED_BY_PEER'
export const MIDI_OVERDUB_RECORDING_STARTED = 'MIDI_OVERDUB_RECORDING_STARTED'
export const MIDI_OVERDUB_RECORDING_STARTED_BY_PEER = 'MIDI_OVERDUB_RECORDING_STARTED_BY_PEER'
export const MIDI_OVERDUB_RECORDING_STOPPED = 'MIDI_OVERDUB_RECORDING_STOPPED'
export const MIDI_OVERDUB_RECORDING_STOPPED_BY_PEER = 'MIDI_OVERDUB_RECORDING_STOPPED_BY_PEER'
export const MIDI_EVENT_RECORDED = 'MIDI_EVENT_RECORDED'
export const MIDI_EVENT_RECORDED_BY_PEER = 'MIDI_EVENT_RECORDED_BY_PEER'

/**
 * createNewMidiRecording create a new midi recording.
 *
 * @param recordingId :: string
*/
export const createNewMidiRecording = (recordingId = uuidV4()) => dispatch =>
  dispatch({
    type: MIDI_RECORDING_CREATED,
    payload: {
      recording: newRecording(recordingId),
    }
  })

export const startMidiOverdubs = (recordingContexts, timelineId) => dispatch => {
  // start overdub recording
  dispatch({
    type: MIDI_OVERDUB_RECORDING_STARTED,
    payload: {
      recordingContexts: map(
        recordingContexts,
        recordingContext => ({...recordingContext, overdub: newOverdub(uuidV4(), 0)}), // TODO (cw|10.29.2017) parameterize timeOffset
      ),
      timelineId,
    },
  })

  // also start playback
  dispatch(startPlayback(timelineId))
}

export const stopMidiOverdubs = (recordingContexts, timelineId) => dispatch => {
  // stop overdub recording
  dispatch({
    type: MIDI_OVERDUB_RECORDING_STOPPED,
    payload: {
      recordingContexts,
      timelineId,
    },
  })

  // also stop playback
  dispatch(stopPlayback(timelineId))
}

/**
 * recordMidiEvent records a midi event to a recording overdub. This action should
 * only be used by the midi-middleware.
 *
 * @param recordingId
 * @param overdubId
 * @param midiEvent
 */
export const recordMidiEvent = (overdubId, midiEvent) => dispatch => {
  dispatch({
    type: MIDI_EVENT_RECORDED,
    payload: {
      overdubId,
      event: midiEvent,
    }
  })
}


text:
import $ from 'jquery'

import locale from '../locale'
import { defer, bindAll, publicCallbacks, fileSelectDialog } from '../utils'
import { valueToFile } from '../utils/files'
import { receiveDrop } from './dragdrop'
import { Template } from './template'
import { openDialog } from './dialog'

class BaseWidget {
  constructor(element, settings) {
    this.element = element
    this.settings = settings
    this.validators = this.settings.validators = []
    this.currentObject = null
    this.__onDialogOpen = $.Callbacks()
    this.__onUploadComplete = $.Callbacks()
    this.__onChange = $.Callbacks().add((object) => {
      return object != null
        ? object.promise().done((info) => {
            return this.__onUploadComplete.fire(info)
          })
        : undefined
    })
    this.__setupWidget()
    this.element.on('change.uploadcare', this.reloadInfo.bind(this))
    // Delay loading info to allow set custom validators on page load.
    this.__hasValue = false
    defer(() => {
      // Do not reload info if user call uc.Widget().value(uuid) manual.
      if (!this.__hasValue) {
        return this.reloadInfo()
      }
    })
  }

  __setupWidget() {
    var path
    this.template = new Template(this.settings, this.element)
    path = ['buttons.choose']
    path.push(this.settings.imagesOnly ? 'images' : 'files')
    path.push(this.settings.multiple ? 'other' : 'one')
    this.template
      .addButton('open', locale.t(path.join('.')))
      .toggleClass('needsclick', this.settings.systemDialog)
      .on('click', () => {
        return this.openDialog()
      })
    this.template
      .addButton('cancel', locale.t('buttons.cancel'))
      .on('click', () => {
        return this.__setObject(null)
      })
    this.template
      .addButton('remove', locale.t('buttons.remove'))
      .on('click', () => {
        return this.__setObject(null)
      })
    this.template.content.on('click', '.uploadcare--widget__file-name', () => {
      return this.openDialog()
    })
    // Enable drag and drop
    receiveDrop(this.template.content, this.__handleDirectSelection.bind(this))
    return this.template.reset()
  }

  __infoToValue(info) {
    if (info.cdnUrlModifiers || this.settings.pathValue) {
      return info.cdnUrl
    } else {
      return info.uuid
    }
  }

  __reset() {
    var object
    // low-level primitive. @__setObject(null) could be better.
    object = this.currentObject
    this.currentObject = null
    if (object != null) {
      if (typeof object.cancel === 'function') {
        object.cancel()
      }
    }
    return this.template.reset()
  }

  __setObject(newFile) {
    if (newFile === this.currentObject) {
      return
    }
    this.__reset()
    if (newFile) {
      this.currentObject = newFile
      this.__watchCurrentObject()
    } else {
      this.element.val('')
    }
    return this.__onChange.fire(this.currentObject)
  }

  __watchCurrentObject() {
    var object
    object = this.__currentFile()
    if (object) {
      this.template.listen(object)
      return object
        .done((info) => {
          if (object === this.__currentFile()) {
            return this.__onUploadingDone(info)
          }
        })
        .fail((errorType, fileInfo, error) => {
          if (object === this.__currentFile()) {
            return this.__onUploadingFailed(errorType, error)
          }
        })
    }
  }

  __onUploadingDone(info) {
    this.element.val(this.__infoToValue(info))
    this.template.setFileInfo(info)
    return this.template.loaded()
  }

  __onUploadingFailed(errorType, error) {
    this.template.reset()
    return this.template.error(errorType, error)
  }

  __setExternalValue(value) {
    return this.__setObject(valueToFile(value, this.settings))
  }

  value(value) {
    if (value !== undefined) {
      this.__hasValue = true
      this.__setExternalValue(value)
      return this
    } else {
      return this.currentObject
    }
  }

  reloadInfo() {
    return this.value(this.element.val())
  }

  openDialog(tab) {
    if (this.settings.systemDialog) {
      return fileSelectDialog(this.template.content, this.settings, (input) => {
        return this.__handleDirectSelection('object', input.files)
      })
    } else {
      return this.__openDialog(tab)
    }
  }

  __openDialog(tab) {
    var dialogApi
    dialogApi = openDialog(this.currentObject, tab, this.settings)
    this.__onDialogOpen.fire(dialogApi)
    return dialogApi.done(this.__setObject.bind(this))
  }

  api() {
    if (!this.__api) {
      this.__api = bindAll(this, [
        'openDialog',
        'reloadInfo',
        'value',
        'validators'
      ])
      this.__api.onChange = publicCallbacks(this.__onChange)
      this.__api.onUploadComplete = publicCallbacks(this.__onUploadComplete)
      this.__api.onDialogOpen = publicCallbacks(this.__onDialogOpen)
      this.__api.inputElement = this.element.get(0)
    }
    return this.__api
  }
}

export { BaseWidget }


text:
using System;
using System.Collections.Generic;
using Mozu.Api.Security;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using System.Threading;

namespace Mozu.Api.Resources.Platform.Entitylists
{
	///
	/// Entities are JSON entries within the MZDB ( Mongo DB) for handling large data sets to heavily filter (>2,000 items). Each entity is associated to an EntityList with schema, rules, and formatting for storing the content. This content can be accessed via the  API and  Hypr tags.
	///
	public partial class EntityResource  	{
		///
		/// <see cref="Mozu.Api.ApiContext"/>
		///
		private readonly IApiContext _apiContext;

		public EntityResource(IApiContext apiContext)
		{
			_apiContext = apiContext;
		}

		public EntityResource CloneWithApiContext(Action<IApiContext> contextModification)
		{
			return new EntityResource(_apiContext.CloneWith(contextModification));
		}

		///
		///
		///
		/// <param name="entityListFullName">The full name of the EntityList including namespace in name@nameSpace format</param>
		/// <param name="id">Unique identifier of the customer segment to retrieve.</param>
		/// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
		/// <returns>
		/// JObject
		/// </returns>
		/// <example>
		///
		///   var entity = new Entity();
		///   var json = await entity.GetEntityAsync( entityListFullName,  id,  responseFields);
		///
		/// </example>
		public virtual async Task<JObject> GetEntityAsync(string entityListFullName, string id, string responseFields =  null, CancellationToken ct = default(CancellationToken))
		{
			MozuClient<JObject> response;
			var client = Mozu.Api.Clients.Platform.Entitylists.EntityClient.GetEntityClient( entityListFullName,  id,  responseFields);
			client.WithContext(_apiContext);
			response = await client.ExecuteAsync(ct).ConfigureAwait(false);
			return await response.ResultAsync();

		}

		///
		///
		///
		/// <param name="entityListFullName">The full name of the EntityList including namespace in name@nameSpace format</param>
		/// <param name="filter">A set of filter expressions representing the search parameters for a query. This parameter is optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for a list of supported filters.</param>
		/// <param name="pageSize">When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with this parameter set to 25, to get the 51st through the 75th items, set startIndex to 50.</param>
		/// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
		/// <param name="sortBy">The element to sort the results by and the channel in which the results appear. Either ascending (a-z) or descending (z-a) channel. Optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for more information.</param>
		/// <param name="startIndex">When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with pageSize set to 25, to get the 51st through the 75th items, set this parameter to 50.</param>
		/// <returns>
		/// <see cref="Mozu.Api.Contracts.MZDB.EntityCollection"/>
		/// </returns>
		/// <example>
		///
		///   var entity = new Entity();
		///   var entityCollection = await entity.GetEntitiesAsync( entityListFullName,  pageSize,  startIndex,  filter,  sortBy,  responseFields);
		///
		/// </example>
		public virtual async Task<Mozu.Api.Contracts.MZDB.EntityCollection> GetEntitiesAsync(string entityListFullName, int? pageSize =  null, int? startIndex =  null, string filter =  null, string sortBy =  null, string responseFields =  null, CancellationToken ct = default(CancellationToken))
		{
			MozuClient<Mozu.Api.Contracts.MZDB.EntityCollection> response;
			var client = Mozu.Api.Clients.Platform.Entitylists.EntityClient.GetEntitiesClient( entityListFullName,  pageSize,  startIndex,  filter,  sortBy,  responseFields);
			client.WithContext(_apiContext);
			response = await client.ExecuteAsync(ct).ConfigureAwait(false);
			return await response.ResultAsync();

		}

		///
		///
		///
		/// <param name="entityListFullName">The full name of the EntityList including namespace in name@nameSpace format</param>
		/// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
		/// <param name="item">JSON code for objects.</param>
		/// <returns>
		/// JObject
		/// </returns>
		/// <example>
		///
		///   var entity = new Entity();
		///   var json = await entity.InsertEntityAsync( item,  entityListFullName,  responseFields);
		///
		/// </example>
		public virtual async Task<JObject> InsertEntityAsync(JObject item, string entityListFullName, string responseFields =  null, CancellationToken ct = default(CancellationToken))
		{
			MozuClient<JObject> response;
			var client = Mozu.Api.Clients.Platform.Entitylists.EntityClient.InsertEntityClient( item,  entityListFullName,  responseFields);
			client.WithContext(_apiContext);
			response = await client.ExecuteAsync(ct).ConfigureAwait(false);
			return await response.ResultAsync();

		}

		///
		///
		///
		/// <param name="entityListFullName">The full name of the EntityList including namespace in name@nameSpace format</param>
		/// <param name="id">Unique identifier of the customer segment to retrieve.</param>
		/// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
		/// <param name="item">JSON code for objects.</param>
		/// <returns>
		/// JObject
		/// </returns>
		/// <example>
		///
		///   var entity = new Entity();
		///   var json = await entity.UpdateEntityAsync( item,  entityListFullName,  id,  responseFields);
		///
		/// </example>
		public virtual async Task<JObject> UpdateEntityAsync(JObject item, string entityListFullName, string id, string responseFields =  null, CancellationToken ct = default(CancellationToken))
		{
			MozuClient<JObject> response;
			var client = Mozu.Api.Clients.Platform.Entitylists.EntityClient.UpdateEntityClient( item,  entityListFullName,  id,  responseFields);
			client.WithContext(_apiContext);
			response = await client.ExecuteAsync(ct).ConfigureAwait(false);
			return await response.ResultAsync();

		}

		///
		///
		///
		/// <param name="entityListFullName">The full name of the EntityList including namespace in name@nameSpace format</param>
		/// <param name="id">Unique identifier of the customer segment to retrieve.</param>
		/// <returns>
		///
		/// </returns>
		/// <example>
		///
		///   var entity = new Entity();
		///   await entity.DeleteEntityAsync( entityListFullName,  id);
		///
		/// </example>
		public virtual async Task DeleteEntityAsync(string entityListFullName, string id, CancellationToken ct = default(CancellationToken))
		{
			MozuClient response;
			var client = Mozu.Api.Clients.Platform.Entitylists.EntityClient.DeleteEntityClient( entityListFullName,  id);
			client.WithContext(_apiContext);
			response = await client.ExecuteAsync(ct).ConfigureAwait(false);

		}

	}

}


text:
/* jslint node: true */
'use strict';

var assert = require('assert');
var _ = require('lodash');

var integrationTestHelper = require('./integrationTestHelper');

describe('Integration test: lists', function () {

	var testHelper = new integrationTestHelper();

	function getBulletListLine(pages, options) {
		options.itemNumber = options.itemNumber || 1;

		var bullet = pages[options.pageNumber].items[options.itemNumber * 2 - 1];
		var content = pages[options.pageNumber].items[options.itemNumber * 2 - 2];

		return {
			bullet: bullet && bullet.item,
			content: content && content.item
		};
	}

	it('renders a ordered list', function () {
		var dd = {
			content: {
				ol: [
					'item 1',
					'item 2',
					'item 3 - Paleo American Apparel forage whatever.'
				]
			}
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), '1. ');

		assert.equal(item1.bullet.x, testHelper.MARGINS.left);
		assert.equal(item1.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString('1. '));
		assert.equal(item1.bullet.y, testHelper.MARGINS.top);
		assert.equal(item1.content.y, testHelper.MARGINS.top);

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item 2');
		assert.equal(_.map(item2.bullet.inlines, 'text').join(''), '2. ');

		assert.equal(item2.bullet.x, testHelper.MARGINS.left);
		assert.equal(item2.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString('2. '));
		assert.equal(item2.bullet.y, testHelper.MARGINS.top + testHelper.LINE_HEIGHT);
		assert.equal(item2.content.y, testHelper.MARGINS.top + testHelper.LINE_HEIGHT);

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 3 - Paleo American Apparel ');
		assert.equal(_.map(item3.bullet.inlines, 'text').join(''), '3. ');

		assert.equal(item3.bullet.x, testHelper.MARGINS.left);
		assert.equal(item3.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString('3. '));
		assert.equal(item3.bullet.y, testHelper.MARGINS.top + testHelper.LINE_HEIGHT * 2);
		assert.equal(item3.content.y, testHelper.MARGINS.top + testHelper.LINE_HEIGHT * 2);

		var item4 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(item4.content.inlines, 'text').join(''), 'forage whatever.');
		assert.equal(item4.bullet, undefined);

		assert.equal(item4.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString(testHelper.DEFAULT_BULLET_SPACER));
		assert.equal(item4.content.y, testHelper.MARGINS.top + testHelper.LINE_HEIGHT * 3);
	});

	it('renders a ordered list and adapts margin to longest list number', function () {
		var dd = {
			content: {
				ol: [
					'item 1',
					'item 2',
					'item 3',
					'item 4',
					'item 5',
					'item 6',
					'item 7',
					'item 8',
					'item 9',
					'item 10'
				]
			}
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), '1. ');

		assert.equal(item1.bullet.x, testHelper.MARGINS.left);
		assert.equal(item1.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString('10. '));

		var item10 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 10});
		assert.equal(_.map(item10.content.inlines, 'text').join(''), 'item 10');
		assert.equal(_.map(item10.bullet.inlines, 'text').join(''), '10. ');

		assert.equal(item10.bullet.x, testHelper.MARGINS.left);
		assert.equal(item10.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString('10. '));
	});

	it('renders a unordered list', function () {
		var dd = {
			content: {
				ul: [
					'item 1',
					'item 2',
					'item 3 - Paleo American Apparel forage whatever.'
				]
			}
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var bulletRadius = 2;
		var bulletMargin = testHelper.MARGINS.left + bulletRadius;

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(item1.bullet.type, 'ellipse');

		assert.equal(item1.bullet.x, bulletMargin);
		assert.equal(item1.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString(testHelper.DEFAULT_BULLET_SPACER));
		assert.equal(item1.content.y, testHelper.MARGINS.top);

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item 2');
		assert.equal(item2.bullet.type, 'ellipse');

		assert.equal(item2.bullet.x, bulletMargin);
		assert.equal(item2.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString(testHelper.DEFAULT_BULLET_SPACER));

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 3 - Paleo American Apparel ');
		assert.equal(item3.bullet.type, 'ellipse');

		assert.equal(item3.bullet.x, bulletMargin);
		assert.equal(item3.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString(testHelper.DEFAULT_BULLET_SPACER));
		assert.equal(item3.content.y, testHelper.MARGINS.top + testHelper.LINE_HEIGHT * 2);

		var item4 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(item4.content.inlines, 'text').join(''), 'forage whatever.');
		assert.equal(item4.bullet, undefined);

		assert.equal(item4.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString(testHelper.DEFAULT_BULLET_SPACER));
		assert.equal(item4.content.y, testHelper.MARGINS.top + testHelper.LINE_HEIGHT * 3);
	});

	it('renders a unordered list and keeps constant small margin', function () {
		var dd = {
			content: {
				ul: [
					'item 1',
					'item 2',
					'item 3',
					'item 4',
					'item 5',
					'item 6',
					'item 7',
					'item 8',
					'item 9',
					'item 10'
				]
			}
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var bulletRadius = 2;
		var bulletMargin = testHelper.MARGINS.left + bulletRadius;

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');

		assert.equal(item1.bullet.x, bulletMargin);
		assert.equal(item1.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString(testHelper.DEFAULT_BULLET_SPACER));

		var item10 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 10});
		assert.equal(_.map(item10.content.inlines, 'text').join(''), 'item 10');

		assert.equal(item10.bullet.x, bulletMargin);
		assert.equal(item10.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString(testHelper.DEFAULT_BULLET_SPACER));
	});

	it('renders nested lists', function () {
		var dd = {
			content: {
				ol: [
					'item 1',
					[
						'item 2',
						{ol: ['subitem 1', 'subitem 2']}
					],
					'item 3'
				]
			}
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), '1. ');

		assert.equal(item1.bullet.x, testHelper.MARGINS.left);
		assert.equal(item1.content.x, testHelper.MARGINS.left + testHelper.getWidthOfString('1. '));

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item 2');
		assert.equal(_.map(item2.bullet.inlines, 'text').join(''), '2. ');

		var item2BulletSpacing = testHelper.MARGINS.left + testHelper.getWidthOfString('2. ');
		assert.equal(item2.bullet.x, testHelper.MARGINS.left);
		assert.equal(item2.content.x, item2BulletSpacing);

		var subItem1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(subItem1.content.inlines, 'text').join(''), 'subitem 1');
		assert.equal(_.map(subItem1.bullet.inlines, 'text').join(''), '1. ');

		assert.equal(subItem1.bullet.x, item2BulletSpacing);
		assert.equal(subItem1.content.x, item2BulletSpacing + testHelper.getWidthOfString('1. '));
		assert.equal(subItem1.content.y, testHelper.MARGINS.top + testHelper.LINE_HEIGHT * 2);

		var subItem2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(subItem2.content.inlines, 'text').join(''), 'subitem 2');
		assert.equal(_.map(subItem2.bullet.inlines, 'text').join(''), '2. ');

		assert.equal(subItem2.bullet.x, item2BulletSpacing);
		assert.equal(subItem2.content.x, item2BulletSpacing + testHelper.getWidthOfString('2. '));

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 3');
		assert.equal(_.map(item3.bullet.inlines, 'text').join(''), '3. ');

		var item3BulletSpacing = testHelper.MARGINS.left + testHelper.getWidthOfString('3. ');
		assert.equal(item3.bullet.x, testHelper.MARGINS.left);
		assert.equal(item3.content.x, item3BulletSpacing);
		assert.equal(item3.content.y, testHelper.MARGINS.top + testHelper.LINE_HEIGHT * 4);
	});

	it('renders a ordered list with start value', function () {
		var dd = {
			content: [
				{
					start: 50,
					ol: [
						'item 1',
						'item 2',
						'item 3',
						'item 4',
						'item 5'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), '50. ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 5');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), '54. ');
	});

	it('renders a reversed ordered list', function () {
		var dd = {
			content: [
				{
					reversed: true,
					ol: [
						'item 1',
						'item 2',
						'item 3',
						'item 4',
						'item 5'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), '5. ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 5');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), '1. ');
	});

	it('renders a ordered list with own separator', function () {
		var dd = {
			content: [
				{
					separator: ')',
					ol: [
						'item 1',
						'item 2',
						'item 3',
						'item 4',
						'item 5'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), '1) ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 5');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), '5) ');
	});

	it('renders a ordered list with own complex separator', function () {
		var dd = {
			content: [
				{
					separator: ['(', ')'],
					ol: [
						'item 1',
						'item 2',
						'item 3',
						'item 4',
						'item 5'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), '(1) ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 5');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), '(5) ');
	});

	it('renders a ordered list with upper-roman style type', function () {
		var dd = {
			content: [
				{
					type: 'upper-roman',
					ol: [
						'item 1',
						'item 2',
						'item 3',
						'item 4',
						'item 5'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), 'I. ');

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item 2');
		assert.equal(_.map(item2.bullet.inlines, 'text').join(''), 'II. ');

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 3');
		assert.equal(_.map(item3.bullet.inlines, 'text').join(''), 'III. ');

		var item4 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(item4.content.inlines, 'text').join(''), 'item 4');
		assert.equal(_.map(item4.bullet.inlines, 'text').join(''), 'IV. ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 5');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), 'V. ');
	});

	it('renders a ordered list with lower-roman style type', function () {
		var dd = {
			content: [
				{
					type: 'lower-roman',
					ol: [
						'item 1',
						'item 2',
						'item 3',
						'item 4',
						'item 5'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), 'i. ');

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item 2');
		assert.equal(_.map(item2.bullet.inlines, 'text').join(''), 'ii. ');

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 3');
		assert.equal(_.map(item3.bullet.inlines, 'text').join(''), 'iii. ');

		var item4 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(item4.content.inlines, 'text').join(''), 'item 4');
		assert.equal(_.map(item4.bullet.inlines, 'text').join(''), 'iv. ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 5');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), 'v. ');
	});

	it('renders a ordered list with upper-roman style type and check maximum', function () {
		var dd = {
			content: [
				{
					start: 4995,
					type: 'upper-roman',
					ol: [
						'item 4995',
						'item 4996',
						'item 4997',
						'item 4998',
						'item 4999',
						'item 5000',
						'item 5001'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 4995');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), 'MMMMCMXCV. ');

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item 4996');
		assert.equal(_.map(item2.bullet.inlines, 'text').join(''), 'MMMMCMXCVI. ');

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 4997');
		assert.equal(_.map(item3.bullet.inlines, 'text').join(''), 'MMMMCMXCVII. ');

		var item4 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(item4.content.inlines, 'text').join(''), 'item 4998');
		assert.equal(_.map(item4.bullet.inlines, 'text').join(''), 'MMMMCMXCVIII. ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 4999');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), 'MMMMCMXCIX. ');

		var item6 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 6});
		assert.equal(_.map(item6.content.inlines, 'text').join(''), 'item 5000');
		assert.equal(_.map(item6.bullet.inlines, 'text').join(''), '5000. ');

		var item7 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 7});
		assert.equal(_.map(item7.content.inlines, 'text').join(''), 'item 5001');
		assert.equal(_.map(item7.bullet.inlines, 'text').join(''), '5001. ');
	});

	it('renders a ordered list with upper-roman style type and check minimum', function () {
		var dd = {
			content: [
				{
					start: -2,
					type: 'upper-roman',
					ol: [
						'item -2',
						'item -1',
						'item 0',
						'item 1',
						'item 2'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item -2');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), '-2. ');

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item -1');
		assert.equal(_.map(item2.bullet.inlines, 'text').join(''), '-1. ');

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 0');
		assert.equal(_.map(item3.bullet.inlines, 'text').join(''), '0. ');

		var item4 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(item4.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item4.bullet.inlines, 'text').join(''), 'I. ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 2');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), 'II. ');
	});

	it('renders a ordered list with upper-alpha style type', function () {
		var dd = {
			content: [
				{
					type: 'upper-alpha',
					ol: [
						'item 1',
						'item 2',
						'item 3',
						'item 4',
						'item 5'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), 'A. ');

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item 2');
		assert.equal(_.map(item2.bullet.inlines, 'text').join(''), 'B. ');

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 3');
		assert.equal(_.map(item3.bullet.inlines, 'text').join(''), 'C. ');

		var item4 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(item4.content.inlines, 'text').join(''), 'item 4');
		assert.equal(_.map(item4.bullet.inlines, 'text').join(''), 'D. ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 5');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), 'E. ');
	});

	it('renders a ordered list with upper-alpha style type (counter 25 - 29)', function () {
		var dd = {
			content: [
				{
					type: 'upper-alpha',
					start: 25,
					ol: [
						'item 1',
						'item 2',
						'item 3',
						'item 4',
						'item 5'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), 'Y. ');

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item 2');
		assert.equal(_.map(item2.bullet.inlines, 'text').join(''), 'Z. ');

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 3');
		assert.equal(_.map(item3.bullet.inlines, 'text').join(''), 'AA. ');

		var item4 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(item4.content.inlines, 'text').join(''), 'item 4');
		assert.equal(_.map(item4.bullet.inlines, 'text').join(''), 'AB. ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 5');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), 'AC. ');
	});

	it('renders a ordered list with upper-alpha style type and check minimum', function () {
		var dd = {
			content: [
				{
					start: -2,
					type: 'upper-alpha',
					ol: [
						'item -2',
						'item -1',
						'item 0',
						'item 1',
						'item 2'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item -2');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), '-2. ');

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item -1');
		assert.equal(_.map(item2.bullet.inlines, 'text').join(''), '-1. ');

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 0');
		assert.equal(_.map(item3.bullet.inlines, 'text').join(''), '0. ');

		var item4 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(item4.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item4.bullet.inlines, 'text').join(''), 'A. ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 2');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), 'B. ');
	});

	it('renders a ordered list with lower-alpha style type', function () {
		var dd = {
			content: [
				{
					type: 'lower-alpha',
					ol: [
						'item 1',
						'item 2',
						'item 3',
						'item 4',
						'item 5'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), 'a. ');

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item 2');
		assert.equal(_.map(item2.bullet.inlines, 'text').join(''), 'b. ');

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 3');
		assert.equal(_.map(item3.bullet.inlines, 'text').join(''), 'c. ');

		var item4 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(item4.content.inlines, 'text').join(''), 'item 4');
		assert.equal(_.map(item4.bullet.inlines, 'text').join(''), 'd. ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 5');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), 'e. ');
	});

	it('renders a ordered list with lower-alpha style type (counter 25 - 29)', function () {
		var dd = {
			content: [
				{
					type: 'lower-alpha',
					start: 25,
					ol: [
						'item 1',
						'item 2',
						'item 3',
						'item 4',
						'item 5'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), 'y. ');

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item 2');
		assert.equal(_.map(item2.bullet.inlines, 'text').join(''), 'z. ');

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 3');
		assert.equal(_.map(item3.bullet.inlines, 'text').join(''), 'aa. ');

		var item4 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(item4.content.inlines, 'text').join(''), 'item 4');
		assert.equal(_.map(item4.bullet.inlines, 'text').join(''), 'ab. ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 5');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), 'ac. ');
	});

	it('renders a ordered list with lower-alpha style type and check minimum', function () {
		var dd = {
			content: [
				{
					start: -2,
					type: 'lower-alpha',
					ol: [
						'item -2',
						'item -1',
						'item 0',
						'item 1',
						'item 2'
					]
				}
			]
		};

		var pages = testHelper.renderPages('A6', dd);

		assert.equal(pages.length, 1);

		var item1 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 1});
		assert.equal(_.map(item1.content.inlines, 'text').join(''), 'item -2');
		assert.equal(_.map(item1.bullet.inlines, 'text').join(''), '-2. ');

		var item2 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 2});
		assert.equal(_.map(item2.content.inlines, 'text').join(''), 'item -1');
		assert.equal(_.map(item2.bullet.inlines, 'text').join(''), '-1. ');

		var item3 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 3});
		assert.equal(_.map(item3.content.inlines, 'text').join(''), 'item 0');
		assert.equal(_.map(item3.bullet.inlines, 'text').join(''), '0. ');

		var item4 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 4});
		assert.equal(_.map(item4.content.inlines, 'text').join(''), 'item 1');
		assert.equal(_.map(item4.bullet.inlines, 'text').join(''), 'a. ');

		var item5 = getBulletListLine(pages, {pageNumber: 0, itemNumber: 5});
		assert.equal(_.map(item5.content.inlines, 'text').join(''), 'item 2');
		assert.equal(_.map(item5.bullet.inlines, 'text').join(''), 'b. ');
	});

});


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#88000000"></solid>
    <corners android:radius="50dp"></corners>
</shape>


text:
package org.apache.pig.scripting;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;

import org.apache.hadoop.util.Shell;
import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.impl.PigContext;
import org.apache.pig.tools.pigstats.PigStats;

/**
 * Base class for various scripting implementations
 */
public abstract class ScriptEngine {

    public static enum SupportedScriptLang {

        // possibly jruby in the future
        jruby(new String[]{"ruby", "jruby"}, new String[]{"rb"}, "org.apache.pig.scripting.jruby.JrubyScriptEngine"),
        jython(new String[]{"python", "jython"}, new String[]{"py"}, "org.apache.pig.scripting.jython.JythonScriptEngine"),
        javascript(new String[]{}, new String[]{"js"}, "org.apache.pig.scripting.js.JsScriptEngine"),
        groovy(new String[]{}, new String[]{"groovy"}, "org.apache.pig.scripting.groovy.GroovyScriptEngine"),
        streaming_python(new String[]{"streaming_python"}, new String[]{}, "org.apache.pig.scripting.streaming.python.PythonScriptEngine");

        private static Set<String> supportedScriptLangs;
        static {
            supportedScriptLangs = new HashSet<String>();
            for (SupportedScriptLang value : SupportedScriptLang.values()) {
                supportedScriptLangs.add(value.name());
            }
            supportedScriptLangs = Collections.unmodifiableSet(supportedScriptLangs);
        }

        public static boolean contains(String supportedScriptLang) {
            return supportedScriptLangs.contains(supportedScriptLang);
        }

        private String[] shebangs;
        private String[] extensions;
        /** Class implementing the engine. As a string as dependencies are possibly not on the class path*/
        private String engineClassName;

        private SupportedScriptLang(String[] shebangs, String[] extensions, String engineClassName) {
            this.shebangs = shebangs;
            this.extensions = extensions;
            this.engineClassName = engineClassName;
        }

        /**
         * If other discovery mechanisms come up they can also override accepts()
         * @param file the path of the file
         * @param firstLine The first line of the file (possibly containing #!...)
         */
        public boolean accepts(String file, String firstLine) {
            if( firstLine == null )
            	return false;

            for (String shebang : shebangs) {
                Pattern p = Pattern.compile("^#!.*/" + shebang + "\\s*$");
                if (p.matcher(firstLine).matches()) {
                    return true;
                }
            }

            for (String ext : extensions) {
                if (file.endsWith("."+ext)) {
                    return true;
                }
            }

            return false;
        }

        public String getEngineClassName() {
            return engineClassName;
        }

    }

    private static final Pattern shebangPattern = Pattern.compile("^#!.+");

    private static boolean declaresShebang(String firstLine) {
    	if( firstLine == null )
    		return false;
        return shebangPattern.matcher(firstLine).matches();
    }

    /**
     * open a stream load a script locally or in the classpath
     * @param scriptPath the path of the script
     * @return a stream (it is the responsibility of the caller to close it)
     * @throws IllegalStateException if we could not open a stream
     */
    public static InputStream getScriptAsStream(String scriptPath) {
    //protected static InputStream getScriptAsStream(String scriptPath) {
        InputStream is = null;
        File file = new File(scriptPath);
        if (file.exists()) {
            try {
                is = new FileInputStream(file);
            } catch (FileNotFoundException e) {
                throw new IllegalStateException("could not find existing file "+scriptPath, e);
            }
        } else {
            if (Shell.WINDOWS && scriptPath.charAt(1)==':') {
                scriptPath = scriptPath.charAt(0) + scriptPath.substring(2);
            }
            // Try system, current and context classloader.
            is = ScriptEngine.class.getResourceAsStream(scriptPath);
            if (is == null) {
                is = getResourceUsingClassLoader(scriptPath, ScriptEngine.class.getClassLoader());
            }
            if (is == null) {
                is = getResourceUsingClassLoader(scriptPath, Thread.currentThread().getContextClassLoader());
            }
            if (is == null && !file.isAbsolute()) {
                String path = "/" + scriptPath;
                is = ScriptEngine.class.getResourceAsStream(path);
                if (is == null) {
                    is = getResourceUsingClassLoader(path, ScriptEngine.class.getClassLoader());
                }
                if (is == null) {
                    is = getResourceUsingClassLoader(path, Thread.currentThread().getContextClassLoader());
                }
            }
        }

        // TODO: discuss if we want to add logic here to load a script from HDFS

        if (is == null) {
            throw new IllegalStateException(
                    "Could not initialize interpreter (from file system or classpath) with " + scriptPath);
        }
        return is;
    }

    private static InputStream getResourceUsingClassLoader(String fullFilename, ClassLoader loader) {
        if (loader != null) {
            return loader.getResourceAsStream(fullFilename);
        }
        return null;
    }

    public static final String NAMESPACE_SEPARATOR = ".";

    /**
     * @param file the file to inspect
     * @return the Supported Script Lang if this is a supported script language
     * @throws IOException if there was an error reading the file or if the file defines explicitly an unknown #!
     */
    public static SupportedScriptLang getSupportedScriptLang(String file) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader(file));
        String firstLine;
        try {
            firstLine = br.readLine();
        } finally {
            br.close();
        }
        for (SupportedScriptLang supportedScriptLang : SupportedScriptLang.values()) {
            if (supportedScriptLang.accepts(file, firstLine)) {
                return supportedScriptLang;
            }
        }
        if (declaresShebang(firstLine)) {
            throw new IOException("Unsupported script type is specified: " + firstLine);
        }
        return null;
    }

    private Map<String, List<PigStats>> statsMap = new HashMap<String, List<PigStats>>();

    /**
     * Registers scripting language functions as Pig functions with given namespace
     *
     * @param path path of the script
     * @param namespace namespace for the functions
     * @param pigContext pigcontext to register functions to pig in the given namespace
     * @throws IOException
     */
    public abstract void registerFunctions(String path, String namespace,
            PigContext pigContext) throws IOException;

    /**
     * Actually runs the script file. This method will be implemented by
     * individual script engines.
     *
     * @param context {@link ScriptPigContext} to run the script file
     * @param scriptFile the file
     * @throws IOException
     */
    protected abstract Map<String, List<PigStats>> main(
           PigContext context, String scriptFile) throws IOException;

// Not needed as a general abstraction so far
//    /**
//     * Loads the script in the interpreter.
//     * @param script
//     */
//    protected abstract void load(InputStream script) throws IOException;

    /**
     * Gets ScriptEngine classname or keyword for the scripting language
     */
    protected abstract String getScriptingLang();

    /**
     * Returns a map from local variable names to their values
     * @throws IOException
     */
    protected abstract Map<String, Object> getParamsFromVariables()
            throws IOException;

    /**
     * Figures out the jar location from the class
     * @param clazz class in the jar file
     * @return the jar file location, null if the class was not loaded from a jar
     * @throws FileNotFoundException
     */
    public static String getJarPath(Class<?> clazz)
            throws FileNotFoundException {
        URL resource = clazz.getClassLoader().getResource(
                clazz.getCanonicalName().replace(".", "/") + ".class");
        if (resource.getProtocol().equals("jar")) {
            return resource.getPath().substring(
                    resource.getPath().indexOf(':') + 1,
                    resource.getPath().indexOf('!'));
        }
        throw new FileNotFoundException("Jar for " + clazz.getName()
                + " class is not found");
    }

    /**
     * Gets instance of the scriptEngine for the given scripting language
     *
     * @param scriptingLang ScriptEngine classname or keyword for the scriptingLang
     * @return scriptengine for the given scripting language
     * @throws IOException
     */
    public static ScriptEngine getInstance(String scriptingLang)
            throws IOException {
        String scriptingEngine = scriptingLang;
        try {
            if (SupportedScriptLang.contains(scriptingLang)) {
                SupportedScriptLang supportedScriptLang = SupportedScriptLang.valueOf(scriptingLang);
                scriptingEngine = supportedScriptLang.getEngineClassName();
            }
            return (ScriptEngine) Class.forName(scriptingEngine).newInstance();
        } catch (Exception e) {
            throw new IOException("Could not load ScriptEngine: "
                    + scriptingEngine + " for "+scriptingLang+" (Supported langs: "+SupportedScriptLang.supportedScriptLangs+") : " + e, e);
        }
    }

    /**
     * Runs a script file.
     * @param pigContext {@link PigContext} to run the script file
     * @param scriptFile the file
     * @return a collection of {@link PigStats} objects. One for each runtime
     * instance of {@link Pig} in the script. For named pipelines, the
     * map key is the name of the pipeline. For unnamed pipeline, the map key
     * is the script id associated with the instance.
     * @throws ExecException
     * @throws IOException
     */
    public Map<String, List<PigStats>> run(PigContext pigContext, String scriptFile)
            throws ExecException, IOException {
        ScriptPigContext.set(pigContext, this);
        return main(pigContext, scriptFile);
    }

    /**
     * Gets the collection of {@link PigStats} after the script is run.
     */
    protected Map<String, List<PigStats>> getPigStatsMap() {
        return statsMap;
    }

    void setPigStats(String key, PigStats stats) {
        List<PigStats> lst = statsMap.get(key);
        if (lst == null) {
            lst = new ArrayList<PigStats>();
            statsMap.put(key, lst);
        }
        lst.add(stats);
    }

    void setPigStats(String key, List<PigStats> stats) {
        statsMap.put(key, stats);
    }

}


text:
package lsh.ext.gson;

import com.google.gson.GsonBuilder;
import lombok.experimental.UtilityClass;

/**
 * Contains methods to maintain {@link GsonBuilder} instances.
 *
 * @author Lyubomyr Shaydariv
 */
@UtilityClass
public final class GsonBuilders {

	/**
	 * Creates a new "canonical" {@link GsonBuilder} instance excluding some default options from the default instance:
	 *
	 *

	 *
{@link GsonBuilder#disableInnerClassSerialization()}

	 *
{@link GsonBuilder#disableHtmlEscaping()}

	 *

	 */
	public static GsonBuilder createCanonical() {
		return new GsonBuilder()
				.disableInnerClassSerialization()
				.disableHtmlEscaping();
	}

}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="mobile-web-app-capable" content="yes">
  <meta name="msapplication-tap-highlight" content="no">
  <title>Truck Gestures</title>
  <link rel="stylesheet" href="../dist/styles/truck-ios.css">

  <screen id='main'>

Gestures

Try:

      tap, double tap, long tap,

      swipe left, swipe right,

      swipe up, swipe down

Gesture:

  </screen>


text:
<?php foreach ($this->album as $album) :?>

<?php echo htmlspecialchars($album['pic_name']); ?>

				<?php if ($album['pic'] == null) :?>

				<div class="pic-hover" data-id= <?php echo  $album['pic_id'] ?> data-src="/content/images/noimage.jpg">

				<?php else : ?>
				<?php echo ''; ?> <div class="pic-hover" data-id= <?php echo  $album['pic_id'] ?> data-src=<?php echo '"data:image/jpeg;base64,' . base64_encode($album['pic']) . '"'; ?> >

				<?php endif ?>

					<?php $date = new DateTime($album['pic_date']);
						echo $date->format('d-M-Y');?>

					Download

<?php endforeach ?>


text:
require 'bundler/setup'
Bundler.setup

require 'rspec/collection_matchers'

require 'codeclimate-test-reporter'
CodeClimate::TestReporter.start

require 'rails'
require 'rails_newsfeed'
require 'models/user_feed'

require 'coveralls'
Coveralls.wear!

require 'factory_girl'
require 'faker'

RSpec.configure do |config|
  config.expect_with :rspec do |expectations|
    expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  end

  config.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
  end

  config.include FactoryGirl::Syntax::Methods
  config.before(:suite) do
    FactoryGirl.find_definitions
  end
end


text:
<?php

namespace AppBundle\Services;
use Doctrine\ORM\EntityManager;

/**
 * Class RoundResults
 * @package AppBundle\Services
 */
class RoundRanking
{
    /**
     * @var \Doctrine\ORM\EntityManager|null
     */
    private $em = null;

    /**
     * @var array
     */
    private $ranking = array();

    /**
     * @var array
     */
    private $playerStats = array();

    public function __construct( EntityManager $em ) {
        $this->em = $em;
    }

    /**
     * @param $id    Identifies a round id
     * @return array Contains all game data of one round
     */
    public function findByRoundId($id)
    {
        $playerRepo     = $this->em->getRepository('AppBundle:Player');
        $gameRepo       = $this->em->getRepository('AppBundle:Game');
        $players        = $playerRepo->findByRoundId($id);
        $games          = $gameRepo->findByRoundId($id);

        foreach($players as $player) {
            $this->playerStats[$player->getId()]['id']           = $player->getId();
            $this->playerStats[$player->getId()]['name']         = $player->getName();
            $this->playerStats[$player->getId()]['games_played'] = 0;
            $this->playerStats[$player->getId()]['games_won']    = 0;
        }

        foreach($games as $game) {
            $idPlayerATeamA = $game['id_player_a_team_a'];
            $idPlayerBTeamA = $game['id_player_b_team_a'];
            $idPlayerATeamB = $game['id_player_a_team_b'];
            $idPlayerBTeamB = $game['id_player_b_team_b'];
            $this->playerStats[$idPlayerATeamA]['games_played']++;
            $this->playerStats[$idPlayerBTeamA]['games_played']++;
            $this->playerStats[$idPlayerATeamB]['games_played']++;
            $this->playerStats[$idPlayerBTeamB]['games_played']++;

            if ( $game['team_a_score'] > $game['team_b_score']) {
                $this->playerStats[$idPlayerATeamA]['games_won']++;
                $this->playerStats[$idPlayerBTeamA]['games_won']++;
            }
            else {
                $this->playerStats[$idPlayerATeamB]['games_won']++;
                $this->playerStats[$idPlayerBTeamB]['games_won']++;
            }
        }

        $this->calculateRatio();
        $this->sortByGamesWon();
        $this->setRanking();

        $date = \DateTime::createFromFormat('Y-m-d', $games[0]['date']);

        return array('date' => $date->format('d.m.y'), 'ranking' => $this->ranking);
    }

    /**
     * @return int
     */
    public function findByLastRound()
    {
        $roundRepo = $this->em->getRepository('AppBundle:Round');

        return $this->findByRoundId($roundRepo->findLatestId());
    }

    public function getPaginationBoundaries() {
        $roundRepo = $this->em->getRepository('AppBundle:Round');

        return array('min' => 1, 'max' => $roundRepo->findLatestId());
    }

    /**
     * Sorts the return array by number of won games
     */
    private function sortByGamesWon() {
        foreach($this->playerStats as $playerStatsKey => $playerStatsValue) {
            $this->ranking[$playerStatsKey] = $playerStatsValue['games_won'];
        }

        arsort($this->ranking);

        foreach($this->ranking as $key => &$value ) {
            $value = $this->playerStats[$key];
        }
    }

    private function setRanking() {
        $lastGameWon    = $this->getMaxWonMatches() + 1;
        $positioning    = 0;
        $offset         = 0;
        foreach($this->ranking as &$topDownRanking) {
            if ($topDownRanking['games_won'] < $lastGameWon) {
                $positioning += $offset;
                $positioning++;

                $topDownRanking['positioning']  = $positioning;
                $lastGameWon                    = $topDownRanking['games_won'];
                $offset                         = 0;
            }
            elseif($topDownRanking['games_won'] === $lastGameWon) {
                $topDownRanking['positioning'] = $positioning;
                $offset++;
            }
        }
    }

    private function getMaxWonMatches() {
        $bestPlayer = array_slice($this->ranking, 0, 1);

        return $bestPlayer[0]['games_won'];
    }

    /**
     * Calculates the ration of won games over played games
     */
    private function calculateRatio() {
        foreach($this->playerStats as &$playerStat) {
            $playerStat['win_ratio'] = round( ( ( $playerStat['games_won'] / $playerStat['games_played'] ) * 100), 2);
        }
    }
}


text:
import pydlbot_ui as Ui
import sys
from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
import time
import threading

if __name__ == '__main__':
	p = threading.Thread(target=main)
        p.start()
        for i in range(3):
                t = threading.Thread(target=f,args=(i,))
                t.start()

def main():
	app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui.Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

def f(id):
    print ("thread function",id)
    return