text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>mne.viz.plot_epochs — MNE 0.12.0 documentation</title>

    <link rel="stylesheet" href="../_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../_static/gallery.css" type="text/css" />
    <link rel="stylesheet" href="../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="../_static/style.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/favicon.ico"/>
    <link rel="top" title="MNE 0.12.0 documentation" href="../index.html" />
    <link rel="up" title="Python API Reference" href="../python_reference.html" />
    <link rel="next" title="mne.viz.plot_events" href="mne.viz.plot_events.html" />
    <link rel="prev" title="mne.viz.plot_drop_log" href="mne.viz.plot_drop_log.html" />

<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' rel='stylesheet' type='text/css'>

  <link rel="canonical" href="https://mne.tools/stable/index.html" />

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">

        </button>

        0.12.0

Get started

Tutorials

Gallery

API

Manual

FAQ

  Site

Getting started

Tutorials

Examples Gallery

Frequently Asked Questions

Contribute to MNE

Python API Reference

User Manual

What’s new

How to cite MNE

Related publications

Publications from MNE users

  Page

mne.viz.plot_epochs

<form class="navbar-form navbar-right" action="../search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

mne.viz.plot_epochs

    « mne.viz.plot_...

    mne.viz.plot_... »

<form action="../search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

mne.viz.plot_epochs¶

mne.viz.plot_epochs(epochs, picks=None, scalings=None, n_epochs=20, n_channels=20, title=None, show=True, block=False)¶

Visualize epochs

Bad epochs can be marked with a left click on top of the epoch. Bad
channels can be selected by clicking the channel name on the left side of
the main axes. Calling this function drops all the selected bad epochs as
well as bad epochs marked beforehand with rejection parameters.

<col class="field-name" />
<col class="field-body" />

Parameters:
epochs : instance of Epochs

The epochs object

picks : array-like of int | None

Channels to be included. If None only good data channels are used.
Defaults to None

scalings : dict | ‘auto’ | None

Scaling factors for the traces. If any fields in scalings are ‘auto’,
the scaling factor is set to match the 99.5th percentile of a subset of
the corresponding data. If scalings == ‘auto’, all scalings fields are
set to ‘auto’. If any fields are ‘auto’ and data is not preloaded,
a subset of epochs up to 100mb will be loaded. If None, defaults to:

dict(mag=1e-12, grad=4e-11, eeg=20e-6, eog=150e-6, ecg=5e-4,
     emg=1e-3, ref_meg=1e-12, misc=1e-3, stim=1, resp=1, chpi=1e-4)

n_epochs : int

The number of epochs per view. Defaults to 20.

n_channels : int

The number of channels per view. Defaults to 20.

title : str | None

The title of the window. If None, epochs name will be displayed.
Defaults to None.

show : bool

Show figure if True. Defaults to True

block : bool

Whether to halt program execution until the figure is closed.
Useful for rejecting bad trials on the fly by clicking on an epoch.
Defaults to False.

Returns:
fig : Instance of matplotlib.figure.Figure

The figure.

Notes

The arrow keys (up/down/left/right) can be used to navigate between
channels and epochs and the scaling can be adjusted with - and + (or =)
keys, but this depends on the backend matplotlib is configured to use
(e.g., mpl.use(TkAgg) should work). Full screen mode can be toggled
with f11 key. The amount of epochs and channels per view can be adjusted
with home/end and page down/page up keys. Butterfly plot can be toggled
with b key. Right mouse click adds a vertical line to the plot.

      Back to top

        © Copyright 2012-2016, MNE Developers. Last updated on 2016-05-10.


text:
package org.apache.hadoop.hive.ql.ddl.table.misc.rename;

import org.apache.hadoop.hive.ql.QueryState;
import org.apache.hadoop.hive.ql.ddl.DDLSemanticAnalyzerFactory.DDLType;
import org.apache.hadoop.hive.ql.parse.HiveParser;
import org.apache.hadoop.hive.ql.parse.SemanticException;

/**
 * Analyzer for rename table commands.
 */
@DDLType(types = HiveParser.TOK_ALTERTABLE_RENAME)
public class AlterTableRenameAnalyzer extends AbstractAlterTableRenameAnalyzer {
  public AlterTableRenameAnalyzer(QueryState queryState) throws SemanticException {
    super(queryState);
  }

  protected boolean isView() {
    return false;
  }
}

redpajama_set_name: RedPajamaGithub


text:
import {expect} from "chai";
import generateId = require("../../../lib/support/generateId");
const uniq = require("lodash.uniq");
const simple = require("simple-mock");
const MAX_PER_SECOND: number = 65536;

describe("generateId", function () {
  afterEach(function (done) {
    simple.restore();
    done();
  });

  it("generates ordered ids", function (done) {
    let ids: string[] = [];

    while (ids.length < 10000) {
      ids.push(generateId());
    }

    expect(ids.length).equals(10000);
    expect(ids.join()).equals(ids.sort().join());
    done();
  });

  it("works with constant date", function (done) {
    let constantDate: number = Date.now() + 1000;
    let ids: string[] = [];

    simple.mock(Date, "now", function () {
      return constantDate;
    });

    while (ids.length < MAX_PER_SECOND) {
      ids.push(generateId());
    }

    expect(ids.length).equals(MAX_PER_SECOND);
    expect(ids.length).equals(uniq(ids).length);
    done();
  });

  it("works with failure of randomness", function (done) {
    let constantDate: number = Date.now() + 1000;

    simple.mock(Date, "now", function () {
      return constantDate;
    });

    simple.mock(Math, "random", function () {
      return 0;
    });

    let ids: string[] = [];

    while (ids.length < MAX_PER_SECOND) {
      ids.push(generateId());
    }

    expect(ids.length).equals(MAX_PER_SECOND);
    expect(ids.length).equals(uniq(ids).length);
    done();
  });
});


text:
/**
 *
 */
package com.gainsight.hackathon.tripAdvisor.model;

import io.searchbox.client.JestResult;

import java.io.Reader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;

import com.gainsight.hackathon.tripAdvisor.beans.HotelAddressCoordinate;
import com.gainsight.hackathon.tripAdvisor.beans.RatingsBean;
import com.gainsight.hackathon.tripAdvisor.beans.ReviewBean;
import com.gainsight.hackathon.tripAdvisor.beans.SentimentAnalysisAspectBean;
import com.gainsight.hackathon.tripAdvisor.services.ElasticSearchJestClient;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

/**
 * @author Kumaran Gunamurthy
 *
 */
public class TripAdvisorJsonFeedProcessor implements BaseFeedProcessor {

	private Logger logger = Logger.getLogger(this.getClass());

	private static int DEFAULT_RATING = -1;

	/* (non-Javadoc)
	 * @see com.gainsight.hackathon.tripAdvisor.model.BaseFeedProcessor#process(java.io.InputStream)
	 */
	@Override
	public boolean process(Reader feedReader) {

		JsonParser parser = new JsonParser();

		try {
			Object obj = parser.parse(feedReader);
            JsonObject hotelJsonObj =  (JsonObject) obj;

            JsonObject hotelInfoJsonObj = (JsonObject) hotelJsonObj.get("HotelInfo");

            String hotelURL 	= hotelInfoJsonObj.get("HotelURL").getAsString();
            String hotelId		= hotelInfoJsonObj.get("HotelID").getAsString();
            String hotelPriceStr= hotelInfoJsonObj.get("Price").getAsString().trim();

            Float lowestHotelPrice = null;
            Float highestHotelPrice = null;

            String[] priceStrArray = hotelPriceStr.split("[\\-]");
            if(StringUtils.isNotEmpty(priceStrArray[0])) {
            	 try {
            		 lowestHotelPrice = Float.parseFloat(priceStrArray[0]);
                 } catch (NumberFormatException e) {
                	 lowestHotelPrice = null;
                 }
            }

            if(priceStrArray.length != 1 && StringUtils.isNotEmpty(priceStrArray[1])) {
	           	try {
	           		highestHotelPrice = Float.parseFloat(priceStrArray[1]);
                } catch (NumberFormatException e) {
                	highestHotelPrice = lowestHotelPrice;
                }
           } else {
        	   highestHotelPrice = lowestHotelPrice;
           }

            JsonArray reviewsArray = hotelJsonObj.get("Reviews").getAsJsonArray();

            int noOfReviews = reviewsArray.size();

            float aggregateOverallRating = 0F;
            for(int i=0; i<noOfReviews; i++) {

            	//JsonObject jsonObject = reviewsArray.get(i).getAsJsonObject();
            	//logger.info("reviewsArray - " + jsonObject.to);
            	aggregateOverallRating += reviewsArray.get(i).getAsJsonObject().get("Ratings").getAsJsonObject().get("Overall").getAsFloat();
            }

            //logger.info("aggregateOverallRating - " + aggregateOverallRating + "   noOfReviews - " + noOfReviews + "   " + (float)aggregateOverallRating/noOfReviews);

            Float hotelOverallRating = aggregateOverallRating/noOfReviews;

            String uid = null;
        	Pattern uidPattern = Pattern.compile("g[\\d]+-d[\\d]+");
        	Matcher uidMatcher = uidPattern.matcher(hotelURL);
        	if(uidMatcher.find()) {
        		uid = uidMatcher.group(0);
        	}
        	HotelAddressCoordinate hCoordinate = null;
        	if(uid != null) {

        		JestResult jResult = new ElasticSearchJestClient().getDocument("hackathon_hotel_location_2", "location", uid);
        		if(jResult.isSucceeded()) {
        			hCoordinate = new HotelAddressCoordinate();
        			JsonObject sourceJsonObject = jResult.getJsonObject().get("_source").getAsJsonObject();
        			hCoordinate.setLatitude(sourceJsonObject.get("lat").getAsFloat());
            		hCoordinate.setLongitude(sourceJsonObject.get("long").getAsFloat());
        		}

        	}

            List<ReviewBean> reviews = new ArrayList<ReviewBean>();

            for(int i=0; i<noOfReviews; i++) {
            	JsonObject reviewJsonObj = reviewsArray.get(i).getAsJsonObject();

            	String content 		= reviewJsonObj.get("Content").getAsString();
            	String reviewId		= reviewJsonObj.get("ReviewID").getAsString();
            	String author		= reviewJsonObj.get("Author").getAsString();
            	String dateString	= reviewJsonObj.get("Date").getAsString();

            	SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy");
            	Date timestamp;
				try {
					timestamp = sdf.parse(dateString);
				} catch (java.text.ParseException e) {
					timestamp = null;
				}

            	JsonObject ratingsJsonObj 	= reviewJsonObj.get("Ratings").getAsJsonObject();

            	int serviceRating;
				try {
					serviceRating = ratingsJsonObj.get("Service").getAsInt();
				} catch (NullPointerException e) {
					serviceRating = DEFAULT_RATING;
				}

            	int businessServiceRating;
				try {
					businessServiceRating = ratingsJsonObj.get("Business service").getAsInt();
				} catch (NullPointerException e) {
					businessServiceRating = DEFAULT_RATING;
				}

            	int cleanlinessRating;
				try {
					cleanlinessRating = ratingsJsonObj.get("Cleanliness").getAsInt();
				} catch (NullPointerException e) {
					cleanlinessRating = DEFAULT_RATING;
				}

            	int checkInRating;
				try {
					checkInRating = ratingsJsonObj.get("Check in / front desk").getAsInt();
				} catch (NullPointerException e) {
					checkInRating = DEFAULT_RATING;
				}

            	Float overallRating;
				try {
					overallRating = ratingsJsonObj.get("Overall").getAsFloat();
				} catch (NullPointerException e) {
					overallRating = (float) DEFAULT_RATING;
				}

            	int valueRating;
				try {
					valueRating = ratingsJsonObj.get("Value").getAsInt();
				} catch (NullPointerException e) {
					valueRating = DEFAULT_RATING;
				}

            	int roomsRating;
				try {
					roomsRating = ratingsJsonObj.get("Rooms").getAsInt();
				} catch (NullPointerException e) {
					roomsRating = DEFAULT_RATING;
				}

            	int locationRating;
				try {
					locationRating = ratingsJsonObj.get("Location").getAsInt();
				} catch (NullPointerException e) {
					locationRating = DEFAULT_RATING;
				}

            	ReviewBean reviewBean = new ReviewBean();
            	reviewBean.setHotelId(hotelId);
            	reviewBean.setLowestHotelPrice(lowestHotelPrice);
            	reviewBean.setHighestHotelPrice(highestHotelPrice);
            	reviewBean.setHotelURL(hotelURL);
            	reviewBean.setHotelOverallRating(hotelOverallRating);

            	reviewBean.setContent(content.split("\\. "));
            	reviewBean.setTimestamp(timestamp);
            	reviewBean.setReviewId(reviewId);
            	reviewBean.setAuthor(author);

            	RatingsBean ratingsBean = new RatingsBean();
            	ratingsBean.setService(serviceRating);
            	ratingsBean.setBusinessService(businessServiceRating);
            	ratingsBean.setCleanliness(cleanlinessRating);
            	ratingsBean.setCheckIn(checkInRating);
            	ratingsBean.setOverall(overallRating);
            	ratingsBean.setValue(valueRating);
            	ratingsBean.setRooms(roomsRating);
            	ratingsBean.setLocation(locationRating);

            	reviewBean.setRatings(ratingsBean);
            	/*HotelAddressCoordinate hCoordinate = new HotelAddressCoordinate();
				hCoordinate.setLatitude(12.9900F);
				hCoordinate.setLongitude(77.7000F);*/

            	reviewBean.setHotelAddressCoordinate(hCoordinate);

            	JestResult jResult = new ElasticSearchJestClient().getDocument("hackathon-sentimentanalysis_2", "sa", hotelId + "_" + reviewId);
            	JsonElement aspectsJsonElement = null;
            	if(jResult.isSucceeded()) {
            		aspectsJsonElement = jResult.getJsonObject().get("_source").getAsJsonObject().get("aspects");
            	}

            	Gson gson = new Gson();
            	SentimentAnalysisAspectBean saAspectBean = gson.fromJson(aspectsJsonElement, SentimentAnalysisAspectBean.class);

            	//Map<String, Double> saAspectBean = gson.fromJson(aspectsJsonElement, HashMap.class);

            	//logger.info("----------" + saAspectBean);

            	reviewBean.setSentimentAnalysisAspects(saAspectBean);

            	/*ObjectMapper objectMapper = new ObjectMapper();
				String docAsJsonString = objectMapper.writeValueAsString(reviewBean);

            	logger.info(docAsJsonString);*/

            	reviews.add(reviewBean);
            }

            ElasticSearchJestClient esJestClient = new ElasticSearchJestClient();
            esJestClient.indexDocument(reviews);
		} catch (Exception e) {
			logger.error("Exception occurred - " + e.getMessage(), e);
		}
		return false;
	}

}


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.Diagnostics;
using Microsoft.VisualStudio.Shell.Interop;

namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.Legacy
{
    internal partial class AbstractLegacyProject : IVsHierarchyEvents
    {
        private uint _hierarchyEventsCookie;

        private void ConnectHierarchyEvents()
        {
            Debug.Assert(!this.AreHierarchyEventsConnected, "IVsHierarchyEvents are already connected!");

            if (ErrorHandler.Failed(Hierarchy.AdviseHierarchyEvents(this, out _hierarchyEventsCookie)))
            {
                Debug.Fail("Failed to connect IVsHierarchyEvents");
                _hierarchyEventsCookie = 0;
            }
        }

        private void DisconnectHierarchyEvents()
        {
            if (this.AreHierarchyEventsConnected)
            {
                Hierarchy.UnadviseHierarchyEvents(_hierarchyEventsCookie);
                _hierarchyEventsCookie = 0;
            }
        }

        private bool AreHierarchyEventsConnected
        {
            get { return _hierarchyEventsCookie != 0; }
        }

        int IVsHierarchyEvents.OnInvalidateIcon(IntPtr hicon)
        {
            return VSConstants.E_NOTIMPL;
        }

        int IVsHierarchyEvents.OnInvalidateItems(uint itemidParent)
        {
            return VSConstants.E_NOTIMPL;
        }

        int IVsHierarchyEvents.OnItemAdded(uint itemidParent, uint itemidSiblingPrev, uint itemidAdded)
        {
            return VSConstants.E_NOTIMPL;
        }

        int IVsHierarchyEvents.OnItemDeleted(uint itemid)
        {
            return VSConstants.E_NOTIMPL;
        }

        int IVsHierarchyEvents.OnItemsAppended(uint itemidParent)
        {
            return VSConstants.E_NOTIMPL;
        }

        int IVsHierarchyEvents.OnPropertyChanged(uint itemid, int propid, uint flags)
        {
            if ((propid == (int)__VSHPROPID.VSHPROPID_Caption ||
                 propid == (int)__VSHPROPID.VSHPROPID_Name) &&
                itemid == (uint)VSConstants.VSITEMID.Root)
            {
                string newDisplayName = GetProjectDisplayName(Hierarchy);
                string newPath = GetProjectFilePath(Hierarchy);

                UpdateProjectDisplayNameAndFilePath(newDisplayName, newPath);
            }

            if ((propid == (int)__VSHPROPID.VSHPROPID_ProjectIDGuid) &&
                 itemid == (uint)VSConstants.VSITEMID.Root)
            {
                // this should happen while project loading if it ever happens
                Guid = GetProjectIDGuid(Hierarchy);
            }

            return VSConstants.S_OK;
        }
    }
}


text:
import StateManager from '../src/stateManager';
import expect from 'expect';

describe('StateManager', () => {
  let stateManager, finalizer;
  beforeEach('initalize StateManager', () => {
    finalizer = () => {};
    stateManager = new StateManager(event => finalizer(event));
  });
  describe('#push', () => {
    it('should push event to the queue', () => {
      let count = 1;
      finalizer = event => {
        expect(event.data).toBe(count);
        count ++;
      };
      stateManager.push('test', 1);
      stateManager.push('test', 2);
      stateManager.commit();
      expect(count).toBe(3);
    });
    it('should accept event object', () => {
      let originalEvent = {
        type: 'test', data: 53
      };
      finalizer = event => expect(event).toBe(originalEvent);
      stateManager.push(originalEvent);
      stateManager.commit();
    });
  });
  describe('#unshift', () => {
    it('should unshift event to the queue', () => {
      let count = 2;
      finalizer = event => {
        expect(event.data).toBe(count);
        count --;
      };
      stateManager.unshift('test', 1);
      stateManager.unshift('test', 2);
      stateManager.commit();
      expect(count).toBe(0);
    });
    it('should accept event object', () => {
      let originalEvent = {
        type: 'test', data: 53
      };
      finalizer = event => expect(event).toBe(originalEvent);
      stateManager.unshift(originalEvent);
      stateManager.commit();
    });
  });
  describe('#commit', () => {
    it('should call finalizer', () => {
      let result = false;
      finalizer = () => result = true;
      stateManager.push('test', 1);
      stateManager.commit();
      expect(result).toBe(true);
    });
    it('should call event listeners', () => {
      let result = false;
      stateManager.on('test', () => result = true);
      stateManager.push('test', 1);
      stateManager.commit();
      expect(result).toBe(true);
    });
  });
  describe('#reset', () => {
    it('should reset queue', () => {
      let result = false;
      finalizer = () => result = true;
      stateManager.reset();
      stateManager.push('test', 1);
      stateManager.reset();
      stateManager.commit();
      expect(result).toBe(false);
    });
  });
});


text:
import React from 'react';
import Empty from '../Empty';
import { shallow } from 'enzyme';

describe('Empty', () => {
  describe('Renders as expected', () => {
    const wrapper = shallow(<Empty title="title" kind="large" />);

    const emptyWrapper = () => wrapper.find('div.wfp--empty');

    describe('emptyWrapper', () => {
      it('renders as expected', () => {
        expect(emptyWrapper().length).toBe(1);
      });

      it('has the expected classes', () => {
        expect(emptyWrapper().hasClass('wfp--empty')).toEqual(true);
      });
    });

    const emptyIcon = () => wrapper.find('div.wfp--empty__icon');

    describe('emptyIcon', () => {
      it('renders as expected', () => {
        expect(emptyIcon().length).toBe(1);
      });

      it('has the expected classes', () => {
        expect(emptyIcon().hasClass('wfp--empty__icon')).toEqual(true);
      });
    });

    const emptyText = () => wrapper.find('div.wfp--empty__text');

    describe('emptyText', () => {
      it('renders as expected', () => {
        expect(emptyText().length).toBe(1);
      });
      it('renders children as expected', () => {
        expect(emptyText().props().children).toEqual([
title
,
]);
      });

      it('renders title as expected', () => {
        expect(emptyText().find('h2').length).toBe(1);
      });

      it('renders additional content as expected', () => {
        expect(emptyText().find('p').length).toBe(1);
      });

      it('has the expected classes', () => {
        expect(emptyText().hasClass('wfp--empty__text')).toEqual(true);
      });
    });

    const emptyButton = () => wrapper.find('div.wfp--empty__button');

    describe('emptyButton', () => {
      it('has the expected classes', () => {
        expect(emptyButton().hasClass('wfp--empty__button')).toEqual(true);
      });
    });
  });
});


text: cd /go/src/github.com/kelseyhightower/confd && ./build


text:
<?php

namespace Hal\Component\File;

use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use RegexIterator;

/**
 * @author Jean-François Lépine <https://twitter.com/Halleck45>
 */
class Finder
{

    /**
     * Follow symlinks
     */
    const FOLLOW_SYMLINKS = RecursiveDirectoryIterator::FOLLOW_SYMLINKS;

    /**
     * Extensions to match
     *
     * @var array
     */
    private $extensions = [];

    /**
     * Subdirectories to exclude
     *
     * @var array
     */
    private $excludedDirs = [];

    /**
     * Flags for RecursiveDirectoryIterator
     *
     * @var integer
     */
    private $flags;

    /**
     * @param string[] $extensions   regex of file extensions to include
     * @param string[] $excludedDirs regex of directories to exclude
     * @param int $flags
     */
    public function __construct(array $extensions = ['php'], array $excludedDirs = [], $flags = null)
    {
        $this->extensions = $extensions;
        $this->excludedDirs = $excludedDirs;
        $this->flags = $flags;
    }

    /**
     * Find files in path
     *
     * @param string[] $paths
     * @return array
     */
    public function fetch(array $paths)
    {
        $files = [];
        foreach ($paths as $path) {
            if (is_dir($path)) {
                $path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
                $directory = new RecursiveDirectoryIterator($path, $this->flags);
                $iterator = new RecursiveIteratorIterator($directory);

                $filterRegex = sprintf(
                    '`^%s%s%s$`',
                    preg_quote($path, '`'),
                    !empty($this->excludedDirs) ? '((?!' . implode('|', array_map('preg_quote', $this->excludedDirs)) . ').)+' : '.+',
                    '\.(' . implode('|', $this->extensions) . ')'
                );

                $filteredIterator = new RegexIterator(
                    $iterator,
                    $filterRegex,
                    \RecursiveRegexIterator::GET_MATCH
                );

                foreach ($filteredIterator as $file) {
                    $files[] = $file[0];
                }
            } elseif (is_file($path)) {
                $files[] = $path;
            }
        }
        return $files;
    }
}


text:
import React, { Component } from 'react';
import { connect } from 'react-redux';
import {graphql, gql, compose} from 'react-apollo';

import { GC_USER_ID, GC_AUTH_TOKEN } from '../constants';
import { ChangeBackground } from "../../actions/background";
import { FullLogin } from '../../actions/session';

class Login extends Component {
    state = {
        login: true, // switch between Login and SignUp
        email: '',
        password: '',
        name: ''
    };

    renderBlockIcon(){
        if (this.state.login){
            return (

            );
        } else {
            return (

            );
        }
    };

    componentDidMount(){
        this.props.changeBackground('');
    }

    render() {
        return (

{this.state.login ? 'Login' : 'Sign Up'}

                    {this.renderBlockIcon()}

                    {
                        !this.state.login &&

                            Name
                            <input value={this.state.name} onChange={(e) => this.setState({ name: e.target.value })} type='text'
                                   className="form-control" placeholder='Your name'/>

                    }

                        Email
                        <input value={this.state.email} onChange={(e) => this.setState({ email: e.target.value })} type='text'
                               className="form-control" placeholder='Your email address'/>

                        Password
                        <input value={this.state.password} onChange={(e) => this.setState({ password: e.target.value })} type='password'
                               className="form-control" placeholder='Choose a safe password'/>

                        <button className="btn btn-success" onClick={() => this._confirm()}>
                            {this.state.login ? 'login' : 'create account' }
                        </button>

                        <button className="btn" onClick={() => this.setState({ login: !this.state.login })}>
                            {this.state.login ? 'need to create an account?' : 'already have an account?'}
                        </button>

        )
    }

    _confirm = async () => {
        const { name, email, password } = this.state;
        if (this.state.login) {
            const result = await this.props.signinUserMutation({
                variables: {
                    email,
                    password
                }
            });
            const id = result.data.signinUser.user.id;
            const token = result.data.signinUser.token;
            this.props.setAuthInfo(id, token);
        } else {
            const result = await this.props.createUserMutation({
                variables: {
                    name,
                    email,
                    password
                }
            });
            const id = result.data.signinUser.user.id;
            const token = result.data.signinUser.token;
            this.props.setAuthInfo(id, token);
        }
        this.props.history.push(`/`)
    };
}

const mapDispatchToProps = (dispatch) => ({
    changeBackground: (background) => { dispatch(ChangeBackground(background))},
    setAuthInfo: (userId, authToken) => { dispatch(FullLogin(userId, authToken)) }
});

const CREATE_USER = gql`
    mutation CreateUserMutation($name: String!, $email: String!, $password: String!) {
        createUser(name: $name, authProvider:{email: {email: $email, password: $password}}){
            id
        }

        signinUser(email: {
            email: $email,
            password:$password
        }){
            token
            user {
                id
            }
        }
    }
`;

const SIGNIN_USER = gql`
    mutation SigninUserMutation($email: String!, $password: String!){
        signinUser(email: {
            email: $email,
            password:$password
        }){
            token
            user {
                id
            }
        }
    }
`;

const component = compose(
    graphql(CREATE_USER, {name: 'createUserMutation'}),
    graphql(SIGNIN_USER, {name: 'signinUserMutation'})
)(Login);

export default connect((state)=>({state}), mapDispatchToProps)(component);


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

import com.amazonaws.AmazonServiceException;

/**
 * <p>
 * The attribute referred to does not exist.
 * </p>
 */
public class InvalidAttributeNameException extends AmazonServiceException {
    private static final long serialVersionUID = 1L;

    /**
     * Constructs a new InvalidAttributeNameException with the specified error
     * message.
     *
     * @param message Describes the error encountered.
     */
    public InvalidAttributeNameException(String message) {
        super(message);
    }

}


text:
TOPLEVEL_LANG = verilog

SIM ?= icarus
WAVES ?= 0

COCOTB_HDL_TIMEUNIT = 1ns
COCOTB_HDL_TIMEPRECISION = 1ps

export S_COUNT ?= 4
export M_COUNT ?= 4

DUT      = axis_switch
WRAPPER  = $(DUT)_wrap_$(S_COUNT)x$(M_COUNT)
TOPLEVEL = $(WRAPPER)
MODULE   = test_$(DUT)
VERILOG_SOURCES += $(WRAPPER).v
VERILOG_SOURCES += ../../rtl/$(DUT).v
VERILOG_SOURCES += ../../rtl/axis_register.v
VERILOG_SOURCES += ../../rtl/arbiter.v
VERILOG_SOURCES += ../../rtl/priority_encoder.v

# module parameters
export PARAM_DATA_WIDTH ?= 8
export PARAM_KEEP_ENABLE ?= $(shell expr $(PARAM_DATA_WIDTH) \> 8 )
export PARAM_KEEP_WIDTH ?= $(shell expr \( $(PARAM_DATA_WIDTH) + 7 \) / 8 )
export PARAM_ID_ENABLE ?= 1
export PARAM_S_ID_WIDTH ?= 16
export PARAM_M_ID_WIDTH ?= $(shell python -c "print($(PARAM_S_ID_WIDTH) + ($(S_COUNT)-1).bit_length())")
export PARAM_M_DEST_WIDTH ?= 8
export PARAM_S_DEST_WIDTH ?= $(shell python -c "print($(PARAM_M_DEST_WIDTH) + ($(M_COUNT)-1).bit_length())")
export PARAM_USER_ENABLE ?= 1
export PARAM_USER_WIDTH ?= 1
export PARAM_UPDATE_TID ?= 1
export PARAM_S_REG_TYPE ?= 0
export PARAM_M_REG_TYPE ?= 2
export PARAM_ARB_TYPE_ROUND_ROBIN ?= 1
export PARAM_ARB_LSB_HIGH_PRIORITY ?= 1

ifeq ($(SIM), icarus)
	PLUSARGS += -fst

	COMPILE_ARGS += -P $(TOPLEVEL).DATA_WIDTH=$(PARAM_DATA_WIDTH)
	COMPILE_ARGS += -P $(TOPLEVEL).KEEP_ENABLE=$(PARAM_KEEP_ENABLE)
	COMPILE_ARGS += -P $(TOPLEVEL).KEEP_WIDTH=$(PARAM_KEEP_WIDTH)
	COMPILE_ARGS += -P $(TOPLEVEL).ID_ENABLE=$(PARAM_ID_ENABLE)
	COMPILE_ARGS += -P $(TOPLEVEL).S_ID_WIDTH=$(PARAM_S_ID_WIDTH)
	COMPILE_ARGS += -P $(TOPLEVEL).M_ID_WIDTH=$(PARAM_M_ID_WIDTH)
	COMPILE_ARGS += -P $(TOPLEVEL).S_DEST_WIDTH=$(PARAM_S_DEST_WIDTH)
	COMPILE_ARGS += -P $(TOPLEVEL).M_DEST_WIDTH=$(PARAM_M_DEST_WIDTH)
	COMPILE_ARGS += -P $(TOPLEVEL).USER_ENABLE=$(PARAM_USER_ENABLE)
	COMPILE_ARGS += -P $(TOPLEVEL).USER_WIDTH=$(PARAM_USER_WIDTH)
	COMPILE_ARGS += -P $(TOPLEVEL).UPDATE_TID=$(PARAM_UPDATE_TID)
	COMPILE_ARGS += -P $(TOPLEVEL).S_REG_TYPE=$(PARAM_S_REG_TYPE)
	COMPILE_ARGS += -P $(TOPLEVEL).M_REG_TYPE=$(PARAM_M_REG_TYPE)
	COMPILE_ARGS += -P $(TOPLEVEL).ARB_TYPE_ROUND_ROBIN=$(PARAM_ARB_TYPE_ROUND_ROBIN)
	COMPILE_ARGS += -P $(TOPLEVEL).ARB_LSB_HIGH_PRIORITY=$(PARAM_ARB_LSB_HIGH_PRIORITY)

	ifeq ($(WAVES), 1)
		VERILOG_SOURCES += iverilog_dump.v
		COMPILE_ARGS += -s iverilog_dump
	endif
else ifeq ($(SIM), verilator)
	COMPILE_ARGS += -Wno-SELRANGE -Wno-WIDTH

	COMPILE_ARGS += -GDATA_WIDTH=$(PARAM_DATA_WIDTH)
	COMPILE_ARGS += -GKEEP_ENABLE=$(PARAM_KEEP_ENABLE)
	COMPILE_ARGS += -GKEEP_WIDTH=$(PARAM_KEEP_WIDTH)
	COMPILE_ARGS += -GID_ENABLE=$(PARAM_ID_ENABLE)
	COMPILE_ARGS += -GS_ID_WIDTH=$(PARAM_S_ID_WIDTH)
	COMPILE_ARGS += -GM_ID_WIDTH=$(PARAM_M_ID_WIDTH)
	COMPILE_ARGS += -GS_DEST_WIDTH=$(PARAM_S_DEST_WIDTH)
	COMPILE_ARGS += -GM_DEST_WIDTH=$(PARAM_M_DEST_WIDTH)
	COMPILE_ARGS += -GUSER_ENABLE=$(PARAM_USER_ENABLE)
	COMPILE_ARGS += -GUSER_WIDTH=$(PARAM_USER_WIDTH)
	COMPILE_ARGS += -GUPDATE_TID=$(PARAM_UPDATE_TID)
	COMPILE_ARGS += -GS_REG_TYPE=$(PARAM_S_REG_TYPE)
	COMPILE_ARGS += -GM_REG_TYPE=$(PARAM_M_REG_TYPE)
	COMPILE_ARGS += -GARB_TYPE_ROUND_ROBIN=$(PARAM_ARB_TYPE_ROUND_ROBIN)
	COMPILE_ARGS += -GARB_LSB_HIGH_PRIORITY=$(PARAM_ARB_LSB_HIGH_PRIORITY)

	ifeq ($(WAVES), 1)
		COMPILE_ARGS += --trace-fst
	endif
endif

include $(shell cocotb-config --makefiles)/Makefile.sim

$(WRAPPER).v: ../../rtl/$(DUT)_wrap.py
	$< -p $(S_COUNT) $(M_COUNT)

iverilog_dump.v:
	echo 'module iverilog_dump();' > $@
	echo 'initial begin' >> $@
	echo '    $$dumpfile("$(TOPLEVEL).fst");' >> $@
	echo '    $$dumpvars(0, $(TOPLEVEL));' >> $@
	echo 'end' >> $@
	echo 'endmodule' >> $@

clean::
	@rm -rf iverilog_dump.v
	@rm -rf dump.fst $(TOPLEVEL).fst
	@rm -rf *_wrap_*.v


text:
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

Imports System.Composition
Imports System.Linq
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

Namespace System.Runtime.Analyzers
    ''' <summary>
    ''' CA2214: Do not call overridable methods in constructors
    ''' </summary>
    <ExportCodeFixProvider(LanguageNames.VisualBasic), [Shared]>
    Public NotInheritable Class BasicDoNotCallOverridableMethodsInConstructorsFixer
        Inherits DoNotCallOverridableMethodsInConstructorsFixer

    End Class
End Namespace


text:
assetrinc */aˈsentrik/* An unusually simple way to compile and serve web assets

## Installation

The recommended method for installing assetrinc is via Composer.  If you are not familiar with Composer, check out the [Composer documentation](http://getcomposer.org).

Assetrinc's package name is `assetrinc/assetrinc`.

It is highly recommended that you require a specific version of assetrinc in your composer.json for now.  That is, do not include `0.0.*` or `~0.0.6`, but instead include `0.0.6`.  Assetrinc is still undergoing research and development, so backwards incompatible changes are still likely to occur between versions.

## Basic Usage

### Manifest Files

Manifest files are CSS and JS files with special comments that list CSS or JS files to include.

Assetrinc uses [Sprocketeer](http://github.com/zacharyrankin/sprocketeer) to parse manifest files.  Sprocketeer manifest files are similar to Ruby's Sprockets library manifest files, but keep in mind that Sprocketeer simplifies behavior by using named category paths instead of search paths.

### Example Code

```php
<?php

require 'vendor/autoload.php';

use Assetrinc\AssetService;

$asset_service = new AssetService(
    // the category paths to use when loading manifest files
    array(
        'core' => __DIR__ . '/assets',
        'bower' => __DIR__ . '/bower_components',
    ),
    // the base route assets are served from
    '/assets',
    array('debug' => false)
);

// in the controller that serves your /assets/{name} route
header("Content-Type: " . $asset_service->getContentType($name));
echo $asset_service->getContent($name);

// in your templates, generate JS/CSS tags using
echo $asset_service->jsTag("core/application.js");
echo $asset_service->cssTag("core/application.css");
```

## Contributors

Project Leaders

 - [Matt Light](http://github.com/lightster)
 - [Zachary Rankin](http://github.com/zacharyrankin)


text:
from django.core.management import BaseCommand
from django.db.models import get_app, get_models
from django.conf import settings

from search.search_utils import index_instance, confirm_model_is_indexable

class Command(BaseCommand):
    def add_arguments(self, parser):
        parser.add_argument(
            '--test',
            action='store_true',
            dest='test',
            default=False,
            help='Provide this if you want to create a test index')

    def handle(self, *args, **options):
        # optimize this to index in bulk

        apps_lists = settings.LOCAL_APPS

        for app_name in apps_lists:
            app = get_app(app_name)
            for model in get_models(app):
                if model and confirm_model_is_indexable(model):
                    all_instances = model.objects.all()[0:100] \
                        if options.get('test') else model.objects.all()
                    [index_instance(obj) for obj in all_instances]
                    message = "Indexed {} {}".format(
                        all_instances.count(),
                        model._meta.verbose_name_plural.capitalize())
                    self.stdout.write(message)
                else:
                    message = "Not indexing model {}".format(
                        model.__name__)
                    self.stdout.write(message)

        self.stdout.write("Finished indexing")


text:
package com.flipkart.flux.client.model;

import java.lang.annotation.*;

/**
 * The Workflow annotation is used to declare Flux Workflows.
 * Essentially, a new workflow is "submitted" to Flux whenever a method annotated with Workflow is executed
 * Any @com.flipkart.flux.client.model.Task methods used within the workflow are executed asynchronously,
 * whenever their dependencies are satisfied.
 *
 * @author yogesh.nachnani
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Workflow {
    /**
     * Each workflow must be versioned.
     * This enables the flux runtime to execute the right task based on the version number of this workflow
     */
    long version();

    String description() default "";
}


text:
**Installing the CLI**

To run `{%= name %}` from the command line, you'll need to install [Update][] globally first. You can do that now with the following command:

```sh
$ npm install --global update
```

This adds the `update` command to your system path, allowing it to be run from any directory.

**Install {%= name %}**

Install this module with the following command:

```sh
$ npm install --global {%= name %}
```