text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (c *FakeHelms) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(helmsResource, c.ns, name), &v1alpha1.Helm{})
return err
} | [
0.47218987345695496,
0.24466393887996674,
0.3332422971725464,
0.48892930150032043,
0.7268715500831604,
0.24514098465442657,
0.501941442489624,
-1.126969337463379,
0.9172027111053467,
0.4557679295539856,
-0.5379533767700195,
0.36066123843193054,
-0.820410966873169,
0.46095988154411316,
-0... |
func (c *FakeHelms) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(helmsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.HelmList{})
return err
} | [
-0.6045289635658264,
-0.02821161411702633,
0.45454561710357666,
0.30286651849746704,
0.7227287292480469,
-0.5435743927955627,
0.6713356971740723,
-0.8665724992752075,
0.5530939698219299,
-0.7578422427177429,
-0.38077953457832336,
0.5493070483207703,
0.04012748599052429,
1.5272903442382812,... |
func (c *FakeHelms) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Helm, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(helmsResource, c.ns, name, pt, data, subresources...), &v1alpha1.Helm{})
if obj == nil {
return nil, err
}
return ob... | [
-0.16259586811065674,
-0.09052882343530655,
0.2921082377433777,
-0.09868539124727249,
-1.0329039096832275,
0.9471446871757507,
0.015255431644618511,
-0.5820221304893494,
0.43611258268356323,
-0.19824402034282684,
-0.36499062180519104,
0.7013055086135864,
-0.37301158905029297,
-0.0065022069... |
func (*EventServiceConfig) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*EventServiceConfig_GrpcService)(nil),
}
} | [
-0.976839542388916,
0.24947373569011688,
0.4673921763896942,
-0.23756757378578186,
0.3544270098209381,
-0.26078781485557556,
0.17831918597221375,
-0.061654333025217056,
0.5932934880256653,
0.29416316747665405,
-0.07295768707990646,
0.07171753793954849,
0.18250101804733276,
1.14596235752105... |
func NewCategoryQueryInMemory(db map[int]*model.Category) CategoryQuery {
return &categoryQueryInMemory{db}
} | [
-0.01149892807006836,
-0.627171516418457,
0.17876413464546204,
0.15362398326396942,
-1.5118118524551392,
-0.10091256350278854,
-0.23180189728736877,
-0.24586227536201477,
-0.338390588760376,
-0.34172287583351135,
0.2654413878917694,
0.21310770511627197,
-0.39075398445129395,
1.352107286453... |
func (q *categoryQueryInMemory) FindByID(id int) <-chan QueryResult {
output := make(chan QueryResult)
go func() {
defer close(output)
category, ok := q.db[id]
if !ok {
output <- QueryResult{Error: errors.New("category not found")}
return
}
output <- QueryResult{Result: category}
}()
return output... | [
0.3000298738479614,
0.2287856936454773,
0.32130610942840576,
-0.6640783548355103,
-0.6897796392440796,
-0.6615434885025024,
0.3767246603965759,
-1.7779208421707153,
-0.323542982339859,
-0.07440044730901718,
0.10487543791532516,
0.1112758070230484,
-0.6902590990066528,
1.696779727935791,
... |
func (q *categoryQueryInMemory) FindAll() <-chan QueryResult {
output := make(chan QueryResult)
go func() {
defer close(output)
var categories model.Categories
for _, v := range q.db {
categories = append(categories, *v)
}
output <- QueryResult{Result: categories}
}()
return output
} | [
0.3223455846309662,
0.3275904655456543,
0.38107234239578247,
0.07932504266500473,
-0.25302597880363464,
-0.03908172622323036,
-0.24438926577568054,
-0.988510012626648,
-0.481407105922699,
-0.6708646416664124,
0.3750123083591461,
0.05057090148329735,
-0.730898380279541,
1.842668890953064,
... |
func getInjectionTestDirs() (string, string, error) {
home := os.Getenv("EITHOME")
datahome := os.Getenv("EITDATAHOME")
if len(home) == 0 {
return "", "", errors.New("EITHOME not set")
}
if len(datahome) == 0 {
return "", "", errors.New("EITDATAHOME not set")
}
return home, datahome, nil
} | [
-0.5527157783508301,
-0.07981213182210922,
0.590283989906311,
-0.3518924117088318,
1.028132438659668,
0.4634610414505005,
0.9731144309043884,
0.2007921189069748,
0.4297793209552765,
0.8537194728851318,
-0.01560119166970253,
0.43982774019241333,
-1.2229262590408325,
0.707571268081665,
0.5... |
func setFault(t *testing.T, methods []string, rand bool, errno syscall.Errno,
probability int32, regexp string) {
client, conn, err := server.Connect()
if err != nil {
t.Fatalf("failed to connect to RPC server %v", err)
}
defer conn.Close()
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)... | [
0.5817737579345703,
-0.07366171479225159,
0.7299707531929016,
0.13096871972084045,
0.45966488122940063,
0.668434202671051,
-0.17887011170387268,
-0.19590070843696594,
0.369931161403656,
-0.42989611625671387,
-0.6122490763664246,
0.9751226305961609,
-1.1643685102462769,
0.5577095746994019,
... |
func (l *Lexer) next() rune {
if int(l.pos) >= len(l.input) {
l.width = 0
return eof
}
r, w := utf8.DecodeRuneInString(l.input[l.pos:])
l.width = Pos(w)
l.pos += l.width
return r
} | [
-0.2508741021156311,
0.042625173926353455,
0.44877487421035767,
-0.29824137687683105,
-1.2643368244171143,
-0.2754030227661133,
-0.7158341407775879,
0.5082547664642334,
0.2746850848197937,
-0.29043200612068176,
0.9314634799957275,
0.12868326902389526,
-0.5815721750259399,
0.000761637755203... |
func (l *Lexer) peek() rune {
r := l.next()
l.backup()
return r
} | [
0.641192615032196,
0.38442203402519226,
0.5788355469703674,
-0.8393067121505737,
-0.5399959087371826,
-0.3918866515159607,
-0.3863028883934021,
-0.8909308314323425,
-0.3142149746417999,
-0.06007983908057213,
0.5489498376846313,
0.7148702144622803,
-0.12553641200065613,
-0.26994839310646057... |
func (l *Lexer) backup() {
l.pos -= l.width
} | [
-0.23667772114276886,
-0.34855175018310547,
0.37226617336273193,
-0.839096188545227,
-0.4359641671180725,
0.4367980360984802,
0.256801038980484,
0.455432653427124,
-0.03265273571014404,
0.3860871195793152,
0.04851235821843147,
-0.3792530596256256,
-0.5442819595336914,
0.04849392920732498,
... |
func (l *Lexer) emit(t TokenType) {
l.tokens <- Token{t, l.start, l.input[l.start:l.pos]}
l.start = l.pos
} | [
-1.1062346696853638,
-0.06410902738571167,
0.1963721215724945,
-1.1092480421066284,
-0.006847586948424578,
0.5664784908294678,
-0.8399026989936829,
-0.053291577845811844,
-0.7459761500358582,
0.30509012937545776,
-1.161007046699524,
0.5845835208892822,
-0.3363554775714874,
0.40204015374183... |
func (l *Lexer) ignore() {
l.start = l.pos
} | [
-0.23265008628368378,
-1.0474066734313965,
0.2933233082294464,
-0.635613203048706,
0.2802802324295044,
0.5310941338539124,
-0.20793722569942474,
0.5553550124168396,
-0.5592588186264038,
-0.22354580461978912,
-0.8997787237167358,
-0.22738628089427948,
-0.6409200429916382,
0.0661452934145927... |
func (l *Lexer) accept(valid string) bool {
if strings.IndexRune(valid, l.next()) >= 0 {
return true
}
l.backup()
return false
} | [
-0.2277224361896515,
-0.0499238446354866,
0.7151437401771545,
-0.15194067358970642,
-1.5209391117095947,
0.5541842579841614,
0.004031124524772167,
0.4762134552001953,
-0.3036136329174042,
0.028674844652414322,
0.21823501586914062,
-0.29937973618507385,
-1.3809460401535034,
0.44179800152778... |
func (l *Lexer) acceptRun(valid string) {
for strings.IndexRune(valid, l.next()) >= 0 {
}
l.backup()
} | [
0.07403919100761414,
-0.4270627796649933,
0.3791366517543793,
-0.4512386620044708,
-0.7799746990203857,
0.4500650465488434,
0.10842970758676529,
0.5858762860298157,
-0.49087268114089966,
0.2248125523328781,
0.19704803824424744,
0.24543693661689758,
-1.1349451541900635,
0.37622857093811035,... |
func (l *Lexer) lineNumber() int {
return 1 + strings.Count(l.input[:l.lastPos], "\n")
} | [
-0.4529828429222107,
-0.5550857782363892,
0.6857142448425293,
-0.04630061984062195,
0.16306273639202118,
-0.23537695407867432,
-0.07602987438440323,
0.8784568905830383,
0.09404771775007248,
-1.5255309343338013,
-0.2689805030822754,
-0.3774310350418091,
0.5087709426879883,
0.708971500396728... |
func (l *Lexer) errorf(format string, args ...interface{}) stateFn {
l.tokens <- Token{TokError, l.start, fmt.Sprintf(format, args...)}
return nil
} | [
-0.28761768341064453,
-0.4864286482334137,
0.33090290427207947,
-0.3795314133167267,
0.4699813425540924,
-0.2424914687871933,
-0.01550703588873148,
0.9666033983230591,
-0.4065232276916504,
-0.42307841777801514,
-0.014500760473310947,
0.2975577712059021,
1.0779411792755127,
0.26907810568809... |
func WithLogger(logger log.Logger) Option {
return func(o *options) {
o.logger = logger
}
} | [
0.049833741039037704,
0.2523583471775055,
0.43465331196784973,
-0.4482400119304657,
-0.000320010120049119,
-0.3428618907928467,
0.2837069630622864,
-0.3237682580947876,
1.0524680614471436,
-0.7471019625663757,
0.10106489807367325,
-0.6687375903129578,
0.45575806498527527,
0.536993443965911... |
func Server(opts ...Option) middleware.Middleware {
options := options{
logger: log.DefaultLogger,
}
for _, o := range opts {
o(&options)
}
log := log.NewHelper("middleware/logging", options.logger)
return func(handler middleware.Handler) middleware.Handler {
return func(ctx context.Context, req interface{}... | [
-0.7571765184402466,
-0.3737306296825409,
0.8996638655662537,
0.43575847148895264,
0.28784117102622986,
0.17699912190437317,
0.2613140940666199,
0.15375711023807526,
-0.12854380905628204,
0.04727189242839813,
-0.17336995899677277,
0.665789008140564,
-0.8951619267463684,
0.48375096917152405... |
func Client(opts ...Option) middleware.Middleware {
options := options{
logger: log.DefaultLogger,
}
for _, o := range opts {
o(&options)
}
log := log.NewHelper("middleware/logging", options.logger)
return func(handler middleware.Handler) middleware.Handler {
return func(ctx context.Context, req interface{}... | [
-0.075992651283741,
-0.09275196492671967,
0.8496882319450378,
-0.0771138146519661,
-0.40184178948402405,
0.4890018701553345,
0.3663027584552765,
-0.42697668075561523,
-0.17409658432006836,
-0.14915169775485992,
-0.012534000910818577,
0.7923250794410706,
-0.23703446984291077,
-0.14565981924... |
func LoginFunc(w http.ResponseWriter, r *http.Request) {
session, _ := sessions.Store.Get(r, "session")
switch r.Method {
case "GET":
view.LoginTemplate.Execute(w, nil)
case "POST":
r.ParseForm()
username := r.Form.Get("username")
password := r.Form.Get("password")
// there will not handle the empty value... | [
-0.41165462136268616,
-0.3070899248123169,
0.855859637260437,
0.7331919074058533,
-0.3196183443069458,
0.14611782133579254,
0.689369261264801,
0.6441731452941895,
0.780666708946228,
-0.37917599081993103,
-0.5244523286819458,
0.06442271173000336,
0.4892059862613678,
0.1642899066209793,
-0... |
func LoginOutFunc(w http.ResponseWriter, r *http.Request) {
session, err := sessions.Store.Get(r, "session")
if err == nil {
if session.Values["loggedin"] != "false" {
session.Values["loggedin"] = "false"
session.Save(r, w)
}
}
http.Redirect(w, r, "/login/", 302)
} | [
-0.5294041633605957,
-0.41590458154678345,
0.49662667512893677,
-0.3945499360561371,
0.04843471571803093,
0.47774937748908997,
0.7383233904838562,
1.2662243843078613,
0.3922426998615265,
0.7419190406799316,
-0.16608427464962006,
0.8248186111450195,
0.30293184518814087,
-0.6684685349464417,... |
func SignUpFunc(w http.ResponseWriter, r *http.Request) {
if r.Method != "POST" {
http.Redirect(w, r, "/", http.StatusBadRequest)
return
}
r.ParseForm()
username := r.Form.Get("username")
password := r.Form.Get("password")
email := r.Form.Get("email")
if user.UserIsExist(username) {
http.Error(w, "UserName... | [
-0.218591570854187,
0.6188569068908691,
0.9615011811256409,
0.3378644585609436,
0.32857003808021545,
0.46803075075149536,
0.811767578125,
1.1071927547454834,
-0.53575199842453,
0.10191775858402252,
-0.2639126181602478,
-0.05821593850851059,
0.4626103937625885,
-0.1092640683054924,
-0.321... |
func (h *InvertedSet) Len() int {
return len(h.Content)
} | [
-0.3295218348503113,
0.23637713491916656,
-0.029006773605942726,
-1.2263367176055908,
0.1440841108560562,
-0.45370230078697205,
0.5649141669273376,
0.4266301095485687,
-1.1653685569763184,
-0.4347316324710846,
-0.8682098388671875,
0.49579012393951416,
-0.5400539040565491,
-0.12420378625392... |
func (h *InvertedSetFreq) Len() int {
return len(h.Content)
} | [
-0.11295416206121445,
0.37136825919151306,
-0.0011735260486602783,
-1.2565336227416992,
0.3032788932323456,
-0.5253503322601318,
0.8405205011367798,
0.3051947355270386,
-1.0206433534622192,
-0.688996434211731,
-0.4192500114440918,
-0.041230328381061554,
-0.45481711626052856,
-0.02475825697... |
func mockInsertFile() error {
connString := mysql.ConstructConnString(dbUserName, dbPassword, dbName)
seqDatabase := mysql.ConnectDatabase(connString)
//seq Repository
seq := mysql.NewSeq(seqDatabase)
//Generate ID for New File
fileID, err := seq.Find("FILENAME")
if err != nil {
return errors.New("Error on... | [
-0.4273044466972351,
0.43315500020980835,
0.8849630951881409,
-0.4036180078983307,
0.7960285544395447,
0.15283745527267456,
0.8366538286209106,
0.3321848213672638,
-0.9073849320411682,
-0.19704791903495789,
-0.39770403504371643,
-0.6827210783958435,
-0.8407928347587585,
0.324304461479187,
... |
func CreateFile(filename string, fileSize int64) (*os.File, error) {
if filename == "" {
return nil, errors.New("No Filename being supplied into the function")
}
newFile, err := os.Create(filename)
if err != nil {
return nil, err
}
err1 := os.Truncate(newFile.Name(), fileSize)
if err1 != nil {
return nil, ... | [
0.9830809235572815,
-0.06521011143922806,
0.5974916219711304,
0.23193849623203278,
-0.11557292193174362,
0.42246776819229126,
0.6564775109291077,
0.29640915989875793,
-0.13731148838996887,
0.3685119152069092,
0.7009302377700806,
-0.6627862453460693,
-0.40751883387565613,
0.2118384391069412... |
func CreateNewNode(nodeID int, fileName string, timeStart string, graphID int, fileType string, userID int) (Node, error) {
if nodeID == 0 || fileName == "" || timeStart == "" || graphID == 0 || fileType == "" || userID == 0 {
return Node{}, errors.New("Not enough argument supplied")
}
return Node{
NodeID: no... | [
0.1753098964691162,
-0.48793020844459534,
0.5638201832771301,
0.2746545374393463,
-0.06615597009658813,
0.6820869445800781,
-0.3202701508998871,
-0.3438934087753296,
-0.6478630900382996,
0.14659956097602844,
0.34553810954093933,
0.7216551303863525,
-0.6965295076370239,
1.2040592432022095,
... |
func CreateNewFm(nodeID int, fileName string, fileExt string, storageFolder string, fgName string, foName string, fremark string, fileSize int, fileStatus int, fileType int) (Fmedia, error) {
if nodeID == 0 || fileName == "" || fileExt == "" || storageFolder == "" || fgName == "" || foName == "" || fileSize == 0 {
r... | [
-0.23198820650577545,
-1.0929570198059082,
0.6448317170143127,
-0.11536774784326553,
-0.07957975566387177,
-0.17286831140518188,
-0.4151274263858795,
-0.2210855931043625,
-0.36589866876602173,
-0.6392006278038025,
0.46785610914230347,
0.00942990742623806,
-0.40238475799560547,
1.1492354869... |
func CreateNewNL(parentNodeID int, childNodeID int, linkType string) (NodeLink, error) {
if parentNodeID == 0 || childNodeID == 0 || linkType == "" {
return NodeLink{}, errors.New("Not enough arguments supplied")
}
return NodeLink{
LinkPNodeID: parentNodeID,
LinkCNodeID: childNodeID,
LinkType: linkType,
... | [
0.3969044089317322,
-0.35809817910194397,
0.46167972683906555,
-0.29301708936691284,
-0.3191177546977997,
0.8924156427383423,
-0.5621722340583801,
-0.49084773659706116,
-0.3892112374305725,
-0.7317221164703369,
0.395341157913208,
0.6831997632980347,
-0.500880777835846,
1.2585054636001587,
... |
func CreateNewFv(nodeID int, timeAfter string, remarks string, timeStart string, version string, verState int) (Fverinfo, error) {
if nodeID == 0 || timeAfter == "" || remarks == "" || timeStart == "" || version == "" || verState == 0 {
return Fverinfo{}, errors.New("Not enough argument supplied")
}
return Fverinf... | [
-0.33572179079055786,
-0.39468666911125183,
0.4893038868904114,
0.1542152464389801,
-0.6301457285881042,
-0.061012085527181625,
-0.3609444200992584,
-0.8318576216697693,
-0.7124408483505249,
-0.5782678127288818,
-0.19840124249458313,
0.027993865311145782,
-0.13683493435382843,
1.4361371994... |
func CreateNewConv(nodeID int, fileExt string, destPath string) (Convqueue, error) {
if nodeID == 0 || fileExt == "" || destPath == "" {
return Convqueue{}, errors.New("Not enough argument supplied")
}
return Convqueue{
NodeID: nodeID,
ConvType: "PDF",
FExt: fileExt,
FFulPath: destPath,
INSDate: t... | [
-0.5546603798866272,
-1.0569051504135132,
0.6165801882743835,
0.27659741044044495,
-0.30478113889694214,
-0.04598383232951164,
-1.0750014781951904,
0.21531176567077637,
-0.9335324764251709,
0.1411522924900055,
0.8727174401283264,
0.4227701425552368,
-0.015568435192108154,
1.036840677261352... |
func CopyFile(fileName string, destPath string) error {
oriFile, err := os.Open(fileName)
if err != nil {
return err
}
destFile, err := os.Create(destPath)
if err != nil {
return err
}
bytesWritten, err := io.Copy(destFile, oriFile)
if err != nil {
return err
}
fmt.Println("Bytes copied: ", bytesWritt... | [
0.8978124260902405,
-0.12577387690544128,
0.5012578964233398,
-0.05559155344963074,
0.3478218615055084,
1.0204813480377197,
0.6987163424491882,
0.43385985493659973,
-0.7163761258125305,
0.2735760509967804,
0.24745741486549377,
0.10789961367845535,
0.18987108767032623,
-0.47600916028022766,... |
func PrepareNodeStmt(db *sql.DB) (*sql.Stmt, error) {
stmt, err := db.Prepare("INSERT node SET nodeid=?,nodebits=?,nodedesc=?,nodedt=?,nodegid=?,nodehash=?,nodelevel=?,nodetype=?,nodeuid=?")
if err != nil {
return nil, err
}
return stmt, nil
} | [
-0.576496422290802,
0.16701501607894897,
0.3501783311367035,
-0.6437468528747559,
-0.3430078625679016,
-0.526576042175293,
-0.8358203768730164,
-0.5753462910652161,
-0.03305714577436447,
0.6389071345329285,
-0.2657648026943207,
0.06716585159301758,
-0.41259634494781494,
0.7143529057502747,... |
func PrepareFmStmt(db *sql.DB) (*sql.Stmt, error) {
stmt, err := db.Prepare("INSERT fmedia SET nodeid=?,fdesc=?,fext=?,ffulpath=?,fgname=?,foname=?,fremark=?,fsize=?,fstatus=?,ftype=?")
if err != nil {
return nil, err
}
return stmt, nil
} | [
-0.4399287700653076,
0.027257701382040977,
0.46811288595199585,
-0.033621061593294144,
-0.5631370544433594,
-1.0332640409469604,
-0.6753225326538086,
-0.07006647437810898,
0.23463329672813416,
0.060493502765893936,
-0.46335655450820923,
-0.5701808929443359,
-0.6901123523712158,
1.220798254... |
func PrepareNLStmt(db *sql.DB) (*sql.Stmt, error) {
stmt, err := db.Prepare("INSERT nodelink SET linkcnodeid=?,linkpnodeid=?,linktype=?")
if err != nil {
return nil, err
}
return stmt, nil
} | [
0.0765286460518837,
0.2807992696762085,
0.34008899331092834,
-0.476345956325531,
-0.636942982673645,
-0.32136911153793335,
-1.0608861446380615,
-0.40691429376602173,
0.4926900565624237,
-0.025107214227318764,
-0.36671146750450134,
-0.5279848575592041,
-1.124121904373169,
1.003722906112671,... |
func PrepareFvStmt(db *sql.DB) (*sql.Stmt, error) {
stmt, err := db.Prepare("INSERT fverinfo SET nodeid=?,enddate=?,remarks=?,startdate=?,version=?,verstate=?")
if err != nil {
return nil, err
}
return stmt, nil
} | [
-0.05840997397899628,
0.26610612869262695,
0.44863107800483704,
0.19589124619960785,
-0.8616982102394104,
-0.8099033236503601,
-0.8253021836280823,
-0.7243814468383789,
-0.05832315981388092,
0.531980574131012,
-0.4425739347934723,
-0.8133856058120728,
-0.4381316900253296,
0.691281735897064... |
func PrepareConvStmt(db *sql.DB) (*sql.Stmt, error) {
stmt, err := db.Prepare("INSERT convqueue SET nodeid=?,convtype=?,fext=?,ffulpath=?,insdate=?,priority=?")
if err != nil {
return nil, err
}
return stmt, nil
} | [
-0.04388298839330673,
0.09777683019638062,
0.445892870426178,
0.17118391394615173,
-0.6525959372520447,
-0.7510454058647156,
-1.223235845565796,
-0.29907891154289246,
0.1295628696680069,
1.369856834411621,
-0.4224100112915039,
-0.6247696876525879,
-0.22981536388397217,
0.9699705839157104,
... |
func (stmt *PreparedStmt) PrepareStatement(db *sql.DB) error {
var err error
stmt.NodeStmt, err = PrepareNodeStmt(db)
if err != nil {
return err
}
stmt.FmediaStmt, err = PrepareFmStmt(db)
if err != nil {
return err
}
stmt.NLStmt, err = PrepareNLStmt(db)
if err != nil {
return err
}
stmt.FvStmt, err = P... | [
-0.889677107334137,
0.41737693548202515,
0.499429315328598,
0.23088780045509338,
0.11085489392280579,
-0.07102027535438538,
0.26090848445892334,
-0.10386834293603897,
0.07025014609098434,
0.39451661705970764,
-0.33248990774154663,
-0.6884639859199524,
-0.3174039125442505,
1.485735416412353... |
func CommitIntoDatabase(db *sql.DB, stmt PreparedStmt, newNode Node, newFmedia Fmedia, newNL NodeLink, newFv Fverinfo, newConv Convqueue) error {
tx, err := db.Begin()
if err != nil {
return err
}
_, err = tx.Stmt(stmt.NodeStmt).Exec(newNode.NodeID, newNode.NodeBits, newNode.NodeDesc, newNode.NodeDT, newNode.Node... | [
-0.47322824597358704,
-0.41976577043533325,
1.0448144674301147,
-0.13381464779376984,
0.2980475425720215,
-0.13415004312992096,
0.26630887389183044,
-0.008327752351760864,
-1.0675179958343506,
0.6377725601196289,
0.014873838052153587,
-0.22138305008411407,
-0.622133195400238,
0.99525082111... |
func (info AppInfo) DataRoot() (string, error) {
var homeDir string
var err error
if homeDir, err = os.UserHomeDir(); err != nil {
return "", err
}
return filepath.Join(homeDir, "Library", "Application Support", info.Name), nil
} | [
1.045732021331787,
-0.18532417714595795,
0.4173213243484497,
-0.34366992115974426,
-0.6319273710250854,
1.107356309890747,
-0.30376142263412476,
-0.23524953424930573,
0.3271639049053192,
-0.32872286438941956,
0.14923550188541412,
0.6716421246528625,
-0.2686464190483093,
0.9159640073776245,... |
func (info AppInfo) ConfigRoot() (string, error) {
// In Mac, there are no separate config and data directories
return info.DataRoot()
} | [
-0.0017575992969796062,
0.21899080276489258,
0.4283740818500519,
0.3523578345775604,
-0.8914353251457214,
0.4521859884262085,
-0.2386789172887802,
0.11363377422094345,
-0.23702049255371094,
-0.02040591463446617,
0.2604908347129822,
0.45613259077072144,
-0.13639770448207855,
1.2128328084945... |
func (info AppInfo) CacheRoot() (string, error) {
var cacheDir string
var err error
if cacheDir, err = os.UserCacheDir(); err != nil {
return "", err
}
return filepath.Join(cacheDir, info.Name), nil
} | [
0.707776665687561,
-0.17744076251983643,
0.48827749490737915,
0.735234260559082,
-1.1174007654190063,
1.1497762203216553,
-0.015733886510133743,
-0.8802402019500732,
-0.011807822622358799,
0.11553610861301422,
0.6927714943885803,
0.5024756789207458,
0.07431112974882126,
0.7134196758270264,... |
func (room *RoomRecorder) subscribe(builder RBuilderI) {
var (
events EventsI
client RClientI
)
builder.BuildEvents(&events)
builder.BuildConnectionEvents(&client)
room.eventsSubscribe(events)
room.peopleSubscribe(room.p)
room.connectionSubscribe(client)
} | [
0.6961297392845154,
-0.22883179783821106,
0.40424296259880066,
1.0519615411758423,
-0.19988588988780975,
0.3686883747577667,
-0.26118040084838867,
0.5935326814651489,
-0.138994500041008,
-0.44096609950065613,
-0.45090585947036743,
0.2909820079803467,
-0.7801257967948914,
0.6286949515342712... |
func (room *RoomRecorder) Init(builder RBuilderI) {
room.init()
room.build(builder)
room.subscribe(builder)
} | [
0.44109612703323364,
-0.14640744030475616,
0.41557809710502625,
0.8421878814697266,
-0.08829294145107269,
0.3905721604824066,
-0.2703583836555481,
1.0572259426116943,
-0.10389678925275803,
-0.48532944917678833,
-0.62640780210495,
1.687631607055664,
-0.6862620711326599,
1.7225055694580078,
... |
func (room *RoomRecorder) Leave(conn *Connection, action int32, isPlayer bool) {
if isPlayer {
room.se.PlayerExit(conn)
} else {
room.se.ObserverExit(conn)
}
room.notifyAll(conn, action)
} | [
0.17796964943408966,
-0.14901813864707947,
0.6030908226966858,
0.611759603023529,
0.16573596000671387,
0.10528765618801117,
-0.2556365728378296,
0.4666392207145691,
0.5185109972953796,
0.560602605342865,
-0.06664261966943741,
-0.239105224609375,
-1.0624326467514038,
0.3263939321041107,
0... |
func (room *RoomRecorder) history() []*action_.PlayerAction {
room.historyM.RLock()
v := room._history
room.historyM.RUnlock()
return v
} | [
-0.7066745758056641,
-0.3096816837787628,
0.487597793340683,
1.3716580867767334,
0.5694190859794617,
-0.36642053723335266,
0.9767081141471863,
-0.9016311168670654,
0.3188647925853729,
0.10015435516834259,
-0.5174826979637146,
1.2834842205047607,
-0.5939956903457642,
0.44179001450538635,
... |
func (room *RoomRecorder) setHistory(history []*action_.PlayerAction) {
room.historyM.Lock()
room._history = history
room.historyM.Unlock()
} | [
-0.5263384580612183,
0.1379186511039734,
0.39316296577453613,
1.2302802801132202,
0.7669694423675537,
-0.09386572986841202,
0.6448787450790405,
0.29300084710121155,
0.022565126419067383,
0.7507027983665466,
-0.9486916661262512,
1.4051913022994995,
-0.30044442415237427,
0.652554452419281,
... |
func (room *RoomRecorder) appendAction(action *action_.PlayerAction) {
room.historyM.Lock()
defer room.historyM.Unlock()
room._history = append(room._history, action)
} | [
-0.6227204203605652,
-0.3177638649940491,
0.5542500615119934,
0.2851791977882385,
0.3058072626590729,
0.13568709790706635,
0.3445326089859009,
-0.15433776378631592,
1.0154027938842773,
0.26384252309799194,
-0.3445321321487427,
1.1873666048049927,
-0.4314655661582947,
1.337027907371521,
0... |
func (room *RoomRecorder) historyFree() {
room.historyM.Lock()
room._history = nil
room.historyM.Unlock()
} | [
0.5519766807556152,
0.2710094153881073,
0.4713200330734253,
0.3027413487434387,
0.14390623569488525,
-0.32381126284599304,
0.49172455072402954,
-0.709293007850647,
-0.3546551465988159,
-0.09091224521398544,
-0.3197344243526459,
1.245172381401062,
-0.7940680980682373,
1.1875097751617432,
... |
func (room *RoomRecorder) actionBackToLobby(msg synced.Msg) {
if conn, ok := room.connectionCheck(msg); ok {
room.Leave(conn, msg.Action, conn.IsPlayer())
}
} | [
0.13631218671798706,
-0.6800491213798523,
0.6930902600288391,
-0.05192117020487785,
0.7301714420318604,
0.30564355850219727,
1.1265769004821777,
-0.14620384573936462,
0.008179991506040096,
1.224042296409607,
-0.1093721091747284,
0.7206712365150452,
-1.464678406715393,
0.3371839225292206,
... |
func (room *RoomRecorder) actionRestart(msg synced.Msg) {
if conn, ok := room.connectionCheck(msg); ok {
room.Restart(conn)
}
} | [
-0.21643556654453278,
-1.0073152780532837,
0.4256031811237335,
0.4822883903980255,
0.7973067164421082,
-0.11297246068716049,
0.17458927631378174,
0.3739267885684967,
0.045827560126781464,
0.8898502588272095,
-0.018958834931254387,
1.7259156703948975,
-1.3952972888946533,
0.2497667819261551... |
func (room *RoomRecorder) actionDisconnect(msg synced.Msg) {
if conn, ok := room.connectionCheck(msg); ok {
room.Disconnect(conn)
}
} | [
-0.029828153550624847,
-1.0397906303405762,
0.31219786405563354,
0.4380350112915039,
0.7768845558166504,
0.000012163682185928337,
0.5873536467552185,
0.32409611344337463,
-0.004295515827834606,
1.2947248220443726,
0.15874703228473663,
0.8403767943382263,
-0.5950816869735718,
0.505772292613... |
func (room *RoomRecorder) connectionCheck(msg synced.Msg) (*Connection, bool) {
action, ok := msg.Extra.(ConnectionMsg)
if !ok {
return nil, ok
}
return action.connection, ok
} | [
-0.3889806568622589,
-0.23637650907039642,
0.6492491364479065,
0.9958268404006958,
0.35296303033828735,
-0.20655286312103271,
0.7560549974441528,
0.560757577419281,
0.0860634595155716,
0.8647913932800293,
0.6717429161071777,
0.10655195266008377,
-0.8738236427307129,
0.8177937865257263,
-... |
func (room *RoomRecorder) connectionSubscribe(c RClientI) {
observer := synced.NewObserver(
synced.NewPair(action_.BackToLobby, room.actionBackToLobby),
synced.NewPair(action_.Restart, room.actionRestart),
synced.NewPair(action_.Disconnect, room.actionDisconnect))
c.Observe(observer.AddPublisherCode(room_.Updat... | [
0.1033702865242958,
-0.7636516094207764,
0.5234400033950806,
0.3711226284503937,
0.04325420409440994,
0.09679408371448517,
0.16213718056678772,
-0.13529211282730103,
-0.797755777835846,
0.60904461145401,
-0.7355533838272095,
-0.19166193902492523,
-0.7584201693534851,
0.3581230640411377,
... |
func (room *RoomRecorder) peoplCheck(msg synced.Msg) (*Connection, bool, bool) {
action, ok := msg.Extra.(ConnectionMsg)
if !ok {
return nil, ok, ok
}
needRecover, ok := action.content.(bool)
if !ok {
return nil, ok, ok
}
return action.connection, needRecover, ok
} | [
-0.2652820944786072,
0.23348888754844666,
0.8653623461723328,
-0.03418474644422531,
-0.046785928308963776,
0.22889560461044312,
0.5565961003303528,
0.19141995906829834,
0.31820324063301086,
0.8431167006492615,
0.21809616684913635,
-0.4841151833534241,
-0.8687065839767456,
0.447896957397460... |
func (room *RoomRecorder) peoplePlayerEnter(msg synced.Msg) {
if conn, recover, ok := room.peoplCheck(msg); ok {
room.AddConnection(conn, true, recover)
}
} | [
-0.571113646030426,
-0.07544239610433578,
0.6193128824234009,
0.25762492418289185,
0.4118192493915558,
0.23206228017807007,
0.2378118634223938,
0.40914785861968994,
-0.08342599868774414,
0.4387049973011017,
0.24793420732021332,
-0.6725029349327087,
-1.957171082496643,
0.2013971358537674,
... |
func (room *RoomRecorder) peopleObserverEnter(msg synced.Msg) {
if conn, recover, ok := room.peoplCheck(msg); ok {
room.AddConnection(conn, false, recover)
}
} | [
-0.2611423432826996,
-0.17481248080730438,
0.6501173377037048,
0.11500322818756104,
0.16679005324840546,
0.1266152709722519,
0.40687718987464905,
0.7004193067550659,
-0.18729804456233978,
0.08593643456697464,
0.18425649404525757,
-1.085362434387207,
-1.4469494819641113,
0.32549849152565,
... |
func (room *RoomRecorder) peopleSubscribe(p PeopleI) {
observer := synced.NewObserver(
synced.NewPair(room_.ObserverEnter, room.peopleObserverEnter),
synced.NewPair(room_.PlayerEnter, room.peoplePlayerEnter))
p.Observe(observer.AddPublisherCode(room_.UpdatePeople))
} | [
-0.2774215638637543,
-0.31259751319885254,
0.5527345538139343,
0.3373676538467407,
-1.2438971996307373,
-0.007964296266436577,
-0.28991878032684326,
0.1783357560634613,
-0.2902742028236389,
0.044451288878917694,
-0.4271225035190582,
-0.09291490912437439,
-1.1139787435531616,
0.714360535144... |
func (room *RoomRecorder) eventsSubscribe(e EventsI) {
observer := synced.NewObserver(
synced.NewPairNoArgs(room_.StatusFinished, room.finish))
e.Observe(observer.AddPublisherCode(room_.UpdateStatus))
} | [
0.27452048659324646,
-0.2069772481918335,
0.4475333094596863,
0.4894430339336395,
-0.5116822719573975,
-0.26721876859664917,
-0.3541015386581421,
0.5508227348327637,
-0.24592013657093048,
0.6469959616661072,
-1.5468257665634155,
-0.027218373492360115,
0.15303798019886017,
0.703235447406768... |
func (a Admin) Login(user,passwd string) (error, bool) {
if user == a.Name && passwd == a.Pass {
return nil, true
} else {
return errors.New("Wrong login or password"), false
}
} | [
-0.2948480546474457,
-0.39022836089134216,
0.6274225115776062,
0.26105931401252747,
-0.9130275845527649,
0.9408475160598755,
-0.8019507527351379,
-0.004841982387006283,
0.16241933405399323,
0.2473127841949463,
0.1701461374759674,
0.773900032043457,
0.007680713199079037,
0.15528978407382965... |
func (a SuperAdmin) Login(user, passwd string) (error, bool) {
if user == a.Name && passwd == a.Pass {
return nil, true
} else {
return errors.New("Wrong login or password"), false
}
} | [
0.15386295318603516,
-0.4632311165332794,
0.6173629760742188,
0.7541311979293823,
-1.1471072435379028,
0.9597486257553101,
-0.6488879919052124,
0.5173938870429993,
0.19042572379112244,
-0.3170425593852997,
-0.21885743737220764,
0.7659155130386353,
0.13017278909683228,
0.06857140362262726,
... |
func LoginUser(u User) {
err, _ := u.Login("admin", "admin")
if err != nil {
fmt.Println(err.Error())
}
} | [
-0.5653637647628784,
0.3871811330318451,
0.7437328696250916,
0.7782468795776367,
0.006473088636994362,
0.92503821849823,
0.19601479172706604,
-0.056281037628650665,
0.08319838345050812,
-0.39071714878082275,
-1.2974743843078613,
1.0139623880386353,
-0.14601252973079681,
0.9374392628669739,... |
func GenVolumeSourceForSwarm(source string) string {
return source + common.NameSeparator + taskSlot
} | [
-0.0655069574713707,
-0.29229220747947693,
0.11514937877655029,
-0.8717204332351685,
-0.8445863127708435,
0.38698235154151917,
-0.17948158085346222,
0.519972562789917,
-0.05260854214429855,
-0.08287526667118073,
-0.017303934320807457,
-0.6783130764961243,
0.5319918990135193,
0.371245026588... |
func GenVolumeSourceName(source string, index int64) string {
return source + common.NameSeparator + strconv.FormatInt(index, 10)
} | [
-0.8876602649688721,
0.004365153145045042,
0.5958513021469116,
-1.0546854734420776,
0.14385631680488586,
-0.1318320780992508,
-0.22887884080410004,
0.07441963255405426,
0.5603541731834412,
0.6090427041053772,
-0.1969590038061142,
-0.808487594127655,
0.7091841697692871,
-0.8704847693443298,... |
func (ts *Server) Start() error {
var err error
if ts.Handler == nil {
return fmt.Errorf("server cannot start; no handler provided")
}
if ts.Listener == nil && ts.Addr != "" {
ts.Listener, err = net.Listen("tcp", ts.Addr)
if err != nil {
return err
}
}
if ts.Listener == nil {
return fmt.Errorf("serve... | [
-0.032865285873413086,
-0.5070489645004272,
0.4955333471298218,
-0.5642979741096497,
0.3708976209163666,
0.8092982172966003,
0.19302472472190857,
0.7256489992141724,
-0.43948376178741455,
0.28131362795829773,
0.14955876767635345,
1.178529977798462,
0.30337220430374146,
0.7367766499519348,
... |
func (ts *Server) Stop() error {
if ts.Server == nil {
return nil
}
if err := ts.Server.Shutdown(context.Background()); err != nil {
return err
}
ts.Server = nil
return nil
} | [
-1.2993613481521606,
0.0027725952677428722,
0.2354954034090042,
-0.2765100300312042,
0.7314724326133728,
-0.05284631624817848,
-0.4520941376686096,
0.041525427252054214,
-0.2266719788312912,
0.9159587025642395,
-0.3047389090061188,
0.9528909921646118,
-0.64850252866745,
-0.0500707030296325... |
func FormatContentLength(sizeBytes int) string {
if sizeBytes >= 1<<30 {
return fmt.Sprintf("%dgB", sizeBytes/(1<<30))
} else if sizeBytes >= 1<<20 {
return fmt.Sprintf("%dmB", sizeBytes/(1<<20))
} else if sizeBytes >= 1<<10 {
return fmt.Sprintf("%dkB", sizeBytes/(1<<10))
}
return fmt.Sprintf("%dB", sizeByte... | [
0.5573280453681946,
-0.738315761089325,
0.7969395518302917,
-1.2841870784759521,
-0.7893032431602478,
0.6157363057136536,
0.14867129921913147,
-1.2526181936264038,
0.29824692010879517,
0.5756782293319702,
1.0246903896331787,
-0.32828202843666077,
-0.7187771201133728,
0.8573905229568481,
... |
func (m *Maze) dfs_traverse(cp *Point, tr *traverser, path []*Point) ([]*Point, error) {
// we made it to the destination! return the path and get out!
if cp.IsDestination {
return path, nil
}
// nothing more to visit and there was no destination
if tr.isVisitComplete() {
return []*P... | [
-0.29696083068847656,
1.1314584016799927,
0.5853294134140015,
0.8652077317237854,
-0.011424717493355274,
-1.4403184652328491,
0.5037386417388916,
0.020307809114456177,
-0.33558905124664307,
0.914021909236908,
0.502167284488678,
-0.5077570676803589,
-0.133772611618042,
-0.04991364851593971,... |
func (a *API) GetChannelsValues( /*ctx context.Context,*/ universe int, startAddr int, count int) (ChannelsValues, error) {
// - `QLC+API|getChannelsValues|<universe>|<startAddr>|[<count>]`: Returns the channel values of a given `<universe>` (starting at one) beginning at given `<startAddr>` (starting at one) and retu... | [
-0.2302650809288025,
-0.10636796057224274,
0.6759455800056458,
-0.8931952118873596,
0.006765173282474279,
-1.3581748008728027,
-0.11819445341825485,
-1.3657251596450806,
-0.8631160259246826,
-0.4760710299015045,
0.11323586106300354,
0.855670154094696,
-0.378351092338562,
-0.088897846639156... |
func GetPeople(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
json.NewEncoder(w).Encode(people)
} | [
-0.946150004863739,
-0.835961103439331,
0.6740233302116394,
0.08264918625354767,
-0.2855629026889801,
-0.15897631645202637,
-0.5347299575805664,
-0.25921201705932617,
-0.5464255809783936,
0.5063756108283997,
-0.6303046345710754,
0.10404457151889801,
-0.5676596760749817,
0.335132896900177,
... |
func GetPerson(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
for _, item := range people {
if item.ID == params["id"] {
json.NewEncoder(w).Encode(item)
return
}
}
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
json.NewEncoder(w).Encode(&model.Person{})
//r = mux.Vars... | [
-1.1100307703018188,
-1.3029859066009521,
0.6550853252410889,
0.48541009426116943,
-0.30074167251586914,
0.004294702783226967,
-0.40928876399993896,
-0.13319575786590576,
-0.4841241240501404,
0.3045652508735657,
-0.26609599590301514,
0.25773248076438904,
-0.17073878645896912,
0.65199589729... |
func CreatePerson(w http.ResponseWriter, r *http.Request) {
var person model.Person
/*
To print the response to string
*/
bodyBytes, _ := ioutil.ReadAll(r.Body)
bodyString := string(bodyBytes)
fmt.Println(bodyString)
/*
Parse JSON object without struct
*/
m := map[string]interface{}{}
err := json.Unmarsh... | [
-0.5466143488883972,
-1.437368392944336,
0.9384722709655762,
-0.9197496175765991,
-0.27864834666252136,
0.9388103485107422,
-0.6978153586387634,
-0.154052734375,
0.041667476296424866,
0.23964911699295044,
-0.2526613175868988,
-0.5082808136940002,
-0.5432379245758057,
0.4981551468372345,
... |
func (_m *Reservation) OrderID() types.OrderID {
ret := _m.Called()
var r0 types.OrderID
if rf, ok := ret.Get(0).(func() types.OrderID); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(types.OrderID)
}
return r0
} | [
-0.6569162607192993,
-0.6590980291366577,
0.33858925104141235,
0.5603010654449463,
0.37500548362731934,
0.44061264395713806,
0.8052897453308105,
0.5186242461204529,
0.4199550151824951,
0.6723187565803528,
-0.3172371983528137,
0.9266558885574341,
-0.050726599991321564,
1.0085431337356567,
... |
func (_m *Reservation) Resources() virtenginetypes.ResourceGroup {
ret := _m.Called()
var r0 virtenginetypes.ResourceGroup
if rf, ok := ret.Get(0).(func() virtenginetypes.ResourceGroup); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(virtenginetypes.ResourceGroup)
}
}
return r0
} | [
-0.6436511874198914,
0.9238053560256958,
0.20289430022239685,
-0.7712469696998596,
0.017837045714259148,
-0.711438775062561,
0.9995418190956116,
-0.1371152549982071,
-0.050555452704429626,
-0.010814779438078403,
0.057694680988788605,
-0.6102123260498047,
-0.19824348390102386,
0.57917958498... |
func SetDBTxContextKey(ctx context.Context, t *sql.Tx) context.Context {
return context.WithValue(ctx, dbTxCtxKey, t)
} | [
-0.18755507469177246,
0.2657255232334137,
0.20822285115718842,
-0.8298830986022949,
-0.048588886857032776,
0.20931482315063477,
-0.5477491021156311,
-0.47247955203056335,
-0.21018272638320923,
0.6618743538856506,
-0.4229024350643158,
0.17061415314674377,
-0.16742396354675293,
-0.4555756747... |
func TxFromContext(ctx context.Context) (*sql.Tx, bool) {
tx, ok := ctx.Value(dbTxCtxKey).(*sql.Tx)
return tx, ok
} | [
0.1953350305557251,
0.6979987025260925,
0.4437231719493866,
-0.6114257574081421,
-1.0581753253936768,
-0.11542414128780365,
-1.0903823375701904,
-1.3258980512619019,
0.5996721982955933,
0.6234654784202576,
-0.8417458534240723,
-1.055736780166626,
-0.4478556215763092,
-0.9321606159210205,
... |
func NewTransactionWithContext(ctx context.Context) (*sql.Tx, context.Context, error) {
var (
tx *sql.Tx
err error
)
// get the new transaction
tx, err = DB.DirDB.Begin()
if err != nil {
return tx, ctx, err
}
// set the transaction in context
ctx = SetDBTxContextKey(ctx, tx)
return tx, ctx, err
} | [
0.023555932566523552,
-0.31693634390830994,
0.3994832932949066,
0.19002239406108856,
-0.7197343111038208,
-0.8693395853042603,
-0.45625898241996765,
-0.6406639814376831,
0.4296008348464966,
0.9705672264099121,
-0.8178972601890564,
-0.47785332798957825,
-0.20366431772708893,
-0.023158641532... |
func SetSessionContextKey(ctx context.Context, s *Session) context.Context {
return context.WithValue(ctx, sessionCtxKey, s)
} | [
-0.7866944074630737,
-1.3480759859085083,
0.13579294085502625,
0.1572965532541275,
-0.57977694272995,
-0.11595283448696136,
0.15941227972507477,
-0.8754903078079224,
1.3150969743728638,
1.0491999387741089,
-0.2154451608657837,
0.11828818917274475,
0.9702098965644836,
-0.36831939220428467,
... |
func GetSessionFromContext(ctx context.Context) (*Session, bool) {
sess, ok := ctx.Value(sessionCtxKey).(*Session)
return sess, ok
} | [
-0.5567955374717712,
-0.2408011257648468,
0.3337547481060028,
0.3427952229976654,
-0.4198544919490814,
0.1114390641450882,
-0.38676437735557556,
-1.3822805881500244,
1.0741561651229858,
0.49698275327682495,
-0.6499797105789185,
-0.4501381516456604,
-0.186085507273674,
-0.7953105568885803,
... |
func WriteToInterface(res interface{}, v interface{}) error {
x := reflect.ValueOf(v)
if x.Kind() == reflect.Ptr {
x = x.Elem()
}
reflect.ValueOf(res).Elem().Set(x)
return nil
} | [
-0.755151629447937,
-0.3507223129272461,
0.4831613004207611,
-0.9024744629859924,
0.829879879951477,
-0.6098242998123169,
0.6719353795051575,
-0.41853880882263184,
0.3039357364177704,
0.7380101680755615,
-0.7154691815376282,
-0.08616062253713608,
-0.8912148475646973,
-0.13286161422729492,
... |
func tandem(text string) map[string]int {
mSubStringIndex := createMapSubStringAndIndex(text)
ansMap := findTandemFromMap(mSubStringIndex)
//Set response to json format
j, _ := json.Marshal(ansMap)
fmt.Println(string(j))
return ansMap
} | [
-0.7810551524162292,
-1.6435467004776,
0.5972117185592651,
-1.4005578756332397,
-0.5408148169517517,
-0.017046445980668068,
0.3074416220188141,
-0.571757972240448,
-0.39801645278930664,
-0.6134774684906006,
-0.678494930267334,
0.08606448024511337,
-0.3544548749923706,
-0.16071166098117828,... |
func createMapSubStringAndIndex(input string) map[string] []int{
mSubStringIndex := make(map[string] []int)
//loop in to find Tandem repeat from size 3 to 10
for size := 3; size <= 10; size++ {
i := 0
for i + size < len(input) + 1 {
frameValue := input[i:i+size]
if val, ok := mSubStringIndex[frameValue]; o... | [
-0.4278571605682373,
-0.7941181063652039,
0.9558787941932678,
-1.0997546911239624,
-0.7000740170478821,
0.37731149792671204,
0.8399315476417542,
0.35215985774993896,
0.20394332706928253,
-0.10738302767276764,
-0.5150752663612366,
0.18853631615638733,
-0.2502063512802124,
-0.368102401494979... |
func setIgnoreValue(key string, mSubStringIndex *map[string] []int){
ignoreKey := key
for len(ignoreKey) + len(key) <= 10 {
ignoreKey += key
(*mSubStringIndex)[ignoreKey] = []int{-1}
}
} | [
-0.5353485345840454,
0.42145904898643494,
0.533884584903717,
-1.1880334615707397,
-0.15485072135925293,
0.444728821516037,
0.39820659160614014,
0.8611675500869751,
-0.2490708976984024,
0.6933448910713196,
-0.9465909004211426,
0.27109959721565247,
0.11696618795394897,
-0.40011709928512573,
... |
func findTandemFromMap(mSubStringIndex map[string] []int) map[string]int {
ansMap := make(map[string]int)
for k, mapVal := range mSubStringIndex {
var startIndex int
var repeatedTimes int
if mapVal[0] != -1 && len(mapVal) > 1{
for i,repeatIndex := range mapVal {
if startIndex == 0 {
startIndex = rep... | [
-0.5123952031135559,
-0.5776165723800659,
0.6279602646827698,
-0.586082398891449,
-1.0404506921768188,
-0.10917598754167557,
0.9153750538825989,
-0.3856155574321747,
0.040859103202819824,
0.5282108187675476,
-0.1729791760444641,
0.29244187474250793,
0.22599536180496216,
0.33146461844444275... |
func setTandemKeyFormat(startIndex int, tandem string) string{
s := strconv.Itoa(startIndex)
ans := s +"-"+ tandem
return ans
} | [
-0.5150036215782166,
-1.110299825668335,
0.4212356507778168,
-1.3888418674468994,
-0.21771420538425446,
-0.1356029510498047,
-0.4453141689300537,
-0.7758556008338928,
-0.42037421464920044,
-0.03188428282737732,
-0.047738101333379745,
1.1022589206695557,
-0.08384496718645096,
-0.05970422551... |
func PrintPipe(pipes interface{}, collection string, savedToFile bool) {
jsonByte, err := json.MarshalIndent(pipes, "", " ")
if err != nil {
log.Println("ERROR!", err)
}
if isLogEnabled {
log.Println("PRINT Pipe\n", "db.getCollection('"+collection+"').aggregate(\n"+string(jsonByte)+"\n)")
}
if savedToFile ... | [
-0.12844419479370117,
0.37402909994125366,
0.8783717155456543,
-0.5939283967018127,
0.5449700355529785,
0.5357281565666199,
-0.21203508973121643,
0.5026776194572449,
-0.9172648787498474,
0.6942568421363831,
0.509322464466095,
1.0474070310592651,
-0.8388667106628418,
0.5149693489074707,
0... |
func Renderer() func(string) {
var prev string
return func(curr string) {
// clear lines
if prev != "" {
for range lines(prev) {
MoveUp(1)
ClearLine()
}
}
// print lines
if curr != "" {
for _, s := range lines(curr) {
fmt.Printf("%s\n", s)
}
}
prev = curr
}
} | [
0.31933918595314026,
-0.38703832030296326,
0.5842961668968201,
-0.4607234597206116,
-1.2473607063293457,
-0.5366663336753845,
0.45913153886795044,
0.3666623830795288,
-0.07651974260807037,
-0.17069266736507416,
0.9673144817352295,
0.05350290238857269,
0.35650932788848877,
0.449160844087600... |
func lines(s string) []string {
return strings.Split(s, "\n")
} | [
-0.37742865085601807,
-0.588547945022583,
0.14563749730587006,
0.19089263677597046,
-0.025516897439956665,
0.18726804852485657,
-1.572758436203003,
0.0002200603485107422,
0.9526252746582031,
-0.6777912974357605,
0.2888772189617157,
0.32889413833618164,
0.04394523426890373,
-0.1589333415031... |
func Strip(s string) string {
return strip.ReplaceAllString(s, "")
} | [
0.10950493067502975,
-0.6920409798622131,
0.04852524772286415,
-0.31216415762901306,
-1.0229101181030273,
0.4643682539463043,
-0.41421234607696533,
0.5774534344673157,
1.1743701696395874,
-0.7557510137557983,
-0.5224546194076538,
0.7817808985710144,
0.6490755081176758,
-0.737184464931488,
... |
func Length(s string) (n int) {
for range Strip(s) {
n++
}
return
} | [
0.027450019493699074,
-0.17263412475585938,
0.08209941536188126,
-0.756964385509491,
-0.3468211591243744,
0.4122048020362854,
1.0912458896636963,
0.97525954246521,
0.8519666194915771,
-0.179364874958992,
-1.120605707168579,
0.20682474970817566,
0.7768958806991577,
0.3789946138858795,
0.7... |
func CenterLine(s string) string {
r := strings.Repeat
w, h := Size()
size := Length(s)
xpad := int(math.Abs(float64((w - size) / 2)))
ypad := h / 2
return r("\n", ypad) + r(" ", xpad) + s + r("\n", ypad)
} | [
1.0226006507873535,
-0.7198624610900879,
0.8352426886558533,
-0.38949981331825256,
-0.7353713512420654,
0.08998554199934006,
-0.575160801410675,
-0.14735108613967896,
0.9430289268493652,
0.38201990723609924,
0.45996665954589844,
0.42997172474861145,
0.0453791581094265,
-0.138479545712471,
... |
func Size() (w int, h int) {
w = goterm.Width()
h = goterm.Height()
return
} | [
-0.3606298267841339,
0.3194665312767029,
0.4638310670852661,
-0.9432191252708435,
-0.029010945931077003,
-0.044538889080286026,
0.2018108069896698,
-0.274203896522522,
-0.8378165364265442,
0.3959008753299713,
0.31148457527160645,
1.0076044797897339,
-0.7311438322067261,
0.8653505444526672,... |
func ClearAll() {
fmt.Printf("\033[2J")
MoveTo(1, 1)
} | [
0.42754065990448,
-0.27725672721862793,
0.35631194710731506,
1.2747529745101929,
-0.5222077369689941,
0.48465028405189514,
-0.06100616604089737,
-0.08713768422603607,
-0.33704015612602234,
0.6026990413665771,
-0.1793629378080368,
1.551088571548462,
0.5139548182487488,
0.30340227484703064,
... |
func ClearLine() {
fmt.Printf("\033[2K")
} | [
1.3408993482589722,
-0.14969457685947418,
0.6481631994247437,
0.7867987155914307,
0.4550153613090515,
1.2407376766204834,
-0.8435558080673218,
0.26465052366256714,
-0.19718676805496216,
0.16769613325595856,
-0.34514984488487244,
1.332265853881836,
0.5667089223861694,
-0.3799172639846802,
... |
func ClearLineEnd() {
fmt.Printf("\033[0K")
} | [
1.4515390396118164,
-0.39679306745529175,
0.6303249597549438,
0.13868087530136108,
0.397986501455307,
1.171283483505249,
-1.488903284072876,
0.37683653831481934,
-0.5684154033660889,
0.840366780757904,
-0.3212294280529022,
0.9327073097229004,
0.2780384421348572,
0.305338591337204,
-0.174... |
func ClearLineStart() {
fmt.Printf("\033[1K")
} | [
1.615812063217163,
-0.9936957955360413,
0.5142536759376526,
-0.02022184245288372,
0.24169768393039703,
0.8656693696975708,
-0.7083764672279358,
0.16728754341602325,
0.426948606967926,
0.6548181176185608,
-0.35098737478256226,
1.4062327146530151,
0.23524914681911469,
-0.35225507616996765,
... |
func MoveTo(x, y int) {
fmt.Printf("\033[%d;%df", y, x)
} | [
-0.4755658805370331,
-0.26368096470832825,
0.5860243439674377,
-0.7414728403091431,
0.22459785640239716,
-0.011251214891672134,
-0.8298303484916687,
-0.4254966676235199,
-0.6363116502761841,
0.07274627685546875,
-0.36500343680381775,
1.6733555793762207,
0.5810980200767517,
-1.1063365936279... |
func MoveDown(n int) {
fmt.Printf("\033[%dE", n)
} | [
0.3699052035808563,
0.21567252278327942,
0.633297324180603,
0.11852117627859116,
0.24433298408985138,
0.49532920122146606,
0.6390148997306824,
-0.07668556272983551,
-0.23093043267726898,
-0.9247332811355591,
-0.591084897518158,
1.06322181224823,
-0.17477844655513763,
0.3681127727031708,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.