text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func NewHTTPTransport(v1 http.RoundTripper, v2 http.RoundTripper) http.RoundTripper {
return RoundTripperFunc(func(r *http.Request) (*http.Response, error) {
t := v1
if r.ProtoMajor == 2 {
t = v2
}
return t.RoundTrip(r)
})
} | [
-0.8678731918334961,
-0.7598098516464233,
0.507843554019928,
0.6291750073432922,
-0.7690147161483765,
-0.16715098917484283,
-0.5089336633682251,
-1.0817986726760864,
-0.663009762763977,
0.1836320161819458,
-0.6222130656242371,
0.5967025756835938,
-0.3247258961200714,
0.11149287223815918,
... |
func RetryStatus(status int) RetryCond {
return func(resp *http.Response) bool {
return resp.StatusCode == status
}
} | [
0.3746289312839508,
-0.8648107647895813,
0.3448503017425537,
-0.2540806829929352,
-0.8502437472343445,
0.43145009875297546,
-0.8415937423706055,
-0.1314554661512375,
0.41912269592285156,
-0.15666930377483368,
-0.9753015637397766,
-0.06413179636001587,
0.5224146842956543,
-0.757460117340087... |
func NewRetryRoundTripper(rt http.RoundTripper, l *zap.SugaredLogger, b wait.Backoff, conditions ...RetryCond) http.RoundTripper {
return &retryRoundTripper{
logger: l,
transport: rt,
backoffSettings: b,
retryConditions: conditions,
}
} | [
0.08759346604347229,
-1.2781305313110352,
0.4357609152793884,
-0.8938688039779663,
-1.537503957748413,
0.11532025039196014,
-0.3504581153392792,
0.29676583409309387,
-0.081916943192482,
-0.14705319702625275,
-0.4859153628349304,
-0.0029869263526052237,
-0.2960066497325897,
0.22546645998954... |
func NewRuntimeField() *RuntimeField {
r := &RuntimeField{}
return r
} | [
0.18454299867153168,
-0.34690040349960327,
-0.09052463620901108,
0.13760921359062195,
-0.3244348168373108,
0.1694222241640091,
-0.04892602190375328,
-0.39103880524635315,
0.18609686195850372,
-0.31738731265068054,
-1.610098123550415,
0.11101202666759491,
-1.688454508781433,
-0.038225572556... |
func IsHugePageResourceName(name corev1.ResourceName) bool {
return strings.HasPrefix(string(name), corev1.ResourceHugePagesPrefix)
} | [
-0.6047148108482361,
-0.16179674863815308,
0.5219019055366516,
-0.07020401209592819,
0.31254374980926514,
0.015950309112668037,
-0.6219420433044434,
0.5516295433044434,
0.7626272439956665,
1.594805359840393,
0.29015758633613586,
-1.244554877281189,
0.06735977530479431,
0.9902476668357849,
... |
func IsQuotaHugePageResourceName(name corev1.ResourceName) bool {
return strings.HasPrefix(string(name), corev1.ResourceHugePagesPrefix) || strings.HasPrefix(string(name), corev1.ResourceRequestsHugePagesPrefix)
} | [
-0.4759032428264618,
-0.5331048369407654,
0.5728541016578674,
-0.2824285328388214,
0.34869951009750366,
0.016910282894968987,
-0.7771013379096985,
0.18147405982017517,
0.7383598685264587,
1.5523226261138916,
0.7215415835380554,
-1.0469845533370972,
0.4476923942565918,
0.7214917540550232,
... |
func HugePageResourceName(pageSize resource.Quantity) corev1.ResourceName {
return corev1.ResourceName(fmt.Sprintf("%s%s", corev1.ResourceHugePagesPrefix, pageSize.String()))
} | [
-0.23201632499694824,
-0.637067437171936,
0.43583056330680847,
-0.6688079237937927,
0.08688128739595413,
0.12098486721515656,
-0.38275688886642456,
0.8883301019668579,
0.7226593494415283,
1.0111395120620728,
0.5563210844993591,
-0.9586787223815918,
0.6146288514137268,
0.42303964495658875,
... |
func HugePageSizeFromResourceName(name corev1.ResourceName) (resource.Quantity, error) {
if !IsHugePageResourceName(name) {
return resource.Quantity{}, fmt.Errorf("resource name: %s is an invalid hugepage name", name)
}
pageSize := strings.TrimPrefix(string(name), corev1.ResourceHugePagesPrefix)
return resource.P... | [
0.006423738319426775,
-0.9023076295852661,
0.3103177845478058,
-0.26242801547050476,
-0.09081782400608063,
0.3405442237854004,
-0.7783685326576233,
0.14635588228702545,
0.5268431305885315,
0.46554091572761536,
-0.07171429693698883,
-1.0084071159362793,
0.30992263555526733,
0.46436434984207... |
func NonConvertibleFields(annotations map[string]string) map[string]string {
nonConvertibleKeys := map[string]string{}
for key, value := range annotations {
if strings.HasPrefix(key, corev1.NonConvertibleAnnotationPrefix) {
nonConvertibleKeys[key] = value
}
}
return nonConvertibleKeys
} | [
-1.3479137420654297,
0.07380102574825287,
0.3738517761230469,
-0.546540379524231,
-1.2190134525299072,
0.31467193365097046,
-0.03953628987073898,
-0.36710309982299805,
-0.39483779668807983,
1.4085180759429932,
-0.8768056631088257,
-0.7531575560569763,
-1.0569610595703125,
0.193118482828140... |
func IsStandardResourceQuotaScope(str string) bool {
return standardResourceQuotaScopes.Has(str)
} | [
-0.3140959143638611,
-1.043814778327942,
0.14951075613498688,
-0.21006536483764648,
-0.8851664662361145,
-0.15792104601860046,
-0.3955230116844177,
-0.16016876697540283,
-0.035828378051519394,
1.6038023233413696,
-0.44184693694114685,
-0.12432511895895004,
-0.023781247437000275,
-0.0935416... |
func IsResourceQuotaScopeValidForResource(scope corev1.ResourceQuotaScope, resource string) bool {
switch scope {
case corev1.ResourceQuotaScopeTerminating, corev1.ResourceQuotaScopeNotTerminating, corev1.ResourceQuotaScopeNotBestEffort, corev1.ResourceQuotaScopePriorityClass:
return podObjectCountQuotaResources.Ha... | [
0.07769886404275894,
-1.4827061891555786,
0.3054516911506653,
-0.38828763365745544,
-0.28537115454673767,
0.4542180895805359,
-0.304584801197052,
-0.5699706673622131,
-0.04948388785123825,
0.6322957277297974,
0.6086052060127258,
-0.06619610637426376,
0.5105547308921814,
0.1767273098230362,... |
func IsStandardContainerResourceName(str string) bool {
return standardContainerResources.Has(str) || IsHugePageResourceName(corev1.ResourceName(str))
} | [
-0.48094502091407776,
-0.2615411579608917,
0.31166893243789673,
0.22185873985290527,
-0.2714940011501312,
-0.6435348987579346,
-0.010729561559855938,
0.7993655800819397,
0.5399771332740784,
0.5929177403450012,
-0.04854567348957062,
-1.006076455116272,
0.07565675675868988,
0.487024396657943... |
func IsExtendedResourceName(name corev1.ResourceName) bool {
if IsNativeResource(name) || strings.HasPrefix(string(name), corev1.DefaultResourceRequestsPrefix) {
return false
}
// Ensure it satisfies the rules in IsQualifiedName() after converted into quota resource name
nameForQuota := fmt.Sprintf("%s%s", corev1... | [
-0.3663157522678375,
-0.18244478106498718,
0.6206703186035156,
0.3150319755077362,
-1.0641390085220337,
0.21421274542808533,
-0.8989763855934143,
-0.09017912298440933,
0.6263665556907654,
0.6853891611099243,
0.05966910347342491,
-0.1777888387441635,
-0.0201349426060915,
1.0615758895874023,... |
func IsNativeResource(name corev1.ResourceName) bool {
return !strings.Contains(string(name), "/") ||
strings.Contains(string(name), corev1.ResourceDefaultNamespacePrefix)
} | [
-0.4798969626426697,
-0.4585646092891693,
0.3568493127822876,
0.40596768260002136,
-1.0877718925476074,
0.2320607453584671,
-1.3719407320022583,
-0.7633096575737,
0.25651815533638,
0.6621907949447632,
-0.06085815280675888,
-0.7678521871566772,
-0.6543917655944824,
1.136081576347351,
-0.7... |
func IsOvercommitAllowed(name corev1.ResourceName) bool {
return IsNativeResource(name) &&
!IsHugePageResourceName(name)
} | [
-0.011866705492138863,
-0.3495453894138336,
0.7882536053657532,
-0.11177794635295868,
-1.0374996662139893,
0.22521518170833588,
-0.1424081027507782,
-0.5903717279434204,
-0.5474742650985718,
0.7935463786125183,
1.2447397708892822,
-0.12092801183462143,
-0.8911635875701904,
0.62704366445541... |
func IsStandardLimitRangeType(str string) bool {
return standardLimitRangeTypes.Has(str)
} | [
0.05509277060627937,
-0.40651974081993103,
-0.0355934202671051,
0.6393388509750366,
-0.48350611329078674,
0.6444844007492065,
-0.6006415486335754,
0.29765039682388306,
0.18329289555549622,
0.748569130897522,
-1.3026704788208008,
0.0161584485322237,
-1.0335116386413574,
0.09324690699577332,... |
func IsStandardQuotaResourceName(str string) bool {
return standardQuotaResources.Has(str) || IsQuotaHugePageResourceName(corev1.ResourceName(str))
} | [
-0.32468467950820923,
-1.1618720293045044,
0.2822103798389435,
0.3940295875072479,
-0.6735316514968872,
-0.2993690073490143,
-0.3094014823436737,
0.29021838307380676,
0.30303487181663513,
1.0349698066711426,
0.10988528281450272,
-0.48476487398147583,
0.2546638548374176,
0.3853664696216583,... |
func IsStandardResourceName(str string) bool {
return standardResources.Has(str) || IsQuotaHugePageResourceName(corev1.ResourceName(str))
} | [
-0.41265127062797546,
-0.6535312533378601,
0.24983741343021393,
0.05565492436289787,
-0.6624035239219666,
-0.3847583830356598,
-0.24703672528266907,
0.6107674837112427,
0.6675930619239807,
1.0746521949768066,
-0.19853107631206512,
-0.5969908237457275,
0.00017923337873071432,
0.308968573808... |
func IsIntegerResourceName(str string) bool {
return integerResources.Has(str) || IsExtendedResourceName(corev1.ResourceName(str))
} | [
-0.3067885935306549,
-0.20317110419273376,
0.2681063711643219,
0.33026695251464844,
-1.1854394674301147,
-0.39595967531204224,
-0.28300467133522034,
-0.26814132928848267,
0.9417327046394348,
0.7845767140388489,
0.4562578499317169,
-0.48175424337387085,
-0.442531943321228,
0.598204851150512... |
func IsServiceIPSet(service *corev1.Service) bool {
return service.Spec.ClusterIP != corev1.ClusterIPNone && service.Spec.ClusterIP != ""
} | [
-0.8654934763908386,
0.15240494906902313,
0.34266653656959534,
-0.0595567487180233,
-0.021271338686347008,
-0.2647741138935089,
-0.27655452489852905,
-0.3736899495124817,
0.7658618092536926,
1.462206244468689,
0.24735720455646515,
-0.08706756681203842,
-0.7800982594490051,
-0.3571505546569... |
func IsStandardFinalizerName(str string) bool {
return standardFinalizers.Has(str)
} | [
-0.5711022019386292,
-0.14107556641101837,
0.11111830174922943,
0.5530411005020142,
-1.228818416595459,
-0.009984781965613365,
-0.31664401292800903,
0.2715955376625061,
-0.0707385390996933,
-0.20074157416820526,
-0.9817047119140625,
-0.9293683767318726,
-0.36685147881507874,
0.944026768207... |
func LoadBalancerStatusEqual(l, r *corev1.LoadBalancerStatus) bool {
return ingressSliceEqual(l.Ingress, r.Ingress)
} | [
0.546536922454834,
-0.9471718668937683,
0.15918952226638794,
0.3184238374233246,
-0.11954066157341003,
0.9295329451560974,
-1.6566623449325562,
-0.9650726318359375,
1.0093295574188232,
0.9588971734046936,
-0.9210711717605591,
0.5366744995117188,
-1.2016761302947998,
0.35668495297431946,
... |
func GetAccessModesAsString(modes []corev1.PersistentVolumeAccessMode) string {
modes = removeDuplicateAccessModes(modes)
modesStr := []string{}
if containsAccessMode(modes, corev1.ReadWriteOnce) {
modesStr = append(modesStr, "RWO")
}
if containsAccessMode(modes, corev1.ReadOnlyMany) {
modesStr = append(modesS... | [
-0.698646068572998,
-1.1952502727508545,
0.9244480133056641,
-0.4752570688724518,
0.0015366132138296962,
-0.11692780256271362,
-0.4450264573097229,
-1.0579944849014282,
0.7560549974441528,
0.6898317337036133,
1.604961633682251,
0.1278739720582962,
-0.2084660530090332,
-0.0828154981136322,
... |
func GetAccessModesFromString(modes string) []corev1.PersistentVolumeAccessMode {
strmodes := strings.Split(modes, ",")
accessModes := []corev1.PersistentVolumeAccessMode{}
for _, s := range strmodes {
s = strings.Trim(s, " ")
switch {
case s == "RWO":
accessModes = append(accessModes, corev1.ReadWriteOnce)... | [
-0.3326338827610016,
-1.4782661199569702,
0.5651195645332336,
-0.05132799223065376,
0.14507032930850983,
-0.10443581640720367,
-0.35716280341148376,
-0.392238050699234,
0.524070680141449,
0.23870588839054108,
0.7144106030464172,
0.20843000710010529,
-0.7637852430343628,
-0.3990423083305359... |
func removeDuplicateAccessModes(modes []corev1.PersistentVolumeAccessMode) []corev1.PersistentVolumeAccessMode {
accessModes := []corev1.PersistentVolumeAccessMode{}
for _, m := range modes {
if !containsAccessMode(accessModes, m) {
accessModes = append(accessModes, m)
}
}
return accessModes
} | [
-0.544213056564331,
-1.48119056224823,
0.675909161567688,
-0.2213287353515625,
-0.2957500219345093,
0.04187186434864998,
0.48466846346855164,
-0.4866834580898285,
1.097883939743042,
0.6075571179389954,
-0.06306376308202744,
-0.08184469491243362,
-0.35195717215538025,
0.0646023228764534,
... |
func NodeSelectorRequirementsAsSelector(nsm []corev1.NodeSelectorRequirement) (labels.Selector, error) {
if len(nsm) == 0 {
return labels.Nothing(), nil
}
selector := labels.NewSelector()
for _, expr := range nsm {
var op selection.Operator
switch expr.Operator {
case corev1.NodeSelectorOpIn:
op = select... | [
-2.0560336112976074,
-1.091675877571106,
0.4124188721179962,
-0.38441160321235657,
-0.028213540092110634,
-0.3922392427921295,
-0.009848454035818577,
-0.9885703921318054,
0.5428935289382935,
0.5703811645507812,
0.3969399929046631,
0.12210852652788162,
-0.13873901963233948,
0.66825556755065... |
func NodeSelectorRequirementsAsFieldSelector(nsm []corev1.NodeSelectorRequirement) (fields.Selector, error) {
if len(nsm) == 0 {
return fields.Nothing(), nil
}
selectors := []fields.Selector{}
for _, expr := range nsm {
switch expr.Operator {
case corev1.NodeSelectorOpIn:
if len(expr.Values) != 1 {
re... | [
-1.5244793891906738,
-0.5698480606079102,
0.3391927480697632,
-0.8391937613487244,
0.10235251486301422,
-0.626308262348175,
0.19296130537986755,
-0.7063632607460022,
0.37984272837638855,
-0.07440707087516785,
0.0904095396399498,
-0.3648597300052643,
-0.11369583755731583,
0.6344596743583679... |
func AddOrUpdateTolerationInPod(pod *corev1.Pod, toleration *corev1.Toleration) bool {
podTolerations := pod.Spec.Tolerations
var newTolerations []corev1.Toleration
updated := false
for i := range podTolerations {
if toleration.MatchToleration(&podTolerations[i]) {
if Semantic.DeepEqual(toleration, podTolerat... | [
-0.7009827494621277,
0.2182157337665558,
0.8686403632164001,
-0.38016626238822937,
-0.23651136457920074,
0.18867610394954681,
-0.3550506830215454,
-0.40331605076789856,
0.15849706530570984,
0.8747679591178894,
0.05941952019929886,
-0.7287938594818115,
-0.8681896924972534,
-0.37158846855163... |
func GetPersistentVolumeClaimClass(claim *corev1.PersistentVolumeClaim) string {
// Use beta annotation first
if class, found := claim.Annotations[corev1.BetaStorageClassAnnotation]; found {
return class
}
if claim.Spec.StorageClassName != nil {
return *claim.Spec.StorageClassName
}
return ""
} | [
0.17990103363990784,
-1.3731956481933594,
0.793509304523468,
0.2039874643087387,
0.5752885341644287,
0.2872160077095032,
-1.1160639524459839,
0.37393397092819214,
0.16116590797901154,
-0.263346403837204,
1.1760355234146118,
0.15294359624385834,
0.08003658801317215,
0.36976468563079834,
1... |
func PersistentVolumeClaimHasClass(claim *corev1.PersistentVolumeClaim) bool {
// Use beta annotation first
if _, found := claim.Annotations[corev1.BetaStorageClassAnnotation]; found {
return true
}
if claim.Spec.StorageClassName != nil {
return true
}
return false
} | [
0.4649355709552765,
-1.1283327341079712,
0.7351871132850647,
0.6891341805458069,
0.7738312482833862,
0.21795836091041565,
-1.0978541374206543,
0.4866877496242523,
0.038075949996709824,
-0.5697648525238037,
0.52481609582901,
-0.246012344956398,
-0.10742857307195663,
0.7882757782936096,
0.... |
func NewZookeeperSequencer(logger log.ErrorLogger) *ZookeeperSequencer {
s := &ZookeeperSequencer{
logger: logger,
}
return s
} | [
-1.110589861869812,
-1.1352229118347168,
-0.2037230134010315,
0.6342432498931885,
-0.7523491978645325,
-0.682633638381958,
0.18306246399879456,
0.6472442150115967,
0.1437133103609085,
-0.015753835439682007,
-0.5836411714553833,
-0.4995696544647217,
-0.1557418704032898,
1.5415328741073608,
... |
func (r *reporter) Fail() {
atomic.StoreInt32(&r.failed, 1)
} | [
0.2911347448825836,
0.954169750213623,
0.1152181625366211,
-0.8745787739753723,
0.6564568281173706,
0.21103499829769135,
0.3161117136478424,
-0.6627273559570312,
-0.887749433517456,
-0.6784599423408508,
-0.7826844453811646,
-0.4081892967224121,
-1.5484542846679688,
1.1032406091690063,
0.... |
func (r *reporter) Failed() bool {
return atomic.LoadInt32(&r.failed) > 0
} | [
0.25768837332725525,
0.5798432230949402,
0.40002864599227905,
-0.5261713266372681,
-0.035137079656124115,
0.13882412016391754,
-0.28475338220596313,
-0.20035237073898315,
-0.05065130442380905,
-0.9096638560295105,
-0.6073273420333862,
-0.9420933723449707,
-1.2409093379974365,
0.25139522552... |
func (r *reporter) Fatal(args ...interface{}) {
r.Fail()
panic(fmt.Sprint(args...))
} | [
0.998272180557251,
-0.32862424850463867,
0.3032172918319702,
0.6106615662574768,
0.9030534625053406,
1.1212650537490845,
-0.7889906167984009,
0.008963527157902718,
-0.4715837836265564,
-0.6097580194473267,
0.8617845177650452,
-0.1782960444688797,
-0.195703387260437,
0.8877084255218506,
0... |
func (r *reporter) Fatalf(format string, args ...interface{}) {
r.Fatal(fmt.Sprintf(format, args...))
} | [
1.5265005826950073,
-0.47263383865356445,
0.29946035146713257,
-0.10537569224834442,
0.8991953134536743,
0.5276656150817871,
-0.39096787571907043,
0.42457714676856995,
-0.138205885887146,
-0.6503463387489319,
0.9838899374008179,
-0.42832741141319275,
0.31716227531433105,
0.6774601936340332... |
func (r *reporter) Helper() {} | [
1.507477879524231,
-0.45599132776260376,
0.29029905796051025,
-0.12205011397600174,
0.62665855884552,
0.4930523633956909,
1.333420753479004,
0.0893142968416214,
-0.3149910867214203,
-0.6039641499519348,
0.3253454267978668,
-0.9706931710243225,
0.02393268793821335,
1.0287600755691528,
-0.... |
func (shoe *Shoe) addDeck() {
var cards = make([]card.Card, 52)
i := 0
suits := card.AllSuits()
for s := range suits {
for n, v := range *card.AllValues() {
cards[i] = card.Card{
Name: n,
Value: v,
Suit: suits[s],
}
i++
}
}
shoe.Cards = append(shoe.Cards, cards...)
} | [
-0.6474459171295166,
0.8593571782112122,
0.73124760389328,
0.17323291301727295,
-0.3626350462436676,
-0.088437020778656,
-0.5868261456489563,
0.15048539638519287,
0.5237915515899658,
-0.9997047185897827,
0.2677226662635803,
0.6754667162895203,
0.4064783751964569,
1.6674535274505615,
0.07... |
func (shoe *Shoe) Shuffle() {
c := shoe.Cards
rand.Seed(time.Now().UnixNano())
rand.Shuffle(
len(c),
func(i, j int) {
c[i], c[j] = c[j], c[i]
})
} | [
-1.012415885925293,
0.2477237731218338,
0.38053691387176514,
-0.6108819842338562,
0.4013637602329254,
-0.16642461717128754,
0.5848707556724548,
-0.28578639030456543,
0.7201929688453674,
-0.45416390895843506,
0.3905204236507416,
0.8252180814743042,
0.45132169127464294,
0.20480407774448395,
... |
func (shoe *Shoe) DrawCard() card.Card {
card := shoe.Cards[0]
shoe.Cards = shoe.Cards[1:]
return card
} | [
-1.0171831846237183,
0.30048999190330505,
0.6279668211936951,
-0.4606555104255676,
-0.018564775586128235,
0.051380470395088196,
-0.2763217091560364,
0.2524074912071228,
1.654267430305481,
-0.03400794789195061,
0.30199897289276123,
1.4199875593185425,
0.15896447002887726,
-0.153959095478057... |
func New(decks int, shuffles int) *Shoe {
var ret Shoe
for i := 0; i < decks; i++ {
ret.addDeck()
}
for i := 0; i < shuffles; i++ {
ret.Shuffle()
}
return &ret
} | [
-0.373302161693573,
-0.08412349224090576,
0.38982951641082764,
-0.050597336143255234,
0.10210262984037399,
-0.3086448609828949,
0.11655550450086594,
-0.040211547166109085,
-0.0001902117655845359,
-0.24168622493743896,
0.46947503089904785,
-0.15120704472064972,
0.005033815745264292,
0.67911... |
func f8(ctx *Context, l0 int32) int32 {
return ctx.f.F8(ctx, l0)
} | [
-0.7596722841262817,
-0.03864797204732895,
0.04417711868882179,
-0.012697303667664528,
-0.4128492474555969,
-0.11145585775375366,
0.06319136917591095,
-0.16406048834323883,
0.1890220046043396,
-0.8475857973098755,
0.19408099353313446,
0.06226395070552826,
0.20794428884983063,
0.16620413959... |
func NewConfig() *Config {
return &Config{
Options: true,
OptionsHandler: DefaultOptionsHandler,
Trace: false,
TraceHandler: DefaultTraceHandler,
AddHeadOnGet: true,
}
} | [
1.1452568769454956,
0.058423563838005066,
0.140336811542511,
0.33811455965042114,
0.09433896839618683,
0.15541794896125793,
0.03920730948448181,
0.01003657653927803,
0.3794456422328949,
-0.5895965099334717,
-0.1764707863330841,
-0.08017122000455856,
-0.17365486919879913,
0.6921887993812561... |
func New() *Yam {
y := &Yam{}
y.Config = NewConfig()
y.Root = &Route{yam: y}
return y
} | [
0.32510098814964294,
-1.5087858438491821,
0.3823927342891693,
0.3473837673664093,
-0.3194107115268707,
-0.6166651844978333,
0.1776454895734787,
0.6578092575073242,
0.1349780112504959,
-1.1448273658752441,
-0.7220011949539185,
0.9264439940452576,
0.8115976452827454,
1.3768917322158813,
0.... |
func (y *Yam) Route(path string) *Route {
route := y.Root.Route(path)
return route
} | [
0.7717879414558411,
-0.4292227625846863,
0.19365979731082916,
0.8165081739425659,
-0.29370251297950745,
-1.0341767072677612,
0.3226325511932373,
-0.8197237253189087,
-0.2355699986219406,
-1.1044502258300781,
0.5172715783119202,
0.6589624285697937,
0.33755049109458923,
1.1075286865234375,
... |
func route(path string, base *Route, y *Yam) *Route {
var route *Route
// /foo/bar/baz [foo bar baz]
parts := strings.Split(path, "/")[1:]
// Our starting routes we loop over should be the base route
route = base
// Iterate over the parts
var found bool
for _, part := range parts {
// Iterate over the routes... | [
0.7755021452903748,
-0.46832871437072754,
0.5717727541923523,
0.2957105338573456,
0.6770235300064087,
-0.6517332792282104,
-0.6303473711013794,
-0.2751840054988861,
-0.45033329725265503,
-0.30989253520965576,
0.5510586500167847,
0.06849595904350281,
-0.6880514025688171,
0.05229379236698150... |
func (y *Yam) ServeHTTP(w http.ResponseWriter, r *http.Request) {
parts := strings.Split(r.URL.Path, "/")[1:]
routes := y.Root.Routes
for i, part := range parts {
for _, route := range routes {
match := false
// Pattern Match
if strings.HasPrefix(route.leaf, ":") {
match = true
values := url.Valu... | [
0.17077717185020447,
-0.3068593144416809,
0.9084506630897522,
0.6158587336540222,
0.1080135852098465,
-0.2652381360530853,
0.6212632060050964,
0.015116795897483826,
-0.4293438196182251,
0.3155773878097534,
0.7435001730918884,
-0.12388269603252411,
-0.14400231838226318,
0.8314043283462524,
... |
func (r *Route) Route(path string) *Route {
r = route(path, r, r.yam)
if r.handlers == nil {
r.handlers = make(map[string]http.Handler)
}
if r.yam.Config.Options {
if r.handlers["OPTIONS"] == nil {
r.handlers["OPTIONS"] = r.yam.Config.OptionsHandler(r)
}
}
if r.yam.Config.Trace {
if r.handlers["TRAC... | [
0.3107460141181946,
0.01969885267317295,
0.5220898389816284,
-0.11302192509174347,
-0.08028002828359604,
-0.41315749287605286,
0.5094505548477173,
-0.37033864855766296,
0.4562535881996155,
-0.7711068391799927,
-0.07041353732347488,
0.1883721500635147,
-0.01315244846045971,
0.44257497787475... |
func (r *Route) Add(method string, h http.Handler) *Route {
r.handlers[method] = h
return r
} | [
-0.9367336630821228,
-0.2087298482656479,
0.3101537227630615,
0.008333723992109299,
-0.19324877858161926,
0.7547944784164429,
-0.798581600189209,
0.07859828323125839,
-0.08959603309631348,
-0.7546096444129944,
-0.13144059479236603,
0.5368614792823792,
-0.14132386445999146,
0.96067875623703... |
func (r *Route) Head(h http.Handler) *Route {
r.Add("HEAD", h)
return r
} | [
-0.4885200560092926,
0.211786150932312,
0.3074672222137451,
0.5821340680122375,
0.020151479169726372,
1.5647783279418945,
-0.24888285994529724,
-0.006169680971652269,
0.461174875497818,
-0.38069963455200195,
-0.9136377573013306,
0.4729839265346527,
0.5180146098136902,
0.27439653873443604,
... |
func (r *Route) Options(h http.Handler) *Route {
r.Add("OPTIONS", h)
return r
} | [
-0.47098681330680847,
0.8339236378669739,
0.27474528551101685,
-0.19433702528476715,
0.65327388048172,
0.6306589245796204,
-0.36608195304870605,
-0.10442033410072327,
0.21569110453128815,
-0.8209571242332458,
-0.39845961332321167,
-0.5186437368392944,
0.5553246736526489,
0.8557191491127014... |
func (r *Route) Trace(h http.Handler) *Route {
r.Add("TRACE", h)
return r
} | [
0.6219080686569214,
1.010803461074829,
0.3983042538166046,
0.42273834347724915,
0.5058556795120239,
0.6433690786361694,
0.05989295616745949,
-0.48040297627449036,
0.32488277554512024,
-0.47035345435142517,
-0.9552541375160217,
-0.2627158463001251,
0.0748371034860611,
0.6088928580284119,
... |
func (r *Route) Get(h http.Handler) *Route {
r.Add("GET", h)
if r.yam.Config.AddHeadOnGet {
// Apply the head middleware to the head handler
r.Add("HEAD", h)
}
return r
} | [
-0.12299907207489014,
0.17636777460575104,
0.4733465313911438,
-0.2779746949672699,
0.19579587876796722,
0.30724868178367615,
-0.8457614779472351,
0.09403607249259949,
0.23869211971759796,
-0.5815648436546326,
-0.1267223358154297,
0.9583931565284729,
0.03653028607368469,
1.1226966381072998... |
func (r *Route) Post(h http.Handler) *Route {
r.Add("POST", h)
return r
} | [
0.011038514785468578,
0.6764669418334961,
0.24200643599033356,
0.7469702959060669,
-0.16924354434013367,
0.9871212244033813,
-0.6363949179649353,
-0.04138876870274544,
-0.5979087948799133,
-1.5500900745391846,
-0.9647643566131592,
-0.4489329159259796,
0.05933303385972977,
1.263888120651245... |
func (r *Route) Put(h http.Handler) *Route {
r.Add("PUT", h)
return r
} | [
-0.31919601559638977,
0.6641274690628052,
0.15688106417655945,
-0.858590841293335,
0.08136337995529175,
1.1321747303009033,
0.14640386402606964,
0.30535128712654114,
-0.39501577615737915,
-0.387222021818161,
-1.122175693511963,
0.31226786971092224,
-0.3923841416835785,
0.7969009876251221,
... |
func (r *Route) Delete(h http.Handler) *Route {
r.Add("DELETE", h)
return r
} | [
0.44720590114593506,
0.8760688900947571,
0.31583172082901,
0.2576393783092499,
0.7073991298675537,
0.6864770650863647,
-0.2861507534980774,
0.5100897550582886,
0.47306007146835327,
-0.44089454412460327,
-0.5817281603813171,
0.2699147164821625,
-0.23726750910282135,
0.9311052560806274,
-0... |
func (r *Route) Patch(h http.Handler) *Route {
r.Add("PATCH", h)
return r
} | [
0.06784957647323608,
0.1701408326625824,
0.21414494514465332,
-0.5286886096000671,
-0.4170030355453491,
1.4559389352798462,
-0.344750314950943,
0.6169401407241821,
0.21566277742385864,
-0.891556441783905,
-0.7016444206237793,
0.4281447231769562,
0.1779898703098297,
1.1078739166259766,
-0... |
func DefaultOptionsHandler(route *Route) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
methods := []string{}
for key, _ := range route.handlers {
methods = append(methods, key)
}
w.Header().Add("Allow", strings.Join(methods, ", "))
})
} | [
-0.48806270956993103,
0.10361433029174805,
0.4600212574005127,
-0.2974379360675812,
0.20442000031471252,
0.14374947547912598,
-0.2680602967739105,
-0.4026298224925995,
-0.12286273390054703,
0.38629281520843506,
0.5643187761306763,
-1.4270293712615967,
-0.8403195142745972,
0.458004444837570... |
func DefaultTraceHandler(route *Route) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
dump, _ := httputil.DumpRequest(r, false)
w.Write(dump)
})
} | [
-0.07713127136230469,
0.35927996039390564,
0.49947866797447205,
-0.48596417903900146,
0.5120859146118164,
0.44459018111228943,
-0.14103037118911743,
-0.44333702325820923,
0.4789431095123291,
-0.07347752153873444,
0.0656210333108902,
-1.2915019989013672,
-0.8078906536102295,
-0.087456181645... |
func NewUpdateCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *UpdateCommand {
var c UpdateCommand
c.Globals = globals
c.manifest = data
c.CmdClause = parent.Command("update", "Update or insert an item on a Fastly edge dictionary")
c.RegisterServiceIDFlag(&c.manifest.Flag.ServiceID)
c.Cmd... | [
-0.5105968713760376,
-0.7481179237365723,
0.5348571538925171,
-0.2813684344291687,
-0.28944408893585205,
-0.4339546263217926,
-0.30831989645957947,
0.38389939069747925,
0.25614842772483826,
-0.223294198513031,
0.2220555692911148,
0.5779944658279419,
-0.28918853402137756,
1.162298560142517,... |
func (c *UpdateCommand) Exec(in io.Reader, out io.Writer) error {
serviceID, source := c.manifest.ServiceID()
if c.Globals.Verbose() {
cmd.DisplayServiceID(serviceID, source, out)
}
if source == manifest.SourceUndefined {
return errors.ErrNoServiceID
}
c.Input.ServiceID = serviceID
d, err := c.Globals.Clien... | [
-0.30151456594467163,
-0.32805135846138,
0.6589707732200623,
-0.6557515859603882,
-0.956271767616272,
0.794018566608429,
-0.42934584617614746,
0.4455605447292328,
-0.6970469355583191,
0.12806068360805511,
0.3917740285396576,
1.1281201839447021,
-0.10870809108018875,
0.3635525405406952,
0... |
func (self ValueKind) String() string {
switch self {
case I32:
return "i32"
case I64:
return "i64"
case F32:
return "f32"
case F64:
return "f64"
case AnyRef:
return "anyref"
case FuncRef:
return "funcref"
}
panic("Unknown value kind")
} | [
-0.4861671030521393,
-0.7732162475585938,
0.2451968938112259,
-0.20213386416435242,
-0.17294074594974518,
0.5032037496566772,
0.08049644529819489,
-1.4836076498031616,
-0.25466737151145935,
0.437093049287796,
0.7537695169448853,
1.335900902748108,
-0.30990976095199585,
-0.04676656797528267... |
func (self ValueKind) IsNumber() bool {
return bool(C.wasm_valkind_is_num(C.wasm_valkind_t(self)))
} | [
-0.48716816306114197,
-0.19930127263069153,
0.34979894757270813,
1.6842416524887085,
0.16487742960453033,
-0.7061442732810974,
0.2652150094509125,
-0.19127340614795685,
0.7009260654449463,
-0.5963454246520996,
-0.3910646140575409,
1.0160579681396484,
-0.21562913060188293,
0.993701219558715... |
func (self ValueKind) IsReference() bool {
return bool(C.wasm_valkind_is_ref(C.wasm_valkind_t(self)))
} | [
-0.3567768633365631,
-0.017640352249145508,
0.42508429288864136,
0.8875333666801453,
0.2929982841014862,
-0.6959957480430603,
0.24590331315994263,
-0.6126935482025146,
0.7503330707550049,
0.16273777186870575,
0.5662550926208496,
1.3199604749679565,
-0.9603639841079712,
1.3388316631317139,
... |
func NewValueType(kind ValueKind) *ValueType {
pointer := C.wasm_valtype_new(C.wasm_valkind_t(kind))
return newValueType(pointer, nil)
} | [
0.7293215394020081,
0.012730191461741924,
0.211872860789299,
0.4838768541812897,
-0.7961546778678894,
-0.9699220061302185,
-0.4282771348953247,
-0.22449511289596558,
0.4543707072734833,
0.28939884901046753,
-0.42040643095970154,
0.4732487201690674,
-0.4533906579017639,
1.365435004234314,
... |
func (self *ValueType) Kind() ValueKind {
kind := ValueKind(C.wasm_valtype_kind(self.inner()))
runtime.KeepAlive(self)
return kind
} | [
0.011723182164132595,
-0.3758111596107483,
0.09834739565849304,
0.2339618057012558,
0.014261226169764996,
0.19137300550937653,
0.4777830243110657,
-0.539599597454071,
-0.2429593801498413,
-0.37351956963539124,
0.4451184868812561,
1.0581878423690796,
-0.5549842119216919,
0.27196004986763,
... |
func (e *Operation) Validate() error {
if util.HasRFC3986ReservedSymbols(e.ID) {
return fmt.Errorf("%s contains invalid character(s)", e.ID)
}
if e.Type == "" {
return fmt.Errorf("missing operation type")
}
if e.State == "" {
return fmt.Errorf("missing operation state")
}
if e.ResourceID == "" {
retur... | [
-0.13874657452106476,
0.5184692144393921,
0.7019571661949158,
0.05398210138082504,
0.06390797346830368,
-0.14278119802474976,
0.6620625853538513,
-0.4700884222984314,
0.34752824902534485,
-0.07549409568309784,
0.17045289278030396,
-0.5735185742378235,
-0.14916874468326569,
0.51677858829498... |
func (l *Logger) SetLevel(levelName string) *Logger {
l.mu.Lock()
l.Level = getLevelByName(levelName)
l.mu.Unlock()
return l
} | [
-0.25602149963378906,
-0.24210162460803986,
0.29287993907928467,
0.10827721655368805,
-0.5766474604606628,
0.2990817129611969,
0.23228205740451813,
-0.01879534125328064,
0.26747646927833557,
0.06746839731931686,
-0.875728964805603,
0.2550009787082672,
-1.3552021980285645,
0.682527899742126... |
func NewTagsFromTagIterator(iter ident.TagIterator) (ident.Tags, error) {
defer iter.Close()
var r ident.Tags
if tagsLen := iter.Remaining(); tagsLen > 0 {
tags := make([]ident.Tag, 0, tagsLen)
for iter.Next() {
curr := iter.Current()
tagName := checked.NewBytes(append([]byte(nil), curr.Name.Bytes()...), ... | [
0.19140028953552246,
-0.5810053944587708,
0.3106186091899872,
0.18115614354610443,
-0.8843740224838257,
0.020123671740293503,
-0.5428202748298645,
-0.9665749669075012,
-0.8187832236289978,
0.43923938274383545,
-0.4384569227695465,
-0.26763394474983215,
-0.41143298149108887,
1.1924153566360... |
func LPush(conn redigo.Conn, key string, v ...interface{}) (int, error) {
args := []interface{}{key}
args = append(args, v...)
return redigo.Int(Do(conn, "LPUSH", args...))
} | [
-0.3315143585205078,
0.9933921694755554,
0.6423873901367188,
-0.995219886302948,
-0.23201048374176025,
-0.12120876461267471,
-0.7754912376403809,
-0.4479568600654602,
-0.4308680593967438,
0.7208242416381836,
-0.26579323410987854,
-0.001077550696209073,
-0.5307906270027161,
0.69270944595336... |
func RPush(conn redigo.Conn, key string, v ...interface{}) (int, error) {
args := []interface{}{key}
args = append(args, v...)
return redigo.Int(Do(conn, "RPUSH", args...))
} | [
-0.728361964225769,
1.1382089853286743,
0.6154471039772034,
0.188888281583786,
-0.4472203552722931,
-0.14810557663440704,
-0.42221346497535706,
-0.05236336961388588,
-1.150134801864624,
1.3133416175842285,
-0.5005804896354675,
0.31025856733322144,
-0.9478458166122437,
0.1876443773508072,
... |
func LPushX(conn redigo.Conn, key string, v ...interface{}) (int, error) {
args := []interface{}{key}
args = append(args, v...)
return redigo.Int(Do(conn, "LPUSHX", args...))
} | [
-0.16230408847332,
1.1539725065231323,
0.781830906867981,
-0.6120148301124573,
-0.7759443521499634,
-0.07240308821201324,
-1.333716869354248,
-0.16710852086544037,
-0.22361229360103607,
0.6995497941970825,
-0.564157247543335,
-0.04659106954932213,
-0.5726310014724731,
0.32044240832328796,
... |
func RPushX(conn redigo.Conn, key string, v ...interface{}) (int, error) {
args := []interface{}{key}
args = append(args, v...)
return redigo.Int(Do(conn, "RPUSHX", args...))
} | [
-0.9184176921844482,
1.2369836568832397,
0.7732471227645874,
0.27006348967552185,
-0.8818652033805847,
-0.09989452362060547,
-1.0768282413482666,
-0.16239841282367706,
-0.7979409694671631,
1.3862838745117188,
-0.7808483839035034,
-0.12940722703933716,
-0.797853946685791,
0.2969741523265838... |
func LPop(conn redigo.Conn, key string, dest interface{}) (bool, error) {
return Result(conn.Do("LPOP", key)).StringToJSON(dest)
} | [
-1.535643219947815,
0.5033046007156372,
0.5949857234954834,
-1.0828279256820679,
-1.0062247514724731,
0.038358546793460846,
-2.2913687229156494,
-0.17401517927646637,
-0.148025780916214,
1.7186647653579712,
-0.47505983710289,
-1.4002525806427002,
-0.3492201864719391,
-0.7989633679389954,
... |
func RPop(conn redigo.Conn, key string, dest interface{}) (bool, error) {
return Result(conn.Do("RPOP", key)).StringToJSON(dest)
} | [
-2.106125593185425,
0.4674728214740753,
0.48458459973335266,
-0.0822068303823471,
-1.2403658628463745,
-0.21171411871910095,
-1.57088041305542,
-0.15381167829036713,
-0.9517590403556824,
2.1229360103607178,
-0.761767566204071,
-0.8773622512817383,
-0.3392576575279236,
-0.7050900459289551,
... |
func NewTestClient(fn roundTripFunc) *http.Client {
return &http.Client{
Transport: roundTripFunc(fn),
}
} | [
-0.18241114914417267,
-0.7949252724647522,
0.12101072072982788,
-0.6264942288398743,
-0.7347925305366516,
-0.23382699489593506,
0.6290485858917236,
-0.7921951413154602,
-0.5896642804145813,
-0.790219783782959,
0.6228464245796204,
0.17410650849342346,
-0.19422248005867004,
-1.25488924980163... |
func (s *Service) genUserDesc(c context.Context, base *api.UserBase) (userDesc []string, regionName string) {
var (
birthday string
sex string
)
if len(base.Birthday) != 8 {
birthday = "其他"
} else {
if base.Birthday > "20100000" {
birthday = "10后"
} else if base.Birthday > "20000000" {
birthday... | [
-0.9823166131973267,
0.039435699582099915,
0.9167249798774719,
0.6644443869590759,
-0.21776767075061798,
0.4293851852416992,
-0.18175868690013885,
0.4157372713088989,
-0.8755770325660706,
0.23666898906230927,
-0.465655654668808,
0.7241311073303223,
0.40231943130493164,
1.4598414897918701,
... |
func (i *Interface) Instance() interface{} {
return i.base.instance
} | [
-0.9795179963111877,
-0.20655189454555511,
0.2599681615829468,
-0.5722630620002747,
-1.0296486616134644,
1.3530819416046143,
1.1075208187103271,
-0.007493626791983843,
0.11667969077825546,
-0.526163637638092,
-0.39471814036369324,
-0.06273992359638214,
-1.0163209438323975,
-0.0279714614152... |
func (i *Interface) NewVIF(index uint32) (*VIF, error) {
vif, err := newVIF(i, fmt.Sprintf("%s-%d", i.name, index))
if err != nil {
return nil, err
}
if err := i.initVIF(vif); err != nil {
vif.Free()
return nil, err
}
return vif, nil
} | [
0.10597104579210281,
-0.5936504006385803,
0.1883791834115982,
0.1274542659521103,
-0.21704956889152527,
-0.3280140161514282,
0.3467286229133606,
-0.7318928241729736,
0.22358539700508118,
0.27436497807502747,
-1.4760245084762573,
-0.15962086617946625,
-0.6829366087913513,
-0.479754894971847... |
func (i *Interface) NewTunnel(index uint32, tunnel *Tunnel) (*VIF, error) {
if tunnel == nil {
return nil, errors.New("Tunnel details is not given")
}
vif, err := newVIF(i, fmt.Sprintf("%s-%d", i.name, index))
if err != nil {
return nil, err
}
vif.setTunnel(tunnel)
if err := i.initVIF(vif); err != nil {
... | [
0.01948692835867405,
0.05759160593152046,
0.2888467013835907,
-0.15010316669940948,
-0.02221653051674366,
-0.5695302486419678,
-0.17011559009552002,
-0.49951499700546265,
0.39687490463256836,
-0.13284564018249512,
-0.8813156485557556,
0.5849919319152832,
-0.6948460340499878,
-0.22598479688... |
func (i *Interface) SetInterfaceMode(mode VLANMode) error {
if mode == i.instance.InterfaceMode() {
return nil
}
i.freeAllVIF()
for vid := range i.vids {
if err := i.instance.DeleteVID(vid); err != nil {
return err
}
delete(i.vids, vid)
}
return i.instance.SetInterfaceMode(mode)
} | [
-0.13761864602565765,
-0.1019667387008667,
0.5631077885627747,
0.2954666316509247,
0.36199167370796204,
0.37064802646636963,
0.9536408185958862,
-0.22680899500846863,
0.0959014743566513,
0.6948156356811523,
-1.0457297563552856,
-0.31763955950737,
-1.2957231998443604,
0.8999283313751221,
... |
func (mv *Move) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
parsed, err := ParseMove(s)
if err != nil {
return err
}
*mv = *parsed
return nil
} | [
0.14187896251678467,
0.4479376971721649,
0.8678792119026184,
-0.15496324002742767,
-0.5754913687705994,
-1.2294219732284546,
0.36335787177085876,
0.36950692534446716,
0.4282383322715759,
0.8063722252845764,
0.1575937569141388,
0.2197825163602829,
0.1334904432296753,
-0.2922270894050598,
... |
func ParseMove(s string) (*Move, error) {
parts := strings.Split(s, ":")
if len(parts) != 2 {
return nil, fmt.Errorf("invalid package move %s", s)
}
var (
from = path.NewPath(parts[0])
to = path.NewPath(parts[1])
)
return &Move{
From: from,
To: to,
}, nil
} | [
-0.20536379516124725,
-0.815541684627533,
0.4759005308151245,
0.5654578804969788,
-0.6104779839515686,
-0.5001369714736938,
-0.3725094497203827,
-0.04225563257932663,
-0.223688542842865,
0.13429296016693115,
-0.636235773563385,
-0.13658809661865234,
-0.4547085464000702,
-1.2696599960327148... |
func (mv *Move) String() string {
return fmt.Sprintf("%30s -> %30s", mv.From, mv.To)
} | [
-0.938870370388031,
-1.198496699333191,
0.4938863217830658,
-0.8285866975784302,
-0.48473700881004333,
1.062276840209961,
-0.27426737546920776,
-1.0130516290664673,
-0.6019982695579529,
0.739118754863739,
-0.1897461712360382,
0.7560497522354126,
0.18029151856899261,
-0.611341118812561,
0... |
func (mv *Move) Rewrite(path path.Path) (path.Path, error) {
if !mv.From.Contains(path) {
return nil, fmt.Errorf("%s does not contain %s", mv.From, path)
}
return mv.To.Append(path[len(mv.From):]), nil
} | [
-0.439037561416626,
0.6147354245185852,
0.7449272274971008,
0.7775391936302185,
0.3792581558227539,
0.2684575319290161,
0.027558408677577972,
-0.20567993819713593,
0.05227013677358627,
0.7488365769386292,
0.545410692691803,
0.17041929066181183,
-0.11798496544361115,
-0.6282443404197693,
... |
func (mv *Move) ApplyPrefix(prefix path.Path) *Move {
return &Move{
From: prefix.Append(mv.From),
To: prefix.Append(mv.To),
}
} | [
-0.5727694034576416,
-0.34055954217910767,
0.6784093379974365,
-0.20495499670505524,
-0.513719916343689,
-0.6324054598808289,
-0.8986584544181824,
0.7424619197845459,
1.1720125675201416,
-0.6474096775054932,
-0.5442922711372375,
0.2999817132949829,
0.5308675765991211,
0.1701040267944336,
... |
func ParseMoves(mvList []string) (Moves, error) {
moves := make(Moves, 0, len(mvList))
for _, r := range mvList {
rule, err := ParseMove(r)
if err != nil {
return nil, err
}
moves = append(moves, rule)
}
sort.Sort(moves)
return moves, nil
} | [
-0.3531794846057892,
0.41705676913261414,
0.4271005094051361,
0.39067357778549194,
0.07084150612354279,
0.014451607130467892,
-0.14569774270057678,
-0.4576217532157898,
-0.08563577383756638,
0.7129157781600952,
-0.26888421177864075,
-0.2929461598396301,
-1.0026682615280151,
1.1988526582717... |
func (moves *Moves) UnmarshalYAML(unmarshal func(interface{}) error) error {
var mvList []string
if err := unmarshal(&mvList); err != nil {
return err
}
parsed, err := ParseMoves(mvList)
if err != nil {
return err
}
*moves = parsed
return nil
} | [
-0.006090183742344379,
1.057662010192871,
0.511135458946228,
-0.3903995156288147,
-0.21924933791160583,
-1.215490460395813,
0.43537071347236633,
0.6675679087638855,
0.4586709141731262,
0.619296669960022,
-0.3662417232990265,
0.3131295442581177,
0.3172543942928314,
0.1598169207572937,
-0.... |
func (moves Moves) Len() int { return len(moves) } | [
-0.2791248857975006,
0.5091040134429932,
-0.001782015897333622,
-0.2632439434528351,
0.3926458954811096,
-0.6414329409599304,
0.7258945107460022,
0.7467129826545715,
-0.011994053609669209,
-0.06693442910909653,
-1.4981375932693481,
0.40847277641296387,
0.5476108193397522,
-0.13994130492210... |
func (moves Moves) Swap(i, j int) { moves[i], moves[j] = moves[j], moves[i] } | [
-1.5510464906692505,
0.32063427567481995,
0.1594340056180954,
-0.19948704540729523,
0.2594994902610779,
0.36409786343574524,
-0.19144561886787415,
0.35960653424263,
-0.5766306519508362,
0.22445577383041382,
-0.6212356686592102,
1.1384409666061401,
0.18461334705352783,
-0.6592541337013245,
... |
func (moves Moves) Less(i, j int) bool {
if len(moves[i].From) < len(moves[j].From) {
return true
}
if len(moves[i].From) > len(moves[j].From) {
return false
}
return moves[i].String() < moves[j].String()
} | [
-0.1351080983877182,
-0.35107943415641785,
0.4679186940193176,
-1.3682136535644531,
-0.8593721389770508,
-0.2756640315055847,
-0.8041969537734985,
-1.1990127563476562,
-0.5675513744354248,
0.18707546591758728,
-0.8941628932952881,
0.3432907462120056,
-0.6156074404716492,
-0.072794198989868... |
func (moves Moves) BestMatch(p path.Path) *Move {
var matches Moves
for _, mv := range moves {
if mv.From.Contains(p) {
matches = append(matches, mv)
}
}
if len(matches) == 0 {
return nil
}
sort.Sort(matches)
return matches[len(matches)-1]
} | [
0.7004827857017517,
-0.08292339742183685,
0.8075180053710938,
0.8990162014961243,
-0.4497545659542084,
0.14113041758537292,
-0.6304917335510254,
0.0956529974937439,
-0.005705974530428648,
-0.3895077109336853,
0.0236404687166214,
0.1903611123561859,
-0.9209140539169312,
-0.7758721113204956,... |
func (moves Moves) ExactMatch(p path.Path) *Move {
for _, mv := range moves {
if mv.From.Equal(p) {
return mv
}
}
return nil
} | [
0.3293541967868805,
0.3945958614349365,
0.5615013241767883,
0.5796440839767456,
0.03731619566679001,
1.0655105113983154,
-0.03226814419031143,
-0.08250495046377182,
-0.3430948257446289,
0.37894871830940247,
-0.18479064106941223,
0.09327882528305054,
-1.0229467153549194,
-0.4133691191673279... |
func (moves Moves) ApplyPrefix(prefix path.Path) Moves {
newMoves := make(Moves, len(moves))
for i, mv := range moves {
newMoves[i] = mv.ApplyPrefix(prefix)
}
return newMoves
} | [
-1.0302072763442993,
0.10791776329278946,
0.4651969075202942,
0.21385027468204498,
0.046228475868701935,
-0.7039612531661987,
-0.2962929904460907,
0.41463831067085266,
1.1266855001449585,
-0.002219269284978509,
-0.7686532139778137,
0.45169275999069214,
0.23224160075187683,
0.97004729509353... |
func New() *Router {
r := &Router{}
r.index = make(map[string]string)
r.prefix = "/"
r.router = httprouter.New()
r.router.NotFound = r.notFoundHandler
return r
} | [
-0.8773100972175598,
-1.2273424863815308,
0.08643167465925217,
-0.31705182790756226,
-0.12432023882865906,
0.29377779364585876,
0.16254687309265137,
-0.1564836949110031,
-0.4318811297416687,
-0.7597419619560242,
-0.32615500688552856,
0.8573796153068542,
-0.03451380133628845,
0.790134906768... |
func (r *Router) Run(address string) error {
return http.ListenAndServe(address, r.chain())
} | [
-0.6291337013244629,
-0.4765664339065552,
0.4853586256504059,
-0.5209015607833862,
-0.12482265383005142,
0.31322839856147766,
-0.07542489469051361,
0.42094969749450684,
0.11723721027374268,
-0.408668577671051,
-0.7948522567749023,
1.153735637664795,
-0.5371451377868652,
0.5025326609611511,... |
func (r *Router) RunTLS(addr, certFile, keyFile string) error {
return http.ListenAndServeTLS(addr, certFile, keyFile, r.chain())
} | [
-0.13169217109680176,
-0.318217933177948,
0.285885751247406,
-0.6016237139701843,
-0.5638946890830994,
0.508496880531311,
-1.0215473175048828,
0.12060045450925827,
-0.5602405667304993,
-0.034639373421669006,
-0.18220382928848267,
0.6740732192993164,
0.2079383134841919,
0.13261030614376068,... |
func GetCronNextAt(cronTab string) string {
now := time.Now()
var schedule, err = cron.ParseStandard(cronTab)
if err != nil {
return now.Format(cronNextAtTimeFormat)
}
return schedule.Next(now).Format(cronNextAtTimeFormat)
} | [
0.4007999002933502,
-0.6316098570823669,
0.6081165671348572,
0.08848171681165695,
-0.9454851150512695,
-0.3477173447608948,
-0.9129249453544617,
-0.08464600145816803,
-0.8256383538246155,
0.22737419605255127,
-0.11143504828214645,
-0.010363321751356125,
-0.09495373070240021,
-0.06382010132... |
func (c *Client) CreateDBProxy(ctx context.Context, params *CreateDBProxyInput, optFns ...func(*Options)) (*CreateDBProxyOutput, error) {
if params == nil {
params = &CreateDBProxyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBProxy", params, optFns, c.addOperationCreateDBProxyMiddlewares)
if... | [
-0.5820356011390686,
1.2285741567611694,
0.7695245742797852,
0.5287811756134033,
0.43756258487701416,
-0.24691341817378998,
-0.04000489041209221,
-1.0301456451416016,
0.051854878664016724,
-0.3287239670753479,
-0.664080798625946,
1.1349650621414185,
-1.482861876487732,
-0.6415638327598572,... |
func TimelineIndex(res http.ResponseWriter, req *http.Request) {
timelineList := models.AllTimelines()
if err := json.NewEncoder(res).Encode(timelineList); err != nil {
http.Error(res, err.Error(), http.StatusInternalServerError)
return
}
} | [
-0.7685944437980652,
-0.7195672988891602,
0.5027680993080139,
-0.12965421378612518,
-0.7312077879905701,
0.18349051475524902,
-0.21620601415634155,
0.669631838798523,
0.07914595305919647,
0.8926100730895996,
-1.0497184991836548,
-0.34681621193885803,
0.20878684520721436,
-0.203003630042076... |
func NewUrl() *Url {
this := Url{}
return &this
} | [
0.5380996465682983,
-0.5102038383483887,
-0.14624537527561188,
1.2678728103637695,
-0.6764674186706543,
0.5213773846626282,
0.48458439111709595,
0.1217343732714653,
0.6366018056869507,
-1.4738935232162476,
-0.27713513374328613,
0.06109911948442459,
-0.517880916595459,
-0.5624932050704956,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.