text:
<?php defined('C5_EXECUTE') or die("Access Denied.");

/**
 * ----------------------------------------------------------------------------
 * Ensure we're not accessing this file directly.
 * ----------------------------------------------------------------------------
 */
if (basename($_SERVER['PHP_SELF']) == DISPATCHER_FILENAME_CORE) {
    die("Access Denied.");
}

/**
 * ----------------------------------------------------------------------------
 * Import relevant classes.
 * ----------------------------------------------------------------------------
 */
use Concrete\Core\Application\Application;
use Concrete\Core\Asset\AssetList;
use Concrete\Core\Config\DatabaseLoader;
use Concrete\Core\Config\DatabaseSaver;
use Concrete\Core\Config\FileLoader;
use Concrete\Core\Config\FileSaver;
use Concrete\Core\Config\Repository\Repository as ConfigRepository;
use Concrete\Core\File\Type\TypeList;
use Concrete\Core\Foundation\ClassAliasList;
use Concrete\Core\Foundation\Service\ProviderList;
use Concrete\Core\Permission\Key\Key as PermissionKey;
use Concrete\Core\Support\Facade\Facade;
use Illuminate\Filesystem\Filesystem;
use Patchwork\Utf8\Bootup as PatchworkUTF8;

/**
 * ----------------------------------------------------------------------------
 * Handle text encoding.
 * ----------------------------------------------------------------------------
 */
PatchworkUTF8::initAll();

/**
 * ----------------------------------------------------------------------------
 * Instantiate concrete5.
 * ----------------------------------------------------------------------------
 */
/** @var Application $cms */
$cms = require DIR_APPLICATION . '/bootstrap/start.php';
$cms->instance('app', $cms);

/**
 * ----------------------------------------------------------------------------
 * Bind the IOC container to our facades
 * Completely indebted to Taylor Otwell & Laravel for this.
 * ----------------------------------------------------------------------------
 */
Facade::setFacadeApplication($cms);

/**
 * ----------------------------------------------------------------------------
 * Load path detection for relative assets, URL and path to home.
 * ----------------------------------------------------------------------------
 */
require DIR_BASE_CORE . '/bootstrap/paths.php';

/**
 * ----------------------------------------------------------------------------
 * Add install environment detection
 * ----------------------------------------------------------------------------
 */
$db_config = array();
if (file_exists(DIR_APPLICATION . '/config/database.php')) {
    $db_config = include DIR_APPLICATION . '/config/database.php';
}
$environment = $cms->environment();
$cms->detectEnvironment(function() use ($db_config, $environment, $cms) {
    try {
        $installed = $cms->isInstalled();
        return $installed;
    } catch (\Exception $e) {}

    return isset($db_config['default-connection']) ? $environment : 'install';
});

/**
 * ----------------------------------------------------------------------------
 * Enable Filesystem Config.
 * ----------------------------------------------------------------------------
 */
if (!$cms->bound('config')) {
    $cms->bindShared('config', function(Application $cms) {
        $file_system = new Filesystem();
        $file_loader = new FileLoader($file_system);
        $file_saver = new FileSaver($file_system);
        return new ConfigRepository($file_loader, $file_saver, $cms->environment());
    });
}

$config = $cms->make('config');

/*
 * ----------------------------------------------------------------------------
 * Finalize paths.
 * ----------------------------------------------------------------------------
 */
require DIR_BASE_CORE . '/bootstrap/paths_configured.php';

/**
 * ----------------------------------------------------------------------------
 * Timezone Config
 * ----------------------------------------------------------------------------
 */
if (!$config->has('app.timezone')) {
    // There is no timezone set.
    $config->set('app.timezone', @date_default_timezone_get());
}

if (!$config->has('app.server_timezone')) {
    // There is no server timezone set.
    $config->set('app.server_timezone', @date_default_timezone_get());
}

@date_default_timezone_set($config->get('app.timezone'));

/**
 * ----------------------------------------------------------------------------
 * Setup core classes aliases.
 * ----------------------------------------------------------------------------
 */
$list = ClassAliasList::getInstance();
$list->registerMultiple($config->get('app.aliases'));
$list->registerMultiple($config->get('app.facades'));

/**
 * ----------------------------------------------------------------------------
 * Set up Database Config.
 * ----------------------------------------------------------------------------
 */

if (!$cms->bound('config/database')) {
    $cms->bindShared('config/database', function(Application $cms) {
        $database_loader = new DatabaseLoader();
        $database_saver = new DatabaseSaver();
        return new ConfigRepository($database_loader, $database_saver, $cms->environment());
    });
}

$database_config = $cms->make('config/database');

/**
 * ----------------------------------------------------------------------------
 * Setup the core service groups.
 * ----------------------------------------------------------------------------
 */

$list = new ProviderList($cms);

// Register events first so that they can be used by other providers.
$list->registerProvider($config->get('app.providers.core_events'));

// Register all other providers
$list->registerProviders($config->get('app.providers'));

/**
 * ----------------------------------------------------------------------------
 * Legacy Definitions
 * ----------------------------------------------------------------------------
 */
define('APP_VERSION', $config->get('concrete.version'));
define('APP_CHARSET', $config->get('concrete.charset'));
try {
    define('BASE_URL', \Core::getApplicationURL());
} catch (\Exception $x) {
    echo $x->getMessage();
    die(1);
}
define('DIR_REL', $cms['app_relative_path']);

/**
 * ----------------------------------------------------------------------------
 * Setup file cache directories. Has to come after we define services
 * because we use the file service.
 * ----------------------------------------------------------------------------
 */
$cms->setupFilesystem();

/**
 * ----------------------------------------------------------------------------
 * Registries for theme paths, assets, routes and file types.
 * ----------------------------------------------------------------------------
 */
$asset_list = AssetList::getInstance();

$asset_list->registerMultiple($config->get('app.assets', array()));
$asset_list->registerGroupMultiple($config->get('app.asset_groups', array()));

Route::registerMultiple($config->get('app.routes'));
Route::setThemesByRoutes($config->get('app.theme_paths', array()));

$type_list = TypeList::getInstance();
$type_list->defineMultiple($config->get('app.file_types', array()));
$type_list->defineImporterAttributeMultiple($config->get('app.importer_attributes', array()));

/**
 * ----------------------------------------------------------------------------
 * If we are running through the command line, we don't proceed any further
 * ----------------------------------------------------------------------------
 */
if ($cms->isRunThroughCommandLineInterface()) {
    return $cms;
}

/**
 * ----------------------------------------------------------------------------
 * If not through CLI, load up the application/bootstrap/app.php
 */
include DIR_APPLICATION . '/bootstrap/app.php';

/**
 * ----------------------------------------------------------------------------
 * Set trusted proxies and headers for the request
 * ----------------------------------------------------------------------------
 */

if($proxyHeaders = $config->get('concrete.security.trusted_proxies.headers')){
    foreach($proxyHeaders as $key => $value) {
        Request::setTrustedHeaderName($key, $value);
    }
}

if($trustedProxiesIps = $config->get('concrete.security.trusted_proxies.ips')) {
    Request::setTrustedProxies($trustedProxiesIps);
}

/**
 * ----------------------------------------------------------------------------
 * Obtain the Request object.
 * ----------------------------------------------------------------------------
 */
$request = Request::getInstance();

/**
 * ----------------------------------------------------------------------------
 * If we haven't installed, then we need to reroute. If we have, and we're
 * on the install page, and we haven't installed, then we need to dispatch
 * early and exit.
 * ----------------------------------------------------------------------------
 */
if (!$cms->isInstalled()) {
    if (!$cms->isRunThroughCommandLineInterface() && !$request->matches('/install/*') && $request->getPath(
        ) != '/install'
    ) {
        $response = Redirect::to('/install');
    }
    else {
        $response = $cms->dispatch($request);
    }
    $response->send();
    $cms->shutdown();
}

/**
 * ----------------------------------------------------------------------------
 * Check the page cache in case we need to return a result early.
 * ----------------------------------------------------------------------------
 */
$response = $cms->checkPageCache($request);
if ($response) {
    $response->send();
    $cms->shutdown();
}

/**
 * ----------------------------------------------------------------------------
 * Now we load all installed packages, and register their package autoloaders.
 * ----------------------------------------------------------------------------
 */
$cms->setupPackageAutoloaders();

/**
 * ----------------------------------------------------------------------------
 * Load preprocess items
 * ----------------------------------------------------------------------------
 */
require DIR_BASE_CORE . '/bootstrap/preprocess.php';

/**
 * ----------------------------------------------------------------------------
 * Set the active language for the site, based either on the site locale, or the
 * current user record. This can be changed later as well, during runtime.
 * Start localization library.
 * ----------------------------------------------------------------------------
 */
$u = new User();
$lan = $u->getUserLanguageToDisplay();
$loc = Localization::getInstance();
$loc->setLocale($lan);

/**
 * Handle automatic updating
 */
$cms->handleAutomaticUpdates();

/**
 * ----------------------------------------------------------------------------
 * Now that we have languages out of the way, we can run our package on_start
 * methods
 * ----------------------------------------------------------------------------
 */
$cms->setupPackages();

/**
 * ----------------------------------------------------------------------------
 * Load all permission keys into our local cache.
 * ----------------------------------------------------------------------------
 */
PermissionKey::loadAll();

/**
 * ----------------------------------------------------------------------------
 * Fire an event for intercepting the dispatch
 * ----------------------------------------------------------------------------
 */
\Events::dispatch('on_before_dispatch');

/**
 * ----------------------------------------------------------------------------
 * Get the response to the current request
 * ----------------------------------------------------------------------------
 */
$response = $cms->dispatch($request);
/**
 * ----------------------------------------------------------------------------
 * Send it to the user
 * ----------------------------------------------------------------------------
 */
$response->send();

/**
 * ----------------------------------------------------------------------------
 * Return the CMS object.
 * ----------------------------------------------------------------------------
 */
return $cms;


text:
require "test_helper"
require "minitest/mock"
require "stubs/test_connection"
require "stubs/room"

class ActionCable::Channel::BaseTest < ActionCable::TestCase
  class ActionCable::Channel::Base
    def kick
      @last_action = [ :kick ]
    end

    def topic
    end
  end

  class BasicChannel < ActionCable::Channel::Base
    def chatters
      @last_action = [ :chatters ]
    end
  end

  class ChatChannel < BasicChannel
    attr_reader :room, :last_action
    after_subscribe :toggle_subscribed
    after_unsubscribe :toggle_subscribed

    def initialize(*)
      @subscribed = false
      super
    end

    def subscribed
      @room = Room.new params[:id]
      @actions = []
    end

    def unsubscribed
      @room = nil
    end

    def toggle_subscribed
      @subscribed = !@subscribed
    end

    def leave
      @last_action = [ :leave ]
    end

    def speak(data)
      @last_action = [ :speak, data ]
    end

    def topic(data)
      @last_action = [ :topic, data ]
    end

    def subscribed?
      @subscribed
    end

    def get_latest
      transmit data: "latest"
    end

    def receive
      @last_action = [ :receive ]
    end

    private
      def rm_rf
        @last_action = [ :rm_rf ]
      end
  end

  setup do
    @user = User.new "lifo"
    @connection = TestConnection.new(@user)
    @channel = ChatChannel.new @connection, "{id: 1}", id: 1
  end

  test "should subscribe to a channel" do
    @channel.subscribe_to_channel
    assert_equal 1, @channel.room.id
  end

  test "on subscribe callbacks" do
    @channel.subscribe_to_channel
    assert @channel.subscribed
  end

  test "channel params" do
    assert_equal({ id: 1 }, @channel.params)
  end

  test "unsubscribing from a channel" do
    @channel.subscribe_to_channel

    assert @channel.room
    assert_predicate @channel, :subscribed?

    @channel.unsubscribe_from_channel

    assert_not @channel.room
    assert_not_predicate @channel, :subscribed?
  end

  test "connection identifiers" do
    assert_equal @user.name, @channel.current_user.name
  end

  test "callable action without any argument" do
    @channel.perform_action "action" => :leave
    assert_equal [ :leave ], @channel.last_action
  end

  test "callable action with arguments" do
    data = { "action" => :speak, "content" => "Hello World" }

    @channel.perform_action data
    assert_equal [ :speak, data ], @channel.last_action
  end

  test "should not dispatch a private method" do
    @channel.perform_action "action" => :rm_rf
    assert_nil @channel.last_action
  end

  test "should not dispatch a public method defined on Base" do
    @channel.perform_action "action" => :kick
    assert_nil @channel.last_action
  end

  test "should dispatch a public method defined on Base and redefined on channel" do
    data = { "action" => :topic, "content" => "This is Sparta!" }

    @channel.perform_action data
    assert_equal [ :topic, data ], @channel.last_action
  end

  test "should dispatch calling a public method defined in an ancestor" do
    @channel.perform_action "action" => :chatters
    assert_equal [ :chatters ], @channel.last_action
  end

  test "should dispatch receive action when perform_action is called with empty action" do
    data = { "content" => "hello" }
    @channel.perform_action data
    assert_equal [ :receive ], @channel.last_action
  end

  test "transmitting data" do
    @channel.perform_action "action" => :get_latest

    expected = { "identifier" => "{id: 1}", "message" => { "data" => "latest" } }
    assert_equal expected, @connection.last_transmission
  end

  test "do not send subscription confirmation on initialize" do
    assert_nil @connection.last_transmission
  end

  test "subscription confirmation on subscribe_to_channel" do
    expected = { "identifier" => "{id: 1}", "type" => "confirm_subscription" }
    @channel.subscribe_to_channel
    assert_equal expected, @connection.last_transmission
  end

  test "actions available on Channel" do
    available_actions = %w(room last_action subscribed unsubscribed toggle_subscribed leave speak subscribed? get_latest receive chatters topic).to_set
    assert_equal available_actions, ChatChannel.action_methods
  end

  test "invalid action on Channel" do
    assert_logged("Unable to process ActionCable::Channel::BaseTest::ChatChannel#invalid_action") do
      @channel.perform_action "action" => :invalid_action
    end
  end

  test "notification for perform_action" do
    begin
      events = []
      ActiveSupport::Notifications.subscribe "perform_action.action_cable" do |*args|
        events << ActiveSupport::Notifications::Event.new(*args)
      end

      data = { "action" => :speak, "content" => "hello" }
      @channel.perform_action data

      assert_equal 1, events.length
      assert_equal "perform_action.action_cable", events[0].name
      assert_equal "ActionCable::Channel::BaseTest::ChatChannel", events[0].payload[:channel_class]
      assert_equal :speak, events[0].payload[:action]
      assert_equal data, events[0].payload[:data]
    ensure
      ActiveSupport::Notifications.unsubscribe "perform_action.action_cable"
    end
  end

  test "notification for transmit" do
    begin
      events = []
      ActiveSupport::Notifications.subscribe "transmit.action_cable" do |*args|
        events << ActiveSupport::Notifications::Event.new(*args)
      end

      @channel.perform_action "action" => :get_latest
      expected_data = { data: "latest" }

      assert_equal 1, events.length
      assert_equal "transmit.action_cable", events[0].name
      assert_equal "ActionCable::Channel::BaseTest::ChatChannel", events[0].payload[:channel_class]
      assert_equal expected_data, events[0].payload[:data]
      assert_nil events[0].payload[:via]
    ensure
      ActiveSupport::Notifications.unsubscribe "transmit.action_cable"
    end
  end

  test "notification for transmit_subscription_confirmation" do
    begin
      @channel.subscribe_to_channel

      events = []
      ActiveSupport::Notifications.subscribe "transmit_subscription_confirmation.action_cable" do |*args|
        events << ActiveSupport::Notifications::Event.new(*args)
      end

      @channel.stub(:subscription_confirmation_sent?, false) do
        @channel.send(:transmit_subscription_confirmation)

        assert_equal 1, events.length
        assert_equal "transmit_subscription_confirmation.action_cable", events[0].name
        assert_equal "ActionCable::Channel::BaseTest::ChatChannel", events[0].payload[:channel_class]
      end
    ensure
      ActiveSupport::Notifications.unsubscribe "transmit_subscription_confirmation.action_cable"
    end
  end

  test "notification for transmit_subscription_rejection" do
    begin
      events = []
      ActiveSupport::Notifications.subscribe "transmit_subscription_rejection.action_cable" do |*args|
        events << ActiveSupport::Notifications::Event.new(*args)
      end

      @channel.send(:transmit_subscription_rejection)

      assert_equal 1, events.length
      assert_equal "transmit_subscription_rejection.action_cable", events[0].name
      assert_equal "ActionCable::Channel::BaseTest::ChatChannel", events[0].payload[:channel_class]
    ensure
      ActiveSupport::Notifications.unsubscribe "transmit_subscription_rejection.action_cable"
    end
  end

  private
    def assert_logged(message)
      old_logger = @connection.logger
      log = StringIO.new
      @connection.instance_variable_set(:@logger, Logger.new(log))

      begin
        yield

        log.rewind
        assert_match message, log.read
      ensure
        @connection.instance_variable_set(:@logger, old_logger)
      end
    end
end

redpajama_set_name: RedPajamaGithub


text:
"""
Copyright (c) 2004-Present Pivotal Software, Inc.

This program and the accompanying materials are made available under
the terms of the under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

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

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

import tinctest

import os,re

from mpp.models import SQLTestCase
from mpp.lib.PSQL import PSQL
from tinctest.lib import local_path, Gpdiff

MYD = os.path.abspath(os.path.dirname(__file__))

class OSSpecificSQLsTest(SQLTestCase):
    """

    @description This contains several test cases for possible ways of manipulating objects. This testcase specifically deals with OS specific SQLs -  sqls which require specific run-time changes to be made to them before execution  For more details refer QA task - QA-143
    @created 2009-01-27 14:00:00
    @modified 2013-10-17 17:10:15
    @tags ddl schema_topology
    """

    sql_dir = 'sqls/ddls/os_specific_ddls'
    ans_dir = 'sqls/ddls/os_specific_ddls'
    out_dir = 'sqls/ddls/os_specific_ddls'

    transformations = {
                'AS\s\'.+\',' : 'AS \''+MYD+'/'+sql_dir+'/funcs\',' ,
                'TO\s\'.+test1_file_copy\'' : 'TO \''+MYD+'/'+sql_dir+'/test1_file_copy\'' ,
                'TO\s\'.+test2_file_copy\'' : 'TO \''+MYD+'/'+sql_dir+'/test2_file_copy\'' ,
                'TO\s\'.+CO_all_types_file_copy\'' : 'TO \''+MYD+'/'+sql_dir+'/CO_all_types_file_copy\'' ,
                'FROM\s\'.+test1_file_copy\'' : 'FROM \''+MYD+'/'+sql_dir+'/test1_file_copy\'' ,
                'FROM\s\'.+test2_file_copy\'' : 'FROM \''+MYD+'/'+sql_dir+'/test2_file_copy\'' ,
                'FROM\s\'.+CO_all_types_file_copy\'' : 'FROM \''+MYD+'/'+sql_dir+'/CO_all_types_file_copy\''
             }

    os_name = os.uname()[0]
    if os_name == 'Darwin': #Mac
        transformations.__setitem__('schema_topology(\/\w+)*?\/funcs','schema_topology/Mac/funcs')
    else: #Linux/Solaris
        transformations.__setitem__('schema_topology(\/\w+)*?\/funcs','schema_topology/Linux_Solaris/funcs')

    @classmethod
    def setUpClass(cls):
        super(OSSpecificSQLsTest, cls).setUpClass()
        tinctest.logger.info("*** Running the pre-requisite sql files drop.sql and setup.sql")
        PSQL.run_sql_file(local_path('sqls/setup/drop.sql'))
        PSQL.run_sql_file(local_path('sqls/setup/create.sql'))

    @classmethod
    def get_out_dir(cls):
        # If the sqls are located in a different directory than the source file, create an output
        # directory at the same level as the sql dir
        if cls.get_source_dir() == cls.get_sql_dir():
            out_dir = os.path.join(cls.get_sql_dir(), 'output/OSSpecificSQLsTest/')
        else:
            out_dir = os.path.join(cls.get_sql_dir(), '../output/OSSpecificSQLsTest/')

        if not os.path.exists(out_dir):
            os.makedirs(out_dir)
        return out_dir

    def perform_transformation_on_sqlfile(self,input_filename, output_filename,transforms):
        with open(input_filename, 'r') as input:
            with open(output_filename, 'w') as output:
                for line in input.readlines():
                    for key,value in transforms.iteritems():
                        line = re.sub(key,value,line)
                    output.write(line)
        return output_filename

    def run_test(self):
        sql_file = self.sql_file
        ans_file = self.ans_file
        new_sql_file = sql_file + '.t'
        new_ans_file = ans_file + '.t'
        tinctest.logger.info("**** Performing the transformations...")
        tinctest.logger.info(self.transformations)
        self.sql_file = self.perform_transformation_on_sqlfile(sql_file, new_sql_file,self.transformations)
        self.ans_file = self.perform_transformation_on_sqlfile(ans_file, new_ans_file,self.transformations)
        return super(OSSpecificSQLsTest, self).run_test()
        tinctest.logger.info('***** Running the OS specific sql files...')


text:
package gov.cdc.epiinfo.interpreter.functions;

import gov.cdc.epiinfo.interpreter.EnterRule;
import gov.cdc.epiinfo.interpreter.Rule_Context;

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

import com.creativewidgetworks.goldparser.engine.Reduction;

public class Rule_SendSMS extends EnterRule
{
    private List<EnterRule> ParameterList = new ArrayList<EnterRule>();

    public Rule_SendSMS(Rule_Context pContext, Reduction pToken)

    {
    	super(pContext);
        this.ParameterList = EnterRule.GetFunctionParameters(pContext, pToken);
    }

    /// <summary>
    /// Executes the reduction.
    /// </summary>
    /// <returns>Returns the absolute value of two numbers.</returns>
    @Override
    public  Object Execute()
    {

            return null;

    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>de.dentrassi.kura.addons</groupId>
        <artifactId>kura-addons</artifactId>
        <version>0.7.1-SNAPSHOT</version>
    </parent>

    <artifactId>utils</artifactId>
    <packaging>pom</packaging>

    <name>Utility addons for Eclipse Kura™</name>
    <description>This project provides some utilties addons for Eclipse Kura</description>

    <modules>
        <module>de.dentrassi.kura.addons.utils.configadmin</module>
        <module>de.dentrassi.kura.addons.utils.fileinstall</module>
        <module>de.dentrassi.kura.addons.utils.jmx</module>
        <module>de.dentrassi.kura.addons.utils.jolokia</module>
    </modules>
</project>


text:
using System;

namespace SwfSharp.Actions
{
    [Serializable]
    public class ActionReturn : ActionBase
    {
        public ActionReturn()
            : base(ActionType.Return)
        {}
    }
}


text:
#ifndef __UPDATE_POSITION_LABEL_H__
#define __UPDATE_POSITION_LABEL_H__

#include <sstream>

#include "action/Action.h"
#include "singleton/GuiDescription.h"
#include "singleton/EventPosition.h"
#include "core/Point.h"

class UpdatePositionLabel : public Action {

  public:
    /*----------------------------------------------------------------------*/

    UpdatePositionLabel() {

      // get builder object
      Glib::RefPtr<Gtk::Builder> builder =
        GuiDescription::get_instance()->get_builder();

      this->positionLabel = Glib::RefPtr<Gtk::Label>::cast_dynamic(builder->get_object("positionLabel"));

    }

    /*----------------------------------------------------------------------*/

    virtual void execute() {

      // FIXME: Is this necessary?
      if( !EventPosition::get_instance()->is_valid() ) {
        // do nothing if the position is not valid
        return;
      }

      Point point = EventPosition::get_instance()->get();

      std::stringstream stream;

      stream << "( "
             << (int) point.get_canonical_x()
             << ", "
             << (int) point.get_canonical_y()
             << ", "
             << (int) point.get_canonical_z()
             << " )";

      this->positionLabel->set_text(stream.str());

    }

  /*----------------------------------------------------------------------*/

private:

  Glib::RefPtr<Gtk::Label> positionLabel;

};
#endif


text:
/*******************************************************************************
 * \file mission_handler_hold_position.cpp
 *
 * \author MAV'RIC Team
 * \author Matthew Douglas
 * \author Julien Lecoeur
 *
 * \brief The mission handler functions for the hold position state
 *
 ******************************************************************************/

#include "mission/mission_handler_hold_position.hpp"

Mission_handler_hold_position::Mission_handler_hold_position(const INS& ins):
    Mission_handler(),
    ins_(ins)
{
    waypoint_ = Waypoint(   MAV_FRAME_LOCAL_NED,
                            MAV_CMD_NAV_LOITER_UNLIM,
                            0,
                            0.0f,
                            0.0f,
                            0.0f,
                            0.0f,
                            0.0f,
                            0.0f,
                            0.0f);
}

bool Mission_handler_hold_position::can_handle(const Waypoint& wpt) const
{
    bool handleable = false;

    uint16_t cmd = wpt.command();
    if (cmd == MAV_CMD_NAV_LOITER_UNLIM ||
        cmd == MAV_CMD_NAV_LOITER_TIME  ||
        cmd == MAV_CMD_NAV_LOITER_TO_ALT ||
        (cmd == MAV_CMD_OVERRIDE_GOTO && wpt.param1() == MAV_GOTO_DO_HOLD))
    {
        handleable = true;
    }

    return handleable;
}

bool Mission_handler_hold_position::setup(const Waypoint& wpt)
{
    bool success = true;
    waypoint_ = wpt;
    start_time_ = time_keeper_get_ms();
    within_radius_ = false;

    return success;
}

Mission_handler::update_status_t Mission_handler_hold_position::update()
{
    /*******************
    Determine status code
    ********************/
    // Determine if we have entered the hold position volume
    local_position_t wpt_pos = waypoint_.local_pos();

    float radius;
    if (!waypoint_.radius(radius))
    {
        radius = 0.0f;
    }

    // Check that we are at the waypoint
    else if (((wpt_pos[X]-ins_.position_lf()[X])*(wpt_pos[X]-ins_.position_lf()[X]) + (wpt_pos[Y]-ins_.position_lf()[Y])*(wpt_pos[Y]-ins_.position_lf()[Y])) < radius*radius)
    {
        within_radius_ = true;
    }
    else
    {
        within_radius_ = false;

        // Reset start time
        start_time_ = time_keeper_get_ms();
    }

    // Determine if we should advance to the next waypoint
    if (waypoint_.autocontinue() == 1)
    {
        switch (waypoint_.command())
        {
        case MAV_CMD_NAV_LOITER_UNLIM:
            break;

        case MAV_CMD_NAV_LOITER_TIME:
            if (within_radius_ && ((time_keeper_get_ms() - start_time_) > waypoint_.param1() * 1000))
            {
                return MISSION_FINISHED;
            }
            break;

        case MAV_CMD_NAV_LOITER_TO_ALT:
            if (maths_f_abs(ins_.position_lf()[Z] - waypoint_.local_pos()[Z]) < waypoint_.param2()) // TODO: Add check for heading
            {
                return MISSION_FINISHED;
            }
            break;

        case MAV_CMD_OVERRIDE_GOTO:
            return MISSION_FINISHED;
        }
    }

    return MISSION_IN_PROGRESS;
}

Mission_planner::internal_state_t Mission_handler_hold_position::handler_mission_state() const
{
    return Mission_planner::MISSION;
}

bool Mission_handler_hold_position::write_flight_command(Flight_controller& flight_controller) const
{
	position_command_t cmd;

    // Set heading and position fram waypoint
    float heading = 0.0f;
    waypoint_.heading(heading);
    cmd.xyz     = waypoint_.local_pos();
	cmd.heading = heading;

    return flight_controller.set_command(cmd);
}


text:
from idq.helpers import WorkflowBase, CombinedWorkflow, filled, field_to_flag

from projection import Projection
from convert import Conversion
from reverse_geocode import ReverseGeocode

class GeoWorkflow(CombinedWorkflow):
    def __init__(self):
        super(GeoWorkflow,self).__init__([
            Conversion(),
            Projection(),
            ReverseGeocode()
        ])

    def process(self,d):
        r = super(GeoWorkflow,self).process(d)
        print r
        return r


text:
module.exports = require('./dist/base64url').default;
module.exports.default = module.exports;


text:
<?php

namespace Brickoo\Component\Routing\Route\Collector;

use Brickoo\Component\Common\Collection;
use Brickoo\Component\Validation\Constraint\ContainsInstancesOfConstraint;

/**
 * CallbackRouteCollector
 *
 * Implementation of a route collection based on callback call.
 * @author Celestino Diaz <celestino.diaz@gmx.de>
 */
class CallbackRouteCollector implements RouteCollector {

    /** @var callable */
    private $callback;

    /**
     * Class constructor.
     * @param callable $callback the callback must return a list of route collections
     */
    public function __construct(callable $callback) {
        $this->callback = $callback;
    }

    /** {@inheritDoc} */
    public function collect() {
        $collection = new Collection();
        if (($routeCollections = call_user_func($this->callback))
            && is_array($routeCollections)
            && (new ContainsInstancesOfConstraint("\\Brickoo\\Component\\Routing\\Route\\RouteCollection"))->matches($routeCollections)) {
                $collection->fromArray($routeCollections);
        }
        return $collection;
    }

}


text:
package extractor

import (
	"errors"
	"strconv"
	"strings"

	"qiniupkg.com/text/tpl.v1"
)

/* -----------------------------------------------------------------------------

leafMark = xxx_Int | xxx_Float | xxx_String | xxx_Text | xxx_Char | xxx_Bool
leafArrayMark = xxx_Ints | xxx_Floats | ... | xxx_Bools
leafArrayMark = xxx_IntArray | xxx_FloatArray | ... | xxx_BoolArray
nodeMark = xxx_Node
nodeArrayMark = xxx_NodeArray

// ---------------------------------------------------------------------------*/

func GetValue(typ string, lit string) interface{} {

	switch typ {
	case "String":
		v, err := strconv.Unquote(lit)
		if err != nil {
			panic(err)
		}
		return v
	case "Int":
		v, err := strconv.ParseInt(lit, 10, 64)
		if err != nil {
			panic(err)
		}
		return v
	case "Float":
		v, err := strconv.ParseFloat(lit, 64)
		if err != nil {
			panic(err)
		}
		return v
	case "Char":
		v, multibyte, tail, err := strconv.UnquoteChar(lit[1:len(lit)-1], '\'')
		if err != nil {
			panic(err)
		}
		if tail != "" || multibyte {
			panic("invalid char: " + lit)
		}
		return byte(v)
	case "Text":
		return lit
	}
	panic("unsupported type: " + typ)
}

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

type Options struct {
	Scanner  tpl.Tokener
	ScanMode tpl.ScanMode
	GetValue func(typ string, lit string) interface{}
}

type Engine struct {
	*tpl.CompileRet
	doc Node
	stk *Node
}

var (
	optionsDef Options
)

var (
	InsertSemis = &Options{ScanMode: tpl.InsertSemis}
)

func New(grammar interface{}, options *Options) (p *Engine, err error) {

	if options == nil {
		options = &optionsDef
	}

	p = new(Engine)
	compiler := new(tpl.Compiler)

	initer := func() {
		p.doc.clear()
		p.stk = &p.doc
	}
	getValue := options.GetValue
	if getValue == nil {
		getValue = GetValue
	}
	marker := func(g tpl.Grammar, mark string) tpl.Grammar {
		markOld := mark
		isArray := false
		if strings.HasSuffix(mark, "s") {
			mark, isArray = mark[:len(mark)-1], true
		} else if strings.HasSuffix(mark, "Array") {
			mark, isArray = mark[:len(mark)-5], true
		}
		pos := strings.LastIndex(mark, "_")
		if pos < 0 {
			panic("invalid mark: " + markOld)
		}
		typ := mark[pos+1:]
		mark = mark[:pos]
		if typ != "Node" {
			return tpl.Action(g, func(tokens []tpl.Token, g tpl.Grammar) {
				p.stk.insertLeaf(mark, getValue(typ, tokens[0].Literal), isArray)
			})
		}
		return tpl.Transaction(g, func() interface{} {
			stk := p.stk
			trans := &transCtx{stk: stk, hd: stk.hd}
			p.stk = stk.insertNode(mark, isArray)
			return trans
		}, func(ctx interface{}, err error) {
			trans := ctx.(*transCtx)
			p.stk = trans.stk
			if err != nil {
				p.stk.hd = trans.hd
			}
		})
	}

	switch g := grammar.(type) {
	case string:
		compiler.Grammar = []byte(g)
	case []byte:
		compiler.Grammar = g
	default:
		panic("invalid grammar type")
	}
	compiler.Scanner = options.Scanner
	compiler.ScanMode = options.ScanMode
	compiler.Marker = marker
	compiler.Init = initer
	ret, err := compiler.Cl()
	if err != nil {
		return
	}

	p.CompileRet = &ret
	return
}

type transCtx struct {
	stk *Node
	hd  *Cons
}

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

func (p *Engine) Result() map[string]interface{} {

	return p.doc.toMap()
}

func (p *Engine) Parse(code []byte, fname string) (doc map[string]interface{}, err error) {

	err = p.MatchExactly(code, fname)
	if err != nil {
		return
	}
	return p.doc.toMap(), nil
}

func (p *Engine) SafeParse(code []byte, fname string) (doc map[string]interface{}, err error) {

	defer func() {
		if e := recover(); e != nil {
			switch v := e.(type) {
			case string:
				err = errors.New(v)
			case error:
				err = v
			default:
				panic(e)
			}
		}
	}()

	err = p.MatchExactly(code, fname)
	if err != nil {
		return
	}
	return p.doc.toMap(), nil
}

func (p *Engine) Extract(src string) (doc map[string]interface{}, err error) {

	return p.SafeParse([]byte(src), "")
}

func (p *Engine) SafeExtract(src string) (doc map[string]interface{}, err error) {

	return p.SafeParse([]byte(src), "")
}

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


text:
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

import unittest

from pants.help.help_formatter import HelpFormatter
from pants.help.help_info_extracter import OptionHelpInfo

class OptionHelpFormatterTest(unittest.TestCase):
  def format_help_for_foo(self, **kwargs):
    ohi = OptionHelpInfo(registering_class=type(None), display_args=['--foo'],
                         scoped_cmd_line_args=['--foo'], unscoped_cmd_line_args=['--foo'],
                         typ=bool, fromfile=False, default=None, help='help for foo',
                         deprecated_version=None, deprecated_message=None, deprecated_hint=None)
    ohi = ohi._replace(**kwargs)
    lines = HelpFormatter(scope='', show_recursive=False, show_advanced=False,
                          color=False).format_option(ohi)
    self.assertEquals(len(lines), 2)
    self.assertIn('help for foo', lines[1])
    return lines[0]

  def test_format_help(self):
    line = self.format_help_for_foo(default='MYDEFAULT')
    self.assertEquals('--foo (default: MYDEFAULT)', line)

  def test_format_help_fromfile(self):
    line = self.format_help_for_foo(fromfile=True)
    self.assertEquals('--foo (@fromfile value supported) (default: None)', line)

  def test_suppress_advanced(self):
    args = ['--foo']
    kwargs = {'advanced': True}
    lines = HelpFormatter(scope='', show_recursive=False, show_advanced=False,
                          color=False).format_options('', '', [(args, kwargs)])
    self.assertEquals(0, len(lines))
    lines = HelpFormatter(scope='', show_recursive=True, show_advanced=True,
                          color=False).format_options('', '', [(args, kwargs)])
    print(lines)
    self.assertEquals(5, len(lines))


text:
package org.apache.gobblin.converter.avro;

import org.apache.avro.Schema;
import org.apache.avro.generic.GenericRecord;

import org.apache.gobblin.configuration.WorkUnitState;
import org.apache.gobblin.converter.Converter;
import org.apache.gobblin.converter.DataConversionException;
import org.apache.gobblin.converter.SchemaConversionException;
import org.apache.gobblin.converter.SingleRecordIterable;
import org.apache.gobblin.fork.CopyableGenericRecord;
import org.apache.gobblin.fork.CopyableSchema;

/**
 * Implementation of {@link Converter} that takes in an Avro {@link Schema} and {@link GenericRecord} and returns a
 * {@link org.apache.gobblin.fork.CopyableSchema} and a {@link org.apache.gobblin.fork.CopyableGenericRecord}.
 */
public class AvroToAvroCopyableConverter extends
    Converter<Schema, CopyableSchema, GenericRecord, CopyableGenericRecord> {

  /**
   * Returns a {@link org.apache.gobblin.fork.CopyableSchema} wrapper around the given {@link Schema}.
   * {@inheritDoc}
   * @see org.apache.gobblin.converter.Converter#convertSchema(java.lang.Object, org.apache.gobblin.configuration.WorkUnitState)
   */
  @Override
  public CopyableSchema convertSchema(Schema inputSchema, WorkUnitState workUnit) throws SchemaConversionException {
    return new CopyableSchema(inputSchema);
  }

  /**
   * Returns a {@link org.apache.gobblin.fork.CopyableGenericRecord} wrapper around the given {@link GenericRecord}.
   * {@inheritDoc}
   * @see org.apache.gobblin.converter.Converter#convertRecord(java.lang.Object, java.lang.Object, org.apache.gobblin.configuration.WorkUnitState)
   */
  @Override
  public Iterable<CopyableGenericRecord> convertRecord(CopyableSchema outputSchema, GenericRecord inputRecord,
      WorkUnitState workUnit) throws DataConversionException {
    return new SingleRecordIterable<>(new CopyableGenericRecord(inputRecord));
  }
}


text:
package org.apache.hadoop.hbase.client;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;

import org.apache.hadoop.hbase.HBaseClusterTestCase;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.io.BatchUpdate;
import org.apache.hadoop.hbase.io.Cell;
import org.apache.hadoop.hbase.io.RowResult;
import org.apache.hadoop.hbase.util.Bytes;

/**
 * Test puts
 */
public class TestPut extends HBaseClusterTestCase {
  private static final byte [] CONTENTS_FAMILY = Bytes.toBytes("contents");
  private static final byte [] SMALL_FAMILY = Bytes.toBytes("smallfam");

  private static final byte [] row1 = Bytes.toBytes("row1");
  private static final byte [] row2 = Bytes.toBytes("row2");

  private static final int SMALL_LENGTH = 1;
  private static final int NB_BATCH_ROWS = 10;
  private byte [] value;
  private byte [] smallValue;

  private HTableDescriptor desc = null;
  private HTable table = null;

  /**
   * @throws UnsupportedEncodingException
   */
  public TestPut() throws UnsupportedEncodingException {
    super();
    value = Bytes.toBytes("abcd");
    smallValue = Bytes.toBytes("a");
  }

  @Override
  public void setUp() throws Exception {
    super.setUp();
    this.desc = new HTableDescriptor("test");
    desc.addFamily(new HColumnDescriptor(CONTENTS_FAMILY));
    desc.addFamily(new HColumnDescriptor(SMALL_FAMILY,
        HColumnDescriptor.DEFAULT_VERSIONS,
        HColumnDescriptor.DEFAULT_COMPRESSION,
        HColumnDescriptor.DEFAULT_IN_MEMORY,
        HColumnDescriptor.DEFAULT_BLOCKCACHE, SMALL_LENGTH,
        HColumnDescriptor.DEFAULT_TTL, HColumnDescriptor.DEFAULT_BLOOMFILTER));
    HBaseAdmin admin = new HBaseAdmin(conf);
    admin.createTable(desc);
    table = new HTable(conf, desc.getName());
  }

  /**
   * @throws IOException
   */
  public void testPut() throws IOException {

    Put put = new Put(row1);
    put.add(CONTENTS_FAMILY, null, value);
    table.put(put);

    put = new Put(row2);
    put.add(CONTENTS_FAMILY, null, value);

    assertEquals(put.size(), 1);
    assertEquals(put.getFamilyMap().get(CONTENTS_FAMILY).size(), 1);

    KeyValue kv = put.getFamilyMap().get(CONTENTS_FAMILY).get(0);

    assertTrue(Bytes.equals(kv.getFamily(), CONTENTS_FAMILY));
    // will it return null or an empty byte array?
    assertTrue(Bytes.equals(kv.getQualifier(), new byte[0]));

    assertTrue(Bytes.equals(kv.getValue(), value));

    table.put(put);

    Scan scan = new Scan();
    scan.addColumn(CONTENTS_FAMILY, null);
    ResultScanner scanner = table.getScanner(scan);
    for (Result r : scanner) {
      for(KeyValue key : r.sorted()) {
        System.out.println(Bytes.toString(r.getRow()) + ": " + key.toString());
      }
    }
  }

  public void testRowsPut() {
    ArrayList<Put> rowsUpdate = new ArrayList<Put>();
    for(int i = 0; i < NB_BATCH_ROWS; i++) {
      byte [] row = Bytes.toBytes("row" + i);
      Put put = new Put(row);
      put.add(CONTENTS_FAMILY, null, value);
      rowsUpdate.add(put);
    }
    try {
      table.put(rowsUpdate);

      Scan scan = new Scan();
      scan.addFamily(CONTENTS_FAMILY);
      ResultScanner scanner = table.getScanner(scan);
      int nbRows = 0;
      for(@SuppressWarnings("unused") Result row : scanner)
        nbRows++;
      assertEquals(NB_BATCH_ROWS, nbRows);
    } catch (IOException e) {
      fail("This is unexpected : " + e);
    }
  }

  public void testRowsPutBufferedOneFlush() {
    table.setAutoFlush(false);
    ArrayList<Put> rowsUpdate = new ArrayList<Put>();
    for(int i = 0; i < NB_BATCH_ROWS*10; i++) {
      byte [] row = Bytes.toBytes("row" + i);
      Put put = new Put(row);
      put.add(CONTENTS_FAMILY, null, value);
      rowsUpdate.add(put);
    }
    try {
      table.put(rowsUpdate);

      Scan scan = new Scan();
      scan.addFamily(CONTENTS_FAMILY);
      ResultScanner scanner = table.getScanner(scan);
      int nbRows = 0;
      for(@SuppressWarnings("unused") Result row : scanner)
        nbRows++;
      assertEquals(0, nbRows);
      scanner.close();

      table.flushCommits();

      scan = new Scan();
      scan.addFamily(CONTENTS_FAMILY);
      scanner = table.getScanner(scan);
      nbRows = 0;
      for(@SuppressWarnings("unused") Result row : scanner)
        nbRows++;
      assertEquals(NB_BATCH_ROWS*10, nbRows);
    } catch (IOException e) {
      fail("This is unexpected : " + e);
    }
  }

  public void testRowsPutBufferedManyManyFlushes() {
    table.setAutoFlush(false);
    table.setWriteBufferSize(10);
    ArrayList<Put> rowsUpdate = new ArrayList<Put>();
    for(int i = 0; i < NB_BATCH_ROWS*10; i++) {
      byte [] row = Bytes.toBytes("row" + i);
      Put put = new Put(row);
      put.add(CONTENTS_FAMILY, null, value);
      rowsUpdate.add(put);
    }
    try {
      table.put(rowsUpdate);

      table.flushCommits();

      Scan scan = new Scan();
      scan.addFamily(CONTENTS_FAMILY);
      ResultScanner scanner = table.getScanner(scan);
      int nbRows = 0;
      for(@SuppressWarnings("unused") Result row : scanner)
        nbRows++;
      assertEquals(NB_BATCH_ROWS*10, nbRows);
    } catch (IOException e) {
      fail("This is unexpected : " + e);
    }
  }

}


text:
var fs = require('fs');
var spawn = require('child_process').spawn;

var PREFS =
    'user_pref("browser.shell.checkDefaultBrowser", false);\n' +
    'user_pref("browser.bookmarks.restore_default_bookmarks", false);\n' +
    'user_pref("dom.disable_open_during_load", false);\n' +
    'user_pref("dom.max_script_run_time", 0);\n';

// Return location of firefox.exe file for a given Firefox directory
// (available: "Mozilla Firefox", "Aurora", "Nightly").
var getFirefoxExe = function(firefoxDirName) {
  if (process.platform !== 'win32') {
    return null;
  }

  var prefix;
  var prefixes = [process.env.PROGRAMFILES, process.env['PROGRAMFILES(X86)']];
  var suffix = '\\'+ firefoxDirName + '\\firefox.exe';

  for (var i = 0; i < prefixes.length; i++) {
    prefix = prefixes[i];
    if (fs.existsSync(prefix + suffix)) {
      return prefix + suffix;
    }
  }

  return 'C:\\Program Files' + suffix;
}

var getFirefoxWithFallbackOnOSX = function() {
  if (process.platform !== 'darwin') {
    return null;
  }

  var firefoxDirNames = Array.prototype.slice.call(arguments);

  var prefix = '/Applications/';
  var suffix = '.app/Contents/MacOS/firefox-bin';

  var path;
  for (var i = 0; i < firefoxDirNames.length; i++) {
    path = prefix + firefoxDirNames[i] + suffix;
    if (fs.existsSync(path)) {
      return path;
    }
  }
};

// https://developer.mozilla.org/en-US/docs/Command_Line_Options
var FirefoxBrowser = function(id, baseBrowserDecorator, args, logger) {
  baseBrowserDecorator(this);

  var log = logger.create('launcher');
  this._getPrefs = function(prefs) {
    if (typeof prefs !== 'object') {
      return PREFS;
    }
    var result = PREFS;
    for (var key in prefs) {
      result += 'user_pref("' + key + '", ' + JSON.stringify(prefs[key]) + ');\n';
    }
    return result;
  }

  this._start = function(url) {
    var self = this;
    var command = this._getCommand();

    fs.writeFileSync(self._tempDir + '/prefs.js', this._getPrefs(args.prefs));
    self._execCommand(command, [url, '-profile', self._tempDir, '-no-remote']);
  };
};

FirefoxBrowser.prototype = {
  name: 'Firefox',

  DEFAULT_CMD: {
    linux: 'firefox',
    darwin: '/Applications/Firefox.app/Contents/MacOS/firefox-bin',
    win32: getFirefoxExe('Mozilla Firefox')
  },
  ENV_CMD: 'FIREFOX_BIN'
};

FirefoxBrowser.$inject = ['id', 'baseBrowserDecorator', 'args', 'logger'];

var FirefoxDeveloperBrowser = function() {
  FirefoxBrowser.apply(this, arguments);
};

FirefoxDeveloperBrowser.prototype = {
  name: 'FirefoxDeveloper',
  DEFAULT_CMD: {
    linux: 'firefox',
    darwin: getFirefoxWithFallbackOnOSX('FirefoxDeveloperEdition', 'FirefoxAurora'),
    win32: getFirefoxExe('Firefox Developer Edition')
  },
  ENV_CMD: 'FIREFOX_DEVELOPER_BIN'
};

FirefoxDeveloperBrowser.$inject = ['id', 'baseBrowserDecorator', 'args', 'logger'];

var FirefoxAuroraBrowser = function() {
  FirefoxBrowser.apply(this, arguments);
};

FirefoxAuroraBrowser.prototype = {
  name: 'FirefoxAurora',
  DEFAULT_CMD: {
    linux: 'firefox',
    darwin: '/Applications/FirefoxAurora.app/Contents/MacOS/firefox-bin',
    win32: getFirefoxExe('Aurora')
  },
  ENV_CMD: 'FIREFOX_AURORA_BIN'
};

FirefoxAuroraBrowser.$inject = ['id', 'baseBrowserDecorator', 'args', 'logger'];

var FirefoxNightlyBrowser = function() {
  FirefoxBrowser.apply(this, arguments);
};

FirefoxNightlyBrowser.prototype = {
  name: 'FirefoxNightly',

  DEFAULT_CMD: {
    linux: 'firefox',
    darwin: '/Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin',
    win32: getFirefoxExe('Nightly')
  },
  ENV_CMD: 'FIREFOX_NIGHTLY_BIN'
};

FirefoxNightlyBrowser.$inject = ['id', 'baseBrowserDecorator', 'args', 'logger'];

// PUBLISH DI MODULE
module.exports = {
  'launcher:Firefox': ['type', FirefoxBrowser],
  'launcher:FirefoxDeveloper': ['type', FirefoxDeveloperBrowser],
  'launcher:FirefoxAurora': ['type', FirefoxAuroraBrowser],
  'launcher:FirefoxNightly': ['type', FirefoxNightlyBrowser]
};


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('transcripts', '0002_transcriptpage_updated_at'),
    ]

    operations = [
        migrations.AddField(
            model_name='transcriptpage',
            name='image_url',
            field=models.TextField(blank=True, null=True),
        ),
    ]


text:
[Home](./index.md) > [sip.js](./sip.js.md) > [SubscribeUserAgentClient](./sip.js.subscribeuseragentclient.md) > [waitNotifyStop](./sip.js.subscribeuseragentclient.waitnotifystop.md)

## SubscribeUserAgentClient.waitNotifyStop() method

Signature:

```typescript
waitNotifyStop(): void;
```
Returns:

void


text:
../umison --generate-custom-interface rapidjson -i riot_games.xml -e riot_games.h -p riot_games.cpp

g++ -g -I../../rapidjson/include -o riot_games main.cpp riot_games.cpp

./riot_games

# AFL_HARDEN=1 afl-g++ -O3 -fPIC -I../../rapidjson/include -o riot_games_afl afl_main.cpp riot_games.cpp


text:
from django.contrib import admin
from solution.models import Coin

class CoinAdmin(admin.ModelAdmin):
    pass

admin.site.register(Coin, CoinAdmin)


text:
using Questionnaire.Data.Attributes;
using Questionnaire.Serialization.Attributes;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Questionnaire.Data.Model.QuestionDefinition
{
    [SurveyType("comment")]
    [Table("QuestionBases_Comment")]
    public class Comment : QuestionBase
    {
        public int rows { get; set; } = 4;

        public bool ShouldSerializerows()
        {
            return this.rows != 4;
        }

        public int cols { get; set; } = 50;

        public bool ShouldSerializecols()
        {
            return this.cols != 50;
        }

        [MaxLength(256)]
        [LocalizableProperty()]
        public string placeHolder { get; set; }

        public bool ShouldSerializeplaceHolder()
        {
            return !string.IsNullOrEmpty(this.placeHolder);
        }

        public override void Visit(IVisitor visitor)
        {
            base.Visit(visitor);
            visitor.Visit(this);
        }
    }
}


text:
package client

import (
	"crypto/tls"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"time"

	"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
	"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
	"github.com/golang/glog"
)

// Interface holds the methods for clients of Kubenetes,
// an interface to allow mock testing.
type Interface interface {
	ListPods(selector labels.Selector) (api.PodList, error)
	GetPod(name string) (api.Pod, error)
	DeletePod(name string) error
	CreatePod(api.Pod) (api.Pod, error)
	UpdatePod(api.Pod) (api.Pod, error)

	GetReplicationController(name string) (api.ReplicationController, error)
	CreateReplicationController(api.ReplicationController) (api.ReplicationController, error)
	UpdateReplicationController(api.ReplicationController) (api.ReplicationController, error)
	DeleteReplicationController(string) error

	GetService(name string) (api.Service, error)
	CreateService(api.Service) (api.Service, error)
	UpdateService(api.Service) (api.Service, error)
	DeleteService(string) error
}

// StatusErr might get returned from an api call if your request is still being processed
// and hence the expected return data is not available yet.
type StatusErr struct {
	Status api.Status
}

func (s *StatusErr) Error() string {
	return fmt.Sprintf("Status: %v (%#v)", s.Status.Status, s.Status)
}

// AuthInfo is used to store authorization information
type AuthInfo struct {
	User     string
	Password string
}

// Client is the actual implementation of a Kubernetes client.
// Host is the http://... base for the URL
type Client struct {
	host       string
	auth       *AuthInfo
	httpClient *http.Client
	Sync       bool
	PollPeriod time.Duration
	Timeout    time.Duration
}

// New creates a new client object.
func New(host string, auth *AuthInfo) *Client {
	return &Client{
		auth: auth,
		host: host,
		httpClient: &http.Client{
			Transport: &http.Transport{
				TLSClientConfig: &tls.Config{
					InsecureSkipVerify: true,
				},
			},
		},
		Sync:       false,
		PollPeriod: time.Second * 20,
		Timeout:    time.Second * 20,
	}
}

// Execute a request, adds authentication (if auth != nil), and HTTPS cert ignoring.
func (c *Client) doRequest(request *http.Request) ([]byte, error) {
	if c.auth != nil {
		request.SetBasicAuth(c.auth.User, c.auth.Password)
	}
	response, err := c.httpClient.Do(request)
	if err != nil {
		return nil, err
	}
	defer response.Body.Close()
	body, err := ioutil.ReadAll(response.Body)
	if err != nil {
		return body, err
	}

	// Did the server give us a status response?
	isStatusResponse := false
	var status api.Status
	if err := api.DecodeInto(body, &status); err == nil && status.Status != "" {
		isStatusResponse = true
	}

	switch {
	case response.StatusCode == http.StatusConflict:
		// Return error given by server, if there was one.
		if isStatusResponse {
			return nil, &StatusErr{status}
		}
		fallthrough
	case response.StatusCode < http.StatusOK || response.StatusCode > http.StatusPartialContent:
		return nil, fmt.Errorf("request [%#v] failed (%d) %s: %s", request, response.StatusCode, response.Status, string(body))
	}

	// If the server gave us a status back, look at what it was.
	if isStatusResponse && status.Status != api.StatusSuccess {
		// "Working" requests need to be handled specially.
		// "Failed" requests are clearly just an error and it makes sense to return them as such.
		return nil, &StatusErr{status}
	}
	return body, err
}

// Underlying base implementation of performing a request.
// method is the HTTP method (e.g. "GET")
// path is the path on the host to hit
// requestBody is the body of the request. Can be nil.
// target the interface to marshal the JSON response into.  Can be nil.
func (c *Client) rawRequest(method, path string, requestBody io.Reader, target interface{}) ([]byte, error) {
	request, err := http.NewRequest(method, c.makeURL(path), requestBody)
	if err != nil {
		return nil, err
	}
	body, err := c.doRequest(request)
	if err != nil {
		return body, err
	}
	if target != nil {
		err = api.DecodeInto(body, target)
	}
	if err != nil {
		glog.Infof("Failed to parse: %s\n", string(body))
		// FIXME: no need to return err here?
	}
	return body, err
}

func (c *Client) makeURL(path string) string {
	return c.host + "/api/v1beta1/" + path
}

// ListPods takes a selector, and returns the list of pods that match that selector
func (c *Client) ListPods(selector labels.Selector) (result api.PodList, err error) {
	err = c.Get().Path("pods").Selector(selector).Do().Into(&result)
	return
}

// GetPod takes the name of the pod, and returns the corresponding Pod object, and an error if it occurs
func (c *Client) GetPod(name string) (result api.Pod, err error) {
	err = c.Get().Path("pods").Path(name).Do().Into(&result)
	return
}

// DeletePod takes the name of the pod, and returns an error if one occurs
func (c *Client) DeletePod(name string) error {
	return c.Delete().Path("pods").Path(name).Do().Error()
}

// CreatePod takes the representation of a pod.  Returns the server's representation of the pod, and an error, if it occurs
func (c *Client) CreatePod(pod api.Pod) (result api.Pod, err error) {
	err = c.Post().Path("pods").Body(pod).Do().Into(&result)
	return
}

// UpdatePod takes the representation of a pod to update.  Returns the server's representation of the pod, and an error, if it occurs
func (c *Client) UpdatePod(pod api.Pod) (result api.Pod, err error) {
	err = c.Put().Path("pods").Path(pod.ID).Body(pod).Do().Into(&result)
	return
}

// GetReplicationController returns information about a particular replication controller
func (c *Client) GetReplicationController(name string) (result api.ReplicationController, err error) {
	err = c.Get().Path("replicationControllers").Path(name).Do().Into(&result)
	return
}

// CreateReplicationController creates a new replication controller
func (c *Client) CreateReplicationController(controller api.ReplicationController) (result api.ReplicationController, err error) {
	err = c.Post().Path("replicationControllers").Body(controller).Do().Into(&result)
	return
}

// UpdateReplicationController updates an existing replication controller
func (c *Client) UpdateReplicationController(controller api.ReplicationController) (result api.ReplicationController, err error) {
	err = c.Put().Path("replicationControllers").Path(controller.ID).Body(controller).Do().Into(&result)
	return
}

// DeleteReplicationController deletes an existing replication controller.
func (c *Client) DeleteReplicationController(name string) error {
	return c.Delete().Path("replicationControllers").Path(name).Do().Error()
}

// GetService returns information about a particular service.
func (c *Client) GetService(name string) (result api.Service, err error) {
	err = c.Get().Path("services").Path(name).Do().Into(&result)
	return
}

// CreateService creates a new service.
func (c *Client) CreateService(svc api.Service) (result api.Service, err error) {
	err = c.Post().Path("services").Body(svc).Do().Into(&result)
	return
}

// UpdateService updates an existing service.
func (c *Client) UpdateService(svc api.Service) (result api.Service, err error) {
	err = c.Put().Path("services").Path(svc.ID).Body(svc).Do().Into(&result)
	return
}

// DeleteService deletes an existing service.
func (c *Client) DeleteService(name string) error {
	return c.Delete().Path("services").Path(name).Do().Error()
}


text:
@-webkit-keyframes -anim-loading-keyframes {
  from {
    background-position: 0 0; }

  to {
    background-position: 52px 52px; } }

@-moz-keyframes -anim-loading-keyframes {
  from {
    background-position: 0 0; }

  to {
    background-position: 52px 52px; } }

@keyframes -anim-loading-keyframes {
  from {
    background-position: 0 0; }

  to {
    background-position: 52px 52px; } }

.-anim-loading, ._loading_.-dropdown .-dropdown-header:before {
  -webkit-animation: -anim-loading-keyframes 1000ms linear both;
  -webkit-animation-play-state: paused;
  -moz-animation: -anim-loading-keyframes 1000ms linear both;
  -moz-animation-play-state: paused;
  -o-animation: -anim-loading-keyframes 1000ms linear both;
  -o-animation-play-state: paused;
  animation: -anim-loading-keyframes 1000ms linear both;
  animation-play-state: paused;
  animation-iteration-count: infinite;
  -webkit-animation-iteration-count: infinite;
  -moz-animation-iteration-count: infinite;
  -o-animation-iteration-count: infinite; }
  .-anim-loading._anim-start_, ._loading_.-dropdown ._anim-start_.-dropdown-header:before, ._loading_._anim-start_.-dropdown .-dropdown-header:before {
    -webkit-animation-play-state: running;
    -moz-animation-play-state: running;
    -o-animation-play-state: running;
    animation-play-state: running; }

.-dropdown {
  -webkit-box-sizing: content-box;
  -moz-box-sizing: content-box;
  box-sizing: content-box;
  display: inline-block;
  outline: none;
  vertical-align: middle; }

.-dropdown {
  -webkit-box-sizing: content-box;
  -moz-box-sizing: content-box;
  box-sizing: content-box;
  display: inline-block;
  outline: none;
  vertical-align: middle; }

  ._tiny.-dropdown:before {
    border-width: 4px;
    border-style: solid; }
  ._small.-dropdown:before {
    border-width: 4.66667px;
    border-style: solid; }
  ._minor.-dropdown:before, .-dropdown:before {
    border-width: 5.33333px;
    border-style: solid; }
  ._normal.-dropdown:before {
    border-width: 8px;
    border-style: solid; }
  ._major.-dropdown:before {
    border-width: 10.66667px;
    border-style: solid; }
  ._big.-dropdown:before {
    border-width: 13.33333px;
    border-style: solid; }
  ._huge.-dropdown:before {
    border-width: 16px;
    border-style: solid; }
  ._giant.-dropdown:before {
    border-width: 20px;
    border-style: solid; }
  ._divine.-dropdown:before {
    border-width: 26px;
    border-style: solid; }
  .default._top_.-dropdown:before, ._top_.-dropdown:before {
    border-left-color: transparent;
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-top-color: #cdcdcd; }
  .default._bottom_.-dropdown:before, ._bottom_.-dropdown:before {
    border-left-color: transparent;
    border-right-color: transparent;
    border-top-color: transparent;
    border-bottom-color: #cdcdcd; }
  .default._right_.-dropdown:before, ._right_.-dropdown:before {
    border-left-color: transparent;
    border-bottom-color: transparent;
    border-top-color: transparent;
    border-right-color: #cdcdcd; }
  .default._left_.-dropdown:before, ._left_.-dropdown:before {
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-top-color: transparent;
    border-left-color: #cdcdcd; }
  .-disabled-._top_.-dropdown:before {
    border-left-color: transparent;
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-top-color: #d9d9d9; }
  .-disabled-._bottom_.-dropdown:before {
    border-left-color: transparent;
    border-right-color: transparent;
    border-top-color: transparent;
    border-bottom-color: #d9d9d9; }
  .-disabled-._right_.-dropdown:before {
    border-left-color: transparent;
    border-bottom-color: transparent;
    border-top-color: transparent;
    border-right-color: #d9d9d9; }
  .-disabled-._left_.-dropdown:before {
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-top-color: transparent;
    border-left-color: #d9d9d9; }
  .-primary-._top_.-dropdown:before {
    border-left-color: transparent;
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-top-color: #0a324e; }
  .-primary-._bottom_.-dropdown:before {
    border-left-color: transparent;
    border-right-color: transparent;
    border-top-color: transparent;
    border-bottom-color: #0a324e; }
  .-primary-._right_.-dropdown:before {
    border-left-color: transparent;
    border-bottom-color: transparent;
    border-top-color: transparent;
    border-right-color: #0a324e; }
  .-primary-._left_.-dropdown:before {
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-top-color: transparent;
    border-left-color: #0a324e; }

.-dropdown {
  position: relative;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); }
  .-dropdown .-dropdown-content {
    background-color: white;
    border-radius: 0 0 5px 5px; }
  .-dropdown .-dropdown-header {
    text-align: center;
    border-radius: 5px 5px 0 0; }
  ._tiny.-dropdown .-dropdown-content {
    padding: 4px 6px; }
  ._tiny.-dropdown .-dropdown-header {
    font-size: 12px;
    padding: 4px 6px; }
  ._tiny._top_.-dropdown:before, ._tiny._bottom_.-dropdown:before {
    margin-left: -4px; }
  ._tiny._left_.-dropdown:before, ._tiny._right_.-dropdown:before {
    margin-top: -4px; }
  ._tiny._top_.-dropdown:before {
    top: 100%; }
  ._tiny._bottom_.-dropdown:before {
    bottom: 100%; }
  ._tiny._left_.-dropdown:before {
    left: 100%; }
  ._tiny._right_.-dropdown:before {
    right: 100%; }
  ._small.-dropdown .-dropdown-content {
    padding: 4.66667px 7px; }
  ._small.-dropdown .-dropdown-header {
    font-size: 14px;
    padding: 4.66667px 7px; }
  ._small._top_.-dropdown:before, ._small._bottom_.-dropdown:before {
    margin-left: -4.66667px; }
  ._small._left_.-dropdown:before, ._small._right_.-dropdown:before {
    margin-top: -4.66667px; }
  ._small._top_.-dropdown:before {
    top: 100%; }
  ._small._bottom_.-dropdown:before {
    bottom: 100%; }
  ._small._left_.-dropdown:before {
    left: 100%; }
  ._small._right_.-dropdown:before {
    right: 100%; }
  ._minor.-dropdown .-dropdown-content {
    padding: 5.33333px 8px; }
  ._minor.-dropdown .-dropdown-header {
    font-size: 16px;
    padding: 5.33333px 8px; }
  ._minor._top_.-dropdown:before, ._minor._bottom_.-dropdown:before {
    margin-left: -5.33333px; }
  ._minor._left_.-dropdown:before, ._minor._right_.-dropdown:before {
    margin-top: -5.33333px; }
  ._minor._top_.-dropdown:before {
    top: 100%; }
  ._minor._bottom_.-dropdown:before {
    bottom: 100%; }
  ._minor._left_.-dropdown:before {
    left: 100%; }
  ._minor._right_.-dropdown:before {
    right: 100%; }
  .-dropdown .-dropdown-content {
    padding: 5.33333px 8px; }
  .-dropdown .-dropdown-header {
    font-size: 16px;
    padding: 5.33333px 8px; }
  ._top_.-dropdown:before, ._bottom_.-dropdown:before {
    margin-left: -5.33333px; }
  ._left_.-dropdown:before, ._right_.-dropdown:before {
    margin-top: -5.33333px; }
  ._top_.-dropdown:before {
    top: 100%; }
  ._bottom_.-dropdown:before {
    bottom: 100%; }
  ._left_.-dropdown:before {
    left: 100%; }
  ._right_.-dropdown:before {
    right: 100%; }
  ._normal.-dropdown .-dropdown-content {
    padding: 8px 12px; }
  ._normal.-dropdown .-dropdown-header {
    font-size: 24px;
    padding: 8px 12px; }
  ._normal._top_.-dropdown:before, ._normal._bottom_.-dropdown:before {
    margin-left: -8px; }
  ._normal._left_.-dropdown:before, ._normal._right_.-dropdown:before {
    margin-top: -8px; }
  ._normal._top_.-dropdown:before {
    top: 100%; }
  ._normal._bottom_.-dropdown:before {
    bottom: 100%; }
  ._normal._left_.-dropdown:before {
    left: 100%; }
  ._normal._right_.-dropdown:before {
    right: 100%; }
  ._major.-dropdown .-dropdown-content {
    padding: 10.66667px 16px; }
  ._major.-dropdown .-dropdown-header {
    font-size: 32px;
    padding: 10.66667px 16px; }
  ._major._top_.-dropdown:before, ._major._bottom_.-dropdown:before {
    margin-left: -10.66667px; }
  ._major._left_.-dropdown:before, ._major._right_.-dropdown:before {
    margin-top: -10.66667px; }
  ._major._top_.-dropdown:before {
    top: 100%; }
  ._major._bottom_.-dropdown:before {
    bottom: 100%; }
  ._major._left_.-dropdown:before {
    left: 100%; }
  ._major._right_.-dropdown:before {
    right: 100%; }
  ._big.-dropdown .-dropdown-content {
    padding: 13.33333px 20px; }
  ._big.-dropdown .-dropdown-header {
    font-size: 40px;
    padding: 13.33333px 20px; }
  ._big._top_.-dropdown:before, ._big._bottom_.-dropdown:before {
    margin-left: -13.33333px; }
  ._big._left_.-dropdown:before, ._big._right_.-dropdown:before {
    margin-top: -13.33333px; }
  ._big._top_.-dropdown:before {
    top: 100%; }
  ._big._bottom_.-dropdown:before {
    bottom: 100%; }
  ._big._left_.-dropdown:before {
    left: 100%; }
  ._big._right_.-dropdown:before {
    right: 100%; }
  ._huge.-dropdown .-dropdown-content {
    padding: 16px 24px; }
  ._huge.-dropdown .-dropdown-header {
    font-size: 48px;
    padding: 16px 24px; }
  ._huge._top_.-dropdown:before, ._huge._bottom_.-dropdown:before {
    margin-left: -16px; }
  ._huge._left_.-dropdown:before, ._huge._right_.-dropdown:before {
    margin-top: -16px; }
  ._huge._top_.-dropdown:before {
    top: 100%; }
  ._huge._bottom_.-dropdown:before {
    bottom: 100%; }
  ._huge._left_.-dropdown:before {
    left: 100%; }
  ._huge._right_.-dropdown:before {
    right: 100%; }
  ._giant.-dropdown .-dropdown-content {
    padding: 20px 30px; }
  ._giant.-dropdown .-dropdown-header {
    font-size: 60px;
    padding: 20px 30px; }
  ._giant._top_.-dropdown:before, ._giant._bottom_.-dropdown:before {
    margin-left: -20px; }
  ._giant._left_.-dropdown:before, ._giant._right_.-dropdown:before {
    margin-top: -20px; }
  ._giant._top_.-dropdown:before {
    top: 100%; }
  ._giant._bottom_.-dropdown:before {
    bottom: 100%; }
  ._giant._left_.-dropdown:before {
    left: 100%; }
  ._giant._right_.-dropdown:before {
    right: 100%; }
  ._divine.-dropdown .-dropdown-content {
    padding: 26px 39px; }
  ._divine.-dropdown .-dropdown-header {
    font-size: 78px;
    padding: 26px 39px; }
  ._divine._top_.-dropdown:before, ._divine._bottom_.-dropdown:before {
    margin-left: -26px; }
  ._divine._left_.-dropdown:before, ._divine._right_.-dropdown:before {
    margin-top: -26px; }
  ._divine._top_.-dropdown:before {
    top: 100%; }
  ._divine._bottom_.-dropdown:before {
    bottom: 100%; }
  ._divine._left_.-dropdown:before {
    left: 100%; }
  ._divine._right_.-dropdown:before {
    right: 100%; }
  ._top_.-dropdown:after, ._top_.-dropdown:before, ._bottom_.-dropdown:after, ._bottom_.-dropdown:before, ._left_.-dropdown:after, ._left_.-dropdown:before, ._right_.-dropdown:after, ._right_.-dropdown:before {
    content: " ";
    display: block;
    position: absolute; }
  ._top_.-dropdown:before, ._bottom_.-dropdown:before, ._left_.-dropdown:before, ._right_.-dropdown:before {
    position: absolute; }
  .default.-dropdown .-dropdown-header {
    color: #333333;
    background-color: #fbfbfb;
    text-shadow: "0 1px 0 rgba(255,255,255,1)"; }
  .default._top_.-dropdown:after, .default._bottom_.-dropdown:after {
    background-image: -webkit-linear-gradient(left, rgba(230, 230, 230, 0), #e6e6e6 50%, rgba(230, 230, 230, 0));
    background-image: linear-gradient(to right, rgba(230, 230, 230, 0), #e6e6e6 50%, rgba(230, 230, 230, 0)); }
  .default._left_.-dropdown:after, .default._right_.-dropdown:after {
    background-image: -webkit-linear-gradient(top, rgba(230, 230, 230, 0), #e6e6e6 50%, rgba(230, 230, 230, 0));
    background-image: linear-gradient(to bottom, rgba(230, 230, 230, 0), #e6e6e6 50%, rgba(230, 230, 230, 0)); }
  .-dropdown .-dropdown-header {
    color: #333333;
    background-color: #fbfbfb;
    text-shadow: "0 1px 0 rgba(255,255,255,1)"; }
  ._top_.-dropdown:after, ._bottom_.-dropdown:after {
    background-image: -webkit-linear-gradient(left, rgba(230, 230, 230, 0), #e6e6e6 50%, rgba(230, 230, 230, 0));
    background-image: linear-gradient(to right, rgba(230, 230, 230, 0), #e6e6e6 50%, rgba(230, 230, 230, 0)); }
  ._left_.-dropdown:after, ._right_.-dropdown:after {
    background-image: -webkit-linear-gradient(top, rgba(230, 230, 230, 0), #e6e6e6 50%, rgba(230, 230, 230, 0));
    background-image: linear-gradient(to bottom, rgba(230, 230, 230, 0), #e6e6e6 50%, rgba(230, 230, 230, 0)); }
  .-disabled-.-dropdown {
    box-shadow: none!important;
    color: #cccccc; }
  .-disabled-.-dropdown .-dropdown-header {
    color: white;
    background-color: #f3f3f3;
    text-shadow: none; }
  .-disabled-._top_.-dropdown:after, .-disabled-._bottom_.-dropdown:after {
    background-image: -webkit-linear-gradient(left, rgba(217, 217, 217, 0), #d9d9d9 50%, rgba(217, 217, 217, 0));
    background-image: linear-gradient(to right, rgba(217, 217, 217, 0), #d9d9d9 50%, rgba(217, 217, 217, 0)); }
  .-disabled-._left_.-dropdown:after, .-disabled-._right_.-dropdown:after {
    background-image: -webkit-linear-gradient(top, rgba(217, 217, 217, 0), #d9d9d9 50%, rgba(217, 217, 217, 0));
    background-image: linear-gradient(to bottom, rgba(217, 217, 217, 0), #d9d9d9 50%, rgba(217, 217, 217, 0)); }
  .-primary-.-dropdown .-dropdown-header {
    color: white;
    background-color: #1b88d6;
    text-shadow: "0 -1px rgba(0,0,0,.3)"; }
  .-primary-._top_.-dropdown:after, .-primary-._bottom_.-dropdown:after {
    background-image: -webkit-linear-gradient(left, rgba(24, 122, 191, 0), #187abf 50%, rgba(24, 122, 191, 0));
    background-image: linear-gradient(to right, rgba(24, 122, 191, 0), #187abf 50%, rgba(24, 122, 191, 0)); }
  .-primary-._left_.-dropdown:after, .-primary-._right_.-dropdown:after {
    background-image: -webkit-linear-gradient(top, rgba(24, 122, 191, 0), #187abf 50%, rgba(24, 122, 191, 0));
    background-image: linear-gradient(to bottom, rgba(24, 122, 191, 0), #187abf 50%, rgba(24, 122, 191, 0)); }
  ._top_.-dropdown:after, ._bottom_.-dropdown:after {
    height: 1px;
<<<<<<< HEAD
    width: 100%;
    left: 0;
    position: absolute;
    display: inline-block;
    content: " "; }
  .-dropdown._top_ .-arrow {
    left: 50%;
    margin-left: -6px;
    bottom: -12px; }
  .-dropdown._top_:after {
=======
    left: 5px;
    right: 5px; }
  ._top_.-dropdown:before, ._bottom_.-dropdown:before {
    left: 50%; }
  ._left_.-dropdown:after, ._right_.-dropdown:after {
    width: 1px;
    top: 5px;
    bottom: 5px; }
  ._left_.-dropdown:before, ._right_.-dropdown:before {
    top: 50%; }
  ._top_.-dropdown:after {
>>>>>>> 526953e4827d8852136a2e443fb685b3b1054878
    bottom: -1px; }
  ._bottom_.-dropdown:after {
    top: -1px; }
  ._left_.-dropdown:after {
    right: -1px; }
  ._right_.-dropdown:after {
    left: -1px; }
  ._loading_.-dropdown .-dropdown-header {
    position: relative; }
    ._loading_.-dropdown .-dropdown-header:before {
      background-size: 52px 52px;
      background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.35, rgba(255, 255, 255, 0.35)), color-stop(0.35, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.35)), color-stop(0.75, rgba(255, 255, 255, 0.35)), color-stop(0.75, transparent), to(transparent)) !important;
      background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.35) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0.35) 75%, transparent 75%, transparent) !important;
      background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.35) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0.35) 75%, transparent 75%, transparent) !important;
      background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.35) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0.35) 75%, transparent 75%, transparent) !important;
      background-image: linear, -45deg, rgba(255, 255, 255, 0.35) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0.35) 75%, transparent 75%, transparent !important;
      content: " ";
      display: block;
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0; }


text:
import json
from numpy.random import choice

def generate_slides():
        slides = json.load(open("static/carousel/slides.json", "r"))
        weights = [x["weight"] for x in slides]
        sum_weights = sum(weights)
        weights = [w / float(sum_weights) for w in weights]
        num_slides = 5
        slides = choice(slides, 5, replace=False, p=weights)
	return slides


text:
class GNUPlotPipe
{
public:
    GNUPlotPipe(bool persistent = true)
    {
#ifdef __unix__
        if(persistent)
            pipeHandle = popen("gnuplot -persistent", "w");
        else
            pipeHandle = popen("gnuplot", "w");
#else
        if(persistent)
            pipeHandle = _popen("gnuplot -persistent", "w");
        else
            pipeHandle = _popen("gnuplot", "w");
#endif
    }
    ~GNUPlotPipe()
    {
        write("exit\n");
#ifdef __unix__
        pclose(pipeHandle);
#else
        _pclose(pipeHandle);
#endif
    }

    void write(const char* str)
    {
        fprintf(pipeHandle, "%s", str);
        fflush(pipeHandle);
    }

    void writef(const char* format, ...)
    {
        static char temp[512];
        va_list argList;
        va_start(argList, format);
        vsnprintf(temp, 512, format, argList);
        write(temp);
        va_end(argList);
    }

    void flush()
    {
        fflush(pipeHandle);
    }
protected:
    FILE *pipeHandle;
};

#endif


text:
from .DirectGlobals import *

# Routines to adjust values
def ROUND_TO(value, divisor):
    return round(value/float(divisor)) * divisor

def ROUND_INT(val):
    return int(round(val))

def CLAMP(val, minVal, maxVal):
    return min(max(val, minVal), maxVal)

# Create a tk compatible color string
def getTkColorString(color):
    """
    Print out a Tk compatible version of a color string
    """
    def toHex(intVal):
        val = int(round(intVal))
        if val < 16:
            return "0" + hex(val)[2:]
        else:
            return hex(val)[2:]
    r = toHex(color[0])
    g = toHex(color[1])
    b = toHex(color[2])
    return "#" + r + g + b

## Background Color ##
def lerpBackgroundColor(r, g, b, duration):
    """
    Function to lerp background color to a new value
    """
    def lerpColor(state):
        dt = globalClock.getDt()
        state.time += dt
        sf = state.time / state.duration
        if sf >= 1.0:
            base.setBackgroundColor(state.ec[0], state.ec[1], state.ec[2])
            return Task.done
        else:
            r = sf * state.ec[0] + (1 - sf) * state.sc[0]
            g = sf * state.ec[1] + (1 - sf) * state.sc[1]
            b = sf * state.ec[2] + (1 - sf) * state.sc[2]
            base.setBackgroundColor(r, g, b)
            return Task.cont
    taskMgr.remove('lerpBackgroundColor')
    t = taskMgr.add(lerpColor, 'lerpBackgroundColor')
    t.time = 0.0
    t.duration = duration
    t.sc = base.getBackgroundColor()
    t.ec = VBase4(r, g, b, 1)

# Set direct drawing style for an object
# Never light object or draw in wireframe
def useDirectRenderStyle(nodePath, priority = 0):
    """
    Function to force a node path to use direct render style:
    no lighting, and no wireframe
    """
    nodePath.setLightOff(priority)
    nodePath.setRenderModeFilled()

# File data util
def getFileData(filename, separator = ','):
    """
    Open the specified file and strip out unwanted whitespace and
    empty lines.  Return file as list of lists, one file line per element,
    list elements based upon separator
    """
    f = open(filename.toOsSpecific(), 'r')
    rawData = f.readlines()
    f.close()
    fileData = []
    for line in rawData:
        # First strip whitespace from both ends of line
        l = line.strip()
        if l:
            # If its a valid line, split on separator and
            # strip leading/trailing whitespace from each element
            data = [s.strip() for s in l.split(separator)]
            fileData.append(data)
    return fileData


text:
<?php

namespace App\Entities;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class Reply.
 *
 * @property int    $id
 * @property int    $user_id
 * @property int    $topic_id
 * @property string $content
 * @property Carbon $created_at
 * @property Carbon $updated_at
 */
class Reply extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'user_id',
        'topic_id',
        'content',
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function topic()
    {
        return $this->belongsTo(Topic::class);
    }
}


text:
from tree_tensor_network_mnist import TreeTensorNetwork
from utilities_mnist import load_train_data
from utilities_mnist import load_test_data
from itertools import product
import numpy as np

import pickle

data_folder = "/export/tree_tn/data/mnist/"
n_epochs = 3

bond_data=[2,2,2,2,2,2,2,2,2,2]
bond_inner=[2,2,2,2,2,2,2,2,2,2]
bond_label = 2

n_class = 2
n_train_single=10
n_train_each = n_train_single*9
n_train = n_train_each * n_class

n_test_each = 800
n_test = n_test_each * 10

layer_units = [16, 8, 4, 2, 1]

# build tensor network---------------------------------------------------
print("building tensor network")
output = open('tsne.pkl', 'wb')

ttn=[0 for col in range(10)]
acc_train=[0 for col in range(10)]
acc_test1=[0 for col in range(10)]
acc_test2=[0 for col in range(10)]

for i in [0]: # 0,1,2...9 corresponding to each digit
    print("bond_data:",bond_data[i])
    print("bond_inner:", bond_inner[i])
    data, labels = load_train_data(data_folder + "train.mat", n_train, n_train_each, bond_label, bond_data[i], i)
    data_test, labels_test = load_train_data(data_folder + "test.mat", n_test_each*2, n_test_each, bond_label, bond_data[i], i)

    ttn[i] = TreeTensorNetwork(data, labels, bond_data[i], bond_inner[i], bond_label, layer_units)

    # Training
    print("Training number", i, "th binary classifier:")
    acc_train[i] = ttn[i].train(n_epochs)
    print("training inner product:",acc_train[i])

    pickle.dump(ttn, output)
output.close()


text:
import json
import yaml
import pprint

with open('yaml_output.yml', 'r') as f:
    output = yaml.load(f)
    pprint.pprint(output)
    f.close()

with open('json_output.json', 'r') as f:
    output = json.load(f)
    pprint.pprint(output)
    f.close()


text:
package com.theoryinpractice.testng.configuration;

import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ArrayUtil;
import junit.framework.Assert;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import org.testng.IDEATestNGRemoteListener;
import org.testng.ISuite;
import org.testng.xml.XmlClass;
import org.testng.xml.XmlInclude;
import org.testng.xml.XmlSuite;
import org.testng.xml.XmlTest;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class TestNGTreeHierarchyTest {

  @Test
  public void testOneTestMethod() throws Exception {
    final XmlSuite suite = new XmlSuite();
    final XmlTest test = new XmlTest();
    final XmlClass xmlClass = new XmlClass("a.ATest", false);
    xmlClass.getIncludedMethods().add(new XmlInclude("test1"));
    test.getClasses().add(xmlClass);
    suite.getTests().add(test);

    doTest(suite, "\n" +
                  "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" +
                  "\n" +
                  "##teamcity[testStarted name='test1|[0|]' locationHint='java:test://a.ATest.test1|[0|]']\n" +
                  "\n" +
                  "##teamcity[testFinished name='test1|[0|]']\n");
  }

  @Test
  public void testSkipTestMethod() throws Exception {

    final StringBuffer buf = new StringBuffer();
    final IDEATestNGRemoteListener listener = createListener(buf);
    listener.onStart((ISuite)null);
    listener.onTestSkipped(new MockTestNGResult("ATest", "testName"));
    listener.onFinish((ISuite)null);

    Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" +
                                          "\n" +
                                          "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='testName' locationHint='java:test://ATest.testName|[0|]']\n" +
                                          "\n" +
                                          "##teamcity[testIgnored name='testName']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='testName']\n" +
                                          "##teamcity[testSuiteFinished name='ATest']\n", StringUtil.convertLineSeparators(buf.toString()));
  }

  @Test
  public void testParallelTestExecutionPreserveInvocationCount() throws Exception {

    final StringBuffer buf = new StringBuffer();
    final IDEATestNGRemoteListener listener = createListener(buf);
    listener.onStart((ISuite)null);
    final MockTestNGResult[] results = new MockTestNGResult[] {new MockTestNGResult("ATest", "testName"), new MockTestNGResult("ATest", "testName1"), new MockTestNGResult("ATest", "testName")};
    for (MockTestNGResult result : results) {
      listener.onTestStart(result);
      listener.onTestFinished(result);
    }
    listener.onFinish((ISuite)null);

    Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" +
                                          "\n" +
                                          "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='testName' locationHint='java:test://ATest.testName|[0|]']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='testName']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='testName1' locationHint='java:test://ATest.testName1|[0|]']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='testName1']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='testName (1)' locationHint='java:test://ATest.testName|[1|]']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='testName (1)']\n" +
                                          "##teamcity[testSuiteFinished name='ATest']\n", StringUtil.convertLineSeparators(buf.toString()));
  }

  @Test
  public void testFailureWithoutStart() throws Exception {

    final StringBuffer buf = new StringBuffer();
    final IDEATestNGRemoteListener listener = createListener(buf);
    listener.onStart((ISuite)null);
    final Exception exception = new Exception();
    exception.setStackTrace(new StackTraceElement[0]);
    listener.onTestFailure(new MockTestNGResult("ATest", "testName", exception, ArrayUtil.EMPTY_OBJECT_ARRAY));
    listener.onFinish((ISuite)null);

    Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" +
                                          "\n" +
                                          "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='testName' locationHint='java:test://ATest.testName|[0|]']\n" +
                                          "##teamcity[testFailed name='testName' details='java.lang.Exception|n' error='true' message='']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='testName']\n" +
                                          "##teamcity[testSuiteFinished name='ATest']\n", StringUtil.convertLineSeparators(buf.toString()));
  }

  @Test
  public void testSkipMethodAfterStartTest() throws Exception {
    final StringBuffer buf = new StringBuffer();
    final IDEATestNGRemoteListener listener = createListener(buf);
    listener.onStart((ISuite)null);
    final MockTestNGResult result = new MockTestNGResult("ATest", "testName");
    listener.onTestStart(result);
    listener.onTestSkipped(result);
    listener.onFinish((ISuite)null);

    Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" +
                                          "\n" +
                                          "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='testName' locationHint='java:test://ATest.testName|[0|]']\n" +
                                          "\n" +
                                          "##teamcity[testIgnored name='testName']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='testName']\n" +
                                          "##teamcity[testSuiteFinished name='ATest']\n", StringUtil.convertLineSeparators(buf.toString()));
  }

  @Test
  public void testOneTestMethodWithMultipleInvocationCount() throws Exception {
    final XmlSuite suite = new XmlSuite();
    final XmlTest test = new XmlTest();
    final XmlClass xmlClass = new XmlClass("a.ATest", false);
    xmlClass.getIncludedMethods().add(new XmlInclude("test1", Arrays.asList(0, 1, 2), 0));
    test.getClasses().add(xmlClass);
    suite.getTests().add(test);

    doTest(suite, "\n" +
                  "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" +
                  "\n" +
                  "##teamcity[testStarted name='test1|[0|]' locationHint='java:test://a.ATest.test1|[0|]']\n" +
                  "\n" +
                  "##teamcity[testFinished name='test1|[0|]']\n" +
                  "\n" +
                  "##teamcity[testStarted name='test1|[1|] (1)' locationHint='java:test://a.ATest.test1|[1|]']\n" +
                  "\n" +
                  "##teamcity[testFinished name='test1|[1|] (1)']\n" +
                  "\n" +
                  "##teamcity[testStarted name='test1|[2|] (2)' locationHint='java:test://a.ATest.test1|[2|]']\n" +
                  "\n" +
                  "##teamcity[testFinished name='test1|[2|] (2)']\n");
  }

  @Test
  public void testConfigurationMethods() throws Exception {
    final StringBuffer buf = new StringBuffer();
    final IDEATestNGRemoteListener listener = createListener(buf);
    final String className = "a.ATest";
    listener.onSuiteStart(className, true);
    for(String methodName : new String[] {"test1", "test2"}) {
      listener.onConfigurationSuccess(new MockTestNGResult(className, "setUp"));
      final MockTestNGResult result = new MockTestNGResult(className, methodName);
      listener.onTestStart(result);
      listener.onTestFinished(result);
      listener.onConfigurationSuccess(new MockTestNGResult(className, "tearDown"));
    }
    listener.onSuiteFinish(className);

    Assert.assertEquals("output: " + buf, "\n" +
                                          "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='setUp' locationHint='java:test://a.ATest.setUp']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='setUp']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='test1' locationHint='java:test://a.ATest.test1|[0|]']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='test1']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='tearDown' locationHint='java:test://a.ATest.tearDown']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='tearDown']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='setUp' locationHint='java:test://a.ATest.setUp']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='setUp']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='test2' locationHint='java:test://a.ATest.test2|[0|]']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='test2']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='tearDown' locationHint='java:test://a.ATest.tearDown']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='tearDown']\n" +
                                          "##teamcity[testSuiteFinished name='a.ATest']\n", StringUtil.convertLineSeparators(buf.toString()));
  }

  @Test
  public void testNullParameters() throws Exception {
    final StringBuffer buf = new StringBuffer();
    final IDEATestNGRemoteListener listener = createListener(buf);
    final MockTestNGResult result = new MockTestNGResult("ATest", "testMe", null, new Object[]{null, null});
    listener.onTestStart(result);
    listener.onTestFinished(result);
    Assert.assertEquals("output: " + buf, "\n" +
                                          "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest']\n" +
                                          "\n" +
                                          "##teamcity[testStarted name='testMe|[null, null|]' locationHint='java:test://ATest.testMe|[0|]']\n" +
                                          "\n" +
                                          "##teamcity[testFinished name='testMe|[null, null|]']\n", StringUtil.convertLineSeparators(buf.toString()));
  }

  private static void doTest(XmlSuite suite, String expected) {
    final StringBuffer buf = new StringBuffer();
    final IDEATestNGRemoteListener listener = createListener(buf);

    for (XmlTest test : suite.getTests()) {
      for (XmlClass aClass : test.getClasses()) {
        final String classFQName = aClass.getName();
        for (XmlInclude include : aClass.getIncludedMethods()) {
          final String methodName = include.getName();
          List<Integer> numbers = include.getInvocationNumbers();
          if (numbers.isEmpty()) {
            numbers = Collections.singletonList(0);
          }
          for (Integer integer : numbers) {
            final MockTestNGResult result = new MockTestNGResult(classFQName, methodName, null, new Object[] {integer});
            listener.onTestStart(result);
            listener.onTestFinished(result);
          }
        }
      }
    }

    Assert.assertEquals("output: " + buf, expected, StringUtil.convertLineSeparators(buf.toString()));
  }

  @NotNull
  private static IDEATestNGRemoteListener createListener(final StringBuffer buf) {
    return new IDEATestNGRemoteListener(new PrintStream(new OutputStream() {
        @Override
        public void write(int b) throws IOException {
          buf.append(new String(new byte[]{(byte)b}));
        }
      })) {
      @Override
      protected String getTrace(Throwable tr) {
        return StringUtil.convertLineSeparators(super.getTrace(tr));
      }
    };
  }

  private static class MockTestNGResult implements IDEATestNGRemoteListener.ExposedTestResult {
    private final String myClassName;
    private final String myMethodName;
    private final Throwable myThrowable;
    private final Object[]  myParams;

    public MockTestNGResult(String className, String methodName, Throwable throwable, Object[] params) {
      myClassName = className;
      myMethodName = methodName;
      myThrowable = throwable;
      myParams = params;
    }

    private MockTestNGResult(String className, String methodName) {
     this(className, methodName, null, ArrayUtil.EMPTY_OBJECT_ARRAY);
    }

    @Override
    public Object[] getParameters() {
      return myParams;
    }

    @Override
    public String getMethodName() {
      return myMethodName;
    }

    @Override
    public String getClassName() {
      return myClassName;
    }

    @Override
    public long getDuration() {
      return 0;
    }

    @Override
    public List<String> getTestHierarchy() {
      return Collections.singletonList(myClassName);
    }

    @Override
    public Throwable getThrowable() {
      return myThrowable;
    }

    @Override
    public boolean equals(Object o) {
      if (this == o) return true;
      if (o == null || getClass() != o.getClass()) return false;

      MockTestNGResult result = (MockTestNGResult)o;

      if (!myClassName.equals(result.myClassName)) return false;
      if (!myMethodName.equals(result.myMethodName)) return false;
      if (myThrowable != null ? !myThrowable.equals(result.myThrowable) : result.myThrowable != null) return false;
      // Probably incorrect - comparing Object[] arrays with Arrays.equals
      if (!Arrays.equals(myParams, result.myParams)) return false;

      return true;
    }

    @Override
    public int hashCode() {
      int result = myClassName.hashCode();
      result = 31 * result + myMethodName.hashCode();
      result = 31 * result + (myThrowable != null ? myThrowable.hashCode() : 0);
      result = 31 * result + (myParams != null ? Arrays.hashCode(myParams) : 0);
      return result;
    }
  }
}