text:
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';

class ModalHeader extends PureComponent {
  render () {
    const {hideCloseButton, className, children} = this.props;
    let closeButton = null;

    if (!hideCloseButton) {
      closeButton = (
        <button type="button" className="btn btn--compact modal__close-btn" data-close-modal="true">

        </button>
      );
    }

    return (

          {children}

        {closeButton}

    );
  }
}

ModalHeader.propTypes = {
  // Required
  children: PropTypes.node.isRequired,

  // Optional
  hideCloseButton: PropTypes.bool,
  className: PropTypes.string
};

export default ModalHeader;


text:
class AddInterpretationServicesToServices < ActiveRecord::Migration
  def change
    add_column :services, :interpretation_services, :text
  end
end

redpajama_set_name: RedPajamaGithub


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

namespace _13._1000DaysAfterBirth
{
    class Program
    {
        static void Main(string[] args)
        {
            string birthDate = Console.ReadLine();
            string format = "dd-MM-yyyy";

            DateTime afterDays = DateTime.ParseExact(birthDate, format, null);
            Console.WriteLine(afterDays.AddDays(999).ToString(format));
        }
    }
}


text:
package wfdb;

public class example4 {

  public static void main(final String argv[]) {
    int rr, rrhist[], rrmax, t = 0;
    final WFDB_Anninfo a = new WFDB_Anninfo();
    final WFDB_Annotation annot = new WFDB_Annotation();

    if (argv.length < 2) {
      System.out.println("usage: example4 annotator record\n");
      // Unlike C programs, Java programs do not have any foolproof way
      // to discover their own names, so the name is given as a constant
      // above. The usage statement is correct if this file has been
      // compiled. The command needed to run this program within a JVM
      // is platform-dependent and likely to be more complex.
      System.exit(1);
    }
    a.setName(argv[0]);
    a.setStat(wfdbConstants.WFDB_READ);
    if (wfdb.annopen(argv[1], a, 1) < 0)
      System.exit(2);
    if ((rrmax = (int) (3 * wfdb.sampfreq(argv[1]))) <= 0)
      System.exit(3);
    rrhist = new int[rrmax + 1];
    while (wfdb.getann(0, annot) == 0
        && wfdb.wfdb_isqrs(annot.getAnntyp()) == 0)
      t = annot.getTime();
    while (wfdb.getann(0, annot) == 0)
      if (wfdb.wfdb_isqrs(annot.getAnntyp()) != 0) {
        if ((rr = annot.getTime() - t) > rrmax)
          rr = rrmax;
        rrhist[rr]++;
        t = annot.getTime();
      }
    for (rr = 1; rr < rrmax; rr++)
      System.out.println(rrhist[rr] + wfdb.mstimstr(rr));
    System.out.println(rrhist[rr] + wfdb.mstimstr(rr) + " (or longer)");
    wfdb.wfdbquit();
  }
}


text:
function getValueByKeyMatch(targetObject, regex) {
	const match = Object.keys(targetObject).filter((prop) => {
		if (prop.match(regex)) {
			return prop;
		}
	})[0];
	return targetObject[match];
}

export default {
	getValueByKeyMatch
}


text:
/**
 * Module dependencies.
 */

var express = require('express');
var http = require('http');
var path = require('path');
var handlebars = require('express3-handlebars');
var mongoose = require('mongoose');

var index = require('./routes/index');
//var customer = require('./routes/customer');

// Connect to the Mongo database, whether locally or on Heroku
// MAKE SURE TO CHANGE THE NAME FROM 'lab7' TO ... IN OTHER PROJECTS
var local_database_name = 'customerdb';
var local_database_uri  = 'mongodb://localhost/' + local_database_name
var database_uri = process.env.MONGOLAB_URI || local_database_uri
mongoose.connect(database_uri);

var app = express();

// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.engine('handlebars', handlebars());
app.set('view engine', 'handlebars');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
// app.use(express.methodOverride());
app.use(express.cookieParser('Intro HCI secret key'));
app.use(express.session());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

// Add routes here
app.get('/', index.view);
//app.get('/customer/:id', customer.customerInfo);

// Example route
// app.get('/users', user.list);

http.createServer(app).listen(app.get('port'), function(){
  console.log('Express server listening on port ' + app.get('port'));
});


text:
using System;
using System.Management.Automation.Language;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Moq;
using PSycheTest;
using PSycheTest.Runners.Framework;
using PSycheTest.Runners.Framework.Results;
using PSycheTest.Runners.Framework.Utilities.Collections;
using PSycheTest.Runners.VisualStudio;
using PSycheTest.Runners.VisualStudio.Core;
using Xunit;
using Xunit.Extensions;

namespace Tests.Unit.PSycheTest.Runners.VisualStudio.Core
{
	public class TestMapperTests
	{
		[Fact]
		public void Test_Map_TestFunction()
		{
			// Arrange.
			var extent = Mock.Of<IScriptExtent>(e =>
				e.File == @"C:\TestScript.ps1" &&
				e.StartLineNumber == 12 &&
				e.StartColumnNumber == 20);

			var testFunction = new TestFunction(SyntaxTree.OfFunctionNamed("Test-Function",
				attribute: SyntaxTree.OfAttribute<TestAttribute>(), extent: extent));

			// Act.
			var testCase = mapper.Map(testFunction);

			// Assert.
			Assert.Equal("Test-Function", testCase.DisplayName);
			Assert.Equal(@"C:\TestScript.ps1:Test-Function", testCase.FullyQualifiedName);
			Assert.Equal(@"C:\TestScript.ps1", testCase.Source);
			Assert.Equal(@"C:\TestScript.ps1", testCase.CodeFilePath);
			Assert.Equal(12, testCase.LineNumber);
			Assert.Equal(VSTestExecutor.ExecutorUri, testCase.ExecutorUri);
		}

		[Theory]
		[InlineData(TestOutcome.None, TestStatus.NotExecuted)]
		[InlineData(TestOutcome.Passed, TestStatus.Passed)]
		[InlineData(TestOutcome.Failed, TestStatus.Failed)]
		[InlineData(TestOutcome.Skipped, TestStatus.Skipped)]
		public void Test_Map_TestStatus(TestOutcome expected, TestStatus status)
		{
			// Act.
			var actual = mapper.Map(status);

			// Assert.
			Assert.Equal(expected, actual);
		}

		[Fact]
		public void Test_Map_PassedResult()
		{
			// Arrange.
			var testCase = new TestCase("This.Is.A.Test", new Uri("executor://The.Executor"), @"C:\TestScript.ps1");
			var result = new PassedResult(TimeSpan.FromSeconds(2), new Uri(@"C:\artifact.txt").ToEnumerable());

			// Act.
			var mappedResult = mapper.Map(testCase, result);

			// Assert.
			Assert.Equal(TestOutcome.Passed, mappedResult.Outcome);
			Assert.Equal(TimeSpan.FromSeconds(2), mappedResult.Duration);
			Assert.Equal(testCase, mappedResult.TestCase);
			Assert.Null(mappedResult.ErrorStackTrace);
			Assert.Null(mappedResult.ErrorMessage);

			var attachmentSet = Assert.Single(mappedResult.Attachments);
			var attachment = Assert.Single(attachmentSet.Attachments);
			Assert.Equal(@"C:\artifact.txt", attachment.Uri.OriginalString);
		}

		[Fact]
		public void Test_Map_FailedResult()
		{
			// Arrange.
			var testCase = new TestCase("This.Is.A.Test", new Uri("executor://The.Executor"), @"C:\TestScript.ps1");
			var exception = Record.Exception(() => { throw new InvalidOperationException("Error!"); });	// Populate the stack trace.

			var result = new FailedResult(TimeSpan.FromSeconds(3), new ExceptionScriptError(exception));

			// Act.
			var mappedResult = mapper.Map(testCase, result);

			// Assert.
			Assert.Equal(TestOutcome.Failed, mappedResult.Outcome);
			Assert.Equal(TimeSpan.FromSeconds(3), mappedResult.Duration);
			Assert.Equal(testCase, mappedResult.TestCase);
			Assert.Equal(exception.StackTrace, mappedResult.ErrorStackTrace);
			Assert.Equal(exception.Message, mappedResult.ErrorMessage);
		}

		[Fact]
		public void Test_Map_SkippedResult()
		{
			// Arrange.
			var testCase = new TestCase("This.Is.A.Test", new Uri("executor://The.Executor"), @"C:\TestScript.ps1");
			var result = new SkippedResult("Because!");

			// Act.
			var mappedResult = mapper.Map(testCase, result);

			// Assert.
			Assert.Equal(TestOutcome.Skipped, mappedResult.Outcome);
			Assert.Equal(TimeSpan.Zero, mappedResult.Duration);
			Assert.Equal(testCase, mappedResult.TestCase);
			Assert.Null(mappedResult.ErrorStackTrace);
			Assert.Null(mappedResult.ErrorMessage);
		}

 		private readonly TestMapper mapper = new TestMapper();
	}
}


text:
package com.sun.pdfview;

import com.hsl.txtreader.PDFRenderer;
import com.hsl.txtreader.Rectangle2D;

/**
 * The abstract superclass of all drawing commands for a PDFPage.
 * @author Mike Wessler
 */
public abstract class PDFCmd {

    /**
     * mark the page or change the graphics state
     * @param state the current graphics state;  may be modified during
     * execution.
     * @return the region of the page made dirty by executing this command
     *         or null if no region was touched.  Note this value should be
     *         in the coordinates of the image touched, not the page.
     */
    public abstract Rectangle2D execute(PDFRenderer state);

    /**
     * a human readable representation of this command
     */
    @Override
    public String toString() {
        String name = getClass().getName();
        int lastDot = name.lastIndexOf('.');
        if (lastDot >= 0) {
            return name.substring(lastDot + 1);
        } else {
            return name;
        }
    }

    /**
     * the details of this command
     */
    public String getDetails() {
        return super.toString();
    }
}


text:
Hi! Have you ever faced the problem that the scrollbar lags when you're scrolling? With help of this plugin you can avoid this problem.

The magic is in the "pointer-events: none" CSS rule, it's set on the scroll event of the element and removed after the scroll event.
This CSS rule says browser to ignore all the mouse events. So, when you're scrolling browser doesn't process your mouse events and
you get a really fast scrolling speed.

It's a really simple and small jQuery plugin and you can easily use it.

    $(window).noLagScroll();

You need only **jquery.no-lag-scroll.js** file to use this plugin.


text:
{namespace blog=M12\Plugin\Blog\ViewHelpers}

		by {post.properties.author}
		on
		<time datetime="<f:format.date format='c'>{post.properties.datePublished}</f:format.date>" itemprop="datePublished"><f:format.date format="jS F Y">{post.properties.datePublished}</f:format.date></time>

	<f:if condition="{post.properties.tags}">

<blog:tags node="{post}" />

	</f:if>


text:
package com.facebook.buck.features.python;

import com.facebook.buck.core.cell.CellPathResolver;
import com.facebook.buck.core.description.arg.BuildRuleArg;
import com.facebook.buck.core.description.arg.HasDeclaredDeps;
import com.facebook.buck.core.description.arg.HasTests;
import com.facebook.buck.core.description.attr.ImplicitDepsInferringDescription;
import com.facebook.buck.core.exceptions.HumanReadableException;
import com.facebook.buck.core.model.BuildTarget;
import com.facebook.buck.core.model.Flavor;
import com.facebook.buck.core.model.FlavorDomain;
import com.facebook.buck.core.model.InternalFlavor;
import com.facebook.buck.core.model.impl.BuildTargetPaths;
import com.facebook.buck.core.rules.ActionGraphBuilder;
import com.facebook.buck.core.rules.BuildRuleCreationContextWithTargetGraph;
import com.facebook.buck.core.rules.BuildRuleParams;
import com.facebook.buck.core.rules.DescriptionWithTargetGraph;
import com.facebook.buck.core.rules.impl.SymlinkTree;
import com.facebook.buck.core.sourcepath.SourcePath;
import com.facebook.buck.core.toolchain.ToolchainProvider;
import com.facebook.buck.core.util.Optionals;
import com.facebook.buck.core.util.immutables.BuckStyleImmutable;
import com.facebook.buck.core.util.log.Logger;
import com.facebook.buck.cxx.config.CxxBuckConfig;
import com.facebook.buck.cxx.toolchain.CxxPlatform;
import com.facebook.buck.cxx.toolchain.CxxPlatformsProvider;
import com.facebook.buck.cxx.toolchain.UnresolvedCxxPlatform;
import com.facebook.buck.features.python.PythonBuckConfig.PackageStyle;
import com.facebook.buck.features.python.toolchain.PexToolProvider;
import com.facebook.buck.features.python.toolchain.PythonPlatform;
import com.facebook.buck.features.python.toolchain.PythonPlatformsProvider;
import com.facebook.buck.file.WriteFile;
import com.facebook.buck.io.filesystem.ProjectFilesystem;
import com.facebook.buck.rules.coercer.PatternMatchedCollection;
import com.facebook.buck.rules.macros.StringWithMacros;
import com.facebook.buck.rules.macros.StringWithMacrosConverter;
import com.facebook.buck.versions.HasVersionUniverse;
import com.facebook.buck.versions.VersionRoot;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.ImmutableSortedSet;
import java.nio.file.Path;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.immutables.value.Value;

public class PythonBinaryDescription
    implements DescriptionWithTargetGraph<PythonBinaryDescriptionArg>,
        ImplicitDepsInferringDescription<
            PythonBinaryDescription.AbstractPythonBinaryDescriptionArg>,
        VersionRoot<PythonBinaryDescriptionArg> {

  private static final Logger LOG = Logger.get(PythonBinaryDescription.class);

  private final ToolchainProvider toolchainProvider;
  private final PythonBuckConfig pythonBuckConfig;
  private final CxxBuckConfig cxxBuckConfig;

  public PythonBinaryDescription(
      ToolchainProvider toolchainProvider,
      PythonBuckConfig pythonBuckConfig,
      CxxBuckConfig cxxBuckConfig) {
    this.toolchainProvider = toolchainProvider;
    this.pythonBuckConfig = pythonBuckConfig;
    this.cxxBuckConfig = cxxBuckConfig;
  }

  @Override
  public Class<PythonBinaryDescriptionArg> getConstructorArgType() {
    return PythonBinaryDescriptionArg.class;
  }

  public static BuildTarget getEmptyInitTarget(BuildTarget baseTarget) {
    return baseTarget.withAppendedFlavors(InternalFlavor.of("__init__"));
  }

  public static SourcePath createEmptyInitModule(
      BuildTarget buildTarget,
      ProjectFilesystem projectFilesystem,
      ActionGraphBuilder graphBuilder) {
    BuildTarget emptyInitTarget = getEmptyInitTarget(buildTarget);
    Path emptyInitPath =
        BuildTargetPaths.getGenPath(projectFilesystem, buildTarget, "%s/__init__.py");
    WriteFile rule =
        graphBuilder.addToIndex(
            new WriteFile(
                emptyInitTarget, projectFilesystem, "", emptyInitPath, /* executable */ false));
    return rule.getSourcePathToOutput();
  }

  public static ImmutableMap<Path, SourcePath> addMissingInitModules(
      ImmutableMap<Path, SourcePath> modules, SourcePath emptyInit) {

    Map<Path, SourcePath> initModules = new LinkedHashMap<>();

    // Insert missing `__init__.py` modules.
    Set<Path> packages = new HashSet<>();
    for (Path module : modules.keySet()) {
      Path pkg = module;
      while ((pkg = pkg.getParent()) != null && !packages.contains(pkg)) {
        Path init = pkg.resolve("__init__.py");
        if (!modules.containsKey(init)) {
          initModules.put(init, emptyInit);
        }
        packages.add(pkg);
      }
    }

    return ImmutableMap.<Path, SourcePath>builder().putAll(modules).putAll(initModules).build();
  }

  private PythonInPlaceBinary createInPlaceBinaryRule(
      BuildTarget buildTarget,
      ProjectFilesystem projectFilesystem,
      BuildRuleParams params,
      ActionGraphBuilder graphBuilder,
      PythonPlatform pythonPlatform,
      CxxPlatform cxxPlatform,
      String mainModule,
      Optional<String> extension,
      PythonPackageComponents components,
      ImmutableSet<String> preloadLibraries,
      PackageStyle packageStyle) {

    SourcePath emptyInit = createEmptyInitModule(buildTarget, projectFilesystem, graphBuilder);
    BuildTarget linkTreeTarget = buildTarget.withAppendedFlavors(InternalFlavor.of("link-tree"));
    Path linkTreeRoot = BuildTargetPaths.getGenPath(projectFilesystem, linkTreeTarget, "%s");
    SymlinkTree linkTree =
        graphBuilder.addToIndex(
            new SymlinkTree(
                "python_in_place_binary",
                linkTreeTarget,
                projectFilesystem,
                graphBuilder,
                linkTreeRoot,
                components.withDefaultInitPy(emptyInit).asSymlinks()));

    return new PythonInPlaceBinary(
        buildTarget,
        projectFilesystem,
        graphBuilder,
        params.getDeclaredDeps(),
        cxxPlatform,
        pythonPlatform,
        mainModule,
        components,
        extension.orElse(pythonBuckConfig.getPexExtension()),
        preloadLibraries,
        pythonBuckConfig.legacyOutputPath(),
        linkTree,
        pythonPlatform.getEnvironment(),
        packageStyle);
  }

  PythonBinary createPackageRule(
      BuildTarget buildTarget,
      ProjectFilesystem projectFilesystem,
      BuildRuleParams params,
      ActionGraphBuilder graphBuilder,
      PythonPlatform pythonPlatform,
      CxxPlatform cxxPlatform,
      String mainModule,
      Optional<String> extension,
      PythonPackageComponents components,
      ImmutableList<String> buildArgs,
      PythonBuckConfig.PackageStyle packageStyle,
      ImmutableSet<String> preloadLibraries) {

    switch (packageStyle) {
      case INPLACE_LITE:
      case INPLACE:
        return createInPlaceBinaryRule(
            buildTarget,
            projectFilesystem,
            params,
            graphBuilder,
            pythonPlatform,
            cxxPlatform,
            mainModule,
            extension,
            components,
            preloadLibraries,
            packageStyle);

      case STANDALONE:
        return new PythonPackagedBinary(
            buildTarget,
            projectFilesystem,
            graphBuilder,
            params.getDeclaredDeps(),
            pythonPlatform,
            toolchainProvider
                .getByName(
                    PexToolProvider.DEFAULT_NAME,
                    buildTarget.getTargetConfiguration(),
                    PexToolProvider.class)
                .getPexTool(graphBuilder, buildTarget.getTargetConfiguration()),
            buildArgs,
            pythonBuckConfig
                .getPexExecutor(graphBuilder, buildTarget.getTargetConfiguration())
                .orElse(pythonPlatform.getEnvironment()),
            extension.orElse(pythonBuckConfig.getPexExtension()),
            pythonPlatform.getEnvironment(),
            mainModule,
            components,
            preloadLibraries,
            pythonBuckConfig.shouldCacheBinaries(),
            pythonBuckConfig.legacyOutputPath());

      default:
        throw new IllegalStateException();
    }
  }

  private UnresolvedCxxPlatform getCxxPlatform(
      BuildTarget target, AbstractPythonBinaryDescriptionArg args) {
    CxxPlatformsProvider cxxPlatformsProvider =
        toolchainProvider.getByName(
            CxxPlatformsProvider.DEFAULT_NAME,
            target.getTargetConfiguration(),
            CxxPlatformsProvider.class);
    FlavorDomain<UnresolvedCxxPlatform> cxxPlatforms =
        cxxPlatformsProvider.getUnresolvedCxxPlatforms();
    return cxxPlatforms
        .getValue(target)
        .orElse(
            args.getCxxPlatform()
                .map(cxxPlatforms::getValue)
                .orElse(cxxPlatformsProvider.getDefaultUnresolvedCxxPlatform()));
  }

  @Override
  public PythonBinary createBuildRule(
      BuildRuleCreationContextWithTargetGraph context,
      BuildTarget buildTarget,
      BuildRuleParams params,
      PythonBinaryDescriptionArg args) {
    if (args.getMain().isPresent() == args.getMainModule().isPresent()) {
      throw new HumanReadableException(
          "%s: must set exactly one of `main_module` and `main`", buildTarget);
    }
    Path baseModule = PythonUtil.getBasePath(buildTarget, args.getBaseModule());

    ActionGraphBuilder graphBuilder = context.getActionGraphBuilder();

    // If `main` is set, add it to the map of modules for this binary and also set it as the
    // `mainModule`, otherwise, use the explicitly set main module.
    String mainModule;
    Optional<PythonMappedComponents> modules;
    if (args.getMain().isPresent()) {
      LOG.info(
          "%s: parameter `main` is deprecated, please use `main_module` instead.", buildTarget);
      String mainName =
          graphBuilder.getSourcePathResolver().getSourcePathName(buildTarget, args.getMain().get());
      Path main = baseModule.resolve(mainName);
      mainModule = PythonUtil.toModuleName(buildTarget, main.toString());
      modules =
          Optional.of(
              PythonMappedComponents.of(
                  ImmutableSortedMap.of(baseModule.resolve(mainName), args.getMain().get())));
    } else {
      mainModule = args.getMainModule().get();
      modules = Optional.empty();
    }

    FlavorDomain<PythonPlatform> pythonPlatforms =
        toolchainProvider
            .getByName(
                PythonPlatformsProvider.DEFAULT_NAME,
                buildTarget.getTargetConfiguration(),
                PythonPlatformsProvider.class)
            .getPythonPlatforms();

    // Extract the platforms from the flavor, falling back to the default platforms if none are
    // found.
    PythonPlatform pythonPlatform =
        pythonPlatforms
            .getValue(buildTarget)
            .orElse(
                pythonPlatforms.getValue(
                    args.getPlatform()
                        .<Flavor>map(InternalFlavor::of)
                        .orElse(pythonPlatforms.getFlavors().iterator().next())));
    CxxPlatform cxxPlatform =
        getCxxPlatform(buildTarget, args)
            .resolve(graphBuilder, buildTarget.getTargetConfiguration());

    ProjectFilesystem projectFilesystem = context.getProjectFilesystem();

    // Build up the list of all components going into the python binary.
    PythonPackagable root =
        PythonBinaryPackagable.builder()
            .setBuildTarget(buildTarget)
            .setFilesystem(projectFilesystem)
            .setPythonPackageDeps(
                PythonUtil.getDeps(
                        pythonPlatform, cxxPlatform, args.getDeps(), args.getPlatformDeps())
                    .stream()
                    .map(graphBuilder::getRule)
                    .collect(ImmutableList.toImmutableList()))
            .setPythonModules(modules)
            .setPythonZipSafe(args.getZipSafe())
            .build();

    CellPathResolver cellRoots = context.getCellPathResolver();
    StringWithMacrosConverter macrosConverter =
        StringWithMacrosConverter.builder()
            .setBuildTarget(buildTarget)
            .setCellPathResolver(cellRoots)
            .setActionGraphBuilder(graphBuilder)
            .setExpanders(PythonUtil.MACRO_EXPANDERS)
            .build();
    PythonPackageComponents allPackageComponents =
        PythonUtil.getAllComponents(
            cellRoots,
            buildTarget,
            projectFilesystem,
            params,
            graphBuilder,
            root,
            pythonPlatform,
            cxxBuckConfig,
            cxxPlatform,
            args.getLinkerFlags().stream()
                .map(macrosConverter::convert)
                .collect(ImmutableList.toImmutableList()),
            pythonBuckConfig.getNativeLinkStrategy(),
            args.getPreloadDeps(),
            args.getCompile().orElse(false));
    return createPackageRule(
        buildTarget,
        projectFilesystem,
        params,
        graphBuilder,
        pythonPlatform,
        cxxPlatform,
        mainModule,
        args.getExtension(),
        allPackageComponents,
        args.getBuildArgs(),
        args.getPackageStyle().orElse(pythonBuckConfig.getPackageStyle()),
        PythonUtil.getPreloadNames(graphBuilder, cxxPlatform, args.getPreloadDeps()));
  }

  @Override
  public void findDepsForTargetFromConstructorArgs(
      BuildTarget buildTarget,
      CellPathResolver cellRoots,
      AbstractPythonBinaryDescriptionArg constructorArg,
      ImmutableCollection.Builder<BuildTarget> extraDepsBuilder,
      ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) {
    // We need to use the C/C++ linker for native libs handling, so add in the C/C++ linker to
    // parse time deps.
    extraDepsBuilder.addAll(
        getCxxPlatform(buildTarget, constructorArg)
            .getLinkerParseTimeDeps(buildTarget.getTargetConfiguration()));

    if (constructorArg.getPackageStyle().orElse(pythonBuckConfig.getPackageStyle())
        == PythonBuckConfig.PackageStyle.STANDALONE) {
      Optionals.addIfPresent(
          pythonBuckConfig.getPexTarget(buildTarget.getTargetConfiguration()), extraDepsBuilder);
      Optionals.addIfPresent(
          pythonBuckConfig.getPexExecutorTarget(buildTarget.getTargetConfiguration()),
          extraDepsBuilder);
    }
  }

  @Override
  public boolean producesCacheableSubgraph() {
    return true;
  }

  @BuckStyleImmutable
  @Value.Immutable
  interface AbstractPythonBinaryDescriptionArg
      extends BuildRuleArg, HasDeclaredDeps, HasTests, HasVersionUniverse {
    Optional<SourcePath> getMain();

    Optional<String> getMainModule();

    @Value.Default
    default PatternMatchedCollection<ImmutableSortedSet<BuildTarget>> getPlatformDeps() {
      return PatternMatchedCollection.of();
    }

    Optional<String> getBaseModule();

    Optional<Boolean> getZipSafe();

    ImmutableList<String> getBuildArgs();

    Optional<String> getPlatform();

    Optional<Flavor> getCxxPlatform();

    Optional<PythonBuckConfig.PackageStyle> getPackageStyle();

    ImmutableSet<BuildTarget> getPreloadDeps();

    ImmutableList<StringWithMacros> getLinkerFlags();

    Optional<String> getExtension();

    Optional<Boolean> getCompile();
  }
}


text:
concat-regexp is a function that takes a series of regular expressions (as String and/or RegExp objects) and returns them in concatenated form.

[![Build status](https://travis-ci.org/michaelrhodes/concat-regexp.png?branch=master)](https://travis-ci.org/michaelrhodes/concat-regexp)

[![Browser support](https://ci.testling.com/michaelrhodes/concat-regexp.png)](https://ci.testling.com/michaelrhodes/concat-regexp)

## Install
```sh
$ npm install concat-regexp
```

### Example
``` js
var concat = require('concat-regexp')

var username = 'alice'
concat(/^\/users\//, username, /\/?/, RegExp('$', 'i'))
// => /^\/users\/alice\/?$/i
```

### License
[MIT](http://opensource.org/licenses/MIT)


text:
package alicloud

import (
	"fmt"
	"log"
	"strings"
	"testing"

	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"

	"github.com/alibaba/terraform-provider/alicloud/connectivity"
	"github.com/aliyun/alibaba-cloud-sdk-go/services/vpc"
	"github.com/hashicorp/terraform/helper/resource"
	"github.com/hashicorp/terraform/terraform"
)

func init() {
	resource.AddTestSweepers("alicloud_route_table", &resource.Sweeper{
		Name: "alicloud_route_table",
		F:    testSweepRouteTable,
		// When implemented, these should be removed firstly
		Dependencies: []string{
			"alicloud_route_table_attachment",
		},
	})
}

func testSweepRouteTable(region string) error {
	rawClient, err := sharedClientForRegion(region)
	if err != nil {
		return fmt.Errorf("error getting Alicloud client: %s", err)
	}
	client := rawClient.(*connectivity.AliyunClient)

	prefixes := []string{
		"tf-testAcc",
		"tf_testAcc",
	}

	var routeTables []vpc.RouterTableListType
	req := vpc.CreateDescribeRouteTableListRequest()
	req.RegionId = client.RegionId
	req.PageSize = requests.NewInteger(PageSizeLarge)
	req.PageNumber = requests.NewInteger(1)
	for {
		raw, err := client.WithVpcClient(func(vpcClient *vpc.Client) (interface{}, error) {
			return vpcClient.DescribeRouteTableList(req)
		})
		if err != nil {
			return fmt.Errorf("Error retrieving RouteTables: %s", err)
		}
		resp, _ := raw.(*vpc.DescribeRouteTableListResponse)
		if resp == nil || len(resp.RouterTableList.RouterTableListType) < 1 {
			break
		}
		routeTables = append(routeTables, resp.RouterTableList.RouterTableListType...)

		if len(resp.RouterTableList.RouterTableListType) < PageSizeLarge {
			break
		}

		if page, err := getNextpageNumber(req.PageNumber); err != nil {
			return err
		} else {
			req.PageNumber = page
		}
	}

	for _, vtb := range routeTables {
		name := vtb.RouteTableName
		id := vtb.RouteTableId
		skip := true
		for _, prefix := range prefixes {
			if strings.HasPrefix(strings.ToLower(name), strings.ToLower(prefix)) {
				skip = false
				break
			}
		}
		if skip {
			log.Printf("[INFO] Skipping Route Table: %s (%s)", name, id)
			continue
		}
		log.Printf("[INFO] Deleting Route Table: %s (%s)", name, id)
		req := vpc.CreateDeleteRouteTableRequest()
		req.RouteTableId = id
		_, err := client.WithVpcClient(func(vpcClient *vpc.Client) (interface{}, error) {
			return vpcClient.DeleteRouteTable(req)
		})
		if err != nil {
			log.Printf("[ERROR] Failed to delete Route Table (%s (%s)): %s", name, id, err)
		}
	}
	return nil
}

func TestAccAlicloudRouteTable_basic(t *testing.T) {
	var routeTable vpc.DescribeRouteTableListResponse
	resource.Test(t, resource.TestCase{
		PreCheck: func() {
			testAccPreCheck(t)
		},
		// module name
		IDRefreshName: "alicloud_route_table.foo",
		Providers:     testAccProviders,
		CheckDestroy:  testAccCheckRouteTableDestroy,
		Steps: []resource.TestStep{
			resource.TestStep{
				Config: testAccRouteTableConfig,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckRouteTableListExists("alicloud_route_table.foo", &routeTable),
					resource.TestCheckResourceAttrSet(
						"alicloud_route_table.foo", "vpc_id"),
					resource.TestCheckResourceAttr(
						"alicloud_route_table.foo", "name", "tf-testAcc_route_table"),
					resource.TestCheckResourceAttr(
						"alicloud_route_table.foo", "description", "tf-testAcc_route_table"),
				),
			},
		},
	})
}

func testAccCheckRouteTableListExists(n string, routeTable *vpc.DescribeRouteTableListResponse) resource.TestCheckFunc {
	return func(s *terraform.State) error {
		rs, ok := s.RootModule().Resources[n]
		if !ok {
			return fmt.Errorf("Not found: %s", n)
		}
		if rs.Primary.ID == "" {
			return fmt.Errorf("No Route Table ID is set")
		}
		client := testAccProvider.Meta().(*connectivity.AliyunClient)
		routeTableService := RouteTableService{client}
		instance, err := routeTableService.DescribeRouteTable(rs.Primary.ID)
		if err != nil {
			return err
		}
		if routeTable == nil || len((*routeTable).RouterTableList.RouterTableListType) <= 0 {
			return err
		}
		(*routeTable).RouterTableList.RouterTableListType[0].RouteTableId = instance.RouteTableId
		return nil
	}
}

func testAccCheckRouteTableDestroy(s *terraform.State) error {
	client := testAccProvider.Meta().(*connectivity.AliyunClient)
	routeTableService := RouteTableService{client}
	for _, rs := range s.RootModule().Resources {
		if rs.Type != "alicloud_route_table" {
			continue
		}
		instance, err := routeTableService.DescribeRouteTable(rs.Primary.ID)
		if err != nil {
			if NotFoundError(err) {
				continue
			}
			return fmt.Errorf("Describe Route Table error %#v", err)
		}
		if instance.RouteTableId != "" {
			return fmt.Errorf("Route Table %s still exist", instance.RouteTableId)
		}
	}
	return nil
}

const testAccRouteTableConfig = `

resource "alicloud_vpc" "foo" {
	cidr_block = "172.16.0.0/12"
	name = "tf-testAccVpcConfig"
}

resource "alicloud_route_table" "foo" {
  vpc_id = "${alicloud_vpc.foo.id}"
  name = "tf-testAcc_route_table"
  description = "tf-testAcc_route_table"
}

`


text:
class Comment < ApplicationRecord
  belongs_to :commentable, polymorphic: true
  belongs_to :user
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level1" level="1" version="2">
  <model name="case00022">
    <listOfCompartments>
      <compartment name="compartment" volume="0.3" units="volume"/>
    </listOfCompartments>
    <listOfSpecies>
      <species name="S1" compartment="compartment" initialAmount="0.0015" units="substance"/>
      <species name="S2" compartment="compartment" initialAmount="0" units="substance"/>
    </listOfSpecies>
    <listOfParameters>
      <parameter name="k1" value="0.35"/>
      <parameter name="k2" value="180"/>
    </listOfParameters>
    <listOfReactions>
      <reaction name="reaction1" reversible="false">
        <listOfReactants>
          <speciesReference species="S1"/>
        </listOfReactants>
        <listOfProducts>
          <speciesReference species="S2" stoichiometry="3" denominator="10"/>
        </listOfProducts>
        <kineticLaw formula="compartment * k1 * S1"/>
      </reaction>
      <reaction name="reaction2" reversible="false">
        <listOfReactants>
          <speciesReference species="S2" stoichiometry="7" denominator="10"/>
        </listOfReactants>
        <listOfProducts>
          <speciesReference species="S1"/>
        </listOfProducts>
        <kineticLaw formula="compartment * k2 * S2"/>
      </reaction>
    </listOfReactions>
  </model>
</sbml>


text:
/* eslint-env jest */
import {
  ERROR_MISSING_FIELD,
  ERROR_VALUE_NOT_ALLOWED,
  ERROR_DOES_NOT_MATCH,
  ERROR_NOT_NUMBER,
  ERROR_NOT_INTEGER,
  ERROR_NOT_STRING,
  ERROR_KEY_NOT_ALLOWED,
  ERROR_TOO_LONG,
  ERROR_NOT_OBJECT,
  ERROR_TOO_SMALL,
} from './constants.js';
import Schema from './Schema.js';

describe('Test Schema', () => {
  let testContext;

  beforeEach(() => {
    testContext = {};
  });

  describe('Given a Schema class', () => {
    test('should expose ERROR_MISSING_FIELD', () => {
      expect(Schema.ERROR_MISSING_FIELD).toBeTruthy();
    });
    test('should expose ERROR_KEY_NOT_ALLOWED', () => {
      expect(Schema.ERROR_KEY_NOT_ALLOWED).toBeTruthy();
    });
    test('should expose ERROR_INVALID_DATE', () => {
      expect(Schema.ERROR_INVALID_DATE).toBeTruthy();
    });
    test('should expose ERROR_DOES_NOT_MATCH', () => {
      expect(Schema.ERROR_DOES_NOT_MATCH).toBeTruthy();
    });
    test('should expose ERROR_NOT_EQUAL', () => {
      expect(Schema.ERROR_NOT_EQUAL).toBeTruthy();
    });
    test('should expose ERROR_NOT_INTEGER', () => {
      expect(Schema.ERROR_NOT_INTEGER).toBeTruthy();
    });
    test('should expose ERROR_NOT_STRING', () => {
      expect(Schema.ERROR_NOT_STRING).toBeTruthy();
    });
    test('should expose ERROR_NOT_NUMBER', () => {
      expect(Schema.ERROR_NOT_NUMBER).toBeTruthy();
    });
    test('should expose ERROR_NOT_BOOLEAN', () => {
      expect(Schema.ERROR_NOT_BOOLEAN).toBeTruthy();
    });
    test('should expose ERROR_NOT_ARRAY', () => {
      expect(Schema.ERROR_NOT_ARRAY).toBeTruthy();
    });
    test('should expose ERROR_NOT_OBJECT', () => {
      expect(Schema.ERROR_NOT_OBJECT).toBeTruthy();
    });
    test('should expose ERROR_NOT_DATE', () => {
      expect(Schema.ERROR_NOT_DATE).toBeTruthy();
    });
    test('should expose ERROR_NOT_INSTANCE_OF', () => {
      expect(Schema.ERROR_NOT_INSTANCE_OF).toBeTruthy();
    });
    test('should expose ERROR_VALUE_NOT_ALLOWED', () => {
      expect(Schema.ERROR_VALUE_NOT_ALLOWED).toBeTruthy();
    });
    test('should expose ERROR_VALUE_NOT_ALLOWED', () => {
      expect(Schema.ERROR_VALUE_NOT_ALLOWED).toBeTruthy();
    });
    test('should expose ERROR_TOO_LONG', () => {
      expect(Schema.ERROR_TOO_LONG).toBeTruthy();
    });
    test('should expose ERROR_TOO_SHORT', () => {
      expect(Schema.ERROR_TOO_SHORT).toBeTruthy();
    });
    test('should expose ERROR_TOO_LARGE', () => {
      expect(Schema.ERROR_TOO_LARGE).toBeTruthy();
    });
    test('should expose ERROR_TOO_SMALL', () => {
      expect(Schema.ERROR_TOO_SMALL).toBeTruthy();
    });
    test('should expose ERROR_IS_EMPTY', () => {
      expect(Schema.ERROR_IS_EMPTY).toBeTruthy();
    });
  });

  describe('Given "any" schema', () => {
    beforeEach(() => {
      testContext.schema = Schema.any();
    });
    test('should set "any" flag', () => {
      expect(testContext.schema.compiled.isAny).toBe(true);
    });
    test('should accept an empty object', () => {
      expect(testContext.schema.getErrors({})).toBeFalsy();
    });
    test('should accept a number', () => {
      expect(testContext.schema.getErrors(1)).toBeFalsy();
    });
  });

  describe('Given "blackbox" schema', () => {
    beforeEach(() => {
      testContext.schema = Schema.blackbox();
    });
    test('should set "blackbox" flag', () => {
      expect(testContext.schema.compiled.isBlackbox).toBe(true);
    });
    test('should set "sealed" to false', () => {
      expect(testContext.schema.compiled.isSealed).toBe(false);
    });
    test('should accept an empty object', () => {
      expect(testContext.schema.getErrors({})).toBeFalsy();
    });
    test('should accept object with additional fields', () => {
      expect(testContext.schema.getErrors({
        x: 1,
        y: 1,
      })).toBeFalsy();
    });
    test('should not accept a number', () => {
      expect(testContext.schema.getErrors(1)).toEqual({
        actual: 1,
        error: ERROR_NOT_OBJECT,
      });
    });
  });

  describe('Given "empty" schema', () => {
    beforeEach(() => {
      testContext.schema = Schema.empty();
    });
    test('should validate empty object', () => {
      expect(testContext.schema.getErrors({})).toBeFalsy();
    });
    test('should not accept object with properties', () => {
      expect(testContext.schema.getErrors({
        x: 1,
        y: 1,
      })).toEqual({
        errors: {
          x: { error: ERROR_KEY_NOT_ALLOWED },
          y: { error: ERROR_KEY_NOT_ALLOWED },
        },
      });
    });
    test('should not accept object with undefined properties', () => {
      expect(testContext.schema.getErrors({
        x: undefined,
        y: undefined,
      })).toEqual({
        errors: {
          x: { error: ERROR_KEY_NOT_ALLOWED },
          y: { error: ERROR_KEY_NOT_ALLOWED },
        },
      });
    });
  });

  describe('Given "maybe" schema', () => {
    beforeEach(() => {
      testContext.schema = Schema.maybe(Number);
    });
    test('should set "maybe" flag', () => {
      expect(testContext.schema.compiled.isMaybe).toBe(true);
    });
    test('should accept if value is present', () => {
      expect(testContext.schema.getErrors(1)).toBeFalsy();
    });
    test('should not accept if value is of different type', () => {
      expect(testContext.schema.getErrors('a')).toEqual({
        actual: 'a',
        error: ERROR_NOT_NUMBER,
      });
    });
    test('should accept if value is missing', () => {
      expect(testContext.schema.getErrors(null)).toBeFalsy();
    });
    test('should accept if value is void', () => {
      expect(testContext.schema.getErrors(undefined)).toBeFalsy();
    });
  });

  describe('Given "maybe" that is canceled with explicit maybe option', () => {
    beforeEach(() => {
      testContext.schema = new Schema(new Schema.Maybe(Number), { maybe: false });
    });
    test('should set "maybe" flag', () => {
      expect(testContext.schema.compiled.isMaybe).not.toBe(true);
    });
    test('should accept if value is present', () => {
      expect(testContext.schema.getErrors(1)).toBeFalsy();
    });
    test('should not accept if value is of different type', () => {
      expect(testContext.schema.getErrors('a')).toEqual({
        actual: 'a',
        error: ERROR_NOT_NUMBER,
      });
    });
    test('should not accept if value is missing', () => {
      expect(testContext.schema.getErrors(null)).toEqual({
        actual: null,
        error: ERROR_NOT_NUMBER,
      });
    });
    test('should accept if value is void', () => {
      expect(testContext.schema.getErrors(undefined)).toEqual({
        actual: undefined,
        error: ERROR_NOT_NUMBER,
      });
    });
  });

  describe('Given "enum" schema', () => {
    beforeEach(() => {
      testContext.schema = Schema.enum(['A', 'B', 'C']);
    });
    test('should set "atomic" flag', () => {
      expect(testContext.schema.compiled.isAtomic).toBe(true);
    });
    test('should accept each of the enumrated values', () => {
      expect(testContext.schema.getErrors('A')).toBeFalsy();
      expect(testContext.schema.getErrors('B')).toBeFalsy();
      expect(testContext.schema.getErrors('C')).toBeFalsy();
    });
    test('should not accept a string that is not explicitly listed', () => {
      expect(testContext.schema.getErrors('D')).toEqual({
        error: ERROR_VALUE_NOT_ALLOWED,
        actual: 'D',
        expected: ['"A"', '"B"', '"C"'],
      });
    });
    test('should not accept a number', () => {
      expect(testContext.schema.getErrors(1)).toEqual({
        error: ERROR_NOT_STRING,
        actual: 1,
      });
    });
  });

  describe('Given scheam with "custom" validator', () => {
    beforeEach(() => {
      testContext.schema = new Schema(String, {
        meta: {
          expected: 'a',
        },
        custom: (actual, { expected }) => {
          if (actual !== expected) {
            return { error: ERROR_VALUE_NOT_ALLOWED, actual, expected };
          }
          return undefined;
        },
      });
      testContext.schema2 = new Schema({
        a: Number,
        b: Number,
      }, {
        custom: (actual) => {
          if (actual.a !== actual.b) {
            return { error: ERROR_VALUE_NOT_ALLOWED, actual: [actual.a, actual.b], expected: 'equal' };
          }
          return undefined;
        },
      });
    });
    test('should accept an allowed string value', () => {
      expect(testContext.schema.getErrors('a')).toBeFalsy();
    });
    test('should reject value that is not a string', () => {
      expect(testContext.schema.getErrors(1)).toEqual({
        actual: 1,
        error: ERROR_NOT_STRING,
      });
    });
    test('should reject other values', () => {
      expect(testContext.schema.getErrors('b')).toEqual({
        error: ERROR_VALUE_NOT_ALLOWED,
        actual: 'b',
        expected: 'a',
      });
    });
    test('should accept an allowed object', () => {
      expect(testContext.schema2.getErrors({
        a: 1,
        b: 1,
      })).toBeFalsy();
    });
    test('should reject not a non-object value', () => {
      expect(testContext.schema2.getErrors(null)).toEqual({
        actual: null,
        error: ERROR_NOT_OBJECT,
      });
    });
    test('should reject if custom validator fails', () => {
      expect(testContext.schema2.getErrors({
        a: 1,
        b: 2,
      })).toEqual({
        actual: [1, 2],
        error: ERROR_VALUE_NOT_ALLOWED,
        expected: 'equal',
      });
    });
  });

  describe('Given schema with "meta" properties', () => {
    beforeEach(() => {
      testContext.schema1 = new Schema({
        a: { type: Number, meta: { description: 'Number a' } },
        b: { type: Number, meta: { description: 'Number b' } },
      }, {
        meta: {
          description: 'Object (a, b)',
        },
      });
      testContext.schema2 = Schema.pick(testContext.schema1, {
        properties: {
          a: { meta: { title: 'a' } },
          b: { meta: { title: 'b' } },
        },
      });
    });
    test('should expose "meta" as a property of the schema', () => {
      expect(testContext.schema1.meta).toEqual({
        description: 'Object (a, b)',
      });
    });
    test('should add "meta" property to validator', () => {
      expect(testContext.schema1.property('a').meta).toEqual({
        description: 'Number a',
      });
      expect(testContext.schema1.property('b').meta).toEqual({
        description: 'Number b',
      });
    });
    test('should merge "meta" property if it is overwritten', () => {
      expect(testContext.schema2.property('a').meta).toEqual({
        description: 'Number a',
        title: 'a',
      });
      expect(testContext.schema2.property('b').meta).toEqual({
        description: 'Number b',
        title: 'b',
      });
    });
  });

  describe('Given object schema that overwrites property options', () => {
    beforeEach(() => {
      const MyNumber = new Schema(Number, { decimal: false });
      testContext.schema = new Schema({
        a: MyNumber,
        b: { type: MyNumber, decimal: true },
      });
    });
    test('should accept integers', () => {
      expect(testContext.schema.getErrors({
        a: 1,
        b: 2,
      })).toBeFalsy();
    });
    test('should accept one decimal', () => {
      expect(testContext.schema.getErrors({
        a: 1,
        b: 2.5,
      })).toBeFalsy();
    });
    test('should reject two decimals', () => {
      expect(testContext.schema.getErrors({
        a: 1.5,
        b: 2.5,
      })).toEqual({
        errors: {
          a: { error: ERROR_NOT_INTEGER, actual: 1.5 },
        },
      });
    });
  });

  describe('Given an array schema', () => {
    beforeEach(() => {
      testContext.schema = new Schema([String]);
    });
    test(
      'should throw descriptive error if the first element is invalid',
      () => {
        expect(() => {
          testContext.schema.validate([1]);
        }).toThrowError('0 should be a string');
      },
    );
    test(
      'should throw descriptive error if the second element is invalid',
      () => {
        expect(() => {
          testContext.schema.validate(['a', 1]);
        }).toThrowError('1 should be a string');
      },
    );
  });

  describe('Given a schema with allowedValues', () => {
    describe('and the schema is an array', () => {
      beforeEach(() => {
        testContext.schema1 = new Schema([String], { '$.allowedValues': ['a', 'b', 'c'] });
      });
      test('should reject value that is not allowed', () => {
        expect(testContext.schema1.getErrors(['a', 'b', 'x'])).toEqual({
          errors: [
            undefined,
            undefined,
            {
              error: ERROR_VALUE_NOT_ALLOWED,
              actual: 'x',
              expected: ['"a"', '"b"', '"c"'],
            },
          ],
        });
      });
      test('should accept value that is allowed', () => {
        expect(testContext.schema1.getErrors(['a', 'b', 'c'])).toBeFalsy();
      });
    });
  });

  describe('Given a schema with regular expression', () => {
    describe('and the schema is an array', () => {
      beforeEach(() => {
        testContext.schema1 = new Schema([String], { '$.regEx': /\d+/ });
      });
      test('should reject value that is not allowed', () => {
        expect(testContext.schema1.getErrors(['1', '12', 'xxx'])).toEqual({
          errors: [
            undefined,
            undefined,
            {
              error: ERROR_DOES_NOT_MATCH,
              expected: 'match /\\d+/',
            },
          ],
        });
      });
      test('should accept value that is allowed', () => {
        expect(testContext.schema1.getErrors(['1', '12', '123'])).toBeFalsy();
      });
    });
  });

  describe('Given a nested object schema', () => {
    beforeEach(() => {
      testContext.schema1 = new Schema({
        a: new Schema({
          x: Number,
          y: Number,
        }),
        b: {
          type: new Schema({
            x: Number,
            y: Number,
          }),
        },
        c: {
          type: {
            x: Number,
            y: Number,
          },
        },
      }, {
        emptyStringsAreMissingValues: true,
      });
    });
    test('should reject object with missing properties', () => {
      expect(testContext.schema1.getErrors({
        a: { x: 1 },
        b: { x: 1 },
        c: { x: 1 },
      })).toEqual({
        errors: {
          a: { errors: { y: { error: ERROR_MISSING_FIELD } } },
          b: { errors: { y: { error: ERROR_MISSING_FIELD } } },
          c: { errors: { y: { error: ERROR_MISSING_FIELD } } },
        },
      });
    });
    test('should not report empty string, if object is expected', () => {
      expect(testContext.schema1.getErrors({
        a: '',
        b: null,
        c: undefined,
      })).toEqual({
        errors: {
          a: { error: ERROR_NOT_OBJECT, actual: '' },
          b: { error: ERROR_MISSING_FIELD },
          c: { error: ERROR_MISSING_FIELD },
        },
      });
    });
    test('should not report missing string, if number is expected', () => {
      expect(testContext.schema1.getErrors({
        a: { x: '', y: 1 },
      })).toEqual({
        errors: {
          a: {
            errors: {
              x: { error: ERROR_NOT_NUMBER, actual: '' },
            },
          },
          b: { error: ERROR_MISSING_FIELD },
          c: { error: ERROR_MISSING_FIELD },
        },
      });
    });
  });

  describe('Given a merge schema', () => {
    beforeEach(() => {
      testContext.schema1 = Schema.merge([
        {
          a: { type: Number },
          b: { type: String },
        },
        {
          b: { type: Number },
          c: { type: String },
        },
      ]);
    });

    test('should accept a valid object', () => {
      expect(testContext.schema1.getErrors({
        a: 1,
        b: 1,
        c: 'x',
      })).toBeFalsy();
    });

    test('should reject an object with invalid property type', () => {
      expect(testContext.schema1.getErrors({
        a: 1,
        b: 'x',
        c: 'x',
      })).toEqual({
        errors: {
          b: { error: ERROR_NOT_NUMBER, actual: 'x' },
        },
      });
    });
  });

  describe('Given a schema with "pick"', () => {
    beforeEach(() => {
      testContext.schema1 = Schema.pick({
        a: { type: Number },
        b: { type: String },
        c: { type: Number },
      }, {
        properties: ['a', 'b'],
      });
      testContext.schema2 = Schema.pick({
        a: { type: Number },
        b: { type: String },
        c: { type: Number },
      }, {
        properties: {
          a: { optional: true },
          b: { optional: true },
          c: {},
        },
      });
      testContext.schema3 = Schema.pick({
        a: { type: Number, optional: true },
        b: { type: String, optional: true },
        c: { type: Number, optional: true },
      }, {
        properties: ['a', 'b', 'c'],
        required: ['a'],
      });
    });

    test('should accept a valid object', () => {
      expect(testContext.schema1.getErrors({
        a: 1,
        b: 'x',
      })).toBeFalsy();
    });

    test('should reject an object with invalid property type', () => {
      expect(testContext.schema1.getErrors({
        a: 1,
        b: 1,
        c: 'x',
      })).toEqual({
        errors: {
          b: { error: ERROR_NOT_STRING, actual: 1 },
          c: { error: ERROR_KEY_NOT_ALLOWED },
        },
      });
    });

    test('should allow changing property options', () => {
      expect(testContext.schema2.getErrors({
        c: 'x',
      })).toEqual({
        errors: {
          c: {
            actual: 'x',
            error: ERROR_NOT_NUMBER,
          },
        },
      });
    });

    test('should allow changing property mode via required array', () => {
      expect(testContext.schema3.getErrors({})).toEqual({
        errors: {
          a: {
            error: ERROR_MISSING_FIELD,
          },
        },
      });
    });
  });

  describe('Given a merged schema', () => {
    beforeEach(() => {
      testContext.schema1 = Schema.merge([
        {
          a: { type: String },
          b: { type: String },
        },
        {
          b: { type: String, optional: true },
          c: { type: String },
          d: { type: String },
        },
      ]);
      testContext.schema2 = Schema.merge([
        Schema.blackbox(),
        {
          a: { type: String, optional: true },
          b: { type: String, optional: true },
        },
      ]);
    });

    test('should accept a valid object', () => {
      expect(testContext.schema1.getErrors({
        a: 'a',
        c: 'c',
        d: 'd',
      })).toBeFalsy();
    });

    test('should reject an invalid object', () => {
      expect(testContext.schema1.getErrors({
        c: 'c',
        d: 'd',
      })).toEqual({
        errors: {
          a: { error: ERROR_MISSING_FIELD },
        },
      });
    });

    test('should flag itself with isObject', () => {
      expect(testContext.schema1.compiled.isObject).toBe(true);
    });

    test('should set isSealed to false if one of elements allows additional properties', () => {
      expect(testContext.schema2.compiled.isSealed).toBe(false);
    });

    test('should allow additional properties', () => {
      expect(testContext.schema2.getErrors({
        x: 1,
        y: 1,
      })).toBeFalsy();
    });
  });

  describe('Given a hash with object sub-schema', () => {
    beforeEach(() => {
      testContext.schema = Schema.hash({
        key: new Schema(String, { max: 3 }),
        value: {
          a: Number,
          b: String,
        },
      });
    });
    test('should accept a valid object', () => {
      expect(testContext.schema.getErrors({
        xxx: { a: 1, b: 'x' },
        yyy: { a: 2, b: 'y' },
      })).toBeFalsy();
    });
    test('should reject if key is too long', () => {
      expect(testContext.schema.getErrors({
        xxxx: { a: 1, b: 'x' },
      })).toEqual({
        errors: {
          xxxx: {
            actual: 'xxxx',
            error: ERROR_TOO_LONG,
            expected: 3,
          },
        },
      });
    });
    test('should reject an invalid object', () => {
      expect(testContext.schema.getErrors({
        xxx: { b: 'x' },
        yyy: { c: 2, a: 1, b: 'y' },
      })).toEqual({
        errors: {
          xxx: {
            errors: {
              a: {
                error: ERROR_MISSING_FIELD,
              },
            },
          },
          yyy: {
            errors: {
              c: {
                error: ERROR_KEY_NOT_ALLOWED,
              },
            },
          },
        },
      });
    });
  });

  describe('Given an alternative schema', () => {
    beforeEach(() => {
      testContext.schema = Schema.oneOf([
        new Schema({}, { typeName: 'empty' }),
        new Schema(String, { typeName: 'text' }),
        Schema.arrayOf(Number),
      ]);
    });

    test('should generate a descriptive error of there is no match', () => {
      expect(testContext.schema.validate(true, { noException: true })).toBe('Value should be one of: empty, text, array of number');
    });
  });

  describe('Given a disjoint "oneOf" schema', () => {
    beforeEach(() => {
      testContext.schema = Schema.oneOf([
        {
          type: 'typeA',
          settings: new Schema({
            a: String,
          }),
        },
        {
          type: 'typeB',
          settings: new Schema({
            b: Number,
          }),
        },
      ], {
        disjointBy: 'type',
      });
    });

    test('should reject if value is not an object', () => {
      expect(testContext.schema.getErrors(null)).toEqual({
        actual: null,
        error: ERROR_NOT_OBJECT,
      });
    });

    test('should accept an object of first type', () => {
      expect(testContext.schema.getErrors({
        type: 'typeA',
        settings: {
          a: '',
        },
      })).toBeFalsy();
    });

    test('should accept an object of the second type', () => {
      expect(testContext.schema.getErrors({
        type: 'typeB',
        settings: {
          b: 1,
        },
      })).toBeFalsy();
    });

    test('should reject object which is declared as typeB but it is not', () => {
      expect(testContext.schema.getErrors({
        type: 'typeB',
        settings: {
          a: '',
        },
      })).toEqual({
        errors: {
          settings: {
            errors: {
              a: { error: 'core.keyNotAllowed' },
              b: { error: 'core.missingField' },
            },
          },
        },
      });
    });

    test('should reject object that does not match any type', () => {
      expect(testContext.schema.getErrors({
        type: 'typeC',
        settings: {
          c: [],
        },
      })).toEqual({
        error: ERROR_VALUE_NOT_ALLOWED,
        expected: [
          '"typeA"',
          '"typeB"',
        ],
      });
    });
  });

  describe('Schema.clean()', () => {
    beforeEach(() => {
      testContext.schema1 = new Schema({
        a: new Schema({
          x: { type: Number, defaultValue: 0 },
          y: { type: String, defaultValue: '' },
        }, {
          defaultValue: {},
        }),
        b: [new Schema(Number)],
      });
      testContext.schema2 = new Schema({
        a: Number,
        b: Number,
        c: String,
      }, {
        sealed: false,
      });
      testContext.schema3 = new Schema({
        a: Number,
        b: Number,
        c: String,
      }, {
        emptyStringsAreMissingValues: true,
      });
      testContext.schema4 = Schema.tuple([
        Number,
        Number,
        Number,
      ], {
        defaultValue: [0, 0, 0],
      });
      testContext.schema5 = Schema.objectOf(
        new Schema(Number, { defaultValue: 0 }),
        {
          defaultValue: {},
        },
      );
    });
    test('should not modify a valid object', () => {
      expect(testContext.schema1.clean({
        a: { x: 1, y: 'y' },
        b: [1, 2, 3],
      })).toEqual({
        a: { x: 1, y: 'y' },
        b: [1, 2, 3],
      });
    });
    test('should convert strings to numbers', () => {
      expect(testContext.schema1.clean({
        a: { x: '1.5', y: '' },
        b: ['1', '2', 3],
      })).toEqual({
        a: { x: 1.5, y: '' },
        b: [1, 2, 3],
      });
    });
    test('should convert numbers to strings', () => {
      expect(testContext.schema1.clean({
        a: { x: 0, y: 1 },
      })).toEqual({
        a: { x: 0, y: '1' },
      });
    });
    test('should remove properties that are not allowed', () => {
      expect(testContext.schema1.clean({
        a: { x: 0, y: '', z: {} },
      })).toEqual({
        a: { x: 0, y: '' },
      });
    });
    test('should set default values', () => {
      expect(testContext.schema1.clean({})).toEqual({
        a: {
          x: 0,
          y: '',
        },
      });
    });
    test(
      'should remove properties that are null, undefined or empty',
      () => {
        expect(testContext.schema3.clean({
          a: null,
          b: undefined,
          c: '',
        })).toEqual({});
      },
    );
    test(
      'should not remove empty strings if they are not considerd missing values',
      () => {
        expect(testContext.schema2.clean({
          a: null,
          b: undefined,
          c: '',
        })).toEqual({
          c: '',
        });
      },
    );
    test('should keep additional properties if they are allowed', () => {
      expect(testContext.schema2.clean({
        d: 3,
      })).toEqual({
        d: 3,
      });
    });
    test('should not change things that cannot be cleaned', () => {
      expect(testContext.schema1.clean({
        a: [1, 2, 3],
      })).toEqual({
        a: [1, 2, 3],
      });
    });
    test('should tuple elements', () => {
      expect(testContext.schema4.clean(
        [1, 2, '3'],
      )).toEqual(
        [1, 2, 3],
      );
    });
    test('should remove outstanding elements from tuple', () => {
      expect(testContext.schema4.clean(
        [1, 2, 3, 4, 5],
      )).toEqual(
        [1, 2, 3],
      );
    });
    test('should append missing elements to tuple', () => {
      expect(testContext.schema4.clean(
        [1],
      )).toEqual(
        [1, 0, 0],
      );
    });
    test('should clean hash values', () => {
      expect(testContext.schema5.clean({
        a: '1',
        b: 1,
        c: undefined,
      })).toEqual({
        a: 1,
        b: 1,
        c: 0,
      });
    });
  });

  describe('Given a an object schema with default value', () => {
    beforeEach(() => {
      testContext.schema1 = new Schema({
        a: new Schema({
          x: { type: Number, defaultValue: 0, optional: true, min: 1 },
          y: { type: new Schema(Number, { defaultValue: 0 }) },
        }),
        b: {
          type: new Schema({
            x: Number,
            y: Number,
          }, {
            defaultValue: {
              x: 0,
            },
          }),
          optional: true,
        },
      }, {
        defaultValue: {},
      });
    });
    test('should return relevant errors web validating null', () => {
      expect(testContext.schema1.getErrors(undefined, { clean: true })).toEqual({
        errors: {
          a: { error: ERROR_MISSING_FIELD },
          b: { errors: { y: { error: ERROR_MISSING_FIELD } } },
        },
      });
    });
    test(
      'should return relevant errors when validating empty object ',
      () => {
        expect(testContext.schema1.getErrors({}, { clean: true })).toEqual({
          errors: {
            a: { error: ERROR_MISSING_FIELD },
            b: { errors: { y: { error: ERROR_MISSING_FIELD } } },
          },
        });
      },
    );
    test(
      'should return relevant errors when properties are empty objects',
      () => {
        expect(testContext.schema1.getErrors({
          a: {},
          b: {},
        }, { clean: true })).toEqual({
          errors: {
            a: {
              errors: {
                x: { error: ERROR_TOO_SMALL, expected: 1, actual: 0 },
              },
            },
            b: {
              errors: {
                x: { error: ERROR_MISSING_FIELD },
                y: { error: ERROR_MISSING_FIELD },
              },
            },
          },
        });
      },
    );
  });

  describe('Given a hash schema with default value', () => {
    beforeEach(() => {
      testContext.schema1 = Schema.objectOf(
        new Schema({
          x: { type: Number, defaultValue: 0, optional: true, min: 1 },
          y: { type: Number },
        }, { defaultValue: {} }),
        {
          defaultValue: {},
        },
      );
    });
    test('should not return any errors on null', () => {
      expect(testContext.schema1.getErrors(undefined, { clean: true })).toBeFalsy();
    });
    test(
      'should return relevant errors there is key with null value',
      () => {
        expect(testContext.schema1.getErrors({
          a: undefined,
        }, { clean: true })).toEqual({
          errors: {
            a: {
              errors: {
                x: { error: ERROR_TOO_SMALL, actual: 0, expected: 1 },
                y: { error: ERROR_MISSING_FIELD },
              },
            },
          },
        });
      },
    );
  });

  describe('Given two schemas with referencing properties', () => {
    beforeEach(() => {
      testContext.schema1 = new Schema({
        a: { type: String, optional: true },
        b: { type: Number },
        c: {
          type: new Schema({
            x: Number,
            y: Number,
          }),
        },
        d: {
          type: Schema.arrayOf({
            x: Number,
            y: Number,
          }),
          optional: true,
        },
      });
      testContext.schema2 = new Schema({
        a: testContext.schema1.property('a'),
        b: testContext.schema1.property('b'),
        x: testContext.schema1.property('c.x'),
        y: { type: testContext.schema1.property('c.y'), label: 'Y', optional: true },
      });
      testContext.schema3 = new Schema({
        x: testContext.schema1.property('d.x'),
        y: testContext.schema1.property('d.y'),
      });
    });
    test('should not affect the original validator', () => {
      expect(testContext.schema1.getErrors({
        b: 1,
        c: {},
      })).toEqual({
        errors: {
          c: {
            errors: {
              x: { error: ERROR_MISSING_FIELD },
              y: { error: ERROR_MISSING_FIELD },
            },
          },
        },
      });
    });
    test('should reject object with missing properties', () => {
      expect(testContext.schema2.getErrors({})).toEqual({
        errors: {
          b: { error: ERROR_MISSING_FIELD },
          x: { error: ERROR_MISSING_FIELD },
        },
      });
    });
    test('should properly report relevant errors', () => {
      expect(testContext.schema2.getErrors({
        b: 1,
        x: 'x',
        y: 'y',
      })).toEqual({
        errors: {
          x: {
            actual: 'x',
            error: ERROR_NOT_NUMBER,
          },
          y: {
            actual: 'y',
            error: ERROR_NOT_NUMBER,
            label: 'Y',
          },
        },
      });
    });
    test('should accept a valid object', () => {
      expect(testContext.schema2.getErrors({
        a: 'a',
        b: 1,
        x: 1,
        y: 1,
      })).toBeFalsy();
    });
    test('should pick properties from object nested in array', () => {
      expect(testContext.schema3.getErrors({
        x: 1,
        y: 1,
      })).toBeFalsy();
    });
  });

  describe('Given a schema with labels', () => {
    beforeEach(() => {
      testContext.schema1 = new Schema({
        a: { type: String, label: 'A' },
        b: {
          type: {
            x: { type: Number, label: 'X' },
            y: { type: Number, label: 'Y' },
          },
        },
      });
      testContext.schema2 = new Schema([new Schema(String, { label: 'Item' })], { maxCount: 2, label: 'Array' });
    });
    test('should attach labels to error descriptor', () => {
      expect(testContext.schema1.getErrors({
        b: {
          x: '',
        },
      })).toEqual({
        errors: {
          a: {
            error: ERROR_MISSING_FIELD,
            label: 'A',
          },
          b: {
            errors: {
              x: {
                error: ERROR_NOT_NUMBER,
                label: 'X',
                actual: '',
              },
              y: {
                error: ERROR_MISSING_FIELD,
                label: 'Y',
              },
            },
          },
        },
      });
    });
    test('should properly attach label to an array', () => {
      expect(testContext.schema2.getErrors([1, 2, 3])).toEqual({
        actual: [1, 2, 3],
        error: ERROR_TOO_LONG,
        expected: 2,
        label: 'Array',
      });
    });
    test('should properly attach label to an array elements', () => {
      expect(testContext.schema2.getErrors([1, 2])).toEqual({
        label: 'Array',
        errors: [
          {
            actual: 1,
            error: ERROR_NOT_STRING,
            label: 'Item',
          },
          {
            actual: 2,
            error: ERROR_NOT_STRING,
            label: 'Item',
          },
        ],
      });
    });
  });

  describe('Compilation errors', () => {
    test('throws when "required" is not an array', () => {
      expect(() => {
        new Schema({}, { required: {} }).getErrors();
      }).toThrow(/array/);
    });

    test('throws when "allowedValues" is not an array', () => {
      expect(() => {
        new Schema(String, { allowedValues: {} }).getErrors();
      }).toThrow(/array/);
    });

    test('throws when "allowedValues" is not an array of strings', () => {
      expect(() => {
        new Schema(String, { allowedValues: [1, 2, 3] }).getErrors();
      }).toThrow(/array/);
    });

    test('throws when "allowedValues" is not used with string', () => {
      expect(() => {
        new Schema(Number, { allowedValues: [] }).getErrors();
      }).toThrow(/can only be used with string/);
    });
  });
});


text:
<!doctype html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="shortcut icon" type="image/x-icon" href="/eos/favicon.ico" />


text:
export class Message {
    constructor(public from?: string, public content?: string) { }
}


text:
import json
import os
import shutil
import sys
import tempfile
import unittest
from StringIO import StringIO

from lbryum.errors import InvalidPassword
from lbryum.lbrycrd import pw_decode
from lbryum.wallet import NewWallet, WalletStorage

class FakeSynchronizer(object):
    def __init__(self):
        self.store = []

    def add(self, address):
        self.store.append(address)

class WalletTestCase(unittest.TestCase):
    def setUp(self):
        super(WalletTestCase, self).setUp()
        self.user_dir = tempfile.mkdtemp()

        self.wallet_path = os.path.join(self.user_dir, "somewallet")

        self._saved_stdout = sys.stdout
        self._stdout_buffer = StringIO()
        sys.stdout = self._stdout_buffer

    def tearDown(self):
        super(WalletTestCase, self).tearDown()
        shutil.rmtree(self.user_dir)
        # Restore the "real" stdout
        sys.stdout = self._saved_stdout

class TestWalletStorage(WalletTestCase):
    def test_read_dictionary_from_file(self):
        some_dict = {"a": "b", "c": "d"}
        contents = repr(some_dict)
        with open(self.wallet_path, "w") as f:
            contents = f.write(contents)

        storage = WalletStorage(self.wallet_path)
        self.assertEqual("b", storage.get("a"))
        self.assertEqual("d", storage.get("c"))

    def test_write_dictionary_to_file(self):
        storage = WalletStorage(self.wallet_path)

        some_dict = {"a": "b", "c": "d"}

        for key, value in some_dict.items():
            storage.put(key, value)
        storage.write()

        contents = ""
        with open(self.wallet_path, "r") as f:
            contents = f.read()
        self.assertEqual(some_dict, json.loads(contents))

class TestNewWallet(WalletTestCase):
    seed_text = "travel nowhere air position hill peace suffer parent beautiful rise blood power home crumble teach"
    xprv_text = "xprv9s21ZrQH143K2RNUGjxcwJXKSzQeSoCp1GwLFBF8YVQ92TJUX7LXvwoCLVVyrHcPAbAaGQwnFydd8hftzAuTMRCzHue31ftg9wiGkkoVAaT"
    password = "secret"

    first_account_name = "account1"

    import_private_key = "L52XzL2cMkHxqxBXRyEpnPQZGUs3uKiL3R11XbAdHigRzDozKZeW"
    import_key_address = "15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma"

    def setUp(self):
        super(TestNewWallet, self).setUp()
        self.storage = WalletStorage(self.wallet_path)
        self.wallet = NewWallet(self.storage)
        # This cannot be constructed by lbryum at random, it should be safe
        # from eventual collisions.
        self.wallet.add_seed(self.seed_text, self.password)
        self.wallet.create_master_keys(self.password)
        self.wallet.create_main_account()

    def test_wallet_with_seed_is_not_watching_only(self):
        self.assertFalse(self.wallet.is_watching_only())

    def test_wallet_without_seed_is_watching_only(self):
        # We need a new storage , since the default storage was already seeded
        # in setUp()
        new_dir = tempfile.mkdtemp()
        storage = WalletStorage(os.path.join(new_dir, "somewallet"))
        wallet = NewWallet(storage)
        self.assertTrue(wallet.is_watching_only())
        shutil.rmtree(new_dir)  # Don't leave useless stuff in /tmp

    def test_new_wallet_is_deterministic(self):
        self.assertTrue(self.wallet.is_deterministic())

    def test_get_seed_returns_correct_seed(self):
        self.assertEqual(self.wallet.get_seed(self.password), self.seed_text)

    def test_update_password(self):
        new_password = "secret2"
        self.wallet.update_password(self.password, new_password)
        self.wallet.get_seed(new_password)

    def test_encryption(self):
        self.storage.write()
        wallet_data = json.load(open(self.wallet_path, "r"))
        self.assertTrue(wallet_data['use_encryption'])

        # retrieve the encrypted values from wallet storage
        enc_xprv_key = wallet_data['master_private_keys']['x/']
        enc_seed = wallet_data['seed']

        # the xprv key and seed should not be in plain text in the wallet storage
        self.assertNotEqual(self.seed_text, enc_seed)
        self.assertNotEqual(self.xprv_text, enc_xprv_key)

        # decoding the encrypted xprv key and seed should return the original values
        self.assertEqual(self.seed_text, pw_decode(enc_seed, self.password))
        self.assertEqual(self.xprv_text, pw_decode(enc_xprv_key, self.password))
        self.assertEqual(self.xprv_text, self.wallet.get_master_private_key('x/', self.password))

    def test_check_password(self):
        # no errors should occur if the password is valid
        self.wallet.check_password(self.password)

    def test_check_invalid_password(self):
        with self.assertRaises(InvalidPassword):
            self.wallet.check_password('invalid')


text:
<record><header><identifier>froac:149</identifier><datestamp>2013-04-08T02:33:15Z</datestamp><setSpec>notImplemented</setSpec></header><metadata><lom:lom xmlns:lom="http://ltsc.ieee.org/xsd/LOM" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ltsc.ieee.org/xsd/LOM http://ltsc.ieee.org/xsd/lomv1.0/lom.xsd">
<lom:general>
	<lom:identifier>
		<lom:catalog>NBC</lom:catalog>
		<lom:entry>03.01.02</lom:entry>
	</lom:identifier>
	<lom:title>Mapa Político de Oceania</lom:title>
	<lom:language>es</lom:language>
	<lom:description>En esta animación se presenta el mapa político de Oceanía con sus respectivos países y capitales.</lom:description>
	<lom:keyword>Oceania</lom:keyword>
	<lom:coverage>Primaria</lom:coverage>
	<lom:structure>linear</lom:structure>
	<lom:aggregationlevel>2</lom:aggregationlevel>
</lom:general>

<lom:lifecycle>
	<lom:version>1.0</lom:version>
	<lom:status>final</lom:status>
	<lom:contribute>
		<lom:role>author</lom:role>
		<lom:date>2013-04-08</lom:date>
		<lom:entity>GAIA- Grupo de Ambientes Inteligentes Adaptativos</lom:entity>
	</lom:contribute>
</lom:lifecycle>

<lom:metametadata>
	<lom:contribute>
		<lom:role>creator</lom:role>
		<lom:date>2013-04-08</lom:date>
		<lom:entity>GAIA- Grupo de Ambientes Inteligentes Adaptativos</lom:entity>
	</lom:contribute>
	<lom:metadataschema>LOMv1.0</lom:metadataschema>
	<lom:language>es</lom:language>
</lom:metametadata>

<lom:technical>
	<lom:format>rar</lom:format>
	<lom:size>757930</lom:size>
	<lom:location>http://froac.manizales.unal.edu.co/roap/control/download.php?id=174</lom:location>
	<lom:installationremarks>Descomprima el .zip y abra Oceania.html en su navegador web</lom:installationremarks>
	<lom:otherplatformrequirements> </lom:otherplatformrequirements>
	<lom:duration>PT30M</lom:duration>
	<lom:requirements>
		<lom:type>browser</lom:type>
		<lom:name>Google Crome, Mozilla Firefox</lom:name>
		<lom:minimumversion>Todas las versiones</lom:minimumversion>
		<lom:maximumversion>Todas las versiones.</lom:maximumversion>
	</lom:requirements>
</lom:technical>

<lom:educational>
	<lom:interactivitytype>1</lom:interactivitytype>
	<lom:learningresourcetype>simulation</lom:learningresourcetype>
	<lom:interactivitylevel>high</lom:interactivitylevel>
	<lom:semanticdensity>low</lom:semanticdensity>
	<lom:intendedenduserrole>learner</lom:intendedenduserrole>
	<lom:intendedenduserrole>teacher</lom:intendedenduserrole>
	<lom:context>school</lom:context>
	<lom:typicalagerange>9-11 años</lom:typicalagerange>
	<lom:difficulty>medium</lom:difficulty>
	<lom:typicallearningtime>PT40M</lom:typicallearningtime>
	<lom:description>VARK{Visual:90%; Auditivo:0%; Lector:10%; Kinestético:0%}</lom:description>
	<lom:language>es</lom:language>
</lom:educational>

<lom:rights>
	<lom:cost>no</lom:cost>
	<lom:copyrightandotherrestrictions>no</lom:copyrightandotherrestrictions>
	<lom:description> </lom:description>
</lom:rights>

<lom:relation>
	<lom:kind> </lom:kind>
</lom:relation>

<lom:annotation>
	<lom:entity> </lom:entity>
	<lom:date> </lom:date>
	<lom:description> </lom:description>
</lom:annotation>

<lom:classification>
	<lom:purpose> </lom:purpose>
	<lom:description> </lom:description>
</lom:classification>
</lom:lom></metadata></record>


text:
#ifndef MATERIAL_H
#define MATERIAL_H
#include "sound.h"

class Material : public StaticAgent
{
public:
    SAGENT(Material)

    // Agent interface
public:

    void Deserialize(const rapidjson::Value &val) override;
    void onDbLoad(std::shared_ptr<Object> &par, Level *, const glm::vec3 &pos, const GameTimer& gt) override;
    void onDamage(std::shared_ptr<Object> &par, Level *l, const glm::vec3 &pos, const GameTimer& gt) override;
    void onDestroy(std::shared_ptr<Object> &par, Level *l, const glm::vec3 &pos, const GameTimer& gt) override;

    std::string breaksound, hitsound;
    const Sound *hitting, *breaking;
};

REGISTER_AGENT(Material)

#endif // MATERIAL_H


text:
using Common;
using Common.Interfaces.BL;
using CommonData = Common.Data;

namespace BL
{
    /// <summary>
    /// Глобальные данные
    /// </summary>
    public static class Globals
    {
        private static CommonData.Account _curAccount = null;
        private static IRepositoryBL _reposBL = IoC.Resolve<IRepositoryBL>();
        private static IAccountBL _accountBL = IoC.Resolve<IAccountBL>();
        private const string CURRENT_ACCOUNTID = "CurrentAccountID";

        /// <summary>
        /// Текущий торговый счет
        /// </summary>
        public static CommonData.Account CurrentAccount
        {
            get
            {
                return _curAccount;
            }
            set
            {
                if (_curAccount == value) return;

                _curAccount = value;
                if (_curAccount != null)
                {
                    _reposBL.SetIntParam(CURRENT_ACCOUNTID, _curAccount.AccountID);
                    if (_curAccount.AccountType == CommonData.AccountTypes.Real)
                    {
                        IoC.Resolve<IChartSystem>().Initialize();
                    }
                    else if (_curAccount.AccountType == CommonData.AccountTypes.Test)
                    {
                        IoC.Resolve<ISimulSystem>().Initialize();
                    }
                }
            }
        }

        /// <summary>
        /// Инициализация
        /// </summary>
        public static void Initialize()
        {
            int? accID = _reposBL.GetIntParam(CURRENT_ACCOUNTID);
            if (accID != null)
            {
                var account = _accountBL.GetAccountByID(accID.Value);
                CurrentAccount = account;
            }
            else
            {
                CurrentAccount = null;
            }
        }
    }
}


text:
\date{Padova, 11 Luglio 2016}
\begin{letter}{
	Professor Tullio Vardanega \\
	Università degli Studi di Padova \\
	Dipartimento di Matematica Pura ed Applicata \\
	Via Trieste, 63 \\
	35121 Padova
}
\signature{
\begin{center}
\textit{
\Responsabile{} \\
Responsabile \GroupName{}
}
\includegraphics{res/MatteoDiPirro.png}
\end{center}
}
\opening{Egregio Professor Tullio Vardanega,}
\begin{quotation}
con la presente il team \GroupName{} intende comunicare ufficialmente la partecipazione alla Revisione di Accetazione, indetta in data 11 luglio 2016, per la realizzazione del prodotto \\
\begin{center}
\textbf{\ProjectName{}} \\
\end{center} proposto dall'azienda \Proponente, rappresentata dal sig. Alessandro Maccagnan. \\
Allego i seguenti documenti, all'interno dei quali potrà trovare tutti i dettagli relativi al prodotto realizzato:
\begin{itemize}
\item \AnalisiDeiRequisiti{};
\item \Glossario{};
\item \NormeDiProgetto{};
\item \PianoDiProgetto{};
\item \PianoDiQualifica{};
\item \SpecificaTecnica{};
\item \ManualeUtente{};
\item \ManualeSviluppatore{};
\item \ManualeAdmin{}.
\end{itemize}
Oltre alla documentazione viene consegnato anche il codice sorgente relativo al prodotto commissionato, completo della descrizione di quanto è stato implementato.
In accordo con quanto riportato nel \PianoDiProgetto, il team non ha superato il costo preventivato, pari a \euro{} 13.647. \\
Rimango a Sua completa disposizione per ogni ulteriore chiarimento.
\end{quotation}
\closing{Cordiali saluti,}
\end{letter}


text:
<!DOCTYPE html>

  <title>Koheron | TE0745 </title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="author" content="Koheron">
  <meta charset="utf-8">
  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
  <meta http-equiv="Pragma" content="no-cache" />
  <meta http-equiv="Expires" content="0" />

  <link rel="shortcut icon" href="kbird.ico">
  <link rel="stylesheet" type="text/css" href="bootstrap.min.css">
  <link rel="stylesheet" type="text/css" href="_koheron.css">
  <link rel="stylesheet" type="text/css" href="main.css">

    Temperature (°C):

This instrument was built with Koheron Software Development Kit. See settings.


text:
require 'share_notify/exceptions'

module ShareNotify
  # Queries the SHARE search api for an existing record. This assumes the class into which this
  # module is included responds to #url and that in turn is mapped to the docID of the Share
  # document that was originally uploaded via the SHARE push API.
  #
  # @see ShareNotify::PushDocument
  class NotificationQueryService
    def initialize(context)
      self.context = context
    end

    def share_notified?
      response = search("shareProperties.docID:\"#{context.url}\"")
      return if response.status != 200
      return false if response.count < 1
      response.docs.first.doc_id == context.url
    end

    private

      def search(string)
        ShareNotify::SearchResponse.new(api.search(string))
      end

      def api
        ShareNotify::API.new
      end

      attr_reader :context

      def context=(input)
        raise ShareNotify::InitializationError.new(input, [:url]) unless input.respond_to?(:url)
        @context = input
      end
  end
end


text:
#!/usr/bin/env node

var exec = require('child_process').exec;
var budo = require('budo');

function execCmd (cmd) {
  var p = exec(cmd);
  p.stderr.pipe(process.stderr);
  p.stdout.pipe(process.stdout);
  return p;
}

var consts = {
  NAME: 'MAZEVR',
  WATCH: 'examples/**/*',  // Additional files to watch for LiveReload
  ENTRY: 'examples/main.js',
  PORT: 9005
};

var opts = {
  debug: process.env.NODE_ENVIRONMENT !== 'production',
  verbose: true,
  live: true,
  stream: process.stdout,
  host: process.env.HOST,
  port: process.env.PORT || consts.PORT,
  watchGlob: consts.WATCH,
  browserifyArgs: ['-s', consts.NAME],
  middleware: function (req, res, next) {
    next();
  }
};

var app = budo(consts.ENTRY, opts);
app.on('update', function () {
  execCmd('semistandard -v | snazzy');
});


text:
import { Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { NavController } from 'ionic-angular';

// providers
import { ExternalLinkProvider } from '../../../providers/external-link/external-link';
import { LanguageProvider } from '../../../providers/language/language';
import { ProfileProvider } from '../../../providers/profile/profile';
import { WalletProvider } from '../../../providers/wallet/wallet';

@Component({
  selector: 'page-language',
  templateUrl: 'language.html'
})
export class LanguagePage {
  public currentLanguage;
  public languages;

  constructor(
    private navCtrl: NavController,
    private languageProvider: LanguageProvider,
    private externalLinkProvider: ExternalLinkProvider,
    private profileProvider: ProfileProvider,
    private walletProvider: WalletProvider,
    private translate: TranslateService
  ) {
    this.currentLanguage = this.languageProvider.getCurrent();
    this.languages = this.languageProvider.getAvailables();
  }

  public openExternalLink(): void {
    let url = 'https://crowdin.com/project/copay';
    let optIn = true;
    let title = this.translate.instant('Open Translation Community');
    let message = this.translate.instant(
      'You can make contributions by signing up on our Crowdin community translation website. We're looking forward to hearing from you!'
    );
    let okText = this.translate.instant('Open Crowdin');
    let cancelText = this.translate.instant('Go Back');
    this.externalLinkProvider.open(
      url,
      optIn,
      title,
      message,
      okText,
      cancelText
    );
  }

  public save(newLang: string): void {
    this.languageProvider.set(newLang);
    this.navCtrl.pop();
    setTimeout(() => {
      const opts = {
        showHidden: true
      };
      let wallets = this.profileProvider.getWallets(opts);
      this.walletProvider.updateRemotePreferences(wallets);
    }, 1000);
  }
}


text:
Perform a linear interpolation of this vector's position towards pnt. p controls the amount to move towards pnt. p is normally between 0 and 1 and where 0 means stay the original position and 1 means move all the way to pnt, but you can also have p greater than 1 overshoot pnt, or less than 0 to move backwards away from pnt.

```cpp
ofVec2f v1( 0, 5 );
ofVec2f v2( 10, 10 );
// go go gadget zeno
v1.interpolate( v2, 0.5 ); // v1 is now (5, 7.5)
v1.interpolate( v2, 0.5 ); // v1 is now (7.5, 8.75)
v1.interpolate( v2, 0.5 ); // v1 is now (8.75, 9.375)
v1.interpolate( v2, 0.5 ); // v1 is now (9.375, 9.6875)
```


text:
{-# LANGUAGE TypeFamilies #-}

module OverDirectThisModA (C, D)
where

import Data.Kind (Type)

data family C a b :: Type

type family D a b :: Type


text:
"""
sentry.models.group
~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function

import logging
import math
import six
import time
import warnings

from base64 import b16decode, b16encode
from datetime import timedelta
from django.core.urlresolvers import reverse
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _

from sentry.app import buffer
from sentry.constants import (
    DEFAULT_LOGGER_NAME, LOG_LEVELS, MAX_CULPRIT_LENGTH
)
from sentry.db.models import (
    BaseManager, BoundedIntegerField, BoundedPositiveIntegerField,
    FlexibleForeignKey, Model, GzippedDictField, sane_repr
)
from sentry.utils.http import absolute_uri
from sentry.utils.strings import truncatechars, strip

# TODO(dcramer): pull in enum library
class GroupStatus(object):
    UNRESOLVED = 0
    RESOLVED = 1
    MUTED = 2
    PENDING_DELETION = 3
    DELETION_IN_PROGRESS = 4
    PENDING_MERGE = 5

class GroupManager(BaseManager):
    use_for_related_fields = True

    def from_kwargs(self, project, **kwargs):
        from sentry.event_manager import EventManager

        manager = EventManager(kwargs)
        manager.normalize()
        return manager.save(project)

    def add_tags(self, group, tags):
        from sentry.models import TagValue, GroupTagValue

        project_id = group.project_id
        date = group.last_seen

        for tag_item in tags:
            if len(tag_item) == 2:
                (key, value), data = tag_item, None
            else:
                key, value, data = tag_item

            buffer.incr(TagValue, {
                'times_seen': 1,
            }, {
                'project_id': project_id,
                'key': key,
                'value': value,
            }, {
                'last_seen': date,
                'data': data,
            })

            buffer.incr(GroupTagValue, {
                'times_seen': 1,
            }, {
                'group_id': group.id,
                'project_id': project_id,
                'key': key,
                'value': value,
            }, {
                'last_seen': date,
            })

class Group(Model):
    """
    Aggregated message which summarizes a set of Events.
    """
    __core__ = False

    project = FlexibleForeignKey('sentry.Project', null=True)
    logger = models.CharField(
        max_length=64, blank=True, default=DEFAULT_LOGGER_NAME, db_index=True)
    level = BoundedPositiveIntegerField(
        choices=LOG_LEVELS.items(), default=logging.ERROR, blank=True,
        db_index=True)
    message = models.TextField()
    culprit = models.CharField(
        max_length=MAX_CULPRIT_LENGTH, blank=True, null=True,
        db_column='view')
    num_comments = BoundedPositiveIntegerField(default=0, null=True)
    platform = models.CharField(max_length=64, null=True)
    status = BoundedPositiveIntegerField(default=0, choices=(
        (GroupStatus.UNRESOLVED, _('Unresolved')),
        (GroupStatus.RESOLVED, _('Resolved')),
        (GroupStatus.MUTED, _('Muted')),
    ), db_index=True)
    times_seen = BoundedPositiveIntegerField(default=1, db_index=True)
    last_seen = models.DateTimeField(default=timezone.now, db_index=True)
    first_seen = models.DateTimeField(default=timezone.now, db_index=True)
    first_release = FlexibleForeignKey('sentry.Release', null=True)
    resolved_at = models.DateTimeField(null=True, db_index=True)
    # active_at should be the same as first_seen by default
    active_at = models.DateTimeField(null=True, db_index=True)
    time_spent_total = BoundedIntegerField(default=0)
    time_spent_count = BoundedIntegerField(default=0)
    score = BoundedIntegerField(default=0)
    is_public = models.NullBooleanField(default=False, null=True)
    data = GzippedDictField(blank=True, null=True)

    objects = GroupManager()

    class Meta:
        app_label = 'sentry'
        db_table = 'sentry_groupedmessage'
        verbose_name_plural = _('grouped messages')
        verbose_name = _('grouped message')
        permissions = (
            ("can_view", "Can view"),
        )
        index_together = (
            ('project', 'first_release'),
        )

    __repr__ = sane_repr('project_id')

    def __unicode__(self):
        return "(%s) %s" % (self.times_seen, self.error())

    def save(self, *args, **kwargs):
        if not self.last_seen:
            self.last_seen = timezone.now()
        if not self.first_seen:
            self.first_seen = self.last_seen
        if not self.active_at:
            self.active_at = self.first_seen
        if self.message:
            # We limit what we store for the message body
            self.message = self.message.splitlines()[0][:255]
        super(Group, self).save(*args, **kwargs)

    def get_absolute_url(self):
        return absolute_uri(reverse('sentry-group', args=[
            self.organization.slug, self.project.slug, self.id]))

    @property
    def avg_time_spent(self):
        if not self.time_spent_count:
            return
        return float(self.time_spent_total) / self.time_spent_count

    def is_over_resolve_age(self):
        resolve_age = self.project.get_option('sentry:resolve_age', None)
        if not resolve_age:
            return False
        return self.last_seen < timezone.now() - timedelta(hours=int(resolve_age))

    def is_muted(self):
        return self.get_status() == GroupStatus.MUTED

    def is_resolved(self):
        return self.get_status() == GroupStatus.RESOLVED

    def get_status(self):
        if self.status == GroupStatus.UNRESOLVED and self.is_over_resolve_age():
            return GroupStatus.RESOLVED
        return self.status

    def get_share_id(self):
        return b16encode('{}.{}'.format(self.project_id, self.id)).lower()

    @classmethod
    def from_share_id(cls, share_id):
        try:
            project_id, group_id = b16decode(share_id.upper()).split('.')
        except ValueError:
            raise cls.DoesNotExist
        return cls.objects.get(project=project_id, id=group_id)

    def get_score(self):
        return int(math.log(self.times_seen) * 600 + float(time.mktime(self.last_seen.timetuple())))

    def get_latest_event(self):
        from sentry.models import Event

        if not hasattr(self, '_latest_event'):
            try:
                self._latest_event = Event.objects.filter(
                    group=self,
                ).order_by('-datetime')[0]
            except IndexError:
                self._latest_event = None
        return self._latest_event

    def get_unique_tags(self, tag, since=None, order_by='-times_seen'):
        # TODO(dcramer): this has zero test coverage and is a critical path
        from sentry.models import GroupTagValue

        queryset = GroupTagValue.objects.filter(
            group=self,
            key=tag,
        )
        if since:
            queryset = queryset.filter(last_seen__gte=since)
        return queryset.values_list(
            'value',
            'times_seen',
            'first_seen',
            'last_seen',
        ).order_by(order_by)

    def get_tags(self, with_internal=True):
        from sentry.models import GroupTagKey, TagKey
        if not hasattr(self, '_tag_cache'):
            group_tags = GroupTagKey.objects.filter(
                group=self,
                project=self.project,
            )
            if not with_internal:
                group_tags = group_tags.exclude(key__startswith='sentry:')

            group_tags = list(group_tags.values_list('key', flat=True))

            tag_keys = dict(
                (t.key, t)
                for t in TagKey.objects.filter(
                    project=self.project,
                    key__in=group_tags
                )
            )

            results = []
            for key in group_tags:
                try:
                    tag_key = tag_keys[key]
                except KeyError:
                    label = key.replace('_', ' ').title()
                else:
                    label = tag_key.get_label()

                results.append({
                    'key': key,
                    'label': label,
                })

            self._tag_cache = sorted(results, key=lambda x: x['label'])

        return self._tag_cache

    def error(self):
        return self.message
    error.short_description = _('error')

    def has_two_part_message(self):
        message = strip(self.message)
        return '\n' in message or len(message) > 100

    @property
    def title(self):
        culprit = strip(self.culprit)
        if culprit:
            return culprit
        return self.message

    @property
    def message_short(self):
        message = strip(self.message)
        if not message:
            message = '<unlabeled message>'
        else:
            message = truncatechars(message.splitlines()[0], 100)
        return message

    @property
    def organization(self):
        return self.project.organization

    @property
    def team(self):
        return self.project.team

    @property
    def checksum(self):
        warnings.warn('Group.checksum is no longer used', DeprecationWarning)
        return ''

    def get_email_subject(self):
        return '[%s] %s: %s' % (
            self.project.get_full_name().encode('utf-8'),
            six.text_type(self.get_level_display()).upper().encode('utf-8'),
            self.message_short.encode('utf-8')
        )


text:
layout: archive
permalink: /
title: "Technology innovation & adult learning"
---

_Making / Learning / Work was an adult learning innovation project hosted at the MIT Media Lab from September 2014 to May 2016. This site is an archive of the project documentation. The research work will be continued as part of a new Learning Innovation Fellowship at the Media Lab._

In the US, 36 Million adults have low basic literacy and numeracy skills. Many are stuck in low-paying jobs or unemployment. This is a challenge not just for the individuals and families directly affected, but for the US economy as a whole. "Learning" is the most promising pathway towards family-supporting employment and better futures. [[Read More]]({{site.baseurl}}/about/)

# Current Prototypes

# Project Updates

{% for post in site.posts %}
	{% include post-grid.html %}
{% endfor %}


text:
using System;
using VsxFactory.Modeling.VisualStudio;

namespace VsxFactory.Modeling.VisualStudio.Synchronization
{
    public interface IProjectCodeTypesListener
    {
        void UnregisterAllProjects();
        void RegisterProject(ProjectNode project);
        void UnregisterProject(ProjectNode project);
        System.Collections.Generic.IEnumerable<EnvDTE.CodeType> AllKnownTypes { get; }
        void Dispose();
        event AttributeAdded OnAttributeAdded;
        event AttributeChanged OnAttributeChanged;
        event AttributeRemoved OnAttributeRemoved;
        event BaseTypeChanged OnBaseTypeChanged;
        event ElementPropertiesChanged OnElementPropertiesChanged;
        event FieldAdded OnFieldAdded;
        event MemberRemoved OnFieldRemoved;
        event FieldRenamed OnFieldRenamed;
        event MethodAdded OnMethodAdded;
        event MemberRemoved OnMethodRemoved;
        event MethodRenamed OnMethodRenamed;
        event NestedTypeAdded OnNestedTypeAdded;
        event ParameterAdded OnParameterAdded;
        event ParameterRemoved OnParameterRemoved;
        event ParameterRenamed OnParameterRenamed;
        event PropertyAdded OnPropertyAdded;
        event MemberRemoved OnPropertyRemoved;
        event TypeAdded OnTypeAdded;
        event TypeRemoved OnTypeRemoved;
        event TypeRenamed OnTypeRenamed;
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>BlockSnake: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

BlockSnake

Main Page

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

Fruit Member List

This is the complete list of members for Fruit, including all inherited members.

assetManager	Fruit	private

canCollide() const 	GameObject

doesCollide	GameObject	protected

draw(float aspect) override	Fruit	protectedvirtual

findRandomPlace()	Fruit	protectedvirtual

Fruit(AssetManager *assetManager, Vector3f position)	Fruit

fruitProgram	Fruit	private

getCurrentMat(float aspect)	GameObject	protected

getPosition() const 	GameObject

mv_location	Fruit	private

onCollision(GameObject *col) override	Fruit	protectedvirtual

onDestroy() override	Fruit	protectedvirtual

onKeyDown(unsigned short keycode)	GameObject	protectedvirtual

position	GameObject	protected

primitive	Fruit	private

rotation	GameObject	protected

scale	GameObject	protected

texture	Fruit	private

update(float tpf) override	Fruit	protectedvirtual

~GameObject()	GameObject	virtual

<address class="footer">
Generated by

 1.8.10
</address>