text:
package api

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"net/http/httptest"
	"testing"
	"time"

	"github.com/hobeone/pointyhair/db"
)

const getNoteGoldenResponse = `{
  "notes": [
    {
      "id": 1,
      "date": "0001-01-01T00:00:00Z",
      "text": "http://testfeed1/feed.atom",
      "category": "",
      "person": 3
    },
    {
      "id": 2,
      "date": "0001-01-01T00:00:00Z",
      "text": "http://testfeed2/feed.atom",
      "category": "",
      "person": 3
    },
    {
      "id": 3,
      "date": "0001-01-01T00:00:00Z",
      "text": "http://testfeed3/feed.atom",
      "category": "",
      "person": 3
    }
  ]
}`

func TestGetNotes(t *testing.T) {
	dbh, m := setupTest(t)
	dbh.ORM.Begin()
	defer dbh.ORM.Rollback()
	loadFixtures(dbh)

	response := httptest.NewRecorder()

	req, _ := http.NewRequest("GET", "/api/1/notes", nil)
	m.ServeHTTP(response, req)

	if response.Code != 200 {
		fmt.Println(response.Body.String())
		t.Fatalf("Expected 200 response code, got %d", response.Code)
	}

	if response.Body.String() != getNoteGoldenResponse {
		fmt.Println(response.Body.String())
		t.Fatalf("Response doesn't match golden response")
	}
}

const getNoteWithIdsGoldenResponse = `{
  "notes": [
    {
      "id": 1,
      "date": "0001-01-01T00:00:00Z",
      "text": "http://testfeed1/feed.atom",
      "category": "",
      "person": 3
    },
    {
      "id": 2,
      "date": "0001-01-01T00:00:00Z",
      "text": "http://testfeed2/feed.atom",
      "category": "",
      "person": 3
    }
  ]
}`

func TestGetNotesWithIds(t *testing.T) {
	dbh, m := setupTest(t)

	dbh.ORM.Begin()
	defer dbh.ORM.Rollback()
	loadFixtures(dbh)

	response := httptest.NewRecorder()

	req, _ := http.NewRequest("GET", "/api/1/notes?ids[]=1&ids[]=2", nil)
	m.ServeHTTP(response, req)

	if response.Code != 200 {
		fmt.Println(response.Body.String())
		t.Fatalf("Expected 200 response code, got %d", response.Code)
	}

	if response.Body.String() != getNoteWithIdsGoldenResponse {
		fmt.Println(response.Body.String())
		t.Fatalf("Response doesn't match golden response")
	}
}

const getNoteWithIdGoldenResponse = `{
  "note": {
    "id": 1,
    "date": "0001-01-01T00:00:00Z",
    "text": "http://testfeed1/feed.atom",
    "category": "",
    "person": 3
  }
}`

func TestGetNotesById(t *testing.T) {
	dbh, m := setupTest(t)

	dbh.ORM.Begin()
	defer dbh.ORM.Rollback()
	loadFixtures(dbh)

	response := httptest.NewRecorder()

	req, _ := http.NewRequest("GET", "/api/1/notes/1", nil)
	m.ServeHTTP(response, req)

	if response.Code != 200 {
		fmt.Println(response.Body.String())
		t.Fatalf("Expected 200 response code, got %d", response.Code)
	}

	if response.Body.String() != getNoteWithIdGoldenResponse {
		fmt.Println(response.Body.String())
		t.Fatalf("Response doesn't match golden response")
	}
}

func TestCreateWithInvalidPersonId(t *testing.T) {
	dbh, m := setupTest(t)

	dbh.ORM.Begin()
	defer dbh.ORM.Rollback()
	loadFixtures(dbh)

	test_person_id := int64(1000)
	_, err := dbh.GetPersonById(test_person_id)
	if err == nil {
		t.Fatal("Person with ID 1000 shouldn't exist")
	}

	tdate := time.Now()
	n := NoteJSON{
		Note: noteWithPersonIdJSON{
			&db.Note{
				Text: "testtext",
				Date: tdate,
			},
			test_person_id,
		},
	}
	req_body, err := json.Marshal(n)
	failOnError(t, err)

	response := httptest.NewRecorder()
	req, _ := http.NewRequest("POST", "/api/1/notes", bytes.NewReader(req_body))
	req.Header.Set("Content-Type", "application/json; charset=UTF-8")
	m.ServeHTTP(response, req)

	if response.Code != 500 {
		fmt.Println(response.Body.String())
		t.Fatalf("Expected 500 response code, got %d", response.Code)
	}
}

func TestCreateNote(t *testing.T) {
	dbh, m := setupTest(t)

	dbh.ORM.Begin()
	defer dbh.ORM.Rollback()
	loadFixtures(dbh)

	tdate := time.Now()
	n := NoteJSON{
		Note: noteWithPersonIdJSON{
			&db.Note{
				Text: "testtext",
				Date: tdate,
			},
			1,
		},
	}
	req_body, err := json.Marshal(n)
	failOnError(t, err)

	response := httptest.NewRecorder()
	req, _ := http.NewRequest("POST", "/api/1/notes", bytes.NewReader(req_body))
	req.Header.Set("Content-Type", "application/json; charset=UTF-8")
	m.ServeHTTP(response, req)

	if response.Code != 200 {
		fmt.Println(response.Body.String())
		t.Fatalf("Expected 200 response code, got %d", response.Code)
	}

	u := unmarshalNoteJSONContainer{}
	err = json.NewDecoder(response.Body).Decode(&u)
	failOnError(t, err)
	if u.Note.Date != tdate {
		t.Fatalf("Note Date doesn't match test Date: %v != %v",
			u.Note.Date, tdate)
	}

	if u.Note.Text != "testtext" {
		t.Fatalf("Note Text doesn't match test text: %s != %s",
			u.Note.Text, "testtext")
	}
}

func TestUpdateNote(t *testing.T) {
	dbh, m := setupTest(t)

	dbh.ORM.Begin()
	defer dbh.ORM.Rollback()
	loadFixtures(dbh)

	dbnote, err := dbh.GetNoteById(1)
	failOnError(t, err)

	new_text_string := "New Text STRING"
	dbnote.Text = new_text_string
	n := NoteJSON{
		Note: noteWithPersonIdJSON{
			dbnote,
			1,
		},
	}
	req_body, err := json.Marshal(n)
	failOnError(t, err)

	response := httptest.NewRecorder()
	req, _ := http.NewRequest("PUT", "/api/1/notes/1", bytes.NewReader(req_body))
	req.Header.Set("Content-Type", "application/json; charset=UTF-8")
	m.ServeHTTP(response, req)

	if response.Code != 200 {
		fmt.Println(response.Body.String())
		t.Fatalf("Expected 200 response code, got %d", response.Code)
	}

	dbnote, err = dbh.GetNoteById(1)
	failOnError(t, err)
	if dbnote.Text != new_text_string {
		t.Fatalf("text field wasn't updated")
	}
}

func TestUpdateNonExistingNote(t *testing.T) {
	dbh, m := setupTest(t)

	dbh.ORM.Begin()
	defer dbh.ORM.Rollback()
	loadFixtures(dbh)
	non_existing_id := int64(100)

	_, err := dbh.GetNoteById(non_existing_id)
	if err == nil {
		t.Fatalf("Didn't expect to find note with id 100")
	}

	n := NoteJSON{
		Note: noteWithPersonIdJSON{
			&db.Note{},
			1,
		},
	}
	req_body, err := json.Marshal(n)
	failOnError(t, err)

	response := httptest.NewRecorder()
	req, _ := http.NewRequest("PUT", fmt.Sprintf("/api/1/notes/%d", non_existing_id), bytes.NewReader(req_body))
	req.Header.Set("Content-Type", "application/json; charset=UTF-8")
	m.ServeHTTP(response, req)

	if response.Code != 404 {
		fmt.Println(response.Body.String())
		t.Fatalf("Expected 404 response code, got %d", response.Code)
	}
}

repository: hobeone/pointyhair

repo_name: hobeone/pointyhair


text:
# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)

SUMMARY = "Fast, unopinionated, minimalist web framework"
HOMEPAGE = "http://expressjs.com/"
# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
# your responsibility to verify that the values are complete and correct.
#
# The following license files were not able to be identified and are
# represented as "Unknown" below, you will need to check them yourself:
#   node_modules/body-parser/node_modules/qs/LICENSE
#   node_modules/qs/LICENSE
#
# NOTE: multiple licenses have been detected; they have been separated with &
# in the LICENSE value for now since it is a reasonable assumption that all
# of the licenses apply. If instead there is a choice between the multiple
# licenses then you should change the value to separate the licenses with |
# instead of &. If there is any doubt, check the accompanying documentation
# to determine which situation is applicable.
LICENSE = "MIT & ISC & BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=5513c00a5c36cd361da863dd9aa8875d \
                    file://node_modules/type-is/LICENSE;md5=0afd201e48c7d095454eed4ac1184e40 \
                    file://node_modules/etag/LICENSE;md5=6e8686b7b13dd7ac8733645a81842c4a \
                    file://node_modules/array-flatten/LICENSE;md5=44088ba57cb871a58add36ce51b8de08 \
                    file://node_modules/content-disposition/LICENSE;md5=13babc4f212ce635d68da544339c962b \
                    file://node_modules/content-disposition/node_modules/safe-buffer/LICENSE;md5=badd5e91c737e7ffdf10b40c1f907761 \
                    file://node_modules/fresh/LICENSE;md5=373c2cf0978b37e434394a43b4cbbdb4 \
                    file://node_modules/body-parser/LICENSE;md5=0afd201e48c7d095454eed4ac1184e40 \
                    file://node_modules/body-parser/node_modules/type-is/LICENSE;md5=0afd201e48c7d095454eed4ac1184e40 \
                    file://node_modules/body-parser/node_modules/type-is/node_modules/media-typer/LICENSE;md5=c6e0ce1e688c5ff16db06b7259e9cd20 \
                    file://node_modules/body-parser/node_modules/type-is/node_modules/mime-types/LICENSE;md5=bf1f9ad1e2e1d507aef4883fff7103de \
                    file://node_modules/body-parser/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/LICENSE;md5=c8d3a30332ecb31cfaf4c0a06da18f5c \
                    file://node_modules/body-parser/node_modules/raw-body/LICENSE;md5=c970d30155ebbdb1903e6de8c0666e18 \
                    file://node_modules/body-parser/node_modules/raw-body/node_modules/unpipe/LICENSE;md5=934ab86a8ab081ea0326add08d550739 \
                    file://node_modules/body-parser/node_modules/raw-body/node_modules/iconv-lite/LICENSE;md5=f942263d98f0d75e0e0101884e86261d \
                    file://node_modules/body-parser/node_modules/raw-body/node_modules/iconv-lite/node_modules/safer-buffer/LICENSE;md5=3baebc2a17b8f5bff04882cd0dc0f76e \
                    file://node_modules/body-parser/node_modules/raw-body/node_modules/http-errors/LICENSE;md5=607209623abfcc77b9098f71a0ef52f9 \
                    file://node_modules/body-parser/node_modules/raw-body/node_modules/bytes/LICENSE;md5=013e95467eddb048f19a6f5b42820f86 \
                    file://node_modules/body-parser/node_modules/iconv-lite/LICENSE;md5=f942263d98f0d75e0e0101884e86261d \
                    file://node_modules/body-parser/node_modules/on-finished/LICENSE;md5=1b1f7f9cec194121fdf616b971df7a7b \
                    file://node_modules/body-parser/node_modules/on-finished/node_modules/ee-first/LICENSE;md5=c8d3a30332ecb31cfaf4c0a06da18f5c \
                    file://node_modules/body-parser/node_modules/http-errors/LICENSE;md5=607209623abfcc77b9098f71a0ef52f9 \
                    file://node_modules/body-parser/node_modules/http-errors/node_modules/inherits/LICENSE;md5=5b2ef2247af6d355ae9d9f988092d470 \
                    file://node_modules/body-parser/node_modules/http-errors/node_modules/toidentifier/LICENSE;md5=1a261071a044d02eb6f2bb47f51a3502 \
                    file://node_modules/body-parser/node_modules/http-errors/node_modules/statuses/LICENSE;md5=36e2bc837ce69a98cc33a9e140d457e5 \
                    file://node_modules/body-parser/node_modules/http-errors/node_modules/setprototypeof/LICENSE;md5=4846f1626304c2c0f806a539bbc7d54a \
                    file://node_modules/body-parser/node_modules/http-errors/node_modules/depd/LICENSE;md5=13babc4f212ce635d68da544339c962b \
                    file://node_modules/body-parser/node_modules/debug/LICENSE;md5=ddd815a475e7338b0be7a14d8ee35a99 \
                    file://node_modules/body-parser/node_modules/debug/node_modules/ms/license.md;md5=fd56fd5f1860961dfa92d313167c37a6 \
                    file://node_modules/body-parser/node_modules/depd/LICENSE;md5=13babc4f212ce635d68da544339c962b \
                    file://node_modules/body-parser/node_modules/bytes/LICENSE;md5=013e95467eddb048f19a6f5b42820f86 \
                    file://node_modules/body-parser/node_modules/qs/LICENSE;md5=d5c7c6dc45a33a0a9620ed81315672d7 \
                    file://node_modules/body-parser/node_modules/content-type/LICENSE;md5=f4b767f006864f81a4901347fe4efdab \
                    file://node_modules/on-finished/LICENSE;md5=1b1f7f9cec194121fdf616b971df7a7b \
                    file://node_modules/serve-static/LICENSE;md5=27b1707520b14d0bc890f4e75cd387b0 \
                    file://node_modules/serve-static/node_modules/send/LICENSE;md5=df2b0938eba0709b77ac937e2d552b7a \
                    file://node_modules/serve-static/node_modules/send/node_modules/etag/LICENSE;md5=6e8686b7b13dd7ac8733645a81842c4a \
                    file://node_modules/serve-static/node_modules/send/node_modules/destroy/LICENSE;md5=c8d3a30332ecb31cfaf4c0a06da18f5c \
                    file://node_modules/serve-static/node_modules/send/node_modules/fresh/LICENSE;md5=373c2cf0978b37e434394a43b4cbbdb4 \
                    file://node_modules/serve-static/node_modules/send/node_modules/on-finished/LICENSE;md5=1b1f7f9cec194121fdf616b971df7a7b \
                    file://node_modules/serve-static/node_modules/send/node_modules/statuses/LICENSE;md5=36e2bc837ce69a98cc33a9e140d457e5 \
                    file://node_modules/serve-static/node_modules/send/node_modules/ms/license.md;md5=fd56fd5f1860961dfa92d313167c37a6 \
                    file://node_modules/serve-static/node_modules/send/node_modules/http-errors/LICENSE;md5=607209623abfcc77b9098f71a0ef52f9 \
                    file://node_modules/serve-static/node_modules/send/node_modules/debug/LICENSE;md5=ddd815a475e7338b0be7a14d8ee35a99 \
                    file://node_modules/serve-static/node_modules/send/node_modules/range-parser/LICENSE;md5=d4246fb961a4f121eef5ffca47f0b010 \
                    file://node_modules/serve-static/node_modules/send/node_modules/mime/LICENSE;md5=8e8ea2ad138ce468f8570a0edbadea65 \
                    file://node_modules/serve-static/node_modules/send/node_modules/encodeurl/LICENSE;md5=272621efa0ff4f18a73221e49ab60654 \
                    file://node_modules/serve-static/node_modules/send/node_modules/escape-html/LICENSE;md5=f8746101546eeb9e4f6de64bb8bdf595 \
                    file://node_modules/serve-static/node_modules/send/node_modules/depd/LICENSE;md5=13babc4f212ce635d68da544339c962b \
                    file://node_modules/serve-static/node_modules/parseurl/LICENSE;md5=e7842ed4f188e53e53c3e8d9c4807e89 \
                    file://node_modules/serve-static/node_modules/encodeurl/LICENSE;md5=272621efa0ff4f18a73221e49ab60654 \
                    file://node_modules/serve-static/node_modules/escape-html/LICENSE;md5=f8746101546eeb9e4f6de64bb8bdf595 \
                    file://node_modules/statuses/LICENSE;md5=36e2bc837ce69a98cc33a9e140d457e5 \
                    file://node_modules/vary/LICENSE;md5=13babc4f212ce635d68da544339c962b \
                    file://node_modules/send/LICENSE;md5=df2b0938eba0709b77ac937e2d552b7a \
                    file://node_modules/cookie/LICENSE;md5=bc85b43b6f963e8ab3f88e63628448ca \
                    file://node_modules/safe-buffer/LICENSE;md5=badd5e91c737e7ffdf10b40c1f907761 \
                    file://node_modules/parseurl/LICENSE;md5=e7842ed4f188e53e53c3e8d9c4807e89 \
                    file://node_modules/finalhandler/LICENSE;md5=b506956e5cbfbe0d04f8a5c40107ec89 \
                    file://node_modules/finalhandler/node_modules/unpipe/LICENSE;md5=934ab86a8ab081ea0326add08d550739 \
                    file://node_modules/finalhandler/node_modules/on-finished/LICENSE;md5=1b1f7f9cec194121fdf616b971df7a7b \
                    file://node_modules/finalhandler/node_modules/statuses/LICENSE;md5=36e2bc837ce69a98cc33a9e140d457e5 \
                    file://node_modules/finalhandler/node_modules/parseurl/LICENSE;md5=e7842ed4f188e53e53c3e8d9c4807e89 \
                    file://node_modules/finalhandler/node_modules/debug/LICENSE;md5=ddd815a475e7338b0be7a14d8ee35a99 \
                    file://node_modules/finalhandler/node_modules/encodeurl/LICENSE;md5=272621efa0ff4f18a73221e49ab60654 \
                    file://node_modules/finalhandler/node_modules/escape-html/LICENSE;md5=f8746101546eeb9e4f6de64bb8bdf595 \
                    file://node_modules/merge-descriptors/LICENSE;md5=aaf57ba8c5c9bf256fea7e943991a81a \
                    file://node_modules/debug/LICENSE;md5=ddd815a475e7338b0be7a14d8ee35a99 \
                    file://node_modules/accepts/LICENSE;md5=bf1f9ad1e2e1d507aef4883fff7103de \
                    file://node_modules/accepts/node_modules/negotiator/LICENSE;md5=6417a862a5e35c17c904d9dda2cbd499 \
                    file://node_modules/accepts/node_modules/mime-types/LICENSE;md5=bf1f9ad1e2e1d507aef4883fff7103de \
                    file://node_modules/proxy-addr/LICENSE;md5=6e8686b7b13dd7ac8733645a81842c4a \
                    file://node_modules/proxy-addr/node_modules/ipaddr.js/LICENSE;md5=88f60a4b6e44cb849b5d907a7664c0ef \
                    file://node_modules/proxy-addr/node_modules/forwarded/LICENSE;md5=13babc4f212ce635d68da544339c962b \
                    file://node_modules/methods/LICENSE;md5=c16a7dd9f946172f07086576d135d9d3 \
                    file://node_modules/range-parser/LICENSE;md5=d4246fb961a4f121eef5ffca47f0b010 \
                    file://node_modules/utils-merge/LICENSE;md5=1cf0906082187f374cb9a63c54eb782c \
                    file://node_modules/setprototypeof/LICENSE;md5=4846f1626304c2c0f806a539bbc7d54a \
                    file://node_modules/encodeurl/LICENSE;md5=272621efa0ff4f18a73221e49ab60654 \
                    file://node_modules/escape-html/LICENSE;md5=f8746101546eeb9e4f6de64bb8bdf595 \
                    file://node_modules/path-to-regexp/LICENSE;md5=44088ba57cb871a58add36ce51b8de08 \
                    file://node_modules/depd/LICENSE;md5=13babc4f212ce635d68da544339c962b \
                    file://node_modules/qs/LICENSE;md5=d5c7c6dc45a33a0a9620ed81315672d7 \
                    file://node_modules/content-type/LICENSE;md5=f4b767f006864f81a4901347fe4efdab"

SRC_URI = "npm://registry.npmjs.org;name=express;version=${PV}"

NPM_SHRINKWRAP := "${THISDIR}/${PN}/npm-shrinkwrap.json"
NPM_LOCKDOWN := "${THISDIR}/${PN}/lockdown.json"

inherit npm

# Must be set after inherit npm since that itself sets S
S = "${WORKDIR}/npmpkg"

FILES_${PN} += " \
    /usr/lib \
    /usr/lib/node_modules \
    /usr/lib/node_modules/express \
"

LICENSE_${PN}-accepts-mime-types = "MIT"
LICENSE_${PN}-accepts-negotiator = "MIT"
LICENSE_${PN}-accepts = "MIT"
LICENSE_${PN}-array-flatten = "MIT"
LICENSE_${PN}-body-parser-bytes = "MIT"
LICENSE_${PN}-body-parser-content-type = "MIT"
LICENSE_${PN}-body-parser-debug-ms = "MIT"
LICENSE_${PN}-body-parser-debug = "MIT"
LICENSE_${PN}-body-parser-depd = "MIT"
LICENSE_${PN}-body-parser-http-errors-depd = "MIT"
LICENSE_${PN}-body-parser-http-errors-inherits = "ISC"
LICENSE_${PN}-body-parser-http-errors-setprototypeof = "ISC"
LICENSE_${PN}-body-parser-http-errors-statuses = "MIT"
LICENSE_${PN}-body-parser-http-errors-toidentifier = "MIT"
LICENSE_${PN}-body-parser-http-errors = "MIT"
LICENSE_${PN}-body-parser-iconv-lite = "MIT"
LICENSE_${PN}-body-parser-on-finished-ee-first = "MIT"
LICENSE_${PN}-body-parser-on-finished = "MIT"
LICENSE_${PN}-body-parser-qs = "BSD-3-Clause"
LICENSE_${PN}-body-parser-raw-body-bytes = "MIT"
LICENSE_${PN}-body-parser-raw-body-http-errors = "MIT"
LICENSE_${PN}-body-parser-raw-body-iconv-lite-safer-buffer = "MIT"
LICENSE_${PN}-body-parser-raw-body-iconv-lite = "MIT"
LICENSE_${PN}-body-parser-raw-body-unpipe = "MIT"
LICENSE_${PN}-body-parser-raw-body = "MIT"
LICENSE_${PN}-body-parser-type-is-media-typer = "MIT"
LICENSE_${PN}-body-parser-type-is-mime-types-mime-db = "MIT"
LICENSE_${PN}-body-parser-type-is-mime-types = "MIT"
LICENSE_${PN}-body-parser-type-is = "MIT"
LICENSE_${PN}-body-parser = "MIT"
LICENSE_${PN}-content-disposition-safe-buffer = "MIT"
LICENSE_${PN}-content-disposition = "MIT"
LICENSE_${PN}-content-type = "MIT"
LICENSE_${PN}-cookie-signature = "MIT"
LICENSE_${PN}-cookie = "MIT"
LICENSE_${PN}-debug = "MIT"
LICENSE_${PN}-depd = "MIT"
LICENSE_${PN}-encodeurl = "MIT"
LICENSE_${PN}-escape-html = "MIT"
LICENSE_${PN}-etag = "MIT"
LICENSE_${PN}-finalhandler-debug = "MIT"
LICENSE_${PN}-finalhandler-encodeurl = "MIT"
LICENSE_${PN}-finalhandler-escape-html = "MIT"
LICENSE_${PN}-finalhandler-on-finished = "MIT"
LICENSE_${PN}-finalhandler-parseurl = "MIT"
LICENSE_${PN}-finalhandler-statuses = "MIT"
LICENSE_${PN}-finalhandler-unpipe = "MIT"
LICENSE_${PN}-finalhandler = "MIT"
LICENSE_${PN}-fresh = "MIT"
LICENSE_${PN}-merge-descriptors = "MIT"
LICENSE_${PN}-methods = "MIT"
LICENSE_${PN}-on-finished = "MIT"
LICENSE_${PN}-parseurl = "MIT"
LICENSE_${PN}-path-to-regexp = "MIT"
LICENSE_${PN}-proxy-addr-forwarded = "MIT"
LICENSE_${PN}-proxy-addr-ipaddr.js = "MIT"
LICENSE_${PN}-proxy-addr = "MIT"
LICENSE_${PN}-qs = "BSD-3-Clause"
LICENSE_${PN}-range-parser = "MIT"
LICENSE_${PN}-safe-buffer = "MIT"
LICENSE_${PN}-send = "MIT"
LICENSE_${PN}-serve-static-encodeurl = "MIT"
LICENSE_${PN}-serve-static-escape-html = "MIT"
LICENSE_${PN}-serve-static-parseurl = "MIT"
LICENSE_${PN}-serve-static-send-debug = "MIT"
LICENSE_${PN}-serve-static-send-depd = "MIT"
LICENSE_${PN}-serve-static-send-destroy = "MIT"
LICENSE_${PN}-serve-static-send-encodeurl = "MIT"
LICENSE_${PN}-serve-static-send-escape-html = "MIT"
LICENSE_${PN}-serve-static-send-etag = "MIT"
LICENSE_${PN}-serve-static-send-fresh = "MIT"
LICENSE_${PN}-serve-static-send-http-errors = "MIT"
LICENSE_${PN}-serve-static-send-mime = "MIT"
LICENSE_${PN}-serve-static-send-ms = "MIT"
LICENSE_${PN}-serve-static-send-on-finished = "MIT"
LICENSE_${PN}-serve-static-send-range-parser = "MIT"
LICENSE_${PN}-serve-static-send-statuses = "MIT"
LICENSE_${PN}-serve-static-send = "MIT"
LICENSE_${PN}-serve-static = "MIT"
LICENSE_${PN}-setprototypeof = "ISC"
LICENSE_${PN}-statuses = "MIT"
LICENSE_${PN}-type-is = "MIT"
LICENSE_${PN}-utils-merge = "MIT"
LICENSE_${PN}-vary = "MIT"
LICENSE_${PN} = "MIT"

license: MIT

license_type: permissive

branch_name: refs/heads/master

extension: bb


text:
DESCRIPTION = "A V4L2 plugin that wraps rockchip-mpp for the chromium's V4L2 VDA"

SECTION = "libs"

LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=d749e86a105281d7a44c2328acebc4b0"

SRC_URI = "git://${EXTRA}/libv4l-rkmpp;protocol=file;usehead=1"
SRCREV = "${AUTOREV}"

DEPENDS = "rockchip-mpp rockchip-librga libv4l"

inherit autotools pkgconfig

FILES_${PN} = "${libdir}/libv4l/plugins/*.so"

repository: ponmadasamy/meta-dealcore

repo_name: ponmadasamy/meta-dealcore


text:
/*
 * Copyright (c) 2021 boot-go
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 */

package boot

import "testing"

func TestRuntimeHasMode(t *testing.T) {
	type fields struct {
		modes []Flag
	}
	type args struct {
		mode Flag
	}
	tests := []struct {
		name   string
		fields fields
		args   args
		want   bool
	}{
		{
			name:   "Unit Test Flag",
			fields: fields{modes: []Flag{StandardFlag, UnitTestFlag}},
			args:   args{mode: UnitTestFlag},
			want:   true,
		},
		{
			name:   "Missing Unit Test Flag",
			fields: fields{modes: []Flag{StandardFlag, FunctionalTestFlag}},
			args:   args{mode: UnitTestFlag},
			want:   false,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			r := &runtime{
				modes: tt.fields.modes,
			}
			if got := r.HasFlag(tt.args.mode); got != tt.want {
				t.Errorf("HasFlag() = %v, want %v", got, tt.want)
			}
		})
	}
}

repository: lndrschlz/boot

repo_name: lndrschlz/boot

branch_name: refs/heads/main

gha_license_id: MIT

extension: go


text:
include(vcpkg_common_functions)

vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)

vcpkg_from_github(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO libfann/fann
    REF 2.2.0
    SHA512 b307539a39d93078a489710ac77aa8c6e324f3cf5ef80299ce257d10c043913764abef83aceac5278a5bd243b1ee245b4e8331a9e13c774aa63c9cb604f86bdd
    HEAD_REF master
)

vcpkg_configure_cmake(
    SOURCE_PATH ${SOURCE_PATH}
    PREFER_NINJA
)
vcpkg_install_cmake()

if(NOT VCPKG_CMAKE_SYSTEM_NAME)
    # Finish Directories
    file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
    file(RENAME ${CURRENT_PACKAGES_DIR}/fann.dll ${CURRENT_PACKAGES_DIR}/bin/fann.dll)
    file(RENAME ${CURRENT_PACKAGES_DIR}/doublefann.dll ${CURRENT_PACKAGES_DIR}/bin/doublefann.dll)
    file(RENAME ${CURRENT_PACKAGES_DIR}/fixedfann.dll ${CURRENT_PACKAGES_DIR}/bin/fixedfann.dll)
    file(RENAME ${CURRENT_PACKAGES_DIR}/floatfann.dll ${CURRENT_PACKAGES_DIR}/bin/floatfann.dll)
    file(RENAME ${CURRENT_PACKAGES_DIR}/fann.lib ${CURRENT_PACKAGES_DIR}/lib/fann.lib)
    file(RENAME ${CURRENT_PACKAGES_DIR}/doublefann.lib ${CURRENT_PACKAGES_DIR}/lib/doublefann.lib)
    file(RENAME ${CURRENT_PACKAGES_DIR}/fixedfann.lib ${CURRENT_PACKAGES_DIR}/lib/fixedfann.lib)
    file(RENAME ${CURRENT_PACKAGES_DIR}/floatfann.lib ${CURRENT_PACKAGES_DIR}/lib/floatfann.lib)
    file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
    file(RENAME ${CURRENT_PACKAGES_DIR}/debug/fann.dll ${CURRENT_PACKAGES_DIR}/debug/bin/fann.dll)
    file(RENAME ${CURRENT_PACKAGES_DIR}/debug/doublefann.dll ${CURRENT_PACKAGES_DIR}/debug/bin/doublefann.dll)
    file(RENAME ${CURRENT_PACKAGES_DIR}/debug/fixedfann.dll ${CURRENT_PACKAGES_DIR}/debug/bin/fixedfann.dll)
    file(RENAME ${CURRENT_PACKAGES_DIR}/debug/floatfann.dll ${CURRENT_PACKAGES_DIR}/debug/bin/floatfann.dll)
    file(RENAME ${CURRENT_PACKAGES_DIR}/debug/fann.lib ${CURRENT_PACKAGES_DIR}/debug/lib/fann.lib)
    file(RENAME ${CURRENT_PACKAGES_DIR}/debug/doublefann.lib ${CURRENT_PACKAGES_DIR}/debug/lib/doublefann.lib)
    file(RENAME ${CURRENT_PACKAGES_DIR}/debug/fixedfann.lib ${CURRENT_PACKAGES_DIR}/debug/lib/fixedfann.lib)
    file(RENAME ${CURRENT_PACKAGES_DIR}/debug/floatfann.lib ${CURRENT_PACKAGES_DIR}/debug/lib/floatfann.lib)

    # Remove useless config file and include path
    file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
    file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
    file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig)
endif()

# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)

vcpkg_copy_pdbs()

repository: JackBoos/vcpkg

repo_name: JackBoos/vcpkg

gha_license_id: NOASSERTION

extension: cmake


text:
# This file is loaded when gcc/g++ is used for assembler files (the "ASM" cmake language)
include(Compiler/GNU)

set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm)

__compiler_gnu(ASM)

if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH STREQUAL "GNU assembler")
  set(CMAKE_DEPFILE_FLAGS_ASM${ASM_DIALECT} "--MD <DEP_FILE>")
  set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
    "<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
  set(CMAKE_ASM_DEFINE_FLAG "--defsym ")
endif()


text:
@InProceedings{hajiaghayi14,
  pdf = {http://jmlr.org/proceedings/papers/v32/hajiaghayi14.pdf},
  section = {cycle-1},
  supplementary = {Supplementary:hajiaghayi14-supp.pdf},
  title = {Efficient Continuous-Time Markov Chain Estimation},
  author = {Monir Hajiaghayi and Bonnie Kirkpatrick and Liangliang Wang and Alexandre Bouchard-Côté},
  pages = {638-646},
  abstract = {Many problems of practical interest rely on Continuous-time Markov chains~(CTMCs) defined over combinatorial state spaces, rendering the computation of transition probabilities, and hence probabilistic inference, difficult or impossible with existing methods.  For problems with countably infinite states, where classical methods such as matrix exponentiation are not applicable,  the main alternative has been particle Markov chain Monte Carlo methods imputing both the holding times and sequences of visited states.    We propose a particle-based Monte Carlo approach where the holding times are marginalized analytically.  We demonstrate that in a range of realistic inferential setups, our scheme dramatically reduces the variance of the Monte Carlo approximation and yields more accurate parameter posterior approximations given a fixed computational budget. These experiments are performed on both synthetic and real datasets, drawing from two important examples of CTMCs having combinatorial state spaces: string-valued mutation models in phylogenetics and nucleic acid folding pathways.},
}

repository: mreid/papersite

repo_name: mreid/papersite

gha_language: TeX

extension: bib


text:
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package cli

import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"testing"

	"github.com/aws/amazon-genomics-cli/internal/pkg/cli/spec"
	storagemocks "github.com/aws/amazon-genomics-cli/internal/pkg/mocks/storage"
	"github.com/aws/amazon-genomics-cli/internal/pkg/storage"
	"github.com/golang/mock/gomock"
	"github.com/stretchr/testify/require"
)

func TestProjectInit_Validate(t *testing.T) {
	testCases := map[string]struct {
		projectName  string
		expectedErr  error
		workflowType string
	}{
		"valid project name": {
			projectName:  testProjectName,
			workflowType: "nextflow",
		},
		"illegal project name": {
			projectName:  testBadProjectName,
			expectedErr:  fmt.Errorf("%s has non-alpha-numeric characters in it", testBadProjectName),
			workflowType: "wdl",
		},
		"illegal project name 2": {
			projectName:  testBadProjectName2,
			expectedErr:  fmt.Errorf("%s has non-alpha-numeric characters in it", testBadProjectName2),
			workflowType: "wdl",
		},
		"missing project name": {
			expectedErr:  fmt.Errorf("missing project name"),
			workflowType: "nextflow",
		},
		"invalid workflow type": {
			expectedErr:  fmt.Errorf("the workflow type specified 'aBadEngineName' does not match the valid values which are nextflow, and wdl"),
			workflowType: "aBadEngineName",
			projectName:  testProjectName,
		},
		"missing workflow type": {
			expectedErr:  fmt.Errorf("please specify a workflow type with the --workflow-type flag"),
			workflowType: "",
			projectName:  testProjectName,
		},
	}

	for name, tc := range testCases {
		t.Run(name, func(t *testing.T) {
			ctrl := gomock.NewController(t)
			defer ctrl.Finish()
			mockProj := storagemocks.NewMockProjectClient(ctrl)
			opts := &initProjectOpts{
				projectClient:   mockProj,
				initProjectVars: initProjectVars{tc.projectName, tc.workflowType},
			}
			mockProj.EXPECT().IsInitialized().AnyTimes().Return(false, nil)
			err := opts.Validate()

			if tc.expectedErr == nil {
				require.NoError(t, err)
			} else {
				require.EqualError(t, err, tc.expectedErr.Error())
			}
		})
	}
}

func TestProjectInit_Execute(t *testing.T) {
	testCases := map[string]struct {
		projectName    string
		expectedEngine []spec.Engine
		engineName     string
	}{
		"cromwell engine generation": {
			projectName:    testProjectName,
			engineName:     "wdl",
			expectedEngine: []spec.Engine{{Type: "wdl", Engine: "cromwell"}},
		},
		"nextflow engine generation": {
			projectName:    testProjectName,
			engineName:     "nextflow",
			expectedEngine: []spec.Engine{{Type: "nextflow", Engine: "nextflow"}},
		},
	}

	for name, tc := range testCases {
		t.Run(name, func(t *testing.T) {

			ctrl := gomock.NewController(t)
			defer ctrl.Finish()
			mockProj := storagemocks.NewMockProjectClient(ctrl)

			expectedProject := spec.Project{
				Name:          tc.projectName,
				SchemaVersion: spec.LatestVersion,
				Contexts: map[string]spec.Context{
					initContextName: {RequestSpotInstances: false, Engines: tc.expectedEngine},
				},
			}

			opts := &initProjectOpts{
				projectClient:   mockProj,
				initProjectVars: initProjectVars{tc.projectName, tc.engineName},
			}
			mockProj.EXPECT().Write(expectedProject).AnyTimes().Return(nil)

			err := opts.Execute()

			require.NoError(t, err)
		})
	}
}
func TestProjectInit_CreateInitialProject_ValidateSchema(t *testing.T) {
	tempDir := t.TempDir()
	tempFilePath := filepath.Join(tempDir, storage.ProjectSpecFileName)
	specFile, err := os.Create(tempFilePath)
	if err != nil {
		t.Fatal(err)
	}
	_ = specFile.Close()
	client, err := storage.NewProjectClientWithLocation(tempDir)
	if err != nil {
		t.Fatal(err)
	}
	opts := &initProjectOpts{
		initProjectVars: initProjectVars{
			ProjectName:  "AGCTestProject",
			workflowType: "wdl",
		},
		projectClient: client,
	}
	fileComponents := opts.createInitialProject()
	err = client.Write(fileComponents)
	if err != nil {
		t.Fatal(err)
	}
	bytes, err := ioutil.ReadFile(tempFilePath)
	if err != nil {
		t.Fatal(err)
	}
	err = spec.ValidateProject(bytes)
	require.NoError(t, err)
}

repository: fabbondanza/amazon-genomics-cli

repo_name: fabbondanza/amazon-genomics-cli


text:
DEFAULT_PREFERENCE = "-1"

include libxcb.inc
PV = "1.0+git"
PR = "r0"

DEPENDS += "libpthread-stubs"

SRC_URI = "git://anongit.freedesktop.org/git/xcb;protocol=git"
S = "${WORKDIR}/git/xcb"

PACKAGES =+ "libxcb-xinerama"


text:
const request = require('request')
const chalk = require('chalk')
const emoji = require('node-emoji')
const semverDiff = require('semver-diff')
const semver = require('semver')

module.exports = (dep, deps, showOnlyBugs) => {
  request(`http://registry.npmjs.org/${dep}`, (error, response, body) => {
    if (error) {
      console.log(
        chalk.red.bold(error)
      )
    }

    body = JSON.parse(body)
    const version = deps[dep].replace('^', '').replace('~', '')

    if (!semver.valid(version)) {

        if (showOnlyBugs) {
            return null
        }

        return console.log(
            emoji.get('warning'),
            " ",
            chalk.blue.bold(dep),
            `(${version})`,
            'Unsupported format, only works with full specific version'
        )
    }

    if (version.indexOf('git') > -1) {
      return console.log(
        emoji.get('disappointed'),
        chalk.blue.bold(dep),
        'Only support public packages from http://registry.npmjs.org'
      )
    }

    const patchVersions = {};

    Object.keys(body['versions']).forEach((versionFromRegistry) => {
        if ('patch' == semverDiff(version, versionFromRegistry)) {
            // Overwrite to get last patch in versionFromRegistry
            patchVersions[version] = versionFromRegistry
        }
    })

    if (Object.keys(patchVersions).length > 0) {
        return console.log(
            emoji.get('sos'),
            " ",
            chalk.red.bold(dep),
            `(${version})`,
            `There is a bug, update at least to last patch version (${chalk.red.bold(patchVersions[version])})`
        )
    }

    if (!showOnlyBugs) {
        return console.log(
            emoji.get('white_check_mark'),
            " ",
            chalk.green.bold(dep),
            `(${version})`
        )
    }
  })
}

repository: bernardosecades/sos-dep-checker

repo_name: bernardosecades/sos-dep-checker

extension: js


text:
@InProceedings{fujimaki12,
  title = {Factorized Asymptotic Bayesian Inference for Mixture Modeling},
  author = {Ryohei Fujimaki and Satoshi Morinaga},
  pages = {400--408},
  abstract = {This paper proposes a novel Bayesian approximation inference method for mixture modeling. Our key idea is to factorize marginal log-likelihood using a variational distribution over latent variables. An asymptotic approximation, a factorized information criterion (FIC), is obtained by applying the Laplace method to each of the factorized components. In order to evaluate FIC, we propose factorized asymptotic Bayesian inference (FAB), which maximizes an asymptotically-consistent lower bound of FIC. FIC and FAB have several desirable properties: 1) asymptotic consistency with the marginal log-likelihood, 2) automatic component selection on the basis of an intrinsic shrinkage mechanism, and 3) parameter identifiability in mixture modeling. Experimental results show that FAB outperforms state-of-the-art VB methods.},
  pdf = {http://jmlr.org/proceedings/papers/v22/fujimaki12/fujimaki12.pdf},
}


text:
require ${PN}.inc

PR = "r1"

SRC_URI = "http://sources.openembedded.org/opie-1.2.4-split_core_apps_qcop.tar.bz2;name=split_core_apps_qcop \
           file://unbreak-logging.patch"
SRC_URI[split_core_apps_qcop.md5sum] = "6d2616f81989361c30b2f3502084b9c3"
SRC_URI[split_core_apps_qcop.sha256sum] = "c35f64660758ff9ed686bf7174f92df5fff3c07a845e8c60fc0b7a522ef49c5d"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD


text:
SUMMARY = "PLDM Requester Stack"
DESCRIPTION = "Implementation of PLDM specifications"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"

SRC_URI += "git://git@github.com/Intel-BMC/pldmd.git;protocol=ssh;branch=1-release"
SRCREV = "2c3522ec89828d5abed265b4f460e77b4c580ae4"

S = "${WORKDIR}/git"

PV = "1.0+git${SRCPV}"

inherit cmake systemd

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

DEPENDS += " \
    libpldm-intel \
    mctp-wrapper \
    systemd \
    sdbusplus \
    phosphor-logging \
    gtest \
    boost \
    phosphor-dbus-interfaces \
    mctpwplus \
    "

FILES:${PN} += "${systemd_system_unitdir}/xyz.openbmc_project.pldmd.service"
SYSTEMD_SERVICE:${PN} += "xyz.openbmc_project.pldmd.service"

repository: Intel-BMC/openbmc

repo_name: Intel-BMC/openbmc

gha_language: Python


text:
@inproceedings{bm20,
author={Bendik, Jaroslav and  Meel, Kuldeep S.},
title={Approximate Counting of Minimal Unsatisfiable Subsets},
month={7},
booktitle={Proceedings of International Conference on Computer-Aided Verification (CAV)},
year={2020},
abstract={Given an unsatisfiable formula F in CNF, i.e. a set of clauses, the problem of Minimal Unsatisfiable Subset (MUS) seeks to identify the minimal subset of clauses N \subseteq F such that N is unsatisfiable. The emerging viewpoint of MUSes as the root causes of unsatisfiability has led MUSes to find applications in a wide variety of diagnostic approaches. Recent advances in finding and enumeration of MUSes have motivated researchers to discover applications that can benefit from rich information about the set of MUSes. One such extension is that of counting the number of MUSes, which has shown to describe the inconsistency metrics for general propositional knowledge bases. The current best approach for MUS counting is to employ a MUS enumeration algorithm, which often does not scale for the cases with a reasonably large number of MUSes. Motivated by the success of hashing-based techniques in the context of model counting, we design the first approximate counting procedure with (epsilon,delta) guarantees, called AMUSIC. Our approach avoids exhaustive MUS enumeration by combining the classical technique of universal hashing with advances in QBF solvers along with a novel usage of union and intersection of MUSes to achieve runtime efficiency. Our prototype implementation of AMUSIC is shown to scale to instances that were clearly beyond the reach of enumeration-based approaches.},
}

repository: meelgroup/meelgroup-website

repo_name: meelgroup/meelgroup-website


text:
// Copyright (C) 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package template

import (
	"sort"

	"fmt"

	"github.com/google/gapid/gapil/analysis"
	"github.com/google/gapid/gapil/constset"
	"github.com/google/gapid/gapil/semantic"
)

// constsetEntryBuilder is a transient structure used to build a constset.Entry.
type constsetEntryBuilder struct {
	name string
	val  uint64
}
type constsetEntryBuilderList []constsetEntryBuilder

// constsetSetBuilder is a transient structure used to build a constset.Set.
type constsetSetBuilder struct {
	isBitfield bool // true if this set is for a bitfield.
	entries    constsetEntryBuilderList
	idx        *int // pointer to index of the Set in the built Pack.
}

// constsetPackBuilder is a transient structure used to build a constset.Pack.
type constsetPackBuilder struct {
	syms   map[string]struct{}            // contains all the used symbol names.
	sets   map[string]*constsetSetBuilder // set builder key to builder.
	setIdx map[string]int                 // set builder key to index in sets.
}

func (l constsetEntryBuilderList) Len() int           { return len(l) }
func (l constsetEntryBuilderList) Swap(i, j int)      { l[i], l[j] = l[j], l[i] }
func (l constsetEntryBuilderList) Less(i, j int) bool { return l[i].val < l[j].val }

func (b *constsetPackBuilder) addLabels(labels analysis.Labels, isBitfield bool) *int {
	set := &constsetSetBuilder{
		isBitfield: isBitfield,
		entries:    make([]constsetEntryBuilder, 0, len(labels)),
	}
	for v, n := range labels {
		b.syms[n] = struct{}{}
		set.entries = append(set.entries, constsetEntryBuilder{n, v})
	}
	sort.Sort(set.entries)
	key := fmt.Sprintf("%v %+v", isBitfield, set.entries)
	if set, ok := b.sets[key]; ok {
		return set.idx
	}
	set.idx = new(int)
	b.sets[key] = set
	return set.idx
}

func (b *constsetPackBuilder) sortedSyms() []string {
	syms := make([]string, 0, len(b.syms))
	for sym := range b.syms {
		syms = append(syms, sym)
	}
	sort.Strings(syms)
	return syms
}

func (b *constsetPackBuilder) build() constset.Pack {
	out := constset.Pack{}

	offsets := map[string]int{}
	for _, s := range b.sortedSyms() {
		offsets[s] = len(out.Symbols)
		out.Symbols += constset.Symbols(s)
	}

	keys := make([]string, 0, len(b.sets))
	for key := range b.sets {
		keys = append(keys, key)
	}
	sort.Strings(keys)

	out.Sets = make([]constset.Set, len(keys))
	for i, key := range keys {
		set := b.sets[key]
		*set.idx = i
		entries := make([]constset.Entry, len(set.entries))
		for i, e := range set.entries {
			entries[i] = constset.Entry{
				V: e.val,
				O: offsets[e.name],
				L: len(e.name),
			}
		}
		out.Sets[i] = constset.Set{
			IsBitfield: set.isBitfield,
			Entries:    entries,
		}
	}

	return out
}

type u64s []uint64

func (p u64s) Len() int           { return len(p) }
func (p u64s) Less(i, j int) bool { return p[i] < p[j] }
func (p u64s) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }

// ConstantSets consatins the constset.Pack, and each semantic mapping to a
// constset.Set index.
type ConstantSets struct {
	Pack constset.Pack
	Sets map[semantic.Node]*int
}

type nodeLabeler struct {
	nodes map[semantic.Node]analysis.Labels
	seen  map[analysis.Value]bool
}

func (nl *nodeLabeler) addLabels(n semantic.Node, v analysis.Value) {
	l, ok := nl.nodes[n]
	if !ok {
		l = analysis.Labels{}
		nl.nodes[n] = l
	}

	if ev, ok := v.(*analysis.EnumValue); ok {
		l.Merge(ev.Labels)
	}
}

func (nl *nodeLabeler) traverse(n semantic.Node, v analysis.Value) {
	if nl.seen[v] {
		return
	}
	nl.seen[v] = true
	nl.addLabels(n, v)
	switch v := v.(type) {
	case *analysis.ClassValue:
		for n, fv := range v.Fields {
			nl.traverse(v.Class.FieldByName(n), fv)
		}
	case *analysis.MapValue:
		for k, v := range v.KeyToValue {
			nl.traverse(n, k)
			nl.traverse(n, v)
		}
	}
}

func buildConstantSets(api *semantic.API, mappings *semantic.Mappings) *ConstantSets {
	b := &constsetPackBuilder{
		syms:   map[string]struct{}{},
		sets:   map[string]*constsetSetBuilder{},
		setIdx: map[string]int{},
	}

	a := analysis.Analyze(api, mappings)

	constsets := map[semantic.Node]*int{}

	// Create a constant set for all the API's enums that didn't opt out
	for _, e := range api.Enums {
		// "analyze_usage" opts out of the default constant set generation,
		// uses analysis to determine which constants should go together
		if e.Annotations.GetAnnotation("analyze_usage") == nil {
			labels := analysis.Labels{}
			for _, entry := range e.Entries {
				value, ok := semantic.AsUint64(entry.Value)
				if !ok {
					panic(fmt.Sprintf("Unsupported enum number type: %v", e.NumberType))
				}
				// In cases a constant value has multiple labels (multiple
				// labels defining the same constant value in the same enum),
				// the last label will be adopted as the name of the constant
				// value.
				labels[value] = string(entry.Named)
			}
			constsets[e] = b.addLabels(labels, e.IsBitfield)
		}
	}

	for _, f := range api.Functions {
		for _, p := range f.FullParameters {
			v, ok := a.Parameters[p]
			if !ok {
				continue // No analysis for this parameter.
			}
			ev, ok := v.(*analysis.EnumValue)
			if !ok || len(ev.Labels) == 0 {
				continue // Parameter wasn't an enum, or had no labels.
			}
			// Check if we already created a constset for this parameter type
			if idx, ok := constsets[ev.Ty]; ok {
				constsets[p] = idx
			} else {
				// This type has been annotated with "analyze_usage"
				constsets[p] = b.addLabels(ev.Labels, ev.Ty.IsBitfield)
			}
		}
	}
	nl := nodeLabeler{
		nodes: map[semantic.Node]analysis.Labels{},
		seen:  map[analysis.Value]bool{},
	}
	// Gather all the labeled nodes.
	for n, v := range a.Globals {
		nl.traverse(n, v)
	}
	for n, v := range a.Instances {
		nl.traverse(n, v)
	}
	// Create constant sets for all the nodes.
	for n, l := range nl.nodes {
		isBitfield := false
		if ty, err := semantic.TypeOf(n); err == nil {
			if enum, ok := ty.(*semantic.Enum); ok {
				if i, ok := constsets[enum]; ok {
					constsets[n] = i
					continue
				}
				isBitfield = enum.IsBitfield
			}
		}
		if len(l) != 0 {
			constsets[n] = b.addLabels(l, isBitfield)
		}
	}

	return &ConstantSets{
		Pack: b.build(),
		Sets: constsets,
	}
}

func (f *Functions) constantSets() *ConstantSets {
	if f.cs != nil {
		return f.cs
	}
	f.cs = buildConstantSets(f.api, f.mappings)
	return f.cs
}

// ConstantSets returns the full constants set pack for the API.
func (f *Functions) ConstantSets() constset.Pack {
	return f.constantSets().Pack
}

// ConstantSetIndex returns the constant set for the given parameter.
func (f *Functions) ConstantSetIndex(n semantic.Node) int {
	if i, ok := f.constantSets().Sets[n]; ok {
		return *i
	}
	return -1
}

repository: google/gapid

repo_name: google/gapid

gha_language: Go


text:
@article{Ruiz:2016gne,
      author         = "Garcia Ruiz, R. F. and others",
      title          = "{Unexpectedly large charge radii of neutron-rich calcium
                        isotopes}",
      journal        = "Nature Phys.",
      volume         = "12",
      year           = "2016",
      pages          = "594",
      doi            = "10.1038/nphys3645",
      eprint         = "1602.07906",
      archivePrefix  = "arXiv",
      primaryClass   = "nucl-ex",
      SLACcitation   = "%%CITATION = ARXIV:1602.07906;%%"
}

license: Unlicense

repository: cheshyre/latex-templates

repo_name: cheshyre/latex-templates


text:
@article{turnbull2020reductions,
  title={Reductions in task positive neural systems occur with the passage of time and are associated with changes in ongoing thought},
  author={Turnbull, Adam and Karapanagiotidis, Theodoros and Wang, Hao-Ting and Bernhardt, Boris C and Leech, Robert and Margulies, Daniel and Schooler, Jonathan and Jefferies, Elizabeth and Smallwood, Jonathan},
  journal={Scientific reports},
  volume={10},
  number={1},
  pages={1--10},
  year={2020},
  publisher={Nature Publishing Group}
}

repository: tkarapan/academic-kickstart

repo_name: tkarapan/academic-kickstart


text:
@article{flottorp-2013,
abstract = {Determinants of practice are factors that might prevent or enable improvements. Several checklists, frameworks, taxonomies, and classifications of determinants of healthcare professional practice have been published. In this paper, we describe the development of a comprehensive, integrated checklist of determinants of practice (the TICD checklist). We performed a systematic review of frameworks of determinants of practice followed by a consensus process. We searched electronic databases and screened the reference lists of key background documents. Two authors independently assessed titles and abstracts, and potentially relevant full text articles. We compiled a list of attributes that a checklist should have: comprehensiveness, relevance, applicability, simplicity, logic, clarity, usability, suitability, and usefulness. We assessed included articles using these criteria and collected information about the theory, model, or logic underlying how the factors (determinants) were selected, described, and grouped, the strengths and weaknesses of the checklist, and the determinants and the domains in each checklist. We drafted a preliminary checklist based on an aggregated list of determinants from the included checklists, and finalized the checklist by a consensus process among implementation researchers. We screened 5,778 titles and abstracts and retrieved 87 potentially relevant papers in full text. Several of these papers had references to papers that we also retrieved in full text. We also checked potentially relevant papers we had on file that were not retrieved by the searches. We included 12 checklists. None of these were completely comprehensive when compared to the aggregated list of determinants and domains. We developed a checklist with 57 potential determinants of practice grouped in seven domains: guideline factors, individual health professional factors, patient factors, professional interactions, incentives and resources, capacity for organisational change, and social, political, and legal factors. We also developed five worksheets to facilitate the use of the checklist. Based on a systematic review and a consensus process we developed a checklist that aims to be comprehensive and to build on the strengths of each of the 12 included checklists. The checklist is accompanied with five worksheets to facilitate its use in implementation research and quality improvement projects.},
annote = {This paper presents the TICD (Tailored Intervention for Chronic Diseases) checklist. This checklist includes 57 items in seven domains: guideline factors, individual health professional factors, patient factors, professional interactions, incentives and resources, capacity for organisational change, and social, political, and legal factors.},
author = {Flottorp, Signe A and Oxman, Andrew D and Krause, Jane and Musila, Nyokabi R and Wensing, Michel and Godycki-Cwirko, Maciek and Baker, Richard and Eccles, Martin P},
doi = {10.1186/1748-5908-8-35},
issn = {1748-5908},
journal = {Implementation Science},
keywords = {Health Administration,Health Informatics,Health Promotion and Disease Prevention,Public Health,Quality improvement},
mendeley-tags = {Quality improvement},
month = {dec},
number = {1},
pages = {35},
publisher = {BioMed Central},
title = {{A checklist for identifying determinants of practice: A systematic review and synthesis of frameworks and taxonomies of factors that prevent or enable improvements in healthcare professional practice}},
url = {http://implementationscience.biomedcentral.com/articles/10.1186/1748-5908-8-35},
volume = {8},
  source = {19/06/flottorp-2013},
year = {2013},
urldate = {2019-06-23}
}

repository: pmean/build-website

repo_name: pmean/build-website


text:
@inproceedings{iussp2013mmr,
  title={How Informative are Vital Registration Data for Estimating Maternal Mortality? A Bayesian Analysis of WHO Adjustment Data and Parameters},
  author={Chao, Fengqing and Alkema, Leontine},
  booktitle={XXVII IUSSP International Population Conference},
  pages={1--23},
  year={2013},
  organization={IUSSP},
  publisher={figshare},
  DOI={10.6084/m9.figshare.12401495},
  note={Available at: \url{https://doi.org/10.6084/m9.figshare.12401495}}
}

repository: pinwheelovefaye/academic-kickstart

repo_name: pinwheelovefaye/academic-kickstart


text:
@article{maher_medical_2013,
	title = {Medical school attrition -- beyond the statistics a 10 year retrospective study},
	volume = {13},
	rights = {http://creativecommons.org/licenses/by/2.0/},
	issn = {1472-6920},
	url = {http://www.biomedcentral.com/1472-6920/13/13/abstract},
	doi = {10.1186/1472-6920-13-13},
	abstract = {Medical school attrition is important - securing a place in medical school is difficult and a high attrition rate can affect the academic reputation of a medical school and staff morale. More important, however, are the personal consequences of dropout for the student. The aims of our study were to examine factors associated with attrition over a ten-year period (2001--2011) and to study the personal effects of dropout on individual students.},
	pages = {13},
	number = {1},
	journaltitle = {{BMC} Medical Education},
	author = {Maher, Bridget M. and Hynes, Helen and Sweeney, Catherine and Khashan, Ali S. and O¿Rourke, Margaret and Doran, Kieran and Harris, Anne and Flynn, Siun O¿},
	urldate = {2013-02-01},
	date = {2013-01-31},
	langid = {english}
}


text:
SECTION = "console/utils"
DESCRIPTION = 'The PCI Utilities package contains a library for portable access \
to PCI bus configuration space and several utilities based on this library.'
DESCRIPTION_pciutils-ids = 'The list of PCI IDs for pciutils'
HOMEPAGE = "http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml"
LICENSE = "GPLv2"

PR ="r3"

PARALLEL_MAKE = ""
FILES_pciutils-ids="${prefix}/share/pci.ids"
PACKAGES =+ "pciutils-ids"
SRC_URI = "${KERNELORG_MIRROR}/pub/software/utils/pciutils/pciutils-${PV}.tar.bz2 \
	   file://configure.patch \
	   file://configure-uclibc.patch \
	   file://pcimodules-pciutils-2.1.11.diff"

do_configure () {
	(cd lib && ./configure ${datadir} ${PV} ${TARGET_OS} 2.4.21 ${TARGET_ARCH})
}

export PREFIX = "${D}${prefix}"
export SBINDIR = "${D}${sbindir}"
export SHAREDIR = "${D}${datadir}"
export MANDIR = "${D}${mandir}"

do_install () {
	oe_runmake install
}
do_install_append () {
	install -d ${D}/${prefix}/share
	install -m 6440 ${WORKDIR}/${PN}-${PV}/pci.ids ${D}/${prefix}/share
}

SRC_URI[md5sum] = "2b3b2147b7bc91f362be55cb49fa1c4e"
SRC_URI[sha256sum] = "8817295a7db11f31837c7c23f49e768131700b2b729d9fc724520d94a8b00f4b"


text:
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package email is logic for sending email invitations
package email

import (
	"context"
	"fmt"

	"github.com/google/exposure-notifications-verification-server/internal/firebase"
)

var _ Provider = (*firebase.Client)(nil)

// NewFirebase creates a new SMTP email sender with the given auth.
func NewFirebase(ctx context.Context) (Provider, error) {
	firebaseInternal, err := firebase.New(ctx)
	if err != nil {
		return nil, fmt.Errorf("failed to configure internal firebase client: %w", err)
	}
	return firebaseInternal, nil
}