text:
/* tslint:disable */

import { ConcreteRequest } from "relay-runtime";
export type CreateSmsSecondFactorInput = {
    readonly attributes: SmsSecondFactorAttributes;
    readonly clientMutationId?: string | null;
};
export type SmsSecondFactorAttributes = {
    readonly countryCode?: string | null;
    readonly phoneNumber?: string | null;
};
export type CreateSmsSecondFactorMutationVariables = {
    input: CreateSmsSecondFactorInput;
};
export type CreateSmsSecondFactorMutationResponse = {
    readonly createSmsSecondFactor: {
        readonly secondFactorOrErrors: {
            readonly __typename: "SmsSecondFactor";
            readonly internalID: string;
        } | {
            readonly __typename: "Errors";
            readonly errors: ReadonlyArray<{
                readonly message: string;
                readonly code: string;
            }>;
        } | {
            /*This will never be '%other', but we need some
            value in case none of the concrete values match.*/
            readonly __typename: "%other";
        };
    } | null;
};
export type CreateSmsSecondFactorMutationRawResponse = {
    readonly createSmsSecondFactor: ({
        readonly secondFactorOrErrors: {
            readonly __typename: "SmsSecondFactor";
            readonly internalID: string;
        } | {
            readonly __typename: "Errors";
            readonly errors: ReadonlyArray<{
                readonly message: string;
                readonly code: string;
            }>;
        } | {
            readonly __typename: string | null;
        };
    }) | null;
};
export type CreateSmsSecondFactorMutation = {
    readonly response: CreateSmsSecondFactorMutationResponse;
    readonly variables: CreateSmsSecondFactorMutationVariables;
    readonly rawResponse: CreateSmsSecondFactorMutationRawResponse;
};

/*
mutation CreateSmsSecondFactorMutation(
  $input: CreateSmsSecondFactorInput!
) {
  createSmsSecondFactor(input: $input) {
    secondFactorOrErrors {
      __typename
      ... on SmsSecondFactor {
        __typename
        internalID
      }
      ... on Errors {
        __typename
        errors {
          message
          code
        }
      }
    }
  }
}
*/

const node: ConcreteRequest = (function(){
var v0 = [
  {
    "kind": "LocalArgument",
    "name": "input",
    "type": "CreateSmsSecondFactorInput!",
    "defaultValue": null
  }
],
v1 = [
  {
    "kind": "Variable",
    "name": "input",
    "variableName": "input"
  }
],
v2 = {
  "kind": "ScalarField",
  "alias": null,
  "name": "__typename",
  "args": null,
  "storageKey": null
},
v3 = {
  "kind": "InlineFragment",
  "type": "SmsSecondFactor",
  "selections": [
    (v2/*: any*/),
    {
      "kind": "ScalarField",
      "alias": null,
      "name": "internalID",
      "args": null,
      "storageKey": null
    }
  ]
},
v4 = {
  "kind": "InlineFragment",
  "type": "Errors",
  "selections": [
    (v2/*: any*/),
    {
      "kind": "LinkedField",
      "alias": null,
      "name": "errors",
      "storageKey": null,
      "args": null,
      "concreteType": "Error",
      "plural": true,
      "selections": [
        {
          "kind": "ScalarField",
          "alias": null,
          "name": "message",
          "args": null,
          "storageKey": null
        },
        {
          "kind": "ScalarField",
          "alias": null,
          "name": "code",
          "args": null,
          "storageKey": null
        }
      ]
    }
  ]
};
return {
  "kind": "Request",
  "fragment": {
    "kind": "Fragment",
    "name": "CreateSmsSecondFactorMutation",
    "type": "Mutation",
    "metadata": null,
    "argumentDefinitions": (v0/*: any*/),
    "selections": [
      {
        "kind": "LinkedField",
        "alias": null,
        "name": "createSmsSecondFactor",
        "storageKey": null,
        "args": (v1/*: any*/),
        "concreteType": "CreateSmsSecondFactorPayload",
        "plural": false,
        "selections": [
          {
            "kind": "LinkedField",
            "alias": null,
            "name": "secondFactorOrErrors",
            "storageKey": null,
            "args": null,
            "concreteType": null,
            "plural": false,
            "selections": [
              (v3/*: any*/),
              (v4/*: any*/)
            ]
          }
        ]
      }
    ]
  },
  "operation": {
    "kind": "Operation",
    "name": "CreateSmsSecondFactorMutation",
    "argumentDefinitions": (v0/*: any*/),
    "selections": [
      {
        "kind": "LinkedField",
        "alias": null,
        "name": "createSmsSecondFactor",
        "storageKey": null,
        "args": (v1/*: any*/),
        "concreteType": "CreateSmsSecondFactorPayload",
        "plural": false,
        "selections": [
          {
            "kind": "LinkedField",
            "alias": null,
            "name": "secondFactorOrErrors",
            "storageKey": null,
            "args": null,
            "concreteType": null,
            "plural": false,
            "selections": [
              (v2/*: any*/),
              (v3/*: any*/),
              (v4/*: any*/)
            ]
          }
        ]
      }
    ]
  },
  "params": {
    "operationKind": "mutation",
    "name": "CreateSmsSecondFactorMutation",
    "id": null,
    "text": "mutation CreateSmsSecondFactorMutation(\n  $input: CreateSmsSecondFactorInput!\n) {\n  createSmsSecondFactor(input: $input) {\n    secondFactorOrErrors {\n      __typename\n      ... on SmsSecondFactor {\n        __typename\n        internalID\n      }\n      ... on Errors {\n        __typename\n        errors {\n          message\n          code\n        }\n      }\n    }\n  }\n}\n",
    "metadata": {}
  }
};
})();
(node as any).hash = '2ecc9fd98f69d9f9197cdd78f399016f';
export default node;


text:
require 'docusign_rest'
require 'rails'
module DocusignRest
  class Railtie < Rails::Railtie
    railtie_name :docusign_rest

    rake_tasks do
      load 'tasks/docusign_task.rake'
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('djciv_data', '0010_text_textdelete'),
    ]

    operations = [
        migrations.AlterField(
            model_name='text',
            name='textdelete',
            field=models.BooleanField(),
        ),
    ]


text:
@implementation AddressTypeUtil

+ (NSString *)getAddressName:(AddrType)addressType {
    NSString *key;
    switch (addressType) {
        case MultisigAddrType:
            key = @"address_multisig";
            break;
        case P2SHP2WPKHAddrType:
            key = @"address_segwit";
            break;
        default:
            key = @"address_normal";
            break;
    }
    return NSLocalizedString(key, nil);
}

+ (NSString *)getAddressTypeName:(AddrType)addressType {
    NSString *key;
    switch (addressType) {
        case MultisigAddrType:
            key = @"address_multisig_type";
            break;
        case P2SHP2WPKHAddrType:
            key = @"address_segwit_type";
            break;
        default:
            key = @"address_normal_type";
            break;
    }
    return NSLocalizedString(key, nil);
}

+ (NSString *)getSwitchAddressTypeName:(AddrType)addressType {
    NSString *key;
    switch (addressType) {
        case P2SHP2WPKHAddrType:
            key = @"address_type_switch_to_segwit";
            break;
        default:
            key = @"address_type_switch_to_normal";
            break;
    }
    return NSLocalizedString(key, nil);
}

+ (NSString *)getSwitchAddressTypeTips:(AddrType)addressType {
    return [NSString stringWithFormat:NSLocalizedString(@"address_type_switch_tips", nil), [AddressTypeUtil getAddressTypeName:addressType]];
}

+ (BOOL)isSegwitAddressType {
    return [[UserDefaultsUtil instance] isSegwitAddressType];
}

+ (AddrType)getSwitchAddressType:(BOOL)isSegwit {
    if (isSegwit) {
        return NormalAddrType;
    } else {
        return P2SHP2WPKHAddrType;
    }
}

+ (AddrType)getCurrentAddressType {
    return [AddressTypeUtil isSegwitAddressType] ? P2SHP2WPKHAddrType : NormalAddrType;
}

+ (PathType)getCurrentAddressExternalPathType {
    return [AddressTypeUtil getAddressExternalPathType:[AddressTypeUtil isSegwitAddressType]];
}

+ (PathType)getAddressExternalPathType:(BOOL)isSegwit {
    return isSegwit ? EXTERNAL_BIP49_PATH : EXTERNAL_ROOT_PATH;
}

+ (PathType)getCurrentAddressInternalPathType {
    return [AddressTypeUtil getAddressInternalPathType:[AddressTypeUtil isSegwitAddressType]];
}

+ (PathType)getAddressInternalPathType:(BOOL)isSegwit {
    return isSegwit ? INTERNAL_BIP49_PATH : INTERNAL_ROOT_PATH;
}

@end


text:
package com.alibaba.dubbo.governance.web.common.auth;

import java.io.Serializable;

import com.alibaba.dubbo.registry.common.domain.User;

/**
 * MinasUser: DubboUser
 *
 * @author guanghui.shigh
 */
public class DubboUser implements Serializable {

	private static final long serialVersionUID = 1L;

	private static final ThreadLocal<User> userHolder = new ThreadLocal<User>();

	private DubboUser() {
	}

    public static final User getCurrentUser() {
        return (User) userHolder.get();
    }

    public static final void setCurrentUser(User user) {
        userHolder.set(user);
    }

}


text:
def extractExMachinaAsia(item):
	"""
	ExMachina.Asia
	"""
	vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
	if not (chp or vol or frag) or 'preview' in item['title'].lower():
		return None

	if 'Ultimate Assassin System' in item['tags']:
		return buildReleaseMessageWithType(item, 'Ultimate Assassin System', vol, chp, frag=frag, postfix=postfix)
	if "We live in dragon's peak" in item['tags']:
		return buildReleaseMessageWithType(item, "We live in dragon's peak", vol, chp, frag=frag, postfix=postfix)

	return False


text:
package com.juntosalimos.client.application.challenge.ui;

import com.google.gwt.core.shared.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class ChallengeSummary extends Composite {

	interface Binder extends
			UiBinder<Widget, ChallengeSummary> {
	}

	private static Binder uiBinder = GWT.create(Binder.class);

	public ChallengeSummary() {
		initWidget(uiBinder.createAndBindUi(this));
	}

}


text:
Ext.define('CustomApp', {
    extend:'Rally.app.App',
    componentCls:'app',
    layout:{
        type:'vbox',
        align:'stretch'
    },
    items:[

        { // define a container to house header info about the PI
            xtype:'container',
            itemId:'piHeaderContainer',
            padding:'15 15 15 15' // top ? bottom left,
        },
        {
            // panel where we will place the grid for the PI's leaf stories by state
            xtype:'panel',
            itemId:'piByStateGridContainer',
            layout:'fit'
        },
        {
            // panel where we will place the grid for the PI's leaf stories
            xtype:'panel',
            itemId:'piLeafStoryGridContainer',
            layout:'fit'
        }
    ],

    // --- App global variables ---

    gKanbanStateFieldName: "KanbanState",   // field to break PI down by State
    // //gKanbanStateFieldName: "MikeBan",       // field to break PI down by State

    gShowPiLeafStoryGrid: false,        // show/hide PI leaf stories grid

    gStateMetaDataArray: [],            // array to hold the PI's leaf story meta data per state

    gPiObjectID: undefined,             // PI object ID to breakdown upon initial load
    gPiFormattedID: undefined,          // PI formatted ID
    gPiName: undefined,                 // PI name
    gPiPlanEstTotal: undefined,    // PI plan estimate total

    // --- end global variables ---

    _fireChooser:function () {

        // Chooser to select PI to retrieve the leaf stories for

        Ext.create('Rally.ui.dialog.ChooserDialog', {
            artifactTypes:['PortfolioItem'],
            autoShow:true,
            title:'Select Portfolio Item',
            //limit:20,
            //height:400,
            width:380,
            listeners:{
                artifactChosen:function (selectedRecord) {

                    this.gPiFormattedID = selectedRecord.get('FormattedID');
                    this.gPiObjectID = selectedRecord.get('ObjectID');
                    this.gPiName = selectedRecord.get("Name");

                    this._getPiInfo();
                },
                scope:this
            }
        });
    },

    launch:function () {

        // main function

        // process this App's preferences
        this._processAppPrefs();

        // we need to determine the order of states via the WSAPI model
        this._getStoryModel();

    }, // end launch

    // ----------------------------------------------------
    // process the App's preferences:
    //      "piObjectID" - undefined or object ID of PI to use upon App load
    // ----------------------------------------------------

    _processAppPrefs:function () {

        // log out the App's settings
        console.log("App's original preference settings");
        console.log(this.settings);

        // grab PI info to use upon initial load (might be undefined)
        //this.gPiObjectID = this.getSetting("piObjectID");
        this.gPiObjectID = parseInt(this.getSetting("piObjectID"), 10);
        this.gPiFormattedID = this.getSetting("piFormattedID");
        this.gPiName = this.getSetting("piName");

        console.log("App's preferences retrieved");
        console.log("this.gPiObjectID: " + this.gPiObjectID);
        console.log("this.gPiFormattedID: " + this.gPiFormattedID);
        console.log("this.gPiName: " + this.gPiName);

    }, // end _processAppPrefs()

    // ----------------------------------------------------
    // update the App's preferences:
    //      "piObjectID" - save the object ID of PI to use upon next App load
    // ----------------------------------------------------

    _updateAppPrefs:function () {

        console.log(this.settings);

        // capture App's scope to reference upon success
        var appScope = this;

        this.updateSettingsValues({
            settings: {
                piObjectID: this.gPiObjectID,
                piFormattedID: this.gPiFormattedID,
                piName: this.gPiName
            },
            success: function(updatedSettings){
                console.log("Success: updateSettingsValues() worked!");

                //that._expWithSettings();

            },
            failure: function(){
                console.log("Failure: updateSettingsValues() failed!");
            }
        });

    }, // end _updateAppPrefs()

    // reset the page's controls
    _reset:function () {

        // reset all containers
        this.down('#piLeafStoryGridContainer').removeAll();
        this.down('#piByStateGridContainer').removeAll();

        this._resetStateMetaDataArray();

    }, // end _reset

    // reset state meta data array
    _resetStateMetaDataArray:function () {

        // reset the global array of state meta data
        var len = this.gStateMetaDataArray.length
        for (var x = 0; x < len; x++){
            var aState = this.gStateMetaDataArray[x];
            aState.itsCount = 0;
            aState.itsPlanEst = 0;
            aState.itsAggCount = 0;
            aState.itsAggPlanEst = 0;
            aState.itsPctComp = "n/a";
        }

    }, // end _resetStateMetaDataArray

    // ----------------------------------------------------
    // retrieve the story model from WSAPI so we can determine
    // what STATES are allowed
    // ----------------------------------------------------
    _getStoryModel:function (){

        console.log("Enter _getStoryModel");

        // capture scope and WS context
        var appScope = this;
        var wsContext = this.context.getWorkspace();

        // LEARNING POINT: I HAD to use 'UserStory' as the type as 'Story' failed
        Rally.data.ModelFactory.getModel({
            type: 'UserStory',
            context: {

                // LEARNING POINT: why did I have to capture this before the model and use the _ref attribute
                workspace: wsContext._ref

            },
            success: function(model) {
                // populate the state's values
                appScope._populateStates(model);

                // now add the form's controls to the page (PI name/dates/etc. and the select PI button)
                appScope._addAppControls();

                // check if a PI is already set in preferences
                //if (appScope.gPiObjectID !== null && appScope.gPiObjectID !== undefined){
                if (appScope.gPiObjectID !== null && appScope.gPiObjectID > 0){
                    console.log("Preferences contain a PI to use upon load");

                    // start w/ PI stored in preferences
                    appScope._getPiInfo();

                }

            },
            failure: function(f,a){
                Ext.Msg.alert("getModel() failed");
            }
        });

        console.log("Exit _getStoryModel");
    },

    // ----------------------------------------------------
    // populate the global STATE array with all of the allowed values
    // ----------------------------------------------------
    _populateStates:function (theStoryModel){

        var stateField = theStoryModel.getField(this.gKanbanStateFieldName);

        // ensure the stateField is valid
        if (!(  (typeof stateField === "object") &&
            (stateField.hasOwnProperty("allowedValues")))) {
            console.log("Invalid stateField: " + stateField);
            return;
        }

        nbrAllowedValues = stateField.allowedValues.length;
        console.log("nbrAllowedValues: " + nbrAllowedValues);

        // prepopulate states with each of the allowed values
        for (var ndx = 0; ndx < nbrAllowedValues; ndx++){

            // localize the allowed value
            aValue = stateField.allowedValues[ndx].StringValue;
            //console.log("aValue: " + aValue);

            // populate initial entry for this state
            var storyStateMetaData = new Object();
            storyStateMetaData.itsName = aValue;
            storyStateMetaData.itsCount = 0;
            storyStateMetaData.itsPlanEst = 0;
            storyStateMetaData.itsAggCount = 0;
            storyStateMetaData.itsAggPlanEst = 0;

            // add it to the state array
            this.gStateMetaDataArray.push(storyStateMetaData);

        } // end loop through all allowed values

        //console.log("Exit _populateStates");
    },

    // ----------------------------------------------------
    // add the initial controls to the App (PI fields, choose PI button, etc.)
    // ----------------------------------------------------
    _addAppControls:function (){

        // add "select PI" button to header
        var piHeaderContainer = this.down('#piHeaderContainer');
        piHeaderContainer.add({
            xtype:'rallybutton',
            text:'Select Portfolio Item',
            listeners:{
                click: this._fireChooser,
                scope: this
            }
        });

        // add PI name text box (nulled) to header
        var piTextBox = Ext.create('Ext.container.Container', {
            itemId:"piTextBox",
            html:""
        });
        piHeaderContainer.add(piTextBox);

        // add PI actual start date text box (nulled) to header
        var piActualStartDateTextBox = Ext.create('Ext.container.Container', {
            itemId:"piActualStartDateTextBox",
            html:""
        });
        piHeaderContainer.add(piActualStartDateTextBox);

        // add PI planned end date text box (nulled) to header
        var piPlannedEndDateTextBox = Ext.create('Ext.container.Container', {
            itemId:"piPlannedEndDateTextBox",
            html:""
        });
        piHeaderContainer.add(piPlannedEndDateTextBox);

    },

    // ----------------------------------------------------
    // the PI chooser button has been fired...
    // now it is time to go get the selected PI's data
    // ----------------------------------------------------
    _getPiInfo:function () {

        this._reset();

        console.log("_getPiInfo() - this.gPiObjectID: " + this.gPiObjectID);

        var store = Ext.create('Rally.data.WsapiDataStore', {
            model: 'PortfolioItem',
            fetch: ["ObjectID", "Name", "ActualStartDate", "PlannedEndDate", "LeafStoryCount", "LeafStoryPlanEstimateTotal"],
            // scope globally
            context: {
                project:null
            },
            filters: [
                {
                    property: 'ObjectID',
                    operator: '=',
                    value: this.gPiObjectID
                }
            ],
            limit: Infinity,
            autoLoad: true,
            listeners: {
                load:function (store, data, success) {

                    // map release OIDs to release NAMES
                    this._getLeafStoriesInPi(data);

                },
                scope:this
            }
        });

    }, // end _getPiInfo

    // ----------------------------------------------------
    // after PI selected, query for all its leaf level stories
    // ----------------------------------------------------
    _getLeafStoriesInPi:function (thePiRecords) {

        // ----- BEGIN: grab the PI's fields
        var nbrPiRecords;

        nbrPiRecords = thePiRecords.length;
        console.log("nbrPiRecords: " + nbrPiRecords);

        // we should only get a single record back for the PI we query for
        if (nbrPiRecords !== 1) {
            alert("Error: Multiple Portfolio Items Fetched for this Object ID");
            return;
        }

        this.gPiPlanEstTotal = thePiRecords[0].get("LeafStoryPlanEstimateTotal");

        var piActualStartDate = thePiRecords[0].get("ActualStartDate");
        var piPlannedEndDate = thePiRecords[0].get("PlannedEndDate");

        var piTextBox = this.down('#piTextBox');
        piTextBox.update('
Portfolio Item: ' + this.gPiFormattedID + " - " + this.gPiName + "");

        var piActualStartDateTextBox = this.down('#piActualStartDateTextBox');
        piActualStartDateTextBox.update('Actual Start Date: ' + piActualStartDate + "");

        var piPlannedEndDateTextBox = this.down('#piPlannedEndDateTextBox');
        piPlannedEndDateTextBox.update('Planned End Date: ' + piPlannedEndDate + "");

        // ----- END: grab the PI's fields

        // ----- BEGIN: query the LBAPI for all of the PI's leaf stories

        // set query config info
        var query = {
            "__At":"current",
            "_TypeHierarchy":"HierarchicalRequirement",
            "Children":null,
            "_ItemHierarchy":this.gPiObjectID
        };

        var queryString = Ext.JSON.encode(query);

        console.log("query: " + query);
        console.log("queryString: " + queryString);

        // set fields to retrieve
        var find = ["ObjectID", "_UnformattedID", "Name", "Release", "ScheduleState", "PlanEstimate", "c_" + this.gKanbanStateFieldName];

        // set context to global across the workspace
        var context = this.getContext().getDataContext();

        // clear context's project
        context.project = undefined;

        // capture App's scope
        var appScope = this;

        // fetch the snapshot of all leaf level stories for the PI
        var ssPiLeafStories = Ext.create('Rally.data.lookback.SnapshotStore', {
            context: {
                workspace: this.context.getWorkspace(),
                project: this.context.getProject()
            },
            pageSize: 10000000,
            fetch: find,
            //rawFind: queryString,
            rawFind: query,
            hydrate: ["ScheduleState", "c_" + this.gKanbanStateFieldName],
            autoLoad: true,
            listeners: {
                load:function (store, data, success) {

                    // map release OIDs to release NAMES
                    appScope._processPiLeafStories(store, data);

                },
                scope: this
            }

        });

        // ----- END: query the LBAPI for all of the PI's leaf stories

    }, // end _getStoriesInPi

    // ----------------------------------------------------
    // output the PI's leaf stories in a grid and then call
    // routine to bucket them by STATE
    // ----------------------------------------------------
    _processPiLeafStories:function (theStore, theRecords) {

        console.log("Enter _processPiLeafStories()");

        // spit out all leaf stories into a grid
        var snapshotGrid = Ext.create('Rally.ui.grid.Grid', {
            title: 'Snapshots',
            store: theStore,
            columnCfgs: [
                {
                    text:'ObjectID',
                    dataIndex:'ObjectID'
                },
                {
                    text:'Name',
                    dataIndex:'Name'
                },
                {
                    text:'Project',
                    dataIndex:'Project'
                },
                {
                    text:'_UnformattedID',
                    dataIndex:'_UnformattedID'
                },
                ,
                {
                    text:'Release',
                    dataIndex:'Release'
                },
                {
                    text:'PlanEstimate',
                    dataIndex:'PlanEstimate'
                },
                {
                    text:'ScheduleState',
                    dataIndex:'ScheduleState'
                },
                {
                    text:this.gKanbanStateFieldName,
                    dataIndex:'c_' + this.gKanbanStateFieldName
                }
            ]//,
            //height:400
        });

        // check if set to show the grid containing the PI's leaf stories
        if (this.gShowPiLeafStoryGrid === true){
            // render the grid of all of the PI's leaf stories
            var gridHolder = this.down('#piLeafStoryGridContainer');
            gridHolder.removeAll(true);
            gridHolder.add(snapshotGrid);
        }

        // time to start processing the PI's leaf stories by their state
        this._processAllPiStoriesByState(theRecords);

        // calc each STATE's % of completion
        // ex. 100% stories estimated, 80% developed, 50% completed, 40% accepted
        this._calcPiByStateCompletion(this.gStateMetaDataArray);

        //this._logStateMetaDataArray(this.gStateMetaDataArray);

        this._chartPiByState(this.gStateMetaDataArray);

        // save PI info into preferences
        this._updateAppPrefs();

        console.log("Exit _processPiLeafStories()");

    }, // end _processPiLeafStories

    // ----------------------------------------------------
    // process all PI's leaf stories by STATE
    // ----------------------------------------------------
    _processAllPiStoriesByState:function (theStoryRecords) {

        // clear any prior state meta data
        this._resetStateMetaDataArray();

        var nbrStories = theStoryRecords.length;
        console.log("# PI Leaf Stories: " + nbrStories);

        // loop through each of the PI's stories
        for (var storyNdx = 0; storyNdx < nbrStories; storyNdx++) {

            var aStoryRecord = theStoryRecords[storyNdx];

            if (aStoryRecord !== null) {

                //console.log("Story Name: " + aStoryRecord.get("Name"));

                // process this PI leaf story
                var rc = this._processPiStoryByState( this.gStateMetaDataArray, aStoryRecord);

                if (rc !== 0 ) {
                    console.log("*** Error updating the story state meta data array ***");
                    console.log("rc: " + rc);
                    return rc;
                }

            } // end story record is not null

        } // end loop for all story records

    }, // end _processPiStoriesByState

    // ----------------------------------------------------
    // Process the supplied leaf story.  Its meta data
    // will be added to the appropriate story states.
    // ----------------------------------------------------
    _processPiStoryByState:function (theStoryStateMetaDataArray, theStoryRecord) {

        //console.log("***  Enter _processPiStoryByState ***");

        // check if array is empty
        if (theStoryStateMetaDataArray === null)
            return 1001;

        // grab the story's state from the story record
        var aStoryState = theStoryRecord.get("c_" + this.gKanbanStateFieldName);
        //console.log("aStoryState: " + aStoryState);

        var len = theStoryStateMetaDataArray.length;

        // loop through each story meta data state
        for (var x = 0; x < len; x++) {
            var aStateMetaDataEntry = theStoryStateMetaDataArray[x];

            if (aStateMetaDataEntry === null)
                return 1002;

            //console.log("aStateMetaDataEntry.itsName    : " + aStateMetaDataEntry.itsName);

            // the supplied story is either in this state or beyond it
            aStateMetaDataEntry.itsAggCount += 1;
            aStateMetaDataEntry.itsAggPlanEst += theStoryRecord.get("PlanEstimate") || 0;

            // check if the supplied story is in this state
            if (aStateMetaDataEntry.itsName === aStoryState) {
                aStateMetaDataEntry.itsCount += 1;
                aStateMetaDataEntry.itsPlanEst += theStoryRecord.get("PlanEstimate") || 0;
                return 0;
            }

        } // end loop through each story meta data state

        // state not found --- we encountered a state no longer used/valid

        // populate initial entry for this "old" state.  Although the state may no longer
        // be valid, there could be story's still referencing it that have yet to be updated.
        var anOldState = new Object();
        anOldState.itsName = aStoryState;
        anOldState.itsCount = 1;
        anOldState.itsPlanEst = theStoryRecord.get("PlanEstimate") || 0;
        anOldState.itsAggCount = 1;
        anOldState.itsAggPlanEst = theStoryRecord.get("PlanEstimate") || 0;

        // add it to the state array
        theStoryStateMetaDataArray.push(anOldState);

        console.log("WARNING: Accounting for an invalid STATE: " + aStoryState);

        return 0;

    }, // end _processPiStoryByState

    // ----------------------------------------------------
    // Calc each STATE's % of completion.  For example:
    // 100% estimated
    // 80%  developed
    // 50%  completed
    // 40%  accepted
    // ----------------------------------------------------
    _calcPiByStateCompletion:function (theStoryStateMetaDataArray) {

        console.log("Enter _calcPiByStateCompletion()");

        var nbrStates = theStoryStateMetaDataArray.length;
        console.log("len: " + nbrStates);

        for (var x = 0; x < nbrStates; x++) {

            var anEntry = theStoryStateMetaDataArray[x];

            if (anEntry !== null) {

                console.log("anEntry.itsName: " + anEntry.itsName);
                console.log("anEntry.itsAggPlanEst: " + anEntry.itsAggPlanEst);
                console.log("this.gPiPlanEstTotal: " + this.gPiPlanEstTotal);

                anEntry.itsPctComp =
                                anEntry.itsAggPlanEst /
                                this.gPiPlanEstTotal *
                                100;

                console.log("anEntry.itsPctComp: " + anEntry.itsPctComp);
            }

        } // end loop through all entries in the story state meta data array

        console.log("Exit _calcPiByStateCompletion()");
    },

    // chart out the PI's bucketed by kanban state
    _chartPiByState:function (theStoryStateMetaDataArray) {

        // define a custom  model
        var aModel = Ext.define('CustomStateModel', {
            extend: 'Ext.data.Model',
            fields: [
                {name:'itsName', type:'string'},
                {name:'itsCount', type:'int'},
                {name:'itsPlanEst', type:'int'},
                {name:'itsAggCount', type:'int'},
                {name:'itsAggPlanEst', type:'int'},
                {name:'itsPctComp', type:'int'}
            ]
        });

        // populate a store built around the custom model
        var aStore = Ext.create('Ext.data.Store', {
            storeId: 'piByStateStore',
            model: aModel,
            data: theStoryStateMetaDataArray
        });

        // define a rally grid to output the store's data in
        var aGrid = Ext.create('Rally.ui.grid.Grid', {
            itemId: 'piByStateGrid',
            store: aStore,
            width: 470,
            columnCfgs: [
                {
                    text:'State Name', dataIndex:'itsName', flex:3
                },
                {
                    text:'Story Count Total', dataIndex:'itsCount', flex:1
                },
                {
                    text:'Plan Estimate Total', dataIndex:'itsPlanEst', flex:1
                },
                {
                    text:'Aggregate Story Count Total', dataIndex:'itsAggCount', flex:1
                },
                {
                    text:'Aggregate Plan Estimate Total', dataIndex:'itsAggPlanEst', flex:1
                },
                {
                    text:'% Complete', dataIndex:'itsPctComp', flex:1
                }
            ] // end columnCfgs
        });

        // render the PI by State grid
        var aPiByStateGridContainer = this.down('#piByStateGridContainer');
        aPiByStateGridContainer.removeAll(true);
        aPiByStateGridContainer.add(aGrid);

    }, // end _chartPiByState

    _logStateMetaDataArray:function (theStoryStateMetaDataArray) {

        console.log("----- _logStateMetaDataArray() -----");

        var len = theStoryStateMetaDataArray.length;
        console.log("len: " + len);

        for (var x = 0; x < len; x++) {

            var anEntry = theStoryStateMetaDataArray[x];

            if (anEntry !== null) {
                console.log("itsName: " + anEntry.itsName);
                console.log("itsCount: " + anEntry.itsCount);
                console.log("itsPlanEst: " + anEntry.itsPlanEst);
                console.log("itsAggCount: " + anEntry.itsAggCount);
                console.log("itsAggPlanEst: " + anEntry.itsAggPlanEst);
                console.log("itsPctComp: " + anEntry.itsPctComp);
            }
        } // end loop through all entries in the story state meta data array

    } // end _logStateMetaDataArray

}); // end of Ext.define


text:
.. _running_tests:

Running tests
=============

This chapter explains how to run pyws interoperability tests, for detailed
description of the test bench, refer to :ref:`test_bench`. These tests can also
be treated as examples of how different clients work with pyws.

You can run all the tests (except WS-I Basic Profile ones, about which read
below) using one single command::

    make

However, each set of tests has it own requirements, which you can learn below.

In any case we need a pyws server running, but all tests deal with it
themselves, so don't bother yourself with it and just keep reading.

PHP
----

Base directory is ``[pyws_dir]/tests/php``.

Surely, we need to have PHP installed, I use PHP 5.3.6. We need to have
PHPUnit installed as well, I use PHPUnit 3.6.9. To generate PHP classes from
a WSDL file, I use my fork of wsdl2php project (
https://github.com/stepank/wsdl2php).

Running PHP tests is easy::

    make

Note: I could not make native PHP SOAP client work with WSDL that is suitable
for other clients, so a special version is generated (``rpc=1`` param is added
to WSDL URL).

Java (Axis)
-----------

Base directory is ``[pyws_dir]/tests/java/axis``.

Of course, we need to have Java installed, I use Java 1.6.0_23. We also need
to have Apache Axis and JUnit4 installed, I use Apache Axis 1.4 and JUnit
4.8.2. Probably, you may also need to edit ``common.sh`` and change
``JAVA_DIR`` to the directory containing Java libraries. In my case it is
``/usr/share/java``.

To run Java tests, again, just run::

    make

C# (Mono)
---------

Base directory is ``[pyws_dir]/tests/mono``.

Of course, we need to have Mono SDK installed, I use 2.10.5. We also need NUnit
installed, I use 2.5.10.

To run Mono tests, again, just run::

    make

Python (suds)
-------------

Base directory is ``[pyws_dir]/tests/python/suds``.

We need to have suds and unittest2 installed.

You might have guessed::

    make

WS-I Basic Profile 1.1
----------------------

This test checks if WSDL file generated by pyws is compliant with `WS-I Basic
Profile 1.1 <http://www.ws-i.org/profiles/basicprofile-1.1-2004-08-24.html>`_.

Base directory is ``[pyws_dir]/tests/java/ws-i/bp11``.

Requirements are the same as for Axis integration tests, except that we don't
need JUnit.

Run the test::

    make

It will download WS-I Test Tools (about 4MB) and generate ``report.xml`` file.
All we have to do is to open it (for example, with Mozilla Firefox Web browser)
and check the status in summary section. If there you see green ``passed``,
then it's OK. In the case of problems, you can find further in the document
some details about them, it would be great if you report them to me.

To clean generated report files::

    make clean_report

WS-I Basic Profile 1.2
----------------------

This test checks if WSDL file generated by pyws is compliant with `WS-I Basic
Profile 1.2 <http://www.ws-i.org/Profiles/BasicProfile-1.2-2010-11-09.html>`_.

Base directory is ``[pyws_dir]/tests/java/ws-i/bp12``.

Requirements are the same as for Axis integration tests, except that we don't
need JUnit, but we do need an XSLT 2.0 processor. I use Saxon B 0.9, if you
use another one, you should specify it in ``xslt.sh`` in variable ``SAXON``.

Run the test::

    make

It will download WS-I Test Tools (about 6MB) and generate ``report.xml`` file.
All we have to do is to open it (for example, with Mozilla Firefox Web browser)
and check if there are any "failed" assertions. If there ain't any, then it's
OK. Otherwise, you can find further in the document the causes of the failure
and report them to me :). But I find it unlikely, I usually run this test too.

To clean generated report files::

    make clean_report

Known problems
--------------

In rare cases, a pyws server is not halted after the tests (have not figured
why so far), so you'll have to kill it yourself, this command might help::

    ps ax | grep 'python __init__.py' | grep -v grep


text:
<template name="settings">

Site Settings

    {{#if this.hasSettings}}
      {{> quickForm collection="Settings" doc=this.settings resetOnSuccess=false id="updateSettingsForm" type="update" label-class="control-label" input-col-class="controls"}}
    {{else}}
      {{> quickForm collection="Settings" doc=this.settings resetOnSuccess=false id="insertSettingsForm" type="insert" label-class="control-label" input-col-class="controls"}}
    {{/if}}

    {{> savingLoader }}

</template>


text:
{% load helpers %}

    {% if perms.dcim.change_devicebay or perms.dcim.delete_devicebay %}

            <input name="pk" type="checkbox" value="{{ devicebay.pk }}" />

    {% endif %}

    {# Name #}

         {{ devicebay.name }}

    {# Status #}

        {% if devicebay.installed_device %}

                {{ devicebay.installed_device.get_status_display }}

        {% else %}
            Vacant
        {% endif %}

    {# Description #}

        {{ devicebay.description|placeholder }}

    {# Installed device #}
    {% if devicebay.installed_device %}

            {{ devicebay.installed_device }}

            {{ devicebay.installed_device.device_type.display_name }}

    {% else %}

    {% endif %}

        {% if perms.dcim.change_devicebay %}
            {% if devicebay.installed_device %}

            {% else %}

            {% endif %}

        {% endif %}
        {% if perms.dcim.delete_devicebay %}
            {% if devicebay.installed_device %}
                <button class="btn btn-danger btn-xs" disabled="disabled">

                </button>
            {% else %}

            {% endif %}
        {% endif %}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace UniRx
{
    public static partial class Scheduler
    {
        public static readonly IScheduler Immediate = new ImmediateScheduler();

        class ImmediateScheduler : IScheduler
        {
            public ImmediateScheduler()
            {
            }

            public DateTimeOffset Now
            {
                get { return Scheduler.Now; }
            }

            public IDisposable Schedule(Action action)
            {
                action();
                return Disposable.Empty;
            }

            public IDisposable Schedule(TimeSpan dueTime, Action action)
            {
                var wait = Scheduler.Normalize(dueTime);
                if (wait.Ticks > 0)
                {
                    Thread.Sleep(wait);
                }

                action();
                return Disposable.Empty;
            }
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using Xamarin.Forms;
using Inkton.Nest.Model;
using Inkton.Nest.Cloud;
using Inkton.Nester.Cloud;
using Inkton.Nester.ViewModels;
using Inkton.Nester.Helpers;

namespace Inkton.Nester.Views
{
    public partial class ExitView : View
	{
        public ExitView()
        {
            InitializeComponent();

            SetActivityMonotoring(ServiceActive,
                new List<Xamarin.Forms.View> {
                    ButtonDone
                });

            Message.Text = "Click 'Close Account' to close the account.\n\nAll private details will be removed from the database and remaining credit balance refunded.";
            BindingContext = BaseViewModels.AuthViewModel;
        }

        async void OnDoneButtonClickedAsync(object sender, EventArgs e)
        {
            try
            {
                IsServiceActive = true;

                var yes = await DisplayAlert("Nester", "This will permenently close the account, proceed ?", "Yes", "No");

                if (yes)
                {
                    ResultSingle<User> result = await BaseViewModels.AuthViewModel.DeleteUserAsync();
                    await DisplayAlert("Nester", new ResultHandler<User>(result).GetMessage(), "OK");
                    await MainView.UnstackViewAsync();
                }
            }
            catch (Exception ex)
            {
                await ErrorHandler.ExceptionAsync(this, ex);
                IsServiceActive = false;
            }
        }

        async private void OnCloseButtonClickedAsync(object sender, EventArgs e)
        {
            try
            {
                await MainView.UnstackViewAsync();
            }
            catch (Exception ex)
            {
                await DisplayAlert("Nester", ex.Message, "OK");
            }
        }
    }
}


text:
from django.utils import importlib
from django.conf import settings

class BackendRegistry(object):
    def __init__(self):
        self.provider_map = {}
        self.loaded = False

    def get_list(self):
        self.load()
        return self.provider_map.values()

    def register(self, cls):
        self.provider_map[cls.id] = cls()

    def by_id(self, id):
        self.load()
        return self.provider_map[id]

    def as_choices(self):
        self.load()
        for provider in self.get_list():
            yield (provider.id, provider.name)

    def load(self):
        if not self.loaded:
            for app in settings.INSTALLED_APPS:
                provider_module = app + '.provider'
                try:
                    importlib.import_module(provider_module)
                except ImportError:
                    pass
            self.loaded = True

registry = BackendRegistry()


text:
package cs3246.a2;

import java.io.FileReader;

import com.google.gson.Gson;

public class AdjacentSimilarity extends Similarity {

	private static double[][] S;

	@Override
	double compute(double[] query, double[] document) {
		double s[][] = getSimilarityMatrix();
		double sum = 0.0;
        for(int i = 0; i < query.length; i++) {
        	for (int j = 0; j < query.length; j++){
        		double sim_i = computeNormalizedSimilarity(query[i], document[i]);
        		double sim_j = computeNormalizedSimilarity(query[j], document[j]);

        		sum += sim_i * sim_j * s[i][j];
        	}

        }
        return sum;

	}

	private double[][] getSimilarityMatrix() {
		if (S != null) {
			return S;
		} else {
			Gson gson = new Gson();
			try {
				S = gson.fromJson(new FileReader("colorsimilarity.txt"), double[][].class);
			} catch (Exception e) {
				e.printStackTrace();
			}
			return S;
		}
	}

	private double computeNormalizedSimilarity(double a, double b){
		double result = 0;

		double distance = Math.abs(a - b);
    	double max = a > b ? a : b;
    	if (max == 0){
    		return 0;
    	}
    	return a * ( 1 - distance / max);
	}

}


text:
namespace views {

class BubbleDialogDelegateViewInteractiveTest : public test::WidgetTest {
 public:
  BubbleDialogDelegateViewInteractiveTest() = default;

  ~BubbleDialogDelegateViewInteractiveTest() override = default;

  void SetUp() override {
    SetUpForInteractiveTests();
    test::WidgetTest::SetUp();
    original_nw_factory_ =
        ViewsDelegate::GetInstance()->native_widget_factory();
#if !BUILDFLAG(IS_CHROMEOS_LACROS)
    ViewsDelegate::GetInstance()->set_native_widget_factory(
        base::BindRepeating(CreateNativeWidget));
#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)
  }

  void TearDown() override {
    ViewsDelegate::GetInstance()->set_native_widget_factory(
        original_nw_factory_);
    test::WidgetTest::TearDown();
  }

 private:
  static NativeWidget* CreateNativeWidget(
      const Widget::InitParams& params,
      internal::NativeWidgetDelegate* delegate) {
#if BUILDFLAG(ENABLE_DESKTOP_AURA)
    // Create DesktopNativeWidgetAura for toplevel widgets, NativeWidgetAura
    // otherwise.
    if (!params.parent)
      return new DesktopNativeWidgetAura(delegate);
#endif  // BUILDFLAG(ENABLE_DESKTOP_AURA)
    return new NativeWidgetAura(delegate);
  }

  ViewsDelegate::NativeWidgetFactory original_nw_factory_;
};

TEST_F(BubbleDialogDelegateViewInteractiveTest,
       BubbleAndParentNotActiveSimultaneously) {
  WidgetAutoclosePtr anchor_widget(CreateTopLevelNativeWidget());
  View* anchor_view = anchor_widget->GetContentsView();
  anchor_widget->LayoutRootViewIfNecessary();

  test::WidgetActivationWaiter waiter(anchor_widget.get(), true);
  anchor_widget->Show();
  waiter.Wait();
  EXPECT_TRUE(anchor_widget->IsActive());
  EXPECT_TRUE(anchor_widget->GetNativeWindow()->HasFocus());

  auto bubble = std::make_unique<BubbleDialogDelegateView>(
      anchor_view, BubbleBorder::Arrow::TOP_CENTER);
  bubble->set_close_on_deactivate(false);
  WidgetAutoclosePtr bubble_widget(
      BubbleDialogDelegateView::CreateBubble(std::move(bubble)));

  bubble_widget->Show();
  EXPECT_FALSE(anchor_widget->IsActive());
  EXPECT_TRUE(bubble_widget->IsActive());

  // TODO(crbug.com/1213139): We are not checking anchor_widget's
  // aura::Window because it might not get focus. This happens in test
  // suites that don't use FocusController on NativeWidgetAura.

  anchor_widget->Activate();
  EXPECT_TRUE(anchor_widget->IsActive());
  EXPECT_FALSE(bubble_widget->IsActive());

  // Check the backing aura::Windows as well.
  EXPECT_TRUE(anchor_widget->GetNativeWindow()->HasFocus());
  EXPECT_FALSE(bubble_widget->GetNativeWindow()->HasFocus());
}

}  // namespace views


text:
"use strict";

var _ = require("lodash");
var moment = require("moment");
var async = require("async");
var utils = require("../utils");
var CustomerSession = require("../database/customerSession");
var Message = require("../database/message");

var customerSessionController = module.exports;

customerSessionController.get = function (req, res, next) {

    CustomerSession.findById(req.params.uuid, function (err, customerSession) {

        if (err) return next(err);

        return res.json({code: 200, msg: customerSession});
    });
};

customerSessionController.query = function (req, res, next) {
    var condition = {cid: req.params.cid};

    // fist seen
    CustomerSession.findOne(condition, function (err, customerSession) {

        if (err) return next(err);

        async.parallel([
            function (next) { // address
                if (utils.isPrivateIPV4(customerSession.ip)) return next(null, 'local');

                utils.getCountry(customerSession.ip, function (err, countryInfo) {

                    if (err) return next(err);

                    if (countryInfo && countryInfo.country) {
                        return next(null, countryInfo.country.names.en);
                    }

                    return next(null, 'Unknown');
                });
            }, function (next) { // last seen
                condition.type = 0;
                Message.getLatestMessage(condition, ['createdAt'], next);
            }
        ], function (err, results) {
            if (err) return next(err);

            var customer = _.pick(customerSession, ['cid', 'email']);
            customer.address = results[0];
            customer.firstSeen = moment(customerSession.createdAt).startOf('hour').fromNow();
            customer.lastContacted = customer.lastSeen = moment(results[1].createdAt).startOf('hour').fromNow();

            return res.json({code: 200, msg: customer});
        });
    });
};

customerSessionController.create = function (req, res, next) {
    var customer = {
        cid: req.body.cid,
        ip: req.body.ip,
        name: req.body.name,
        email: req.body.email,
        photo: req.body.photo,
        browser: req.body.browser,
        systemName: req.body.systemName || 'win10',
        version: req.body.version,
        platform: req.body.platform,
        os: req.body.os,
        device: req.body.device,
        url: req.body.url
    };

    CustomerSession.insert(customer, function (err, data) {

        if (err) return next(err);

        return res.json({code: 200, msg: data});
    });
};

customerSessionController.update = function (req, res, next) {
    var customer = {
        ip: req.body.ip,
        name: req.body.name,
        email: req.body.email,
        browser: req.body.browser,
        systemName: req.body.systemName,
        version: req.body.version,
        platform: req.body.platform,
        os: req.body.os,
        'url': req.body.url
    };

    if (req.body.device) customer.device = req.body.device;

    var condition = {};
    if (req.params.uuid) condition.uuid = req.params.uuid;
    if (req.params.cid) condition.cid = req.params.cid;

    CustomerSession.update(customer, condition, function (err, data) {

        if (err) return next(err);

        return res.json({code: 200, msg: 'success update'});
    });
};

customerSessionController.delete = function (req, res, next) {
    var condition = {uuid: req.params.uuid};

    CustomerSession.delete(condition, function (err, data) {

        if (err) return next(err);

        return res.json({code: 200, msg: 'success delete'});
    });
};


text:
require 'test_helper'

class ThemeFileTest < ActiveSupport::TestCase
  setup do
    @theme_file = theme_files(:aachen_open_index)
  end

  test 'validates presence of filename' do
    @theme_file.filename = ''
    assert_not_valid(@theme_file, :filename)

    @theme_file.filename = nil
    assert_not_valid(@theme_file, :filename)
  end

  test 'validates uniqueness of filename, scoped by competition' do
    new_file = @theme_file.dup
    assert_not_valid(new_file, :filename)

    new_file.competition = competitions(:german_open)
    assert_valid(new_file)
  end

  test 'validates uniqueness of filename, scoped by theme' do
    theme_file = theme_files(:default_index)
    new_file = theme_file.dup
    assert_not_valid(new_file, :filename)

    new_file.theme = themes(:fancy)
    assert_valid(new_file)
  end

  test 'theme_file for theme can have same filename as another theme_file of a competition' do
    theme_file = theme_files(:default_index)
    theme_file.filename = @theme_file.filename
    assert_valid(theme_file)
  end

  test 'validates liquid syntax' do
    @theme_file.content = '{{ foo'
    assert_not_valid(@theme_file, :content)
  end

  test 'does validate presence and integrity of competition' do
    @theme_file.competition = nil
    assert_not_valid(@theme_file, :base)

    @theme_file.competition_id = 17
    assert_not_valid(@theme_file, :base)
  end

  test "can't have both a theme_id and a competition_id but requires one of them" do
    @theme_file.theme = themes(:default)
    assert_not_valid(@theme_file, :base)
  end

  test 'validates image content type' do
    file = theme_files(:aachen_open_logo)
    file.image_content_type = 'application/evil'
    assert_not_valid(file, :image_content_type)
  end

  test 'validates image file size' do
    file = theme_files(:aachen_open_logo)
    file.image_file_size = 10.megabytes
    assert_not_valid(file, :image_file_size)
  end

  test "validates that content is empty if image_content_type isn't" do
    file = theme_files(:aachen_open_logo)
    file.content = 'foobar'
    assert_not_valid(file, :content)
  end

  test 'image url' do
    file = theme_files(:aachen_open_logo)
    assert_match /logo\.png\z/, file.image.url
  end

  test '#basename' do
    assert_equal 'foobar', ThemeFile.new(filename: 'foobar.en.html').basename
    assert_equal 'foobar', ThemeFile.new(filename: 'foobar.html').basename
    assert_equal 'foobar', ThemeFile.new(filename: 'foobar').basename
  end

  test '#html?' do
    assert_equal true, ThemeFile.new(filename: 'foobar.html').html?
    assert_equal false, ThemeFile.new(filename: 'foobar.css').html?
    assert_equal true, ThemeFile.new(filename: 'foobar.en.html').html?
    assert_equal false, ThemeFile.new(filename: 'foobar.en.css').html?
  end

  test '#extension' do
    assert_equal 'html', ThemeFile.new(filename: 'foobar.html').extension
    assert_equal 'css', ThemeFile.new(filename: 'foobar.css').extension
    assert_equal 'html', ThemeFile.new(filename: 'foobar.en.html').extension
    assert_equal 'css', ThemeFile.new(filename: 'foobar.en.css').extension
    assert_nil ThemeFile.new(filename: 'foobar').extension
  end
end


text:
package nl.esciencecenter.e3dchem.knime.silicosit.preferences;

import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(SWTBotJunit4ClassRunner.class)
public class PreferencePageTest {
    private static SWTWorkbenchBot bot = null;

    @BeforeClass
    public static void setUp() {
        assumeFalse("Does not work on Mac", System.getProperty("os.name").contains("Mac"));
        bot = new SWTWorkbenchBot();
    }

    @AfterClass
    public static void sleep() {
        if (bot != null) {
            bot.closeAllShells();
        }
    }

    @Test
    public void test_initialState() {
        String binDir = bot.textWithLabel("Directory with Silicos-it binaries:").getText();
        assertTrue("Silicos-it directory contains 'bin'", binDir.contains("bin"));

        String dataDir = bot.textWithLabel("Directory with Open Babel data files:").getText();
        assertTrue("Babel data dir contains 'data'", dataDir.contains("data"));

        String libDir = bot.textWithLabel("Directory with Open Babel plugin libraries:").getText();
        assertTrue("Babel lib dir contains 'lib/plugins'", libDir.contains("lib/plugins"));
    }

    @Before
    public void openPage() {
        bot.menu("Window").menu("Preferences").click();

        bot.shell("Preferences").activate();

        bot.tree().expandNode("KNIME", true).select("Silicos-it");
    }

    @After
    public void closePage() {
        bot.shell("Preferences").close();
    }
}


text:
<?php

namespace Meta\OntologyCreateBundle\Controller;

use Sonata\AdminBundle\Controller\CRUDController;

class ObjectAdminController extends CRUDController
{

}


text:
package sterling.lang.expression;

import sterling.lang.SterlingException;

public interface ExpressionVisitor<R, S> {

    R visitAccessExpression(AccessedExpression expression, S state) throws SterlingException;

    R visitApplyExpression(AppliedExpression expression, S state) throws SterlingException;

    R visitArgumentExpression(Argument expression, S state) throws SterlingException;

    R visitBoundExpression(BoundExpression expression, S state) throws SterlingException;

    R visitBooleanConstant(BooleanConstant constant, S state) throws SterlingException;

    R visitCharacterConstant(CharacterConstant constant, S state) throws SterlingException;

    R visitConditional(Conditional conditional, S state) throws SterlingException;

    R visitConstantExpression(ConstantExpression expression, S state) throws SterlingException;

    R visitDefault(Expression expression, S state) throws SterlingException;

    R visitDictionaryExpression(DictionaryExpression dictionary, S state) throws SterlingException;

    R visitDoubleConstant(DoubleConstant constant, S state) throws SterlingException;

    R visitIdentityExpression(IdentityExpression expression, S state) throws SterlingException;

    R visitIntegerConstant(IntegerConstant constant, S state) throws SterlingException;

    R visitInterpolation(Interpolation interpolation, S state) throws SterlingException;

    R visitLambda(Lambda lambda, S state) throws SterlingException;

    R visitListExpression(ListExpression list, S state) throws SterlingException;

    R visitNullConstant(NothingConstant constant, S state) throws SterlingException;

    R visitObjectExpression(ObjectExpression object, S state) throws SterlingException;

    R visitRangeExpression(RangeExpression range, S state) throws SterlingException;

    R visitSequence(Sequence sequence, S state) throws SterlingException;

    R visitSetExpression(SetExpression set, S state) throws SterlingException;

    R visitStrictApply(StrictApply apply, S state) throws SterlingException;

    R visitStringConstant(StringConstant constant, S state) throws SterlingException;

    R visitSymbol(Symbol symbol, S state) throws SterlingException;

    R visitTupleExpression(TupleExpression tuple, S state) throws SterlingException;

    R visitVariable(Variable variable, S state) throws SterlingException;

    R visitXRangeExpression(XRangeExpression xrange, S state) throws SterlingException;
}


text:
struct A;
struct B;

template <class X, class Y, class Z>
struct choose_bases
    : boost::python::detail::select_bases<
    X
    , typename boost::python::detail::select_bases<
        Y
        , typename boost::python::detail::select_bases<Z>::type
    >::type>
{

};

int main()
{
    BOOST_STATIC_ASSERT((boost::python::detail::specifies_bases<
                         boost::python::bases<A,B> >::value));

    BOOST_STATIC_ASSERT((!boost::python::detail::specifies_bases<
                         boost::python::bases<A,B>& >::value));

    BOOST_STATIC_ASSERT((!boost::python::detail::specifies_bases<
                         void* >::value));

    BOOST_STATIC_ASSERT((!boost::python::detail::specifies_bases<
                         int >::value));

    BOOST_STATIC_ASSERT((!boost::python::detail::specifies_bases<
                         int[5] >::value));

    typedef boost::python::detail::select_bases<
        int
        , boost::python::detail::select_bases<char*>::type > collected1;

    BOOST_STATIC_ASSERT((boost::is_same<collected1::type,boost::python::bases<> >::value));
    BOOST_STATIC_ASSERT((boost::is_same<choose_bases<int,char*,long>::type,boost::python::bases<> >::value));

    typedef boost::python::detail::select_bases<
        int
        , boost::python::detail::select_bases<
                boost::python::bases<A,B>
                , boost::python::detail::select_bases<
                        A
            >::type
         >::type
     > collected2;

    BOOST_STATIC_ASSERT((boost::is_same<collected2::type,boost::python::bases<A,B> >::value));
    BOOST_STATIC_ASSERT((boost::is_same<choose_bases<int,boost::python::bases<A,B>,long>::type,boost::python::bases<A,B> >::value));

    return 0;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <Button
        android:id="@+id/btn_start_longtime"
        style="@style/button_style"
        android:text="开启定时任务" />

    <Button
        android:id="@+id/btn_stop_longtime"
        style="@style/button_style"
        android:layout_width="match_parent"
        android:text="关闭定时任务" />

</LinearLayout>


text:
var args = arguments[0] || {},
	currentPullWidth = 0,
	lineAnimation = Ti.UI.createAnimation({
		width:0,
		duration : 100
	}),
	widthIncrementor,
	slides = [$.i1, $.i2, $.i3],
	refreshing = false,
	currentSlide = 1,
	higherZIndex = 1000,
	deviceWidth = Titanium.Platform.displayCaps.platformWidth;
	slideAnimationUp = Ti.UI.createAnimation({
		width : "100%",
		duration : 500
	});
	slideAnimationDown = Ti.UI.createAnimation({
		width : 0,
		duration : 50
	});

widthIncrementor = deviceWidth / (Alloy.Globals.pullHeight / Alloy.Globals.pullIncrementor);
//widthIncrementor = Titanium.Platform.displayCaps.platformWidth / (150 / 7);

Titanium.App.addEventListener('pullDown', function(event){
	currentPullWidth += widthIncrementor;
	$.i1.width = currentPullWidth + 'px';
});

Titanium.App.addEventListener('pullEnd', function(event){
	currentPullWidth = 0;
	$.i1.width = 0;
	$.i1.zIndex = higherZIndex + 1;
});

Titanium.App.addEventListener('refreshStartWorking', function(event){
	if(refreshing){
		return;
	}
	refreshing = true;
	refreshStartSliding();
});

Titanium.App.addEventListener('refreshStopWorking', function(event){
	refreshing = false;
	refreshStopSliding();
});

function refreshStartSliding(){

	if(!refreshing){
		return;
	}
	if(currentSlide == 0){
		slides[slides.length - 2].animate(slideAnimationDown);
	}
	else{
		if(currentSlide == 1){
			slides[slides.length - 1].animate(slideAnimationDown);
		}
		else{
			slides[currentSlide - 2].animate(slideAnimationDown);
		}
	}

	higherZIndex++;

	slides[currentSlide].zIndex = higherZIndex,

	slides[currentSlide].animate(slideAnimationUp);

	currentSlide++;
	if(currentSlide >= slides.length){
		currentSlide = 0;
	}
}

slideAnimationUp.addEventListener('complete', function(event){
	if(!refreshing){
		for(var i = 0; i < slides.length; i++){
			slides[i].animate(slideAnimationDown);
		}

	}
	refreshStartSliding();
});

function refreshStopSliding(){
	higherZIndex = 1000;
	for(var i = 0; i < slides.length; i++){
		slides[i].animate(slideAnimationDown);
		slides[i].zIndex = higherZIndex;
	}
}