text:
/**
 * 拓展对象
 */
exports.extend = function extend(target) {
    var sources = Array.prototype.slice.call(arguments, 1);

    for (var i = 0; i < sources.length; i += 1) {
        var source = sources[i];
        for (var key in source) {
            if (source.hasOwnProperty(key)) {
                target[key] = source[key];
            }
        }
    }

    return target;
};


text:
```bash
composer update
```

### Lint and test code

```bash
composer lint
composer test
```

redpajama_set_name: RedPajamaGithub


text:
class ChangeCoronavirusAnnouncementsPathToUrl < ActiveRecord::Migration[6.0]
  def change
    rename_column :coronavirus_announcements, :path, :url
  end
end


text:
import * as canny from 'canny';
import * as whisker from 'canny/mod/whisker';
import { Carousel } from './carousel';
import { icons } from '../../misc/icons'

const template = require('./slider.html'),
    mySlider = Carousel();

let sliderNode;
/**
 * hide the slider
 */
export function hide () {
    if (sliderNode) {
        sliderNode.remove();
        sliderNode = null;
    }
}

/**
 * show the slider
 * @param listOfNodes
 * @param index
 */
export function show (listOfNodes, index) {
    sliderNode = document.createElement('div');
    sliderNode.className = 'assetSlider';
    sliderNode.innerHTML = template;

    whisker.add(sliderNode, function (fc) {
        fc({
            // sliderId and className are only an example - this could already be defined in the template
            sliderId : 'assetSlider',
            className : 'assetSlider-slider',
            imageHandler : function (imageContainerNode) {
                listOfNodes.forEach(function (img, idx) {
                    const div = document.createElement('div');
                    div.className = 'c-item img_' + idx + ' slider-screenshot';
                    div.appendChild(img);
                    imageContainerNode.appendChild(div);
                });
            }
        })
    });
    // apply canny to the view and canny will initialize the modules above
    canny.cannyParse.apply({
        icon : icons,
        slider : mySlider,
        sliderCloseButton : {
            add : (node) => {
            	node.addEventListener('click', () => {
                    sliderNode.remove();
                    sliderNode = null;
            	})
            }
        }
    }, [sliderNode]);

    document.body.appendChild(sliderNode);
    mySlider.initializeSlider('assetSlider');
    if (index && index !== -1) {
        mySlider.slideToIndex('assetSlider', index);
    }
}


text:
define([
    "dojo/_base/declare",
    "blocks/Exception"
], function (declare, Exception) {
    /**
     * @class jazzHands.query.exception.InvalidArgumentType
     * @mixes blocks.Exception
     */
    return declare([Exception], {
        error: "err:FORG0006",
        message: "Invalid argument type",
        see: "http://www.w3.org/TR/xpath-functions/#ERRFORG0006"
    });
});


text:
class GURL;

namespace mojo {
class ApplicationDelegate;
}

namespace content {

// MojoShellContext hosts the browser's ApplicationManager, coordinating
// app registration and interconnection.
class CONTENT_EXPORT MojoShellContext
    : public NON_EXPORTED_BASE(mojo::shell::ApplicationManager::Delegate) {
 public:
  using StaticApplicationMap =
      std::map<GURL, base::Callback<scoped_ptr<mojo::ApplicationDelegate>()>>;

  MojoShellContext();
  ~MojoShellContext() override;

  // Connects an application at |url| and gets a handle to its exposed services.
  // This is only intended for use in browser code that's not part of some Mojo
  // application. May be called from any thread. |requestor_url| is given to
  // the target application as the requestor's URL upon connection.
  static void ConnectToApplication(
      const GURL& url,
      const GURL& requestor_url,
      mojo::InterfaceRequest<mojo::ServiceProvider> request,
      mojo::ServiceProviderPtr exposed_services,
      mojo::CapabilityFilterPtr filter);

  static void SetApplicationsForTest(const StaticApplicationMap* apps);

 private:
  class Proxy;
  friend class Proxy;

  void ConnectToApplicationOnOwnThread(
      const GURL& url,
      const GURL& requestor_url,
      mojo::InterfaceRequest<mojo::ServiceProvider> request,
      mojo::ServiceProviderPtr exposed_services,
      mojo::CapabilityFilterPtr filter);

  // mojo::shell::ApplicationManager::Delegate:
  GURL ResolveMappings(const GURL& url) override;
  GURL ResolveMojoURL(const GURL& url) override;
  bool CreateFetcher(
      const GURL& url,
      const mojo::shell::Fetcher::FetchCallback& loader_callback) override;

  static base::LazyInstance<scoped_ptr<Proxy>> proxy_;

  scoped_ptr<mojo::shell::ApplicationManager> application_manager_;

  DISALLOW_COPY_AND_ASSIGN(MojoShellContext);
};

}  // namespace content

#endif  // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_


text:
/* eslint no-magic-numbers: off */
import * as clock from '../ClockActions'
import configureStore from 'redux-mock-store'
import emptyObj from 'empty/object'
import lolex from 'lolex'
import { merge } from 'lodash'

const STATES = {
  stopwatch: {
    clock: {
      elapsedTime: 0,
      lastTick: 0,
      mode: 'CLOCK_MODE_STOPWATCH',
      running: true,
      startedAt: 0,
      timerValue: 5000
    }
  },
  timer: {
    clock: {
      elapsedTime: 0,
      lastTick: 0,
      mode: 'CLOCK_MODE_TIMER',
      running: true,
      startedAt: 0,
      timerDuration: 5000,
      timerValue: 5000
    }
  }
}
const mockStore = configureStore()

describe('ClockActions', () => {
  describe('#pauseClock', () => {
    it('returns a payload', () => {
      const result = clock.pauseClock()
      expect(result.type).toBe('CLOCK_PAUSED')
      expect(result.payload).toBe(emptyObj)
    })
  })

  describe('#resetClock', () => {
    it('resets the clock', () => {
      const mockClock = lolex.install()
      const store = mockStore(STATES.stopwatch)
      clock.resetClock()(store.dispatch, store.getState)
      let actions = store.getActions()
      expect(actions.length).toBe(1)
      expect(actions[0].type).toBe('CLOCK_RESET')
      expect(actions[0].payload).toMatchSnapshot()
      mockClock.tick(clock.IntervalValue)
      actions = store.getActions()
      expect(actions.length).toBe(1)
      mockClock.uninstall()
    })

    it('resets the timer', () => {
      const mockClock = lolex.install()
      const store = mockStore(STATES.timer)
      clock.resetClock()(store.dispatch, store.getState)
      let actions = store.getActions()
      expect(actions[0].type).toBe('CLOCK_RESET')
      expect(actions[0].payload).toMatchSnapshot()
      mockClock.tick(clock.IntervalValue)
      actions = store.getActions()
      expect(actions.length).toBe(1)
      mockClock.uninstall()
    })
  })

  describe('#startClock', () => {
    it('starts the stopwatch', () => {
      const mockClock = lolex.install()
      const store = mockStore(STATES.stopwatch)
      clock.startClock()(store.dispatch, store.getState)
      let actions = store.getActions()
      expect(actions.length).toBe(1)
      expect(actions[0].type).toBe('CLOCK_STARTED')
      expect(actions[0].payload).toMatchSnapshot()
      mockClock.tick(clock.IntervalValue)
      actions = store.getActions()
      expect(actions.length).toBe(2)
      expect(actions[1].type).toBe('CLOCK_TICK')
      expect(actions[1].payload).toMatchSnapshot()
      mockClock.uninstall()
    })

    it('starts the timer', () => {
      const mockClock = lolex.install()
      const store = mockStore(STATES.timer)
      clock.startClock()(store.dispatch, store.getState)
      let actions = store.getActions()
      expect(actions[0].type).toBe('CLOCK_STARTED')
      expect(actions[0].payload).toMatchSnapshot()
      mockClock.tick(clock.IntervalValue)
      actions = store.getActions()
      expect(actions.length).toBe(2)
      expect(actions[1].type).toBe('CLOCK_TICK')
      expect(actions[1].payload).toMatchSnapshot()
      mockClock.uninstall()
    })
  })

  describe('#changeTimerValue', () => {
    it('resets and updates the timer value when in stopwatch mode', () => {
      const store = mockStore(STATES.stopwatch)
      clock.changeTimerValue()(store.dispatch, store.getState)
      const action = store.getActions()[0]
      expect(action.type).toBe('CLOCK_TIMER_CHANGED')
      expect(action.payload).toMatchSnapshot()
    })

    it('resets and updates the timer value when in timer mode', () => {
      const store = mockStore(STATES.timer)
      clock.changeTimerValue(STATES.timer.clock.timerValue)(store.dispatch, store.getState)
      const action = store.getActions()[0]
      expect(action.type).toBe('CLOCK_TIMER_CHANGED')
      expect(action.payload).toMatchSnapshot()
    })
  })

  describe('#stopwatchMode', () => {
    it('resets the clock and changes the mode from stopwatch to stopwatch', () => {
      const store = mockStore(STATES.stopwatch)
      store.dispatch(clock.stopwatchMode())
      const action = store.getActions()[0]
      expect(action.type).toBe('CLOCK_MODE_CHANGED')
      expect(action.payload).toMatchSnapshot()
    })

    it('resets the clock and changes the mode from timer to stopwatch', () => {
      const store = mockStore(STATES.timer)
      store.dispatch(clock.stopwatchMode())
      const action = store.getActions()[0]
      expect(action.type).toBe('CLOCK_MODE_CHANGED')
      expect(action.payload).toMatchSnapshot()
    })
  })

  describe('#timerMode', () => {
    it('resets the clock and changes the mode from stopwatch to timer', () => {
      const store = mockStore(STATES.stopwatch)
      clock.timerMode()(store.dispatch, store.getState)
      const action = store.getActions()[0]
      expect(action.type).toBe('CLOCK_MODE_CHANGED')
      expect(action.payload).toMatchSnapshot()
    })

    it('resets the clock and changes the mode from timer to timer', () => {
      const store = mockStore(STATES.timer)
      clock.timerMode()(store.dispatch, store.getState)
      const action = store.getActions()[0]
      expect(action.type).toBe('CLOCK_MODE_CHANGED')
      expect(action.payload).toMatchSnapshot()
    })
  })

  describe('#toggleClock', () => {
    it('starts the clock when not previously started', () => {
      const mockClock = lolex.install()
      const store = mockStore(merge({}, STATES.stopwatch, {
        clock: {
          running: false,
          startedAt: null
        }
      }))
      clock.toggleClock()(store.dispatch, store.getState)
      const action = store.getActions()[0]
      expect(action.type).toBe('CLOCK_STARTED')
      expect(action.payload).toMatchSnapshot()
      mockClock.uninstall()
    })

    it('pauses the clock when running', () => {
      const mockClock = lolex.install()
      const store = mockStore(STATES.stopwatch)
      clock.toggleClock()(store.dispatch, store.getState)
      const action = store.getActions()[0]
      expect(action.type).toBe('CLOCK_PAUSED')
      expect(action.payload).toMatchSnapshot()
      mockClock.uninstall()
    })

    it('unpauses the clock when paused', () => {
      const store = mockStore(merge({}, STATES.stopwatch, {
        clock: {
          running: false
        }
      }))
      clock.toggleClock()(store.dispatch, store.getState)
      const action = store.getActions()[0]
      expect(action.type).toBe('CLOCK_UNPAUSED')
      expect(action.payload).toMatchSnapshot()
    })
  })

  describe('#clockTick', () => {
    it('does nothing if the clock is not running', () => {
      const store = mockStore(merge({}, STATES.stopwatch, {
        clock: {
          running: false
        }
      }))
      clock.clockTick(store.dispatch, store.getState)
      const action = store.getActions()[0]
      expect(action).not.toBeDefined()
    })

    it('recalculates the clock state when running', () => {
      const mockClock = lolex.install()
      mockClock.tick(clock.IntervalValue * 20)
      const store = mockStore(STATES.stopwatch)
      mockClock.tick(clock.IntervalValue * 20)
      clock.clockTick(store.dispatch, store.getState)
      const action = store.getActions()[0]
      expect(action.payload).toMatchSnapshot()
      mockClock.uninstall()
    })

    it('recalculates the timer state when running', () => {
      const mockClock = lolex.install()
      mockClock.tick(clock.IntervalValue * 20)
      const store = mockStore(STATES.timer)
      mockClock.tick(clock.IntervalValue * 20)
      clock.clockTick(store.dispatch, store.getState)
      const action = store.getActions()[0]
      expect(action.payload).toMatchSnapshot()
      mockClock.uninstall()
    })

    it('determines when the timer has expired', () => {
      const mockClock = lolex.install()
      mockClock.tick(clock.IntervalValue * 20)
      const store = mockStore(merge({}, STATES.timer, {
        clock: {
          timerDuration: 500,
          timerValue: 500
        }
      }))
      mockClock.tick(clock.IntervalValue * 20)
      clock.clockTick(store.dispatch, store.getState)
      const action = store.getActions()[0]
      expect(action.payload.hasTimerElapsed).toBeTruthy()
      mockClock.uninstall()
    })
  })

  describe('#pauseClock', () => {
    it('pauses the clock', () => {
      const store = mockStore(STATES.stopwatch)
      store.dispatch(clock.pauseClock())
      const action = store.getActions()[0]
      expect(action.type).toBe('CLOCK_PAUSED')
      expect(action.payload).toMatchSnapshot()
    })
  })
})


text:
require File.dirname(__FILE__) + '/../../spec_helper'

describe "File.link" do
  before :each do
    @file = "test.txt"
    @link = "test.lnk"
    File.delete(@link) if File.exist?(@link)
    File.delete(@file) if File.exist?(@file)
    File.open(@file,"w+")
  end

  after :each do
    File.unlink(@link) if File.exist?(@link)
    File.delete(@file) if File.exist?(@file)
    @link = nil
  end

  platform_is_not :windows do
    it "link a file with another" do
      File.link(@file, @link).should == 0
      File.exists?(@link).should == true
      File.identical?(@file, @link).should == true
    end

    it "raises an Errno::EEXIST if the target already exists" do
      File.link(@file, @link)
      lambda { File.link(@file, @link) }.should raise_error(Errno::EEXIST)
    end

    it "raises an ArgumentError if not passed two arguments" do
      lambda { File.link                      }.should raise_error(ArgumentError)
      lambda { File.link(@file)               }.should raise_error(ArgumentError)
      lambda { File.link(@file, @link, @file) }.should raise_error(ArgumentError)
    end

    it "raises a TypeError if not passed String types" do
      lambda { File.link(@file, nil) }.should raise_error(TypeError)
      lambda { File.link(@file, 1)   }.should raise_error(TypeError)
    end
  end
end


text:
package com.sun.media.sound;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.RandomAccessFile;

/**
 * Resource Interchange File Format (RIFF) stream encoder.
 *
 * @author Karl Helgason
 */
public final class RIFFWriter extends OutputStream {

    private interface RandomAccessWriter {

        void seek(long chunksizepointer) throws IOException;

        long getPointer() throws IOException;

        void close() throws IOException;

        void write(int b) throws IOException;

        void write(byte[] b, int off, int len) throws IOException;

        void write(byte[] bytes) throws IOException;

        long length() throws IOException;

        void setLength(long i) throws IOException;
    }

    private static class RandomAccessFileWriter implements RandomAccessWriter {

        RandomAccessFile raf;

        RandomAccessFileWriter(File file) throws FileNotFoundException {
            this.raf = new RandomAccessFile(file, "rw");
        }

        RandomAccessFileWriter(String name) throws FileNotFoundException {
            this.raf = new RandomAccessFile(name, "rw");
        }

        @Override
        public void seek(long chunksizepointer) throws IOException {
            raf.seek(chunksizepointer);
        }

        @Override
        public long getPointer() throws IOException {
            return raf.getFilePointer();
        }

        @Override
        public void close() throws IOException {
            raf.close();
        }

        @Override
        public void write(int b) throws IOException {
            raf.write(b);
        }

        @Override
        public void write(byte[] b, int off, int len) throws IOException {
            raf.write(b, off, len);
        }

        @Override
        public void write(byte[] bytes) throws IOException {
            raf.write(bytes);
        }

        @Override
        public long length() throws IOException {
            return raf.length();
        }

        @Override
        public void setLength(long i) throws IOException {
            raf.setLength(i);
        }
    }

    private static class RandomAccessByteWriter implements RandomAccessWriter {

        byte[] buff = new byte[32];
        int length = 0;
        int pos = 0;
        byte[] s;
        final OutputStream stream;

        RandomAccessByteWriter(OutputStream stream) {
            this.stream = stream;
        }

        @Override
        public void seek(long chunksizepointer) throws IOException {
            pos = (int) chunksizepointer;
        }

        @Override
        public long getPointer() throws IOException {
            return pos;
        }

        @Override
        public void close() throws IOException {
            stream.write(buff, 0, length);
            stream.close();
        }

        @Override
        public void write(int b) throws IOException {
            if (s == null)
                s = new byte[1];
            s[0] = (byte)b;
            write(s, 0, 1);
        }

        @Override
        public void write(byte[] b, int off, int len) throws IOException {
            int newsize = pos + len;
            if (newsize > length)
                setLength(newsize);
            int end = off + len;
            for (int i = off; i < end; i++) {
                buff[pos++] = b[i];
            }
        }

        @Override
        public void write(byte[] bytes) throws IOException {
            write(bytes, 0, bytes.length);
        }

        @Override
        public long length() throws IOException {
            return length;
        }

        @Override
        public void setLength(long i) throws IOException {
            length = (int) i;
            if (length > buff.length) {
                int newlen = Math.max(buff.length << 1, length);
                byte[] newbuff = new byte[newlen];
                System.arraycopy(buff, 0, newbuff, 0, buff.length);
                buff = newbuff;
            }
        }
    }
    private int chunktype = 0; // 0=RIFF, 1=LIST; 2=CHUNK
    private RandomAccessWriter raf;
    private final long chunksizepointer;
    private final long startpointer;
    private RIFFWriter childchunk = null;
    private boolean open = true;
    private boolean writeoverride = false;

    public RIFFWriter(String name, String format) throws IOException {
        this(new RandomAccessFileWriter(name), format, 0);
    }

    public RIFFWriter(File file, String format) throws IOException {
        this(new RandomAccessFileWriter(file), format, 0);
    }

    public RIFFWriter(OutputStream stream, String format) throws IOException {
        this(new RandomAccessByteWriter(stream), format, 0);
    }

    private RIFFWriter(RandomAccessWriter raf, String format, int chunktype)
            throws IOException {
        if (chunktype == 0)
            if (raf.length() != 0)
                raf.setLength(0);
        this.raf = raf;
        if (raf.getPointer() % 2 != 0)
            raf.write(0);

        if (chunktype == 0)
            raf.write("RIFF".getBytes("ascii"));
        else if (chunktype == 1)
            raf.write("LIST".getBytes("ascii"));
        else
            raf.write((format + "    ").substring(0, 4).getBytes("ascii"));

        chunksizepointer = raf.getPointer();
        this.chunktype = 2;
        writeUnsignedInt(0);
        this.chunktype = chunktype;
        startpointer = raf.getPointer();
        if (chunktype != 2)
            raf.write((format + "    ").substring(0, 4).getBytes("ascii"));

    }

    public void seek(long pos) throws IOException {
        raf.seek(pos);
    }

    public long getFilePointer() throws IOException {
        return raf.getPointer();
    }

    public void setWriteOverride(boolean writeoverride) {
        this.writeoverride = writeoverride;
    }

    public boolean getWriteOverride() {
        return writeoverride;
    }

    @Override
    public void close() throws IOException {
        if (!open)
            return;
        if (childchunk != null) {
            childchunk.close();
            childchunk = null;
        }

        int bakchunktype = chunktype;
        long fpointer = raf.getPointer();
        raf.seek(chunksizepointer);
        chunktype = 2;
        writeUnsignedInt(fpointer - startpointer);

        if (bakchunktype == 0)
            raf.close();
        else
            raf.seek(fpointer);
        open = false;
        raf = null;
    }

    @Override
    public void write(int b) throws IOException {
        if (!writeoverride) {
            if (chunktype != 2) {
                throw new IllegalArgumentException(
                        "Only chunks can write bytes!");
            }
            if (childchunk != null) {
                childchunk.close();
                childchunk = null;
            }
        }
        raf.write(b);
    }

    @Override
    public void write(byte[] b, int off, int len) throws IOException {
        if (!writeoverride) {
            if (chunktype != 2) {
                throw new IllegalArgumentException(
                        "Only chunks can write bytes!");
            }
            if (childchunk != null) {
                childchunk.close();
                childchunk = null;
            }
        }
        raf.write(b, off, len);
    }

    public RIFFWriter writeList(String format) throws IOException {
        if (chunktype == 2) {
            throw new IllegalArgumentException(
                    "Only LIST and RIFF can write lists!");
        }
        if (childchunk != null) {
            childchunk.close();
            childchunk = null;
        }
        childchunk = new RIFFWriter(this.raf, format, 1);
        return childchunk;
    }

    public RIFFWriter writeChunk(String format) throws IOException {
        if (chunktype == 2) {
            throw new IllegalArgumentException(
                    "Only LIST and RIFF can write chunks!");
        }
        if (childchunk != null) {
            childchunk.close();
            childchunk = null;
        }
        childchunk = new RIFFWriter(this.raf, format, 2);
        return childchunk;
    }

    // Write ASCII chars to stream
    public void writeString(String string) throws IOException {
        byte[] buff = string.getBytes();
        write(buff);
    }

    // Write ASCII chars to stream
    public void writeString(String string, int len) throws IOException {
        byte[] buff = string.getBytes();
        if (buff.length > len)
            write(buff, 0, len);
        else {
            write(buff);
            for (int i = buff.length; i < len; i++)
                write(0);
        }
    }

    // Write 8 bit signed integer to stream
    public void writeByte(int b) throws IOException {
        write(b);
    }

    // Write 16 bit signed integer to stream
    public void writeShort(short b) throws IOException {
        write((b >>> 0) & 0xFF);
        write((b >>> 8) & 0xFF);
    }

    // Write 32 bit signed integer to stream
    public void writeInt(int b) throws IOException {
        write((b >>> 0) & 0xFF);
        write((b >>> 8) & 0xFF);
        write((b >>> 16) & 0xFF);
        write((b >>> 24) & 0xFF);
    }

    // Write 64 bit signed integer to stream
    public void writeLong(long b) throws IOException {
        write((int) (b >>> 0) & 0xFF);
        write((int) (b >>> 8) & 0xFF);
        write((int) (b >>> 16) & 0xFF);
        write((int) (b >>> 24) & 0xFF);
        write((int) (b >>> 32) & 0xFF);
        write((int) (b >>> 40) & 0xFF);
        write((int) (b >>> 48) & 0xFF);
        write((int) (b >>> 56) & 0xFF);
    }

    // Write 8 bit unsigned integer to stream
    public void writeUnsignedByte(int b) throws IOException {
        writeByte((byte) b);
    }

    // Write 16 bit unsigned integer to stream
    public void writeUnsignedShort(int b) throws IOException {
        writeShort((short) b);
    }

    // Write 32 bit unsigned integer to stream
    public void writeUnsignedInt(long b) throws IOException {
        writeInt((int) b);
    }
}


text:
@implementation FaceppFaceset

-(FaceppResult*) addFaceWithFacesetName:(NSString*)facesetName orFacesetId:(NSString*)facesetId andFaceId:(NSArray*)faceId {
    NSMutableArray *params = [NSMutableArray arrayWithCapacity:10];
    if ((faceId != nil) && ([faceId count]>0)) {
        [params addObject:@"face_id"];
        NSMutableString *faces = [NSMutableString stringWithString:[faceId objectAtIndex:0]];
        for (int i=1; i<[faceId count]; i++)
            [faces appendFormat:@",%@", [faceId objectAtIndex:i]];
        [params addObject:faces];
    }
    if (facesetId != nil) {
        [params addObject:@"faceset_id"];
        [params addObject:facesetId];
    }
    if (facesetName != nil) {
        [params addObject:@"faceset_name"];
        [params addObject:facesetName];
    }
    return [FaceppClient requestWithMethod:@"faceset/add_face" params:params];
}

-(FaceppResult*) create {
    return [FaceppClient requestWithMethod:@"faceset/create" params:nil];
}

-(FaceppResult*) createWithFacesetName:(NSString*)facesetName andFaceId:(NSArray*)faceId andTag:(NSString*)tag {
    NSMutableArray *params = [NSMutableArray arrayWithCapacity:10];
    if (facesetName != nil) {
        [params addObject:@"faceset_name"];
        [params addObject:facesetName];
    }
    if (tag != nil) {
        [params addObject:@"tag"];
        [params addObject:tag];
    }
    if ((faceId != nil) && ([faceId count]>0)) {
        [params addObject:@"face_id"];
        NSMutableString *faces = [NSMutableString stringWithString:[faceId objectAtIndex:0]];
        for (int i=1; i<[faceId count]; i++)
            [faces appendFormat:@",%@", [faceId objectAtIndex:i]];
        [params addObject:faces];
    }
    return [FaceppClient requestWithMethod:@"faceset/create" params:params];
}

-(FaceppResult*) deleteWithFacesetName:(NSString*)facesetName orFacesetId:(NSString*)facesetId {
    NSMutableArray *params = [NSMutableArray arrayWithCapacity:10];
    if (facesetId != nil) {
        [params addObject:@"faceset_id"];
        [params addObject:facesetId];
    }
    if (facesetName != nil) {
        [params addObject:@"faceset_name"];
        [params addObject:facesetName];
    }
    return [FaceppClient requestWithMethod:@"faceset/delete" params:params];
}

-(FaceppResult*) getInfoWithFacesetName:(NSString*)facesetName orFacesetId:(NSString*)facesetId {
    NSMutableArray *params = [NSMutableArray arrayWithCapacity:10];
    if (facesetId != nil) {
        [params addObject:@"faceset_id"];
        [params addObject:facesetId];
    }
    if (facesetName != nil) {
        [params addObject:@"faceset_name"];
        [params addObject:facesetName];
    }
    return [FaceppClient requestWithMethod:@"faceset/get_info" params:params];
}

-(FaceppResult*) removeAllFaceWithFacesetName:(NSString *)facesetName orFacesetId:(NSString *)facesetId {
    return [self removeFaceWithFacesetName:facesetName orFacesetId:facesetId andFaceId:[NSArray arrayWithObject:@"all"]];
}

-(FaceppResult*) removeFaceWithFacesetName:(NSString*)facesetName orFacesetId:(NSString*)facesetId andFaceId:(NSArray*)faceId {
    NSMutableArray *params = [NSMutableArray arrayWithCapacity:10];
    if (facesetName != nil) {
        [params addObject:@"faceset_name"];
        [params addObject:facesetName];
    }
    if (facesetId != nil) {
        [params addObject:@"faceset_id"];
        [params addObject:facesetId];
    }
    if ((faceId != nil) && ([faceId count]>0)) {
        [params addObject:@"face_id"];
        NSMutableString *faces = [NSMutableString stringWithString:[faceId objectAtIndex:0]];
        for (int i=1; i<[faceId count]; i++)
            [faces appendFormat:@",%@", [faceId objectAtIndex:i]];
        [params addObject:faces];
    }
    return [FaceppClient requestWithMethod:@"faceset/remove_face" params:params];

}

-(FaceppResult*) setInfoWithFacesetName:(NSString*)facesetName orFacesetId:(NSString*)facesetId andName:(NSString*)name andTag:(NSString*)tag {
    NSMutableArray *params = [NSMutableArray arrayWithCapacity:10];
    if (facesetId != nil) {
        [params addObject:@"faceset_id"];
        [params addObject:facesetId];
    }
    if (facesetName != nil) {
        [params addObject:@"faceset_name"];
        [params addObject:facesetName];
    }
    if (name != nil) {
        [params addObject:@"name"];
        [params addObject:name];
    }
    if (tag != nil) {
        [params addObject:@"tag"];
        [params addObject:tag];
    }
    return [FaceppClient requestWithMethod:@"faceset/set_info" params:params];
}

@end


text:
using DScript.Extras;
using DScript.Extras.FunctionProviders;
using NUnit.Framework;
using System.IO;
using System.Linq;

namespace DScript.Test
{
    public class JSTests
    {

        [Test, TestCaseSource("GetTestCases")]
        public void TestFile(string filename)
        {
            var file = File.ReadAllText(filename);
            var engine = new ScriptEngine();
            var loader = new EngineFunctionLoader();
            loader.RegisterFunctions(engine);

            engine.Root.AddChild("result", new ScriptVar(0));

            ScriptException ex = null;

            try
            {
                engine.Execute(file);
            }
            catch(ScriptException e)
            {
                ex = e;
            }

            var result = engine.Root.GetParameter("result");
            var resultAsBool = result.Bool;
            Assert.IsTrue(resultAsBool, ex != null ? ex.Message : string.Empty);
        }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "Used in reflection")]
        private static string[] GetTestCases()
        {
            var files = Directory.EnumerateFiles("Tests", "*.js");
            return files.ToArray();
        }
    }
}


text:
"""The Bernoulli distribution class."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import nn
from tensorflow.python.ops import random_ops
from tensorflow.python.ops.distributions import distribution
from tensorflow.python.ops.distributions import kullback_leibler
from tensorflow.python.ops.distributions import util as distribution_util
from tensorflow.python.util.tf_export import tf_export

@tf_export("distributions.Bernoulli")
class Bernoulli(distribution.Distribution):
  """Bernoulli distribution.

  The Bernoulli distribution with `probs` parameter, i.e., the probability of a
  `1` outcome (vs a `0` outcome).
  """

  def __init__(self,
               logits=None,
               probs=None,
               dtype=dtypes.int32,
               validate_args=False,
               allow_nan_stats=True,
               name="Bernoulli"):
    """Construct Bernoulli distributions.

    Args:
      logits: An N-D `Tensor` representing the log-odds of a `1` event. Each
        entry in the `Tensor` parametrizes an independent Bernoulli distribution
        where the probability of an event is sigmoid(logits). Only one of
        `logits` or `probs` should be passed in.
      probs: An N-D `Tensor` representing the probability of a `1`
        event. Each entry in the `Tensor` parameterizes an independent
        Bernoulli distribution. Only one of `logits` or `probs` should be passed
        in.
      dtype: The type of the event samples. Default: `int32`.
      validate_args: Python `bool`, default `False`. When `True` distribution
        parameters are checked for validity despite possibly degrading runtime
        performance. When `False` invalid inputs may silently render incorrect
        outputs.
      allow_nan_stats: Python `bool`, default `True`. When `True`,
        statistics (e.g., mean, mode, variance) use the value "`NaN`" to
        indicate the result is undefined. When `False`, an exception is raised
        if one or more of the statistic's batch members are undefined.
      name: Python `str` name prefixed to Ops created by this class.

    Raises:
      ValueError: If p and logits are passed, or if neither are passed.
    """
    parameters = dict(locals())
    with ops.name_scope(name) as name:
      self._logits, self._probs = distribution_util.get_logits_and_probs(
          logits=logits,
          probs=probs,
          validate_args=validate_args,
          name=name)
    super(Bernoulli, self).__init__(
        dtype=dtype,
        reparameterization_type=distribution.NOT_REPARAMETERIZED,
        validate_args=validate_args,
        allow_nan_stats=allow_nan_stats,
        parameters=parameters,
        graph_parents=[self._logits, self._probs],
        name=name)

  @staticmethod
  def _param_shapes(sample_shape):
    return {"logits": ops.convert_to_tensor(sample_shape, dtype=dtypes.int32)}

  @property
  def logits(self):
    """Log-odds of a `1` outcome (vs `0`)."""
    return self._logits

  @property
  def probs(self):
    """Probability of a `1` outcome (vs `0`)."""
    return self._probs

  def _batch_shape_tensor(self):
    return array_ops.shape(self._logits)

  def _batch_shape(self):
    return self._logits.get_shape()

  def _event_shape_tensor(self):
    return array_ops.constant([], dtype=dtypes.int32)

  def _event_shape(self):
    return tensor_shape.scalar()

  def _sample_n(self, n, seed=None):
    new_shape = array_ops.concat([[n], self.batch_shape_tensor()], 0)
    uniform = random_ops.random_uniform(
        new_shape, seed=seed, dtype=self.probs.dtype)
    sample = math_ops.less(uniform, self.probs)
    return math_ops.cast(sample, self.dtype)

  def _log_prob(self, event):
    if self.validate_args:
      event = distribution_util.embed_check_integer_casting_closed(
          event, target_dtype=dtypes.bool)

    # TODO(jaana): The current sigmoid_cross_entropy_with_logits has
    # inconsistent behavior for logits = inf/-inf.
    event = math_ops.cast(event, self.logits.dtype)
    logits = self.logits
    # sigmoid_cross_entropy_with_logits doesn't broadcast shape,
    # so we do this here.

    def _broadcast(logits, event):
      return (array_ops.ones_like(event) * logits,
              array_ops.ones_like(logits) * event)

    if not (event.get_shape().is_fully_defined() and
            logits.get_shape().is_fully_defined() and
            event.get_shape() == logits.get_shape()):
      logits, event = _broadcast(logits, event)
    return -nn.sigmoid_cross_entropy_with_logits(labels=event, logits=logits)

  def _entropy(self):
    return (-self.logits * (math_ops.sigmoid(self.logits) - 1) +
            nn.softplus(-self.logits))

  def _mean(self):
    return array_ops.identity(self.probs)

  def _variance(self):
    return self._mean() * (1. - self.probs)

  def _mode(self):
    """Returns `1` if `prob > 0.5` and `0` otherwise."""
    return math_ops.cast(self.probs > 0.5, self.dtype)

@kullback_leibler.RegisterKL(Bernoulli, Bernoulli)
def _kl_bernoulli_bernoulli(a, b, name=None):
  """Calculate the batched KL divergence KL(a || b) with a and b Bernoulli.

  Args:
    a: instance of a Bernoulli distribution object.
    b: instance of a Bernoulli distribution object.
    name: (optional) Name to use for created operations.
      default is "kl_bernoulli_bernoulli".

  Returns:
    Batchwise KL(a || b)
  """
  with ops.name_scope(name, "kl_bernoulli_bernoulli",
                      values=[a.logits, b.logits]):
    delta_probs0 = nn.softplus(-b.logits) - nn.softplus(-a.logits)
    delta_probs1 = nn.softplus(b.logits) - nn.softplus(a.logits)
    return (math_ops.sigmoid(a.logits) * delta_probs0
            + math_ops.sigmoid(-a.logits) * delta_probs1)


text:
mkdir -pv $PREFIX/bin
cp -rv clair3 preprocess scripts shared trio $PREFIX/bin
cp clair3.py $PREFIX/bin/
cp run_clair3_trio.sh $PREFIX/bin/


text:
namespace llmq
{

CSigningManager* quorumSigningManager;

UniValue CRecoveredSig::ToJson() const
{
    UniValue ret(UniValue::VOBJ);
    ret.push_back(Pair("llmqType", (int)llmqType));
    ret.push_back(Pair("quorumHash", quorumHash.ToString()));
    ret.push_back(Pair("id", id.ToString()));
    ret.push_back(Pair("msgHash", msgHash.ToString()));
    ret.push_back(Pair("sig", sig.Get().ToString()));
    ret.push_back(Pair("hash", sig.Get().GetHash().ToString()));
    return ret;
}

CRecoveredSigsDb::CRecoveredSigsDb(CDBWrapper& _db) :
    db(_db)
{
    if (Params().NetworkIDString() == CBaseChainParams::TESTNET) {
        // TODO this can be completely removed after some time (when we're pretty sure the conversion has been run on most testnet MNs)
        if (db.Exists(std::string("rs_upgraded"))) {
            return;
        }

        ConvertInvalidTimeKeys();
        AddVoteTimeKeys();

        db.Write(std::string("rs_upgraded"), (uint8_t)1);
    }
}

// This converts time values in "rs_t" from host endiannes to big endiannes, which is required to have proper ordering of the keys
void CRecoveredSigsDb::ConvertInvalidTimeKeys()
{
    LogPrintf("CRecoveredSigsDb::%s -- converting invalid rs_t keys\n", __func__);

    std::unique_ptr<CDBIterator> pcursor(db.NewIterator());

    auto start = std::make_tuple(std::string("rs_t"), (uint32_t)0, (uint8_t)0, uint256());
    pcursor->Seek(start);

    CDBBatch batch(db);
    size_t cnt = 0;
    while (pcursor->Valid()) {
        decltype(start) k;

        if (!pcursor->GetKey(k) || std::get<0>(k) != "rs_t") {
            break;
        }

        batch.Erase(k);
        std::get<1>(k) = htobe32(std::get<1>(k));
        batch.Write(k, (uint8_t)1);

        cnt++;

        pcursor->Next();
    }
    pcursor.reset();

    db.WriteBatch(batch);

    LogPrintf("CRecoveredSigsDb::%s -- converted %d invalid rs_t keys\n", __func__, cnt);
}

// This adds rs_vt keys for every rs_v entry to the DB. The time in the key is set to the current time.
// This causes cleanup of all these votes a week later.
void CRecoveredSigsDb::AddVoteTimeKeys()
{
    LogPrintf("CRecoveredSigsDb::%s -- adding rs_vt keys with current time\n", __func__);

    auto curTime = GetAdjustedTime();

    std::unique_ptr<CDBIterator> pcursor(db.NewIterator());

    auto start = std::make_tuple(std::string("rs_v"), (uint8_t)0, uint256());
    pcursor->Seek(start);

    CDBBatch batch(db);
    size_t cnt = 0;
    while (pcursor->Valid()) {
        decltype(start) k;

        if (!pcursor->GetKey(k) || std::get<0>(k) != "rs_v") {
            break;
        }

        uint8_t llmqType = std::get<1>(k);
        const uint256& id = std::get<2>(k);

        auto k2 = std::make_tuple(std::string("rs_vt"), (uint32_t)htobe32(curTime), llmqType, id);
        batch.Write(k2, (uint8_t)1);

        cnt++;

        pcursor->Next();
    }
    pcursor.reset();

    db.WriteBatch(batch);

    LogPrintf("CRecoveredSigsDb::%s -- added %d rs_vt entries\n", __func__, cnt);
}

bool CRecoveredSigsDb::HasRecoveredSig(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash)
{
    auto k = std::make_tuple(std::string("rs_r"), (uint8_t)llmqType, id, msgHash);
    return db.Exists(k);
}

bool CRecoveredSigsDb::HasRecoveredSigForId(Consensus::LLMQType llmqType, const uint256& id)
{
    auto cacheKey = std::make_pair(llmqType, id);
    bool ret;
    {
        LOCK(cs);
        if (hasSigForIdCache.get(cacheKey, ret)) {
            return ret;
        }
    }

    auto k = std::make_tuple(std::string("rs_r"), (uint8_t)llmqType, id);
    ret = db.Exists(k);

    LOCK(cs);
    hasSigForIdCache.insert(cacheKey, ret);
    return ret;
}

bool CRecoveredSigsDb::HasRecoveredSigForSession(const uint256& signHash)
{
    bool ret;
    {
        LOCK(cs);
        if (hasSigForSessionCache.get(signHash, ret)) {
            return ret;
        }
    }

    auto k = std::make_tuple(std::string("rs_s"), signHash);
    ret = db.Exists(k);

    LOCK(cs);
    hasSigForSessionCache.insert(signHash, ret);
    return ret;
}

bool CRecoveredSigsDb::HasRecoveredSigForHash(const uint256& hash)
{
    bool ret;
    {
        LOCK(cs);
        if (hasSigForHashCache.get(hash, ret)) {
            return ret;
        }
    }

    auto k = std::make_tuple(std::string("rs_h"), hash);
    ret = db.Exists(k);

    LOCK(cs);
    hasSigForHashCache.insert(hash, ret);
    return ret;
}

bool CRecoveredSigsDb::ReadRecoveredSig(Consensus::LLMQType llmqType, const uint256& id, CRecoveredSig& ret)
{
    auto k = std::make_tuple(std::string("rs_r"), (uint8_t)llmqType, id);

    CDataStream ds(SER_DISK, CLIENT_VERSION);
    if (!db.ReadDataStream(k, ds)) {
        return false;
    }

    try {
        ret.Unserialize(ds);
        return true;
    } catch (std::exception&) {
        return false;
    }
}

bool CRecoveredSigsDb::GetRecoveredSigByHash(const uint256& hash, CRecoveredSig& ret)
{
    auto k1 = std::make_tuple(std::string("rs_h"), hash);
    std::pair<uint8_t, uint256> k2;
    if (!db.Read(k1, k2)) {
        return false;
    }

    return ReadRecoveredSig((Consensus::LLMQType)k2.first, k2.second, ret);
}

bool CRecoveredSigsDb::GetRecoveredSigById(Consensus::LLMQType llmqType, const uint256& id, CRecoveredSig& ret)
{
    return ReadRecoveredSig(llmqType, id, ret);
}

void CRecoveredSigsDb::WriteRecoveredSig(const llmq::CRecoveredSig& recSig)
{
    CDBBatch batch(db);

    uint32_t curTime = GetAdjustedTime();

    // we put these close to each other to leverage leveldb's key compaction
    // this way, the second key can be used for fast HasRecoveredSig checks while the first key stores the recSig
    auto k1 = std::make_tuple(std::string("rs_r"), recSig.llmqType, recSig.id);
    auto k2 = std::make_tuple(std::string("rs_r"), recSig.llmqType, recSig.id, recSig.msgHash);
    batch.Write(k1, recSig);
    // this key is also used to store the current time, so that we can easily get to the "rs_t" key when we have the id
    batch.Write(k2, curTime);

    // store by object hash
    auto k3 = std::make_tuple(std::string("rs_h"), recSig.GetHash());
    batch.Write(k3, std::make_pair(recSig.llmqType, recSig.id));

    // store by signHash
    auto signHash = CLLMQUtils::BuildSignHash(recSig);
    auto k4 = std::make_tuple(std::string("rs_s"), signHash);
    batch.Write(k4, (uint8_t)1);

    // store by current time. Allows fast cleanup of old recSigs
    auto k5 = std::make_tuple(std::string("rs_t"), (uint32_t)htobe32(curTime), recSig.llmqType, recSig.id);
    batch.Write(k5, (uint8_t)1);

    db.WriteBatch(batch);

    {
        int64_t t = GetTimeMillis();

        LOCK(cs);
        hasSigForIdCache.insert(std::make_pair((Consensus::LLMQType)recSig.llmqType, recSig.id), true);
        hasSigForSessionCache.insert(signHash, true);
        hasSigForHashCache.insert(recSig.GetHash(), true);
    }
}

void CRecoveredSigsDb::RemoveRecoveredSig(CDBBatch& batch, Consensus::LLMQType llmqType, const uint256& id, bool deleteTimeKey)
{
    AssertLockHeld(cs);

    CRecoveredSig recSig;
    if (!ReadRecoveredSig(llmqType, id, recSig)) {
        return;
    }

    auto signHash = CLLMQUtils::BuildSignHash(recSig);

    auto k1 = std::make_tuple(std::string("rs_r"), recSig.llmqType, recSig.id);
    auto k2 = std::make_tuple(std::string("rs_r"), recSig.llmqType, recSig.id, recSig.msgHash);
    auto k3 = std::make_tuple(std::string("rs_h"), recSig.GetHash());
    auto k4 = std::make_tuple(std::string("rs_s"), signHash);
    batch.Erase(k1);
    batch.Erase(k2);
    batch.Erase(k3);
    batch.Erase(k4);

    if (deleteTimeKey) {
        CDataStream writeTimeDs(SER_DISK, CLIENT_VERSION);
        // TODO remove the size() == sizeof(uint32_t) in a future version (when we stop supporting upgrades from < 0.14.1)
        if (db.ReadDataStream(k2, writeTimeDs) && writeTimeDs.size() == sizeof(uint32_t)) {
            uint32_t writeTime;
            writeTimeDs >> writeTime;
            auto k5 = std::make_tuple(std::string("rs_t"), (uint32_t) htobe32(writeTime), recSig.llmqType, recSig.id);
            batch.Erase(k5);
        }
    }

    hasSigForIdCache.erase(std::make_pair((Consensus::LLMQType)recSig.llmqType, recSig.id));
    hasSigForSessionCache.erase(signHash);
    hasSigForHashCache.erase(recSig.GetHash());
}

void CRecoveredSigsDb::RemoveRecoveredSig(Consensus::LLMQType llmqType, const uint256& id)
{
    LOCK(cs);
    CDBBatch batch(db);
    RemoveRecoveredSig(batch, llmqType, id, true);
    db.WriteBatch(batch);
}

void CRecoveredSigsDb::CleanupOldRecoveredSigs(int64_t maxAge)
{
    std::unique_ptr<CDBIterator> pcursor(db.NewIterator());

    auto start = std::make_tuple(std::string("rs_t"), (uint32_t)0, (uint8_t)0, uint256());
    uint32_t endTime = (uint32_t)(GetAdjustedTime() - maxAge);
    pcursor->Seek(start);

    std::vector<std::pair<Consensus::LLMQType, uint256>> toDelete;
    std::vector<decltype(start)> toDelete2;

    while (pcursor->Valid()) {
        decltype(start) k;

        if (!pcursor->GetKey(k) || std::get<0>(k) != "rs_t") {
            break;
        }
        if (be32toh(std::get<1>(k)) >= endTime) {
            break;
        }

        toDelete.emplace_back((Consensus::LLMQType)std::get<2>(k), std::get<3>(k));
        toDelete2.emplace_back(k);

        pcursor->Next();
    }
    pcursor.reset();

    if (toDelete.empty()) {
        return;
    }

    CDBBatch batch(db);
    {
        LOCK(cs);
        for (auto& e : toDelete) {
            RemoveRecoveredSig(batch, e.first, e.second, false);

            if (batch.SizeEstimate() >= (1 << 24)) {
                db.WriteBatch(batch);
                batch.Clear();
            }
        }
    }

    for (auto& e : toDelete2) {
        batch.Erase(e);
    }

    db.WriteBatch(batch);

    LogPrint("llmq", "CRecoveredSigsDb::%d -- deleted %d entries\n", __func__, toDelete.size());
}

bool CRecoveredSigsDb::HasVotedOnId(Consensus::LLMQType llmqType, const uint256& id)
{
    auto k = std::make_tuple(std::string("rs_v"), (uint8_t)llmqType, id);
    return db.Exists(k);
}

bool CRecoveredSigsDb::GetVoteForId(Consensus::LLMQType llmqType, const uint256& id, uint256& msgHashRet)
{
    auto k = std::make_tuple(std::string("rs_v"), (uint8_t)llmqType, id);
    return db.Read(k, msgHashRet);
}

void CRecoveredSigsDb::WriteVoteForId(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash)
{
    auto k1 = std::make_tuple(std::string("rs_v"), (uint8_t)llmqType, id);
    auto k2 = std::make_tuple(std::string("rs_vt"), (uint32_t)htobe32(GetAdjustedTime()), (uint8_t)llmqType, id);

    CDBBatch batch(db);
    batch.Write(k1, msgHash);
    batch.Write(k2, (uint8_t)1);

    db.WriteBatch(batch);
}

void CRecoveredSigsDb::CleanupOldVotes(int64_t maxAge)
{
    std::unique_ptr<CDBIterator> pcursor(db.NewIterator());

    auto start = std::make_tuple(std::string("rs_vt"), (uint32_t)0, (uint8_t)0, uint256());
    uint32_t endTime = (uint32_t)(GetAdjustedTime() - maxAge);
    pcursor->Seek(start);

    CDBBatch batch(db);
    size_t cnt = 0;
    while (pcursor->Valid()) {
        decltype(start) k;

        if (!pcursor->GetKey(k) || std::get<0>(k) != "rs_vt") {
            break;
        }
        if (be32toh(std::get<1>(k)) >= endTime) {
            break;
        }

        uint8_t llmqType = std::get<2>(k);
        const uint256& id = std::get<3>(k);

        batch.Erase(k);
        batch.Erase(std::make_tuple(std::string("rs_v"), llmqType, id));

        cnt++;

        pcursor->Next();
    }
    pcursor.reset();

    if (cnt == 0) {
        return;
    }

    db.WriteBatch(batch);

    LogPrint("llmq", "CRecoveredSigsDb::%d -- deleted %d entries\n", __func__, cnt);
}

//////////////////

CSigningManager::CSigningManager(CDBWrapper& llmqDb, bool fMemory) :
    db(llmqDb)
{
}

bool CSigningManager::AlreadyHave(const CInv& inv)
{
    LOCK(cs);
    return inv.type == MSG_QUORUM_RECOVERED_SIG && db.HasRecoveredSigForHash(inv.hash);
}

bool CSigningManager::GetRecoveredSigForGetData(const uint256& hash, CRecoveredSig& ret)
{
    if (!db.GetRecoveredSigByHash(hash, ret)) {
        return false;
    }
    if (!CLLMQUtils::IsQuorumActive((Consensus::LLMQType)(ret.llmqType), ret.quorumHash)) {
        // we don't want to propagate sigs from inactive quorums
        return false;
    }
    return true;
}

void CSigningManager::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman)
{
    if (strCommand == NetMsgType::QSIGREC) {
        CRecoveredSig recoveredSig;
        vRecv >> recoveredSig;
        ProcessMessageRecoveredSig(pfrom, recoveredSig, connman);
    }
}

void CSigningManager::ProcessMessageRecoveredSig(CNode* pfrom, const CRecoveredSig& recoveredSig, CConnman& connman)
{
    bool ban = false;
    if (!PreVerifyRecoveredSig(pfrom->id, recoveredSig, ban)) {
        if (ban) {
            LOCK(cs_main);
            Misbehaving(pfrom->id, 100);
        }
        return;
    }

    // It's important to only skip seen *valid* sig shares here. See comment for CBatchedSigShare
    // We don't receive recovered sigs in batches, but we do batched verification per node on these
    if (db.HasRecoveredSigForHash(recoveredSig.GetHash())) {
        return;
    }

    LogPrint("llmq", "CSigningManager::%s -- signHash=%s, id=%s, msgHash=%s, node=%d\n", __func__,
            CLLMQUtils::BuildSignHash(recoveredSig).ToString(), recoveredSig.id.ToString(), recoveredSig.msgHash.ToString(), pfrom->GetId());

    LOCK(cs);
    pendingRecoveredSigs[pfrom->id].emplace_back(recoveredSig);
}

bool CSigningManager::PreVerifyRecoveredSig(NodeId nodeId, const CRecoveredSig& recoveredSig, bool& retBan)
{
    retBan = false;

    auto llmqType = (Consensus::LLMQType)recoveredSig.llmqType;
    if (!Params().GetConsensus().llmqs.count(llmqType)) {
        retBan = true;
        return false;
    }

    CQuorumCPtr quorum = quorumManager->GetQuorum(llmqType, recoveredSig.quorumHash);

    if (!quorum) {
        LogPrint("llmq", "CSigningManager::%s -- quorum %s not found, node=%d\n", __func__,
                  recoveredSig.quorumHash.ToString(), nodeId);
        return false;
    }
    if (!CLLMQUtils::IsQuorumActive(llmqType, quorum->qc.quorumHash)) {
        return false;
    }

    return true;
}

void CSigningManager::CollectPendingRecoveredSigsToVerify(
        size_t maxUniqueSessions,
        std::unordered_map<NodeId, std::list<CRecoveredSig>>& retSigShares,
        std::unordered_map<std::pair<Consensus::LLMQType, uint256>, CQuorumCPtr, StaticSaltedHasher>& retQuorums)
{
    {
        LOCK(cs);
        if (pendingRecoveredSigs.empty()) {
            return;
        }

        std::unordered_set<std::pair<NodeId, uint256>, StaticSaltedHasher> uniqueSignHashes;
        CLLMQUtils::IterateNodesRandom(pendingRecoveredSigs, [&]() {
            return uniqueSignHashes.size() < maxUniqueSessions;
        }, [&](NodeId nodeId, std::list<CRecoveredSig>& ns) {
            if (ns.empty()) {
                return false;
            }
            auto& recSig = *ns.begin();

            bool alreadyHave = db.HasRecoveredSigForHash(recSig.GetHash());
            if (!alreadyHave) {
                uniqueSignHashes.emplace(nodeId, CLLMQUtils::BuildSignHash(recSig));
                retSigShares[nodeId].emplace_back(recSig);
            }
            ns.erase(ns.begin());
            return !ns.empty();
        }, rnd);

        if (retSigShares.empty()) {
            return;
        }
    }

    for (auto& p : retSigShares) {
        NodeId nodeId = p.first;
        auto& v = p.second;

        for (auto it = v.begin(); it != v.end();) {
            auto& recSig = *it;

            Consensus::LLMQType llmqType = (Consensus::LLMQType) recSig.llmqType;
            auto quorumKey = std::make_pair((Consensus::LLMQType)recSig.llmqType, recSig.quorumHash);
            if (!retQuorums.count(quorumKey)) {
                CQuorumCPtr quorum = quorumManager->GetQuorum(llmqType, recSig.quorumHash);
                if (!quorum) {
                    LogPrint("llmq", "CSigningManager::%s -- quorum %s not found, node=%d\n", __func__,
                              recSig.quorumHash.ToString(), nodeId);
                    it = v.erase(it);
                    continue;
                }
                if (!CLLMQUtils::IsQuorumActive(llmqType, quorum->qc.quorumHash)) {
                    LogPrint("llmq", "CSigningManager::%s -- quorum %s not active anymore, node=%d\n", __func__,
                              recSig.quorumHash.ToString(), nodeId);
                    it = v.erase(it);
                    continue;
                }

                retQuorums.emplace(quorumKey, quorum);
            }

            ++it;
        }
    }
}

void CSigningManager::ProcessPendingReconstructedRecoveredSigs()
{
    decltype(pendingReconstructedRecoveredSigs) l;
    {
        LOCK(cs);
        l = std::move(pendingReconstructedRecoveredSigs);
    }
    for (auto& p : l) {
        ProcessRecoveredSig(-1, p.first, p.second, *g_connman);
    }
}

bool CSigningManager::ProcessPendingRecoveredSigs(CConnman& connman)
{
    std::unordered_map<NodeId, std::list<CRecoveredSig>> recSigsByNode;
    std::unordered_map<std::pair<Consensus::LLMQType, uint256>, CQuorumCPtr, StaticSaltedHasher> quorums;

    ProcessPendingReconstructedRecoveredSigs();

    CollectPendingRecoveredSigsToVerify(32, recSigsByNode, quorums);
    if (recSigsByNode.empty()) {
        return false;
    }

    // It's ok to perform insecure batched verification here as we verify against the quorum public keys, which are not
    // craftable by individual entities, making the rogue public key attack impossible
    CBLSBatchVerifier<NodeId, uint256> batchVerifier(false, false);

    size_t verifyCount = 0;
    for (auto& p : recSigsByNode) {
        NodeId nodeId = p.first;
        auto& v = p.second;

        for (auto& recSig : v) {
            // we didn't verify the lazy signature until now
            if (!recSig.sig.Get().IsValid()) {
                batchVerifier.badSources.emplace(nodeId);
                break;
            }

            const auto& quorum = quorums.at(std::make_pair((Consensus::LLMQType)recSig.llmqType, recSig.quorumHash));
            batchVerifier.PushMessage(nodeId, recSig.GetHash(), CLLMQUtils::BuildSignHash(recSig), recSig.sig.Get(), quorum->qc.quorumPublicKey);
            verifyCount++;
        }
    }

    cxxtimer::Timer verifyTimer(true);
    batchVerifier.Verify();
    verifyTimer.stop();

    LogPrint("llmq", "CSigningManager::%s -- verified recovered sig(s). count=%d, vt=%d, nodes=%d\n", __func__, verifyCount, verifyTimer.count(), recSigsByNode.size());

    std::unordered_set<uint256, StaticSaltedHasher> processed;
    for (auto& p : recSigsByNode) {
        NodeId nodeId = p.first;
        auto& v = p.second;

        if (batchVerifier.badSources.count(nodeId)) {
            LOCK(cs_main);
            LogPrintf("CSigningManager::%s -- invalid recSig from other node, banning peer=%d\n", __func__, nodeId);
            Misbehaving(nodeId, 100);
            continue;
        }

        for (auto& recSig : v) {
            if (!processed.emplace(recSig.GetHash()).second) {
                continue;
            }

            const auto& quorum = quorums.at(std::make_pair((Consensus::LLMQType)recSig.llmqType, recSig.quorumHash));
            ProcessRecoveredSig(nodeId, recSig, quorum, connman);
        }
    }

    return true;
}

// signature must be verified already
void CSigningManager::ProcessRecoveredSig(NodeId nodeId, const CRecoveredSig& recoveredSig, const CQuorumCPtr& quorum, CConnman& connman)
{
    auto llmqType = (Consensus::LLMQType)recoveredSig.llmqType;

    {
        LOCK(cs_main);
        connman.RemoveAskFor(recoveredSig.GetHash());
    }

    std::vector<CRecoveredSigsListener*> listeners;
    {
        LOCK(cs);
        listeners = recoveredSigsListeners;

        auto signHash = CLLMQUtils::BuildSignHash(recoveredSig);

        LogPrint("llmq", "CSigningManager::%s -- valid recSig. signHash=%s, id=%s, msgHash=%s, node=%d\n", __func__,
                signHash.ToString(), recoveredSig.id.ToString(), recoveredSig.msgHash.ToString(), nodeId);

        if (db.HasRecoveredSigForId(llmqType, recoveredSig.id)) {
            CRecoveredSig otherRecoveredSig;
            if (db.GetRecoveredSigById(llmqType, recoveredSig.id, otherRecoveredSig)) {
                auto otherSignHash = CLLMQUtils::BuildSignHash(recoveredSig);
                if (signHash != otherSignHash) {
                    // this should really not happen, as each masternode is participating in only one vote,
                    // even if it's a member of multiple quorums. so a majority is only possible on one quorum and one msgHash per id
                    LogPrintf("CSigningManager::%s -- conflicting recoveredSig for signHash=%s, id=%s, msgHash=%s, otherSignHash=%s\n", __func__,
                              signHash.ToString(), recoveredSig.id.ToString(), recoveredSig.msgHash.ToString(), otherSignHash.ToString());
                } else {
                    // Looks like we're trying to process a recSig that is already known. This might happen if the same
                    // recSig comes in through regular QRECSIG messages and at the same time through some other message
                    // which allowed to reconstruct a recSig (e.g. ISLOCK). In this case, just bail out.
                }
                return;
            } else {
                // This case is very unlikely. It can only happen when cleanup caused this specific recSig to vanish
                // between the HasRecoveredSigForId and GetRecoveredSigById call. If that happens, treat it as if we
                // never had that recSig
            }
        }

        db.WriteRecoveredSig(recoveredSig);
    }

    CInv inv(MSG_QUORUM_RECOVERED_SIG, recoveredSig.GetHash());
    g_connman->ForEachNode([&](CNode* pnode) {
        if (pnode->nVersion >= LLMQS_PROTO_VERSION && pnode->fSendRecSigs) {
            pnode->PushInventory(inv);
        }
    });

    for (auto& l : listeners) {
        l->HandleNewRecoveredSig(recoveredSig);
    }
}

void CSigningManager::PushReconstructedRecoveredSig(const llmq::CRecoveredSig& recoveredSig, const llmq::CQuorumCPtr& quorum)
{
    LOCK(cs);
    pendingReconstructedRecoveredSigs.emplace_back(recoveredSig, quorum);
}

void CSigningManager::RemoveRecoveredSig(Consensus::LLMQType llmqType, const uint256& id)
{
    db.RemoveRecoveredSig(llmqType, id);
}

void CSigningManager::Cleanup()
{
    int64_t now = GetTimeMillis();
    if (now - lastCleanupTime < 5000) {
        return;
    }

    int64_t maxAge = GetArg("-recsigsmaxage", DEFAULT_MAX_RECOVERED_SIGS_AGE);

    db.CleanupOldRecoveredSigs(maxAge);
    db.CleanupOldVotes(maxAge);

    lastCleanupTime = GetTimeMillis();
}

void CSigningManager::RegisterRecoveredSigsListener(CRecoveredSigsListener* l)
{
    LOCK(cs);
    recoveredSigsListeners.emplace_back(l);
}

void CSigningManager::UnregisterRecoveredSigsListener(CRecoveredSigsListener* l)
{
    LOCK(cs);
    auto itRem = std::remove(recoveredSigsListeners.begin(), recoveredSigsListeners.end(), l);
    recoveredSigsListeners.erase(itRem, recoveredSigsListeners.end());
}

bool CSigningManager::AsyncSignIfMember(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash, bool allowReSign)
{
    auto& params = Params().GetConsensus().llmqs.at(llmqType);

    if (!fMasternodeMode || activeMasternodeInfo.proTxHash.IsNull()) {
        return false;
    }

    {
        LOCK(cs);

        bool hasVoted = db.HasVotedOnId(llmqType, id);
        if (hasVoted) {
            uint256 prevMsgHash;
            db.GetVoteForId(llmqType, id, prevMsgHash);
            if (msgHash != prevMsgHash) {
                LogPrintf("CSigningManager::%s -- already voted for id=%s and msgHash=%s. Not voting on conflicting msgHash=%s\n", __func__,
                        id.ToString(), prevMsgHash.ToString(), msgHash.ToString());
                return false;
            } else if (allowReSign) {
                LogPrint("llmq", "CSigningManager::%s -- already voted for id=%s and msgHash=%s. Resigning!\n", __func__,
                         id.ToString(), prevMsgHash.ToString());
            } else {
                LogPrint("llmq", "CSigningManager::%s -- already voted for id=%s and msgHash=%s. Not voting again.\n", __func__,
                          id.ToString(), prevMsgHash.ToString());
                return false;
            }
        }

        if (db.HasRecoveredSigForId(llmqType, id)) {
            // no need to sign it if we already have a recovered sig
            return true;
        }
        if (!hasVoted) {
            db.WriteVoteForId(llmqType, id, msgHash);
        }
    }

    int tipHeight;
    {
        LOCK(cs_main);
        tipHeight = chainActive.Height();
    }

    // This might end up giving different results on different members
    // This might happen when we are on the brink of confirming a new quorum
    // This gives a slight risk of not getting enough shares to recover a signature
    // But at least it shouldn't be possible to get conflicting recovered signatures
    // TODO fix this by re-signing when the next block arrives, but only when that block results in a change of the quorum list and no recovered signature has been created in the mean time
    CQuorumCPtr quorum = SelectQuorumForSigning(llmqType, tipHeight, id);
    if (!quorum) {
        LogPrint("llmq", "CSigningManager::%s -- failed to select quorum. id=%s, msgHash=%s\n", __func__, id.ToString(), msgHash.ToString());
        return false;
    }

    if (!quorum->IsValidMember(activeMasternodeInfo.proTxHash)) {
        //LogPrint("llmq", "CSigningManager::%s -- we're not a valid member of quorum %s\n", __func__, quorum->quorumHash.ToString());
        return false;
    }

    if (allowReSign) {
        // make us re-announce all known shares (other nodes might have run into a timeout)
        quorumSigSharesManager->ForceReAnnouncement(quorum, llmqType, id, msgHash);
    }
    quorumSigSharesManager->AsyncSign(quorum, id, msgHash);

    return true;
}

bool CSigningManager::HasRecoveredSig(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash)
{
    return db.HasRecoveredSig(llmqType, id, msgHash);
}

bool CSigningManager::HasRecoveredSigForId(Consensus::LLMQType llmqType, const uint256& id)
{
    return db.HasRecoveredSigForId(llmqType, id);
}

bool CSigningManager::HasRecoveredSigForSession(const uint256& signHash)
{
    return db.HasRecoveredSigForSession(signHash);
}

bool CSigningManager::GetRecoveredSigForId(Consensus::LLMQType llmqType, const uint256& id, llmq::CRecoveredSig& retRecSig)
{
    if (!db.GetRecoveredSigById(llmqType, id, retRecSig)) {
        return false;
    }
    return true;
}

bool CSigningManager::IsConflicting(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash)
{
    if (!db.HasRecoveredSigForId(llmqType, id)) {
        // no recovered sig present, so no conflict
        return false;
    }

    if (!db.HasRecoveredSig(llmqType, id, msgHash)) {
        // recovered sig is present, but not for the given msgHash. That's a conflict!
        return true;
    }

    // all good
    return false;
}

bool CSigningManager::HasVotedOnId(Consensus::LLMQType llmqType, const uint256& id)
{
    return db.HasVotedOnId(llmqType, id);
}

bool CSigningManager::GetVoteForId(Consensus::LLMQType llmqType, const uint256& id, uint256& msgHashRet)
{
    return db.GetVoteForId(llmqType, id, msgHashRet);
}

std::vector<CQuorumCPtr> CSigningManager::GetActiveQuorumSet(Consensus::LLMQType llmqType, int signHeight)
{
    auto& llmqParams = Params().GetConsensus().llmqs.at(llmqType);
    size_t poolSize = (size_t)llmqParams.signingActiveQuorumCount;

    CBlockIndex* pindexStart;
    {
        LOCK(cs_main);
        int startBlockHeight = signHeight - SIGN_HEIGHT_OFFSET;
        if (startBlockHeight > chainActive.Height()) {
            return {};
        }
        pindexStart = chainActive[startBlockHeight];
    }

    return quorumManager->ScanQuorums(llmqType, pindexStart, poolSize);
}

CQuorumCPtr CSigningManager::SelectQuorumForSigning(Consensus::LLMQType llmqType, int signHeight, const uint256& selectionHash)
{
    auto quorums = GetActiveQuorumSet(llmqType, signHeight);
    if (quorums.empty()) {
        return nullptr;
    }

    std::vector<std::pair<uint256, size_t>> scores;
    scores.reserve(quorums.size());
    for (size_t i = 0; i < quorums.size(); i++) {
        CHashWriter h(SER_NETWORK, 0);
        h << (uint8_t)llmqType;
        h << quorums[i]->qc.quorumHash;
        h << selectionHash;
        scores.emplace_back(h.GetHash(), i);
    }
    std::sort(scores.begin(), scores.end());
    return quorums[scores.front().second];
}

bool CSigningManager::VerifyRecoveredSig(Consensus::LLMQType llmqType, int signedAtHeight, const uint256& id, const uint256& msgHash, const CBLSSignature& sig)
{
    auto& llmqParams = Params().GetConsensus().llmqs.at(Params().GetConsensus().llmqChainLocks);

    auto quorum = SelectQuorumForSigning(llmqParams.type, signedAtHeight, id);
    if (!quorum) {
        return false;
    }

    uint256 signHash = CLLMQUtils::BuildSignHash(llmqParams.type, quorum->qc.quorumHash, id, msgHash);
    return sig.VerifyInsecure(quorum->qc.quorumPublicKey, signHash);
}

}


text:
<!doctype html>

  <link rel="stylesheet" href="https://cdn.rawgit.com/sourcelair/xterm.js/2.1.0/dist/xterm.css">


text:
package org.thymeleaf.processor.doctype;

import org.thymeleaf.context.ITemplateProcessingContext;
import org.thymeleaf.engine.IDocTypeStructureHandler;
import org.thymeleaf.model.IDocType;
import org.thymeleaf.processor.IProcessor;

/**
 *
 * @author Daniel Fernández
 * @since 3.0.0
 *
 */
public interface IDocTypeProcessor extends IProcessor {

    public void process(
            final ITemplateProcessingContext processingContext, final IDocType docType,
            final IDocTypeStructureHandler structureHandler);

}


text:
A [slack](http://api.slack.com/) [bot](https://api.slack.com/bot-users) for interacting with a lens installation.

This is developed using [botkit](https://github.com/howdyai/botkit/) and [lens-node-client](https://github.com/prongs/lens-node-client/).

## Installation

* install as nodejs package.
* Create $HOME/lens_config.json with content like the following:
```
     {
         "slackToken":"your-bot's slack-token",
         "lensServerBaseUrl": "http://lens-installation/lensapi/",
         "lensUsername":"admin-user-name",
         "lensPassword":"admin-user-password",
         "upgrade_secret": "secret with which you can ask the bot to suicide."
     }
```
* Run the following code with node:
```
var bot = new LensSlackBot();
bot.start();
```
* Go to slack and wait for your bot to come online :) The upgrade secret is useful when you have a script that's starting bot in a loop.
So you ask the bot to upgrade, provide the upgrade secret, and it goes offline. Then the external script can bring it up again.

## What can this bot do:

### Query analysis

A command is made up of two parts: collection, and action. Collection and action are separated by `:`. The bot will understand
the collection, run the action over that and reply to you in chat. Then it'll ask if you want to analyze more. There you can
provide more action commands. Here, the context is the original collection, and you can put action commands to analyze over the
same collection. Once you reply no, the context is lost, and you can analyze over a different collection.

#### How to specify a Collection

* Space separated list of query handles
* `running queries` == your queries that are in running state. Similarly `queued queries`, `successful queries`, `failed queries` etc.
* `all running queries` == all queries in running state. Similarly for other query states.

#### Actions:

* Comma separated List of fields to extract. e.g. `status, user query`. Note that here, `user query` translates to `userQuery`, but you can specify whichever is comfortable.
* A sql. e.g. `select priority, count(*) num from ? group by priority`. We use [alasql](https://github.com/agershun/alasql) for running
  sql on in-memory data. The first `?` in the query refers to the collection currently in context.
* A shortcut which the bot already knows. The shortcuts are developed by training the bot.

### Training
As mentioned earlier, sql analysis can be done on a query collection. Now, Writing sql everytime could be troublesome, so there's a
feature to save your sql queries so that they can be refered by a short name.

* You can ask the bot to show what it has learned so far by asking `what do you know`/`what have you learned`.
* You can perform training by writing `training` in a private chat with the bot. Then Answer `sql` for `what do you want me to learn` and
   answer the next questions.

### Upgrade
You can tell the bot to `upgrade` itself. It'll ask you for an upgrade secret. The secret should be deployed in the config xml
and shared with people who should have the capability to upgrade.

## More chat instructions to be added soon :)
## Contributing

* Fork it
* Add/change code
* Raise a pull-request
* Star it :)


text:
define({
  "settingsHeader": "Postavite detalje za GeoLookup Widget",
  "settingsDesc": "Izvršite geoobogaćivanje liste lokacija iz CSV datoteke naspram slojeva poligona na mapi. Izabrana polja iz slojeva poligona su dodata lokacijama.",
  "settingsLoadingLayers": "Sačekajte dok se slojevi učitavaju.",
  "settingsConfigureTitle": "Konfigurišite polja sloja",
  "layerTable": {
    "colEnrich": "Obogati",
    "colLabel": "Sloj",
    "colFieldSelector": "Polja"
  },
  "fieldTable": {
    "colAppend": "Dodaj",
    "colName": "Naziv",
    "colAlias": "Pseudonim",
    "colOrder": "Radnje",
    "label": "Proverite polja koja želite da dodate. Izaberite polje za koje ćete ažurirati pseudonim i redosled."
  },
  "symbolArea": {
    "symbolLabelWithin": "Izaberite simbol za lokacije unutar:",
    "symbolLabelOutside": "Izaberite simbol za lokacije izvan:"
  },
  "advSettings": {
    "label": "Napredne postavke",
    "latFieldsDesc": "Moguća imena polja za polje geografske širine.",
    "longFieldsDesc": "Moguća imena polja za polje geografske dužine.",
    "intersectFieldDesc": "Ime polja kreiranog da skladišti vrednost ako je pretraga presekla sloj.",
    "intersectInDesc": "Vrednost za skladištenje kada je lokacija presečena poligonom.",
    "intersectOutDesc": "Vrednost za skladištenje kada lokacija nije presečena poligonom.",
    "maxRowCount": "Maksimalan broj redova u CSV datoteci.",
    "cacheNumberDesc": "Granična vrednost klastera tačaka za brže obrađivanje.",
    "subTitle": "Postavi vrednosti za CSV datoteku.",
    "geometryServiceDesc": "URL adresa servisa geometrije za reprojektovanje tačaka."
  },
  "noPolygonLayers": "Nema slojeva poligona",
  "errorOnOk": "Popunite sve parametre pre čuvanja konfiguracije",
  "saveFields": "Sačuvaj polja",
  "cancelFields": "Otkaži polja",
  "saveAdv": "Sačuvaj napredne postavke",
  "cancelAdv": "Otkaži napredne postavke",
  "advSettingsBtn": "Napredne postavke",
  "chooseSymbol": "Izaberi simbol",
  "okBtn": "U redu",
  "cancelBtn": "Otkaži"
});


text:
<?php

namespace Phpactor\ClassFileConverter\Adapter\Simple;

use Phpactor\ClassFileConverter\Domain\ClassToFile;
use Phpactor\ClassFileConverter\Domain\FilePathCandidates;
use Phpactor\ClassFileConverter\Domain\ClassName;
use Phpactor\ClassFileConverter\Domain\FilePath;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use RegexIterator;

class SimpleClassToFile implements ClassToFile
{
    /**
     * @var string
     */
    private $cwd;

    /**
     * @var ClassScanner
     */
    private $classScanner;

    public function __construct(string $cwd)
    {
        $this->cwd = $cwd;
        $this->classScanner = new ClassScanner();
    }

    public function classToFileCandidates(ClassName $className): FilePathCandidates
    {
        $candidates = [];
        $pattern = sprintf(
            '{^.*/%s.php$}',
            $className->name()
        );

        $iterator = new RecursiveDirectoryIterator($this->cwd);
        $iterator = new RecursiveIteratorIterator($iterator);
        $iterator = new RegexIterator($iterator, $pattern);

        foreach ($iterator as $phpFile) {
            if (ClassName::fromString(
                $this->classScanner->getClassNameFromFile($phpFile->getPathName())
            ) == $className) {
                $candidates[] = FilePath::fromString($phpFile->getPathName());
            }
        }

        return FilePathCandidates::fromFilePaths($candidates);
    }
}


text:
#include "deployment.h"
#include <core/error.h>
#include <core/kernel.h>
#include <middleware/port.h>
#include <types.h>
/*****************************************************/
/*  This file was automatically generated by Ocarina */
/*  Do NOT hand-modify this file, as your            */
/*  changes will be lost when you re-run Ocarina     */
/*****************************************************/
uint8_t pr2_partport[1] = {pr2_pdatain};
uint8_t pr1_pdataout_deployment_destinations[1] = {pr2_pdatain_global};
uint8_t pr1_partport[1] = {pr1_pdataout};
uint8_t pok_global_ports_to_local_ports[POK_CONFIG_NB_GLOBAL_PORTS] = {
    pr2_pdatain, pr1_pdataout};
pok_bus_identifier_t pok_global_ports_to_bus[POK_CONFIG_NB_GLOBAL_PORTS] = {
    invalid_bus, invalid_bus};
uint8_t pok_buses_partitions[POK_CONFIG_NB_BUSES] = {};
uint8_t pok_local_ports_to_global_ports[POK_CONFIG_NB_PORTS] = {
    pr2_pdatain_global, pr1_pdataout_global};
uint8_t pok_ports_nodes[POK_CONFIG_NB_GLOBAL_PORTS] = {0, 0};
/*  This array indicates on which node is located each port. For example, it */
/*  means that the first port is located on the node that is represented in */
/*  this array with the first value. You can check node identifier values in */
/*  the deployment.h file*/
uint8_t pok_ports_nb_ports_by_partition[POK_CONFIG_NB_PARTITIONS] = {1, 1};
uint8_t *pok_ports_by_partition[POK_CONFIG_NB_PARTITIONS] = {pr2_partport,
                                                             pr1_partport};
char *pok_ports_names[POK_CONFIG_NB_PORTS] = {"pr2_pdatain", "pr1_pdataout"};
/*  This array contains the identifier of each port involved in */
/*  inter-partition communication. These names are used in */
/*  pok_port_sampling_create() and pok_port_ queueing_create*/
uint8_t pok_ports_identifiers[POK_CONFIG_NB_PORTS] = {pr2_pdatain,
                                                      pr1_pdataout};
uint8_t pok_ports_nb_destinations[POK_CONFIG_NB_PORTS] = {0, 1};
uint8_t *pok_ports_destinations[POK_CONFIG_NB_PORTS] = {
    NULL, pr1_pdataout_deployment_destinations};
pok_port_kind_t pok_ports_kind[POK_CONFIG_NB_PORTS] = {POK_PORT_KIND_SAMPLING,
                                                       POK_PORT_KIND_SAMPLING};

/**************************/
/* pok_partition_error   */
/*************************/

void pok_partition_error(uint8_t partition, uint32_t error) {

  switch (partition) {
  case 0: {
    switch (error) {
    case POK_ERROR_KIND_PARTITION_CONFIGURATION: {
      pok_error_partition_callback(0);

      break;
    }
    }

    break;
  }
  case 1: {
    switch (error) {
    case POK_ERROR_KIND_PARTITION_CONFIGURATION: {
      pok_error_partition_callback(1);

      break;
    }
    }

    break;
  }
  }
}

/***********************/
/* pok_kernel_error   */
/**********************/

void pok_kernel_error(uint32_t error) {

  switch (error) {
  case POK_ERROR_KIND_KERNEL_INIT: {
    pok_kernel_restart();

    break;
  }
  }
}


text:
<?php

namespace Magento\OfflinePayments\Model;

use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Framework\Escaper;
use Magento\Payment\Helper\Data as PaymentHelper;

class CheckmoConfigProvider implements ConfigProviderInterface
{
    /**
     * @var string[]
     */
    protected $methodCode = Checkmo::PAYMENT_METHOD_CHECKMO_CODE;

    /**
     * @var Checkmo
     */
    protected $method;

    /**
     * @var Escaper
     */
    protected $escaper;

    /**
     * @param PaymentHelper $paymentHelper
     * @param Escaper $escaper
     */
    public function __construct(
        PaymentHelper $paymentHelper,
        Escaper $escaper
    ) {
        $this->escaper = $escaper;
        $this->method = $paymentHelper->getMethodInstance($this->methodCode);
    }

    /**
     * {@inheritdoc}
     */
    public function getConfig()
    {
        return $this->method->isAvailable() ? [
            'payment' => [
                'checkmo' => [
                    'mailingAddress' => $this->getMailingAddress(),
                    'payableTo' => $this->getPayableTo(),
                ],
            ],
        ] : [];
    }

    /**
     * Get mailing address from config
     *
     * @return string
     */
    protected function getMailingAddress()
    {
        return nl2br($this->escaper->escapeHtml($this->method->getMailingAddress()));
    }

    /**
     * Get payable to from config
     *
     * @return string
     */
    protected function getPayableTo()
    {
        return $this->method->getPayableTo();
    }
}


text:
for(var i = 0; i < 187; i++) { var scriptId = 'u' + i; window[scriptId] = document.getElementById(scriptId); }

$axure.eventManager.pageLoad(
function (e) {

if (true) {

	SetPanelState('u3', 'pd1u3','none','',500,'none','',500);

SetWidgetSelected('u53');
}

});

function rdo2Click(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Blog__Detail.html');

}

}

function rdo4Click(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Blog__Detail.html');

}

}

function rdo6Click(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Blog__Detail.html');

}

}

function rdo3Click(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Blog__Detail.html');

}

}

function rdo5Click(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Blog__Detail.html');

}

}

function rdo0Home(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Home__Find_A_Store.html');

}

}

function rdo0More(e) {

if (true) {

	SetPanelVisibility('u44','','none',500);

	BringToFront("u44");

	MoveWidgetBy('u75', GetNum('0'), GetNum('245'),'none',500);

}

}

function rdo0Less(e) {

if (true) {

	SetPanelVisibility('u44','hidden','none',500);

	SendToBack("u44");

	MoveWidgetBy('u75', GetNum('0'), GetNum('-245'),'none',500);

}

}
gv_vAlignTable['u115'] = 'center';document.getElementById('u21_img').tabIndex = 0;

u21.style.cursor = 'pointer';
$axure.eventManager.click('u21', function(e) {

if (true) {

	SetPanelState('u16', 'pd1u16','none','',500,'none','',500);

rdo0More(e);

}
});
gv_vAlignTable['u32'] = 'center';gv_vAlignTable['u156'] = 'center';document.getElementById('u130_img').tabIndex = 0;

u130.style.cursor = 'pointer';
$axure.eventManager.click('u130', function(e) {

if (true) {

rdo3Click(e);

}
});
gv_vAlignTable['u7'] = 'center';gv_vAlignTable['u2'] = 'center';document.getElementById('u4_img').tabIndex = 0;

u4.style.cursor = 'pointer';
$axure.eventManager.click('u4', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Store_Details__Gateway.html');

}
});
document.getElementById('u140_img').tabIndex = 0;

u140.style.cursor = 'pointer';
$axure.eventManager.click('u140', function(e) {

if (true) {

rdo4Click(e);

}
});
document.getElementById('u17_img').tabIndex = 0;

u17.style.cursor = 'pointer';
$axure.eventManager.click('u17', function(e) {

if (true) {

	SetPanelState('u16', 'pd0u16','none','',500,'none','',500);

rdo0Less(e);

}
});
gv_vAlignTable['u135'] = 'center';document.getElementById('u42_img').tabIndex = 0;

u42.style.cursor = 'pointer';
$axure.eventManager.click('u42', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Store_Results.html');

}
});
document.getElementById('u159_img').tabIndex = 0;

u159.style.cursor = 'pointer';
$axure.eventManager.click('u159', function(e) {

if (true) {

rdo5Click(e);

}
});
document.getElementById('u55_img').tabIndex = 0;
HookClick('u55', false);

u55.style.cursor = 'pointer';
$axure.eventManager.click('u55', function(e) {

if (true) {

	self.location.href='http://www.wholefoodsmarket.com/whole-foods-market';

}
});
gv_vAlignTable['u186'] = 'center';document.getElementById('u14_img').tabIndex = 0;

u14.style.cursor = 'pointer';
$axure.eventManager.click('u14', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Shopping_List__Home.html');

}
});
gv_vAlignTable['u48'] = 'center';document.getElementById('u105_img').tabIndex = 0;

u105.style.cursor = 'pointer';
$axure.eventManager.click('u105', function(e) {

if (true) {

rdo2Click(e);

}
});
gv_vAlignTable['u138'] = 'center';gv_vAlignTable['u52'] = 'center';gv_vAlignTable['u20'] = 'center';gv_vAlignTable['u152'] = 'center';document.getElementById('u6_img').tabIndex = 0;

u6.style.cursor = 'pointer';
$axure.eventManager.click('u6', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Store_Details__Lamar.html');

}
});
gv_vAlignTable['u108'] = 'center';document.getElementById('u37_img').tabIndex = 0;

u37.style.cursor = 'pointer';
$axure.eventManager.click('u37', function(e) {

if (true) {

	SetPanelState('u33', 'pd1u33','none','',500,'swing','left',1000);

}
});
gv_vAlignTable['u62'] = 'center';gv_vAlignTable['u141'] = 'center';gv_vAlignTable['u11'] = 'center';gv_vAlignTable['u133'] = 'center';document.getElementById('u34_img').tabIndex = 0;

u34.style.cursor = 'pointer';
$axure.eventManager.click('u34', function(e) {

if ((GetWidgetText('u36')) != ('enter text...')) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Search_Results.html');

}
});
gv_vAlignTable['u89'] = 'center';document.getElementById('u47_img').tabIndex = 0;
HookClick('u47', false);

u47.style.cursor = 'pointer';
$axure.eventManager.click('u47', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Product_FAQs_Landing.html');

}
});
gv_vAlignTable['u184'] = 'center';document.getElementById('u103_img').tabIndex = 0;

u103.style.cursor = 'pointer';
$axure.eventManager.click('u103', function(e) {

if (true) {

rdo2Click(e);

}
});
gv_vAlignTable['u164'] = 'center';gv_vAlignTable['u78'] = 'center';gv_vAlignTable['u179'] = 'center';document.getElementById('u57_img').tabIndex = 0;
HookClick('u57', false);

u57.style.cursor = 'pointer';
$axure.eventManager.click('u57', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Online_Ordering.html');

}
});
gv_vAlignTable['u119'] = 'center';gv_vAlignTable['u125'] = 'center';gv_vAlignTable['u41'] = 'center';gv_vAlignTable['u54'] = 'center';gv_vAlignTable['u38'] = 'center';document.getElementById('u176_img').tabIndex = 0;

u176.style.cursor = 'pointer';
$axure.eventManager.click('u176', function(e) {

if (true) {

rdo6Click(e);

}
});
gv_vAlignTable['u26'] = 'center';document.getElementById('u51_img').tabIndex = 0;
HookClick('u51', false);

u51.style.cursor = 'pointer';
$axure.eventManager.click('u51', function(e) {

if (true) {

	self.location.href='http://www.wholefoodsmarket.com/careers';

}
});

$axure.eventManager.click('u182', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Blog__Detail.html');

}
});
document.getElementById('u10_img').tabIndex = 0;

u10.style.cursor = 'pointer';
$axure.eventManager.click('u10', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Recipes.html');

}
});
gv_vAlignTable['u100'] = 'top';document.getElementById('u23_img').tabIndex = 0;

u23.style.cursor = 'pointer';
$axure.eventManager.click('u23', function(e) {

if (true) {

	SetPanelState('u16', 'pd1u16','none','',500,'none','',500);

rdo0More(e);

}
});
document.getElementById('u144_img').tabIndex = 0;

u144.style.cursor = 'pointer';
$axure.eventManager.click('u144', function(e) {

if (true) {

rdo4Click(e);

}
});
gv_vAlignTable['u82'] = 'center';
u36.style.cursor = 'pointer';
$axure.eventManager.click('u36', function(e) {

if (true) {

SetWidgetFormText('u36', '');

}
});
gv_vAlignTable['u158'] = 'center';
$axure.eventManager.click('u74', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Home__Find_A_Store.html');

}
});

$axure.eventManager.click('u74', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Home__Find_A_Store.html');

}
});

$axure.eventManager.click('u74', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Home__Find_A_Store.html');

}
});
gv_vAlignTable['u123'] = 'center';gv_vAlignTable['u160'] = 'center';gv_vAlignTable['u92'] = 'center';gv_vAlignTable['u46'] = 'center';gv_vAlignTable['u181'] = 'center';gv_vAlignTable['u5'] = 'center';gv_vAlignTable['u98'] = 'center';gv_vAlignTable['u127'] = 'center';gv_vAlignTable['u43'] = 'center';gv_vAlignTable['u169'] = 'center';gv_vAlignTable['u56'] = 'center';gv_vAlignTable['u150'] = 'center';document.getElementById('u142_img').tabIndex = 0;

u142.style.cursor = 'pointer';
$axure.eventManager.click('u142', function(e) {

if (true) {

rdo4Click(e);

}
});
gv_vAlignTable['u106'] = 'center';gv_vAlignTable['u154'] = 'top';document.getElementById('u53_img').tabIndex = 0;
HookClick('u53', false);

u53.style.cursor = 'pointer';
$axure.eventManager.click('u53', function(e) {

if (true) {

    self.location.href="resources/reload.html#" + encodeURI($axure.globalVariableProvider.getLinkUrl($axure.pageData.url));

}
});
gv_vAlignTable['u104'] = 'center';gv_vAlignTable['u121'] = 'center';document.getElementById('u19_img').tabIndex = 0;

u19.style.cursor = 'pointer';
$axure.eventManager.click('u19', function(e) {

if (true) {

	SetPanelState('u16', 'pd0u16','none','',500,'none','',500);

rdo0Less(e);

}
});

$axure.eventManager.click('u109', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Blog__Detail.html');

}
});
gv_vAlignTable['u84'] = 'center';gv_vAlignTable['u50'] = 'center';document.getElementById('u134_img').tabIndex = 0;

u134.style.cursor = 'pointer';
$axure.eventManager.click('u134', function(e) {

if (true) {

rdo3Click(e);

}
});
gv_vAlignTable['u177'] = 'center';gv_vAlignTable['u94'] = 'center';gv_vAlignTable['u60'] = 'center';gv_vAlignTable['u102'] = 'center';gv_vAlignTable['u9'] = 'center';document.getElementById('u163_img').tabIndex = 0;

u163.style.cursor = 'pointer';
$axure.eventManager.click('u163', function(e) {

if (true) {

rdo5Click(e);

}
});
gv_vAlignTable['u131'] = 'center';gv_vAlignTable['u64'] = 'center';gv_vAlignTable['u24'] = 'center';gv_vAlignTable['u162'] = 'center';gv_vAlignTable['u117'] = 'top';gv_vAlignTable['u13'] = 'center';gv_vAlignTable['u113'] = 'top';document.getElementById('u132_img').tabIndex = 0;

u132.style.cursor = 'pointer';
$axure.eventManager.click('u132', function(e) {

if (true) {

rdo3Click(e);

}
});
gv_vAlignTable['u175'] = 'center';gv_vAlignTable['u129'] = 'center';gv_vAlignTable['u86'] = 'center';gv_vAlignTable['u58'] = 'center';gv_vAlignTable['u173'] = 'center';gv_vAlignTable['u111'] = 'center';gv_vAlignTable['u171'] = 'top';document.getElementById('u83_img').tabIndex = 0;

u83.style.cursor = 'pointer';
$axure.eventManager.click('u83', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Home__Select_A_Store.html');

}
});
document.getElementById('u178_img').tabIndex = 0;

u178.style.cursor = 'pointer';
$axure.eventManager.click('u178', function(e) {

if (true) {

rdo6Click(e);

}
});
document.getElementById('u8_img').tabIndex = 0;

u8.style.cursor = 'pointer';
$axure.eventManager.click('u8', function(e) {

if (true) {

rdo0Home(e);

}
});
gv_vAlignTable['u96'] = 'center';
$axure.eventManager.click('u146', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Blog__Detail.html');

}
});
gv_vAlignTable['u15'] = 'center';document.getElementById('u49_img').tabIndex = 0;
HookClick('u49', false);

u49.style.cursor = 'pointer';
$axure.eventManager.click('u49', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Our_Apps.html');

}
});
gv_vAlignTable['u80'] = 'center';gv_vAlignTable['u148'] = 'center';gv_vAlignTable['u167'] = 'center';gv_vAlignTable['u145'] = 'center';document.getElementById('u12_img').tabIndex = 0;

u12.style.cursor = 'pointer';
$axure.eventManager.click('u12', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Deals.html');

}
});

$axure.eventManager.click('u165', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Blog__Detail.html');

}
});
document.getElementById('u25_img').tabIndex = 0;

u25.style.cursor = 'pointer';
$axure.eventManager.click('u25', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Home__Find_A_Store.html');

}
});
HookClick('u59', false);
gv_vAlignTable['u18'] = 'center';document.getElementById('u161_img').tabIndex = 0;

u161.style.cursor = 'pointer';
$axure.eventManager.click('u161', function(e) {

if (true) {

rdo5Click(e);

}
});
document.getElementById('u45_img').tabIndex = 0;
HookClick('u45', false);

u45.style.cursor = 'pointer';
$axure.eventManager.click('u45', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Special_Diets_Overview.html');

}
});
gv_vAlignTable['u22'] = 'center';gv_vAlignTable['u143'] = 'center';document.getElementById('u107_img').tabIndex = 0;

u107.style.cursor = 'pointer';
$axure.eventManager.click('u107', function(e) {

if (true) {

rdo2Click(e);

}
});
gv_vAlignTable['u35'] = 'center';
$axure.eventManager.click('u136', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('Blog__Detail.html');

}
});
document.getElementById('u180_img').tabIndex = 0;

u180.style.cursor = 'pointer';
$axure.eventManager.click('u180', function(e) {

if (true) {

rdo6Click(e);

}
});


text:
@import AppKit;

#define kGraphiteAccentColor -1

extern NSInteger NSColorGetUserAccentColor(void);


text:
//
//  CLDAccountUser.h
//  MEOCloudSDK
//
//  Created by Hugo Sousa on 17/03/14.
//
//

#import <MEOCloudSDK/CLDUser.h>

/**
 This subclass of <CLDUser> is used to represent a user's account information.
 */
@interface CLDAccountUser : CLDUser

/**
 `BOOL` stating if the user's account is currently active.
 @since 1.0
 */
@property (readonly, nonatomic, getter = isActive) BOOL active;

/**
 `BOOL` stating if the user's account is still in trial.
 @since 1.0
 */
@property (readonly, nonatomic, getter = isTrial) BOOL trial;

/**
 Total quota available to the user.
 @since 1.0
 */
@property (readonly, strong, nonatomic) NSDecimalNumber *quotaTotal;

/**
 Available free space on the user's account.
 @since 1.0
 */
@property (readonly, strong, nonatomic) NSDecimalNumber *quotaAvailable;

/**
 Total used quota with both normal and shared content.
 @since 1.0
 */
@property (readonly, strong, nonatomic) NSDecimalNumber *quotaUsed;

/**
 Total used quota with normal content.
 @see quotaUsed
 @since 1.0
 */
@property (readonly, strong, nonatomic) NSDecimalNumber *quotaUsedNormal;

/**
 Total used quota with shared content.
 @see quotaUsed
 @since 1.0
 */
@property (readonly, strong, nonatomic) NSDecimalNumber *quotaUsedShared;

/**
 The user's referral code.
 @since 1.0
 */
@property (readonly, strong, nonatomic) NSString *referralCode;

/**
 The user's referral URL. Use this if you want to invite others using this user's referral code.
 @since 1.0
 */
@property (readonly, strong, nonatomic) NSURL *referralURL;

/**
 The date when the user signed up.
 @since 1.0
 */
@property (readonly, strong, nonatomic) NSDate *createDate;

/**
 The date of the user's last event.
 @since 1.0
 */
@property (readonly, strong, nonatomic) NSDate *lastEventDate;

@end