text:
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
  # Settings in config/environments/* take precedence over those specified here.
  # Application configuration should go into files in config/initializers
  # -- all .rb files in that directory are automatically loaded.

  # Add additional load paths for your own custom dirs
  config.load_paths += %W( #{RAILS_ROOT}/lib #{RAILS_ROOT}/lib/ponteggio )

  # Specify gems that this application depends on and have them installed with rake gems:install
  config.gem "searchlogic"
  config.gem 'will_paginate', :version => '~> 2.3.11', :source => 'http://gemcutter.org'

  # Only load the plugins named here, in the order given (default is alphabetical).
  # :all can be used as a placeholder for all plugins not explicitly named

  # Skip frameworks you're not going to use. To use Rails without a database,
  # you must remove the Active Record framework.
  # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

  # Activate observers that should always be running
  # config.active_record.observers = :cacher, :garbage_collector, :forum_observer

  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  # Run "rake -D time" for a list of tasks for finding time zone names.
  config.time_zone = 'UTC'

  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
  config.i18n.default_locale = :cs
end

require 'ponteggio'

redpajama_set_name: RedPajamaGithub


text:
'use strict';

export default function authService(apiService, sessionService) {

  return {
    login,
    logout
  };

  function login(loginData) {
    return apiService.post('/api/v1/auth', loginData)
      .then(response => {
        sessionService.setToken(response.token);
      });
  }

  function logout() {
      sessionService.destroy();
  }

}


text:
=head1 LICENSE

Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2022] EMBL-European Bioinformatics Institute

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=cut

package Bio::EnsEMBL::Production::Pipeline::Production::ConstitutiveExons;

use strict;
use warnings;

use base qw/Bio::EnsEMBL::Production::Pipeline::Common::Base/;

use Bio::EnsEMBL::Utils::Exception qw(throw warning);
use Bio::EnsEMBL::Utils::ConversionSupport;
use Bio::EnsEMBL::DensityType;
use Bio::EnsEMBL::DensityFeature;

# default run method
# For a given databases of dbtype, flags exons which are constitutive
sub run {
  my ($self)      = @_;
  my $species     = $self->param('species');
  my $dbtype      = $self->param('dbtype');
  my $quick_check = $self->param('quick_check');
  my $ga = Bio::EnsEMBL::Registry->get_adaptor($species, $dbtype, 'Gene');

  if ($quick_check) {
	print "Carrying out quick check...\n";
	my $splice_count = $ga->dbc()->sql_helper()->execute_single_result(
	  -SQL => q/select count(*) from
  (select distinct(g.gene_id) as id from gene g
  join transcript t using (gene_id)
  join seq_region s on (s.seq_region_id=t.seq_region_id)
  join coord_system using (coord_system_id)
  where species_id=? group by g.gene_id having count(*)>1) x;/,
	  -PARAMS => [$ga->species_id()]);

	if ($splice_count == 0) {
	  print "No splices detected - setting all exons as constitutive...\n";
	  $ga->dbc()->sql_helper()->execute_update(
		-SQL => q/update exon e, seq_region s, coord_system c
	set e.is_constitutive=1
	where e.seq_region_id=s.seq_region_id
	and c.coord_system_id=s.coord_system_id and c.species_id=?/,
		-PARAMS => [$ga->species_id()]);
	  return;
	}
  }

  my @gene_dbIDs = sort { $a <=> $b } @{$ga->list_dbIDs()};
  my $bin = scalar(@gene_dbIDs)/1000;
  my @gene_list;
  for (my $i = 0; $i < $bin; $i++) {
	push(@gene_list, @{$ga->fetch_all_by_dbID_list([splice(@gene_dbIDs, 0, 1000)])});
  }

  while (my $gene = shift(@gene_list)) {
	my @transcripts      = @{$gene->get_all_Transcripts()};
	my $transcript_count = scalar(@transcripts);
	my %exon_count;
	my %exon_object;

	foreach my $transcript (@transcripts) {
	  my @exons = @{$transcript->get_all_Exons()};
	  while (my $exon = shift(@exons)) {
		my $key = $exon->dbID();
		++$exon_count{$key};
		$exon_object{$key} = $exon;
	  }
	}

	foreach my $exon_key (keys(%exon_count)) {
	  my $exon            = $exon_object{$exon_key};
	  my $is_constitutive = $exon->is_constitutive();
	  if ($exon_count{$exon_key} == $transcript_count) {
		if (!$exon->is_constitutive()) {
		  $is_constitutive = 1;
		}
	  } else {
		if ($exon_object{$exon_key}->is_constitutive()) {
		  $is_constitutive = 0;
		}
	  }
	  $ga->dbc()->sql_helper()->execute_update(-SQL    => 'update exon set is_constitutive = ? where exon_id =?',
											   -PARAMS => [$is_constitutive, $exon->dbID()]);
	}
  } ## end while (my $gene = shift(@gene_list...))
  #Disconnecting from the registry
  $ga->dbc->disconnect_if_idle();
  return;
} ## end sub run

1;


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
           http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

  <!-- START SNIPPET: e1 -->
  <!-- bean which creates/destroys the database table for this example -->
  <bean id="initDatabase" class="org.apache.camel.example.mybatis.DatabaseBean"
        init-method="create" destroy-method="destroy">
    <property name="camelContext" ref="myBatisAndCamel"/>
  </bean>
  <!-- END SNIPPET: e1 -->

  <!-- START SNIPPET: e2 -->
  <!-- order service our business logic bean that creates new orders -->
  <bean id="orderService" class="org.apache.camel.example.mybatis.OrderService"/>

  <!-- here is Camel configured with a number of routes -->
  <camelContext id="myBatisAndCamel" xmlns="http://camel.apache.org/schema/blueprint">

    <!-- route that generate new orders and insert them in the database -->
    <route id="generateOrder-route">
      <from uri="timer:foo?period=5s"/>
      <transform>
        <method ref="orderService" method="generateOrder"/>
      </transform>
      <to uri="mybatis:insertOrder?statementType=Insert"/>
      <log message="Inserted new order ${body.id}"/>
    </route>

    <!-- route that process the orders by picking up new rows from the database
         and when done processing then update the row to mark it as processed -->
    <route id="processOrder-route">
      <from uri="mybatis:selectOrders?statementType=SelectList&onConsume=consumeOrder"/>
      <to uri="bean:orderService?method=processOrder"/>
      <log message="${body}"/>
    </route>

  </camelContext>
  <!-- END SNIPPET: e2 -->

</blueprint>


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

namespace MiniSVM.SpamClassifier
{
    public class SvmDataManager
    {
        public List<Dictionary<string, int>> SpamTrainingSet { get; set; }
        public List<Dictionary<string, int>> HamTrainingSet { get; set; }
        public SortedSet<string> SelectedFeatures { get; set; }

        public SparseVector<double>[] TrainingData { get; set; }
        public double[] TrainingLabels { get; set; }
        public SparseVector<double>[] TestData { get; set; }
        public double[] TestLabels { get; set; }

        public SvmDataManager(List<Dictionary<string, int>> spamTrainingSet,
            List<Dictionary<string, int>> hamTrainingSet,
            SortedSet<string> selectedFeatures)
        {
            SpamTrainingSet = spamTrainingSet;
            HamTrainingSet = hamTrainingSet;
            SelectedFeatures = selectedFeatures;
        }

        public SvmDataManager()
        {
            SpamTrainingSet = new List<Dictionary<string, int>>();
            HamTrainingSet = new List<Dictionary<string, int>>();
            SelectedFeatures = new SortedSet<string>();
        }

        public void CalculateTrainingData(int testSetPercent)
        {
            int totalSetSize = SpamTrainingSet.Count + HamTrainingSet.Count;
            int spamTestSetSize = (testSetPercent * SpamTrainingSet.Count) / 100;
            int hamTestSetSize = (testSetPercent * HamTrainingSet.Count) / 100;
            int spamTrainingSetSize = SpamTrainingSet.Count - spamTestSetSize;
            int hamTrainingSetSize = HamTrainingSet.Count - hamTestSetSize;
            int[] permutation = Enumerable.Range(0, hamTrainingSetSize).ToArray();
            var random = new Random();
            TrainingData = new SparseVector<double>[spamTrainingSetSize + hamTrainingSetSize];
            TrainingLabels = new double[spamTrainingSetSize + hamTrainingSetSize];
            TestData = new SparseVector<double>[totalSetSize - TrainingData.Length];
            TestLabels = new double[totalSetSize - TrainingData.Length];

            int currentElement = 0;
            foreach (int index in Permutation.Sequence(HamTrainingSet.Count))
            {
                var item = TokenizedMailToFeatures(HamTrainingSet[index]);
                if (currentElement < hamTrainingSetSize)
                {
                    TrainingData[currentElement] = item;
                    TrainingLabels[currentElement] = (double)MailType.Ham;
                }
                else
                {
                    TestData[currentElement - hamTrainingSetSize] = item;
                    TestLabels[currentElement - hamTrainingSetSize] = (double)MailType.Ham;
                }
                ++currentElement;
            }
            currentElement = 0;
            foreach (int index in Permutation.Sequence(SpamTrainingSet.Count))
            {
                var item = TokenizedMailToFeatures(SpamTrainingSet[index]);
                if (currentElement < spamTrainingSetSize)
                {
                    TrainingData[hamTrainingSetSize + currentElement] = item;
                    TrainingLabels[hamTrainingSetSize + currentElement] = (double)MailType.Spam;
                }
                else
                {
                    TestData[hamTestSetSize + currentElement - spamTrainingSetSize] = item;
                    TestLabels[hamTestSetSize + currentElement - spamTrainingSetSize] = (double)MailType.Spam;
                }
                ++currentElement;
            }
        }
        public SparseVector<double> TokenizedMailToFeatures(List<string> tokenizedMail)
        {
            return TokenizedMailToFeatures(SelectedFeatures, tokenizedMail);
        }
        public SparseVector<double> TokenizedMailToFeatures(Dictionary<string, int> tokenizedMail)
        {
            return TokenizedMailToFeatures(SelectedFeatures, tokenizedMail);
        }

        public SparseVector<double> TokenizedMailToFeatures(SortedSet<string> features, List<string> tokenizedMail)
        {
            Dictionary<string, int> wordCounts = new Dictionary<string, int>();
            SparseVector<double> result = new SparseVector<double>();
            foreach (var word in tokenizedMail)
            {
                if (!wordCounts.ContainsKey(word))
                    wordCounts.Add(word, 0);
                wordCounts[word]++;
            }
            return TokenizedMailToFeatures(features, wordCounts);
        }

        public SparseVector<double> TokenizedMailToFeatures(SortedSet<string> features, Dictionary<string, int> tokenizedMail)
        {
            SparseVector<double> result = new SparseVector<double>();
            int j = 0;
            foreach (var word in features)
            {
                result[j++] = (tokenizedMail.ContainsKey(word)) ? tokenizedMail[word] : 0;
            }
            return result;
        }
    }
}


text:
'use strict';

const { Events } = require('../../../util/Constants');

module.exports = (client, packet) => {
  const { old, updated } = client.actions.ChannelUpdate.handle(packet.d);
  if (old && updated) {
    /**
     * Emitted whenever a channel is updated - e.g. name change, topic change.
     * @event Client#channelUpdate
     * @param {DMChannel|GuildChannel} oldChannel The channel before the update
     * @param {DMChannel|GuildChannel} newChannel The channel after the update
     */
    client.emit(Events.CHANNEL_UPDATE, old, updated);
  }
};


text:
@interface StatusIcon : NSObject

- (id)initWithStatusMenu:(NSMenu*)statusMenu;

- (void)normal;
- (void)pomodoro;
- (void)shortBreak;
- (void)longBreak;

@end


text:
.class public Lcom/quizup/lib/widgets/UnSwipableViewPager;
.super Landroid/support/v4/view/ViewPager;
.source ""

# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0

    .line 16
    invoke-direct {p0, p1}, Landroid/support/v4/view/ViewPager;-><init>(Landroid/content/Context;)V

    .line 17
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0

    .line 12
    invoke-direct {p0, p1, p2}, Landroid/support/v4/view/ViewPager;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 13
    return-void
.end method

# virtual methods
.method public onInterceptTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 1

    .line 22
    const/4 v0, 0x0

    return v0
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 1

    .line 28
    const/4 v0, 0x0

    return v0
.end method


text:
/*************************************************************************/
/*  tween.cpp                                                            */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#include "tween.h"

#include "scene/animation/easing_equations.h"
#include "scene/main/node.h"

Tween::interpolater Tween::interpolaters[Tween::TRANS_MAX][Tween::EASE_MAX] = {
	{ &linear::in, &linear::in, &linear::in, &linear::in }, // Linear is the same for each easing.
	{ &sine::in, &sine::out, &sine::in_out, &sine::out_in },
	{ &quint::in, &quint::out, &quint::in_out, &quint::out_in },
	{ &quart::in, &quart::out, &quart::in_out, &quart::out_in },
	{ &quad::in, &quad::out, &quad::in_out, &quad::out_in },
	{ &expo::in, &expo::out, &expo::in_out, &expo::out_in },
	{ &elastic::in, &elastic::out, &elastic::in_out, &elastic::out_in },
	{ &cubic::in, &cubic::out, &cubic::in_out, &cubic::out_in },
	{ &circ::in, &circ::out, &circ::in_out, &circ::out_in },
	{ &bounce::in, &bounce::out, &bounce::in_out, &bounce::out_in },
	{ &back::in, &back::out, &back::in_out, &back::out_in },
};

void Tweener::set_tween(Ref<Tween> p_tween) {
	tween = p_tween;
}

void Tweener::clear_tween() {
	tween.unref();
}

void Tweener::_bind_methods() {
	ADD_SIGNAL(MethodInfo("finished"));
}

void Tween::start_tweeners() {
	if (tweeners.is_empty()) {
		dead = true;
		ERR_FAIL_MSG("Tween without commands, aborting.");
	}

	for (Ref<Tweener> &tweener : tweeners.write[current_step]) {
		tweener->start();
	}
}

Ref<PropertyTweener> Tween::tween_property(Object *p_target, NodePath p_property, Variant p_to, float p_duration) {
	ERR_FAIL_NULL_V(p_target, nullptr);
	ERR_FAIL_COND_V_MSG(!valid, nullptr, "Tween invalid. Either finished or created outside scene tree.");
	ERR_FAIL_COND_V_MSG(started, nullptr, "Can't append to a Tween that has started. Use stop() first.");

#ifdef DEBUG_ENABLED
	Variant::Type property_type = p_target->get_indexed(p_property.get_as_property_path().get_subnames()).get_type();
	ERR_FAIL_COND_V_MSG(property_type != p_to.get_type(), Ref<PropertyTweener>(), "Type mismatch between property and final value: " + Variant::get_type_name(property_type) + " and " + Variant::get_type_name(p_to.get_type()));
#endif

	Ref<PropertyTweener> tweener = memnew(PropertyTweener(p_target, p_property, p_to, p_duration));
	append(tweener);
	return tweener;
}

Ref<IntervalTweener> Tween::tween_interval(float p_time) {
	ERR_FAIL_COND_V_MSG(!valid, nullptr, "Tween invalid. Either finished or created outside scene tree.");
	ERR_FAIL_COND_V_MSG(started, nullptr, "Can't append to a Tween that has started. Use stop() first.");

	Ref<IntervalTweener> tweener = memnew(IntervalTweener(p_time));
	append(tweener);
	return tweener;
}

Ref<CallbackTweener> Tween::tween_callback(Callable p_callback) {
	ERR_FAIL_COND_V_MSG(!valid, nullptr, "Tween invalid. Either finished or created outside scene tree.");
	ERR_FAIL_COND_V_MSG(started, nullptr, "Can't append to a Tween that has started. Use stop() first.");

	Ref<CallbackTweener> tweener = memnew(CallbackTweener(p_callback));
	append(tweener);
	return tweener;
}

Ref<MethodTweener> Tween::tween_method(Callable p_callback, Variant p_from, Variant p_to, float p_duration) {
	ERR_FAIL_COND_V_MSG(!valid, nullptr, "Tween invalid. Either finished or created outside scene tree.");
	ERR_FAIL_COND_V_MSG(started, nullptr, "Can't append to a Tween that has started. Use stop() first.");

	Ref<MethodTweener> tweener = memnew(MethodTweener(p_callback, p_from, p_to, p_duration));
	append(tweener);
	return tweener;
}

void Tween::append(Ref<Tweener> p_tweener) {
	p_tweener->set_tween(this);

	if (parallel_enabled) {
		current_step = MAX(current_step, 0);
	} else {
		current_step++;
	}
	parallel_enabled = default_parallel;

	tweeners.resize(current_step + 1);
	tweeners.write[current_step].push_back(p_tweener);
}

void Tween::stop() {
	started = false;
	running = false;
	dead = false;
}

void Tween::pause() {
	running = false;
}

void Tween::play() {
	ERR_FAIL_COND_MSG(!valid, "Tween invalid. Either finished or created outside scene tree.");
	ERR_FAIL_COND_MSG(dead, "Can't play finished Tween, use stop() first to reset its state.");
	running = true;
}

void Tween::kill() {
	running = false; // For the sake of is_running().
	dead = true;
}

bool Tween::is_running() {
	return running;
}

void Tween::set_valid(bool p_valid) {
	valid = p_valid;
}

bool Tween::is_valid() {
	return valid;
}

void Tween::clear() {
	valid = false;

	for (List<Ref<Tweener>> &step : tweeners) {
		for (Ref<Tweener> &tweener : step) {
			tweener->clear_tween();
		}
	}
	tweeners.clear();
}

Ref<Tween> Tween::bind_node(Node *p_node) {
	ERR_FAIL_NULL_V(p_node, this);

	bound_node = p_node->get_instance_id();
	is_bound = true;
	return this;
}

Ref<Tween> Tween::set_process_mode(TweenProcessMode p_mode) {
	process_mode = p_mode;
	return this;
}

Tween::TweenProcessMode Tween::get_process_mode() {
	return process_mode;
}

Ref<Tween> Tween::set_pause_mode(TweenPauseMode p_mode) {
	pause_mode = p_mode;
	return this;
}

Tween::TweenPauseMode Tween::get_pause_mode() {
	return pause_mode;
}

Ref<Tween> Tween::set_parallel(bool p_parallel) {
	default_parallel = p_parallel;
	parallel_enabled = p_parallel;
	return this;
}

Ref<Tween> Tween::set_loops(int p_loops) {
	loops = p_loops;
	return this;
}

Ref<Tween> Tween::set_speed_scale(float p_speed) {
	speed_scale = p_speed;
	return this;
}

Ref<Tween> Tween::set_trans(TransitionType p_trans) {
	default_transition = p_trans;
	return this;
}

Tween::TransitionType Tween::get_trans() {
	return default_transition;
}

Ref<Tween> Tween::set_ease(EaseType p_ease) {
	default_ease = p_ease;
	return this;
}

Tween::EaseType Tween::get_ease() {
	return default_ease;
}

Ref<Tween> Tween::parallel() {
	parallel_enabled = true;
	return this;
}

Ref<Tween> Tween::chain() {
	parallel_enabled = false;
	return this;
}

bool Tween::custom_step(float p_delta) {
	bool r = running;
	running = true;
	bool ret = step(p_delta);
	running = running && r; // Running might turn false when Tween finished.
	return ret;
}

bool Tween::step(float p_delta) {
	ERR_FAIL_COND_V_MSG(tweeners.is_empty(), false, "Tween started, but has no Tweeners.");

	if (dead) {
		return false;
	}

	if (!running) {
		return true;
	}

	if (is_bound) {
		Object *bound_instance = ObjectDB::get_instance(bound_node);
		if (bound_instance) {
			Node *bound_node = Object::cast_to<Node>(bound_instance);
			// This can't by anything else than Node, so we can omit checking if casting succeeded.
			if (!bound_node->is_inside_tree()) {
				return true;
			}
		} else {
			return false;
		}
	}

	if (!started) {
		current_step = 0;
		loops_done = 0;
		start_tweeners();
		started = true;
	}

	float rem_delta = p_delta * speed_scale;
	bool step_active = false;

	while (rem_delta > 0 && running) {
		float step_delta = rem_delta;
		step_active = false;

		for (Ref<Tweener> &tweener : tweeners.write[current_step]) {
			// Modified inside Tweener.step().
			float temp_delta = rem_delta;
			// Turns to true if any Tweener returns true (i.e. is still not finished).
			step_active = tweener->step(temp_delta) || step_active;
			step_delta = MIN(temp_delta, rem_delta);
		}

		rem_delta = step_delta;

		if (!step_active) {
			emit_signal(SNAME("step_finished"), current_step);
			current_step++;

			if (current_step == tweeners.size()) {
				loops_done++;
				if (loops_done == loops) {
					running = false;
					dead = true;
					emit_signal(SNAME("finished"));
				} else {
					emit_signal(SNAME("loop_finished"), loops_done);
					current_step = 0;
					start_tweeners();
				}
			} else {
				start_tweeners();
			}
		}
	}

	return true;
}

bool Tween::should_pause() {
	if (is_bound && pause_mode == TWEEN_PAUSE_BOUND) {
		Object *bound_instance = ObjectDB::get_instance(bound_node);
		if (bound_instance) {
			Node *bound_node = Object::cast_to<Node>(bound_instance);
			return !bound_node->can_process();
		}
	}

	return pause_mode != TWEEN_PAUSE_PROCESS;
}

real_t Tween::run_equation(TransitionType p_trans_type, EaseType p_ease_type, real_t p_time, real_t p_initial, real_t p_delta, real_t p_duration) {
	if (p_duration == 0) {
		// Special case to avoid dividing by 0 in equations.
		return p_initial + p_delta;
	}

	interpolater func = interpolaters[p_trans_type][p_ease_type];
	return func(p_time, p_initial, p_delta, p_duration);
}

Variant Tween::interpolate_variant(Variant p_initial_val, Variant p_delta_val, float p_time, float p_duration, TransitionType p_trans, EaseType p_ease) {
	ERR_FAIL_INDEX_V(p_trans, TransitionType::TRANS_MAX, Variant());
	ERR_FAIL_INDEX_V(p_ease, EaseType::EASE_MAX, Variant());

// Helper macro to run equation on sub-elements of the value (e.g. x and y of Vector2).
#define APPLY_EQUATION(element) \
	r.element = run_equation(p_trans, p_ease, p_time, i.element, d.element, p_duration);

	switch (p_initial_val.get_type()) {
		case Variant::BOOL: {
			return (run_equation(p_trans, p_ease, p_time, p_initial_val, p_delta_val, p_duration)) >= 0.5;
		}

		case Variant::INT: {
			return (int)run_equation(p_trans, p_ease, p_time, (int)p_initial_val, (int)p_delta_val, p_duration);
		}

		case Variant::FLOAT: {
			return run_equation(p_trans, p_ease, p_time, (real_t)p_initial_val, (real_t)p_delta_val, p_duration);
		}

		case Variant::VECTOR2: {
			Vector2 i = p_initial_val;
			Vector2 d = p_delta_val;
			Vector2 r;

			APPLY_EQUATION(x);
			APPLY_EQUATION(y);
			return r;
		}

		case Variant::VECTOR2I: {
			Vector2i i = p_initial_val;
			Vector2i d = p_delta_val;
			Vector2i r;

			APPLY_EQUATION(x);
			APPLY_EQUATION(y);
			return r;
		}

		case Variant::RECT2: {
			Rect2 i = p_initial_val;
			Rect2 d = p_delta_val;
			Rect2 r;

			APPLY_EQUATION(position.x);
			APPLY_EQUATION(position.y);
			APPLY_EQUATION(size.x);
			APPLY_EQUATION(size.y);
			return r;
		}

		case Variant::RECT2I: {
			Rect2i i = p_initial_val;
			Rect2i d = p_delta_val;
			Rect2i r;

			APPLY_EQUATION(position.x);
			APPLY_EQUATION(position.y);
			APPLY_EQUATION(size.x);
			APPLY_EQUATION(size.y);
			return r;
		}

		case Variant::VECTOR3: {
			Vector3 i = p_initial_val;
			Vector3 d = p_delta_val;
			Vector3 r;

			APPLY_EQUATION(x);
			APPLY_EQUATION(y);
			APPLY_EQUATION(z);
			return r;
		}

		case Variant::VECTOR3I: {
			Vector3i i = p_initial_val;
			Vector3i d = p_delta_val;
			Vector3i r;

			APPLY_EQUATION(x);
			APPLY_EQUATION(y);
			APPLY_EQUATION(z);
			return r;
		}

		case Variant::TRANSFORM2D: {
			Transform2D i = p_initial_val;
			Transform2D d = p_delta_val;
			Transform2D r;

			APPLY_EQUATION(elements[0][0]);
			APPLY_EQUATION(elements[0][1]);
			APPLY_EQUATION(elements[1][0]);
			APPLY_EQUATION(elements[1][1]);
			APPLY_EQUATION(elements[2][0]);
			APPLY_EQUATION(elements[2][1]);
			return r;
		}

		case Variant::QUATERNION: {
			Quaternion i = p_initial_val;
			Quaternion d = p_delta_val;
			Quaternion r;

			APPLY_EQUATION(x);
			APPLY_EQUATION(y);
			APPLY_EQUATION(z);
			APPLY_EQUATION(w);
			return r;
		}

		case Variant::AABB: {
			AABB i = p_initial_val;
			AABB d = p_delta_val;
			AABB r;

			APPLY_EQUATION(position.x);
			APPLY_EQUATION(position.y);
			APPLY_EQUATION(position.z);
			APPLY_EQUATION(size.x);
			APPLY_EQUATION(size.y);
			APPLY_EQUATION(size.z);
			return r;
		}

		case Variant::BASIS: {
			Basis i = p_initial_val;
			Basis d = p_delta_val;
			Basis r;

			APPLY_EQUATION(elements[0][0]);
			APPLY_EQUATION(elements[0][1]);
			APPLY_EQUATION(elements[0][2]);
			APPLY_EQUATION(elements[1][0]);
			APPLY_EQUATION(elements[1][1]);
			APPLY_EQUATION(elements[1][2]);
			APPLY_EQUATION(elements[2][0]);
			APPLY_EQUATION(elements[2][1]);
			APPLY_EQUATION(elements[2][2]);
			return r;
		}

		case Variant::TRANSFORM3D: {
			Transform3D i = p_initial_val;
			Transform3D d = p_delta_val;
			Transform3D r;

			APPLY_EQUATION(basis.elements[0][0]);
			APPLY_EQUATION(basis.elements[0][1]);
			APPLY_EQUATION(basis.elements[0][2]);
			APPLY_EQUATION(basis.elements[1][0]);
			APPLY_EQUATION(basis.elements[1][1]);
			APPLY_EQUATION(basis.elements[1][2]);
			APPLY_EQUATION(basis.elements[2][0]);
			APPLY_EQUATION(basis.elements[2][1]);
			APPLY_EQUATION(basis.elements[2][2]);
			APPLY_EQUATION(origin.x);
			APPLY_EQUATION(origin.y);
			APPLY_EQUATION(origin.z);
			return r;
		}

		case Variant::COLOR: {
			Color i = p_initial_val;
			Color d = p_delta_val;
			Color r;

			APPLY_EQUATION(r);
			APPLY_EQUATION(g);
			APPLY_EQUATION(b);
			APPLY_EQUATION(a);
			return r;
		}

		default: {
			return p_initial_val;
		}
	};
#undef APPLY_EQUATION
}

Variant Tween::calculate_delta_value(Variant p_intial_val, Variant p_final_val) {
	ERR_FAIL_COND_V_MSG(p_intial_val.get_type() != p_final_val.get_type(), p_intial_val, "Type mismatch between initial and final value: " + Variant::get_type_name(p_intial_val.get_type()) + " and " + Variant::get_type_name(p_final_val.get_type()));

	switch (p_intial_val.get_type()) {
		case Variant::BOOL: {
			return (int)p_final_val - (int)p_intial_val;
		}

		case Variant::RECT2: {
			Rect2 i = p_intial_val;
			Rect2 f = p_final_val;
			return Rect2(f.position - i.position, f.size - i.size);
		}

		case Variant::RECT2I: {
			Rect2i i = p_intial_val;
			Rect2i f = p_final_val;
			return Rect2i(f.position - i.position, f.size - i.size);
		}

		case Variant::TRANSFORM2D: {
			Transform2D i = p_intial_val;
			Transform2D f = p_final_val;
			return Transform2D(f.elements[0][0] - i.elements[0][0],
					f.elements[0][1] - i.elements[0][1],
					f.elements[1][0] - i.elements[1][0],
					f.elements[1][1] - i.elements[1][1],
					f.elements[2][0] - i.elements[2][0],
					f.elements[2][1] - i.elements[2][1]);
		}

		case Variant::AABB: {
			AABB i = p_intial_val;
			AABB f = p_final_val;
			return AABB(f.position - i.position, f.size - i.size);
		}

		case Variant::BASIS: {
			Basis i = p_intial_val;
			Basis f = p_final_val;
			return Basis(f.elements[0][0] - i.elements[0][0],
					f.elements[0][1] - i.elements[0][1],
					f.elements[0][2] - i.elements[0][2],
					f.elements[1][0] - i.elements[1][0],
					f.elements[1][1] - i.elements[1][1],
					f.elements[1][2] - i.elements[1][2],
					f.elements[2][0] - i.elements[2][0],
					f.elements[2][1] - i.elements[2][1],
					f.elements[2][2] - i.elements[2][2]);
		}

		case Variant::TRANSFORM3D: {
			Transform3D i = p_intial_val;
			Transform3D f = p_final_val;
			return Transform3D(f.basis.elements[0][0] - i.basis.elements[0][0],
					f.basis.elements[0][1] - i.basis.elements[0][1],
					f.basis.elements[0][2] - i.basis.elements[0][2],
					f.basis.elements[1][0] - i.basis.elements[1][0],
					f.basis.elements[1][1] - i.basis.elements[1][1],
					f.basis.elements[1][2] - i.basis.elements[1][2],
					f.basis.elements[2][0] - i.basis.elements[2][0],
					f.basis.elements[2][1] - i.basis.elements[2][1],
					f.basis.elements[2][2] - i.basis.elements[2][2],
					f.origin.x - i.origin.x,
					f.origin.y - i.origin.y,
					f.origin.z - i.origin.z);
		}

		default: {
			return Variant::evaluate(Variant::OP_SUBTRACT, p_final_val, p_intial_val);
		}
	};
}

void Tween::_bind_methods() {
	ClassDB::bind_method(D_METHOD("tween_property", "object", "property", "final_val", "duration"), &Tween::tween_property);
	ClassDB::bind_method(D_METHOD("tween_interval", "time"), &Tween::tween_interval);
	ClassDB::bind_method(D_METHOD("tween_callback", "callback"), &Tween::tween_callback);
	ClassDB::bind_method(D_METHOD("tween_method", "method", "from", "to", "duration"), &Tween::tween_method);

	ClassDB::bind_method(D_METHOD("custom_step", "delta"), &Tween::custom_step);
	ClassDB::bind_method(D_METHOD("stop"), &Tween::stop);
	ClassDB::bind_method(D_METHOD("pause"), &Tween::pause);
	ClassDB::bind_method(D_METHOD("play"), &Tween::play);
	ClassDB::bind_method(D_METHOD("kill"), &Tween::kill);

	ClassDB::bind_method(D_METHOD("is_running"), &Tween::is_running);
	ClassDB::bind_method(D_METHOD("is_valid"), &Tween::is_valid);
	ClassDB::bind_method(D_METHOD("bind_node", "node"), &Tween::bind_node);
	ClassDB::bind_method(D_METHOD("set_process_mode", "mode"), &Tween::set_process_mode);
	ClassDB::bind_method(D_METHOD("set_pause_mode", "mode"), &Tween::set_pause_mode);

	ClassDB::bind_method(D_METHOD("set_parallel", "parallel"), &Tween::set_parallel, DEFVAL(true));
	ClassDB::bind_method(D_METHOD("set_loops", "loops"), &Tween::set_loops, DEFVAL(0));
	ClassDB::bind_method(D_METHOD("set_speed_scale", "speed"), &Tween::set_speed_scale);
	ClassDB::bind_method(D_METHOD("set_trans", "trans"), &Tween::set_trans);
	ClassDB::bind_method(D_METHOD("set_ease", "ease"), &Tween::set_ease);

	ClassDB::bind_method(D_METHOD("parallel"), &Tween::parallel);
	ClassDB::bind_method(D_METHOD("chain"), &Tween::chain);

	ClassDB::bind_method(D_METHOD("interpolate_value", "trans_type", "ease_type", "elapsed_time", "initial_value", "delta_value", "duration"), &Tween::interpolate_variant);

	ADD_SIGNAL(MethodInfo("step_finished", PropertyInfo(Variant::INT, "idx")));
	ADD_SIGNAL(MethodInfo("loop_finished", PropertyInfo(Variant::INT, "loop_count")));
	ADD_SIGNAL(MethodInfo("finished"));

	BIND_ENUM_CONSTANT(TWEEN_PROCESS_PHYSICS);
	BIND_ENUM_CONSTANT(TWEEN_PROCESS_IDLE);

	BIND_ENUM_CONSTANT(TWEEN_PAUSE_BOUND);
	BIND_ENUM_CONSTANT(TWEEN_PAUSE_STOP);
	BIND_ENUM_CONSTANT(TWEEN_PAUSE_PROCESS);

	BIND_ENUM_CONSTANT(TRANS_LINEAR);
	BIND_ENUM_CONSTANT(TRANS_SINE);
	BIND_ENUM_CONSTANT(TRANS_QUINT);
	BIND_ENUM_CONSTANT(TRANS_QUART);
	BIND_ENUM_CONSTANT(TRANS_QUAD);
	BIND_ENUM_CONSTANT(TRANS_EXPO);
	BIND_ENUM_CONSTANT(TRANS_ELASTIC);
	BIND_ENUM_CONSTANT(TRANS_CUBIC);
	BIND_ENUM_CONSTANT(TRANS_CIRC);
	BIND_ENUM_CONSTANT(TRANS_BOUNCE);
	BIND_ENUM_CONSTANT(TRANS_BACK);

	BIND_ENUM_CONSTANT(EASE_IN);
	BIND_ENUM_CONSTANT(EASE_OUT);
	BIND_ENUM_CONSTANT(EASE_IN_OUT);
	BIND_ENUM_CONSTANT(EASE_OUT_IN);
}

Ref<PropertyTweener> PropertyTweener::from(Variant p_value) {
	initial_val = p_value;
	do_continue = false;
	return this;
}

Ref<PropertyTweener> PropertyTweener::from_current() {
	do_continue = false;
	return this;
}

Ref<PropertyTweener> PropertyTweener::as_relative() {
	relative = true;
	return this;
}

Ref<PropertyTweener> PropertyTweener::set_trans(Tween::TransitionType p_trans) {
	trans_type = p_trans;
	return this;
}

Ref<PropertyTweener> PropertyTweener::set_ease(Tween::EaseType p_ease) {
	ease_type = p_ease;
	return this;
}

Ref<PropertyTweener> PropertyTweener::set_delay(float p_delay) {
	delay = p_delay;
	return this;
}

void PropertyTweener::start() {
	elapsed_time = 0;
	finished = false;

	Object *target_instance = ObjectDB::get_instance(target);
	if (!target_instance) {
		WARN_PRINT("Target object freed before starting, aborting Tweener.");
		return;
	}

	if (do_continue) {
		initial_val = target_instance->get_indexed(property);
	}

	if (relative) {
		final_val = Variant::evaluate(Variant::Operator::OP_ADD, initial_val, base_final_val);
	}

	delta_val = tween->calculate_delta_value(initial_val, final_val);
}

bool PropertyTweener::step(float &r_delta) {
	if (finished) {
		// This is needed in case there's a parallel Tweener with longer duration.
		return false;
	}

	Object *target_instance = ObjectDB::get_instance(target);
	if (!target_instance) {
		return false;
	}
	elapsed_time += r_delta;

	if (elapsed_time < delay) {
		r_delta = 0;
		return true;
	}

	float time = MIN(elapsed_time - delay, duration);
	target_instance->set_indexed(property, tween->interpolate_variant(initial_val, delta_val, time, duration, trans_type, ease_type));

	if (time < duration) {
		r_delta = 0;
		return true;
	} else {
		finished = true;
		r_delta = elapsed_time - delay - duration;
		emit_signal(SNAME("finished"));
		return false;
	}
}

void PropertyTweener::set_tween(Ref<Tween> p_tween) {
	tween = p_tween;
	if (trans_type == Tween::TRANS_MAX) {
		trans_type = tween->get_trans();
	}
	if (ease_type == Tween::EASE_MAX) {
		ease_type = tween->get_ease();
	}
}

void PropertyTweener::_bind_methods() {
	ClassDB::bind_method(D_METHOD("from", "value"), &PropertyTweener::from);
	ClassDB::bind_method(D_METHOD("from_current"), &PropertyTweener::from_current);
	ClassDB::bind_method(D_METHOD("as_relative"), &PropertyTweener::as_relative);
	ClassDB::bind_method(D_METHOD("set_trans", "trans"), &PropertyTweener::set_trans);
	ClassDB::bind_method(D_METHOD("set_ease", "ease"), &PropertyTweener::set_ease);
	ClassDB::bind_method(D_METHOD("set_delay", "delay"), &PropertyTweener::set_delay);
}

PropertyTweener::PropertyTweener(Object *p_target, NodePath p_property, Variant p_to, float p_duration) {
	target = p_target->get_instance_id();
	property = p_property.get_as_property_path().get_subnames();
	initial_val = p_target->get_indexed(property);
	base_final_val = p_to;
	final_val = base_final_val;
	duration = p_duration;
}

PropertyTweener::PropertyTweener() {
	ERR_FAIL_MSG("Can't create empty PropertyTweener. Use get_tree().tween_property() or tween_property() instead.");
}

void IntervalTweener::start() {
	elapsed_time = 0;
	finished = false;
}

bool IntervalTweener::step(float &r_delta) {
	if (finished) {
		return false;
	}

	elapsed_time += r_delta;

	if (elapsed_time < duration) {
		r_delta = 0;
		return true;
	} else {
		finished = true;
		r_delta = elapsed_time - duration;
		emit_signal(SNAME("finished"));
		return false;
	}
}

IntervalTweener::IntervalTweener(float p_time) {
	duration = p_time;
}

IntervalTweener::IntervalTweener() {
	ERR_FAIL_MSG("Can't create empty IntervalTweener. Use get_tree().tween_interval() instead.");
}

Ref<CallbackTweener> CallbackTweener::set_delay(float p_delay) {
	delay = p_delay;
	return this;
}

void CallbackTweener::start() {
	elapsed_time = 0;
	finished = false;
}

bool CallbackTweener::step(float &r_delta) {
	if (finished) {
		return false;
	}

	elapsed_time += r_delta;
	if (elapsed_time >= delay) {
		Variant result;
		Callable::CallError ce;
		callback.call(nullptr, 0, result, ce);
		if (ce.error != Callable::CallError::CALL_OK) {
			ERR_FAIL_V_MSG(false, "Error calling method from CallbackTweener: " + Variant::get_call_error_text(this, callback.get_method(), nullptr, 0, ce));
		}

		finished = true;
		r_delta = elapsed_time - delay;
		emit_signal(SNAME("finished"));
		return false;
	}

	r_delta = 0;
	return true;
}

void CallbackTweener::_bind_methods() {
	ClassDB::bind_method(D_METHOD("set_delay", "delay"), &CallbackTweener::set_delay);
}

CallbackTweener::CallbackTweener(Callable p_callback) {
	callback = p_callback;
}

CallbackTweener::CallbackTweener() {
	ERR_FAIL_MSG("Can't create empty CallbackTweener. Use get_tree().tween_callback() instead.");
}

Ref<MethodTweener> MethodTweener::set_delay(float p_delay) {
	delay = p_delay;
	return this;
}

Ref<MethodTweener> MethodTweener::set_trans(Tween::TransitionType p_trans) {
	trans_type = p_trans;
	return this;
}

Ref<MethodTweener> MethodTweener::set_ease(Tween::EaseType p_ease) {
	ease_type = p_ease;
	return this;
}

void MethodTweener::start() {
	elapsed_time = 0;
	finished = false;
}

bool MethodTweener::step(float &r_delta) {
	if (finished) {
		return false;
	}

	elapsed_time += r_delta;

	if (elapsed_time < delay) {
		r_delta = 0;
		return true;
	}

	float time = MIN(elapsed_time - delay, duration);
	Variant current_val = tween->interpolate_variant(initial_val, delta_val, time, duration, trans_type, ease_type);
	const Variant **argptr = (const Variant **)alloca(sizeof(Variant *));
	argptr[0] = &current_val;

	Variant result;
	Callable::CallError ce;
	callback.call(argptr, 1, result, ce);
	if (ce.error != Callable::CallError::CALL_OK) {
		ERR_FAIL_V_MSG(false, "Error calling method from MethodTweener: " + Variant::get_call_error_text(this, callback.get_method(), argptr, 1, ce));
	}

	if (time < duration) {
		r_delta = 0;
		return true;
	} else {
		finished = true;
		r_delta = elapsed_time - delay - duration;
		emit_signal(SNAME("finished"));
		return false;
	}
}

void MethodTweener::set_tween(Ref<Tween> p_tween) {
	tween = p_tween;
	if (trans_type == Tween::TRANS_MAX) {
		trans_type = tween->get_trans();
	}
	if (ease_type == Tween::EASE_MAX) {
		ease_type = tween->get_ease();
	}
}

void MethodTweener::_bind_methods() {
	ClassDB::bind_method(D_METHOD("set_delay", "delay"), &MethodTweener::set_delay);
	ClassDB::bind_method(D_METHOD("set_trans", "trans"), &MethodTweener::set_trans);
	ClassDB::bind_method(D_METHOD("set_ease", "ease"), &MethodTweener::set_ease);
}

MethodTweener::MethodTweener(Callable p_callback, Variant p_from, Variant p_to, float p_duration) {
	callback = p_callback;
	initial_val = p_from;
	delta_val = tween->calculate_delta_value(p_from, p_to);
	duration = p_duration;
}

MethodTweener::MethodTweener() {
	ERR_FAIL_MSG("Can't create empty MethodTweener. Use get_tree().tween_method() instead.");
}


text:
"""
This module contains all of the fixtures that are used throughout the testing.

The fixtures from each of the sub-modules are imported here for convenience, so instead of

::

    from service.tests.fixtures.notifications import NotificationFactory
    from service.tests.fixtures.sword import SwordFactory

you can do

::

    from service.tests.fixtures import NotificationFactory, SwordFactory
"""
from service.tests.fixtures.notifications import NotificationFactory
from service.tests.fixtures.sword import SwordFactory
from service.tests.fixtures.http_layer import MockHttpLayer


text:
#pragma once

#include "BSearch.h"
#include "MarketStatus.h"
#include "CommonDefs.h"
#include <list>
#include <map>

typedef unsigned long IdDeals;

class PGenDatabaseRows
{
public:
    class PGenDatabaseRow
    {
        /*
            ibrokers.deals (Table)
            =======================
            iddeals             int(10) unsigned PK
            tickerid            int(11)
            ticker              text
            oi                  int(11)
            buyprice            double
            numberbuyshares     int(11)
            sellprice           double
            numbersellshares    int(11)
            sectype             text
            exchange            text
            primaryexchange     text
            currency            text
            localsymbol         text
            secidtype           text
            secid               text
            genericticks        text
            displayname         text
            username            text
            accountnumber       text
            hitcount            int(11)
            lastavgfillbuyprice double
            lastbuycommission   double
            lastbuydate         datetime
            updatetimestamp     timestamp
        */

        // POD. Easier to keep public, rather than unnecessary get/set methods.
        // Each instance of this class represents 1 row in the deals table.
        // Everyone else needs easy access to this data.
        public:
            IdDeals _iddeals;
            TickerId _tickerid;
            std::string _ticker;
            long _oi;
            double _buyprice;
            long _numberbuyshares;
            double _sellprice;
            long _numbersellshares;
            std::string _sectype;
            std::string _exchange;
            std::string _primaryexchange;
            std::string _currency;
            std::string _localsymbol;
            std::string _secidtype;
            std::string _secid;
            std::string _genericticks;
            std::string _displayname;
            long _hitcount;
            double _lastavgbuyfill;
            double _lastbuycommission;
            std::string _lastbuydate;

        private:
            bool _haveparsedlastbuydate;
            bool _parsedlastbuydate_valid;
            CTime _parsedlastbuydate;

        public:
            static void InitialiseField (const XMLCh *value, std::string &field);
            static void InitialiseField (const XMLCh *value, long &field);
            static void InitialiseField (const XMLCh *value, double &field);

            std::string GetKey ();
            CTime &GetLastBuyDate (bool &valid);

        public:
            PGenDatabaseRow ();
            PGenDatabaseRow (long oi);
    };

private:
    typedef std::map <std::string, PGenDatabaseRows::PGenDatabaseRow *>::iterator DBRowsIter;
    std::map <std::string, PGenDatabaseRow *> _dbrows; // <rowkey, dbrow>

    bool _deepdelete;

    friend class IB_PTraderDlg;
    friend class Tickers;

public:
    static void Delete (PGenDatabaseRows * &dbrows, bool deepdelete);
    static PGenDatabaseRows *Merge (PGenDatabaseRows *master, PGenDatabaseRows *slave, PGenDatabaseRows *delta);

    int GetNumberOfRows () { return (int) _dbrows.size (); }

    PGenDatabaseRow *AddDBRow (PGenDatabaseRow *dbrow);
    PGenDatabaseRow *AddDBRow (const XMLCh *ticker, const XMLCh *tickerid,
                               const XMLCh *buyprice, const XMLCh *numberbuyshares,
                               const XMLCh *sellprice, const XMLCh *numbersellshares,
                               const XMLCh *sectype, const XMLCh *exchange, const XMLCh *primaryexchange,
                               const XMLCh *currency, const XMLCh *localsymbol, const XMLCh *secidtype,
                               const XMLCh *secid, const XMLCh *genericticks, const XMLCh *displayname,
                               long hitcount);
    PGenDatabaseRow *AddDBRow (IdDeals iddeals,
                               TickerId tickerid,
                               std::string ticker,
                               long oi,
                               double buyprice,
                               long numberbuyshares,
                               double sellprice,
                               long numbersellshares,
                               std::string sectype,
                               std::string exchange,
                               std::string primaryexchange,
                               std::string currency,
                               std::string localsymbol,
                               std::string secidtype,
                               std::string secid,
                               std::string genericticks,
                               std::string displayname,
                               long hitcount,
                               double lastavgbuyfill,
                               double lastbuycommission,
                               std::string lastbuydate);

    PGenDatabaseRows ();

private:
    ~PGenDatabaseRows ();
};


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/The151Suggestions.iml" filepath="$PROJECT_DIR$/The151Suggestions.iml" />
    </modules>
  </component>
</project>


text:
<resources>
    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>
    <dimen name="actionBarSize">56dp</dimen>
    <dimen name="actionBarSizeX2">112dp</dimen>
    <dimen name="fab_compat_margin">0dp</dimen>

    <!-- Per the design guidelines, navigation drawers should be between 240dp and 320dp:
         https://developer.android.com/design/patterns/navigation-drawer.html -->
    <dimen name="navigation_drawer_width">240dp</dimen>
</resources>


text:
@interface ITProgressIndicator ()
@property (nonatomic, strong, readonly) CALayer *progressIndicatorLayer;
@end

#pragma mark - Implementation

@implementation ITProgressIndicator
@synthesize progressIndicatorLayer = _progressIndicatorLayer;

#pragma mark - Init

- (id)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        [self initLayers];
    }
    return self;
}

- (id)initWithFrame:(NSRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initLayers];
    }
    return self;
}

- (void)initLayers {
    // Setting initial values
    self.color = [NSColor blackColor];
    self.innerMargin = 4;
	self.widthOfLine = 3;
    self.lengthOfLine = 6;
    self.numberOfLines = 8;
    self.animationDuration = 0.6;
    self.isIndeterminate = NO;
    self.steppedAnimation = YES;
    self.hideWhenStopped = YES;
    self.animates = YES;

    // Init layers
    [self setWantsLayer:YES];
    self.progressIndicatorLayer.frame = self.layer.bounds;
    [self.layer addSublayer:self.progressIndicatorLayer];

    [self reloadIndicatorContent];
    [self reloadAnimation];
}

- (void)awakeFromNib {
    [self reloadAnimation];
}

- (void)reloadIndicatorContent {
    self.progressIndicatorLayer.contents = [self progressImage];
}

- (void)reloadAnimation {
    [self.progressIndicatorLayer removeAnimationForKey:kITSpinAnimationKey];

    if (self.animates) {
        [self.progressIndicatorLayer addAnimation:[self keyFrameAnimationForCurrentPreferences] forKey:kITSpinAnimationKey];
    }
}

#pragma mark - Drawing

- (NSImage *)progressImage {
    NSImage *progressImage = [[NSImage alloc] initWithSize:self.bounds.size];
    [progressImage setFlipped:NO];
    [progressImage lockFocus];
    {
        [NSGraphicsContext saveGraphicsState];
        {
            [self.color set];

            NSRect r = self.bounds;
            NSBezierPath *line = [NSBezierPath bezierPathWithRoundedRect:
                                  NSMakeRect((NSWidth(r) / 2) - (self.widthOfLine / 2),
                                             (NSHeight(r) / 2) - self.innerMargin - self.lengthOfLine,
                                             self.widthOfLine, self.lengthOfLine)
                                                                 xRadius:self.widthOfLine / 2
                                                                 yRadius:self.widthOfLine / 2];

            void (^lineDrawingBlock)(NSUInteger line) =
            ^(NSUInteger lineNumber) {
                NSBezierPath *lineInstance = [line copy];
                lineInstance = [lineInstance rotatedBezierPath:((2 * M_PI) / self.numberOfLines * lineNumber) + M_PI
                                                    aboutPoint:NSMakePoint(NSWidth(r) / 2, NSHeight(r) / 2)];

                if (!_isIndeterminate) [[self.color colorWithAlphaComponent:1.0 - (1.0 / self.numberOfLines * lineNumber)] set];

                [lineInstance fill];
            };

            if (self.isIndeterminate) {
                for (NSUInteger i = self.numberOfLines;
                     i > round(self.numberOfLines - (self.numberOfLines * self.progress));
                     i--)
                {
                    lineDrawingBlock(i);
                }
            } else {
                for (NSUInteger i = 0; i < self.numberOfLines; i++) {
                    lineDrawingBlock(i);
                }
            }
        }
        [NSGraphicsContext restoreGraphicsState];
    }
    [progressImage unlockFocus];

    return progressImage;
}

#pragma mark - Helpers

- (CAKeyframeAnimation *)keyFrameAnimationForCurrentPreferences {
    NSMutableArray* keyFrameValues = [NSMutableArray array];
    NSMutableArray* keyTimeValues;

    if (self.steppedAnimation) {
        {
            [keyFrameValues addObject:[NSNumber numberWithFloat:0.0]];
            for (int i = 0; i < self.numberOfLines; i++) {
                [keyFrameValues addObject:[NSNumber numberWithFloat:-M_PI * (2.0 / self.numberOfLines * i)]];
                [keyFrameValues addObject:[NSNumber numberWithFloat:-M_PI * (2.0 / self.numberOfLines * i)]];
            }
            [keyFrameValues addObject:[NSNumber numberWithFloat:-M_PI*2.0]];
        }

        keyTimeValues = [NSMutableArray array];
        {
            [keyTimeValues addObject:[NSNumber numberWithFloat:0.0]];
            for (int i = 0; i < (self.numberOfLines - 1); i++) {
                [keyTimeValues addObject:[NSNumber numberWithFloat:1.0 / self.numberOfLines * i]];
                [keyTimeValues addObject:[NSNumber numberWithFloat:1.0 / self.numberOfLines * (i + 1)]];
            }
            [keyTimeValues addObject:[NSNumber numberWithFloat:1.0 / self.numberOfLines * (self.numberOfLines - 1)]];
        }
    } else {
        {
            [keyFrameValues addObject:[NSNumber numberWithFloat:-M_PI*0.0]];
            [keyFrameValues addObject:[NSNumber numberWithFloat:-M_PI*0.5]];
            [keyFrameValues addObject:[NSNumber numberWithFloat:-M_PI*1.0]];
            [keyFrameValues addObject:[NSNumber numberWithFloat:-M_PI*1.5]];
            [keyFrameValues addObject:[NSNumber numberWithFloat:-M_PI*2.0]];
        }
    }

    CAKeyframeAnimation* animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];

    [animation setRepeatCount:HUGE_VALF];
    [animation setValues:keyFrameValues];
    [animation setKeyTimes:keyTimeValues];
    [animation setValueFunction:[CAValueFunction functionWithName: kCAValueFunctionRotateZ]];
    [animation setDuration:self.animationDuration];

    return animation;
}

- (void)reloadVisibility {
    if (_hideWhenStopped && !_animates && !_isIndeterminate) {
        [self setHidden:YES];
    } else {
        [self setHidden:NO];
    }
}

#pragma mark - NSView methods

// Animatible proxy
+ (id)defaultAnimationForKey:(NSString *)key
{
    if ([key isEqualToString:kITProgressPropertyKey]) {
        return [CABasicAnimation animation];
    } else {
        return [super defaultAnimationForKey:key];
    }
}

#pragma mark - Setters & Getters

- (void)setIndeterminate:(BOOL)isIndeterminate {
    _isIndeterminate = isIndeterminate;

    if (_isIndeterminate) {
        self.animates = NO;
    }
}

- (void)setProgress:(CGFloat)progress {
    if (progress < 0 || progress > 1) {
        @throw [NSException exceptionWithName:@"Invalid `progress` property value"
                                       reason:@"`progress` property needs to be between 0 and 1"
                                     userInfo:nil];
    }

    _progress = progress;

    if (self.isIndeterminate) {
        [self reloadIndicatorContent];
    }
}

- (void)setAnimates:(BOOL)animates {
    _animates = animates;
    [self reloadIndicatorContent];
    [self reloadAnimation];
    [self reloadVisibility];
}

- (void)setHideWhenStopped:(BOOL)hideWhenStopped {
    _hideWhenStopped = hideWhenStopped;
    [self reloadVisibility];
}

- (CALayer *)progressIndicatorLayer {
    if (!_progressIndicatorLayer) {
        _progressIndicatorLayer = [CALayer layer];
    }

    return _progressIndicatorLayer;
}

- (void)setLengthOfLine:(CGFloat)lengthOfLine {
    _lengthOfLine = lengthOfLine;
    [self reloadIndicatorContent];
}

- (void)setWidthOfLine:(CGFloat)widthOfLine {
    _widthOfLine = widthOfLine;
    [self reloadIndicatorContent];
}

- (void)setInnerMargin:(CGFloat)innerMargin {
    _innerMargin = innerMargin;
    [self reloadIndicatorContent];
}

- (void)setAnimationDuration:(CGFloat)animationDuration {
    _animationDuration = animationDuration;
    [self reloadAnimation];
}

- (void)setNumberOfLines:(NSUInteger)numberOfLines {
    _numberOfLines = numberOfLines;
    [self reloadIndicatorContent];
    [self reloadAnimation];
}

- (void)setSteppedAnimation:(BOOL)steppedAnimation {
    _steppedAnimation = steppedAnimation;
    [self reloadAnimation];
}

- (void)setColor:(NSColor *)color {
    _color = color;
    [self reloadIndicatorContent];
}

@end


text:
package com.gogoing.www.safeground;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class GuidecomplateActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_guidecomplate);
    }
}


text:
namespace MFlow.Core.Validation
{
    /// <summary>
    ///     A fluent validation interface
    /// </summary>
    public interface IFluentValidationString<T> : IFluentValidationGeneric<T>
    {
        /// <summary>
        ///     Checks if the expressions evaluates to a string that is empty
        /// </summary>
        IFluentValidation<T> IsNotEmpty();

        /// <summary>
        ///     Checks if the expression evaluates to a string that matches the regEx
        /// </summary>
        IFluentValidation<T> Matches(string regEx);

        /// <summary>
        ///     Checks if the expression evaluates to a string that is an email address
        /// </summary>
        IFluentValidation<T> IsEmail();

        /// <summary>
        ///     Checks if the expression evaluates to a string that contains value
        /// </summary>
        IFluentValidation<T> Contains(string value);

        /// <summary>
        ///     Checks if the expression evaluates to a string that is of length
        /// </summary>
        IFluentValidation<T> IsLength(int length);

        /// <summary>
        ///     Checks if the expression evaluates to a string longer than length
        /// </summary>
        IFluentValidation<T> IsLongerThan(int length);

        /// <summary>
        ///     Checks if the expression evaluates to a string shorter than length
        /// </summary>
        IFluentValidation<T> IsShorterThan(int length);

        /// <summary>
        ///     Check if the expression evaluates to a string matching a credit card pattern
        /// </summary>
        IFluentValidation<T> IsCreditCard();

        /// <summary>
        ///     Check if the expression evaluates to a string that is a post code
        /// </summary>
        IFluentValidation<T> IsPostCode();

        /// <summary>
        ///     Check if the expression evaluates to a strin that is a zip code
        /// </summary>
        IFluentValidation<T> IsZipCode();

        /// <summary>
        ///    Check if the expression evalates to a string that is numeric
        /// </summary>
        IFluentValidation<T> IsNumeric();

        /// <summary>
        ///    Check if the expression evalates to a string that is alpha only
        /// </summary>
        IFluentValidation<T> IsAlpha();

        /// <summary>
        ///    Check if the expressions evaluates to a string that is a date
        /// </summary>
        IFluentValidation<T> IsDate();

        /// <summary>
        ///    Check if the expressions evaluates to a string that is a valid password
        /// </summary>
        IFluentValidation<T> IsPassword();

        /// <summary>
        ///    Check if the expressions evaluates to a string that is a valid username
        /// </summary>
        IFluentValidation<T> IsUsername();

        /// <summary>
        ///    Check if the expressions evaluates to a string that is a valid url
        /// </summary>
        IFluentValidation<T> IsUrl();
    }
}


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("./index");
//# sourceMappingURL=bin.js.map


text:
package org.datanucleus.tests;

import javax.jdo.JDOHelper;
import javax.jdo.ObjectState;

import org.assertj.core.api.Condition;
import org.datanucleus.store.types.SCO;

/**
 * Provides an extension to AssertJ for common test assertions and condtions.
 */
public class DataNucleusAssertions
{
    /**
     * It must use an instance for each assertion because we keep the actual state in order to be able to show
     * the actual state in case it does not match.
     * @param expectedState The {@link ObjectState} that the object is expected to be in
     * @return a new Condition to the given expectedState.
     */
    public static Condition<Object> state(ObjectState expectedState)
    {
        return new StateCondition(expectedState);
    }

    public static Condition<Object> WRAPPER = new Condition<Object>("a SCO wrapper")
    {
        public boolean matches(Object object)
        {
            return object instanceof SCO;
        }
    };

    private static class StateCondition extends ConditionWithActual<Object, ObjectState>
    {
        public StateCondition(ObjectState expectedState)
        {
            super(expectedState);
        }

        @Override
        public boolean matches(Object object)
        {
            actual = JDOHelper.getObjectState(object);

            boolean result = actual == expected;
            if (result)
            {
                as("state [%s]", expected);
            }
            else
            {
                as("state [%s] instead of [%s]", expected, actual);
            }
            return actual == expected;
        }
    }

    private static abstract class ConditionWithActual<T, A> extends Condition<T>
    {
        protected A actual;

        protected A expected;

        public ConditionWithActual(A expected)
        {
            this.expected = expected;
        }
    }
}


text:
@interface SettingsTableViewController : UITableViewController <UITableViewDataSource, UITableViewDelegate, UIAlertViewDelegate>

@end


text:
"""tests for the non-native part of qr()

:author: `Patrick Kanzler <patrick.kanzler@fablab.fau.de>`_
:organization: `python-escpos <https://github.com/python-escpos>`_
:copyright: Copyright (c) 2016 `python-escpos <https://github.com/python-escpos>`_
:license: MIT
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import mock

from escpos.printer import Dummy
from PIL import Image

@mock.patch('escpos.printer.Dummy.image', spec=Dummy)
def test_type_of_object_passed_to_image_function(img_function):
    """
    Test the type of object that is passed to the image function during non-native qr-printing.

    The type should be PIL.Image
    """
    d = Dummy()
    d.qr("LoremIpsum")
    args, kwargs = img_function.call_args
    assert isinstance(args[0], Image.Image)


text:
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
 *     Copyright 2017 Couchbase, Inc.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
#include "get_meta_context.h"

#include "engine_wrapper.h"

#include <daemon/buckets.h>
#include <daemon/cookie.h>
#include <daemon/debug_helpers.h>
#include <daemon/mcaudit.h>
#include <daemon/memcached.h>
#include <xattr/utils.h>

GetMetaCommandContext::GetMetaCommandContext(Cookie& cookie)
    : SteppableCommandContext(cookie),
      vbucket(cookie.getRequest().getVBucket()),
      state(State::GetItemMeta),
      info(),
      fetchDatatype(false) {
    auto extras = cookie.getRequest().getExtdata();
    // Read the version if extlen is 1
    if (extras.size() == 1 && *extras.data() == uint8_t(GetMetaVersion::V2)) {
        fetchDatatype = true;
    }
}

ENGINE_ERROR_CODE GetMetaCommandContext::getItemMeta() {
    auto errorMetaPair =
            bucket_get_meta(cookie, cookie.getRequestKey(), vbucket);
    if (errorMetaPair.first == cb::engine_errc::success) {
        info = errorMetaPair.second;
        state = State::SendResponse;
    } else if (errorMetaPair.first == cb::engine_errc::no_such_key) {
        state = State::NoSuchItem;
        errorMetaPair.first = cb::engine_errc::success;
    }

    return ENGINE_ERROR_CODE(errorMetaPair.first);
}

ENGINE_ERROR_CODE GetMetaCommandContext::sendResponse() {
    // Prepare response
    uint32_t deleted =
            htonl(info.document_state == DocumentState::Deleted ? 1 : 0);
    uint8_t datatype = fetchDatatype ? info.datatype : uint8_t(0);
    GetMetaResponse metaResponse(deleted,
                                 info.flags,
                                 htonl(gsl::narrow<uint32_t>(info.exptime)),
                                 htonll(info.seqno),
                                 datatype);

    const size_t responseExtlen =
            fetchDatatype
                    ? sizeof(metaResponse)
                    : sizeof(metaResponse) - sizeof(metaResponse.datatype);

    std::string_view extras = {reinterpret_cast<const char*>(&metaResponse),
                               responseExtlen};
    cookie.sendResponse(cb::mcbp::Status::Success,
                        extras,
                        {},
                        {},
                        cb::mcbp::Datatype::Raw,
                        info.cas);
    cb::audit::document::add(cookie, cb::audit::document::Operation::Read);
    update_topkeys(cookie);

    state = State::Done;
    return ENGINE_SUCCESS;
}

ENGINE_ERROR_CODE GetMetaCommandContext::noSuchItem() {

    if (cookie.getRequest().isQuiet()) {
        auto& bucket = connection.getBucket();
        bucket.responseCounters[int(cb::mcbp::Status::KeyEnoent)]++;
    } else {
        auto& req = cookie.getRequest();
        if (req.getClientOpcode() != cb::mcbp::ClientOpcode::GetqMeta) {
            cookie.sendResponse(cb::mcbp::Status::KeyEnoent);
        }
    }

    state = State::Done;
    return ENGINE_SUCCESS;
}

ENGINE_ERROR_CODE GetMetaCommandContext::step() {
    auto ret = ENGINE_SUCCESS;
    do {
        switch (state) {
        case State::GetItemMeta:
            ret = getItemMeta();
            break;
        case State::NoSuchItem:
            ret = noSuchItem();
            break;
        case State::SendResponse:
            ret = sendResponse();
            break;
        case State::Done:
            return ENGINE_SUCCESS;
        }
    } while (ret == ENGINE_SUCCESS);

    return ret;
}


text:
package javax.usb;

/**
 * Interface for a USB IRP (I/O Request Packet).
 *

 * Some USB communication requires addiitonal metadata that describes how the actual
 * data should be handled when being transferred.  This UsbIrp encapsulates the
 * actual data buffer, as well as other metadata that gives the user more
 * control and knowledge over how the data is handled.
 *

 * Before submitting this, at least some of these (depending on UsbIrp implementation) must be performed:
 *

 *
The {@link #getData() data} must be {@link #setData(byte[]) set}.

 *
The {@link #getOffset() data offset}, may be {@link #setOffset(int) set}.

 *
The {@link #getLength() data length} may be {@link #setLength(int) set}.

 *
The {@link #getAcceptShortPacket() Short Packet policy} may be {@link #setAcceptShortPacket(boolean) set}.

 *
The {@link #getUsbException() UsbException} must be null (and {@link #isUsbException() isUsbException} must be false).

 *
The {@link #isComplete() complete state} must be false.

 *

 * Any UsbIrp implementation must behave as specified in this interface's documentation, including the specified defaults.
 * Note that {@link #setData(byte[]) setData} also sets the offset to 0 and the length to data.length; if other
 * values should be used, use the {@link #setData(byte[],int,int) 3-parameter setData} or set the
 * {@link #setOffset(int) offset} and {@link #setLength(int) length} with their setters after setting
 * the data.
 *

 * The javax.usb implementation will set the {@link #getActualLength() data length} or, if unsuccessful, the
 * {@link #getUsbException() UsbException}, after processing.  Finally, it will call {@link #complete() complete}.
 *

 * See the USB 1.1 specification section 5.3.2 for details on USB IRPs.
 * The IRP defined in this API has more than is mentioned in the USB 1.1 specification.
 * @author Dan Streetman
 */
public interface UsbIrp
{
	/**
	 * Get the data.
	 *

	 * This defaults to an empty byte[].
	 * This will never be null.
	 * @return The data.
	 */
	public byte[] getData();

	/**
	 * Get the starting offset of the data.
	 *

	 * This indicates the starting byte in the data.
	 *

	 * This defaults to 0, and this is set to 0 by {@link #setData(byte[]) the 1-parameter setData}.
	 * This will never be negative.
	 * @return The offset.
	 */
	public int getOffset();

	/**
	 * The amount of data to transfer.
	 *

	 * This indicates the amount of data to transfer.
	 *

	 * This defaults to 0, and this is set to data.length by {@link #setData(byte[]) the 1-parameter setData}.
	 * This will never be negative.
	 * @return The amount of data to transfer.
	 */
	public int getLength();

	/**
	 * The amount of data that was transferred.
	 *

	 * This defaults to 0, and is set by the implementation during/after submission (if successful).
	 * This will never be negative.  If {@link #isUsbException() isUsbException} is true,
	 * this value is undefined.
	 * @return The amount of data that was transferred.
	 */
	public int getActualLength();

	/**
	 * Set the data.
	 *

	 * This {@link #setOffset(int) sets the offset} to 0,
	 * and {@link #setLength(int) sets the length} to data.length;
	 * if those values are inappropriate, use the
	 * {@link #setData(byte[],int,int) other setData}.
	 * @param data The data.
	 * @exception IllegalArgumentException If the data is null.
	 */
	public void setData(byte[] data);

	/**
	 * Set the data.
	 *

	 * This sets the data, offset, and length to the specified values.
	 * @param data The data.
	 * @param offset The offset.
	 * @param length The length.
	 * @exception IllegalArgumentException If the data is null, or offset and/or length is negative.
	 */
	public void setData(byte[] data, int offset, int length);

	/**
	 * Set the offset.
	 * @param offset The offset.
	 * @exception IllegalArgumentException If the offset is negative.
	 */
	public void setOffset(int offset);

	/**
	 * Set the amount of data to transfer.
	 * @param length The amount of data to transfer.
	 * @exception IllegalArgumentException If the length is negative.
	 */
	public void setLength(int length);

	/**
	 * Set the amount of data that was transferred.
	 *

	 * The implementation will set this to the amount of data
	 * actually transferred.  The implementation will set this
	 * before calling {@link #complete() complete}, regardless of
	 * whether the submission was successful or not.
	 * @param length The amount of data that was transferred.
	 * @exception IllegalArgumentException If the length is negative.
	 */
	public void setActualLength(int length);

	/**
	 * If a UsbException occured.
	 *

	 * If this is true, the {@link #getActualLength() actual length} is undefined.
	 * @return If a UsbException occurred.
	 */
	public boolean isUsbException();

	/**
	 * Get the UsbException.
	 *

	 * If no UsbException occurred, this returns null.
	 * @return The UsbException, or null.
	 */
	public UsbException getUsbException();

	/**
	 * Set the UsbException.
	 * @param usbException The UsbException.
	 */
	public void setUsbException(UsbException usbException);

	/**
	 * If short packets should be accepted.
	 *

	 * See the USB 1.1 specification sec 5.3.2 for details on short packets and
	 * short packet detection.
	 * If short packets are accepted (true), a short packet indicates the end of data.
	 * If short packets are not accepted (false), a short packet will generate
	 * an UsbException.  The default is true.
	 * @return If short packects should be accepted.
	 */
	public boolean getAcceptShortPacket();

	/**
	 * Set if short packets should be accepted.
	 *

	 * This should be set by the application.
	 * @param accept If short packets should be accepted.
	 */
	public void setAcceptShortPacket( boolean accept );

	/**
	 * If this has completed.
	 *

	 * This must be false before use.
	 * @return If this UsbIrp has completed.
	 */
	public boolean isComplete();

	/**
	 * Set this as complete or not.
	 *

	 * This is what {@link #isComplete() isComplete} returns.
	 * @param complete If this is complete or not.
	 */
	public void setComplete(boolean complete);

	/**
	 * Set this as complete.
	 *

	 * This is the last method the implementation calls; it indicates the UsbIrp has completed.
	 * The implementation will {@link #setActualLength(int) set the actual length},
	 * even if the submission was unsuccessful, before calling this.
	 * The implementation will {@link #setUsbException(UsbException) set the UsbException},
	 * if appropriate, before calling this.
	 *

	 * After calling this {@link #isComplete() isComplete} will return true.
	 */
	public void complete();

	/**
	 * Wait until {@link #isComplete() complete}.
	 *

	 * This will block until this is {@link #isComplete() complete}.
	 */
	public void waitUntilComplete();

	/**
	 * Wait until {@link #isComplete() complete}, or the timeout has expired.
	 *

	 * This will block until this is {@link #isComplete() complete},
	 * or the timeout has expired.  The timeout is ignored if it is
	 * 0 or less, i.e. this will behave as the {@link #waitUntilComplete() no-timeout method}.
	 * @param timeout The maximum number of milliseconds to wait.
	 */
	public void waitUntilComplete( long timeout );
}


text:
/**
 * Here we present two methods (recursive and iterative) of generating all the combinations of a set
 * by choosing only r of n elements.
 *
 * <p>Time Complexity: O( n choose r )
 *
 * @author William Fiset, Micah Stairs
 */
package com.williamfiset.algorithms.other;

public class Combinations {

  // This method finds all the combinations of size r in a set
  public static void combinationsChooseR(int[] set, int r) {

    if (r < 0) return;
    if (set == null) return;

    boolean[] used = new boolean[set.length];
    combinations(set, r, 0, used);
  }

  // To find all the combinations of size r we need to recurse until we have
  // selected r elements (aka r = 0), otherwise if r != 0 then we need to select
  // an element which is found after the position of our last selected element
  private static void combinations(int[] set, int r, int at, boolean[] used) {

    final int N = set.length;

    // Return early if there are more elements left to select than what is available.
    int elementsLeftToPick = N - at;
    if (elementsLeftToPick < r) return;

    // We selected 'r' elements so we found a valid subset!
    if (r == 0) {

      System.out.print("{ ");
      for (int i = 0; i < N; i++) if (used[i]) System.out.print(set[i] + " ");
      System.out.println("}");

    } else {

      for (int i = at; i < N; i++) {

        // Try including this element
        used[i] = true;

        combinations(set, r - 1, i + 1, used);

        // Backtrack and try the instance where we did not include this element
        used[i] = false;
      }
    }
  }

  // Use this method in combination with a do while loop to generate all the combinations
  // of a set choosing r elements in a iterative fashion. This method returns
  // false once the last combination has been generated.
  // NOTE: Originally the selection needs to be initialized to {0,1,2,3 ... r-1}
  public static boolean nextCombination(int[] selection, int N, int r) {
    if (r > N) throw new IllegalArgumentException("r must be <= N");
    int i = r - 1;
    while (selection[i] == N - r + i) if (--i < 0) return false;
    selection[i]++;
    for (int j = i + 1; j < r; j++) selection[j] = selection[i] + j - i;
    return true;
  }

  public static void main(String[] args) {

    // Recursive approach
    int R = 3;
    int[] set = {1, 2, 3, 4, 5};
    combinationsChooseR(set, R);
    // prints:
    // { 1 2 3 }
    // { 1 2 4 }
    // { 1 2 5 }
    // { 1 3 4 }
    // { 1 3 5 }
    // { 1 4 5 }
    // { 2 3 4 }
    // { 2 3 5 }
    // { 2 4 5 }
    // { 3 4 5 }

    // Suppose we want to select all combinations of colors where R = 3
    String[] colors = {"red", "purple", "green", "yellow", "blue", "pink"};
    R = 3;

    // Initialize the selection to be {0, 1, ... , R-1}
    int[] selection = {0, 1, 2};
    do {

      // Print each combination
      for (int index : selection) System.out.print(colors[index] + " ");
      System.out.println();

    } while (nextCombination(selection, colors.length, R));
    // prints:
    // red purple green
    // red purple yellow
    // red purple blue
    // red purple pink
    // red green yellow
    // red green blue
    // red green pink
    // red yellow blue
    // red yellow pink
    // red blue pink
    // purple green yellow
    // purple green blue
    // purple green pink
    // purple yellow blue
    // purple yellow pink
    // purple blue pink
    // green yellow blue
    // green yellow pink
    // green blue pink
    // yellow blue pink

  }
}


text:
import Item from './Item'

export default class ItemFactory {
	constructor(configItems) {
		this._configItems = configItems
	}

	_getItems() {
		return (function visit(configItems, parent) {
			return configItems.map(function (configItem) {
				var item = new Item(configItem, parent)
				if (item.items) {
					item.items = visit(item.items, item)
				}
				return item
			})
		})(this._configItems)
	}

	getItem(idPath) {
		var items = this._getItems()
		idPath = idPath.toLowerCase() || items[0].idPath
		var ids = idPath.split('/')

		return (function visit(items, ids, navigation, title) {
			navigation = navigation || []
			title = title || []
			var item
			var id = ids.shift()
			if (id === undefined) {
				item = items[0]
			} else {
				for (var i = 0; i < items.length; i++) {
					if (items[i].id === id) {
						item = items[i]
						break
					}
				}
			}

			if (item) {
				item.active = true
				navigation.push(items)
				title.unshift(item.name)
				if (item.items) {
					return visit(item.items, ids, navigation, title)
				}
				return {
					title: title.join(' - '),
					url: item.url,
					navigation: navigation,
				}
			}
		})(items, ids)
	}
}


text:
import cleanup from './cleanup';
import listenersCallback from './listeners_callback';

export default function applyChanges(data) {
  const { combineState, listeners } = data;
  let { state } = data;

  data.isSetting = true;
  data.partialStates.forEach((partialState) => {
    state = combineState(state, partialState);
  });
  data.state = state;

  if (listeners.size === 0) {
    cleanup(data);
    return;
  }

  // Guard against synchronous listeners calling "cleanup" too early
  data.listenersLeft = 1;
  listeners.forEach((listener) => {
    data.listenersLeft += 1;
    listener(() => {
      listenersCallback(data);
    });
  });
  // The "last listener":
  listenersCallback(data);
}


text:
/*
 *  Duktape built-ins
 *
 *  Size optimization note: it might seem that vararg multipurpose functions
 *  like fin(), enc(), and dec() are not very size optimal, but using a single
 *  user-visible Ecmascript function saves a lot of run-time footprint; each
 *  Function instance takes >100 bytes.  Using a shared native helper and a
 *  'magic' value won't save much if there are multiple Function instances
 *  anyway.
 */

#include "duk_internal.h"

#if defined(DUK_USE_DUKTAPE_BUILTIN)

DUK_INTERNAL duk_ret_t duk_bi_duktape_object_info(duk_hthread *thr) {
	duk_inspect_value(thr, -1);
	return 1;
}

DUK_INTERNAL duk_ret_t duk_bi_duktape_object_act(duk_hthread *thr) {
	duk_int_t level;

	level = duk_to_int(thr, 0);
	duk_inspect_callstack_entry(thr, level);
	return 1;
}

DUK_INTERNAL duk_ret_t duk_bi_duktape_object_gc(duk_hthread *thr) {
	duk_small_uint_t flags;

	flags = (duk_small_uint_t) duk_get_uint(thr, 0);
	duk_heap_mark_and_sweep(thr->heap, flags);

	/* XXX: Not sure what the best return value would be in the API.
	 * Return true for now.
	 */
	duk_push_true(thr);
	return 1;
}

#if defined(DUK_USE_FINALIZER_SUPPORT)
DUK_INTERNAL duk_ret_t duk_bi_duktape_object_fin(duk_hthread *thr) {
	(void) duk_require_hobject(thr, 0);
	if (duk_get_top(thr) >= 2) {
		/* Set: currently a finalizer is disabled by setting it to
		 * undefined; this does not remove the property at the moment.
		 * The value could be type checked to be either a function
		 * or something else; if something else, the property could
		 * be deleted.  Must use duk_set_finalizer() to keep
		 * DUK_HOBJECT_FLAG_HAVE_FINALIZER in sync.
		 */
		duk_set_top(thr, 2);
		duk_set_finalizer(thr, 0);
		return 0;
	} else {
		/* Get. */
		DUK_ASSERT(duk_get_top(thr) == 1);
		duk_get_finalizer(thr, 0);
		return 1;
	}
}
#endif  /* DUK_USE_FINALIZER_SUPPORT */

DUK_INTERNAL duk_ret_t duk_bi_duktape_object_enc(duk_hthread *thr) {
	duk_hstring *h_str;

	/* Vararg function: must be careful to check/require arguments.
	 * The JSON helpers accept invalid indices and treat them like
	 * non-existent optional parameters.
	 */

	h_str = duk_require_hstring(thr, 0);  /* Could reject symbols, but no point: won't match comparisons. */
	duk_require_valid_index(thr, 1);

	if (h_str == DUK_HTHREAD_STRING_HEX(thr)) {
		duk_set_top(thr, 2);
		duk_hex_encode(thr, 1);
		DUK_ASSERT_TOP(thr, 2);
	} else if (h_str == DUK_HTHREAD_STRING_BASE64(thr)) {
		duk_set_top(thr, 2);
		duk_base64_encode(thr, 1);
		DUK_ASSERT_TOP(thr, 2);
#if defined(DUK_USE_JSON_SUPPORT) && defined(DUK_USE_JX)
	} else if (h_str == DUK_HTHREAD_STRING_JX(thr)) {
		duk_bi_json_stringify_helper(thr,
		                             1 /*idx_value*/,
		                             2 /*idx_replacer*/,
		                             3 /*idx_space*/,
		                             DUK_JSON_FLAG_EXT_CUSTOM |
		                             DUK_JSON_FLAG_ASCII_ONLY |
		                             DUK_JSON_FLAG_AVOID_KEY_QUOTES /*flags*/);
#endif
#if defined(DUK_USE_JSON_SUPPORT) && defined(DUK_USE_JC)
	} else if (h_str == DUK_HTHREAD_STRING_JC(thr)) {
		duk_bi_json_stringify_helper(thr,
		                             1 /*idx_value*/,
		                             2 /*idx_replacer*/,
		                             3 /*idx_space*/,
		                             DUK_JSON_FLAG_EXT_COMPATIBLE |
		                             DUK_JSON_FLAG_ASCII_ONLY /*flags*/);
#endif
	} else {
		DUK_DCERROR_TYPE_INVALID_ARGS(thr);
	}
	return 1;
}

DUK_INTERNAL duk_ret_t duk_bi_duktape_object_dec(duk_hthread *thr) {
	duk_hstring *h_str;

	/* Vararg function: must be careful to check/require arguments.
	 * The JSON helpers accept invalid indices and treat them like
	 * non-existent optional parameters.
	 */

	h_str = duk_require_hstring(thr, 0);  /* Could reject symbols, but no point: won't match comparisons */
	duk_require_valid_index(thr, 1);

	if (h_str == DUK_HTHREAD_STRING_HEX(thr)) {
		duk_set_top(thr, 2);
		duk_hex_decode(thr, 1);
		DUK_ASSERT_TOP(thr, 2);
	} else if (h_str == DUK_HTHREAD_STRING_BASE64(thr)) {
		duk_set_top(thr, 2);
		duk_base64_decode(thr, 1);
		DUK_ASSERT_TOP(thr, 2);
#if defined(DUK_USE_JSON_SUPPORT) && defined(DUK_USE_JX)
	} else if (h_str == DUK_HTHREAD_STRING_JX(thr)) {
		duk_bi_json_parse_helper(thr,
		                         1 /*idx_value*/,
		                         2 /*idx_replacer*/,
		                         DUK_JSON_FLAG_EXT_CUSTOM /*flags*/);
#endif
#if defined(DUK_USE_JSON_SUPPORT) && defined(DUK_USE_JC)
	} else if (h_str == DUK_HTHREAD_STRING_JC(thr)) {
		duk_bi_json_parse_helper(thr,
		                         1 /*idx_value*/,
		                         2 /*idx_replacer*/,
		                         DUK_JSON_FLAG_EXT_COMPATIBLE /*flags*/);
#endif
	} else {
		DUK_DCERROR_TYPE_INVALID_ARGS(thr);
	}
	return 1;
}

/*
 *  Compact an object
 */

DUK_INTERNAL duk_ret_t duk_bi_duktape_object_compact(duk_hthread *thr) {
	DUK_ASSERT_TOP(thr, 1);
	duk_compact(thr, 0);
	return 1;  /* return the argument object */
}

#endif  /* DUK_USE_DUKTAPE_BUILTIN */


text:
// Exact geometric predicates
#pragma once

#include <geode/exact/config.h>
#include <geode/vector/Vector.h>
namespace geode {

template<int axis, class Perturbed> GEODE_CORE_EXPORT GEODE_PURE bool
axis_less_degenerate(const Perturbed a, const Perturbed b) GEODE_COLD;

// Is a[axis] < b[axis]?
template<int axis, class Perturbed> GEODE_PURE static inline bool axis_less(const Perturbed a, const Perturbed b) {
  if (a.value()[axis] != b.value()[axis])
    return a.value()[axis] < b.value()[axis];
  return axis_less_degenerate<axis>(a,b);
}

// axis_less with a runtime axis
template<class Perturbed> GEODE_PURE static inline bool
axis_less(const int axis, const Perturbed a, const Perturbed b) {
  static constexpr auto d = Perturbed::ValueType::m;
  if (a.value[axis] != b.value[axis])
    return a.value[axis] < b.value[axis];
  static_assert(d <= 3,"");
  return d<=1 || axis==0 ? axis_less_degenerate<0>(a,b)
       : d<=2 || axis==1 ? axis_less_degenerate<(d>1?1:0)>(a,b)
                         : axis_less_degenerate<(d>2?2:0)>(a,b);
}

// Is a.x < b.x?
template<class Perturbed> static inline bool rightwards(const Perturbed a, const Perturbed b) { return axis_less<0>(a,b); }

// Is a.y < b.y?
template<class Perturbed> static inline bool upwards(const Perturbed a, const Perturbed b) { return axis_less<1>(a,b); }

/*** 2D predicates ***/

#define P2 exact::Perturbed2
#define P3 exact::Perturbed3

// Is a 2D triangle positively oriented?
GEODE_CORE_EXPORT GEODE_PURE bool triangle_oriented(const P2 p0, const P2 p1, const P2 p2);

// Is the rotation from d0 to d1 positive?
GEODE_CORE_EXPORT GEODE_PURE bool directions_oriented(const P2 d0, const P2 d1);

// Is the rotation from a1-a0 to b1-b0 positive?
GEODE_CORE_EXPORT GEODE_PURE bool segment_directions_oriented(const P2 a0, const P2 a1, const P2 b0, const P2 b1);

// Is the rotation from a1-a0 to d positive?  This is needed for sentinel incircle tests.
GEODE_CORE_EXPORT GEODE_PURE bool segment_to_direction_oriented(const P2 a0, const P2 a1, const P2 d);

// Given segments a,b,c, does intersect(a,b) come before intersect(a,c) on segment a?
// b and c are allowed to share one point (but not two).
GEODE_CORE_EXPORT GEODE_PURE bool segment_intersections_ordered(const P2 a0, const P2 a1,
                                                                const P2 b0, const P2 b1,
                                                                const P2 c0, const P2 c1);

// Given segments a,b and vertex c, is intersect(a,b) above c
GEODE_CORE_EXPORT GEODE_PURE bool segment_intersection_above_point(const P2 a0, const P2 a1,
                                                                   const P2 b0, const P2 b1, const P2 c);

// Given segments a,b and a ray origin c, does a rightwards ray from c intersect [a0,a1] before [b0,b1]
GEODE_CORE_EXPORT GEODE_PURE bool ray_intersections_rightwards(const P2 a0, const P2 a1,
                                                               const P2 b0, const P2 b1, const P2 c);

// Does p3 lie inside the circle defined by p0,p1,p2?  This predicate is antisymmetric.
GEODE_CORE_EXPORT GEODE_PURE bool incircle(const P2 p0, const P2 p1, const P2 p2, const P2 p3);

// Does segment a0,a1 intersect b0,b1?
GEODE_CORE_EXPORT GEODE_PURE bool segments_intersect(const P2 a0, const P2 a1, const P2 b0, const P2 b1);

/*** 3D predicates ***/

// Is a 3D tetrahedron positively oriented?
GEODE_CORE_EXPORT GEODE_PURE bool tetrahedron_oriented(const P3 p0, const P3 p1,
                                                       const P3 p2, const P3 p3);

// Does segment a0,a1 intersect triangle b0,b1,b2?
GEODE_CORE_EXPORT GEODE_PURE bool segment_triangle_intersect(const P3 a0, const P3 a1,
                                                             const P3 b0, const P3 b1, const P3 b2);

// Do segment (a0,a1) and triangle (b0,b1,b2) have matching orientations?
GEODE_CORE_EXPORT GEODE_PURE bool segment_triangle_oriented(const P3 a0, const P3 a1,
                                                            const P3 b0, const P3 b1, const P3 b2);

// Given segment a and triangles b,c, does intersect(a,b) come before intersect(a,c) on segment a?
GEODE_CORE_EXPORT GEODE_PURE bool segment_triangle_intersections_ordered(const P3 a0, const P3 a1,
                                                                         const P3 b0, const P3 b1, const P3 b2,
                                                                         const P3 c0, const P3 c1, const P3 c2);

// Given triangles a,b,c, is det(na,nb,nc) > 0?
GEODE_CORE_EXPORT GEODE_PURE bool triangles_oriented(const P3 a0, const P3 a1, const P3 a2,
                                                     const P3 b0, const P3 b1, const P3 b2,
                                                     const P3 c0, const P3 c1, const P3 c2);

#undef P3
#undef P2

}


text:
[![Build Status](https://travis-ci.org/mxro/metrics-js.svg)](https://travis-ci.org/mxro/metrics-js)

**Project Moved** This project has moved to [javadelight/delight-metrics-js](https://github.com/javadelight/delight-metrics-js)

# metrics-js

A simple yet powerful metrics library for JavaScript (and GWT).

## Resources

- [JavaDoc](http://modules.appjangle.com/metrics-js/latest/apidocs/)
- [Project Reports](http://modules.appjangle.com/metrics-js/latest/project-reports.html)


text:
require_dependency 'changeset'

module CodeReviewChangesetPatch
  def self.included(base) # :nodoc:
    base.send(:include, ChangesetInstanceMethodsCodeReview)

    base.class_eval do
      unloadable # Send unloadable so it will not be unloaded in development
      has_many :code_review_assignments, :dependent => :destroy
      alias_method_chain :scan_comment_for_issue_ids, :code_review
    end

  end
end

module ChangesetInstanceMethodsCodeReview
  #
  # for review issues
  #
  def review_count
    return @review_count if @review_count
    @review_count = 0
    filechanges.each{|change|
      @review_count += change.review_count
    }
    return @review_count
  end

  def open_review_count
    return @open_review_count if @open_review_count
    @open_review_count = 0
    filechanges.each{|change|
      @open_review_count += change.open_review_count
    }
    return @open_review_count
  end

  def review_issues
    return @review_issues if @review_issues
    filechanges.each{|change|
      unless @review_issues
        @review_issues = change.code_reviews.collect{|issue| issue}
      else
        @review_issues =  @review_issues + change.code_reviews.collect{|issue| issue}
      end
      @review_issues
    }
  end

  def closed_review_count
    review_count - open_review_count
  end

  def closed_review_pourcent
    if review_count == 0
      0
    else
      closed_review_count * 100.0 / review_count
    end
  end

  def completed_review_pourcent
    if review_count == 0
      0
    elsif open_review_count == 0
      100
    else
      @completed_review_pourcent ||= (closed_review_count * 100 +
          CodeReview.sum("#{Issue.table_name}.done_ratio",
          :joins => "left join #{Change.table_name} on change_id = #{Change.table_name}.id  left join #{Changeset.table_name} on #{Change.table_name}.changeset_id = #{Changeset.table_name}.id " +
      "left join #{Issue.table_name} on issue_id = #{Issue.table_name}.id " +
      "left join #{IssueStatus.table_name} on #{Issue.table_name}.status_id = #{IssueStatus.table_name}.id",
          :conditions => ["#{Changeset.table_name}.id = ? AND #{IssueStatus.table_name}.is_closed = ?", id, false]).to_f) / review_count
    end
  end

  #
  # for assignment issues
  #

  def assignment_count
    #return @assignment_count if @assignment_count
    @assignment_count = code_review_assignments.length
    filechanges.each{|change|
      @assignment_count += change.assignment_count
    }
    return @assignment_count
  end

  def open_assignment_count
    return @open_assignment_count if @open_assignment_count
    @open_assignment_count = code_review_assignments.select {|assignment|
      !assignment.is_closed?
    }.length
    filechanges.each{|change|
      @open_assignment_count += change.open_assignment_count
    }
    return @open_assignment_count
  end

  def assignment_issues
    return @assignment_issues if @assignment_issues
    @assignment_issues = code_review_assignments
    filechanges.each{|change|
        @assignment_issues =  @assignment_issues + change.code_review_assignments.collect{|issue| issue}
    }
    @assignment_issues

  end

  def closed_assignment_count
    assignment_count - open_assignment_count
  end

  def closed_assignment_pourcent
    if assignment_count == 0
      0
    else
      closed_assignment_count * 100.0 / assignment_count
    end
  end

  def completed_assignment_pourcent
    if assignment_count == 0
      0
    elsif open_assignment_count == 0
      100
    else
      @completed_assignment_pourcent ||= (closed_assignment_count * 100 +
          CodeReviewAssignment.sum("#{Issue.table_name}.done_ratio",
          :joins => "left join #{Change.table_name} on change_id = #{Change.table_name}.id  left join #{Changeset.table_name} on #{Change.table_name}.changeset_id = #{Changeset.table_name}.id " +
      "left join #{Issue.table_name} on issue_id = #{Issue.table_name}.id " +
      "left join #{IssueStatus.table_name} on #{Issue.table_name}.status_id = #{IssueStatus.table_name}.id",
          :conditions => ["#{Changeset.table_name}.id = ? AND #{IssueStatus.table_name}.is_closed = ?", id, false]).to_f) / assignment_count
    end
  end

  #
  # changeset作成時にレビューの自動アサインを行う
  #
  def scan_comment_for_issue_ids_with_code_review
    ret = scan_comment_for_issue_ids_without_code_review
    project = repository.project if repository
    return ret unless project
    return ret unless project.module_enabled?('code_review')
    setting = CodeReviewProjectSetting.find_or_create(project)
    auto_assign = setting.auto_assign_settings
    return ret unless auto_assign.enabled?
    return unless auto_assign.match_with_changeset?(self)
    CodeReviewAssignment.create_with_changeset(self)
    ret
  end
end


text:
package com.ofg.infrastructure.metrics.config;

public enum GraphiteFormat {
    UDP, TCP, PICKLE
}


text:
'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
  Schema = mongoose.Schema;

/**
 * Artist Schema
 */
var ArtistSchema = new Schema({
  created : {
    type    : Date,
    default : Date.now
  },
  name    : {
    type    : String,
    default : '',
    trim    : true
  }
});

mongoose.model('Artist', ArtistSchema);