text:
"""

        Run the Strongly Connected Components algorithm
         by Travis Riggs

    This runs a strongly connected component analysis algorithm
    on a given graph edge file.

"""

from graphs import DirectedGraph

if __name__ == '__main__':

    digraph = DirectedGraph()

    with open("data/SCC.txt", "r") as f:
    # with open("data/smalldigraph.txt", "r") as f:

        for line in f.readlines():

            head, tail = line.strip().split(" ")

            digraph.add_edge(int(head), int(tail))

    print("Loaded graph from file")
    print(len(list(digraph.nodes.keys())))
    print("Beginning strong connection analysis...")

    digraph.strong_connections()

    # print(digraph)
    digraph.print_sccs(limit=10)

redpajama_set_name: RedPajamaGithub


text:
package sampler.cluster.abc.actor.root

import sampler.cluster.abc.config.ABCConfig
import sampler.cluster.abc.actor.WeighedParticles
import sampler.cluster.abc.algorithm.Generation

trait GettersComponent{
	val getters: Getters
}

trait Getters {
	def getMixRateMS(config: ABCConfig): Long = config.cluster.mixRateMS
	def getNumParticles(config: ABCConfig): Int = config.job.numParticles

	//TODO so far these are just used in logging, to avoid errors when testing, but they could
	// be used more widely, or perhaps converted to lenses?
	def getNumParticles[P](weighedParticles: WeighedParticles[P]): Int = weighedParticles.seq.size
	def getAccumulatedGenerationSize[P](generation: Generation[P]): Int = generation.weighted.size
}


text:
#include <ztest.h>
extern void test_multilib(void);

/**test case main entry*/
void test_main(void)
{
	ztest_test_suite(test_multilib_fn,
		ztest_unit_test(test_multilib));
	ztest_run_test_suite(test_multilib_fn);
}


text:
@class CCCategory;

@interface CCFood : NSManagedObject

@property (nonatomic, retain) NSString * title;
@property (nonatomic, retain) NSNumber * downloaded;
@property (nonatomic, retain) NSString * language;
@property (nonatomic, retain) NSString * locale;
@property (nonatomic, retain) NSNumber * sourceId;
@property (nonatomic, retain) NSNumber * showMeasurement;
@property (nonatomic, retain) NSNumber * cholesterol;
@property (nonatomic, retain) NSNumber * gramsPerServing;
@property (nonatomic, retain) NSNumber * sugar;
@property (nonatomic, retain) NSNumber * fiber;
@property (nonatomic, retain) NSDate * lastUpdated;
@property (nonatomic, retain) NSNumber * addedByUser;
@property (nonatomic, retain) NSNumber * fat;
@property (nonatomic, retain) NSNumber * sodium;
@property (nonatomic, retain) NSNumber * deleted;
@property (nonatomic, retain) NSNumber * hidden;
@property (nonatomic, retain) NSNumber * custom;
@property (nonatomic, retain) NSNumber * calories;
@property (nonatomic, retain) NSNumber * oid;
@property (nonatomic, retain) NSNumber * servingsCategory;
@property (nonatomic, retain) NSNumber * saturatedFat;
@property (nonatomic, retain) NSNumber * potasium;
@property (nonatomic, retain) NSString * brand;
@property (nonatomic, retain) NSNumber * carbohydrates;
@property (nonatomic, retain) NSNumber * protein;
@property (nonatomic, retain) NSNumber * defaultSize;
@property (nonatomic, retain) NSNumber * unsaturatedFat;
@property (nonatomic, retain) NSNumber * gramsPerMilliliter;
@property (nonatomic, retain) NSString * pieceDescription;
@property (nonatomic, retain) NSNumber * gramsPerPiece;
@property (nonatomic, retain) NSNumber * typeOfMeasurement;
@property (nonatomic, retain) NSNumber * showOnlySameType;
@property (nonatomic, retain) CCCategory *category;

@end


text:
using System;

// Implement ICard interface to class Card
// Create method ToString based on class CardToStringTest
namespace Poker
{
    public class Card : ICard
    {
        public CardFace Face { get; private set; }
        public CardSuit Suit { get; private set; }

        public Card(CardFace face, CardSuit suit)
        {
            this.Face = face;
            this.Suit = suit;
        }

        private string SuitToString()
        {
            string suitToString = string.Empty;
            switch (this.Suit)
            {
                case CardSuit.Clubs:
                    suitToString = "♣";
                    break;
                case CardSuit.Diamonds:
                    suitToString = "♦";
                    break;
                case CardSuit.Hearts:
                    suitToString = "♥";
                    break;
                case CardSuit.Spades:
                    suitToString = "♠";
                    break;
            }

            return suitToString;
        }

        public override string ToString()
        {
            string cardToString = string.Empty;
            if ((int)this.Face <= 10)
            {
                cardToString += (int)this.Face;
                cardToString += this.SuitToString();
            }
            else
            {
                cardToString += this.Face.ToString()[0];
                cardToString += this.SuitToString();
            }

            return cardToString;
        }
    }
}


text:
require 'spec_helper'

describe Banzai::Filter::ExternalIssueReferenceFilter, lib: true do
  include FilterSpecHelper

  def helper
    IssuesHelper
  end

  let(:project) { create(:jira_project) }

  context 'JIRA issue references' do
    let(:issue)     { ExternalIssue.new('JIRA-123', project) }
    let(:reference) { issue.to_reference }

    it 'requires project context' do
      expect { described_class.call('') }.to raise_error(ArgumentError, /:project/)
    end

    %w(pre code a style).each do |elem|
      it "ignores valid references contained inside '#{elem}' element" do
        exp = act = "<#{elem}>Issue #{reference}</#{elem}>"
        expect(filter(act).to_html).to eq exp
      end
    end

    it 'ignores valid references when using default tracker' do
      expect(project).to receive(:default_issues_tracker?).and_return(true)

      exp = act = "Issue #{reference}"
      expect(filter(act).to_html).to eq exp
    end

    it 'links to a valid reference' do
      doc = filter("Issue #{reference}")
      expect(doc.css('a').first.attr('href'))
        .to eq helper.url_for_issue(reference, project)
    end

    it 'links to the external tracker' do
      doc = filter("Issue #{reference}")
      link = doc.css('a').first.attr('href')

      expect(link).to eq "http://jira.example/browse/#{reference}"
    end

    it 'links with adjacent text' do
      doc = filter("Issue (#{reference}.)")
      expect(doc.to_html).to match(/\(#{reference}<\/a>\.\)/)
    end

    it 'includes a title attribute' do
      doc = filter("Issue #{reference}")
      expect(doc.css('a').first.attr('title')).to eq "Issue in JIRA tracker"
    end

    it 'escapes the title attribute' do
      allow(project.external_issue_tracker).to receive(:title).
        and_return(%{">whatever<a title="})

      doc = filter("Issue #{reference}")
      expect(doc.text).to eq "Issue #{reference}"
    end

    it 'includes default classes' do
      doc = filter("Issue #{reference}")
      expect(doc.css('a').first.attr('class')).to eq 'gfm gfm-issue has-tooltip'
    end

    it 'supports an :only_path context' do
      doc = filter("Issue #{reference}", only_path: true)
      link = doc.css('a').first.attr('href')

      expect(link).to eq helper.url_for_issue("#{reference}", project, only_path: true)
    end
  end
end


text:
import types
import asyncio
import logging
import aiohttp.web
import scrapy.signals
import scrapy.crawler

from scrapy.utils.project import get_project_settings

import scrapybox.crawler.spiders

SETTINGS = get_project_settings()

logger = logging.getLogger(__name__)

async def poll(crawler, time=1):
    while crawler.crawling:
        await asyncio.sleep(time)

async def parse_post(request):
    """
    $ curl localhost:8080/api/eval -d start_urls=[\"http://scrapinghub.com\",\"http://scrapy.org\"]
    Scraped 2 items: [{'response': <200 http://scrapinghub.com>}, {'response': <200 http://scrapy.org>}]

    <Request POST /api/eval > <MultiDictProxy('start_url': 'scrapy.org', 'parse': 'text = response.xpath(\'id("scrapy-logo")/following-sibling::p\')\r\nitem = dict(text=text.extract())\r\n', 'yield_item': 'on')>
    2016-03-25 12:08:12 [aiohttp.access] INFO: 127.0.0.1 - - [25/Mar/2016:19:08:12 +0000] "POST /api/eval HTTP/1.1" 200 188 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.116 Chrome/48.0.2564.116 Safari/537.36"
    Scraped 1 items: [{'text': ['
An open source and collaborative framework for extracting the data you need from websites.\n
', '
In a fast, simple, yet extensible way.
']}]

    http://stackoverflow.com/questions/35256152/can-eval-be-applied-on-a-compiled-ast-node-have-a-local-context
        self.emit ('\n{}\n', node.args [1] .s.format (* [
            eval (
                compile (
                    ast.Expression (arg),
                    '<string>',
                    'eval'
                ),
                {},
                {'include': include}
            )
            for arg in node.args [2:]
        ]))
    """
    await request.post()

    request_POST = dict(request.post())

    server_info = dict(
        request=dict(
            host=str(request.host),
            path=str(request.path),
            POST=dict(request_POST),
            query=str(request.query_string),
            method=str(request.method),
            scheme=str(request.scheme),
            cookies=dict(request.cookies),
            version=str(request.version),
            headers=dict(request.headers),
            content=list(request.content.read()),
            # payload=list(request.payload.read()),
            has_body=bool(request.has_body),
        ),
    )

    class Spider(scrapybox.crawler.spiders.ExampleYieldSpider):
        pass

    if 'start_urls' in request_POST:
        value = request_POST['start_urls'].strip()
        if value:
            Spider.start_urls = eval(value)

    if 'start_url' in request_POST:
        value = request_POST['start_url'].strip()
        if value:
            url = scrapy.utils.url.add_http_if_no_scheme(value)
            Spider.start_urls = [url]

    if request_POST.get('parse'):
        def parse(self, response):
            exec(request_POST['parse'], globals(), locals())
            if request_POST.get('yield_item'):
                frame_item = locals()['item']
                yield frame_item
        Spider.parse = types.MethodType(parse, Spider)

    settings = dict(SETTINGS)

    settings['ROBOTSTXT_OBEY'] = 'settings.ROBOTSTXT_OBEY' in request_POST
    settings['HTTPCACHE_ENABLED'] = 'settings.HTTPCACHE_ENABLED' in request_POST
    if 'settings.USER_AGENT' in request_POST:
        settings['USER_AGENT'] = request_POST['settings.USER_AGENT']

    items = []

    def item_scraped(item, response, spider):
        items.append(item)

    crawler = scrapy.crawler.Crawler(Spider, settings)
    crawler.signals.connect(item_scraped, signal=scrapy.signals.item_scraped)
    logger.debug('API starting to crawl {}'.format(crawler))
    crawler.crawl()
    await poll(crawler)
    data = dict(items=items, scrapybox=server_info)

    return aiohttp.web.json_response(data)

async def parse_get(request):
    """
    $ curl "http://127.0.0.1:8080/api/parse/eval/response.status"
    200

    $ curl "http://127.0.0.1:8080/api/parse/eval/response.headers"
    {b'Last-Modified': [b'Fri, 09 Aug 2013 23:54:35 GMT'], b'Etag': [b'"359670651+gzip"'], b'X-Cache': [b'HIT'], b'Date': [b'Mon, 21 Mar 2016 20:17:19 GMT'], b'X-Ec-Custom-Error': [b'1'], b'Cache-Control': [b'max-age=604800'], b'Vary': [b'Accept-Encoding'], b'Content-Type': [b'text/html'], b'Server': [b'ECS (ftw/FBE4)'], b'Expires': [b'Mon, 28 Mar 2016 20:17:19 GMT']}

    $ curl "http://127.0.0.1:8080/api/parse/eval/response"
    <200 http://www.example.com/>

    $ curl "http://127.0.0.1:8080/api/parse/eval/self"
    <Spider 'parse' at 0x7f3a3af2fb38>

    $ curl "http://127.0.0.1:8080/api/parse/eval/self.__dict__"
    {'settings': <scrapy.settings.Settings object at 0x7f3a3af47e10>, 'result': {...}, 'crawler': <scrapy.crawler.Crawler object at 0x7f3a3af47b70>}
    """
    class Spider(scrapybox.crawler.spiders.ExampleSpider):
        result = None
        def parse(self, response):
            self.result = eval(self.code())
            yield

        @staticmethod
        def code():
            return request.match_info.get('code')

    crawler = scrapy.crawler.Crawler(Spider, SETTINGS)
    logger.debug('API starting to crawl {}'.format(crawler))
    crawler.crawl()
    await poll(crawler)
    text = '{}\n'.format(crawler.spider.result)

    return aiohttp.web.Response(body=text.encode('utf-8'))

async def delay(request):
    """
    $ curl localhost:8080/api/delay/15 &
    [1] 17172
    $ curl localhost:8080/api/delay/5 &
    [2] 17174
    $ curl localhost:8080/api/delay/1 &
    [3] 17177
    $ /api/delay/1
    /api/delay/5
    /api/delay/15
    """
    Spider = scrapybox.crawler.spiders.ExampleSpider
    crawler = scrapy.crawler.Crawler(Spider, SETTINGS)
    logger.debug('API starting to crawl {}'.format(crawler))
    crawler.crawl()
    await poll(crawler, float(request.match_info.get('time')))
    text = '{}\n'.format(request.path)

    return aiohttp.web.Response(body=text.encode('utf-8'))

def hello(request):
    """
    $ curl "http://127.0.0.1:8080/api/hello"
    Hello world!
    """
    text = 'Hello world!\n'
    return aiohttp.web.Response(body=text.encode('utf-8'))


text:
class SelectPoll;
#elif defined(__linux__)
class EpollPoll;
#endif
class Listener;
class Worker;
struct EventHandler;
class Network {
  enum {
    kDefaultWorkerCount = 1,
    kDefaultBufferSize  = 16 * 1024,
  };
  EventHandler* handler_;
#if defined(_WINDOWS_) || defined(_MSC_VER)
  SelectPoll* poll_;
#elif defined(__linux__)
  EpollPoll* poll_;
#endif
  Worker* workers_;
  int     worker_count_;
  std::vector<Listener*> listeners_;

  Network(const Network&);
  Network& operator =(const Network&);
public:
  explicit Network(void);
  ~Network(void);

  inline void Attach(EventHandler* hander)
  {
    handler_ = hander;
  }
public:
  bool Init(
      int worker_count = kDefaultWorkerCount,
      int rbytes = kDefaultBufferSize,
      int wbytes = kDefaultBufferSize);
  void Destroy(void);

  bool Listen(const char* ip = "127.0.0.1", unsigned short port = 5555);
};

#endif  //! __NETWORK_HEADER_H__


text:
* {margin:0;padding:0;}
a {text-decoration:none; color:#333; font-weight:bold;}
a:hover {color:#999; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -o-transition: all 0.3s ease;}
img, img a, img a:hover, img:hover { border:none; }
img:hover {-webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -o-transition: all 0.3s ease; opacity:0.6; filter:alpha(opacity=60);) }
/*body {background:#fff; font-family: "Century Gothic", CenturyGothic, AppleGothic, sans-serif; font-weight:normal; font-size:14px; color:#333333; }*/
body {background:#fff; font-family: Verdana,Helvetica,sans-serif; font-weight:normal; font-size:12px; color:#333333; }
input,select,textarea { font-family:Verdana,Helvetica,sans-serif; }

#nav { width:10%; height:100%; background:#444; color:#fff; text-align:center; z-index:5; position:fixed; left:0; top:0; }
#nav a { color:#fff; font-weight:normal; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -o-transition: all 0.3s ease; }
#nav a:hover { color:#a5df00; }
ul.navigation { width:100%; }
ul.navigation li {	list-style:none; margin-bottom:0px; }
ul.navigation li a {width:100%; height:25px; display:block; background:#333; text-align:left;border:0px solid #006699;color:#ffffff; padding:5px 0 0 5px;font-weight:normal; font-size:12px; overflow:hidden;}
ul.navigation li a:hover { border:0px solid #000; background:#222; }
ul.navigation li.indent a { padding-left:15%; width:85%; }

#top_bar { width:100%; height:24px; background:#444; color:#fff; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; }
#top_bar img { float:left; background:#fff; border:1px solid #fff; height:16px; margin:3px 0 0 5px; }
#top_bar p { float:left; padding:4px 0 0 10px; }
#top_bar p.right { float:right; padding:4px 10px 0 0; }
#top_bar p.right a { color:#fff; font-weight:normal; } #top_bar p.right a:hover { color:#ccc; }
#main_content { width:77%; margin-left:10%; padding:3px 1% 1% 1%; }
#sec_content { width:10%; height:100%; padding:3px; background:#444; color:#fff; position:fixed; right:0; top:0; }
#loginbox { width:500px; margin:50px auto; height:auto; border:0px solid #ccc; padding:10px;}
#footer { clear:both; width:100%; font-size:10px; height:70px; padding-top:30px; text-align:center; border:0px solid #333; margin-top:100px; }
#footer a {font-weight:normal;}
ul.space li { margin-left:30px; }
hr { background-color:#333; color:#333; border:0px solid #333; height:1px; width:80%; margin:5px auto; }
hr {	border:0; height: 1px; width:80%; margin:0 auto;	background: -webkit-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); 	background: -moz-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); 	background: -ms-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); 	background: -o-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));}
hr.spacer { margin:80px auto; }

.successful {background-color:#dfffbf; padding:5px; border:1px solid #84ff0b; margin:30px; }
.unsuccessful {background-color:#ffe2e2; padding:5px; border:1px solid #ff3a3a; margin:30px; }
.sessionflash {padding:10px; margin:10px; border:1px solid #FFFF00; background:#FFFFCC; width:500px; }

.quickfloat { float:left; }
.quickfloatpadding { float:left; padding-left:30px; }
.quickfloatright { float:right; }
.clearboth { clear:both; }

.stats_boxes { background:#f5f5f5; border:1px solid #ccc; float:left; margin:3px; padding:10px; width:300px; height:200px; border-radius:5px; }
.stats_boxes:hover { background:#f9f9f9; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -o-transition: all 0.3s ease; }

label { cursor:pointer; display:inline-block; width:100%; height:100%; padding:0; margin:0; }
fieldset { padding:10px; }
legend { padding:5px; }

h1, h2, h3 { width:80%; margin:15px 0; padding-left:10px; font-weight:normal; }

table th, table td, table tr { padding:5px; margin:0; text-align:center; }
table th { background:#a5df00; }
.tbg1 { background:#FAFAFA; } .tbg1:hover { background:#ddd; -webkit-transition: all 0.2s ease; -moz-transition: all 0.2s ease; -o-transition: all 0.2s ease; }
.tbg2 { background:#F2F2F2; } .tbg2:hover { background:#ddd; -webkit-transition: all 0.2s ease; -moz-transition: all 0.2s ease; -o-transition: all 0.2s ease; }

table input, table select, table p { padding:2px; text-align:left; font-size:10px; }
.datepicker, select { cursor:pointer; }
input.submit { padding:5px; text-align:center; cursor:pointer; }
input.submit:hover {  }
table p, table p a { font-size:10px; padding:0; font-weight:normal; }
table p a:hover { text-decoration:underline; }
table input, table select { border:1px solid #ccc; width:80px; }

input.checkBox { width:20px; }
input.box, select.box, textarea.box { width:200px; padding:5px; margin:5px; }
select.box { cursor:pointer; width:210px; }
textarea.box { width:95%; height:150px; }
/*
input.boxSubmit { cursor:pointer; text-align:center; padding:10px; }
input.boxSubmit:hover { border:1px solid #000; background:#ccc; }
*/

input.login_email { background:url(../images/icons/user.png) 5px 10px no-repeat #e4f4df; padding:10px 10px 10px 40px; width:200px; }
input.login_password { background:url(../images/icons/key.png) 5px 10px no-repeat #e4f4df; padding:10px 10px 10px 40px; width:200px; }
input.login_email:hover,input.login_email:focus { background:url(../images/icons/user.png) 5px 10px no-repeat #b7d9ab; padding:10px 10px 10px 40px; }
input.login_password:hover,input.login_password:focus { background:url(../images/icons/key.png) 5px 10px no-repeat #b7d9ab; padding:10px 10px 10px 40px; }

input.ajaxSearchTasks, input.autocomplete_search_tickets, input.autocomplete_search_archivetickets { background:url(../images/icons/magnify_16x16.png) 5px 10px no-repeat; padding:10px 10px 10px 40px; width:600px; border:1px solid #ccc; }
input.ajaxSearchTasks:hover,input.ajaxSearchTasks:focus, input.autocomplete_search_tickets:hover,input.autocomplete_search_tickets:focus,
input.autocomplete_search_archivetickets:hover,input.autocomplete_search_archivetickets:focus { border:1px solid #777; }

.ui-autocomplete {
    max-height: 400px;
    overflow-y: auto;
    /* prevent horizontal scrollbar */
    overflow-x: hidden;
  }

.ui-autocomplete .ui-menu-item .ui-state-focus {
 cursor:pointer;
}

.dialog { display:none; }


text:
class SessionsController < ApplicationController
  def allowed
    {
      new: :guest,
      create: :guest,
      destroy: :member,
    }
  end

  def new
  end

  def create
    if @user = login(session_params[:email], session_params[:password])
      redirect_back_or_to root_path
    else
      flash.now.alert = "Email or password is invalid"
      render :new
    end
  end

  def destroy
    logout
    redirect_to root_path
  end

  private

  def session_params
    params.require(:session).permit(%i[email password])
  end
end


text:
package com.github.skjolber.nfc.hce;

import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.github.skjolber.nfc.NfcReader;
import com.github.skjolber.nfc.NfcService;
import com.github.skjolber.nfc.acs.Acr1222LReader;
import com.github.skjolber.nfc.acs.Acr122UReader;
import com.github.skjolber.nfc.acs.Acr1251UReader;
import com.github.skjolber.nfc.acs.Acr1252UReader;
import com.github.skjolber.nfc.acs.Acr1255UReader;
import com.github.skjolber.nfc.acs.Acr1281UReader;
import com.github.skjolber.nfc.acs.Acr1283LReader;
import com.github.skjolber.nfc.command.ACR1222Commands;
import com.github.skjolber.nfc.command.ACR122Commands;
import com.github.skjolber.nfc.command.ACR1251Commands;
import com.github.skjolber.nfc.command.ACR1252Commands;
import com.github.skjolber.nfc.command.ACR1255BluetoothCommands;
import com.github.skjolber.nfc.command.ACR1255UsbCommands;
import com.github.skjolber.nfc.command.ACR1281Commands;
import com.github.skjolber.nfc.command.ACR1283Commands;
import com.github.skjolber.nfc.command.ACRCommands;
import com.github.skjolber.nfc.messages.NfcReaderServiceListener;

public class DefaultNfcReaderServiceListener implements NfcReaderServiceListener {

    private static final String TAG = DefaultNfcReaderServiceListener.class.getName();

    private Context context;
    private IAcr122UBinder acr122Binder;
    private IAcr1222LBinder acr1222Binder;
    private IAcr1251UBinder acr1251Binder;
    private IAcr1281UBinder acr1281Binder;
    private IAcr1283Binder acr1283Binder;
    private IAcr1252UBinder acr1252Binder;
    private IAcr1255UBinder acr1255Binder;

    public DefaultNfcReaderServiceListener(IAcr122UBinder acr122Binder, IAcr1222LBinder acr1222Binder, IAcr1251UBinder acr1251Binder, IAcr1281UBinder acr1281Binder, IAcr1283Binder acr1283Binder, IAcr1252UBinder acr1252Binder, IAcr1255UBinder acr1255Binder, Context context) {
        this.acr122Binder = acr122Binder;
        this.acr1222Binder = acr1222Binder;
        this.acr1251Binder = acr1251Binder;
        this.acr1281Binder = acr1281Binder;
        this.acr1283Binder = acr1283Binder;
        this.acr1252Binder = acr1252Binder;
        this.acr1255Binder = acr1255Binder;
        this.context = context;
    }

    public void onServiceStarted() {
        broadcast(NfcService.ACTION_SERVICE_STARTED);
    }

    public void onServiceStopped() {
        broadcast(NfcService.ACTION_SERVICE_STOPPED);
    }

    @Override
    public void onReaderOpen(Object r, int status) {
        Intent intent = new Intent();

        intent.setAction(NfcReader.ACTION_READER_OPENED);
        if (r != null) {
            if (r instanceof ACRCommands) {
                ACRCommands reader = (ACRCommands) r;
                if (reader instanceof ACR122Commands) {
                    acr122Binder.setAcr122UCommands((ACR122Commands) reader);
                    intent.putExtra(NfcReader.EXTRA_READER_CONTROL, new Acr122UReader(reader.getName(), acr122Binder));
                } else if (reader instanceof ACR1222Commands) {
                    acr1222Binder.setAcr1222LCommands((ACR1222Commands) reader);
                    intent.putExtra(NfcReader.EXTRA_READER_CONTROL, new Acr1222LReader(reader.getName(), acr1222Binder));
                } else if (reader instanceof ACR1251Commands) {
                    acr1251Binder.setCommands((ACR1251Commands) reader);
                    intent.putExtra(NfcReader.EXTRA_READER_CONTROL, new Acr1251UReader(reader.getName(), acr1251Binder));
                } else if (reader instanceof ACR1252Commands) {
                    acr1252Binder.setCommands((ACR1252Commands) reader);
                    intent.putExtra(NfcReader.EXTRA_READER_CONTROL, new Acr1252UReader(reader.getName(), acr1252Binder));
                } else if (reader instanceof ACR1255UsbCommands) {
                    acr1255Binder.setCommands((ACR1255UsbCommands) reader);
                    intent.putExtra(NfcReader.EXTRA_READER_CONTROL, new Acr1255UReader(reader.getName(), acr1255Binder));
                } else if (reader instanceof ACR1281Commands) {
                    acr1281Binder.setCommands((ACR1281Commands) reader);
                    intent.putExtra(NfcReader.EXTRA_READER_CONTROL, new Acr1281UReader(reader.getName(), acr1281Binder));
                } else if (reader instanceof ACR1283Commands) {
                    acr1283Binder.setCommands((ACR1283Commands) reader);
                    intent.putExtra(NfcReader.EXTRA_READER_CONTROL, new Acr1283LReader(reader.getName(), acr1283Binder));
                } else if (reader instanceof ACR1255UsbCommands) {
                    acr1255Binder.setCommands((ACR1255UsbCommands) reader);
                    intent.putExtra(NfcReader.EXTRA_READER_CONTROL, new Acr1255UReader(reader.getName(), acr1255Binder));
                } else {
                    Log.d(TAG, "Not supporting reader extras for " + r);
                }
            } else if (r instanceof ACR1255BluetoothCommands) {
                ACR1255BluetoothCommands reader = (ACR1255BluetoothCommands) r;
                acr1255Binder.setCommands(reader);
                intent.putExtra(NfcReader.EXTRA_READER_CONTROL, new Acr1255UReader(reader.getName(), acr1255Binder));
            } else {
                Log.d(TAG, "Not supporting reader extras for " + r);
            }
        } else {
            Log.d(TAG, "No reader extras");
        }

        intent.putExtra(NfcReader.EXTRA_READER_STATUS_CODE, status);

        sendBroadcast(intent);
    }

    public void onReaderClosed(int status, String message) {
        if (acr122Binder != null) acr122Binder.clearReader();
        if (acr1222Binder != null) acr1222Binder.clearReader();
        if (acr1251Binder != null) acr1251Binder.clearReader();
        if (acr1252Binder != null) acr1252Binder.clearReader();
        if (acr1255Binder != null) acr1255Binder.clearReader();
        if (acr1281Binder != null) acr1281Binder.clearReader();
        if (acr1283Binder != null) acr1283Binder.clearReader();

        Intent intent = new Intent();
        intent.setAction(NfcReader.ACTION_READER_CLOSED);

        if (status != -1) {
            intent.putExtra(NfcReader.EXTRA_READER_STATUS_CODE, status);
        }

        if (message != null) {
            intent.putExtra(NfcReader.EXTRA_READER_STATUS_MESSAGE, message);
        }

        sendBroadcast(intent);
    }

    public void broadcast(String action) {
        Intent intent = new Intent();
        intent.setAction(action);
        sendBroadcast(intent);
    }

    private void sendBroadcast(Intent intent) {
        Log.d(TAG, "Broadcast " + intent.getAction());

        context.sendBroadcast(intent);
    }
}


text:
require 'spec_helper'

describe Banzai::Pipeline::GfmPipeline do
  describe 'integration between parsing regular and external issue references' do
    let(:project) { create(:redmine_project, :public) }

    context 'when internal issue tracker is enabled' do
      context 'when shorthand pattern #ISSUE_ID is used' do
        it 'links an internal issue  if it exists' do
          issue = create(:issue, project: project)
          markdown = issue.to_reference(project, full: true)

          result = described_class.call(markdown, project: project)[:output]
          link = result.css('a').first

          expect(link['href']).to eq(
            Gitlab::Routing.url_helpers.project_issue_path(project, issue)
          )
        end

        it 'does not link any issue if it does not exist on GitLab' do
          markdown = '#12'

          result = described_class.call(markdown, project: project)[:output]
          expect(result.css('a')).to be_empty
        end
      end

      it 'allows to use long external reference syntax for Redmine' do
        markdown = 'API_32-12'

        result = described_class.call(markdown, project: project)[:output]
        link = result.css('a').first

        expect(link['href']).to eq 'http://issues.example.com/issues/12'
      end

      it 'parses cross-project references to regular issues' do
        other_project = create(:project, :public)
        issue = create(:issue, project: other_project)
        markdown = issue.to_reference(project, full: true)

        result = described_class.call(markdown, project: project)[:output]
        link = result.css('a').first

        expect(link['href']).to eq(
          Gitlab::Routing.url_helpers.project_issue_path(other_project, issue)
        )
      end
    end

    context 'when internal issue tracker is disabled' do
      before do
        project.issues_enabled = false
        project.save!
      end

      it 'allows to use shorthand external reference syntax for Redmine' do
        markdown = '#12'

        result = described_class.call(markdown, project: project)[:output]
        link = result.css('a').first

        expect(link['href']).to eq 'http://issues.example.com/issues/12'
      end

      it 'allows to use long external reference syntax for Redmine' do
        markdown = 'API_32-12'

        result = described_class.call(markdown, project: project)[:output]
        link = result.css('a').first

        expect(link['href']).to eq 'http://issues.example.com/issues/12'
      end

      it 'parses cross-project references to regular issues' do
        other_project = create(:project, :public)
        issue = create(:issue, project: other_project)
        markdown = issue.to_reference(project, full: true)

        result = described_class.call(markdown, project: project)[:output]
        link = result.css('a').first

        expect(link['href']).to eq(
          Gitlab::Routing.url_helpers.project_issue_path(other_project, issue)
        )
      end
    end
  end

  describe 'markdown link or image urls having spaces' do
    let(:project) { create(:project, :public) }

    it 'rewrites links with spaces in url' do
      markdown = "[Link to Page](page slug)"
      output = described_class.to_html(markdown, project: project)

      expect(output).to include("href=\"page%20slug\"")
    end

    it 'rewrites images with spaces in url' do
      markdown = "![My Image](test image.png)"
      output = described_class.to_html(markdown, project: project)

      expect(output).to include("src=\"test%20image.png\"")
    end

    it 'sanitizes the fixed link' do
      markdown_xss = "[xss](javascript: alert%28document.domain%29)"
      output = described_class.to_html(markdown_xss, project: project)

      expect(output).not_to include("javascript")

      markdown_xss = "<invalidtag>\n[xss](javascript:alert%28document.domain%29)"
      output = described_class.to_html(markdown_xss, project: project)

      expect(output).not_to include("javascript")
    end
  end

  describe 'emoji in references' do
    set(:project) { create(:project, :public) }
    let(:emoji) { '💯' }

    it 'renders a label reference with emoji inside' do
      create(:label, project: project, name: emoji)

      output = described_class.to_html("#{Label.reference_prefix}\"#{emoji}\"", project: project)

      expect(output).to include(emoji)
      expect(output).to include(Gitlab::Routing.url_helpers.project_issues_path(project, label_name: emoji))
    end

    it 'renders a milestone reference with emoji inside' do
      milestone = create(:milestone, project: project, title: emoji)

      output = described_class.to_html("#{Milestone.reference_prefix}\"#{emoji}\"", project: project)

      expect(output).to include(emoji)
      expect(output).to include(Gitlab::Routing.url_helpers.milestone_path(milestone))
    end
  end

  describe 'asset proxy' do
    let(:project) { create(:project, :public) }
    let(:image)   { '![proxy](http://example.com/test.png)' }
    let(:proxy)   { 'https://assets.example.com/08df250eeeef1a8cf2c761475ac74c5065105612/687474703a2f2f6578616d706c652e636f6d2f746573742e706e67' }
    let(:version) { Gitlab::CurrentSettings.current_application_settings.local_markdown_version }

    before do
      stub_asset_proxy_setting(enabled: true)
      stub_asset_proxy_setting(secret_key: 'shared-secret')
      stub_asset_proxy_setting(url: 'https://assets.example.com')
      stub_asset_proxy_setting(whitelist: %W(gitlab.com *.mydomain.com #{Gitlab.config.gitlab.host}))
      stub_asset_proxy_setting(domain_regexp: Banzai::Filter::AssetProxyFilter.compile_whitelist(Gitlab.config.asset_proxy.whitelist))
    end

    it 'replaces a lazy loaded img src' do
      output = described_class.to_html(image, project: project)
      doc    = Nokogiri::HTML.fragment(output)
      result = doc.css('img').first

      expect(result['data-src']).to eq(proxy)
    end

    it 'autolinks images to the proxy' do
      output = described_class.to_html(image, project: project)
      doc    = Nokogiri::HTML.fragment(output)
      result = doc.css('a').first

      expect(result['href']).to eq(proxy)
      expect(result['data-canonical-src']).to eq('http://example.com/test.png')
    end

    it 'properly adds tooltips to link for IDN images' do
      image  = '![proxy](http://exa😄mple.com/test.png)'
      proxy  = 'https://assets.example.com/6d8b634c412a23c6bfe1b2963f174febf5635ddd/687474703a2f2f6578612546302539462539382538346d706c652e636f6d2f746573742e706e67'
      output = described_class.to_html(image, project: project)
      doc    = Nokogiri::HTML.fragment(output)
      result = doc.css('a').first

      expect(result['href']).to eq(proxy)
      expect(result['data-canonical-src']).to eq('http://exa%F0%9F%98%84mple.com/test.png')
      expect(result['title']).to eq 'http://xn--example-6p25f.com/test.png'
    end
  end
end


text:
using NUnit.Framework;
using TddEbook.TddToolkit.ChainedAssertions;

namespace TddEbook.TddToolkitSpecification
{
  public class ChainedAssertionsSpecification
  {
    [Test]
    public void ShouldAllowTestingForNotNullWithMessage()
    {
      //GIVEN
      var levels = new Level1();

      //THEN
      var e = Assert.Throws<AssertionException>(() =>
        levels.AssertNotNull("l1")
          ._l2.AssertNotNull("l2")
          ._l3.AssertNotNull("l3")
          ._l4.AssertNotNull("l4")
          ._l5.AssertNotNull("l5")
        );
      StringAssert.Contains("l5", e.Message);
    }

    [Test]
    public void ShouldAllowTestingForEqualityWithMessage()
    {
      Level4.Str.AssertEqualTo("aaa", "l4str");

      var e = Assert.Throws<AssertionException>(() =>
        Level4.Str.AssertNotNull("l4NotNull")
          .AssertEqualTo("abc", "l4str")

        );
      StringAssert.Contains("l4str", e.Message);

    }

    [Test]
    public void ShouldAllowTestingForGreaterLower()
    {
      5.AssertEqualTo(5, "e")
        .AssertGreaterOrEqualTo(5, "ge")
        .AssertGreaterOrEqualTo(4, "ge2")
        .AssertGreaterThan(4, "g")
        .AssertLessOrEqualTo(5, "le")
        .AssertLessOrEqualTo(6, "le2")
        .AssertLessThan(6, "l")
        .AssertPositive("positive");
    }

    [Test]
    public void ShouldAllowAssertingOnCollections()
    {
      //GIVEN
      var collection = new[] {"Amber", "Annie", "Eve", "Julie"};

      //THEN
      var e = Assert.Throws<AssertionException>(() => collection
                                                        .AssertContains("Annie", "Annie")
                                                        .AssertDoesNotContain("Jodie", "should not contain Jodie")
                                                        .AssertContains<string[], string>(s => s.StartsWith("Ju"), "predicate1")
                                                        .AssertIsNotEmpty("not empty")
                                                        .AssertIsInAcendingOrder("ascending order")
                                                        [0]
                                                        .AssertEqualTo("Amber", "Amber")
                                                        .AssertEqualTo("Lol", "This should fail"));
      StringAssert.Contains("This should fail", e.Message);
    }

    public class Level1
    {
      public readonly Level2 _l2 = new Level2();
    }

    public class Level2
    {
      public readonly Level3 _l3 = new Level3();
    }

    public class Level3
    {
      public readonly Level4 _l4 = new Level4();
    }

    public class Level4
    {
      public readonly Level5 _l5 = null;
      public const string Str = "aaa";
    }

    public class Level5
    {

    }
  }

}


text:
class Game
  attr_accessor :name, :year, :system
  attr_reader :created_at

  def initialize(name, options={})
    @name = name
    @year = options[:year]
    @system = options[:system]
    @created_at = Time.new
  end
end

street_fight = Game.new('Street Fight', {:year => 2014, :system => 'PS3'})
puts street_fight.name
puts street_fight.created_at


text:
extern void print_hello(int i);

int main(int, char**) {
    print_hello(1);
    return 0;
}


text:
// -*-Mode: C++;-*- // technically C99

// * BeginRiceCopyright *****************************************************
//
// $HeadURL$
// $Id$
//
// --------------------------------------------------------------------------
// Part of HPCToolkit (hpctoolkit.org)
//
// Information about sources of support for research and development of
// HPCToolkit is at 'hpctoolkit.org' and in 'README.Acknowledgments'.
// --------------------------------------------------------------------------
//
// Copyright ((c)) 2002-2015, Rice University
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
//   notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
//   notice, this list of conditions and the following disclaimer in the
//   documentation and/or other materials provided with the distribution.
//
// * Neither the name of Rice University (RICE) nor the names of its
//   contributors may be used to endorse or promote products derived from
//   this software without specific prior written permission.
//
// This software is provided by RICE and contributors "as is" and any
// express or implied warranties, including, but not limited to, the
// implied warranties of merchantability and fitness for a particular
// purpose are disclaimed. In no event shall RICE or contributors be
// liable for any direct, indirect, incidental, special, exemplary, or
// consequential damages (including, but not limited to, procurement of
// substitute goods or services; loss of use, data, or profits; or
// business interruption) however caused and on any theory of liability,
// whether in contract, strict liability, or tort (including negligence
// or otherwise) arising in any way out of the use of this software, even
// if advised of the possibility of such damage.
//
// ******************************************************* EndRiceCopyright *

//***************************************************************************
//
// File:
//   $HeadURL$
//
// Purpose:
//   LUSH: Logical Unwind Support for HPCToolkit
//
// Description:
//   [The set of functions, macros, etc. defined in the file]
//
// Author:
//   Nathan Tallent, Rice University.
//
//***************************************************************************

#ifndef lush_support_rt_h
#define lush_support_rt_h

//************************* System Include Files ****************************

#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>

//*************************** User Include Files ****************************

#include <lib/prof-lean/lush/lush-support.h>

#include <unwind/common/unwind.h>

#include <memory/hpcrun-malloc.h>
#include <utilities/ip-normalized.h>

//*************************** Forward Declarations **************************

// A macro to automatically declare function pointers types for each
// routine
#define LUSHI_DECL(RET, FN, ARGS)  \
  RET FN ARGS;                     \
  typedef RET (* FN ## _fn_t) ARGS

//***************************************************************************
// LUSH Unwind Types
//***************************************************************************

// ---------------------------------------------------------
// LUSH step
// ---------------------------------------------------------

typedef enum lush_step lush_step_t;

enum lush_step {
  LUSH_STEP_NULL = 0,

  LUSH_STEP_CONT,      // cursor represents valid chord/note
  LUSH_STEP_END_CHORD, // prev note  was the end of the chord
  LUSH_STEP_END_PROJ,  // prev chord was the end of the projection
  LUSH_STEP_ERROR      // error during the step
};

// ---------------------------------------------------------
// LUSH LIP: An opaque logical id
// ---------------------------------------------------------

// N.B.: Currently, this routine belongs here and not in lush-support.h!
static inline lush_lip_t*
lush_lip_clone(lush_lip_t* x)
{
  lush_lip_t* x_clone = hpcrun_malloc(sizeof(lush_lip_t));
  memcpy(x_clone, x, sizeof(lush_lip_t));
  return x_clone;
}

// ---------------------------------------------------------
// LUSH l-cursor: space for a logical cursor
// ---------------------------------------------------------

typedef struct lush_lcursor lush_lcursor_t;

struct lush_lcursor {
  unsigned char data[64];
};

// ---------------------------------------------------------
// LUSH cursor
// ---------------------------------------------------------

typedef enum lush_cursor_flags lush_cursor_flags_t;

enum lush_cursor_flags {
  LUSH_CURSOR_FLAGS_NONE = 0x00000000,

  //fixme: do we want this?
  //LUSH_CURSOR_FLAGS_MASK       = 0x00000000,
  //LUSH_CURSOR_FLAGS_MASK_AGENT = 0x00000000,

  // projections
  LUSH_CURSOR_FLAGS_BEG_PPROJ  = 0x00000001, // cursor @ beg of p-projection
  LUSH_CURSOR_FLAGS_END_PPROJ  = 0x00000002, // cursor @ end of p-projection
  LUSH_CURSOR_FLAGS_END_LPROJ  = 0x00000004, // cursor @ end of l-projection

  // chords
  LUSH_CURSOR_FLAGS_BEG_PCHORD = 0x00000010, // cursor @ beg of p-chord
  LUSH_CURSOR_FLAGS_END_PCHORD = 0x00000020, // cursor @ end of p-chord
  LUSH_CURSOR_FLAGS_END_LCHORD = 0x00000040  // cursor @ end of l-chord
};

typedef struct lush_cursor lush_cursor_t;

struct lush_cursor {
  // meta info
  unsigned flags;            // lush_cursor_flags
  lush_assoc_info_t as_info; // bichord's physical-logical association
  lush_agentid_t aid;        // agent id (if any) owning this cursor
  lush_agentid_t aid_prev;   // previous agent id (excluding identity agent)
  lush_agent_pool_t* apool;  // agent pool

  // physical cursor
  hpcrun_unw_cursor_t pcursor;

  // logical cursor
  lush_lcursor_t lcursor;
  lush_lip_t     lip;
  // active marker FIXME
};

static inline bool
lush_cursor_is_flag(lush_cursor_t* cursor, lush_cursor_flags_t f)
{
  return (cursor->flags & f);
}

static inline void
lush_cursor_set_flag(lush_cursor_t* cursor, lush_cursor_flags_t f)
{
  cursor->flags = (cursor->flags | f);
}

static inline void
lush_cursor_unset_flag(lush_cursor_t* cursor, lush_cursor_flags_t f)
{
  cursor->flags = (cursor->flags & ~f);
}

static inline lush_assoc_t
lush_cursor_get_assoc(lush_cursor_t* cursor)
{
  return lush_assoc_info__get_assoc(cursor->as_info);
}

static inline void
lush_cursor_set_assoc(lush_cursor_t* cursor, lush_assoc_t as)
{
  lush_assoc_info__set_assoc(cursor->as_info, as);
}

static inline lush_agentid_t
lush_cursor_get_aid(lush_cursor_t* cursor)
{
  return cursor->aid;
}

static inline void
lush_cursor_set_aid(lush_cursor_t* cursor, lush_agentid_t aid)
{
  cursor->aid = aid;
}

static inline lush_agentid_t
lush_cursor_get_aid_prev(lush_cursor_t* cursor)
{
  return cursor->aid_prev;
}

static inline void
lush_cursor_set_aid_prev(lush_cursor_t* cursor, lush_agentid_t aid)
{
  cursor->aid_prev = aid;
}

static inline ip_normalized_t
lush_cursor_get_ip_norm(lush_cursor_t* cursor)
{
  ip_normalized_t ip_norm;
  if (hpcrun_unw_get_ip_norm_reg(&cursor->pcursor, &ip_norm) < 0) {
    // FIXME
  }
  return ip_norm;
}

static inline void*
lush_cursor_get_ip_unnorm(lush_cursor_t* cursor)
{
  void* ip_unnorm;
  if (hpcrun_unw_get_ip_unnorm_reg(&cursor->pcursor, &ip_unnorm) < 0) {
    // FIXME
  }
  return ip_unnorm;
}

static inline lush_lip_t*
lush_cursor_get_lip(lush_cursor_t* cursor)
{
  return &cursor->lip;
}

static inline hpcrun_unw_cursor_t*
lush_cursor_get_pcursor(lush_cursor_t* cursor)
{
  return &cursor->pcursor;
}

static inline lush_lcursor_t*
lush_cursor_get_lcursor(lush_cursor_t* cursor)
{
  return &cursor->lcursor;
}

// **************************************************************************

#endif /* lush_support_rt_h */


text:
package ac.cr.tec.ce1103.cedms.serverClient;

import org.junit.Test;

public class Client_SocketTest {
    @Test
    public void testSend() throws Exception {
        Client_Socket client = new Client_Socket("192.168.1.111", 5013);
        client.send("hello");

    }
}


text:
package com.eugenePetrenko.idea.dependencies.data;

import com.eugenePetrenko.idea.dependencies.DependenciesFilter;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.LibraryOrderEntry;
import com.intellij.openapi.roots.ModuleOrderEntry;
import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.roots.RootPolicy;
import com.intellij.openapi.roots.libraries.Library;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

/**
* Created 07.04.13 15:54
*
* @author Eugene Petrenko (eugene.petrenko@jetbrains.com)
*/
public class LibOrModuleSet {
  private final Set<Module> myModules = new HashSet<>();
  private final Set<Library> myLibs = new HashSet<>();

  public boolean contains(@Nullable final Module mod) {
    return mod != null && myModules.contains(mod);
  }

  public boolean contains(@Nullable final Library lib) {
    return lib != null && myLibs.contains(lib);
  }

  public boolean contains(@Nullable final OrderEntry e) {
    if (e == null) return false;
    return e.accept(CONTAINS, false);
  }

  public void addDependencies(@NotNull final Collection<? extends OrderEntry> es) {
    for (OrderEntry e : es) {
      addDependency(e);
    }
  }

  public void addDependencies(@NotNull final LibOrModuleSet deps) {
    myLibs.addAll(deps.myLibs);
    myModules.addAll(deps.myModules);
  }

  public void addDependency(@NotNull final OrderEntry e) {
    if (!DependenciesFilter.REMOVABLE_DEPENDENCY.test(e)) return;
    e.accept(ADD, null);
  }

  public void addDependency(@Nullable final Library lib) {
    if (lib == null) return;
    myLibs.add(lib);
  }

  public void removeDependency(@Nullable final Library lib) {
    if (lib == null) return;
    myLibs.remove(lib);
  }

  public void addDependency(@Nullable final Module module) {
    if (module == null) return;
    myModules.add(module);
  }

  public void removeDependency(@Nullable final Module module) {
    if (module == null) return;
    myModules.remove(module);
  }

  public boolean isEmpty() {
    return myLibs.isEmpty() && myModules.isEmpty();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("LibOrModuleSet{\n");

    if (!myModules.isEmpty()) {
      sb.append("  Modules:\n");
      for (Module m : myModules) {
        sb.append("    ").append(m).append("\n");
      }
    }

    if (!myLibs.isEmpty()) {
      sb.append("  Libraries:\n");
      for (Library m : myLibs) {
        sb.append("    ").append(m).append("\n");
      }
    }
    sb.append("}");
    return sb.toString();
  }

  private final RootPolicy<Void> ADD = new RootPolicy<>() {
    @Override
    public Void visitLibraryOrderEntry(LibraryOrderEntry libraryOrderEntry, Void value) {
      addDependency(libraryOrderEntry.getLibrary());
      return null;
    }

    @Override
    public Void visitModuleOrderEntry(ModuleOrderEntry moduleOrderEntry, Void value) {
      addDependency(moduleOrderEntry.getModule());
      return null;
    }
  };

  private final RootPolicy<Boolean> CONTAINS = new RootPolicy<>() {
    @Override
    public Boolean visitLibraryOrderEntry(LibraryOrderEntry libraryOrderEntry, Boolean value) {
      return contains(libraryOrderEntry.getLibrary());
    }

    @Override
    public Boolean visitModuleOrderEntry(ModuleOrderEntry moduleOrderEntry, Boolean value) {
      return contains(moduleOrderEntry.getModule());
    }
  };

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

    final LibOrModuleSet that = (LibOrModuleSet) o;
    return myLibs.equals(that.myLibs) && myModules.equals(that.myModules);
  }

  @Override
  public int hashCode() {
    int result = myModules.hashCode();
    result = 31 * result + myLibs.hashCode();
    return result;
  }

  @NotNull
  public LibOrModuleSet intersect(@NotNull LibOrModuleSet b) {
    return intersect(this, b);
  }

  @NotNull
  public static LibOrModuleSet intersect(@NotNull LibOrModuleSet a, @NotNull LibOrModuleSet b) {
    final LibOrModuleSet result = new LibOrModuleSet();
    result.myLibs.addAll(a.myLibs);
    result.myLibs.retainAll(b.myLibs);

    result.myModules.addAll(a.myModules);
    result.myModules.retainAll(b.myModules);

    return result;
  }
}


text:
module OrchestrateIo
  class Event

    attr_reader :request

    # == Usage
    #
    # io = OrchestrateIo.new(api_key: "abc")
    # request = io.event :get do
    #   collection  'films'
    #   key         'the_godfather'
    #   type        'comments'
    # end
    #
    # request.perform
    # => HTTParty::Response
    #
    def initialize(client, method, &block)
      args = {
        client: client,
        http_method: method,
        uri: uri,
        options: options
      }

      @request = OrchestrateIo::Request.new(args, &block)
    end

    def perform
      request.perform
    end

  protected

    def uri
      "/:version/:collection/:key/events/:type"
    end

    def options
      options = {}
      options[:body] = :data
      options[:query] = { timestamp: :timestamp, start: :from, end: :to }
      options
    end
  end
end


text:
{% load i18n %}
<a href="{% url "basket" %}">
    {% if request.basket.lines %}
        {%  trans "The cart contains" %} {{ request.basket.product_count }}
        {% blocktrans count request.basket.lines|length as lines %}photo{% plural %}photos{% endblocktrans %}
    {% else %}
        {% trans "Your cart is empty" %}
    {% endif %}
</a>


text:
/**
 * \addtogroup rime
 * @{
 */

/**
 * \defgroup rimermh Best-effort multihop forwarding
 * @{
 *
 * The rmh module implements a multihop forwarding mechanism. Routes
 * must have already been setup with the route_add() function. Setting
 * up routes is done with another Rime module such as the \ref
 * routediscovery "route-discovery module".
 *
 * The hop-by-hop reliable multi-hop unciast primitive is similar to
 * the best-effot multi-hop unicast primitive except that it uses the
 * reliable single-hop primitive for the communication between two
 * single-hop neighbors.
 *
 * \section channels Channels
 *
 * The rmh module uses 1 channel.
 *
 */

/*
 * Copyright (c) 2006, Swedish Institute of Computer Science.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the Institute nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * This file is part of the Contiki operating system.
 *
 */

/**
 * \file
 *         Multihop forwarding header file
 * \author
 *         Adam Dunkels <adam@sics.se>
 */

#ifndef __RMH_H__
#define __RMH_H__

#include "net/rime/runicast.h"
#include "net/rime/rimeaddr.h"

struct rmh_conn;

#define RMH_ATTRIBUTES  { PACKET_ADDR_ESENDER, PACKET_ADDRSIZE }, \
                        { PACKET_ADDR_ERECEIVER, PACKET_ADDRSIZE }, \
                        { PACKET_ATTR_TTL, PACKET_ATTR_BIT * 5 }, \
                        { PACKET_ATTR_MAX_REXMIT, PACKET_ATTR_BIT * 5 }, \
                        RUC_ATTRIBUTES

struct rmh_callbacks {
  void (* recv)(struct rmh_conn *ptr, rimeaddr_t *sender, uint8_t hops);
  rimeaddr_t *(* forward)(struct rmh_conn *ptr,
			  const rimeaddr_t *originator,
			  const rimeaddr_t *dest,
			  const rimeaddr_t *prevhop,
			  uint8_t hops);
};

struct rmh_conn {
  struct runicast_conn c;
  const struct rmh_callbacks *cb;
  uint8_t num_rexmit;
};

void rmh_open(struct rmh_conn *c, uint16_t channel,
	      const struct rmh_callbacks *u);
void rmh_close(struct rmh_conn *c);
int rmh_send(struct rmh_conn *c, rimeaddr_t *to, uint8_t num_rexmit,
	     uint8_t max_hops);

#endif /* __RMH_H__ */
/** @} */
/** @} */


text:
Odiseo Standard Edition
========================

Welcome to the Symfony Standard Edition - a fully-functional Symfony4
application that you can use as the skeleton for your new applications.

Installation
------------

Create your project running the following command:

```bash
$ composer create-project odiseoteam/odiseo-standard-edition [path_to_project]
```

Edit the .env file and run the commands:

```bash
$ cd [path_to_project]
$ php bin/console doctrine:database:create
$ php bin/console doctrine:schema:update --force
$ php bin/console doctrine:fixtures:load
$ php bin/console cache:clear
$ npm install
$ npm run dev
```

HAVE FUN!!!

Tests
-------

This Symfony4 skeleton project comes with a ready to use testing tools like phpstan and behat.

#### Phpstan

```bash
$ vendor/bin/phpstan.phar analyse -c phpstan.neon -l max src/
```

#### Behat

Rename behat.yml.dist to behat.yml and change the content according to your project.
Next add your Scenarios on features folder and run:

```bash
$ vendor/bin/behat
```

Docker
-------

Having docker and docker compose installed you can run the project with the following
command:

```bash
$ docker-compose up
```

Authors
-------

This project is maintained by Odiseo. Want us to help you with this or any Symfony project? Contact us on team@odiseo.com.ar.


text:
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var plumber = require('gulp-plumber');
var concat = require('gulp-concat');

gulp.task('libcss', function () {
    return gulp.src([
            'bower_components/cropper/dist/cropper.min.css'
        ])
        .pipe(plumber())
        .pipe(concat('dependencies.css'))
        .pipe(gulp.dest('../../assets/components/markdowneditor/css'));
});

gulp.task('github-md', function () {
    return gulp.src([
            'scss/vendor/github-markdown-css/github-markdown.css'
        ])
        .pipe(plumber())
        .pipe(concat('github-markdown.css'))
        .pipe(gulp.dest('../../assets/components/markdowneditor/css'));
});

gulp.task('noembed-css', function () {
    return gulp.src([
            'scss/vendor/noembed/*.scss'
        ])
        .pipe(plumber())
        .pipe(sass())
        .pipe(concat('noembed.css'))
        .pipe(gulp.dest('../../assets/components/markdowneditor/css'));
});

gulp.task('cards-css', function () {
    return gulp.src([
            'scss/cards/*.scss'
        ])
        .pipe(plumber())
        .pipe(sass())
        .pipe(concat('cards.css'))
        .pipe(gulp.dest('../../assets/components/markdowneditor/css'));
});

gulp.task('css-highlight', function () {
    return gulp.src([
            'src/vendor/highlight/styles/github.css'
        ])
        .pipe(plumber())
        .pipe(concat('highlight.css'))
        .pipe(gulp.dest('../../assets/components/markdowneditor/css'));
});

gulp.task('css', function () {
    return gulp.src('scss/app.scss')
            .pipe(sourcemaps.init())
            .pipe(plumber())
            .pipe(sass({
                paths: ['assets']
            }))
            .pipe(sourcemaps.write())
            .pipe(gulp.dest('../../assets/components/markdowneditor/css'));
});

gulp.task('css:watch', ['css', 'cards-css'], function () {
    gulp.watch('scss/*.scss', ['css']);
    gulp.watch('scss/cards/*.scss', ['cards-css']);
});


text:
from __future__ import (absolute_import, division, print_function)
import os
import numpy as np

from qtpy.QtWidgets import QVBoxLayout, QWidget

from addie.plot import IndicatorManager, NavigationToolbar
from addie.plot import FigureCanvas
from addie.plot.constants import BASIC_COLORS, LINE_MARKERS, LINE_STYLES
import addie.utilities.workspaces
import mantid.simpleapi as simpleapi

class MplGraphicsView(QWidget):
    """ A combined graphics view including matplotlib canvas and
    a navigation tool bar

    Note: Merged with HFIR_Powder_Reduction.MplFigureCanvas
    """

    def __init__(self, parent):
        # Initialize parent
        QWidget.__init__(self, parent)

        # set up canvas
        self._myCanvas = FigureCanvas(self)
        self._myToolBar = NavigationToolbar(self, self._myCanvas)

        # state of operation
        self._isZoomed = False
        # X and Y limit with home button
        self._homeXYLimit = None

        # set up layout
        self._vBox = QVBoxLayout(self)
        self._vBox.addWidget(self._myCanvas)
        self._vBox.addWidget(self._myToolBar)

        # auto line's maker+color list
        self._myLineMarkerColorList = []
        self._myLineMarkerColorIndex = 0
        self.setAutoLineMarkerColorCombo()

        # records for all the lines that are plot on the canvas
        self._my1DPlotDict = dict()
        self._my1DPlotMinYDict = dict()
        self._my1DPlotMaxYDict = dict()

        # Declaration of class variables
        self._indicatorKey = None

        # Indicator manager
        self._myIndicatorsManager = IndicatorManager()

        # some statistic recorder for convenient operation
        self._statDict = dict()

    def add_arrow(self, start_x, start_y, stop_x, stop_y):
        self._myCanvas.add_arrow(start_x, start_y, stop_x, stop_y)

    def add_line_set(self, vec_set, color, marker, line_style, line_width):
        """ Add a set of line and manage together
        """
        key_list = list()
        bd_tmp_list = []
        i = 0
        for vec_x, vec_y in vec_set:
            bd_tmp_list.append(simpleapi.CreateWorkspace(DataX=vec_x, DataY=vec_y, NSpec=1))
            temp_key = self._myCanvas.add_plot_1d(wkspname=bd_tmp_list[i], wkspindex=0, color=color, marker=marker,
                                                  line_style=line_style, line_width=line_width)
            assert isinstance(temp_key, int)
            assert temp_key >= 0
            key_list.append(temp_key)
            i += 1

        return key_list

    # TODO change this to pass down the workspace handle
    def add_plot_1d(self, wkspname, wkspindex, color=None, label='', x_label=None, y_label=None,
                    marker=None, line_style=None, line_width=1, alpha=1., show_legend=True, plotError=False):
        """
        Add a 1-D plot to canvas
        """
        line_key = self._myCanvas.add_plot_1d(wkspname, wkspindex, color, label, x_label, y_label, marker, line_style,
                                              line_width, alpha, show_legend)

        xmin, xmax, ymin, ymax = addie.utilities.workspaces.get_xy_range(wkspname, wkspindex)

        # record min/max
        self._statDict[line_key] = xmin, xmax, ymin, ymax
        self._my1DPlotDict[line_key] = label

        self._my1DPlotMinYDict[line_key] = ymin
        self._my1DPlotMaxYDict[line_key] = ymax

        return line_key

    def add_2way_indicator(self, x=None, y=None, color=None, master_line=None):
        """ Add a 2-way indicator following an existing line?
        """
        if master_line is not None:
            raise RuntimeError('Implement how to use master_line ASAP.')

        x_min, x_max = self._myCanvas.getXLimit()
        if x is None:
            x = (x_min + x_max) * 0.5
        else:
            assert isinstance(x, float)

        y_min, y_max = self._myCanvas.getYLimit()
        if y is None:
            y = (y_min + y_max) * 0.5
        else:
            assert isinstance(y, float)

        if color is None:
            color = self._myIndicatorsManager.get_next_color()
        else:
            assert isinstance(color, str)

        my_id = self._myIndicatorsManager.add_2way_indicator(x, x_min, x_max,
                                                             y, y_min, y_max,
                                                             color)
        vec_set = self._myIndicatorsManager.get_2way_data(my_id)

        canvas_line_index = self.add_line_set(vec_set, color=color,
                                              marker=self._myIndicatorsManager.get_marker(),
                                              line_style=self._myIndicatorsManager.get_line_style(),
                                              line_width=1)
        self._myIndicatorsManager.set_canvas_line_index(my_id, canvas_line_index)

        return my_id

    def add_horizontal_indicator(self, y=None, color=None):
        """ Add an indicator line
        """
        # Default
        if y is None:
            y_min, y_max = self._myCanvas.getYLimit()
            y = (y_min + y_max) * 0.5
        else:
            assert isinstance(y, float)

        x_min, x_max = self._myCanvas.getXLimit()

        # For color
        if color is None:
            color = self._myIndicatorsManager.get_next_color()
        else:
            assert isinstance(color, str)

        # Form
        my_id = self._myIndicatorsManager.add_horizontal_indicator(y, x_min, x_max, color)
        vec_x, vec_y = self._myIndicatorsManager.get_data(my_id)

        bd_tmp_h = simpleapi.CreateWorkspace(DataX=vec_x, DataY=vec_y, NSpec=1)

        canvas_line_index = self._myCanvas.add_plot_1d(wkspname=bd_tmp_h, wkspindex=0,
                                                       color=color, marker=self._myIndicatorsManager.get_marker(),
                                                       line_style=self._myIndicatorsManager.get_line_style(),
                                                       line_width=1)

        self._myIndicatorsManager.set_canvas_line_index(my_id, canvas_line_index)

        return my_id

    def add_vertical_indicator(self, x=None, color=None, style=None, line_width=1):
        """
        Add a vertical indicator line
        Guarantees: an indicator is plot and its ID is returned
        :param x: None as the automatic mode using default from middle of canvas
        :param color: None as the automatic mode using default
        :param style:
        :return: indicator ID
        """
        # For indicator line's position
        if x is None:
            x_min, x_max = self._myCanvas.getXLimit()
            x = (x_min + x_max) * 0.5
        else:
            assert isinstance(x, float)

        y_min, y_max = self._myCanvas.getYLimit()

        # For color
        if color is None:
            color = self._myIndicatorsManager.get_next_color()
        else:
            assert isinstance(color, str)

        # style
        if style is None:
            style = self._myIndicatorsManager.get_line_style()

        # Form
        my_id = self._myIndicatorsManager.add_vertical_indicator(x, y_min, y_max, color)
        vec_x, vec_y = self._myIndicatorsManager.get_data(my_id)

        bd_tmp = simpleapi.CreateWorkspace(DataX=vec_x, DataY=vec_y, NSpec=1)

        canvas_line_index = self._myCanvas.add_plot_1d(wkspname=bd_tmp, wkspindex=0,
                                                       color=color, marker=self._myIndicatorsManager.get_marker(),
                                                       line_style=self._myIndicatorsManager.get_line_style(),
                                                       line_width=1)

        self._myIndicatorsManager.set_canvas_line_index(my_id, canvas_line_index)

        return my_id

    def add_plot_2d(self, array2d, x_min, x_max, y_min, y_max, hold_prev_image=True, y_tick_label=None):
        """
        Add a 2D image to canvas
        :param array2d: numpy 2D array
        :param x_min:
        :param x_max:
        :param y_min:
        :param y_max:
        :param hold_prev_image:
        :param y_tick_label:
        :return:
        """
        self._myCanvas.addPlot2D(array2d, x_min, x_max, y_min, y_max, hold_prev_image, y_tick_label)

    def addImage(self, imagefilename):
        """ Add an image by file
        """
        # check
        if os.path.exists(imagefilename) is False:
            raise NotImplementedError("Image file %s does not exist." % (imagefilename))

        self._myCanvas.addImage(imagefilename)

    def auto_scale_y(self, room_percent=0.05, lower_boundary=None, upper_boundary=None):
        """
        auto scale along Y axis by checking all the min/max value of current plotted Y values
        :param room_percent ::  percentage of the room left
        :return:
        """
        # min and max list
        min_y_list = list()
        max_y_list = list()
        for plot_key in self._my1DPlotMinYDict:
            min_y_list.append(self._my1DPlotMinYDict[plot_key])
            max_y_list.append(self._my1DPlotMaxYDict[plot_key])

        # find min and max
        min_y = np.min(np.array(min_y_list))
        max_y = np.max(np.array(max_y_list))
        delta_y = max_y - min_y

        # find out lower and upper boundaries
        low_y_boundary = min_y - room_percent * delta_y
        upp_y_boundary = max_y + room_percent * delta_y
        if lower_boundary is not None and lower_boundary < low_y_boundary:
            low_y_boundary = lower_boundary
        if upper_boundary is not None and upper_boundary:
            upp_y_boundary = upper_boundary

        # scale to set y limits
        self.setXYLimit(ymin=low_y_boundary, ymax=upp_y_boundary)

    def canvas(self):
        """ Get the canvas
        """
        return self._myCanvas

    def clear_all_lines(self):
        self._myCanvas.clear_all_1d_plots()

        self._statDict.clear()
        self._my1DPlotDict.clear()

        self._my1DPlotMinYDict.clear()
        self._my1DPlotMaxYDict.clear()

        # about zoom
        self._isZoomed = False
        self._homeXYLimit = None

    def clear_canvas(self):
        """ Clear canvas: it includes clear_all_lines()
        """
        # clear all the records
        self.clear_all_lines()

        return self._myCanvas.clear_canvas()

    def draw(self):
        """ Draw to commit the change
        """
        return self._myCanvas.draw()

    def evt_toolbar_home(self):
        """ event for homing key of tool bar
        """
        # turn off zoom mode
        self._isZoomed = False

    def evt_view_updated(self):
        """ Event handling as canvas size updated
        :return:
        """
        # update the indicator
        new_x_range = self.getXLimit()
        new_y_range = self.getYLimit()

        self._myIndicatorsManager.update_indicators_range(new_x_range, new_y_range)
        for indicator_key in self._myIndicatorsManager.get_live_indicator_ids():
            canvas_line_id = self._myIndicatorsManager.get_canvas_line_index(indicator_key)
            data_x, data_y = self._myIndicatorsManager.get_data(indicator_key)
            self._myCanvas.updateLine(ikey=canvas_line_id, vecx=data_x, vecy=data_x)

    def evt_zoom_released(self):
        """
        event for zoom is release
        """
        # record home XY limit if it is never zoomed
        if self._isZoomed is False:
            self._homeXYLimit = list(self.getXLimit())
            self._homeXYLimit.extend(list(self.getYLimit()))
        # END-IF

        # set the state of being zoomed
        self._isZoomed = True

    def getPlot(self):
        return self._myCanvas.getPlot()

    def getLastPlotIndexKey(self):
        """ Get ...
        """
        return self._myCanvas.getLastPlotIndexKey()

    def getXLimit(self):
        """ Get limit of Y-axis
        :return: 2-tuple as xmin, xmax
        """
        return self._myCanvas.getXLimit()

    def getYLimit(self):
        """ Get limit of Y-axis
        """
        return self._myCanvas.getYLimit()

    def get_y_min(self):
        """
        Get the minimum Y value of the plots on canvas
        """
        if len(self._statDict) == 0:
            return 1E10

        line_id_list = list(self._statDict.keys())
        min_y = self._statDict[line_id_list[0]][2]
        for i_plot in range(1, len(line_id_list)):
            if self._statDict[line_id_list[i_plot]][2] < min_y:
                min_y = self._statDict[line_id_list[i_plot]][2]

        return min_y

    def get_y_max(self):
        """
        Get the maximum Y value of the plots on canvas
        :return:
        """
        if len(self._statDict) == 0:
            return -1E10

        line_id_list = list(self._statDict.keys())
        max_y = self._statDict[line_id_list[0]][3]
        for i_plot in range(1, len(line_id_list)):
            if self._statDict[line_id_list[i_plot]][3] > max_y:
                max_y = self._statDict[line_id_list[i_plot]][3]

        return max_y

    def move_indicator(self, line_id, dx, dy):
        """
        Move the indicator line in horizontal
        """
        # Shift value
        self._myIndicatorsManager.shift(line_id, dx=dx, dy=dy)

        # apply to plot on canvas
        if self._myIndicatorsManager.get_line_type(line_id) < 2:
            # horizontal or vertical
            canvas_line_index = self._myIndicatorsManager.get_canvas_line_index(line_id)
            vec_x, vec_y = self._myIndicatorsManager.get_data(line_id)
            self._myCanvas.updateLine(ikey=canvas_line_index, vecx=vec_x, vecy=vec_y)
        else:
            # 2-way
            canvas_line_index_h, canvas_line_index_v = self._myIndicatorsManager.get_canvas_line_index(line_id)
            h_vec_set, v_vec_set = self._myIndicatorsManager.get_2way_data(line_id)

            self._myCanvas.updateLine(ikey=canvas_line_index_h, vecx=h_vec_set[0], vecy=h_vec_set[1])
            self._myCanvas.updateLine(ikey=canvas_line_index_v, vecx=v_vec_set[0], vecy=v_vec_set[1])

    def remove_indicator(self, indicator_key):
        """ Remove indicator line
        """
        #
        plot_id = self._myIndicatorsManager.get_canvas_line_index(indicator_key)
        self._myCanvas.remove_plot_1d(plot_id)
        self._myIndicatorsManager.delete(indicator_key)

    def remove_line(self, line_id):
        """ Remove a line
        """
        # remove line
        self._myCanvas.remove_plot_1d(line_id)

        # remove the records
        if line_id in self._statDict:
            del self._statDict[line_id]
            del self._my1DPlotDict[line_id]
            del self._my1DPlotMinYDict[line_id]
            del self._my1DPlotMaxYDict[line_id]

    def set_indicator_position(self, line_id, pos_x, pos_y):
        """ Set the indicator to new position
        """
        # Set value
        self._myIndicatorsManager.set_position(line_id, pos_x, pos_y)

        # apply to plot on canvas
        if self._myIndicatorsManager.get_line_type(line_id) < 2:
            # horizontal or vertical
            canvas_line_index = self._myIndicatorsManager.get_canvas_line_index(line_id)
            vec_x, vec_y = self._myIndicatorsManager.get_data(line_id)
            self._myCanvas.updateLine(ikey=canvas_line_index, vecx=vec_x, vecy=vec_y)
        else:
            # 2-way
            canvas_line_index_h, canvas_line_index_v = self._myIndicatorsManager.get_canvas_line_index(line_id)
            h_vec_set, v_vec_set = self._myIndicatorsManager.get_2way_data(line_id)

            self._myCanvas.updateLine(ikey=canvas_line_index_h, vecx=h_vec_set[0], vecy=h_vec_set[1])
            self._myCanvas.updateLine(ikey=canvas_line_index_v, vecx=v_vec_set[0], vecy=v_vec_set[1])

    def updateLine(self, ikey, wkspname='', wkspindex=0, linestyle=None, linecolor=None, marker=None, markercolor=None):
        """update a line's set up
        """

        # check
        assert isinstance(ikey, int), 'Line key must be an integer.'
        assert ikey in self._my1DPlotDict, 'Line with ID %d is not on canvas. ' % ikey

        # update line
        if wkspname:
            ymin, ymax = addie.utilities.workspaces.get_y_range(wkspname, wkspindex)
            self._my1DPlotMinYDict[ikey] = ymin
            self._my1DPlotMaxYDict[ikey] = ymax
        self._myCanvas.updateLine(ikey=ikey, wkspname=wkspname, wkspindex=wkspindex,
                                  linestyle=linestyle, linecolor=linecolor, marker=marker,
                                  markercolor=markercolor)

    def update_indicator(self, i_key, color):
        """
        Update indicator with new color
        """
        if self._myIndicatorsManager.get_line_type(i_key) < 2:
            # horizontal or vertical
            canvas_line_index = self._myIndicatorsManager.get_canvas_line_index(i_key)
            self._myCanvas.updateLine(ikey=canvas_line_index, vecx=None, vecy=None, linecolor=color)
        else:
            # 2-way
            canvas_line_index_h, canvas_line_index_v = self._myIndicatorsManager.get_canvas_line_index(i_key)
            # h_vec_set, v_vec_set = self._myIndicatorsManager.get_2way_data(i_key)

            self._myCanvas.updateLine(ikey=canvas_line_index_h, vecx=None, vecy=None, linecolor=color)
            self._myCanvas.updateLine(ikey=canvas_line_index_v, vecx=None, vecy=None, linecolor=color)

    def get_canvas(self):
        """
        get canvas
        """
        return self._myCanvas

    def get_current_plots(self):
        """
        Get the current plots on canvas

        Returns
        -------
        list of 2-tuple: integer (plot ID) and string (label)
        """
        tuple_list = list()
        line_id_list = sorted(self._my1DPlotDict.keys())
        for line_id in line_id_list:
            tuple_list.append((line_id, self._my1DPlotDict[line_id]))

        return tuple_list

    def get_indicator_key(self, x, y):
        """ Get the key of the indicator with given position
        :param picker_pos:
        :return:
        """
        return self._myIndicatorsManager.get_indicator_key(x, y)

    def get_indicator_position(self, indicator_key):
        """ Get position (x or y) of the indicator
        :param indicator_key
        :return: a tuple.  (0) horizontal (x, x); (1) vertical (y, y); (2) 2-way (x, y)
        """
        # Get indicator's type
        indicator_type = self._myIndicatorsManager.get_line_type(indicator_key)
        if indicator_type < 2:
            # horizontal or vertical indicator
            x, y = self._myIndicatorsManager.get_data(indicator_key)

            if indicator_type == 0:
                # horizontal
                return y[0], y[0]

            elif indicator_type == 1:
                # vertical
                return x[0], x[0]

        else:
            # 2-way
            raise RuntimeError('Implement 2-way as soon as possible!')

    def getLineStyleList(self):
        return LINE_STYLES

    def getLineMarkerList(self):
        return LINE_MARKERS

    def getLineBasicColorList(self):
        return BASIC_COLORS

    def getDefaultColorMarkerComboList(self):
        """ Get a list of line/marker color and marker style combination
        as default to add more and more line to plot
        """
        return self._myCanvas.getDefaultColorMarkerComboList()

    def getNextLineMarkerColorCombo(self):
        """ As auto line's marker and color combo list is used,
        get the NEXT marker/color combo
        """
        # get from list
        marker, color = self._myLineMarkerColorList[self._myLineMarkerColorIndex]
        # process marker if it has information
        if marker.count(' (') > 0:
            marker = marker.split(' (')[0]

        # update the index
        self._myLineMarkerColorIndex += 1
        if self._myLineMarkerColorIndex == len(self._myLineMarkerColorList):
            self._myLineMarkerColorIndex = 0

        return marker, color

    def reset_line_color_marker_index(self):
        """ Reset the auto index for line's color and style
        """
        self._myLineMarkerColorIndex = 0

    def set_title(self, title, color='black'):
        """
        set title to canvas
        """
        self._myCanvas.set_title(title, color)

    def setXYLimit(self, xmin=None, xmax=None, ymin=None, ymax=None):
        """ Set X-Y limit automatically
        """
        self._myCanvas.axes.set_xlim([xmin, xmax])
        self._myCanvas.axes.set_ylim([ymin, ymax])

        self._myCanvas.draw()

    def setAutoLineMarkerColorCombo(self):
        """ Set the default/auto line marker/color combination list
        """
        self._myLineMarkerColorList = list()
        for marker in LINE_MARKERS:
            for color in BASIC_COLORS:
                self._myLineMarkerColorList.append((marker, color))

    def setLineMarkerColorIndex(self, newindex):
        """
        """
        self._myLineMarkerColorIndex = newindex


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<installdata>
	<action>
		<file>index</file>
		<menu>Log In</menu>
		<position>0</position>
	</action>
	<action>
		<file>overview</file>
		<menu>Overview</menu>
		<position>2</position>
	</action>
	<action>
		<file>apps</file>
		<menu>Applications</menu>
		<position>3</position>
	</action>
	<action>
		<file>upgrade</file>
		<menu>Upgrade</menu>
		<position>4</position>
	</action>
	<action>
		<file>done</file>
		<menu>Finished</menu>
		<position>5</position>
	</action>
</installdata>


text:
package it.playfellas.superapp.tiles;

/**
 * Created by affo on 31/07/15.
 */
public enum TileDirection {
    UP,
    RIGHT,
    DOWN,
    LEFT,
    NONE;

    @Override
    public String toString() {
        return this.name();
    }
}


text:
package com.pureperfect.ferret;

import java.io.File;
import java.net.URL;

/**
 * A prefilter that only allows local files if they actually exist.
 *
 * @author J. Chris Folsom
 * @version 1.0
 * @since 1.0
 */
class DefaultPrefilter implements Prefilter {
    /*
     * (non-Javadoc)
     *
     * @see com.pureperfect.ferret.Prefilter#allow(java.io.File)
     */
    @Override
    public boolean allow(File f) {
        return f.exists();
    }

    /*
     * (non-Javadoc)
     *
     * @see com.pureperfect.ferret.Prefilter#allow(java.net.URL)
     */
    @Override
    public boolean allow(URL url) {
        if ("file".equals(url.getProtocol())) {
            return new File(url.getFile()).exists();
        }

        return true;
    }
}


text:
//
//////////////////////////////////////////////////////////////////////////////
//
//  Copyright 2012 Autodesk, Inc.  All rights reserved.
//
//  Use of this software is subject to the terms of the Autodesk license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.
//
//////////////////////////////////////////////////////////////////////////////
//
//
#ifndef   _RXDEFS_H_
#define   _RXDEFS_H_

#include "adesk.h"
#pragma pack (push, 8)

#define NULLFCN static_cast<Adesk::IntPtr>(0)  // A NULL function pointer

#define ACRX_ULONG_MAX 0xFFFFFFFF

#define ACRX_ASCII_MAX 255  /* Same as UCHAR_MAX in <limits.h> */
#define ACRX_EOS 0          /* End of String Indicator */

// AcRx:  typedef and enum namespace scoping struct.

struct AcRx {

    typedef void (*FcnPtr) ();

    enum         DictIterType { kDictSorted   = 0,
                                kDictCollated = 1 };

    enum         Ordering     { kLessThan     = -1,
                                kEqual        = 0,
                                kGreaterThan  = 1,
                                kNotOrderable = 2 };

    enum         AppMsgCode   { kNullMsg         = 0,
                                kInitAppMsg      = 1,
                                kUnloadAppMsg    = 2,
                                kLoadDwgMsg      = 3,
                                kUnloadDwgMsg    = 4,
                                kInvkSubrMsg     = 5,
                                kCfgMsg          = 6,
                                kEndMsg          = 7,
                                kQuitMsg         = 8,
                                kSaveMsg         = 9,
                                kDependencyMsg   = 10,
                                kNoDependencyMsg = 11,
                                kOleUnloadAppMsg = 12,
                                kPreQuitMsg      = 13,
                                kInitDialogMsg   = 14,
                                kEndDialogMsg    = 15,
                                kSuspendMsg      = 16,
                                kInitTabGroupMsg = 17,
                                kEndTabGroupMsg  = 18};

    enum        AppRetCode   { kRetOK          = 0,
                                kRetError       = 3 };
};

/* These messages are replaced by kLoadDwgMsg, and kUnloadDgwMsg.
 */
#ifndef kLoadADSMsg
#define kLoadADSMsg kLoadDwgMsg
#define kUnloadADSMsg kUnloadDwgMsg
#endif

class AcRxClass;
typedef void (*AppNameChangeFuncPtr)(const AcRxClass* classObj,
                ACHAR *& newAppName, int saveVer);

#pragma pack (pop)

#endif


text:
typedef struct {
	double r,g,b;
}
RGB;

class Image {
	public:
		// allocates image of specified size
		Image(int m, int n);

		// access to a specific pixel
		RGB &pixel(int i, int j);

		bool save_to_ppm_file(const char *filename);
	private:
		int xsize, ysize;

		// pixel intensities
		RGB *rgb;
};


text: <!DOCTYPE html>


text:
import {Synonym} from './Synonym';

/**
 * Created by user on 3/25/2017.
 */
export interface Synonyms {
    name: Synonym[];
    description: Synonym[];
    pubmed_title: Synonym[];
    pubmed_abstract: Synonym[];
    sample_protocol: Synonym[];
    data_protocol: Synonym[];
}


text:
package jenkins.model;

import hudson.ExtensionList;
import hudson.model.FreeStyleProject;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.tasks.LogRotator;
import hudson.util.DescribableList;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.recipes.LocalData;

public class GlobalBuildDiscarderTest {
    @Rule
    public JenkinsRule j = new JenkinsRule();

    @Test
    @LocalData
    @Issue("JENKINS-61688")
    public void testLoading() throws Exception {
        Assert.assertEquals(0, GlobalBuildDiscarderConfiguration.get().getConfiguredBuildDiscarders().size());
    }

    @Test
    @LocalData
    @Issue("JENKINS-61688")
    public void testLoadingWithDiscarders() throws Exception {
        final DescribableList<GlobalBuildDiscarderStrategy, GlobalBuildDiscarderStrategyDescriptor> configuredBuildDiscarders = GlobalBuildDiscarderConfiguration.get().getConfiguredBuildDiscarders();
        Assert.assertEquals(2, configuredBuildDiscarders.size());
        Assert.assertNotNull(configuredBuildDiscarders.get(JobGlobalBuildDiscarderStrategy.class));
        Assert.assertEquals(5, ((LogRotator)configuredBuildDiscarders.get(SimpleGlobalBuildDiscarderStrategy.class).getDiscarder()).getNumToKeep());
    }

    @Test
    public void testJobBuildDiscarder() throws Exception {
        FreeStyleProject p = j.createFreeStyleProject();
        { // no discarder
            j.buildAndAssertSuccess(p);
            j.buildAndAssertSuccess(p);
            j.buildAndAssertSuccess(p);
            j.buildAndAssertSuccess(p);
            j.buildAndAssertSuccess(p);
            Assert.assertArrayEquals("all 5 builds exist", p.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{5, 4, 3, 2, 1});
        }

        { // job build discarder
            GlobalBuildDiscarderConfiguration.get().getConfiguredBuildDiscarders().add(new JobGlobalBuildDiscarderStrategy());
            p.setBuildDiscarder(new LogRotator(null, "3", null, null));
            Assert.assertArrayEquals("all 5 builds exist", p.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{5, 4, 3, 2, 1});

            ExtensionList.lookupSingleton(BackgroundGlobalBuildDiscarder.class).execute(TaskListener.NULL);
            Assert.assertArrayEquals("only 3 builds left", p.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{5, 4, 3});

            j.buildAndAssertSuccess(p);
            Assert.assertArrayEquals("still only 3 builds", p.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{6, 5, 4});

            p.setBuildDiscarder(null);
            j.buildAndAssertSuccess(p);
            j.buildAndAssertSuccess(p);
            Assert.assertArrayEquals("5 builds again", p.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{8, 7, 6, 5, 4});

            ExtensionList.lookupSingleton(BackgroundGlobalBuildDiscarder.class).execute(TaskListener.NULL);
            Assert.assertArrayEquals("still 5 builds", p.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{8, 7, 6, 5, 4});
        }

        { // global build discarder
            GlobalBuildDiscarderConfiguration.get().getConfiguredBuildDiscarders().add(new SimpleGlobalBuildDiscarderStrategy(new LogRotator(null, "2", null, null)));
            ExtensionList.lookupSingleton(BackgroundGlobalBuildDiscarder.class).execute(TaskListener.NULL);
            Assert.assertArrayEquals("newest 2 builds", p.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{8, 7});
            j.buildAndAssertSuccess(p);
            j.buildAndAssertSuccess(p);

            // run global discarders once a build finishes
            Assert.assertArrayEquals("2 builds because of BackgroundBuildDiscarderListener", p.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{10, 9});

            GlobalBuildDiscarderConfiguration.get().getConfiguredBuildDiscarders().clear();
            GlobalBuildDiscarderConfiguration.get().getConfiguredBuildDiscarders().add(new SimpleGlobalBuildDiscarderStrategy(new LogRotator(null, "1", null, null)));

            // apply global config changes periodically
            ExtensionList.lookupSingleton(BackgroundGlobalBuildDiscarder.class).execute(TaskListener.NULL);
            Assert.assertArrayEquals("2 builds again", p.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{10});
        }

        // reset global config
        GlobalBuildDiscarderConfiguration.get().getConfiguredBuildDiscarders().clear();

        { // job and global build discarder
            FreeStyleProject p1 = j.createFreeStyleProject();
            j.buildAndAssertSuccess(p1);
            j.buildAndAssertSuccess(p1);
            j.buildAndAssertSuccess(p1);
            j.buildAndAssertSuccess(p1);
            j.buildAndAssertSuccess(p1);
            j.buildAndAssertSuccess(p1);
            j.buildAndAssertSuccess(p1);
            Assert.assertArrayEquals("job with 5 builds", p1.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{7,6,5,4,3,2,1});
            p1.setBuildDiscarder(new LogRotator(null, "5", null, null));

            FreeStyleProject p2 = j.createFreeStyleProject();
            j.buildAndAssertSuccess(p2);
            j.buildAndAssertSuccess(p2);
            j.buildAndAssertSuccess(p2);
            j.buildAndAssertSuccess(p2);
            j.buildAndAssertSuccess(p2);
            j.buildAndAssertSuccess(p2);
            Assert.assertArrayEquals("job with 3 builds", p2.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{6,5,4,3,2,1});
            p2.setBuildDiscarder(new LogRotator(null, "3", null, null));

            GlobalBuildDiscarderConfiguration.get().getConfiguredBuildDiscarders().add(new SimpleGlobalBuildDiscarderStrategy(new LogRotator(null, "4", null, null)));
            GlobalBuildDiscarderConfiguration.get().getConfiguredBuildDiscarders().add(new JobGlobalBuildDiscarderStrategy());

            { // job 1 with builds more aggressively deleted by global strategy
                j.buildAndAssertSuccess(p1);
                j.buildAndAssertSuccess(p1);
                Assert.assertArrayEquals("job 1 discards down to 5, but global override is for 4", p1.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{9, 8, 7, 6});
                ExtensionList.lookupSingleton(BackgroundGlobalBuildDiscarder.class).execute(TaskListener.NULL);
                Assert.assertArrayEquals("job 1 discards down to 5, but global override is for 4", p1.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{9, 8, 7, 6});
            }

            { // job 2 with more aggressive local build discarder
                j.buildAndAssertSuccess(p2);
                Assert.assertArrayEquals("job 1 discards down to 3", p2.getBuilds().stream().mapToInt(Run::getNumber).toArray(), new int[]{7,6,5});
            }
        }
    }
}


text:
param($installPath, $toolsPath, $package, $project)

$folder = $project.ProjectItems | where-object {$_.Name -eq "Model"}
$item = $folder.ProjectItems | where-object {$_.Name -eq "Definition.domain"}
$item.Properties.Item("CustomTool").Value = "MSBuild:Compile"


text:
package org.apache.ignite.spi.discovery.zk.internal;

import org.apache.zookeeper.client.ZooKeeperSaslClient;
import org.junit.Assert;

/**
 *
 */
public class ZookeeperDiscoverySpiSaslFailedAuthTest extends ZookeeperDiscoverySpiSaslAuthAbstractTest {
    /**
     * @throws Exception If failed.
     */
    public void testIgniteNodeWithInvalidPasswordFailsToJoin() throws Exception {
        fail("https://issues.apache.org/jira/browse/IGNITE-9573");

        System.setProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY,
            "InvalidZookeeperClient");

        System.setProperty("IGNITE_ZOOKEEPER_DISCOVERY_MAX_RETRY_COUNT", Integer.toString(1));

        try {
            startGrid(0);

            Assert.fail("Ignite node with invalid password should fail on join.");
        }
        catch (Exception e) {
            //ignored
        }
    }
}


text:
import React, { useState } from "react";
import { db } from "../db";
import { ErrorBoundary } from "./ErrorBoundrary";
import { ItemListComponent } from "./ItemListComponent";
import { ItemLoaderComponent } from "./ItemLoaderComponent";

export function App() {
  const [currentId, setCurrentId] = useState(1);
  return <ErrorBoundary>

All items

      <ItemListComponent loadItems={()=>db.items.toArray()} />

Current item

        <ErrorBoundary>
          <ItemLoaderComponent id={currentId} loadItem={(id: number)=>db.items.get(id)} />
        </ErrorBoundary>

      <button id="btnFirst" onClick={()=>setCurrentId(1)}>First</button>
      <button id="btnNext" onClick={()=>setCurrentId(prevId => prevId + 1)}>Next</button>
      <button id="btnInvalidKey" onClick={()=>setCurrentId(NaN)}>Select invalid key</button>

  </ErrorBoundary>;
}


text:
#pragma once

#include "scene/Scene.hpp"

#include "renderers/LightRenderer.hpp"
#include "renderers/shadowmaps/ShadowMap.hpp"
#include "scene/lights/Light.hpp"
#include "scene/lights/PointLight.hpp"
#include "scene/lights/DirectionalLight.hpp"
#include "scene/lights/SpotLight.hpp"

#include "Common.hpp"

/**
 \brief Apply a light onto the lighting buffer using a geometric proxy (cone, sphere, screenquad). By processing all lights, the final lighting is accumulated in the buffer.
 \sa GPUShaders::Frag::Spot_light_pbr, GPUShaders::Frag::Point_light_pbr, GPUShaders::Frag::Directional_light_pbr
 \ingroup PBRDemo
 */
class DeferredLight final : public LightRenderer {

public:
	/** Constructor.
	 \param texAlbedo the texture containing the albedo
	 \param texNormals the texture containing the surface normals
	 \param texDepth the texture containing the depth
	 \param texEffects the texture containing the material properties
	 */
	explicit DeferredLight(const Texture * texAlbedo, const Texture * texNormals, const Texture * texDepth, const Texture * texEffects);

	/** Set the current user view and projection matrices.
	 \param viewMatrix the camera view matrix
	 \param projMatrix the camera projection matrix
	 */
	void updateCameraInfos(const glm::mat4 & viewMatrix, const glm::mat4 & projMatrix);

	/** Apply a spot lighting using a supporting cone.
	 \param light the light to compute the contribution of
	 */
	void draw(const SpotLight * light) override;

	/** Apply a point lighting using a supporting sphere.
	 \param light the light to compute the contribution of
	 */
	void draw(const PointLight * light) override;

	/** Apply a directional lighting using a supporting quad.
	 \param light the light to compute the contribution of
	 */
	void draw(const DirectionalLight * light) override;

private:

	std::vector<const Texture *> _textures; ///< G-buffer input textures.
	const Mesh * _sphere; ///< Point light supporting geometry.
	const Mesh * _cone;   ///< Spot light supporting geometry.

	Program * _dirProgram; 	///< Directional light shader.
	Program * _pointProgram;	///< Point light shader.
	Program * _spotProgram;	///< Spot light shader.

	glm::mat4 _view = glm::mat4(1.0f); ///< Cached camera view matrix.
	glm::mat4 _proj = glm::mat4(1.0f); ///< Cached camera projection matrix.

};

/**
 \brief Apply a probe onto the lighting buffer by rendering a box. The probe contribution weight is accumulated in the alpha channel.
 \sa GPUShaders::Frag::Probe_pbr, GPUShaders::Frag::Probe_normalization
 \ingroup PBRDemo
 */
class DeferredProbe {

public:

	/** Constructor.
	 \param texAlbedo the texture containing the albedo
	 \param texNormals the texture containing the surface normals
	 \param texEffects the texture containing the material properties
	 \param texDepth the texture containing the depth
	 \param texSSAO the texture containing the SSAO result
	 */
	explicit DeferredProbe(const Texture * texAlbedo, const Texture * texNormals, const Texture * texEffects, const Texture * texDepth, const Texture * texSSAO);

	/** Set the current user view and projection matrices.
	 \param viewMatrix the camera view matrix
	 \param projMatrix the camera projection matrix
	 */
	void updateCameraInfos(const glm::mat4 & viewMatrix, const glm::mat4 & projMatrix);

	/** Apply a probe in the current framebuffer
	 \param probe the probe to compute the contribution of
	 */
	void draw(const LightProbe & probe);

private:

	std::vector<const Texture *> _textures; ///< G-buffer input textures.
	const Mesh * _box; ///< Probe supporting geometry.
	Program * _program; ///< Probe application shader.

	glm::mat4 _viewProj = glm::mat4(1.0f); ///< Cached camera view projection matrix.
	glm::mat4 _invView = glm::mat4(1.0f); ///< Cached camera inverse view matrix.
	glm::vec4 _projectionVector = glm::vec4(0.0f); ///< Cached camera projection parameters.
};