text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func ToI(str string) int64 {
val, err := strconv.ParseInt(str, 10, 64)
L.IsError(err, str)
return val
} | [
-0.06429701298475266,
-0.21985672414302826,
0.5114507675170898,
0.0393146350979805,
-0.3943846523761749,
-0.5116874575614929,
-0.10244332998991013,
0.5994397401809692,
-0.965010941028595,
0.511649489402771,
-0.718029260635376,
-0.5326804518699646,
-0.3774784505367279,
-0.9241383671760559,
... |
func AsI(str string) (int64, bool) {
res, err := strconv.ParseInt(str, 10, 64)
return res, err == nil
} | [
-0.5994833707809448,
-0.3521297872066498,
0.524321436882019,
-0.09721744060516357,
-0.838729977607727,
-0.612820029258728,
-0.8853930830955505,
0.587199866771698,
-0.7057231664657593,
0.7478732466697693,
-1.0146316289901733,
-0.7184155583381653,
-0.3726656436920166,
-0.4382091760635376,
... |
func ToF(str string) float64 {
val, err := strconv.ParseFloat(str, 64)
L.IsError(err, str)
return val
} | [
1.026055097579956,
0.09790581464767456,
0.3651443123817444,
-0.3254907727241516,
-0.6433789730072021,
-0.614170491695404,
0.28476306796073914,
0.26384463906288147,
-0.5003272294998169,
-0.25688326358795166,
-0.14255470037460327,
-0.1947345733642578,
-0.36543387174606323,
0.0170847568660974... |
func AsF(str string) (float64, bool) {
res, err := strconv.ParseFloat(str, 64)
return res, err == nil
} | [
0.3625878691673279,
-0.3186163306236267,
0.3367060124874115,
-0.3607620894908905,
-0.8020800352096558,
-0.8576704859733582,
-0.5889660120010376,
0.3828493356704712,
-0.6497504711151123,
-0.060201436281204224,
-0.6209815740585327,
-0.43071410059928894,
-0.4194294810295105,
0.836603403091430... |
func PadLeft(s string, padStr string, lenStr int) string {
var padCount int
padCount = I.MaxOf(lenStr-len(s), 0)
return strings.Repeat(padStr, padCount) + s
} | [
1.1192561388015747,
-0.28591102361679077,
0.5467999577522278,
-0.5302514433860779,
-0.6706613898277283,
0.853334367275238,
-1.073547601699829,
-0.6172639727592468,
0.9674938917160034,
0.0744340568780899,
0.2593000531196594,
0.02125963754951954,
-0.5620019435882568,
-0.34155160188674927,
... |
func PadRight(s string, padStr string, lenStr int) string {
var padCount int
padCount = I.MaxOf(lenStr-len(s), 0)
return s + strings.Repeat(padStr, padCount)
} | [
0.4712884724140167,
0.2784082591533661,
0.7594082951545715,
-0.019407665356993675,
-1.0902117490768433,
0.42755889892578125,
-1.3665167093276978,
-0.46349668502807617,
0.24920052289962769,
-0.535895049571991,
0.47297006845474243,
0.2301567643880844,
-0.558009684085846,
-0.2507469356060028,... |
func HashPassword(pass string) string {
res1 := []byte(pass)
res2 := sha256.Sum256(res1)
res3 := res2[:]
return base64.StdEncoding.EncodeToString(res3)
} | [
0.6458224058151245,
-0.6778577566146851,
0.49526020884513855,
1.330117106437683,
0.5489585399627686,
0.05940232798457146,
-0.3643215596675873,
0.6721017360687256,
0.7785871028900146,
0.6531943082809448,
-0.7087671756744385,
0.08622077107429504,
-0.4100151062011719,
-0.4432221055030823,
-... |
func ValidateEmail(str string) string {
res := strings.Split(str, `@`)
if len(res) != 2 {
return ``
}
if (strings.Trim(res[0], `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%&'*+-/=?^_{|}~.`)) == `` {
if strings.Trim(res[1], `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.`)... | [
-0.17295517027378082,
-0.47061866521835327,
0.7618613243103027,
-0.20822376012802124,
-0.6785150766372681,
0.550354540348053,
0.15575753152370453,
-0.7107799053192139,
-0.047735750675201416,
0.07554688304662704,
0.18653857707977295,
0.7530139088630676,
-0.3987497389316559,
-0.5336481928825... |
func ValidatePhone(str string) string {
return re_non_phone.ReplaceAllString(str, ``)
} | [
-0.2924855053424835,
-0.015364623628556728,
0.4071548879146576,
0.9542153477668762,
-0.5692594647407532,
0.8440544009208679,
-0.6499603986740112,
-0.20404185354709625,
0.6420159935951233,
0.5461393594741821,
0.6227770447731018,
-0.4196380376815796,
-0.583331823348999,
0.3895101249217987,
... |
func PrettyPrint(s string, indentLevel int, color Color) {
var tabStr string
for i := 0; i < indentLevel; i++ {
tabStr += "\t"
}
str := fmt.Sprintf("%s%s\n\n", tabStr, regexp.MustCompile("\n").ReplaceAllString(s, "\n"+tabStr))
if color != NoColor {
if cfunc, ok := colorFunc[color]; !ok {
fmt.Print("COLOR NO... | [
0.7544751167297363,
-0.11676859110593796,
0.8507415056228638,
-0.19391289353370667,
-0.24352578818798065,
-0.34735432267189026,
-0.30702152848243713,
0.3825071156024933,
-1.0273139476776123,
0.05558962747454643,
0.3980672359466553,
0.5385931134223938,
-0.13024407625198364,
0.07943265885114... |
func PrintResult(result []ChaosResult) {
for _, chaos := range result {
PrettyPrint("[Chaos]: "+chaos.Name, 0, Blue)
for _, pod := range chaos.Pods {
PrettyPrint("[Pod]: "+pod.Name, 0, Blue)
for i, item := range pod.Items {
PrettyPrint(fmt.Sprintf("%d. [%s]", i+1, item.Name), 1, Cyan)
PrettyPrint(ite... | [
-0.5649012923240662,
-0.5842907428741455,
0.6327052116394043,
-0.14881832897663116,
0.627671480178833,
0.1826556921005249,
-0.20211239159107208,
-0.6635151505470276,
-0.3224310278892517,
-0.7944796085357666,
-0.10120606422424316,
0.03585138916969299,
0.02437303401529789,
0.3515928387641907... |
func MarshalChaos(s interface{}) (string, error) {
b, err := json.MarshalIndent(s, "", " ")
if err != nil {
return "", errors.Wrapf(err, "failed to marshal indent")
}
return string(b), nil
} | [
0.11879140883684158,
0.0393889956176281,
0.40005868673324585,
-0.5260809659957886,
-0.983158528804779,
0.06732484698295593,
-0.6048985719680786,
-0.29868972301483154,
0.5181000232696533,
0.4570201635360718,
-0.15152300894260406,
0.7649586200714111,
0.5375691652297974,
-0.14062273502349854,... |
func InitClientSet() (*ClientSet, error) {
restconfig, err := config.GetConfig()
if err != nil {
return nil, err
}
ctrlClient, err := client.New(restconfig, client.Options{Scheme: scheme})
if err != nil {
return nil, fmt.Errorf("failed to create client")
}
kubeClient, err := kubernetes.NewForConfig(restconfi... | [
0.5847529768943787,
-0.7622690796852112,
0.7225332856178284,
-0.6891063451766968,
-0.16972759366035461,
-0.5409475564956665,
-0.11345282942056656,
-1.0966510772705078,
-0.6154048442840576,
0.3625119626522064,
0.3707866668701172,
1.1217639446258545,
-0.3328697681427002,
0.2894665598869324,
... |
func GetPods(ctx context.Context, chaosName string, status v1alpha1.ChaosStatus, selectorSpec v1alpha1.PodSelectorSpec, c client.Client) ([]v1.Pod, []v1.Pod, error) {
// get podName
failedMessage := "" // TODO: fill in message
if failedMessage != "" {
PrettyPrint(fmt.Sprintf("chaos %s failed with: %s", chaosName, ... | [
-1.4083162546157837,
-0.594043493270874,
0.641400158405304,
-0.0034237545914947987,
1.5214864015579224,
-0.5710576176643372,
0.14025971293449402,
-0.1820637285709381,
0.46406814455986023,
-0.1235455870628357,
0.3558243215084076,
1.007913589477539,
-0.15870144963264465,
0.2310819923877716,
... |
func GetChaosList(ctx context.Context, chaosType string, chaosName string, ns string, c client.Client) ([]runtime.Object, []string, error) {
chaosType = upperCaseChaos(strings.ToLower(chaosType))
allKinds := v1alpha1.AllKinds()
chaosListInterface := allKinds[chaosType].ChaosList
if err := c.List(ctx, chaosListInte... | [
-0.5391865968704224,
-0.8558700680732727,
0.7236989736557007,
0.32570093870162964,
0.24436542391777039,
-0.31117701530456543,
-0.23719415068626404,
-0.43770986795425415,
0.24772733449935913,
0.18297302722930908,
-0.8128974437713623,
0.2768295109272003,
-0.11858139932155609,
1.4159519672393... |
func GetPidFromPS(ctx context.Context, pod v1.Pod, daemon v1.Pod, c *kubernetes.Clientset) ([]string, []string, error) {
cmd := "ps"
out, err := ExecBypass(ctx, pod, daemon, cmd, c)
if err != nil {
return nil, nil, errors.Wrapf(err, "run command %s failed", cmd)
}
outLines := strings.Split(string(out), "\n")
if... | [
-0.45520123839378357,
-1.3430837392807007,
0.677337646484375,
-0.30811992287635803,
-0.08218663930892944,
-0.3857545554637909,
-0.35487547516822815,
-0.15354153513908386,
0.0017191529041156173,
-0.2681538164615631,
0.5686064958572388,
0.04487800598144531,
-0.1587526947259903,
0.05030991137... |
func GetPidFromPod(ctx context.Context, pod v1.Pod, daemon v1.Pod) (uint32, error) {
pfCancel, localPort, err := forwardPorts(ctx, daemon, uint16(ctrlconfig.ControllerCfg.ChaosDaemonPort))
if err != nil {
return 0, errors.Wrapf(err, "forward ports for daemon pod %s/%s failed", daemon.Namespace, daemon.Name)
}
L()... | [
0.12644045054912567,
-0.7022607922554016,
0.9630785584449768,
-0.12914830446243286,
0.49129974842071533,
0.3676685094833374,
0.545660138130188,
-0.3388725817203522,
0.4725821614265442,
-0.23930391669273376,
0.10445806384086609,
0.577684760093689,
-0.8685587048530579,
-0.07852306962013245,
... |
func Log(pod v1.Pod, tail int64, c *kubernetes.Clientset) (string, error) {
podLogOpts := v1.PodLogOptions{}
//use negative tail to indicate no tail limit is needed
if tail >= 0 {
podLogOpts.TailLines = func(i int64) *int64 { return &i }(tail)
}
req := c.CoreV1().Pods(pod.Namespace).GetLogs(pod.Name, &podLogOpt... | [
-0.35551655292510986,
0.5015889406204224,
0.620840311050415,
-0.4601248800754547,
-1.2314115762710571,
0.2647251784801483,
0.1439848393201828,
-1.4128822088241577,
0.4019708037376404,
0.1625843644142151,
-0.02463199384510517,
0.9783313870429993,
-0.18651936948299408,
-0.6515465378761292,
... |
func ConnectToLocalChaosDaemon(port int) (daemonClient.ChaosDaemonClientInterface, error) {
if cli := mock.On("MockChaosDaemonClient"); cli != nil {
return cli.(daemonClient.ChaosDaemonClientInterface), nil
}
if err := mock.On("NewChaosDaemonClientError"); err != nil {
return nil, err.(error)
}
cc, err := getG... | [
-0.06993000954389572,
-0.8868116140365601,
0.3732297122478485,
-0.8375464677810669,
0.6577374339103699,
-0.3635658025741577,
0.5925506353378296,
-0.3337811529636383,
0.29024791717529297,
-0.1832168996334076,
-0.21720373630523682,
0.3097572922706604,
-0.3014337718486786,
0.3534250557422638,... |
func ExistsInDatastore(ctx appengine.Context, obj interface{}) bool {
kind, val := reflect.TypeOf(obj), reflect.ValueOf(obj)
str := val
if val.Kind().String() == "ptr" {
kind, str = kind.Elem(), val.Elem()
}
if str.Kind().String() != "struct" {
return false
}
dsKind := getDatastoreKind(kind)
if bsMethod := ... | [
-0.8772122859954834,
-0.058036454021930695,
0.7671633958816528,
-0.6007182598114014,
-0.3483695685863495,
0.22472958266735077,
-0.33667901158332825,
-0.05081171914935112,
0.1424112319946289,
0.23985591530799866,
-0.23190292716026306,
-0.5220011472702026,
-0.21911434829235077,
0.30784150958... |
func getDatastoreKind(kind reflect.Type) (dsKind string) {
dsKind = kind.String()
if li := strings.LastIndex(dsKind, "."); li >= 0 {
//Format kind to be in a standard format used for datastore
dsKind = dsKind[li+1:]
}
return
} | [
-0.6392369866371155,
0.32433030009269714,
0.26567918062210083,
-1.0432755947113037,
-1.049997329711914,
-0.12599250674247742,
0.20317122340202332,
0.02986222133040428,
0.5379959344863892,
0.22614726424217224,
0.3479560613632202,
1.221941590309143,
0.2529177665710449,
-0.07627275586128235,
... |
func Update(mainObj interface{}, newData interface{}) bool {
newDataVal, mainObjVal := reflect.ValueOf(newData).Elem(), reflect.ValueOf(mainObj).Elem()
fieldCount := newDataVal.NumField()
changed := false
for i := 0; i < fieldCount; i++ {
newField := newDataVal.Field(i)
// They passed in a value for this field,... | [
-0.8107848763465881,
0.06996821612119675,
0.7173840999603271,
0.1353577822446823,
-1.1749516725540161,
1.082216501235962,
-0.2287917286157608,
0.18085181713104248,
-0.3708791732788086,
-0.2713359296321869,
-0.6096135377883911,
-0.40499773621559143,
-1.1885343790054321,
0.5290300846099854,
... |
func IsEmpty(val reflect.Value) bool {
typeStr := val.Kind().String()
switch typeStr {
case "int", "int8", "int16", "int32", "int64":
return val.Int() == 0
case "float", "float8", "float16", "float32", "float64":
return val.Float() == 0
case "string":
return val.String() == ""
case "slice", "ptr", "map", "c... | [
-0.9350466728210449,
0.2790413200855255,
0.6978631019592285,
-0.2710849344730377,
0.10408994555473328,
0.3375190496444702,
0.30152201652526855,
-0.30201292037963867,
-0.06386053562164307,
-0.013387815095484257,
-0.2412647157907486,
0.09402351081371307,
-0.6798664927482605,
0.59198963642120... |
func (c *HTTPClient) do(req *http.Request) ([]byte, error) {
// We always need to include the API version in the headers
req.Header.Set(HeaderApiVersion, ApiVersion)
resp, err := c.client.Do(req)
if err != nil {
return nil, fmt.Errorf("error making http request: %w", err)
}
defer resp.Body.Close()
if resp.St... | [
-0.44834470748901367,
-0.2936115562915802,
1.1111559867858887,
-0.4303515553474426,
0.17472738027572632,
0.05940381810069084,
-1.013536810874939,
-0.8304959535598755,
-0.13406629860401154,
0.47445428371429443,
-0.4894043207168579,
0.388454794883728,
-0.525360643863678,
0.3227366805076599,
... |
func Fit(m *mat.Dense, yCol int, params map[string]int) algo.Model {
return fit(m, yCol, params["n_estimator"], params["maxDepth"], params["minSize"])
} | [
0.49750277400016785,
0.24242755770683289,
0.2327478677034378,
1.0787917375564575,
-0.09710081666707993,
0.06611857563257217,
0.11472315341234207,
-0.26610442996025085,
-0.9166423678398132,
0.07460610568523407,
0.06389310210943222,
0.24810288846492767,
0.4619513750076294,
0.7734624743461609... |
func (rf *RandomForest) Predict(m *mat.Dense) (predictions []float64) {
dR, _ := m.Dims()
predictions = make([]float64, dR)
for i := 0; i < dR; i++ {
predictions[i] = rf.PredictRow(m.RowView(i))
}
return predictions
} | [
-0.743947446346283,
0.29721078276634216,
0.4865894317626953,
1.0825790166854858,
-0.45146527886390686,
-0.5477624535560608,
0.08939097821712494,
0.3125569224357605,
-0.5742175579071045,
-0.01546127162873745,
0.4585961699485779,
-0.5884236693382263,
0.09171828627586365,
1.2122184038162231,
... |
func (rf *RandomForest) PredictRow(row mat.Vector) float64 {
var predictions mathelper.Row = make([]float64, len(rf.estimators))
for i, estimator := range rf.estimators {
features := rf.feMapping[estimator]
projectedRow := make([]float64, len(features))
for i, f := range features {
projectedRow[i] = row.AtVe... | [
-1.2878334522247314,
0.7439078092575073,
0.29602813720703125,
0.5360705256462097,
0.09077440947294235,
-0.47665080428123474,
0.18791545927524567,
0.40381231904029846,
0.10797268152236938,
-0.15950089693069458,
0.7231559753417969,
-0.6735360622406006,
0.966663658618927,
1.0484269857406616,
... |
func (rf *RandomForest) IsFitted() bool {
if len(rf.estimators) >= 0 && rf.Score >= 0 {
return true
}
return false
} | [
-0.6480252742767334,
-0.8031333684921265,
0.3999764919281006,
0.573927640914917,
1.1045409440994263,
0.3632243871688843,
-0.10589201003313065,
0.5471760034561157,
0.30763283371925354,
-0.6855020523071289,
-0.5909040570259094,
0.1831921488046646,
-0.7941199541091919,
0.9322912096977234,
-... |
func doScan(a []interface{}) (numProcessed int, err error) {
defer errorHandler(&err)
return
} | [
-0.8277904391288757,
0.4944365322589874,
0.4658770263195038,
1.2987565994262695,
-0.4076477587223053,
-0.21003344655036926,
1.097835898399353,
-0.19727160036563873,
0.4581911861896515,
-0.6150519251823425,
-0.09937036037445068,
0.3895544111728668,
-0.09084621071815491,
0.9763913750648499,
... |
func ProtoBaseNegotiation() Negotiation {
return &BaseNegotiation{}
} | [
-1.1404716968536377,
0.26270776987075806,
0.3752950429916382,
0.6520248651504517,
-0.05723285675048828,
-0.3459969460964203,
-0.7451716661453247,
0.14536753296852112,
-0.8349627256393433,
-0.03206448256969452,
-0.969876229763031,
-1.1143958568572998,
-1.1904692649841309,
0.1139500960707664... |
func (baseNegotiation BaseNegotiation) GetBuyerBlockHeight() int64 {
return baseNegotiation.BuyerBlockHeight
} | [
-0.06833387166261673,
-0.04122132435441017,
0.6183717250823975,
1.3344143629074097,
0.10769408941268921,
-0.47849440574645996,
-0.03852802515029907,
0.17546412348747253,
-1.2360694408416748,
-0.03354652225971222,
-1.2718071937561035,
0.32140830159187317,
-0.8743451237678528,
0.030061136931... |
func (baseNegotiation *BaseNegotiation) SetBuyerBlockHeight(height int64) error {
baseNegotiation.BuyerBlockHeight = height
return nil
} | [
-0.23893503844738007,
-0.37227845191955566,
0.5026049613952637,
1.083704948425293,
0.0773342177271843,
-0.5611344575881958,
0.08900158852338791,
0.16013239324092865,
-1.3883211612701416,
-0.0895836353302002,
-1.6533769369125366,
0.29745978116989136,
-0.8014915585517883,
0.2522343695163727,... |
func (baseNegotiation BaseNegotiation) GetSellerBlockHeight() int64 {
return baseNegotiation.SellerBlockHeight
} | [
-0.19492506980895996,
0.3027503490447998,
0.31639939546585083,
1.1536577939987183,
-0.183756485581398,
-0.7221421599388123,
0.23077747225761414,
-0.17017905414104462,
-0.3260992467403412,
0.25304222106933594,
-0.8243614435195923,
-0.10290740430355072,
-0.7317345142364502,
0.228308990597724... |
func (baseNegotiation *BaseNegotiation) SetSellerBlockHeight(height int64) error {
baseNegotiation.SellerBlockHeight = height
return nil
} | [
-0.4328191876411438,
-0.1156107634305954,
0.3062027394771576,
0.9877392053604126,
-0.3773822784423828,
-0.5884885787963867,
0.4284607768058777,
-0.03949498385190964,
-0.41243454813957214,
0.1881941258907318,
-1.199530005455017,
-0.18948018550872803,
-0.7249586582183838,
0.37524235248565674... |
func (baseNegotiation BaseNegotiation) GetBuyerContractHash() string {
return baseNegotiation.BuyerContractHash
} | [
0.5069862604141235,
-0.48987627029418945,
0.5561801791191101,
0.7524330019950867,
-0.1797494739294052,
0.29727327823638916,
-0.25736501812934875,
0.49528080224990845,
-0.6306387782096863,
-0.22685222327709198,
-0.8187500834465027,
0.40884819626808167,
-0.8439481854438782,
-0.69545412063598... |
func (baseNegotiation *BaseNegotiation) SetBuyerContractHash(buyerContractHash string) error {
baseNegotiation.BuyerContractHash = buyerContractHash
return nil
} | [
0.4996211528778076,
-0.4113837778568268,
0.40154457092285156,
0.5087060332298279,
-0.07172787189483643,
0.3132742643356323,
-0.12311235815286636,
0.5355553030967712,
-0.6404501795768738,
-0.2785131633281708,
-1.3891446590423584,
0.2946849763393402,
-0.47003522515296936,
-0.3447447121143341... |
func (baseNegotiation BaseNegotiation) GetSellerContractHash() string {
return baseNegotiation.SellerContractHash
} | [
0.29998844861984253,
-0.23996886610984802,
0.30395516753196716,
0.6029989123344421,
-0.5404185056686401,
-0.0326569527387619,
0.03857899457216263,
0.2616141438484192,
-0.2419012039899826,
-0.2038818895816803,
-0.5421091318130493,
-0.16784457862377167,
-0.4506283402442932,
-0.47277310490608... |
func (baseNegotiation *BaseNegotiation) SetSellerContractHash(sellerContractHash string) error {
baseNegotiation.SellerContractHash = sellerContractHash
return nil
} | [
0.45188403129577637,
-0.20935121178627014,
0.3241325318813324,
0.4035896956920624,
-0.4291473627090454,
0.22872699797153473,
0.13953657448291779,
0.3677685856819153,
-0.24433423578739166,
-0.23007328808307648,
-1.195036768913269,
-0.27333471179008484,
-0.300498366355896,
-0.271572500467300... |
func GenerateNegotiationIDBytes(buyerAddress AccAddress, sellerAddress AccAddress, pegHash PegHash) []byte {
return append(append(buyerAddress.Bytes(), sellerAddress.Bytes()...), pegHash.Bytes()...)
} | [
-0.2570861279964447,
0.757293164730072,
0.5185672044754028,
-0.3529093861579895,
0.20137766003608704,
0.30760735273361206,
-1.1739754676818848,
0.21253757178783417,
0.2718656063079834,
0.992658257484436,
-0.9260575175285339,
0.20101575553417206,
-0.8531249165534973,
0.010233290493488312,
... |
func GetNegotiationIDHex(negotiationIDStr string) (negotiationID NegotiationID, err error) {
bz, err := hex.DecodeString(negotiationIDStr)
if err != nil {
return nil, err
}
return NegotiationID(bz), nil
} | [
-0.27921736240386963,
-0.45180362462997437,
0.23165641725063324,
0.29960897564888,
-0.25630003213882446,
0.17157836258411407,
-0.92359459400177,
0.9477416276931763,
0.008579298853874207,
0.8333985209465027,
-0.07387522608041763,
-0.3350772261619568,
-0.3864342272281647,
-0.4124725759029388... |
func GetNegotiationIDFromHex(negotiationIDStr []byte) NegotiationID {
bz := hex.EncodeToString(negotiationIDStr)
return NegotiationID([]byte(bz))
} | [
-0.01530424878001213,
-0.5530306100845337,
0.07708479464054108,
0.11547599732875824,
-0.42479628324508667,
0.5241817235946655,
-1.5348795652389526,
0.8330911993980408,
0.6100818514823914,
0.9117990136146545,
-0.2503516972064972,
-0.608252763748169,
-0.381605327129364,
-0.07457659393548965,... |
func NewAzureBlobDownloader(l logger.Logger, c AzureBlobDownloaderConfig) *AzureBlobDownloader {
return &AzureBlobDownloader{
logger: l,
conf: c,
}
} | [
0.333151251077652,
-0.9310880899429321,
0.19763672351837158,
0.6232340335845947,
-0.42739519476890564,
0.5936197638511658,
-0.3851691484451294,
0.5024756789207458,
-0.8487460613250732,
0.016922345384955406,
-0.28491857647895813,
-0.009529991075396538,
-0.3517720699310303,
0.761052250862121... |
func (d *AzureBlobDownloader) Start(ctx context.Context) error {
loc, err := ParseAzureBlobLocation(d.conf.Repository)
if err != nil {
return err
}
d.logger.Debug("Azure Blob Storage path: %v", loc)
client, err := NewAzureBlobClient(d.logger, loc.StorageAccountName)
if err != nil {
return err
}
f, err :=... | [
0.8272862434387207,
-1.030514121055603,
0.5647865533828735,
0.02739746682345867,
0.47362175583839417,
-0.08685115724802017,
0.41537395119667053,
0.5218309164047241,
-0.8384127020835876,
0.3506752848625183,
-0.28870195150375366,
0.7342654466629028,
-0.04031522199511528,
-0.21020939946174622... |
func (p *PreInplaceControl) CheckInplace(obj PreInplaceHookObjectInterface, pod *v1.Pod, podTemplate *v1.PodTemplateSpec,
newStatus PreInplaceHookStatusInterface, podNameLabelKey string) (bool, error) {
if pod.Status.Phase != v1.PodRunning {
return true, nil
}
metaObj, ok := obj.(metav1.Object)
if !ok {
return... | [
-0.8864597082138062,
-0.6414891481399536,
0.9811590909957886,
0.2077883630990982,
0.36633795499801636,
0.5774199366569519,
0.6386295557022095,
0.05467018857598305,
-0.3634580969810486,
0.5118076205253601,
-0.2903922498226166,
-0.02548927068710327,
-1.2589675188064575,
0.8057278990745544,
... |
func (p *PreInplaceControl) createHookRun(metaObj metav1.Object, runtimeObj runtime.Object,
preInplaceHook *hookv1alpha1.HookStep, pod *v1.Pod, podTemplate *v1.PodTemplateSpec, labels map[string]string,
podNameLabelKey string) (*hookv1alpha1.HookRun, error) {
arguments := []hookv1alpha1.Argument{}
for _, arg := ran... | [
-0.5133275985717773,
-0.6984790563583374,
0.8867582678794861,
-0.29918912053108215,
0.5811002254486084,
0.17042984068393707,
0.29643818736076355,
-0.22592757642269135,
-1.0994659662246704,
0.30200710892677307,
-0.36621567606925964,
-0.23975659906864166,
-0.4686431586742401,
1.2803438901901... |
func (p *PreInplaceControl) newHookRunFromHookTemplate(metaObj metav1.Object,
runtimeObj runtime.Object, args []hookv1alpha1.Argument,
pod *v1.Pod, preInplaceHook *hookv1alpha1.HookStep, labels map[string]string,
podNameLabelKey string) (*hookv1alpha1.HookRun, error) {
template, err := p.hookTemplateLister.HookTemp... | [
-0.14420638978481293,
-0.4370078444480896,
0.5307468771934509,
-0.031908344477415085,
0.05840132385492325,
-0.019233601167798042,
0.724614143371582,
-0.2683754563331604,
-0.4255480170249939,
0.2556746006011963,
-0.4730577766895294,
-0.4679367244243622,
-0.3727385997772217,
0.59161901473999... |
func deletePreInplaceHookCondition(status PreInplaceHookStatusInterface, podName string) error {
var index int
found := false
conditions := status.GetPreInplaceHookConditions()
for i, cond := range conditions {
if cond.PodName == podName {
found = true
index = i
break
}
}
if !found {
return fmt.Err... | [
-0.304013192653656,
-0.41042637825012207,
0.5295265913009644,
-0.0902571827173233,
-0.07449038326740265,
0.41231903433799744,
1.26589035987854,
0.6811515688896179,
-0.21878500282764435,
0.22590917348861694,
-0.16777323186397552,
0.0949169471859932,
-0.9778355360031128,
0.8665505051612854,
... |
func resetPreInplaceHookConditionPhase(status PreInplaceHookStatusInterface, podName string,
phase hookv1alpha1.HookPhase) error {
var index int
found := false
conditions := status.GetPreInplaceHookConditions()
for i, cond := range conditions {
if cond.PodName == podName {
found = true
index = i
break
... | [
-0.5178296566009521,
-0.38897567987442017,
0.46085765957832336,
0.16620701551437378,
0.6135209202766418,
0.16725888848304749,
0.7929141521453857,
0.943682074546814,
-0.993889570236206,
0.8496416807174683,
0.052852481603622437,
0.08853026479482651,
-1.6675859689712524,
0.13493216037750244,
... |
func (p *PreInplaceControl) injectPodDeletingAnnotation(pod *v1.Pod) error {
currentAnnotations := pod.ObjectMeta.DeepCopy().Annotations
if currentAnnotations == nil {
currentAnnotations = map[string]string{}
}
currentAnnotations[DeletingAnnotation] = "true"
if reflect.DeepEqual(currentAnnotations, pod.Annotatio... | [
-0.640061616897583,
-0.3068612515926361,
0.806401789188385,
-0.48664623498916626,
0.3444223701953888,
0.3466130793094635,
0.24247919023036957,
0.155772864818573,
0.9992949962615967,
0.44192230701446533,
0.036962974816560745,
0.5695720314979553,
-0.3150891363620758,
-0.4107602834701538,
0... |
func findModifiedContainers(podTemplate *v1.PodTemplateSpec, pod *v1.Pod) ([]hookv1alpha1.Argument, error) {
oldImages := make(map[string]string)
for _, container := range pod.Spec.Containers {
oldImages[container.Name] = container.Image
}
arguments := make([]hookv1alpha1.Argument, 0)
for _, container := range ... | [
-1.3039520978927612,
-1.3632986545562744,
0.6086205244064331,
-0.7035576701164246,
0.6079431176185608,
-0.7571303248405457,
0.1157214418053627,
-0.7155086398124695,
-0.5432776212692261,
0.896536111831665,
-0.020353561267256737,
0.18990004062652588,
-0.08238434046506882,
2.246849775314331,
... |
func AddNewStructViewInline(parent ki.Ki, name string) *StructViewInline {
return parent.AddNewChild(TypeStructViewInline, name).(*StructViewInline)
} | [
-0.20970040559768677,
-0.15211522579193115,
0.6752018332481384,
0.3352154791355133,
-1.1185566186904907,
0.5257825255393982,
-0.06205485016107559,
-0.34066420793533325,
0.05515441298484802,
-1.315494179725647,
-1.1330585479736328,
-0.1674477458000183,
-0.21729420125484467,
0.06050511822104... |
func (sv *StructViewInline) SetStruct(st any) {
updt := false
if sv.Struct != st {
updt = sv.UpdateStart()
sv.Struct = st
if k, ok := st.(ki.Ki); ok {
k.NodeSignal().Connect(sv.This(), func(recv, send ki.Ki, sig int64, data any) {
svv, _ := recv.Embed(TypeStructViewInline).(*StructViewInline)
svv.Upd... | [
-0.7312638163566589,
-0.1105765551328659,
0.42356976866722107,
0.2584426999092102,
-1.0236436128616333,
-0.26786288619041443,
0.2555946409702301,
0.23704326152801514,
0.24592529237270355,
-0.6500203609466553,
-0.2920856475830078,
0.4347098767757416,
-0.22962403297424316,
0.3915347158908844... |
func (sv *StructViewInline) ConfigParts() {
if kit.IfaceIsNil(sv.Struct) {
return
}
sv.Parts.Lay = gi.LayoutHoriz
config := kit.TypeAndNameList{}
// always start fresh!
sv.FieldViews = make([]ValueView, 0)
kit.FlatFieldsValueFunc(sv.Struct, func(fval any, typ reflect.Type, field reflect.StructField, fieldVal r... | [
-0.4700327217578888,
-0.03876788541674614,
0.7145249843597412,
-0.9790761470794678,
-0.21293383836746216,
0.1813194453716278,
0.17921176552772522,
-0.12226321548223495,
0.34941068291664124,
0.09942954778671265,
-0.3507692515850067,
-0.7341192960739136,
-0.1634242832660675,
1.08733725547790... |
func GetSourceOracleDataDirectory(oracleVersion string) string {
if oracleVersion == consts.Oracle18c {
return consts.SourceOracleXeDataDirectory
}
return consts.SourceOracleDataDirectory
} | [
-0.19958403706550598,
0.5518087148666382,
0.32933279871940613,
-1.5299246311187744,
0.29191577434539795,
0.40355461835861206,
0.48302003741264343,
0.19419582188129425,
0.904723584651947,
0.32825079560279846,
-0.7028840184211731,
1.306610345840454,
1.3671971559524536,
-0.5479247570037842,
... |
func GetSourceOracleBase(oracleVersion string) string {
if oracleVersion == consts.Oracle18c {
return consts.SourceOracleXeBase
}
return consts.SourceOracleBase
} | [
0.13827717304229736,
0.23324598371982574,
0.3267858326435089,
-0.5381639003753662,
0.5341646671295166,
0.2430080771446228,
0.6677441596984863,
-0.3270684480667114,
0.7685366272926331,
1.539459228515625,
-0.9741349220275879,
-0.23033703863620758,
0.2381030023097992,
-0.8604660630226135,
0... |
func GetSourceOracleHome(oracleVersion string) string {
if oracleVersion == consts.Oracle18c {
return fmt.Sprintf(consts.SourceOracleXeHome, oracleVersion)
}
return fmt.Sprintf(consts.SourceOracleHome, oracleVersion)
} | [
0.4166789948940277,
0.35172826051712036,
0.32987159490585327,
-0.6629621982574463,
0.3755507171154022,
0.15048770606517792,
0.7180913686752319,
-0.09819379448890686,
1.1115520000457764,
1.7380203008651733,
-0.26830747723579407,
0.6037043333053589,
0.3338552713394165,
-0.9700720310211182,
... |
func GetSourceOracleInventory(oracleVersion string) string {
if oracleVersion == consts.Oracle18c {
return consts.SourceOracleXeInventory
}
return consts.SourceOracleInventory
} | [
-0.21940715610980988,
0.15500786900520325,
0.2784518897533417,
-0.6130692362785339,
-0.03536663204431534,
0.4609466791152954,
0.9571793079376221,
0.1315288096666336,
0.9229035973548889,
0.893293559551239,
-0.5586418509483337,
0.09271656721830368,
0.8285817503929138,
-1.3678092956542969,
... |
func PilotConfigToResource(c *Config) (*mcp.Resource, error) {
r := &mcp.Resource{}
// MCP, K8S and Istio configs use gogo configs
// On the wire it's the same as golang proto.
a, err := ToProto(c.Spec)
if err != nil {
return nil, err
}
r.Body = a
r.Metadata = &mcp.Metadata{
Name: c.Namespace + "/" ... | [
-0.3150794506072998,
0.17010055482387543,
0.3501006066799164,
-1.2133070230484009,
-0.3519599437713623,
0.2948683202266693,
-0.11317424476146698,
-0.118903748691082,
-0.004837454296648502,
1.0703680515289307,
-0.06475379317998886,
0.17160169780254364,
-0.773703396320343,
-0.181765183806419... |
func (e *executor) validateOSType() error {
executorOSType := e.ExecutorOptions.Metadata[metadataOSType]
if executorOSType == "" {
return common.MakeBuildError("%s does not have any OSType specified", e.Config.Executor)
}
if executorOSType != e.info.OSType {
return common.MakeBuildError(
"executor requires ... | [
0.017971020191907883,
0.7230169177055359,
0.4163057804107666,
0.47916898131370544,
0.7167357802391052,
-0.24340297281742096,
0.41870561242103577,
-0.22812046110630035,
-0.3540513515472412,
0.26438358426094055,
0.6940228939056396,
-0.169377863407135,
0.20992788672447205,
1.7233299016952515,... |
func (e *executor) addServiceHealthCheckEnvironment(service *types.Container) ([]string, error) {
environment := []string{}
if e.networkMode.UserDefined() != "" {
environment = append(environment, "WAIT_FOR_SERVICE_TCP_ADDR="+service.ID[:12])
ports, err := e.getContainerExposedPorts(service)
if err != nil {
... | [
-0.34138670563697815,
0.07111982256174088,
0.7764423489570618,
0.014458986930549145,
0.8901540040969849,
1.1228479146957397,
0.436951607465744,
-0.4708903133869171,
0.2686770558357239,
0.396072119474411,
0.35138383507728577,
0.08916804194450378,
-0.12802854180335999,
1.1593416929244995,
... |
func getAPISet(baseURL string, authToken string, httpClient ...*http.Client) (*apiutils.APISet, error) {
// if a HTTP client was explicitly given,
// we just create and return a new APISet with that client
if len(httpClient) > 0 {
if authToken == "" {
return apiutils.New(baseURL, apiutils.WithHTTPClient(httpCli... | [
-0.10826262086629868,
-0.02878805808722973,
0.5553016662597656,
-0.5172668099403381,
-0.002024419140070677,
-0.2970222532749176,
-0.6344234347343445,
-0.6790538430213928,
0.2372402548789978,
-0.824097752571106,
0.38520631194114685,
0.9764871001243591,
-0.7234199047088623,
-0.50891280174255... |
func NewBgWorker(conf map[string]interface{}) (bgworker.BgWorker, error) {
data, _ := json.Marshal(conf)
config := FetcherConfig{}
json.Unmarshal(data, &config)
return &PolygonFetcher{
backfillM: &sync.Map{},
config: config,
}, nil
} | [
0.43801364302635193,
-0.1314830332994461,
0.5670391917228699,
-0.1227327510714531,
-0.6132067441940308,
0.38080090284347534,
-0.48705780506134033,
-0.5381779670715332,
-0.6145917177200317,
0.7922450304031372,
-1.4419922828674316,
0.2578177750110626,
-0.3901631534099579,
0.3519963324069977,... |
func (pf *PolygonFetcher) Run() {
api.SetAPIKey(pf.config.APIKey)
if pf.config.BaseURL != "" {
api.SetBaseURL(pf.config.BaseURL)
}
if pf.config.NatsServers != "" {
api.SetNatsServers(pf.config.NatsServers)
}
go pf.workBackfill()
if err := api.Stream(pf.streamHandler, pf.config.Symbols); err != nil {
gl... | [
-0.9920040369033813,
-0.19858083128929138,
0.34380435943603516,
-0.5990273952484131,
0.06277763098478317,
0.5180158019065857,
0.1240522712469101,
-1.0119765996932983,
-0.4165847897529602,
0.27702730894088745,
-1.2082908153533936,
0.7261157631874084,
-0.3373408615589142,
0.4654066264629364,... |
func Load(r *http.Request, dst interface{}) error {
if err := r.ParseForm(); err != nil {
return errors.Trace(err)
}
if err := decoder.Decode(dst, r.Form); err != nil {
multi, ok := errors.Cause(err).(schema.MultiError)
if ok {
for _, single := range multi {
empty, ok := errors.Cause(single).(schema.Em... | [
-1.154927134513855,
0.6385752558708191,
0.9811117649078369,
-0.712523877620697,
-0.5934308767318726,
0.16017594933509827,
-0.6916082501411438,
0.22101213037967682,
-0.8559427261352539,
0.17315490543842316,
-0.3567451536655426,
-0.08313853293657303,
0.03274814411997795,
0.0331047959625721,
... |
func FormatDocuments(w io.Writer, docs []Document, templateFormat string, shortSha bool, db *ParaphraseDb) {
if templateFormat == "" {
WriteDocuments(w, docs, shortSha)
return
}
for _, doc := range docs {
err := RenderDocument(templateFormat, &doc, db, nil)
if err != nil {
log.Println(err)
break
}
... | [
-0.7012097239494324,
-0.20131231844425201,
0.20555460453033447,
-0.15805377066135406,
-0.49868741631507874,
-0.3934028446674347,
0.4793168604373932,
0.1026250571012497,
0.7444742918014526,
0.12561102211475372,
0.8358768224716187,
-0.2160085141658783,
-0.9406231045722961,
1.4072318077087402... |
func prefixLines(prefix, lines string) string {
return prefix + strings.Replace(lines, "\n", "\n"+prefix, -1)
} | [
0.7986029982566833,
-0.8221946358680725,
0.2854236364364624,
-0.34164780378341675,
-0.4719220995903015,
-0.3522180914878845,
-1.7877626419067383,
0.6818122267723083,
0.9375582933425903,
0.631820023059845,
1.4612579345703125,
0.4583723843097687,
0.7077150344848633,
0.1575055867433548,
0.0... |
func headFunc(lineCount int, text string) string {
if lineCount <= 0 {
return ""
}
lines := strings.Split(text, "\n")
return strings.Join(lines[:min(lineCount, len(lines))], "\n")
} | [
1.4894747734069824,
-0.7056439518928528,
0.507268488407135,
-0.007972734980285168,
-0.6666500568389893,
-0.04004552960395813,
-0.5665395855903625,
0.14207273721694946,
0.03507474437355995,
0.16479961574077606,
0.6201902627944946,
0.8929625749588013,
0.3688855767250061,
-0.41145265102386475... |
func firstFunc(n int, text string) string {
if n <= 0 {
return ""
}
return text[:min(n, len(text))]
} | [
1.5846236944198608,
0.05243394896388054,
0.15049917995929718,
-0.3362480103969574,
-0.34014925360679626,
-0.9468100070953369,
-0.1678175926208496,
-0.1662442833185196,
0.19286490976810455,
-0.6302587389945984,
0.46063077449798584,
0.16357116401195526,
0.3941825032234192,
0.1024857088923454... |
func repeatText(n int, text string) string {
out := ""
for ; n > 0; n-- {
out += text
}
return out
} | [
0.013817045837640762,
0.7498186230659485,
0.1936810463666916,
-0.0568823367357254,
-0.8314189314842224,
0.33105894923210144,
-0.9620801210403442,
-0.455846905708313,
-0.07328026741743088,
0.3128420412540436,
-0.6526663899421692,
0.21433377265930176,
-0.4581376314163208,
-0.4593875706195831... |
func NewButton(input ButtonInput) Button {
return Button{
displayText: input.DisplayText,
textColour: input.TextColour,
backgroundColour: input.BackgroundColour,
}
} | [
1.0576941967010498,
-0.9833500385284424,
0.11469252407550812,
-0.4600842595100403,
-0.7913514971733093,
0.8139445185661316,
-0.557174801826477,
-0.027185238897800446,
0.47935670614242554,
-0.26652613282203674,
0.000010557796485954896,
0.6472715139389038,
-0.28402116894721985,
0.26014587283... |
func IsValidRefPattern(name string) bool {
return !refNamePatternInvalid.MatchString(name)
} | [
-0.8299275636672974,
-0.2774955630302429,
0.5830551385879517,
-0.32238563895225525,
-1.2948967218399048,
0.7327761650085449,
-0.4178953468799591,
-0.7699984908103943,
0.7272423505783081,
0.12617889046669006,
-0.46710342168807983,
-0.31600821018218994,
-0.8206857442855835,
0.251610279083251... |
func (ref *Reference) Commit() (*Commit, error) {
return ref.repo.getCommit(ref.Object)
} | [
0.38910481333732605,
-1.157052755355835,
0.6296638250350952,
0.49526381492614746,
-0.08329495042562485,
-0.025746455416083336,
0.23947198688983917,
-0.9481246471405029,
0.15455609560012817,
1.1003947257995605,
0.4883311092853546,
0.7224968671798706,
-0.327944815158844,
-0.07795831561088562... |
func (ref *Reference) ShortName() string {
return RefName(ref.Name).ShortName()
} | [
1.1529902219772339,
-1.1580437421798706,
0.24055689573287964,
-0.432099312543869,
-0.16471347212791443,
-0.06716804951429367,
-0.049106575548648834,
-0.5774540305137634,
0.7164808511734009,
0.6500060558319092,
1.1342953443527222,
0.4772145450115204,
-0.007107721641659737,
0.424102991819381... |
func (ref *Reference) RefGroup() string {
return RefName(ref.Name).RefGroup()
} | [
-0.17780114710330963,
0.556646466255188,
0.04786459729075432,
-0.5730893611907959,
-0.28810685873031616,
0.413787841796875,
0.01109238713979721,
-1.502385139465332,
0.008115004748106003,
-0.0588546060025692,
0.937005341053009,
0.5693404674530029,
0.04372568428516388,
1.3422831296920776,
... |
func (ref RefName) TagName() string {
return ref.nameWithoutPrefix(TagPrefix)
} | [
0.6834164261817932,
-0.20430202782154083,
0.22692252695560455,
-0.5830221772193909,
0.0558898039162159,
-0.2234252691268921,
-0.27042725682258606,
-0.31159940361976624,
-0.2541358768939972,
0.35497742891311646,
0.4549761116504669,
0.022735608741641045,
0.16849395632743835,
0.81703990697860... |
func (ref RefName) BranchName() string {
return ref.nameWithoutPrefix(BranchPrefix)
} | [
0.327931672334671,
-0.44240114092826843,
0.3003782629966736,
-0.04023261368274689,
-0.7242534756660461,
0.5831685066223145,
-0.19392400979995728,
-0.13686515390872955,
-0.20269875228405,
0.3051820993423462,
0.6825840473175049,
0.37885546684265137,
-0.11793409287929535,
0.2941138744354248,
... |
func (ref RefName) PullName() string {
refName := string(ref)
lastIdx := strings.LastIndexByte(refName[len(PullPrefix):], '/')
if strings.HasPrefix(refName, PullPrefix) && lastIdx > -1 {
return refName[len(PullPrefix) : lastIdx+len(PullPrefix)]
}
return ""
} | [
-0.6678526401519775,
0.015879061073064804,
0.6940805315971375,
-0.6284362077713013,
-0.3843108117580414,
-0.3169352412223816,
-0.32333898544311523,
-0.26649340987205505,
0.8877339363098145,
0.4865698516368866,
1.0224963426589966,
-0.4061521887779236,
-0.6365756392478943,
-0.771907866001129... |
func (ref RefName) ForBranchName() string {
return ref.nameWithoutPrefix(ForPrefix)
} | [
0.4688740074634552,
0.24776357412338257,
0.4465794265270233,
-0.8990970253944397,
-0.5988129377365112,
0.0025876422878354788,
-0.3651765286922455,
-0.7489504218101501,
-0.5011726021766663,
-0.2204088568687439,
0.9268544912338257,
-0.11751069873571396,
0.2240656614303589,
0.3650904297828674... |
func (ref RefName) ShortName() string {
refName := string(ref)
if ref.IsBranch() {
return ref.BranchName()
}
if ref.IsTag() {
return ref.TagName()
}
if ref.IsRemote() {
return ref.RemoteName()
}
if ref.IsPull() {
return ref.PullName()
}
if ref.IsFor() {
return ref.ForBranchName()
}
return refName... | [
0.5332035422325134,
-0.5643952488899231,
0.41866812109947205,
-0.08232590556144714,
0.3193874657154083,
-0.2611933648586273,
-0.6588569283485413,
-0.8234308958053589,
0.3873850703239441,
0.39936840534210205,
0.9036855101585388,
-0.039784856140613556,
-0.28444918990135193,
0.979242980480194... |
func (ref RefName) RefGroup() string {
if ref.IsBranch() {
return "heads"
}
if ref.IsTag() {
return "tags"
}
if ref.IsRemote() {
return "remotes"
}
if ref.IsPull() {
return "pull"
}
if ref.IsFor() {
return "for"
}
return ""
} | [
-0.5965527892112732,
0.887279748916626,
0.28663551807403564,
-0.9658249020576477,
-0.015011048875749111,
0.2496471107006073,
-0.49296799302101135,
-1.49373197555542,
-0.7288734912872314,
0.2301967591047287,
0.7379325032234192,
0.3459688127040863,
-0.15910650789737701,
1.510783314704895,
... |
func (ref RefName) RefType() string {
var refType string
if ref.IsBranch() {
refType = "branch"
} else if ref.IsTag() {
refType = "tag"
}
return refType
} | [
0.2174513190984726,
0.3019286096096039,
0.4265512228012085,
0.12216418236494064,
0.8418127298355103,
0.3258415758609772,
-0.45841747522354126,
-0.972791850566864,
0.9003991484642029,
0.6592385172843933,
0.7562869191169739,
0.097665935754776,
-0.44893625378608704,
1.3719093799591064,
0.38... |
func RefURL(repoURL, ref string) string {
refFullName := RefName(ref)
refName := util.PathEscapeSegments(refFullName.ShortName())
switch {
case refFullName.IsBranch():
return repoURL + "/src/branch/" + refName
case refFullName.IsTag():
return repoURL + "/src/tag/" + refName
case !IsValidSHAPattern(ref):
// ... | [
0.4793104827404022,
-0.22675172984600067,
0.6717128753662109,
0.054677434265613556,
-0.15938059985637665,
0.1978336125612259,
-0.29688701033592224,
0.1428309977054596,
0.44866323471069336,
0.28177574276924133,
0.7489804029464722,
0.11591610312461853,
0.06159091740846634,
0.124397411942482,... |
func UnmarshalAnilist(data []byte) (Anilist, error) {
var r Anilist
err := json.Unmarshal(data, &r)
return r, err
} | [
-0.45508795976638794,
-0.20114710927009583,
0.35265567898750305,
-0.8711247444152832,
-1.2922115325927734,
-0.33352208137512207,
-0.6150095462799072,
1.399074912071228,
1.0122356414794922,
0.4456574022769928,
-0.8583499789237976,
-0.4565960466861725,
-0.5074944496154785,
-0.096224345266819... |
func (r *Anilist) Marshal() ([]byte, error) {
return json.Marshal(r)
} | [
-0.27733567357063293,
-0.39725157618522644,
0.26974356174468994,
-0.3889833390712738,
-1.185030460357666,
0.41971555352211,
-1.0597329139709473,
-0.17661108076572418,
0.9302158951759338,
-0.0837748646736145,
-0.9582281112670898,
1.3281065225601196,
-0.0723479688167572,
0.3255898058414459,
... |
func GetMapper(name string) (*Mapper, error) {
mapper := new(Mapper)
url := fmt.Sprintf("%s/get_user?k=%s&u=%s&type=string", osuURL, osuKey, name)
log.Printf("Requesting from: %s\n", strings.Replace(url, osuKey, "[secure]", 1))
resp, err := http.Get(url)
if err != nil {
return nil, err
}
defer resp.Body.Close... | [
-1.3967947959899902,
0.05327615886926651,
0.9626587629318237,
0.115412138402462,
-0.6119594573974609,
-0.43729934096336365,
-0.750676155090332,
-0.9656209945678711,
0.6740206480026245,
0.20524075627326965,
-0.4216613471508026,
-0.24618194997310638,
-0.7849231958389282,
0.11181791871786118,... |
func MapperFromDB(name string) (*Mapper, error) {
mapper := new(Mapper)
DB.Where("lower(username) = lower(?)", name).First(mapper)
if mapper.ID == 0 {
return mapper, fmt.Errorf("no mapper was found for %s", name)
}
return mapper, nil
} | [
-0.5849714279174805,
-0.4150828719139099,
0.35993653535842896,
-0.056090276688337326,
-1.5620931386947632,
0.5220299363136292,
-0.9145545363426208,
-0.6975866556167603,
0.3393426835536957,
0.4044024646282196,
-0.47342830896377563,
-0.9595454931259155,
-0.8848027586936951,
0.928046286106109... |
func (mapper *Mapper) Insert() {
DB.Create(mapper)
mapsets, err := mapper.GetMapsets()
if err != nil {
log.Printf("Mapsets could not be retrieved for %s\n", mapper.Username)
return
}
// Add the mapper's mapsets to the DB.
inserted := []*Mapset{}
for _, mapset := range mapsets {
if !HasMapset(inserted, map... | [
-0.9539135098457336,
0.612413763999939,
0.43753719329833984,
-0.4558260142803192,
0.1426047533750534,
0.39105239510536194,
-0.13099981844425201,
-0.28447267413139343,
0.0953245535492897,
-0.6684419512748718,
-0.48893120884895325,
-1.2993518114089966,
-1.0435601472854614,
0.4030671119689941... |
func (mapper *Mapper) Update(newName string) {
log.Printf("%s has changed their name to %s\n", mapper.Username, newName)
mapper.Username = newName
DB.Save(&mapper)
} | [
-1.2541980743408203,
-0.9512559175491333,
0.18538732826709747,
-0.4434565603733063,
-1.548632264137268,
0.4989520013332367,
-0.6094550490379333,
0.007008429151028395,
-0.1109788715839386,
0.6812637448310852,
-1.0238605737686157,
-0.39802098274230957,
-0.16109347343444824,
0.306519299745559... |
func (mapper *Mapper) GetMapsets() ([]*Mapset, error) {
var mapsets []*Mapset
url := fmt.Sprintf("%s/get_beatmaps?k=%s&u=%d", osuURL, osuKey, mapper.ID)
resp, err := http.Get(url)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, er... | [
-1.1679701805114746,
0.35975849628448486,
0.5529983639717102,
0.5279595851898193,
-0.20752358436584473,
-0.2090742439031601,
-0.5112483501434326,
-1.6159483194351196,
0.680487334728241,
-0.36550721526145935,
-0.17087337374687195,
0.428337424993515,
-0.7277700901031494,
0.05609487369656563,... |
func predictionHandler(w http.ResponseWriter, req *http.Request) {
// read txn, decode JSON, store in Aerospike
incomingTxn := webTxn{}
err := acceptTxn(req, aeroClient, &incomingTxn)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
// read txn by userID
enrichedTxn := enrichedTxn{... | [
-0.09992735087871552,
-0.4046609699726105,
0.6990918517112732,
0.37388747930526733,
-0.7604892253875732,
1.0063105821609497,
-0.08333660662174225,
0.15543420612812042,
-0.6000376343727112,
0.7148613333702087,
0.01851613260805607,
-0.18227384984493256,
0.2946465313434601,
0.0334448292851448... |
func acceptTxn(req *http.Request, client *aero.Client, incomingTxn *webTxn) (err error) {
// read and decode txn
err = json.NewDecoder(req.Body).Decode(&incomingTxn)
if err != nil {
return err
}
// store the incoming txn in Aerospike
key, err := aero.NewKey(namespace, setName, incomingTxn.SellerID)
if err != ... | [
-0.616493284702301,
-0.7772694826126099,
0.5234588980674744,
-0.9104316234588623,
-0.6649333834648132,
0.591759979724884,
-0.07315660268068314,
0.12277361750602722,
-0.2534838616847992,
0.5101826786994934,
-0.7394342422485352,
-0.37772896885871887,
0.06630748510360718,
-0.01854267530143261... |
func tryFloat(v interface{}, dflt float64) float64 {
f, ok := v.(float64)
if !ok {
return dflt
}
return f
} | [
0.2701463997364044,
1.2018635272979736,
0.2790745198726654,
-0.2577696442604065,
0.4204797148704529,
-0.5604961514472961,
-0.2674770653247833,
-0.6528504490852356,
-0.7102084755897522,
-1.1894973516464233,
0.29820516705513,
-0.28715234994888306,
0.30219826102256775,
0.17825505137443542,
... |
func enrichTxn(aeroClient *aero.Client, incomingTxn *webTxn, enrichedTxn *enrichedTxn) (txnOutcome string, err error) {
// read enriched data by UserID
getKey, err := aero.NewKey(namespace, setName, incomingTxn.UserID)
if err != nil {
return "", err
}
record, err := aeroClient.Get(nil, getKey)
if err != nil {
... | [
-0.2982812821865082,
-0.16098368167877197,
0.6090524196624756,
-0.5011094212532043,
-0.2861136198043823,
0.2602466344833374,
0.14384698867797852,
-0.3680555820465088,
-0.11507591605186462,
0.32408246397972107,
-0.29935508966445923,
1.2015644311904907,
0.3253558278083801,
-0.058343838900327... |
func getPrediction(enrichedTxn *enrichedTxn) (modelPrediction string, err error) {
// marshal to the expected struct
reqBody, err := json.Marshal(enrichedTxn)
if err != nil {
return "", err
}
// prepare request
req, err := http.NewRequest("POST", mlModelServingURL, bytes.NewBuffer(reqBody))
if err != nil {
... | [
-0.3359881639480591,
-0.03047175146639347,
0.9732711315155029,
0.0788339227437973,
-0.15234635770320892,
0.3779875338077545,
-0.40049389004707336,
-0.27867579460144043,
-0.5541236996650696,
0.47785839438438416,
-0.3925512135028839,
0.635199248790741,
-0.5176796913146973,
0.4793936014175415... |
func validatePrediction(txnOutcome, modelPrediction string) {
// compare both predictions
if txnOutcome == modelPrediction {
fmt.Println("and it DOES match the classification")
return
}
fmt.Println("and it DOES NOT match the classification")
// advanced: run comparison for all fields in csv
return
} | [
0.09771408885717392,
-0.9622721076011658,
0.48007282614707947,
0.6165619492530823,
-0.40451034903526306,
1.374947428703308,
-0.5057265758514404,
0.6120495796203613,
-0.3821989893913269,
0.19751593470573425,
0.4612307846546173,
0.2755391001701355,
0.08422862738370895,
0.6281935572624207,
... |
func GetBytes[T any](key T) (*[]byte, error) {
var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
err := enc.Encode(key)
if err != nil {
return nil, err
}
b := buf.Bytes()
return &b, nil
} | [
-0.07736208289861679,
1.2818294763565063,
0.26357853412628174,
0.057030562311410904,
0.6866961717605591,
-0.9431418180465698,
-1.2377080917358398,
-0.3720243275165558,
-0.10178212076425552,
0.8252517580986023,
-0.7193695902824402,
0.21284276247024536,
-1.0033159255981445,
0.835719823837280... |
func handler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html")
w.WriteHeader(200)
w.Write([]byte("<h1>Hello</>"))
} | [
0.3676529824733734,
0.09649655222892761,
0.5863038897514343,
0.1649634689092636,
-0.08764522522687912,
0.8486164808273315,
0.6734984517097473,
0.7882055044174194,
-0.4797910749912262,
-0.5714684724807739,
-0.455812007188797,
-0.22994622588157654,
0.7335436940193176,
0.1686384677886963,
-... |
func (a *DefaultApiService) BootVM(ctx _context.Context) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
localVarPath := a.... | [
-1.0428342819213867,
-0.41296038031578064,
1.0857245922088623,
-0.12580320239067078,
-0.0690794289112091,
-0.2764759361743927,
-0.1449369341135025,
-0.42775553464889526,
-0.550693690776825,
0.2476041167974472,
0.05404164642095566,
0.6385790109634399,
-1.2604255676269531,
1.0178892612457275... |
func (a *DefaultApiService) CreateVM(ctx _context.Context, vmConfig VmConfig) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variable... | [
-0.7855228781700134,
-0.0031881877221167088,
0.9984918236732483,
-0.28162503242492676,
0.043847519904375076,
-0.04203829914331436,
-0.1487066149711609,
-0.26275768876075745,
-0.5742129683494568,
0.6787304282188416,
-0.1195465624332428,
0.1745055466890335,
-1.323077917098999,
0.522387325763... |
func (a *DefaultApiService) DeleteVM(ctx _context.Context) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
localVarPath := ... | [
-1.0357033014297485,
-0.3104589283466339,
1.0691986083984375,
-0.034425098448991776,
0.14487403631210327,
0.004576704930514097,
0.27702027559280396,
-0.3264055550098419,
-0.2530418932437897,
-0.1383681297302246,
0.029911404475569725,
0.8401497006416321,
-1.2930076122283936,
0.4793541729450... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.