text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func ConvertPathToString(p Path) string {
var results = []string{}
var step Step
for p != nil {
step, p = p.Pop()
if step == nil {
break
}
results = append([]string{step.String()}, results...)
}
return strings.Join(results, ".")
} | [
-0.7638212442398071,
-0.5240902304649353,
0.7072536945343018,
0.11268109828233719,
0.37326011061668396,
-0.11924833059310913,
0.16694143414497375,
-0.7709043025970459,
-0.07215956598520279,
0.6258972883224487,
-0.044712964445352554,
-0.6005725860595703,
0.051919400691986084,
0.408676326274... |
func (d *DataFrame) TripleSmooth(smooth, trend, season float64, period int) *DataFrame {
s := EmptyDataFrame(d.Len())
b := EmptyDataFrame(d.Len())
c := EmptyDataFrame(d.Len())
// set initial values
s.Insert(0, d.Index(0))
var x float64
for i := 0; i < period; i++ {
x += (d.Index(i) - d.Index(i+period)) / flo... | [
0.13686184585094452,
1.2933990955352783,
0.630378007888794,
0.12406202405691147,
-0.06072735786437988,
0.4883067309856415,
0.2594470679759979,
-0.5390796661376953,
0.5943758487701416,
-0.3788079619407654,
-0.3621310889720917,
1.0501832962036133,
0.2275027334690094,
-1.5175408124923706,
-... |
func NewRepository(db *sqlx.DB) *Repository {
return &Repository{
DbConn: db,
}
} | [
0.08028575778007507,
-0.158920019865036,
-0.0058923824690282345,
0.25210151076316833,
-0.6856866478919983,
-0.6719999313354492,
-1.1111023426055908,
0.346945196390152,
0.4262101650238037,
-0.2730177640914917,
-0.4609960913658142,
0.04836270958185196,
0.015372149646282196,
0.607291162014007... |
func (s *server) Running() bool {
s.mutex.RLock()
defer s.mutex.RUnlock()
return (s.state != Stopped && s.state != Initialized)
} | [
-1.7503958940505981,
-0.8589698672294617,
0.18825013935565948,
-0.5143802762031555,
-0.4058396518230438,
0.14356131851673126,
-0.7321063280105591,
0.2879304587841034,
0.24507397413253784,
0.17293930053710938,
-1.0782747268676758,
-0.05327432230114937,
-0.880744993686676,
-0.087117984890937... |
func (s *server) setState(state string) {
s.mutex.Lock()
defer s.mutex.Unlock()
// Temporarily store previous values.
//prevState := s.state
//prevLeader := s.leader
// Update state and leader.
s.state = state
if state == Leader {
s.leader = s.Name()
s.syncedPeer = make(map[string]bool)
}
//
//// Dis... | [
-0.8233507871627808,
0.49914029240608215,
0.6295521259307861,
0.32222020626068115,
-0.19143818318843842,
-0.14390891790390015,
0.8862963318824768,
0.2789139449596405,
0.8128406405448914,
-0.10126753896474838,
-1.3324240446090698,
0.8681039810180664,
-1.03726327419281,
1.0470077991485596,
... |
func (s *server) promotable() bool {
return s.log.currentIndex() > 0
} | [
-0.5127773284912109,
-0.12852725386619568,
0.67791348695755,
0.4068215489387512,
-0.6060683727264404,
-0.0790373757481575,
-0.5355539917945862,
0.06000898405909538,
-0.03499733656644821,
0.6262115240097046,
0.5418412089347839,
0.7898520231246948,
-0.9383252263069153,
0.46611103415489197,
... |
func (s *server) GetState() string {
s.mutex.RLock()
defer s.mutex.RUnlock()
return fmt.Sprintf("Name: %s, State: %s, Term: %v, CommitedIndex: %v ", s.name, s.state, s.currentTerm, s.log.commitIndex)
} | [
0.10163038969039917,
-0.3591306507587433,
0.5318484902381897,
-0.6168660521507263,
-0.04796246066689491,
-0.5009353756904602,
-0.21825097501277924,
-0.7066370844841003,
-0.4218596816062927,
0.47163671255111694,
0.1849905401468277,
1.2105191946029663,
-1.2882003784179688,
0.0820718631148338... |
func (s *server) Term() uint64 {
s.mutex.RLock()
defer s.mutex.RUnlock()
return s.currentTerm
} | [
-0.9231369495391846,
-0.20136111974716187,
0.48278698325157166,
0.4293172359466553,
-0.17098145186901093,
0.24309544265270233,
0.5381297469139099,
0.16440154612064362,
0.4243834614753723,
-0.6319038271903992,
-0.2676081657409668,
0.7296128273010254,
-1.7909557819366455,
-0.0859313532710075... |
func (s *server) State() string {
s.mutex.RLock()
defer s.mutex.RUnlock()
return s.state
} | [
-0.48548921942710876,
-0.2095922827720642,
0.18207265436649323,
0.005990121979266405,
-0.47949331998825073,
0.5225807428359985,
0.5023412108421326,
-0.08392620086669922,
0.45998650789260864,
-0.3795619010925293,
0.07774066179990768,
0.6383592486381531,
-1.3161154985427856,
0.56558448076248... |
func (s *server) send(value interface{}) (interface{}, error) {
event := &ev{target: value, c: make(chan error, 1)}
s.c <- event
err := <-event.c
return event.returnValue, err
} | [
-0.6923862099647522,
0.5931007862091064,
0.6121193170547485,
0.23077484965324402,
-0.6663092970848083,
-0.20152702927589417,
-0.08438125252723694,
-0.8226068615913391,
0.1283307522535324,
0.2745848596096039,
-0.6266725659370422,
0.5885274410247803,
-0.34544360637664795,
0.6612964272499084,... |
func (s *server) AddPeer(name string, connectiongString string) error {
s.debugln("server.peer.add: ", name, len(s.peers))
// Do not allow peers to be added twice.
if s.peers[name] != nil {
return nil
}
// Skip the Peer if it has the same name as the Server
if s.name != name {
peer := newPeer(s, name, conne... | [
-0.40931248664855957,
-0.43613168597221375,
0.605402410030365,
0.44430193305015564,
-0.3946020305156708,
0.4560069143772125,
-0.3594264090061188,
0.37334516644477844,
0.22113388776779175,
-0.3092792332172394,
-0.6365858316421509,
-0.43089500069618225,
-1.266404628753662,
1.05967378616333,
... |
func (s *server) Transporter() Transporter {
s.mutex.RLock()
defer s.mutex.RUnlock()
return s.transporter
} | [
0.013447406701743603,
-0.2136494219303131,
0.42853018641471863,
0.2127894014120102,
-0.5261366963386536,
0.5434547662734985,
1.3329267501831055,
-0.36733004450798035,
0.274314284324646,
-0.8675808906555176,
-0.21651878952980042,
0.5416303873062134,
-1.2500498294830322,
0.6341082453727722,
... |
func (s *server) AppendEntries(req *AppendEntriesRequest) *AppendEntriesResponse {
var ret, _ = s.send(req)
resp, _ := ret.(*AppendEntriesResponse)
return resp
} | [
-1.0028852224349976,
0.6800519824028015,
0.48884841799736023,
0.25061312317848206,
0.02609305828809738,
-0.8073192238807678,
0.3871912658214569,
-0.4160083830356598,
0.8231275677680969,
-0.7069693207740784,
-0.4149126410484314,
0.17976288497447968,
-1.1817190647125244,
1.2874735593795776,
... |
func (s *server) processAppendEntriesRequest(req *AppendEntriesRequest) (*AppendEntriesResponse, bool) {
s.traceln("server.ae.process")
if req.Term < s.currentTerm {
s.debugln("server.ae.error: stale term")
return newAppendEntriesResponse(s.currentTerm, false, s.log.currentIndex(), s.log.CommitIndex()), false
}... | [
-0.5262660980224609,
-0.31350457668304443,
0.9676880240440369,
-0.6528688073158264,
-0.27269604802131653,
-0.2520751655101776,
-0.006022577174007893,
-0.4903467893600464,
0.5042037963867188,
0.6802281141281128,
0.722714364528656,
0.07634539902210236,
-0.11612601578235626,
0.745132684707641... |
func (s *server) updateCurrentTerm(term uint64, leaderName string) {
//_assert(term > s.currentTerm,
// "upadteCurrentTerm: update is called when term is not larger than currentTerm")
s.mutex.Lock()
defer s.mutex.Unlock()
// Store previous values temporarily.
//prevTerm := s.currentTerm
//prevLeader := s.leader... | [
-0.7093108892440796,
-1.201570987701416,
0.35459843277931213,
0.005166373681277037,
-0.852271556854248,
0.40378835797309875,
-0.5318368673324585,
0.0189394261687994,
-0.1639351099729538,
0.7371240854263306,
-0.24060513079166412,
0.4222080707550049,
-0.7892497777938843,
0.10741900652647018,... |
func (s *server) processAppendEntriesResponse(resp *AppendEntriesResponse) {
// If we find a higher term then change to a follower and exit.
if resp.Term() > s.Term() {
s.updateCurrentTerm(resp.Term(), "")
return
}
// panic response if it's not successful.
if !resp.Success() {
return
}
// if one peer suc... | [
0.32355794310569763,
-0.6654508113861084,
0.8072943687438965,
-0.612740695476532,
0.22599808871746063,
-0.5543553829193115,
-0.17124691605567932,
-0.4314754009246826,
0.5400739312171936,
0.8486900925636292,
0.35990625619888306,
-0.2124210149049759,
-0.6996986269950867,
0.5394562482833862,
... |
func (s *server) MemberCount() int {
s.mutex.Lock()
defer s.mutex.Unlock()
return len(s.peers) + 1
} | [
-0.3019361197948456,
-0.14687389135360718,
0.46742895245552063,
-0.59787517786026,
-0.06221325322985649,
-0.05334336683154106,
0.1093081682920456,
1.0408540964126587,
-0.33980152010917664,
-0.027286501601338387,
-0.33413076400756836,
1.1716161966323853,
-1.0435247421264648,
0.1687064021825... |
func (s *server) QuorumSize() int {
return (s.MemberCount() / 2) + 1
} | [
-0.49469974637031555,
0.1341342329978943,
0.4853866696357727,
-0.361096054315567,
-0.25943422317504883,
-0.4702642261981964,
0.14588648080825806,
-0.17069974541664124,
0.08238543570041656,
-0.25267529487609863,
-0.956800103187561,
0.22048945724964142,
-1.3376710414886475,
0.145614415407180... |
func newPeer(server *server, name string, connectionString string, heartbeatInterval time.Duration) *Peer {
return &Peer{
server: server,
Name: name,
ConnectionString: connectionString,
heartbeatInterval: heartbeatInterval,
}
} | [
0.6746425032615662,
-1.1672475337982178,
0.5633429288864136,
0.3767206072807312,
-1.3296552896499634,
1.0810809135437012,
-1.5222874879837036,
-0.6089522242546082,
-0.9315425753593445,
0.16340720653533936,
0.27898454666137695,
0.1437137871980667,
-1.3819669485092163,
0.32582783699035645,
... |
func Duration(v time.Duration) *time.Duration {
return &v
} | [
0.4757002890110016,
-0.34724172949790955,
0.18565921485424042,
0.012817478738725185,
-0.7520068287849426,
-0.39249494671821594,
0.38576066493988037,
-0.5665120482444763,
1.17229425907135,
0.38380852341651917,
0.15711046755313873,
0.9016726016998291,
1.1535595655441284,
0.05207940563559532,... |
func DurationValue(v *time.Duration) time.Duration {
if v != nil {
return *v
}
return time.Duration(0)
} | [
0.28568679094314575,
0.13130737841129303,
0.6025858521461487,
0.5792309641838074,
-0.07662027329206467,
-0.702933132648468,
0.19132550060749054,
0.42714357376098633,
0.6692982316017151,
0.30078205466270447,
0.1332901269197464,
0.33142879605293274,
0.7880762219429016,
0.9954203963279724,
... |
func DurationSlice(src []time.Duration) []*time.Duration {
dst := make([]*time.Duration, len(src))
for i := 0; i < len(src); i++ {
dst[i] = &(src[i])
}
return dst
} | [
-1.1288045644760132,
0.27563801407814026,
0.3920750916004181,
0.5952080488204956,
0.1414375603199005,
0.06819412857294083,
-0.2643500864505768,
-0.5563453435897827,
-0.10648138076066971,
1.3429864645004272,
0.19810956716537476,
0.9796673655509949,
0.5742164254188538,
0.7407085299491882,
... |
func DurationValueSlice(src []*time.Duration) []time.Duration {
dst := make([]time.Duration, len(src))
for i := 0; i < len(src); i++ {
if src[i] != nil {
dst[i] = *(src[i])
}
}
return dst
} | [
-1.061652660369873,
-0.030039671808481216,
0.6299577355384827,
0.8742212057113647,
0.3890932500362396,
-0.17309851944446564,
-0.5284188985824585,
0.4664281904697418,
-0.6139129400253296,
1.1650733947753906,
-0.16189131140708923,
0.12385543435811996,
0.680960476398468,
0.9342494010925293,
... |
func DurationMap(src map[string]time.Duration) map[string]*time.Duration {
dst := make(map[string]*time.Duration, len(src))
for k, val := range src {
v := val
dst[k] = &v
}
return dst
} | [
-0.5982725024223328,
0.17605708539485931,
0.47930583357810974,
-0.6204012632369995,
-0.3546881079673767,
0.4041297137737274,
0.13711361587047577,
0.3357125222682953,
0.3924603760242462,
1.353935956954956,
-0.7882789373397827,
-0.09936422109603882,
0.7951802611351013,
0.5389539003372192,
... |
func DurationValueMap(src map[string]*time.Duration) map[string]time.Duration {
dst := make(map[string]time.Duration, len(src))
for k, val := range src {
if val != nil {
dst[k] = *val
}
}
return dst
} | [
-0.6339110136032104,
-0.041330378502607346,
0.6237383484840393,
0.031901367008686066,
0.08294831961393356,
0.29379990696907043,
-0.21079933643341064,
0.5692898035049438,
-0.011866714805364609,
1.1933674812316895,
-0.4731614589691162,
0.011519541032612324,
1.167475700378418,
0.8383728265762... |
func (cm *ConnManager) connHandler() {
connMap := make(map[uint64]*ConnReq, cm.cfg.TargetOutbound)
out:
for {
select {
case request := <-cm.reqChan:
switch req := request.(type) {
case connected:
connReq := req.c
connReq.conn = req.conn
connMap[connReq.id] = connReq
log.Printf("CONN:Connect... | [
-0.7811773419380188,
-1.320137858390808,
0.780623733997345,
0.1509723961353302,
0.09024353325366974,
0.2899725139141083,
-0.2686631977558136,
0.2749079465866089,
-0.1906559318304062,
-0.2854108214378357,
-0.08739583194255829,
-0.7615769505500793,
-0.326153039932251,
0.7803906202316284,
0... |
func NewMockNotary(ctrl *gomock.Controller) *MockNotary {
mock := &MockNotary{ctrl: ctrl}
mock.recorder = &MockNotaryMockRecorder{mock}
return mock
} | [
-0.5117307901382446,
0.1411527544260025,
0.17031939327716827,
0.46931734681129456,
0.31432637572288513,
-0.12194222211837769,
-0.3219747841358185,
-0.675369143486023,
-0.11080382764339447,
0.4167749583721161,
-1.641431450843811,
0.0468144565820694,
0.11352541297674179,
1.057059645652771,
... |
func (m *MockNotary) EXPECT() *MockNotaryMockRecorder {
return m.recorder
} | [
0.0794452354311943,
0.1701582968235016,
0.21043813228607178,
0.12657922506332397,
0.20764672756195068,
0.4015122950077057,
-0.366960346698761,
-0.16014660894870758,
0.33020853996276855,
-0.3763674199581146,
0.2526560425758362,
0.4583340287208557,
-0.47552791237831116,
0.5487008690834045,
... |
func (m *MockNotary) Notarize(arg0 string) (map[string]interface{}, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Notarize", arg0)
ret0, _ := ret[0].(map[string]interface{})
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
-0.9855985045433044,
0.4798226058483124,
0.35646820068359375,
0.41839173436164856,
1.1233417987823486,
0.3054898977279663,
0.5150932669639587,
-0.2077733725309372,
-1.051948070526123,
-0.005337594076991081,
-0.43204209208488464,
-0.9719630479812622,
-1.0464919805526733,
1.5011935234069824,... |
func (mr *MockNotaryMockRecorder) Notarize(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Notarize", reflect.TypeOf((*MockNotary)(nil).Notarize), arg0)
} | [
-0.38452860713005066,
1.1389306783676147,
0.3826577365398407,
0.39313215017318726,
0.22643902897834778,
0.17529185116291046,
-0.22524656355381012,
-0.7950381636619568,
0.23802128434181213,
0.6903205513954163,
0.6316099762916565,
-0.04175405949354172,
-1.1293524503707886,
1.6655138731002808... |
func PlayerMaps(games []Game) (map[string][]Game, map[string]PlayerRating) {
m := make(map[string][]Game)
pr := make(map[string]PlayerRating)
for _, g := range games {
for _, p := range []PlayerRating{g.PlayerOne(), g.PlayerTwo()} {
if _, ok := m[p.UniqueId()]; !ok {
m[p.UniqueId()] = make([]Game, 0, 5)
... | [
-0.5818100571632385,
-0.5603145956993103,
0.7852799296379089,
-0.6544700264930725,
-0.18365423381328583,
0.35927048325538635,
0.11936074495315552,
-0.8277472257614136,
0.2777820825576782,
0.9149296879768372,
-0.028366073966026306,
-0.8508611917495728,
-0.9707747101783752,
-0.71523356437683... |
func New(config *configuration.Config, vs *library.Library) *Downloader {
return &Downloader{
Base: subapp.NewBase(AppName),
config: config,
library: vs,
}
} | [
0.5683123469352722,
-1.4793931245803833,
0.22019723057746887,
0.7107464671134949,
-0.6108678579330444,
0.008943646214902401,
-1.0432994365692139,
0.45645272731781006,
-0.5585556030273438,
0.10267722606658936,
-0.13933463394641876,
0.23573966324329376,
0.745164692401886,
1.0266152620315552,... |
func (d *Downloader) Name() string {
return AppName
} | [
-0.6069684028625488,
-1.171898603439331,
0.5321580767631531,
0.22207459807395935,
-1.326310157775879,
0.25867760181427,
-0.3513681888580322,
-0.16049838066101074,
0.10600952059030533,
1.0811916589736938,
-0.37117600440979004,
-0.22434133291244507,
0.7335277199745178,
1.2901965379714966,
... |
func (d *Downloader) Run(log *logrus.Entry) error {
log = log.WithField("app", AppName)
// Init the app
d.InitStart(log)
log.Debug("downloader started")
d.event = make(chan struct{}, 1)
if d.config.Downloader.LaunchAtStartup {
log.Debug("initial downloader launch")
d.event <- struct{}{}
}
// Start the s... | [
0.10514988005161285,
-0.7445071339607239,
1.0319339036941528,
0.3907354176044464,
-0.29351186752319336,
0.024082506075501442,
-0.16709913313388824,
0.7535046935081482,
-0.11168741434812546,
-0.02260245569050312,
-0.3308250308036804,
0.3622530400753021,
0.1986439824104309,
0.487988770008087... |
func Init() {
go func() {
http.HandleFunc("/ws", wsHandler)
http.ListenAndServe(":8080", nil)
}()
p = pat.New()
setWeb()
chk(http.ListenAndServe(":80", p))
} | [
0.2752422094345093,
0.3837825655937195,
0.5183283686637878,
-0.03298095986247063,
0.30668166279792786,
1.339015245437622,
0.8141062259674072,
0.39320024847984314,
-0.21875034272670746,
-1.0733938217163086,
0.16792155802249908,
1.0373014211654663,
0.5219729542732239,
1.112771987915039,
0.... |
func ReloadLogs() {
ReloadRuntimeLogs()
ReloadDownloadLogs()
} | [
0.25366830825805664,
-0.12828834354877472,
0.3610270619392395,
1.0792564153671265,
-0.24779978394508362,
-0.6628957390785217,
-0.27485018968582153,
-1.0930484533309937,
0.12088706344366074,
0.07486903667449951,
0.024022165685892105,
1.6917599439620972,
0.008025048300623894,
0.5576790571212... |
func logDownload(typ string, statuscode int, p *MirrorlistPage, err error) {
dlogger.RLock()
defer dlogger.RUnlock()
if dlogger.l == nil {
// Logs are disabled
return
}
if statuscode == 302 || statuscode == 200 {
var distance, countries string
m := p.MirrorList[0]
distance = strconv.FormatFloat(float64... | [
-0.45084577798843384,
-0.6240445971488953,
0.9508745074272156,
-1.0022196769714355,
-0.46952173113822937,
0.178830087184906,
0.023255756124854088,
0.6296666860580444,
0.07204410433769226,
0.3815792202949524,
-0.1230502724647522,
0.4147023856639862,
-0.42762628197669983,
0.4911130964756012,... |
func ParseHexDump(data []byte) ([]byte, error) {
var result bytes.Buffer
for {
match := reLine.FindSubmatchIndex(data)
if match == nil {
return result.Bytes(), nil
}
bytes := data[match[2]:match[3]]
data = data[match[1]:]
for {
m := reByte.FindSubmatchIndex(bytes)
if m == nil {
break
}
... | [
-0.17220181226730347,
0.11422646045684814,
0.8905754089355469,
-0.4830991327762604,
0.14840681850910187,
-0.6361515522003174,
0.4563596546649933,
0.5229858160018921,
0.32482609152793884,
-0.9101844429969788,
-0.9329462051391602,
-0.8964545726776123,
-0.4498877227306366,
-0.1819118261337280... |
func Initialize() (common.Configuration, error) {
// args
spaceKey := flag.String("spaceKey", "", "The Key of the space to process")
reportType := flag.String("reportType", "csv", "Type of report to generate (csv or json) - csv is default")
allSpacesFlag := flag.Bool("allSpaces", false, "Should we process all space... | [
0.17832137644290924,
0.5761998891830444,
0.6840488910675049,
0.11947299540042877,
0.01403763797134161,
0.04125405475497246,
-0.26705724000930786,
0.543545126914978,
-0.7699456214904785,
0.28340113162994385,
0.3130154311656952,
0.07376312464475632,
-0.8153232932090759,
1.0685607194900513,
... |
func TestCreateSite(t *testing.T) {
fmt.Println("RUNNING: Test Create Site")
// Always remove whatever testing data we created.
defer RemoveTestData(t)
var emptyAP = []entities.AccessPoint{}
example_site := entities.Site{test_prefix + "one", test_prefix + "role1", test_prefix + "uri1", emptyAP}
fmt.Println("\tCr... | [
0.06764275580644608,
0.6170433163642883,
0.1362195909023285,
-0.2773275673389435,
0.9104481935501099,
0.14884720742702484,
0.38215330243110657,
-0.37906646728515625,
0.7946131825447083,
-0.06886595487594604,
-0.3173918128013611,
0.14861230552196503,
0.06102355942130089,
-0.4268639683723449... |
func TestEditSite(t *testing.T) {
fmt.Println("RUNNING: Test Update Site")
// Always remove whatever testing data we created.
defer RemoveTestData(t)
var emptyAP = []entities.AccessPoint{}
var access_points = []entities.AccessPoint{}
ap := entities.AccessPoint{"pet", "http://pets.com"}
ap1 := entities.AccessPoin... | [
-0.31822332739830017,
-0.121468186378479,
0.36410921812057495,
-0.7797337770462036,
0.2772415280342102,
0.2914741635322571,
0.3747837245464325,
0.23737862706184387,
0.022031079977750778,
0.285727322101593,
-0.18063056468963623,
0.5616244077682495,
0.10289248824119568,
-0.7581707835197449,
... |
func TestDeleteSite (t *testing.T) {
fmt.Println("RUNNING: Test Delete Site")
defer RemoveTestData(t)
var access_points = []entities.AccessPoint{}
ap := entities.AccessPoint{"pet", "http://pets.com"}
ap1 := entities.AccessPoint{"book", "Harry Potter"}
ap2 := entities.AccessPoint{"cat", "Olive"}
access_points = a... | [
0.2675588130950928,
-0.012034177780151367,
0.3016081750392914,
-0.16605664789676666,
0.5702086091041565,
0.5441139340400696,
0.617676317691803,
0.1581140160560608,
0.49684080481529236,
-0.3260120153427124,
0.0838308036327362,
0.4028448760509491,
-0.06143824756145477,
-0.282577782869339,
... |
func createTestSite(t *testing.T, site entities.Site, expected_response_code int) {
site_json, _ := site.ToJson()
resp, err := http.Post(url + "/sites", "application/json", bytes.NewBuffer(site_json))
if err != nil {
t.Error("Error running test: " + err.Error())
return
}
// Ensure we got the expected response... | [
0.18769922852516174,
0.22562189400196075,
0.3136782646179199,
-0.723621666431427,
0.9058756232261658,
-0.1558973640203476,
0.06042678281664848,
-0.32004615664482117,
0.09533868730068207,
0.07597513496875763,
0.31551799178123474,
-0.24922136962413788,
-0.8781017065048218,
-0.161953240633010... |
func Start(ctx context.Context, addr string, svc domain.CustomerService) error {
s := newServer(svc)
srv := http.Server{
Addr: addr,
Handler: handlers.LoggingHandler(os.Stdout, handlers.ProxyHeaders(s.router)),
}
errs := make(chan error)
go func() {
errs <- srv.ListenAndServe()
}()
select {
case err... | [
0.7754374742507935,
-0.08245499432086945,
0.6101635694503784,
-0.04490240290760994,
-0.5554469227790833,
-0.28501757979393005,
-0.0035419389605522156,
-0.11666937917470932,
-0.4252360463142395,
0.35361695289611816,
0.39490756392478943,
1.610191822052002,
-0.23685511946678162,
0.04001450538... |
func outputJSON(data interface{}) (int, error) {
if err := json.NewEncoder(os.Stdout).Encode(data); err != nil {
return 1, err
}
return 0, nil
} | [
-1.1319372653961182,
-0.3408105671405792,
0.7790053486824036,
0.26633188128471375,
-1.1964918375015259,
-0.8970513939857483,
1.0202947854995728,
-0.6505922675132751,
0.04939049854874611,
0.803164541721344,
-0.2674087882041931,
0.5069819688796997,
-0.7147093415260315,
0.8317741751670837,
... |
func NewGopper(cachelocation, cachelocationsysljson, fsType, accept string) (*gop.GopperService, error) {
r := gop.GopperService{}
switch fsType {
case "os":
r.Gopper = gop_filesystem.New(afero.NewOsFs(), MemoryLoc(accept))
case "mem", "memory", "":
r.Gopper = gop_filesystem.New(MemoryFs(accept), "/")
case "gc... | [
-0.2743224501609802,
-0.17577201128005981,
0.5761549472808838,
0.033687200397253036,
-0.327056884765625,
0.1787039041519165,
-0.7489151954650879,
-0.3615981638431549,
-0.23466332256793976,
0.2807435393333435,
0.13130079209804535,
0.024531586095690727,
-0.5005428791046143,
0.998706281185150... |
func (c *Client) UpdateAssetModel(ctx context.Context, params *UpdateAssetModelInput, optFns ...func(*Options)) (*UpdateAssetModelOutput, error) {
if params == nil {
params = &UpdateAssetModelInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateAssetModel", params, optFns, c.addOperationUpdateAssetMod... | [
-1.4836879968643188,
-0.40796732902526855,
0.7903183102607727,
0.22348526120185852,
-0.3655599355697632,
0.2841706871986389,
0.5633571743965149,
-1.00296151638031,
0.08113512396812439,
0.31224244832992554,
-0.7338981032371521,
0.7595000267028809,
0.05922841653227806,
-0.9999068379402161,
... |
func (br *BaseRoutine) TableName() string {
return "base_routines"
} | [
0.3892723619937897,
-0.039283785969018936,
0.5132966041564941,
0.7208148837089539,
0.13500002026557922,
0.07782075554132462,
0.5111005902290344,
-0.018104005604982376,
-0.6876726150512695,
0.03921167552471161,
-0.4659225344657898,
0.5104815363883972,
-0.3560998737812042,
0.359881728887558,... |
func (br *BaseRoutine) GetBaseRoutineAssociations() {
baseExercises := []*BaseExercise{}
storage.DB.Model(&br).Association("BaseExercises").Find(&baseExercises)
for i := 0; i < len(baseExercises); i++ {
baseExercises[i].GetBaseExerciseAssociations()
}
br.BaseExercises = baseExercises
routineCategory := Routi... | [
-0.42754191160202026,
0.06811107695102692,
0.7210282683372498,
-0.2982146441936493,
0.667006254196167,
-0.1944100260734558,
0.9631571769714355,
-0.34580835700035095,
-0.2357608824968338,
-0.21699188649654388,
-0.2326560914516449,
-0.061599910259246826,
-0.5302987098693848,
0.36111319065093... |
func Log(handler http.Handler) http.Handler {
return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
fmt.Println(req)
handler.ServeHTTP(res, req)
})
} | [
0.24736399948596954,
0.15057231485843658,
0.5569519400596619,
0.1264970302581787,
-0.7180387377738953,
0.496582567691803,
0.1405181586742401,
0.6384478807449341,
-0.09064053744077682,
-1.239226222038269,
-0.08732031285762787,
0.1349865347146988,
0.9766958355903625,
0.3632981777191162,
-0... |
func logIn(res http.ResponseWriter, req *http.Request) {
// retrive the name form URL
name := req.FormValue("name")
name = html.EscapeString(name)
if name != "" {
uuid := generateUniqueId()
sessionsSyncLoc.Lock()
sessions[uuid] = name
sessionsSyncLoc.Unlock()
// save uuid in the cookie
cookie := http.C... | [
-0.8381686210632324,
0.24802051484584808,
0.6792576313018799,
0.20498663187026978,
-0.6685194373130798,
-0.3527507483959198,
0.5949225425720215,
0.3920172452926636,
0.5709398984909058,
0.1154908686876297,
-0.48256659507751465,
-0.2491220384836197,
-0.47685444355010986,
-0.2800111770629883,... |
func generateUniqueId() string {
cmd := exec.Command("/usr/bin/uuidgen")
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
log.Fatal(err)
}
uuid := out.String()
uuid = strings.Replace(uuid, "\n", "", 1)
return uuid
} | [
0.40940022468566895,
-0.08876468241214752,
0.8366858959197998,
-0.0810522511601448,
-0.1424517184495926,
0.28527548909187317,
0.31438133120536804,
1.3575514554977417,
0.08447615057229996,
-0.3712750971317291,
-0.1611858755350113,
0.3745558261871338,
-0.42071211338043213,
0.2016322165727615... |
func loginForm(res http.ResponseWriter, req *http.Request) {
//check if the user is login
name, correctlyLogIn := getNameAndCookie(res, req)
res.Header().Set("Content-Type", "text/html")
if !correctlyLogIn {
fmt.Fprintf(
res,
`<html>
<body>
<form action="login">
What is your name, Earthling?
... | [
-0.34724050760269165,
-0.1892910897731781,
0.7266717553138733,
0.31588298082351685,
-0.6748278141021729,
-0.16371247172355652,
-0.8441110849380493,
-0.5503372550010681,
0.07025314122438431,
-0.3708483874797821,
0.13994549214839935,
-0.4346349835395813,
-0.1285058706998825,
0.39485624432563... |
func invalidateCookie(res http.ResponseWriter) {
// set the experiation date to last year
expire := time.Now().AddDate(-1, 0, 0)
cookie := http.Cookie{Name: "uuid", Path: "/", Expires: expire}
http.SetCookie(res, &cookie)
} | [
-0.15390783548355103,
0.19298797845840454,
0.703365683555603,
0.07906784862279892,
0.13005532324314117,
0.10128087550401688,
-0.14946036040782928,
1.0465391874313354,
-0.6276506185531616,
0.4693453013896942,
0.8666518330574036,
0.1998162865638733,
-0.6348536610603333,
0.2915598452091217,
... |
func logOut(res http.ResponseWriter, req *http.Request) {
invalidateCookie(res)
fmt.Fprintf(
res,
`<html>
<head>
<META http-equiv="refresh" content="10;URL=/index.html">
<body>
<p>Good-bye.</p>
</body>
</html>`,
)
} | [
-0.20152516663074493,
0.2361232191324234,
0.5075259208679199,
-0.13249222934246063,
-0.11792346835136414,
-0.240925595164299,
-0.15337976813316345,
-0.07941198348999023,
0.17797577381134033,
0.40817150473594666,
0.7221609354019165,
0.37260153889656067,
-0.029171057045459747,
-0.50891470909... |
func getNameAndCookie(res http.ResponseWriter, req *http.Request) (string, bool) {
var name string
var ok bool
var cookie, err = req.Cookie("uuid")
//correctlyLogIn - means that both cookie and name exists
correctlyLogIn := false
// if the cookie is set up
if err == nil {
// retrive the name, before the acc... | [
-1.0607799291610718,
-1.129783034324646,
0.8871062994003296,
0.2549740970134735,
-0.7555223107337952,
-0.5201672911643982,
-0.3127018213272095,
-0.08235061168670654,
0.16913114488124847,
0.7853062152862549,
0.28770020604133606,
-0.3459222912788391,
-0.3399501442909241,
0.02508109249174595,... |
func getTime(res http.ResponseWriter, req *http.Request) {
now := time.Now().Format("3:04:05 PM")
displayName := ""
name, correctlyLogIn := getNameAndCookie(res, req)
if correctlyLogIn {
displayName = `, ` + name
}
res.Header().Set("Content-Type", "text/html")
fmt.Fprintf(
res,
`<doctype html>
<ht... | [
-0.4047929644584656,
0.048201628029346466,
0.9439014196395874,
0.5067368745803833,
-0.14885994791984558,
-0.18036513030529022,
-0.4572165012359619,
-0.45971617102622986,
0.23715314269065857,
1.1496111154556274,
0.12519259750843048,
-0.2945590019226074,
-0.28637397289276123,
1.0419460535049... |
func unknownRoute(res http.ResponseWriter, req *http.Request) {
res.WriteHeader(http.StatusNotFound)
res.Header().Set("Content-Type", "html")
fmt.Fprintf(
res,
`<html>
<body>
<p>These are not the URLs you're looking for.</p>
</body>
</html>`,
)
} | [
-0.2900366187095642,
-0.32980039715766907,
0.5611087679862976,
-0.6379989981651306,
0.11724039912223816,
-0.09580262005329132,
-0.10159162431955338,
0.847784698009491,
-0.7808586359024048,
-0.17506471276283264,
0.48331552743911743,
0.029658570885658264,
-0.27276530861854553,
0.283506780862... |
func main() {
var port int
var version bool
sessions = make(map[string]string)
sessionsSyncLoc = new(sync.RWMutex)
// parse the flags
flag.IntVar(&port, "port", 8080, "used port")
flag.BoolVar(&version, "V", false, "version of the program")
flag.Parse()
// if user type -V, the V flag is set up to true
if v... | [
-0.08468178659677505,
-0.747329592704773,
0.9954219460487366,
0.958301842212677,
0.15894553065299988,
0.30600881576538086,
0.5944607257843018,
0.6004844307899475,
0.19800546765327454,
-0.036230795085430145,
0.016578057780861855,
0.4202074408531189,
-0.1554613709449768,
0.230565145611763,
... |
func NewZtunnelComponent(opts *Options) *ZtunnelComponent {
return &ZtunnelComponent{
&CommonComponentFields{
Options: opts,
ComponentName: name.ZtunnelComponentName,
},
}
} | [
0.284168541431427,
-0.6522504091262817,
0.1606638878583908,
-1.801764965057373,
-0.44787415862083435,
-0.5933609008789062,
1.077998399734497,
-0.5429876446723938,
0.4474727213382721,
0.11883028596639633,
0.2830338180065155,
0.12413407862186432,
0.1160258799791336,
-0.7988554239273071,
-0... |
func (c *ZtunnelComponent) Run() error {
return runComponent(c.CommonComponentFields)
} | [
0.011860329657793045,
-0.6166703104972839,
0.19897130131721497,
-1.2837767601013184,
0.5184375047683716,
0.18391652405261993,
1.417177438735962,
-0.43829452991485596,
-0.1802191287279129,
-0.5418696999549866,
-0.6523380279541016,
-0.8301197290420532,
-0.8522704243659973,
-0.631632030010223... |
func (c *ZtunnelComponent) RenderManifest() (string, error) {
return renderManifest(c, c.CommonComponentFields)
} | [
-0.2456958293914795,
-0.7710161805152893,
0.11496289074420929,
-1.3958419561386108,
-0.25676774978637695,
-0.2924812138080597,
-0.5151720643043518,
-0.28924593329429626,
0.4042701721191406,
-0.4112130105495453,
-0.2759544551372528,
-0.8725914359092712,
-1.2312930822372437,
-0.6288618445396... |
func (c *ZtunnelComponent) ComponentName() name.ComponentName {
return c.CommonComponentFields.ComponentName
} | [
-0.09082037955522537,
-0.8271093368530273,
0.370565801858902,
-0.9413557648658752,
0.2688615918159485,
0.06590709835290909,
1.6013946533203125,
-0.017972663044929504,
0.18486513197422028,
0.17788654565811157,
0.2038743644952774,
-0.4562757611274719,
-0.0973200872540474,
-0.7475100159645081... |
func (c *ZtunnelComponent) ResourceName() string {
return c.CommonComponentFields.ResourceName
} | [
0.0843731164932251,
-0.7086196541786194,
0.2462388575077057,
-0.9787614345550537,
0.26482951641082764,
-0.14058281481266022,
1.6855649948120117,
0.1647764891386032,
0.20075784623622894,
0.4076198935508728,
0.46302950382232666,
-1.1283881664276123,
-0.24721300601959229,
-1.1514782905578613,... |
func (c *ZtunnelComponent) Namespace() string {
return c.CommonComponentFields.Namespace
} | [
0.7118008136749268,
-0.8403725028038025,
0.12806005775928497,
-0.663323700428009,
0.6586366295814514,
0.09840720146894455,
1.077949047088623,
-1.0509651899337769,
0.6585459113121033,
-0.926389753818512,
-0.023434875532984734,
-0.5890024304389954,
-0.5489789247512817,
-0.7624536156654358,
... |
func (c *ZtunnelComponent) Enabled() bool {
return isCoreComponentEnabled(c.CommonComponentFields)
} | [
0.520487904548645,
-0.5272696614265442,
0.4114360213279724,
-0.70973140001297,
0.5792799592018127,
0.3129798471927643,
1.0239492654800415,
0.10521814227104187,
0.08170060068368912,
-0.06224939227104187,
-1.0709495544433594,
-0.7269718050956726,
-0.8188592195510864,
-0.2712506949901581,
0... |
func (m *monitor) Start() error {
log.Info("sensor: starting monitors...")
// if err := m.peMon.Start(); err != nil {
// return err
// }
if err := m.fanMon.Start(); err != nil {
log.
WithError(err).
Error("sensor: composite monitor - FAN failed to start running")
closeAll(m.closeAfterDone)
return e... | [
-0.41638967394828796,
-0.7003684639930725,
0.3522266149520874,
0.32043617963790894,
1.1197775602340698,
0.4343130886554718,
0.609151303768158,
-0.529087483882904,
-0.5419576168060303,
-0.26866698265075684,
-0.22819451987743378,
0.33973878622055054,
-0.6176273226737976,
0.8609548807144165,
... |
func dupAppStdStream(w io.Writer, kind string) (*os.File, *os.File, error) {
filename := filepath.Join(app.DefaultArtifactDirPath, "app_"+kind+".log")
f, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY, 0o644)
if err != nil {
return nil, nil, fmt.Errorf("cannot open file %q to duplicate app's %s stream: %w",... | [
0.24224625527858734,
-0.46358898282051086,
0.8696866631507874,
0.16393333673477173,
-0.7526108622550964,
0.3607461154460907,
0.5547415018081665,
0.04418463259935379,
-0.22969961166381836,
0.5700656175613403,
0.2291288524866104,
0.4262751638889313,
1.0928841829299927,
0.4192187786102295,
... |
func (m *manager) Controllers() (map[string]controller.Controller, error) {
gcontroller := group.AsController(plugin.NewAddressable("group", m.Options.Name.LookupOnly(), ""), m)
controllers := map[string]controller.Controller{
"groups": gcontroller,
}
all, err := m.Plugin.InspectGroups()
if err != nil {
retur... | [
-0.5871638655662537,
-0.32781174778938293,
0.37386617064476013,
-0.9646985530853271,
-0.24393029510974884,
-0.46228837966918945,
-0.14772118628025055,
-0.8879870176315308,
0.7829756140708923,
-0.20119884610176086,
0.07023416459560394,
0.19598034024238586,
0.1796754002571106,
0.132697194814... |
func createActualUpdateMessage(actualValue string) DeviceTwinUpdate {
var deviceTwinUpdateMessage DeviceTwinUpdate
actualMap := map[string]*MsgTwin{"state": {Actual: &TwinValue{Value: &actualValue}, Metadata: &TypeMetadata{Type: "Updated"}}}
deviceTwinUpdateMessage.Twin = actualMap
return deviceTwinUpdateMessage
} | [
-1.0058358907699585,
-0.9893096685409546,
0.49154311418533325,
-0.8146219253540039,
-0.8129083514213562,
0.56019127368927,
0.27537059783935547,
-0.1320325881242752,
-0.43179264664649963,
0.6352294683456421,
0.057915668934583664,
-0.1047021821141243,
0.43293309211730957,
0.1261163204908371,... |
func (item *item) touch() {
if item.ttl > 0 {
item.expireAt = time.Now().Add(item.ttl)
}
} | [
0.08859175443649292,
-0.3574282228946686,
0.5436537861824036,
-0.6252061724662781,
0.8953092694282532,
0.16033276915550232,
-0.6068156361579895,
0.42582741379737854,
0.04079251363873482,
1.1860074996948242,
-0.5790503621101379,
-0.6615704894065857,
0.03324024751782417,
0.2981114089488983,
... |
func (item *item) expired() bool {
if item.ttl <= 0 {
return false
}
return item.expireAt.Before(time.Now())
} | [
-0.5800963640213013,
-0.9357668161392212,
0.5273062586784363,
0.4325735867023468,
0.1647615134716034,
0.08353091776371002,
-1.6041306257247925,
-0.17812132835388184,
0.020980549976229668,
0.6081721186637878,
-0.967541515827179,
-0.42030254006385803,
0.010404321365058422,
0.2465661168098449... |
func (k *Kademlia) FindRoot(req FindDirRequest, res *FindDirResult) {
res.MsgID = CopyID(req.MsgID)
res.Inode = req.StartInode
res.Key = req.StartKey
return
} | [
-0.5285288095474243,
-0.40352916717529297,
0.3165373206138611,
0.6639024019241333,
-0.5803560614585876,
-0.5773090720176697,
0.5428243279457092,
-0.3988679349422455,
0.22125479578971863,
0.8288338780403137,
0.23797717690467834,
1.0178560018539429,
-1.3873608112335205,
1.0150443315505981,
... |
func NewUser(db *sql.DB) *User {
var dbx = sqlx.NewDb(db, "postgres")
return &User{
db: dbx,
}
} | [
0.2598856985569,
0.7209280133247375,
0.3091554343700409,
1.0414457321166992,
-0.733386218547821,
0.2404060959815979,
-0.5363317728042603,
-0.5812366008758545,
0.2826599180698395,
-0.49621137976646423,
-0.453914999961853,
0.34225204586982727,
0.04278917610645294,
0.01453275978565216,
-0.1... |
func (_m *Converter) DetailsToGraphQLInput(id string, deprecated model.ServiceDetails) (model.GraphQLServiceDetailsInput, error) {
ret := _m.Called(id, deprecated)
var r0 model.GraphQLServiceDetailsInput
if rf, ok := ret.Get(0).(func(string, model.ServiceDetails) model.GraphQLServiceDetailsInput); ok {
r0 = rf(id... | [
-0.18719932436943054,
0.18040351569652557,
0.7156480550765991,
-0.6355347633361816,
-0.10943935066461563,
0.11622124910354614,
0.019114956259727478,
-0.9892160296440125,
-0.02678598463535309,
-0.9077907800674438,
-0.4141811728477478,
0.3906688988208771,
0.20011724531650543,
0.2008196562528... |
func (_m *Converter) GraphQLToServiceDetails(converted model.GraphQLServiceDetails) (model.ServiceDetails, error) {
ret := _m.Called(converted)
var r0 model.ServiceDetails
if rf, ok := ret.Get(0).(func(model.GraphQLServiceDetails) model.ServiceDetails); ok {
r0 = rf(converted)
} else {
r0 = ret.Get(0).(model.S... | [
0.040889810770750046,
-0.27636003494262695,
0.5605518817901611,
-0.662483274936676,
-0.26250770688056946,
0.44181790947914124,
0.3738526701927185,
-0.9143165946006775,
-0.34076154232025146,
-0.5817700624465942,
0.14805465936660767,
0.2806311249732971,
0.3613583743572235,
0.7272510528564453... |
func (_m *Converter) ServiceDetailsToService(in model.ServiceDetails, serviceID string) (model.Service, error) {
ret := _m.Called(in, serviceID)
var r0 model.Service
if rf, ok := ret.Get(0).(func(model.ServiceDetails, string) model.Service); ok {
r0 = rf(in, serviceID)
} else {
r0 = ret.Get(0).(model.Service)
... | [
-0.21806925535202026,
-0.4222491383552551,
0.317740797996521,
-0.3654293119907379,
-0.09736783802509308,
0.30099815130233765,
0.5100084543228149,
-0.7297157049179077,
-0.3388341963291168,
-0.12578986585140228,
0.07360436767339706,
0.48328351974487305,
-0.007168292999267578,
1.0139052867889... |
func checkStatus2(
done <-chan interface{},
urls ...string,
) <-chan Result {
results := make(chan Result)
go func() {
defer close(results)
for _, url := range urls {
var result Result
resp, err := http.Get(url)
result = Result{Error: err, Response: resp}
select {
case <-done:
return
case ... | [
-0.6094342470169067,
-0.6286634802818298,
0.6778882741928101,
0.6904970407485962,
-0.16325992345809937,
-0.08833105862140656,
-0.6123441457748413,
-0.6158467531204224,
-0.5559123158454895,
0.019975459203124046,
-0.3446635603904724,
0.2592218816280365,
-0.24485617876052856,
0.64256167411804... |
func runCheckStatus2() {
done := make(chan interface{})
defer close(done)
urls := []string{"https://www.google.com", "https://badhost"}
for result := range checkStatus2(done, urls...) {
if result.Error != nil {
fmt.Printf("error: %v\n", result.Error)
continue
}
fmt.Printf("Response: %v\n", result.Respon... | [
-0.6368919014930725,
-0.7185443043708801,
0.5580486059188843,
0.6569843292236328,
0.552603006362915,
0.6863465309143066,
0.23302941024303436,
-0.05466092377901077,
-0.5961751937866211,
-0.41905471682548523,
-0.5424835085868835,
0.9573562741279602,
-0.22156164050102234,
1.4242438077926636,
... |
func NewHTTP() *HTTP {
return HTTPPool.Get().(*HTTP)
} | [
0.043783076107501984,
-0.17196692526340485,
0.10574132949113846,
0.9542888402938843,
-0.8722455501556396,
0.35292160511016846,
-0.5400707125663757,
-0.8730247616767883,
0.1416279375553131,
0.10619987547397614,
0.5314203500747681,
0.8385562896728516,
-0.04023158177733421,
-0.692840099334716... |
func (q *HTTP) GetID() uint64 {
return q.id
} | [
0.2994530498981476,
-0.29764753580093384,
0.44983869791030884,
0.6967334151268005,
0.6992857456207275,
1.2651280164718628,
-0.24327623844146729,
-0.49930644035339355,
0.9826328158378601,
-0.5795905590057373,
0.027897199615836143,
0.3729245662689209,
-1.3676420450210571,
1.3079423904418945,... |
func (q *HTTP) SetID(n uint64) {
q.id = n
} | [
-0.2984090745449066,
-0.015378161333501339,
0.15599679946899414,
0.609156608581543,
0.3807027339935303,
1.688661813735962,
-0.6496953368186951,
-0.6549667119979858,
0.8468317985534668,
-0.47807079553604126,
-0.9304560422897339,
-0.13147127628326416,
-0.857932984828949,
1.9916373491287231,
... |
func (q *HTTP) String() string {
return fmt.Sprintf("HumanLabel: \"%s\", HumanDescription: \"%s\", Method: \"%s\", Path: \"%s\", Body: \"%s\"", q.HumanLabel, q.HumanDescription, q.Method, q.Path, q.Body)
} | [
-0.5367634892463684,
-1.4518030881881714,
0.5898494720458984,
-1.2711873054504395,
-0.1287413239479065,
1.1136267185211182,
-0.21877239644527435,
-1.3386822938919067,
-0.7093162536621094,
-0.07465413212776184,
-0.11032024770975113,
1.3403650522232056,
-0.6509689688682556,
0.101669356226921... |
func (q *HTTP) HumanLabelName() []byte {
return q.HumanLabel
} | [
-0.9498186111450195,
-0.8926569819450378,
0.48657581210136414,
0.12245765328407288,
-0.3871753215789795,
1.2957614660263062,
-1.1399421691894531,
-0.28135621547698975,
-0.0748349130153656,
0.2837219834327698,
-0.4708828330039978,
0.01859576627612114,
-0.21755574643611908,
0.438691020011901... |
func (q *HTTP) HumanDescriptionName() []byte {
return q.HumanDescription
} | [
-0.35478782653808594,
-0.048081330955028534,
0.5631107091903687,
0.3141801357269287,
-0.6192012429237366,
0.6319705247879028,
-0.6335625648498535,
-0.18147802352905273,
-0.414959192276001,
0.5275393724441528,
-0.4942251443862915,
0.22642846405506134,
-0.06264394521713257,
0.705651104450225... |
func (q *HTTP) Release() {
q.HumanLabel = q.HumanLabel[:0]
q.HumanDescription = q.HumanDescription[:0]
q.id = 0
q.Method = q.Method[:0]
q.Path = q.Path[:0]
q.Body = q.Body[:0]
q.StartTimestamp = 0
q.EndTimestamp = 0
HTTPPool.Put(q)
} | [
-1.4123557806015015,
-0.22559311985969543,
0.4154165983200073,
-1.5363075733184814,
0.2687353789806366,
0.4130566716194153,
-0.8700511455535889,
-0.8216490745544434,
-0.3683352768421173,
0.1161874458193779,
-0.25614655017852783,
1.4296587705612183,
-1.290851354598999,
0.5271328091621399,
... |
func LanguageOf(char interface{}) string {
for lang, langRange := range langMap {
if langRange.index(char) != -1 {
return lang
}
}
// Still not found then something wrong
return "unknown"
} | [
-0.14433401823043823,
-0.8053175210952759,
0.4865032136440277,
-0.6142481565475464,
-0.911492645740509,
-0.14460262656211853,
-0.03415758162736893,
-0.47994354367256165,
0.04205726087093353,
0.13433189690113068,
0.34195178747177124,
-0.4202500879764557,
0.10110543668270111,
-0.034488555043... |
func CharCompare(char1, char2 interface{}) bool {
if char1 == char2 {
return true
}
char1Index := langMap[LanguageOf(char1)].index(char1)
char2Index := langMap[LanguageOf(char2)].index(char2)
if char1Index == char2Index {
return true
}
return false
} | [
-0.49666842818260193,
-0.9944561719894409,
0.5474032163619995,
-0.49848708510398865,
-0.602168083190918,
-0.06424126774072647,
-1.022985816001892,
-0.2508506774902344,
-1.1471281051635742,
0.39077985286712646,
-0.883491575717926,
0.3439421057701111,
-0.45730775594711304,
-0.507960021495819... |
func GetDestinationRule(k8sClient kubernetes.Interface, istioClient istio.Interface, name string, namespace string) (*DestinationRuleDetail, error) {
destinationRule, err := istioClient.NetworkingV1alpha3().DestinationRules(namespace).Get(name, metaV1.GetOptions{})
if err != nil {
return nil, err
}
return ToDest... | [
0.13834215700626373,
0.8588411808013916,
0.5766048431396484,
-0.5297882556915283,
0.6745705008506775,
0.6926015615463257,
-0.8015058636665344,
-0.26483768224716187,
-0.5780647397041321,
1.1743967533111572,
0.20205724239349365,
0.6142837405204773,
0.005500598344951868,
-0.009616643190383911... |
func (env *env) newTestHelperCreateLgr(id string, t *testing.T) *testhelper {
genesisBlk, err := constructTestGenesisBlock(id)
assert.NoError(t, err)
lgr, err := env.ledgerMgr.CreateLedger(id, genesisBlk)
assert.NoError(t, err)
client, committer, verifier := newClient(lgr, id, t), newCommitter(lgr, t), newVerifier... | [
0.684060275554657,
-0.19794602692127228,
0.40737542510032654,
-0.7448011040687561,
0.3784494996070862,
0.4176512658596039,
-0.36930981278419495,
-0.5785224437713623,
-0.8195199370384216,
0.3996528387069702,
0.08060231059789658,
0.12586475908756256,
-0.7654271721839905,
1.3180615901947021,
... |
func (env *env) newTestHelperOpenLgr(id string, t *testing.T) *testhelper {
lgr, err := env.ledgerMgr.OpenLedger(id)
assert.NoError(t, err)
client, committer, verifier := newClient(lgr, id, t), newCommitter(lgr, t), newVerifier(lgr, t)
return &testhelper{client, committer, verifier, lgr, id, assert.New(t)}
} | [
0.46966540813446045,
-0.5507954955101013,
0.33634281158447266,
-1.0952790975570679,
-0.36085668206214905,
0.2083166539669037,
-0.0027985344640910625,
-0.45592737197875977,
-0.31366172432899475,
0.10568905621767044,
0.294505774974823,
0.3251827359199524,
-0.7519663572311401,
0.9311448335647... |
func (h *testhelper) cutBlockAndCommitLegacy() *ledger.BlockAndPvtData {
defer func() {
h.simulatedTrans = nil
h.missingPvtData = make(ledger.TxMissingPvtDataMap)
}()
return h.committer.cutBlockAndCommitLegacy(h.simulatedTrans, h.missingPvtData)
} | [
0.0705454871058464,
-0.30262231826782227,
0.6466450095176697,
0.4271142780780792,
-0.30832356214523315,
0.4115586280822754,
-0.4360787570476532,
0.6262409090995789,
-0.2653518617153168,
0.6488021612167358,
-0.13624580204486847,
-0.14307887852191925,
-0.6372689604759216,
0.38617268204689026... |
func RandomIntArray(arrSize int, intRange int, positiveVal bool) []int {
rand.Seed(time.Now().UnixNano())
intArr := make([]int, arrSize)
for i := 0; i < arrSize; i++ {
intArr[i] = rand.Intn(intRange)
if !positiveVal {
if rand.Intn(2) == 1 {
intArr[i] = -intArr[i]
}
}
}
return intArr
} | [
-1.2744001150131226,
-0.8021456003189087,
0.7507452964782715,
0.6075249314308167,
-0.4420943260192871,
0.6526228189468384,
-0.3155631124973297,
-0.6992930769920349,
0.04451138526201248,
0.005013411398977041,
0.03602951392531395,
-0.08807115256786346,
-1.5056413412094116,
0.4730912744998932... |
func RandomString(maxlen int, charset string) string {
var s string
for i := 0; i < rand.Intn(maxlen)+1; i++ {
s = s + string(charset[rand.Intn(len(charset))])
}
return s
} | [
-0.20730416476726532,
0.5566845536231995,
0.1102907657623291,
-0.8932684659957886,
-0.6979966759681702,
0.6648349761962891,
-0.9660345911979675,
-0.45313727855682373,
0.0170452781021595,
-0.007353411056101322,
0.19797444343566895,
0.5033586025238037,
-0.4469016492366791,
-1.010107755661010... |
func newAWSSession(accessKeyID, secretAccessKey, region, asssumeRoleArn string) (*session.Session, error) {
var awsConf *aws.Config
if secretAccessKey != "" && accessKeyID != "" {
creds := credentials.NewStaticCredentials(accessKeyID, secretAccessKey, "")
awsConf = &aws.Config{Credentials: creds, Region: ®ion}... | [
0.03330593556165695,
-0.843985378742218,
0.5052700042724609,
-0.37159186601638794,
-1.2056902647018433,
-0.06967194378376007,
-0.4214305877685547,
-0.8833320140838623,
0.5892027616500854,
0.9610977172851562,
-0.0807684138417244,
0.6460843086242676,
0.10672927647829056,
-0.19160248339176178... |
func main() {
var (
sflag = flag.String("s", "localhost:8088", "address of api server")
wflag = flag.String("w", "localhost:8089", "address of wallet api server")
)
flag.Parse()
//args := flag.Args()
factom.SetFactomdServer(*sflag)
factom.SetWalletServer(*wflag)
fmt.Println("Using factomd at", *sflag)
fm... | [
0.37936678528785706,
0.12290360033512115,
0.9117178916931152,
-0.537803053855896,
0.8942050933837891,
0.24474303424358368,
0.3246094882488251,
0.3786408603191376,
-0.3615173399448395,
0.16344696283340454,
-0.18166431784629822,
0.8953779935836792,
-0.1897752434015274,
0.7653188109397888,
... |
func Decode(rc io.ReadCloser) (s beep.StreamSeekCloser, format beep.Format, err error) {
defer func() {
if err != nil {
err = errors.Wrap(err, "ogg/vorbis")
}
}()
d, err := oggvorbis.NewReader(rc)
if err != nil {
return nil, beep.Format{}, err
}
format = beep.Format{
SampleRate: beep.SampleRate(d.Samp... | [
0.18915097415447235,
-0.8127160668373108,
0.425944060087204,
0.17647236585617065,
-0.5718076825141907,
0.19266897439956665,
-0.25500527024269104,
-1.0870734453201294,
0.1723640263080597,
0.19154779613018036,
0.7375238537788391,
0.7627965807914734,
-0.5444384813308716,
0.6820204257965088,
... |
func (client *Client) GetProfileInfo() (model.User, error) {
var user model.User
err := client.RestAPI.Get(rest.Rq{
Result: &user,
URL: rest.URL{
Path: userInfoPath,
Params: rest.P{},
},
})
return user, err
} | [
0.3189295530319214,
-0.051956988871097565,
0.39332258701324463,
0.8951733708381653,
0.4809301197528839,
0.11351538449525833,
-0.44310325384140015,
-1.3727045059204102,
-0.3776910603046417,
-0.13987261056900024,
-0.8367220759391785,
-0.001507661654613912,
-0.7476837038993835,
-0.62797594070... |
func (client *Client) ChangePassword(currentPassword, newPassword string) (model.Tokens, error) {
var tokens model.Tokens
err := client.RestAPI.Put(rest.Rq{
Result: &tokens,
URL: rest.URL{
Path: userPasswordChangePath,
Params: rest.P{},
},
})
return tokens, err
} | [
-1.2312616109848022,
-0.7514527440071106,
0.4221111536026001,
0.6857361197471619,
-0.2610107958316803,
0.08702946454286575,
-1.0964534282684326,
0.3253099024295807,
-0.13006296753883362,
1.0805261135101318,
-0.7920656204223633,
1.5973905324935913,
-0.9207829833030701,
0.15530496835708618,
... |
func (client *Client) Login(login model.Login) (model.Tokens, error) {
var tokens model.Tokens
err := client.RestAPI.Post(rest.Rq{
Body: login,
Result: &tokens,
URL: rest.URL{
Path: userLoginPath,
Params: rest.P{},
},
})
return tokens, err
} | [
-1.1913983821868896,
-0.5598430037498474,
0.5299063324928284,
0.798477828502655,
-0.8936822414398193,
0.11590207368135452,
-0.9444869756698608,
0.04264802485704422,
0.15763801336288452,
-0.4861725866794586,
-1.2921212911605835,
0.9283702969551086,
-0.4713817238807678,
-0.48915648460388184,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.