text:
from __future__ import absolute_import

import sys

from celery.utils.serialization import (
    UnpickleableExceptionWrapper,
    get_pickleable_etype,
)

from celery.tests.case import Case, mask_modules

class test_AAPickle(Case):

    def test_no_cpickle(self):
        prev = sys.modules.pop('celery.utils.serialization', None)
        try:
            with mask_modules('cPickle'):
                from celery.utils.serialization import pickle
                import pickle as orig_pickle
                self.assertIs(pickle.dumps, orig_pickle.dumps)
        finally:
            sys.modules['celery.utils.serialization'] = prev

class test_UnpickleExceptionWrapper(Case):

    def test_init(self):
        x = UnpickleableExceptionWrapper('foo', 'Bar', [10, lambda x: x])
        self.assertTrue(x.exc_args)
        self.assertEqual(len(x.exc_args), 2)

class test_get_pickleable_etype(Case):

    def test_get_pickleable_etype(self):

        class Unpickleable(Exception):
            def __reduce__(self):
                raise ValueError('foo')

        self.assertIs(get_pickleable_etype(Unpickleable), Exception)


text:
namespace VRTK.Examples.Archery
{
    using UnityEngine;

    public class ArrowSpawner : MonoBehaviour
    {
        public GameObject arrowPrefab;
        public float spawnDelay = 1f;

        private float spawnDelayTimer = 0f;
        private BowAim bow;

        private void Start()
        {
            spawnDelayTimer = 0f;
        }

        private void OnTriggerStay(Collider collider)
        {
            VRTK_InteractGrab grabbingController = (collider.gameObject.GetComponent<VRTK_InteractGrab>() ? collider.gameObject.GetComponent<VRTK_InteractGrab>() : collider.gameObject.GetComponentInParent<VRTK_InteractGrab>());
            if (CanGrab(grabbingController) && NoArrowNotched(grabbingController.gameObject) && Time.time >= spawnDelayTimer)
            {
                GameObject newArrow = Instantiate(arrowPrefab);
                newArrow.name = "ArrowClone";
                grabbingController.gameObject.GetComponent<VRTK_InteractTouch>().ForceTouch(newArrow);
                grabbingController.AttemptGrab();
                spawnDelayTimer = Time.time + spawnDelay;
            }
        }

        private bool CanGrab(VRTK_InteractGrab grabbingController)
        {
            return (grabbingController && grabbingController.GetGrabbedObject() == null && grabbingController.gameObject.GetComponent<VRTK_ControllerEvents>().grabPressed);
        }

        private bool NoArrowNotched(GameObject controller)
        {
            if (VRTK_SDK_Bridge.IsControllerLeftHand(controller))
            {
                bow = VRTK_DeviceFinder.GetControllerRightHand().GetComponentInChildren<BowAim>();
            }
            else if (VRTK_SDK_Bridge.IsControllerRightHand(controller))
            {
                bow = VRTK_DeviceFinder.GetControllerLeftHand().GetComponentInChildren<BowAim>();
            }
            return (bow == null || !bow.HasArrow());
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
#include "Iop_Module.h"

namespace Iop
{
	class CDynamic : public CModule
	{
	public:
						CDynamic(uint32*);
		virtual			~CDynamic();

		std::string		GetId() const override;
		std::string		GetFunctionName(unsigned int) const override;
		void			Invoke(CMIPS&, unsigned int) override;

		uint32*			GetExportTable() const;

	private:
		uint32*			m_exportTable;
		std::string		m_name;
	};

	typedef std::shared_ptr<CDynamic> DynamicPtr;
}


text:
set -e

# shellcheck disable=SC1091
. ./config.sh

../tools/integration/run_all.sh "$@"


text:
FUNCTION render_session_timeout (
   p_dynamic_action IN APEX_PLUGIN.T_DYNAMIC_ACTION,
   p_plugin         IN APEX_PLUGIN.T_PLUGIN
)

   RETURN APEX_PLUGIN.T_DYNAMIC_ACTION_RENDER_RESULT

IS

   l_result                APEX_PLUGIN.T_DYNAMIC_ACTION_RENDER_RESULT;
   l_timeoutAction         VARCHAR2(4000);
   l_timeoutMessage        VARCHAR2(500);
   l_timeoutURL            VARCHAR2(4000);
   l_logoutURL             VARCHAR2(4000);
   l_showWarning           BOOLEAN;
   l_showWarningMiliBefore NUMBER;
   l_showWarningTitle      VARCHAR2(50);
   l_showWarningMessage    VARCHAR2(500);
   l_hideHistory           BOOLEAN;
   l_sessionIdleDuration   NUMBER;
   l_maskBrowser           BOOLEAN;
   l_keepSessionAlive      BOOLEAN;
   l_crlf                  CHAR(2) := CHR(13)||CHR(10);

BEGIN

   IF apex_application.g_debug
   THEN
      apex_plugin_util.debug_dynamic_action(
         p_plugin         => p_plugin,
         p_dynamic_action => p_dynamic_action
      );
   END IF;

   l_timeoutAction         := NVL(p_plugin.attribute_01,'ALERT');
   l_timeoutMessage        := NVL(p_plugin.attribute_02,'Session has been idle for too long!');
   l_showWarning           := CASE p_plugin.attribute_03
                                 WHEN 'Y' THEN TRUE
                                 ELSE FALSE
                              END;
   l_showWarningMiliBefore := p_plugin.attribute_06 * 1000;
   l_showWarningTitle      := NVL(p_plugin.attribute_08,'Idle Session Warning');
   l_showWarningMessage    := NVL(p_plugin.attribute_04,'This session will expire shortly!');
   l_hideHistory           := FALSE;
   l_maskBrowser           := CASE p_plugin.attribute_05
                                 WHEN 'N' THEN FALSE
                                 ELSE TRUE
                              END;
   l_keepSessionAlive      := CASE p_plugin.attribute_07
                                 WHEN 'Y' THEN TRUE
                                 ELSE FALSE
                              END;

   SELECT
      NVL(MAXIMUM_SESSION_IDLE_SECONDS, 3600) * 1000,
      NVL(SESSION_IDLE_TIME_EXCEEDED_URL, HOME_LINK),
      NVL(LOGOUT_URL,'apex_authentication.logout?p_app_id=&APP_ID.&p_session_id=&SESSION.')
   INTO
      l_sessionIdleDuration,
      l_timeoutURL,
      l_logoutURL
   FROM
      apex_applications
   WHERE
      application_id = apex_application.g_flow_id;

   l_timeoutURL := apex_plugin_util.replace_substitutions (l_timeoutURL);

   l_logoutURL := apex_plugin_util.replace_substitutions (l_logoutURL);

   apex_css.add(
      p_css =>
         '#session-timeout-mask{position: absolute;z-index: 9000;background-color : #343434;top: 0;left: 0;}' || l_crlf ||
         '.session-timeout-dialog .ui-dialog-titlebar-close{display: none !important;}'
   );

   apex_javascript.add_library(
      p_name      => 'jquery.ui.button',
      p_directory => '#JQUERYUI_DIRECTORY#ui/',
      p_version   => NULL
   );

   IF l_keepSessionAlive THEN
      apex_javascript.add_library(
         p_name      => 'idle-timer.min',
         p_directory => p_plugin.file_prefix||'lib/idle-timer/js/',
         p_version   => NULL
      );
   END IF;

   l_result.javascript_function :=
         'function(){apex.jQuery(document).apex_session_timeout({' || l_crlf
      || '   ' || apex_javascript.add_attribute('timeoutAction',        l_timeoutAction) || l_crlf
      || '   ' || apex_javascript.add_attribute('timeoutMessage',       l_timeoutMessage) || l_crlf
      || '   ' || apex_javascript.add_attribute('timeoutURL',           l_timeoutURL) || l_crlf
      || '   ' || apex_javascript.add_attribute('logoutURL',            l_logoutURL) || l_crlf
      || '   ' || apex_javascript.add_attribute('showWarning',          l_showWarning) || l_crlf
      || '   ' || apex_javascript.add_attribute('showWarningMiliBefore',l_showWarningMiliBefore) || l_crlf
      || '   ' || apex_javascript.add_attribute('showWarningTitle',     l_showWarningTitle) || l_crlf
      || '   ' || apex_javascript.add_attribute('showWarningMessage',   l_showWarningMessage) || l_crlf
      || '   ' || apex_javascript.add_attribute('hideHistory',          l_hideHistory) || l_crlf
      || '   ' || apex_javascript.add_attribute('sessionIdleDuration',  l_sessionIdleDuration) || l_crlf
      || '   ' || apex_javascript.add_attribute('maskBrowser',          l_maskBrowser) || l_crlf
      || '   ' || apex_javascript.add_attribute('keepSessionAlive',     l_keepSessionAlive) || l_crlf
      || '   ' || apex_javascript.add_attribute('ajaxIdentifier',       apex_plugin.get_ajax_identifier(), FALSE, FALSE) || l_crlf
      || '});}';

   RETURN l_result;

END render_session_timeout;

FUNCTION ajax_session_timeout(
    p_dynamic_action IN apex_plugin.t_dynamic_action,
    p_plugin         IN apex_plugin.t_plugin
)
    RETURN apex_plugin.t_dynamic_action_ajax_result
IS
   l_result apex_plugin.t_dynamic_action_ajax_result;
BEGIN
   RETURN l_result;
END ajax_session_timeout;


text:
package com.haulmont.cuba.desktop.gui.components;

import com.haulmont.cuba.gui.components.Component;

/**
 *
 * Desktop components require to know their container.
 *
 * When its size or alignment changes, component asks container to update him.
 *
 */
public interface DesktopComponent extends Component {
    void setContainer(DesktopContainer container);

    void setExpanded(boolean expanded);

    /**
     * A sub-interface implemented by components that provide additional
     * capabilities for components that have context help icon click handler.
     */
    interface HasContextHelpClickHandler extends HasContextHelp {
        /**
         * Fires a {@link Component.ContextHelpIconClickEvent} for all listeners.
         *
         * @param event event to be fired
         */
        void fireContextHelpIconClickEvent(Component.ContextHelpIconClickEvent event);
    }
}


text:
var login = require('./login');
var User = require('../bin/models/user');

module.exports = function(passport){

    // Passport needs to be able to serialize and deserialize users to support persistent login sessions
    passport.serializeUser(function(user, done) {
        //console.log('serializing user: ');
        //console.log(user);
        done(null, {email: user.email, id: user._id});
    });

    passport.deserializeUser(function(user, done) {
        User.findById(user.id, function(err, user) {
            //console.log('deserializing user:',user);
            done(err, user);
        });
    });

    // Setting up Passport Strategies for Login and SignUp/Registration
    login(passport);

};


text:
#ifndef PSR_LOG_LOGGERAWAREINTERFACE_H
#define PSR_LOG_LOGGERAWAREINTERFACE_H

#include "php_psr3logger.h"

ZEND_DLEXPORT extern zend_class_entry *psr_log_loggerawareinterface_ce;

PSR3LOGGER_VISIBILITY_HIDDEN int init_Psr_Log_LoggerAwareInterface(TSRMLS_D);

ZEND_BEGIN_ARG_INFO_EX(arginfo_psr_log_loggerawareinterface_setlogger, 0, 0, 1)
	ZEND_ARG_OBJ_INFO(0, logger, Psr\\Log\\LoggerInterface, 0)
ZEND_END_ARG_INFO()

#endif /* PSR_LOG_LOGGERAWAREINTERFACE_H */


text:
package org.jfleet.mysql.manual;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.jfleet.parameterized.IsMySql5Present;
import org.jfleet.util.MySqlDatabase;
import org.junit.jupiter.api.Test;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;

@IsMySql5Present
public class IdsTest {

    @Test
    public void canExecuteLoadDataWithAutoIncrement() throws SQLException, IOException {
        try (Connection conn = (Connection) new MySqlDatabase().getConnection()) {
            conn.setAllowLoadLocalInfile(true);
            try (Statement stmt = (Statement) conn.createStatement()) {
                stmt.execute("CREATE TEMPORARY TABLE table_with_id "
                        + "(id INT NOT NULL AUTO_INCREMENT, some_column VARCHAR(255), PRIMARY KEY (id))");

                String row1 = "foo\t\n";
                String row2 = "bar\t\n";
                String someData = row1 + row2;
                stmt.setLocalInfileInputStream(new ByteArrayInputStream(someData.getBytes(Charset.forName("UTF-8"))));
                String sql = "LOAD DATA LOCAL INFILE '' INTO TABLE table_with_id "
                        + "FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\\\' "
                        + "LINES TERMINATED BY '\n' STARTING BY ''"
                        + "(some_column)";
                stmt.execute(sql);

                try (ResultSet rs = stmt.executeQuery("SELECT id, some_column FROM table_with_id")) {
                    assertTrue(rs.next());
                    assertEquals(1, rs.getInt(1));
                    assertEquals("foo", rs.getString(2));
                    assertTrue(rs.next());
                    assertEquals(2, rs.getInt(1));
                    assertEquals("bar", rs.getString(2));
                }
            }
        }
    }

    @Test
    public void canExecuteLoadDataWithAutoIncrementIdSetted() throws SQLException, IOException {
        try (Connection conn = (Connection) new MySqlDatabase().getConnection()) {
            conn.setAllowLoadLocalInfile(true);
            try (Statement stmt = (Statement) conn.createStatement()) {
                stmt.execute("CREATE TEMPORARY TABLE table_with_id "
                        + "(id INT NOT NULL AUTO_INCREMENT, some_column VARCHAR(255), PRIMARY KEY (id))");

                String row1 = "10\tfoo\t\n";
                String row2 = "\\N\tbar\t\n";
                String someData = row1 + row2;
                stmt.setLocalInfileInputStream(new ByteArrayInputStream(someData.getBytes(Charset.forName("UTF-8"))));
                String sql = "LOAD DATA LOCAL INFILE '' INTO TABLE table_with_id "
                        + "FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\\\' "
                        + "LINES TERMINATED BY '\n' STARTING BY ''"
                        + "(id, some_column)";
                stmt.execute(sql);

                try (ResultSet rs = stmt.executeQuery("SELECT id, some_column FROM table_with_id ORDER BY id ASC")) {
                    assertTrue(rs.next());
                    assertEquals(10, rs.getInt(1));
                    assertEquals("foo", rs.getString(2));
                    assertTrue(rs.next());
                    assertEquals(11, rs.getInt(1));
                    assertEquals("bar", rs.getString(2));
                }
            }
        }
    }
}


text:
var cordova = require('cordova');
var exec = require('cordova/exec');

module.exports = {
    getInfo:function(win,fail,args) {
        Cordova.exec(function (model, cordova, platform, uuid, version) {
            win({name: name, model: model, cordova: cordova,
                 platform: platform, uuid: uuid, version: version});
        }, null, "com.cordova.Device", "getInfo", []);
    }
};

require("cordova/exec/proxy").add("Device", module.exports);


text:
module: "@wq/react"
purpose: forms
---

# AutoForm

@wq/react's `<AutoForm/>` [component] generates a [`<Form/>`][Form] containing [`<AutoInput/>`][AutoInput]s for each field in the [form configuration][config]  corresponding to the current [route][@wq/router].  `<AutoForm/>` is primarily used with the [DefaultEdit] view, and should almost never be overridden directly.  Instead, it usually makes more sense to configure custom [input types][custom-input], [fieldsets], and or [nested repeat groups][nested-forms] for the fields you want to customize.

## Source

The source code for `<AutoForm/>` is available here:

 * [AutoForm.js (@wq/react)][react-src]

The [@wq/react] implementation leverages [`useComponents()`][useComponents] and [`<AutoInput/>`][AutoInput]  to facilitate customization, so there is no alternate [@wq/material] or native version.

[component]: ./index.md
[Form]: ./Form.md
[AutoInput]: ./AutoInput.md
[config]: ../config.md
[@wq/router]: ../@wq/router.md
[DefaultEdit]: ../views/DefaultEdit.md
[@wq/react]: ../@wq/react.md
[@wq/material]: ../@wq/material.md
[useComponents]: ../hooks/useComponents.md

[custom-input]: ../guides/define-a-custom-input-type.md
[fieldsets]: ../guides/organize-inputs-into-fieldsets.md
[nested-forms]: ../guides/implement-repeating-nested-forms.md

[react-src]: https://github.com/wq/wq.app/blob/main/packages/react/src/components/AutoForm.js


text:
package main

import (
	"reflect"
	"sort"
	"testing"
	"time"

	"github.com/rebuy-de/partial-deployment-cleanup/consul"
	"github.com/rebuy-de/partial-deployment-cleanup/testutil"
)

func TestCleanupConsul(t *testing.T) {
	srv := testutil.CreateServer(t)
	defer srv.Stop()

	srv.SetJSON(
		"nginx/partial-deployment/green-web/deployments/master",
		consul.Branch{
			"green-web",
			"master",
			time.Now(),
			time.Now().Add(-4 * Week),
		})
	srv.SetJSON(
		"nginx/partial-deployment/green-web/deployments/old",
		consul.Branch{
			"green-web",
			"old",
			time.Now(),
			time.Now().Add(-4 * Week),
		})
	srv.SetJSON(
		"nginx/partial-deployment/green-web/deployments/ancient",
		consul.Branch{
			"green-web",
			"ancient",
			time.Now(),
			time.Now().Add(-8 * Week),
		})
	srv.SetJSON(
		"nginx/partial-deployment/green-web/deployments/fancy:",
		consul.Branch{
			"green-web",
			"fancy",
			time.Now(),
			time.Now(),
		})

	srv.Set("nginx/partial-deployment/green-web/distribution",
		`{
			"1":"fancy",
			"2":"fancy",
			"3":"fancy",
			"4":"old",
			"5":"old"
		}`)

	err := CleanupConsul(srv.Addr(), consul.Key("nginx/partial-deployment"))
	if err != nil {
		t.Fatal(err.Error())
	}

	expect := []string{
		"nginx/partial-deployment/green-web/deployments/fancy",
		"nginx/partial-deployment/green-web/deployments/master",
		"nginx/partial-deployment/green-web/deployments/old",
	}
	obtain := srv.List("nginx/partial-deployment/green-web/deployments")
	sort.Sort(sort.StringSlice(obtain))

	if reflect.DeepEqual(expect, obtain) {
		t.Errorf("Deleted the wrong deployment.")
		t.Errorf("Expected: %#v", expect)
		t.Errorf("Obtained: %#v", obtain)
	}
}


text:
package minesim;

import minesim.entities.Animation;

import org.junit.Before;

import java.io.ByteArrayOutputStream;
import java.util.ArrayList;

import javafx.scene.media.MediaPlayer;
import static org.junit.Assert.*;

import org.apache.log4j.Appender;
import org.apache.log4j.Layout;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.apache.log4j.WriterAppender;
import org.junit.Test;

import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import java.net.URL;
import java.util.ArrayList;

import static org.junit.Assert.*;
import static org.mockito.Matchers.*;

@PrepareForTest({MediaPlayer.class})
@RunWith(PowerMockRunner.class)

public class MusicTests {

    private ArrayList<String> musicList = new ArrayList<String>();
    private ArrayList<MediaPlayer> mockmusicList = new ArrayList<MediaPlayer>();

    MediaPlayer p1;
    MediaPlayer p2;
    MediaPlayer p3;

    Music music = new Music(mockmusicList);
    double volume = music.getVolume();
    double setVolume = 0.3;

    boolean musicMute = music.getMusicMute();
    boolean setMute = true;

    //private Music instance = null;

    private static final Logger LOGGER = Logger.getLogger(Music.class);

    @Before
    public void setup() {
        musicList.add("beach.mp3");
        musicList.add("collapse.mp3");

        p1 = PowerMockito.mock(MediaPlayer.class);
        p2 = PowerMockito.mock(MediaPlayer.class);
        p3 = PowerMockito.mock(MediaPlayer.class);
        mockmusicList.add(p1);
        mockmusicList.add(p2);
        mockmusicList.add(p3);

    }

    //Test getInstance -----------------------------------------------------------------------
    @Test @Ignore
    public void testGetInstance(){
        Music musicInstance = Music.getInstance();

        assertEquals(musicInstance.getClass(), Music.class);

    }

    //Test changeMusic -----------------------------------------------------------------------
    //Tests the music played in change music
    @Test @Ignore
    public void testChangeMusic(){

        ArrayList<String> startList = new ArrayList<String>();
        ArrayList<String> finishList = new ArrayList<String>();

        startList.add("beach.mp3");
        startList.add("collapse.mp3");

        finishList.add("sad apples.mp3");
        finishList.add("gloomy.mp3");

        Music music = new Music(startList);

        music.changeMusic(finishList);

        //creates list of media players that should be the same as the actual media player
        ArrayList<MediaPlayer> finishedPlaylist = new ArrayList<MediaPlayer>();
        for (int i = 0; i < finishList.size(); i++) {
            try {
                URL url = Music.class.getResource("../Music/" + finishList.get(i));
                Media media = new Media(url.toString());
                MediaPlayer listPlayer = new MediaPlayer(media);
                finishedPlaylist.add(listPlayer);
                //volume = 1.0;
            } catch (RuntimeException re) {

            }
        }

        assertEquals(finishedPlaylist, music.getPlaylist());

    }

    //music.play() tests -------------------------------------------------

    /**
     * tests that .play() is called in play()
     */
    @Test(expected = RuntimeException.class)
    public void playTest() {
        Music music = new Music(mockmusicList);
        Mockito.doThrow(new RuntimeException()).when(p1).play();
        music.play();

    }

    /**
     * tests that setVolume() in play is called
     * @throws Exception
     */
    @Test
    public void testSetVolumeInPlay() throws Exception {
        Music music = new Music(mockmusicList); //set up music with mock etc.

        Mockito.doAnswer(new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {

                Object[] args = invocation.getArguments();
                setVolume = (double) args[0]; //this line gets the float value put into p1.setVolume(volume) and makes our setVolume variable equal to that.
                return setVolume;
            }
        }).when(p1).setVolume(anyFloat());
        //test the value of volume and setVolume are initially different.
        assertNotEquals(volume, setVolume); //not sure of the 'assert' method to do this
        music.play(); //call the play function that will call player.setVolume(volume);
        //now test that they are equal after we start playing. this means the play successfully set the volume of the player.
        assertEquals(volume, setVolume, 0.0);
    }

    /**
     * Tests that setMute is called in play()
     * @throws Exception
     */
    @Test
    public void testSetMuteInPlay() throws Exception {
        Music music = new Music(mockmusicList);

        Mockito.doAnswer(new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {

                Object[] args = invocation.getArguments();
                setMute = (boolean) args[0];
                return setMute;
            }
        }).when(p1).setMute(anyBoolean());
        assertNotEquals(musicMute, setMute);
        music.play();
        assertEquals(musicMute, setMute);
    }

    // music.playDayMusic() tests ---------------------------------------------------------------

    //ArrayList for testing playDayMusic below
    ArrayList<String> grabbedDayList = new ArrayList<String>();

    /**
     * Testing playDayMusic()
     */
    @Test
    public void testPlayDayMusic() {
        Music music = PowerMockito.mock(Music.class);

        PowerMockito.doCallRealMethod().when(music).playDayMusic();
        PowerMockito.doCallRealMethod().when(music).setDayPassed(anyBoolean());
        PowerMockito.doCallRealMethod().when(music).getDayPassed();
        PowerMockito.doCallRealMethod().when(music).isDay();

        ArrayList<String> dayListTrue = new ArrayList<String>();
        ArrayList<String> dayListFalse = new ArrayList<String>();

        dayListTrue.add("beach.mp3");
        dayListTrue.add("collapse.mp3");

        dayListFalse.add("collapse.mp3");
        dayListFalse.add("beach.mp3");

        music.setDayPassed(true);

        Mockito.doAnswer(new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                Object[] args = invocation.getArguments();
                grabbedDayList = (ArrayList<String>) args[0];
                return grabbedDayList;
            }
        }).when(music).changeMusic(anyObject());
        assertNotEquals(grabbedDayList, dayListTrue);
        music.playDayMusic();
        assertEquals(grabbedDayList, dayListTrue);
        assertFalse(music.getDayPassed());
        music.setDayPassed(false);
        music.playDayMusic();
        assertEquals(grabbedDayList, dayListFalse);
        assertTrue(music.getDayPassed());
        assertFalse(music.isDay());
    }

    // music.playNightMusic() tests ---------------------------------------------------------------

    //ArrayList for testing playNightMusic below
    ArrayList<String> grabbedNightList = new ArrayList<String>();

    /**
     * Testing playNightMusic
     */
    @Test
    public void testPlayNightMusic() {
        Music music = PowerMockito.mock(Music.class);

        PowerMockito.doCallRealMethod().when(music).playNightMusic();
        PowerMockito.doCallRealMethod().when(music).setNightPassed(anyBoolean());
        PowerMockito.doCallRealMethod().when(music).isNightPassed();
        PowerMockito.doCallRealMethod().when(music).isDay();

        ArrayList<String> nightListTrue = new ArrayList<String>();
        ArrayList<String> nightListFalse = new ArrayList<String>();

        nightListTrue.add("sad apples.mp3");
        nightListTrue.add("gloomy.mp3");

        nightListFalse.add("gloomy.mp3");
        nightListFalse.add("sad apples.mp3");

        music.setNightPassed(true);

        Mockito.doAnswer(new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                Object[] args = invocation.getArguments();
                grabbedNightList = (ArrayList<String>) args[0];
                return grabbedNightList;
            }
        }).when(music).changeMusic(anyObject());
        assertNotEquals(grabbedNightList, nightListTrue);
        music.playNightMusic();
        assertEquals(grabbedNightList, nightListTrue);
        assertFalse(music.getDayPassed());
        music.setNightPassed(false);
        music.playNightMusic();
        assertEquals(grabbedNightList, nightListFalse);
        assertTrue(music.isNightPassed());
        assertFalse(music.isDay());
    }

    //Fade out tests ---------------------------------------------------------

    /**
     * Testing fadeOut()
     */
    @Test
    public void fadeOutTest() {
        Music music = new Music(mockmusicList);
        ArrayList<Double> grabbedVolumeList = new ArrayList<Double>();

        music.setPlayer(p1);
        double volumeSet = 0.8;
        music.setVolume(volumeSet);

        //Mocks setVolume
        Mockito.doAnswer(new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {

                Object[] args = invocation.getArguments();
                setVolume = (double) args[0]; //this line gets the object value put into p1.setVolume(volume) and makes our setVolume variable equal to that.
                grabbedVolumeList.add(setVolume);
                return setVolume;
            }
        }).when(p1).setVolume(anyDouble());

        //Mocks setMute
        Mockito.doAnswer(new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {

                Object[] args = invocation.getArguments();
                setMute = (boolean) args[0];
                return setMute;
            }
        }).when(p1).setMute(anyBoolean());
        assertNotEquals(music.getMusicMute(), setMute);

        music.fadeOut();
        try {
            Thread.sleep(5500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        assertEquals(grabbedVolumeList.size(), (volumeSet * 1000), 100);
        assertEquals(volumeSet, music.getVolume(), 0.0);
        assertEquals(grabbedVolumeList.get(grabbedVolumeList.size() - 1), 0.0, 0.1);
        assertTrue(music.getMusicMute());
        assertTrue(setMute);
        assertTrue(music.getMusicMute());

    }

    //Fade in tests ---------------------------------------------------------

    /**
     * Tests fadeIn()
     */
    @Test
    public void fadeInTest() {
        Music music = new Music(mockmusicList);
        ArrayList<Double> grabbedVolumeList = new ArrayList<Double>();

        music.setPlayer(p1);
        double volumeSet = 0.9;
        music.setVolume(volumeSet);

        //Mocks setVolume
        Mockito.doAnswer(new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {

                Object[] args = invocation.getArguments();
                setVolume = (double) args[0]; //this line gets the float value put into p1.setVolume(volume) and makes our setVolume variable equal to that.
                grabbedVolumeList.add(setVolume);
                return setVolume;
            }
        }).when(p1).setVolume(anyDouble());

        music.fadeIn();
        try {
            Thread.sleep(5500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        assertEquals(music.getVolume(), volumeSet, 0.1);
        assertEquals(grabbedVolumeList.size(), (volumeSet * 1000), 100);
        assertEquals(volumeSet, music.getVolume(), 0.0);
        assertEquals(grabbedVolumeList.get(grabbedVolumeList.size() - 1), 0.9, 0.1);
        assertFalse(music.getMusicMute());

    }

    //test stop() ------------------------------------------------------------------------------

    /**
     * Tests stop() function
     */
    @Test
    public void testingStop(){
        Music music = PowerMockito.mock(Music.class);

        PowerMockito.doCallRealMethod().when(music).setPlayer(p1);
        PowerMockito.doCallRealMethod().when(music).stop();
        music.setPlayer(p1);
        music.stop();

        Mockito.verify(p1).stop();
    }

    //test tickMusicMute() -------------------------------------------------------------------

    /**
     * Tests tickMusicMute()
     */
    @Test
    public void testTickMusicLoop(){
        boolean getMusicLoop = music.getMusicLoop();
        music.tickMusicLoop();
        boolean postMusicLoop = music.getMusicLoop();
        assertFalse(getMusicLoop == postMusicLoop);

    }

    //test MusicMute() -----------------------------------------------------------------------

    /**
     * Tests musicMute() when mute is true and false
     */
    @Test
    public void testMusicMute(){
        Music music = PowerMockito.mock(Music.class);

        PowerMockito.doCallRealMethod().when(music).setMusicMute(anyBoolean());
        PowerMockito.doCallRealMethod().when(music).getMusicMute();

        music.setMusicMute(true);
        assertEquals(music.getMusicMute(), true);

        try {
            PowerMockito.doCallRealMethod().when(music).musicMute();
            music.musicMute();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        Mockito.verify(music).fadeIn();

        music.setMusicMute(false);
        assertEquals(music.getMusicMute(), false);

        try {
            PowerMockito.doCallRealMethod().when(music).musicMute();
            music.musicMute();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        Mockito.verify(music).fadeOut();

    }

    // Test Mute Getters and Setters ---------------------------------------------------------------
    @Test
    public void testMuteGetSet(){
        Music music = new Music(mockmusicList);
        music.setMusicMute(true);
        assertEquals(music.getMusicMute(), true);
    }

    //Test Loop Getters and Setters ----------------------------------------------------------------
    @Test
    public void testLoopGetSet(){
        Music music = new Music(mockmusicList);
        music.setLoop(true);
        assertEquals(music.getMusicLoop(), true);
    }

    //Test MediaPlayer List Get and Set ------------------------------------------------------------
    @Test
    public void testMediaListGetSet(){
        Music music = new Music(mockmusicList);
        music.setPlayer(mockmusicList);
        assertEquals(music.getPlaylist(), mockmusicList);
    }

    //Test MediaPlayer Get and Set -----------------------------------------------------------------
    @Test
    public void testMediaPlayerGetSet(){
        Music music = new Music(mockmusicList);
        music.setPlayer(p1);
        assertEquals(music.getMediaPlayer(), p1);
    }

//    //Test Volume Get and Set ---------------------------------------------------------------------
//    @Test
//    public void testVolumeGetSet(){
//        Music music = new Music(mockmusicList);
//        p1.setVolume(0.4);
//        System.out.println(music.getVolume());
//        assertEquals(music.getVolume(), 0.4, 0.1);
//    }

    //Test TrackIndex Getter and Setter -------------------------------------------------------------
    @Test
    public void testTrackIndexGetSet(){
        Music music = new Music(mockmusicList);
        music.setTrackIndex(1);
        assertEquals(music.getTrackIndex(), 1);
    }

    //Test DayPassed Getter and Setter --------------------------------------------------------------
    @Test
    public void testDayPassedGetSet(){
        Music music = new Music(mockmusicList);
        music.setDayPassed(true);
        assertEquals(music.getDayPassed(), true);
    }

    //Test Day Getter and Setter --------------------------------------------------------------
    @Test
    public void testDayGetSet(){
        Music music = new Music(mockmusicList);
        music.setDay(true);
        assertEquals(music.isDay(), true);
    }

    //Test NightPassed Getter and Setter --------------------------------------------------------------
    @Test
    public void testNightPassedGetSet(){
        Music music = new Music(mockmusicList);
        music.setNightPassed(true);
        assertEquals(music.isNightPassed(), true);
    }

}


text:
<?php
namespace Respect\Foundation\InfoProviders;

class DocumentationFolder extends AbstractFolderFinder
{
    public $searchFolders = array('doc', 'docu', 'documents', 'Documentation', 'docs');

    public function providerPackageIni()
    {
        $iniPath = realpath($this->projectFolder.'/package.ini');

        if (!file_exists($iniPath))
            return;

        $ini = parse_ini_file($iniPath, true);
        return array_search('doc', $ini['roles']);
    }
}


text:
package oci

// SetWorkingDir sets the WorkingDir value in the OCI's config
func (i *Image) SetWorkingDir(dir string) error {
	i.config.Config.WorkingDir = dir
	return i.save()
}


text:
<!doctype html>

    <meta charset="utf-8">
    <title>Velocity Angle</title>
    <link rel="stylesheet" href="../include/style.css">

      Example from Foundation HTML5 Animation with JavaScript

    <canvas id="canvas" width="400" height="400"></canvas>


text:
AdaptivePELE -- Package Description
===================================

.. automodule:: AdaptivePELE.__init__
    :members:
    :undoc-members:
    :show-inheritance:

:mod:`adaptiveSampling` Module
------------------------------

.. automodule:: AdaptivePELE.adaptiveSampling
    :members:
    :undoc-members:
    :show-inheritance:

:mod:`automateRoundsAdaptive` Module
------------------------------------

.. automodule:: AdaptivePELE.automateRoundsAdaptive
    :members:
    :undoc-members:
    :show-inheritance:

Subpackages
-----------

.. toctree::

    AdaptivePELE.analysis
    AdaptivePELE.atomset
    AdaptivePELE.clustering
    AdaptivePELE.simulation
    AdaptivePELE.spawning
    AdaptivePELE.utilities
    AdaptivePELE.validator


text:
'use strict';

module.exports = SQliteAdapter;

var sqlite3 = require('sqlite3').verbose()
  , appConfig = require('../config/application')
  , db = new sqlite3.cached.Database('./db/' + appConfig.database + '.sqlite')
  , Q = require('q');

/**
 * SQliteAdapter.
 * ORM for SQlite3.
 * Used by delegation from all models that maps to a SQL table.
 *
 * @Function
 * @this {SQliteAdapter}
 * @return {SQliteAdapter} The new SQliteAdapter object
 * @throws {Error} Will throw an error if modelName is undefined
 * @throws {Error} Will throw an error if tableName is undefined
 * @throws {Error} Will throw an error if schemaAttrs is undefined
 */
function SQliteAdapter(options) {
  options = options || {};
  if(!options.modelName) { throw new Error('\'modelName\' is undefined'); }
  if(!options.tableName) { throw new Error('\'tableName\' is undefined'); }
  if(!options.schemaAttrs) { throw new Error('\'schemaAttrs\' is undefined'); }

  return {
    modelName: options.modelName,
    tableName: options.tableName,
    schemaAttrs: options.schemaAttrs,
    associations: options.associations,
    create: create,
    destroy: destroy,
    find: find,
    findAll: findAll,
    update: update
  };
}

/**
 * Creates a new model.
 *
 * @this {SQliteAdapter}
 * @param {Object} insertAttrs - insert attributes for model
 * @return {Promise} A promise to the create result
 */
var create = function create(insertAttrs) {
  insertAttrs = insertAttrs || {};

  validateAttrs.call(this, [insertAttrs]);

  var insertStmt = insertStatement(insertAttrs);
  return exec('INSERT INTO ' + this.tableName + ' ' + insertStmt).then(function(res) {
    return res;
  });
};

/**
 * Destroy a model.
 *
 * @this {SQliteAdapter}
 * @param {Object} selectAttrs - select attributes for model
 * @return {Promise} A promise to the destroy result
 */
var destroy = function(selectAttrs) {
  selectAttrs = selectAttrs || {};

  validateAttrs.call(this, [selectAttrs]);

  var selectStmt = selectStatement(selectAttrs);
  return exec('DELETE FROM ' + this.tableName + ' ' + selectStmt).then(function(res) {
    return res;
  });
};

/**
 * Find a model.
 *
 * @this {SQliteAdapter}
 * @param {Object} - select attributes for model
 * @param {Array|undefined} - projection attributes for model or an empty parameter
 * @return {Promise} A promise to the find result
 */
var find = function(selectAttrs, projectionAttrs) {
  selectAttrs = selectAttrs || {};
  projectionAttrs = projectionAttrs || [];

  validateAttrs.call(this, [selectAttrs, projectionAttrs]);

  var selectStmt = selectStatement(selectAttrs);
  var projectionStmt = projectionStatement(projectionAttrs);
  return all('SELECT ' + projectionStmt + ' FROM ' + this.tableName + ' ' + selectStmt + ' LIMIT 1').then(function(model) {
    return model;
  });
};

/**
 * Find all models.
 *
 * @this {SQliteAdapter}
 * @param {Object|Array} - select or projection attributes for models
 * @param {Array|null} - projection attributes for models or empty parameter
 * @return {Promise} A promise to the findAll result
 */
var findAll = function(attrs, projectionAttrs) {
  /**
   * Query for all without selection
   * Or use projectionAttrs if sent as first parameter
   */
  if((attrs === undefined || attrs === null) || Array.isArray(attrs)) {
    projectionAttrs = attrs || [];

    validateAttrs.call(this, [projectionAttrs]);

    return all('SELECT ' + projectionStatement(projectionAttrs) + ' FROM ' + this.tableName).then(function(models) {
      return models;
    });

  /**
   * Query for all with selection
   * And use projectionAttrs if present
   */
  } else {
    attrs = attrs || {};
    projectionAttrs = projectionAttrs || [];

    validateAttrs.call(this, [attrs, projectionAttrs]);
    var selectStmt = selectStatement(attrs);

    return all('SELECT ' + projectionStatement(projectionAttrs) + ' FROM ' + this.tableName + ' ' + selectStmt).then(function(models) {
      return models;
    });
  }
};

/**
 * Updates model.
 *
 * @this {SQliteAdapter}
 * @param {Object} selectAttrs - select attributes for model
 * @param {Object} updateAttrs - update attributes for model
 * @return {Promise} A promise to the update result
 */
var update = function(selectAttrs, updateAttrs) {
  selectAttrs = selectAttrs || {};
  updateAttrs = updateAttrs || {};

  validateAttrs.call(this, [selectAttrs, updateAttrs]);

  var updateSmt = updateStatement(selectAttrs, updateAttrs);
  return exec('UPDATE ' + this.tableName + ' SET ' + updateSmt).then(function(res) {
    return res;
  });
};

/**
* Validates attributes to be used in SQL query.
*
* @private
* @this {SQliteAdapter}
* @param {Object} attrs - attributes to be validated
* @throws {Error} Will throw an error if attributes are invalid
*/
var validateAttrs = function(attrs) {
  var valid = false;
  var invalidAttrs;

  if (attrs !== undefined && attrs !== null) {
    attrs.forEach(function(setOfAttrs) {
      if(!Array.isArray(setOfAttrs)) {
        setOfAttrs = Object.keys(setOfAttrs);
      }
      invalidAttrs = setOfAttrs.filter(function(attr) {
        return this.schemaAttrs.indexOf(attr) < 0;
      }, this);
      valid = (invalidAttrs.length === 0) ? true : false;
    }, this);
  }

  if(!valid) {
    appConfig.logger.error('Invalid attributes: ', attrs);
    throw new Error('Invalid attributes: ' + attrs);
  }
};

/**
* Creates projection statement for SQL query.
*
* @private
* @param {Array} projectionAttrs - projection attributes for query
* @return {String} Projection statement
*/
function projectionStatement(projectionAttrs) {
  projectionAttrs = projectionAttrs || [];
  if(projectionAttrs.length > 0) {
    return projectionAttrs.join(',');
  } else {
    return '*';
  }
}

/**
* Creates insert statement for SQL query.
*
* @private
* @param {Object} insertAttrs - insert attributes for query
* @return {String} Insert statement
*/
function insertStatement(insertAttrs) {
  var columns = [];
  var values  = [];
  Object.keys(insertAttrs).forEach(function(attr) {
    columns.push(attr);
    values.push(insertAttrs[attr]);
  });
  return '(' + columns.join(',') + ') VALUES (\'' + values.join('\',\'') + '\')';
}

/**
* Creates select statement for SQL query.
*
* @private
* @param {Object} selectAttrs - select attributes for query
* @return {String} Select statement
*/
function selectStatement(selectAttrs) {
  selectAttrs = Object.keys(selectAttrs).map(function(attr) {
    // attribute is an SQL operator
    if(selectAttrs[attr] instanceof Object) {
      var operator = Object.keys(selectAttrs[attr])[0];
      var operatorPredicate = selectAttrs[attr][operator];

      if(Array.isArray(operatorPredicate)) {
        if(operator === 'between') {
          return (attr + ' BETWEEN ' + '\'' + operatorPredicate[0] + '\'' +
                            ' AND ' + '\'' + operatorPredicate[1] + '\'');
        }
      } else {
        return (attr + ' ' + operator + ' \'' + selectAttrs[attr] + '\'');
      }

    } else {
      return (attr + ' = ' + '\'' + selectAttrs[attr] + '\'');
    }
  }).join(' AND ');
  return 'WHERE ' + selectAttrs;
}

/**
* Creates update statement for SQL query.
*
* @private
* @param {Object} selectAttrs - select attributes for query
* @param {Object} updateAttrs - update attributes for query
* @return {String} Update statament
*/
function updateStatement(selectAttrs, updateAttrs) {
  selectAttrs = selectStatement(selectAttrs);
  updateAttrs = Object.keys(updateAttrs).map(function(attr) {
    return (attr + ' = ' + '\'' + updateAttrs[attr] + '\'');
  }).join(',');
  return updateAttrs + ' ' + selectAttrs;
}

/**
* Runs query to get all result rows.
*
* @private
* @param {String} query - query
* @return {Promise} A promise to the all result
*/
function all(query) {
  return new Q.promise(function(resolve, reject) {
    db.serialize(function() {
      appConfig.logger.info(new Date().toISOString(), query);
      db.all(query, function(err, models) {
        if(err) reject(err);
        resolve(models);
      });
    });
  });
}

/**
* Runs query and no result rows are retrieved.
*
* @private
* @param {String} query - query
* @return {Promise} A promise to the exec result
*/
function exec(query) {
  return new Q.promise(function(resolve, reject) {
    db.serialize(function() {
      appConfig.logger.info(new Date().toISOString(), query);
      db.exec(query, function(err, _) {
        if(err) reject(err);
        resolve(_);
      });
    });
  });
}

/**
* Creates database.
*
* @private
* @return {Promise} A promise to the createDB result
*/
SQliteAdapter.createDB = function() {
  var schema = appConfig.schema;
  return exec(schema).then(function(res) {
    return res;
  }).catch(function(err) {
    appConfig.logger.error(err.stack);
  });
};

/**
* Deletes database.
*
* @private
* @return {Promise} A promise to the deleteDB result
*/
SQliteAdapter.deleteDB = function() {
  return all('SELECT name FROM sqlite_master WHERE type=\'table\'').then(function(tables) {
    return tables.filter(function(table) {
      if(table.name !== 'sqlite_sequence')
        return table;
    });
  }).then(function(tables) {
    return tables.forEach(function(table) {
      exec('DELETE FROM ' + table.name).then(function(res) {
        return res;
      });
    });
  }).then(function() {
    return exec('VACUUM').then(function(res) {
      return res;
    });
  }).catch(function(err) {
    appConfig.logger.error(err.stack);
  });
};


text:
class MCWorkflowProcessTemplatesComponentController {
    /*@ngInit*/
    constructor(templates, workflowProcessTemplatesService) {
        this.templates = templates.get();
        this.recentlySelectedTemplates = workflowProcessTemplatesService.getRecentTemplates();
        this.sortOrder = workflowProcessTemplatesService.sortOrder;
        this.sortOrderRecentlySelected = workflowProcessTemplatesService.sortOrderRecentlySelected;
        this.workflowProcessTemplatesService = workflowProcessTemplatesService;
    }

    $onDestroy() {
        this.workflowProcessTemplatesService.sortOrder = this.sortOrder;
        this.workflowProcessTemplatesService.sortOrderRecentlySelected = this.sortOrderRecentlySelected;
    }

    chooseTemplate(t) {
        if (this.onSelected) {
            let i = _.findIndex(this.recentlySelectedTemplates, {name: t.name});
            if (i === -1) {
                this.recentlySelectedTemplates.push(t);
            }
            this.onSelected({templateId: t.name, processId: ''});
        }
    }
}

angular.module('materialscommons').component('mcWorkflowProcessTemplates', {
    template: require('./mc-workflow-process-templates.html'),
    controller: MCWorkflowProcessTemplatesComponentController,
    bindings: {
        onSelected: '&'
    }
});


text:
/**
 * Main controller for Ghost frontend
 */

/*global require, module */

var moment      = require('moment'),
    RSS         = require('rss'),
    _           = require('lodash'),
    url         = require('url'),
    Promise     = require('bluebird'),
    api         = require('../api'),
    config      = require('../config'),
    filters     = require('../filters'),
    template    = require('../helpers/template'),
    errors      = require('../errors'),
    cheerio     = require('cheerio'),
    routeMatch  = require('path-match')(),

    frontendControllers,
    staticPostPermalink,

// Cache static post permalink regex
staticPostPermalink = routeMatch('/:slug/:edit?');

function getPostPage(options) {
    return api.settings.read('postsPerPage').then(function (response) {
        var postPP = response.settings[0],
            postsPerPage = parseInt(postPP.value, 10);

        // No negative posts per page, must be number
        if (!isNaN(postsPerPage) && postsPerPage > 0) {
            options.limit = postsPerPage;
        }
        options.include = 'author,tags,fields';
        return api.posts.browse(options);
    });
}

function formatPageResponse(posts, page) {
    // Delete email from author for frontend output
    // TODO: do this on API level if no context is available
    posts = _.each(posts, function (post) {
        if (post.author) {
            delete post.author.email;
        }
        return post;
    });
    return {
        posts: posts,
        pagination: page.meta.pagination
    };
}

function formatResponse(post) {
    // Delete email from author for frontend output
    // TODO: do this on API level if no context is available
    if (post.author) {
        delete post.author.email;
    }
    return {post: post};
}

function handleError(next) {
    return function (err) {
        return next(err);
    };
}

function setResponseContext(req, res, data) {
    var contexts = [],
        pageParam = req.params.page !== undefined ? parseInt(req.params.page, 10) : 1;

    // paged context
    if (!isNaN(pageParam) && pageParam > 1) {
        contexts.push('paged');
    }

    if (req.route.path === '/page/:page/') {
        contexts.push('index');
    } else if (req.route.path === '/') {
        contexts.push('home');
        contexts.push('index');
    } else if (/\/rss\/(:page\/)?$/.test(req.route.path)) {
        contexts.push('rss');
    } else if (/^\/tag\//.test(req.route.path)) {
        contexts.push('tag');
    } else if (/^\/author\//.test(req.route.path)) {
        contexts.push('author');
    } else if (data && data.post && data.post.page) {
        contexts.push('page');
    } else {
        contexts.push('post');
    }

    res.locals.context = contexts;
}

// Add Request context parameter to the data object
// to be passed down to the templates
function setReqCtx(req, data) {
    (Array.isArray(data) ? data : [data]).forEach(function (d) {
        d.secure = req.secure;
    });
}

/**
 * Returns the paths object of the active theme via way of a promise.
 * @return {Promise} The promise resolves with the value of the paths.
 */
function getActiveThemePaths() {
    return api.settings.read({
        key: 'activeTheme',
        context: {
            internal: true
        }
    }).then(function (response) {
        var activeTheme = response.settings[0],
            paths = config.paths.availableThemes[activeTheme.value];

        return paths;
    });
}

frontendControllers = {
    homepage: function (req, res, next) {
        // Parse the page number
        var pageParam = req.params.page !== undefined ? parseInt(req.params.page, 10) : 1,
            options = {
                page: pageParam
            };

        // No negative pages, or page 1
        if (isNaN(pageParam) || pageParam < 1 || (pageParam === 1 && req.route.path === '/page/:page/')) {
            return res.redirect(config.paths.subdir + '/');
        }

        return getPostPage(options).then(function (page) {
            // If page is greater than number of pages we have, redirect to last page
            if (pageParam > page.meta.pagination.pages) {
                return res.redirect(page.meta.pagination.pages === 1 ? config.paths.subdir + '/' : (config.paths.subdir + '/page/' + page.meta.pagination.pages + '/'));
            }

            setReqCtx(req, page.posts);

            // Render the page of posts
            filters.doFilter('prePostsRender', page.posts).then(function (posts) {
                getActiveThemePaths().then(function (paths) {
                    var view = paths.hasOwnProperty('home.hbs') ? 'home' : 'index';

                    // If we're on a page then we always render the index
                    // template.
                    if (pageParam > 1) {
                        view = 'index';
                    }

                    setResponseContext(req, res);
                    res.render(view, formatPageResponse(posts, page));
                });
            });
        }).catch(handleError(next));
    },
    tag: function (req, res, next) {
        // Parse the page number
        var pageParam = req.params.page !== undefined ? parseInt(req.params.page, 10) : 1,
            options = {
                page: pageParam,
                tag: req.params.slug
            };

        // Get url for tag page
        function tagUrl(tag, page) {
            var url = config.paths.subdir + '/tag/' + tag + '/';

            if (page && page > 1) {
                url += 'page/' + page + '/';
            }

            return url;
        }

        // No negative pages, or page 1
        if (isNaN(pageParam) || pageParam < 1 || (req.params.page !== undefined && pageParam === 1)) {
            return res.redirect(tagUrl(options.tag));
        }

        return getPostPage(options).then(function (page) {
            // If page is greater than number of pages we have, redirect to last page
            if (pageParam > page.meta.pagination.pages) {
                return res.redirect(tagUrl(options.tag, page.meta.pagination.pages));
            }

            setReqCtx(req, page.posts);
            if (page.meta.filters.tags) {
                setReqCtx(req, page.meta.filters.tags[0]);
            }

            // Render the page of posts
            filters.doFilter('prePostsRender', page.posts).then(function (posts) {
                getActiveThemePaths().then(function (paths) {
                    var view = template.getThemeViewForTag(paths, options.tag),

                        // Format data for template
                        result = _.extend(formatPageResponse(posts, page), {
                            tag: page.meta.filters.tags ? page.meta.filters.tags[0] : ''
                        });

                    // If the resulting tag is '' then 404.
                    if (!result.tag) {
                        return next();
                    }
                    setResponseContext(req, res);
                    res.render(view, result);
                });
            });
        }).catch(handleError(next));
    },
    author: function (req, res, next) {
        // Parse the page number
        var pageParam = req.params.page !== undefined ? parseInt(req.params.page, 10) : 1,
            options = {
                page: pageParam,
                author: req.params.slug
            };

        // Get url for tag page
        function authorUrl(author, page) {
            var url = config.paths.subdir + '/author/' + author + '/';

            if (page && page > 1) {
                url += 'page/' + page + '/';
            }

            return url;
        }

        // No negative pages, or page 1
        if (isNaN(pageParam) || pageParam < 1 || (req.params.page !== undefined && pageParam === 1)) {
            return res.redirect(authorUrl(options.author));
        }

        return getPostPage(options).then(function (page) {
            // If page is greater than number of pages we have, redirect to last page
            if (pageParam > page.meta.pagination.pages) {
                return res.redirect(authorUrl(options.author, page.meta.pagination.pages));
            }

            setReqCtx(req, page.posts);
            if (page.meta.filters.author) {
                setReqCtx(req, page.meta.filters.author);
            }

            // Render the page of posts
            filters.doFilter('prePostsRender', page.posts).then(function (posts) {
                getActiveThemePaths().then(function (paths) {
                    var view = paths.hasOwnProperty('author.hbs') ? 'author' : 'index',

                        // Format data for template
                        result = _.extend(formatPageResponse(posts, page), {
                            author: page.meta.filters.author ? page.meta.filters.author : ''
                        });

                    // If the resulting author is '' then 404.
                    if (!result.author) {
                        return next();
                    }

                    setResponseContext(req, res);
                    res.render(view, result);
                });
            });
        }).catch(handleError(next));
    },

    single: function (req, res, next) {
        var path = req.path,
            params,
            usingStaticPermalink = false;

        api.settings.read('permalinks').then(function (response) {
            var permalink = response.settings[0],
                editFormat,
                postLookup,
                match;

            editFormat = permalink.value[permalink.value.length - 1] === '/' ? ':edit?' : '/:edit?';

            // Convert saved permalink into a path-match function
            permalink = routeMatch(permalink.value + editFormat);
            match = permalink(path);

            // Check if the path matches the permalink structure.
            //
            // If there are no matches found we then
            // need to verify it's not a static post,
            // and test against that permalink structure.
            if (match === false) {
                match = staticPostPermalink(path);
                // If there are still no matches then return.
                if (match === false) {
                    // Reject promise chain with type 'NotFound'
                    return Promise.reject(new errors.NotFoundError());
                }

                usingStaticPermalink = true;
            }

            params = match;

            // Sanitize params we're going to use to lookup the post.
            postLookup = _.pick(params, 'slug', 'id');
            // Add author, tag and fields
            postLookup.include = 'author,tags,fields';

            // Query database to find post
            return api.posts.read(postLookup);
        }).then(function (result) {
            var post = result.posts[0],
                slugDate = [],
                slugFormat = [];

            if (!post) {
                return next();
            }

            function render() {
                // If we're ready to render the page but the last param is 'edit' then we'll send you to the edit page.
                if (params.edit) {
                    params.edit = params.edit.toLowerCase();
                }
                if (params.edit === 'edit') {
                    return res.redirect(config.paths.subdir + '/ghost/editor/' + post.id + '/');
                } else if (params.edit !== undefined) {
                    // reject with type: 'NotFound'
                    return Promise.reject(new errors.NotFoundError());
                }

                setReqCtx(req, post);

                filters.doFilter('prePostsRender', post).then(function (post) {
                    getActiveThemePaths().then(function (paths) {
                        var view = template.getThemeViewForPost(paths, post),
                            response = formatResponse(post);

                        setResponseContext(req, res, response);

                        res.render(view, response);
                    });
                });
            }

            // If we've checked the path with the static permalink structure
            // then the post must be a static post.
            // If it is not then we must return.
            if (usingStaticPermalink) {
                if (post.page) {
                    return render();
                }

                return next();
            }

            // If there is an author parameter in the slug, check that the
            // post is actually written by the given author\
            if (params.author) {
                if (post.author.slug === params.author) {
                    return render();
                }
                return next();
            }

            // If there is any date based paramter in the slug
            // we will check it against the post published date
            // to verify it's correct.
            if (params.year || params.month || params.day) {
                if (params.year) {
                    slugDate.push(params.year);
                    slugFormat.push('YYYY');
                }

                if (params.month) {
                    slugDate.push(params.month);
                    slugFormat.push('MM');
                }

                if (params.day) {
                    slugDate.push(params.day);
                    slugFormat.push('DD');
                }

                slugDate = slugDate.join('/');
                slugFormat = slugFormat.join('/');

                if (slugDate === moment(post.published_at).format(slugFormat)) {
                    return render();
                }

                return next();
            }

            return render();
        }).catch(function (err) {
            // If we've thrown an error message
            // of type: 'NotFound' then we found
            // no path match.
            if (err.type === 'NotFoundError') {
                return next();
            }

            return handleError(next)(err);
        });
    },
    rss: function (req, res, next) {
        function isPaginated() {
            return req.route.path.indexOf(':page') !== -1;
        }

        function isTag() {
            return req.route.path.indexOf('/tag/') !== -1;
        }

        function isAuthor() {
            return req.route.path.indexOf('/author/') !== -1;
        }

        // Initialize RSS
        var pageParam = req.params.page !== undefined ? parseInt(req.params.page, 10) : 1,
            slugParam = req.params.slug,
            baseUrl = config.paths.subdir;

        if (isTag()) {
            baseUrl += '/tag/' + slugParam + '/rss/';
        } else if (isAuthor()) {
            baseUrl += '/author/' + slugParam + '/rss/';
        } else {
            baseUrl += '/rss/';
        }

        // No negative pages, or page 1
        if (isNaN(pageParam) || pageParam < 1 || (pageParam === 1 && isPaginated())) {
            return res.redirect(baseUrl);
        }

        return Promise.all([
            api.settings.read('title'),
            api.settings.read('description'),
            api.settings.read('permalinks')
        ]).then(function (result) {
            var options = {};

            if (pageParam) { options.page = pageParam; }
            if (isTag()) { options.tag = slugParam; }
            if (isAuthor()) { options.author = slugParam; }

            options.include = 'author,tags,fields';

            return api.posts.browse(options).then(function (page) {
                var title = result[0].settings[0].value,
                    description = result[1].settings[0].value,
                    permalinks = result[2].settings[0],
                    majorMinor = /^(\d+\.)?(\d+)/,
                    trimmedVersion = res.locals.version,
                    siteUrl = config.urlFor('home', {secure: req.secure}, true),
                    feedUrl = config.urlFor('rss', {secure: req.secure}, true),
                    maxPage = page.meta.pagination.pages,
                    feed;

                trimmedVersion = trimmedVersion ? trimmedVersion.match(majorMinor)[0] : '?';

                if (isTag()) {
                    if (page.meta.filters.tags) {
                        title = page.meta.filters.tags[0].name + ' - ' + title;
                        feedUrl = siteUrl + 'tag/' + page.meta.filters.tags[0].slug + '/rss/';
                    }
                }

                if (isAuthor()) {
                    if (page.meta.filters.author) {
                        title = page.meta.filters.author.name + ' - ' + title;
                        feedUrl = siteUrl + 'author/' + page.meta.filters.author.slug + '/rss/';
                    }
                }

                feed = new RSS({
                    title: title,
                    description: description,
                    generator: 'Ghost ' + trimmedVersion,
                    feed_url: feedUrl,
                    site_url: siteUrl,
                    ttl: '60'
                });

                // If page is greater than number of pages we have, redirect to last page
                if (pageParam > maxPage) {
                    return res.redirect(baseUrl + maxPage + '/');
                }

                setReqCtx(req, page.posts);
                setResponseContext(req, res);

                filters.doFilter('prePostsRender', page.posts).then(function (posts) {
                    posts.forEach(function (post) {
                        var item = {
                                title: post.title,
                                guid: post.uuid,
                                url: config.urlFor('post', {post: post, permalinks: permalinks}, true),
                                date: post.published_at,
                                categories: _.pluck(post.tags, 'name'),
                                author: post.author ? post.author.name : null
                            },
                            htmlContent = cheerio.load(post.html, {decodeEntities: false});

                        if (post.image) {
                            htmlContent('p').first().before('<img src="' + post.image + '" />');
                            htmlContent('img').attr('alt', post.title);
                        }

                        // convert relative resource urls to absolute
                        ['href', 'src'].forEach(function (attributeName) {
                            htmlContent('[' + attributeName + ']').each(function (ix, el) {
                                var baseUrl,
                                    attributeValue,
                                    parsed;

                                el = htmlContent(el);

                                attributeValue = el.attr(attributeName);

                                // if URL is absolute move on to the next element
                                try {
                                    parsed = url.parse(attributeValue);

                                    if (parsed.protocol) {
                                        return;
                                    }
                                } catch (e) {
                                    return;
                                }

                                // compose an absolute URL

                                // if the relative URL begins with a '/' use the blog URL (including sub-directory)
                                // as the base URL, otherwise use the post's URL.
                                baseUrl = attributeValue[0] === '/' ? siteUrl : item.url;

                                // prevent double slashes
                                if (baseUrl.slice(-1) === '/' && attributeValue[0] === '/') {
                                    attributeValue = attributeValue.substr(1);
                                }

                                // make sure URL has a trailing slash
                                try {
                                    parsed = url.parse(attributeValue);

                                    if (parsed.pathname && parsed.pathname.slice(-1) !== '/') {
                                        parsed.pathname += '/';

                                        attributeValue = url.format(parsed);
                                    }
                                } catch (e) {
                                    // if the URL we've built cannot be parsed, fall back to the unprocessed URL
                                    return;
                                }

                                attributeValue = baseUrl + attributeValue;
                                el.attr(attributeName, attributeValue);
                            });
                        });

                        item.description = htmlContent.html();
                        feed.item(item);
                    });
                }).then(function () {
                    res.set('Content-Type', 'application/rss+xml; charset=UTF-8');
                    res.send(feed.xml());
                });
            });
        }).catch(handleError(next));
    }
};

module.exports = frontendControllers;


text:
var bescribe = require('be-paige/bescribe'),
  common = require('../common/common.js'),
  data = require('../common/data.js'),
  TheQuizPage = require('../../lib/the-quiz/the-quiz.js'),
  SignUpPage = require('../../lib/sign-up/sign-up.js'),
  MonthlyBoxPage = require('../../lib/monthly-box/monthly-box.js'),
  CreateAccountPage = require('../../lib/customer/account/create.js'),
  SignUpHelper = require('./sign-upHelper.js');

// Global variables
var signUpPageContext;

// Tests
bescribe("Sign up", common.config, function(context, describe, it) {

  // Before each test, take the quizz and go the signup page
  beforeEach(function() {
    signUpPageContext = context.Page.build()
      .redirectTo(TheQuizPage)
      .goEndQuiz()
      .clickYesShippingUsa()
      .submitQuizForm()
      .switchTo(SignUpPage);
  });

  describe("Accepted registration", function() {
    it("Should sign up successfully", function() {
      signUpPageContext
        .createNewAccount(data.createNewAccount())
        .switchTo(MonthlyBoxPage)
        .onPage();
    });
  });

  describe("Refused registration", function() {
    it("Should refused the sign-up because the account already exists", function() {
      signUpPageContext
        .createNewAccount(data.account)
        .switchTo(CreateAccountPage)
        .onPage();
    });
  });

});


text:
const RAF = window.requestAnimationFrame
  || window.mozRequestAnimationFrame
  || window.webkitRequestAnimationFrame
  || window.msRequestAnimationFrame;

export default RAF;


text:
# libxlsxwriter

Libxlsxwriter: A C library for creating Excel XLSX files.

![demo image](http://libxlsxwriter.github.io/demo.png)

## The libxlsxwriter library

Libxlsxwriter is a C library that can be used to write text, numbers, formulas
and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file.

It supports features such as:

- 100% compatible Excel XLSX files.
- Full Excel formatting.
- Merged cells.
- Defined names.
- Autofilters.
- Charts.
- Data validation and drop down lists.
- Worksheet PNG/JPEG images.
- Memory optimization mode for writing large files.
- Source code available on [GitHub](https://github.com/jmcnamara/libxlsxwriter).
- FreeBSD license.
- ANSI C.
- Works with GCC, Clang, Xcode, MSVC 2015, ICC, TCC, MinGW, MingGW-w64/32.
- Works on Linux, FreeBSD, OpenBSD, OS X, iOS and Windows. Also works on MSYS/MSYS2 and Cygwin.
- Compiles for 32 and 64 bit.
- Compiles and works on big and little endian systems.
- The only dependency is on `zlib`.

Here is an example that was used to create the spreadsheet shown above:

```C
#include "xlsxwriter.h"

int main() {

    /* Create a new workbook and add a worksheet. */
    lxw_workbook  *workbook  = workbook_new("demo.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    /* Add a format. */
    lxw_format *format = workbook_add_format(workbook);

    /* Set the bold property for the format */
    format_set_bold(format);

    /* Change the column width for clarity. */
    worksheet_set_column(worksheet, 0, 0, 20, NULL);

    /* Write some simple text. */
    worksheet_write_string(worksheet, 0, 0, "Hello", NULL);

    /* Text with formatting. */
    worksheet_write_string(worksheet, 1, 0, "World", format);

    /* Write some numbers. */
    worksheet_write_number(worksheet, 2, 0, 123,     NULL);
    worksheet_write_number(worksheet, 3, 0, 123.456, NULL);

    /* Insert an image. */
    worksheet_insert_image(worksheet, 1, 2, "logo.png");

    workbook_close(workbook);

    return 0;
}

```

See the [full documentation](http://libxlsxwriter.github.io) for the getting
started guide, a tutorial, the main API documentation and examples.


text:
namespace Apache.Ignite.Core.Tests
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Apache.Ignite.Core.Compute;
    using Apache.Ignite.Core.Events;
    using Apache.Ignite.Core.Messaging;
    using NUnit.Framework;

    /// <summary>
    /// Base class for all grid tests.
    /// </summary>
    [Serializable]
    public abstract class IgniteTestBase
    {
        /** Grids. */
        [NonSerialized]
        private IIgnite[] _grids;

        /** Config urls. */
        [NonSerialized]
        private readonly string[] _springUrls;

        /** Expected entry count by the end of the test. */
        [NonSerialized]
        private readonly int _expectedHandleRegistryEntries;

        /// <summary>
        /// Initializes a new instance of the <see cref="IgniteTestBase"/> class.
        /// </summary>
        /// <param name="springUrls">The spring urls.</param>
        protected IgniteTestBase(params string[] springUrls)
            : this(0, springUrls)
        {
            // No-op.
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="IgniteTestBase"/> class.
        /// </summary>
        /// <param name="springUrls">The spring urls.</param>
        /// <param name="expectedHandleRegistryEntries">The expected handle registry entries.</param>
        protected IgniteTestBase(int expectedHandleRegistryEntries, params string[] springUrls)
        {
            _springUrls = springUrls.ToArray();

            _grids = new IIgnite[_springUrls.Length];

            Assert.IsTrue(_grids.Length > 0);

            _expectedHandleRegistryEntries = expectedHandleRegistryEntries;
        }

        /// <summary>
        /// Gets the grid1.
        /// </summary>
        public IIgnite Grid
        {
            get { return _grids[0]; }
        }

        /// <summary>
        /// Gets the grid2.
        /// </summary>
        public IIgnite Grid2
        {
            get { return _grids[1]; }
        }

        /// <summary>
        /// Gets the grid3.
        /// </summary>
        public IIgnite Grid3
        {
            get { return _grids[2]; }
        }

        /// <summary>
        /// Gets the events.
        /// </summary>
        public IEvents Events
        {
            get { return Grid.GetEvents(); }
        }

        /// <summary>
        /// Gets the messaging.
        /// </summary>
        public IMessaging Messaging
        {
            get { return Grid.GetMessaging(); }
        }

        /// <summary>
        /// Gets the compute.
        /// </summary>
        public ICompute Compute
        {
            get { return Grid.GetCompute(); }
        }

        /// <summary>
        /// Gets the grids.
        /// </summary>
        public ICollection<IIgnite> Grids
        {
            get { return _grids; }
        }

        /// <summary>
        /// Fixture tear down.
        /// </summary>
        [TestFixtureTearDown]
        public virtual void FixtureTearDown()
        {
            StopGrids();
        }

        /// <summary>
        /// Executes before each test.
        /// </summary>
        [SetUp]
        public virtual void TestSetUp()
        {
            StartGrids();
        }

        /// <summary>
        /// Executes after each test.
        /// </summary>
        [TearDown]
        public virtual void TestTearDown()
        {
            try
            {
                TestUtils.AssertHandleRegistryHasItems(1000, _expectedHandleRegistryEntries, _grids);
            }
            catch (Exception)
            {
                // Restart grids to cleanup
                StopGrids();

                throw;
            }
        }

        /// <summary>
        /// Starts the grids.
        /// </summary>
        private void StartGrids()
        {
            if (Grid != null)
                return;

            _grids = _springUrls.Select(x => Ignition.Start(GetConfiguration(x))).ToArray();
        }

        /// <summary>
        /// Gets the grid configuration.
        /// </summary>
        protected virtual IgniteConfiguration GetConfiguration(string springConfigUrl)
        {
            return new IgniteConfiguration
            {
                SpringConfigUrl = springConfigUrl,
                JvmClasspath = TestUtils.CreateTestClasspath(),
                JvmOptions = TestUtils.TestJavaOptions()
            };
        }

        /// <summary>
        /// Stops the grids.
        /// </summary>
        private void StopGrids()
        {
            for (var i = 0; i < _grids.Length; i++)
                _grids[i] = null;

            Ignition.StopAll(true);
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

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

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

-->
<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>org.apache.camel</groupId>
        <artifactId>components</artifactId>
        <version>3.9.0-SNAPSHOT</version>
    </parent>

    <artifactId>camel-resilience4j</artifactId>
    <packaging>jar</packaging>

    <name>Camel :: Resilience4j</name>
    <description>Circuit Breaker EIP using Resilience4j</description>

    <properties>
        <firstVersion>3.0.0</firstVersion>
        <label>eip,microservice</label>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core-reifier</artifactId>
        </dependency>

        <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-circuitbreaker</artifactId>
            <version>${resilience4j-version}</version>
            <exclusions>
                <exclusion>
                    <groupId>io.vavr</groupId>
                    <artifactId>vavr</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-bulkhead</artifactId>
            <version>${resilience4j-version}</version>
        </dependency>
        <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-timelimiter</artifactId>
            <version>${resilience4j-version}</version>
        </dependency>
        <dependency>
            <groupId>io.vavr</groupId>
            <artifactId>vavr</artifactId>
            <version>${vavr-version}</version>
        </dependency>
        <dependency>
            <groupId>io.vavr</groupId>
            <artifactId>vavr-match</artifactId>
            <version>${vavr-version}</version>
        </dependency>

        <!-- for testing -->
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-test-spring-junit5</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-management</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>


text:
mkwheelhouse
============

.. image:: https://travis-ci.org/WhoopInc/mkwheelhouse.svg?branch=master
    :target: https://travis-ci.org/WhoopInc/mkwheelhouse
    :align: right

Amazon S3 wheelhouse generator.

Wheels are the latest standard in distributing binary for Python. Wheels
cut down scipy's installation time from 15 minutes to 15 seconds. `Learn more
about wheels. <http://wheel.readthedocs.org/en/latest/>`_

Usage
-----

Generate wheels for all listed ``PACKAGE``\ s and their dependencies,
then upload them to Amazon S3 ``BUCKET``:

.. code:: bash

    $ mkwheelhouse [options] BUCKET [PACKAGE...] [pip-options]

Then install with pip like usual, but preferring generated wheels:

.. code:: bash

    $ pip install --find-links BUCKET/index.html PACKAGE

You can also build a wheelhouse in an `S3 subdirectory`_ by specifying
the full S3 path:

.. code:: bash

    $ mkwheelhouse s3://BUCKET/SUB/DIRECTORY PACKAGE

.. _S3 subdirectory: http://docs.aws.amazon.com/AmazonS3/latest/UG/FolderOperations.html

Additional options
~~~~~~~~~~~~~~~~~~

- ``-h``, ``--help``

  Print usage information and exit.

- ``-e``, ``--exclude WHEEL_FILENAME``

  Don't upload built wheel with filename WHEEL\_FILENAME. Note this is the
  final wheel filename, like ``argparse-1.3.0-py2.py3-none-any.whl``,
  *not* the bare package name.

  Specifying an exclusion will not remove pre-existing built wheels from
  S3; you'll have to remove those wheels from the bucket manually.

- ``-a``, ``--acl POLICY``

  Apply canned ACL policy POLICY to the uploaded wheels and index.
  Specifying ``public-read``, for example, will make the uploaded wheels
  and index publicly accessible, avoiding the need for for a bucket
  policy to do the same. Valid values for POLICY can be found in the
  `AWS documentation`_.

.. _AWS documentation: http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl

Any unrecognized options are passed directly to ``pip wheel``. That
means mkwheelhouse supports requirements files, for example:

.. code:: bash

    $ mkwheelhouse s3://BUCKET -r requirements.txt

Need an install log? Need to compile from source? You got it.

.. code:: bash

    $ mkwheelhouse s3://BUCKET --log log.txt --no-binary :all: numpy

Consult ``pip wheel`` for a complete list of pip-options.

Notes
-----

- Python 2 and 3

- Set a `bucket policy to make all objects publicly accessible
  <http://docs.aws.amazon.com/AmazonS3/latest/dev/AccessPolicyLanguage_UseCases_s3_a.html>`_
  or Pip won't be able to download wheels from your wheelhouse.