text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func NewRender(objfile, texfile string, w, h int) (*Render, error) {
// Open both the object and texture file
// if either fails to load, return nil and
// the cause.
fobj, err := os.Open(objfile)
if err != nil {
return nil, err
}
tex := render.LoadSprite(texfile)
if tex == nil {
return nil, errors.New("Una... | [
0.7012903690338135,
-0.945623517036438,
0.7065079212188721,
-0.0280180424451828,
-0.9006413817405701,
0.21510490775108337,
-0.4724898040294647,
0.05982157588005066,
-0.18053807318210602,
0.14917783439159393,
0.044064961373806,
-0.22014537453651428,
-0.5241524577140808,
-0.7440572381019592,... |
func (r *Render) Draw(buff draw.Image) {
// To avoid duplicating logic, Draw just calls DrawOffset with 0 offsets.
r.DrawOffset(buff, 0, 0)
} | [
-0.49837252497673035,
0.264347106218338,
0.47394439578056335,
-0.5097074508666992,
0.260743111371994,
1.0514130592346191,
0.4989529848098755,
-0.6901103854179382,
0.39107224345207214,
-1.3483332395553589,
-0.028585461899638176,
0.2861015498638153,
-0.1274302899837494,
0.9815893173217773,
... |
func (r *Render) DrawOffset(buff draw.Image, xOff, yOff float64) {
// If there hasn't been new mouse input, so the 3d model has not been rotated
// since it was processed last, don't re-process the model's rotation.
if mouse.LastMouseEvent != r.lastmouse {
// Reset the backing Sprite's color buffer to be empty, so... | [
-0.19441312551498413,
0.10826549679040909,
1.0538313388824463,
-0.8808549046516418,
-0.517540693283081,
0.4178217947483063,
0.4038701355457306,
0.2292243093252182,
0.45726892352104187,
0.44165605306625366,
-0.023718364536762238,
0.1392696350812912,
0.16086672246456146,
-0.3307822048664093,... |
func Min(array []int) (int, int) {
var ind = 0
var min = array[0]
for index, value := range array {
if min > value {
min = value
ind = index
}
}
return min, ind
} | [
-0.8055163621902466,
-1.5161395072937012,
0.29263317584991455,
0.17158544063568115,
-1.154884696006775,
0.253608375787735,
-0.06511862576007843,
-0.5958197116851807,
0.4411778450012207,
0.05520274117588997,
0.02290227822959423,
0.6969649791717529,
0.15437942743301392,
0.6094769835472107,
... |
func Remove(slice []int, s int) []int {
return append(slice[:s], slice[s+1:]...)
} | [
-0.6689706444740295,
-0.6026012897491455,
0.5422254800796509,
0.23727163672447205,
-1.1991074085235596,
-0.7622513175010681,
0.15919651091098785,
0.8904955983161926,
1.0461722612380981,
0.6787202954292297,
-1.3822696208953857,
0.92913419008255,
-0.7074939608573914,
-0.2950558066368103,
1... |
func ChangesEmbed() *discordgo.MessageEmbed {
embed := &discordgo.MessageEmbed{
Author: &discordgo.MessageEmbedAuthor{
Name: "Flankerbot",
URL: "https://github.com/rodzy/F",
IconURL: "https://cdn.discordapp.com/avatars/703454326722396161/e70c1562f842ede26dbb80404b1206a5.webp?size=128",
},
Color:... | [
0.39635705947875977,
0.05108150839805603,
0.8967429399490356,
-0.4756735861301422,
0.38740476965904236,
0.5213487148284912,
-0.4025591015815735,
0.06974081695079803,
-0.4554935097694397,
0.4287587106227875,
-0.7268198132514954,
0.9147511124610901,
0.018983110785484314,
1.0382969379425049,
... |
func ChanWriteCloser(inp ...io.WriteCloser) chan io.WriteCloser {
out := make(chan io.WriteCloser)
go func() {
defer close(out)
for i := range inp {
out <- inp[i]
}
}()
return out
} | [
-0.7340172529220581,
-1.3543254137039185,
0.58680260181427,
-0.32203683257102966,
-0.0177388284355402,
0.5771883726119995,
-0.3640331029891968,
-0.529230535030365,
-0.3701086938381195,
0.08743979781866074,
0.7552569508552551,
0.0016426255460828543,
-0.6634840965270996,
0.15082773566246033,... |
func ChanWriteCloserSlice(inp ...[]io.WriteCloser) chan io.WriteCloser {
out := make(chan io.WriteCloser)
go func() {
defer close(out)
for i := range inp {
for j := range inp[i] {
out <- inp[i][j]
}
}
}()
return out
} | [
-1.2431021928787231,
-1.3668513298034668,
0.676868200302124,
-0.05277612805366516,
0.03978990763425827,
0.1827402412891388,
-0.205596923828125,
-0.4698832631111145,
-0.7138863205909729,
0.371870219707489,
0.09583494067192078,
-0.1145312488079071,
-1.030664086341858,
-0.1753225028514862,
... |
func ChanWriteCloserFuncNok(act func() (io.WriteCloser, bool)) <-chan io.WriteCloser {
out := make(chan io.WriteCloser)
go func() {
defer close(out)
for {
res, ok := act() // Apply action
if !ok {
return
}
out <- res
}
}()
return out
} | [
-0.44124677777290344,
-0.8843461275100708,
0.41367343068122864,
0.04506871849298477,
-0.13155217468738556,
-0.6073548197746277,
1.2218570709228516,
-0.22568894922733307,
-0.3591933250427246,
-0.07064661383628845,
0.12464658170938492,
-0.13092991709709167,
0.020502105355262756,
0.3437182009... |
func ChanWriteCloserFuncErr(act func() (io.WriteCloser, error)) <-chan io.WriteCloser {
out := make(chan io.WriteCloser)
go func() {
defer close(out)
for {
res, err := act() // Apply action
if err != nil {
return
}
out <- res
}
}()
return out
} | [
-0.9033312797546387,
-1.1881258487701416,
0.5544328093528748,
-0.08505532890558243,
0.3047731816768646,
-0.00791377853602171,
0.5374549031257629,
-0.8246511816978455,
0.18501481413841248,
0.09277088940143585,
1.416155457496643,
0.06036996841430664,
-0.5595486164093018,
0.796004593372345,
... |
func JoinWriteCloser(out chan<- io.WriteCloser, inp ...io.WriteCloser) chan struct{} {
done := make(chan struct{})
go func() {
defer close(done)
for i := range inp {
out <- inp[i]
}
done <- struct{}{}
}()
return done
} | [
-0.8784005045890808,
-1.1501944065093994,
0.815010666847229,
0.48072531819343567,
-0.16021309792995453,
0.6599360108375549,
0.7861830592155457,
-0.8070058822631836,
-0.8177467584609985,
0.14559973776340485,
0.42932218313217163,
-0.5826202034950256,
-1.4257980585098267,
0.06150816008448601,... |
func JoinWriteCloserSlice(out chan<- io.WriteCloser, inp ...[]io.WriteCloser) chan struct{} {
done := make(chan struct{})
go func() {
defer close(done)
for i := range inp {
for j := range inp[i] {
out <- inp[i][j]
}
}
done <- struct{}{}
}()
return done
} | [
-1.128347396850586,
-1.200015902519226,
0.8073276877403259,
0.37786152958869934,
-0.2827896475791931,
0.32737070322036743,
0.5503102540969849,
-0.5886076092720032,
-0.9711981415748596,
0.5237470269203186,
0.1637529730796814,
-0.4034917950630188,
-1.4486111402511597,
-0.0958481878042221,
... |
func JoinWriteCloserChan(out chan<- io.WriteCloser, inp <-chan io.WriteCloser) chan struct{} {
done := make(chan struct{})
go func() {
defer close(done)
for i := range inp {
out <- i
}
done <- struct{}{}
}()
return done
} | [
-0.4452348053455353,
-1.1609610319137573,
0.6375963091850281,
0.36234787106513977,
0.11313550919294357,
0.4713040292263031,
1.0146124362945557,
-0.6683197021484375,
-0.8799758553504944,
-0.41489070653915405,
-0.041769225150346756,
0.08920684456825256,
-1.2097933292388916,
-0.48046711087226... |
func DoneWriteCloser(inp <-chan io.WriteCloser) chan struct{} {
done := make(chan struct{})
go func() {
defer close(done)
for i := range inp {
_ = i // Drain inp
}
done <- struct{}{}
}()
return done
} | [
-1.7989789247512817,
-0.8979646563529968,
0.6760621666908264,
-0.5311160683631897,
-0.2505558133125305,
0.27579471468925476,
1.2795730829238892,
-1.141850471496582,
-0.05567833408713341,
0.022070040926337242,
0.04351436346769333,
-0.4131220877170563,
-1.1731897592544556,
0.7134270668029785... |
func DoneWriteCloserSlice(inp <-chan io.WriteCloser) chan []io.WriteCloser {
done := make(chan []io.WriteCloser)
go func() {
defer close(done)
WriteCloserS := []io.WriteCloser{}
for i := range inp {
WriteCloserS = append(WriteCloserS, i)
}
done <- WriteCloserS
}()
return done
} | [
-1.858558177947998,
-1.2599519491195679,
0.8006769418716431,
-0.24970240890979767,
0.18122756481170654,
-0.09386063367128372,
0.9320835471153259,
-1.2478277683258057,
-0.2158082276582718,
0.5121386051177979,
-0.30453190207481384,
-0.027086270973086357,
-1.329871416091919,
0.592800259590148... |
func DoneWriteCloserFunc(inp <-chan io.WriteCloser, act func(a io.WriteCloser)) chan struct{} {
done := make(chan struct{})
if act == nil {
act = func(a io.WriteCloser) { return }
}
go func() {
defer close(done)
for i := range inp {
act(i) // Apply action
}
done <- struct{}{}
}()
return done
} | [
-1.0546890497207642,
-0.8941636085510254,
0.6396828889846802,
-0.017631249502301216,
-0.1788024753332138,
-0.19841454923152924,
1.7590858936309814,
-0.4079650342464447,
-0.20632177591323853,
0.3507002294063568,
0.5042724013328552,
0.22979283332824707,
-0.5519829392433167,
0.315056473016738... |
func PipeWriteCloserBuffer(inp <-chan io.WriteCloser, cap int) chan io.WriteCloser {
out := make(chan io.WriteCloser, cap)
go func() {
defer close(out)
for i := range inp {
out <- i
}
}()
return out
} | [
-1.0284202098846436,
-0.9649258852005005,
0.7541878819465637,
-0.1550142765045166,
0.44416505098342896,
0.5779609084129333,
0.6293725967407227,
-0.45401203632354736,
-0.8298606872558594,
-0.4943722188472748,
-0.24445584416389465,
0.07081455737352371,
-1.3084691762924194,
-0.579925000667572... |
func PipeWriteCloserFunc(inp <-chan io.WriteCloser, act func(a io.WriteCloser) io.WriteCloser) chan io.WriteCloser {
out := make(chan io.WriteCloser)
if act == nil {
act = func(a io.WriteCloser) io.WriteCloser { return a }
}
go func() {
defer close(out)
for i := range inp {
out <- act(i)
}
}()
return o... | [
-0.47931814193725586,
-1.167777180671692,
0.586514949798584,
-0.2792098820209503,
-0.3046966791152954,
-0.43575215339660645,
1.131373405456543,
-0.03146177902817726,
-0.5073252320289612,
0.35457703471183777,
1.1791898012161255,
0.42590031027793884,
-0.21718215942382812,
-0.0519731268286705... |
func PipeWriteCloserFork(inp <-chan io.WriteCloser) (chan io.WriteCloser, chan io.WriteCloser) {
out1 := make(chan io.WriteCloser)
out2 := make(chan io.WriteCloser)
go func() {
defer close(out1)
defer close(out2)
for i := range inp {
out1 <- i
out2 <- i
}
}()
return out1, out2
} | [
-1.3023830652236938,
-0.9066208004951477,
0.7577869296073914,
0.26615607738494873,
0.14720608294010162,
-0.07265245914459229,
0.842836320400238,
-0.17305532097816467,
-1.2093720436096191,
-0.32562586665153503,
0.022283103317022324,
-0.22557462751865387,
-0.6056951284408569,
0.2544930577278... |
func WriteCloserDaisy(inp <-chan io.WriteCloser, tube WriteCloserTube) (out <-chan io.WriteCloser) {
cha := make(chan io.WriteCloser)
go tube(inp, cha)
return cha
} | [
-1.1325781345367432,
-0.4790496528148651,
0.6763235330581665,
0.1920783668756485,
0.5388917922973633,
0.07897832989692688,
0.644167959690094,
-0.6598559617996216,
-0.6799241900444031,
-0.3133087158203125,
0.28252679109573364,
0.31758978962898254,
-0.5366154313087463,
0.5255618691444397,
... |
func WriteCloserDaisyChain(inp <-chan io.WriteCloser, tubes ...WriteCloserTube) (out <-chan io.WriteCloser) {
cha := inp
for i := range tubes {
cha = WriteCloserDaisy(cha, tubes[i])
}
return cha
} | [
-1.437286615371704,
-0.30049338936805725,
0.5117284059524536,
0.44472357630729675,
0.47429123520851135,
0.5467759370803833,
0.91080242395401,
-0.9464790225028992,
-0.47568610310554504,
-0.433641642332077,
-0.022104566916823387,
-0.10074035823345184,
-0.8755509853363037,
0.5396847724914551,... |
func (o *Oscar) AddTestSuiteFile(name, header, filter string) error {
suite := struct {
Header string
FileName string
CaseSelector func(*TestCase) bool
}{
Header: header,
FileName: name,
}
if len(filter) > 0 {
nameMatcher, err := regexp.Compile("(?i)" + filter)
if err != nil {
return e... | [
-0.41225168108940125,
-0.20460298657417297,
0.5901601314544678,
-0.244695782661438,
-0.06967342644929886,
-0.16538174450397491,
0.10286440700292587,
0.2087181806564331,
-0.5338060259819031,
0.16282980144023895,
-0.7522163987159729,
-0.2055017352104187,
0.04362296685576439,
0.24713411927223... |
func (o Oscar) prefix(i int) string {
name := ""
if len(o.Suits) > 1 {
name = path.Base(o.suiteDefinitions[i].FileName) + ":"
}
return name
} | [
-0.33026349544525146,
0.05676976963877678,
0.6458043456077576,
0.1315905600786209,
-0.47662922739982605,
0.43011629581451416,
0.5505087375640869,
0.03395094722509384,
0.48433786630630493,
1.0793401002883911,
0.18976333737373352,
0.038652654737234116,
1.1591804027557373,
0.22266830503940582... |
func (o Oscar) IterateResults(f func(string, int, int, int, time.Duration, time.Duration, time.Duration)) {
for i, ts := range o.Suits {
for _, tc := range ts.GetCases() {
cntErr := 0
if tc.Error != nil {
cntErr = 1
}
if cntErr == 0 && tc.CountAssertSuccess == 0 {
continue
}
elapsedTotal, e... | [
-0.45357421040534973,
0.15581075847148895,
0.7003195285797119,
-0.023873524740338326,
0.7155523896217346,
0.29882797598838806,
0.23241381347179413,
-0.5289034843444824,
-0.5930747985839844,
0.1362871676683426,
0.37682175636291504,
0.2207760214805603,
0.9125292301177979,
0.33331382274627686... |
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not foun... | [
-0.7961483001708984,
-1.2313168048858643,
0.633165180683136,
-0.6093899011611938,
-1.546921730041504,
-0.11101024597883224,
0.12971386313438416,
-1.3390334844589233,
-1.1358720064163208,
0.4855233430862427,
0.3090141713619232,
0.32495471835136414,
-0.6009681224822998,
-0.44264674186706543,... |
func MustAsset(name string) []byte {
a, err := Asset(name)
if err != nil {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
} | [
-0.012778956443071365,
0.11985661834478378,
0.4091298282146454,
-0.5268413424491882,
-0.8276715278625488,
0.4719155430793762,
-0.8186293840408325,
-1.5736604928970337,
0.16388541460037231,
0.6357062458992004,
-0.5354578495025635,
0.35693347454071045,
0.0057142809964716434,
-0.0248885955661... |
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("Asset... | [
0.371969997882843,
-1.1052993535995483,
0.5630446076393127,
-0.922572672367096,
-1.356387734413147,
0.0033556853886693716,
0.6777529716491699,
-0.8006685972213745,
-1.2748286724090576,
0.3115358352661133,
0.2636086046695709,
0.26388120651245117,
0.0635773167014122,
-0.3988074064254761,
0... |
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
} | [
-0.7293784618377686,
-0.8460342288017273,
0.7321816682815552,
-0.39323121309280396,
-0.48951536417007446,
0.7661203145980835,
-0.5028699636459351,
-0.8655748963356018,
-0.4145073890686035,
0.8099913597106934,
0.16903363168239594,
1.163049578666687,
-0.028152840211987495,
0.0342608317732811... |
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
if err != nil {
return err
}
err = ioutil.WriteFile(_filePath(dir, name), d... | [
0.3437124192714691,
-0.3622540235519409,
0.6770355701446533,
-1.2592030763626099,
-0.006139514967799187,
-0.04453148692846298,
-0.0072639440186321735,
-0.43950510025024414,
-0.20619122684001923,
-0.2510169744491577,
0.1784360408782959,
0.13568510115146637,
-0.23627112805843353,
-0.56985116... |
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File
if err != nil {
return RestoreAsset(dir, name)
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, filepath.Join(name, child))
if err != nil {
return err
}
}
return nil
} | [
0.42261892557144165,
0.30020031332969666,
0.5813396573066711,
-0.20641657710075378,
-0.23828908801078796,
-0.24414615333080292,
0.5739709138870239,
-0.029911456629633904,
0.06188219040632248,
-0.43923482298851013,
0.5113736987113953,
0.3275970220565796,
-0.6125145554542542,
0.0351656526327... |
func SetRestAPIConfig(configFile string) error {
yamlData, err := ioutil.ReadFile(configFile)
if err != nil {
return err
}
err = yaml.Unmarshal(yamlData, &RestAPIConfig)
if err != nil {
return err
}
return err
} | [
0.33287274837493896,
-0.8690488338470459,
0.4858591854572296,
-0.6237503886222839,
-0.4175494313240051,
0.12274549901485443,
0.17496876418590546,
1.344879388809204,
-1.283434510231018,
0.5799630284309387,
-1.7067328691482544,
0.10069653391838074,
-0.6261501312255859,
0.2019302397966385,
... |
func GetRestAPIConfig() ([]byte, error) {
configJSON, err := json.Marshal(RestAPIConfig)
if err != nil {
return nil, err
}
return configJSON, err
} | [
-0.39286649227142334,
-0.30743876099586487,
0.47076818346977234,
-0.3659205734729767,
-0.8653975129127502,
-0.4799618721008301,
-0.7335140705108643,
0.49631255865097046,
-0.3388521075248718,
0.7737301588058472,
-2.3604350090026855,
0.48529860377311707,
-1.1765520572662354,
-0.0065565165132... |
func TestECVRFOnce(t *testing.T) {
pk, _ := hex.DecodeString(pks)
sk, _ := hex.DecodeString(sks)
m := []byte(message)
DoTestECVRF(t, pk, sk, m, true)
h := ECVRF_hash_to_curve(m, pk)
fmt.Printf("h: %s\n", hex.EncodeToString(ECP2OS(h)))
} | [
0.3629549443721771,
1.164046049118042,
0.44820451736450195,
-0.6166864037513733,
1.5511538982391357,
-0.4062540829181671,
-0.12211786955595016,
-0.5837454795837402,
-0.13346242904663086,
-0.0747704729437828,
-0.4536181390285492,
0.47224125266075134,
-0.3031724691390991,
-0.6263276934623718... |
func DwarfTagFromString(s string) enum.DwarfTag {
for key, val := range _DwarfTag_map {
if s == val {
return key
}
}
panic(fmt.Errorf("unable to locate DwarfTag enum corresponding to %q", s))
} | [
-0.0520547591149807,
-0.7889967560768127,
0.07541515678167343,
-0.3483254611492157,
-0.4703238606452942,
-0.03593026101589203,
0.5282661318778992,
-0.5270022749900818,
0.08937061578035355,
0.22598397731781006,
-0.6088955402374268,
0.15090356767177582,
0.6417906880378723,
0.1943833827972412... |
func getWriters(s *SubLoggerConfig) (*multiWriterHolder, error) {
if s == nil {
return nil, errSubloggerConfigIsNil
}
outputWriters := strings.Split(s.Output, "|")
writers := make([]io.Writer, 0, len(outputWriters))
for x := range outputWriters {
var writer io.Writer
switch strings.ToLower(outputWriters[x])... | [
-0.0829172134399414,
0.11216222494840622,
0.5599036812782288,
0.7383413910865784,
-0.1552829146385193,
-0.2352299690246582,
0.39634647965431213,
-0.10934776067733765,
-0.3534766435623169,
-0.4066912829875946,
-0.09892123937606812,
0.22093749046325684,
-0.5700844526290894,
0.634972631931304... |
func GenDefaultSettings() *Config {
return &Config{
Enabled: convert.BoolPtr(true),
SubLoggerConfig: SubLoggerConfig{
Level: "INFO|DEBUG|WARN|ERROR",
Output: "console",
},
LoggerFileConfig: &loggerFileConfig{
FileName: "log.txt",
Rotate: convert.BoolPtr(false),
},
AdvancedSettings: advancedS... | [
-0.43384411931037903,
0.5676132440567017,
0.7211382985115051,
-0.12217486649751663,
-0.5233562588691711,
0.3209190368652344,
-0.16824671626091003,
-0.3249503970146179,
-0.8687768578529358,
0.09781703352928162,
-0.7345736026763916,
-0.5511980056762695,
0.03465653583407402,
1.120557427406311... |
func SetGlobalLogConfig(incoming *Config) error {
if incoming == nil {
return errConfigNil
}
var fileConf loggerFileConfig
if incoming.LoggerFileConfig != nil {
fileConf = *incoming.LoggerFileConfig
}
subs := make([]SubLoggerConfig, len(incoming.SubLoggers))
copy(subs, incoming.SubLoggers)
mu.Lock()
defer ... | [
0.18692909181118011,
0.699005126953125,
0.8269147276878357,
-0.286029577255249,
-1.0075114965438843,
1.1382321119308472,
-0.17052535712718964,
0.7897827625274658,
-0.5668827891349792,
0.8751170635223389,
-1.380630373954773,
0.80945885181427,
-0.5951740741729736,
1.4025591611862183,
0.794... |
func SetLogPath(newLogPath string) error {
if newLogPath == "" {
return errLogPathIsEmpty
}
mu.Lock()
defer mu.Unlock()
logPath = newLogPath
return nil
} | [
0.02641691453754902,
0.018670622259378433,
0.28489115834236145,
0.7374961376190186,
0.1393098086118698,
0.1343909353017807,
0.05499512329697609,
-0.2003754824399948,
-0.0902920737862587,
0.38605445623397827,
-1.1684099435806274,
0.6582953333854675,
-1.2340819835662842,
0.2918285131454468,
... |
func GetLogPath() string {
mu.RLock()
defer mu.RUnlock()
return logPath
} | [
-0.07816184312105179,
0.16634489595890045,
0.315410852432251,
1.0903090238571167,
-0.0025080551858991385,
0.15603122115135193,
0.5554153919219971,
-0.8798779249191284,
-0.5081652402877808,
-0.23773238062858582,
0.06181224063038826,
0.7271831631660461,
-1.674804925918579,
0.0135533856227993... |
func configureSubLogger(subLogger, levels string, output *multiWriterHolder) error {
logPtr, found := SubLoggers[subLogger]
if !found {
return fmt.Errorf("sub logger %v not found", subLogger)
}
err := logPtr.setOutput(output)
if err != nil {
return err
}
logPtr.setLevels(splitLevel(levels))
SubLoggers[subL... | [
0.4405316710472107,
-0.49242037534713745,
0.7054159641265869,
0.023052481934428215,
-1.1915709972381592,
-0.35543808341026306,
-0.3817262649536133,
-0.006978722754865885,
-0.08327613025903702,
-0.015621289610862732,
-0.8965922594070435,
-0.12830545008182526,
-0.4968748092651367,
0.71047139... |
func SetupSubLoggers(s []SubLoggerConfig) error {
mu.Lock()
defer mu.Unlock()
for x := range s {
output, err := getWriters(&s[x])
if err != nil {
return err
}
err = configureSubLogger(strings.ToUpper(s[x].Name), s[x].Level, output)
if err != nil {
return err
}
}
return nil
} | [
-0.20033445954322815,
-0.025736046954989433,
0.4789801836013794,
0.4375446140766144,
-0.577892541885376,
-0.6607773303985596,
0.13956500589847565,
0.3253645598888397,
-0.41207510232925415,
0.6326528787612915,
-0.9813491106033325,
0.1819690763950348,
-0.715305745601654,
1.0074188709259033,
... |
func SetupGlobalLogger(botName string, structuredOutput bool) error {
mu.Lock()
defer mu.Unlock()
if fileLoggingConfiguredCorrectly {
globalLogFile = &Rotate{
FileName: globalLogConfig.LoggerFileConfig.FileName,
MaxSize: globalLogConfig.LoggerFileConfig.MaxSize,
Rotate: globalLogConfig.LoggerFileConfi... | [
-0.1136380136013031,
-0.0017823625821620226,
0.9481735825538635,
-0.1447785496711731,
-0.44692227244377136,
0.40242528915405273,
0.4292706549167633,
0.6544718146324158,
-1.0929665565490723,
0.4041675925254822,
-0.7469136714935303,
0.4788259267807007,
-0.6724693775177002,
1.3620585203170776... |
func SetFileLoggingState(correctlyConfigured bool) {
mu.Lock()
fileLoggingConfiguredCorrectly = correctlyConfigured
mu.Unlock()
} | [
-0.3090173304080963,
-0.208306685090065,
0.4463193714618683,
0.3605903089046478,
-0.39225584268569946,
0.13219203054904938,
0.4624464809894562,
0.7218301296234131,
0.15322871506214142,
-0.1486814022064209,
-0.6194819211959839,
-0.030883457511663437,
0.17555350065231323,
0.14287534356117249... |
func registerNewSubLogger(subLogger string) *SubLogger {
tempHolder, err := getWriters(&SubLoggerConfig{
Name: strings.ToUpper(subLogger),
Level: "INFO|WARN|DEBUG|ERROR",
Output: "stdout"})
if err != nil {
return nil
}
temp := &SubLogger{
name: strings.ToUpper(subLogger),
output: ... | [
-0.3053510785102844,
-0.24839656054973602,
0.844295859336853,
-0.09824738651514053,
-1.0283030271530151,
-0.10250342637300491,
-0.7280750274658203,
-0.09985997527837753,
-0.3713497817516327,
-0.12916460633277893,
-1.2926570177078247,
0.7709980010986328,
-0.6057694554328918,
1.2421454191207... |
func init() {
// Start persistent worker to handle logs
go loggerWorker()
mu.Lock()
Global = registerNewSubLogger("LOG")
ConnectionMgr = registerNewSubLogger("CONNECTION")
CommunicationMgr = registerNewSubLogger("COMMS")
APIServerMgr = registerNewSubLogger("API")
ConfigMgr = registerNewSubLogger("CONFIG")
Da... | [
0.49215394258499146,
0.2985672950744629,
0.898110032081604,
0.5177688002586365,
0.3838973343372345,
0.5697449445724487,
-0.2727572023868561,
-0.44315221905708313,
-0.27596572041511536,
-0.15165017545223236,
-1.3190171718597412,
0.9921506643295288,
-0.5186306834220886,
0.720941960811615,
... |
func ToPBSshconfig(from *system.SSHConfig) *pb.SshConfig {
var gw *pb.SshConfig
if from.GatewayConfig != nil {
gw = ToPBSshconfig(from.GatewayConfig)
}
return &pb.SshConfig{
Gateway: gw,
Host: from.Host,
Port: int32(from.Port),
PrivateKey: from.PrivateKey,
User: from.User,
}
} | [
0.8861914873123169,
-0.1054467037320137,
0.7748127579689026,
0.15866468846797943,
-1.558762550354004,
0.8525118231773376,
-0.8070590496063232,
0.04516797512769699,
0.06033517047762871,
-0.24982517957687378,
-0.4358132779598236,
1.0412096977233887,
0.29605311155319214,
1.0766100883483887,
... |
func ToAPISshConfig(from *pb.SshConfig) *system.SSHConfig {
var gw *system.SSHConfig
if from.Gateway != nil {
gw = ToAPISshConfig(from.Gateway)
}
return &system.SSHConfig{
User: from.User,
Host: from.Host,
PrivateKey: from.PrivateKey,
Port: int(from.Port),
GatewayConfig: gw... | [
-0.05997171252965927,
-0.09936466813087463,
0.5402406454086304,
-0.2192125916481018,
-0.8700271844863892,
0.27997657656669617,
-0.8332288861274719,
0.20942950248718262,
0.6146154999732971,
0.40695634484291077,
-1.1073558330535889,
0.8221856355667114,
0.2540161609649658,
0.5694472789764404,... |
func ToPbVolume(in api.Volume) *pb.Volume {
return &pb.Volume{
ID: in.ID,
Name: in.Name,
Size: int32(in.Size),
Speed: pb.VolumeSpeed(in.Speed),
}
} | [
0.12178291380405426,
-0.6060823202133179,
0.5995001792907715,
-0.2196277529001236,
-0.5224145650863647,
0.4401230216026306,
-0.8835800886154175,
-0.7628303170204163,
-0.2647859752178192,
-0.6111229658126831,
0.0018342413241043687,
0.17292062938213348,
-0.9699183702468872,
-0.20633995532989... |
func ToPBContainerList(in []string) *pb.ContainerList {
var containers []*pb.Container
for _, name := range in {
containers = append(containers, &pb.Container{Name: name})
}
return &pb.ContainerList{
Containers: containers,
}
} | [
-0.7848936319351196,
-0.8164101839065552,
0.481473833322525,
0.44384217262268066,
-0.29033613204956055,
0.054592303931713104,
-0.2702476680278778,
-0.5201492309570312,
0.6957693099975586,
0.2954087257385254,
-0.6699908375740051,
-0.8335737586021423,
-0.38076668977737427,
0.3788303732872009... |
func ToPBContainerMountPoint(in *api.ContainerInfo) *pb.ContainerMountingPoint {
return &pb.ContainerMountingPoint{
Container: in.Name,
Path: in.MountPoint,
VM: &pb.Reference{
Name: in.VM,
},
}
} | [
1.0436123609542847,
-1.1139506101608276,
0.4876200556755066,
0.1449194848537445,
-0.07471136748790741,
-0.05331486836075783,
-0.833454966545105,
-0.8931835889816284,
-0.0018144684145227075,
0.23559747636318207,
0.7832130789756775,
-0.06622464954853058,
-0.9305979013442993,
0.05178057029843... |
func ToPBNas(in *api.Nas) *pb.NasDefinition {
return &pb.NasDefinition{
Nas: &pb.NasName{
Name: in.Name},
VM: &pb.Reference{
ID: in.ServerID},
Path: in.Path,
IsServer: in.IsServer,
}
} | [
-0.5620536804199219,
0.13617658615112305,
0.4530450701713562,
-0.5905546545982361,
-0.7284412384033203,
0.18506400287151337,
-0.4942893385887146,
-0.5456032156944275,
1.2048180103302002,
-0.42672857642173767,
-0.07900414615869522,
1.1875489950180054,
0.05248969793319702,
1.1444534063339233... |
func (a *AWSResourceList) ToTable() *metav1.Table {
table := &metav1.Table{
TypeMeta: metav1.TypeMeta{
APIVersion: metav1.SchemeGroupVersion.String(),
Kind: "Table",
},
ColumnDefinitions: []metav1.TableColumnDefinition{
{
Name: "Partition",
Type: "string",
},
{
Name: "Service",
... | [
0.15349435806274414,
-0.20842361450195312,
0.5753135085105896,
-1.1646702289581299,
0.08515100926160812,
-0.3433597981929779,
0.012485234998166561,
0.007121463306248188,
0.6773194670677185,
0.7800153493881226,
0.08006267249584198,
0.12398241460323334,
0.7284733653068542,
-0.070963509380817... |
func New(cfg clients.Config) (*Client, error) {
if err := cfg.Validate(); err != nil {
return nil, errors.Trace(err)
}
producerCfg := sarama.NewConfig()
producerCfg.Producer.Return.Successes = true
producer, err := sarama.NewSyncProducer(
cfg.Brokers,
producerCfg,
)
if err != nil {
return nil, errors.T... | [
0.5984833836555481,
-0.09087899327278137,
0.4903554618358612,
0.6821688413619995,
-1.1464366912841797,
-0.31952252984046936,
1.0779732465744019,
-0.20042283833026886,
-1.0769785642623901,
0.47791174054145813,
-0.43293771147727966,
0.7381322383880615,
0.11413673311471939,
-0.323112636804580... |
func (c *Client) Name() string {
return "shopify-sarama"
} | [
-0.4793913662433624,
-0.10418058931827545,
0.4264376163482666,
0.2802269756793976,
-0.6685506701469421,
-0.18696480989456177,
0.6913416385650635,
-0.7832517027854919,
0.27502667903900146,
1.0292574167251587,
-0.8637356758117676,
0.3216940462589264,
0.13529255986213684,
-0.18991123139858246... |
func (c *Client) Produce(buff []byte) error {
deliveryChan := make(chan error)
go func() {
_, _, err := c.producer.SendMessage(
&sarama.ProducerMessage{
Topic: c.Topic,
Value: sarama.ByteEncoder(buff),
},
)
deliveryChan <- err
}()
select {
case err := <-deliveryChan:
if err != nil {
retu... | [
-0.2138945311307907,
1.0468170642852783,
0.4443892538547516,
0.21700595319271088,
0.31951114535331726,
-0.08381962776184082,
0.36931169033050537,
-1.2840877771377563,
0.2909686267375946,
0.16748498380184174,
-0.3905603289604187,
0.5350253582000732,
-0.8034645318984985,
0.15162000060081482,... |
func (c *Client) Close() error {
return errors.Trace(c.producer.Close())
} | [
-0.1254071444272995,
0.223178431391716,
0.2665613293647766,
0.2293011099100113,
-0.31062397360801697,
0.38901591300964355,
0.9921449422836304,
-0.9035884141921997,
-0.7889020442962646,
-0.09602176398038864,
0.5437924861907959,
0.538806140422821,
-0.9766900539398193,
-0.10743408650159836,
... |
func CheckAuth(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if auth.IsLoggedIn(r) {
next.ServeHTTP(w, r)
return
}
if strings.HasPrefix(r.URL.Path, "/api") {
common.NewAPIResponse("Login required", nil).WriteResponse(w, http.StatusUnauthorized)... | [
-0.9515626430511475,
-0.5517837405204773,
0.5704873204231262,
0.9517564177513123,
-0.22066956758499146,
0.741057813167572,
0.6367391347885132,
0.8928484916687012,
0.814180850982666,
-0.14311300218105316,
0.3232656419277191,
0.4863899350166321,
0.08430791646242142,
0.45525601506233215,
0.... |
func Handle(req []byte) []byte {
start := time.Now()
shouldValidate := os.Getenv("validate_hmac")
payloadSecret, secretErr := sdk.ReadSecret("payload-secret")
if secretErr != nil {
return []byte(secretErr.Error())
}
if len(shouldValidate) > 0 && (shouldValidate == "1" || shouldValidate == "true") {
cloudHe... | [
0.46537432074546814,
0.9959526062011719,
1.1618574857711792,
0.6332981586456299,
1.0107396841049194,
0.27549242973327637,
0.31622567772865295,
-0.30527591705322266,
-0.7613694071769714,
-0.008957111276686192,
0.10799062997102737,
-0.003071421990171075,
-0.13924172520637512,
1.1055753231048... |
func findStackFile(pushEvent *sdk.PushEvent) (bool, error) {
// If using a private repo the file will not be available via the git-raw CDN
if pushEvent.Repository.Private {
return true, nil
}
addr, err := getRawURL(pushEvent.SCM, pushEvent.Repository.RepositoryURL, pushEvent.Repository.Owner.Login, pushEvent.Re... | [
-0.027271131053566933,
0.946241021156311,
1.097717523574829,
-0.2372632473707199,
0.27808570861816406,
-0.04250243678689003,
-0.10673660039901733,
0.06028197333216667,
-1.2644506692886353,
0.2711166739463806,
-0.41894248127937317,
-0.29405471682548523,
-0.5614895224571228,
0.88290947675704... |
func RequiresReplaceIfConfigured() planmodifier.List {
return RequiresReplaceIf(
func(_ context.Context, req planmodifier.ListRequest, resp *RequiresReplaceIfFuncResponse) {
if req.ConfigValue.IsNull() {
return
}
resp.RequiresReplace = true
},
"If the value of this attribute is configured and chang... | [
-0.28098782896995544,
-0.14305879175662994,
0.27828383445739746,
-0.5679582357406616,
0.6578277945518494,
-0.29770222306251526,
0.22255322337150574,
0.37873077392578125,
1.0027456283569336,
0.3395256996154785,
-0.6717042326927185,
-0.5743995904922485,
0.5589873790740967,
1.3235538005828857... |
func createCheckText(text string) string {
// Always lower case the string so we don't need case-insensitive regex's
newText := strings.ToLower(text)
// Space out anything that we shouldn't search...
// URL's
newText = xurls.Strict.ReplaceAllStringFunc(newText, func(toRep string) string {
return strings.Repeat... | [
0.3338996171951294,
-0.3774653971195221,
0.43157458305358887,
-0.10467550158500671,
-0.08155413717031479,
-0.06963767111301422,
-0.6820841431617737,
0.48155707120895386,
0.4433470368385315,
0.09578704833984375,
-0.03401709720492363,
-0.2535078823566437,
-1.0515631437301636,
0.3838471770286... |
func NewFileMap(filename string) (*FileMap, error) {
bufb, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
buf := string(bufb)
fm := FileMap{
Filename: filename,
Text: buf,
CheckText: createCheckText(buf),
Lines: make([]lineEntry, 0, (len(buf)/32)+1),
}
// create lines
b... | [
0.010639998130500317,
-1.2486004829406738,
0.467878133058548,
-0.2535858452320099,
-0.7551859021186829,
0.1720839887857437,
0.04451877251267433,
0.18792855739593506,
-0.14167168736457825,
-0.49749675393104553,
-0.038957372307777405,
-0.016783570870757103,
-0.10143459588289261,
0.3688800930... |
func (fm *FileMap) FindOffset(offset int) (int, int) {
if offset < 1 {
return 0, 0
}
if offset >= len(fm.Text)-1 {
r := len(fm.Lines) - 1
c := fm.Lines[r].end - fm.Lines[r].start
return r, c
}
// Find smallest index such that offset occurs before the end of the line
idx := sort.Search(len(fm.Lines), fun... | [
-0.09907887130975723,
-1.0036035776138306,
0.8394127488136292,
-0.9125389456748962,
-1.1191799640655518,
-0.24139399826526642,
0.5074800252914429,
-0.30170977115631104,
-0.6812782883644104,
-0.2141469269990921,
0.6070267558097839,
-0.05204576998949051,
-0.6974920630455017,
0.84445530176162... |
func (*PrereqRequest) Descriptor() ([]byte, []int) {
return file_prereqInterface_proto_rawDescGZIP(), []int{0}
} | [
-1.2773584127426147,
0.3951648473739624,
0.5004122853279114,
-0.2489296942949295,
-0.09541347622871399,
-0.23409220576286316,
0.7079349756240845,
0.19254039227962494,
-0.36518025398254395,
-0.9372743964195251,
-0.012037510983645916,
0.24930371344089508,
0.14204177260398865,
1.4355503320693... |
func (*PrereqResponse) Descriptor() ([]byte, []int) {
return file_prereqInterface_proto_rawDescGZIP(), []int{1}
} | [
-0.7849581241607666,
0.053009770810604095,
0.1568501740694046,
-0.37704983353614807,
0.24959799647331238,
-0.6777050495147705,
1.2582143545150757,
-0.03709065541625023,
-0.06915180385112762,
-0.9639610648155212,
-0.6354960799217224,
-0.4731943607330322,
-0.6442558765411377,
0.3229243457317... |
func IfAndFor() *gas.C {
root := &IfAndForRoot{
Show: false,
Arr: []string{"click", "here", "if you want to see some magic"},
}
c := &gas.C{
Root: root,
NotPointer: true,
}
root.c = c
return c
} | [
0.618981659412384,
-0.24508927762508392,
0.36660853028297424,
-0.0420498251914978,
-0.7211999893188477,
-0.6733691096305847,
0.18538717925548553,
0.1342848390340805,
-0.37783685326576233,
-1.3677494525909424,
0.7460808157920837,
0.5280814170837402,
0.5826634168624878,
1.2121719121932983,
... |
func (role Role) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, role.ID)), nil
} | [
0.04270050302147865,
-0.17701192200183868,
0.2588336765766144,
-1.0860596895217896,
-0.07954201847314835,
-0.25729018449783325,
-0.9815407991409302,
0.04274311289191246,
0.9861878156661987,
0.5765705108642578,
-0.4046027362346649,
0.883062481880188,
-0.7298074960708618,
0.644119918346405,
... |
func (role *Role) UnmarshalJSON(bytes []byte) error {
var id string
err := json.Unmarshal(bytes, &id)
if err != nil {
return err
}
if r, ok := Roles[id]; ok {
role.ID = r.ID
role.rank = r.rank
role.LegacyList = r.LegacyList
return nil
}
return fmt.Errorf("unable to find role with id %s", string(id))
} | [
-0.36894217133522034,
-0.30853721499443054,
0.21562789380550385,
-1.7134311199188232,
0.04355346038937569,
-0.3265652358531952,
-0.4134629964828491,
0.5013264417648315,
0.8635619878768921,
0.5394373536109924,
-0.42558926343917847,
0.2924131453037262,
-0.5845718383789062,
0.4190259277820587... |
func ParseGitLog(text string) []*Commit {
var answer []*Commit
lines := strings.Split(text, "\n")
buf := strings.Builder{}
var c *Commit
for _, line := range lines {
if strings.HasPrefix(line, commitPrefix) {
if buf.Len() > 0 && c != nil {
c.Comment = strings.TrimSuffix(buf.String(), "\n")
}
buf.Res... | [
0.8253698348999023,
-0.39416980743408203,
1.002859354019165,
-0.588611900806427,
-0.5226486921310425,
-0.275083065032959,
-0.23830680549144745,
-0.1495753675699234,
-0.3068108856678009,
0.666286289691925,
0.13523146510124207,
-0.06566733866930008,
-0.1317385733127594,
0.245461568236351,
... |
func download(c *king.Config, args []string) error {
var fn bool
do := new(king.DownloadOptions)
pf := pflag.NewFlagSet("", pflag.ExitOnError)
pf.BoolVarP(&do.Overwrite, "force", "f", false, "")
pf.BoolVarP(&fn, "no-bar", "n", false, "")
pf.SetInterspersed(true)
pf.Usage = func() {
fmt.Fprintln(os.Stderr,... | [
-0.37322378158569336,
0.33839330077171326,
1.084319829940796,
0.7589884400367737,
0.23156730830669403,
0.04817673936486244,
0.5099669694900513,
0.07298593968153,
-0.3735474944114685,
0.042812880128622055,
0.24217893183231354,
-0.2129736691713333,
-0.13698464632034302,
1.60939621925354,
-... |
func WalkOrig(v cue.Value, before func(cue.Value) bool, after func(cue.Value), options ...cue.Option) {
// call before and possibly stop recursion
if before != nil && !before(v) {
return
}
// possibly recurse
switch v.IncompleteKind() {
case cue.StructKind:
if options == nil {
options = defaultWalkOption... | [
-0.07692722231149673,
0.15116192400455475,
0.6513434052467346,
-0.22589661180973053,
-0.21045510470867157,
0.7452725172042847,
0.69317626953125,
0.3626101016998291,
-0.6212281584739685,
0.1014644131064415,
-0.3601799011230469,
0.3448261320590973,
-0.278603196144104,
0.9589616060256958,
-... |
func GetRandomHead() rune {
return heads[rand.Intn(len(heads))]
} | [
-0.36107391119003296,
-0.33459171652793884,
0.3794226348400116,
0.21970084309577942,
-0.15656302869319916,
0.3626556992530823,
-0.5112062096595764,
-0.815447211265564,
0.7320901155471802,
-0.36471885442733765,
-0.2062803953886032,
1.0887430906295776,
-0.5482981204986572,
-0.667364716529846... |
func GetRandomTexture() (rune, rune) {
randomTexture := textures[rand.Intn(len(textures))]
return randomTexture.leftRune, randomTexture.rightRune
} | [
0.13546660542488098,
-0.6261423230171204,
0.4160621464252472,
-0.7422175407409668,
-0.6578383445739746,
-0.22868651151657104,
0.17262043058872223,
-0.09767165035009384,
0.7701737880706787,
-0.49005022644996643,
-0.46698760986328125,
0.3075205981731415,
-1.1956933736801147,
0.45303446054458... |
func RandomDirection() Direction {
return directions[rand.Intn(len(directions))]
} | [
-0.9005669355392456,
-0.4838295876979828,
0.1381559669971466,
-0.2548118531703949,
0.04778430983424187,
0.542984127998352,
0.5090650916099548,
-0.1291547417640686,
1.6055243015289307,
-0.9553716778755188,
-0.48330894112586975,
0.438221275806427,
-0.7499852776527405,
0.3836957812309265,
-... |
func (current Direction) IsOpposite(new Direction) bool {
return current.VX+new.VX == 0 && current.VY+new.VY == 0
} | [
-0.9384363889694214,
-0.9999575614929199,
0.5574221611022949,
-0.017546601593494415,
-0.013343088328838348,
-0.5090689063072205,
-1.1100002527236938,
-0.07752189040184021,
0.6995534300804138,
0.9488438963890076,
0.3486939072608948,
-1.197176218032837,
-1.0396932363510132,
0.316041499376297... |
func (current Direction) Opposite() Direction {
switch current {
case Up:
return Down
case Down:
return Up
case Left:
return Right
case Right:
return Left
}
return current
} | [
-1.8739075660705566,
-0.3090004622936249,
0.4996727406978607,
-0.11444678902626038,
-0.35419538617134094,
0.8685379028320312,
-0.049457285553216934,
0.34221434593200684,
-0.21329237520694733,
-0.27871349453926086,
-0.14133378863334656,
-0.31987351179122925,
-1.0194828510284424,
0.041543096... |
func (snake *Snake) GetHeadCoords() Coords {
if len(snake.Body) > 0 {
return snake.Body[0]
}
return Coords{}
} | [
-0.6893548965454102,
-0.019172536209225655,
0.7244622707366943,
0.25096333026885986,
0.22661390900611877,
-0.047202277928590775,
-0.46626463532447815,
-1.406982421875,
0.8394688367843628,
-0.40532928705215454,
-0.539242148399353,
0.6375926733016968,
-1.2043331861495972,
-0.2203635722398758... |
func (snake *Snake) Update(lvl LevelMap) {
snake.StepSize += snake.Speed
if snake.StepSize >= 12 {
snake.StepSize = 0
head := snake.GetHeadCoords()
snake.Direction = snake.NextDirection
newCoords := lvl.GetCoords(head.X+snake.Direction.VX, head.Y+snake.Direction.VY)
if len(snake.Body) < snake.TargetL... | [
-0.5210601091384888,
-0.7819970846176147,
0.6750317811965942,
-0.9032808542251587,
0.056510601192712784,
0.1971040964126587,
-0.48102816939353943,
-0.2338414192199707,
0.5356419682502747,
0.36778196692466736,
-0.48774150013923645,
0.6324347257614136,
-0.8781771659851074,
0.5224208235740662... |
func StringToDirection(s string) Direction {
switch {
case s == "up":
return Up
case s == "down":
return Down
case s == "left":
return Left
case s == "right":
return Right
}
return Direction{}
} | [
-0.5013700127601624,
-1.5236060619354248,
0.4105614721775055,
-0.4156288802623749,
-0.4198838174343109,
0.35443398356437683,
0.31630685925483704,
-0.20385625958442688,
0.31069132685661316,
-0.28263014554977417,
-0.8663268089294434,
0.42982301115989685,
-0.2473725974559784,
-0.4208046495914... |
func ClaculateSnakeBody(x, y, length int, direction Direction, lvl LevelMap) []Coords {
body := []Coords{}
for i := 0; i < length; i++ {
body = append(body, lvl.GetCoords(x+direction.Opposite().VX*i, y+direction.Opposite().VY*i))
}
return body
} | [
-0.512666642665863,
-0.3786185681819916,
0.6733614802360535,
-0.6792556047439575,
-0.04604552313685417,
-0.3099064826965332,
-0.7903217077255249,
-0.9534416198730469,
0.46782997250556946,
0.7326014041900635,
-1.0157337188720703,
0.3892030119895935,
-0.06986719369888306,
0.3362269699573517,... |
func newUpgrade010(a app.App, out io.Writer, pl PackageLister) *upgrade010 {
return &upgrade010{
app: a,
out: out,
packageLister: pl,
}
} | [
0.07507963478565216,
-1.5835819244384766,
0.010593941435217857,
0.593812108039856,
-0.7764754295349121,
-0.6271026730537415,
-0.5354599356651306,
0.1663462072610855,
1.0871559381484985,
0.44488149881362915,
-0.3354325294494629,
-0.41633278131484985,
-0.08527729660272598,
0.9275996088981628... |
func (u *upgrade010) Upgrade(dryRun bool) error {
if u == nil {
return errors.New("nil receiver")
}
if u.app == nil {
return errors.New("nil app")
}
if err := u.checkForOldKSLibLocation(dryRun); err != nil {
return errors.Wrapf(err, "upgrading kslib location")
}
if u.packageLister == nil {
return error... | [
-0.8395997285842896,
-0.49665510654449463,
0.5445938110351562,
0.9513131380081177,
0.19487401843070984,
0.10255871713161469,
0.06010767072439194,
0.5033866167068481,
0.620462954044342,
0.3652958571910858,
0.11831465363502502,
-0.07218565791845322,
-0.06356610357761383,
0.7792276740074158,
... |
func (u *upgrade010) upgradeOldVendoredPackages(pl PackageLister, dryRun bool) error {
if u == nil {
return errors.Errorf("nil receiver")
}
if u.app == nil {
return errors.Errorf("nil app")
}
fs := u.app.Fs()
if fs == nil {
return errors.Errorf("nil filesystem interface")
}
if pl == nil {
return errors.... | [
-0.8449562788009644,
-0.6672123074531555,
0.7659623622894287,
0.0678875595331192,
-0.3352060616016388,
0.45787128806114197,
0.4115108549594879,
0.09563235938549042,
0.3983951210975647,
0.8178477883338928,
-0.1562686711549759,
0.00354001484811306,
0.14701925218105316,
0.6412711143493652,
... |
func (*upgrade010) upgradeEnvTargets(listerUpdater envListerUpdater, dryRun bool) error {
if listerUpdater == nil {
return errors.New("nil envListerUpdater")
}
targets := make(map[string][]string)
envs, err := listerUpdater.Environments()
if err != nil {
return errors.Wrap(err, "fetching environments")
}
f... | [
-1.2474418878555298,
-0.8669844269752502,
0.714036762714386,
0.2788897454738617,
0.1746872216463089,
-0.1602952778339386,
-0.48395028710365295,
-0.21225544810295105,
0.131136953830719,
0.8698180317878723,
0.3376583158969879,
0.5674352049827576,
-0.26273348927497864,
1.472917914390564,
0.... |
func allLibraries(a app.App) (app.LibraryConfigs, error) {
if a == nil {
return nil, errors.Errorf("nil receiver")
}
combined := app.LibraryConfigs{}
libs, err := a.Libraries()
if err != nil {
return nil, errors.Wrapf(err, "checking libraries")
}
for _, lib := range libs {
combined[lib.Name] = lib
}
e... | [
0.26331499218940735,
-0.5198201537132263,
0.5132264494895935,
0.364956259727478,
-0.46855252981185913,
0.301327109336853,
-0.5427119731903076,
-0.4138965606689453,
0.8217563033103943,
0.5050721168518066,
0.8118816018104553,
-0.7137517929077148,
-0.12148777395486832,
1.537665605545044,
0.... |
func (u *upgrade010) CheckUpgrade() (bool, error) {
if u == nil {
return false, errors.Errorf("nil reciever")
}
var needUpgrade bool
legacyPkgs, err := u.checkUpgradeVendoredPackages()
if err != nil {
return false, err
}
if len(legacyPkgs) > 0 {
logrus.Warnf("Versioned packages stored in unversioned pat... | [
-1.1183576583862305,
-0.2972917854785919,
0.9265186190605164,
0.9993499517440796,
-0.20869530737400055,
-0.08263178914785385,
-0.8622746467590332,
0.5313376188278198,
0.08463224023580551,
0.40942639112472534,
-0.39777636528015137,
-0.6265310049057007,
-0.5803036093711853,
0.620591759681701... |
func (u *upgrade010) checkUpgradeVendoredPackages() ([]pkg.Package, error) {
if u == nil {
return nil, errors.Errorf("nil receiver")
}
a := u.app
if a == nil {
return nil, errors.Errorf("nil app")
}
fs := a.Fs()
if fs == nil {
return nil, errors.Errorf("nil filesystem interface")
}
pkgs, err := u.packag... | [
-0.5262886881828308,
-0.46650707721710205,
0.7307631373405457,
0.7149577736854553,
0.20350812375545502,
0.3698660135269165,
0.05475935339927673,
0.4739316999912262,
0.918323278427124,
0.7700855731964111,
0.09532507508993149,
-0.2916643023490906,
-0.7702819108963013,
1.104749083518982,
-0... |
func NewEventPolicyRPCHandler(memDb *memdb.Memdb, logger log.Logger) (*EventPolicyRPCHandler, error) {
return &EventPolicyRPCHandler{policyDb: memDb, logger: logger}, nil
} | [
0.995194673538208,
-0.8822776079177856,
0.3208029270172119,
-0.5973790884017944,
-0.24837304651737213,
0.488728791475296,
0.2416221648454666,
0.25855743885040283,
-0.1314280480146408,
0.13227878510951996,
-0.36533692479133606,
0.003216222394257784,
-1.6497958898544312,
0.10317190736532211,... |
func (e *EventPolicyRPCHandler) WatchEventPolicy(in *api.ObjectMeta, stream emgrpc.EventPolicyAPI_WatchEventPolicyServer) error {
e.logger.Infof("watch event policy from [%v]", in.Name)
// watch for changes
watcher := memdb.Watcher{Name: "event-policy"}
watcher.Channel = make(chan memdb.Event, memdb.WatchLen)
def... | [
0.5486217737197876,
-1.3356640338897705,
0.8397806286811829,
-0.6564338803291321,
0.5116760730743408,
0.9410352110862732,
0.4870825707912445,
-0.11415684223175049,
0.08579474687576294,
0.8807176351547241,
-0.5838646292686462,
0.6931213140487671,
-0.08502567559480667,
0.7879666090011597,
... |
func NewMiddleware(ctx Context, command string) (Middleware, error) {
if command == "" {
return nil, nil
}
ctx.Logger = ctx.Logger.With().
Str(LoggerKeyComponent, "middleware").
Str("command", command).
Logger()
cmd := exec.CommandContext(ctx.StdContext, command)
cmd.Stderr = &logWrapper{
l: ctx.Logger... | [
0.0650995522737503,
-0.8699697256088257,
0.9336332678794861,
0.23531711101531982,
-1.1107258796691895,
-0.26769235730171204,
-0.4804283380508423,
-0.48856279253959656,
0.27971071004867554,
0.2039569467306137,
0.851049542427063,
0.7507447600364685,
-1.0896271467208862,
1.2184895277023315,
... |
func (m *mware) Start() error {
if err := m.cmd.Start(); err != nil {
return fmt.Errorf("failed to start middleware command: %w", err)
}
return nil
} | [
0.15829308331012726,
-0.3201138973236084,
0.3713018000125885,
0.09278757870197296,
-0.226803258061409,
0.1284080594778061,
0.342584490776062,
0.22139529883861542,
-0.41161057353019714,
0.3300606310367584,
0.14404821395874023,
1.3420199155807495,
-0.9198796153068542,
1.9371774196624756,
0... |
func (m *mware) Wait() error {
return m.cmd.Wait()
} | [
-0.11617844551801682,
-0.346133291721344,
0.19582678377628326,
-0.28353288769721985,
0.7047963738441467,
0.7874358892440796,
0.8938879370689392,
-0.49759286642074585,
-0.8697513341903687,
-0.9983077049255371,
0.2596273422241211,
0.6669353246688843,
-0.5206423401832581,
1.8620558977127075,
... |
func (m *mware) Close() {
m.stdout.Close()
} | [
0.5507189035415649,
-0.5956743359565735,
0.5753608345985413,
-0.16388826072216034,
-1.0077272653579712,
0.776948094367981,
0.8776103258132935,
-1.0049104690551758,
-1.1153994798660278,
-0.6313002705574036,
1.3595675230026245,
0.7739406228065491,
-1.4645861387252808,
2.6811020374298096,
0... |
func (m *mware) Exec(ctx Context, header []byte, n interface{}) (interface{}, error) {
m.mu.Lock()
defer m.mu.Unlock()
if m.scanner == nil {
m.scanner = bufio.NewScanner(m.stdout)
ctx.Logger.Debug().Msg("scanner created")
}
if len(header) > 0 {
m.stdin.Write(header)
m.stdin.Write([]byte{' '})
}
err :=... | [
-0.14836598932743073,
-0.15274293720722198,
1.1349869966506958,
-0.06838403642177582,
-1.1578571796417236,
-0.22901983559131622,
-0.41570547223091125,
-0.7484051585197449,
-0.5499098896980286,
0.203832745552063,
-0.11678147315979004,
0.29721978306770325,
-0.3931589424610138,
0.633792519569... |
func Spy(name string) Gob {
return &spy{name: name, callThroughCondition: "", shouldExport: true}
} | [
0.37650710344314575,
0.17913123965263367,
0.29840120673179626,
0.569727897644043,
-1.2163667678833008,
-0.1296672821044922,
-0.4972061216831207,
-0.6621593236923218,
-0.05255690589547157,
0.7142131924629211,
-1.289269208908081,
0.057508617639541626,
-0.46125727891921997,
-0.305675595998764... |
func ShallowSpy(name string) Gob {
return &spy{name: name, callThroughCondition: "", shouldExport: false}
} | [
0.22167932987213135,
-0.30044710636138916,
0.3507835268974304,
-0.5568243861198425,
-0.6210377216339111,
-0.14972399175167084,
-0.432603120803833,
-0.39000341296195984,
0.23091064393520355,
0.008780772797763348,
-0.7504824995994568,
0.5968528389930725,
-0.6350347995758057,
0.31619459390640... |
func SpyAndCallThrough(name string) Gob {
return &spy{name: name, callThroughCondition: unconditionalCallthrough, shouldExport: true}
} | [
0.4911433756351471,
-0.4932674169540405,
0.24718064069747925,
0.007056893315166235,
-1.5429606437683105,
-0.03833606466650963,
-0.46271219849586487,
-0.5902306437492371,
1.0638442039489746,
0.05759555101394653,
-0.5196468234062195,
0.28878530859947205,
0.14115159213542938,
1.07143366336822... |
func ShallowSpyAndCallThrough(name string) Gob {
return &spy{name: name, callThroughCondition: unconditionalCallthrough, shouldExport: false}
} | [
0.5352846384048462,
-0.002408763160929084,
0.4143608510494232,
-0.5942516326904297,
-1.2361527681350708,
0.5063438415527344,
-0.05710775777697563,
-0.00364578771404922,
1.2170711755752563,
-0.14625027775764465,
0.08964292705059052,
0.7140575051307678,
0.461222767829895,
0.8517879247665405,... |
func SpyAndConditionallyCallThrough(name string, callThroughCondition string) Gob {
return &spy{name: name, callThroughCondition: callThroughCondition, shouldExport: true}
} | [
1.0097613334655762,
-0.3445122241973877,
0.27607962489128113,
-0.0716114267706871,
-1.6018223762512207,
0.11730174720287323,
-0.48489639163017273,
-0.652816891670227,
0.6929945349693298,
0.42448723316192627,
-0.4168562591075897,
0.4938797652721405,
0.2243839055299759,
0.802372395992279,
... |
func ShallowSpyAndConditionallyCallThrough(name string, callThroughCondition string) Gob {
return &spy{name: name, callThroughCondition: callThroughCondition, shouldExport: false}
} | [
0.804653525352478,
-0.3534590005874634,
0.29455167055130005,
-0.5009507536888123,
-1.2045514583587646,
0.3479342460632324,
0.10846405476331711,
-0.1955612301826477,
0.772709310054779,
0.20207341015338898,
-0.24076144397258759,
1.0930380821228027,
0.29127904772758484,
0.9590544104576111,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.