text:
package tld.testmod.common.animation;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import tld.testmod.Main;

public class TestAnimBlock extends AnimBaseBlock
{

    public TestAnimBlock()
    {
        super(Material.WOOD);
        this.setCreativeTab(Main.MOD_TAB);
    }

    @Override
    public TileEntity createTileEntity(World world, IBlockState state)
    {
        return new TestAnimTileEntity();
    }

    @Override
    public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if(!world.isRemote)
        {
            TileEntity te = world.getTileEntity(pos);
            if(te instanceof TestAnimTileEntity)
            {
                ((TestAnimTileEntity)te).click(false);
            }
        }
        return true;
    }

    @Override
    public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param)
    {
        if(worldIn.isRemote)
        {
            TileEntity te = worldIn.getTileEntity(pos);
            if(te instanceof TestAnimTileEntity)
            {
                ((TestAnimTileEntity)te).click(param==1 ? true: false);
            }
        }

        if (param == 1)
        {
            worldIn.playSound(null, pos, SoundEvents.BLOCK_IRON_TRAPDOOR_OPEN,  SoundCategory.BLOCKS, 0.5F, 1.0F );
            worldIn.spawnParticle(EnumParticleTypes.HEART, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.2D, (double)pos.getZ() + 0.5D, (double)param / 24.0D, 0.0D, 0.0D, new int[0]);
        }
        else
        {
            worldIn.playSound(null, pos, SoundEvents.BLOCK_IRON_TRAPDOOR_CLOSE,  SoundCategory.BLOCKS, 0.5F, 1.0F );
        }
        return true;
    }

    /**
     * React to a redstone powered neighbor block
     */
    @Override
    public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
    {
        boolean flag = worldIn.isBlockPowered(pos);
        TileEntity te = worldIn.getTileEntity(pos);

        if (te instanceof TestAnimTileEntity)
        {
            TestAnimTileEntity testAnimTE = (TestAnimTileEntity)te;
            if (testAnimTE.isPreviousRedstoneState() != flag)
            {
                if (flag)
                    testAnimTE.click(false);

                testAnimTE.setPreviousRedstoneState(flag);
            }
        }
    }

}


text:
"""
    Script to run a Symbooglix's AxiomAndEntryRequiresCheckTransformPass
    pass on a set of boogie programs (from a program List) in preparation
    for running a smoke test to check that all the assumptions leading to
    an entry point are satisfiable.
"""
import argparse
import logging
import multiprocessing
import os
import pprint
from  BoogieRunner import ProgramListLoader
from BoogieRunner import EntryPointFinder
import traceback
import yaml
import signal
import sys
import subprocess

_logger = None
futureToRunner = None

def handleInterrupt(signum, frame):
  logging.info('Received signal {}'.format(signum))
  if futureToRunner != None:
    cancel(futureToRunner)

def entryPoint(args):
  global _logger, futureToRunner
  parser = argparse.ArgumentParser(description=__doc__)
  parser.add_argument("-l","--log-level",type=str, default="info", dest="log_level", choices=['debug','info','warning','error'])
  parser.add_argument("--rprefix", default=os.getcwd(), help="Prefix for relative paths for program_list")
  parser.add_argument("-j", "--jobs", default=multiprocessing.cpu_count(), type=int, help="jobs to run in parallel")
  parser.add_argument("input_program_list", help="File containing list of Boogie programs")
  parser.add_argument("output_dir", help="Directory to create working transformed programs in")
  parser.add_argument("output_program_list")

  parser.add_argument("--spr-path", dest='spr_path', required=True, help="Path to Symbooglix pass runner tool (spr)")

  # Options to set the entry point
  group = parser.add_mutually_exclusive_group(required=True)
  group.add_argument("--entry-point", dest='entry_point', default=None, help="Entry point name")
  group.add_argument("--entry-point-from-bool-attribute", dest='entry_point_from_bool_attribute',
    default=None, help="Get entry point from bool attribute on procedure e.g. {:entry_point}")

  pargs = parser.parse_args()

  if pargs.jobs < 1:
    _logger.error('Jobs must be >= 1')
    return 1

  logLevel = getattr(logging, pargs.log_level.upper(),None)
  if logLevel == logging.DEBUG:
    logFormat = '%(levelname)s:%(threadName)s: %(filename)s:%(lineno)d %(funcName)s()  : %(message)s'
  else:
    logFormat = '%(levelname)s:%(threadName)s: %(message)s'

  logging.basicConfig(level=logLevel, format=logFormat)
  _logger = logging.getLogger(__name__)

  # Check paths that must exist
  for pathToCheck in [ pargs.input_program_list, pargs.spr_path]:
    if not os.path.exists(pathToCheck):
      _logger.error('"{}" does not exist'.format(pathToCheck))
      return 1

  # Check paths that must not already exist
  for pathToCheck in [ pargs.output_program_list, pargs.output_dir]:
    if os.path.exists(pathToCheck):
      _logger.error('Refusing to overwrite "{}"'.format(pathToCheck))
      return 1

  # Load list of programs
  programList = None
  try:
    _logger.debug('Loading program_list from "{}"'.format(pargs.input_program_list))
    programList = ProgramListLoader.load(pargs.input_program_list, pargs.rprefix)
  except (ProgramListLoader.ProgramListLoaderException) as e:
    _logger.error(e)
    _logger.debug(traceback.format_exc())

    return 1

  # Compute list index to entry point name mapping
  entryPoints = [ ]
  _logger.info('Getting program entry points...')
  for programPath in programList:
    if pargs.entry_point != None:
      entryPoints.append(pargs.entry_point)
    else:
      assert pargs.entry_point_from_bool_attribute != None
      entryPointName = EntryPointFinder.findEntryPointWithBooleanAttribute(pargs.entry_point_from_bool_attribute, programPath)
      assert entryPointName != None
      entryPoints.append(entryPointName)

  # Generate new programs
  _logger.info('Generating new programs')
  tasks = [ ]
  os.mkdir(pargs.output_dir)
  for index, (programPath, entryPoint) in enumerate(zip(programList, entryPoints)):
    outputPath = os.path.join(pargs.output_dir, 'program-{}.bpl'.format(index))
    tasks.append( ProgramGenTask(programPath, entryPoint, outputPath, pargs.spr_path) )

  # Run
  if pargs.jobs == 1:
    for t in tasks:
      t.run()
  else:
    signal.signal(signal.SIGINT, handleInterrupt)
    signal.signal(signal.SIGTERM, handleInterrupt)

    import concurrent.futures
    with concurrent.futures.ThreadPoolExecutor(max_workers=pargs.jobs) as executor:
      futureToRunner = { executor.submit(t.run) : t for t in tasks }
      for future in concurrent.futures.as_completed(futureToRunner):
        r = futureToRunner[future]
        _logger.info('{} runner finished'.format(r.outputPath))

        if future.exception():
          e = future.exception()
          cancel(futureToRunner)
          _logger.error(e)
          return 1

        if r.exitCode != 0:
          _logger.error('Tool failed')
          cancel(futureToRunner)
          return 1

  # Write program list
  with open(pargs.output_program_list, 'w') as f:
    for t in tasks:
      if t.exitCode != None:
        f.writelines('# Generated from {}\n'.format(t.programPath))
        f.writelines('{}\n\n'.format(t.outputPath))
      else:
        f.writelines('# Skipping program "{}" due to failure\n'.format(t.programPath))

  _logger.info('Finished')

  return 0

def cancel(futureToRunner):
  _logger.warning('Cancelling futures')
  for future in futureToRunner.keys():
    future.cancel()

class ProgramGenTask:
  def __init__(self, programPath, entryPoint, outputPath, sprPath):
    assert isinstance(programPath, str)
    assert isinstance(entryPoint, str)
    assert isinstance(outputPath, str)
    assert isinstance(sprPath, str)
    assert os.path.exists(programPath)
    self.programPath = programPath
    self.entryPoint = entryPoint
    self.outputPath = outputPath
    self.sprPath = sprPath
    self.exitCode = None

  def run(self):
    cmdLine = [ self.sprPath,
                '-e', self.entryPoint,
                '-p', 'Transform.AxiomAndEntryRequiresCheckTransformPass',
                '-o', self.outputPath,
                self.programPath
              ]
    _logger.debug('Running:\n{}'.format(pprint.pformat(cmdLine)))
    exitCode = subprocess.call(cmdLine)
    _logger.debug('Finished')
    self.exitCode = exitCode

if __name__ == '__main__':
  try:
    sys.exit(entryPoint(sys.argv[1:]))
  except KeyboardInterrupt:
    sys.exit(2)

redpajama_set_name: RedPajamaGithub


text:
package com.vmware.vim25;

/**
@author Steve Jin (sjin@vmware.com)
*/

public class CustomizationSysprep extends CustomizationIdentitySettings
{
  public CustomizationGuiUnattended guiUnattended;
  public CustomizationUserData userData;
  public CustomizationGuiRunOnce guiRunOnce;
  public CustomizationIdentification identification;
  public CustomizationLicenseFilePrintData licenseFilePrintData;

  public CustomizationGuiUnattended getGuiUnattended()
  {
    return this.guiUnattended;
  }

  public CustomizationUserData getUserData()
  {
    return this.userData;
  }

  public CustomizationGuiRunOnce getGuiRunOnce()
  {
    return this.guiRunOnce;
  }

  public CustomizationIdentification getIdentification()
  {
    return this.identification;
  }

  public CustomizationLicenseFilePrintData getLicenseFilePrintData()
  {
    return this.licenseFilePrintData;
  }

  public void setGuiUnattended(CustomizationGuiUnattended guiUnattended)
  {
    this.guiUnattended=guiUnattended;
  }

  public void setUserData(CustomizationUserData userData)
  {
    this.userData=userData;
  }

  public void setGuiRunOnce(CustomizationGuiRunOnce guiRunOnce)
  {
    this.guiRunOnce=guiRunOnce;
  }

  public void setIdentification(CustomizationIdentification identification)
  {
    this.identification=identification;
  }

  public void setLicenseFilePrintData(CustomizationLicenseFilePrintData licenseFilePrintData)
  {
    this.licenseFilePrintData=licenseFilePrintData;
  }
}


text:
"""
This package contains wrappers for other topic modeling programs.
"""

from .ldamallet import LdaMallet
from .dtmmodel import DtmModel
from .ldavowpalwabbit import LdaVowpalWabbit


text:
var Menu = function (cutLabel, copyLabel, pasteLabel) {
        var gui = require('nw.gui'),

            menu = new gui.Menu(),

            cut = new gui.MenuItem({
                label: cutLabel,
                click: function() {
                    document.execCommand('cut');
                }
            }),

            copy = new gui.MenuItem({
                label: copyLabel,
                click: function() {
                    document.execCommand('copy');
                }
            }),

            paste = new gui.MenuItem({
                label: pasteLabel,
                click: function() {
                    document.execCommand('paste');
                }
            });

        menu.append(cut);
        menu.append(copy);
        menu.append(paste);

        return menu;
};

var menu = new Menu('Cut', 'Copy', 'Paste');

document.addEventListener('contextmenu', function(e) {
    e.preventDefault();
    menu.popup(e.x, e.y);
    return false;
});


text:
Ixchel Guadalupe Meza Chávez
Amaury Gutierrez Acosta

**Título del proyecto**: Policy Gradients utilizando CUDA aplicado al juego Pong de ATARI

En el aprendizaje por refuerzo clásico se aproxima una función del producto cartesiano del espacio de estados y el espacio de acciones. El primer intento de aproximar dicha función usando una red neuronal se debe a Gerald Tesauro, quien creó un programa capaz de aprender a jugar Backgammon a partir de nulo conocimiento. Jugando contra sí mismo, el programa era capaz de generar estrategias y evaluar su eficacia hasta poder vencer a humanos expertos. Usando una idea similar, el artículo cuyas ideas intentaremos replicar en este proyecto plantea la creación de un agente que pueda aprender a jugar videojuegos a partir de la secuencia de matrices de pixeles que constituyen el juego. Para lograr esto, se propone el uso de una red neuronal con dos capas de convolución y una capa completamente conectada. La entrada de la red sería la matriz de pixeles y la salida es un elemento del espacio de acciones que el agente puede tomar.

Para implementar la arquitectura de la red neuronas usaremos [cuDNN](https://developer.nvidia.com/cudnn), este *framework* proporciona herramientas que comúnmente se usan en las redes neuronales. Adicionalmente se explorarán otras opciones para acelerar el entrenamiento de la red neuronal encontradas en la literatura, sin embargo, la implementación de las mismas está fuera del alcance del proyecto. En cuanto a nuestra implementación nos enfocaremos en el juego conocido como Breakout.

El objetivo del proyecto es implementar y evaluar el uso de las tarjetas gráficas para el computo científico.

En la carpeta [avance_07_04_2017](avance_07_04_2017) se encuentra el reporte del primer avance para determinar y avanzar nuestro proyecto.

En la carpeta [avance_17_04_2017](avance_17_04_2017) se encuentra el reporte del segundo avance para determinar y avanzar nuestro proyecto.

En la carpeta [avance_26_04_2017](avance_26_04_2017) se encuentra el reporte del tercer avance para determinar y avanzar nuestro proyecto.

En la carpeta [avance_02_05_2017](avance_02_05_2017) se encuentra el reporte del cuarto avance para determinar y avanzar nuestro proyecto.

En la carpeta [avance_08_05_2017](avance_08_05_2017) se encuentra el reporte del cuarto avance para determinar y avanzar nuestro proyecto.

En la carpeta [avance_15_05_2017](avance_15_05_2017) se encuentra el reporte del cuarto avance para determinar y avanzar nuestro proyecto.

En la carpeta [avance_22_05_2017](avance_22_05_2017) se encuentra el reporte del cuarto avance para determinar y avanzar nuestro proyecto.

En la carpeta [avance_30_05_2017](avance_30_05_2017) se encuentra el reporte del cuarto avance para determinar y avanzar nuestro proyecto.

## Plan de trabajo

### [7 de abril](avance_07_04_2017)

Exploración de factibilidad del proyecto. Revisión de literatura. Prueba de ejemplos de cuDNN. Prueba de hardware disponible.

### [17 de abril](avance_17_04_2017)

Revisión de literatura. Prueba de ejemplos que usan DQN. Revisión de la librería cuDNN.

### [26 de abril](avance_26_04_2017)

Revisión de literatura recomendada por Erick. Pruebas de aprendizaje usando policy gradient con el juego Breakout.

### [2 de mayo](avance_02_05_2017)

Revisión de literatura y notas para trabajo escrito y presentación. pruebas de aprendizaje usando policy gradient con el juego Breakout.

### [8 de mayo](avance_08_05_2017)

Inicio de implementación de código.

### [15 de mayo](avance_15_05_2017)

Implementación de código.

### [22 de mayo](avance_22_05_2017)

Reporte y presentación.

### [30 de mayo](avance_30_05_2017)

Reporte y presentación.

## Referencias

- [Temporal Difference Learning and TD-Gammon](http://courses.cs.washington.edu/courses/cse590hk/01sp/Readings/tesauro95cacm.pdf)

- [Playing Atari with Deep Reinforcement Learning](https://arxiv.org/pdf/1312.5602.pdf)

- [Massively Parallel Methods for Deep Reinforcement Learning](https://arxiv.org/pdf/1507.04296.pdf)


text:
	#define CLOCK_SOURCE (USE_PLL_HSE_EXTC|USE_PLL_HSE_XTAL|USE_PLL_HSI)
#endif
#if !defined(MBED_CONF_PPP_CELL_IFACE_BAUD_RATE)
	#define MBED_CONF_PPP_CELL_IFACE_BAUD_RATE (115200)
#endif
#if !defined(MBED_CONF_EVENTS_SHARED_HIGHPRIO_EVENTSIZE)
	#define MBED_CONF_EVENTS_SHARED_HIGHPRIO_EVENTSIZE (256)
#endif
#if !defined(MBED_CONF_PLATFORM_STDIO_BAUD_RATE)
	#define MBED_CONF_PLATFORM_STDIO_BAUD_RATE (9600)
#endif
#if !defined(MBED_CONF_EVENTS_SHARED_STACKSIZE)
	#define MBED_CONF_EVENTS_SHARED_STACKSIZE (1024)
#endif
#if !defined(MBED_CONF_PPP_CELL_IFACE_AT_PARSER_BUFFER_SIZE)
	#define MBED_CONF_PPP_CELL_IFACE_AT_PARSER_BUFFER_SIZE (256)
#endif
#if !defined(MBED_CONF_PPP_CELL_IFACE_AT_PARSER_TIMEOUT)
	#define MBED_CONF_PPP_CELL_IFACE_AT_PARSER_TIMEOUT (8000)
#endif
#if !defined(CLOCK_SOURCE_USB)
	#define CLOCK_SOURCE_USB (0)
#endif
#if !defined(MBED_CONF_EVENTS_SHARED_DISPATCH_FROM_APPLICATION)
	#define MBED_CONF_EVENTS_SHARED_DISPATCH_FROM_APPLICATION (0)
#endif
#if !defined(MBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE)
	#define MBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE (256)
#endif
#if !defined(MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP)
	#define MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP (0)
#endif
#if !defined(MBED_CONF_PLATFORM_STDIO_FLUSH_AT_EXIT)
	#define MBED_CONF_PLATFORM_STDIO_FLUSH_AT_EXIT (1)
#endif
#if !defined(MBED_CONF_PLATFORM_STDIO_CONVERT_NEWLINES)
	#define MBED_CONF_PLATFORM_STDIO_CONVERT_NEWLINES (0)
#endif
#if !defined(MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE)
	#define MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE (9600)
#endif
#if !defined(MBED_CONF_DRIVERS_UART_SERIAL_TXBUF_SIZE)
	#define MBED_CONF_DRIVERS_UART_SERIAL_TXBUF_SIZE (256)
#endif
#if !defined(MBED_CONF_EVENTS_SHARED_EVENTSIZE)
	#define MBED_CONF_EVENTS_SHARED_EVENTSIZE (256)
#endif
#if !defined(MBED_CONF_EVENTS_SHARED_HIGHPRIO_STACKSIZE)
	#define MBED_CONF_EVENTS_SHARED_HIGHPRIO_STACKSIZE (1024)
#endif
#if !defined(UNITY_INCLUDE_CONFIG_H)
	#define UNITY_INCLUDE_CONFIG_H
#endif

# endif


text:
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.21.0.4666 modeling language!*/

import java.sql.Time;

/**
 * Police or fire vehicle
 * From Requirements section 8 Data Dictionary
 */
// line 60 "BcmsCore.ump"
// line 128 "BcmsCore.ump"
public class Vehicle
{

  //------------------------
  // MEMBER VARIABLES
  //------------------------

  //Vehicle Attributes
  private String vehicleID;
  private Location currentLocation;
  private Time eta;
  private Location intendedLocation;
  private boolean brokenDown;
  private boolean inTrafficCongestion;

  //Vehicle State Machines
  enum LocationStatus { station, enRouteToCrisis, atCrisis, enrouteReturn }
  private LocationStatus locationStatus;

  //Vehicle Associations
  private Route routePlan;

  //------------------------
  // CONSTRUCTOR
  //------------------------

  public Vehicle(String aVehicleID, Location aCurrentLocation, Time aEta, Location aIntendedLocation, boolean aBrokenDown, boolean aInTrafficCongestion)
  {
    vehicleID = aVehicleID;
    currentLocation = aCurrentLocation;
    eta = aEta;
    intendedLocation = aIntendedLocation;
    brokenDown = aBrokenDown;
    inTrafficCongestion = aInTrafficCongestion;
    setLocationStatus(LocationStatus.station);
  }

  //------------------------
  // INTERFACE
  //------------------------

  public boolean setVehicleID(String aVehicleID)
  {
    boolean wasSet = false;
    vehicleID = aVehicleID;
    wasSet = true;
    return wasSet;
  }

  public boolean setCurrentLocation(Location aCurrentLocation)
  {
    boolean wasSet = false;
    currentLocation = aCurrentLocation;
    wasSet = true;
    return wasSet;
  }

  public boolean setEta(Time aEta)
  {
    boolean wasSet = false;
    eta = aEta;
    wasSet = true;
    return wasSet;
  }

  public boolean setIntendedLocation(Location aIntendedLocation)
  {
    boolean wasSet = false;
    intendedLocation = aIntendedLocation;
    wasSet = true;
    return wasSet;
  }

  public boolean setBrokenDown(boolean aBrokenDown)
  {
    boolean wasSet = false;
    brokenDown = aBrokenDown;
    wasSet = true;
    return wasSet;
  }

  public boolean setInTrafficCongestion(boolean aInTrafficCongestion)
  {
    boolean wasSet = false;
    inTrafficCongestion = aInTrafficCongestion;
    wasSet = true;
    return wasSet;
  }

  public String getVehicleID()
  {
    return vehicleID;
  }

  public Location getCurrentLocation()
  {
    return currentLocation;
  }

  public Time getEta()
  {
    return eta;
  }

  public Location getIntendedLocation()
  {
    return intendedLocation;
  }

  public boolean getBrokenDown()
  {
    return brokenDown;
  }

  public boolean getInTrafficCongestion()
  {
    return inTrafficCongestion;
  }

  public boolean isBrokenDown()
  {
    return brokenDown;
  }

  public boolean isInTrafficCongestion()
  {
    return inTrafficCongestion;
  }

  public String getLocationStatusFullName()
  {
    String answer = locationStatus.toString();
    return answer;
  }

  public LocationStatus getLocationStatus()
  {
    return locationStatus;
  }

  public boolean setLocationStatus(LocationStatus aLocationStatus)
  {
    locationStatus = aLocationStatus;
    return true;
  }

  public Route getRoutePlan()
  {
    return routePlan;
  }

  public boolean hasRoutePlan()
  {
    boolean has = routePlan != null;
    return has;
  }

  public boolean setRoutePlan(Route aNewRoutePlan)
  {
    boolean wasSet = false;
    if (aNewRoutePlan == null)
    {
      Route existingRoutePlan = routePlan;
      routePlan = null;

      if (existingRoutePlan != null && existingRoutePlan.getVehicle() != null)
      {
        existingRoutePlan.setVehicle(null);
      }
      wasSet = true;
      return wasSet;
    }

    Route currentRoutePlan = getRoutePlan();
    if (currentRoutePlan != null && !currentRoutePlan.equals(aNewRoutePlan))
    {
      currentRoutePlan.setVehicle(null);
    }

    routePlan = aNewRoutePlan;
    Vehicle existingVehicle = aNewRoutePlan.getVehicle();

    if (!equals(existingVehicle))
    {
      aNewRoutePlan.setVehicle(this);
    }
    wasSet = true;
    return wasSet;
  }

  public void delete()
  {
    if (routePlan != null)
    {
      routePlan.setVehicle(null);
    }
  }

  public String toString()
  {
	  String outputString = "";
    return super.toString() + "["+
            "vehicleID" + ":" + getVehicleID()+ "," +
            "brokenDown" + ":" + getBrokenDown()+ "," +
            "inTrafficCongestion" + ":" + getInTrafficCongestion()+ "]" + System.getProperties().getProperty("line.separator") +
            "  " + "currentLocation" + "=" + (getCurrentLocation() != null ? !getCurrentLocation().equals(this)  ? getCurrentLocation().toString().replaceAll("  ","    ") : "this" : "null") + System.getProperties().getProperty("line.separator") +
            "  " + "eta" + "=" + (getEta() != null ? !getEta().equals(this)  ? getEta().toString().replaceAll("  ","    ") : "this" : "null") + System.getProperties().getProperty("line.separator") +
            "  " + "intendedLocation" + "=" + (getIntendedLocation() != null ? !getIntendedLocation().equals(this)  ? getIntendedLocation().toString().replaceAll("  ","    ") : "this" : "null") + System.getProperties().getProperty("line.separator") +
            "  " + "routePlan = "+(getRoutePlan()!=null?Integer.toHexString(System.identityHashCode(getRoutePlan())):"null")
     + outputString;
  }
}


text:
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Lorem Ipsum Page - Problem 1</title>
	<link rel="stylesheet" type="text/css" href="styles/styles.css">
</head>
<body>
	<p>
		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Architecto quidem sit, temporibus suscipit facilis natus incidunt nemo, tempora distinctio blanditiis, voluptatum rem dolore aliquid, cupiditate quam doloremque totam ipsam qui.
	</p>
</body>
</html>


text:
@interface PodsDummy_stompws : NSObject
@end
@implementation PodsDummy_stompws
@end


text:
require('source-map-support').install();
var asyncplify = require('../dist/asyncplify');
var tests = require('asyncplify-tests');

describe('catch', function () {

    var s1 = asyncplify.throw('error1');
	var s2 = asyncplify.throw('error2');
	var s3 = asyncplify.throw('error3');
	var s4 = asyncplify.value(2);

	s1
        .catch([s2, s3])
        .pipe(tests.itShouldEndSync({ error: 'error3' }));

	s1
        .catch([s2, s3, s4])
        .pipe(tests.itShouldClose())
        .pipe(tests.itShouldEmitValues([2]));

    s1
        .catch(function (err) { return asyncplify.value(2); })
        .pipe(tests.itShouldEmitValues({ values: [2], title: 'should support having a mapper'}));
});


text:
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __LIS302DL_H
#define __LIS302DL_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "../Common/accelero.h"

/** @addtogroup BSP
  * @{
  */

/** @addtogroup Components
  * @{
  */

/** @addtogroup LIS302DL
  * @{
  */

/** @defgroup LIS302DL_Exported_Types
  * @{
  */
/* LIS302DL struct */
typedef struct
{
  uint8_t Power_Mode;                         /* Power-down/Active Mode */
  uint8_t Output_DataRate;                    /* OUT data rate 100 Hz / 400 Hz */
  uint8_t Axes_Enable;                        /* Axes enable */
  uint8_t Full_Scale;                         /* Full scale */
  uint8_t Self_Test;                          /* Self test */
}LIS302DL_InitTypeDef;

/* Interrupt struct */
typedef struct
{
  uint8_t Latch_Request;                      /* Latch interrupt request into CLICK_SRC register*/
  uint8_t SingleClick_Axes;                   /* Single Click Axes Interrupts */
  uint8_t DoubleClick_Axes;                   /* Double Click Axes Interrupts */
}LIS302DL_InterruptConfigTypeDef;

/* High Pass Filter struct */
typedef struct
{
  uint8_t HighPassFilter_Data_Selection;      /* Internal filter bypassed or data from internal filter send to output register*/
  uint8_t HighPassFilter_CutOff_Frequency;    /* High pass filter cut-off frequency */
  uint8_t HighPassFilter_Interrupt;           /* High pass filter enabled for Freefall/WakeUp #1 or #2 */
}LIS302DL_FilterConfigTypeDef;

/**
  * @}
  */

/** @defgroup LIS302DL_Exported_Constants
  * @{
  */

/******************************************************************************/
/*************************** START REGISTER MAPPING  **************************/
/******************************************************************************/

/*******************************************************************************
*  WHO_AM_I Register: Device Identification Register
*  Read only register
*  Default value: 0x3B
*******************************************************************************/
#define LIS302DL_WHO_AM_I_ADDR                  0x0F

/*******************************************************************************
*  CTRL_REG1 Register: Control Register 1
*  Read Write register
*  Default value: 0x07
*  7 DR: Data Rate selection.
*        0 - 100 Hz output data rate
*        1 - 400 Hz output data rate
*  6 PD: Power Down control.
*        0 - power down mode
*        1 - active mode
*  5 FS: Full Scale selection.
*        0 - Typical measurement range 2.3
*        1 - Typical measurement range 9.2
*  4:3 STP-STM Self Test Enable:
*              STP |  STM |   mode
*            ----------------------------
*               0  |  0   |   Normal mode
*               0  |  1   |   Self Test M
*               1  |  0   |   Self Test P
*  2 Zen: Z axis enable.
*         0 - Z axis disabled
*         1- Z axis enabled
*  1 Yen: Y axis enable.
*         0 - Y axis disabled
*         1- Y axis enabled
*  0 Xen: X axis enable.
*         0 - X axis disabled
*         1- X axis enabled
*******************************************************************************/
#define LIS302DL_CTRL_REG1_ADDR                 0x20

/*******************************************************************************
*  CTRL_REG2 Regsiter: Control Register 2
*  Read Write register
*  Default value: 0x00
*  7 SIM: SPI Serial Interface Mode Selection.
*         0 - 4 wire interface
*         1 - 3 wire interface
*  6 BOOT: Reboot memory content
*          0 - normal mode
*          1 - reboot memory content
*  5 Reserved
*  4 FDS: Filtered data selection.
*         0 - internal filter bypassed
*         1 - data from internal filter sent to output register
*  3 HP FF_WU2: High pass filter enabled for FreeFall/WakeUp#2.
*               0 - filter bypassed
*               1 - filter enabled
*  2 HP FF_WU1: High pass filter enabled for FreeFall/WakeUp#1.
*               0 - filter bypassed
*               1 - filter enabled
*  1:0 HP coeff2-HP coeff1 High pass filter cut-off frequency (ft) configuration.
*                 ft= ODR[hz]/6*HP coeff
*            HP coeff2 | HP coeff1 |   HP coeff
*            -------------------------------------------
*                 0     |     0     |   8
*                 0     |     1     |   16
*                 1     |     0     |   32
*                 1     |     1     |   64
*            HP coeff |  ft[hz]   |  ft[hz]   |
*                     |ODR 100Hz | ODR 400Hz  |
*            --------------------------------------------
*              00     |    2      |     8     |
*              01     |    1      |     4     |
*              10     |    0.5    |     2     |
*              11     |    0.25   |     1     |
*******************************************************************************/
#define LIS302DL_CTRL_REG2_ADDR              0x21

/*******************************************************************************
*  CTRL_REG3 Register: Interrupt Control Register
*  Read Write register
*  Default value: 0x00
*  7 IHL active: Interrupt active high/low.
*                0 - active high
*                1 - active low
*  6 PP_OD: push-pull/open-drain.
*           0 - push-pull
*           1 - open-drain
*  5:3 I2_CFG2 - I2_CFG0 Data signal on INT2 pad control bits
*  2:0 I1_CFG2 - I1_CFG0 Data signal on INT1 pad control bits
*        I1(2)_CFG2  |  I1(2)_CFG1  |  I1(2)_CFG0  | INT1(2) Pad
*        ----------------------------------------------------------
*              0     |      0       |       0      | GND
*              0     |      0       |       1      | FreeFall/WakeUp#1
*              0     |      1       |       0      | FreeFall/WakeUp#2
*              0     |      1       |       1      | FreeFall/WakeUp#1 or FreeFall/WakeUp#2
*              1     |      0       |       0      | Data ready
*              1     |      1       |       1      | Click interrupt
*******************************************************************************/
#define LIS302DL_CTRL_REG3_ADDR              0x22

/*******************************************************************************
*  HP_FILTER_RESET Register: Dummy register. Reading at this address zeroes
*  instantaneously the content of the internal high pass filter. If the high pass
*  filter is enabled all three axes are instantaneously set to 0g.
*  This allows to overcome the settling time of the high pass filter.
*  Read only register
*  Default value: Dummy
*******************************************************************************/
#define LIS302DL_HP_FILTER_RESET_REG_ADDR     0x23

/*******************************************************************************
*  STATUS_REG Register: Status Register
*  Default value: 0x00
*  7 ZYXOR: X, Y and Z axis data overrun.
*           0: no overrun has occurred
*           1: new data has overwritten the previous one before it was read
*  6 ZOR: Z axis data overrun.
*         0: no overrun has occurred
*         1: new data for Z-axis has overwritten the previous one before it was read
*  5 yOR: y axis data overrun.
*         0: no overrun has occurred
*         1: new data for y-axis has overwritten the previous one before it was read
*  4 XOR: X axis data overrun.
*         0: no overrun has occurred
*         1: new data for X-axis has overwritten the previous one before it was read
*  3 ZYXDA: X, Y and Z axis new data available
*           0: a new set of data is not yet available
*           1: a new set of data is available
*  2 ZDA: Z axis new data available.
*         0: a new set of data is not yet available
*         1: a new data for Z axis is available
*  1 YDA: Y axis new data available
*         0: a new set of data is not yet available
*         1: a new data for Y axis is available
*  0 XDA: X axis new data available
*         0: a new set of data is not yet available
*         1: a new data for X axis is available
*******************************************************************************/
#define LIS302DL_STATUS_REG_ADDR             0x27

/*******************************************************************************
*  OUT_X Register: X-axis output Data
*  Read only register
*  Default value: output
*  7:0 XD7-XD0: X-axis output Data
*******************************************************************************/
#define LIS302DL_OUT_X_ADDR                  0x29

/*******************************************************************************
*  OUT_Y Register: Y-axis output Data
*  Read only register
*  Default value: output
*  7:0 YD7-YD0: Y-axis output Data
*******************************************************************************/
#define LIS302DL_OUT_Y_ADDR                  0x2B

/*******************************************************************************
*  OUT_Z Register: Z-axis output Data
*  Read only register
*  Default value: output
*  7:0 ZD7-ZD0: Z-axis output Data
*******************************************************************************/
#define LIS302DL_OUT_Z_ADDR                  0x2D

/*******************************************************************************
*  FF_WW_CFG_1 Register: Configuration register for Interrupt 1 source.
*  Read write register
*  Default value: 0x00
*  7 AOI: AND/OR combination of Interrupt events.
*         0: OR combination of interrupt events
*         1: AND combination of interrupt events
*  6 LIR: Latch/not latch interrupt request
*         0: interrupt request not latched
*         1: interrupt request latched
*  5 ZHIE: Enable interrupt generation on Z high event.
*          0: disable interrupt request
*          1: enable interrupt request on measured accel. value higher than preset threshold
*  4 ZLIE: Enable interrupt generation on Z low event.
*          0: disable interrupt request
*          1: enable interrupt request on measured accel. value lower than preset threshold
*  3 YHIE: Enable interrupt generation on Y high event.
*          0: disable interrupt request
*          1: enable interrupt request on measured accel. value higher than preset threshold
*  2 YLIE: Enable interrupt generation on Y low event.
*          0: disable interrupt request
*          1: enable interrupt request on measured accel. value lower than preset threshold
*  1 XHIE: Enable interrupt generation on X high event.
*          0: disable interrupt request
*          1: enable interrupt request on measured accel. value higher than preset threshold
*  0 XLIE: Enable interrupt generation on X low event.
*          0: disable interrupt request
*          1: enable interrupt request on measured accel. value lower than preset threshold
*******************************************************************************/
#define LIS302DL_FF_WU_CFG1_REG_ADDR         0x30

/*******************************************************************************
*  FF_WU_SRC_1 Register: Interrupt 1 source register.
*  Reading at this address clears FF_WU_SRC_1 register and the FF, WU 1 interrupt
*  and allow the refreshment of data in the FF_WU_SRC_1 register if the latched option
*  was chosen.
*  Read only register
*  Default value: 0x00
*  7 Reserved
*  6 IA: Interrupt active.
*        0: no interrupt has been generated
*        1: one or more interrupts have been generated
*  5 ZH: Z high.
*        0: no interrupt
*        1: ZH event has occurred
*  4 ZL: Z low.
*        0: no interrupt
*        1: ZL event has occurred
*  3 YH: Y high.
*        0: no interrupt
*        1: YH event has occurred
*  2 YL: Y low.
*        0: no interrupt
*        1: YL event has occurred
*  1 YH: X high.
*        0: no interrupt
*        1: XH event has occurred
*  0 YL: X low.
*        0: no interrupt
*        1: XL event has occurred
*******************************************************************************/
#define LIS302DL_FF_WU_SRC1_REG_ADDR           0x31

/*******************************************************************************
*  FF_WU_THS_1 Register: Threshold register
*  Read Write register
*  Default value: 0x00
*  7 DCRM: Reset mode selection.
*          0 - counter resetted
*          1 - counter decremented
*  6 THS6-THS0: Free-fall/wake-up threshold value.
*******************************************************************************/
#define LIS302DL_FF_WU_THS1_REG_ADDR          0x32

/*******************************************************************************
*  FF_WU_DURATION_1 Register: duration Register
*  Read Write register
*  Default value: 0x00
*  7:0 D7-D0 Duration value. (Duration steps and maximum values depend on the ODR chosen)
 ******************************************************************************/
#define LIS302DL_FF_WU_DURATION1_REG_ADDR     0x33

/*******************************************************************************
*  FF_WW_CFG_2 Register: Configuration register for Interrupt 2 source.
*  Read write register
*  Default value: 0x00
*  7 AOI: AND/OR combination of Interrupt events.
*         0: OR combination of interrupt events
*         1: AND combination of interrupt events
*  6 LIR: Latch/not latch interrupt request
*         0: interrupt request not latched
*         1: interrupt request latched
*  5 ZHIE: Enable interrupt generation on Z high event.
*          0: disable interrupt request
*          1: enable interrupt request on measured accel. value higher than preset threshold
*  4 ZLIE: Enable interrupt generation on Z low event.
*          0: disable interrupt request
*          1: enable interrupt request on measured accel. value lower than preset threshold
*  3 YHIE: Enable interrupt generation on Y high event.
*          0: disable interrupt request
*          1: enable interrupt request on measured accel. value higher than preset threshold
*  2 YLIE: Enable interrupt generation on Y low event.
*          0: disable interrupt request
*          1: enable interrupt request on measured accel. value lower than preset threshold
*  1 XHIE: Enable interrupt generation on X high event.
*          0: disable interrupt request
*          1: enable interrupt request on measured accel. value higher than preset threshold
*  0 XLIE: Enable interrupt generation on X low event.
*          0: disable interrupt request
*          1: enable interrupt request on measured accel. value lower than preset threshold
*******************************************************************************/
#define LIS302DL_FF_WU_CFG2_REG_ADDR         0x34

/*******************************************************************************
*  FF_WU_SRC_2 Register: Interrupt 2 source register.
*  Reading at this address clears FF_WU_SRC_2 register and the FF, WU 2 interrupt
*  and allow the refreshment of data in the FF_WU_SRC_2 register if the latched option
*  was chosen.
*  Read only register
*  Default value: 0x00
*  7 Reserved
*  6 IA: Interrupt active.
*        0: no interrupt has been generated
*        1: one or more interrupts have been generated
*  5 ZH: Z high.
*        0: no interrupt
*        1: ZH event has occurred
*  4 ZL: Z low.
*        0: no interrupt
*        1: ZL event has occurred
*  3 YH: Y high.
*        0: no interrupt
*        1: YH event has occurred
*  2 YL: Y low.
*        0: no interrupt
*        1: YL event has occurred
*  1 YH: X high.
*        0: no interrupt
*        1: XH event has occurred
*  0 YL: X low.
*        0: no interrupt
*        1: XL event has occurred
*******************************************************************************/
#define LIS302DL_FF_WU_SRC2_REG_ADDR           0x35

/*******************************************************************************
*  FF_WU_THS_2 Register: Threshold register
*  Read Write register
*  Default value: 0x00
*  7 DCRM: Reset mode selection.
*          0 - counter resetted
*          1 - counter decremented
*  6 THS6-THS0: Free-fall/wake-up threshold value.
*******************************************************************************/
#define LIS302DL_FF_WU_THS2_REG_ADDR          0x36

/*******************************************************************************
*  FF_WU_DURATION_2 Register: duration Register
*  Read Write register
*  Default value: 0x00
*  7:0 D7-D0 Duration value. (Duration steps and maximum values depend on the ODR chosen)
 ******************************************************************************/
#define LIS302DL_FF_WU_DURATION2_REG_ADDR     0x37

/******************************************************************************
*  CLICK_CFG Register: click Register
*  Read Write register
*  Default value: 0x00
*  7 Reserved
*  6 LIR: Latch Interrupt request.
*         0: interrupt request not latched
*         1: interrupt request latched
*  5 Double_Z: Enable interrupt generation on double click event on Z axis.
*              0: disable interrupt request
*              1: enable interrupt request
*  4 Single_Z: Enable interrupt generation on single click event on Z axis.
*              0: disable interrupt request
*              1: enable interrupt request
*  3 Double_Y: Enable interrupt generation on double click event on Y axis.
*              0: disable interrupt request
*              1: enable interrupt request
*  2 Single_Y: Enable interrupt generation on single click event on Y axis.
*              0: disable interrupt request
*              1: enable interrupt request
*  1 Double_X: Enable interrupt generation on double click event on X axis.
*              0: disable interrupt request
*              1: enable interrupt request
*  0 Single_y: Enable interrupt generation on single click event on X axis.
*              0: disable interrupt request
*              1: enable interrupt request
 ******************************************************************************/
#define LIS302DL_CLICK_CFG_REG_ADDR     0x38

/******************************************************************************
*  CLICK_SRC Register: click status Register
*  Read only register
*  Default value: 0x00
*  7 Reserved
*  6 IA: Interrupt active.
*        0: no interrupt has been generated
*        1: one or more interrupts have been generated
*  5 Double_Z: Double click on Z axis event.
*        0: no interrupt
*        1: Double Z event has occurred
*  4 Single_Z: Z low.
*        0: no interrupt
*        1: Single Z event has occurred
*  3 Double_Y: Y high.
*        0: no interrupt
*        1: Double Y event has occurred
*  2 Single_Y: Y low.
*        0: no interrupt
*        1: Single Y event has occurred
*  1 Double_X: X high.
*        0: no interrupt
*        1: Double X event has occurred
*  0 Single_X: X low.
*        0: no interrupt
*        1: Single X event has occurred
*******************************************************************************/
#define LIS302DL_CLICK_SRC_REG_ADDR        0x39

/*******************************************************************************
*  CLICK_THSY_X Register: Click threshold Y and X register
*  Read Write register
*  Default value: 0x00
*  7:4 THSy3-THSy0: Click threshold on Y axis, step 0.5g
*  3:0 THSx3-THSx0: Click threshold on X axis, step 0.5g
*******************************************************************************/
#define LIS302DL_CLICK_THSY_X_REG_ADDR        0x3B

/*******************************************************************************
*  CLICK_THSZ Register: Click threshold Z register
*  Read Write register
*  Default value: 0x00
*  7:4 Reserved
*  3:0 THSz3-THSz0: Click threshold on Z axis, step 0.5g
*******************************************************************************/
#define LIS302DL_CLICK_THSZ_REG_ADDR         0x3C

/*******************************************************************************
*  CLICK_TimeLimit Register: Time Limit register
*  Read Write register
*  Default value: 0x00
*  7:0 Dur7-Dur0: Time Limit value, step 0.5g
*******************************************************************************/
#define LIS302DL_CLICK_TIMELIMIT_REG_ADDR        0x3D

/*******************************************************************************
*  CLICK_Latency Register: Latency register
*  Read Write register
*  Default value: 0x00
*  7:0 Lat7-Lat0: Latency value, step 1msec
*******************************************************************************/
#define LIS302DL_CLICK_LATENCY_REG_ADDR        0x3E

/*******************************************************************************
*  CLICK_Window Register: Window register
*  Read Write register
*  Default value: 0x00
*  7:0 Win7-Win0: Window value, step 1msec
*******************************************************************************/
#define LIS302DL_CLICK_WINDOW_REG_ADDR        0x3F

/******************************************************************************/
/**************************** END REGISTER MAPPING  ***************************/
/******************************************************************************/
#define I_AM_LIS302DL                                     0x3B

#define LIS302DL_SENSITIVITY_2_3G                         18  /* 18 mg/digit*/
#define LIS302DL_SENSITIVITY_9_2G                         72  /* 72 mg/digit*/

/** @defgroup Data_Rate_selection
  * @{
  */
#define LIS302DL_DATARATE_100                             ((uint8_t)0x00)
#define LIS302DL_DATARATE_400                             ((uint8_t)0x80)
/**
  * @}
  */

/** @defgroup Power_Mode_selection
  * @{
  */
#define LIS302DL_LOWPOWERMODE_POWERDOWN                   ((uint8_t)0x00)
#define LIS302DL_LOWPOWERMODE_ACTIVE                      ((uint8_t)0x40)
/**
  * @}
  */

/** @defgroup Full_Scale_selection
  * @{
  */
#define LIS302DL_FULLSCALE_2_3                            ((uint8_t)0x00)
#define LIS302DL_FULLSCALE_9_2                            ((uint8_t)0x20)
/**
  * @}
  */

/** @defgroup Self_Test_selection
  * @{
  */
#define LIS302DL_SELFTEST_NORMAL                          ((uint8_t)0x00)
#define LIS302DL_SELFTEST_P                               ((uint8_t)0x10)
#define LIS302DL_SELFTEST_M                               ((uint8_t)0x08)
/**
  * @}
  */

/** @defgroup Direction_XYZ_selection
  * @{
  */
#define LIS302DL_X_ENABLE                                 ((uint8_t)0x01)
#define LIS302DL_Y_ENABLE                                 ((uint8_t)0x02)
#define LIS302DL_Z_ENABLE                                 ((uint8_t)0x04)
#define LIS302DL_XYZ_ENABLE                               ((uint8_t)0x07)
/**
  * @}
  */

 /** @defgroup SPI_Serial_Interface_Mode_selection
  * @{
  */
#define LIS302DL_SERIALINTERFACE_4WIRE                    ((uint8_t)0x00)
#define LIS302DL_SERIALINTERFACE_3WIRE                    ((uint8_t)0x80)
/**
  * @}
  */

 /** @defgroup Boot_Mode_selection
  * @{
  */
#define LIS302DL_BOOT_NORMALMODE                          ((uint8_t)0x00)
#define LIS302DL_BOOT_REBOOTMEMORY                        ((uint8_t)0x40)
/**
  * @}
  */

 /** @defgroup Filtered_Data_Selection_Mode_selection
  * @{
  */
#define LIS302DL_FILTEREDDATASELECTION_BYPASSED           ((uint8_t)0x00)
#define LIS302DL_FILTEREDDATASELECTION_OUTPUTREGISTER     ((uint8_t)0x20)
/**
  * @}
  */

 /** @defgroup High_Pass_Filter_Interrupt_selection
  * @{
  */
#define LIS302DL_HIGHPASSFILTERINTERRUPT_OFF              ((uint8_t)0x00)
#define LIS302DL_HIGHPASSFILTERINTERRUPT_1                ((uint8_t)0x04)
#define LIS302DL_HIGHPASSFILTERINTERRUPT_2                ((uint8_t)0x08)
#define LIS302DL_HIGHPASSFILTERINTERRUPT_1_2              ((uint8_t)0x0C)
/**
  * @}
  */

 /** @defgroup High_Pass_Filter_selection
  * @{
  */
#define LIS302DL_HIGHPASSFILTER_LEVEL_0                   ((uint8_t)0x00)
#define LIS302DL_HIGHPASSFILTER_LEVEL_1                   ((uint8_t)0x01)
#define LIS302DL_HIGHPASSFILTER_LEVEL_2                   ((uint8_t)0x02)
#define LIS302DL_HIGHPASSFILTER_LEVEL_3                   ((uint8_t)0x03)
/**
  * @}
  */

/** @defgroup latch_Interrupt_Request_selection
  * @{
  */
#define LIS302DL_INTERRUPTREQUEST_NOTLATCHED              ((uint8_t)0x00)
#define LIS302DL_INTERRUPTREQUEST_LATCHED                 ((uint8_t)0x40)
/**
  * @}
  */

/** @defgroup Click_Interrupt_XYZ_selection
  * @{
  */
#define LIS302DL_CLICKINTERRUPT_XYZ_DISABLE               ((uint8_t)0x00)
#define LIS302DL_CLICKINTERRUPT_X_ENABLE                  ((uint8_t)0x01)
#define LIS302DL_CLICKINTERRUPT_Y_ENABLE                  ((uint8_t)0x04)
#define LIS302DL_CLICKINTERRUPT_Z_ENABLE                  ((uint8_t)0x10)
#define LIS302DL_CLICKINTERRUPT_XYZ_ENABLE                ((uint8_t)0x15)
/**
  * @}
  */

/** @defgroup Double_Click_Interrupt_XYZ_selection
  * @{
  */
#define LIS302DL_DOUBLECLICKINTERRUPT_XYZ_DISABLE         ((uint8_t)0x00)
#define LIS302DL_DOUBLECLICKINTERRUPT_X_ENABLE            ((uint8_t)0x02)
#define LIS302DL_DOUBLECLICKINTERRUPT_Y_ENABLE            ((uint8_t)0x08)
#define LIS302DL_DOUBLECLICKINTERRUPT_Z_ENABLE            ((uint8_t)0x20)
#define LIS302DL_DOUBLECLICKINTERRUPT_XYZ_ENABLE          ((uint8_t)0x2A)
/**
  * @}
  */

/**
  * @}
  */

/** @defgroup LIS302DL_Exported_Functions
  * @{
  */
void    LIS302DL_Init(uint16_t InitStruct);
uint8_t LIS302DL_ReadID(void);
void    LIS302DL_FilterConfig(uint8_t FilterStruct);
void    LIS302DL_InterruptConfig(LIS302DL_InterruptConfigTypeDef *LIS302DL_IntConfigStruct);
void    LIS302DL_Click_IntConfig(void);
void    LIS302DL_Click_IntClear(void);
void    LIS302DL_LowpowerCmd(uint8_t LowPowerMode);
void    LIS302DL_FullScaleCmd(uint8_t FS_value);
void    LIS302DL_DataRateCmd(uint8_t DataRateValue);
void    LIS302DL_RebootCmd(void);
void    LIS302DL_ReadACC(int16_t *pData);

/* Accelerometer driver structure */
extern ACCELERO_DrvTypeDef Lis302dlDrv;

/* Accelerometer IO functions */
void    ACCELERO_IO_Init(void);
void    ACCELERO_IO_ITConfig(void);
void    ACCELERO_IO_Write(uint8_t* pBuffer, uint8_t WriteAddr, uint16_t NumByteToWrite);
void    ACCELERO_IO_Read(uint8_t* pBuffer, uint8_t ReadAddr, uint16_t NumByteToRead);

#ifdef __cplusplus
}
#endif

#endif /* __LIS302DL_H */

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/


text:
"use strict";
/**
 * @fileoverview SIP URI
 */

/**
 * @augments SIP
 * @class Class creating a SIP URI.
 *
 * @param {String} [scheme]
 * @param {String} [user]
 * @param {String} host
 * @param {String} [port]
 * @param {Object} [parameters]
 * @param {Object} [headers]
 *
 */
module.exports = function (SIP) {
var URI;

URI = function(scheme, user, host, port, parameters, headers) {
  var param, header;

  // Checks
  if(!host) {
    throw new TypeError('missing or invalid "host" parameter');
  }

  // Initialize parameters
  scheme = scheme || SIP.C.SIP;
  this.parameters = {};
  this.headers = {};

  for (param in parameters) {
    this.setParam(param, parameters[param]);
  }

  for (header in headers) {
    this.setHeader(header, headers[header]);
  }

  Object.defineProperties(this, {
    scheme: {
      get: function(){ return scheme; },
      set: function(value){
        scheme = value.toLowerCase();
      }
    },

    user: {
      get: function(){ return user; },
      set: function(value){
        user = value;
      }
    },

    host: {
      get: function(){ return host; },
      set: function(value){
        host = value.toLowerCase();
      }
    },

    aor: {
      get: function(){ return user + '@' + host; }
    },

    port: {
      get: function(){ return port; },
      set: function(value){
        port = value === 0 ? value : (parseInt(value,10) || null);
      }
    }
  });
};
URI.prototype = {
  setParam: function(key, value) {
    if(key) {
      this.parameters[key.toLowerCase()] = (typeof value === 'undefined' || value === null) ? null : value.toString().toLowerCase();
    }
  },

  getParam: function(key) {
    if(key) {
      return this.parameters[key.toLowerCase()];
    }
  },

  hasParam: function(key) {
    if(key) {
      return (this.parameters.hasOwnProperty(key.toLowerCase()) && true) || false;
    }
  },

  deleteParam: function(parameter) {
    var value;
    parameter = parameter.toLowerCase();
    if (this.parameters.hasOwnProperty(parameter)) {
      value = this.parameters[parameter];
      delete this.parameters[parameter];
      return value;
    }
  },

  clearParams: function() {
    this.parameters = {};
  },

  setHeader: function(name, value) {
    this.headers[SIP.Utils.headerize(name)] = (value instanceof Array) ? value : [value];
  },

  getHeader: function(name) {
    if(name) {
      return this.headers[SIP.Utils.headerize(name)];
    }
  },

  hasHeader: function(name) {
    if(name) {
      return (this.headers.hasOwnProperty(SIP.Utils.headerize(name)) && true) || false;
    }
  },

  deleteHeader: function(header) {
    var value;
    header = SIP.Utils.headerize(header);
    if(this.headers.hasOwnProperty(header)) {
      value = this.headers[header];
      delete this.headers[header];
      return value;
    }
  },

  clearHeaders: function() {
    this.headers = {};
  },

  clone: function() {
    return new URI(
      this.scheme,
      this.user,
      this.host,
      this.port,
      JSON.parse(JSON.stringify(this.parameters)),
      JSON.parse(JSON.stringify(this.headers)));
  },

  toString: function(){
    var header, parameter, idx, uri,
      headers = [];

    uri  = this.scheme + ':';
    // add slashes if it's not a sip(s) URI
    if (!this.scheme.match("^sips?$")) {
      uri += "//";
    }
    if (this.user) {
      uri += SIP.Utils.escapeUser(this.user) + '@';
    }
    uri += this.host;
    if (this.port || this.port === 0) {
      uri += ':' + this.port;
    }

    for (parameter in this.parameters) {
      uri += ';' + parameter;

      if (this.parameters[parameter] !== null) {
        uri += '='+ this.parameters[parameter];
      }
    }

    for(header in this.headers) {
      for(idx in this.headers[header]) {
        headers.push(header + '=' + this.headers[header][idx]);
      }
    }

    if (headers.length > 0) {
      uri += '?' + headers.join('&');
    }

    return uri;
  }
};

/**
  * Parse the given string and returns a SIP.URI instance or undefined if
  * it is an invalid URI.
  * @public
  * @param {String} uri
  */
URI.parse = function(uri) {
  uri = SIP.Grammar.parse(uri,'SIP_URI');

  if (uri !== -1) {
    return uri;
  } else {
    return undefined;
  }
};

SIP.URI = URI;
};


text:
"""ActorInterval module: contains the ActorInterval class"""

__all__ = ['ActorInterval', 'LerpAnimInterval']

from panda3d.core import *
from panda3d.direct import *
from direct.directnotify.DirectNotifyGlobal import *
import Interval
import math

class ActorInterval(Interval.Interval):

    # create ActorInterval DirectNotify category
    notify = directNotify.newCategory('ActorInterval')

    # Name counter
    animNum = 1
    # Class methods

    # Plays an animation on an Actor.  The subrange of the animation
    # to be played may be specified via frames (startFrame up to and
    # including endFrame) or seconds (startTime up to and including
    # endTime).  If neither is specified, the default is the entire
    # range of the animation.

    # The duration may be implicit or explicit.  If it is omitted, it
    # is taken to be endTime - startTime.  There's not much point in
    # specifying otherwise unless you also specify loop=1, which will
    # loop the animation over its frame range during the duration of
    # the interval.

    # Note: if loop == 0 and duration > anim duration then the
    # animation will play once and then hold its final pose for the
    # remainder of the interval.

    # loop = 1 implies a loop within the entire range of animation,
    # while constrainedLoop = 1 implies a loop within startFrame and
    # endFrame only.

    def __init__(self, actor, animName, loop=0, constrainedLoop=0,
                 duration=None, startTime=None, endTime=None,
                 startFrame=None, endFrame=None,
                 playRate=1.0, name=None, forceUpdate=0,
                 partName=None, lodName=None):
        # Generate unique id
        id = 'Actor-%s-%d' % (animName, ActorInterval.animNum)
        ActorInterval.animNum += 1
        # Record class specific variables
        self.actor = actor
        self.animName = animName
        self.controls = self.actor.getAnimControls(
            self.animName, partName = partName, lodName = lodName)
        self.loopAnim = loop
        self.constrainedLoop = constrainedLoop
        self.forceUpdate = forceUpdate
        self.playRate = playRate

        # If no name specified, use id as name
        if (name == None):
            name = id

        if len(self.controls) == 0:
            self.notify.warning("Unknown animation for actor: %s" % (self.animName))
            self.frameRate = 1.0
            self.startFrame = 0
            self.endFrame = 0
        else:

            self.frameRate = self.controls[0].getFrameRate() * abs(playRate)
            # Compute start and end frames.
            if startFrame != None:
                self.startFrame = startFrame
            elif startTime != None:
                self.startFrame = startTime * self.frameRate
            else:
                self.startFrame = 0

            if endFrame != None:
                self.endFrame = endFrame
            elif endTime != None:
                self.endFrame = endTime * self.frameRate
            elif duration != None:
                if startTime == None:
                    startTime = float(self.startFrame) / float(self.frameRate)
                endTime = startTime + duration
                self.endFrame = duration * self.frameRate
            else:
                # No end frame specified.  Choose the maximum of all
                # of the controls' numbers of frames.
                maxFrames = self.controls[0].getNumFrames()
                warned = 0
                for i in range(1, len(self.controls)):
                    numFrames = self.controls[i].getNumFrames()
                    if numFrames != maxFrames and numFrames != 1 and not warned:
                        self.notify.warning("Animations '%s' on %s have an inconsistent number of frames." % (animName, actor.getName()))
                        warned = 1
                    maxFrames = max(maxFrames, numFrames)
                self.endFrame = maxFrames - 1

        # Must we play the animation backwards?  We play backwards if
        # either (or both) of the following is true: the playRate is
        # negative, or endFrame is before startFrame.
        self.reverse = (playRate < 0)
        if self.endFrame < self.startFrame:
            self.reverse = 1
            t = self.endFrame
            self.endFrame = self.startFrame
            self.startFrame = t

        self.numFrames = self.endFrame - self.startFrame + 1

        # Compute duration if no duration specified
        self.implicitDuration = 0
        if duration == None:
            self.implicitDuration = 1
            duration = float(self.numFrames) / self.frameRate

        # Initialize superclass
        Interval.Interval.__init__(self, name, duration)

    def getCurrentFrame(self):
        """Calculate the current frame playing in this interval.

        returns a float value between startFrame and endFrame, inclusive
        returns None if there are any problems
        """
        retval = None
        if not self.isStopped():
            framesPlayed = self.numFrames * self.currT
            retval = self.startFrame + framesPlayed
        return retval

    def privStep(self, t):
        frameCount = t * self.frameRate
        if self.constrainedLoop:
            frameCount = frameCount % self.numFrames

        if self.reverse:
            absFrame = self.endFrame - frameCount
        else:
            absFrame = self.startFrame + frameCount

        # Calc integer frame number
        intFrame = int(math.floor(absFrame + 0.0001))

        # Pose anim

        # We use our pre-computed list of animControls for
        # efficiency's sake, rather than going through the relatively
        # expensive Actor interface every frame.
        for control in self.controls:
            # Each animControl might have a different number of frames.
            numFrames = control.getNumFrames()
            if self.loopAnim:
                frame = (intFrame % numFrames) + (absFrame - intFrame)
            else:
                frame = max(min(absFrame, numFrames - 1), 0)

            control.pose(frame)

        if self.forceUpdate:
            self.actor.update()
        self.state = CInterval.SStarted
        self.currT = t

    def privFinalize(self):
        if self.implicitDuration and not self.loopAnim:
            # As a special case, we ensure we end up posed to the last
            # frame of the animation if the original duration was
            # implicit.  This is necessary only to guard against
            # possible roundoff error in computing the final frame
            # from the duration.  We don't do this in the case of a
            # looping animation, however, because this would introduce
            # a hitch in the animation when it plays back-to-back with
            # the next cycle.
            if self.reverse:
                for control in self.controls:
                    control.pose(self.startFrame)
            else:
                for control in self.controls:
                    control.pose(self.endFrame)
            if self.forceUpdate:
                self.actor.update()

        else:
            # Otherwise, the user-specified duration determines which
            # is our final frame.
            self.privStep(self.getDuration())

        self.state = CInterval.SFinal
        self.intervalDone()

    # If we want to change what part this interval is playing on after
    # the interval has been created, call resetControls and pass in a partName
    # and optional lod param
    def resetControls(self, partName, lodName=None):
        self.controls = self.actor.getAnimControls(
            self.animName, partName = partName, lodName = lodName)

class LerpAnimInterval(CLerpAnimEffectInterval):
    # Blends between two anims.  Start both anims first (or use
    # parallel ActorIntervals), then invoke LerpAnimInterval to
    # smoothly blend the control effect from the first to the second.
    lerpAnimNum = 1

    def __init__(self, actor, duration, startAnim, endAnim,
                 startWeight = 0.0, endWeight = 1.0,
                 blendType = 'noBlend', name = None,
                 partName=None, lodName=None):
        # Generate unique name if necessary
        if (name == None):
            name = 'LerpAnimInterval-%d' % LerpAnimInterval.lerpAnimNum
            LerpAnimInterval.lerpAnimNum += 1

        blendType = self.stringBlendType(blendType)
        assert blendType != self.BTInvalid

        # Initialize superclass
        CLerpAnimEffectInterval.__init__(self, name, duration, blendType)

        if startAnim != None:
            controls = actor.getAnimControls(
                startAnim, partName = partName, lodName = lodName)
            #controls = actor.getAnimControls(startAnim)
            for control in controls:
                self.addControl(control, startAnim,
                                1.0 - startWeight, 1.0 - endWeight)

        if endAnim != None:
            controls = actor.getAnimControls(
                endAnim, partName = partName, lodName = lodName)
            #controls = actor.getAnimControls(endAnim)
            for control in controls:
                self.addControl(control, endAnim,
                                startWeight, endWeight)


text:
 yammer group office 365 url

**Namespace:** [OfficeDevPnP.Core.Entities](OfficeDevPnP.Core.Entities.md)
**Assembly:** OfficeDevPnP.Core.dll
## Syntax
```C#
public object office365_url { get; set; }
```

### Property Value
Type: System.Object

## See also
- [YammerGroup](OfficeDevPnP.Core.Entities.YammerGroup.md)
- [OfficeDevPnP.Core.Entities](OfficeDevPnP.Core.Entities.md)


text:
package com.github.mvv.smogon.tests

import org.specs._
import com.mongodb._
import com.github.mvv.layson.bson._
import com.github.mvv.smogon._

class MyEmbedded {
  var innerField = 0.0
}

class MyDoc {
  var docField = 0
}

class MyEntity {
  var id = BsonId.Zero
  var field = 0.shortValue
  var opt: String = null
  var embedded = new MyEmbedded
  var elems: Seq[Int] = Vector.empty
  var docs: Seq[MyDoc] = Vector.empty
  var dyn: Map[String, Int] = Map.empty
}

class MyCollection extends Collection {
  type DocRepr = MyEntity
  protected def newDocRepr = new MyEntity

  object id extends IdFieldM[BsonId](_.id, _.id = _)
  object field extends IntFieldM[Short](_.field, _.field = _)
  object opt extends OptStringFieldM[String](_.opt, _.opt = _)
  object embedded extends EmbeddingFieldM[MyEmbedded](_.embedded,
                                                      _.embedded = _) {
    protected def newDocRepr = new MyEmbedded
    object innerField extends DoubleFieldM[Double](_.innerField,
                                                   _.innerField = _)
    innerField
  }
  object elems extends IntArrayFieldM[Int, Seq](_.elems, _.elems = _)
                  with SeqArrayField[Vector] {
    protected val seqFactory = Vector
  }
  object docs extends DocumentsArrayFieldM[MyDoc, Seq](_.docs, _.docs = _)
                 with SeqArrayField[Vector] {
    protected def newDocRepr = new MyDoc
    protected val seqFactory = Vector
    object docField extends IntFieldM[Int](_.docField, _.docField = _)
    docField
  }
  object dyn extends DynamicFieldM[String, Int, Map](_.dyn, _.dyn = _)
                with MapDynamicField[Map] {
    def stringToName(str: String) = Some(str)
    protected val mapFactory = Map
    object field extends IntField[Int]
    field
  }
  id | field | opt | embedded | elems | docs | dyn
}

object MyCollection extends MyCollection

class MyCollectionD extends DefaultReprCollection {
  object id extends IdFieldD[BsonId]
  object field extends IntFieldD[Short]
  object opt extends OptStringFieldD[String]
  object embedded extends EmbeddingFieldDD {
    object innerField extends DoubleFieldD[Double]
    innerField
  }
  object elems extends IntArrayFieldD[Int, Seq]
                  with SeqArrayField[Vector] {
    protected val seqFactory = Vector
  }
  object docs extends DocumentsArrayFieldDD[Seq] with SeqArrayField[Vector] {
    protected val seqFactory = Vector
    object docField extends IntFieldD[Int]
    docField
  }
  object dyn extends DynamicFieldDD[String] {
    def stringToName(str: String) = Some(str)
    object field extends IntField[Int]
    field
  }
  id | field | opt | embedded | elems | docs | dyn
}

object MyCollectionD extends MyCollectionD

object SimpleTest {
  var mongo: Mongo = null
  var db: DB = null
}

class SimpleTest extends SpecificationWithJUnit {
  import SimpleTest._

  doBeforeSpec {
    mongo = new Mongo
    db = mongo.getDB("smogon_tests")
  }

  doAfterSpec {
    db.dropDatabase()
  }

  "Custom document representation" should {
    shareVariables()
    setSequential()
    val dbc = db.getCollection("mycoll")
    var id = BsonId.Zero

    "Identity properties must have name '_id'" in {
      MyCollection.id.fieldName must_== "_id"
    }

    "Number of fields must be correct" in {
      MyCollection.fields.size must_== 7
    }

    "Setting default safety level must actually set it" in {
      MyCollection.defaultSafetyOf(dbc, Safety.Safe)
      MyCollection.defaultSafetyOf(dbc).isInstanceOf[Safety.Safe] must_== true
    }

    "Creating an index must succeed" in {
      MyCollection.ensureIndexIn(dbc, m => m.field & m.opt.desc)
      true must_== true
    }

    "Saving must set _id" in {
      val my = new MyEntity
      val myDoc = new MyDoc
      myDoc.docField = 10
      my.docs +:= myDoc
      MyCollection.saveInto(dbc, my)
      id = my.id
      id must_!= BsonId.Zero
    }

    "Querying must succeed" in {
      val q = MyCollection(m => m.field > -10 || m.opt === "hello")
      q.findOneIn(dbc).isDefined must_== true
    }

    "Updating a document must succeed" in {
      MyCollection(_.id === id).
        updateIn(dbc, m => m.field =# 100 && m.opt =# "hello" &&
                           m.elems =# Seq(10, 20, 30)) must_== 1
      MyCollection(m => m.field === 100 && m.opt === "hello" &&
                         m.elems.size(3)).
        findOneIn(dbc).isDefined must_== true
    }

    "Replacing a document should succeed" in {
      val myOpt = MyCollection(_.id === id).findOneIn(dbc)
      myOpt.isDefined must_== true
      val my = myOpt.get
      my.field = 255
      MyCollection(_.id === id).replaceIn(dbc, my) must_== true
      val upOpt = MyCollection(m => m.id === id && m.field === 255).
                    findOneIn(dbc)
      upOpt.isDefined must_== true
    }

    "Quering an embedded primitives array field must succeed" in {
      MyCollection(_.elems.contains(_.in(5, 20))).
        findOneIn(dbc).isDefined must_== true
      MyCollection(_.elems.containsAll(10, 20)).
        findOneIn(dbc).isDefined must_== true
      MyCollection(_.elems.containsAll(20, 30)).
        findOneIn(dbc).isDefined must_== true
      MyCollection(_.elems.containsAll(40, 30)).
        findOneIn(dbc).isDefined must_== false
    }

    "Quering an embedded documents array field must succeed" in {
      MyCollection(_.docs.contains(_.docField === 10)).
        findOneIn(dbc).isDefined must_== true
      MyCollection(_.docs.contains(_.docField === 11)).
        findOneIn(dbc).isDefined must_== false
    }

    "UpdateOne must return true with upsert" in {
      MyCollection(_.field === 1).
        updateOneIn(dbc, _.field =# 1, upsert = true) must_== true
      MyCollection(_.field === 1).findOneIn(dbc).isDefined must_== true
    }

    "FindAndUpdate(upsert, returnUpdated) must return created document" in {
      val myOpt = MyCollection(m => m.field === 2).findAndUpdateIn(dbc, { m =>
        m.field =# 2 &&
        (m.embedded.innerField += 2.0)
      }, upsert = true, returnUpdated = true)
      myOpt.isDefined must_== true
      val my = myOpt.get
      my.field must_== 2
      my.embedded.innerField must_== 2.0
    }

    ("FindAndUpdate(upsert, !returnUpdated) " +
     "on nonexistent document must return None") in {
      val id = Collection.genId()
      MyCollection(_.id === id).findAndUpdateIn(dbc, { m =>
        m.field =# 3 &&
        (m.embedded.innerField += 2.0)
      }, upsert = true).isEmpty must_== true
      MyCollection(m => m.id === id && m.field === 3).
        findOneIn(dbc).isDefined must_== true
    }

    "Setting dynamic field must work" in {
      val updated = MyCollection(_.field === 2).updateOneIn(dbc, { m =>
        m.dyn("test") =# 10
      })
      updated must_== true
      val my = MyCollection(_.field === 2).findOneIn(dbc).get
      my.dyn.get("test") must_== Some(10)
    }
  }

  "Default document representation" should {
    shareVariables()
    setSequential()
    val dbc = db.getCollection("mycolld")
    var id = BsonId.Zero

    "Identity properties must have name '_id'" in {
      MyCollectionD.id.fieldName must_== "_id"
    }

    "Number of fields must be correct" in {
      MyCollectionD.fields.size must_== 7
    }

    "Setting default safety level must actually set it" in {
      MyCollectionD.defaultSafetyOf(dbc, Safety.Safe)
      MyCollectionD.defaultSafetyOf(dbc).isInstanceOf[Safety.Safe] must_== true
    }

    "Creating an index must succeed" in {
      MyCollectionD.ensureIndexIn(dbc, m => m.field & m.opt.desc)
      true must_== true
    }

    "Saving must set _id" in {
      val my = MyCollectionD.create
      val myDoc = MyCollectionD.docs.create
      MyCollectionD.docs.docField.set(myDoc, 10)
      MyCollectionD.docs.set(my, Vector(myDoc))
      MyCollectionD.saveInto(dbc, my)
      id = MyCollectionD.id.get(my)
      id must_!= BsonId.Zero
    }

    "Querying must succeed" in {
      val q = MyCollectionD(m => m.field > -10 || m.opt === "hello")
      q.findOneIn(dbc).isDefined must_== true
    }

    "Updating a document must succeed" in {
      MyCollectionD(_.id === id).
        updateIn(dbc, m => m.field =# 100 && m.opt =# "hello" &&
                            m.elems =# Seq(10, 20, 30)) must_== 1
      MyCollectionD(m => m.field === 100 && m.opt === "hello" && m.elems.size(3)).
        findOneIn(dbc).isDefined must_== true
    }

    "Replacing a document should succeed" in {
      val myOpt = MyCollectionD(_.id === id).findOneIn(dbc)
      myOpt.isDefined must_== true
      val my = myOpt.get
      MyCollectionD.field.set(my, 255)
      MyCollectionD(_.id === id).replaceIn(dbc, my) must_== true
      val upOpt = MyCollectionD(m => m.id === id && m.field === 255).
                    findOneIn(dbc)
      upOpt.isDefined must_== true
    }

    "Quering an embedded primitives array field must succeed" in {
      MyCollectionD(m => m.elems.contains(_.in(5, 20))).
        findOneIn(dbc).isDefined must_== true
      MyCollectionD(m => m.elems.containsAll(10, 20)).
        findOneIn(dbc).isDefined must_== true
      MyCollectionD(m => m.elems.containsAll(20, 30)).
        findOneIn(dbc).isDefined must_== true
      MyCollectionD(m => m.elems.containsAll(40, 30)).
        findOneIn(dbc).isDefined must_== false
    }

    "Quering an embedded documents array field must succeed" in {
      MyCollectionD(m => m.docs.contains(_.docField === 10)).
        findOneIn(dbc).isDefined must_== true
      MyCollectionD(m => m.docs.contains(_.docField === 11)).
        findOneIn(dbc).isDefined must_== false
    }

    "UpdateOne must return true with upsert" in {
      MyCollectionD(_.field === 1).
        updateOneIn(dbc, _.field =# 1, upsert = true) must_== true
      MyCollectionD(_.field === 1).findOneIn(dbc).isDefined must_== true
    }

    "FindAndUpdate(upsert, returnUpdated) must return created document" in {
      val myOpt = MyCollectionD(m => m.field === 2).findAndUpdateIn(dbc, { m =>
        m.field =# 2 &&
        (m.embedded.innerField += 2.0)
      }, upsert = true, returnUpdated = true)
      myOpt.isDefined must_== true
      val my = myOpt.get
      MyCollectionD.field.get(my) must_== 2
      MyCollectionD.embedded.innerField.
        get(MyCollectionD.embedded.get(my)) must_== 2.0
    }

    ("FindAndUpdate(upsert, !returnUpdated) " +
     "on nonexistent document must return None") in {
      val id = Collection.genId()
      MyCollectionD(_.id === id).findAndUpdateIn(dbc, { m =>
        m.field =# 3 &&
        (m.embedded.innerField += 2.0)
      }, upsert = true).isEmpty must_== true
      MyCollectionD(m => m.id === id && m.field === 3).
        findOneIn(dbc).isDefined must_== true
    }

    "Setting dynamic field must work" in {
      val updated = MyCollectionD(_.field === 2).updateOneIn(dbc, { m =>
        m.dyn("test") =# 10
      })
      updated must_== true
      val my = MyCollectionD(_.field === 2).findOneIn(dbc).get
      MyCollectionD.dyn.get(MyCollectionD.dyn.get(my), "test") must_== Some(10)
    }
  }
}


text:
@interface UIImage (extension)

+ (UIImage *)imageNamed:(NSString *)name;
@end


text:
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs        */
/*                                                                            */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
/* not use this file except in compliance with the License. You may obtain    */
/* a copy of the License at                                                   */
/*                                                                            */
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
/*                                                                            */
/* Unless required by applicable law or agreed to in writing, software        */
/* distributed under the License is distributed on an "AS IS" BASIS,          */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
/* See the License for the specific language governing permissions and        */
/* limitations under the License.                                             */
/* -------------------------------------------------------------------------- */

#ifndef VIRTUAL_NETWORK_H_
#define VIRTUAL_NETWORK_H_

#include "PoolSQL.h"
#include "Leases.h"
#include "VirtualNetworkTemplate.h"
#include "Clusterable.h"

#include <vector>
#include <string>
#include <map>

#include <time.h>
#include <sstream>

using namespace std;

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

/**
 *  The Virtual Network class. It represents a Virtual Network at manages its
 *  leases. One lease is formed by one IP and one MAC address.
 *  MAC address are derived from IP addresses.
 */
class VirtualNetwork : public PoolObjectSQL, public Clusterable
{
public:

    /**
     * Possible types of networks
     */

    enum NetworkType
    {
        UNINITIALIZED   = -1,
        RANGED          =  0,
        FIXED           =  1
    };

    // *************************************************************************
    // Virtual Network Public Methods
    // *************************************************************************

    /**
     *  Factory method for virtual network templates
     */
    Template * get_new_template() const
    {
        return new VirtualNetworkTemplate;
    }

    /**
     * Adds Leases to the virtual network (Only implemented for FIXED networks)
     *  @param leases template in the form LEASES = [IP=XX, MAC=XX].
     *         MAC is optional. The template can only contain one LEASE
     *         definition.
     *  @param error_msg If the action fails, this message contains the reason.
     *  @return 0 on success
     */
    int add_leases(VirtualNetworkTemplate * leases, string& error_msg);

    /**
     * Removes Leases from the virtual network; if they are not used.(Only
     * implemented for FIXED networks)
     *  @param leases template in the form LEASES = [IP=XX].
     *         The template can only contain one LEASE definition.
     *  @param error_msg If the action fails, this message contains
     *         the reason.
     *  @return 0 on success
     */
    int remove_leases(VirtualNetworkTemplate* leases, string& error_msg);

    /**
     * Holds a Lease, marking it as used
     *  @param leases template in the form LEASES = [IP=XX].
     *          The template can only contain one LEASE definition.
     *  @param error_msg If the action fails, this message contains the reason.
     *  @return 0 on success
     */
    int hold_leases(VirtualNetworkTemplate * leases, string& error_msg);

    /**
     * Releases a Lease on hold
     *  @param leases template in the form LEASES = [IP=XX].
     *          The template can only contain one LEASE definition.
     *  @param error_msg If the action fails, this message contains
     *         the reason.
     *  @return 0 on success
     */
    int free_leases(VirtualNetworkTemplate* leases, string& error_msg);

    /**
     *    Gets a new lease for a specific VM
     *    @param vid VM identifier
     *    @param _ip pointer to string for IP to be stored into
     *    @param _mac pointer to string for MAC to be stored into
     *    @param _bridge name of the physical bridge this VN binds to
     *    @return 0 if success
     */
    int get_lease(int vid, string& _ip, string& _mac, string& _bridge)
    {
        unsigned int eui64[2];

        _bridge = bridge;
        return leases->get(vid, _ip, _mac, eui64);
    };

    /**
     *    Asks for an specific lease of the given virtual network
     *    @param vid VM identifier
     *    @param _ip the ip of the requested lease
     *    @param _mac pointer to string for MAC to be stored into
     *    @param _bridge name of the physical bridge this VN binds to
     *    @return 0 if success
     */
    int set_lease(int vid, const string& _ip, string& _mac, string& _bridge)
    {
        unsigned int eui64[2];

        _bridge = bridge;
        return leases->set(vid, _ip, _mac, eui64);
    };

    /**
     *  Release previously given lease
     *    @param _ip IP identifying the lease
     *    @return 0 if success
     */
    void release_lease(const string& ip)
    {
        return leases->release(ip);
    };

    /**
     *  Check if a VM is the owner of the ip
     *    @param ip of the lease to be checked
     *    @param vid the ID of the VM
     *    @return true if the ip was already assigned
     */
    bool is_owner (const string& ip, int vid)
    {
        return leases->is_owner(ip, vid);
    };

    /**
     *    Gets size of the network (used + free)
     *    @return number of hosts that can be fitted in this network
     */
    unsigned int get_size()
    {
        return leases->size;
    };

    /**
     * Function to print the VirtualNetwork object into a string in
     * XML format
     *  @param xml the resulting XML string
     *  @return a reference to the generated string
     */
    string& to_xml(string& xml) const;

    /**
     * Function to print the VirtualNetwork object into a string in
     * XML format. The extended XML includes the LEASES
     *  @param xml the resulting XML string
     *  @return a reference to the generated string
     */
    string& to_xml_extended(string& xml) const;

    /**
     * Modifies the given nic attribute adding the following attributes:
     *  * IP:  leased from network
     *  * MAC: leased from network
     *  * BRIDGE: for this virtual network
     *  @param nic attribute for the VM template
     *  @param vid of the VM getting the lease
     *  @return 0 on success
     */
    int nic_attribute(VectorAttribute * nic, int vid);

private:

    // -------------------------------------------------------------------------
    // Friends
    // -------------------------------------------------------------------------
    friend class VirtualNetworkPool;

    // *************************************************************************
    // Virtual Network Private Attributes
    // *************************************************************************

    // -------------------------------------------------------------------------
    // Binded physical attributes
    // -------------------------------------------------------------------------

    /**
     *  Name of the bridge this VNW binds to
     */
    string  bridge;

    /**
     *  Name of the physical device the bridge should be attached to
     */
    string  phydev;

    /**
     *  VLAN ID of the NIC
     */
    string  vlan_id;

    /**
     *  Whether or not to isolate this network with the vnm driver
     */
    int     vlan;

    /**
     *  IPv6 address global unicast prefix
     */
     string global;

    /**
     *  Binary representation of the IPv6 address global unicast prefix
     */
     unsigned int global_bin[2];

    /**
     *  IPv6 address site unicast prefix
     */
     string site;

    /**
     *  Binary representation of the IPv6 address site unicast prefix
     */
     unsigned int site_bin[2];

    // -------------------------------------------------------------------------
    // Virtual Network Description
    // -------------------------------------------------------------------------
    /**
     * Holds the type of this network
     */
    NetworkType type;

    /**
     *  Pointer to leases class, can be fixed or ranged.
     *  Holds information on given (and, optionally, possible) leases
     */
    Leases *    leases;

    unsigned int ip_start;
    unsigned int ip_end;

    // *************************************************************************
    // DataBase implementation (Private)
    // *************************************************************************

    /**
     *  Execute an INSERT or REPLACE Sql query.
     *    @param db The SQL DB
     *    @param replace Execute an INSERT or a REPLACE
     *    @param error_str Returns the error reason, if any
     *    @return 0 on success
     */
    int insert_replace(SqlDB *db, bool replace, string& error_str);

    /**
     *  Bootstraps the database table(s) associated to the Virtual Network
     *    @return 0 on success
     */
    static int bootstrap(SqlDB * db)
    {
        int rc;

        ostringstream oss_vnet(VirtualNetwork::db_bootstrap);
        ostringstream oss_lease(Leases::db_bootstrap);

        rc =  db->exec(oss_vnet);
        rc += db->exec(oss_lease);

        return rc;
    };

    /**
     * Function to print the VirtualNetwork object into a string in
     * XML format
     *  @param xml the resulting XML string
     *  @param extended If true, leases are included
     *  @return a reference to the generated string
     */
    string& to_xml_extended(string& xml, bool extended) const;

    /**
     *  Rebuilds the object from an xml formatted string
     *    @param xml_str The xml-formatted string
     *
     *    @return 0 on success, -1 otherwise
     */
    int from_xml(const string &xml_str);

    //**************************************************************************
    // Constructor
    //**************************************************************************

    VirtualNetwork(int                      uid,
                   int                      gid,
                   const string&            _uname,
                   const string&            _gname,
                   int                      _umask,
                   int                      _cluster_id,
                   const string&            _cluster_name,
                   VirtualNetworkTemplate * _vn_template = 0);

    ~VirtualNetwork();

    // *************************************************************************
    // DataBase implementation
    // *************************************************************************

    static const char * table;

    static const char * db_names;

    static const char * db_bootstrap;

    /**
     *  Reads the Virtual Network (identified with its OID) from the database.
     *    @param db pointer to the db
     *    @return 0 on success
     */
    int select(SqlDB * db);

    /**
     *  Reads the Virtual Network (identified with its OID) from the database.
     *    @param db pointer to the db
     *    @param name of the network
     *    @param uid of the owner
     *
     *    @return 0 on success
     */
    int select(SqlDB * db, const string& name, int uid);

    /**
     *  Reads the Virtual Network leases from the database.
     *    @param db pointer to the db
     *    @return 0 on success
     */
    int select_leases(SqlDB * db);

    /**
     *  Writes the Virtual Network and its associated template and leases in the database.
     *    @param db pointer to the db
     *    @return 0 on success
     */
    int insert(SqlDB * db, string& error_str);

    /**
     *  Writes/updates the Virtual Network data fields in the database.
     *    @param db pointer to the db
     *    @return 0 on success
     */
    int update(SqlDB * db)
    {
        string error_str;
        return insert_replace(db, true, error_str);
    }

    /**
     * Deletes a VNW from the database and all its associated information:
     *   - VNW template
     *   - given leases
     *   @param db pointer to the db
     *   @return 0 on success
     */
    int drop(SqlDB * db);
};

#endif /*VIRTUAL_NETWORK_H_*/


text:
"""Functional test suite for ``pypi_parker.config``."""
import os

import pytest

from pypi_parker import build

from .functional_helpers import (
    read_manifest_from_sdist, read_setup_config, read_setup_from_sdist,
    read_setup_py, TEST_PACKAGE_NAMES
)

@pytest.mark.parametrize('name', TEST_PACKAGE_NAMES)
def test_setup_body(name):
    setup_config = read_setup_config(name)

    assert build._setup_body(setup_config) == read_setup_py(name)

@pytest.mark.parametrize('name', TEST_PACKAGE_NAMES)
def test_generate_and_build_pacakge(tmpdir, name):
    target_dir = tmpdir.mkdir('test')
    setup_config = read_setup_config(name)

    build.generate_and_build_package(
        package_config=setup_config,
        origin_directory=str(target_dir)
    )

    assert os.path.isdir(os.path.join(str(target_dir), 'dist'))
    dist_contents = os.listdir(os.path.join(str(target_dir), 'dist'))
    assert len(dist_contents) == 1
    sdist_file = os.path.join(str(target_dir), 'dist', dist_contents[0])
    assert read_manifest_from_sdist(sdist_file) == build.MANIFEST
    assert read_setup_from_sdist(sdist_file) == read_setup_py(name)


text:
using Machine.Specifications;
using MFlow.WebApi.Api;
using MFlow.WebApi.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MFlow.WebApi.Tests.for_ValidationController.given
{
    [Subject("for Validation Controller")]
    public class a_validation_controller_and_an_invalid_model
    {
        protected static ValidationController validation_controller;
        protected static ModelToValidate model;

        Establish context = () =>
        {
            validation_controller = new ValidationController();
            model = new ModelToValidate { Validate = JsonConvert.SerializeObject(new User()), Type = "MFlow.WebApi.Tests, MFlow.WebApi.Tests.User" };
        };
    }
}


text:
// Copyright 2004-2011 Castle Project - http://www.castleproject.org/
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Castle.Facilities.WcfIntegration
{
	using System;
	using System.Runtime.Remoting.Proxies;
	using System.ServiceModel;
	using System.ServiceModel.Channels;

	public interface IWcfChannelHolder : IDisposable
	{
		IChannel Channel { get; }

		RealProxy RealProxy { get; }

		ChannelFactory ChannelFactory { get; }

		IWcfBurden ChannelBurden { get; }

		bool IsChannelUsable { get; }

		void RefreshChannel();
	}
}


text:
// $Id: CharsAction.java 99 2005-02-28 21:37:53Z blindsey $

package com.blnz.xsl.tr;

import com.blnz.xsl.om.*;

/**
 * character data
 */
class CharsAction implements Action
{
    private String chars;
    CharsAction(String chars)
    {
        this.chars = chars;
    }

    public void invoke(ProcessContext context, Node sourceNode,
                       Result result) throws XSLException
    {
        result.characters(chars);
    }
}


text:
import {Pipe, PipeTransform} from '@angular/core';

@Pipe({
    name: 'truncate'
})
export class TruncatePipe implements PipeTransform {
    transform(value: string, ...args: string[]): string {
        if (!value) {
            return null;
        }
        const limit = args.length > 0 ? parseInt(args[0], 10) : 200;
        const trail = args.length > 1 ? args[1] : '...';
        const highlight = args.length > 2 ? args[2] : null;
        if (highlight != null) {
            let indexes = [];
            const keywords = highlight.split(/[\s;]+/);
            keywords.forEach(keyword => {
                const index = value.toLowerCase().indexOf(keyword.toLowerCase());
                if (index !== -1) {
                    indexes.push({'index': index, 'word': value.substring(index, index + keyword.length)});
                }
            });
            if (indexes.length > 0) {
                indexes = indexes.sort((i1, i2) => i2['index'] - i1['index']);
                const distance = indexes[0]['index'] - indexes[indexes.length - 1]['index'];
                let fromIndex = indexes[indexes.length - 1]['index'] - Math.abs(limit - distance) / 2;
                let delta = 0;
                if (fromIndex < 0) {
                    delta = 0 - fromIndex;
                    fromIndex = 0;
                }
                delta += Math.abs(limit - distance) / 2;
                const toIndex = indexes[0]['index'] + indexes[0]['word'].length + delta;
                let newVal = value.length > limit ? value.substring(fromIndex, toIndex) : value;
                if (fromIndex !== 0) {
                    newVal = trail + newVal.trimLeft();
                }
                if (toIndex < value.length) {
                    newVal = newVal + trail;
                }
                indexes.forEach(element => {
                    newVal = newVal.replace(element['word'], '' + element['word'] + '');
                });

                if (distance > limit) {
                    const maxDistance = {'from': 0, 'to': 0};
                    for (let i = 0; i + 1 < indexes.length; i++) {
                        if (indexes[i]['index'] - indexes[i + 1]['index'] > maxDistance['to'] - maxDistance['from']) {
                            maxDistance['from'] = indexes[i + 1]['index'] + indexes[i + 1]['word'].length;
                            maxDistance['to'] = indexes[i]['index'];
                        }
                    }
                    maxDistance['from'] = maxDistance['from'] - fromIndex + 100;
                    maxDistance['to'] = maxDistance['to'] - fromIndex - 100;

                    if (maxDistance['to'] > maxDistance['from']) {
                        newVal = newVal.substring(0, maxDistance['from']) + trail + '
' + trail + newVal.substring(maxDistance['to']);
                    }
                }
                return newVal;
            }
        }
        return value.length > limit ? value.substring(0, limit) + trail : value;
    }
}


text:
d3.json('health-wealth.json').then(data => {
    // convert string properties to numbers
    data.forEach(d => {
        d.income = Number(d.income);
        d.population = Number(d.population);
        d.lifeExpectancy = Number(d.lifeExpectancy);
    });

    const regions = d3.set(data.map(d => d.region));
    const color = d3.scaleOrdinal(d3.schemeCategory10).domain(regions.values());

    const legend = d3.legendColor().scale(color);

    const size = d3
        .scaleLinear()
        .range([20, 800])
        .domain(fc.extentLinear().accessors([d => d.population])(data));

    const pointSeries = fc
        .seriesSvgPoint()
        .crossValue(d => d.income)
        .mainValue(d => d.lifeExpectancy)
        .size(d => size(d.population))
        .decorate(sel => {
            sel.enter().attr('fill', d => color(d.region));
        });

    const chart = fc
        .chartCartesian(d3.scaleLog(), d3.scaleLinear())
        .xDomain(fc.extentLinear().accessors([d => d.income])(data))
        .yDomain(fc.extentLinear().accessors([d => d.lifeExpectancy])(data))
        .chartLabel('The Wealth & Health of Nations')
        .xLabel('Income (dollars)')
        .yLabel('Life expectancy (years)')
        .xTicks(2, d3.format(',d'))
        .yOrient('left')
        .svgPlotArea(pointSeries)
        .decorate(selection => {
            // append an svg for the d3-legend
            selection
                .enter()
                .append('d3fc-svg')
                .attr('class', 'legend');

            // render the legend
            selection
                .select('.legend')
                .select('svg')
                .call(legend);
        });

    d3.select('#bubble-chart')
        // remove the loading text from the container
        .text(null)
        .datum(data)
        .call(chart);
});


text:
from __future__ import absolute_import

import six

import sentry

from django.conf import settings
from rest_framework.response import Response

from sentry import options
from sentry.api.base import Endpoint
from sentry.api.permissions import SuperuserPermission
from sentry.utils.email import is_smtp_enabled

class SystemOptionsEndpoint(Endpoint):
    permission_classes = (SuperuserPermission,)

    def get(self, request):
        query = request.GET.get('query')
        if query == 'is:required':
            option_list = options.filter(flag=options.FLAG_REQUIRED)
        elif query:
            return Response('{} is not a supported search query'.format(query), status=400)
        else:
            option_list = options.all()

        smtp_disabled = not is_smtp_enabled()

        results = {}
        for k in option_list:
            disabled, disabled_reason = False, None

            if smtp_disabled and k.name[:5] == 'mail.':
                disabled_reason, disabled = 'smtpDisabled', True
            elif bool(k.flags & options.FLAG_PRIORITIZE_DISK and settings.SENTRY_OPTIONS.get(k.name)):
                # TODO(mattrobenolt): Expose this as a property on Key.
                disabled_reason, disabled = 'diskPriority', True

            # TODO(mattrobenolt): help, placeholder, title, type
            results[k.name] = {
                'value': options.get(k.name),
                'field': {
                    'default': k.default(),
                    'required': bool(k.flags & options.FLAG_REQUIRED),
                    'disabled': disabled,
                    'disabledReason': disabled_reason,
                    'isSet': options.isset(k.name),
                    'allowEmpty': bool(k.flags & options.FLAG_ALLOW_EMPTY),
                }
            }

        return Response(results)

    def put(self, request):
        # TODO(dcramer): this should validate options before saving them
        for k, v in six.iteritems(request.DATA):
            if v and isinstance(v, six.string_types):
                v = v.strip()
            try:
                option = options.lookup_key(k)
            except options.UnknownOption:
                # TODO(dcramer): unify API errors
                return Response({
                    'error': 'unknown_option',
                    'errorDetail': {
                        'option': k,
                    },
                }, status=400)

            try:
                if not (option.flags & options.FLAG_ALLOW_EMPTY) and not v:
                    options.delete(k)
                else:
                    options.set(k, v)
            except TypeError as e:
                return Response({
                    'error': 'invalid_type',
                    'errorDetail': {
                        'option': k,
                        'message': six.text_type(e),
                    },
                }, status=400)
        # TODO(dcramer): this has nothing to do with configuring options and
        # should not be set here
        options.set('sentry:version-configured', sentry.get_version())
        return Response(status=200)