text:
package com.amazonaws.services.glacier.model;

import java.io.Serializable;

import com.amazonaws.AmazonWebServiceRequest;

/**
 * Container for the parameters to the {@link com.amazonaws.services.glacier.AmazonGlacier#getVaultNotifications(GetVaultNotificationsRequest) GetVaultNotifications operation}.
 *

 * This operation retrieves the notification-configuration
 * subresource of the specified vault.
 *

 *

 * For information about setting a notification configuration on a vault,
 * see SetVaultNotifications. If a notification configuration for a vault
 * is not set, the operation returns a 404 Not Found error.
 * For more information about vault notifications, see
 *  Configuring Vault Notifications in Amazon Glacier
 * .
 *

 *

 * An AWS account has full permission to perform all operations
 * (actions). However, AWS Identity and Access Management (IAM) users
 * don't have any permissions by default. You must grant them explicit
 * permission to perform specific actions. For more information, see
 *  Access Control Using AWS Identity and Access Management (IAM)
 * .
 *

 *

 * For conceptual information and underlying REST API, go to
 *  Configuring Vault Notifications in Amazon Glacier  and  Get Vault Notification Configuration
 * in the Amazon Glacier Developer Guide .
 *
 *

 *
 * @see com.amazonaws.services.glacier.AmazonGlacier#getVaultNotifications(GetVaultNotificationsRequest)
 */
public class GetVaultNotificationsRequest extends AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     * The AccountId value is the AWS account ID of the account
     * that owns the vault. You can either specify an AWS account ID or
     * optionally a single '-' (hyphen), in which case Amazon
     * Glacier uses the AWS account ID associated with the credentials used
     * to sign the request. If you use an account ID, do not include any
     * hyphens ('-') in the ID.
     */
    private String accountId;

    /**
     * The name of the vault.
     */
    private String vaultName;

    /**
     * Default constructor for a new GetVaultNotificationsRequest object.  Callers should use the
     * setter or fluent setter (with...) methods to initialize this object after creating it.
     */
    public GetVaultNotificationsRequest() {}

    /**
     * Constructs a new GetVaultNotificationsRequest object.
     * Callers should use the setter or fluent setter (with...) methods to
     * initialize any additional object members.
     *
     * @param vaultName The name of the vault.
     */
    public GetVaultNotificationsRequest(String vaultName) {
        setVaultName(vaultName);
    }

    /**
     * Constructs a new GetVaultNotificationsRequest object.
     * Callers should use the setter or fluent setter (with...) methods to
     * initialize any additional object members.
     *
     * @param accountId The AccountId value is the AWS account
     * ID of the account that owns the vault. You can either specify an AWS
     * account ID or optionally a single '-' (hyphen), in which
     * case Amazon Glacier uses the AWS account ID associated with the
     * credentials used to sign the request. If you use an account ID, do not
     * include any hyphens ('-') in the ID.
     * @param vaultName The name of the vault.
     */
    public GetVaultNotificationsRequest(String accountId, String vaultName) {
        setAccountId(accountId);
        setVaultName(vaultName);
    }

    /**
     * The AccountId value is the AWS account ID of the account
     * that owns the vault. You can either specify an AWS account ID or
     * optionally a single '-' (hyphen), in which case Amazon
     * Glacier uses the AWS account ID associated with the credentials used
     * to sign the request. If you use an account ID, do not include any
     * hyphens ('-') in the ID.
     *
     * @return The AccountId value is the AWS account ID of the account
     *         that owns the vault. You can either specify an AWS account ID or
     *         optionally a single '-' (hyphen), in which case Amazon
     *         Glacier uses the AWS account ID associated with the credentials used
     *         to sign the request. If you use an account ID, do not include any
     *         hyphens ('-') in the ID.
     */
    public String getAccountId() {
        return accountId;
    }

    /**
     * The AccountId value is the AWS account ID of the account
     * that owns the vault. You can either specify an AWS account ID or
     * optionally a single '-' (hyphen), in which case Amazon
     * Glacier uses the AWS account ID associated with the credentials used
     * to sign the request. If you use an account ID, do not include any
     * hyphens ('-') in the ID.
     *
     * @param accountId The AccountId value is the AWS account ID of the account
     *         that owns the vault. You can either specify an AWS account ID or
     *         optionally a single '-' (hyphen), in which case Amazon
     *         Glacier uses the AWS account ID associated with the credentials used
     *         to sign the request. If you use an account ID, do not include any
     *         hyphens ('-') in the ID.
     */
    public void setAccountId(String accountId) {
        this.accountId = accountId;
    }

    /**
     * The AccountId value is the AWS account ID of the account
     * that owns the vault. You can either specify an AWS account ID or
     * optionally a single '-' (hyphen), in which case Amazon
     * Glacier uses the AWS account ID associated with the credentials used
     * to sign the request. If you use an account ID, do not include any
     * hyphens ('-') in the ID.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param accountId The AccountId value is the AWS account ID of the account
     *         that owns the vault. You can either specify an AWS account ID or
     *         optionally a single '-' (hyphen), in which case Amazon
     *         Glacier uses the AWS account ID associated with the credentials used
     *         to sign the request. If you use an account ID, do not include any
     *         hyphens ('-') in the ID.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public GetVaultNotificationsRequest withAccountId(String accountId) {
        this.accountId = accountId;
        return this;
    }

    /**
     * The name of the vault.
     *
     * @return The name of the vault.
     */
    public String getVaultName() {
        return vaultName;
    }

    /**
     * The name of the vault.
     *
     * @param vaultName The name of the vault.
     */
    public void setVaultName(String vaultName) {
        this.vaultName = vaultName;
    }

    /**
     * The name of the vault.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param vaultName The name of the vault.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public GetVaultNotificationsRequest withVaultName(String vaultName) {
        this.vaultName = vaultName;
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getAccountId() != null) sb.append("AccountId: " + getAccountId() + ",");
        if (getVaultName() != null) sb.append("VaultName: " + getVaultName() );
        sb.append("}");
        return sb.toString();
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getAccountId() == null) ? 0 : getAccountId().hashCode());
        hashCode = prime * hashCode + ((getVaultName() == null) ? 0 : getVaultName().hashCode());
        return hashCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;

        if (obj instanceof GetVaultNotificationsRequest == false) return false;
        GetVaultNotificationsRequest other = (GetVaultNotificationsRequest)obj;

        if (other.getAccountId() == null ^ this.getAccountId() == null) return false;
        if (other.getAccountId() != null && other.getAccountId().equals(this.getAccountId()) == false) return false;
        if (other.getVaultName() == null ^ this.getVaultName() == null) return false;
        if (other.getVaultName() != null && other.getVaultName().equals(this.getVaultName()) == false) return false;
        return true;
    }

    @Override
    public GetVaultNotificationsRequest clone() {

            return (GetVaultNotificationsRequest) super.clone();
    }

}


text:
package me.circleapp.api.objects;

import android.util.Log;

import com.parse.ParseObject;
import com.parse.ParseUser;

import java.io.Serializable;

/**
 * Created by henocdz on 17/11/14.
 */
public class Review implements Serializable {
    private String title;
    private String description;
    private float stars;
    private String image;
    private String facebookId;
    private String userName;

    public Review(float stars, String title, String description) {
        this.title = title;
        this.description = description;
        this.stars = stars;
        this.facebookId = "";
        this.image = null;
    }

    public Review(ParseObject review){
        this.title = review.getString("title");
        this.description = review.getString("description");
        this.stars = (float) review.getDouble("stars");
        ParseUser user = review.getParseUser("user");
        if(user != null){
            this.facebookId = user.getString("facebookId");
            this.userName = user.getString("username");
        }else{
            this.facebookId = "2345667654321";
            this.userName = "Undefined";
        }
    }

    public String getUserName(){ return userName; }

    public String getFacebookId(){ return facebookId; }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public float getStars() {
        return stars;
    }

    public void setStars(int stars) {
        this.stars = stars;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package javax.sql;

import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.NClob;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLXML;
import java.sql.Ref;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Map;

public  interface   RowSet  extends java.sql.ResultSet
{
    public  void 	addRowSetListener(RowSetListener listener);
    public  void 	clearParameters() throws SQLException;
    public  void 	execute() throws SQLException;
    public  String 	getCommand();
    public  String 	getDataSourceName();
    public  boolean 	getEscapeProcessing() throws SQLException;
    public  int 	getMaxFieldSize() throws SQLException;
    public  int 	getMaxRows() throws SQLException;
    public  String 	getPassword();
    public  int 	getQueryTimeout() throws SQLException;
    public  int 	getTransactionIsolation();
    public  Map<String,Class<?>> 	getTypeMap() throws SQLException;
    public  String 	getUrl() throws SQLException;
    public  String 	getUsername();
    public  boolean 	isReadOnly();
    public  void 	removeRowSetListener(RowSetListener listener);
    public  void 	setArray(int i, Array x) throws SQLException;
    public  void 	setAsciiStream(int parameterIndex, InputStream x) throws SQLException;
    public  void 	setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException;
    public  void 	setAsciiStream(String parameterName, InputStream x) throws SQLException;
    public  void 	setAsciiStream(String parameterName, InputStream x, int length) throws SQLException;
    public  void 	setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException;
    public  void 	setBigDecimal(String parameterName, BigDecimal x) throws SQLException;
    public  void 	setBinaryStream(int parameterIndex, InputStream x) throws SQLException;
    public  void 	setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException;
    public  void 	setBinaryStream(String parameterName, InputStream x) throws SQLException;
    public  void 	setBinaryStream(String parameterName, InputStream x, int length) throws SQLException;
    public  void 	setBlob(int i, Blob x) throws SQLException;
    public  void 	setBlob(int parameterIndex, InputStream inputStream) throws SQLException;
    public  void 	setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException;
    public  void 	setBlob(String parameterName, Blob x) throws SQLException;
    public  void 	setBlob(String parameterName, InputStream inputStream) throws SQLException;
    public  void 	setBlob(String parameterName, InputStream inputStream, long length) throws SQLException;
    public  void 	setBoolean(int parameterIndex, boolean x) throws SQLException;
    public  void 	setBoolean(String parameterName, boolean x) throws SQLException;
    public  void 	setByte(int parameterIndex, byte x) throws SQLException;
    public  void 	setByte(String parameterName, byte x) throws SQLException;
    public  void 	setBytes(int parameterIndex, byte[] x) throws SQLException;
    public  void 	setBytes(String parameterName, byte[] x) throws SQLException;
    public  void 	setCharacterStream(int parameterIndex, Reader reader) throws SQLException;
    public  void 	setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException;
    public  void 	setCharacterStream(String parameterName, Reader reader) throws SQLException;
    public  void 	setCharacterStream(String parameterName, Reader reader, int length) throws SQLException;
    public  void 	setClob(int i, Clob x) throws SQLException;
    public  void 	setClob(int parameterIndex, Reader reader) throws SQLException;
    public  void 	setClob(int parameterIndex, Reader reader, long length) throws SQLException;
    public  void 	setClob(String parameterName, Clob x) throws SQLException;
    public  void 	setClob(String parameterName, Reader reader) throws SQLException;
    public  void 	setClob(String parameterName, Reader reader, long length) throws SQLException;
    public  void 	setCommand(String cmd) throws SQLException;
    public  void 	setConcurrency(int concurrency) throws SQLException;
    public  void 	setDataSourceName(String name) throws SQLException;
    public  void 	setDate(int parameterIndex, Date x) throws SQLException;
    public  void 	setDate(int parameterIndex, Date x, Calendar cal) throws SQLException;
    public  void 	setDate(String parameterName, Date x) throws SQLException;
    public  void 	setDate(String parameterName, Date x, Calendar cal) throws SQLException;
    public  void 	setDouble(int parameterIndex, double x) throws SQLException;
    public  void 	setDouble(String parameterName, double x) throws SQLException;
    public  void 	setEscapeProcessing(boolean enable) throws SQLException;
    public  void 	setFloat(int parameterIndex, float x) throws SQLException;
    public  void 	setFloat(String parameterName, float x) throws SQLException;
    public  void 	setInt(int parameterIndex, int x) throws SQLException;
    public  void 	setInt(String parameterName, int x) throws SQLException;
    public  void 	setLong(int parameterIndex, long x) throws SQLException;
    public  void 	setLong(String parameterName, long x) throws SQLException;
    public  void 	setMaxFieldSize(int max) throws SQLException;
    public  void 	setMaxRows(int max) throws SQLException;
    public  void 	setNCharacterStream(int parameterIndex, Reader value) throws SQLException;
    public  void 	setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException;
    public  void 	setNCharacterStream(String parameterName, Reader value) throws SQLException;
    public  void 	setNCharacterStream(String parameterName, Reader value, long length) throws SQLException;
    public  void 	setNClob(int parameterIndex, NClob value) throws SQLException;
    public  void 	setNClob(int parameterIndex, Reader reader) throws SQLException;
    public  void 	setNClob(int parameterIndex, Reader reader, long length) throws SQLException;
    public  void 	setNClob(String parameterName, NClob value) throws SQLException;
    public  void 	setNClob(String parameterName, Reader reader) throws SQLException;
    public  void 	setNClob(String parameterName, Reader reader, long length) throws SQLException;
    public  void 	setNString(int parameterIndex, String value) throws SQLException;
    public  void 	setNString(String parameterName, String value) throws SQLException;
    public  void 	setNull(int parameterIndex, int sqlType) throws SQLException;
    public  void 	setNull(int paramIndex, int sqlType, String typeName) throws SQLException;
    public  void 	setNull(String parameterName, int sqlType) throws SQLException;
    public  void 	setNull(String parameterName, int sqlType, String typeName) throws SQLException;
    public  void 	setObject(int parameterIndex, Object x) throws SQLException;
    public  void 	setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException;
    public  void 	setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException;
    public  void 	setObject(String parameterName, Object x) throws SQLException;
    public  void 	setObject(String parameterName, Object x, int targetSqlType) throws SQLException;
    public  void 	setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException;
    public  void 	setPassword(String password) throws SQLException;
    public  void 	setQueryTimeout(int seconds) throws SQLException;
    public  void 	setReadOnly(boolean value) throws SQLException;
    public  void 	setRef(int i, Ref x) throws SQLException;
    public  void 	setRowId(int parameterIndex, RowId x) throws SQLException;
    public  void 	setRowId(String parameterName, RowId x) throws SQLException;
    public  void 	setShort(int parameterIndex, short x) throws SQLException;
    public  void 	setShort(String parameterName, short x) throws SQLException;
    public  void 	setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException;
    public  void 	setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException;
    public  void 	setString(int parameterIndex, String x) throws SQLException;
    public  void 	setString(String parameterName, String x) throws SQLException;
    public  void 	setTime(int parameterIndex, Time x) throws SQLException;
    public  void 	setTime(int parameterIndex, Time x, Calendar cal) throws SQLException;
    public  void 	setTime(String parameterName, Time x) throws SQLException;
    public  void 	setTime(String parameterName, Time x, Calendar cal) throws SQLException;
    public  void 	setTimestamp(int parameterIndex, Timestamp x) throws SQLException;
    public  void 	setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException;
    public  void 	setTimestamp(String parameterName, Timestamp x) throws SQLException;
    public  void 	setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException;
    public  void 	setTransactionIsolation(int level) throws SQLException;
    public  void 	setType(int type) throws SQLException;
    public  void 	setTypeMap(Map<String,Class<?>> map) throws SQLException;
    public  void 	setURL(int parameterIndex, URL x) throws SQLException;
    public  void 	setUrl(String url) throws SQLException;
    public  void 	setUsername(String name) throws SQLException;
}


text:
package com.arrival.selenium;

/**
 * @author: Aaron Kutekidila
 * @version: 1.0
 * @Created: 09.05.2015
 * @since: 1.0
 * @Package: com.arrival.selenium
 */

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class SeleniumSingleton {
    public static final String TESTNG = "TESTNG";
    public static final String ARRIVAL = "ARRIVAL";
    public static String framework;

    private static final Logger log = LogManager.getLogger(SeleniumSingleton.class);
    private static SeleniumSingleton ourInstance = new SeleniumSingleton();
    private static SeleniumManager seleniumManager = new SeleniumManager();

    private SeleniumSingleton() {
        framework = TESTNG;
        log.info(SeleniumSingleton.class + " set up!!");
    }

    public static SeleniumSingleton getInstance() {

        return ourInstance;
    }

    public static SeleniumManager getSeleniumManager() {
        return seleniumManager;
    }

    public static void setSeleniumManager(SeleniumManager seleniumManager) {
        SeleniumSingleton.seleniumManager = seleniumManager;
    }

    public static String getFramework() {
        return framework;
    }

    public static void setFramework(String framework) {
        SeleniumSingleton.framework = framework;
    }

    public boolean isArrival(){
        return    framework.equals(ARRIVAL);
    }
}


text:
require 'rubygems'
gem 'ruby-prof', '>= 0.6.1'
require 'ruby-prof'

require 'fileutils'
require 'rails/version'

module ActiveSupport
  module Testing
    module Performance
      DEFAULTS =
        if benchmark = ARGV.include?('--benchmark')  # HAX for rake test
          { :benchmark => true,
            :runs => 4,
            :metrics => [:wall_time, :memory, :objects, :gc_runs, :gc_time],
            :output => 'tmp/performance' }
        else
          { :benchmark => false,
            :runs => 1,
            :min_percent => 0.01,
            :metrics => [:process_time, :memory, :objects],
            :formats => [:flat, :graph_html, :call_tree],
            :output => 'tmp/performance' }
        end.freeze

      def self.included(base)
        base.superclass_delegating_accessor :profile_options
        base.profile_options = DEFAULTS
      end

      def full_test_name
        "#{self.class.name}##{method_name}"
      end

      def run(result)
        return if method_name =~ /^default_test$/

        yield(self.class::STARTED, name)
        @_result = result

        run_warmup
        if profile_options && metrics = profile_options[:metrics]
          metrics.each do |metric_name|
            if klass = Metrics[metric_name.to_sym]
              run_profile(klass.new)
              result.add_run
            end
          end
        end

        yield(self.class::FINISHED, name)
      end

      def run_test(metric, mode)
        run_callbacks :setup
        setup
        metric.send(mode) { __send__ @method_name }
      rescue ::Test::Unit::AssertionFailedError => e
        add_failure(e.message, e.backtrace)
      rescue StandardError, ScriptError
        add_error($!)
      ensure
        begin
          teardown
          run_callbacks :teardown, :enumerator => :reverse_each
        rescue ::Test::Unit::AssertionFailedError => e
          add_failure(e.message, e.backtrace)
        rescue StandardError, ScriptError
          add_error($!)
        end
      end

      protected
        def run_warmup
          GC.start

          time = Metrics::Time.new
          run_test(time, :benchmark)
          puts "%s (%s warmup)" % [full_test_name, time.format(time.total)]

          GC.start
        end

        def run_profile(metric)
          klass = profile_options[:benchmark] ? Benchmarker : Profiler
          performer = klass.new(self, metric)

          performer.run
          puts performer.report
          performer.record
        end

      class Performer
        delegate :run_test, :profile_options, :full_test_name, :to => :@harness

        def initialize(harness, metric)
          @harness, @metric = harness, metric
        end

        def report
          rate = @total / profile_options[:runs]
          '%20s: %s' % [@metric.name, @metric.format(rate)]
        end

        protected
          def output_filename
            "#{profile_options[:output]}/#{full_test_name}_#{@metric.name}"
          end
      end

      class Benchmarker < Performer
        def run
          profile_options[:runs].to_i.times { run_test(@metric, :benchmark) }
          @total = @metric.total
        end

        def record
          avg = @metric.total / profile_options[:runs].to_i
          now = Time.now.utc.xmlschema
          with_output_file do |file|
            file.puts "#{avg},#{now},#{environment}"
          end
        end

        def environment
          unless defined? @env
            app = "#{$1}.#{$2}" if File.directory?('.git') && `git branch -v` =~ /^\* (\S+)\s+(\S+)/

            rails = Rails::VERSION::STRING
            if File.directory?('vendor/rails/.git')
              Dir.chdir('vendor/rails') do
                rails += ".#{$1}.#{$2}" if `git branch -v` =~ /^\* (\S+)\s+(\S+)/
              end
            end

            ruby = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
            ruby += "-#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"

            @env = [app, rails, ruby, RUBY_PLATFORM] * ','
          end

          @env
        end

        protected
          HEADER = 'measurement,created_at,app,rails,ruby,platform'

          def with_output_file
            fname = output_filename

            if new = !File.exist?(fname)
              FileUtils.mkdir_p(File.dirname(fname))
            end

            File.open(fname, 'ab') do |file|
              file.puts(HEADER) if new
              yield file
            end
          end

          def output_filename
            "#{super}.csv"
          end
      end

      class Profiler < Performer
        def initialize(*args)
          super
          @supported = @metric.measure_mode rescue false
        end

        def run
          return unless @supported

          RubyProf.measure_mode = @metric.measure_mode
          RubyProf.start
          RubyProf.pause
          profile_options[:runs].to_i.times { run_test(@metric, :profile) }
          @data = RubyProf.stop
          @total = @data.threads.values.sum(0) { |method_infos| method_infos.sort.last.total_time }
        end

        def report
          if @supported
            super
          else
            '%20s: unsupported' % @metric.name
          end
        end

        def record
          return unless @supported

          klasses = profile_options[:formats].map { |f| RubyProf.const_get("#{f.to_s.camelize}Printer") }.compact

          klasses.each do |klass|
            fname = output_filename(klass)
            FileUtils.mkdir_p(File.dirname(fname))
            File.open(fname, 'wb') do |file|
              klass.new(@data).print(file, profile_options.slice(:min_percent))
            end
          end
        end

        protected
          def output_filename(printer_class)
            suffix =
              case printer_class.name.demodulize
                when 'FlatPrinter'; 'flat.txt'
                when 'GraphPrinter'; 'graph.txt'
                when 'GraphHtmlPrinter'; 'graph.html'
                when 'CallTreePrinter'; 'tree.txt'
                else printer_class.name.sub(/Printer$/, '').underscore
              end

            "#{super()}_#{suffix}"
          end
      end

      module Metrics
        def self.[](name)
          const_get(name.to_s.camelize)
        rescue NameError
          nil
        end

        class Base
          attr_reader :total

          def initialize
            @total = 0
          end

          def name
            @name ||= self.class.name.demodulize.underscore
          end

          def measure_mode
            self.class::Mode
          end

          def measure
            0
          end

          def benchmark
            with_gc_stats do
              before = measure
              yield
              @total += (measure - before)
            end
          end

          def profile
            RubyProf.resume
            yield
          ensure
            RubyProf.pause
          end

          protected
            if GC.respond_to?(:enable_stats)
              def with_gc_stats
                GC.enable_stats
                yield
              ensure
                GC.disable_stats
              end
            elsif defined?(GC::Profiler)
              def with_gc_stats
                GC.start
                GC.disable
                GC::Profiler.enable
                yield
              ensure
                GC::Profiler.disable
                GC.enable
              end
            else
              def with_gc_stats
                yield
              end
            end
        end

        class Time < Base
          def measure
            ::Time.now.to_f
          end

          def format(measurement)
            if measurement < 2
              '%d ms' % (measurement * 1000)
            else
              '%.2f sec' % measurement
            end
          end
        end

        class ProcessTime < Time
          Mode = RubyProf::PROCESS_TIME

          def measure
            RubyProf.measure_process_time
          end
        end

        class WallTime < Time
          Mode = RubyProf::WALL_TIME

          def measure
            RubyProf.measure_wall_time
          end
        end

        class CpuTime < Time
          Mode = RubyProf::CPU_TIME if RubyProf.const_defined?(:CPU_TIME)

          def initialize(*args)
            # FIXME: yeah my CPU is 2.33 GHz
            RubyProf.cpu_frequency = 2.33e9
            super
          end

          def measure
            RubyProf.measure_cpu_time
          end
        end

        class Memory < Base
          Mode = RubyProf::MEMORY if RubyProf.const_defined?(:MEMORY)

          # ruby-prof wrapper
          if RubyProf.respond_to?(:measure_memory)
            def measure
              RubyProf.measure_memory / 1024.0
            end

          # Ruby 1.8 + railsbench patch
          elsif GC.respond_to?(:allocated_size)
            def measure
              GC.allocated_size / 1024.0
            end

          # Ruby 1.8 + lloyd patch
          elsif GC.respond_to?(:heap_info)
            def measure
              GC.heap_info['heap_current_memory'] / 1024.0
            end

          # Ruby 1.9 with total_malloc_allocated_size patch
          elsif GC.respond_to?(:malloc_total_allocated_size)
            def measure
              GC.total_malloc_allocated_size / 1024.0
            end

          # Ruby 1.9 unpatched
          elsif GC.respond_to?(:malloc_allocated_size)
            def measure
              GC.malloc_allocated_size / 1024.0
            end

          # Ruby 1.9 + GC profiler patch
          elsif defined?(GC::Profiler)
            def measure
              GC.enable
              GC.start
              kb = GC::Profiler.data.last[:HEAP_USE_SIZE] / 1024.0
              GC.disable
              kb
            end
          end

          def format(measurement)
            '%.2f KB' % measurement
          end
        end

        class Objects < Base
          Mode = RubyProf::ALLOCATIONS if RubyProf.const_defined?(:ALLOCATIONS)

          if RubyProf.respond_to?(:measure_allocations)
            def measure
              RubyProf.measure_allocations
            end

          # Ruby 1.8 + railsbench patch
          elsif ObjectSpace.respond_to?(:allocated_objects)
            def measure
              ObjectSpace.allocated_objects
            end

          # Ruby 1.9 + GC profiler patch
          elsif defined?(GC::Profiler)
            def measure
              GC.enable
              GC.start
              last = GC::Profiler.data.last
              count = last[:HEAP_LIVE_OBJECTS] + last[:HEAP_FREE_OBJECTS]
              GC.disable
              count
            end
          end

          def format(measurement)
            measurement.to_i.to_s
          end
        end

        class GcRuns < Base
          Mode = RubyProf::GC_RUNS if RubyProf.const_defined?(:GC_RUNS)

          if RubyProf.respond_to?(:measure_gc_runs)
            def measure
              RubyProf.measure_gc_runs
            end
          elsif GC.respond_to?(:collections)
            def measure
              GC.collections
            end
          elsif GC.respond_to?(:heap_info)
            def measure
              GC.heap_info['num_gc_passes']
            end
          end

          def format(measurement)
            measurement.to_i.to_s
          end
        end

        class GcTime < Base
          Mode = RubyProf::GC_TIME if RubyProf.const_defined?(:GC_TIME)

          if RubyProf.respond_to?(:measure_gc_time)
            def measure
              RubyProf.measure_gc_time
            end
          elsif GC.respond_to?(:time)
            def measure
              GC.time
            end
          end

          def format(measurement)
            '%d ms' % (measurement / 1000)
          end
        end
      end
    end
  end
end


text:
namespace QuantConnect.Indicators
{
    /// <summary>
    /// This indicator computes the Absolute Price Oscillator (APO)
    /// The Absolute Price Oscillator is calculated using the following formula:
    /// APO[i] = FastMA[i] - SlowMA[i]
    /// </summary>
    /// <remarks>
    /// The Absolute Price Oscillator is the same as a MACD with the signal period equal to the slow period.
    /// </remarks>
    public class AbsolutePriceOscillator : MovingAverageConvergenceDivergence
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AbsolutePriceOscillator"/> class using the specified name and parameters.
        /// </summary>
        /// <param name="name">The name of this indicator</param>
        /// <param name="fastPeriod">The fast moving average period</param>
        /// <param name="slowPeriod">The slow moving average period</param>
        /// <param name="movingAverageType">The type of moving average to use</param>
        public AbsolutePriceOscillator(string name, int fastPeriod, int slowPeriod, MovingAverageType movingAverageType = MovingAverageType.Simple)
            : base(name, fastPeriod, slowPeriod, slowPeriod, movingAverageType)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="AbsolutePriceOscillator"/> class using the specified parameters.
        /// </summary>
        /// <param name="fastPeriod">The fast moving average period</param>
        /// <param name="slowPeriod">The slow moving average period</param>
        /// <param name="movingAverageType">The type of moving average to use</param>
        public AbsolutePriceOscillator(int fastPeriod, int slowPeriod, MovingAverageType movingAverageType = MovingAverageType.Simple)
            : this($"APO({fastPeriod},{slowPeriod})", fastPeriod, slowPeriod, movingAverageType)
        {
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
        <rules>
            <inputs>
                <!-- Files are assumed be in the basedir job/results Example below-->
                <!-- <file>overview.json</file> -->
                <file>amplicon_analysis_consensus_report.json</file>
            </inputs>
            <attributesRules />
            <tablesRules />
            <plotGroupsRules />
        </rules>


text:
/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 *    AbstractClassifier.java
 *    Copyright (C) 1999-2012 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.classifiers;

import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;

import weka.core.Attribute;
import weka.core.Capabilities;
import weka.core.CapabilitiesHandler;
import weka.core.Instance;
import weka.core.Option;
import weka.core.OptionHandler;
import weka.core.RevisionHandler;
import weka.core.RevisionUtils;
import weka.core.SerializedObject;
import weka.core.Utils;

/**
 * Abstract classifier. All schemes for numeric or nominal prediction in
 * Weka extend this class. Note that a classifier MUST either implement
 * distributionForInstance() or classifyInstance().
 *
 * @author Eibe Frank (eibe@cs.waikato.ac.nz)
 * @author Len Trigg (trigg@cs.waikato.ac.nz)
 * @version $Revision: 8034 $
 */
public abstract class AbstractClassifier
  implements Classifier, Cloneable, Serializable, OptionHandler,
             CapabilitiesHandler, RevisionHandler {

  /** for serialization */
  private static final long serialVersionUID = 6502780192411755341L;

  /** Whether the classifier is run in debug mode. */
  protected boolean m_Debug = false;

  /**
   * Classifies the given test instance. The instance has to belong to a
   * dataset when it's being classified. Note that a classifier MUST
   * implement either this or distributionForInstance().
   *
   * @param instance the instance to be classified
   * @return the predicted most likely class for the instance or
   * Utils.missingValue() if no prediction is made
   * @exception Exception if an error occurred during the prediction
   */
  public double classifyInstance(Instance instance) throws Exception {

    double [] dist = distributionForInstance(instance);
    if (dist == null) {
      throw new Exception("Null distribution predicted");
    }
    switch (instance.classAttribute().type()) {
    case Attribute.NOMINAL:
      double max = 0;
      int maxIndex = 0;

      for (int i = 0; i < dist.length; i++) {
        if (dist[i] > max) {
          maxIndex = i;
          max = dist[i];
        }
      }
      if (max > 0) {
        return maxIndex;
      } else {
        return Utils.missingValue();
      }
    case Attribute.NUMERIC:
      return dist[0];
    default:
      return Utils.missingValue();
    }
  }

  /**
   * Predicts the class memberships for a given instance. If
   * an instance is unclassified, the returned array elements
   * must be all zero. If the class is numeric, the array
   * must consist of only one element, which contains the
   * predicted value. Note that a classifier MUST implement
   * either this or classifyInstance().
   *
   * @param instance the instance to be classified
   * @return an array containing the estimated membership
   * probabilities of the test instance in each class
   * or the numeric prediction
   * @exception Exception if distribution could not be
   * computed successfully
   */
  public double[] distributionForInstance(Instance instance) throws Exception {

    double[] dist = new double[instance.numClasses()];
    switch (instance.classAttribute().type()) {
      case Attribute.NOMINAL:
        double classification = classifyInstance(instance);
        if (Utils.isMissingValue(classification)) {
          return dist;
        } else {
          dist[(int)classification] = 1.0;
        }
        return dist;
      case Attribute.NUMERIC:
        dist[0] = classifyInstance(instance);
        return dist;
      default:
        return dist;
    }
  }

  /**
   * Creates a new instance of a classifier given it's class name and
   * (optional) arguments to pass to it's setOptions method. If the
   * classifier implements OptionHandler and the options parameter is
   * non-null, the classifier will have it's options set.
   *
   * @param classifierName the fully qualified class name of the classifier
   * @param options an array of options suitable for passing to setOptions. May
   * be null.
   * @return the newly created classifier, ready for use.
   * @exception Exception if the classifier name is invalid, or the options
   * supplied are not acceptable to the classifier
   */
  public static Classifier forName(String classifierName,
      String [] options) throws Exception {

    return ((AbstractClassifier)Utils.forName(Classifier.class,
                                              classifierName,
                                              options));
  }

  /**
   * Creates a deep copy of the given classifier using serialization.
   *
   * @param model the classifier to copy
   * @return a deep copy of the classifier
   * @exception Exception if an error occurs
   */
  public static Classifier makeCopy(Classifier model) throws Exception {

    return (Classifier)new SerializedObject(model).getObject();
  }

  /**
   * Creates a given number of deep copies of the given classifier using serialization.
   *
   * @param model the classifier to copy
   * @param num the number of classifier copies to create.
   * @return an array of classifiers.
   * @exception Exception if an error occurs
   */
  public static Classifier [] makeCopies(Classifier model, int num) throws Exception {

    if (model == null) {
      throw new Exception("No model classifier set");
    }
    Classifier [] classifiers = new Classifier [num];
    SerializedObject so = new SerializedObject(model);
    for(int i = 0; i < classifiers.length; i++) {
      classifiers[i] = (Classifier) so.getObject();
    }
    return classifiers;
  }

  /**
   * Returns an enumeration describing the available options.
   *
   * @return an enumeration of all the available options.
   */
  public Enumeration listOptions() {

    Vector newVector = new Vector(1);

    newVector.addElement(new Option(
          "\tIf set, classifier is run in debug mode and\n"
          + "\tmay output additional info to the console",
          "D", 0, "-D"));
    return newVector.elements();
  }

  /**
   * Parses a given list of options. Valid options are:

   *
   * -D

   * If set, classifier is run in debug mode and
   * may output additional info to the console.

   *
   * @param options the list of options as an array of strings
   * @exception Exception if an option is not supported
   */
  public void setOptions(String[] options) throws Exception {

    setDebug(Utils.getFlag('D', options));
  }

  /**
   * Gets the current settings of the Classifier.
   *
   * @return an array of strings suitable for passing to setOptions
   */
  public String [] getOptions() {

    String [] options;
    if (getDebug()) {
      options = new String[1];
      options[0] = "-D";
    } else {
      options = new String[0];
    }
    return options;
  }

  /**
   * Set debugging mode.
   *
   * @param debug true if debug output should be printed
   */
  public void setDebug(boolean debug) {

    m_Debug = debug;
  }

  /**
   * Get whether debugging is turned on.
   *
   * @return true if debugging output is on
   */
  public boolean getDebug() {

    return m_Debug;
  }

  /**
   * Returns the tip text for this property
   * @return tip text for this property suitable for
   * displaying in the explorer/experimenter gui
   */
  public String debugTipText() {
    return "If set to true, classifier may output additional info to " +
      "the console.";
  }

  /**
   * Returns the Capabilities of this classifier. Maximally permissive
   * capabilities are allowed by default. Derived classifiers should
   * override this method and first disable all capabilities and then
   * enable just those capabilities that make sense for the scheme.
   *
   * @return            the capabilities of this object
   * @see               Capabilities
   */
  public Capabilities getCapabilities() {
    Capabilities result = new Capabilities(this);
    result.enableAll();

    return result;
  }

  /**
   * Returns the revision string.
   *
   * @return            the revision
   */
  public String getRevision() {
    return RevisionUtils.extract("$Revision: 8034 $");
  }

  /**
   * runs the classifier instance with the given options.
   *
   * @param classifier		the classifier to run
   * @param options	the commandline options
   */
  public static void runClassifier(Classifier classifier, String[] options) {
    try {
      System.out.println(Evaluation.evaluateModel(classifier, options));
    }
    catch (Exception e) {
      if (    ((e.getMessage() != null) && (e.getMessage().indexOf("General options") == -1))
          || (e.getMessage() == null) )
        e.printStackTrace();
      else
        System.err.println(e.getMessage());
    }
  }
}


text:
<?php

namespace Media\PhotoBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * AlbumsRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class AlbumsRepository extends EntityRepository {

    public function ifViewers($user, $album) {
        return $this->getEntityManager()
                        ->createQuery(
                                'SELECT a
                        FROM MediaPhotoBundle:AlbumViewers a
                        WHERE a.user = ' . $user . ' AND a.album=' . $album . '
                        '
                        )
                        ->getResult();
    }

    public function ifActiveViewers($user, $album) {
        return $this->getEntityManager()
                        ->createQuery(
                                'SELECT a
                        FROM MediaPhotoBundle:AlbumViewers a
                        WHERE a.user = ' . $user . ' AND a.album=' . $album . '
                        AND a.isActive = 1'
                        )
                        ->getResult();
    }

    public function findViewers($id) {
        return $this->getEntityManager()
                        ->createQuery(
                                'SELECT c
                        FROM MediaPhotoBundle:Albums c
                        WHERE c.album = ' . $id . '
                        ORDER BY c.id ASC'
                        )
                        ->getResult();
    }

}


text:
namespace Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation
{
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;

    /// <summary>
    /// Runs tasks synchronously, on the current thread.
    /// From <a href="http://code.msdn.microsoft.com/Samples-for-Parallel-b4b76364/view/SourceCode"/>.
    /// </summary>
    internal sealed class CurrentThreadTaskScheduler : TaskScheduler
    {
        public static readonly TaskScheduler Instance = new CurrentThreadTaskScheduler();

        public override int MaximumConcurrencyLevel
        {
            get { return 1; }
        }

        protected override void QueueTask(Task task)
        {
            this.TryExecuteTask(task);
        }

        protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
        {
            return this.TryExecuteTask(task);
        }

        protected override IEnumerable<Task> GetScheduledTasks()
        {
            return Enumerable.Empty<Task>();
        }
    }
}


text:
package com.skogsrud.halvard.spring.security.custom.spike;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
    public static void main(String... args) {
        SpringApplication.run(Application.class, args);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/textView"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginBottom="32dp"
        android:layout_marginEnd="32dp"
        android:layout_marginStart="32dp"
        android:layout_marginTop="32dp"
        android:text="TextView"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>


text:
let chai = require("chai");
let expect = chai.expect;
let {shouldThrow, createTemplateRebuilder, createDeleteSync} = require('./util');
let assert = require('assert');
let path = require('path')
let {join} = path;

let mymixin = require("./../src/mixins/mixin");
let directoryable = require("./../src/mixins/directoryable");
let Promise = require('bluebird');

// const TEMPLATE_WITHCONFIG = join(__dirname, "./template-withconfig");
// const DEST_WITHCONFIG = join(__dirname, "./dest-withconfig");

// const TEMPLATE_NOCONFIG = join(__dirname, "./template-withoutconfig");
// const DEST_NOCONFIG = join(__dirname, "./dest-withoutconfig");

// let withConfigTemplate = createTemplateRebuilder(TEMPLATE_WITHCONFIG, DEST_WITHCONFIG);
// // let noConfigTemplate = createTemplateRebuilder(
// //     TEMPLATE_NOCONFIG, DEST_NOCONFIG);
// let deleteConfigTemplate = createDeleteSync(DEST_WITHCONFIG);
// // let deleteNoConfigTemplate = createDeleteSync(DEST_NOCONFIG);
// before(withConfigTemplate);
// // before(noConfigTemplate);
// after(deleteConfigTemplate);
// // after(deleteNoConfigTemplate);

describe("directoryable", function(){
  it("Should require function options", function(){
    let opts = {};
    let index;
    let requiredFunctions = ["directoryStat", "readDirectoryResolve", "getDirectoryName"
        , "loadDirectory", "loadFile", "loadParentDirectory"];
    requiredFunctions.forEach((required, i) => {
      index = i;
      shouldThrow(function(){
        mymixin(directoryable, {}, opts);
      }, function(err){
        expect(err.message).to.include(requiredFunctions[i]);
        expect(err.message).to.include('must be a function');
        opts[requiredFunctions[i]] = function(){}
      });
    });
  });

  describe("sample of using directoryable to create something tree-like", function(){
    let readDirectoryAndResolve = function(directoryString){
      let retVal = [];
      let arrDirectoryString = Array.from(directoryString);

      let aCount = 0;
      let aPush = [];
      function pushFirstTo(toPushTo){
        toPushTo.push(arrDirectoryString.shift());
      }
      if(arrDirectoryString[0] === 'a'){
        arrDirectoryString.shift();
      }
      while(arrDirectoryString.length){
        if(arrDirectoryString[0] === 'b' && aCount == 0){
          pushFirstTo(retVal);
        } else if(arrDirectoryString[0] === 'b' && aCount > 0){
          pushFirstTo(aPush);
        } else if(arrDirectoryString[0] === 'a'){
          aCount++;
          pushFirstTo(aPush);
        } else if(arrDirectoryString[0] == 'c'){
          aCount--;
          if(aCount == 0){
            arrDirectoryString.shift();
            retVal.push(aPush.join(''));
            aPush = []
          } else {
            pushFirstTo(aPush);
          }
        } else {
          console.log(aPush);
          console.log(retVal);
          console.log(aCount);
          throw new Error("test string must be abc's only");
        }
      }
      return retVal;
    }
    let loadParentDirectory = function(directory){
      return {type: 'node', directory};
    }
    let loadDirectory = function(filename, parentObject, directory, fromDirectory){
      return fromDirectory(filename);
    }
    let loadFile = function(filename, parentObject, directory){
      return {type: 'file', directory};
    }
    let directoryStat = function(directory){
      return directory[0] === 'a';
    }
    let getDirectoryName = function(name){
      return name;
    }
    it("readDirectoryAndResolve works expectedly", function(){
      let res = readDirectoryAndResolve('babcbbabbcaabbcbbbc');
      expect(res).to.deep.equal(['b', 'ab', 'b', 'b', 'abb', 'aabbcbbb']);
      res = readDirectoryAndResolve('aabbcbbb');
      expect(res).to.deep.equal(['abb', 'b', 'b', 'b']);
    });
    it("Should work as expected", function(){
      //convert this to tree.
      //   a means folder
      //   b means file
      //   c means end of the folder
      let toConvert = 'babcbbabbcaabbcbbbc';

    });
  });
});


text:
from abc import ABCMeta, abstractmethod

from fabric import api
from six import add_metaclass

__author__ = 'y.gavenchuk'
__all__ = ('Daemon', 'SimpleService', 'Nginx', 'Uwsgi', 'Supervisor', )

@add_metaclass(ABCMeta)
class Daemon(object):
    _name = None
    _api = api

    def __str__(self):
        return self.name

    @property
    def name(self):
        return str(self._name)

    @abstractmethod
    def restart(self):
        pass

class SimpleService(Daemon):
    def restart(self):
        self._api.sudo('service %s restart' % self.name)

class Nginx(SimpleService):
    _name = 'nginx'

class Uwsgi(SimpleService):
    _name = 'uwsgi'

class Supervisor(Daemon):
    _name = 'supervisor'
    _service = 'all'

    def __init__(self, service=None):
        super(Supervisor, self).__init__()
        if service:
            self._service = service

    def restart(self):
        self._api.sudo('supervisorctl reread')
        self._api.sudo(
            'supervisorctl restart %s' % self._service
        )


text:
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSStreamFwd.h>
#include <aws/core/utils/memory/stl/AWSString.h>

namespace Aws
{
namespace Utils
{
namespace Xml
{
  class XmlNode;
} // namespace Xml
} // namespace Utils
namespace EC2
{
namespace Model
{
  /*

Describes association information for an Elastic IP address.

  */
  class AWS_EC2_API NetworkInterfaceAssociation
  {
  public:
    NetworkInterfaceAssociation();
    NetworkInterfaceAssociation(const Aws::Utils::Xml::XmlNode& xmlNode);
    NetworkInterfaceAssociation& operator=(const Aws::Utils::Xml::XmlNode& xmlNode);

    void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const;
    void OutputToStream(Aws::OStream& oStream, const char* location) const;

    /*

The address of the Elastic IP address bound to the network interface.

    */
    inline const Aws::String& GetPublicIp() const{ return m_publicIp; }

    /*

The address of the Elastic IP address bound to the network interface.

    */
    inline void SetPublicIp(const Aws::String& value) { m_publicIpHasBeenSet = true; m_publicIp = value; }

    /*

The address of the Elastic IP address bound to the network interface.

    */
    inline void SetPublicIp(Aws::String&& value) { m_publicIpHasBeenSet = true; m_publicIp = value; }

    /*

The address of the Elastic IP address bound to the network interface.

    */
    inline void SetPublicIp(const char* value) { m_publicIpHasBeenSet = true; m_publicIp.assign(value); }

    /*

The address of the Elastic IP address bound to the network interface.

    */
    inline NetworkInterfaceAssociation& WithPublicIp(const Aws::String& value) { SetPublicIp(value); return *this;}

    /*

The address of the Elastic IP address bound to the network interface.

    */
    inline NetworkInterfaceAssociation& WithPublicIp(Aws::String&& value) { SetPublicIp(value); return *this;}

    /*

The address of the Elastic IP address bound to the network interface.

    */
    inline NetworkInterfaceAssociation& WithPublicIp(const char* value) { SetPublicIp(value); return *this;}

    /*

The public DNS name.

    */
    inline const Aws::String& GetPublicDnsName() const{ return m_publicDnsName; }

    /*

The public DNS name.

    */
    inline void SetPublicDnsName(const Aws::String& value) { m_publicDnsNameHasBeenSet = true; m_publicDnsName = value; }

    /*

The public DNS name.

    */
    inline void SetPublicDnsName(Aws::String&& value) { m_publicDnsNameHasBeenSet = true; m_publicDnsName = value; }

    /*

The public DNS name.

    */
    inline void SetPublicDnsName(const char* value) { m_publicDnsNameHasBeenSet = true; m_publicDnsName.assign(value); }

    /*

The public DNS name.

    */
    inline NetworkInterfaceAssociation& WithPublicDnsName(const Aws::String& value) { SetPublicDnsName(value); return *this;}

    /*

The public DNS name.

    */
    inline NetworkInterfaceAssociation& WithPublicDnsName(Aws::String&& value) { SetPublicDnsName(value); return *this;}

    /*

The public DNS name.

    */
    inline NetworkInterfaceAssociation& WithPublicDnsName(const char* value) { SetPublicDnsName(value); return *this;}

    /*

The ID of the Elastic IP address owner.

    */
    inline const Aws::String& GetIpOwnerId() const{ return m_ipOwnerId; }

    /*

The ID of the Elastic IP address owner.

    */
    inline void SetIpOwnerId(const Aws::String& value) { m_ipOwnerIdHasBeenSet = true; m_ipOwnerId = value; }

    /*

The ID of the Elastic IP address owner.

    */
    inline void SetIpOwnerId(Aws::String&& value) { m_ipOwnerIdHasBeenSet = true; m_ipOwnerId = value; }

    /*

The ID of the Elastic IP address owner.

    */
    inline void SetIpOwnerId(const char* value) { m_ipOwnerIdHasBeenSet = true; m_ipOwnerId.assign(value); }

    /*

The ID of the Elastic IP address owner.

    */
    inline NetworkInterfaceAssociation& WithIpOwnerId(const Aws::String& value) { SetIpOwnerId(value); return *this;}

    /*

The ID of the Elastic IP address owner.

    */
    inline NetworkInterfaceAssociation& WithIpOwnerId(Aws::String&& value) { SetIpOwnerId(value); return *this;}

    /*

The ID of the Elastic IP address owner.

    */
    inline NetworkInterfaceAssociation& WithIpOwnerId(const char* value) { SetIpOwnerId(value); return *this;}

    /*

The allocation ID.

    */
    inline const Aws::String& GetAllocationId() const{ return m_allocationId; }

    /*

The allocation ID.

    */
    inline void SetAllocationId(const Aws::String& value) { m_allocationIdHasBeenSet = true; m_allocationId = value; }

    /*

The allocation ID.

    */
    inline void SetAllocationId(Aws::String&& value) { m_allocationIdHasBeenSet = true; m_allocationId = value; }

    /*

The allocation ID.

    */
    inline void SetAllocationId(const char* value) { m_allocationIdHasBeenSet = true; m_allocationId.assign(value); }

    /*

The allocation ID.

    */
    inline NetworkInterfaceAssociation& WithAllocationId(const Aws::String& value) { SetAllocationId(value); return *this;}

    /*

The allocation ID.

    */
    inline NetworkInterfaceAssociation& WithAllocationId(Aws::String&& value) { SetAllocationId(value); return *this;}

    /*

The allocation ID.

    */
    inline NetworkInterfaceAssociation& WithAllocationId(const char* value) { SetAllocationId(value); return *this;}

    /*

The association ID.

    */
    inline const Aws::String& GetAssociationId() const{ return m_associationId; }

    /*

The association ID.

    */
    inline void SetAssociationId(const Aws::String& value) { m_associationIdHasBeenSet = true; m_associationId = value; }

    /*

The association ID.

    */
    inline void SetAssociationId(Aws::String&& value) { m_associationIdHasBeenSet = true; m_associationId = value; }

    /*

The association ID.

    */
    inline void SetAssociationId(const char* value) { m_associationIdHasBeenSet = true; m_associationId.assign(value); }

    /*

The association ID.

    */
    inline NetworkInterfaceAssociation& WithAssociationId(const Aws::String& value) { SetAssociationId(value); return *this;}

    /*

The association ID.

    */
    inline NetworkInterfaceAssociation& WithAssociationId(Aws::String&& value) { SetAssociationId(value); return *this;}

    /*

The association ID.

    */
    inline NetworkInterfaceAssociation& WithAssociationId(const char* value) { SetAssociationId(value); return *this;}

  private:
    Aws::String m_publicIp;
    bool m_publicIpHasBeenSet;
    Aws::String m_publicDnsName;
    bool m_publicDnsNameHasBeenSet;
    Aws::String m_ipOwnerId;
    bool m_ipOwnerIdHasBeenSet;
    Aws::String m_allocationId;
    bool m_allocationIdHasBeenSet;
    Aws::String m_associationId;
    bool m_associationIdHasBeenSet;
  };

} // namespace Model
} // namespace EC2
} // namespace Aws


text:
module Pinker
  module RuleBuilderAddons
    module InRange
      def in_range(failure_message_proc=nil, &block)
        declare(failure_message_proc) { |call|
          range_results = self.instance_eval(&block)
          range_results = {:allowed => range_results} if range_results.is_a?(Range)
          range_results[:actual] ||= self

          InRange::RANGE_RESULTS_RULE.apply_to(range_results).satisfied!

          allowed_range = range_results[:allowed]
          actual = range_results[:actual]

          if allowed_range.include?(actual)
            true
          else

            failure_message_proc ||=
              proc do |actual, allowed|
                "'#{actual}' is out of range.  " +
                "Value must be between #{allowed_range.begin} and #{allowed_range.end}."
              end

            call.fail(failure_message_proc.call(actual, allowed_range),
                      {:actual => actual, :allowed => allowed_range})
          end
        }
      end

      #how do we turn this off?
        #(this is intended for the designer, after all)
      #should it be a constant?

      RANGE_RESULTS_RULE =
        RuleBuilder.new(:range_results) {
          declare("Bad in_range.  You must return a hash containing the :allowed range and :actual value.") {
            self.key?(:actual) && self.key?(:allowed)
          }
        }.build

    end
  end
end


text:
//---------------------------------------------------------------------
// <copyright file="DataServiceContextWithStreamCustomizer.cs" company="Microsoft">
//      Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------

namespace AstoriaUnitTests.ClientExtensions
{
    using System;
    using System.IO;
    using System.Net;
    using Microsoft.OData.Client;
    using Microsoft.OData.Core;

    public static class ContextUtils
    {
        public static void RegisterStreamCustomizer(this DataServiceContext context, Func<Stream, Stream> requestStreamInterceptor, Func<Stream, Stream> responseStreamInterceptor)
        {
            context.Configurations.RequestPipeline.OnMessageCreating = (args) =>
            {
                return new TestHttpRequestMessage(args, requestStreamInterceptor, responseStreamInterceptor);
            };
        }

        private class TestHttpRequestMessage : HttpWebRequestMessage
        {
            private readonly Func<Stream, Stream> requestStreamInterceptor;
            private readonly Func<Stream, Stream> responseStreamInterceptor;
            internal TestHttpRequestMessage(DataServiceClientRequestMessageArgs args, Func<Stream, Stream> requestStreamInterceptor, Func<Stream, Stream> responseStreamInterceptor) : base(args)
            {
                this.requestStreamInterceptor = requestStreamInterceptor;
                this.responseStreamInterceptor = responseStreamInterceptor;
            }

            public override Stream GetStream()
            {
                if (this.requestStreamInterceptor != null)
                {
                    return this.requestStreamInterceptor(base.GetStream());
                }

                return base.GetStream();
            }

            public override IODataResponseMessage GetResponse()
            {
                var responseMessage = (HttpWebResponseMessage)base.GetResponse();
                return new TestHttpResponseMessage(responseMessage.Response, this.responseStreamInterceptor);
            }

            public override Stream EndGetRequestStream(IAsyncResult asyncResult)
            {
                if (this.requestStreamInterceptor != null)
                {
                    return this.requestStreamInterceptor(base.GetStream());
                }

                return base.GetStream();
            }
        }

        private class TestHttpResponseMessage : HttpWebResponseMessage
        {
            private readonly Func<Stream, Stream> responseStreamInterceptor;
            public TestHttpResponseMessage(HttpWebResponse httpResponse, Func<Stream, Stream> responseStreamInterceptor)
                : base(httpResponse)
            {
                this.responseStreamInterceptor = responseStreamInterceptor;
            }

            public override Stream GetStream()
            {
                if (this.responseStreamInterceptor != null)
                {
                    return this.responseStreamInterceptor(base.GetStream());
                }

                return base.GetStream();
            }
        }
    }
}


text:
package org.motechproject.nms.masterdata.domain;

import org.motechproject.mds.annotations.Entity;
import org.motechproject.mds.annotations.Field;
import org.motechproject.mds.annotations.UIDisplayable;
import org.motechproject.mds.domain.MdsEntity;

/**
 * This class Models data for HealthSubFacility location records
 */

@Entity(recordHistory = true)
public class HealthSubFacility extends MdsEntity {

    @Field
    @UIDisplayable(position = 6)
    private Long stateCode;

    @Field
    @UIDisplayable(position = 5)
    private Long districtCode;

    @Field
    @UIDisplayable(position = 4)
    private Long talukaCode;

    @Field
    @UIDisplayable(position = 3)
    private Long healthBlockCode;

    @Field
    @UIDisplayable(position = 2)
    private Long healthFacilityCode;

    @Field
    @UIDisplayable(position = 1)
    private Long healthSubFacilityCode;

    @Field
    @UIDisplayable(position = 0)
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getHealthFacilityCode() {
        return healthFacilityCode;
    }

    public void setHealthFacilityCode(Long healthFacilityCode) {
        this.healthFacilityCode = healthFacilityCode;
    }

    public Long getHealthSubFacilityCode() {
        return healthSubFacilityCode;
    }

    public void setHealthSubFacilityCode(Long healthSubFacilityCode) {
        this.healthSubFacilityCode = healthSubFacilityCode;
    }

    public Long getTalukaCode() {
        return talukaCode;
    }

    public void setTalukaCode(Long talukaCode) {
        this.talukaCode = talukaCode;
    }

    public Long getDistrictCode() {
        return districtCode;
    }

    public void setDistrictCode(Long districtCode) {
        this.districtCode = districtCode;
    }

    public Long getStateCode() {
        return stateCode;
    }

    public void setStateCode(Long stateCode) {
        this.stateCode = stateCode;
    }

    public Long getHealthBlockCode() {
        return healthBlockCode;
    }

    public void setHealthBlockCode(Long healthBlockCode) {
        this.healthBlockCode = healthBlockCode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof HealthSubFacility)) {
            return false;
        }

        HealthSubFacility that = (HealthSubFacility) o;

        if (!this.getDistrictCode().equals(that.getDistrictCode())) {
            return false;
        }
        if (!this.getHealthBlockCode().equals(that.getHealthBlockCode())) {
            return false;
        }
        if (!this.getHealthFacilityCode().equals(that.getHealthFacilityCode())) {
            return false;
        }
        if (!this.getHealthSubFacilityCode().equals(that.getHealthSubFacilityCode())) {
            return false;
        }
        if (!this.getStateCode().equals(that.getStateCode())) {
            return false;
        }
        if (!this.getTalukaCode().equals(that.getTalukaCode())) {
            return false;
        }

        return true;
    }

    /**
     * Calculates the hash code according to the State Code, District Code, Taluka Code,
     * Health Block Code, Health Facility code and Health Sub Facility Code
     *
     * @return An int hash value
     */
    @Override
    public int hashCode() {
        int result = stateCode.hashCode();
        result = 31 * result + districtCode.hashCode();
        result = 31 * result + talukaCode.hashCode();
        result = 31 * result + healthBlockCode.hashCode();
        result = 31 * result + healthFacilityCode.hashCode();
        result = 31 * result + healthSubFacilityCode.hashCode();
        return result;
    }

    /**
     * This method override the toString method to create string for Health Sub facility Code, State Code
     * District Code, Taluka Code, Health Block Code, and
     * Health Facility Code for the instance variables
     *
     * @return The string of the Health Sub facility Code, State Code
     * District Code, Taluka Code, Health Block Code and
     * Health Facility Code of the instance variables.
     */
    @Override
    public String toString() {
        return "HealthSubFacility{" +
                "stateCode=" + stateCode +
                ", districtCode=" + districtCode +
                ", talukaCode=" + talukaCode +
                ", healthBlockCode=" + healthBlockCode +
                ", healthFacilityCode=" + healthFacilityCode +
                ", healthSubFacilityCode=" + healthSubFacilityCode +
                ", name='" + name + '\'' +
                '}';
    }
}


text:
"""New Flask structure

Revision ID: f7c68fbba74e
Revises: 964f61695f01
Create Date: 2016-07-20 20:55:55.645107

"""

# revision identifiers, used by Alembic.
revision = 'f7c68fbba74e'
down_revision = '964f61695f01'

from alembic import op
import sqlalchemy as sa

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('abilities',
    sa.Column('id', sa.VARCHAR(length=36), nullable=False),
    sa.Column('name', sa.String(length=120), nullable=True),
    sa.Column('created_on', sa.DateTime(), nullable=False),
    sa.Column('updated_on', sa.DateTime(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('roles',
    sa.Column('id', sa.VARCHAR(length=36), nullable=False),
    sa.Column('name', sa.String(length=120), nullable=True),
    sa.Column('created_on', sa.DateTime(), nullable=False),
    sa.Column('updated_on', sa.DateTime(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('role_abilities',
    sa.Column('role_id', sa.VARCHAR(length=36), nullable=True),
    sa.Column('ability_id', sa.VARCHAR(length=36), nullable=True),
    sa.ForeignKeyConstraint(['ability_id'], ['abilities.id'], ),
    sa.ForeignKeyConstraint(['role_id'], ['roles.id'], )
    )
    with op.batch_alter_table(u'user_roles', schema=None) as batch_op:
        batch_op.add_column(sa.Column('role_id', sa.VARCHAR(length=36), nullable=True))
        batch_op.alter_column('user_id',
               existing_type=sa.VARCHAR(length=36),
               nullable=True)
        # batch_op.drop_constraint(None, type_='foreignkey')
        batch_op.create_foreign_key('user_roles', 'roles', ['role_id'], ['id'])
        batch_op.drop_column('updated_on')
        batch_op.drop_column('created_on')
        batch_op.drop_column('id')
        batch_op.drop_column('role_type_id')

    with op.batch_alter_table(u'users', schema=None) as batch_op:
        batch_op.add_column(sa.Column('firstname', sa.String(length=32), nullable=True))
        batch_op.add_column(sa.Column('lastname', sa.String(length=32), nullable=True))
        batch_op.add_column(sa.Column('type', sa.String(length=50), nullable=True))
        batch_op.add_column(sa.Column('username', sa.String(), nullable=True))
        batch_op.drop_column('admin')
        batch_op.drop_column('openid')
        batch_op.drop_column('name')
        batch_op.drop_column('email')

    ### end Alembic commands ###

def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table(u'users', schema=None) as batch_op:
        batch_op.add_column(sa.Column('email', sa.VARCHAR(length=200), nullable=True))
        batch_op.add_column(sa.Column('name', sa.VARCHAR(length=60), nullable=True))
        batch_op.add_column(sa.Column('openid', sa.VARCHAR(length=200), nullable=True))
        batch_op.add_column(sa.Column('admin', sa.BOOLEAN(), server_default=sa.text(u"'0'"), autoincrement=False, nullable=True))
        batch_op.drop_column('username')
        batch_op.drop_column('type')
        batch_op.drop_column('lastname')
        batch_op.drop_column('firstname')

    with op.batch_alter_table(u'user_roles', schema=None) as batch_op:
        batch_op.add_column(sa.Column('role_type_id', sa.VARCHAR(length=36), nullable=True))
        batch_op.add_column(sa.Column('id', sa.VARCHAR(length=36), nullable=False))
        batch_op.add_column(sa.Column('created_on', sa.DATETIME(), nullable=False))
        batch_op.add_column(sa.Column('updated_on', sa.DATETIME(), nullable=False))
        # batch_op.drop_constraint(None, type_='foreignkey')
        batch_op.create_foreign_key('role_types_roles', 'role_types', ['role_type_id'], ['id'])
        batch_op.alter_column('user_id',
               existing_type=sa.VARCHAR(length=36),
               nullable=False)
        batch_op.drop_column('role_id')

    op.create_table('role_types',
    sa.Column('id', sa.VARCHAR(length=36), nullable=False),
    sa.Column('name', sa.VARCHAR(length=60), nullable=True),
    sa.Column('created_on', sa.DATETIME(), nullable=False),
    sa.Column('updated_on', sa.DATETIME(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('role_abilities')
    op.drop_table('roles')
    op.drop_table('abilities')
    ### end Alembic commands ###


text:
/*!
 *
 * \file src/relay/op/device_copy.cc
 * \brief Crossing device data copy operator.
 *
 * The pattern of this operator is registered as kOpaque. Hence, it could be
 * used as "barrier" to avoid fusing operators belonging to differen devices.
 */

#include <tvm/relay/attrs/device_copy.h>
#include <tvm/relay/expr.h>
#include <tvm/relay/op.h>
#include <tvm/relay/op_attr_types.h>
#include <tvm/tir/expr.h>
#include <tvm/topi/elemwise.h>

#include "../transforms/infer_layout_utils.h"
#include "type_relations.h"

namespace tvm {
namespace relay {

// relay.device_copy
TVM_REGISTER_NODE_TYPE(DeviceCopyAttrs);

TVM_REGISTER_GLOBAL("relay.op._make.device_copy")
    .set_body_typed([](Expr data, int src_dev_type, int dst_dev_type) {
      auto attrs = make_object<DeviceCopyAttrs>();
      attrs->src_dev_type = src_dev_type;
      attrs->dst_dev_type = dst_dev_type;
      static const Op& op = Op::Get("device_copy");
      return Call(op, {data}, Attrs(attrs), {});
    });

RELAY_REGISTER_OP("device_copy")
    .describe(R"code(
Copy data from one tensor to another. The source and destination might be
on different devices.
)code" TVM_ADD_FILELINE)
    .set_num_inputs(1)
    .set_support_level(10)
    .add_type_rel("Identity", IdentityRel)
    .set_attr<TOpPattern>("TOpPattern", kOpaque)
    .set_attr<TOpIsStateful>("TOpIsStateful", false)
    .set_attr<FInferCorrectLayout>("FInferCorrectLayout", ElemwiseArbitraryLayout)
    .set_attr<FTVMCompute>("FTVMCompute",
                           [](const Attrs& attrs, const Array<te::Tensor>& inputs,
                              const Type& out_dtype) -> Array<te::Tensor> {
                             return {topi::identity(inputs[0])};
                           });

}  // namespace relay
}  // namespace tvm


text:
package org.apache.nutch.api.model.request;

import java.util.Map;

import java.util.Collections;

public class NutchConfig {
  private String configId;
  private boolean force = false;
  private Map<String, String> params = Collections.emptyMap();

  public Map<String, String> getParams() {
    return params;
  }

  public void setParams(Map<String, String> params) {
    this.params = params;
  }

  public String getConfigId() {
    return configId;
  }

  public void setConfigId(String configId) {
    this.configId = configId;
  }

  public boolean isForce() {
    return force;
  }

  public void setForce(boolean force) {
    this.force = force;
  }
}


text:
"""To add test methods.
"""
# from time import sleep
# from halo import Halo
# from time import time
#
# def rocket_launch():
#     #spinner = Halo({'spinner': 'shark'})
#     spinner = Halo({
#     'spinner': {
#         'interval': 100,
#         'frames': ['-', '\\', '|', '/', '-']
#     }
# })
#     spinner.start()
#     while(1):
#         spinner.text = 'Running... Time Elapsed: {} seconds'.format(time())
#         sleep(10)
#         break
#     spinner.succeed('Rocket launched')
#
# rocket_launch()

from antpcf import *

# bins = np.arange(0.01, 0.201, 0.01)
# atpcf('/Users/rohin/Downloads/DR7-Full.ascii', bins, randfile='/Users/rohin/Downloads/random-DR7-Ful.ascii',permetric='apzdth', parmetric='apdz', weights=True)
# tpcf('/Users/rohin/Downloads/DR3-ns.ascii',bins,randfile='/Users/rohin/Downloads/random-DR3-ns.ascii',weights=True)
# def pmethod():
bins = np.arange(0.002, 0.06, 0.002)
correl = tpcf('./testw.dat',bins,randfile='./testw.dat',weights=True)
#    return correl
# pool = multiprocessing.Pool(processes=ncount)
# correl = pool.map(pmethod)
# print correl
# atpcf('./testw.dat',bins,randfile='./testw.dat',permetric='apzdth',parmetric='apdz',method='ls',weights=True)
# blha=readfitsfile('/Users/rohin/Documents/ipy_notebooks/galsurveystudy/input/galaxy_DR12v5_CMASS_North.fits','data')
# dr12gcmn, weights = datprep('/Users/rohin/Documents/ipy_notebooks/galsurveystudy/input/galaxy_DR12v5_LOWZ_South.fits','data','lcdm')
# dat = readfitsfile('/Users/rohin/Documents/ipy_notebooks/galsurveystudy/input/galaxy_DR12v5_LOWZ_South.fits','data')
# weights = dat['WEIGHT_SYSTOT']
# import pyfits
# dpy = pyfits.open('/Users/rohin/Documents/ipy_notebooks/galsurveystudy/input/galaxy_DR12v5_LOWZ_South.fits')
# dpyd = dpy[1].data
# wts = dpyd['WEIGHT_SYSTOT']
# print(wts)
# print(min(wts))
# print(max(wts))
# print(dr12gcmn)
# print(weights)
# print (min(weights))
# print(max(weights))
# dr12gls=tpcf('/Users/rohin/Documents/ipy_notebooks/galsurveystudy/input/galaxy_DR12v5_LOWZ_South.fits',bins,randfile='/Users/rohin/Downloads/random0_DR12v5_LOWZ_South.fits',weights=True)
# Planck run with changed parameters in param.py
# corrdr3milne = tpcf('/Users/rohin/Downloads/DR3-ns.ascii', bins, randfile='/Users/rohin/Downloads/random-DR3-ns.ascii', weights=True, geometry='open', cosmology='lc')
# corrdr3milne = tpcf('/Users/rohin/Downloads/DR3-ns.ascii', bins, weights=True, mask='/Users/rohin/Documents/ipy_notebooks/galsurveystudy/masks/window.dr72safe0.ply')
# corrdr3milne = tpcf('./testw.dat', bins, weights=True, mask='/Users/rohin/Documents/ipy_notebooks/galsurveystudy/masks/window.dr72safe0.ply')


text:
import Vue from 'vue'
import Promise from 'promise'
import eventEmitter from './event-emitter'

export default {

    countByCards() {
        return new Promise((resolve, reject) => {
            Vue.http.get('api/index.php/cards/tasks/count').then(response => {
                resolve(response.json())
            }, error => {
                reject(error)
            })
        })
    },

    create(cardId, model) {
        return new Promise((resolve, reject) => {
            Vue.http.post(`api/index.php/cards/${cardId}/tasks`, model).then(response => {
                eventEmitter.emit('tasks.created', response.json())
                resolve(response.json())
            }, error => {
                reject(error)
            })
        })
    },

    delete(model) {
        return new Promise((resolve, reject) => {
            Vue.http.delete(`api/index.php/tasks/${model.id}`).then(() => {
                eventEmitter.emit('tasks.deleted', model)
                resolve()
            }, error => {
                reject(error)
            })
        })
    },

    queryByCardId(id, params) {
        return new Promise((resolve, reject) => {
            Vue.http.get(`api/index.php/cards/${id}/tasks`, params).then(response => {
                resolve(response.json())
            }, error => {
                reject(error)
            })
        })
    },

    update(id, model) {
        return new Promise((resolve, reject) => {
            Vue.http.put(`api/index.php/tasks/${id}`, model).then(response => {
                eventEmitter.emit('tasks.updated', response)
                resolve()
            }, error => {
                reject(error)
            })
        })
    }

}


text:
require('jquery');
require('angular');
require('./js/bootstrap.min');
require('angular-animate');
var $MR = require('moonridge-client');
var MRB = $MR({url: 'http://localhost:8080'});  //true indicates, that this backend should be used by default
MRB.socket.on('disconnect', function() {
	console.log("Ha disconnected!");
});

angular.module('MRTest', ['ngAnimate']).controller('fighterCtrl', function($scope, $log) {
	MRB.rpc.events.batchEnds = function() {
		console.log('applies');
		$scope.$apply();
	};
	var fighter = MRB.model('fighter');
	var user = MRB.model('user');
	var fighterLQ = fighter.liveQuery;

	angular.extend($scope, {
		limit: 6,
		oneLQ: fighterLQ().findOne().exec(),
		cLQ: fighterLQ().count().exec()
	});

	var runQuery = function() {
		$scope.LQ = fighterLQ().sort('health').limit($scope.limit).exec();
	};

	$scope.$watch('limit', function(newValue, oldValue) {
		if (angular.isNumber(newValue)) {
			runQuery();
		}
	});

	runQuery();

	$scope.LQ.promise.then(function(LQ) {
		console.log(LQ);    //LiveQuery
	});

	$scope.oneLQ.on('add', function(LQ) {
		console.log('add event handler called');    //
	});

	$scope.oneLQ.on('remove', function(LQ) {
		console.log('remove event handler called');    //
	});

	$scope.oneLQ.on('any', function(LQ) {
		console.log('oneLQ.docs', $scope.oneLQ.docs);    //
	});

	$scope.admin = user.query().findOne().exec();

	$scope.hit = function(afighter) {
		afighter.health -= 1;
		fighter.update(afighter);
	};

	$scope.heal = function(afighter) {
		afighter.health += 1;
		fighter.update(afighter);
	};

	$scope.remove = fighter.remove;

	$scope.create = function() {
		fighter.create({name: $scope.name, health: $scope.health});
	};

	$scope.dropdownTexts = [
		"fighter's name",
		"fighter's health",
		false,
		"fighter's death",
		"fighter's owner",
		"fighter's _id",
		'version'
	];

	console.log("user", MRB.user);

	$scope.admin = function() {
		MRB.authorize({nick: 'admin'}).then(function(user) { //user === moonridgeBackend.user
			console.log("user", user);
			fighter.create({name: 'Jon Snow', health: 70});
			fighter.create({name: 'Littlefinger', health: 20});
			fighter.create({name: 'Roose Bolton', health: 35});
			fighter.create({name: 'Arya Stark', health: 50});
		});
	};

	$scope.user = function() {
		MRB.authorize({nick: 'testUser'});
	};

});


text:
Pattern: Malformed operator line wrapping

Issue: -

## Description

Checks the policy on how to wrap lines on operators.

## Examples

To configure the check:

```xml
<module name="OperatorWrap"/>
```

To configure the check for the assignment operator, `=`, at the end of a line:

```xml
<module name="OperatorWrap">
    <property name="tokens" value="ASSIGN"/>
    <property name="option" value="eol"/>
</module>
```

## Further Reading

* [checkstyle - OperatorWrap](http://checkstyle.sourceforge.net/config_whitespace.html#OperatorWrap)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Nito.AsyncEx;
using NUnit.Framework;
using Realms;
using Realms.Exceptions;

namespace Tests.Database
{
    // using classes from TestObjects.cs
    [TestFixture, Preserve(AllMembers = true)]
    public class PrimaryKeyTests : RealmInstanceTest
    {
        [TestCase(typeof(PrimaryKeyCharObject), 'x', true)]
        [TestCase(typeof(PrimaryKeyNullableCharObject), 'x', true)]
        [TestCase(typeof(PrimaryKeyNullableCharObject), null, true)]
        [TestCase(typeof(PrimaryKeyByteObject), (byte)42, true)]
        [TestCase(typeof(PrimaryKeyNullableByteObject), (byte)42, true)]
        [TestCase(typeof(PrimaryKeyNullableByteObject), null, true)]
        [TestCase(typeof(PrimaryKeyInt16Object), (short)4242, true)]
        [TestCase(typeof(PrimaryKeyNullableInt16Object), (short)4242, true)]
        [TestCase(typeof(PrimaryKeyNullableInt16Object), null, true)]
        [TestCase(typeof(PrimaryKeyInt32Object), 42000042, true)]
        [TestCase(typeof(PrimaryKeyNullableInt32Object), 42000042, true)]
        [TestCase(typeof(PrimaryKeyNullableInt32Object), null, true)]
        [TestCase(typeof(PrimaryKeyInt64Object), 42000042L, true)]
        [TestCase(typeof(PrimaryKeyNullableInt64Object), 42000042L, true)]
        [TestCase(typeof(PrimaryKeyNullableInt64Object), null, true)]
        [TestCase(typeof(PrimaryKeyStringObject), "key", false)]
        public void FindByPrimaryKeyDynamicTests(Type type, object primaryKeyValue, bool isIntegerPK)
        {
            var obj = (RealmObject)Activator.CreateInstance(type);
            var pkProperty = type.GetProperties().Single(p => p.GetCustomAttribute<PrimaryKeyAttribute>() != null);
            pkProperty.SetValue(obj, primaryKeyValue);

            _realm.Write(() => _realm.Add(obj));

            var foundObj = FindByPKDynamic(type, primaryKeyValue, isIntegerPK);

            Assert.That(foundObj, Is.Not.Null);
            Assert.That(pkProperty.GetValue(foundObj), Is.EqualTo(primaryKeyValue));
        }

        [TestCase(typeof(PrimaryKeyCharObject), 'x', true)]
        [TestCase(typeof(PrimaryKeyNullableCharObject), 'x', true)]
        [TestCase(typeof(PrimaryKeyNullableCharObject), null, true)]
        [TestCase(typeof(PrimaryKeyByteObject), (byte)42, true)]
        [TestCase(typeof(PrimaryKeyNullableByteObject), (byte)42, true)]
        [TestCase(typeof(PrimaryKeyNullableByteObject), null, true)]
        [TestCase(typeof(PrimaryKeyInt16Object), (short)4242, true)]
        [TestCase(typeof(PrimaryKeyNullableInt16Object), (short)4242, true)]
        [TestCase(typeof(PrimaryKeyNullableInt16Object), null, true)]
        [TestCase(typeof(PrimaryKeyInt32Object), 42000042, true)]
        [TestCase(typeof(PrimaryKeyNullableInt32Object), 42000042, true)]
        [TestCase(typeof(PrimaryKeyNullableInt32Object), null, true)]
        [TestCase(typeof(PrimaryKeyInt64Object), 42000042L, true)]
        [TestCase(typeof(PrimaryKeyNullableInt64Object), 42000042L, true)]
        [TestCase(typeof(PrimaryKeyNullableInt64Object), null, true)]
        [TestCase(typeof(PrimaryKeyStringObject), "key", false)]
        public void FailToFindByPrimaryKeyDynamicTests(Type type, object primaryKeyValue, bool isIntegerPK)
        {
            var foundObj = FindByPKDynamic(type, primaryKeyValue, isIntegerPK);
            Assert.That(foundObj, Is.Null);
        }

        [TestCase(typeof(PrimaryKeyCharObject), 'x')]
        [TestCase(typeof(PrimaryKeyNullableCharObject), 'x')]
        [TestCase(typeof(PrimaryKeyNullableCharObject), null)]
        [TestCase(typeof(PrimaryKeyByteObject), (byte)42)]
        [TestCase(typeof(PrimaryKeyNullableByteObject), (byte)42)]
        [TestCase(typeof(PrimaryKeyNullableByteObject), null)]
        [TestCase(typeof(PrimaryKeyInt16Object), (short)4242)]
        [TestCase(typeof(PrimaryKeyNullableInt16Object), (short)4242)]
        [TestCase(typeof(PrimaryKeyNullableInt16Object), null)]
        [TestCase(typeof(PrimaryKeyInt32Object), 42000042)]
        [TestCase(typeof(PrimaryKeyNullableInt32Object), 42000042)]
        [TestCase(typeof(PrimaryKeyNullableInt32Object), null)]
        [TestCase(typeof(PrimaryKeyInt64Object), 42000042L)]
        [TestCase(typeof(PrimaryKeyNullableInt64Object), 42000042L)]
        [TestCase(typeof(PrimaryKeyNullableInt64Object), null)]
        [TestCase(typeof(PrimaryKeyStringObject), "key")]
        public void CreateObject_WhenPKExists_ShouldFail(Type type, object primaryKeyValue)
        {
            var pkProperty = type.GetProperties().Single(p => p.GetCustomAttribute<PrimaryKeyAttribute>() != null);

            _realm.Write(() =>
            {
                var first = _realm.CreateObject(type.Name);
                pkProperty.SetValue(first, primaryKeyValue);
            });

            Assert.That(() =>
            {
                _realm.Write(() =>
                {
                    var second = _realm.CreateObject(type.Name);
                    pkProperty.SetValue(second, primaryKeyValue);
                });
            }, Throws.InnerException.TypeOf<RealmDuplicatePrimaryKeyValueException>());
        }

        [TestCase(typeof(PrimaryKeyCharObject), 'x')]
        [TestCase(typeof(PrimaryKeyNullableCharObject), 'x')]
        [TestCase(typeof(PrimaryKeyNullableCharObject), null)]
        [TestCase(typeof(PrimaryKeyByteObject), (byte)42)]
        [TestCase(typeof(PrimaryKeyNullableByteObject), (byte)42)]
        [TestCase(typeof(PrimaryKeyNullableByteObject), null)]
        [TestCase(typeof(PrimaryKeyInt16Object), (short)4242)]
        [TestCase(typeof(PrimaryKeyNullableInt16Object), (short)4242)]
        [TestCase(typeof(PrimaryKeyNullableInt16Object), null)]
        [TestCase(typeof(PrimaryKeyInt32Object), 42000042)]
        [TestCase(typeof(PrimaryKeyNullableInt32Object), 42000042)]
        [TestCase(typeof(PrimaryKeyNullableInt32Object), null)]
        [TestCase(typeof(PrimaryKeyInt64Object), 42000042L)]
        [TestCase(typeof(PrimaryKeyNullableInt64Object), 42000042L)]
        [TestCase(typeof(PrimaryKeyNullableInt64Object), null)]
        [TestCase(typeof(PrimaryKeyStringObject), "key")]
        public void ManageObject_WhenPKExists_ShouldFail(Type type, object primaryKeyValue)
        {
            var pkProperty = type.GetProperties().Single(p => p.GetCustomAttribute<PrimaryKeyAttribute>() != null);
            var first = (RealmObject)Activator.CreateInstance(type);
            pkProperty.SetValue(first, primaryKeyValue);

            _realm.Write(() =>
            {
                _realm.Add(first);
            });

            Assert.That(() =>
            {
                var second = (RealmObject)Activator.CreateInstance(type);
                pkProperty.SetValue(second, primaryKeyValue);
                _realm.Write(() =>
                {
                    _realm.Add(second);
                });
            }, Throws.TypeOf<RealmDuplicatePrimaryKeyValueException>());
        }

        private RealmObject FindByPKDynamic(Type type, object primaryKeyValue, bool isIntegerPK)
        {
            if (isIntegerPK)
            {
                long? castPKValue;
                if (primaryKeyValue == null)
                {
                    castPKValue = null;
                }
                else
                {
                    castPKValue = Convert.ToInt64(primaryKeyValue);
                }

                return _realm.Find(type.Name, castPKValue);
            }

            return _realm.Find(type.Name, (string)primaryKeyValue);
        }

        [TestCase(typeof(PrimaryKeyCharObject), 'x', true)]
        [TestCase(typeof(PrimaryKeyNullableCharObject), 'x', true)]
        [TestCase(typeof(PrimaryKeyNullableCharObject), null, true)]
        [TestCase(typeof(PrimaryKeyByteObject), (byte)42, true)]
        [TestCase(typeof(PrimaryKeyNullableByteObject), (byte)42, true)]
        [TestCase(typeof(PrimaryKeyNullableByteObject), null, true)]
        [TestCase(typeof(PrimaryKeyInt16Object), (short)4242, true)]
        [TestCase(typeof(PrimaryKeyNullableInt16Object), (short)4242, true)]
        [TestCase(typeof(PrimaryKeyNullableInt16Object), null, true)]
        [TestCase(typeof(PrimaryKeyInt32Object), 42000042, true)]
        [TestCase(typeof(PrimaryKeyNullableInt32Object), 42000042, true)]
        [TestCase(typeof(PrimaryKeyNullableInt32Object), null, true)]
        [TestCase(typeof(PrimaryKeyInt64Object), 42000042L, true)]
        [TestCase(typeof(PrimaryKeyNullableInt64Object), 42000042L, true)]
        [TestCase(typeof(PrimaryKeyNullableInt64Object), null, true)]
        [TestCase(typeof(PrimaryKeyStringObject), "key", false)]
        public void FindByPrimaryKeyGenericTests(Type type, object primaryKeyValue, bool isIntegerPK)
        {
            var obj = (RealmObject)Activator.CreateInstance(type);
            var pkProperty = type.GetProperties().Single(p => p.GetCustomAttribute<PrimaryKeyAttribute>() != null);
            pkProperty.SetValue(obj, primaryKeyValue);

            _realm.Write(() => _realm.Add(obj));

            var foundObj = FindByPKGeneric(type, primaryKeyValue, isIntegerPK);

            Assert.That(foundObj, Is.Not.Null);
            Assert.That(pkProperty.GetValue(foundObj), Is.EqualTo(primaryKeyValue));
        }

        [TestCase(typeof(PrimaryKeyCharObject), 'x', true)]
        [TestCase(typeof(PrimaryKeyNullableCharObject), 'x', true)]
        [TestCase(typeof(PrimaryKeyNullableCharObject), null, true)]
        [TestCase(typeof(PrimaryKeyByteObject), (byte)42, true)]
        [TestCase(typeof(PrimaryKeyNullableByteObject), (byte)42, true)]
        [TestCase(typeof(PrimaryKeyNullableByteObject), null, true)]
        [TestCase(typeof(PrimaryKeyInt16Object), (short)4242, true)]
        [TestCase(typeof(PrimaryKeyNullableInt16Object), (short)4242, true)]
        [TestCase(typeof(PrimaryKeyNullableInt16Object), null, true)]
        [TestCase(typeof(PrimaryKeyInt32Object), 42000042, true)]
        [TestCase(typeof(PrimaryKeyNullableInt32Object), 42000042, true)]
        [TestCase(typeof(PrimaryKeyNullableInt32Object), null, true)]
        [TestCase(typeof(PrimaryKeyInt64Object), 42000042L, true)]
        [TestCase(typeof(PrimaryKeyNullableInt64Object), 42000042L, true)]
        [TestCase(typeof(PrimaryKeyNullableInt64Object), null, true)]
        [TestCase(typeof(PrimaryKeyStringObject), "key", false)]
        public void FailToFindByPrimaryKeyGenericTests(Type type, object primaryKeyValue, bool isIntegerPK)
        {
            var foundObj = FindByPKGeneric(type, primaryKeyValue, isIntegerPK);
            Assert.That(foundObj, Is.Null);
        }

        private RealmObject FindByPKGeneric(Type type, object primaryKeyValue, bool isIntegerPK)
        {
            var genericArgument = isIntegerPK ? typeof(long?) : typeof(string);
            var genericMethod = _realm.GetType().GetMethod(nameof(Realm.Find), new[] { genericArgument });

            object castPKValue;
            if (isIntegerPK)
            {
                if (primaryKeyValue == null)
                {
                    castPKValue = (long?)null;
                }
                else
                {
                    castPKValue = Convert.ToInt64(primaryKeyValue);
                }
            }
            else
            {
                castPKValue = (string)primaryKeyValue;
            }

            return (RealmObject)genericMethod.MakeGenericMethod(type).Invoke(_realm, new[] { castPKValue });
        }

        [Test]
        public void ExceptionIfNoPrimaryKeyDeclared()
        {
            Assert.That(() => _realm.Find<Person>("Zaphod"), Throws.TypeOf<RealmClassLacksPrimaryKeyException>());
        }

        [Test]
        public void ExceptionIfNoDynamicPrimaryKeyDeclared()
        {
            Assert.That(() => _realm.Find("Person", "Zaphod"), Throws.TypeOf<RealmClassLacksPrimaryKeyException>());
        }

        [Test]
        public void GetByPrimaryKeyDifferentThreads()
        {
            AsyncContext.Run(async () =>
            {
                _realm.Write(() =>
                {
                    _realm.Add(new PrimaryKeyInt64Object { Int64Property = 42000042 });
                });

                long foundValue = 0;

                // Act
                await Task.Run(() =>
                {
                    using (var realm2 = Realm.GetInstance(_configuration))
                    {
                        var foundObj = realm2.Find<PrimaryKeyInt64Object>(42000042);
                        foundValue = foundObj.Int64Property;
                    }
                });

                Assert.That(foundValue, Is.EqualTo(42000042));
            });
        }

        [Test]
        public void PrimaryKeyStringObjectIsUnique()
        {
            _realm.Write(() =>
            {
                _realm.Add(new PrimaryKeyStringObject { StringProperty = "Zaphod" });
            });

            Assert.That(() =>
            {
                _realm.Write(() =>
                {
                    _realm.Add(new PrimaryKeyStringObject { StringProperty = "Zaphod" }); // deliberately reuse id
                });
            }, Throws.TypeOf<RealmDuplicatePrimaryKeyValueException>());
        }

        [Test]
        public void NullPrimaryKeyStringObjectThrows()
        {
            Assert.That(() =>
            {
                _realm.Write(() =>
                {
                    _realm.Add(new PrimaryKeyStringObject { StringProperty = null });
                });
            }, Throws.TypeOf<ArgumentNullException>());
        }

        [Test]
        public void NullAndNotNullIntPKsWorkTogether()
        {
            _realm.Write(() =>
            {
                _realm.Add(new PrimaryKeyNullableInt64Object { Int64Property = null });
                _realm.Add(new PrimaryKeyNullableInt64Object { Int64Property = 123 });
            });

            Assert.That(_realm.All<PrimaryKeyNullableInt64Object>().Count, Is.EqualTo(2));
        }

        [Test]
        public void PrimaryKeyFailsIfClassNotinRealm()
        {
            var conf = RealmConfiguration.DefaultConfiguration.ConfigWithPath("Skinny");
            conf.ObjectClasses = new[] { typeof(Person) };
            var skinny = Realm.GetInstance(conf);
            Assert.That(() => skinny.Find<PrimaryKeyInt64Object>(42), Throws.TypeOf<KeyNotFoundException>());
        }
    }
}