text:
from collections import Counter as _Counter
from itertools import chain
from math import log2

from baseconvert import dec2str as _dec2str, str2dec as _str2dec, __CHAR
from sort.utils import pre_treat, rearrange

@pre_treat
def bucket_sort(array_, reverse=False):
    min_, max_, len_ = min(array_), max(array_), len(array_)
    buckets = [[] for _ in range(len_)]
    for val in array_:
        bucket_index = ((val - min_) * len_) // (max_ - min_ + 1)
        if not buckets[bucket_index]:
            buckets[bucket_index].append(val)
        else:
            for index in range(len(buckets[bucket_index])):
                if val < buckets[bucket_index][index]:
                    buckets[bucket_index].insert(index, val)
                    break
            else:
                buckets[bucket_index].append(val)
    return list(chain.from_iterable(buckets))[::-1] if reverse else list(chain.from_iterable(buckets))

@pre_treat
def count_sort(array_, reverse=False):
    need_sort, base = array_, 10
    if not isinstance(array_[0], int):
        base_dict = {v: k for k, v in enumerate(__CHAR)}
        base = base_dict[max(set(''.join([str(s[1:] if '-' in s else s) for s in array_])))] + 1
    need_sort = [_str2dec(base)(s) for s in array_]
    min_, max_ = min(need_sort), max(need_sort)
    count_map = _Counter(ele for ele in need_sort)
    sorted_array = [0] * len(array_)
    if not reverse:
        for i in range(min_ + 1, max_ + 1):
            count_map[i] += count_map[i - 1]
    else:
        for i in reversed(range(min_, max_)):
            count_map[i] += count_map[i + 1]
    for index, val in enumerate(reversed(need_sort)):
        sorted_array[count_map[val] - 1] = array_[-1 - index]
        count_map[val] -= 1
    return sorted_array

def custom_radix(sort_func=count_sort):
    @pre_treat
    def custom_radix_(array_, reverse=False):
        base, group_by = 2, int(log2(len(array_)))
        need_sort = [_dec2str(base)(s) for s in array_]
        max_length = max([len(str(s)) for s in need_sort])
        fill_0 = [s.zfill(max_length) for s in need_sort]
        split_arr = [[s[i:i + group_by] for i in range(0, len(s), group_by)] for s in fill_0]
        for i in range(len(split_arr[0])):
            sorted_group = sort_func([arr[-1 - i] for arr in split_arr], reverse=reverse)
            split_arr = rearrange(split_arr, i)(sorted_group)
        return [int(''.join(x), base) if isinstance(array_[0], int) else ''.join(x) for x in split_arr]

    return custom_radix_

def radix_sort(array_, reverse=False):
    return custom_radix()(array_, reverse=reverse)


text:
import shallowEqual from './shallowEqual'

export default class Node {

  constructor(db) {
    this.db = db
  }

  // define set / get interface
  set(prop, value){
    return
  }

  get(prop){
    return this[prop]
  }
}

redpajama_set_name: RedPajamaGithub


text:
using Melanchall.DryWetMidi.Interaction;
using Melanchall.DryWetMidi.Tests.Utilities;
using Melanchall.DryWetMidi.Tools;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Melanchall.DryWetMidi.Tests.Tools
{
    [TestFixture]
    public sealed partial class SplitterTests
    {
        #region Test methods

        [Test]
        public void SplitObjectsAtDistance_Notes_EmptyCollection([Values] LengthedObjectTarget from) => SplitObjectsAtDistance(
            inputObjects: Array.Empty<Note>(),
            distance: (MidiTimeSpan)100,
            from: from,
            expectedObjects: Array.Empty<Note>());

        [Test]
        public void SplitObjectsAtDistance_Notes_Nulls([Values] LengthedObjectTarget from) => SplitObjectsAtDistance(
            inputObjects: new[] { default(ITimedObject), default(ITimedObject) },
            distance: (MidiTimeSpan)100,
            from: from,
            expectedObjects: new[] { default(ITimedObject), default(ITimedObject) });

        [Test]
        public void SplitObjectsAtDistance_Notes_ZeroDistance([Values] LengthedObjectTarget from)
        {
            var inputObjects = CreateInputNotes(1000);
            SplitObjectsAtDistance(
                inputObjects: inputObjects,
                distance: (MidiTimeSpan)0,
                from: from,
                expectedObjects: inputObjects.Select(o => o.Clone()).ToArray());
        }

        [Test]
        public void SplitObjectsAtDistance_Notes_BigDistance([Values] LengthedObjectTarget from)
        {
            var inputObjects = CreateInputNotes(1000);
            SplitObjectsAtDistance(
                inputObjects: inputObjects,
                distance: (MidiTimeSpan)1000,
                from: from,
                expectedObjects: inputObjects.Select(o => o.Clone()).ToArray());
        }

        [Test]
        public void SplitObjectsAtDistance_Notes_Start()
        {
            var inputObjects = CreateInputNotes(1000);
            SplitObjectsAtDistance(
                inputObjects: inputObjects,
                distance: (MidiTimeSpan)10,
                from: LengthedObjectTarget.Start,
                expectedObjects: inputObjects.SelectMany(o => Split(o, new[] { o.Time + 10 })).ToArray());
        }

        [Test]
        public void SplitObjectsAtDistance_Notes_End()
        {
            var inputObjects = CreateInputNotes(1000);
            SplitObjectsAtDistance(
                inputObjects: inputObjects,
                distance: (MidiTimeSpan)10,
                from: LengthedObjectTarget.End,
                expectedObjects: inputObjects.SelectMany(o => Split(o, new[] { o.EndTime - 10 })).ToArray());
        }

        [Test]
        public void SplitObjectsAtDistance_Notes_ByRatio_EmptyCollection([Values] LengthedObjectTarget from)
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = Enumerable.Empty<Note>();
            var ratio = 0.5;
            var expectedObjects = Enumerable.Empty<Note>();
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, ratio, TimeSpanType.Midi, from, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Notes_ByRatio_Nulls([Values] LengthedObjectTarget from)
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = new[] { default(Note), default(Note) };
            var ratio = 0.5;
            var expectedObjects = new[] { default(Note), default(Note) };
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, ratio, TimeSpanType.Midi, from, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Notes_ByRatio_ZeroRatio([Values] LengthedObjectTarget from)
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = CreateInputNotes(1000);
            var ratio = 0.0;
            var expectedObjects = inputObjects.Select(o => o.Clone());
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, ratio, TimeSpanType.Midi, from, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Notes_FullLengthRatio([Values] LengthedObjectTarget from)
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = CreateInputNotes(1000);
            var ratio = 1.0;
            var expectedObjects = inputObjects.Select(o => o.Clone());
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, ratio, TimeSpanType.Midi, from, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Notes_ByRatio_Start()
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = CreateInputNotes(1000);
            var ratio = 0.1;
            var expectedObjects = inputObjects.SelectMany(o => Split(o, new[] { o.Time + 100 }));
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, ratio, TimeSpanType.Midi, LengthedObjectTarget.Start, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Notes_ByRatio_End()
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = CreateInputNotes(1000);
            var ratio = 0.1;
            var expectedObjects = inputObjects.SelectMany(o => Split(o, new[] { o.EndTime - 100 }));
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, ratio, TimeSpanType.Midi, LengthedObjectTarget.End, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Chords_EmptyCollection([Values] LengthedObjectTarget from)
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = Enumerable.Empty<Chord>();
            var distance = (MidiTimeSpan)100;
            var expectedObjects = Enumerable.Empty<Chord>();
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, distance, from, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Chords_Nulls([Values] LengthedObjectTarget from)
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = new[] { default(Chord), default(Chord) };
            var distance = (MidiTimeSpan)100;
            var expectedObjects = new[] { default(Chord), default(Chord) };
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, distance, from, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Chords_ZeroDistance([Values] LengthedObjectTarget from)
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = CreateInputChords(1000);
            var distance = (MidiTimeSpan)0;
            var expectedObjects = inputObjects.Select(o => o.Clone());
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, distance, from, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Chords_BigDistance([Values] LengthedObjectTarget from)
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = CreateInputChords(1000);
            var distance = (MidiTimeSpan)1000;
            var expectedObjects = inputObjects.Select(o => o.Clone());
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, distance, from, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Chords_Start()
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = CreateInputChords(1000);
            var distance = (MidiTimeSpan)10;
            var expectedObjects = inputObjects.SelectMany(o => Split(o, new[] { o.Time + distance }));
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, distance, LengthedObjectTarget.Start, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Chords_End()
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = CreateInputChords(1000);
            var distance = (MidiTimeSpan)10;
            var expectedObjects = inputObjects.SelectMany(o => Split(o, new[] { o.EndTime - distance }));
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, distance, LengthedObjectTarget.End, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Chords_ByRatio_EmptyCollection([Values] LengthedObjectTarget from)
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = Enumerable.Empty<Chord>();
            var ratio = 0.5;
            var expectedObjects = Enumerable.Empty<Chord>();
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, ratio, TimeSpanType.Midi, from, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Chords_ByRatio_Nulls([Values] LengthedObjectTarget from)
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = new[] { default(Chord), default(Chord) };
            var ratio = 0.5;
            var expectedObjects = new[] { default(Chord), default(Chord) };
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, ratio, TimeSpanType.Midi, from, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Chords_ByRatio_ZeroRatio([Values] LengthedObjectTarget from)
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = CreateInputChords(1000);
            var ratio = 0.0;
            var expectedObjects = inputObjects.Select(o => o.Clone());
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, ratio, TimeSpanType.Midi, from, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Chords_FullLengthRatio([Values] LengthedObjectTarget from)
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = CreateInputChords(1000);
            var ratio = 1.0;
            var expectedObjects = inputObjects.Select(o => o.Clone());
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, ratio, TimeSpanType.Midi, from, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Chords_ByRatio_Start()
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = CreateInputChords(1000);
            var ratio = 0.1;
            var expectedObjects = inputObjects.SelectMany(o => Split(o, new[] { o.Time + 100 }));
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, ratio, TimeSpanType.Midi, LengthedObjectTarget.Start, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        [Test]
        public void SplitObjectsAtDistance_Chords_ByRatio_End()
        {
            var tempoMap = TempoMap.Default;

            var inputObjects = CreateInputChords(1000);
            var ratio = 0.1;
            var expectedObjects = inputObjects.SelectMany(o => Split(o, new[] { o.EndTime - 100 }));
            var actualObjects = Splitter.SplitObjectsAtDistance(inputObjects, ratio, TimeSpanType.Midi, LengthedObjectTarget.End, tempoMap);

            MidiAsserts.AreEqual(
                expectedObjects.OfType<ITimedObject>(),
                actualObjects.OfType<ITimedObject>(),
                true,
                0,
                "Objects are invalid.");
        }

        #endregion

        #region Private methods

        private void SplitObjectsAtDistance(
            ICollection<ITimedObject> inputObjects,
            ITimeSpan distance,
            LengthedObjectTarget from,
            ICollection<ITimedObject> expectedObjects)
        {
            var actualObjects = inputObjects.SplitObjectsAtDistance(distance, from, TempoMap.Default).ToArray();
            MidiAsserts.AreEqual(
                expectedObjects,
                actualObjects,
                true,
                0,
                "Invalid result objects.");
        }

        #endregion
    }
}


text:
<?php class OffersController extends AppController {

	 public $name = 'Offers';
		// $uses is where you specify which models this controller uses

	 public $uses = array(
     					   'User',
       				   'Demo',
       				   'Product',
       				   'Offer',
       				   'Property',
       				   'Factory'
    						); 			//from this line we refer to both of our models demo and user
    public $helpers = array('Html', 'Form');

    public function index() {

      $this->Demo->recursive = 0;
		$this->User->recursive = 0;
		$this->Product->recursive = 0;
		$this->Offer->recursive = 0;
		$this->Property->recursive = 0;
      $this->Factory->recursive = 0;

      $this->set('factories', $this->Factory->find('all'));
		$this->set('demos', $this->Demo->find('all'));
		$this->set('users', $this->User->find('all'));
		$this->set('products', $this->Product->find('all'));
		$this->set('offers', $this->Offer->find('all'));
		$this->set('properties', $this->Property->find('all'));
}

    public function view($id = null) {
        if (!$id) {
            throw new NotFoundException(__('Invalid offer'));
        }

        $offer = $this->Offer->findById($id);
        if (!$offer) {
            throw new NotFoundException(__('Invalid offer'));
        }
        $this->set('offer', $offer);
}

   /* xrisimopoieitai apo ton admin*/

public function editOfferAdmin($id = null) {

	 $this->Offer->id = $id;

    $this->Offer->recursive = 0;
    $this->Factory->recursive = 0;

    $this->set('offers', $this->Offer->find('all'));
    $this->set('factories', $this->Factory->find('all'));

    if (!$id) {
    	echo $id;

        throw new NotFoundException(__('Invalid offer'));
    }

    $offer = $this->Offer->findById($id);
    if (!$offer) {
    		echo $id;
        throw new NotFoundException(__('Invalid offer'));
    }

    if ($this->request->is(array('offer', 'put'))) {

        $this->Offer->id = $id;
        if ($this->Offer->save($this->request->data)) {
            $this->Session->setFlash(__('Your offer has been updated.'));
            return $this->redirect(array('controller'=>'demos', 'action'=>'view'));
        }
        $this->Session->setFlash(__('Unable to update your offer.'));
    }

    if (!$this->request->data) {
        $this->request->data = $offer;
    }
}
/* xrisimopoieitai apo ton admin*/
public function addOfferAdmin() {

        if ($this->request->is('post')) {
            $this->Offer->create();
            if ($this->Offer->save($this->request->data)) {
                $this->Session->setFlash(__('Your offer has been saved.'));
                return $this->redirect(array('controller'=>'demos', 'action'=>'view'));
            }
            $this->Session->setFlash(__('Unable to add your offer.'));
        }

       		$this->set('offers', $this->Offer->Factory->find('all'));
        		$this->set('offers', $this->Offer->Product->find('all'));
}

   /* xrisimopoieitai apo ton admin*/

	public function deleteOfferAdmin($id) {
	 $this->Offer->recursive = 0;

    $this->set('offers', $this->Offer->find('all'));

    $this->Offer->id = $id;

        if(!$this->Offer->exists()) {
            throw new NotFoundException(__('Invalid offer'));
        }

        if ($this->Offer->delete($id)) {
            $this->Session->setFlash('The offer with id: ' . $id . ' has been deleted.');
            $this->redirect(array('controller'=>'demos', 'action'=>'view'));
        }
}

   /* xrisimopoieitai apo ton user*/

    public function addOffer() {

    	 $this->Factory->recursive = 0;
    	 $this->set('factories', $this->Factory->find('all'));
		 $this->Product->recursive = 0;
		 $this->set('products', $this->Product->find('all'));
		 $this->Property->recursive = 0;
		 $this->set('properties', $this->Property->find('all'));

        if ($this->request->is('post')) {
            $this->Offer->create();
            if ($this->Offer->save($this->request->data)) {
                $this->Session->setFlash(__('Your offer has been saved.'));
                return $this->redirect(array('controller'=>'properties', 'action'=>'addProperty',$this->Offer->id,$this->request->data['Offer']['product_id']));
            }
            $this->Session->setFlash(__('Unable to add your offer.'));
        }

       		$this->set('offers', $this->Offer->Factory->find('all'));
        		$this->set('offers', $this->Offer->Product->find('all'));
}

/* xrisimopoieitai apo ton user*/
public function editOffer($id = null) {
	//echo "id:".$id;

	$this->Demo->recursive = 0;
	$this->User->recursive = 0;
	$this->Product->recursive = 0;
	$this->Offer->recursive = 0;
	$this->Property->recursive = 0;
   $this->Factory->recursive = 0;

   $this->set('factories', $this->Factory->find('all'));
	$this->set('demos', $this->Demo->find('all'));
	$this->set('users', $this->User->find('all'));
	$this->set('products', $this->Product->find('all'));
	$this->set('offers', $this->Offer->find('all'));
	$this->set('properties', $this->Property->find('all'));

   $this->Offer->id = $id;

   $this->Offer->recursive = 0;
   $this->Factory->recursive = 0;

   $this->set('offers', $this->Offer->find('all'));
   $this->set('factories', $this->Factory->find('all'));

   if (!$id) {
   	echo $id;

       throw new NotFoundException(__('Invalid offer'));
   }

   $offer = $this->Offer->findById($id);
   $property  = $this->Property->findById($id);
   if (!$offer) {
   		echo $id;
       throw new NotFoundException(__('Invalid offer'));
   }

   if ($this->request->is(array('offer', 'put'))) {

       $this->Offer->id = $id;
       if ($this->Offer->save($this->request->data)) {
           $this->Session->setFlash(__('Your offer has been updated.'));
           return $this->redirect(array('controller'=>'properties', 'action'=>'editProperty',$this->Offer->id,$this->request->data['Offer']['product_id'],$id	));
       }
       $this->Session->setFlash(__('Unable to update your offer.'));
   }

   if (!$this->request->data) {
       $this->request->data = $offer;
   }
}
 /* xrisimopoieitai apo ton user*/
	public function delete($id) {
	 $this->Offer->recursive = 0;

    $this->set('offers', $this->Offer->find('all'));

    $this->Offer->id = $id;

        if(!$this->Offer->exists()) {
            throw new NotFoundException(__('Invalid offer'));
        }

        if ($this->Offer->delete($id)) {
            $this->Session->setFlash('The offer with id: ' . $id . ' has been deleted.');
            $this->redirect(array('action' => 'index'));
        }
}

}

?>


text:
require "support/shared/integration/integration_helper"
require "chef/mixin/shell_out"
require "chef/run_lock"
require "chef/config"
require "timeout"
require "fileutils"

describe "chef-solo" do
  include IntegrationSupport
  include Chef::Mixin::ShellOut

  let(:chef_dir) { File.join(File.dirname(__FILE__), "..", "..", "..") }

  let(:cookbook_x_100_metadata_rb) { cb_metadata("x", "1.0.0") }

  let(:cookbook_ancient_100_metadata_rb) { cb_metadata("ancient", "1.0.0") }

  let(:chef_solo) { "ruby bin/chef-solo --legacy-mode --minimal-ohai" }

  when_the_repository "has a cookbook with a basic recipe" do
    before do
      file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb
      file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"'
    end

    it "should complete with success" do
      file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
      result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
      result.error!
      expect(result.stdout).to include("ITWORKS")
    end

    it "should evaluate its node.json file" do
      file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM

      file "config/node.json", <<-E
{"run_list":["x::default"]}
E

      result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -j '#{path_to('config/node.json')}' -l debug", :cwd => chef_dir)
      result.error!
      expect(result.stdout).to include("ITWORKS")
    end

  end

  when_the_repository "has a cookbook with an undeclared dependency" do
    before do
      file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb
      file "cookbooks/x/recipes/default.rb", 'include_recipe "ancient::aliens"'

      file "cookbooks/ancient/metadata.rb", cookbook_ancient_100_metadata_rb
      file "cookbooks/ancient/recipes/aliens.rb", 'print "it was aliens"'
    end

    it "should exit with an error" do
      file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
      result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
      expect(result.exitstatus).to eq(0) # For CHEF-5120 this becomes 1
      expect(result.stdout).to include("WARN: MissingCookbookDependency")
    end
  end

  when_the_repository "has a cookbook with an incompatible chef_version" do
    before do
      file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nchef_version '~> 999.0'")
      file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"'
      file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
    end

    it "should exit with an error" do
      result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
      expect(result.exitstatus).to eq(1)
      expect(result.stdout).to include("Chef::Exceptions::CookbookChefVersionMismatch")
    end
  end

  when_the_repository "has a cookbook with an incompatible ohai_version" do
    before do
      file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nohai_version '~> 999.0'")
      file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"'
      file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
    end

    it "should exit with an error" do
      result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
      expect(result.exitstatus).to eq(1)
      expect(result.stdout).to include("Chef::Exceptions::CookbookOhaiVersionMismatch")
    end
  end

  when_the_repository "has a cookbook with a recipe with sleep" do
    before do
      directory "logs"
      file "logs/runs.log", ""
      file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb
      file "cookbooks/x/recipes/default.rb", <<EOM
ruby_block "sleeping" do
  block do
    retries = 200
    while IO.read(Chef::Config[:log_location]) !~ /Chef client [0-9]+ is running, will wait for it to finish and then run./
      sleep 0.1
      last if ( retries -= 1 ) <= 0
    end
  end
end
EOM
    end

    it "while running solo concurrently" do
      file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
      # We have a timeout protection here so that if due to some bug
      # run_lock gets stuck we can discover it.
      expect do
        Timeout.timeout(120) do
          chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..")

          # Instantiate the first chef-solo run
          s1 = Process.spawn("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' \
-l debug -L #{path_to('logs/runs.log')}", :chdir => chef_dir)

          # Instantiate the second chef-solo run
          s2 = Process.spawn("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' \
-l debug -L #{path_to('logs/runs.log')}", :chdir => chef_dir)

          Process.waitpid(s1)
          Process.waitpid(s2)
        end
      end.not_to raise_error

      # Unfortunately file / directory helpers in integration tests
      # are implemented using before(:each) so we need to do all below
      # checks in one example.
      run_log = File.read(path_to("logs/runs.log"))

      # both of the runs should succeed
      expect(run_log.lines.reject { |l| !l.include? "INFO: Chef Run complete in" }.length).to eq(2)

      # second run should have a message which indicates it's waiting for the first run
      expect(run_log).to match(/Chef client [0-9]+ is running, will wait for it to finish and then run./)
    end

  end
end


text:
declare module 'delaunay-fast' {
	export function triangulate(vertices: number[][]): number[];
}


text:
package com.elfangor1989.FreeLiveView.messages.calls;

import com.elfangor1989.FreeLiveView.messages.LiveViewCall;
import com.elfangor1989.FreeLiveView.messages.MessageConstants;

/**
 * @author Xperimental
 */
public class NavigationResponse extends LiveViewCall {

    private byte response;

    public NavigationResponse(byte response) {
        super(MessageConstants.MSG_NAVIGATION_RESP);
        this.response = response;
    }

    /*
     * (non-Javadoc)
     * @see net.sourcewalker.olv.messages.LiveViewRequest#getPayload()
     */
    @Override
    protected byte[] getPayload() {
        return new byte[] { response };
    }

}


text:
class NewTabPagePrefs {
 public:
  explicit NewTabPagePrefs(Profile* profile);
  void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);

  jboolean GetCurrentlyOpenTabsCollapsed(
      JNIEnv* env,
      const base::android::JavaParamRef<jobject>& obj);
  void SetCurrentlyOpenTabsCollapsed(
      JNIEnv* env,
      const base::android::JavaParamRef<jobject>& obj,
      jboolean is_collapsed);

  jboolean GetSnapshotDocumentCollapsed(
      JNIEnv* env,
      const base::android::JavaParamRef<jobject>& obj);
  void SetSnapshotDocumentCollapsed(
      JNIEnv* env,
      const base::android::JavaParamRef<jobject>& obj,
      jboolean is_collapsed);

  jboolean GetRecentlyClosedTabsCollapsed(
      JNIEnv* env,
      const base::android::JavaParamRef<jobject>& obj);
  void SetRecentlyClosedTabsCollapsed(
      JNIEnv* env,
      const base::android::JavaParamRef<jobject>& obj,
      jboolean is_collapsed);

  jboolean GetSyncPromoCollapsed(
      JNIEnv* env,
      const base::android::JavaParamRef<jobject>& obj);
  void SetSyncPromoCollapsed(JNIEnv* env,
                             const base::android::JavaParamRef<jobject>& obj,
                             jboolean is_collapsed);

  jboolean GetForeignSessionCollapsed(
      JNIEnv* env,
      const base::android::JavaParamRef<jobject>& obj,
      const base::android::JavaParamRef<jstring>& session_tag);
  void SetForeignSessionCollapsed(
      JNIEnv* env,
      const base::android::JavaParamRef<jobject>& obj,
      const base::android::JavaParamRef<jstring>& session_tag,
      jboolean is_collapsed);

  static bool RegisterNewTabPagePrefs(JNIEnv* env);
  static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
 private:
  virtual ~NewTabPagePrefs();

  Profile* profile_;  // weak
  DISALLOW_COPY_AND_ASSIGN(NewTabPagePrefs);
};

#endif  // CHROME_BROWSER_ANDROID_NTP_NEW_TAB_PAGE_PREFS_H_


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
Uses of Interface gov.nasa.worldwind.event.RenderingExceptionListener (NASA World Wind)
</TITLE>

<META NAME="date" CONTENT="2010-01-14">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Index
      Help

NASA World Wind

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Interface
gov.nasa.worldwind.event.RenderingExceptionListener

Packages that use RenderingExceptionListener

gov.nasa.worldwind

gov.nasa.worldwind.awt

Uses of RenderingExceptionListener in gov.nasa.worldwind

Methods in gov.nasa.worldwind with parameters of type RenderingExceptionListener

 void
WorldWindowImpl.addRenderingExceptionListener(RenderingExceptionListener listener)

 void
WorldWindow.addRenderingExceptionListener(RenderingExceptionListener listener)

          Adds an exception listener to this world window.

 void
WorldWindowImpl.removeRenderingExceptionListener(RenderingExceptionListener listener)

 void
WorldWindow.removeRenderingExceptionListener(RenderingExceptionListener listener)

          Removes the specified rendering exception listener associated with this world window.

Uses of RenderingExceptionListener in gov.nasa.worldwind.awt

Methods in gov.nasa.worldwind.awt with parameters of type RenderingExceptionListener

 void
WorldWindowGLJPanel.addRenderingExceptionListener(RenderingExceptionListener listener)

 void
WorldWindowGLCanvas.addRenderingExceptionListener(RenderingExceptionListener listener)

 void
WorldWindowGLJPanel.removeRenderingExceptionListener(RenderingExceptionListener listener)

 void
WorldWindowGLCanvas.removeRenderingExceptionListener(RenderingExceptionListener listener)

      Overview
      Package
      Class
    Use
      Tree
      Index
      Help

NASA World Wind

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes


text:
package com.hribol.bromium.cli.commands;

import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.hribol.bromium.core.TestScenarioSteps;
import com.hribol.bromium.core.providers.IOProvider;
import com.hribol.bromium.core.providers.IOURIProvider;
import com.hribol.bromium.core.suite.VirtualScreenProcessCreator;
import com.hribol.bromium.replay.ReplayBrowser;
import com.hribol.bromium.replay.report.ExecutionReport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Optional;

import static com.hribol.bromium.core.DependencyInjectionConstants.HAR_FILE;
import static com.hribol.bromium.core.DependencyInjectionConstants.MEASUREMENTS_FILE;
import static com.hribol.bromium.core.DependencyInjectionConstants.SCREEN_NUMBER;

/**
 * A command for replaying a test scenario
 */
public class ReplayCommand implements Command {

    private final static Logger logger = LoggerFactory.getLogger(ReplayCommand.class);

    private IOURIProvider<ReplayBrowser> replayBrowserProvider;
    private IOProvider<TestScenarioSteps> stepsProvider;
    private VirtualScreenProcessCreator virtualScreenProcessCreator;
    private Integer screenNumber;
    private File measurementsFile;
    private File harFile;

    @Inject
    public ReplayCommand(IOURIProvider<ReplayBrowser> replayBrowserProvider,
                         IOProvider<TestScenarioSteps> stepsProvider,
                         VirtualScreenProcessCreator virtualScreenProcessCreator,
                         @Named(SCREEN_NUMBER) Integer screenNumber,
                         @Named(MEASUREMENTS_FILE) File measurementsFile,
                         @Named(HAR_FILE) File harFile) {
        this.replayBrowserProvider = replayBrowserProvider;
        this.stepsProvider = stepsProvider;
        this.virtualScreenProcessCreator = virtualScreenProcessCreator;
        this.screenNumber = screenNumber;
        this.measurementsFile = measurementsFile;
        this.harFile = harFile;
    }

    @Override
    public void run() {
        Optional<Process> virtualScreenProcessOptional = Optional.empty();
        try {
            if (screenNumber != 0) {
                virtualScreenProcessOptional = Optional.of(virtualScreenProcessCreator.createXvfbProcess(screenNumber));
            }

            TestScenarioSteps testCaseSteps = stepsProvider.get();
            ReplayBrowser replayBrowser = replayBrowserProvider.get();

            ExecutionReport executionReport = replayBrowser.replay(testCaseSteps);
            executionReport.getLoadingTimes().dump(measurementsFile);
            executionReport.getHar().writeTo(harFile);
            logger.info("Test run result {}", executionReport.getAutomationResult().toString());
        } catch (IOException | URISyntaxException e) {
            logger.error(e.getMessage(), e);
        } finally {
            virtualScreenProcessOptional.ifPresent(Process::destroy);
        }
    }
}


text:
package net.sansa_stack.inference.spark.conformance

import net.sansa_stack.inference.spark.forwardchaining.triples.ForwardRuleReasoner

/**
  * Provides a reasoner.
  *
  * @author Lorenz Buehmann
  */
trait ReasonerContextProvider {

  def reasoner: ForwardRuleReasoner

}


text:
package com.terremark.api;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for ActionDisabledStatus.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *

 *

 * <simpleType name="ActionDisabledStatus">
 *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *     <enumeration value="disabled"/>
 *     <enumeration value="noAccess"/>
 *   </restriction>
 * </simpleType>
 *

 *
 */
@XmlType(name = "ActionDisabledStatus")
@XmlEnum
public enum ActionDisabledStatus {

    @XmlEnumValue("disabled")
    DISABLED("disabled"),
    @XmlEnumValue("noAccess")
    NO_ACCESS("noAccess");
    private final String value;

    ActionDisabledStatus(String v) {
        value = v;
    }

    public String value() {
        return value;
    }

    public static ActionDisabledStatus fromValue(String v) {
        for (ActionDisabledStatus c: ActionDisabledStatus.values()) {
            if (c.value.equals(v)) {
                return c;
            }
        }
        throw new IllegalArgumentException(v);
    }

}


text:
var slackbot = require('node-slackbot'),
  slackApiKey = process.env.SLACK_KEY,
  bot = new slackbot(slackApiKey);

bot.use(function(message, cb) {
  var msgType = message.type ? message.type === 'message' : false,
    toUser = message.text ? message.text.includes('<@') : false;

  if (msgType && toUser) {
    bot.sendMessage(message.channel, "Posted to #you-guys-are-awesome!")
    bot.sendMessage('C0NANKWF7', message.text);
  } else if (msgType && message.channel !== 'C0NANKWF7') {
    bot.sendMessage(
      message.channel,
      'You need to @ mention a user in your message in order to send a compliment!'
    );
  }

  cb();
});

bot.connect();


text:
package v1

import (
	"github.com/rancher/norman/lifecycle"
	"github.com/rancher/norman/resource"
	"k8s.io/api/storage/v1"
	"k8s.io/apimachinery/pkg/runtime"
)

type StorageClassLifecycle interface {
	Create(obj *v1.StorageClass) (runtime.Object, error)
	Remove(obj *v1.StorageClass) (runtime.Object, error)
	Updated(obj *v1.StorageClass) (runtime.Object, error)
}

type storageClassLifecycleAdapter struct {
	lifecycle StorageClassLifecycle
}

func (w *storageClassLifecycleAdapter) HasCreate() bool {
	o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
	return !ok || o.HasCreate()
}

func (w *storageClassLifecycleAdapter) HasFinalize() bool {
	o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
	return !ok || o.HasFinalize()
}

func (w *storageClassLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
	o, err := w.lifecycle.Create(obj.(*v1.StorageClass))
	if o == nil {
		return nil, err
	}
	return o, err
}

func (w *storageClassLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
	o, err := w.lifecycle.Remove(obj.(*v1.StorageClass))
	if o == nil {
		return nil, err
	}
	return o, err
}

func (w *storageClassLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
	o, err := w.lifecycle.Updated(obj.(*v1.StorageClass))
	if o == nil {
		return nil, err
	}
	return o, err
}

func NewStorageClassLifecycleAdapter(name string, clusterScoped bool, client StorageClassInterface, l StorageClassLifecycle) StorageClassHandlerFunc {
	if clusterScoped {
		resource.PutClusterScoped(StorageClassGroupVersionResource)
	}
	adapter := &storageClassLifecycleAdapter{lifecycle: l}
	syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
	return func(key string, obj *v1.StorageClass) (runtime.Object, error) {
		newObj, err := syncFn(key, obj)
		if o, ok := newObj.(runtime.Object); ok {
			return o, err
		}
		return nil, err
	}
}


text:
;(function(){
    // 逐步代替scrollHandle
    // scrollHelper复制一份 便于model控制
    var preScrollTop = 0;
    var scrollHandlerMap = {};

    var $ = Model.$;

    var scrollHelper = {
        bindEvent: function(container, id, scrollToHalfCallback) {
            var scrollDom = container;
            if ($.os.ios) {
                if ($(scrollDom)[0] == document.body) {
                    scrollDom = window;
                }
            }

            $(scrollDom).on("scroll", function() {
                var preScrollTop = 0,
                    throatTimer;

                return function(e) {
                    window.clearTimeout(throatTimer);
                    throatTimer = window.setTimeout(onScroll, 200);

                    function onScroll() {
                        var self = this;
                        var container = e.target;
                        var scrollTop,
                            scrollHeight,
                            windowHeight,
                            loadStartValue = 300;

                        //android 和 ios 5以下版本
                        if (container == document) {
                            scrollTop = window.scrollY;
                            windowHeight = window.innerHeight;
                            scrollHeight = document.body.scrollHeight;
                        }
                        //ios 5+版本
                        else {
                            var style = window.getComputedStyle(container);
                            scrollTop = container.scrollTop;
                            windowHeight = parseInt(style.height) + parseInt(style.paddingTop) + parseInt(style.paddingBottom) + parseInt(style.marginTop) + parseInt(style.marginBottom);
                            scrollHeight = container.scrollHeight;
                        }

                        //滚动到距离屏幕底部N像素时进行加载,N取决于loadStartValue
                        if (scrollTop + windowHeight + loadStartValue >= scrollHeight) {
                            scrollToHalfCallback && scrollToHalfCallback(e);
                        }

                        preScrollTop = scrollTop;
                    }
                };
            }());

        },
        removeModel: function(model) {
            var scrollEl = model._scrollEl;
            if (scrollEl) {
                var el = scrollEl;
                if (typeof scrollEl == "string") {
                    el = $(scrollEl);
                }

                var id;
                if (el == window || el[0] == window || el.selector === "window") {
                    id = '__window__';
                } else {
                    id = el.attr("id");
                }

                if (el && el.length && id) {
                    for (var i = 0; i < scrollHandlerMap[id].length; i++) {
                        if (scrollHandlerMap[id] === model) {
                            break;
                        }
                    }

                    scrollHandlerMap[id].splice(i, 1);
                }
            }
        },

        addModel: function(model) {
            var scrollEl = model.scrollEl;
            var el = scrollEl;
            if (typeof scrollEl == "string") {
                el = $(scrollEl);
            }

            var id;
            if (el == window || el[0] == window || el.selector === "window") {
                id = '__window__';
            } else {

                id = el.attr("id");
                if (id) {} else {
                    id = "d_" + ~~(100000 * Math.random());
                    el.attr("id", id);
                }
            }

            if (scrollHandlerMap[id]) {
                scrollHandlerMap[id].push(model);
            } else {
                scrollHandlerMap[id] = [model];

                this.bindEvent(
                    el,
                    id,
                    function() {

                        scrollHandlerMap[id].map(function(item) {
                            if (item.type == "ScrollModel") {
                                if (!item.freezed && item.scrollEnable) {
                                    var event = Model.createEvent({
                                        type: "scrollToBottom",
                                        target: item,
                                        name: 'anonymouse'
                                    });

                                    item.dispatchEvent(event);
                                }
                            } else {

                                if (!item.freezed && item.currModel.type == "scrollModel" && !item.currModel.freezed && item.currModel.scrollEnable) {

                                    item.currModel.rock();
                                }
                            }
                        });
                    }
                );
            }

        }
    };

    var ScrollModel = Model.Class("BaseModel", {
        type: "ScrollModel",

        _resetPrivateFlag: function(){
            this.get("rendered").set(0);
        },

        extend: function(opt){
            var clone = this.callSuperMethod('extend', {scrollEl: this.scrollEl});

            clone.renderModel = this.renderModel.extend(opt);

            return clone;
        },
        constructor: function(opt){
            //this.addAcceptOpt(['scrollEl']);
            this.callSuper();
            this.scrollEl = opt.scrollEl || window;

            var scrollLock = this.get("scrollLock");

            this.renderModel = new RenderModel(opt);
            this.renderModel.active = function(){
                this.render(this.el);
            };

            this.renderModel.addEventListener("completed", function(e){
                scrollLock.set(0);
            });

            this.renderModel.addEventListener("errored", function(e){
                scrollLock.set(0);
            });

            this.addEventListener("scrollToBottom", function(e){
                if(! scrollLock.value){
                    scrollLock.set(1);

                    this.renderModel.rock();

                    e.stopPropagation();

                }
            });

            this.addEventListener("beforeactived", function(e){
                this.scrollEnable = 1;
            });

            // 以下方法调用元素方法

            this._registerInnerMethod(['hide', 'show', 'feed', 'isFirstDataRequestRender', 'el', 'renderContainer', 'beforeRequest', 'freeze', 'melt', 'onreset',  'reset', 'url', 'data', 'cgiCount'], this.renderModel);

        },

        refresh: function(){
            this.reset();
            this.renderModel.dataCache = [];
            this.renderModel.reset();

            this.rock();
        },

        active: function(e){
            // 如果第一次还要render
            var rendered = this.get("rendered");

            if(! rendered.value){
                // 加上去
                scrollHelper.addModel(this);

                rendered.set(1);
            }

            //this.renderModel.reset();
            this.renderModel.rock();

        },

        unactive: function(e){
            this.scrollEnable = 0;
        }

    });

    Model.external("ScrollModel", ScrollModel);
})();


text:
import React from 'react';
import HeaderStyle from './HeaderStyle';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import { logout } from '../../containers/AuthPage/actions';

class Header extends React.Component { // eslint-disable-line react/prefer-stateless-function
  constructor(props) {
    super(props);
    this.logout = this.logout.bind(this);
  }
  logout() {
    this.props.Logout();
  }
  render() {
    const { addTask } = this.props;
    return (
      <HeaderStyle className="icon-bar">

          <Link to="/"></Link>
          <Link to="/user"></Link>
          <Link to="/user"></Link>

      </HeaderStyle>
    );
  }
}

function mapDispatchToProps(dispatch) {
  return {
    Logout: () => { dispatch(logout()); },
  };
}

export default connect(null, mapDispatchToProps)(Header);


text:
from django.core.urlresolvers import reverse
from filizver.entry.plugins import EntryPoint
from .forms import VideoForm

class VideoEntryPlugin(EntryPoint):
    name = 'video'
    title = 'Video'
    form_class = VideoForm
    link = reverse('filizver:video_create')


text:
package org.eclipse.rdf4j.rio.nquads;

import java.io.IOException;
import java.io.InputStream;

import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.query.QueryResults;
import org.eclipse.rdf4j.rio.RDFHandlerException;
import org.eclipse.rdf4j.rio.RDFParseException;

public class NQuadsWriterBackgroundTest extends AbstractNQuadsWriterTest {

	public NQuadsWriterBackgroundTest() {
		super(new NQuadsWriterFactory(), new NQuadsParserFactory());
	}

	@Override
	protected Model parse(InputStream reader, String baseURI)
			throws RDFParseException, RDFHandlerException, IOException {
		return QueryResults
				.asModel(QueryResults.parseGraphBackground(reader, baseURI, rdfParserFactory.getRDFFormat(),
						null));
	}

}


text:
/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			aprillibrary.h
  \date			Jan 2013
  \author		TNick

  \brief		Contains the definition for AprilLibrary class

*//*

 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Please read COPYING and README files in root folder
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef __APRILLIBRARY_INC__
#define __APRILLIBRARY_INC__
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include    <april/april.h>
#include    <QObject>
#include    <QSettings>
#include    <QMap>
#include    <libbbb/1/list2d.h>

/*  INCLUDES    ============================================================ */
//
//
//
//
/*  DEFINITIONS    --------------------------------------------------------- */

class	AprilPluginInterf;
class	AprilPluginLoader;

namespace   april    {

class	World;
class	Factory;
class	WorldFactory;

//! callback used to create factories
/**
*	The callback must provide a reference to the caller. The reference is
*	owned by the Factory.
*/
typedef Factory *		(*FactoryCreator)	( World * w, const QString & s_name );

/*  DEFINITIONS    ========================================================= */
//
//
//
//
/*  CLASS    --------------------------------------------------------------- */

/**
*	@brief	Represents the root structure for the library
*/
class
	APRILSHARED_EXPORT
	AprilLibrary		: public QObject, public MemTrack	{
	APRIL_OBJECT
	BBM_TRACK( AprilLibrary );

	//
	//
	//
	//
	/*  DEFINITIONS    ----------------------------------------------------- */

	friend class World;
	friend class WorldFactory;

public:

	//! entire set of properties
	struct		LibProps			{

		//! save to settings
		void save ( QSettings & s );

		//! load from settings
		void load ( QSettings & s );
	};

	/*  DEFINITIONS    ===================================================== */
	//
	//
	//
	//
	/*  DATA    ------------------------------------------------------------ */

private:

	//! the properties
	LibProps						props_;

	//! associated worlds
	List2Dh							worlds_;

	//! list of loaded plug-ins
	List2Dh							plugins_;

	//! default world
	World *							def_world_;

	//! world factories
	QMap<QString,WorldFactory*>		world_factories_;

	//! factories creators
	QMap<QString,FactoryCreator>	factories_src_;

	//! the one and only instance
	static AprilLibrary *			uniq_;

	/*  DATA    ============================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ------------------------------------------------------- */

public:

	/**
	*	@brief	constructor;
	*/
	AprilLibrary			( QObject * parent = NULL );

	/**
	*	@brief	destructor;
	*/
	virtual					~AprilLibrary		( void );

	/**
	*	@brief	the one and only instance
	*/
	static AprilLibrary *	unique				( void )
	{ return uniq_; }

	/* ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo */
	/** @name Properties related functionality
	 */
	///@{

public:

	/**
	*	@brief	load properties from permanent storage
	*
	*	The constructor automatically loads properties
	*/
	void					loadProps			( void );

	/**
	*	@brief	save properties to permanent storage
	*
	*	Changes to properties need to be explicitly saved
	*/
	void					saveProps			( void );

	//! the properties
	static LibProps &		properties			( void )
	{ Q_ASSERT( uniq_ != NULL ); return uniq_->props_; }

	///@}
	/* ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo */

	/* ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo */
	/** @name World related functionality
	 */
	///@{

public:

	//! tell if an world is inside the chain
	static bool		hasWorld			(
			World *			world
			);

	//! remove a world
	static void		remWorld			(
			World *			world
			);

	//! first world
	static World *			firstWorld		( void );

	//! get a unique name for a world
	static QString			uniqueWorldName	( const QString & pattern );

	//! the number of worlds
	static int				worldsCount		( void )
	{ return uniq_->worlds_.count(); }

	//! find a world by its name
	static World *			findWorld		( const QString & s_name );

	//! get a world at aspecific index
	static World *			worldAt			( int i );

	//! seta a world as the current world
	static bool				setCrtWorld		(  World * new_crt );

	//! tell the current world
	static World *			crtWorld		( void )
	{ return uniq_->def_world_; }

protected:

	/**
	*	@brief	add a world
	*
	*	Do not use directly. This method is used by World constructor to
	*	signal the parent library.
	*/
	static void		addWorld				(
			World *			world
			);

private:

	//! adds the world
	void			internalAddWorld		( World * world );

	//! removes the world
	void			internalRemWorld		( World * world );

	///@}
	/* ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo */

	/* ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo */
	/** @name Plug-in related functionality
	 */
	///@{

public:

	//! load a plug-in from the file indicated (may be relative to current directory)
	static AprilPluginInterf *	loadPlugIn			( const QString & s );

	//! unload a plug-in based on file name (may be relative to current directory)
	static bool					unloadPlugIn		( const QString & s );

	//! unload a plug-in
	static bool					unloadPlugIn		( AprilPluginInterf * p );

	//! unload a plug-in
	static bool					unloadPlugIn		( AprilPluginLoader * pld );

	//! get the plug-in for a certain file (must be absolute path)
	static AprilPluginInterf *	findPlugIn			( const QString & s );

	//! get the plug-in loader for a certain file (must be absolute path)
	static AprilPluginLoader *	findPlugInLoader	( const QString & s );

	//! get the plug-in for a certain file (may be relative to current directory)
	static AprilPluginInterf *	findPlugInRel		( const QString & s );

	//! get the plug-in loader for a certain file (may be relative to current directory)
	static AprilPluginLoader *	findPlugInLoaderRel	( const QString & s );

	//! first plug-in
	static AprilPluginLoader *	firstPlugin			( void );

	//! the number of plug-ins
	static int					pluginsCount		( void )
	{ return uniq_->plugins_.count(); }

	//! get a plug-in at aspecific index
	static AprilPluginLoader *	pluginAt			( int i );

	///@}
	/* ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo */

	/* ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo */
	/** @name Factory related functionality
	 */
	///@{

public:

	//! register a callback for a particular Factory
	static bool					registerFactory		(
			const QString &			s_name,
			FactoryCreator			callback
			);

	//! unregister a callback for a particular Factory
	static bool					unregisterFactory		(
			const QString &			s_name,
			FactoryCreator			callback
			);

	//! get the name used by the defalt WorldFactory
	static QString				defaultWorldFactoryName	( void );

	//! get the factory that coresponds to given string
	static Factory *			factoryForString	(
			World *					w,
			const QString &			s_name
			);

	//! find a world factory in internal list
	/**
	 * The method does not add a reference; the caller must do that itself
	 * @param s the string to search
	 * @return the pointer or NULL if not found
	 */
	static WorldFactory *		findWorldFactory		(
			const QString &			s
			);

protected:

	//! adds a world factory to internal list
	static bool					addWorldFactory		(
			const QString &			s,
			WorldFactory *			inst
			);

	//! removes a world factory from internal list
	static bool					remWorldFactory		(
			const QString &			s,
			WorldFactory *			inst
			);

private:

	//! factory creator for default worlds
	/**
	 * The caller recieves a reference to the Factory that it should release
	 * at some point
	 * @param s_name ignored
	 * @return the factory instance
	 */
	static Factory *			defaultWorldFactoryCreator	(
			World *				w,
			const QString &		s_name
			);

	//! register build-in factories
	void						registerFactoryCreators		( void );

	///@}
	/* ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo */

	/*  FUNCTIONS    ======================================================= */
	//
	//
	//
	//

};	/*	class AprilLibrary	*/

/*  CLASS    =============================================================== */
//
//
//
//

}   //  namespace   april

//! starts the library
APRILSHARED_EXPORT bool	initAprilLibrary			( void );

//! terminates the libraryl releases resources
APRILSHARED_EXPORT void	endAprilLibrary				( void );

#endif // __APRILLIBRARY_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */


text:
<?php declare(strict_types = 1);

namespace PHPStan\Type\Php;

use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Name;
use PHPStan\Analyser\Scope;
use PHPStan\Analyser\SpecifiedTypes;
use PHPStan\Analyser\TypeSpecifier;
use PHPStan\Analyser\TypeSpecifierAwareExtension;
use PHPStan\Analyser\TypeSpecifierContext;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Type\Constant\ConstantBooleanType;
use PHPStan\Type\Constant\ConstantStringType;
use PHPStan\Type\FunctionTypeSpecifyingExtension;
use PHPStan\Type\ObjectType;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\StaticType;
use PHPStan\Type\StringType;

class IsAFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension
{

	/** @var \PHPStan\Analyser\TypeSpecifier */
	private $typeSpecifier;

	public function isFunctionSupported(FunctionReflection $functionReflection, FuncCall $node, TypeSpecifierContext $context): bool
	{
		return strtolower($functionReflection->getName()) === 'is_a'
			&& isset($node->args[0])
			&& isset($node->args[1])
			&& !$context->null();
	}

	public function specifyTypes(FunctionReflection $functionReflection, FuncCall $node, Scope $scope, TypeSpecifierContext $context): SpecifiedTypes
	{
		if ($context->null()) {
			throw new \PHPStan\ShouldNotHappenException();
		}

		$classNameArgExpr = $node->args[1]->value;
		$classNameArgExprType = $scope->getType($classNameArgExpr);
		if (
			$classNameArgExpr instanceof ClassConstFetch
			&& $classNameArgExpr->class instanceof Name
			&& is_string($classNameArgExpr->name)
			&& strtolower($classNameArgExpr->name) === 'class'
		) {
			$className = $scope->resolveName($classNameArgExpr->class);
			if (strtolower($classNameArgExpr->class->toString()) === 'static') {
				$objectType = new StaticType($className);
			} else {
				$objectType = new ObjectType($className);
			}
			$types = $this->typeSpecifier->create($node->args[0]->value, $objectType, $context);
		} elseif ($classNameArgExprType instanceof ConstantStringType) {
			$objectType = new ObjectType($classNameArgExprType->getValue());
			$types = $this->typeSpecifier->create($node->args[0]->value, $objectType, $context);
		} elseif ($context->true()) {
			$objectType = new ObjectWithoutClassType();
			$types = $this->typeSpecifier->create($node->args[0]->value, $objectType, $context);
		} else {
			$types = new SpecifiedTypes();
		}

		if (isset($node->args[2]) && $context->true()) {
			if (!$scope->getType($node->args[2]->value)->isSuperTypeOf(new ConstantBooleanType(true))->no()) {
				$types = $types->intersectWith($this->typeSpecifier->create($node->args[0]->value, new StringType(), $context));
			}
		}

		return $types;
	}

	public function setTypeSpecifier(TypeSpecifier $typeSpecifier): void
	{
		$this->typeSpecifier = $typeSpecifier;
	}

}