text:
import React from 'react';
import RaisedButton from 'material-ui/lib/raised-button';
import * as graphConstants from '../networkGraph/graphConstants';
import InputLayerInfo from './InputLayerInfo';
import HiddenLayerInfo from './HiddenLayerInfo';
import BiasHistoryInfo from './BiasHistoryInfo';
import ActivationHistoryInfo from './ActivationHistoryInfo';
import OutputLayerInfo from './OutputLayerInfo';

export default class InfoButtons extends React.Component {
  constructor(props) {
    super(props);
    this._isLong = this._isLong.bind(this);
    this._renderHiddenLayerButtons = this._renderHiddenLayerButtons.bind(this);
  }
  _isLong() {
    const biases = this.props.selectedNetwork.snapshots[0].biases;
    return biases.length === 3;
  }
  _renderHiddenLayerButtons() {
    const buttons = [];

    if (!this._isLong()) {
      buttons.push(
        <BiasHistoryInfo
          layer={0}
          selectedNetwork={this.props.selectedNetwork}
          style={{ top: '25px', left: `${graphConstants.WIDTH / 2 - 90}px` }}
        />,
        <ActivationHistoryInfo
          layer={1}
          selectedNetwork={this.props.selectedNetwork}
          selectedDrawing={this.props.selectedDrawing}
          selectedNetworkSummary={this.props.selectedNetworkSummary}
          style={{ top: '67px', left: `${graphConstants.WIDTH / 2 - 90}px` }}
        />
      );
    } else {
      buttons.push(
        <BiasHistoryInfo
          layer={0}
          selectedNetwork={this.props.selectedNetwork}
          style={{ top: '25px', left: `${graphConstants.WIDTH / 3 - 60}px` }}
        />,
        <BiasHistoryInfo
          layer={1}
          selectedNetwork={this.props.selectedNetwork}
          style={{ top: '25px', left: `${2 * graphConstants.WIDTH / 3 - 90}px` }}
        />,
        <ActivationHistoryInfo
          layer={1}
          selectedNetwork={this.props.selectedNetwork}
          selectedDrawing={this.props.selectedDrawing}
          selectedNetworkSummary={this.props.selectedNetworkSummary}
          style={{ top: '67px', left: `${graphConstants.WIDTH / 3 - 60}px` }}
        />,
        <ActivationHistoryInfo
          layer={2}
          selectedNetwork={this.props.selectedNetwork}
          selectedDrawing={this.props.selectedDrawing}
          selectedNetworkSummary={this.props.selectedNetworkSummary}
          style={{ top: '67px', left: `${2 * graphConstants.WIDTH / 3 - 90}px` }}
        />
      );
    }
    return buttons;
  }
  render() {
    const style = {
      position: 'relative',
      display: 'inline-block',
      width: `${graphConstants.WIDTH}px`,
      textAlign: 'left',
      marginTop: '10px'
    };
    // <HiddenLayerInfo
    //   style={{ top: '25px', left:`${graphConstants.WIDTH / 2 - 90}px` }}
    // />

    return (

          Click buttons for more info and charts

        <InputLayerInfo style={{ top: '25px', left: 0 }}/>

        {this._renderHiddenLayerButtons()}

        <OutputLayerInfo style={{ top: '25px', right: '25px' }}/>

        <BiasHistoryInfo
          layer={this._isLong() ? 2 : 1}
          selectedNetwork={this.props.selectedNetwork}
          style={{ top: '67px', right: '25px' }}
        />

        <ActivationHistoryInfo
          layer={this._isLong() ? 3 : 2}
          selectedNetwork={this.props.selectedNetwork}
          selectedDrawing={this.props.selectedDrawing}
          selectedNetworkSummary={this.props.selectedNetworkSummary}
          style={{ top: '110px', right: '25px' }}
        />

    );
  }
}


text:
package com.asksunny.codegen;

import static org.junit.Assert.*;

import org.junit.Test;

import com.asksunny.schema.Entity;
import com.asksunny.schema.Field;
import com.asksunny.schema.Schema;
import com.asksunny.schema.parser.SQLScriptLexer;
import com.asksunny.schema.parser.SQLScriptParser;

public class UniqueConstraintTest {

	@Test
	public void test() throws Exception {
		SQLScriptLexer lexer = new SQLScriptLexer(getClass().getResourceAsStream("/unique.index.sql"));
		SQLScriptParser tokenReader = new SQLScriptParser(lexer);
		tokenReader.setDebug(false);
		Schema schema = tokenReader.parseSql();
		Entity entity = schema.get("Persons");
		assertNotNull(entity);
		Field fd = entity.findField("P_Id");
		assertTrue(fd.isUnique());
	}

	@Test
	public void test2() throws Exception {
		SQLScriptLexer lexer = new SQLScriptLexer(getClass().getResourceAsStream("/unique2.sql"));
		SQLScriptParser tokenReader = new SQLScriptParser(lexer);
		tokenReader.setDebug(true);
		Schema schema = tokenReader.parseSql();
		Entity entity = schema.get("Persons2");
		assertNotNull(entity);
		Field fd = entity.findField("P_Id");
		assertTrue(fd.isUnique());

		Entity entity3 = schema.get("Persons3");
		assertNotNull(entity3);
		Field fd2 = entity3.findField("P_Id");
		assertTrue(fd2.isPrimaryKey());

	}

}

redpajama_set_name: RedPajamaGithub


text:
from __future__ import unicode_literals

from datetime import date, datetime

import oca_unittest
from rogerthat.models import OpeningPeriod, OpeningHour, OpeningHourException, OpeningHours
from rogerthat.rpc import users
from solutions.common.bizz.opening_hours import opening_hours_to_text

class TestOpeningHours(oca_unittest.TestCase):

    def _create_hours(self):
        hours = OpeningHours(
            key=OpeningHours.create_key(users.User('test@example.com'), '1'),
            type=OpeningHours.TYPE_STRUCTURED,
            periods=[
                OpeningPeriod(open=OpeningHour(day=1, time=u'1245'),
                              close=OpeningHour(day=1, time=u'1730')),
                OpeningPeriod(open=OpeningHour(day=2, time=u'0900'),
                              close=OpeningHour(day=2, time=u'1700')),
                OpeningPeriod(open=OpeningHour(day=0, time=u'1400'),
                              close=OpeningHour(day=0, time=u'1700')),
                OpeningPeriod(open=OpeningHour(day=1, time=u'0800'),
                              close=OpeningHour(day=1, time=u'1200')),
                OpeningPeriod(open=OpeningHour(day=5, time=u'0800'),
                              close=OpeningHour(day=5, time=u'1200')),
            ],
            exceptional_opening_hours=[
                OpeningHourException(start_date=date(2020, 1, 12), end_date=date(2020, 1, 13)),
                OpeningHourException(start_date=date(2020, 1, 1), end_date=date(2020, 1, 1)),
                OpeningHourException(start_date=date(2020, 8, 15), end_date=date(2020, 8, 16),
                                     description='Assumption of Mary'),
                OpeningHourException(start_date=date(2020, 1, 2), end_date=date(2020, 1, 2),
                                     description='Slacking off after new year\'s day'),

                OpeningHourException(start_date=date(2020, 7, 1), end_date=date(2020, 8, 30),
                                     description='Summer vacation - deviating hours on monday and friday',
                                     periods=[
                                         OpeningPeriod(open=OpeningHour(day=1, time='0900'),
                                                       close=OpeningHour(day=1, time='1200')),
                                         OpeningPeriod(open=OpeningHour(day=5, time='1000'),
                                                       close=OpeningHour(day=5, time='1200'))
                                     ])
            ]
        )
        hours.put()
        return hours

    def test_sort_hours(self):
        hours = self._create_hours()
        self.assertEqual(1, hours.periods[0].open.day)
        self.assertEqual('0800', hours.periods[0].open.time)
        self.assertEqual(0, hours.periods[-1].open.day)
        self.assertEqual('1400', hours.periods[-1].open.time)
        self.assertEqual(date(2020, 1, 1), hours.exceptional_opening_hours[0].start_date)

    def test_structured_to_str(self):
        hours = self._create_hours()
        current_date = datetime(2020, 1, 2)
        text = opening_hours_to_text(hours, 'en_GB', current_date)
        expected = """Monday
08:00 — 12:00
12:45 — 17:30

Tuesday
09:00 — 17:00

Friday
08:00 — 12:00

Sunday
14:00 — 17:00

Deviating opening hours

02/01/2020 Slacking off after new year's day — Closed
12/01/2020 — 13/01/2020 Closed
01/07/2020 — 30/08/2020 Summer vacation - deviating hours on monday and friday
Monday
09:00 — 12:00

Friday
10:00 — 12:00
15/08/2020 — 16/08/2020 Assumption of Mary — Closed"""
        self.assertEqual(expected, text)

    def test_always_open(self):
        hours = OpeningHours(
            key=OpeningHours.create_key(users.User('test@example.com'), '1'),
            type=OpeningHours.TYPE_STRUCTURED,
            periods=[
                OpeningPeriod(open=OpeningHour(day=0, time=u'0000')),
                OpeningPeriod(open=OpeningHour(day=1, time=u'0000')),
                OpeningPeriod(open=OpeningHour(day=2, time=u'0000')),
                OpeningPeriod(open=OpeningHour(day=3, time=u'0000')),
                OpeningPeriod(open=OpeningHour(day=4, time=u'0000')),
                OpeningPeriod(open=OpeningHour(day=5, time=u'0000')),
                OpeningPeriod(open=OpeningHour(day=6, time=u'0000')),
            ]
        )
        current_date = datetime(2020, 1, 2)
        text = opening_hours_to_text(hours, 'en_GB', current_date)
        expected = """Open 24/7"""
        self.assertEqual(expected, text)

    def test_open_24h(self):
        hours = OpeningHours(
            key=OpeningHours.create_key(users.User('test@example.com'), '1'),
            type=OpeningHours.TYPE_STRUCTURED,
            periods=[
                OpeningPeriod(open=OpeningHour(day=1, time='0000')),
                OpeningPeriod(open=OpeningHour(day=2, time='0800'), close=OpeningHour(day=1, time=u'1700')),
            ]
        )
        current_date = datetime(2020, 1, 2)
        text = opening_hours_to_text(hours, 'en_GB', current_date)
        expected = """Monday
Open 24 hours

Tuesday
08:00 — 17:00"""
        self.assertEqual(expected, text)

    def test_always_closed(self):
        hours = OpeningHours(
            key=OpeningHours.create_key(users.User('test@example.com'), '1'),
            type=OpeningHours.TYPE_STRUCTURED,
        )
        current_date = datetime(2020, 1, 2)
        text = opening_hours_to_text(hours, 'en_GB', current_date)
        expected = """Always closed"""
        self.assertEqual(expected, text)

    def test_duplicate_open_24_hours(self):
        hours = OpeningHours(
            key=OpeningHours.create_key(users.User('test@example.com'), '1'),
            type=OpeningHours.TYPE_STRUCTURED,
            periods=[
                OpeningPeriod(open=OpeningHour(day=1, time='0000')),
                OpeningPeriod(open=OpeningHour(day=1, time='0000')),
                OpeningPeriod(open=OpeningHour(day=1, time='0000')),
            ]
        )
        hours.sanitize_periods()
        self.assertEqual(1, len(hours.periods))

        hours.periods = [
            OpeningPeriod(open=OpeningHour(day=1, time='0000')),
            OpeningPeriod(open=OpeningHour(day=1, time='0000'), close=OpeningHour(day=1, time='0300')),
            OpeningPeriod(open=OpeningHour(day=1, time='0000')),
        ]
        hours.sanitize_periods()
        self.assertEqual(1, len(hours.periods))
        self.assertIsNone(hours.periods[0].close)


text:
namespace pdalboost {} namespace boost = pdalboost; namespace pdalboost { namespace mpi {

// Incidence Graph requirements
std::pair<detail::comm_out_edge_iterator, detail::comm_out_edge_iterator>
out_edges(int vertex, const graph_communicator& comm)
{
  int nneighbors = out_degree(vertex, comm);
  shared_array<int> neighbors(new int[nneighbors]);
  BOOST_MPI_CHECK_RESULT(MPI_Graph_neighbors,
                         ((MPI_Comm)comm, vertex, nneighbors, neighbors.get()));
  return std::make_pair(detail::comm_out_edge_iterator(vertex, neighbors, 0),
                        detail::comm_out_edge_iterator(vertex, neighbors,
                                                       nneighbors));
}

int out_degree(int vertex, const graph_communicator& comm)
{
  int nneighbors;
  BOOST_MPI_CHECK_RESULT(MPI_Graph_neighbors_count,
                         ((MPI_Comm)comm, vertex, &nneighbors));
  return nneighbors;
}

// Adjacency Graph requirements
std::pair<detail::comm_adj_iterator, detail::comm_adj_iterator>
adjacent_vertices(int vertex, const graph_communicator& comm)
{
  int nneighbors = out_degree(vertex, comm);
  shared_array<int> neighbors(new int[nneighbors]);
  BOOST_MPI_CHECK_RESULT(MPI_Graph_neighbors,
                         ((MPI_Comm)comm, vertex, nneighbors, neighbors.get()));
  return std::make_pair(detail::comm_adj_iterator(neighbors, 0),
                        detail::comm_adj_iterator(neighbors, nneighbors));
}

// Edge List Graph requirements
std::pair<detail::comm_edge_iterator, detail::comm_edge_iterator>
edges(const graph_communicator& comm);

std::pair<detail::comm_edge_iterator, detail::comm_edge_iterator>
edges(const graph_communicator& comm)
{
  int nnodes, nedges;
  BOOST_MPI_CHECK_RESULT(MPI_Graphdims_get, ((MPI_Comm)comm, &nnodes, &nedges));

  shared_array<int> indices(new int[nnodes]);
  shared_array<int> edges(new int[nedges]);
  BOOST_MPI_CHECK_RESULT(MPI_Graph_get,
                         ((MPI_Comm)comm, nnodes, nedges,
                          indices.get(), edges.get()));
  return std::make_pair(detail::comm_edge_iterator(indices, edges),
                        detail::comm_edge_iterator(nedges));
}

int num_edges(const graph_communicator& comm)
{
  int nnodes, nedges;
  BOOST_MPI_CHECK_RESULT(MPI_Graphdims_get, ((MPI_Comm)comm, &nnodes, &nedges));
  return nedges;
}

} } // end namespace pdalboost::mpi


text:
using System;
using System.Collections.Generic;
using ModestTree;
using UnityEngine;
using Zenject.Internal;
using System.Linq;

namespace Zenject
{
    public class SubContainerCreatorByPrefab : ISubContainerCreator
    {
        readonly string _groupName;
        readonly string _gameObjectName;
        readonly IPrefabProvider _prefabProvider;
        readonly DiContainer _container;

        public SubContainerCreatorByPrefab(
            DiContainer container, IPrefabProvider prefabProvider, string gameObjectName, string groupName)
        {
            _prefabProvider = prefabProvider;
            _groupName = groupName;
            _gameObjectName = gameObjectName;
            _container = container;
        }

        public DiContainer CreateSubContainer(List<TypeValuePair> args)
        {
            Assert.That(args.IsEmpty());

            var prefab = _prefabProvider.GetPrefab();
            var gameObject = _container.InstantiatePrefab(
                prefab, new object[0], _groupName);

            if (_gameObjectName != null)
            {
                gameObject.name = _gameObjectName;
            }

            var compRoot = gameObject.GetComponent<GameObjectCompositionRoot>();

            Assert.IsNotNull(compRoot,
                "Expected prefab with name '{0}' to container a component of type 'GameObjectCompositionRoot'", prefab.name);

            return compRoot.Container;
        }
    }
}

#endif


text:
package com.tn.blackjack;

import java.util.Arrays;

/**
 * Created by thomasnilsen on 06/05/2017.
 */
public class Dealer extends AbstractPlayer {
    //Dealer must hit until he hits 17 or more
    private static final int MINIMUM_SCORE = 17;
    private CardDeck deck;

    Dealer(int numberOfDecks) {
        if(numberOfDecks < 1) {
            throw new IllegalArgumentException("Must be at least 1 deck");
        }
        this.deck = new CardDeck(numberOfDecks);
    }

    void dealInitialTwoCardsToSelf() {
        drawCards(deck.dealCard(), deck.dealCard());
    }

    Card dealCard() {
        return deck.dealCard();
    }

    void dealInitialTwoCards(Player[] players) {
        Arrays.stream(players).forEach(player -> player.drawCards(deck.dealCard(), deck.dealCard()));
    }

    @Override
    public void performAction(Action action, Card... card) {
        int score = calculateScore();
        if (score < MINIMUM_SCORE) {
            drawCards(card);
            lastAction = Action.HIT;
        } else {
            lastAction = Action.STAND;
        }
    }

    @Override
    public String toString() {
        return "The Dealer";
    }
}


text:
var argsClass = '[object Arguments]';

module.exports = function isArguments(value) {
  return value && typeof value == 'object' && typeof value.length == 'number' &&
    toString.call(value) == argsClass || false;
}


text:
words=['abc','defgh','df','lsefgd']

lst = []

for word in words:
    lst.append((len(word),word))

lst.sort(reverse=True)
print lst

res=[]

for length , word in lst:
    res.append(word)

print res

words.sort(key= lambda x: len(x),reverse=True)

print words


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Mem. Amer. Acad. Arts, ser. 2 16: (1931)

#### Original name
Adelomyces discolomidinus Thaxt., 1931

### Remarks
null


text:
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Eggly Angular 2</title>
  <base href="/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="Eggly Angular 2 from OneHungryMind">

  <link rel="icon" type="image/x-icon" href="favicon.ico">

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <link rel="stylesheet" href="assets/css/global.css" charset="utf-8">
</head>
<body>
  <app-root>Loading...</app-root>
</body>
</html>


text:
function dss_message(state, level, message)
% Logging based on verbosity level
%   dss_message(state, level, message)
%     state    DSS state with verbose-parameter
%     level    Used logging level
%     message  Logged message

% Copyright (C) 2004, 2005 DSS MATLAB package team (dss@cis.hut.fi).
% Distributed by Laboratory of Computer and Information Science,
% Helsinki University of Technology. http://www.cis.hut.fi/projects/dss/.
% $Id: dss_message.m 8776 2013-11-14 09:04:48Z roboos $

if ~isfield(state,'verbose'), return, end
if state.verbose>=level
  fprintf(message);
end