text:
$ErrorActionPreference = "Stop"

# WANT_JSON
# POWERSHELL_COMMON

$result = @{
    changed = $false
}

function Invoke-TaskPathCheck {
    [CmdletBinding(SupportsShouldProcess=$true)]
    param($Path, [Switch]$Remove)

    $pathResults = @{
        PathExists = $null
        RemovedPath = $false
    }

    if ($path -ne "\") {
        $trimmedPath = $Path.TrimEnd("\")
    }
    else {
        $trimmedPath = $Path
    }

    $scheduleObject = New-Object -ComObject Schedule.Service
    $scheduleObject.Connect()

    try {
        $targetFolder = $scheduleObject.GetFolder($trimmedPath)
        $pathResults.PathExists = $true
    }
    catch {
        $pathResults.PathExists = $false
    }

    if ($Remove -and $pathResults.PathExists) {
        $childFolders = $targetFolder.GetFolders($null)
        $childTasks = $targetFolder.GetTasks($null)

        if ($childFolders.Count -eq 0 -and $childTasks.Count -eq 0) {
            if ($PSCmdlet.ShouldProcess($trimmedPath, "Remove task path")) {
                $rootFolder = $scheduleObject.GetFolder("\")
                $rootFolder.DeleteFolder($trimmedPath, $null)
            }
            $pathResults.RemovedPath = $true
        }
    }

    return $pathResults
}

$params = Parse-Args $args -supports_check_mode $true
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false

$arguments = Get-AnsibleParam -obj $params -name "arguments" -type "str" -aliases "argument"
$description = Get-AnsibleParam -obj $params -name "description" -type "str" -default "No description."
$enabled = Get-AnsibleParam -obj $params -name "enabled" -type "bool" -default $true
$path = Get-AnsibleParam -obj $params -name "path" -type "str" -default '\'

# Required vars
$name = Get-AnsibleParam -obj $params -name "name" -type "str" -failifempty $true
$state = Get-AnsibleParam -obj $params -name "state" -type "str" -default "present" -validateset "present","absent"

# Vars conditionally required
$present = $state -eq "present"
$executable = Get-AnsibleParam -obj $params -name "executable" -type "str" -aliases "execute" -failifempty $present
$frequency = Get-AnsibleParam -obj $params -name "frequency" -type "str" -validateset "once","daily","weekly" -failifempty $present
$time = Get-AnsibleParam -obj $params -name "time" -type "str" -failifempty $present

$user = Get-AnsibleParam -obj $params -name "user" -default "$env:USERDOMAIN\$env:USERNAME" -type "str"
$password = Get-AnsibleParam -obj $params -name "password" -type "str"
$runlevel = Get-AnsibleParam -obj $params -name "runlevel" -default "limited" -type "str" -validateset "limited", "highest"
$store_password = Get-AnsibleParam -obj $params -name "store_password" -default $true -type "bool"

$weekly = $frequency -eq "weekly"
$days_of_week = Get-AnsibleParam -obj $params -name "days_of_week" -type "str" -failifempty $weekly

try {
    $task = Get-ScheduledTask | Where-Object {$_.TaskName -eq $name -and $_.TaskPath -eq $path}

    # Correlate task state to enable variable, used to calculate if state needs to be changed
    $taskState = if ($task) { $task.State } else { $null }
    if ($taskState -eq "Ready"){
        $taskState = $true
    }
    elseif($taskState -eq "Disabled"){
        $taskState = $false
    }
    else
    {
        $taskState = $null
    }

    $measure = $task | measure
    if ($measure.count -eq 1 ) {
        $exists = $true
    }
    elseif ( ($measure.count -eq 0) -and ($state -eq "absent") ){
        # Nothing to do
        $result.exists = $false
        $result.msg = "Task does not exist"

        Exit-Json $result
    }
    elseif ($measure.count -eq 0){
        $exists = $false
    }
    else {
        # This should never occur
        Fail-Json $result "$($measure.count) scheduled tasks found"
    }

    $result.exists = $exists

    if ($frequency){
        if ($frequency -eq "once") {
            $trigger = New-ScheduledTaskTrigger -Once -At $time
        }
        elseif ($frequency -eq "daily") {
            $trigger = New-ScheduledTaskTrigger -Daily -At $time
        }
        elseif ($frequency -eq "weekly"){
            $trigger = New-ScheduledTaskTrigger -Weekly -At $time -DaysOfWeek $days_of_week
        }
        else {
            Fail-Json $result "frequency must be daily or weekly"
        }
    }

    if ( ($state -eq "absent") -and ($exists) ) {
        Unregister-ScheduledTask -TaskName $name -Confirm:$false -WhatIf:$check_mode
        $result.changed = $true
        $result.msg = "Deleted task $name"

        # Remove task path if it exists
        $pathResults = Invoke-TaskPathCheck -Path $path -Remove -WhatIf:$check_mode

        if ($pathResults.RemovedPath) {
            $result.msg += " and task path $path removed"
        }

        Exit-Json $result
    }
    elseif ( ($state -eq "absent") -and (-not $exists) ) {
        $result.msg = "Task $name does not exist"
        Exit-Json $result
    }

    # Handle RunAs/RunLevel options for the task

    if ($store_password) {
        # Specify direct credential and run-level values to add to Register-ScheduledTask
        $registerRunOptionParams = @{
            User = $user
            RunLevel = $runlevel
        }
        if ($password) {
            $registerRunOptionParams.Password = $password
        }
    }
    else {
        # Create a ScheduledTaskPrincipal for the task to run under
        $principal = New-ScheduledTaskPrincipal -UserId $user -LogonType S4U -RunLevel $runlevel -Id Author
        $registerRunOptionParams = @{Principal = $principal}
    }

    if ($enabled){
        $settings = New-ScheduledTaskSettingsSet
    }
    else {
        $settings = New-ScheduledTaskSettingsSet -Disable
    }

    if ($arguments) {
        $action = New-ScheduledTaskAction -Execute $executable -Argument $arguments
    }
    else {
        $action = New-ScheduledTaskAction -Execute $executable
    }

    if ( ($state -eq "present") -and (-not $exists) ){
        # Check task path prior to registering
        $pathResults = Invoke-TaskPathCheck -Path $path

        if (-not $check_mode) {
            Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $name -Description $description -TaskPath $path -Settings $settings @registerRunOptionParams
        }

        $result.changed = $true
        $result.msg = "Added new task $name"

        if (!$pathResults.PathExists) {
            $result.msg += " and task path $path created"
        }
    }
    elseif( ($state -eq "present") -and ($exists) ) {
        # Check task path prior to registering
        $pathResults = Invoke-TaskPathCheck -Path $path

        if ((!$store_password -and $task.Principal.LogonType -in @("S4U", "ServiceAccount")) -or ($store_password -and $task.Principal.LogonType -notin @("S4U", "Password") -and !$password)) {
            $passwordStoreConsistent = $true
        }
        else {
            $passwordStoreConsistent = $false
        }

        if ($task.Description -eq $description -and $task.TaskName -eq $name -and $task.TaskPath -eq $path -and $task.Actions.Execute -eq $executable -and
        $taskState -eq $enabled -and $task.Principal.UserId -eq $user -and $task.Principal.RunLevel -eq $runlevel -and $passwordStoreConsistent) {
            # No change in the task
            $result.msg = "No change in task $name"
        }
        else {
            Unregister-ScheduledTask -TaskName $name -Confirm:$false -WhatIf:$check_mode

            if (-not $check_mode) {
                $oldPathResults = Invoke-TaskPathCheck -Path $task.TaskPath -Remove
                Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $name -Description $description -TaskPath $path -Settings $settings @registerRunOptionParams
            }
            $result.changed = $true
            $result.msg = "Updated task $name"

            if (!$pathResults.PathExists) {
                $result.msg += " and task path $path created"
            }
        }
    }

    Exit-Json $result
}
catch
{
  Fail-Json $result $_.Exception.Message
}


text:
import os
from functools import partial
from pluginbase import PluginBase
from util.singleton import Singleton
# ####################

# For easier usage calculate the path relative to here.
here = os.path.abspath(os.path.dirname(__file__))
get_path = partial(os.path.join, here)
plugin_base = PluginBase(package='plugins',
                         searchpath=[get_path('./plugins'), get_path('../plugins')])

@Singleton
class SiteParserFactory():

    """
    Chooses the right subclass function to call.
    """
    def __init__(self):
        self.plugins = {}

        self.source = plugin_base.make_plugin_source(
            searchpath=[get_path('./plugins'), get_path('../plugins')])

        print('Loading Plugins')
        for plugin_name in self.source.list_plugins():
            plugin = self.source.load_plugin(plugin_name)
            setup_op = getattr(plugin, "setup", None)
            if callable(setup_op):
                setup_op(self)

        print('Finished Loading Plugins')

    def register_plugin(self, name, plugin):
        """A function a plugin can use to register a formatter."""
        self.plugins[name] = plugin
        print("Loaded Plugin '%s'" % name)

    def get_instance(self, options):
        parser_class = self.plugins.get(options.site, None)

        if not parser_class:
            raise NotImplementedError("Site Not Supported")

        return parser_class(options)

redpajama_set_name: RedPajamaGithub


text:
from __future__ import absolute_import, unicode_literals

import argparse
import unittest

from nose.tools import ok_
try:
    from unittest.mock import patch
except ImportError:
    from mock import patch

from streamparse.cli.run import main, subparser_hook

class RunTestCase(unittest.TestCase):

    def test_subparser_hook(self):
        parser = argparse.ArgumentParser()
        subparsers = parser.add_subparsers()
        subparser_hook(subparsers)

        subcommands = parser._optionals._actions[1].choices.keys()
        ok_('run' in subcommands)

    @patch('streamparse.cli.run.run_local_topology', autospec=True)
    def test_main_args_passed(self, run_local_mock):
        parser = argparse.ArgumentParser()
        subparsers = parser.add_subparsers()
        subparser_hook(subparsers)

        args = parser.parse_args('run -e my_env -n my_topo --ackers 1'.split())

        main(args)
        run_local_mock.assert_called_with(name='my_topo',
                                          options={'topology.acker.executors': 1},
                                          env_name='my_env',
                                          time=0)

if __name__ == '__main__':
    unittest.main()


text:
function Todoist($scope, TodoistService, SpeechService, Focus) {

	// Show project
	SpeechService.addCommand('todoist_show', function (project) {
		console.debug("Show todoist project");
		getTodoist(project)
		Focus.change("todoist");
	});

	// Add element to project
	SpeechService.addCommand('todoist_add', function (element, project) {
		console.debug("Add element to todoist project");
		addItemTodoist(element, project);
		Focus.change("todoist");
	});

	// Remove element from project
	SpeechService.addCommand('todoist_remove', function (element, project) {
		console.debug("Remove element from todoist project");
		removeItemTodoist(element, project);
		Focus.change("todoist");
	});

	var getTodoist = function(project){
		TodoistService.getItemsFromProject(project).then(function (items) {
			$scope.todoist = items;
		}, function (error) {
			$scope.todoist = { error: error };
		});
	}

	var addItemTodoist = function(element, project){
		TodoistService.addTask(element, project).then(function () {
			getTodoist(project)
		}, function (error) {
			$scope.todoist = { error: error };
		});
	}

	var removeItemTodoist = function(element, project){
		TodoistService.completeTask(element, project).then(function () {
			getTodoist(project)
		}, function (error) {
			$scope.todoist = { error: error };
		});
	}
}

angular.module('SmartMirror')
    .controller('Todoist', Todoist);


text:
require 'rails_helper'

describe MessageTrain::ParticipantsController do
  include_context 'loaded site'
  include ControllerMacros
  routes { MessageTrain::Engine.routes }

  before do
    login_user first_user
  end

  describe 'GET #index' do
    describe 'with model to users' do
      before do
        get(
          :index,
          params: {
            box_division: 'in', model: 'users'
          },
          format: :json
        )
      end
      it_should_behave_like 'a successful page', which_renders: 'index'

      context 'loads participants into @participants' do
        subject { assigns(:participants) }
        its(:first) { should be_a User }
      end
    end
    describe 'with model set to groups' do
      describe 'given model responds to fallback method' do
        before do
          get(
            :index,
            params: {
              box_division: 'in', model: 'groups'
            },
            format: :json
          )
        end
        it_should_behave_like 'a successful page', which_renders: 'index'

        context 'loads participants into @participants' do
          subject { assigns(:participants) }
          its(:first) { should be_a Group }
          it { should have_exactly(2).items }
        end
      end
      describe 'given model does not fallback method' do
        before do
          MessageTrain.configuration.address_book_method = nil
          get(
            :index,
            params: {
              box_division: 'in', model: 'groups'
            },
            format: :json
          )
        end
        it_should_behave_like 'a successful page', which_renders: 'index'

        context 'loads participants into @participants' do
          subject { assigns(:participants) }
          its(:first) { should be_a Group }
          it { should have_exactly(4).items }
        end
      end
    end
    describe 'with no model set' do
      before do
        get(
          :index,
          params: {
            box_division: 'in', model: ''
          },
          format: :json
        )
      end
      it_should_behave_like 'a 404 Not Found error'
    end
  end

  describe 'GET #show' do
    before do
      get(
        :show,
        params: {
          box_division: 'in',
          model: 'users',
          id: first_user.id
        },
        format: :json
      )
    end
    it_should_behave_like 'a successful page', which_renders: 'show'

    context 'loads participant into @participant' do
      subject { assigns(:participant) }
      it { should eq first_user }
    end
  end
end


text:
package teams.api;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils;
import teams.api.validations.TeamValidator;
import teams.domain.*;
import teams.exception.DuplicateTeamNameException;
import teams.exception.NotAllowedException;
import teams.exception.ResourceNotFoundException;
import teams.mail.MailBox;
import teams.repository.*;

import javax.mail.MessagingException;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.stream.StreamSupport;

import static java.lang.String.format;
import static java.util.stream.Collectors.toList;

public abstract class ApiController implements TeamValidator {

    protected final Logger log = LoggerFactory.getLogger(getClass());

    @Value("${teams.default-stem-name}")
    private String defaultStemName;

    @Autowired
    protected TeamRepository teamRepository;

    @Autowired
    protected MembershipRepository membershipRepository;

    @Autowired
    protected ExternalTeamRepository externalTeamRepository;

    @Autowired
    protected InvitationRepository invitationRepository;

    @Autowired
    protected JoinRequestRepository joinRequestRepository;

    @Autowired
    protected MailBox mailBox;

    public static final String ADMIN_HEADER = "X-ADMIN-HEADER";

    protected Team teamById(Long id, boolean includePersons) {
        Team team = includePersons ? teamRepository.findFirstById(id) : teamRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Team not found:" + id));
        assertNotNull("Team", team, id);
        return team;
    }

    protected Membership membership(Team team, String urn) {
        return team.member(urn)
                .orElseThrow(() -> new NotAllowedException(format
                        ("Member %s is not a member of team %s.", urn, team.getUrn())));
    }

    protected void assertNotNull(String entityName, Object entity, Object id) {
        if (entity == null) {
            throw new ResourceNotFoundException(String.format("%s %s does not exist", entityName, id));
        }
    }

    protected List<Invitation> saveAndSendInvitation(List<Invitation> invitations, Team team, Person person, FederatedUser federatedUser) {
        Iterable<Invitation> saved = invitationRepository.saveAll(invitations);
        saved.forEach(invitation -> {
            try {
                mailBox.sendInviteMail(invitation, federatedUser);
                log.info("Created invitation by {} for team {} and person {} with email {}",
                        federatedUser.getPerson().getUrn(),
                        team.getUrn(),
                        person.getUrn(),
                        invitation.getEmail());
            } catch (MessagingException | IOException e) {
                throw new IllegalArgumentException(e);
            }
        });
        return StreamSupport.stream(saved.spliterator(), false).collect(toList());
    }

    protected String constructUrn(String name) {
        return format("%s:%s", defaultStemName,
                name.toLowerCase().trim().replaceAll("[ ']", "_"));
    }

    protected void teamNameDuplicated(String name, List<Object> urns) {
        if (!urns.isEmpty()) {
            throw new DuplicateTeamNameException(format("Team with name %s already exists", name));
        }
    }

    public Team doCreateTeam(NewTeamProperties teamProperties, FederatedUser federatedUser) {
        String name = teamProperties.getName();
        validateTeamName(name);

        String urn = constructUrn(name);
        List<Object> urns = teamRepository.existsByUrn(urn);
        List<Object> names = teamRepository.existsByHistoryName(name.toLowerCase());
        urns.addAll(names);

        teamNameDuplicated(name, urns);

        Team team = new Team(urn, name, teamProperties.getDescription(), teamProperties.isViewable(),
                teamProperties.isHideMembers(), teamProperties.getPersonalNote());
        team.setPublicLinkDisabled(teamProperties.isPublicLinkDisabled());
        Person person = federatedUser.getPerson();
        Team savedTeam = teamRepository.save(team);

        log.info("Team {} created by {}", urn, federatedUser.getUrn());

        if (!CollectionUtils.isEmpty(teamProperties.getEmails())) {
            teamProperties.getEmails().forEach((email, role) -> {
                Invitation invitation = new Invitation(
                        team,
                        email,
                        Role.valueOf(role),
                        teamProperties.getLanguage(),
                        null,
                        null);
                invitation.addInvitationMessage(person, teamProperties.getInvitationMessage());
                Invitation saved = saveAndSendInvitation(Collections.singletonList(invitation), team, person, federatedUser).get(0);
                savedTeam.getInvitations().add(saved);

            });
        }

        return team;
    }

}


text:
package de.sebastianrothbucher.vaadin.html5.widgetset.client;

import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.ui.textfield.TextFieldConnector;
import com.vaadin.shared.ui.Connect;

@Connect(de.sebastianrothbucher.vaadin.html5.widgetset.EmailField.class)
public class EmailFieldConnector extends TextFieldConnector {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected Widget createWidget() {
		return GWT.create(EmailFieldWidget.class);
	}

	@Override
	public EmailFieldWidget getWidget() {
		return (EmailFieldWidget) super.getWidget();
	}

}


text:
_See [I (initial point in this web)](https://github.com/irnc/i)._

Беларусь можно думать, но мне нужно её ещё исследовать и понять.

В городах доминирует русский язык, а [использование белорусского языка фрагментировано двумя нормами](https://github.com/irnc/be-be-x-old). Язык [вообще интересная штука](https://github.com/irnc/explore-language).

Иностранный язык изучается со школы, а иногда и с последнего года в детском саду. [Английский язык](https://github.com/irnc/learn-english) изучался и родителями (РТИ), и мной (СШ №23, СШ №27, лицей №1, ГрГУ, курсы на работе), и вероятно будет и моими детьми.

А эту страну населяет [уйма существ](https://github.com/irnc/insects-belarus), которая то и о стране ничего не знает.

[Электронное правительство](https://github.com/irnc/e-gov) вроде и есть, но его никто не ощущает: тонны бумаги, волокита и безучастие... но кто-то скажет что раньше то было и похуже. Не правительством едины, [НГО](https://github.com/irnc/ngo) живут своей непростой жизнью. А граждане своей, в [товариществах собстенников](https://github.com/irnc/dom83.by) и своих [_уютных квартирках_](https://github.com/irnc/kvartira).

## История

[История украдена](https://github.com/irnc/magnus-ducatus), и ни воспитание, ни образование не стремятся связать поколения.

Вот едешь ты на Mirum Music Festival, в Мир, который на реке Миранке. Ищешь где бы поплавать, а находишь интереснейшую историю [_Миранки_](https://github.com/irnc/miranka).

Есть большая родина, а есть малая ([город Гродно](https://github.com/irnc/grodno), деревня Пасиничи, Озёры). Есть [контекст истории](https://github.com/irnc/grodno-streets), который сильнейшим образом воздействует на настоящее. И этот контекст очень [интересно изучать по источникам](https://github.com/irnc/grodno-sources).

## В Беларуси история начинается с СССР и большевиков

> Отправной точкой деятельности нашего журнала можно считать дату 6 мая 1922 года, когда президиум ЦК КП(б)Б принял постановление об издании в Минске теоретического и политического журнала «Вперед».

> -- [О Журнале _[Беларуская думка]_ / История.](http://beldumka.belta.by/ru/about/history), 20 августа 2015

## Вторая мировая война

Смотрите [Вторая мировая война](world-war-ii.md).

## Жизнь после войны

* http://www.azot.by/ru/about/history

## История и люди

http://fremus.narod.ru/schoolbk.html

## Земля: археология и кладоискательство

* http://www.belklad.by/forum/ & http://belklad.com/forum/ это Чеслава
* http://www.belskarb.com/forum/
* http://belklad.flybb.ru/ лозаменовский
  * см. http://www.belklad.by/forum/viewtopic.php?f=35&t=11686

### 2008, Малыщина

* http://geektimes.ru/post/42490/
* http://geektimes.ru/post/42878/


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;

namespace Microsoft.SharePoint.Client.NetCore.Runtime
{
    internal sealed class ClientRuntimeConfigurationSection //: ConfigurationSection
    {
        //internal const string ConfigNodePath = "microsoft.sharepoint.client/clientRuntime";

        //[ConfigurationProperty("typeAssemblies")]
        //internal AssemblyCollection TypeAssemblies
        //{
        //    get
        //    {
        //        return (AssemblyCollection)base["typeAssemblies"];
        //    }
        //}
    }
}


text:
/**
 * Markdown-it extension
 *
 * Replaces default link_open renderer to add target=_blank
 * attribute to every link generated by markdown-it
 */
(function() {
    window.md_link_target_blank_plugin = function(md) {
        var defaultRenderer = md.renderer.rules.link_open || function(token, idx, options, env, self) {
            return self.renderToken(token, idx, options);
        };

        function linkOpenRenderer(tokens, idx, options, env, self) {
            // If you are sure other plugins can't add `target` - drop check below
            var aIndex = tokens[idx].attrIndex('target');
            var local = tokens[idx].attrIndex('data-link-local');

            if (local < 0){
                if (aIndex < 0) {
                    tokens[idx].attrPush(['target', '_blank']); // add new attribute
                } else {
                    tokens[idx].attrs[aIndex][1] = '_blank';    // replace value of existing attr
                }
            }

            // pass token to default renderer.
            return defaultRenderer(tokens, idx, options, env, self);
        }

        md.renderer.rules.link_open = linkOpenRenderer;
    };
}());


text:
<?php

namespace AmpProject\Optimizer\Configuration;

use AmpProject\Optimizer\Exception\InvalidConfigurationValue;

/**
 * Configuration for the OptimizeAmpBind transformer.
 *
 * @property bool $enabled Whether the amp-bind optimizer is enabled.
 *
 * @package ampproject/amp-toolbox
 */
final class OptimizeAmpBindConfiguration extends BaseTransformerConfiguration
{
    /**
     * Whether the amp-bind optimizer is enabled.
     *
     * @var string
     */
    const ENABLED = 'enabled';

    /**
     * Get the associative array of allowed keys and their respective default values.
     *
     * The array index is the key and the array value is the key's default value.
     *
     * @return array Associative array of allowed keys and their respective default values.
     */
    protected function getAllowedKeys()
    {
        return [
            self::ENABLED => true,
        ];
    }

    /**
     * Validate an individual configuration entry.
     *
     * @param string $key   Key of the configuration entry to validate.
     * @param mixed  $value Value of the configuration entry to validate.
     * @return mixed Validated value.
     */
    protected function validate($key, $value)
    {
        switch ($key) {
            case self::ENABLED:
                if (! is_bool($value)) {
                    throw InvalidConfigurationValue::forInvalidSubValueType(
                        self::class,
                        self::ENABLED,
                        'boolean',
                        is_object($value) ? get_class($value) : gettype($value)
                    );
                }
                break;
        }

        return $value;
    }
}


text:
"""Unit tests for BioCMA."""

import unittest
from cStringIO import StringIO

from Bio import SeqIO

from biocma import biocma, cma, utils

EX_CMA = "fikk.cma"
EX_FASTA = "fikk-full.fasta"

class IOTests(unittest.TestCase):
    """Tests for parsing and writing the CMA format."""

    def test_read(self):
        block = cma.read(EX_CMA)
        self.assertEqual(len(block['sequences']), 24)
        self.assertEqual(block['query_length'], block['sequences'][0]['length'])

    def test_parse(self):
        blocks = list(cma.parse(EX_CMA))
        self.assertEqual(len(blocks), 1)

class BioTests(unittest.TestCase):
    """Tests for the Biopython wrapper."""

    def test_read(self):
        aln = biocma.read(EX_CMA)

class UtilTests(unittest.TestCase):
    """Tests for utility functions."""

    def test_iron(self):
        seq = ('-a-a-LLLGQPIFPGDSGVDQLVEIIKVLgtptre---qiremnpnyteFKFPQIK'
               '---ahpwtkvfrprtPPEAIALCSRLLEYTPTARLT-----PLEACAHSFF-')
        iseq = cma.iron(seq)
        self.assertEqual(len(seq.replace('-', '')),
                         len(iseq.replace('-', '')))

    def test_get_inserts(self):
        block = cma.read(EX_CMA)
        inserts = utils.get_inserts(block)
        self.assertEqual(len(inserts), len(block['sequences']))
        fullseqs = SeqIO.to_dict(SeqIO.parse(EX_FASTA, 'fasta'))
        for sequence, targets in (
            (block['sequences'][1], ['n', 't', 'fyklyllkkydsntlfnv']),
            (block['sequences'][-1], ['altkl', 'nkl',
                                      'siptvgfskdgdrlqemykasvcsyteecqg',
                                      'ndndgeylldge', 'eh', 'p',
                                      'epecancneedknmsennhkkdskhkgdsnhksdsnhksdsnhksdsnhksgsnhksdcnhksgsnhksdsnhqsdcnhmsdhnhksdnnhksdsshksdsshksdsshksgsnhksdnnhksdsshksgsnhksdhnhksdsnhksdsnhknesnhknesnhknesnhknesnhknesnhkndsnhksdsnhmsdhnhksdnnhksdhnhmsdhnhksdnnhksdnnhmsdhnhksdnnhksdnnhksdnnhksdhnhmsdhnhksdnnhksdhnhksdsnhmsdhnhmsdhnhksdhnhksdhnhksdnnhksdsnhksdsnhksdhnhksdsnhmsdhnhmsdhnhksdhnhksdnnhksdsnhksdsnhksdhnhksdsnhmsdhnhmsdhnhmsdhnhksdhnhksdnnhksdsnhksdsnhksdsnhksdhnhksdhkhmsdnnhksdnnhksdhnhksdnnhksdhnhksdsnhksdsnhksdsnhksdsnhksdnnhksdhnhnsdsnhmsdhnhksdhnhksdhnhksdnnhksdnnhksdhnhksdhkknnnnnkdnknddnddsdasdavhediellesysdlnkfnemlteqln',
                                      'vt', 'edtrv', 'pmythnl', 'g',
                                      'sfqscqpcv', 'iirehiklkidnpfehlstitdqee',
                                      'yfd', 'ra', 'fqlak'])):
            full = fullseqs[sequence['id']]
            ins_ranges = [str(full.seq)[start-1:end]
                       for start, end in inserts[sequence['id']]]
            print sequence['id'], ins_ranges
            self.assertEqual(len(ins_ranges), len(targets))
            for ins, tgt in zip(ins_ranges, targets):
                self.assertEqual(ins.lower(), tgt)

# ---------------------------------------------------------

if __name__ == '__main__':
    runner = unittest.TextTestRunner(verbosity=2)
    unittest.main(testRunner=runner)


text:
package org.openended.recommender;

import static com.google.common.collect.Lists.newArrayList;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.anyVararg;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import java.util.UUID;

import org.apache.mahout.cf.taste.common.TasteException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;

import lombok.SneakyThrows;

@AutoConfigureMockMvc
@RecommenderIntegrationTest
@RunWith(SpringRunner.class)
public class RecommenderEndpointTest {

    @Autowired
    private MockMvc mvc;

    @MockBean
    private RecommenderService recommenderService;

    @Test
    @SneakyThrows
    public void should_render_recommendations() {
        // GIVEN
        UUID item = UUID.fromString("91d2e84f-6eca-472f-8954-ade8486ad44f");
        UUID reco1 = UUID.fromString("e0826ddb-f20b-4092-a958-595949db611f");
        UUID reco2 = UUID.fromString("1aab4ed2-6608-422f-8724-a242ff2411a1");
        given(recommenderService.recommend(anyVararg()))
                .willReturn(newArrayList(reco1, reco2));

        // WHEN
        ResultActions resultActions = mvc.perform(get("/recommender/recommendations")
                .param("item", item.toString())
                .accept(APPLICATION_JSON))
                .andDo(print());

        // THEN
        resultActions
                .andExpect(status().isOk())
                .andExpect(content().contentTypeCompatibleWith(APPLICATION_JSON))
                .andExpect(content().encoding("UTF-8"))
                .andExpect(content().json("{\"items\":[\"91d2e84f-6eca-472f-8954-ade8486ad44f\"],\"recommendations\":[\"e0826ddb-f20b-4092-a958-595949db611f\",\"1aab4ed2-6608-422f-8724-a242ff2411a1\"]}"));
    }

    @Test
    @SneakyThrows
    public void should_handle_recommender_exception() {
        // GIVEN
        UUID item = UUID.fromString("91d2e84f-6eca-472f-8954-ade8486ad44f");
        given(recommenderService.recommend(anyVararg()))
                .willThrow(new RecommenderException("test", new TasteException()));

        // WHEN
        ResultActions resultActions = mvc.perform(get("/recommender/recommendations")
                .param("item", item.toString())
                .accept(APPLICATION_JSON))
                .andDo(print());

        // THEN
        resultActions
                .andExpect(status().isOk())
                .andExpect(content().contentTypeCompatibleWith(APPLICATION_JSON))
                .andExpect(content().encoding("UTF-8"))
                .andExpect(content().json("{\"items\":[\"91d2e84f-6eca-472f-8954-ade8486ad44f\"],\"recommendations\":[]}"));
    }
}


text:
"use strict";

// PAGE SETUP & EVENT LISTENERS

var authorArray = []

$(function() {
  setAuthorListeners();
  getAuthors();
  $('#author-books-list').hide()
});

function setAuthorListeners() {
  $("#show-author-books").click(function(e) {
    $('#author-books-list').toggle();
  });
};

function getAuthors() {
  $.get('/authors.json', function(authors) {
    setAuthorsArray(authors);
  })
}

function setAuthorsArray(authors) {
  authors.forEach(function(author) {
    authorArray.push(author.name)
  });
  setAuthorSearch();
}

// AUTHOR MODEL

function Author(author) {
  this.id = author.id
  this.name = author.name
  this.books = alphabetize(author.books, "title")
}

Author.prototype.listBooks = function() {
  var html = ""
  var result = this.books.forEach(function(book) {
    html += '
' + book.title + '
'
  })
  return html
}

// SEARCH FUNCTIONS

function setAuthorSearch() {
  var authorNames = new Bloodhound({
    datumTokenizer: Bloodhound.tokenizers.whitespace,
    queryTokenizer: Bloodhound.tokenizers.whitespace,
    local: authorArray
  });

  $('#author-search .typeahead').typeahead({
      hint: true,
      highlight: true,
      minLength: 1
    },
    {
      name: 'authorNames',
      source: authorNames
  });
}


text:
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

#include <string.h>
#include <CoreFoundation/CFBase.h>
#include <CoreFoundation/CFCharacterSet.h>
#include <CoreFoundation/CFUniChar.h>
#include <CoreFoundation/CFUnicodeDecomposition.h>
#include "CFInternal.h"
#include "CFUniCharPriv.h"

// Canonical Decomposition
static UTF32Char *__CFUniCharDecompositionTable = NULL;
static uint32_t __CFUniCharDecompositionTableLength = 0;
static UTF32Char *__CFUniCharMultipleDecompositionTable = NULL;

static const uint8_t *__CFUniCharDecomposableBitmapForBMP = NULL;
static const uint8_t *__CFUniCharHFSPlusDecomposableBitmapForBMP = NULL;

static CFLock_t __CFUniCharDecompositionTableLock = CFLockInit;

static const uint8_t **__CFUniCharCombiningPriorityTable = NULL;
static uint8_t __CFUniCharCombiningPriorityTableNumPlane = 0;

static void __CFUniCharLoadDecompositionTable(void) {

    __CFLock(&__CFUniCharDecompositionTableLock);

    if (NULL == __CFUniCharDecompositionTable) {
        const uint32_t *bytes = (uint32_t *)CFUniCharGetMappingData(kCFUniCharCanonicalDecompMapping);

        if (NULL == bytes) {
            __CFUnlock(&__CFUniCharDecompositionTableLock);
            return;
        }

        __CFUniCharDecompositionTableLength = *(bytes++);
        __CFUniCharDecompositionTable = (UTF32Char *)bytes;
        __CFUniCharMultipleDecompositionTable = (UTF32Char *)((intptr_t)bytes + __CFUniCharDecompositionTableLength);

        __CFUniCharDecompositionTableLength /= (sizeof(uint32_t) * 2);
        __CFUniCharDecomposableBitmapForBMP = CFUniCharGetBitmapPtrForPlane(kCFUniCharCanonicalDecomposableCharacterSet, 0);
        __CFUniCharHFSPlusDecomposableBitmapForBMP = CFUniCharGetBitmapPtrForPlane(kCFUniCharHFSPlusDecomposableCharacterSet, 0);

        CFIndex idx;

        __CFUniCharCombiningPriorityTableNumPlane = CFUniCharGetNumberOfPlanesForUnicodePropertyData(kCFUniCharCombiningProperty);
        __CFUniCharCombiningPriorityTable = (const uint8_t **)CFAllocatorAllocate(kCFAllocatorSystemDefault, sizeof(uint8_t *) * __CFUniCharCombiningPriorityTableNumPlane, 0);
        for (idx = 0;idx < __CFUniCharCombiningPriorityTableNumPlane;idx++) __CFUniCharCombiningPriorityTable[idx] = (const uint8_t *)CFUniCharGetUnicodePropertyDataForPlane(kCFUniCharCombiningProperty, idx);
    }

    __CFUnlock(&__CFUniCharDecompositionTableLock);
}

static CFLock_t __CFUniCharCompatibilityDecompositionTableLock = CFLockInit;
static UTF32Char *__CFUniCharCompatibilityDecompositionTable = NULL;
static uint32_t __CFUniCharCompatibilityDecompositionTableLength = 0;
static UTF32Char *__CFUniCharCompatibilityMultipleDecompositionTable = NULL;

static void __CFUniCharLoadCompatibilityDecompositionTable(void) {

    __CFLock(&__CFUniCharCompatibilityDecompositionTableLock);

    if (NULL == __CFUniCharCompatibilityDecompositionTable) {
        const uint32_t *bytes = (uint32_t *)CFUniCharGetMappingData(kCFUniCharCompatibilityDecompMapping);

        if (NULL == bytes) {
            __CFUnlock(&__CFUniCharCompatibilityDecompositionTableLock);
            return;
        }

        __CFUniCharCompatibilityDecompositionTableLength = *(bytes++);
        __CFUniCharCompatibilityDecompositionTable = (UTF32Char *)bytes;
        __CFUniCharCompatibilityMultipleDecompositionTable = (UTF32Char *)((intptr_t)bytes + __CFUniCharCompatibilityDecompositionTableLength);

        __CFUniCharCompatibilityDecompositionTableLength /= (sizeof(uint32_t) * 2);
    }

    __CFUnlock(&__CFUniCharCompatibilityDecompositionTableLock);
}

CF_INLINE bool __CFUniCharIsDecomposableCharacterWithFlag(UTF32Char character, bool isHFSPlus) {
    return CFUniCharIsMemberOfBitmap(character, (character < 0x10000 ? (isHFSPlus ? __CFUniCharHFSPlusDecomposableBitmapForBMP : __CFUniCharDecomposableBitmapForBMP) : CFUniCharGetBitmapPtrForPlane(kCFUniCharCanonicalDecomposableCharacterSet, ((character >> 16) & 0xFF))));
}

CF_INLINE uint8_t __CFUniCharGetCombiningPropertyForCharacter(UTF32Char character) { return CFUniCharGetCombiningPropertyForCharacter(character, (((character) >> 16) < __CFUniCharCombiningPriorityTableNumPlane ? __CFUniCharCombiningPriorityTable[(character) >> 16] : NULL)); }

CF_INLINE bool __CFUniCharIsNonBaseCharacter(UTF32Char character) { return ((0 == __CFUniCharGetCombiningPropertyForCharacter(character)) ? false : true); } // the notion of non-base in normalization is characters with non-0 combining class

typedef struct {
    uint32_t _key;
    uint32_t _value;
} __CFUniCharDecomposeMappings;

static uint32_t __CFUniCharGetMappedValue(const __CFUniCharDecomposeMappings *theTable, uint32_t numElem, UTF32Char character) {
    const __CFUniCharDecomposeMappings *p, *q, *divider;

    if ((character < theTable[0]._key) || (character > theTable[numElem-1]._key)) {
        return 0;
    }
    p = theTable;
    q = p + (numElem-1);
    while (p <= q) {
        divider = p + ((q - p) >> 1);    /* divide by 2 */
        if (character < divider->_key) { q = divider - 1; }
        else if (character > divider->_key) { p = divider + 1; }
        else { return divider->_value; }
    }
    return 0;
}

static void __CFUniCharPrioritySort(UTF32Char *characters, CFIndex length) {
    UTF32Char *end = characters + length;

    while ((characters < end) && (0 == __CFUniCharGetCombiningPropertyForCharacter(*characters))) ++characters;

    if ((end - characters) > 1) {
        uint32_t p1, p2;
        UTF32Char *ch1, *ch2;
        bool changes = true;

        do {
            changes = false;
            ch1 = characters; ch2 = characters + 1;
            p2 = __CFUniCharGetCombiningPropertyForCharacter(*ch1);
            while (ch2 < end) {
                p1 = p2; p2 = __CFUniCharGetCombiningPropertyForCharacter(*ch2);
                if (p1 > p2) {
                    UTF32Char tmp = *ch1; *ch1 = *ch2; *ch2 = tmp;
                    changes = true;
                }
                ++ch1; ++ch2;
            }
        } while (changes);
    }
}

static CFIndex __CFUniCharRecursivelyDecomposeCharacter(UTF32Char character, UTF32Char *convertedChars, CFIndex maxBufferLength) {
    uint32_t value = __CFUniCharGetMappedValue((const __CFUniCharDecomposeMappings *)__CFUniCharDecompositionTable, __CFUniCharDecompositionTableLength, character);
    CFIndex length = CFUniCharConvertFlagToCount(value);
    UTF32Char firstChar = value & 0xFFFFFF;
    UTF32Char *mappings = (length > 1 ? __CFUniCharMultipleDecompositionTable + firstChar : &firstChar);
    CFIndex usedLength = 0;

    if (maxBufferLength < length) return 0;

    if (value & kCFUniCharRecursiveDecompositionFlag) {
        usedLength = __CFUniCharRecursivelyDecomposeCharacter(*mappings, convertedChars, maxBufferLength - length);

        --length; // Decrement for the first char
        if (!usedLength || usedLength + length > maxBufferLength) return 0;
        ++mappings;
        convertedChars += usedLength;
    }

    usedLength += length;

    while (length--) *(convertedChars++) = *(mappings++);

    return usedLength;
}

#define HANGUL_SBASE 0xAC00
#define HANGUL_LBASE 0x1100
#define HANGUL_VBASE 0x1161
#define HANGUL_TBASE 0x11A7
#define HANGUL_SCOUNT 11172
#define HANGUL_LCOUNT 19
#define HANGUL_VCOUNT 21
#define HANGUL_TCOUNT 28
#define HANGUL_NCOUNT (HANGUL_VCOUNT * HANGUL_TCOUNT)

CFIndex CFUniCharDecomposeCharacter(UTF32Char character, UTF32Char *convertedChars, CFIndex maxBufferLength) {
    if (NULL == __CFUniCharDecompositionTable) __CFUniCharLoadDecompositionTable();
    if (character >= HANGUL_SBASE && character <= (HANGUL_SBASE + HANGUL_SCOUNT)) {
        CFIndex length;

        character -= HANGUL_SBASE;

        length = (character % HANGUL_TCOUNT ? 3 : 2);

        if (maxBufferLength < length) return 0;

        *(convertedChars++) = character / HANGUL_NCOUNT + HANGUL_LBASE;
        *(convertedChars++) = (character % HANGUL_NCOUNT) / HANGUL_TCOUNT + HANGUL_VBASE;
        if (length > 2) *convertedChars = (character % HANGUL_TCOUNT) + HANGUL_TBASE;
        return length;
    } else {
        return __CFUniCharRecursivelyDecomposeCharacter(character, convertedChars, maxBufferLength);
    }
}

CF_INLINE bool __CFProcessReorderBuffer(UTF32Char *buffer, CFIndex length, void **dst, CFIndex dstLength, CFIndex *filledLength, uint32_t dstFormat) {
    if (length > 1) __CFUniCharPrioritySort(buffer, length);
    return CFUniCharFillDestinationBuffer(buffer, length, dst, dstLength, filledLength, dstFormat);
}

#define MAX_BUFFER_LENGTH (32)
bool CFUniCharDecompose(const UTF16Char *src, CFIndex length, CFIndex *consumedLength, void *dst, CFIndex maxLength, CFIndex *filledLength, bool needToReorder, uint32_t dstFormat, bool isHFSPlus) {
    CFIndex usedLength = 0;
    CFIndex originalLength = length;
    UTF32Char buffer[MAX_BUFFER_LENGTH];
    UTF32Char *decompBuffer = buffer;
    CFIndex decompBufferSize = MAX_BUFFER_LENGTH;
    CFIndex decompBufferLen = 0;
    CFIndex segmentLength = 0;
    UTF32Char currentChar;

    if (NULL == __CFUniCharDecompositionTable) __CFUniCharLoadDecompositionTable();

    while ((length - segmentLength) > 0) {
        currentChar = *(src++);

        if (currentChar < 0x80) {
            if (decompBufferLen > 0) {
                if (!__CFProcessReorderBuffer(decompBuffer, decompBufferLen, &dst, maxLength, &usedLength, dstFormat)) break;
                length -= segmentLength;
                segmentLength = 0;
                decompBufferLen = 0;
            }

            if (maxLength > 0) {
                if (usedLength >= maxLength) break;
                switch (dstFormat) {
                case kCFUniCharUTF8Format: *(uint8_t *)dst = currentChar; dst = (uint8_t *)dst + sizeof(uint8_t); break;
                case kCFUniCharUTF16Format: *(UTF16Char *)dst = currentChar; dst = (uint8_t *)dst + sizeof(UTF16Char); break;
                case kCFUniCharUTF32Format: *(UTF32Char *)dst = currentChar; dst = (uint8_t *)dst + sizeof(UTF32Char); break;
                }
            }

            --length;
            ++usedLength;
        } else {
            if (CFUniCharIsSurrogateLowCharacter(currentChar)) { // Stray surrogagte
                if (dstFormat != kCFUniCharUTF16Format) break;
            } else if (CFUniCharIsSurrogateHighCharacter(currentChar)) {
                if (((length - segmentLength) > 1) && CFUniCharIsSurrogateLowCharacter(*src)) {
                    currentChar = CFUniCharGetLongCharacterForSurrogatePair(currentChar, *(src++));
                } else {
                    if (dstFormat != kCFUniCharUTF16Format) break;
                }
            }

            if (needToReorder && __CFUniCharIsNonBaseCharacter(currentChar)) {
                if ((decompBufferLen + 1) >= decompBufferSize) {
                    UTF32Char *newBuffer;

                    decompBufferSize += MAX_BUFFER_LENGTH;
                    newBuffer = (UTF32Char *)CFAllocatorAllocate(kCFAllocatorSystemDefault, sizeof(UTF32Char) * decompBufferSize, 0);
                    memmove(newBuffer, decompBuffer, (decompBufferSize - MAX_BUFFER_LENGTH) * sizeof(UTF32Char));
                    if (decompBuffer != buffer) CFAllocatorDeallocate(kCFAllocatorSystemDefault, decompBuffer);
                    decompBuffer = newBuffer;
                }

                if (__CFUniCharIsDecomposableCharacterWithFlag(currentChar, isHFSPlus)) { // Vietnamese accent, etc.
                    decompBufferLen += CFUniCharDecomposeCharacter(currentChar, decompBuffer + decompBufferLen, decompBufferSize - decompBufferLen);
                } else {
                    decompBuffer[decompBufferLen++] = currentChar;
                }
            } else {
                if (decompBufferLen > 0) {
                    if (!__CFProcessReorderBuffer(decompBuffer, decompBufferLen, &dst, maxLength, &usedLength, dstFormat)) break;
                    length -= segmentLength;
                    segmentLength = 0;
                }

                if (__CFUniCharIsDecomposableCharacterWithFlag(currentChar, isHFSPlus)) {
                    decompBufferLen = CFUniCharDecomposeCharacter(currentChar, decompBuffer, MAX_BUFFER_LENGTH);
                } else {
                    decompBufferLen = 1;
                    *decompBuffer = currentChar;
                }

                if (!needToReorder || (decompBufferLen == 1)) {
                    if (!CFUniCharFillDestinationBuffer(decompBuffer, decompBufferLen, &dst, maxLength, &usedLength, dstFormat)) break;
                    length -= ((currentChar > 0xFFFF) ? 2 : 1);
                    decompBufferLen = 0;
                    continue;
                }
            }

            segmentLength += ((currentChar > 0xFFFF) ? 2 : 1);
        }
    }

    if ((decompBufferLen > 0) && __CFProcessReorderBuffer(decompBuffer, decompBufferLen, &dst, maxLength, &usedLength, dstFormat)) length -= segmentLength;

    if (decompBuffer != buffer) CFAllocatorDeallocate(kCFAllocatorSystemDefault, decompBuffer);

    if (consumedLength) *consumedLength = originalLength - length;
    if (filledLength) *filledLength = usedLength;

    return ((length > 0) ? false : true);
}

#define MAX_COMP_DECOMP_LEN (32)

static CFIndex __CFUniCharRecursivelyCompatibilityDecomposeCharacter(UTF32Char character, UTF32Char *convertedChars) {
    uint32_t value = __CFUniCharGetMappedValue((const __CFUniCharDecomposeMappings *)__CFUniCharCompatibilityDecompositionTable, __CFUniCharCompatibilityDecompositionTableLength, character);
    CFIndex length = CFUniCharConvertFlagToCount(value);
    UTF32Char firstChar = value & 0xFFFFFF;
    const UTF32Char *mappings = (length > 1 ? __CFUniCharCompatibilityMultipleDecompositionTable + firstChar : &firstChar);
    CFIndex usedLength = length;
    UTF32Char currentChar;
    CFIndex currentLength;

    while (length-- > 0) {
        currentChar = *(mappings++);
        if (__CFUniCharIsDecomposableCharacterWithFlag(currentChar, false)) {
            currentLength = __CFUniCharRecursivelyDecomposeCharacter(currentChar, convertedChars, MAX_COMP_DECOMP_LEN - length);
            convertedChars += currentLength;
            usedLength += (currentLength - 1);
        } else if (CFUniCharIsMemberOf(currentChar, kCFUniCharCompatibilityDecomposableCharacterSet)) {
            currentLength = __CFUniCharRecursivelyCompatibilityDecomposeCharacter(currentChar, convertedChars);
            convertedChars += currentLength;
            usedLength += (currentLength - 1);
        } else {
            *(convertedChars++) = currentChar;
        }
    }

    return usedLength;
}

CF_INLINE void __CFUniCharMoveBufferFromEnd1(UTF32Char *convertedChars, CFIndex length, CFIndex delta) {
    const UTF32Char *limit = convertedChars;
    UTF32Char *dstP;

    convertedChars += length;
    dstP = convertedChars + delta;

    while (convertedChars > limit) *(--dstP) = *(--convertedChars);
}

CF_EXPORT CFIndex CFUniCharCompatibilityDecompose(UTF32Char *convertedChars, CFIndex length, CFIndex maxBufferLength) {
    UTF32Char currentChar;
    UTF32Char buffer[MAX_COMP_DECOMP_LEN];
    const UTF32Char *bufferP;
    const UTF32Char *limit = convertedChars + length;
    CFIndex filledLength;

    if (NULL == __CFUniCharCompatibilityDecompositionTable) __CFUniCharLoadCompatibilityDecompositionTable();

    while (convertedChars < limit) {
        currentChar = *convertedChars;

        if (CFUniCharIsMemberOf(currentChar, kCFUniCharCompatibilityDecomposableCharacterSet)) {
            filledLength = __CFUniCharRecursivelyCompatibilityDecomposeCharacter(currentChar, buffer);

            if (filledLength + length - 1 > maxBufferLength) return 0;

            if (filledLength > 1) __CFUniCharMoveBufferFromEnd1(convertedChars + 1, limit - convertedChars - 1, filledLength - 1);

            bufferP = buffer;
            length += (filledLength - 1);
            while (filledLength-- > 0) *(convertedChars++) = *(bufferP++);
        } else {
            ++convertedChars;
        }
    }

    return length;
}

CF_EXPORT void CFUniCharPrioritySort(UTF32Char *characters, CFIndex length) {
    __CFUniCharPrioritySort(characters, length);
}

#undef MAX_BUFFER_LENGTH
#undef MAX_COMP_DECOMP_LEN
#undef HANGUL_SBASE
#undef HANGUL_LBASE
#undef HANGUL_VBASE
#undef HANGUL_TBASE
#undef HANGUL_SCOUNT
#undef HANGUL_LCOUNT
#undef HANGUL_VCOUNT
#undef HANGUL_TCOUNT
#undef HANGUL_NCOUNT


text:
"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
var utils = require("../util/utils");
var constants_1 = require("../constants");
var Emitter = require("component-emitter2");
var List = /** @class */ (function (_super) {
    __extends(List, _super);
    function List(record) {
        var _this = _super.call(this) || this;
        _this.record = record;
        _this.originalApplyUpdate = _this.record.applyUpdate.bind(_this.record);
        _this.record.applyUpdate = _this.applyUpdate.bind(_this);
        _this.wrappedFunctions = new Map();
        _this.hasAddListener = false;
        _this.hasRemoveListener = false;
        _this.hasMoveListener = false;
        return _this;
    }
    Object.defineProperty(List.prototype, "name", {
        get: function () {
            return this.record.name;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(List.prototype, "isReady", {
        get: function () {
            return this.record.isReady;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(List.prototype, "version", {
        get: function () {
            return this.record.version;
        },
        enumerable: true,
        configurable: true
    });
    List.prototype.whenReady = function (callback) {
        if (callback) {
            this.record.whenReady(this, callback);
        }
        else {
            return this.record.whenReady(this);
        }
    };
    /**
     * Returns the array of list entries or an
     * empty array if the list hasn't been populated yet.
     */
    List.prototype.getEntries = function () {
        var entries = this.record.get();
        if (!(entries instanceof Array)) {
            return [];
        }
        return entries;
    };
    /**
   * Returns true if the list is empty
   */
    List.prototype.isEmpty = function () {
        return this.getEntries().length === 0;
    };
    List.prototype.setEntriesWithAck = function (entries, callback) {
        var _this = this;
        if (!callback) {
            return new Promise(function (resolve, reject) {
                _this.setEntries(entries, function (error) {
                    if (error) {
                        reject(error);
                    }
                    else {
                        resolve();
                    }
                });
            });
        }
        this.setEntries(entries, callback);
    };
    /**
    * Updates the list with a new set of entries
    */
    List.prototype.setEntries = function (entries, callback) {
        var errorMsg = 'entries must be an array of record names';
        var i;
        if (!(entries instanceof Array)) {
            throw new Error(errorMsg);
        }
        for (i = 0; i < entries.length; i++) {
            if (typeof entries[i] !== 'string') {
                throw new Error(errorMsg);
            }
        }
        if (this.record.isReady === false) {
            // ...
        }
        else {
            this.beforeChange();
            this.record.set({ data: entries, callback: callback });
            this.afterChange();
        }
    };
    /**
     * Removes an entry from the list
     *
     * @param {String} entry
     * @param {Number} [index]
     */
    List.prototype.removeEntry = function (entry, index, callback) {
        if (this.record.isReady === false) {
            // ...
            return;
        }
        // @ts-ignore
        var currentEntries = this.record.get();
        var hasIndex = this.hasIndex(index);
        var entries = [];
        var i;
        for (i = 0; i < currentEntries.length; i++) {
            if (currentEntries[i] !== entry || (hasIndex && index !== i)) {
                entries.push(currentEntries[i]);
            }
        }
        this.beforeChange();
        this.record.set({ data: entries, callback: callback });
        this.afterChange();
    };
    /**
   * Adds an entry to the list
   *
   * @param {String} entry
   * @param {Number} [index]
   */
    List.prototype.addEntry = function (entry, index, callback) {
        if (typeof entry !== 'string') {
            throw new Error('Entry must be a recordName');
        }
        if (this.record.isReady === false) {
            // ..
            return;
        }
        var hasIndex = this.hasIndex(index);
        var entries = this.getEntries();
        if (hasIndex) {
            entries.splice(index, 0, entry);
        }
        else {
            entries.push(entry);
        }
        this.beforeChange();
        this.record.set({ data: entries, callback: callback });
        this.afterChange();
    };
    /**
   * Proxies the underlying Record's subscribe method. Makes sure
   * that no path is provided
   */
    List.prototype.subscribe = function (callback) {
        var parameters = utils.normalizeArguments(arguments);
        if (parameters.path) {
            throw new Error('path is not supported for List.subscribe');
        }
        // Make sure the callback is invoked with an empty array for new records
        var listCallback = function (scope, cb) {
            cb(scope.getEntries());
        }.bind(this, this, parameters.callback);
        /**
        * Adding a property onto a function directly is terrible practice,
        * and we will change this as soon as we have a more seperate approach
        * of creating lists that doesn't have records default state.
        *
        * The reason we are holding a referencing to wrapped array is so that
        * on unsubscribe it can provide a reference to the actual method the
        * record is subscribed too.
        **/
        this.wrappedFunctions.set(parameters.callback, listCallback);
        parameters.callback = listCallback;
        this.record.subscribe(parameters);
    };
    /**
   * Proxies the underlying Record's unsubscribe method. Makes sure
   * that no path is provided
   */
    List.prototype.unsubscribe = function (callback) {
        var parameters = utils.normalizeArguments(arguments);
        if (parameters.path) {
            throw new Error('path is not supported for List.unsubscribe');
        }
        var listenCallback = this.wrappedFunctions.get(parameters.callback);
        parameters.callback = listenCallback;
        this.record.unsubscribe(parameters);
        this.wrappedFunctions.delete(parameters.callback);
    };
    /**
     * Proxies the underlying Record's _update method. Set's
     * data to an empty array if no data is provided.
     */
    List.prototype.applyUpdate = function (message) {
        if (!(message.parsedData instanceof Array)) {
            message.parsedData = [];
        }
        this.beforeChange();
        this.originalApplyUpdate(message);
        this.afterChange();
    };
    /**
     * Validates that the index provided is within the current set of entries.
     */
    List.prototype.hasIndex = function (index) {
        var hasIndex = false;
        var entries = this.getEntries();
        if (index !== undefined) {
            if (isNaN(index)) {
                throw new Error('Index must be a number');
            }
            if (index !== entries.length && (index >= entries.length || index < 0)) {
                throw new Error('Index must be within current entries');
            }
            hasIndex = true;
        }
        return hasIndex;
    };
    /**
     * Establishes the current structure of the list, provided the client has attached any
     * add / move / remove listener
     *
     * This will be called before any change to the list, regardsless if the change was triggered
     * by an incoming message from the server or by the client
     */
    List.prototype.beforeChange = function () {
        this.hasAddListener = this.listeners(constants_1.EVENT.ENTRY_ADDED_EVENT).length > 0;
        this.hasRemoveListener = this.listeners(constants_1.EVENT.ENTRY_REMOVED_EVENT).length > 0;
        this.hasMoveListener = this.listeners(constants_1.EVENT.ENTRY_MOVED_EVENT).length > 0;
        if (this.hasAddListener || this.hasRemoveListener || this.hasMoveListener) {
            this.beforeStructure = this.getStructure();
        }
        else {
            this.beforeStructure = null;
        }
    };
    /**
     * Compares the structure of the list after a change to its previous structure and notifies
     * any add / move / remove listener. Won't do anything if no listeners are attached.
     */
    List.prototype.afterChange = function () {
        if (this.beforeStructure === null) {
            return;
        }
        var after = this.getStructure();
        var before = this.beforeStructure;
        var entry;
        var i;
        if (this.hasRemoveListener) {
            for (entry in before) {
                for (i = 0; i < before[entry].length; i++) {
                    if (after[entry] === undefined || after[entry][i] === undefined) {
                        this.emit(constants_1.EVENT.ENTRY_REMOVED_EVENT, entry, before[entry][i]);
                    }
                }
            }
        }
        if (this.hasAddListener || this.hasMoveListener) {
            for (entry in after) {
                if (before[entry] === undefined) {
                    for (i = 0; i < after[entry].length; i++) {
                        this.emit(constants_1.EVENT.ENTRY_ADDED_EVENT, entry, after[entry][i]);
                    }
                }
                else {
                    for (i = 0; i < after[entry].length; i++) {
                        if (before[entry][i] !== after[entry][i]) {
                            if (before[entry][i] === undefined) {
                                this.emit(constants_1.EVENT.ENTRY_ADDED_EVENT, entry, after[entry][i]);
                            }
                            else {
                                this.emit(constants_1.EVENT.ENTRY_MOVED_EVENT, entry, after[entry][i]);
                            }
                        }
                    }
                }
            }
        }
    };
    /**
     * Iterates through the list and creates a map with the entry as a key
     * and an array of its position(s) within the list as a value, e.g.
     *
     * {
     *   'recordA': [ 0, 3 ],
     *   'recordB': [ 1 ],
     *   'recordC': [ 2 ]
     * }
     */
    List.prototype.getStructure = function () {
        var structure = {};
        var i;
        var entries = this.getEntries();
        for (i = 0; i < entries.length; i++) {
            if (structure[entries[i]] === undefined) {
                structure[entries[i]] = [i];
            }
            else {
                structure[entries[i]].push(i);
            }
        }
        return structure;
    };
    return List;
}(Emitter));
exports.List = List;


text:
using System.Collections.Generic;
using System.Linq;
using LinqInfer.Maths;
using NUnit.Framework;

namespace LinqInfer.UnitTests.Maths
{
    [TestFixture]
    public class MultiVectorTests
    {
        [Test]
        public void Construct_GivenMultipleVectorTypes_ReturnsTheCorrectProperties()
        {
            var vect = new MultiVector(
                new ColumnVector1D(1, 2, 3),
                new BitVector(true, false),
                new OneOfNVector(20, 4));

            Assert.That(vect.Size, Is.EqualTo(25));
            Assert.That(vect.InnerVectors.Count(), Is.EqualTo(3));

            Assert.That(vect[0], Is.EqualTo(1));
            Assert.That(vect[1], Is.EqualTo(2));
            Assert.That(vect[2], Is.EqualTo(3));

            Assert.That(vect[3], Is.EqualTo(1));
            Assert.That(vect[4], Is.EqualTo(0));

            foreach (var i in Enumerable.Range(5, 20).Where(n => n != 9))
            {
                Assert.That(vect[i], Is.EqualTo(0));
            }
        }

        [Test]
        public void DotProduct_GivenMultipleVectorTypesAndColumnVector_ReturnsCorrectValue()
        {
            var vect = new MultiVector(
                new ColumnVector1D(3, 6),
                new BitVector(true, false),
                new OneOfNVector(2, 1));

            var vect2 = new ColumnVector1D(2, 5, 8, 1, 5, 9);

            var x = vect.DotProduct(vect2);

            var expected = 3 * 2 + 6 * 5 + 1 * 8 + 0 * 1 + 0 * 5 + 1 * 9;

            Assert.That(x, Is.EqualTo(expected));
        }

        [Test]
        public void MultiplyBy_Vector_GivenMultipleVectorTypesAndColumnVector_ReturnsCorrectValue()
        {
            var vect = new MultiVector(
                new ColumnVector1D(3, 6),
                new BitVector(true, false),
                new OneOfNVector(2, 1));

            var vect2 = new ColumnVector1D(2, 5, 8, 1, 5, 9);

            var x = vect.MultiplyBy(vect2).ToColumnVector().GetUnderlyingArray();

            var expected = new[] { 3 * 2, 6 * 5, 1 * 8, 0 * 1, 0 * 5, 1 * 9 };

            Assert.That(x, Is.EqualTo(expected));
        }

        [Test]
        public void MultiplyBy_Matrix_GivenMultipleVectorTypesAndColumnVector_ReturnsCorrectValue()
        {
            var vect = new MultiVector(
                new ColumnVector1D(3, 6),
                new BitVector(true, false),
                new OneOfNVector(2, 1));

            var m = new Matrix(new[] { new[] { 1, 23, 5, 4, 1, 8.3 }, new[] { 4, 5.6, 8, 12, 5, 9.1 } });
            var expected1 = new[] { 3, 6 * 23, 5, 0, 0, 8.3 }.Sum();
            var expected2 = new[] { 3 * 4, 6 * 5.6, 8, 0, 0, 9.1 }.Sum();
            var expected = new ColumnVector1D(expected1, expected2);

            var x = vect.MultiplyBy(m);

            Assert.That(x.Size, Is.EqualTo(2));
            Assert.That(expected.Equals(x));
        }

        [Test]
        public void MultiplyBy_GivenBitVector_ReturnsResult()
        {
            var vect1 = new MultiVector(
                new ColumnVector1D(3),
                new BitVector(true),
                new OneOfNVector(1));

            var vect2 = new BitVector(true, false, true);

            var vect3 = vect1.MultiplyBy(vect2);

            Assert.That(vect3[0], Is.EqualTo(3));
            Assert.That(vect3[1], Is.EqualTo(0));
            Assert.That(vect3[2], Is.EqualTo(0));
        }

        [Test]
        public void MultiplyBy_GivenSameInstance_ReturnsMultiVector()
        {
            var vect1 = new MultiVector(
                new ColumnVector1D(3),
                new BitVector(true),
                new OneOfNVector(1));

            var vect2 = (MultiVector)vect1.MultiplyBy(vect1);

            Assert.That(vect2[0], Is.EqualTo(9));
            Assert.That(vect2[1], Is.EqualTo(1));
            Assert.That(vect2[2], Is.EqualTo(0));
            Assert.That(vect2.IsIsomorphicTo(vect1));
        }

        [Test]
        public void IsIsomorphicTo_ReturnsTrueForTwoVectorsWithTheSameVectorSizes()
        {
            var v1 = new MultiVector(
                new ColumnVector1D(1, 8),
                new OneOfNVector(5, 3));

            var v2 = new MultiVector(
                new ColumnVector1D(6.1, 1.2),
                new OneOfNVector(5, 1));

            Assert.That(v1.IsIsomorphicTo(v2));
        }

        [Test]
        public void ToByteArray_GivenMultipleVectorTypes_CanCreateEqualVectorFromBytes()
        {
            var vect = new MultiVector(
                new ColumnVector1D(1, 2, 3),
                new BitVector(true, false),
                new OneOfNVector(20, 4));

            var data = vect.ToByteArray();

            var vect2 = MultiVector.FromByteArray(data);

            Assert.That(vect2.Equals(vect));
        }

        [Test]
        public void ToString_GivenMultipleVectorTypes_ReturnsCsvRepresentation()
        {
            var vect = new MultiVector(
                new ColumnVector1D(1, 2.2, 3.23),
                new BitVector(true, false),
                new OneOfNVector(3, 1));

            var str = vect.ToString();

            var vals = str.Split(',').Select(v => double.Parse(v)).ToArray();

            Assert.That(vals.Length, Is.EqualTo(vect.Size));
        }

        [Test]
        public void GetHashCode_OverSimilarSamples_ReturnsZeroClashes()
        {
            var hashes = new List<int>();

            hashes.Add(new MultiVector(
                    new BitVector(true, false),
                    new OneOfNVector(2, 1)).GetHashCode());

            hashes.Add(new MultiVector(
                    new BitVector(true, false),
                    new OneOfNVector(2)).GetHashCode());

            hashes.Add(new MultiVector(
                    new BitVector(false, false),
                    new OneOfNVector(2)).GetHashCode());

            hashes.Add(new MultiVector(
                    new BitVector(false, true),
                    new OneOfNVector(2)).GetHashCode());

            hashes.Add(new MultiVector(
                    new BitVector(true, false),
                    new OneOfNVector(3)).GetHashCode());

            hashes.Add(new MultiVector(
                    new BitVector(true, false),
                    new OneOfNVector(2, 0)).GetHashCode());

            hashes.Add(new MultiVector(
                    new BitVector(true, false),
                    new OneOfNVector(2, 0),
                    new ColumnVector1D(1, 2)).GetHashCode());

            var uniquePercent = hashes.Distinct().Count() / (double)hashes.Count;

            Assert.That(uniquePercent, Is.EqualTo(1));
        }

        [Test]
        public void GetHashCode_OverRandomSamples_ReturnsMinimalClashes()
        {
            var hashes = new List<int>();

            foreach (var i in Enumerable.Range(0, 100))
            {
                var vect = new MultiVector(
                    new ColumnVector1D(1, Functions.RandomDouble(), 3.23),
                    new BitVector(true, false),
                    new OneOfNVector(15, Functions.Random(14)));

                hashes.Add(vect.GetHashCode());
            }

            var uniquePercent = hashes.Distinct().Count() / (double)hashes.Count;

            Assert.That(uniquePercent, Is.GreaterThan(0.9));
        }

        [Test]
        public void ToColumnVector_GivenMultipleVectorTypes_CanCreateEquivalentColVector()
        {
            var vect = new MultiVector(
                new ColumnVector1D(1, 2, 3),
                new BitVector(true, false),
                new OneOfNVector(3, 1));

            var colVect = vect.ToColumnVector();

            Assert.That(colVect[0], Is.EqualTo(1));
            Assert.That(colVect[1], Is.EqualTo(2));
            Assert.That(colVect[2], Is.EqualTo(3));

            Assert.That(colVect[3], Is.EqualTo(1));
            Assert.That(colVect[4], Is.EqualTo(0));

            Assert.That(colVect[5], Is.EqualTo(0));
            Assert.That(colVect[6], Is.EqualTo(1));
            Assert.That(colVect[7], Is.EqualTo(0));
        }
    }
}


text:
<?php

/**
 * MarketplaceWebServiceSellers_Model_ListMarketplaceParticipationsByNextTokenResult
 *
 * Properties:
 *

 *
 *
NextToken: string

 *
ListParticipations: MarketplaceWebServiceSellers_Model_ListParticipations

 *
ListMarketplaces: MarketplaceWebServiceSellers_Model_ListMarketplaces

 *
 *

 */
class MarketplaceWebServiceSellers_Model_ListMarketplaceParticipationsByNextTokenResult extends MarketplaceWebServiceSellers_Model
{

    public function __construct($data = null)
    {
        $this->_fields = array(
            'NextToken' => array('FieldValue' => null, 'FieldType' => 'string'),
            'ListParticipations' => array(
                'FieldValue' => null,
                'FieldType' => 'MarketplaceWebServiceSellers_Model_ListParticipations'
            ),
            'ListMarketplaces' => array(
                'FieldValue' => null,
                'FieldType' => 'MarketplaceWebServiceSellers_Model_ListMarketplaces'
            ),
        );
        parent::__construct($data);
    }

    /**
     * Get the value of the NextToken property.
     *
     * @return String NextToken.
     */
    public function getNextToken()
    {
        return $this->_fields['NextToken']['FieldValue'];
    }

    /**
     * Set the value of the NextToken property.
     *
     * @param string $value nextToken
     * @return $this This instance
     */
    public function setNextToken($value)
    {
        $this->_fields['NextToken']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Check to see if NextToken is set.
     *
     * @return true if NextToken is set.
     */
    public function isSetNextToken()
    {
        return !is_null($this->_fields['NextToken']['FieldValue']);
    }

    /**
     * Set the value of NextToken, return this.
     *
     * @param nextToken
     *             The new value to set.
     *
     * @return $this This instance.
     */
    public function withNextToken($value)
    {
        $this->setNextToken($value);
        return $this;
    }

    /**
     * Get the value of the ListParticipations property.
     *
     * @return MarketplaceWebServiceSellers_Model_ListParticipations ListParticipations.
     */
    public function getListParticipations()
    {
        return $this->_fields['ListParticipations']['FieldValue'];
    }

    /**
     * Set the value of the ListParticipations property.
     *
     * @param MarketplaceWebServiceSellers_Model_ListParticipations $value listParticipations
     * @return $this This instance
     */
    public function setListParticipations($value)
    {
        $this->_fields['ListParticipations']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Check to see if ListParticipations is set.
     *
     * @return true if ListParticipations is set.
     */
    public function isSetListParticipations()
    {
        return !is_null($this->_fields['ListParticipations']['FieldValue']);
    }

    /**
     * Set the value of ListParticipations, return this.
     *
     * @param listParticipations
     *             The new value to set.
     *
     * @return $this This instance.
     */
    public function withListParticipations($value)
    {
        $this->setListParticipations($value);
        return $this;
    }

    /**
     * Get the value of the ListMarketplaces property.
     *
     * @return MarketplaceWebServiceSellers_Model_ListMarketplaces ListMarketplaces.
     */
    public function getListMarketplaces()
    {
        return $this->_fields['ListMarketplaces']['FieldValue'];
    }

    /**
     * Set the value of the ListMarketplaces property.
     *
     * @param MarketplaceWebServiceSellers_Model_ListMarketplaces $value listMarketplaces
     * @return $this This instance
     */
    public function setListMarketplaces($value)
    {
        $this->_fields['ListMarketplaces']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Check to see if ListMarketplaces is set.
     *
     * @return true if ListMarketplaces is set.
     */
    public function isSetListMarketplaces()
    {
        return !is_null($this->_fields['ListMarketplaces']['FieldValue']);
    }

    /**
     * Set the value of ListMarketplaces, return this.
     *
     * @param listMarketplaces
     *             The new value to set.
     *
     * @return $this This instance.
     */
    public function withListMarketplaces($value)
    {
        $this->setListMarketplaces($value);
        return $this;
    }

}


text:
using System;
using System.Threading;
using System.Threading.Tasks;
using grpc = global::Grpc.Core;

namespace HOLMS.Types.Reporting.RPC {
  public static partial class FoliosReportingSvc
  {
    static readonly string __ServiceName = "holms.types.reporting.rpc.FoliosReportingSvc";

    static readonly grpc::Marshaller<global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest> __Marshaller_GroupBookingAssociatedFoliosRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest.Parser.ParseFrom);
    static readonly grpc::Marshaller<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> __Marshaller_HtmlReportResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse.Parser.ParseFrom);
    static readonly grpc::Marshaller<global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator> __Marshaller_GroupBookingIndicator = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator.Parser.ParseFrom);
    static readonly grpc::Marshaller<global::HOLMS.Types.Booking.Groups.GroupBookingInvoiceMapping> __Marshaller_GroupBookingInvoiceMapping = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::HOLMS.Types.Booking.Groups.GroupBookingInvoiceMapping.Parser.ParseFrom);
    static readonly grpc::Marshaller<global::HOLMS.Types.Reporting.RPC.BookingStatementRequest> __Marshaller_BookingStatementRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::HOLMS.Types.Reporting.RPC.BookingStatementRequest.Parser.ParseFrom);
    static readonly grpc::Marshaller<global::HOLMS.Types.Reporting.RPC.FolioPaymentReceiptRequest> __Marshaller_FolioPaymentReceiptRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::HOLMS.Types.Reporting.RPC.FolioPaymentReceiptRequest.Parser.ParseFrom);

    static readonly grpc::Method<global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> __Method_GetBookingAssociatedFoliosDetail = new grpc::Method<global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse>(
        grpc::MethodType.Unary,
        __ServiceName,
        "GetBookingAssociatedFoliosDetail",
        __Marshaller_GroupBookingAssociatedFoliosRequest,
        __Marshaller_HtmlReportResponse);

    static readonly grpc::Method<global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> __Method_GetBookingAssociatedFoliosSummary = new grpc::Method<global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse>(
        grpc::MethodType.Unary,
        __ServiceName,
        "GetBookingAssociatedFoliosSummary",
        __Marshaller_GroupBookingAssociatedFoliosRequest,
        __Marshaller_HtmlReportResponse);

    static readonly grpc::Method<global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> __Method_GetReservationFolioSummary = new grpc::Method<global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse>(
        grpc::MethodType.Unary,
        __ServiceName,
        "GetReservationFolioSummary",
        __Marshaller_GroupBookingIndicator,
        __Marshaller_HtmlReportResponse);

    static readonly grpc::Method<global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> __Method_GetBookingWorksheetDetail = new grpc::Method<global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse>(
        grpc::MethodType.Unary,
        __ServiceName,
        "GetBookingWorksheetDetail",
        __Marshaller_GroupBookingIndicator,
        __Marshaller_HtmlReportResponse);

    static readonly grpc::Method<global::HOLMS.Types.Booking.Groups.GroupBookingInvoiceMapping, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> __Method_GetInvoice = new grpc::Method<global::HOLMS.Types.Booking.Groups.GroupBookingInvoiceMapping, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse>(
        grpc::MethodType.Unary,
        __ServiceName,
        "GetInvoice",
        __Marshaller_GroupBookingInvoiceMapping,
        __Marshaller_HtmlReportResponse);

    static readonly grpc::Method<global::HOLMS.Types.Reporting.RPC.BookingStatementRequest, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> __Method_GetBookingStatement = new grpc::Method<global::HOLMS.Types.Reporting.RPC.BookingStatementRequest, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse>(
        grpc::MethodType.Unary,
        __ServiceName,
        "GetBookingStatement",
        __Marshaller_BookingStatementRequest,
        __Marshaller_HtmlReportResponse);

    static readonly grpc::Method<global::HOLMS.Types.Reporting.RPC.FolioPaymentReceiptRequest, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> __Method_GetFolioPaymentReceipt = new grpc::Method<global::HOLMS.Types.Reporting.RPC.FolioPaymentReceiptRequest, global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse>(
        grpc::MethodType.Unary,
        __ServiceName,
        "GetFolioPaymentReceipt",
        __Marshaller_FolioPaymentReceiptRequest,
        __Marshaller_HtmlReportResponse);

    /// Service descriptor
    public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
    {
      get { return global::HOLMS.Types.Reporting.RPC.FoliosReportingSvcReflection.Descriptor.Services[0]; }
    }

    /// Base class for server-side implementations of FoliosReportingSvc
    public abstract partial class FoliosReportingSvcBase
    {
      public virtual global::System.Threading.Tasks.Task<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetBookingAssociatedFoliosDetail(global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest request, grpc::ServerCallContext context)
      {
        throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
      }

      public virtual global::System.Threading.Tasks.Task<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetBookingAssociatedFoliosSummary(global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest request, grpc::ServerCallContext context)
      {
        throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
      }

      public virtual global::System.Threading.Tasks.Task<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetReservationFolioSummary(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, grpc::ServerCallContext context)
      {
        throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
      }

      public virtual global::System.Threading.Tasks.Task<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetBookingWorksheetDetail(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, grpc::ServerCallContext context)
      {
        throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
      }

      public virtual global::System.Threading.Tasks.Task<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetInvoice(global::HOLMS.Types.Booking.Groups.GroupBookingInvoiceMapping request, grpc::ServerCallContext context)
      {
        throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
      }

      public virtual global::System.Threading.Tasks.Task<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetBookingStatement(global::HOLMS.Types.Reporting.RPC.BookingStatementRequest request, grpc::ServerCallContext context)
      {
        throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
      }

      public virtual global::System.Threading.Tasks.Task<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetFolioPaymentReceipt(global::HOLMS.Types.Reporting.RPC.FolioPaymentReceiptRequest request, grpc::ServerCallContext context)
      {
        throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
      }

    }

    /// Client for FoliosReportingSvc
    public partial class FoliosReportingSvcClient : grpc::ClientBase<FoliosReportingSvcClient>
    {
      /// Creates a new client for FoliosReportingSvc
      /// <param name="channel">The channel to use to make remote calls.</param>
      public FoliosReportingSvcClient(grpc::Channel channel) : base(channel)
      {
      }
      /// Creates a new client for FoliosReportingSvc that uses a custom <c>CallInvoker</c>.
      /// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
      public FoliosReportingSvcClient(grpc::CallInvoker callInvoker) : base(callInvoker)
      {
      }
      /// Protected parameterless constructor to allow creation of test doubles.
      protected FoliosReportingSvcClient() : base()
      {
      }
      /// Protected constructor to allow creation of configured clients.
      /// <param name="configuration">The client configuration.</param>
      protected FoliosReportingSvcClient(ClientBaseConfiguration configuration) : base(configuration)
      {
      }

      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetBookingAssociatedFoliosDetail(global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetBookingAssociatedFoliosDetail(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetBookingAssociatedFoliosDetail(global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest request, grpc::CallOptions options)
      {
        return CallInvoker.BlockingUnaryCall(__Method_GetBookingAssociatedFoliosDetail, null, options, request);
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetBookingAssociatedFoliosDetailAsync(global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetBookingAssociatedFoliosDetailAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetBookingAssociatedFoliosDetailAsync(global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest request, grpc::CallOptions options)
      {
        return CallInvoker.AsyncUnaryCall(__Method_GetBookingAssociatedFoliosDetail, null, options, request);
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetBookingAssociatedFoliosSummary(global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetBookingAssociatedFoliosSummary(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetBookingAssociatedFoliosSummary(global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest request, grpc::CallOptions options)
      {
        return CallInvoker.BlockingUnaryCall(__Method_GetBookingAssociatedFoliosSummary, null, options, request);
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetBookingAssociatedFoliosSummaryAsync(global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetBookingAssociatedFoliosSummaryAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetBookingAssociatedFoliosSummaryAsync(global::HOLMS.Types.Reporting.RPC.GroupBookingAssociatedFoliosRequest request, grpc::CallOptions options)
      {
        return CallInvoker.AsyncUnaryCall(__Method_GetBookingAssociatedFoliosSummary, null, options, request);
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetReservationFolioSummary(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetReservationFolioSummary(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetReservationFolioSummary(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, grpc::CallOptions options)
      {
        return CallInvoker.BlockingUnaryCall(__Method_GetReservationFolioSummary, null, options, request);
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetReservationFolioSummaryAsync(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetReservationFolioSummaryAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetReservationFolioSummaryAsync(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, grpc::CallOptions options)
      {
        return CallInvoker.AsyncUnaryCall(__Method_GetReservationFolioSummary, null, options, request);
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetBookingWorksheetDetail(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetBookingWorksheetDetail(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetBookingWorksheetDetail(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, grpc::CallOptions options)
      {
        return CallInvoker.BlockingUnaryCall(__Method_GetBookingWorksheetDetail, null, options, request);
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetBookingWorksheetDetailAsync(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetBookingWorksheetDetailAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetBookingWorksheetDetailAsync(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, grpc::CallOptions options)
      {
        return CallInvoker.AsyncUnaryCall(__Method_GetBookingWorksheetDetail, null, options, request);
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetInvoice(global::HOLMS.Types.Booking.Groups.GroupBookingInvoiceMapping request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetInvoice(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetInvoice(global::HOLMS.Types.Booking.Groups.GroupBookingInvoiceMapping request, grpc::CallOptions options)
      {
        return CallInvoker.BlockingUnaryCall(__Method_GetInvoice, null, options, request);
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetInvoiceAsync(global::HOLMS.Types.Booking.Groups.GroupBookingInvoiceMapping request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetInvoiceAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetInvoiceAsync(global::HOLMS.Types.Booking.Groups.GroupBookingInvoiceMapping request, grpc::CallOptions options)
      {
        return CallInvoker.AsyncUnaryCall(__Method_GetInvoice, null, options, request);
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetBookingStatement(global::HOLMS.Types.Reporting.RPC.BookingStatementRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetBookingStatement(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetBookingStatement(global::HOLMS.Types.Reporting.RPC.BookingStatementRequest request, grpc::CallOptions options)
      {
        return CallInvoker.BlockingUnaryCall(__Method_GetBookingStatement, null, options, request);
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetBookingStatementAsync(global::HOLMS.Types.Reporting.RPC.BookingStatementRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetBookingStatementAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetBookingStatementAsync(global::HOLMS.Types.Reporting.RPC.BookingStatementRequest request, grpc::CallOptions options)
      {
        return CallInvoker.AsyncUnaryCall(__Method_GetBookingStatement, null, options, request);
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetFolioPaymentReceipt(global::HOLMS.Types.Reporting.RPC.FolioPaymentReceiptRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetFolioPaymentReceipt(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse GetFolioPaymentReceipt(global::HOLMS.Types.Reporting.RPC.FolioPaymentReceiptRequest request, grpc::CallOptions options)
      {
        return CallInvoker.BlockingUnaryCall(__Method_GetFolioPaymentReceipt, null, options, request);
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetFolioPaymentReceiptAsync(global::HOLMS.Types.Reporting.RPC.FolioPaymentReceiptRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetFolioPaymentReceiptAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Reporting.Outputs.HtmlReportResponse> GetFolioPaymentReceiptAsync(global::HOLMS.Types.Reporting.RPC.FolioPaymentReceiptRequest request, grpc::CallOptions options)
      {
        return CallInvoker.AsyncUnaryCall(__Method_GetFolioPaymentReceipt, null, options, request);
      }
      /// Creates a new instance of client from given <c>ClientBaseConfiguration</c>.
      protected override FoliosReportingSvcClient NewInstance(ClientBaseConfiguration configuration)
      {
        return new FoliosReportingSvcClient(configuration);
      }
    }

    /// Creates service definition that can be registered with a server
    /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
    public static grpc::ServerServiceDefinition BindService(FoliosReportingSvcBase serviceImpl)
    {
      return grpc::ServerServiceDefinition.CreateBuilder()
          .AddMethod(__Method_GetBookingAssociatedFoliosDetail, serviceImpl.GetBookingAssociatedFoliosDetail)
          .AddMethod(__Method_GetBookingAssociatedFoliosSummary, serviceImpl.GetBookingAssociatedFoliosSummary)
          .AddMethod(__Method_GetReservationFolioSummary, serviceImpl.GetReservationFolioSummary)
          .AddMethod(__Method_GetBookingWorksheetDetail, serviceImpl.GetBookingWorksheetDetail)
          .AddMethod(__Method_GetInvoice, serviceImpl.GetInvoice)
          .AddMethod(__Method_GetBookingStatement, serviceImpl.GetBookingStatement)
          .AddMethod(__Method_GetFolioPaymentReceipt, serviceImpl.GetFolioPaymentReceipt).Build();
    }

  }
}
#endregion


text:
package org.apache.asterix.om.typecomputer.impl;

import org.apache.asterix.om.types.BuiltinType;
import org.apache.asterix.om.types.IAType;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;

public class StringStringTypeComputer extends AbstractStringTypeComputer {
    public static final StringStringTypeComputer INSTANCE = new StringStringTypeComputer();

    private StringStringTypeComputer() {
    }

    @Override
    public IAType getResultType(ILogicalExpression expr, IAType... inputTypes) throws AlgebricksException {
        return BuiltinType.ASTRING;
    }

}


text:
FROM yep1/usergrid-java

ENV ES_PKG_NAME elasticsearch-1.7.4

# install elasticsearch
RUN \
  cd / && \
  wget https://download.elasticsearch.org/elasticsearch/elasticsearch/$ES_PKG_NAME.tar.gz && \
  tar xvzf $ES_PKG_NAME.tar.gz && \
  rm -f $ES_PKG_NAME.tar.gz && \
  mv /$ES_PKG_NAME /elasticsearch

# define mountable directories
VOLUME ["/data"]

# default command
CMD ["/elasticsearch/bin/elasticsearch"]

# expose ports
#   - 9200: HTTP
#   - 9300: native transport
EXPOSE 9200
EXPOSE 9300

# config
ADD elasticsearch.yml /elasticsearch/config/elasticsearch.yml