text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func logger(lp *LogFile, ready chan (bool)) {
// flushChan will be nil unless FlushSeconds > 0
// Note that a negative FlushSeconds is handled in writeLog
var flushChan <-chan time.Time
if lp.FlushSeconds > 0 {
flushTicker := time.NewTicker(time.Second * time.Duration(lp.FlushSeconds))
defer flushTicker.Stop()
... | [
-0.34495827555656433,
-0.8871421217918396,
0.8362412452697754,
-0.475946307182312,
0.16200901567935944,
0.11988091468811035,
0.43304774165153503,
0.04696839302778244,
-0.18838144838809967,
-0.2495477944612503,
0.324942946434021,
-0.25642824172973633,
-0.35404476523399353,
1.431958079338073... |
func (lp *LogFile) openLogFile(truncated bool) bool {
lp.closeLog()
var err error
flags := os.O_RDWR | os.O_CREATE
if truncated {
flags = flags | os.O_TRUNC
} else {
flags = flags | os.O_APPEND
}
lp.file, err = os.OpenFile(lp.FileName, flags, lp.FileMode)
if err != nil {
lp.PrintError("LogFile failed t... | [
0.2113456130027771,
-0.19283396005630493,
0.9945961236953735,
-0.8658751249313354,
-0.2704731523990631,
1.0301403999328613,
0.5809127688407898,
0.699907660484314,
-0.7357283234596252,
-0.6194931268692017,
-0.7454595565795898,
-0.7740662097930908,
-1.0193891525268555,
0.1586047112941742,
... |
func (lp *LogFile) writeLog(p []byte) {
fileOnly := lp.Flags&FileOnly == FileOnly
if !fileOnly {
_, err := os.Stderr.Write(p)
if err != nil {
// Well I can't write to stderr to report it... so just return
return
}
}
if lp.file == nil {
return
}
// Am I about to go over my file size limit?
if lp.... | [
0.20352627336978912,
0.3973132371902466,
0.750645637512207,
0.32209694385528564,
0.27004170417785645,
1.1308343410491943,
0.6902530193328857,
0.7790244817733765,
-0.2709452211856842,
-0.35459277033805847,
-0.02988051436841488,
-0.4853866696357727,
-0.6783782839775085,
0.3046112358570099,
... |
func (lp *LogFile) rotateLog() {
if lp.RotateFileFunc == nil {
return
}
lp.closeLog()
lp.RotateFileFunc()
lp.openLogFile(noTruncateLog)
} | [
0.4657922089099884,
0.041785359382629395,
0.2710665464401245,
0.17008326947689056,
0.4410402476787567,
0.4195491671562195,
1.1268864870071411,
0.7058829665184021,
-0.5410783290863037,
-0.5029305219650269,
0.02438799850642681,
0.46562033891677856,
-0.4444538354873657,
0.0965932235121727,
... |
func (lp *LogFile) flushLog() {
if lp.file == nil {
return
}
err := lp.buf.Flush()
if err != nil {
lp.PrintError("LogFile error flushing %s: %s\n", lp.FileName, err)
}
} | [
1.1110361814498901,
0.2178763598203659,
0.2388952672481537,
0.3291923403739929,
0.19930250942707062,
1.28223717212677,
0.8538110852241516,
0.3525288701057434,
-0.9889097213745117,
-0.2402639389038086,
0.17881837487220764,
0.4352685213088989,
-0.06896646320819855,
0.7928577661514282,
0.17... |
func (lp *LogFile) vanishedLog() {
_, err := os.Stat(lp.FileName)
if err == nil {
return
}
// Close and reopen the file
lp.closeLog()
lp.openLogFile(noTruncateLog)
} | [
1.3770447969436646,
-0.3015892803668976,
0.2725456953048706,
-0.2659762501716614,
0.09282707422971725,
1.048237919807434,
0.5190311670303345,
1.1482688188552856,
-0.39234456419944763,
-0.39703091979026794,
-0.42058447003364563,
0.3674551248550415,
-0.17293012142181396,
0.6784684658050537,
... |
func (lp *LogFile) closeLog() {
if lp.file == nil {
return
}
lp.flushLog()
err := lp.file.Close()
if err != nil {
lp.PrintError("LogFile error closing %s: %s\n", lp.FileName, err)
}
lp.file = nil
} | [
0.8504929542541504,
-0.010682606138288975,
0.4036669135093689,
-0.17638224363327026,
-0.11819307506084442,
1.2209933996200562,
0.8195517063140869,
0.26420921087265015,
-0.9239792823791504,
-0.4766504168510437,
0.6224485635757446,
-0.014407895505428314,
-0.19212381541728973,
0.6990299820899... |
func FileNameVersion(fileName string, v int) string {
if v == 0 {
return fileName
}
return fmt.Sprintf("%s.%d", fileName, v)
} | [
0.2623315453529358,
-1.2058470249176025,
0.5299245119094849,
-0.10787539184093475,
-0.3842579424381256,
0.07510910928249359,
-0.20767514407634735,
0.6460306644439697,
-0.3703055679798126,
0.5804886221885681,
0.5627365112304688,
0.19213472306728363,
0.6159332990646362,
0.538354218006134,
... |
func (lp *LogFile) RotateFileFuncDefault() {
if lp.OldVersions <= 0 {
return
}
// Delete the oldest
oldFileName := FileNameVersion(lp.FileName, lp.OldVersions)
_, err := os.Stat(oldFileName)
if err == nil {
err := os.Remove(oldFileName)
if err != nil {
lp.PrintError("LogFile error removing old file %s: ... | [
0.4760807156562805,
-0.5804154872894287,
1.0506584644317627,
-0.5743708610534668,
1.5033283233642578,
-0.03959624841809273,
0.47004932165145874,
0.2709924280643463,
-1.0617886781692505,
0.4426281750202179,
0.055232979357242584,
0.36559802293777466,
-0.3983484208583832,
-0.12454714626073837... |
func (lp *LogFile) RotateFile() {
lp.messages <- logMessage{action: rotateLog}
} | [
0.780097246170044,
-0.45154130458831787,
0.37340039014816284,
-0.31825217604637146,
1.3705246448516846,
0.3984599709510803,
0.6075629591941833,
0.14510385692119598,
-1.2955800294876099,
-0.13350209593772888,
0.1644287109375,
1.1372804641723633,
-1.2508577108383179,
0.026612868532538414,
... |
func (lp *LogFile) Flush() {
complete := make(chan bool)
lp.messages <- logMessage{action: flushLog, complete: complete}
<-complete
} | [
0.3799150884151459,
-0.3755527138710022,
0.36412838101387024,
-0.5883501768112183,
0.6255326867103577,
0.9256218075752258,
0.610795259475708,
-0.513558030128479,
-1.0826164484024048,
-0.10865230858325958,
-0.039230406284332275,
0.9653892517089844,
-0.6398904919624329,
1.235695719718933,
... |
func (lp *LogFile) Write(p []byte) (n int, err error) {
// LogFile cannot guarantee that it will have finished with p before this
// function returns. To prevent corruption use a copy of p.
pLen := len(p)
buf := make([]byte, pLen)
copy(buf, p)
lp.messages <- logMessage{action: writeLog, data: buf}
if lp.FlushSe... | [
-0.3883938491344452,
0.6918363571166992,
0.589748203754425,
-0.13532494008541107,
0.19921821355819702,
0.4466986358165741,
0.16179677844047546,
-0.25277087092399597,
-0.5138722062110901,
0.2523302137851715,
-0.8996002674102783,
-0.035244375467300415,
-1.4538158178329468,
0.333918958902359,... |
func (lp *LogFile) Close() {
complete := make(chan bool)
lp.messages <- logMessage{action: closeLog, complete: complete}
// wait for the logfile to close
<-complete
} | [
0.38067910075187683,
-0.4283244013786316,
0.4786875247955322,
-0.7079809904098511,
0.16288846731185913,
1.1488441228866577,
0.4356190264225006,
-0.31854933500289917,
-1.57384192943573,
-0.49397310614585876,
0.16994616389274597,
-0.438495010137558,
-1.4507116079330444,
0.5386672616004944,
... |
func TestAggregateNodeMetricsEmpty(t *testing.T) {
var (
model = newRealModel(time.Minute)
c = make(chan error)
assert = assert.New(t)
)
// Invocation with empty model
go model.aggregateNodeMetrics(c, time.Now())
assert.NoError(<-c)
assert.Empty(model.Nodes)
assert.Empty(model.Metrics)
} | [
0.12202022969722748,
1.1168910264968872,
0.4994135797023773,
-0.4270053803920746,
1.532886028289795,
1.186167597770691,
0.5849037170410156,
-0.7262724041938782,
-1.2467962503433228,
-0.28587764501571655,
-0.0749179795384407,
0.4798741042613983,
-0.08421675860881805,
0.1367492526769638,
-... |
func TestAggregateNamespaceMetricsError(t *testing.T) {
var (
model = newRealModel(time.Minute)
c = make(chan error)
assert = assert.New(t)
)
// Invocation with nil namespace
go model.aggregateNamespaceMetrics(nil, c, time.Now())
assert.Error(<-c)
assert.Empty(model.Namespaces)
// Invocation for a ... | [
0.374532550573349,
1.0354746580123901,
0.602993369102478,
-0.13934971392154694,
0.9381213784217834,
0.6026090383529663,
-0.03981013968586922,
-1.130488395690918,
0.19507552683353424,
-0.2248152196407318,
0.3133349120616913,
0.3833341598510742,
-0.5498843193054199,
1.0276846885681152,
-0.... |
func TestAggregateMetricsNormal(t *testing.T) {
var (
model = newRealModel(time.Minute)
targetInfo = InfoType{
Metrics: make(map[string]*daystore.DayStore),
Labels: make(map[string]string),
}
srcInfo1 = InfoType{
Metrics: make(map[string]*daystore.DayStore),
Labels: make(map[string]string),
... | [
0.01369392592459917,
1.1170461177825928,
0.6650228500366211,
-0.8707045912742615,
0.5134608149528503,
0.6489793062210083,
-0.16927017271518707,
-0.5403033494949341,
-0.2863560914993286,
-0.1271963119506836,
0.05383675917983055,
-0.2371034026145935,
0.21751204133033752,
0.3868785500526428,
... |
func NewFilterManager() (m *FilterManager) {
m = &FilterManager{
filterNodes: make([]FilterNode, 0),
relatedFilterNodes: make([]FilterNode, 0),
upsFilterNodes: make([]FilterNode, 0),
}
defaultFilterNode := &DefaultFilterNode{}
bloomFilterNode := &BloomFilterNode{}
durationFilterNode := &DurationFi... | [
-0.6050819754600525,
0.1199546754360199,
0.6504247188568115,
-0.18951115012168884,
-0.16038194298744202,
-0.48676979541778564,
0.1230526715517044,
-0.6074876189231873,
0.43765881657600403,
-0.09621298313140869,
-0.3238818347454071,
1.0632673501968384,
-0.5082818865776062,
1.366380691528320... |
func AnalyzePhrase(phrase string) ([]Sentence, error) {
var outbuf, errbuf bytes.Buffer
cmd := exec.Command("linguakit", "dep", "es", phrase, "-s")
cmd.Stdout = &outbuf
cmd.Stderr = &errbuf
errorRunning := cmd.Run()
result := outbuf.String()
errorString := errbuf.String()
if errorRunning != nil {
return []... | [
-0.49475088715553284,
0.09005264937877655,
0.8127597570419312,
0.3600342273712158,
0.18048511445522308,
-0.5971021056175232,
-0.8356013894081116,
0.052280671894550323,
0.5181347131729126,
0.7754594087600708,
0.23240694403648376,
-0.6615486741065979,
-0.7001060843467712,
1.0471365451812744,... |
func randString(length int) string {
b := make([]rune, length)
for i := range b {
b[i] = runes[rand.Intn(len(runes))]
}
return string(b)
} | [
-0.15332907438278198,
0.9326579570770264,
0.1659957468509674,
-1.3644083738327026,
-0.20376236736774445,
0.5187615156173706,
0.05723286420106888,
-0.9021289944648743,
0.7646552324295044,
0.4086134433746338,
0.006892504636198282,
0.03960849344730377,
-0.7485978007316589,
-1.0494931936264038... |
func newQuerySorter(m map[string]string) *QuerySorter {
hs := &QuerySorter{
Keys: make([]string, 0, len(m)),
Vals: make([]string, 0, len(m)),
}
for k, v := range m {
hs.Keys = append(hs.Keys, k)
hs.Vals = append(hs.Vals, v)
}
return hs
} | [
-0.5717558860778809,
-0.30834755301475525,
0.3753480613231659,
-0.32829466462135315,
-1.5916380882263184,
-0.2660094201564789,
-1.2622437477111816,
-0.5538482069969177,
-0.6619267463684082,
-0.14131158590316772,
-0.26364338397979736,
-0.39422792196273804,
-0.6762815117835999,
0.68474870920... |
func (hs *QuerySorter) Sort() {
sort.Sort(hs)
} | [
-0.7439771294593811,
0.021344250068068504,
0.01331723015755415,
0.30360981822013855,
0.17981567978858948,
0.5235538482666016,
-0.011185682378709316,
-0.8650137186050415,
-1.0417131185531616,
-0.9246076941490173,
0.47811228036880493,
0.45088693499565125,
-0.7281999588012695,
2.0404028892517... |
func (hs *QuerySorter) Len() int {
return len(hs.Vals)
} | [
-0.32311874628067017,
0.4407798945903778,
-0.08669459819793701,
-0.40835070610046387,
0.054203666746616364,
0.08174753934144974,
0.3618708848953247,
0.38900259137153625,
-0.644485592842102,
-1.209464430809021,
-0.5309008359909058,
0.19625763595104218,
0.08554314076900482,
0.856278240680694... |
func (hs *QuerySorter) Less(i, j int) bool {
return bytes.Compare([]byte(hs.Keys[i]), []byte(hs.Keys[j])) < 0
} | [
-0.5977618098258972,
0.14931391179561615,
0.2499445676803589,
-0.9443548321723938,
-0.9519105553627014,
0.1695016324520111,
-0.7833878397941589,
-1.6728512048721313,
-0.6817139387130737,
-0.4411284923553467,
-0.8327101469039917,
-0.5392059087753296,
-1.3234061002731323,
0.37404030561447144... |
func (hs *QuerySorter) Swap(i, j int) {
hs.Vals[i], hs.Vals[j] = hs.Vals[j], hs.Vals[i]
hs.Keys[i], hs.Keys[j] = hs.Keys[j], hs.Keys[i]
} | [
-1.7496960163116455,
-0.026036735624074936,
0.1995534598827362,
-0.3760039210319519,
-0.2770645320415497,
0.2855580747127533,
-0.4214637279510498,
-0.2725840210914612,
-1.1702977418899536,
-0.5092273950576782,
-0.22847208380699158,
0.19413712620735168,
-0.01313538197427988,
-0.216991707682... |
func newSetupOptions() *SetupOptions {
return &SetupOptions{}
} | [
-0.3565591275691986,
-0.46107205748558044,
0.37285810708999634,
1.1881284713745117,
-0.6100301146507263,
-1.6412463188171387,
0.9535791277885437,
-0.7323501706123352,
0.4240280091762543,
0.704255223274231,
-1.1440726518630981,
-0.9330962896347046,
0.2178160548210144,
0.38387569785118103,
... |
func (o *SetupOptions) AddFlags(flagSet *pflag.FlagSet) {
// Add flags for generic options
flagSet.StringVarP(&o.LogLevel, "log-level", "l", "INFO", "log print level")
flagSet.StringVarP(&o.ConfigPath, "config", "c", "./cmd/client/conf/config-dev.toml", "init client by given config")
} | [
-0.4802948832511902,
0.24774451553821564,
0.5237239003181458,
-0.4449164867401123,
1.0118086338043213,
0.6870693564414978,
0.02827267348766327,
-0.8199328780174255,
-0.3431475758552551,
-0.5764195919036865,
0.6805185079574585,
-0.44303813576698303,
-0.06960443407297134,
0.931639552116394,
... |
func IntPtr(i int) *int {
return &i
} | [
0.3187655508518219,
-0.8448109030723572,
0.336531400680542,
-1.2072967290878296,
-1.35024094581604,
0.4446805715560913,
-0.25674504041671753,
-0.5537007451057434,
0.7879140377044678,
0.621433675289154,
1.243932843208313,
-0.1355677843093872,
-1.4122157096862793,
-0.5090100765228271,
1.53... |
func BoolPtr(b bool) *bool {
return &b
} | [
0.5048654675483704,
-0.055136874318122864,
0.23087099194526672,
-0.26578471064567566,
-0.5850686430931091,
0.7497426271438599,
-0.4392285645008087,
-0.15804339945316315,
-0.11349508911371231,
-0.0028173262253403664,
0.1967521607875824,
-0.5458070635795593,
-0.5241993069648743,
-0.929296910... |
func (f *Editor) Type() Format {
return EditorFormatName
} | [
-0.7307246327400208,
-0.7878214120864868,
0.1405945122241974,
-0.19024395942687988,
-0.17162317037582397,
-0.0054871076717972755,
0.15846595168113708,
-0.987354576587677,
0.2231532782316208,
-0.8223416209220886,
0.2356061488389969,
0.23591937124729156,
0.100836381316185,
1.378275752067566,... |
func (s *Scene) NewRoutine(name string, args ...string) *Routine {
r := NewRoutine(name, args...)
s.AddRoutine(r)
return r
} | [
0.26260504126548767,
0.08298451453447342,
0.3999745845794678,
0.02585449628531933,
-0.0448610857129097,
-0.8053080439567566,
-0.5014010667800903,
-0.7885717749595642,
0.04514628276228905,
-0.27747049927711487,
-0.8477957844734192,
-0.10876042395830154,
-1.0103590488433838,
0.08685193955898... |
func (s *Scene) AddRoutine(r *Routine) error {
if s.HasRoutine(r) {
return ErrRoutineExists
}
s.Routines = append(s.Routines, r)
return nil
} | [
-0.7504814267158508,
0.5763245820999146,
0.5157397985458374,
-0.2744896709918976,
0.566070020198822,
-0.006050674244761467,
-0.201884463429451,
-0.7702767848968506,
0.532736599445343,
-0.6602527499198914,
-0.6851914525032043,
-0.19897004961967468,
-0.8304165005683899,
0.8230457901954651,
... |
func (s *Scene) HasRoutine(r *Routine) bool {
for _, e := range s.Routines {
if e == r {
return true
}
}
return false
} | [
-0.05207303166389465,
0.29712945222854614,
0.6593616008758545,
-0.5511365532875061,
0.411293625831604,
-0.9668622612953186,
0.11391892284154892,
-0.22914455831050873,
0.1970449686050415,
0.027814099565148354,
-0.8939050436019897,
-0.4542885720729828,
-0.7797760963439941,
0.9217374920845032... |
func (s *Scene) GetRoutine(name string) (*Routine, error) {
for _, e := range s.Routines {
if e.Name == name {
return e, nil
}
}
return nil, ErrNoRoutineExists
} | [
-0.09019545465707779,
0.31193727254867554,
0.588775634765625,
-0.2113301306962967,
0.4915056526660919,
-1.4826821088790894,
0.1771075427532196,
-1.3320958614349365,
0.3142922520637512,
0.6254180073738098,
-0.31321704387664795,
0.3146836459636688,
-1.1055288314819336,
0.14941109716892242,
... |
func (s *Scene) Run(c *Crew) (*SceneRun, error) {
r := NewSceneRun(s, c)
r.Run()
return r, nil
} | [
-0.4841006100177765,
-0.5109856128692627,
0.1722676157951355,
-0.17652392387390137,
-0.27221617102622986,
-0.08908174932003021,
-0.2544502913951874,
-0.25914326310157776,
-0.23232302069664001,
-0.31210431456565857,
-1.4429452419281006,
0.4753914773464203,
-0.6577725410461426,
0.54805463552... |
func (n *nilCloser) Close() error {
// works even if n is nil
return nil
} | [
0.16079294681549072,
-0.1475207656621933,
0.4627044200897217,
0.21267835795879364,
-0.6281359791755676,
-0.1869974583387375,
-0.27495482563972473,
-0.6305112838745117,
-0.003916076384484768,
-0.8932225108146667,
0.7907741665840149,
-0.27937403321266174,
-1.2677868604660034,
2.1357617378234... |
func newFuncCloser(fn func() error) *funcCloser {
return &funcCloser{
fn: fn,
}
} | [
0.12473302334547043,
-0.8371031880378723,
0.19858743250370026,
0.14351531863212585,
-1.6592655181884766,
-0.54935222864151,
-0.36047324538230896,
-0.17180337011814117,
-0.648237943649292,
-0.7757946252822876,
0.8281420469284058,
-0.4250807464122772,
0.5538698434829712,
1.6005104780197144,
... |
func (f *funcCloser) Close() error {
return f.fn()
} | [
0.019880320876836777,
-0.6156918406486511,
0.4951139986515045,
0.5968394875526428,
-0.8272886276245117,
-0.14089947938919067,
0.41161713004112244,
-0.5963343977928162,
-0.6994882822036743,
-1.585178256034851,
1.2775589227676392,
-0.16097691655158997,
-0.014341224916279316,
0.82987064123153... |
func (mr MrImpl) Map(key, value string) (result []mapreduce.KeyValue) {
vals := strings.Split(value, " ")
if len(vals) != 3 {
return
}
numbers := strings.Split(vals[2], ",")
if len(numbers) != 6 {
fmt.Printf("wrong lotto results format: %s\n", vals[2])
return
}
result = make([]mapreduce.KeyValue, 0, 6)
... | [
-0.9912911057472229,
-0.20933063328266144,
0.6149681210517883,
-0.21436405181884766,
-0.6863608360290527,
-0.29284703731536865,
-0.45602381229400635,
0.5272144079208374,
0.3692966401576996,
0.4802394211292267,
0.076224185526371,
-0.6353175044059753,
0.5916631817817688,
-0.21633900701999664... |
func (mr MrImpl) Reduce(key string, values []string) string {
counter := 0
for _, v := range values {
val, err := strconv.Atoi(v)
if err != nil {
continue
}
counter += val
}
return fmt.Sprintf("%d", counter)
} | [
-1.0007623434066772,
0.730841338634491,
0.6837676763534546,
-0.8864191770553589,
0.08863407373428345,
-0.5387386083602905,
0.12276321649551392,
0.6238045692443848,
-0.5257834196090698,
0.5168128609657288,
0.3437778651714325,
-0.716625988483429,
-0.17182311415672302,
0.8240711092948914,
0... |
func aesDecryptBlock(key, ciphertext []byte) [16]byte {
if len(key) != 16 {
// assertion
panic("key has wrong length")
}
if len(ciphertext) != 16 {
// assertion
panic("ciphertext has wrong length")
}
cipher, err := aes.NewCipher(key)
if err != nil {
// assertion
panic(fmt.Sprintf("Unexpected error du... | [
0.051729317754507065,
0.3538147211074829,
0.7576874494552612,
-0.5257549285888672,
-0.2681486904621124,
0.5533865690231323,
-0.5315355062484741,
-0.18332359194755554,
0.09408048540353775,
-0.04143325611948967,
-0.480449378490448,
-0.11083996295928955,
-0.24912074208259583,
-0.0334931910037... |
func (e SharedSecretEncryptions) Decrypt(oid commontypes.OracleID, k types.OffchainKeyring) (*[SharedSecretSize]byte, error) {
if oid < 0 || len(e.Encryptions) <= int(oid) {
return nil, errors.New("oid out of range of SharedSecretEncryptions.Encryptions")
}
dhPoint, err := k.ConfigDiffieHellman(e.DiffieHellmanPoi... | [
0.8750109672546387,
1.0761018991470337,
0.5962244272232056,
0.526954174041748,
-0.12695083022117615,
-0.4556049108505249,
0.520366370677948,
-1.1941277980804443,
0.5769607424736023,
0.875847339630127,
-0.6429191827774048,
0.1059228926897049,
-0.6640534400939941,
0.002847753930836916,
1.3... |
func init() {
prometheus.MustRegister(PktsRecv)
prometheus.MustRegister(PktsSent)
prometheus.MustRegister(BytesRecv)
prometheus.MustRegister(BytesSent)
prometheus.MustRegister(PktBufNew)
prometheus.MustRegister(PktBufReuse)
prometheus.MustRegister(PktBufDiscard)
prometheus.MustRegister(PktProcessTime)
promethe... | [
0.40026459097862244,
1.1217411756515503,
0.7202758193016052,
-0.33506345748901367,
0.9004607200622559,
0.3629424571990967,
0.16849467158317566,
-0.15987442433834076,
0.18273520469665527,
-0.09779184311628342,
-1.2011334896087646,
0.4961349368095398,
-0.38638031482696533,
1.0164672136306763... |
func Export(addresses []string) {
http.Handle("/metrics", promhttp.Handler())
for _, addr := range addresses {
go http.ListenAndServe(addr, nil)
}
} | [
0.3409765064716339,
0.9250513911247253,
0.2593834102153778,
0.6723365783691406,
0.03371161222457886,
0.41017988324165344,
0.004540734924376011,
0.18658557534217834,
-0.027664924040436745,
0.5519545674324036,
0.11076982319355011,
0.7665870189666748,
-0.46839332580566406,
0.28009700775146484... |
func (m MultiRESTMapper) VersionAndKindForResource(resource string) (defaultVersion, kind string, err error) {
for _, t := range m {
defaultVersion, kind, err = t.VersionAndKindForResource(resource)
if err == nil {
return
}
}
return
} | [
-0.20748576521873474,
-1.2906956672668457,
0.042631056159734726,
0.8010404706001282,
-0.4468865394592285,
0.33371859788894653,
-0.34352585673332214,
-0.8216063380241394,
-0.7099244594573975,
0.9313126802444458,
0.13298462331295013,
-0.2714555561542511,
0.1316462904214859,
1.587581157684326... |
func (m MultiRESTMapper) RESTMapping(kind string, versions ...string) (mapping *kmeta.RESTMapping, err error) {
for _, t := range m {
mapping, err = t.RESTMapping(kind, versions...)
if err == nil {
return
}
}
return
} | [
-1.4932664632797241,
0.2982995808124542,
0.49287593364715576,
1.254991054534912,
-0.253173828125,
0.07145590335130692,
-0.15379850566387177,
-0.10812493413686752,
-0.1619832068681717,
0.2607259750366211,
0.09566742181777954,
-0.135187566280365,
-0.6664607524871826,
0.1324658840894699,
-1... |
func (m MultiRESTMapper) AliasesForResource(resource string) (aliases []string, has bool) {
for _, t := range m {
aliases, has = t.AliasesForResource(resource)
if has {
return
}
}
return
} | [
-0.42816007137298584,
-1.0494027137756348,
0.19117674231529236,
0.2661591172218323,
-0.8288545608520508,
0.6362111568450928,
-0.4181078374385834,
0.07131091505289078,
-0.6787552833557129,
0.08383583277463913,
0.2676253914833069,
-0.8217142820358276,
0.6027235984802246,
1.3040051460266113,
... |
func NewString(s string) *String {
return &String{String: s, Valid: true}
} | [
0.3962705135345459,
-0.37998777627944946,
-0.050608061254024506,
0.08811519294977188,
-1.6170780658721924,
0.43368667364120483,
0.08411979675292969,
0.06835830211639404,
0.958850622177124,
-0.20333585143089294,
-0.5240621566772461,
0.032761216163635254,
0.4876461327075958,
-1.1347197294235... |
func (s *StringsObj) Join(line string, args ...Object) Object {
argLen := len(args)
if argLen != 1 && argLen != 2 {
return NewError(line, ARGUMENTERROR, "1|2", argLen)
}
sep := ""
a, ok := args[0].(*Array)
if !ok {
return NewError(line, PARAMTYPEERROR, "first", "join", "*Array", args[0].Type())
}
if argLe... | [
0.4650801420211792,
-1.0576660633087158,
0.856521487236023,
0.3807263970375061,
0.12979191541671753,
0.11417728662490845,
-0.4495854675769806,
-0.4220520257949829,
-0.6446913480758667,
0.07335733622312546,
0.203634575009346,
0.8445021510124207,
-0.3985055983066559,
0.019328050315380096,
... |
func NewDockerWindowsSetter() Setter {
return &dockerWindowsSetter{}
} | [
-0.3735238313674927,
-0.0880565270781517,
-0.3426345884799957,
0.15678828954696655,
-1.5524404048919678,
-0.7040346264839172,
0.7962258458137512,
-0.7487776875495911,
0.22827857732772827,
0.04733617976307869,
-1.1913498640060425,
-0.3866783678531647,
0.01184550765901804,
1.3316296339035034... |
func Copy(dst, src string) error {
sfi, err := os.Stat(src)
if err != nil {
return NewCopyError(src, dst, "cannot stat source file", err)
}
if sfi.IsDir() {
return CopyDir(dst, src, sfi.Mode())
}
return CopyFile(dst, src, sfi.Mode())
} | [
-0.19120906293392181,
0.5186933279037476,
0.4515463411808014,
0.6854305863380432,
-0.5359613299369812,
1.1345022916793823,
0.7786874771118164,
-0.12485859543085098,
-0.13138891756534576,
-0.261012464761734,
0.7371438145637512,
0.16874362528324127,
0.712548553943634,
1.0022451877593994,
0... |
func CopyDir(dst, src string, mode os.FileMode) error {
if err := isInside(dst, src); err != nil {
return err
}
fn := func(srcpath string, fi os.FileInfo, err error) error {
if err != nil {
return NewCopyError(src, dst, "cannot stat "+srcpath, err)
}
dest := filepath.Clean(strings.Replace(srcpath, src, ... | [
-0.2764018774032593,
0.24052511155605316,
0.543506383895874,
0.18445643782615662,
-1.1112635135650635,
0.6782124042510986,
0.8156790137290955,
-0.2984742224216461,
-0.3430345356464386,
-0.4389476776123047,
0.2178521752357483,
-0.23942101001739502,
0.6463149785995483,
0.5695173740386963,
... |
func CopyFile(dst, src string, mode os.FileMode) error {
from, err := os.Open(src)
if err != nil {
return NewCopyError(src, dst, "cannot open source file", err)
}
defer from.Close()
to, err := os.OpenFile(dst, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, mode)
if err != nil {
return NewCopyError(src, dst, "cannot op... | [
-0.08347372710704803,
0.35694149136543274,
0.6634200215339661,
-0.47916552424430847,
-0.47684693336486816,
0.6796199679374695,
0.4557574689388275,
0.22128872573375702,
-1.0355132818222046,
0.3744153082370758,
-0.09076686948537827,
0.18566371500492096,
0.8661714196205139,
-0.587182998657226... |
func (p *pod) preparePodUpdateMessage(msgText string) string {
// Handle simple message replacements.
replacements := map[string]string{
"pod triggered scale-up": "Job requires additional resources, scaling up cluster.",
"Successfully assigned": "Pod resources allocated.",
"skip schedule deleting pod":... | [
-0.9218710064888,
-0.8041059970855713,
0.5849184989929199,
-0.923367977142334,
-0.6732495427131653,
-0.3778359293937683,
-0.4201590120792389,
-0.028888534754514694,
-0.30984804034233093,
0.11313707381486893,
0.2179630696773529,
-0.29482436180114746,
-0.35345831513404846,
-0.174859583377838... |
func genTestData(regularMutation, colFilters bool) (key string, seqno, revId, cas uint64, flags, expiry uint32, opCode gomemcached.CommandCode, hash [64]byte, ret []byte, colId uint32, filterIds []uint8) {
randomOnce.Do(func() {
rand.Seed(time.Now().UTC().UnixNano())
})
key = randomString(randInt(12, 64))
seqno ... | [
-0.4328537583351135,
0.3469622731208801,
1.0194647312164307,
0.061805304139852524,
0.018145378679037094,
-0.26231810450553894,
-0.011232223361730576,
-0.46123170852661133,
1.0086452960968018,
0.07987704128026962,
-0.4257606267929077,
0.3520697355270386,
-0.49879229068756104,
0.264541268348... |
func Disabled_TestLoadMismatchedFilesOnly(t *testing.T) {
fmt.Println("============== Test case start: TestLoadMismatchedFilesOnly =================")
assert := assert.New(t)
file1 := "/tmp/test1.bin"
file2 := "/tmp/test2.bin"
defer os.Remove(file1)
defer os.Remove(file2)
entries := 10000
numMismatch := 5
k... | [
0.07655532658100128,
-0.15311411023139954,
1.1361337900161743,
0.40613803267478943,
0.28172457218170166,
1.459999442100525,
0.8658196330070496,
0.5218991041183472,
-0.25893405079841614,
-0.8443183302879333,
-1.1868735551834106,
-0.13718456029891968,
-0.909579336643219,
1.2526490688323975,
... |
func Disabled_TestLoadMismatchedFilesAndUneven(t *testing.T) {
fmt.Println("============== Test case start: TestLoadMismatchedFilesAndUneven =================")
assert := assert.New(t)
file1 := "/tmp/test1.bin"
file2 := "/tmp/test2.bin"
defer os.Remove(file1)
defer os.Remove(file2)
entries := 1000
numMismatch... | [
0.009425620548427105,
-0.1162945106625557,
1.252668857574463,
-0.090018630027771,
0.2367100864648819,
1.3279093503952026,
0.6649647951126099,
0.885516881942749,
-0.3347412347793579,
-0.8322447538375854,
-1.4130630493164062,
-0.25973954796791077,
-0.7402180433273315,
0.7642631530761719,
0... |
func makeHandler(fn func(http.ResponseWriter, *http.Request)) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// don't compress the answer if the client doesn't accept or if Compression disable
if !strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") || !Compression {
fn(w, r)
r... | [
0.6439993381500244,
0.09454009681940079,
0.635262668132782,
0.1795250028371811,
-0.872220516204834,
0.4893762767314911,
0.385099858045578,
-0.15007267892360687,
0.29309552907943726,
-0.25927111506462097,
0.4822378158569336,
-0.8766361474990845,
-0.05480549857020378,
-0.6995176672935486,
... |
func (w gzipResponseWriter) Write(b []byte) (int, error) {
if "" == w.Header().Get("Content-Type") {
// If no content type, apply sniffing algorithm to un-gzipped body.
w.Header().Set("Content-Type", http.DetectContentType(b))
}
return w.Writer.Write(b)
} | [
-0.6132096648216248,
0.11282384395599365,
0.5098528861999512,
0.6604734063148499,
0.5060903429985046,
-0.1395251750946045,
0.6830358505249023,
-0.7399337291717529,
0.5882927775382996,
0.21402902901172638,
-0.214859738945961,
-0.4907262325286865,
-1.145383596420288,
0.664175808429718,
-0.... |
func requestPlayground(form url.Values, url string, w http.ResponseWriter) {
//Reroute to playground and read the answer
client := &http.Client{}
req, err := http.NewRequest("POST", url, nil)
checkHttpError(err, w)
req.Header.Set("User-Agent", UserAgent)
resp, err := client.PostForm(url, form)
checkHttpError(e... | [
-0.5105313658714294,
-0.5087070465087891,
0.9210030436515808,
0.1983218491077423,
-0.25065723061561584,
0.23485837876796722,
-0.12083297222852707,
-0.790650486946106,
0.044646505266427994,
-0.08265487849712372,
-0.239401176571846,
0.3241574466228485,
-1.4182676076889038,
0.5626119375228882... |
func compileHandler(w http.ResponseWriter, r *http.Request) {
//Parse input form and insert these parameter into a new form
form := url.Values{}
err := r.ParseForm()
checkHttpError(err, w)
for k, v := range r.Form {
form.Add(k, v[0])
}
requestPlayground(form, HostPlayGround + "/compile", w)
} | [
-0.47165921330451965,
-0.4471859335899353,
0.524147093296051,
0.8698685765266418,
0.3660880923271179,
0.11682093888521194,
0.5263214707374573,
0.5918461680412292,
-0.5839983224868774,
-0.09631981700658798,
0.33047160506248474,
-0.7175531983375549,
-0.9404739737510681,
0.957162082195282,
... |
func fmtHandler(w http.ResponseWriter, r *http.Request) {
//Parse input form and insert these parameter into a new form
form := url.Values{}
err := r.ParseForm()
checkHttpError(err, w)
for k, v := range r.Form {
form.Add(k, v[0])
}
requestPlayground(form, HostPlayGround + "/fmt", w)
} | [
-0.503718912601471,
-0.453262060880661,
0.4032231271266937,
0.04116908833384514,
0.4731284976005554,
0.1581505388021469,
0.39307230710983276,
0.1877058446407318,
-0.5552985072135925,
-0.7480179071426392,
0.3588195741176605,
-0.3608676493167877,
-0.614513635635376,
1.5779318809509277,
-0.... |
func runHandler(w http.ResponseWriter, r *http.Request) {
//Parse input form and get the content of the go file
form := url.Values{}
err := r.ParseForm()
checkHttpError(err, w)
//Check if file exists
filename := filepath.Join(SamplePath, r.Form["file"][0])
if _, err := os.Stat(filename); os.IsNotExist(err) {
... | [
-0.14755728840827942,
-0.11440418660640717,
0.7992851734161377,
0.27293843030929565,
0.3882412314414978,
0.8213334083557129,
0.767785906791687,
1.0892456769943237,
-1.3978700637817383,
0.11276190727949142,
0.04307524487376213,
-0.4276161789894104,
-1.1125061511993408,
0.23864445090293884,
... |
func init() {
Compression = true
HostPlayGround = "http://play.golang.org"
UserAgent = "soksan"
SamplePath = "./gocode/"
http.HandleFunc("/fmt", makeHandler(fmtHandler))
http.HandleFunc("/compile", makeHandler(compileHandler))
http.HandleFunc("/run", makeHandler(runHandler))
} | [
-0.22258242964744568,
0.21802771091461182,
0.3093297779560089,
0.596764087677002,
0.9286907911300659,
0.7126653790473938,
0.8073671460151672,
0.3504551649093628,
-0.8614533543586731,
-1.1581707000732422,
-0.5631746649742126,
0.26289764046669006,
0.036426544189453125,
0.46736398339271545,
... |
func (o *ContextOptions) c() (*C.TFE_ContextOptions, error) {
opt := C.TFE_NewContextOptions()
if o == nil {
return opt, nil
}
if sz := len(o.Config); sz > 0 {
status := newStatus()
cConfig := C.CBytes(o.Config)
C.TFE_ContextOptionsSetConfig(opt, cConfig, C.size_t(sz), status.c)
C.free(cConfig)
if err ... | [
-0.052336353808641434,
0.4864455461502075,
0.7553701400756836,
0.15609122812747955,
0.23970137536525726,
-0.1374029666185379,
1.0687808990478516,
-0.13163843750953674,
0.596109926700592,
0.5092294812202454,
-0.20206575095653534,
0.05733254551887512,
0.45604124665260315,
-0.4027808308601379... |
func NewContext(options *ContextOptions) (*Context, error) {
status := newStatus()
cOpt, err := options.c()
if err != nil {
return nil, err
}
defer C.TFE_DeleteContextOptions(cOpt)
cContext := C.TFE_NewContext(cOpt, status.c)
if err := status.Err(); err != nil {
return nil, err
}
c := &Context{c: cContext... | [
0.16050952672958374,
-0.18264245986938477,
0.4358968436717987,
0.7136550545692444,
0.251735121011734,
-0.1452837735414505,
0.2886541783809662,
-0.2133311778306961,
0.6264095306396484,
-0.144400954246521,
0.21375614404678345,
-0.5023446679115295,
-0.4222027063369751,
-0.24287773668766022,
... |
func (c *Context) ListDevices() ([]Device, error) {
status := newStatus()
devicesList := C.TFE_ContextListDevices(c.c, status.c)
if err := status.Err(); err != nil {
return nil, fmt.Errorf("SessionListDevices() failed: %v", err)
}
defer C.TF_DeleteDeviceList(devicesList)
return deviceSliceFromDeviceList(devices... | [
-0.7027837038040161,
-0.39745771884918213,
0.1570311337709427,
0.6973980069160461,
0.24788011610507965,
-0.5329431295394897,
0.10335193574428558,
-0.6216267943382263,
1.364013910293579,
0.352843314409256,
0.37785983085632324,
0.26893407106399536,
-0.5914314985275269,
0.3650909960269928,
... |
func NewDeleteStackActivity(awsSessionFactory AWSFactory) *DeleteStackActivity {
return &DeleteStackActivity{
awsSessionFactory: awsSessionFactory,
}
} | [
0.5531600713729858,
0.05722760409116745,
0.35586580634117126,
0.3425976037979126,
-0.7370077967643738,
-0.938570499420166,
0.19557392597198486,
-0.7748054265975952,
0.874443531036377,
-0.23586654663085938,
0.06840050220489502,
0.5597436428070068,
0.14138047397136688,
-0.02036355808377266,
... |
func (e Expo) installExpoCLI() error {
args := []string{"install", "-g"}
if e.Version != "latest" {
args = append(args, "expo-cli@"+e.Version)
} else {
args = append(args, "expo-cli")
}
cmd := command.New("npm", args...)
cmd.SetStdout(os.Stdout)
cmd.SetStderr(os.Stderr)
log.Donef("$ %s", cmd.PrintableComm... | [
-0.7560656666755676,
-0.3075774908065796,
0.9202930331230164,
-0.47153231501579285,
0.42052075266838074,
0.5122381448745728,
0.16188262403011322,
-0.03460689261555672,
-0.7741043567657471,
0.7538705468177795,
0.03964322805404663,
-0.18284247815608978,
-0.2528834342956543,
0.479214519262313... |
func (e Expo) login(userName string, password stepconf.Secret) error {
args := []string{"login", "--non-interactive", "-u", userName, "-p", string(password)}
cmd := command.New("expo", args...)
cmd.SetStdout(os.Stdout)
cmd.SetStderr(os.Stderr)
nonFilteredArgs := ("$ " + cmd.PrintableCommandArgs())
fileredArgs :... | [
-0.27414795756340027,
0.4824353754520416,
0.8657659888267517,
0.4075997769832611,
-0.3192402422428131,
0.6478877663612366,
0.33355748653411865,
0.9275329113006592,
-0.41142287850379944,
-0.289743036031723,
-0.37035468220710754,
0.9199811220169067,
-0.2690944969654083,
0.7819245457649231,
... |
func (e Expo) logout() error {
cmd := command.New("expo", "logout", "--non-interactive")
cmd.SetStdout(os.Stdout)
cmd.SetStderr(os.Stderr)
log.Donef("$ %s", cmd.PrintableCommandArgs())
return cmd.Run()
} | [
-0.31827545166015625,
-0.02073351852595806,
0.7672226428985596,
-0.04224817082285881,
-0.1707400679588318,
0.492526650428772,
0.686019778251648,
-0.11035540699958801,
0.21591836214065552,
0.1685662567615509,
0.5173401832580566,
0.33608919382095337,
-0.5529904961585999,
-0.03030861914157867... |
func (e Expo) eject() error {
args := []string{"eject", "--non-interactive"}
cmd := command.New("expo", args...)
cmd.SetStdout(os.Stdout)
cmd.SetStderr(os.Stderr)
if e.Workdir != "" {
cmd.SetDir(e.Workdir)
}
log.Donef("$ %s", cmd.PrintableCommandArgs())
return cmd.Run()
} | [
-0.25772541761398315,
0.5738070011138916,
0.8860349059104919,
-0.08375248312950134,
0.02278226427733898,
0.8866397142410278,
1.0908300876617432,
-0.5369569063186646,
-0.28357255458831787,
-0.4572656750679016,
0.3803611099720001,
0.40014076232910156,
-0.3583710789680481,
0.49241650104522705... |
func newServerInfo(config *Config) *ServerInfo {
info := &ServerInfo{
registry: info.New(),
startTime: time.Now(),
connections: info.NewCounter(),
commands: info.NewCounter(),
clients: make(map[uint64]*Client),
}
return info.withDefaults(config)
} | [
-0.06123309209942818,
-0.7649127840995789,
0.16992248594760895,
-0.07498250901699066,
0.08256442844867706,
0.13223551213741302,
0.16865932941436768,
-0.2420905977487564,
-0.4709453880786896,
0.20868001878261566,
-1.2458784580230713,
0.6161444783210754,
-0.307492196559906,
1.215460538864135... |
func (i *ServerInfo) Section(name string) *info.Section { return i.registry.Section(name) } | [
-0.3994639217853546,
-0.33175206184387207,
0.21381865441799164,
-0.14819544553756714,
-0.2015371024608612,
0.3081737458705902,
0.5126941204071045,
-0.7490656971931458,
-0.290129154920578,
-0.0683455765247345,
0.32206225395202637,
0.8278552889823914,
0.3302361071109772,
0.3924544155597687,
... |
func (i *ServerInfo) String() string { return i.registry.String() } | [
-0.06971993297338486,
-0.9632468819618225,
-0.05095668509602547,
-0.7080166935920715,
0.3314882516860962,
1.2027064561843872,
1.1436635255813599,
-0.8856059312820435,
-0.3782426714897156,
-0.06470783799886703,
-0.3686515688896179,
1.067366123199463,
-0.666846513748169,
-0.17843228578567505... |
func (i *ServerInfo) OnConnect(client *Client) {
i.connections.Inc(1)
i.mutex.Lock()
defer i.mutex.Unlock()
i.clients[client.ID] = client
} | [
-0.08748913556337357,
-0.5880006551742554,
0.3885613977909088,
-1.1143282651901245,
-0.9974648356437683,
-0.16875067353248596,
-0.05580660700798035,
-1.218535304069519,
-0.7538948655128479,
0.5243744850158691,
-0.4882124364376068,
-0.013279707171022892,
-0.44411206245422363,
0.067566283047... |
func (i *ServerInfo) OnDisconnect(client *Client) {
i.mutex.Lock()
defer i.mutex.Unlock()
delete(i.clients, client.ID)
} | [
0.6155625581741333,
-1.025625228881836,
0.34863075613975525,
-0.9709530472755432,
-0.8211819529533386,
0.11373334378004074,
-0.04956668242812157,
-0.9381763339042664,
-0.2414907068014145,
0.6571115255355835,
-0.38889262080192566,
0.004957703407853842,
-0.7344518899917603,
-0.07138537615537... |
func (i *ServerInfo) OnCommand(client *Client, cmd string) {
i.commands.Inc(1)
if client != nil {
client.OnCommand(cmd)
}
} | [
0.6215464472770691,
-0.2564167380332947,
0.40299808979034424,
-0.15422751009464264,
-0.10581043362617493,
0.6377866864204407,
0.17179450392723083,
-0.18974483013153076,
0.3243585228919983,
-0.6028710007667542,
0.014238602481782436,
0.8728082180023193,
-0.4199291169643402,
0.993819415569305... |
func (i *ServerInfo) Clients() []Client {
i.mutex.RLock()
clients := make(clientSlice, 0, len(i.clients))
for _, c := range i.clients {
clients = append(clients, *c)
}
i.mutex.RUnlock()
sort.Sort(clients)
return []Client(clients)
} | [
-1.1121118068695068,
-1.0217459201812744,
0.16161426901817322,
-0.3018476963043213,
0.2389359325170517,
0.25636187195777893,
0.4097643792629242,
-1.1268858909606934,
-0.3578490614891052,
-0.3968961834907532,
0.39565232396125793,
0.8813998103141785,
-0.9148527383804321,
-0.10240780562162399... |
func (i *ServerInfo) ClientsLen() int {
i.mutex.RLock()
defer i.mutex.RUnlock()
return len(i.clients)
} | [
-0.436093807220459,
-0.042771317064762115,
0.05739982798695564,
-1.0597985982894897,
0.1435341238975525,
0.23421978950500488,
0.758156955242157,
-0.5216365456581116,
-1.0844446420669556,
-0.35676223039627075,
-0.5279571413993835,
0.16837777197360992,
-0.6602917313575745,
0.2018905729055404... |
func (i *ServerInfo) ClientsString() string {
str := ""
for _, client := range i.Clients() {
str += client.String() + "\n"
}
return str
} | [
-0.2510179579257965,
-1.315556526184082,
0.2544713318347931,
-1.2920860052108765,
0.05967538431286812,
0.7161842584609985,
-0.07807006686925888,
-1.4233512878417969,
-1.1579798460006714,
-0.02904871106147766,
0.6032835245132446,
0.5096478462219238,
-0.6935300230979919,
-0.23352524638175964... |
func (i *ServerInfo) TotalConnections() int64 {
return i.connections.Value()
} | [
-0.8912845849990845,
-0.19051828980445862,
0.46837112307548523,
-0.13582435250282288,
0.18346863985061646,
-0.5514910221099854,
1.011579990386963,
-0.3968510031700134,
0.3850632309913635,
0.17112968862056732,
-0.3879622519016266,
-1.0777126550674438,
-0.969158947467804,
-0.3423428237438202... |
func (i *ServerInfo) TotalCommands() int64 {
return i.commands.Value()
} | [
-0.7230594754219055,
0.03816762566566467,
0.5184227824211121,
-0.17819766700267792,
0.28445813059806824,
-0.6266062259674072,
1.0759714841842651,
-0.6583071947097778,
0.4572582244873047,
-0.21863792836666107,
-0.6121581792831421,
-0.8860793709754944,
-0.682124674320221,
-0.0870283991098404... |
func (s *serverImpl) Send(msg *Message, useTLS bool) error {
logger.Debugf("send mail (per %s) - host: %s, from: %s, to: %s",
protocolStr(useTLS), s.host, msg.Header.From, msg.Header.To)
host, _, _ := net.SplitHostPort(s.host)
auth := smtp.PlainAuth(
"",
s.user,
s.pass,
// the host part can't have a port ... | [
-0.5074790716171265,
0.9147245287895203,
0.3437803089618683,
0.3933221399784088,
-0.8294199705123901,
0.25591686367988586,
-0.08935971558094025,
0.24309441447257996,
-0.5282731056213379,
-0.012623757123947144,
-0.5687516331672668,
0.7374000549316406,
-0.4295186996459961,
0.2851015627384186... |
func SatisfiesTargetValue(targetValue int64, minChange int64, utxos []*common.UTXO) bool {
totalValue := int64(0)
for _, utxo := range utxos {
totalValue += utxo.Value
}
return (totalValue == targetValue || totalValue >= targetValue+minChange)
} | [
-0.9751394987106323,
-0.09321869164705276,
0.3632640242576599,
-0.17741000652313232,
-1.1334378719329834,
0.21937796473503113,
-0.8015094995498657,
-0.14609776437282562,
0.2875696122646332,
0.042217060923576355,
-0.46436843276023865,
0.38816162943840027,
0.44849175214767456,
-0.40806666016... |
func MinimalFeeWithChange(utxos []*common.UTXO, feePerKB int64) int64 {
fee := int64(0)
txSize := BytesTransactionOverhead + len(utxos)*BytesPerInput + 2*BytesPerOutput
fee += int64(txSize) * feePerKB / 1000
return fee
} | [
0.6585693359375,
-0.333652526140213,
0.41736069321632385,
0.18128851056098938,
-1.505867600440979,
-0.7408131957054138,
0.015344839543104172,
-0.33875399827957153,
0.5371974110603333,
-0.47964954376220703,
0.21860554814338684,
-0.15534378588199615,
-0.32106393575668335,
0.29881519079208374... |
func New(s *service.Service) (svr *rpc.Server) {
r := &RPC{s: s}
svr = rpc.NewServer(nil)
if err := svr.Register(r); err != nil {
panic(err)
}
return
} | [
-0.10746357589960098,
0.19555050134658813,
0.18142253160476685,
-0.8659914135932922,
0.21855397522449493,
0.04305838793516159,
-0.662632167339325,
-0.5044925808906555,
0.207603320479393,
0.4328876733779907,
-0.31814509630203247,
1.1175986528396606,
-0.8532207608222961,
0.5392698645591736,
... |
func (r *RPC) Ping(c context.Context, arg *struct{}, res *struct{}) (err error) {
return
} | [
-0.7435340881347656,
-0.32517868280410767,
0.4443194568157196,
0.09987403452396393,
0.6779915690422058,
0.7528838515281677,
0.47411808371543884,
-0.19022105634212494,
0.2142627239227295,
0.5617727637290955,
-0.05188971385359764,
-0.6962604522705078,
-1.1730854511260986,
0.02875496819615364... |
func (r *RPC) Auth(c context.Context, arg *rpc.Auth, res *struct{}) (err error) {
return
} | [
-0.952698826789856,
-0.4737166166305542,
0.2924921214580536,
0.07177615165710449,
0.14379465579986572,
0.3813360333442688,
0.950243353843689,
-0.5068603157997131,
0.695415735244751,
-0.5748854875564575,
-0.20629742741584778,
0.44832372665405273,
-0.5716751217842102,
-0.6387074589729309,
... |
func (r *RPC) AddArticle(c context.Context, arg *model.ArgArticle, res *int64) (err error) {
var (
aid int64
a = model.TransformArticle(arg)
)
if aid, err = r.s.AddArticle(c, a, arg.ActivityID, arg.ListID, arg.RealIP); err != nil {
return
}
*res = aid
return
} | [
-0.945408046245575,
0.1639750748872757,
0.5709022283554077,
0.2238861620426178,
0.1575140357017517,
-0.10645723342895508,
0.3796847462654114,
0.14523601531982422,
0.42525067925453186,
0.04936257749795914,
-0.22651755809783936,
-0.8938066363334656,
-1.0648856163024902,
0.11998479813337326,
... |
func (r *RPC) UpdateArticle(c context.Context, arg *model.ArgArticle, res *struct{}) (err error) {
var a = model.TransformArticle(arg)
if err = r.s.UpdateArticle(c, a, arg.ActivityID, arg.ListID, arg.RealIP); err != nil {
return
}
return
} | [
-1.256662368774414,
-0.8744435906410217,
0.43716156482696533,
0.018507789820432663,
-0.10590783506631851,
-0.3079988360404968,
0.5424914360046387,
0.3149220049381256,
0.1420321762561798,
0.8995435237884521,
-0.6675065159797668,
-0.5808289051055908,
-0.8229472041130066,
-0.26074451208114624... |
func (r *RPC) CreationArticle(c context.Context, arg *model.ArgAidMid, res *model.Article) (err error) {
var rr *model.Article
if rr, err = r.s.CreationArticle(c, arg.Aid, arg.Mid); err == nil {
*res = *rr
}
return
} | [
0.1072174459695816,
0.10164337605237961,
0.18192821741104126,
0.35836029052734375,
0.0016272979555651546,
0.4185706079006195,
-0.017799394205212593,
-0.9217627644538879,
-0.4795386493206024,
0.763713538646698,
0.4818728566169739,
-0.230581134557724,
-1.1465959548950195,
0.6241408586502075,... |
func (r *RPC) DelArticle(c context.Context, arg *model.ArgAidMid, res *struct{}) error {
return r.s.DelArticle(c, arg.Aid, arg.Mid)
} | [
0.05645174905657768,
-0.12248557060956955,
0.2616707980632782,
-0.4563976228237152,
-0.07500375807285309,
-0.0037232416216284037,
-0.19089679419994354,
-0.38106662034988403,
0.49488720297813416,
0.07882662117481232,
0.05688580125570297,
0.040776222944259644,
-1.1372268199920654,
-0.0517173... |
func (r *RPC) AddArticleCache(c context.Context, arg *model.ArgAid, res *struct{}) (err error) {
err = r.s.AddArticleCache(c, arg.Aid)
return
} | [
-0.486539751291275,
0.0224408321082592,
0.24161827564239502,
-0.4670840799808502,
-0.18544867634773254,
0.6546545624732971,
-0.11148161441087723,
-0.3123059570789337,
0.0906028151512146,
0.2490043044090271,
0.11237113177776337,
-0.2882174253463745,
-0.7874783873558044,
-0.26249808073043823... |
func (r *RPC) UpdateArticleCache(c context.Context, arg *model.ArgAidCid, res *struct{}) (err error) {
err = r.s.UpdateArticleCache(c, arg.Aid, arg.Cid)
return
} | [
-0.6324827075004578,
-0.8028774261474609,
0.10319706797599792,
-0.5169812440872192,
-0.780424177646637,
0.10214993357658386,
-0.003620160510763526,
-0.2921796143054962,
-0.17092372477054596,
1.0212044715881348,
-0.239140123128891,
0.2042442113161087,
-0.9077279567718506,
-0.641491711139679... |
func (r *RPC) DelArticleCache(c context.Context, arg *model.ArgAidMid, res *struct{}) (err error) {
err = r.s.DelArticleCache(c, arg.Mid, arg.Aid)
return
} | [
0.14285799860954285,
-0.24733728170394897,
0.23556698858737946,
-0.4175850749015808,
-0.86419677734375,
0.16219550371170044,
-0.20141814649105072,
-0.15325872600078583,
0.38886359333992004,
0.4754202663898468,
0.1472770869731903,
0.1682223081588745,
-0.8173037171363831,
-0.1610094755887985... |
func (r *RPC) CreationWithdrawArticle(c context.Context, arg *model.ArgAidMid, res *struct{}) (err error) {
err = r.s.CreationWithdrawArticle(c, arg.Mid, arg.Aid)
return
} | [
0.6168241500854492,
-0.07851554453372955,
0.377621054649353,
-0.36713990569114685,
0.21389374136924744,
1.044620394706726,
-0.28894326090812683,
-1.410871148109436,
-0.4800778031349182,
-0.11404362320899963,
0.41387149691581726,
-0.4121217727661133,
0.4053102433681488,
0.6035929322242737,
... |
func (r *RPC) Categories(c context.Context, arg *model.ArgIP, res *model.Categories) (err error) {
*res, err = r.s.ListCategories(c, arg.RealIP)
return
} | [
-0.8772748708724976,
0.25417348742485046,
0.13734132051467896,
-0.021537592634558678,
0.46529531478881836,
-0.09353053569793701,
-0.4197780191898346,
-0.5171711444854736,
0.2569563686847687,
-0.6251370310783386,
-0.059116095304489136,
-0.6771502494812012,
-0.6502075791358948,
0.13860958814... |
func (r *RPC) CategoriesMap(c context.Context, arg *model.ArgIP, res *map[int64]*model.Category) (err error) {
*res, err = r.s.ListCategoriesMap(c, arg.RealIP)
return
} | [
-1.2099666595458984,
0.07746133953332901,
0.430588036775589,
-0.22912795841693878,
-0.026310591027140617,
0.244520902633667,
0.2041490375995636,
-0.5926460027694702,
0.7157681584358215,
-0.49768930673599243,
-0.15093491971492767,
-1.068080186843872,
-0.2253766655921936,
0.23355773091316223... |
func (r *RPC) CreationUpperArticles(c context.Context, arg *model.ArgCreationArts, res *model.CreationArts) (err error) {
var rr *model.CreationArts
if rr, err = r.s.CreationUpperArticlesMeta(c, arg.Mid, arg.Group, arg.Category, arg.Sort, arg.Pn, arg.Ps, arg.RealIP); err == nil {
*res = *rr
}
return
} | [
-0.29570817947387695,
-0.25674980878829956,
0.6154142618179321,
-0.4491829574108124,
0.0676136314868927,
0.7840498685836792,
0.18829399347305298,
-0.6438682675361633,
-0.4115279018878937,
0.3459096848964691,
0.049916062504053116,
0.07390205562114716,
-0.6436398029327393,
-0.268927186727523... |
func (r *RPC) SetStat(c context.Context, arg *model.ArgStats, res *struct{}) (err error) {
err = r.s.SetStat(c, arg.Aid, arg.Stats)
return
} | [
-0.6905040740966797,
-0.10650254786014557,
0.14660263061523438,
-0.5728868246078491,
0.42717403173446655,
0.258447527885437,
0.35180598497390747,
-0.26759228110313416,
0.18296414613723755,
-0.003544336184859276,
-0.3433716297149658,
0.4161629378795624,
-0.2807353734970093,
0.44828200340270... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.