text:
package org.swellrt.beta.model.local;

import java.util.ArrayList;
import java.util.List;

import org.swellrt.beta.common.SException;
import org.swellrt.beta.model.SMutationHandler;
import org.swellrt.beta.model.SList;
import org.swellrt.beta.model.SMap;
import org.swellrt.beta.model.SNode;
import org.swellrt.beta.model.SText;
import org.swellrt.beta.model.SUtils;
import org.swellrt.beta.model.SVisitor;
import org.swellrt.beta.model.js.HasJsProxy;
import org.swellrt.beta.model.js.Proxy;
import org.swellrt.beta.model.js.SListProxyHandler;

import jsinterop.annotations.JsIgnore;

public class SListLocal implements SList<SNode>, HasJsProxy {

  private List<SNode> list = new ArrayList<SNode>();
  private Proxy proxy = null;

  @Override
  public SNode pick(int index) throws SException {
    return list.get(index);
  }

  @Override
  public SList<SNode> add(Object object) throws SException {
    SNode node = SUtils.castToSNode(object);
    list.add(node);
    return this;
  }

  @Override
  public SList<SNode> addAt(Object object, int index) throws SException {
    SNode node = SUtils.castToSNode(object);
    list.add(index, node);
    return this;
  }

  @Override
  public SList<SNode> remove(int index) throws SException {
    list.remove(index);
    return this;
  }

  @Override
  public int indexOf(SNode node) throws SException {
    return list.indexOf(node);
  }

  @Override
  public void clear() throws SException {
    list.clear();
  }

  @Override
  public boolean isEmpty() {
    return list.isEmpty();
  }

  @Override
  public int size() {
    return list.size();
  }

  @Override
  public Iterable<SNode> values() {
    return list;
  }

  public Object js() {
    if (proxy == null)
      proxy = new Proxy(this, new SListProxyHandler());
    return proxy;
  }

  //
  // Js Proxy
  //

  @Override
  public Proxy getJsProxy() {
    return proxy;
  }

  @Override
  public void setJsProxy(Proxy proxy) {
    this.proxy = proxy;
  }

  @SuppressWarnings({ "rawtypes", "unchecked" })
  @JsIgnore
  @Override
  public void accept(SVisitor visitor) {
    visitor.visit(this);
  }

  //
  // -----------------------------------------------------
  //

  @Override
  public void set(String path, Object value) {
    SNode.set(this, path, value);
  }

  @Override
  public void push(String path, Object value) {
    SNode.push(this, path, value);
  }

  @Override
  public Object pop(String path) {
    return SNode.pop(this, path);
  }

  @Override
  public int length(String path) {
    return SNode.length(this, path);
  }

  @Override
  public boolean contains(String path, String property) {
    return SNode.contains(this, path, property);
  }

  @Override
  public void delete(String path) {
    SNode.delete(this, path);
  }

  @Override
  public Object get(String path) {
    return SNode.get(this, path);
  }

  @Override
  public SNode node(String path) throws SException {
    return SNode.node(this, path);
  }

  @Override
  public SMap asMap() {
    throw new IllegalStateException("Node is not a map");
  }

  @Override
  public SList<? extends SNode> asList() {
    return this;
  }

  @Override
  public String asString() {
    throw new IllegalStateException("Node is not a string");
  }

  @Override
  public double asDouble() {
    throw new IllegalStateException("Node is not a number");
  }

  @Override
  public int asInt() {
    throw new IllegalStateException("Node is not a number");
  }

  @Override
  public boolean asBoolean() {
    throw new IllegalStateException("Node is not a boolean");
  }

  @Override
  public SText asText() {
    throw new IllegalStateException("Node is not a text");
  }

  @Override
  public void addListener(SMutationHandler h, String path) throws SException {
    throw new IllegalStateException("Local nodes don't support event listeners");
  }

  @Override
  public void listen(SMutationHandler h) throws SException {
    throw new IllegalStateException("Local nodes don't support event listeners");
  }

  @Override
  public void removeListener(SMutationHandler h, String path) throws SException {
    throw new IllegalStateException("Local nodes don't support event listeners");
  }

  @Override
  public void unlisten(SMutationHandler h) throws SException {
    throw new IllegalStateException("Local nodes don't support event listeners");
  }

}


text:
Basically stream is an array wrapper that adds many useful methods and properties (`filter`, `iterate`, `map`, `fold`, `flatMap`, `first`, `second` ...  , `last`, `empty` etc.).

Inspired by Javascript and Ruby arrays, Scala collections.

Complete documentation, unit tests with 100% code coverage, Travis CI integration (automatic testing, asdoc and coverage report generation).

See [latest release](https://github.com/kemsky/stream/releases/latest).

## Creating Stream
```as3
var s:Stream = $(1, 2, 3);
var s:Stream = $([1, 2, 3]);
var s:Stream = $(new ArrayCollection([1, 2, 3]));
var s:Stream = $(new ArrayList([1, 2, 3]));
var s:Stream = $(new Stream([1, 2, 3]));

var s:Stream = Stream.from([1, 2, 3]);
var s:Stream = Stream.of(1, 2, 3);

//All expressions are equivalent to:
var s:Stream = new Stream([1, 2, 3])

//Create from iterable object
var obj:Object = {name1: "first", name2: "second"};
var s:Stream = Stream.from(obj);
trace(s);
//prints Stream{Stream{"name1", "first"}, Stream{"name2", "second"}}

//create stream from object property names or property values
var s:Stream = Stream.fromKeys(obj);
trace(s);
//prints Stream{"name1", "name2"}

var s:Stream = Stream.fromValues(obj);
trace(s);
//prints Stream{"first", "second"}

//create from XMLList or XML
var s:Stream = $(<root><item>1</item><item>2</item></root>);
var s:Stream = Stream.from(<root><item>1</item><item>2</item></root>);
trace(s);
//prints Stream{<item>1</item>, <item>2</item>}
```

## Iteration and element access
Stream extends Proxy class and provides the same iteration capabilities as standard Array:
```as3
var s:Stream = $(1, 2, 3);
for each (var item:* in s)
{
   trace(item);
}

for (var i:int = 0; i < s.length; i++)
{
   trace(s[i]);
   trace(s.getItem(i));
}
//prints 1, 2, 3

//iterator
var values:Iterator = s.iterator();
while (values.hasNext)
{
   var n:Number = values.next();
   //values.item;
   //values.index;
   //values.remove();
   //values.end();
}
//or use standard for each loop
for each (var item:Number in values)
{
   //values.item;
   //values.index;
   //values.remove();
   //values.end();
}

//set item at index 0
s.setItem(5, 0);
s[0] = 5;
s.first = 5;
//last item also has index -1, item before last -2 and etc. (Ruby-like)
s[-3] = 5;

//remove item from Stream
delete s[0];
s.removeItem(0);
```
*Stream is about 10x slower when accessed by index (`[index]`) and it seems to be Proxy overhead.
If you need better performance (3x slower than Array) use methods to access Stream items: `getItem(index)` and `setItem(value, index)`.*

## Convert Stream to any collection
```as3
var s:Stream = Stream.of(1, 2, 3);

var collection:ArrayCollection = s.collection();
var array:Array = s.array();
var vector:Vector.<Object> = s.vector();
var list:ArrayList = s.list();
```

## Array-like methods
Stream has all methods(every, forEach, map, some, slice, splice, push, pop etc.) that standard Array has:
```as3
var s:Stream = $(1, 2, 3);
s.forEach(function(item:Number):void
{
    trace(item);
});
//or
s.forEach(function(item:Number, index:uint):void
{
    trace(item);
});
//or
s.forEach(function(item:Number, index:uint, stream:Stream):void
{
    trace(item);
});
//prints 1, 2, 3
```

## foldLeft, foldRight methods

Javascript Array has `reduce` method which is quite similar.
```as3
var sum2:Number = $(0, 1, 2, 3, 4).foldRight(function (prev:Number, current:Number):Number
{
   return prev + current;
}, 10);
trace(sum2);
//prints 20
```

## flatMap, flatten
```as3
var s:Stream = new Stream([1, 2, 3], $(4, 5, 6), new ArrayCollection([7, 8, 9]));
var mapped:Stream = s.flatMap(function(item:*):*
{
   //this is nop callback, used just for example
   //you can use short form: s.flatten();
   return item;
});
trace(mapped);
//prints 1, 2, 3, 4, 5, 6, 7, 8, 9
```

## Various filtering methods

```as3
//filter out null, NaN or undefined items
var s:Stream = Stream.of(null, NaN, undefined).compact();
trace(s, s.length);
//prints Stream{}, 0

public class Item
{
  public var name:String;
  public var price:Number;
}

var item1:Item = new Item("1", 1);
var item2:Item = new Item("2", 2);
var s:Stream = $(item1, item2);

// 1. using custom callback
var result:Stream = s.filter(function(item:Item):Boolean{
   return item.price > 1;
});

// 2. using provided global functions(can compare Boolean, Number, Date, XML, String types)
//    supports nested properties i.e. member("prop.prop.prop")
var result:Stream = s.filter(gt(member("price"), 1));

// 3. using Proxy magick and global functions
var result:Stream = s.price(gt(_, 1));

//all three provide identical results
```

## E4X descendant accessor operator `..`
Short alternative to `map` method:
```as3
var item1:Item = new Item("car", 1);
var item2:Item = new Item("truck", 2);
var s:Stream = $(item1, item2);

var prices:Stream = s..price;

trace(prices);
//prints 1,2
```

## Many other handy methods and properties
Stream can be converted to Object, Dictionary or custom class (using `group` method).
```as3
var item1:Item = new Item("1", 1);
var item2:Item = new Item("2", 2);
var s:Stream = $(item1, item2);

var d:Dictionary = s.dictionary("name");

trace(d["1"], item1);
//prints first item

trace(s.second);
//prints second item

trace(s.unique);
//prints true

trace(s.contains(item1));
//prints true

trace(s.count(function(item:Item):Boolean
{
   return item.price > 1;
}));
//or
trace(s.count(gt(member("price"), 1)));
//prints 1
```

See also: `group`,`partition`,`fill`,`find`,`findIndex`, `drop`, `zip`, `zipWithIndex`, `skip` etc.

## Build

You can build library using **Intelij Idea** or **Apache Maven**.
 - Compile `mvn compile -Dtag.name=<...>`
 - Run tests `mvn test -DflashPlayer.command="<path to flash player projector>"`
 - Generate coverage report `mvn flexmojos:coverage-report -DflashPlayer.command="<path to flash player projector>"`
 - Generate documentation: `mvn flexmojos:asdoc`

redpajama_set_name: RedPajamaGithub


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

namespace ICSharpCode.NRefactory.CSharp
{
	/// <summary>
	/// Expression as TypeReference
	/// </summary>
	public class AsExpression : Expression
	{
		public readonly static TokenRole AsKeywordRole = new TokenRole ("as");

		public Expression Expression {
			get { return GetChildByRole (Roles.Expression); }
			set { SetChildByRole(Roles.Expression, value); }
		}

		public CSharpTokenNode AsToken {
			get { return GetChildByRole (AsKeywordRole); }
		}

		public AstType Type {
			get { return GetChildByRole (Roles.Type); }
			set { SetChildByRole(Roles.Type, value); }
		}

		public AsExpression ()
		{
		}

		public AsExpression (Expression expression, AstType type)
		{
			AddChild (expression, Roles.Expression);
			AddChild (type, Roles.Type);
		}

		public override void AcceptVisitor (IAstVisitor visitor)
		{
			visitor.VisitAsExpression (this);
		}

		public override T AcceptVisitor<T> (IAstVisitor<T> visitor)
		{
			return visitor.VisitAsExpression (this);
		}

		public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
		{
			return visitor.VisitAsExpression (this, data);
		}

		protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
		{
			AsExpression o = other as AsExpression;
			return o != null && this.Expression.DoMatch(o.Expression, match) && this.Type.DoMatch(o.Type, match);
		}
	}
}


text:
import { Component } from '@angular/core';

@Component ({
    selector: 'my-footer-component',
    templateUrl: 'client/components/shared/footer.component.html'
})

export class FooterComponent {
    title: string = 'My'
}


text:
sam_file = ARGV[0]
dataset = ARGV[1]
species = ARGV[2]

readnames_by_group = {}
d = "/project/itmatlab/aligner_benchmark/dataset/#{species}/dataset_#{dataset}/junction/*cig"
puts d
# This yields full path and file name
Dir[d].each do |fn|
	File.open(fn).each do |l|
		readnames_by_group[l.split("\t")[0]]  = fn.split("/")[-1]
	end
end
# puts readnames_by_group

files = {}
filenames = []
unique = readnames_by_group.values.uniq
unique.each do |names|
	puts names
	filenames << "#{sam_file}_#{names}"
	files[names] = File.open("#{sam_file}_#{names}", "w")
end

puts "files: #{files}"
puts "filenames: #{filenames.join("\t")}"

File.open(sam_file).each do |line|
	name = line.split("\t")[0]
	if readnames_by_group[name]
		files[readnames_by_group[name]].puts line
	end
end

files.each_value do |f|
	f.close()
end

Dir["/project/itmatlab/aligner_benchmark/dataset/#{species}/dataset_#{dataset}/junction/*cig"].each do |fn|
	ind = filenames.index {|x| x =~ /#{fn.split("/")[-1]}$/}
	puts ind
	`sort -t'.' -k 2n #{filenames[ind]} > #{filenames[ind]}_s`
	`ruby #{File.expand_path(File.dirname(__FILE__))}/compare2truth_multi_mappers.rb -s #{fn} #{filenames[ind]}_s > #{filenames[ind]}_comp_res_multi_mappers.txt`
	`ruby #{File.expand_path(File.dirname(__FILE__))}/compare2truth.rb -s #{fn} #{filenames[ind]}_s > #{filenames[ind]}_comp_res.txt`
end


text:
package com.jmethods.catatumbo.impl;

import com.jmethods.catatumbo.Embeddable;

/**
 * Objects of this class contain metadata of an {@link Embeddable} class.
 *
 * @author Sai Pullabhotla
 *
 */
public class EmbeddableMetadata extends MetadataBase {

  /**
   * Creates a new instance of EmbeddableMetadata.
   *
   * @param clazz
   *          the Embeddable class
   */
  public EmbeddableMetadata(Class<?> clazz) {
    super(clazz);
  }

}


text:
package com.coolweather.app.util;

public class Test {
public static void main(String[] args) {
	System.out.println("hehe");
}
}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <title>Test case for text-decoration shorthands</title>
        <meta name="assert" content="text-decoration: text-decoration-thickness is parsed as part of the text-decoration shorthand">
        <link rel="author" title="Charlie Marlow" href="mailto:cmarlow@mozilla.com">
        <link rel="author" title="Mozilla" href="https://www.mozilla.org">
        <link rel="help" href="https://drafts.csswg.org/css-text-decor-4/#text-decoration-width-property">
        <link rel="match" href="reference/text-decoration-shorthands-002-ref.html">

Test passes if a thick green underline is rendered

XX XX


text:
.class public Ljava/lang/InstantiationException;
.super Ljava/lang/ReflectiveOperationException;
.source "InstantiationException.java"

# static fields
.field private static final serialVersionUID:J = -0x7527c1d8b22a7a76L

# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 31
    invoke-direct {p0}, Ljava/lang/ReflectiveOperationException;-><init>()V

    .line 32
    return-void
.end method

.method constructor <init>(Ljava/lang/Class;)V
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/Class",
            "<*>;)V"
        }
    .end annotation

    .prologue
    .line 53
    .local p1, "clazz":Ljava/lang/Class;, "Ljava/lang/Class<*>;"
    invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, v0}, Ljava/lang/ReflectiveOperationException;-><init>(Ljava/lang/String;)V

    .line 54
    return-void
.end method

.method public constructor <init>(Ljava/lang/String;)V
    .locals 0
    .param p1, "detailMessage"    # Ljava/lang/String;

    .prologue
    .line 42
    invoke-direct {p0, p1}, Ljava/lang/ReflectiveOperationException;-><init>(Ljava/lang/String;)V

    .line 43
    return-void
.end method


text:
require 'spec_helper'
module Alf
  module Shell
    describe Main, "-I" do

      before do
        Path.dir.chdir
        subject
      end

      let(:cmd){ Main.new }

      subject{
        cmd.parse_options(argv)
        cmd
      }

      context 'when no explicitly set' do
        let(:argv){ [] }

        it 'should have defaults only' do
          cmd.config.load_paths.should eq(["a_load_path"])
        end
      end

      context 'when specified multiple times' do
        let(:argv){ ["-Ilib", "-Ispec"] }

        it 'should have defaults only' do
          cmd.config.load_paths.should eq(["a_load_path", "lib", "spec"])
        end
      end

    end
  end
end


text:
"""
Facility Management template tags
=================================

Tags for including management app javascript assets in a template. To use:

.. code-block:: html

    {% load facility_management_tags %}

    <!-- Render inclusion tag for frontend JS elements -->
    {% facility_management_assets %}

"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals

from django import template

from ..hooks import FacilityManagementSyncHook
from kolibri.core.webpack.utils import webpack_asset_render

register = template.Library()

@register.simple_tag()
def facility_management_assets():
    """
    Using in a template will inject script tags that include the javascript
    assets defined by any concrete hook that subclasses
    FacilityManagementSyncHook.

    :return: HTML of script tags to insert into the template
    """
    return webpack_asset_render(FacilityManagementSyncHook, async=False)


text:
def cf_servicebus(cli_ctx, **_):
    from azure.cli.core.commands.client_factory import get_mgmt_service_client
    from azure.cli.core.profiles import ResourceType
    return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_SERVICEBUS)

def namespaces_mgmt_client_factory(cli_ctx, _):
    return cf_servicebus(cli_ctx).namespaces

def queues_mgmt_client_factory(cli_ctx, _):
    return cf_servicebus(cli_ctx).queues

def topics_mgmt_client_factory(cli_ctx, _):
    return cf_servicebus(cli_ctx).topics

def subscriptions_mgmt_client_factory(cli_ctx, _):
    return cf_servicebus(cli_ctx).subscriptions

def rules_mgmt_client_factory(cli_ctx, _):
    return cf_servicebus(cli_ctx).rules

def disaster_recovery_mgmt_client_factory(cli_ctx, _):
    return cf_servicebus(cli_ctx).disaster_recovery_configs

def migration_mgmt_client_factory(cli_ctx, _):
    return cf_servicebus(cli_ctx).migration_configs

def private_endpoint_connections_mgmt_client_factory(cli_ctx, _):
    return cf_servicebus(cli_ctx).private_endpoint_connections

def private_link_mgmt_client_factory(cli_ctx, _):
    return cf_servicebus(cli_ctx).private_link_resources


text:
'''
Nagios/Icinga plugin for monitoring
free ip in IPmanager 5

example: python check_mgr5_free_ip.py -w 500 -c 300 -u vz

Andrey Skopenko <andrey@skopenko.net> @ 2014
'''

from optparse import OptionParser
import logging
from sys import exit
import subprocess as sp

def command(cmd):
    '''run rsync cmd'''

    p = sp.Popen(cmd, shell=True, stdout=sp.PIPE, stderr=sp.PIPE)
    st = p.wait()
    logging.debug('command (%s) return %s' % (cmd, st))
    if st > 0:
        logging.error(p.stderr.read().strip())
        print 'CRITICAL: plugin error!'
        exit(2)
    return p.stdout

def main():
    p = OptionParser(description='nagios script for get free '
                                 'ips from IPmanager 4',
                     prog='check_ipmgr5_free_ip.py',
                     version='0.1',
                     usage='%prog [-d] -w WARN -c CRIT -u USER')
    p.add_option('-w', '--warning', action='store',
                 help='ip num warning', default=None)
    p.add_option('-c', '--critical', action='store',
                 help='ip num critical', default=None)
    p.add_option('-u', '--user', action='store',
                 help='filter user', default=None)
    p.add_option('-d', '--debug', action='store_true',
                 help='verbose output', default=None)
    options, arguments = p.parse_args()

    defaults = {'warning':15, 'critical':10,
                'user':'vds', 'debug':False}
    config = {}
    config.update(defaults)
    # options override config
    config.update(dict([(k, v) for k, v in vars(options).items()
                  if v is not None]))

    level = logging.INFO
    debug = config.get('debug')
    if debug:
        level = logging.DEBUG
    logging.basicConfig(format='%(asctime)s %(message)s', level=level)
    logging.debug('config: %r', config)
    logging.debug('options: %r', vars(options))

    ip_num = 0
    for line in command('/usr/local/mgr5/sbin/mgrctl -m ipmgr permstat'):
        args = line.strip().split()
        if len(args) < 5:
            continue
        if args[5] == config['user']:
            start_range = int(args[0].split('.')[-1])
            end_range = int(args[2].split('.')[-1])
            ip_num += end_range - start_range

    ip_cur = 0
    for line in command('/usr/local/mgr5/sbin/mgrctl -m ipmgr userstat'):
        args = line.strip().split()
        if len(args) < 3:
            continue
        if args[1].split('=')[1] == config['user']:
            ip_cur = int(args[2].split('=')[1])

    if not ip_num:
        print 'CRITICAL: user %s has no ip range!' % config['user']
        exit(2)

    ip_diff = ip_num - ip_cur
    warning = int(config['warning'])
    critical = int(config['critical'])

    if ip_diff >= warning:
        print '[OK free ip diff %s > %s]' % (ip_diff, warning)
        exit(0)
    elif ip_diff < warning and ip_diff > critical:
        print '[WARNING free ip diff %s < %s < %s]' % (warning,
                                                       ip_diff, critical)
        exit(1)
    elif ip_diff <= critical:
        print '[CRITICAL free ip diff %s < %s]' % (ip_diff, critical)
        exit(2)

if __name__ == '__main__':
    main()


text:
const { property, forall} = require('jsverify');
const assert = require('assert');
const laws = require('../../../helpers/fantasy-land-laws');
const Maybe = require('folktale/maybe');
const { Just, Nothing } = Maybe;

describe('Maybe', () => {

  describe('Conversions', () => {
    property('Just#fromResult', 'json', (a) => {
      return Maybe.fromResult(Just(a).toResult()).equals(Just(a));
    });
    property('Nothing#fromResult', 'json', (a) => {
      return Maybe.fromResult(Nothing().toResult()).equals(Nothing());
    });
  });

  describe('#map(f)', () => {
    property('Just(a).map(f) = Just(f(a))', 'nat', 'nat -> nat', (a, f) => {
      return Just(a).map(f).equals(Just(f(a)));
    });

    it('Nothing().map(f) = Nothing()', () => {
      let called = false;
      const f = () => { called = true };
      Nothing().map(f);
      $ASSERT(called === false);
    });
  });

  describe('#apply(a)', () => {
    property('Just(f).apply(a) = Just(f(a))', 'nat', 'nat -> nat', (a, f) => {
      return Just(f).apply(Just(a)).equals(Just(f(a)));
    });

    property('Just(f).apply(Nothing()) = Nothing()', 'nat -> nat', (f) => {
      return Just(f).apply(Nothing()).equals(Nothing());
    })

    property('Nothing().apply(a) = Nothing()', 'nat', (a) => {
      return Nothing().apply(Just(a)).equals(Nothing());
    });
  });

  describe('#of(a)', () => {
    property('Maybe.of(a) = Just(a)', 'json', (a) => {
      return Maybe.of(a).equals(Just(a));
    });
  });

  describe('#chain(f)', () => {
    property('Just(a).chain(f) = f(a)', 'json', 'json -> json', (a, f) => {
      return Just(a).chain(x => Just(f(x))).equals(Just(f(a)));
    });

    property('Nothing().chain(f) = Nothing()', 'json -> json', (f) => {
      return Nothing().chain(x => Just(f(x))).equals(Nothing());
    });
  });

  describe('#filter(f)', () => {
    property('Just(a).filter(() => true) = Just(a)', 'json', 'json -> json', (a, f) => {
      return Just(a).filter(() => true).equals(Just(a));
    });

    property('Just(a).filter(() => false) = Nothing()', 'json', 'json -> json', (a, f) => {
      return Just(a).filter(() => false).equals(Nothing());
    });

    property('Nothing().filter(() => true) = Nothing()', 'json', 'json -> json', (a, f) => {
      return Nothing().filter(() => true).equals(Nothing());
    });

    property('Nothing().filter(() => false) = Nothing()', 'json', 'json -> json', (a, f) => {
      return Nothing().filter(() => false).equals(Nothing());
    });
  });

  describe('#unsafeGet()', () => {
    property('Just(a).unsafeGet() = a', 'json', (a) => {
      return Just(a).unsafeGet() === a;
    });

    it('Nothing().unsafeGet() throws', () => {
      assert.throws(_ => Nothing().unsafeGet());
    });
  });

  describe('#getOrElse(b)', () => {
    property('Just(a).getOrElse(b) = a', 'json', 'json', (a, b) => {
      return Just(a).getOrElse(b) === a;
    });

    property('Nothing().getOrElse(b) = b', 'json', (a) => {
      return Nothing().getOrElse(a) === a;
    });
  });

  describe('#orElse(f)', () => {
    property('Just(a).orElse(f) = Just(a)', 'json', 'json -> json', (a, f) => {
      return Just(a).orElse(x => Just(f(x))).equals(Just(a));
    });

    property('Nothing().orElse(f) = f()', 'json', 'json -> json', (a, f) => {
      return Nothing().orElse(x => Just(f(a))).equals(Just(f(a)));
    });
  });

  describe('#toResult(b)', () => {
    const { Error, Ok } = require('folktale/result');

    property('Just(a).toResult(b) = Right(a)', 'json', 'json', (a, b) => {
      return Just(a).toResult(b).equals(Ok(a));
    });

    property('Nothing().toResult(b) = Error(b)', 'json', 'json', (a, b) => {
      return Nothing().toResult(b).equals(Error(b));
    });
  });

  describe('#toValidation(b)', () => {
    const { Success, Failure } = require('folktale/validation');

    property('Just(a).toValidation(b) = Succcess(a)', 'json', 'json', (a, b) => {
      return Just(a).toValidation(b).equals(Success(a));
    });

    property('Nothing().toValidation(b) = Failure(b)', 'json', 'json', (a, b) => {
      return Nothing().toValidation(b).equals(Failure(b));
    });
  });

  describe('#empty()', () => {
    property('empty().equals(Nothing()) = true', () => {
      return Maybe.empty().equals(Nothing());
    });

    property('!(empty().equals(Just(a))) = false', 'nat', (a) => {
      return !(Maybe.empty().equals(Just(a)));
    });
  });

  describe('#concat(a)', () => {
    property('Just(a).concat(Nothing()) = Just(a)', 'string', (a) => {
      return Just(a).concat(Maybe.empty()).equals(Just(a));
    });

    property('Nothing().concat(Just(a)) = Nothing()', 'string', (a) => {
      return Maybe.empty().concat(Just(a)).equals(Just(a));
    });

    property('Just(a).concat(Just(b)) = Just(c)', 'string', 'string', (a, b) => {
      return Just(a).concat(Just(b)).equals(Just(a.concat(b)));
    });
  });

  describe('#alt(f)', () => {
    property('Nothing().alt(Just(a)).alt(Just(b)) = Nothing().alt(Just(a).alt(Just(b)))', 'nat', 'nat', (a, b) => {
      return Nothing().alt(Just(a)).alt(Just(b)).equals(Nothing().alt(Just(a).alt(Just(b))));
    });

    property('Just(a).alt(Just(b)).map(f) = Just(a).map(f).alt(Just(b).map(f))', 'nat', 'nat', (a, b) => {
      const f = x => x + 1;
      return Just(a).alt(Just(b)).map(f).equals(Just(a).map(f).alt(Just(b).map(f)));
    });
  });

  describe('Fantasy Land', _ => {
    laws.Setoid(Maybe.Just);
    laws.Setoid(Maybe.Nothing);

    laws.Semigroup(Maybe.Just);
    laws.Semigroup(Maybe.Nothing);

    laws.Monoid(Maybe.Just);
    laws.Monoid(Maybe.Nothing);

    laws.Functor(Maybe.Just);
    laws.Functor(Maybe.Nothing);

    laws.Apply(Maybe.Just);
    laws.Apply(Maybe.Nothing);

    laws.Applicative(Maybe.Just);
    laws.Applicative(Maybe.Nothing);

    laws.Alt(Maybe.Just);
    laws.Alt(Maybe.Nothing);

    laws.Chain(Maybe.Just);
    laws.Chain(Maybe.Nothing);

    laws.Monad(Maybe.Just);
    laws.Monad(Maybe.Nothing);
  });
});


text:
<?php

namespace Pixeloid\AppBundle\Form;

use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList;
use Doctrine\ORM\EntityRepository;
use Pixeloid\AppBundle\Entity\Author;
use Pixeloid\AppBundle\Form\CvType;
use Pixeloid\AppBundle\Form\AuthorType;
use EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType;
use EWZ\Bundle\RecaptchaBundle\Validator\Constraints\IsTrue as RecaptchaTrue;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Braincrafted\Bundle\BootstrapBundle\Form\Type\BootstrapCollectionType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;

class PresentationType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */

    function __construct($container) {
        $this->em = $container->get('doctrine.orm.entity_manager');
        $this->translator = $container->get('translator');
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        switch ($options['flow_step']) {

            case 1:
                $builder
                    ->add('email', null, array('label' => 'form.label.email'))
                    ->add('firstname', null, array('label' => 'form.label.firstname'))
                    ->add('lastname', null, array('label' => 'form.label.lastname'))
                    ->add(
                        'authors',
                        BootstrapCollectionType::class,
                        array(
                            'entry_type' =>  AuthorType::class,
                            'allow_add'          => true,
                            'allow_delete'       => true,
                            'add_button_text'    => 'add_author',
                            'delete_button_text' => 'remove_author',
                            'sub_widget_col'     => 9,
                            'button_col'         => 3,
                            'label'             => 'authors',
                            // 'data' => array(new Author),
                        )
                    )

                    ->add('title', null, array(
                        'label' => 'abstract_title',
                    ))

                    ->add('body1', CKEditorType::class, array(
                         'label' => 'content',
                         'data' => '

                         '.
                         $this->translator->trans('cel')
                         .'

                         '.
                         $this->translator->trans('anyag')
                         .'

                         '.
                         $this->translator->trans('eredmenyek')
                         .'

                         '.
                         $this->translator->trans('kovetkeztetes')
                         .'

                         ',

                        'config' => array(
                          // 'extraPlugins' => 'wordcount',
                            'height' => '300px',
                            'toolbar' => array(
                                // array(
                                //     'name'  => 'document',
                                //     'items' => array('Source', '-', 'Save', 'NewPage', 'DocProps', 'Preview', 'Print', '-', 'Templates'),
                                // ),
                                // '/',
                                array(
                                    'name'  => 'basicstyles',
                                    'items' => array('Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'),
                                ),
                            ),
                            'uiColor' => '#ffffff',
                            //...
                        ),
                    ))

                    ->add('presentationType', EntityType::class, array(
                        'class' => 'PixeloidAppBundle:PresentationType',
                        'choice_label' => 'name',
                        'expanded'  => true,
                        'multiple'  => false,
                        'label' => 'form.label.presentationtype',
                        'data' => $this->em->getReference("PixeloidAppBundle:PresentationType",1)

                    ))

                    ->add('public', ChoiceType::class, array(
                        'label' => 'form.label.agree_publication',
                        'expanded' => true,
                        'choices_as_values' => true,
                        'choices' => [
                            'Nem járulok hozzá a közzétételhez' => 0,
                            'Hozzájárulok a közzétételhez' => 1
                        ],

                    ));

                break;

                case 2:

                $builder
                    ->add('cv', new CvType());

                break;
                case 3:

                $builder
                ->add('recaptcha', EWZRecaptchaType::class, array(
                        'attr'        => array(
                            'options' => array(
                                'size' => 'invisible',              // set size to invisible
                                'defer' => true,
                                'theme' => 'light',
                                'async' => true,
                                'callback' => 'onReCaptchaSuccess', // callback will be set by default if not defined (along with JS function that validate the form on success)
                                'bind' => 'btn_submit',             // this is the id of the form submit button

                            )
                        ),
                        'mapped'      => false,
                        'constraints' => array(
                            new RecaptchaTrue()
                        )

                ));
                ;

                break;
            }

    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'translation_domain'     => 'form',
            'data_class' => 'Pixeloid\AppBundle\Entity\Presentation',
            'validation_groups' => array('CvMandatory'),
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'pixeloid_appbundle_presentation';
    }
}


text: """Unit test package for tyluigiutils."""


text:
import {Component} from '@angular/core';
import {Project} from '../../model/project';
import {ProjectService} from '../../service/project.service';
import {Router} from '@angular/router';
import {UserService} from '../../service/user.service';
import {BAD_REQUEST, CONFLICT, FORBIDDEN, INTERNAL_SERVER_ERROR} from 'http-status-codes';
import {Title} from '@angular/platform-browser';

@Component({
  selector: 'app-add-project',
  templateUrl: './add-project.component.html',
  styleUrls: ['./add-project.component.scss']
})
export class AddProjectComponent {

  project: Project;

  incorrectURL = false;
  projectExists = false;
  nameEmpty = false;
  defaultBranchEmpty = false;

  constructor(private router: Router, private userService: UserService, private projectService: ProjectService,
              private titleService: Title) {
    this.project = new Project();
    this.project.name = '';
    this.project.vcsUrl = '';
    this.project.defaultBranch = 'master';
    titleService.setTitle('Coderadar - Add project');
  }

  /**
   * Validates user input and calls ProjectService.addProject().
   * Handles server errors.
   * If access is denied (403) sends the refresh token and tries to submit again.
   */
  submitForm() {
    if (this.validateInput()) {
      return;
    }

    this.projectService.addProject(this.project)
      .then(response => {
        this.project.id = response.body.id;
        this.router.navigate(['/project-configure', this.project.id]);
      })
      .catch(error => {
        if (error.status && error.status === FORBIDDEN) { // If access is denied
          this.userService.refresh(() => this.submitForm());
        } else if (error.status && error.status === BAD_REQUEST) {   // If there is a field error
          if (error.error && error.error.errorMessage === 'Validation Error') {
            error.error.fieldErrors.forEach(field => {  // Check which field
              if (field.field === 'vcsUrl') {
                this.incorrectURL = true;
              }
            });
          }
        } else if (error.status === CONFLICT &&
          error.error.errorMessage === 'The project ' + this.project.name + ' already exists.') {
          this.projectExists = true;
        }
      });
  }

  /**
   * Checks for empty form fields.
   */
  private validateInput(): boolean {
    this.projectExists = false;
    this.defaultBranchEmpty = false;

    this.incorrectURL = this.project.vcsUrl.trim().length === 0;
    this.nameEmpty = this.project.name.trim().length === 0;
    this.defaultBranchEmpty = this.project.defaultBranch.trim().length === 0;

    return this.nameEmpty || this.incorrectURL || this.defaultBranchEmpty;
  }
}


text:
package com.google.api.ads.adwords.jaxws.v201509.cm;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;

/**
 *
 *             An error indicating a problem with an ad customizer tag.
 *
 *
 *
Java class for AdCustomizerError complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="AdCustomizerError">
 *   <complexContent>
 *     <extension base="{https://adwords.google.com/api/adwords/cm/v201509}ApiError">
 *       <sequence>
 *         <element name="reason" type="{https://adwords.google.com/api/adwords/cm/v201509}AdCustomizerError.Reason" minOccurs="0"/>
 *         <element name="functionString" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="operatorName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="operandIndex" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
 *         <element name="operandValue" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AdCustomizerError", propOrder = {
    "reason",
    "functionString",
    "operatorName",
    "operandIndex",
    "operandValue"
})
public class AdCustomizerError
    extends ApiError
{

    @XmlSchemaType(name = "string")
    protected AdCustomizerErrorReason reason;
    protected String functionString;
    protected String operatorName;
    protected Integer operandIndex;
    protected String operandValue;

    /**
     * Gets the value of the reason property.
     *
     * @return
     *     possible object is
     *     {@link AdCustomizerErrorReason }
     *
     */
    public AdCustomizerErrorReason getReason() {
        return reason;
    }

    /**
     * Sets the value of the reason property.
     *
     * @param value
     *     allowed object is
     *     {@link AdCustomizerErrorReason }
     *
     */
    public void setReason(AdCustomizerErrorReason value) {
        this.reason = value;
    }

    /**
     * Gets the value of the functionString property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getFunctionString() {
        return functionString;
    }

    /**
     * Sets the value of the functionString property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setFunctionString(String value) {
        this.functionString = value;
    }

    /**
     * Gets the value of the operatorName property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getOperatorName() {
        return operatorName;
    }

    /**
     * Sets the value of the operatorName property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setOperatorName(String value) {
        this.operatorName = value;
    }

    /**
     * Gets the value of the operandIndex property.
     *
     * @return
     *     possible object is
     *     {@link Integer }
     *
     */
    public Integer getOperandIndex() {
        return operandIndex;
    }

    /**
     * Sets the value of the operandIndex property.
     *
     * @param value
     *     allowed object is
     *     {@link Integer }
     *
     */
    public void setOperandIndex(Integer value) {
        this.operandIndex = value;
    }

    /**
     * Gets the value of the operandValue property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getOperandValue() {
        return operandValue;
    }

    /**
     * Sets the value of the operandValue property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setOperandValue(String value) {
        this.operandValue = value;
    }

}


text:
<?php

namespace common\packages;

use yii\web\AssetBundle;

/**
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class AppJsAsset extends AssetBundle
{
    public $sourcePath = '@common/web';
    public $css = [
    //'css/sb-admin.css'
    ];
    public $js = [
        'js/app/boot.js'
    ];
    public $depends = [
        'common\packages\MomentJsAsset',
        'yii\web\JqueryAsset',
        'rmrevin\yii\fontawesome\AssetBundle',
    ];
}


text:
<root>
<Version>2.0</Version>
<UpdateText>New version available. Alteryx 9.0 Only!  Download at http:\\downloads.chaosreignswithin.com</UpdateText>
</root>


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace ODataValidator.Rule
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.Composition;
    using System.Linq;
    using System.Text.RegularExpressions;
    using System.Xml;
    using System.Xml.Linq;
    using System.Xml.XPath;
    using ODataValidator.Rule.Helper;
    using ODataValidator.RuleEngine;
    using ODataValidator.RuleEngine.Common;

    /// <summary>
    /// Class of extension rule for Metadata.Core.4360
    /// </summary>
    [Export(typeof(ExtensionRule))]
    public class MetadataCore4360 : ExtensionRule
    {
        /// <summary>
        /// Gets Category property
        /// </summary>
        public override string Category
        {
            get
            {
                return "core";
            }
        }

        /// <summary>
        /// Gets rule name
        /// </summary>
        public override string Name
        {
            get
            {
                return "Metadata.Core.4360";
            }
        }

        /// <summary>
        /// Gets rule description
        /// </summary>
        public override string Description
        {
            get
            {
                return @"The value of the BaseTerm attribute MUST be the name of a term in scope.";
            }
        }

        /// <summary>
        /// Gets rule specification in OData document
        /// </summary>
        public override string SpecificationSection
        {
            get
            {
                return "14.1.3";
            }
        }

        /// <summary>
        /// Gets location of help information of the rule
        /// </summary>
        public override string HelpLink
        {
            get
            {
                return null;
            }
        }

        /// <summary>
        /// Gets the error message for validation failure
        /// </summary>
        public override string ErrorMessage
        {
            get
            {
                return this.Description;
            }
        }

        /// <summary>
        /// Gets the requirement level.
        /// </summary>
        public override RequirementLevel RequirementLevel
        {
            get
            {
                return RequirementLevel.Must;
            }
        }

        /// <summary>
        /// Gets the payload type to which the rule applies.
        /// </summary>
        public override PayloadType? PayloadType
        {
            get
            {
                return RuleEngine.PayloadType.Metadata;
            }
        }

        /// <summary>
        /// Gets the offline context to which the rule applies
        /// </summary>
        public override bool? IsOfflineContext
        {
            get
            {
                return true;
            }
        }

        /// <summary>
        /// Gets the payload format to which the rule applies.
        /// </summary>
        public override PayloadFormat? PayloadFormat
        {
            get
            {
                return RuleEngine.PayloadFormat.Xml;
            }
        }

        /// <summary>
        /// Gets the OData version
        /// </summary>
        public override ODataVersion? Version
        {
            get
            {
                return ODataVersion.V4;
            }
        }

        /// <summary>
        /// Verify Metadata.Core.4360
        /// </summary>
        /// <param name="context">Service context</param>
        /// <param name="info">out parameter to return violation information when rule fail</param>
        /// <returns>true if rule passes; false otherwise</returns>
        public override bool? Verify(ServiceContext context, out ExtensionRuleViolationInfo info)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            bool? passed = null;
            info = null;

            string termXpath = @"./*[local-name()='DataServices']/*[local-name()='Schema']/*[local-name()='Term' and @BaseTerm]";
            XElement metadata = XElement.Parse(context.MetadataDocument);
            IEnumerable<XElement> termCollection = metadata.XPathSelectElements(termXpath);
            foreach (XElement term in termCollection)
            {
                passed = true;
                string termValue = term.Attribute("BaseTerm").Value;
                int dotIndex = termValue.LastIndexOf('.');
                if (dotIndex == -1 || dotIndex == 0 || dotIndex == termValue.Length - 1)
                {
                    passed = false; break;
                }
                string ns = termValue.Substring(0, dotIndex).TrimStart();
                string shortName = termValue.Substring(dotIndex + 1).TrimEnd();

                if (context.ContainsExternalSchema)
                {
                    XElement fullMetadata = XElement.Parse(context.MergedMetadataDocument);
                    string xpath = @"./*[local-name()='DataServices']/*[local-name()='Schema' and (@Namespace='{0}' or @Alias='{0}')]/*[local-name()='Term' and @Name='{1}']";
                    if (fullMetadata.XPathSelectElement(string.Format(xpath, ns, shortName)) == null)
                    {
                        passed = false; break;
                    }
                }
                else
                {
                    string xpath = @"./*[local-name()='Schema' and (@Namespace='{0}' or @Alias='{0}')]/*[local-name()='Term' and @Name='{1}']";
                    if (term.Parent.Parent.XPathSelectElement(string.Format(xpath, ns, shortName)) == null)
                    {
                        passed = false; break;
                    }
                }
            }

            info = new ExtensionRuleViolationInfo(this.ErrorMessage, context.Destination, context.ResponsePayload);
            return passed;
        }
    }
}


text:
  ## package_source_pull_managed(<~uri>) -> <package handle>
  ## --reference returns the package with the content still pointing to the original content dir
  function(package_source_pull_managed uri)
    set(args ${ARGN})

    uri_coerce(uri)

    package_source_resolve_managed("${uri}")
    ans(package_handle)
    if(NOT package_handle)
      return()
    endif()

    list_extract_flag(args --reference)
    ans(reference)

    ## if in reference mode copy package_handle content and set new content_dir
    if(NOT reference)
      list_pop_front(args)
      ans(target_dir)
      path_qualify(target_dir)

      map_tryget(${package_handle} content_dir)
      ans(source_dir)

      cp_dir("${source_dir}" "${target_dir}")
      map_set(${package_handle} content_dir "${target_dir}")
    endif()

    return_ref(package_handle)
  endfunction()


text:
module Helpers
  module Templates
    class Gemspec

      def initialize
        #
      end
    end
  end
end


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.dadaban</groupId>
    <artifactId>dadaban-parent</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>dadaban</name>
    <url>http://maven.apache.org</url>
    <properties>
        <!-- 主要依赖库的版本定义 -->
        <springside.version>4.2.2.GA</springside.version>
        <spring.version>4.0.2.RELEASE</spring.version>
        <hibernate.version>4.3.1.Final</hibernate.version>
        <spring-data-jpa.version>1.4.4.RELEASE</spring-data-jpa.version>
        <tomcat-jdbc.version>7.0.52</tomcat-jdbc.version>
        <sitemesh.version>2.4.2</sitemesh.version>
        <shiro.version>1.2.2</shiro.version>
        <hibernate-validator.version>5.0.3.Final</hibernate-validator.version>
        <jackson.version>2.3.1</jackson.version>
        <aspectj.version>1.7.4</aspectj.version>
        <slf4j.version>1.7.6</slf4j.version>
        <logback.version>1.1.1</logback.version>
        <commons-lang3.version>3.2.1</commons-lang3.version>
        <guava.version>16.0.1</guava.version>
        <junit.version>4.11</junit.version>
        <assertj.version>1.5.0</assertj.version>
        <mockito.version>1.9.5</mockito.version>
        <selenium.version>2.40.0</selenium.version>
        <jetty.version>7.6.14.v20131031</jetty.version>
        <mybatis.version>3.2.7</mybatis.version>
        <mybatis-spring.version>1.2.2</mybatis-spring.version>
        <h2.version>1.3.175</h2.version>

        <!-- Plugin的属性定义 -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.6</java.version>

        <!-- 项目属性 -->
        <!--
        <jdbc.driver.groupId>com.h2database</jdbc.driver.groupId>
        <jdbc.driver.artifactId>h2</jdbc.driver.artifactId>
        <jdbc.driver.version>${h2.version}</jdbc.driver.version>
        -->
        <!---->
        <jdbc.driver.groupId>mysql</jdbc.driver.groupId>
        <jdbc.driver.artifactId>mysql-connector-java</jdbc.driver.artifactId>
        <jdbc.driver.version>5.1.22</jdbc.driver.version>

    </properties>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <!-- SPRINGSIDE -->
        <dependency>
            <groupId>org.springside</groupId>
            <artifactId>springside-core</artifactId>
            <version>${springside.version}</version>
        </dependency>

        <!-- PERSISTENCE begin -->
        <!-- hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <!-- spring data access -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>${spring-data-jpa.version}</version>
        </dependency>

        <!-- spring aop -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${aspectj.version}</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>${aspectj.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- connection pool -->
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jdbc</artifactId>
            <version>${tomcat-jdbc.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- jdbc driver -->
        <dependency>
            <groupId>${jdbc.driver.groupId}</groupId>
            <artifactId>${jdbc.driver.artifactId}</artifactId>
            <version>${jdbc.driver.version}</version>
            <scope>runtime</scope>
        </dependency>
        <!-- PERSISTENCE end -->

        <!-- WEB begin -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
        </dependency>

        <dependency>
            <groupId>opensymphony</groupId>
            <artifactId>sitemesh</artifactId>
            <version>${sitemesh.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
        <!-- WEB end -->

        <!-- SECURITY begin -->
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-spring</artifactId>
            <version>${shiro.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-ehcache</artifactId>
            <version>${shiro.version}</version>
        </dependency>
        <!-- SECURITY end -->

        <!-- JSR303 BeanValidator -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>${hibernate-validator.version}</version>
        </dependency>

        <!-- JSON begin -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-jaxb-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <!-- JSON end -->

        <!-- LOGGING begin -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- 代码直接调用log4j会被桥接到slf4j -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
            <scope>runtime</scope>
        </dependency>
        <!-- 代码直接调用common-logging会被桥接到slf4j -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
            <scope>runtime</scope>
        </dependency>
        <!-- 代码直接调用java.util.logging会被桥接到slf4j -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <version>${slf4j.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.googlecode.log4jdbc</groupId>
            <artifactId>log4jdbc</artifactId>
            <version>1.2</version>
            <scope>runtime</scope>
        </dependency>
        <!-- LOGGING end -->

        <!-- GENERAL UTILS begin -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons-lang3.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
        </dependency>
        <!-- GENERAL UTILS end -->

        <!-- TEST begin -->
        <dependency>
            <groupId>org.springside</groupId>
            <artifactId>springside-core</artifactId>
            <version>${springside.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>${mybatis.version}</version>
        </dependency>

        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>${mybatis-spring.version}</version>
        </dependency>

        <!-- selenium 2.0 -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-htmlunit-driver</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-android-driver</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-iphone-driver</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-safari-driver</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-remote-driver</artifactId>
            <version>${selenium.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>cglib</groupId>
                    <artifactId>cglib-nodep</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- h2  如果生产数据库不是H2,解开下面的注释
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>${h2.version}</version>
        </dependency>
        -->

        <!-- jetty -->
        <dependency>
            <groupId>org.eclipse.jetty.aggregate</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${jetty.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-jsp</artifactId>
            <version>${jetty.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-framework-bom</artifactId>
                <version>${spring.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>net.sf.ehcache</groupId>
                <artifactId>ehcache-core</artifactId>
                <version>2.6.8</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <modules>
        <module>dadaban-domain</module>
        <module>dadaban-persist</module>
        <module>dadaban-service</module>
        <module>dadaban-web</module>
    </modules>
</project>


text:
/**
 * @file    hal_serial.h
 * @brief   Serial Driver macros and structures.
 *
 * @addtogroup SERIAL
 * @{
 */

#ifndef HAL_SERIAL_H
#define HAL_SERIAL_H

#if (HAL_USE_SERIAL == TRUE) || defined(__DOXYGEN__)

/*===========================================================================*/
/* Driver constants.                                                         */
/*===========================================================================*/

/**
 * @name    Serial status flags
 * @{
 */
#define SD_PARITY_ERROR         (eventflags_t)32    /**< @brief Parity.     */
#define SD_FRAMING_ERROR        (eventflags_t)64    /**< @brief Framing.    */
#define SD_OVERRUN_ERROR        (eventflags_t)128   /**< @brief Overflow.   */
#define SD_NOISE_ERROR          (eventflags_t)256   /**< @brief Line noise. */
#define SD_BREAK_DETECTED       (eventflags_t)512   /**< @brief LIN Break.  */
#define SD_QUEUE_FULL_ERROR     (eventflags_t)1024  /**< @brief Queue full. */
/** @} */

/*===========================================================================*/
/* Driver pre-compile time settings.                                         */
/*===========================================================================*/

/**
 * @name    Serial configuration options
 * @{
 */
/**
 * @brief   Default bit rate.
 * @details Configuration parameter, this is the baud rate selected for the
 *          default configuration.
 */
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
#define SERIAL_DEFAULT_BITRATE      38400
#endif

/**
 * @brief   Serial buffers size.
 * @details Configuration parameter, you can change the depth of the queue
 *          buffers depending on the requirements of your application.
 * @note    The default is 16 bytes for both the transmission and receive
 *          buffers.
 * @note    This is a global setting and it can be overridden by low level
 *          driver specific settings.
 */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_BUFFERS_SIZE         16
#endif
/** @} */

/*===========================================================================*/
/* Derived constants and error checks.                                       */
/*===========================================================================*/

/*===========================================================================*/
/* Driver data structures and types.                                         */
/*===========================================================================*/

/**
 * @brief Driver state machine possible states.
 */
typedef enum {
  SD_UNINIT = 0,                    /**< Not initialized.                   */
  SD_STOP = 1,                      /**< Stopped.                           */
  SD_READY = 2                      /**< Ready.                             */
} sdstate_t;

/**
 * @brief   Structure representing a serial driver.
 */
typedef struct SerialDriver SerialDriver;

#include "hal_serial_lld.h"

/**
 * @brief   @p SerialDriver specific methods.
 */
#define _serial_driver_methods                                              \
  _base_asynchronous_channel_methods

/**
 * @extends BaseAsynchronousChannelVMT
 *
 * @brief   @p SerialDriver virtual methods table.
 */
struct SerialDriverVMT {
  _serial_driver_methods
};

/**
 * @extends BaseAsynchronousChannel
 *
 * @brief   Full duplex serial driver class.
 * @details This class extends @p BaseAsynchronousChannel by adding physical
 *          I/O queues.
 */
struct SerialDriver {
  /** @brief Virtual Methods Table.*/
  const struct SerialDriverVMT *vmt;
  _serial_driver_data
};

/*===========================================================================*/
/* Driver macros.                                                            */
/*===========================================================================*/

/**
 * @name    Macro Functions
 * @{
 */
/**
 * @brief   Direct write to a @p SerialDriver.
 * @note    This function bypasses the indirect access to the channel and
 *          writes directly on the output queue. This is faster but cannot
 *          be used to write to different channels implementations.
 *
 * @see     chnPutTimeout()
 *
 * @api
 */
#define sdPut(sdp, b) oqPut(&(sdp)->oqueue, b)

/**
 * @brief   Direct write to a @p SerialDriver with timeout specification.
 * @note    This function bypasses the indirect access to the channel and
 *          writes directly on the output queue. This is faster but cannot
 *          be used to write to different channels implementations.
 *
 * @see     chnPutTimeout()
 *
 * @api
 */
#define sdPutTimeout(sdp, b, t) oqPutTimeout(&(sdp)->oqueue, b, t)

/**
 * @brief   Direct read from a @p SerialDriver.
 * @note    This function bypasses the indirect access to the channel and
 *          reads directly from the input queue. This is faster but cannot
 *          be used to read from different channels implementations.
 *
 * @see     chnGetTimeout()
 *
 * @api
 */
#define sdGet(sdp) iqGet(&(sdp)->iqueue)

/**
 * @brief   Direct read from a @p SerialDriver with timeout specification.
 * @note    This function bypasses the indirect access to the channel and
 *          reads directly from the input queue. This is faster but cannot
 *          be used to read from different channels implementations.
 *
 * @see     chnGetTimeout()
 *
 * @api
 */
#define sdGetTimeout(sdp, t) iqGetTimeout(&(sdp)->iqueue, t)

/**
 * @brief   Direct blocking write to a @p SerialDriver.
 * @note    This function bypasses the indirect access to the channel and
 *          writes directly to the output queue. This is faster but cannot
 *          be used to write from different channels implementations.
 *
 * @see     chnWrite()
 *
 * @api
 */
#define sdWrite(sdp, b, n)                                                  \
  oqWriteTimeout(&(sdp)->oqueue, b, n, TIME_INFINITE)

/**
 * @brief   Direct blocking write to a @p SerialDriver with timeout
 *          specification.
 * @note    This function bypasses the indirect access to the channel and
 *          writes directly to the output queue. This is faster but cannot
 *          be used to write to different channels implementations.
 *
 * @see     chnWriteTimeout()
 *
 * @api
 */
#define sdWriteTimeout(sdp, b, n, t)                                        \
  oqWriteTimeout(&(sdp)->oqueue, b, n, t)

/**
 * @brief   Direct non-blocking write to a @p SerialDriver.
 * @note    This function bypasses the indirect access to the channel and
 *          writes directly to the output queue. This is faster but cannot
 *          be used to write to different channels implementations.
 *
 * @see     chnWriteTimeout()
 *
 * @api
 */
#define sdAsynchronousWrite(sdp, b, n)                                      \
  oqWriteTimeout(&(sdp)->oqueue, b, n, TIME_IMMEDIATE)

/**
 * @brief   Direct blocking read from a @p SerialDriver.
 * @note    This function bypasses the indirect access to the channel and
 *          reads directly from the input queue. This is faster but cannot
 *          be used to read from different channels implementations.
 *
 * @see     chnRead()
 *
 * @api
 */
#define sdRead(sdp, b, n)                                                   \
  iqReadTimeout(&(sdp)->iqueue, b, n, TIME_INFINITE)

/**
 * @brief   Direct blocking read from a @p SerialDriver with timeout
 *          specification.
 * @note    This function bypasses the indirect access to the channel and
 *          reads directly from the input queue. This is faster but cannot
 *          be used to read from different channels implementations.
 *
 * @see     chnReadTimeout()
 *
 * @api
 */
#define sdReadTimeout(sdp, b, n, t)                                         \
  iqReadTimeout(&(sdp)->iqueue, b, n, t)

/**
 * @brief   Direct non-blocking read from a @p SerialDriver.
 * @note    This function bypasses the indirect access to the channel and
 *          reads directly from the input queue. This is faster but cannot
 *          be used to read from different channels implementations.
 *
 * @see     chnReadTimeout()
 *
 * @api
 */
#define sdAsynchronousRead(sdp, b, n)                                       \
  iqReadTimeout(&(sdp)->iqueue, b, n, TIME_IMMEDIATE)
/** @} */

/*===========================================================================*/
/* External declarations.                                                    */
/*===========================================================================*/

#ifdef __cplusplus
extern "C" {
#endif
  void sdInit(void);
#if !defined(SERIAL_ADVANCED_BUFFERING_SUPPORT) ||                          \
    (SERIAL_ADVANCED_BUFFERING_SUPPORT == FALSE)
  void sdObjectInit(SerialDriver *sdp, qnotify_t inotify, qnotify_t onotify);
#else
  void sdObjectInit(SerialDriver *sdp);
#endif
  void sdStart(SerialDriver *sdp, const SerialConfig *config);
  void sdStop(SerialDriver *sdp);
  void sdIncomingDataI(SerialDriver *sdp, uint8_t b);
  msg_t sdRequestDataI(SerialDriver *sdp);
  bool sdPutWouldBlock(SerialDriver *sdp);
  bool sdGetWouldBlock(SerialDriver *sdp);
#ifdef __cplusplus
}
#endif

#endif /* HAL_USE_SERIAL == TRUE */

#endif /* HAL_SERIAL_H */

/** @} */


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Pleurothallis lichenophila Porto & Brade

### Remarks
null


text:
package org.apache.james.mailbox.cassandra.mail.utils;

import static org.assertj.core.api.Assertions.assertThat;

import org.apache.commons.lang.mutable.MutableInt;
import org.apache.james.mailbox.exception.MailboxException;
import org.junit.Test;

public class FunctionRunnerWithRetryTest {

    private final static int MAX_RETRY = 10;

    @Test(expected = IllegalArgumentException.class)
    public void functionRunnerWithInvalidMaxRetryShouldFail() throws Exception {
        new FunctionRunnerWithRetry(-1);
    }

    @Test(expected = MailboxException.class)
    public void functionRunnerShouldFailIfTransactionCanNotBePerformed() throws Exception {
        final MutableInt value = new MutableInt(0);
        new FunctionRunnerWithRetry(MAX_RETRY).execute(
            () -> {
                value.increment();
                return false;
            }
        );
        assertThat(value.getValue()).isEqualTo(MAX_RETRY);
    }

    @Test
    public void functionRunnerShouldWorkOnFirstTry() throws Exception {
        final MutableInt value = new MutableInt(0);
        new FunctionRunnerWithRetry(MAX_RETRY).execute(
            () -> {
                value.increment();
                return true;
            }
        );
        assertThat(value.getValue()).isEqualTo(1);
    }

    @Test
    public void functionRunnerShouldWorkIfNotSucceededOnFirstTry() throws Exception {
        final MutableInt value = new MutableInt(0);
        new FunctionRunnerWithRetry(MAX_RETRY).execute(
            () -> {
                value.increment();
                return (Integer) value.getValue() == MAX_RETRY / 2;
            }
        );
        assertThat(value.getValue()).isEqualTo(MAX_RETRY / 2);
    }

    @Test
    public void functionRunnerShouldWorkIfNotSucceededOnMaxRetryReached() throws Exception {
        final MutableInt value = new MutableInt(0);
        new FunctionRunnerWithRetry(MAX_RETRY).execute(
                () -> {
                    value.increment();
                    return (Integer) value.getValue() == MAX_RETRY;
                }
        );
        assertThat(value.getValue()).isEqualTo(MAX_RETRY);
    }

}


text:
import pytest

from hypothesis import given, settings, reproduce_failure, unlimited, HealthCheck, seed

from tests.hypothesis_helper import runlengths, dfs_min, runlengths_same_length_integers, _slice

from itertools import product
import tempfile
import subprocess
from io import StringIO

from pyrle import Rle

import pandas as pd
import numpy as np

# using assert df equal, because we want to consider output from bedtools and
# pyranges equal even if they have different sort order
from tests.helpers import assert_df_equal

import numpy as np

from os import environ

if environ.get("TRAVIS"):
    max_examples = 100
    deadline = None
else:
    max_examples = 100
    deadline = None

rle_operation_cmd = "Rscript --vanilla tests/subset_coverage.R {} {} {} {}"

@pytest.mark.r
@given(runlengths=runlengths, interval=_slice())
@settings(max_examples=max_examples, deadline=deadline, timeout=unlimited, suppress_health_check=HealthCheck.all())
def test_subset_coverage(runlengths, interval):

    start, end = interval

    print("runlengths\n", runlengths)

    r = Rle(runlengths.Runs, runlengths.Values)

    result_pyranges = r[start:end]

    result_df = None
    with tempfile.TemporaryDirectory() as temp_dir:
        # temp_dir = "."
        f1 = "{}/f1.txt".format(temp_dir)
        outfile = "{}/result.txt".format(temp_dir)
        runlengths.to_csv(f1, sep="\t", index=False)

        cmd = rle_operation_cmd.format(f1, start + 1, end, outfile) # + " 2>/dev/null"
        print(cmd)

        subprocess.check_output(cmd, shell=True, executable="/bin/bash").decode()

        result = pd.read_csv(outfile, sep="\t")
        s4vectors_result = Rle(result.Runs, result.Values)

    print("pyranges result\n", result_pyranges)
    print("s4vectors result\n", s4vectors_result)

    assert np.allclose(result_pyranges.runs, s4vectors_result.runs, equal_nan=False)
    assert np.allclose(result_pyranges.values, s4vectors_result.values, equal_nan=True)

rle_operation_cmd = "Rscript --vanilla tests/subset_coverage.R {} {} {} {}"

# @pytest.mark.r
# @given(runlengths=runlengths, interval=_slice())
# @settings(max_examples=max_examples, deadline=deadline, timeout=unlimited, suppress_health_check=HealthCheck.all())
# def test_getloc_coverage(runlengths, interval):

#     start, end = interval
#     # Only compared against bioc with integers because float equality is hard,
#     # for both libraries, sometimes end up with slightly different runlengths
#     # when consecutive values are almost equal

#     print("runlengths\n", runlengths)

#     r = Rle(runlengths.Runs, runlengths.Values)

#     result_pyranges = r[start:end]

#     result_df = None
#     with tempfile.TemporaryDirectory() as temp_dir:
#         f1 = "{}/f1.txt".format(temp_dir)
#         outfile = "{}/result.txt".format(temp_dir)
#         runlengths.to_csv(f1, sep="\t", index=False)

#         cmd = rle_operation_cmd.format(f1, start, end, outfile) # + " 2>/dev/null"
#         print(cmd)

#         subprocess.check_output(cmd, shell=True, executable="/bin/bash").decode()

#         result = pd.read_csv(outfile, sep="\t")
#         s4vectors_result = Rle(result.Runs, result.Values)

#     print("pyranges result\n", result_pyranges)
#     print("s4vectors result\n", s4vectors_result)

#     assert np.allclose(result_pyranges.runs, s4vectors_result.runs, equal_nan=False)
#     assert np.allclose(result_pyranges.values, s4vectors_result.values, equal_nan=True)


text:
namespace Example_Drawing.Screens.iPad.Home {

	// Base type probably should be MonoTouch.UIKit.UIViewController or subclass
	[Foundation.Register("HomeScreen")]
	public partial class HomeScreen {

		private UIKit.UIView __mt_view;

		private UIKit.UIButton __mt_btnDrawRectVsPath;

		private UIKit.UIButton __mt_btnDrawUsingCGBitmapContext;

		private UIKit.UIButton __mt_btnDrawUsingLayers;

		private UIKit.UIButton __mt_btnOffScreenCoords;

		private UIKit.UIButton __mt_btnOnScreenCoords;

		private UIKit.UIButton __mt_btnOnScreenUncorrectedText;

		private UIKit.UIButton __mt_btnOffScreenFlag;

		private UIKit.UIButton __mt_btnImage;

		private UIKit.UIButton __mt_btnPatterns;

		private UIKit.UIButton __mt_btnStencilPattern;

		private UIKit.UIButton __mt_btnShadows;

		private UIKit.UIButton __mt_btnHitTesting;

		private UIKit.UIButton __mt_btnTouchDrawing;

		private UIKit.UIButton __mt_btnOnScreenFlag;

		private UIKit.UIButton __mt_btnTransformations;

		#pragma warning disable 0169
		[Foundation.Connect("view")]
		private UIKit.UIView view {
			get {
				this.__mt_view = ((UIKit.UIView)(this.GetNativeField("view")));
				return this.__mt_view;
			}
			set {
				this.__mt_view = value;
				this.SetNativeField("view", value);
			}
		}

		[Foundation.Connect("btnDrawRectVsPath")]
		private UIKit.UIButton btnDrawRectVsPath {
			get {
				this.__mt_btnDrawRectVsPath = ((UIKit.UIButton)(this.GetNativeField("btnDrawRectVsPath")));
				return this.__mt_btnDrawRectVsPath;
			}
			set {
				this.__mt_btnDrawRectVsPath = value;
				this.SetNativeField("btnDrawRectVsPath", value);
			}
		}

		[Foundation.Connect("btnDrawUsingCGBitmapContext")]
		private UIKit.UIButton btnDrawUsingCGBitmapContext {
			get {
				this.__mt_btnDrawUsingCGBitmapContext = ((UIKit.UIButton)(this.GetNativeField("btnDrawUsingCGBitmapContext")));
				return this.__mt_btnDrawUsingCGBitmapContext;
			}
			set {
				this.__mt_btnDrawUsingCGBitmapContext = value;
				this.SetNativeField("btnDrawUsingCGBitmapContext", value);
			}
		}

		[Foundation.Connect("btnDrawUsingLayers")]
		private UIKit.UIButton btnDrawUsingLayers {
			get {
				this.__mt_btnDrawUsingLayers = ((UIKit.UIButton)(this.GetNativeField("btnDrawUsingLayers")));
				return this.__mt_btnDrawUsingLayers;
			}
			set {
				this.__mt_btnDrawUsingLayers = value;
				this.SetNativeField("btnDrawUsingLayers", value);
			}
		}

		[Foundation.Connect("btnOffScreenCoords")]
		private UIKit.UIButton btnOffScreenCoords {
			get {
				this.__mt_btnOffScreenCoords = ((UIKit.UIButton)(this.GetNativeField("btnOffScreenCoords")));
				return this.__mt_btnOffScreenCoords;
			}
			set {
				this.__mt_btnOffScreenCoords = value;
				this.SetNativeField("btnOffScreenCoords", value);
			}
		}

		[Foundation.Connect("btnOnScreenCoords")]
		private UIKit.UIButton btnOnScreenCoords {
			get {
				this.__mt_btnOnScreenCoords = ((UIKit.UIButton)(this.GetNativeField("btnOnScreenCoords")));
				return this.__mt_btnOnScreenCoords;
			}
			set {
				this.__mt_btnOnScreenCoords = value;
				this.SetNativeField("btnOnScreenCoords", value);
			}
		}

		[Foundation.Connect("btnOnScreenUncorrectedText")]
		private UIKit.UIButton btnOnScreenUncorrectedText {
			get {
				this.__mt_btnOnScreenUncorrectedText = ((UIKit.UIButton)(this.GetNativeField("btnOnScreenUncorrectedText")));
				return this.__mt_btnOnScreenUncorrectedText;
			}
			set {
				this.__mt_btnOnScreenUncorrectedText = value;
				this.SetNativeField("btnOnScreenUncorrectedText", value);
			}
		}

		[Foundation.Connect("btnOffScreenFlag")]
		private UIKit.UIButton btnOffScreenFlag {
			get {
				this.__mt_btnOffScreenFlag = ((UIKit.UIButton)(this.GetNativeField("btnOffScreenFlag")));
				return this.__mt_btnOffScreenFlag;
			}
			set {
				this.__mt_btnOffScreenFlag = value;
				this.SetNativeField("btnOffScreenFlag", value);
			}
		}

		[Foundation.Connect("btnImage")]
		private UIKit.UIButton btnImage {
			get {
				this.__mt_btnImage = ((UIKit.UIButton)(this.GetNativeField("btnImage")));
				return this.__mt_btnImage;
			}
			set {
				this.__mt_btnImage = value;
				this.SetNativeField("btnImage", value);
			}
		}

		[Foundation.Connect("btnPatterns")]
		private UIKit.UIButton btnPatterns {
			get {
				this.__mt_btnPatterns = ((UIKit.UIButton)(this.GetNativeField("btnPatterns")));
				return this.__mt_btnPatterns;
			}
			set {
				this.__mt_btnPatterns = value;
				this.SetNativeField("btnPatterns", value);
			}
		}

		[Foundation.Connect("btnStencilPattern")]
		private UIKit.UIButton btnStencilPattern {
			get {
				this.__mt_btnStencilPattern = ((UIKit.UIButton)(this.GetNativeField("btnStencilPattern")));
				return this.__mt_btnStencilPattern;
			}
			set {
				this.__mt_btnStencilPattern = value;
				this.SetNativeField("btnStencilPattern", value);
			}
		}

		[Foundation.Connect("btnShadows")]
		private UIKit.UIButton btnShadows {
			get {
				this.__mt_btnShadows = ((UIKit.UIButton)(this.GetNativeField("btnShadows")));
				return this.__mt_btnShadows;
			}
			set {
				this.__mt_btnShadows = value;
				this.SetNativeField("btnShadows", value);
			}
		}

		[Foundation.Connect("btnHitTesting")]
		private UIKit.UIButton btnHitTesting {
			get {
				this.__mt_btnHitTesting = ((UIKit.UIButton)(this.GetNativeField("btnHitTesting")));
				return this.__mt_btnHitTesting;
			}
			set {
				this.__mt_btnHitTesting = value;
				this.SetNativeField("btnHitTesting", value);
			}
		}

		[Foundation.Connect("btnTouchDrawing")]
		private UIKit.UIButton btnTouchDrawing {
			get {
				this.__mt_btnTouchDrawing = ((UIKit.UIButton)(this.GetNativeField("btnTouchDrawing")));
				return this.__mt_btnTouchDrawing;
			}
			set {
				this.__mt_btnTouchDrawing = value;
				this.SetNativeField("btnTouchDrawing", value);
			}
		}

		[Foundation.Connect("btnOnScreenFlag")]
		private UIKit.UIButton btnOnScreenFlag {
			get {
				this.__mt_btnOnScreenFlag = ((UIKit.UIButton)(this.GetNativeField("btnOnScreenFlag")));
				return this.__mt_btnOnScreenFlag;
			}
			set {
				this.__mt_btnOnScreenFlag = value;
				this.SetNativeField("btnOnScreenFlag", value);
			}
		}

		[Foundation.Connect("btnTransformations")]
		private UIKit.UIButton btnTransformations {
			get {
				this.__mt_btnTransformations = ((UIKit.UIButton)(this.GetNativeField("btnTransformations")));
				return this.__mt_btnTransformations;
			}
			set {
				this.__mt_btnTransformations = value;
				this.SetNativeField("btnTransformations", value);
			}
		}
	}
}


text:
\hypertarget{interface_g_f_point_abstract}{}\section{G\+F\+Point\+Abstract Class Reference}
\label{interface_g_f_point_abstract}\index{G\+F\+Point\+Abstract@{G\+F\+Point\+Abstract}}

An Abstract Point implementation.

{\ttfamily \#import $<$Geo\+Features/\+G\+F\+Point\+Abstract.\+h$>$}

Inheritance diagram for G\+F\+Point\+Abstract\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{interface_g_f_point_abstract__inherit__graph}
\end{center}
\end{figure}

Collaboration diagram for G\+F\+Point\+Abstract\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{interface_g_f_point_abstract__coll__graph}
\end{center}
\end{figure}
\subsection*{Additional Inherited Members}

\subsection{Detailed Description}
An Abstract Point implementation.

An Abstract Point implementation which should not be instantiated on it\textquotesingle{}s own.

\begin{DoxyWarning}{Warning}
Do not instantiate this abstract class.
\end{DoxyWarning}
\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000002}{Deprecated}]This class will be removed in v2, please don\textquotesingle{}t directly rely on it at this point.\end{DoxyRefDesc}

\begin{DoxyAuthor}{Author}
Tony Stone
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
6/6/15
\end{DoxyDate}

The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item
Geo\+Features/G\+F\+Point\+Abstract.\+h\end{DoxyCompactItemize}


text:
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

/* MonitoringSink.cs --
 * Ars Magna project, http://arsmagna.ru
 * -------------------------------------------------------
 * Status: poor
 */

#region Using directives

using JetBrains.Annotations;

using MoonSharp.Interpreter;

#endregion

namespace ManagedIrbis.Monitoring
{
    /// <summary>
    /// Абстрактный сток для данных мониторинга.
    /// </summary>
    [PublicAPI]
    [MoonSharpUserData]
    public abstract class MonitoringSink
    {
        #region Public methods

        /// <summary>
        /// Write monitoring data.
        /// </summary>
        public abstract bool WriteData
            (
                [NotNull] MonitoringData data
            );

        #endregion
    }
}


text:
(function () {
    'use strict';

    angular.module('listings')
        .directive('svFormInfo', function () {
            return {
                replace: true,
                templateUrl: 'scripts/listings/directives/sv-form-info.html',
                link: function ($scope, el, attrs) {
                    $scope.listing = $scope.listing || {};
                    $scope.listing.status = 'active';

                }
            };
        });
})();


text:
<?php
class EmAdmin_Form_LocaleOptions extends ZendX_JQuery_Form
{

    public function init()
    {

        $this->setMethod(Zend_Form::METHOD_POST);
        $this->setAction(EMERALD_URL_BASE . "/em-admin/options/save-locale");

        $localeElm = new Zend_Form_Element_Hidden('locale');
        $localeElm->setDecorators(array('ViewHelper'));
        $localeElm->setIgnore(true);

        $titleElm = new Zend_Form_Element_Text('title', array('label' => 'Browser title', 'class' => 'w66'));
        $titleElm->addValidator(new Zend_Validate_StringLength(0, 255));
        $titleElm->setRequired(false);
        $titleElm->setAllowEmpty(true);

        $startPageElm = new Zend_Form_Element_Select('page_start', array('label' => 'Homepage'));
        $startPageElm->setRequired(true);
        $startPageElm->setAllowEmpty(false);

        $beautifurlElm = new Zend_Form_Element_Text('beautifurler', array('label' => 'Beautifurler', array('class' => 'w66')));
        $beautifurlElm->setRequired(false);
        $beautifurlElm->setAllowEmpty(true);

        $submitElm = new Zend_Form_Element_Submit('submit', array('label' => 'Save'));
        $submitElm->setIgnore(true);

        $this->addElements(array($localeElm, $titleElm, $startPageElm, $beautifurlElm, $submitElm));

    }

    public function setLocale($locale)
    {
        $naviModel = new EmCore_Model_Navigation();
        $navi = $naviModel->getNavigation();
        $navi = $navi->findBy("locale_root", $locale);
        $iter = new RecursiveIteratorIterator($navi, RecursiveIteratorIterator::SELF_FIRST);
        $opts = array();
        $opts[''] = $locale;
        foreach($iter as $navi) {
            $opts[$navi->id] = str_repeat("-", $iter->getDepth() + 1) . $navi->label;
        }
        $this->page_start->setMultiOptions($opts);

    }

}

?>


text:
class CreateComments < ActiveRecord::Migration
	def change
		create_table :comments do |t|
	      t.string  :description
	      t.integer :post_id
	      t.integer :user_id
	    end
	end
end


text:
'use strict'

const transport = require('../../lib/pino-transport')

module.exports = async function (opts) {
  opts.parseLine = function (str) {
    const obj = JSON.parse(str)
    return obj
  }
  return transport(opts)
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.CodeFixes.Suppression;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.UnitTests;
using Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.Suppression
{
    public class CSharpSuppressionAllCodeTests : AbstractSuppressionAllCodeTests
    {
        private static readonly TestComposition s_compositionWithMockDiagnosticUpdateSourceRegistrationService = EditorTestCompositions.EditorFeatures
            .AddExcludedPartTypes(typeof(IDiagnosticUpdateSourceRegistrationService))
            .AddParts(typeof(MockDiagnosticUpdateSourceRegistrationService));

        protected override TestWorkspace CreateWorkspaceFromFile(string definition, ParseOptions parseOptions)
            => TestWorkspace.CreateCSharp(definition, (CSharpParseOptions)parseOptions, composition: s_compositionWithMockDiagnosticUpdateSourceRegistrationService);

        internal override Tuple<Analyzer, IConfigurationFixProvider> CreateDiagnosticProviderAndFixer(Workspace workspace)
            => new Tuple<Analyzer, IConfigurationFixProvider>(new Analyzer(), new CSharpSuppressionCodeFixProvider());

        [WorkItem(956453, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/956453")]
        [WorkItem(1007071, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1007071")]
        [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsSuppression)]
        public async Task TestPragmaWarningOnEveryNodes()
            => await TestPragmaAsync(TestResource.AllInOneCSharpCode, CSharpParseOptions.Default, verifier: t => t.IndexOf("#pragma warning disable", StringComparison.Ordinal) >= 0);

        [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsSuppression)]
        public async Task TestSuppressionWithAttributeOnEveryNodes()
        {
            await TestSuppressionWithAttributeAsync(
                TestResource.AllInOneCSharpCode,
                CSharpParseOptions.Default,
                digInto: n => !(n is StatementSyntax) || n is BlockSyntax,
                verifier: t => t.IndexOf("SuppressMessage", StringComparison.Ordinal) >= 0);
        }
    }
}


text:
#include <string.h>
#include <memory.h>

namespace NULLCVector
{
#pragma pack(push, 4)
	struct vector
	{
		unsigned int	elemType;
		unsigned int	flags;
		unsigned int	elemSize;
		NULLCAutoArray	data;
		unsigned int	size;
	};

	struct vector_iterator
	{
		vector*			arr;
		unsigned int	pos;
	};
#pragma pack(pop)

	void ConstructVector(vector* vec, unsigned int type, int reserved)
	{
		vec->elemType = type;
		vec->flags = nullcIsPointer(type);
		vec->size = 0;
		vec->elemSize = nullcGetTypeSize(type);
		vec->data.typeID = type;
		if(reserved)
		{
			NULLCArray data = nullcAllocateArrayTyped(type, reserved);

			vec->data.ptr = data.ptr;
			vec->data.len = data.len;
		}else{
			vec->data.ptr = 0;
			vec->data.len = 0;
		}
	}

	void VectorPushBack(NULLCRef val, vector* vec)
	{
		// Check that we received type that is equal to array element type
		if(val.typeID != (vec->flags ? nullcGetSubType(vec->elemType) : vec->elemType))
		{
			nullcThrowError("vector::push_back received value (%s) that is different from vector type (%s)", nullcGetTypeName(val.typeID), nullcGetTypeName(vec->elemType));
			return;
		}
		// If not enough space
		if(vec->size == vec->data.len)
		{
			// Allocate new
			unsigned int newSize = 32 > vec->data.len ? 32 : (vec->data.len << 1) + vec->data.len;

			NULLCArray newData = nullcAllocateArrayTyped(vec->data.typeID, newSize);

			if(!newData.ptr)
				return;

			if(vec->data.len)
				memcpy(newData.ptr, vec->data.ptr, unsigned(vec->elemSize * vec->data.len));

			vec->data.ptr = newData.ptr;
			vec->data.len = newData.len;
		}
		memcpy(vec->data.ptr + vec->elemSize * vec->size, vec->flags ? (char*)&val.ptr : val.ptr, vec->elemSize);
		vec->size++;
	}

	void VectorPopBack(vector* vec)
	{
		if(!vec->size)
		{
			nullcThrowError("vector::pop_back called on an empty vector");
			return;
		}
		vec->size--;
	}

	NULLCRef VectorFront(vector* vec)
	{
		NULLCRef ret = { 0, 0 };
		if(!vec->size)
		{
			nullcThrowError("vector::front called on an empty vector");
			return ret;
		}
		ret.typeID = (vec->flags ? nullcGetSubType(vec->elemType) : vec->elemType);
		ret.ptr = vec->flags ? *(char**)vec->data.ptr : vec->data.ptr;
		return ret;
	}

	NULLCRef VectorBack(vector* vec)
	{
		NULLCRef ret = { 0, 0 };
		if(!vec->size)
		{
			nullcThrowError("vector::back called on an empty vector");
			return ret;
		}
		ret.typeID = (vec->flags ? nullcGetSubType(vec->elemType) : vec->elemType);
		ret.ptr = vec->flags ? ((char**)vec->data.ptr)[vec->size - 1] : (vec->data.ptr + vec->elemSize * (vec->size - 1));
		return ret;
	}

	NULLCRef VectorIndex(vector* vec, unsigned int index)
	{
		NULLCRef ret = { 0, 0 };
		if(index >= vec->size)
		{
			nullcThrowError("operator[] array index out of bounds");
			return ret;
		}
		ret.typeID = (vec->flags ? nullcGetSubType(vec->elemType) : vec->elemType);
		ret.ptr = vec->flags ? ((char**)vec->data.ptr)[index] : (vec->data.ptr + vec->elemSize * index);
		return ret;
	}

	void VectorReserve(unsigned int size, vector* vec)
	{
		// If not enough space
		if(size > vec->data.len)
		{
			// Allocate new
			NULLCArray newData = nullcAllocateArrayTyped(vec->data.typeID, size);

			if(!newData.ptr)
				return;

			memcpy(newData.ptr, vec->data.ptr, unsigned(vec->elemSize * vec->data.len));

			vec->data.ptr = newData.ptr;
			vec->data.len = newData.len;
		}
	}

	void VectorResize(unsigned int size, vector* vec)
	{
		VectorReserve(size, vec);
		vec->size = size;
	}

	void VectorClear(vector* vec)
	{
		vec->size = 0;
	}

	void VectorDestroy(vector* vec)
	{
		vec->size = 0;
		vec->data.len = 0;
		vec->data.ptr = 0;
	}

	int VectorSize(vector* vec)
	{
		return vec->size;
	}

	int VectorCapacity(vector* vec)
	{
		return vec->data.len;
	}

	NULLCRef VectorNext(vector_iterator* iter)
	{
		NULLCRef ret;
		ret.typeID = (iter->arr->flags ? nullcGetSubType(iter->arr->elemType) : iter->arr->elemType);
		ret.ptr =  iter->arr->flags ? ((char**)iter->arr->data.ptr)[iter->pos] : iter->arr->data.ptr + iter->arr->elemSize * iter->pos;
		iter->pos++;
		return ret;
	}
	int VectorHasNext(vector_iterator* iter)
	{
		return iter->arr && iter->pos < iter->arr->size;
	}

}

#define REGISTER_FUNC(funcPtr, name, index) if(!nullcBindModuleFunctionHelper("old.vector", NULLCVector::funcPtr, name, index)) return false;
bool	nullcInitVectorModule()
{
	REGISTER_FUNC(ConstructVector, "cConstructVector", 0);

	REGISTER_FUNC(VectorPushBack, "vector::push_back", 0);
	REGISTER_FUNC(VectorPopBack, "vector::pop_back", 0);
	REGISTER_FUNC(VectorFront, "vector::front", 0);
	REGISTER_FUNC(VectorBack, "vector::back", 0);
	REGISTER_FUNC(VectorIndex, "[]", 0);
	REGISTER_FUNC(VectorReserve, "vector::reserve", 0);
	REGISTER_FUNC(VectorResize, "vector::resize", 0);
	REGISTER_FUNC(VectorClear, "vector::clear", 0);
	REGISTER_FUNC(VectorDestroy, "vector::destroy", 0);
	REGISTER_FUNC(VectorSize, "vector::size", 0);
	REGISTER_FUNC(VectorCapacity, "vector::capacity", 0);

	REGISTER_FUNC(VectorNext, "vector_iterator::next", 0);
	REGISTER_FUNC(VectorHasNext, "vector_iterator::hasnext", 0);

	return true;
}


text:
package vep.app.production.company

import akka.http.scaladsl.server.Route
import akka.http.scaladsl.server.Directives._
import vep.Configuration
import vep.app.common.verifications.CommonVerifications
import vep.app.production.company.show.ShowIntegrationModule
import vep.app.user.UserService

import scala.concurrent.ExecutionContext

trait CompanyIntegrationModule
  extends ShowIntegrationModule {
  def userService: UserService
  def commonVerifications: CommonVerifications
  def executionContext: ExecutionContext
  def configuration: Configuration

  lazy val companyVerifications = new CompanyVerifications(
    commonVerifications
  )
  lazy val companyService = new CompanyService()
  lazy val companyRouter = new CompanyRouter(
    companyVerifications,
    companyService,
    configuration,
    userService,
    executionContext
  )
  lazy val companyRoute: Route = companyRouter.route ~ showRoute
}