text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func SetGroups(datasetID string, rawGroupings []map[string]interface{}, data api.DataStorage, meta api.MetadataStorage, config *IngestTaskConfig) error {
// We currently only allow for one image to be present in a dataset.
multiBandImageGroupings := getMultiBandImageGrouping(rawGroupings)
numGroupings := len(multiBa... | [
-0.889714777469635,
0.7076534628868103,
0.5949742197990417,
-0.25966036319732666,
0.11019419133663177,
-0.5382766127586365,
0.5489100813865662,
-0.3458822965621948,
-0.3800797164440155,
0.519288957118988,
0.5237966775894165,
0.5744549036026001,
0.29390355944633484,
0.9755411744117737,
0.... |
func (s *Store) Authenticate(uid, passwd string) (staff *People, err error) {
for _, ls := range s.sources {
staff, err = ls.Authenticate(uid, passwd)
if err == nil {
logger().Debugw("authenticate ok", "uid", uid)
return
}
}
logger().Infow("Authen failed", "uid", uid, "err", err)
return
} | [
-0.9327930212020874,
-0.2920328378677368,
0.37323567271232605,
0.057916879653930664,
0.24970899522304535,
-0.16287440061569214,
-0.01926174946129322,
0.2990666627883911,
0.26496413350105286,
-0.15075354278087616,
0.16682125627994537,
-0.1301167756319046,
-0.2791489362716675,
1.019345402717... |
func (s *Store) Get(uid string) (staff *People, err error) {
for _, ls := range s.sources {
staff, err = ls.GetPeople(uid)
if err == nil {
return
}
}
err = ErrNotFound
return
} | [
-0.5102761387825012,
0.00412715831771493,
0.4996977746486664,
-0.7500127553939819,
0.013083096593618393,
-0.13756798207759857,
-0.34368154406547546,
0.03455173596739769,
0.137116938829422,
-0.5516024231910706,
-0.11467631161212921,
0.1641094833612442,
-0.6727274656295776,
1.145401120185852... |
func NewFeasibleRankIterator(ctx Context, source FeasibleIterator) *FeasibleRankIterator {
iter := &FeasibleRankIterator{
ctx: ctx,
source: source,
}
return iter
} | [
-0.15722523629665375,
-0.3064875900745392,
-0.18038725852966309,
0.05993024632334709,
-2.0853281021118164,
-0.25185832381248474,
-0.742914617061615,
0.6035137176513672,
-0.30433064699172974,
-0.6884060502052307,
-0.014883912168443203,
0.41974732279777527,
0.6955602765083313,
0.257091552019... |
func NewStaticRankIterator(ctx Context, nodes []*RankedNode) *StaticRankIterator {
iter := &StaticRankIterator{
ctx: ctx,
nodes: nodes,
}
return iter
} | [
-0.44475600123405457,
-0.2898232042789459,
0.0058456831611692905,
0.16349588334560394,
-0.7585771083831787,
-0.012968472205102444,
-0.7678293585777283,
0.5144526362419128,
-0.2838674783706665,
0.5255924463272095,
0.08292631059885025,
1.9573767185211182,
0.14319030940532684,
0.5044657588005... |
func NewBinPackIterator(ctx Context, source RankIterator, evict bool, priority int, schedConfig *structs.SchedulerConfiguration) *BinPackIterator {
algorithm := schedConfig.EffectiveSchedulerAlgorithm()
scoreFn := structs.ScoreFitBinPack
if algorithm == structs.SchedulerAlgorithmSpread {
scoreFn = structs.ScoreFi... | [
-0.49758467078208923,
-0.41241195797920227,
0.22195561230182648,
0.1585433930158615,
-1.3663102388381958,
-0.30570584535598755,
-0.1999831646680832,
0.5807192921638489,
0.8488966226577759,
0.021534346044063568,
0.09405133128166199,
0.8455122709274292,
-0.36980125308036804,
0.70837557315826... |
func NewJobAntiAffinityIterator(ctx Context, source RankIterator, jobID string) *JobAntiAffinityIterator {
iter := &JobAntiAffinityIterator{
ctx: ctx,
source: source,
jobID: jobID,
}
return iter
} | [
0.21892744302749634,
-0.7549882531166077,
-0.06502842903137207,
-0.2830290198326111,
-0.5421342849731445,
-0.4968165457248688,
0.06828819960355759,
0.5158326625823975,
-0.4852333664894104,
-0.15045832097530365,
0.4503679871559143,
0.7133132815361023,
0.074669748544693,
0.6124871969223022,
... |
func NewNodeReschedulingPenaltyIterator(ctx Context, source RankIterator) *NodeReschedulingPenaltyIterator {
iter := &NodeReschedulingPenaltyIterator{
ctx: ctx,
source: source,
}
return iter
} | [
-0.5065081119537354,
0.32440185546875,
0.0054222531616687775,
-0.41509708762168884,
-1.2258977890014648,
-0.4273083209991455,
-0.6770843267440796,
0.46491318941116333,
-0.26030194759368896,
0.31665247678756714,
0.8171160817146301,
0.6708343625068665,
-0.3822120726108551,
-0.225134134292602... |
func NewNodeAffinityIterator(ctx Context, source RankIterator) *NodeAffinityIterator {
return &NodeAffinityIterator{
ctx: ctx,
source: source,
}
} | [
-0.37803515791893005,
-0.623541533946991,
-0.13458091020584106,
-0.8815534710884094,
-1.8406975269317627,
-0.6682068705558777,
-0.12464331090450287,
0.2581697106361389,
-0.06313184648752213,
-0.020197587087750435,
0.06545910239219666,
1.3365693092346191,
0.5082541108131409,
0.8306903243064... |
func NewScoreNormalizationIterator(ctx Context, source RankIterator) *ScoreNormalizationIterator {
return &ScoreNormalizationIterator{
ctx: ctx,
source: source}
} | [
-0.4757712483406067,
0.0632198378443718,
-0.3005525469779968,
0.139506533741951,
-1.9201123714447021,
-0.13410910964012146,
-0.033236704766750336,
-0.027454856783151627,
0.4673309624195099,
0.8338096737861633,
-0.4352721571922302,
0.7337250709533691,
-0.3596963882446289,
-0.090260885655879... |
func NewPreemptionScoringIterator(ctx Context, source RankIterator) RankIterator {
return &PreemptionScoringIterator{
ctx: ctx,
source: source,
}
} | [
-1.071631669998169,
0.35930460691452026,
0.16537192463874817,
-0.1646595299243927,
-1.1123263835906982,
0.00794141460210085,
0.1635267287492752,
0.35310661792755127,
0.20343127846717834,
0.2159653604030609,
0.11914128065109253,
0.40996891260147095,
-0.32548683881759644,
0.4810689091682434,... |
func netPriority(allocs []*structs.Allocation) float64 {
sumPriority := 0
max := 0.0
for _, alloc := range allocs {
if float64(alloc.Job.Priority) > max {
max = float64(alloc.Job.Priority)
}
sumPriority += alloc.Job.Priority
}
// We use the maximum priority across all allocations
// with an additional pe... | [
0.49618619680404663,
0.3685411512851715,
0.6027837991714478,
-0.020034488290548325,
0.07008366286754608,
-0.18349887430667877,
-0.23619666695594788,
-0.2683022618293762,
0.9180042147636414,
0.019155653193593025,
0.6325692534446716,
-1.0803887844085693,
0.11970794200897217,
0.71114951372146... |
func preemptionScore(netPriority float64) float64 {
// These values were chosen such that a net priority of 2048 would get a preemption score of 0.5
// rate is the decay parameter of the logistic function used in scoring preemption options
const rate = 0.0048
// origin controls the inflection point of the logistic... | [
-0.04623107984662056,
0.3433566987514496,
0.41123858094215393,
-0.9447417855262756,
0.7940860986709595,
-0.7122797966003418,
-0.0758165493607521,
0.4269491136074066,
0.6277202367782593,
0.3763841390609741,
0.44080278277397156,
-0.5758396983146667,
-0.29321616888046265,
0.4210008382797241,
... |
func (o *SearchInventoryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewSearchInventoryOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, ni... | [
-0.9719075560569763,
-1.4665100574493408,
0.5769739747047424,
0.9161992073059082,
0.6033274531364441,
-1.0543255805969238,
-0.15954233705997467,
-0.27470919489860535,
0.3883594870567322,
0.38890889286994934,
0.4436364471912384,
-0.44004490971565247,
-1.1308958530426025,
-0.3604680597782135... |
func NewSearchInventoryOK() *SearchInventoryOK {
return &SearchInventoryOK{}
} | [
-0.9848429560661316,
-1.4871670007705688,
0.09402243047952652,
1.538783073425293,
-0.48884207010269165,
-0.1955597698688507,
0.4050363302230835,
0.31814172863960266,
-0.9061864018440247,
0.47778263688087463,
-0.5476473569869995,
-0.7185384035110474,
-0.03175756707787514,
-0.255007416009902... |
func NewSearchInventoryBadRequest() *SearchInventoryBadRequest {
return &SearchInventoryBadRequest{}
} | [
-1.5310068130493164,
-1.645768404006958,
-0.09283804148435593,
1.218781590461731,
0.040252264589071274,
-0.4986559748649597,
-1.3101935386657715,
0.39026346802711487,
-0.6353785991668701,
-0.9336549043655396,
0.14033092558383942,
0.3491266667842865,
-0.6875198483467102,
0.03916420415043831... |
func main() {
err := shim.Start(new(SimpleChaincode))
if err != nil {
fmt.Printf("Error creating new Smart Contract: %s", err)
}
} | [
0.9980832934379578,
-0.2694712281227112,
0.7127731442451477,
1.3291383981704712,
0.37044230103492737,
0.1221795529127121,
0.14739635586738586,
0.9621020555496216,
0.5949525833129883,
-0.7635781764984131,
-1.1665050983428955,
0.7021592259407043,
-0.3910885751247406,
-0.41043055057525635,
... |
func (t *SimpleChaincode) Init(APIstub shim.ChaincodeStubInterface) pb.Response {
return shim.Success(nil)
} | [
-0.5009085536003113,
-0.3026014268398285,
0.4316445589065552,
0.35535451769828796,
0.344375878572464,
-0.10898658633232117,
-0.10131093859672546,
0.240421861410141,
-0.05711658298969269,
-0.8896551132202148,
-1.0027008056640625,
0.6711999177932739,
-0.7842584848403931,
0.036050278693437576... |
func (t *SimpleChaincode) Invoke(APIstub shim.ChaincodeStubInterface) pb.Response {
function, args := APIstub.GetFunctionAndParameters()
// Handle different functions
if function == "addStudent" { //add a Student
return t.addStudent(APIstub, args)
} else if function == "readStudent" { //read a Student
return t... | [
-0.8596461415290833,
-0.3363717198371887,
0.8844209313392639,
0.3807985186576843,
0.16702362895011902,
-0.4078398644924164,
-0.34256717562675476,
-0.29951462149620056,
-0.09540482610464096,
-0.5567209124565125,
-0.3800279200077057,
-0.0797901451587677,
-0.5889062881469727,
-0.3520424962043... |
func (t *SimpleChaincode) readCert(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {
var name, jsonResp string
var err error
if len(args) != 1 {
return shim.Error("Incorrect number of arguments. Expecting 1")
}
name = args[0]
valAsbytes, err := APIstub.GetState(name)
if err != nil {
jsonResp ... | [
-0.8905981779098511,
-0.5115954875946045,
0.9826720952987671,
0.1967117339372635,
-0.2725563645362854,
0.23548491299152374,
-0.5337555408477783,
-0.6449481248855591,
-0.42679741978645325,
0.2487514466047287,
0.09797109663486481,
-0.11943577229976654,
-0.6743074059486389,
-0.207438006997108... |
func (t *SimpleChaincode) initLedger(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {
Cert := []cert{
cert{PR_no: "101", Student_Name: "Gaurav1", Seat_no: "1", College_Name: "PCCE", Examination: "may/june", Year_Of_Passing: "2019", Sub: "abc"},
cert{PR_no: "102", Student_Name: "Gaurav2", Seat_no: ... | [
-0.9646776914596558,
-0.6721718311309814,
1.1207395792007446,
-0.6616242527961731,
0.2488323599100113,
0.5303471684455872,
0.37362006306648254,
0.1518285572528839,
0.2617366909980774,
0.5434877872467041,
-1.654388666152954,
-0.11863703280687332,
0.45624619722366333,
0.17629404366016388,
... |
func (t *SimpleChaincode) addCert(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {
if len(args) != 6 {
return shim.Error("Incorrect number of arguments. Expecting 5")
}
if len(args[0]) <= 0 {
return shim.Error("1 argument must be a non-empty string")
}
if len(args[1]) <= 0 {
return shim.Err... | [
-0.25862279534339905,
-0.18613341450691223,
1.2779202461242676,
0.3585306704044342,
0.04469339922070503,
0.7116668820381165,
0.10618769377470016,
-0.6020835638046265,
-0.23876143991947174,
0.3790956437587738,
-0.3846835494041443,
0.12635543942451477,
-0.6248670816421509,
0.0828433781862258... |
func (t *SimpleChaincode) transferCert(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {
// 0 1
// "Seatno", "SName"
if len(args) < 2 {
return shim.Error("Incorrect number of arguments. Expecting 2")
}
Seatno := args[0]
SName := args[1]
certAsBytes, err := APIstub.GetState(Seatno)
if ... | [
-0.3988510072231293,
-0.3101044297218323,
0.9064850211143494,
0.17043925821781158,
-0.06043317914009094,
0.17756658792495728,
-0.09561578929424286,
0.09766443818807602,
-0.24339407682418823,
0.4634679853916168,
-0.33170121908187866,
0.6493083834648132,
-0.328031450510025,
-0.44656401872634... |
func (t *SimpleChaincode) addStudent(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {
if len(args) != 10 {
return shim.Error("Incorrect number of arguments. Expecting 9")
}
// ==== Input sanitation ====
fmt.Println("- start")
if len(args[0]) <= 0 {
return shim.Error("1 argument must be a non... | [
-0.37389326095581055,
-0.4782831072807312,
1.3363964557647705,
0.5533884167671204,
0.4704780876636505,
0.5982521772384644,
0.47411826252937317,
-0.18677730858325958,
0.24980710446834564,
0.5242968201637268,
-0.29801279306411743,
-0.0808110237121582,
-1.0439718961715698,
0.04035753011703491... |
func (t *SimpleChaincode) readStudent(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {
var name, jsonResp string
var err error
if len(args) <= 0 {
return shim.Error("Incorrect number of arguments. Expecting name of the name to query")
}
name = args[0]
valAsbytes, err := APIstub.GetState(name)... | [
-1.4758795499801636,
-0.7648283243179321,
0.8247389197349548,
-0.217551589012146,
-0.42235225439071655,
0.16844476759433746,
-0.38422897458076477,
-0.36912626028060913,
-0.16664080321788788,
0.3295699954032898,
0.005757966544479132,
0.22001436352729797,
-0.691857099533081,
-0.5420004725456... |
func (t *SimpleChaincode) login(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {
// 0 1
// "prno", "password"
if len(args) < 2 {
return shim.Error("Incorrect number of arguments. Expecting 2")
}
prno := args[0]
password := args[1]
studentAsBytes, err := APIstub.GetState(prno)
if err !... | [
-1.26060950756073,
-0.8681235313415527,
0.7625568509101868,
0.22274786233901978,
-0.15331551432609558,
0.02152831479907036,
-0.4779320955276489,
0.28798186779022217,
0.5622402429580688,
0.02646544761955738,
-0.8492394089698792,
0.4713189899921417,
0.03836087882518768,
-0.5075476169586182,
... |
func (t *SimpleChaincode) uniCredentials(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {
if len(args) != 2 {
return shim.Error("Incorrect number of arguments. Expecting 2")
}
if len(args[0]) <= 0 {
return shim.Error("1 argument must be a non-empty string")
}
if len(args[1]) <= 0 {
return s... | [
-0.9667677879333496,
-0.5277218222618103,
0.7944248914718628,
-0.20549221336841583,
0.21771031618118286,
0.33917155861854553,
0.005779454950243235,
0.24246488511562347,
0.40728560090065,
0.46735334396362305,
-0.919614851474762,
0.6737165451049805,
-0.30144333839416504,
-0.4021388292312622,... |
func (t *SimpleChaincode) creatorCredentials(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {
if len(args) != 2 {
return shim.Error("Incorrect number of arguments. Expecting 2")
}
if len(args[0]) <= 0 {
return shim.Error("1 argument must be a non-empty string")
}
if len(args[1]) <= 0 {
retu... | [
-0.8575794100761414,
-0.637445867061615,
0.8087356686592102,
0.5861231088638306,
0.08018038421869278,
0.5866531133651733,
-0.02028874307870865,
-0.44021618366241455,
-0.4398604929447174,
0.4508171081542969,
-0.8280103206634521,
0.38630411028862,
-0.13483110070228577,
-0.011828502640128136,... |
func (s *Sysinfo) ToNative(n *unix.Sysinfo_t) {
n.Bufferram = uint32(s.Bufferram)
n.Freeram = uint32(s.Freeram)
n.Freeswap = uint32(s.Freeswap)
n.Procs = s.Procs
n.Sharedram = uint32(s.Sharedram)
n.Totalram = uint32(s.Totalram)
n.Totalswap = uint32(s.Totalswap)
n.Uptime = int32(s.Uptime)
} | [
-0.05259966105222702,
-0.25160160660743713,
0.3462240993976593,
-0.3888297379016876,
-0.6029249429702759,
-0.6182460188865662,
-0.2933637797832489,
-0.6467204689979553,
-0.0650009885430336,
-0.5984162092208862,
-1.6791905164718628,
0.15802288055419922,
0.05118413269519806,
0.04925730079412... |
func (h *distroIDGetSetupHandler) Parse(ctx context.Context, r *http.Request) error {
h.distroID = gimlet.GetVars(r)["distro_id"]
return nil
} | [
-0.16345521807670593,
0.571865975856781,
0.1802637130022049,
0.23758959770202637,
0.7730844020843506,
-0.028128275647759438,
-0.21741944551467896,
-0.2562127709388733,
-0.5046983361244202,
0.14278647303581238,
0.4225478172302246,
0.0545855276286602,
-0.15111902356147766,
0.0692840665578842... |
func (h *distroIDGetSetupHandler) Run(ctx context.Context) gimlet.Responder {
d, err := h.sc.FindDistroById(h.distroID)
if err != nil {
return gimlet.MakeJSONErrorResponder(errors.Wrapf(err, "Database error for find() by distro id '%s'", h.distroID))
}
apiDistro := &model.APIDistro{}
if err = apiDistro.BuildFro... | [
-1.2659523487091064,
-0.3869723081588745,
0.47723639011383057,
-0.7819848656654358,
0.1016898974776268,
-0.42545709013938904,
0.23305214941501617,
0.11039111763238907,
-0.19093377888202667,
0.4914311170578003,
-0.29579320549964905,
0.006396032869815826,
-0.1597529798746109,
-0.069677285850... |
func (h *distroIDChangeSetupHandler) Parse(ctx context.Context, r *http.Request) error {
h.distroID = gimlet.GetVars(r)["distro_id"]
body := util.NewRequestReader(r)
defer body.Close()
if err := util.ReadJSONInto(body, h); err != nil {
return errors.Wrap(err, "Argument read error")
}
return nil
} | [
-1.168009638786316,
0.6512241959571838,
0.5666596293449402,
0.0305450651794672,
0.2962261438369751,
-0.22378724813461304,
-0.34299156069755554,
-0.19914747774600983,
-0.4686945080757141,
0.4765428900718689,
0.37704282999038696,
0.48199063539505005,
0.686119019985199,
-0.28278011083602905,
... |
func (h *distroIDChangeSetupHandler) Run(ctx context.Context) gimlet.Responder {
d, err := h.sc.FindDistroById(h.distroID)
if err != nil {
return gimlet.MakeJSONErrorResponder(errors.Wrapf(err, "Database error for find() by distro id '%s'", h.distroID))
}
d.Setup = h.Setup
if err = h.sc.UpdateDistro(d); err != ... | [
-1.5618621110916138,
-0.4886135160923004,
0.6362534165382385,
-0.7989152669906616,
-0.06284069269895554,
-0.15349745750427246,
0.4052121937274933,
0.40654367208480835,
0.02490212582051754,
0.5576477646827698,
-0.4205835163593292,
0.07013774663209915,
0.041117142885923386,
-0.02351588755846... |
func (h *distroIDGetTeardownHandler) Parse(ctx context.Context, r *http.Request) error {
h.distroID = gimlet.GetVars(r)["distro_id"]
return nil
} | [
0.1078469306230545,
0.20437055826187134,
0.15704141557216644,
-0.06212914362549782,
0.6562822461128235,
0.3333069980144501,
-0.36288440227508545,
-0.17651131749153137,
-0.4118240773677826,
-0.051762908697128296,
0.3636760711669922,
0.5223182439804077,
-0.1534501165151596,
0.014893168583512... |
func (h *distroIDGetTeardownHandler) Run(ctx context.Context) gimlet.Responder {
d, err := h.sc.FindDistroById(h.distroID)
if err != nil {
return gimlet.MakeJSONErrorResponder(errors.Wrapf(err, "Database error for find() by distro id '%s'", h.distroID))
}
apiDistro := &model.APIDistro{}
if err = apiDistro.Build... | [
-1.0889651775360107,
-0.6255470514297485,
0.4000411927700043,
-0.8838357329368591,
0.013291066512465477,
-0.07930894196033478,
0.3626222312450409,
-0.013044803403317928,
-0.11626621335744858,
0.22172905504703522,
-0.3349606692790985,
0.339363694190979,
-0.5153443813323975,
0.07451429218053... |
func (h *distroIDChangeTeardownHandler) Parse(ctx context.Context, r *http.Request) error {
h.distroID = gimlet.GetVars(r)["distro_id"]
body := util.NewRequestReader(r)
defer body.Close()
if err := util.ReadJSONInto(body, h); err != nil {
return errors.Wrap(err, "Argument read error")
}
return nil
} | [
-0.5762110948562622,
0.3199893534183502,
0.5317503809928894,
-0.022416219115257263,
0.06267174333333969,
0.017933515831828117,
-0.3731335401535034,
-0.562679648399353,
-0.33610767126083374,
0.31421810388565063,
0.44686490297317505,
0.8846351504325867,
0.06314925104379654,
0.152217030525207... |
func (h *distroIDChangeTeardownHandler) Run(ctx context.Context) gimlet.Responder {
d, err := h.sc.FindDistroById(h.distroID)
if err != nil {
return gimlet.MakeJSONErrorResponder(errors.Wrapf(err, "Database error for find() by distro id '%s'", h.distroID))
}
d.Teardown = h.Teardown
if err = h.sc.UpdateDistro(d)... | [
-1.0102403163909912,
-0.6526073813438416,
0.5734803676605225,
-0.792761504650116,
-0.30451688170433044,
-0.14584244787693024,
0.3555299639701843,
0.1457728147506714,
0.12314344197511673,
0.5337076783180237,
-0.32890480756759644,
0.45419254899024963,
-0.4353776276111603,
0.40652206540107727... |
func (h *distroIDPutHandler) Parse(ctx context.Context, r *http.Request) error {
h.distroID = gimlet.GetVars(r)["distro_id"]
body := util.NewRequestReader(r)
defer body.Close()
b, err := ioutil.ReadAll(body)
if err != nil {
return errors.Wrap(err, "Argument read error")
}
h.body = b
return nil
} | [
-0.3219817280769348,
0.5999237895011902,
0.4152172803878784,
-0.1710951328277588,
0.05147388204932213,
0.37306347489356995,
-0.3601160943508148,
-0.39453285932540894,
-0.7972148656845093,
0.2227764129638672,
0.3343379497528076,
-0.010782753117382526,
-0.3772851526737213,
0.1866397857666015... |
func (h *distroIDPutHandler) Run(ctx context.Context) gimlet.Responder {
original, err := h.sc.FindDistroById(h.distroID)
if err != nil && err.(gimlet.ErrorResponse).StatusCode != http.StatusNotFound {
return gimlet.MakeJSONErrorResponder(errors.Wrapf(err, "Database error for find() by distro id '%s'", h.distroID))... | [
-0.8113567233085632,
-0.5379945635795593,
0.7731738686561584,
-0.9048967957496643,
-0.3494987487792969,
-0.1133684366941452,
0.44553613662719727,
0.0011222554603591561,
-0.15512169897556305,
0.8051286339759827,
-0.4278217554092407,
-0.29433107376098633,
-0.24087026715278625,
0.312846541404... |
func (h *distroIDDeleteHandler) Parse(ctx context.Context, r *http.Request) error {
h.distroID = gimlet.GetVars(r)["distro_id"]
return nil
} | [
0.3438449800014496,
0.3214659094810486,
0.14755243062973022,
0.12027568370103836,
0.6232917904853821,
0.25338274240493774,
-0.638992428779602,
0.015146187506616116,
-0.26170945167541504,
-0.20441192388534546,
0.3126673400402069,
0.15691792964935303,
-0.04498264938592911,
0.3933833539485931... |
func (h *distroIDDeleteHandler) Run(ctx context.Context) gimlet.Responder {
_, err := h.sc.FindDistroById(h.distroID)
if err != nil {
return gimlet.MakeJSONErrorResponder(errors.Wrapf(err, "Database error for find() by distro id '%s'", h.distroID))
}
err = h.sc.DeleteDistroById(h.distroID)
if err != nil {
ret... | [
-0.5141575336456299,
-0.6106778979301453,
0.3934430480003357,
-0.7672423720359802,
0.06008420139551163,
-0.3942534029483795,
0.20869268476963043,
-0.0553874671459198,
0.15752243995666504,
0.43278947472572327,
-0.29738810658454895,
-0.05921584740281105,
-0.49484017491340637,
0.3964931964874... |
func (h *distroIDPatchHandler) Parse(ctx context.Context, r *http.Request) error {
h.distroID = gimlet.GetVars(r)["distro_id"]
body := util.NewRequestReader(r)
defer body.Close()
b, err := ioutil.ReadAll(body)
if err != nil {
return errors.Wrap(err, "Argument read error")
}
h.body = b
return nil
} | [
-0.30804452300071716,
0.4318677484989166,
0.45079338550567627,
-0.1653284728527069,
0.08930997550487518,
0.5084227323532104,
-0.7212733030319214,
-0.16095814108848572,
-0.47343364357948303,
0.056796591728925705,
0.3584885597229004,
0.16381968557834625,
-0.25680214166641235,
0.2177171409130... |
func (h *distroIDPatchHandler) Run(ctx context.Context) gimlet.Responder {
d, err := h.sc.FindDistroById(h.distroID)
if err != nil {
return gimlet.MakeJSONErrorResponder(errors.Wrapf(err, "Database error for find() by distro id '%s'", h.distroID))
}
apiDistro := &model.APIDistro{}
if err = apiDistro.BuildFromSe... | [
-1.0573010444641113,
-0.6400187611579895,
0.6574269533157349,
-0.7990762591362,
-0.5316440463066101,
-0.033527519553899765,
0.1776067167520523,
0.3011817932128906,
-0.08219198882579803,
0.5090962052345276,
-0.6089258790016174,
0.03631550818681717,
-0.623587965965271,
0.05835629627108574,
... |
func (h *distroIDGetHandler) Parse(ctx context.Context, r *http.Request) error {
h.distroID = gimlet.GetVars(r)["distro_id"]
return nil
} | [
0.1636023372411728,
0.554451584815979,
0.1475207507610321,
0.141790509223938,
0.6074380278587341,
0.29116782546043396,
-0.6260101199150085,
-0.32700857520103455,
-0.5100346803665161,
-0.4437043368816376,
0.42558780312538147,
0.30700820684432983,
-0.32630112767219543,
0.12341371923685074,
... |
func (h *distroIDGetHandler) Run(ctx context.Context) gimlet.Responder {
d, err := h.sc.FindDistroById(h.distroID)
if err != nil {
return gimlet.MakeJSONErrorResponder(errors.Wrapf(err, "Database error for find() by distro id '%s'", h.distroID))
}
distroModel := &model.APIDistro{}
if err = distroModel.BuildFrom... | [
-0.8209558725357056,
-0.31325939297676086,
0.3267138600349426,
-0.6922250986099243,
0.052644480019807816,
-0.06245307996869087,
0.02947225794196129,
0.14932285249233246,
-0.26897382736206055,
0.042820174247026443,
-0.28769007325172424,
0.07910666614770889,
-0.29575115442276,
0.194301828742... |
func (src *prometheusMetricsSource) buildPoint(name string, m *dto.Metric, now int64, tags map[string]string) []*MetricPoint {
var result []*MetricPoint
if m.Gauge != nil {
if !math.IsNaN(m.GetGauge().GetValue()) {
point := src.metricPoint(name+".gauge", float64(m.GetGauge().GetValue()), now, src.source, tags)
... | [
-0.25706738233566284,
-0.43499162793159485,
0.6197642087936401,
0.31305280327796936,
-0.10649607330560684,
-0.05512122064828873,
-0.3097301721572876,
0.12264881283044815,
-0.5602564215660095,
0.6014943718910217,
0.6551238298416138,
0.030357563868165016,
-0.4103696942329407,
0.8240913748741... |
func (src *prometheusMetricsSource) buildQuantiles(name string, m *dto.Metric, now int64, tags map[string]string) []*MetricPoint {
var result []*MetricPoint
for _, q := range m.GetSummary().Quantile {
if !math.IsNaN(q.GetValue()) {
point := src.metricPoint(name+"."+fmt.Sprint(q.GetQuantile()), float64(q.GetValue... | [
-0.25569918751716614,
-0.33578237891197205,
0.5140053629875183,
-0.4550456404685974,
-0.5290346145629883,
-0.31328967213630676,
-0.40917134284973145,
-0.2594826817512512,
-0.5677764415740967,
0.4106559753417969,
0.2865588665008545,
-0.240833580493927,
0.21385760605335236,
0.053773529827594... |
func (src *prometheusMetricsSource) buildHistos(name string, m *dto.Metric, now int64, tags map[string]string) []*MetricPoint {
var result []*MetricPoint
for _, b := range m.GetHistogram().Bucket {
point := src.metricPoint(name+"."+fmt.Sprint(b.GetUpperBound()), float64(b.GetCumulativeCount()), now, src.source, tag... | [
-0.07706477493047714,
0.13318829238414764,
0.612118124961853,
-0.016031676903367043,
-0.10166012495756149,
-0.3255099058151245,
0.006251966115087271,
-0.034382667392492294,
-0.6814378499984741,
0.17254462838172913,
-0.3494316041469574,
0.190194234251976,
0.8510225415229797,
0.2108051329851... |
func (src *prometheusMetricsSource) buildTags(m *dto.Metric) map[string]string {
result := map[string]string{}
for k, v := range src.tags {
if len(v) > 0 {
result[k] = v
}
}
for _, lp := range m.Label {
if len(lp.GetValue()) > 0 {
result[lp.GetName()] = lp.GetValue()
}
}
return result
} | [
-0.7319858074188232,
-0.16206759214401245,
0.3297159969806671,
-0.7118293642997742,
-0.1196124330163002,
-0.09229514002799988,
-1.0139588117599487,
-0.44633814692497253,
-1.4657307863235474,
0.5104816555976868,
-0.2877940833568573,
0.17924199998378754,
0.19845744967460632,
0.48543792963027... |
func CreateImageFlavor(flavorLabel string, outputFlavorFilePath string, inputImageFilePath string, outputEncImageFilePath string,
keyID string, integrityRequired bool) (string, error) {
log.Trace("pkg/imageflavor/create_image_flavors.go:CreateImageFlavor() Entering")
defer log.Trace("pkg/imageflavor/create_image_fla... | [
-0.7839111685752869,
0.14625214040279388,
0.6722748279571533,
0.16624440252780914,
-0.8417100310325623,
-0.4453202784061432,
-0.20107479393482208,
0.04322764277458191,
-0.09872513264417648,
1.2541475296020508,
0.3436643183231354,
0.3424808084964752,
-0.332914799451828,
0.5802661776542664,
... |
func (*Distributor) Descriptor() ([]byte, []int) {
return file_distributorService_proto_rawDescGZIP(), []int{0}
} | [
-0.43669256567955017,
0.44422447681427,
0.43109291791915894,
0.30524078011512756,
-0.48271259665489197,
0.12788859009742737,
0.6681536436080933,
0.9628201723098755,
-0.2677081525325775,
-1.3045181035995483,
-0.11887846887111664,
-0.12287435680627823,
0.061595309525728226,
1.034792423248291... |
func (*DistributorWhere) Descriptor() ([]byte, []int) {
return file_distributorService_proto_rawDescGZIP(), []int{1}
} | [
0.2327898144721985,
0.17320522665977478,
0.7059881687164307,
0.0030525969341397285,
-0.16847658157348633,
0.03529943525791168,
0.7322958111763,
0.6925694346427917,
-1.0983364582061768,
-0.5275253057479858,
0.028159989044070244,
-0.8287121653556824,
0.7170803546905518,
0.7021296620368958,
... |
func (*DistributorTeamNum) Descriptor() ([]byte, []int) {
return file_distributorService_proto_rawDescGZIP(), []int{2}
} | [
-0.8727494478225708,
1.0153594017028809,
0.5892137289047241,
0.453570693731308,
0.30323973298072815,
-0.40135809779167175,
1.3631128072738647,
0.2687346637248993,
-1.0679045915603638,
-1.2185794115066528,
-0.6381496787071228,
-0.4286760091781616,
1.049479365348816,
0.13924448192119598,
0... |
func (*DistributorTeam) Descriptor() ([]byte, []int) {
return file_distributorService_proto_rawDescGZIP(), []int{3}
} | [
-0.20588387548923492,
0.8506771326065063,
0.2696607708930969,
0.3686971366405487,
0.2794751524925232,
0.26964831352233887,
0.21705730259418488,
-0.2286241501569748,
-0.9052726626396179,
-0.9378510117530823,
0.20921142399311066,
-0.0897575095295906,
0.5688927173614502,
-0.24064356088638306,... |
func (*DistributorTeamWhere) Descriptor() ([]byte, []int) {
return file_distributorService_proto_rawDescGZIP(), []int{4}
} | [
0.39581769704818726,
0.463862806558609,
0.8353038430213928,
-0.09611393511295319,
-0.21255512535572052,
0.1909949630498886,
0.88852459192276,
-0.0807919129729271,
-1.6032410860061646,
-0.6439990997314453,
-0.1816883534193039,
-0.6581889390945435,
1.2098841667175293,
0.10859669744968414,
... |
func (*DistributorResponse) Descriptor() ([]byte, []int) {
return file_distributorService_proto_rawDescGZIP(), []int{5}
} | [
-0.24936442077159882,
0.1102452427148819,
0.27963921427726746,
0.03857598081231117,
-0.17735284566879272,
-0.19702360033988953,
1.1328874826431274,
0.4060722291469574,
0.014728899113833904,
-0.8527294993400574,
-0.11929906904697418,
-0.44896742701530457,
-0.48587721586227417,
0.00528841139... |
func (*DistributorTeamNumResponse) Descriptor() ([]byte, []int) {
return file_distributorService_proto_rawDescGZIP(), []int{6}
} | [
-0.550112783908844,
0.34305357933044434,
0.379268616437912,
0.10804970562458038,
0.4831950068473816,
-0.7066677808761597,
1.4296866655349731,
-0.1306450068950653,
-0.09884101897478104,
-1.2296525239944458,
-0.9701506495475769,
-0.5669283270835876,
0.2950505018234253,
-0.1091492772102356,
... |
func (*DistributorTeamResponse) Descriptor() ([]byte, []int) {
return file_distributorService_proto_rawDescGZIP(), []int{7}
} | [
-0.09910395741462708,
0.25983333587646484,
0.07129514962434769,
-0.2811669409275055,
0.2372858077287674,
-0.5015549659729004,
1.1538816690444946,
-0.3332529067993164,
-0.44640976190567017,
-0.2824191749095917,
-0.46542826294898987,
-0.41510334610939026,
0.10999862104654312,
-0.133082956075... |
func (ps *PubSub) PubGateResult(ctx context.Context, win bool) error {
info := &pbGlobal.AccountInfo{Id: 1, Name: "pub_client"}
return ps.pubGateResult.Publish(ctx, &pbPubSub.PubGateResult{Info: info, Win: win})
} | [
0.9269058108329773,
0.19966422021389008,
0.3346917927265167,
0.20520396530628204,
-0.42692992091178894,
0.3818429410457611,
0.3886248469352722,
0.23457986116409302,
-0.32629695534706116,
0.40992167592048645,
-0.19018973410129547,
0.41904059052467346,
-1.889977216720581,
0.5593125224113464,... |
func TestCapabilitiesExternal(t *testing.T) {
cfg := getCapabilitiesTestConfig()
capsNonExternal := getCapabilitiesWithConfig(cfg, t)
cfg.External = config.BooleanDefaultFalse{Value: config.ExplicitlyEnabled}
capsExternal := getCapabilitiesWithConfig(cfg, t)
for _, cap := range externalUnsupportedCapabilities {
... | [
-0.2289222627878189,
-0.16219818592071533,
0.7495791912078857,
-0.03402309492230415,
-0.2917284369468689,
0.5974419116973877,
0.09713298082351685,
0.5907844305038452,
-0.011451923288404942,
0.3388000428676605,
-0.7050695419311523,
-0.4946134090423584,
0.24433769285678864,
0.769233703613281... |
func TestAcceptTransactionSet(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
// Create a transaction pool tester.
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer tpt.Close()
// Check that the transaction pool is empty.
if len(tpt.tpool.transactionSets) != 0 {
t.Error("tr... | [
0.45141321420669556,
1.1647359132766724,
0.5081591010093689,
-0.7667676210403442,
-0.004984791856259108,
-0.10418568551540375,
0.4887533485889435,
-1.1196645498275757,
-0.10324788093566895,
0.3146216869354248,
-0.1143195778131485,
0.2862206697463989,
-0.15590614080429077,
-0.19651916623115... |
func TestConflictingTransactionSets(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
// Create a transaction pool tester.
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer tpt.Close()
// Fund a partial transaction.
fund := types.NewCurrency64(30e6)
txnBuilder, err := tpt.wall... | [
0.4684462547302246,
0.07022346556186676,
0.747743546962738,
-0.08177833259105682,
0.23247648775577545,
-0.781270444393158,
1.0824629068374634,
-0.9857155084609985,
0.11611143499612808,
-0.038411375135183334,
-0.3376111388206482,
-0.9156299233436584,
-0.00857923086732626,
-0.129575446248054... |
func TestCheckMinerFees(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
// Create a transaction pool tester.
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer tpt.Close()
// Prepare a bunch of outputs for a series of graphs to fill up the
// transaction pool.
graphLens := 20... | [
0.4864826500415802,
1.22359037399292,
0.7190458178520203,
0.30206289887428284,
0.3437613844871521,
-0.7122026681900024,
0.5766696333885193,
-0.5637235045433044,
0.03930947184562683,
0.4111747145652771,
0.4905290901660919,
0.39605265855789185,
-0.05562005937099457,
0.10384322702884674,
-0... |
func TestTransactionGraph(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
// Create a transaction pool tester.
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer tpt.Close()
// Create a transaction sending money to an output that TransactionGraph can
// spent (the empty Unlock... | [
0.6561457514762878,
1.3776655197143555,
0.521847665309906,
-0.4834260940551758,
-0.46776798367500305,
-1.063929557800293,
1.2384028434753418,
-0.506222665309906,
0.006875424180179834,
1.0054761171340942,
-0.24513396620750427,
-0.6274943947792053,
-0.0537874810397625,
-0.9357142448425293,
... |
func TestTransactionGraphDiamond(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
// Create a transaction pool tester.
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer tpt.Close()
// Create a transaction sending money to an output that TransactionGraph can
// spent (the empty... | [
0.4450092613697052,
1.3258914947509766,
0.7434356808662415,
-0.5141317248344421,
-0.3768347501754761,
-0.8535999059677124,
1.2825419902801514,
-0.48611772060394287,
0.20903998613357544,
0.41670718789100647,
-0.09324993938207626,
-0.4786962866783142,
0.15755407512187958,
-0.7610536217689514... |
func TestTransactionSuperset(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
// Create a transaction pool tester.
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer tpt.Close()
// Fund a partial transaction.
fund := types.NewCurrency64(30e6)
txnBuilder, err := tpt.wallet.Star... | [
0.4819391965866089,
0.8789629936218262,
0.633309006690979,
-0.2619812488555908,
-0.09247346967458725,
-0.31535670161247253,
0.6480981707572937,
-0.1309782862663269,
-0.12389393895864487,
-0.098827064037323,
-0.9563493728637695,
0.12737169861793518,
-0.2121705710887909,
-0.18758969008922577... |
func TestTransactionSubset(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
// Create a transaction pool tester.
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer tpt.Close()
// Fund a partial transaction.
fund := types.NewCurrency64(30e6)
txnBuilder, err := tpt.wallet.StartT... | [
0.35685116052627563,
0.4458566904067993,
0.6822138428688049,
-0.4720386266708374,
-0.015017485246062279,
-0.018222061917185783,
0.78275066614151,
-0.6399474740028381,
-0.15630285441875458,
0.14725333452224731,
-0.6532320976257324,
-0.13754156231880188,
0.05178619176149368,
-0.1152019798755... |
func TestTransactionChild(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
// Create a transaction pool tester.
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer tpt.Close()
// Fund a partial transaction.
fund := types.NewCurrency64(30e6)
txnBuilder, err := tpt.wallet.StartTr... | [
0.9143397808074951,
0.12742558121681213,
0.9134101271629333,
-0.31125128269195557,
-0.09256784617900848,
-0.019178880378603935,
0.7239658832550049,
-0.9568798542022705,
-0.07593565434217453,
0.07652696222066879,
-1.0672800540924072,
-0.5676289796829224,
0.009579788893461227,
-0.30639758706... |
func TestNilAccept(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer tpt.Close()
err = tpt.tpool.AcceptTransactionSet(nil)
if err == nil {
t.Error("no error returned when submitting nothing to the transaction pool")
}
err = t... | [
0.5311594605445862,
0.8130475282669067,
0.7925813794136047,
-1.0567872524261475,
-0.5028720498085022,
0.11149514466524124,
0.34155821800231934,
-1.1037744283676147,
-0.11171335726976395,
-0.09126129001379013,
0.23776429891586304,
0.47680991888046265,
-0.2513938546180725,
0.5130910873413086... |
func TestAcceptFCAndConflictingRevision(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer tpt.Close()
// Create and fund a valid file contract.
builder, err := tpt.wallet.StartTransaction()
if err != nil {
t.Fatal(err)
}
pay... | [
0.7935343980789185,
0.20544421672821045,
0.7876701354980469,
-0.17729109525680542,
-0.23183570802211761,
-1.0364224910736084,
0.7900383472442627,
0.13988366723060608,
-0.6012547612190247,
-0.26939937472343445,
-0.09154606610536575,
-0.3268471956253052,
0.329580694437027,
0.3673631548881531... |
func TestPartialConfirmation(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer tpt.Close()
// Create and fund a valid file contract.
builder, err := tpt.wallet.StartTransaction()
if err != nil {
t.Fatal(err)
}
payout := type... | [
1.1819804906845093,
-0.10524579882621765,
0.8328127264976501,
0.060836028307676315,
-0.1759151816368103,
-0.5675461292266846,
0.6157597899436951,
0.25971320271492004,
-0.006369736976921558,
-0.1105506643652916,
-0.0577075220644474,
-0.1927933394908905,
0.10954096168279648,
0.05587902292609... |
func TestPartialConfirmationWeave(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer tpt.Close()
// Create a transaction with a single output to a fully controlled address.
emptyUH := types.UnlockConditions{}.UnlockHash()
builder... | [
0.9466556906700134,
0.2884806990623474,
0.8342540264129639,
0.876892626285553,
-0.19733349978923798,
-0.4889943599700928,
1.534550428390503,
-0.4464733600616455,
0.14205984771251678,
-0.17807815968990326,
-0.3875558078289032,
0.05275966599583626,
0.021889161318540573,
0.39022862911224365,
... |
func (p *Provisioner) newClassReflector(kubeClient *kubernetes.Clientset) (cache.Store, *cache.Reflector) {
classStore := cache.NewStore(cache.DeletionHandlingMetaNamespaceKeyFunc)
var classReflector *cache.Reflector
// In 1.6 and above classes are out of beta
classListWatch := &cache.ListWatch{
ListFunc: p.list... | [
-1.410070538520813,
-0.7357712984085083,
0.5838757157325745,
-0.44292303919792175,
-0.18855689465999603,
-0.1180485337972641,
-0.2748487889766693,
-0.024300426244735718,
0.37032464146614075,
0.195602685213089,
-0.022030610591173172,
-0.06561063230037689,
-0.04753842204809189,
1.04029297828... |
func Info(r *kite.Request) (interface{}, error) {
providerName, err := CheckProvider()
if err != nil {
return info{}, err
}
i := info{
ProviderName: providerName.String(),
}
return i, nil
} | [
-0.9200596809387207,
0.2376842498779297,
0.4952971935272217,
0.29383471608161926,
-0.3413132429122925,
-0.2337600588798523,
-0.15813101828098297,
-0.8769432306289673,
-0.1958223283290863,
1.1768627166748047,
0.12624478340148926,
0.35249876976013184,
0.18915054202079773,
0.5415090918540955,... |
func (t ProviderType) String() string {
if int(t) >= 0 && int(t) < len(providerTypes) {
return providerTypes[t]
} else {
return ""
}
} | [
-0.41293054819107056,
-0.20366820693016052,
0.13910964131355286,
-0.3023255169391632,
0.2561472952365875,
0.8001936078071594,
0.03496946394443512,
-1.6360042095184326,
0.5310237407684326,
1.0351839065551758,
-0.04257872700691223,
0.32431504130363464,
-0.7582791447639465,
0.1902536749839782... |
func GetText(w http.ResponseWriter, r *http.Request) {
db := pongo2.Globals[WikipDBKey].(*sql.DB)
vars := mux.Vars(r)
docid, err := strconv.Atoi(vars["docid"])
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
rows, err := db.Query(`SELECT curid, text FROM wikip WHERE id=?`, docid)
... | [
-0.7764034271240234,
0.004295120015740395,
0.7914207577705383,
-0.10097349435091019,
-1.0998142957687378,
-0.6475521922111511,
-0.40710341930389404,
-0.35725417733192444,
0.0694131851196289,
1.3725404739379883,
-0.10289658606052399,
0.1920834183692932,
-0.8392305374145508,
0.06832560151815... |
func GetTexts(w http.ResponseWriter, r *http.Request) {
db := pongo2.Globals[WikipDBKey].(*sql.DB)
vars := mux.Vars(r)
query := vars["query"]
if len(query) == 0 {
http.Error(w, "Query is not specified", http.StatusBadRequest)
return
}
query = width.Widen.String(query)
bigram := getBigram(query)
if bigram =... | [
-0.5642693638801575,
0.25201717019081116,
0.8303617238998413,
-0.639676570892334,
-0.8943910598754883,
-1.1186543703079224,
-0.2350643128156662,
-0.003908875863999128,
-0.21105076372623444,
0.835594117641449,
0.5047955513000488,
-0.43595588207244873,
-0.6490539908409119,
0.3927082419395447... |
func NewMemTokenKeeper(sessionduration time.Duration) (TokenKeeper, error) {
var tk memSessionTokenKeeper
tk.userTokens = make(map[string]string)
tk.maxduration = sessionduration
return &tk, nil
} | [
0.07987429201602936,
-0.696753978729248,
0.26801377534866333,
-0.19102515280246735,
-1.9767701625823975,
-0.12764742970466614,
-0.18982622027397156,
-0.1533658802509308,
-0.06301366537809372,
-0.1320410966873169,
-0.9268501996994019,
0.5568253993988037,
0.2644853889942169,
0.84410125017166... |
func (tk *memSessionTokenKeeper) NewUserToken(username string) (token string, err error) {
h := sha256.New()
h.Write([]byte(username))
h.Write([]byte(time.Now().String()))
token = fmt.Sprintf("%x", h.Sum(nil))
tk.mutex.Lock()
defer tk.mutex.Unlock()
tk.userTokens[username] = token
go func() {
timer := time.Ne... | [
0.1485649198293686,
-0.8161462545394897,
0.531676709651947,
-0.13638059794902802,
-1.5207842588424683,
-0.30654171109199524,
0.7761542201042175,
0.26202094554901123,
0.6376085877418518,
-0.1999928057193756,
-1.9252442121505737,
0.4024905264377594,
-0.3540779948234558,
0.2364831417798996,
... |
func (tk *memSessionTokenKeeper) DelUserToken(username string) error {
tk.mutex.Lock()
defer tk.mutex.Unlock()
if _, exists := tk.userTokens[username]; exists {
delete(tk.userTokens, username)
return nil
}
return ErrNoSuchSession
} | [
0.3704477846622467,
-0.5423468351364136,
0.37016257643699646,
-0.04011115804314613,
-1.4254732131958008,
0.17200380563735962,
0.6735853552818298,
0.49493408203125,
0.9122942686080933,
-0.22221902012825012,
-1.7153831720352173,
0.6308456063270569,
-0.36517930030822754,
0.10308872163295746,
... |
func (tk *memSessionTokenKeeper) Clear() {
tk.mutex.Lock()
defer tk.mutex.Unlock()
tk.userTokens = make(map[string]string)
} | [
-0.15260449051856995,
-0.4256761968135834,
0.14454014599323273,
-0.5360880494117737,
-0.7929139137268066,
0.9174801707267761,
-0.12584726512432098,
-0.3038148880004883,
-0.07849132269620895,
0.03491726517677307,
-0.3461505174636841,
0.9571059346199036,
0.08657172322273254,
0.48432961106300... |
func IntToHex(n int64) []byte {
return []byte(strconv.FormatInt(n, 16))
} | [
-0.5513278245925903,
-0.01160469651222229,
0.3835083246231079,
-0.5080710649490356,
0.5291191339492798,
0.20880445837974548,
-1.2570408582687378,
-0.5537912845611572,
0.008801458403468132,
0.47497525811195374,
-0.7973561882972717,
-0.25833621621131897,
0.6845095157623291,
0.485768824815750... |
func IntToHexString(n int64) string {
return strconv.FormatInt(n, 16)
} | [
-0.36023929715156555,
0.0021382549311965704,
0.33857461810112,
-1.099172592163086,
-0.07402259856462479,
0.7686411142349243,
-0.9991284608840942,
-0.8530440330505371,
-0.04600020498037338,
0.23240478336811066,
-0.17279532551765442,
-1.0503957271575928,
0.775692880153656,
0.0145022869110107... |
func NewServiceSource(kubeClient kubernetes.Interface, clusterName, namespace, annotationFilter string, fqdnTemplate string, combineFqdnAnnotation bool, compatibility string, publishInternal bool, dryRun bool) (Source, error) {
var (
tmpl *template.Template
err error
)
if fqdnTemplate != "" {
tmpl, err = temp... | [
-0.5251028537750244,
-0.07708092778921127,
0.1543351709842682,
-0.0936429426074028,
-1.3715380430221558,
-0.8300336003303528,
0.07259133458137512,
0.1515890508890152,
0.02631540223956108,
0.6464516520500183,
-0.24283072352409363,
0.15704311430454254,
-0.9041522145271301,
0.7858690023422241... |
func (sc *serviceSource) ExternalIPSetting() (*setting.ExternalIPSetting, error) {
services, err := sc.client.CoreV1().Services(sc.namespace).List(metav1.ListOptions{})
if err != nil {
return nil, err
}
services.Items, err = sc.filterByAnnotations(services.Items)
if err != nil {
return nil, err
}
// get all... | [
-0.7975806593894958,
0.7565093636512756,
0.6846147775650024,
-0.8001906275749207,
-0.9205808639526367,
-0.14759938418865204,
-0.3885241746902466,
0.12023851275444031,
0.14648017287254333,
1.0012567043304443,
0.33201444149017334,
0.23970963060855865,
0.015207809396088123,
0.253015398979187,... |
func (sc *serviceSource) endpoints(svc *v1.Service, nodeTargets endpoint.Targets) []*endpoint.Endpoint {
var endpoints []*endpoint.Endpoint
hostnameList := getHostnamesFromAnnotations(svc.Annotations)
for _, hostname := range hostnameList {
endpoints = append(endpoints, sc.generateEndpoint(svc, hostname, nodeTarg... | [
-0.6680237650871277,
0.677549421787262,
0.10087844729423523,
0.11561328172683716,
0.8030981421470642,
0.22591617703437805,
-0.6764681935310364,
0.8747056126594543,
-0.16657426953315735,
-0.04041331261396408,
0.3461046516895294,
0.45868948101997375,
0.2111774981021881,
0.5680853724479675,
... |
func (sc *serviceSource) filterByAnnotations(services []v1.Service) ([]v1.Service, error) {
labelSelector, err := metav1.ParseToLabelSelector(sc.annotationFilter)
if err != nil {
return nil, err
}
selector, err := metav1.LabelSelectorAsSelector(labelSelector)
if err != nil {
return nil, err
}
// empty filte... | [
-0.6169595718383789,
0.1780216544866562,
0.18729618191719055,
-0.2488471120595932,
-0.8423692584037781,
-0.03909563645720482,
-0.2535496652126312,
-1.022444248199463,
0.785270631313324,
0.9110334515571594,
0.4537844955921173,
0.3166719377040863,
-0.6050599813461304,
0.26403310894966125,
... |
func Copy(a, b interface{}) error {
aValue := reflect.ValueOf(a)
bValue := reflect.ValueOf(b)
return copy(aValue, bValue)
} | [
-0.6455393433570862,
-0.6449483036994934,
0.6199362277984619,
0.17169971764087677,
-1.2672251462936401,
0.506031334400177,
-0.15306277573108673,
-0.5124186873435974,
-0.13294599950313568,
0.5418390035629272,
0.8077408075332642,
1.362309217453003,
0.06716697663068771,
0.04800364002585411,
... |
func NewDefaultEndpointResolver() *internalendpoints.Resolver {
return internalendpoints.New()
} | [
-0.498517245054245,
-0.2187705785036087,
0.29305657744407654,
0.37081289291381836,
0.5558260679244995,
-0.3091084361076355,
-0.453674852848053,
0.9979024529457092,
-0.014398814179003239,
-0.5298098921775818,
-0.7917901873588562,
-1.2110062837600708,
-0.9733162522315979,
-0.0904087275266647... |
func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver {
e := aws.Endpoint{URL: url, Source: aws.EndpointSourceCustom}
for _, fn := range optFns {
fn(&e)
}
return EndpointResolverFunc(
func(region string, options EndpointResolverOptions) (aws.Endpoint, error) {
if len(e.Sig... | [
-0.8859661817550659,
-0.24382033944129944,
0.3617529273033142,
0.06528166681528091,
0.11359716951847076,
-0.3374003767967224,
-0.513408362865448,
0.9023205041885376,
0.3294319808483124,
0.04120022431015968,
-0.5931513905525208,
-0.1045401319861412,
-0.20738905668258667,
-0.7744248509407043... |
func (r *resolver) ResolveEndpoint(
ctx context.Context, params EndpointParameters,
) (
endpoint smithyendpoints.Endpoint, err error,
) {
return endpoint, fmt.Errorf("no endpoint rules defined")
} | [
-0.23684605956077576,
-0.29391413927078247,
0.3464025855064392,
0.8327014446258545,
1.3897818326950073,
0.10310473293066025,
0.14104244112968445,
0.8488532304763794,
-0.13871267437934875,
0.1448425054550171,
0.5947893857955933,
0.19710759818553925,
-0.7826834321022034,
0.19523903727531433,... |
func WriteStatus(status []byte, buf *goetty.ByteBuf) {
buf.WriteByte('+')
buf.Write(status)
buf.Write(Delims)
} | [
0.06608440726995468,
-0.4078145921230316,
0.3648243546485901,
-0.8265002965927124,
0.24933980405330658,
0.9376212954521179,
-1.0650417804718018,
1.132019281387329,
0.2663690447807312,
0.06154955178499222,
-1.71195387840271,
0.719813883304596,
0.07455206662416458,
0.6426822543144226,
-0.2... |
func WriteInteger(n int64, buf *goetty.ByteBuf) {
buf.WriteByte(':')
buf.Write(goetty.FormatInt64ToBytes(n))
buf.Write(Delims)
} | [
-0.5109767913818359,
-0.13382035493850708,
0.39512157440185547,
-0.9006195068359375,
0.20725750923156738,
0.3598305881023407,
-0.4390336573123932,
0.1992870718240738,
-0.5220650434494019,
-0.042201340198516846,
-1.1806423664093018,
0.17241686582565308,
-0.5114277005195618,
1.32555925846099... |
func WriteBulk(b []byte, buf *goetty.ByteBuf) {
buf.WriteByte('$')
if len(b) == 0 {
buf.Write(NullBulk)
} else {
buf.Write(goetty.StringToSlice(strconv.Itoa(len(b))))
buf.Write(Delims)
buf.Write(b)
}
buf.Write(Delims)
} | [
-0.36985570192337036,
0.7118316292762756,
0.7797574400901794,
0.09514735639095306,
1.549246072769165,
-0.576498806476593,
-0.8039577007293701,
0.7580187916755676,
0.11373521387577057,
-0.2650009095668793,
-0.46024245023727417,
0.830942690372467,
-0.0063658300787210464,
0.9822173714637756,
... |
func WriteArray(lst []interface{}, buf *goetty.ByteBuf) {
buf.WriteByte('*')
if len(lst) == 0 {
buf.Write(NullArray)
buf.Write(Delims)
} else {
buf.Write(goetty.StringToSlice(strconv.Itoa(len(lst))))
buf.Write(Delims)
for i := 0; i < len(lst); i++ {
switch v := lst[i].(type) {
case []inte... | [
-0.3956001102924347,
-0.456699013710022,
0.5860013961791992,
0.3551866412162781,
0.8272784948348999,
-0.07853620499372482,
-0.6995289921760559,
0.23607897758483887,
0.17091111838817596,
0.5737769603729248,
-0.43372347950935364,
0.4910164475440979,
-0.4158143699169159,
1.6878658533096313,
... |
func WriteSliceArray(lst [][]byte, buf *goetty.ByteBuf) {
buf.WriteByte('*')
if len(lst) == 0 {
buf.Write(NullArray)
buf.Write(Delims)
} else {
buf.Write(goetty.StringToSlice(strconv.Itoa(len(lst))))
buf.Write(Delims)
for i := 0; i < len(lst); i++ {
WriteBulk(lst[i], buf)
}
}
} | [
-0.5085254907608032,
-0.4462539851665497,
0.6166136860847473,
-0.1330699324607849,
0.48614704608917236,
-0.6054096817970276,
-0.7166185975074768,
0.6507266163825989,
0.4463816285133362,
0.714900553226471,
-1.0133782625198364,
0.3007916510105133,
-0.6898946166038513,
1.1305240392684937,
-... |
func WriteFVPairArray(fields, values [][]byte, buf *goetty.ByteBuf) {
buf.WriteByte('*')
if len(fields) == 0 || len(values) == 0 {
buf.Write(NullArray)
buf.Write(Delims)
} else {
buf.Write(goetty.StringToSlice(strconv.Itoa(len(fields) * 2)))
buf.Write(Delims)
for i := 0; i < len(values); i++ {
... | [
-0.8892025351524353,
0.016229161992669106,
0.9500713348388672,
0.13604068756103516,
0.16939276456832886,
-0.30073976516723633,
-0.6619411706924438,
-0.017926843836903572,
-0.28012046217918396,
0.07432296872138977,
0.06135561317205429,
-0.5491856336593628,
-0.3736709952354431,
0.71389955282... |
func WriteScorePairArray(members [][]byte, scores []float64, withScores bool, buf *goetty.ByteBuf) {
buf.WriteByte('*')
if len(members) == 0 || len(scores) == 0 {
buf.Write(NullArray)
buf.Write(Delims)
} else {
if withScores {
buf.Write(goetty.StringToSlice(strconv.Itoa(len(members) * 2)))
buf.Wr... | [
-0.748578667640686,
-0.4224987328052521,
1.070411205291748,
0.13068713247776031,
0.5276350378990173,
0.3667108118534088,
-0.19294704496860504,
-0.43282774090766907,
-0.04336171597242355,
0.595125138759613,
0.06244718283414841,
-0.17226076126098633,
-1.3931360244750977,
0.40324920415878296,... |
func All(bs []byte) map[Position]int {
var x, y, dist int
stack := make([]item, len(bs))
dists := make(map[Position]int)
for _, b := range bs {
switch b {
case '(':
stack = append(stack, item{x, y, dist})
case '|':
head := stack[len(stack)-1]
x, y, dist = head.x, head.y, head.dist
case ')':
head... | [
0.11030737310647964,
-0.7551693320274353,
0.8693176507949829,
0.11969438940286636,
-0.20017169415950775,
-0.10636896640062332,
0.2661975026130676,
0.06831046938896179,
-0.06747767329216003,
0.7508332133293152,
-0.7057586312294006,
-0.11171787232160568,
0.44418832659721375,
0.90987354516983... |
func Max(bs []byte) int {
var max int
for _, dist := range All(bs) {
if dist > max {
max = dist
}
}
return max
} | [
0.29782480001449585,
-0.2093432992696762,
0.5430718660354614,
0.8758392333984375,
-0.2721189856529236,
0.18826799094676971,
-0.17356127500534058,
0.4647340476512909,
-0.06465120613574982,
0.3286494314670563,
-0.6014499068260193,
0.4580134451389313,
-0.5486547350883484,
0.7084698677062988,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.