text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (m *Client) backpaginateRoom(room *Room, amount int) (int, error) {
amount = utils.Max(amount, minimumPagination)
backPaginationToken, _ := room.GetTokens()
resp, err := m.Messages(room.ID, backPaginationToken, "", 'b', amount)
if err != nil {
return -1, err
}
room.concatBackpagination(resp.Chunk, resp.E... | [
-0.6102338433265686,
-0.26643744111061096,
0.7996587753295898,
-0.19823552668094635,
-0.4705730080604553,
-1.0776937007904053,
0.11738140136003494,
0.3428235352039337,
-0.27781468629837036,
0.4196990430355072,
0.026995554566383362,
0.5460419654846191,
-1.4028466939926147,
0.230372235178947... |
func Init(ctr *container.Container) *mux.Router {
// create new router
r := mux.NewRouter()
// initialize middleware
requestCheckerMiddleware := middleware.NewRequestCheckerMiddleware(ctr)
requestAlterMidleware := middleware.NewRequestAlterMiddleware(ctr)
metricsMidleware := middleware.NewMetricsMiddleware()
... | [
0.07081633061170578,
-0.3149303197860718,
0.8035511374473572,
-0.40240925550460815,
0.09391409158706665,
-0.04341985657811165,
0.2737564742565155,
-0.4184313118457794,
0.589360237121582,
-0.2171049267053604,
0.23355905711650848,
0.15931187570095062,
-0.06126372143626213,
0.8656214475631714... |
func newCASClonedBuffer(base Buffer, digest digest.Digest, source Source) Buffer {
return &casClonedBuffer{
base: base,
digest: digest,
source: source,
consumersRemaining: 1,
maximumChunkSizeBytes: -1,
}
} | [
0.48437848687171936,
-0.08326756954193115,
0.3199397623538971,
0.1545858234167099,
-1.2401049137115479,
0.11197399348020554,
-0.41989633440971375,
0.01934693194925785,
0.33236977458000183,
-0.6444774270057678,
-0.7189376354217529,
0.9863579869270325,
-0.5600212812423706,
0.4352455735206604... |
func (*ConversionActionOperation) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*ConversionActionOperation_Create)(nil),
(*ConversionActionOperation_Update)(nil),
(*ConversionActionOperation_Remove)(nil),
}
} | [
-1.4947227239608765,
-0.14452414214611053,
0.6731897592544556,
0.7905349135398865,
-0.029195254668593407,
-0.49927711486816406,
1.070043683052063,
-0.6248683929443359,
0.9795083999633789,
0.8835915923118591,
-0.10306151211261749,
-0.4444880485534668,
-0.058552682399749756,
0.23988597095012... |
func (*RequestTradeRoutes) Descriptor() ([]byte, []int) {
return file_request_trade_routes_proto_rawDescGZIP(), []int{0}
} | [
-0.7807712554931641,
0.09410341084003448,
0.17223487794399261,
0.11286196857690811,
0.35664698481559753,
-0.4918057322502136,
0.51800137758255,
0.10536613315343857,
-0.24900826811790466,
-0.32545047998428345,
-0.6428608894348145,
0.41111794114112854,
-0.34333592653274536,
0.096030533313751... |
func Init() {
viper.SetConfigName("config")
viper.SetConfigType("toml")
viper.AddConfigPath(".")
if err := viper.ReadInConfig(); err != nil {
log.Fatal(err.Error())
}
appCfg = AppConfig{
Port: viper.GetInt("app.port"),
MaxFileSize: viper.GetInt("app.max_filesize"),
LogLeve... | [
0.734589695930481,
-1.1447091102600098,
0.6941943764686584,
0.23427952826023102,
-0.5488986968994141,
0.4133620858192444,
-0.426907479763031,
0.3256402909755707,
-0.09193982928991318,
0.4411033093929291,
-0.1438436061143875,
0.28008800745010376,
0.6583943963050842,
0.5152459144592285,
1.... |
func InitTestConfig() {
viper.SetConfigName("config.test")
viper.SetConfigType("toml")
viper.AddConfigPath(".")
if err := viper.ReadInConfig(); err != nil {
log.Fatal(err.Error())
}
appCfg = AppConfig{
Port: viper.GetInt("app.port"),
MaxFileSize: viper.GetInt("app.max_filesi... | [
0.8386282324790955,
-0.8069624900817871,
0.7141062617301941,
0.2815955877304077,
-0.4307723343372345,
-0.16500809788703918,
0.17611156404018402,
0.130295991897583,
-0.051869556307792664,
0.37659570574760437,
-0.3775477707386017,
0.27872541546821594,
0.12783116102218628,
0.5263411402702332,... |
func App() *AppConfig {
return &appCfg
} | [
1.5960346460342407,
-0.28458139300346375,
0.009723213501274586,
0.848084032535553,
-1.384123682975769,
0.16745686531066895,
0.174968883395195,
0.2567110061645508,
-0.2388565093278885,
-0.2561447024345398,
-0.11381243169307709,
0.14142818748950958,
0.3554610311985016,
0.7879502177238464,
... |
func (r *RabbitMQ) Connect() (err error) {
r.conn, err = amqp.Dial(Conf.AMQPUrl)
if err != nil {
log.Info("[amqp] connect error: %s\n", err)
return err
}
r.channel, err = r.conn.Channel()
if err != nil {
log.Info("[amqp] get channel error: %s\n", err)
return err
}
r.done = make(chan error)
return nil
} | [
-0.17873574793338776,
-0.8695728778839111,
0.7364920973777771,
-0.4865911900997162,
0.11258291453123093,
0.5642412900924683,
-0.7040998935699463,
-0.3822759985923767,
-0.5456607341766357,
0.9427779912948608,
-0.04546276107430458,
0.49930164217948914,
-0.17448405921459198,
0.181253612041473... |
func (r *RabbitMQ) publish(exchange, key string, msg Message) (err error) {
err = r.channel.Publish(exchange, key, false, false,
amqp.Publishing{
Headers: msg.Headers,
ContentType: msg.ContentType,
ContentEncoding: msg.ContentEncoding,
CorrelationId: msg.CorrelationID,
//Expiration: ... | [
-0.22488075494766235,
-0.022553186863660812,
0.4481135606765747,
-0.37880539894104004,
-0.19042126834392548,
0.06926687061786652,
-0.8709224462509155,
0.33422955870628357,
-0.5205107927322388,
0.602711021900177,
0.7843397259712219,
0.43937432765960693,
-1.6422040462493896,
0.44492936134338... |
func (r *RabbitMQ) publishText(exchange, key, text string) (err error) {
err = r.channel.Publish(exchange, key, false, false,
amqp.Publishing{
ContentType: "text/plain",
CorrelationId: "",
ReplyTo: "",
Body: []byte(text),
},
)
if err != nil {
log.Info("[amqp] publish message error:... | [
0.09609086811542511,
0.3226471543312073,
0.3318910002708435,
-0.7460951805114746,
-0.8159872889518738,
0.31033623218536377,
-0.7439531087875366,
0.31249135732650757,
0.14205200970172882,
1.2753275632858276,
0.19615833461284637,
0.686233401298523,
-2.051830768585205,
-0.17973211407661438,
... |
func (r StaticValue) Load() float64 {
return (float64)(r)
} | [
-0.7234407663345337,
-0.02004391700029373,
0.15997478365898132,
0.17868448793888092,
-0.5770968198776245,
0.09992798417806625,
0.23990710079669952,
-0.8694537878036499,
-0.16604940593242645,
-0.33826136589050293,
-0.2598993480205536,
-0.45723485946655273,
-0.4535588026046753,
-0.0190361868... |
func (r FuncValue) Load() float64 {
return r()
} | [
-0.2658703029155731,
0.2959543466567993,
0.18181239068508148,
-0.13511426746845245,
-0.5426697134971619,
-0.28375867009162903,
0.9270358085632324,
-0.5744496583938599,
-0.28608670830726624,
-1.0138883590698242,
-0.030332712456583977,
-0.14118292927742004,
-0.359929621219635,
-0.03394545242... |
func NewUmbrella(sys System) *Umbrella {
u := &Umbrella{SourceType: requests.API}
u.BaseService = *NewBaseService(u, "Umbrella", sys)
return u
} | [
-0.5682703852653503,
-0.05886005237698555,
0.3484533131122589,
0.7928145527839661,
0.11065302044153214,
0.21920858323574066,
-0.15506736934185028,
0.36654913425445557,
0.9788140654563904,
-1.0823066234588623,
-1.174641728401184,
0.4056297838687897,
0.061049684882164,
0.7943987250328064,
... |
func (u *Umbrella) Type() string {
return u.SourceType
} | [
-0.0770055428147316,
0.36984124779701233,
0.01925613172352314,
-0.0014723605709150434,
0.15261036157608032,
1.0675969123840332,
0.9589366912841797,
-0.36704081296920776,
1.1666913032531738,
-0.5848625898361206,
-0.587916374206543,
0.37679630517959595,
-0.5170627236366272,
0.542613804340362... |
func (u *Umbrella) OnStart() error {
u.BaseService.OnStart()
u.API = u.System().Config().GetAPIKey(u.String())
if u.API == nil || u.API.Key == "" {
u.System().Config().Log.Printf("%s: API key data was not provided", u.String())
}
u.SetRateLimit(500 * time.Millisecond)
return nil
} | [
-0.041689638048410416,
0.17788578569889069,
0.3054462969303131,
-0.2744939625263214,
-0.24823962152004242,
-0.2508452236652374,
-0.4493705630302429,
0.2777399718761444,
0.43660953640937805,
0.2937544286251068,
0.1798565685749054,
1.010659098625183,
-0.5214996337890625,
0.32902809977531433,... |
func (u *Umbrella) OnDNSRequest(ctx context.Context, req *requests.DNSRequest) {
cfg := ctx.Value(requests.ContextConfig).(*config.Config)
bus := ctx.Value(requests.ContextEventBus).(*eventbus.EventBus)
if cfg == nil || bus == nil {
return
}
if u.API == nil || u.API.Key == "" {
return
}
if !cfg.IsDomainInS... | [
-0.4169504642486572,
0.5014355182647705,
0.67310631275177,
0.21888385713100433,
-0.05932172015309334,
-0.8584405183792114,
-0.4471593201160431,
-0.18278370797634125,
0.8038550019264221,
-0.006350288167595863,
-0.1331254094839096,
0.7552720904350281,
-0.16072754561901093,
0.7012521028518677... |
func (u *Umbrella) OnAddrRequest(ctx context.Context, req *requests.AddrRequest) {
cfg := ctx.Value(requests.ContextConfig).(*config.Config)
bus := ctx.Value(requests.ContextEventBus).(*eventbus.EventBus)
if cfg == nil || bus == nil {
return
}
if u.API == nil || u.API.Key == "" {
return
}
if req.Address ==... | [
-0.14928068220615387,
-0.00920189917087555,
0.8015755414962769,
-0.010673416778445244,
-0.210668683052063,
-0.3470225930213928,
0.0028632853645831347,
0.3371976912021637,
0.7685017585754395,
0.3291339576244354,
0.39222002029418945,
0.6454447507858276,
-0.41033369302749634,
0.69053632020950... |
func (u *Umbrella) OnASNRequest(ctx context.Context, req *requests.ASNRequest) {
bus := ctx.Value(requests.ContextEventBus).(*eventbus.EventBus)
if bus == nil {
return
}
if u.API == nil || u.API.Key == "" {
return
}
if req.Address == "" && req.ASN == 0 {
return
}
u.CheckRateLimit()
bus.Publish(request... | [
-0.4168005883693695,
-0.7089950442314148,
0.5092256665229797,
0.5303273797035217,
0.304576575756073,
-0.845543622970581,
-0.3050370514392853,
-0.05473814159631729,
0.7839202880859375,
0.13970604538917542,
0.6878234148025513,
0.5382201671600342,
0.16594797372817993,
0.7497565746307373,
0.... |
func (u *Umbrella) OnWhoisRequest(ctx context.Context, req *requests.WhoisRequest) {
cfg := ctx.Value(requests.ContextConfig).(*config.Config)
bus := ctx.Value(requests.ContextEventBus).(*eventbus.EventBus)
if cfg == nil || bus == nil {
return
}
if u.API == nil || u.API.Key == "" {
return
}
if !cfg.IsDomai... | [
-0.4855041801929474,
0.2640116810798645,
0.6884900331497192,
0.3471822142601013,
0.47119951248168945,
-0.10046782344579697,
0.4259495139122009,
-0.06919677555561066,
0.8233633637428284,
0.39257365465164185,
0.08076488971710205,
1.0772221088409424,
0.177107036113739,
0.5639448165893555,
0... |
func NewMockCompany(ctrl *gomock.Controller) *MockCompany {
mock := &MockCompany{ctrl: ctrl}
mock.recorder = &MockCompanyMockRecorder{mock}
return mock
} | [
-0.041054364293813705,
0.23435644805431366,
0.3497365117073059,
1.0630590915679932,
0.7834063768386841,
-0.16193975508213043,
0.49461135268211365,
-0.5034844875335693,
0.33830249309539795,
0.4639692008495331,
-0.32344338297843933,
0.4642646014690399,
-0.4069955050945282,
1.3256757259368896... |
func (m *MockCompany) EXPECT() *MockCompanyMockRecorder {
return m.recorder
} | [
0.12020941078662872,
0.47129490971565247,
0.3357499837875366,
0.37710756063461304,
0.40835168957710266,
0.48816847801208496,
0.054281264543533325,
0.22159458696842194,
0.11649513989686966,
0.23603978753089905,
0.7239040732383728,
0.8589291572570801,
-1.4310572147369385,
0.262301504611969,
... |
func (m *MockCompany) Create(arg0 domain.Company) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Create", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
-0.510360836982727,
0.2294892817735672,
0.22611628472805023,
0.7758377194404602,
1.607997179031372,
0.6447928547859192,
0.7611136436462402,
-0.537796676158905,
-1.4913510084152222,
0.04496156796813011,
-0.024909522384405136,
-1.1652277708053589,
-0.5867756009101868,
1.4106543064117432,
0... |
func (mr *MockCompanyMockRecorder) Create(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockCompany)(nil).Create), arg0)
} | [
-0.05837602913379669,
0.7045876979827881,
0.19819925725460052,
0.7910668849945068,
0.2693037986755371,
0.6994835734367371,
-0.3318728804588318,
-1.2306525707244873,
-0.16834105551242828,
0.8582314252853394,
0.7648912668228149,
-0.0714653804898262,
-0.8094244599342346,
1.8644018173217773,
... |
func (m *MockCompany) Delete(arg0 ...repository.Filter) error {
m.ctrl.T.Helper()
varargs := []interface{}{}
for _, a := range arg0 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Delete", varargs...)
ret0, _ := ret[0].(error)
return ret0
} | [
-0.4624706208705902,
0.4511626064777374,
0.45123356580734253,
0.7814262509346008,
1.2252826690673828,
0.277170866727829,
0.6856303811073303,
-0.0553617998957634,
-0.521911084651947,
-0.0674135610461235,
0.12681449949741364,
-0.4223465025424957,
-1.2813360691070557,
0.9053053855895996,
0.... |
func (mr *MockCompanyMockRecorder) Delete(arg0 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockCompany)(nil).Delete), arg0...)
} | [
0.1531086266040802,
0.9141929745674133,
0.4259258806705475,
0.8601943850517273,
0.3086770474910736,
0.3444039821624756,
-0.3184780478477478,
-0.9357918500900269,
0.8622845411300659,
0.8017392754554749,
0.8141025304794312,
0.3011467456817627,
-1.3258411884307861,
1.1564669609069824,
-0.01... |
func (m *MockCompany) Get(arg0 ...repository.Filter) ([]domain.Company, error) {
m.ctrl.T.Helper()
varargs := []interface{}{}
for _, a := range arg0 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Get", varargs...)
ret0, _ := ret[0].([]domain.Company)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
-1.3456531763076782,
-0.25102856755256653,
0.670477569103241,
0.17793996632099152,
1.3005414009094238,
0.2981860935688019,
0.498374879360199,
-0.2173328548669815,
-1.4550347328186035,
-0.1707524061203003,
-0.15468370914459229,
0.05947141349315643,
-0.4346688389778137,
0.844240665435791,
... |
func (mr *MockCompanyMockRecorder) Get(arg0 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockCompany)(nil).Get), arg0...)
} | [
-0.5226654410362244,
0.342359334230423,
0.44742488861083984,
-0.09398546069860458,
0.6078292727470398,
0.08265721052885056,
-0.7838611006736755,
-0.8964896202087402,
0.06210631877183914,
0.7444016337394714,
0.4918966591358185,
0.904175877571106,
-0.8340988755226135,
1.139452338218689,
0.... |
func (m *MockCompany) Update(arg0 domain.Company) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Update", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
-0.4744223654270172,
-0.4997643232345581,
0.3306410610675812,
0.3961786925792694,
0.8936032652854919,
0.6532787084579468,
0.5908830165863037,
-0.22957193851470947,
-0.35165420174598694,
0.27279889583587646,
-0.16148768365383148,
-0.9713743329048157,
-1.183058500289917,
0.9137850999832153,
... |
func (mr *MockCompanyMockRecorder) Update(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockCompany)(nil).Update), arg0)
} | [
-0.1888313889503479,
0.1094878688454628,
0.29300209879875183,
0.4056699872016907,
-0.3999629616737366,
0.3773830235004425,
-0.27450352907180786,
-0.8224352598190308,
0.7683594226837158,
0.8704883456230164,
0.7225798964500427,
0.09759802371263504,
-1.3651869297027588,
1.2075201272964478,
... |
func NewLibstore(masterServerHostPort, myHostPort string, mode LeaseMode) (Libstore, error) {
// dial the master
master, err := rpc.DialHTTP("tcp", masterServerHostPort)
if err != nil {
return nil, err
}
libstore := &libstore{
mutex: sync.Mutex{},
master: master,
hostPort: myHostPort,
mode: ... | [
0.16209223866462708,
-0.36790189146995544,
0.7282496094703674,
-0.4342920482158661,
-0.4011232852935791,
0.30997827649116516,
-0.5572839975357056,
-0.12603221833705902,
0.14418505132198334,
0.0304807610809803,
-0.3508374094963074,
0.001357380417175591,
-0.8409597873687744,
0.22926074266433... |
func NewHandler(f func(*Message), path string, description ...string) *Handler {
handler := &Handler{f: f}
handler.variables, handler.pattern = parse(path)
if len(description) > 0 {
handler.description = description[0]
}
return handler
} | [
0.5488249659538269,
-0.21100544929504395,
0.12898392975330353,
0.32447561621665955,
-0.4155769944190979,
0.3911779522895813,
0.14963805675506592,
0.6443280577659607,
-1.1018257141113281,
-0.766713559627533,
0.588379442691803,
0.8198873996734619,
0.11482833325862885,
0.008221159689128399,
... |
func newSalt(length int) []byte {
salt := make([]byte, length)
_, _ = rand.Read(salt)
for i, item := range salt {
salt[i] = sourceStr[item%byte(len(sourceStr))]
}
return salt
} | [
-0.44050276279449463,
-0.3878486752510071,
0.4226664900779724,
-1.4220225811004639,
-1.0429832935333252,
0.13958001136779785,
-0.9943642020225525,
-0.8688541054725647,
0.9095384478569031,
0.43124037981033325,
-1.0405186414718628,
0.7344357967376709,
-0.5085759162902832,
-0.1308998167514801... |
func AuthMiddleware() (*jwt.GinJWTMiddleware, error) {
return jwt.New(&jwt.GinJWTMiddleware{
Realm: "test zone",
Key: []byte("$2a$10$GCiJQcAqSaPV8.bU/mvGiOgdHV8GuMOdmW6.nUpCRisfUx9b.VGqy"),
Timeout: time.Hour,
MaxRefresh: time.Hour,
IdentityKey: identityKey,
PayloadFu... | [
-0.18510818481445312,
-0.5276907086372375,
0.4376367926597595,
0.14017240703105927,
-0.18930557370185852,
-0.2983465790748596,
0.1543038934469223,
-0.7301040291786194,
0.9026123881340027,
-0.14243322610855103,
-0.12337528169155121,
0.8164108395576477,
-0.9148771166801453,
0.312657773494720... |
func authenticator(c *gin.Context) (interface{}, error) {
var loginVals login
var user models.User
var db = db.GetDB()
if err := c.ShouldBind(&loginVals); err != nil {
return "", jwt.ErrMissingLoginValues
}
// request fields
email := loginVals.Email
password := loginVals.Password
err := db.Where("email = ... | [
-0.3676528036594391,
-0.12429576367139816,
0.7806025743484497,
0.21526838839054108,
-0.7009101510047913,
-0.15801888704299927,
0.11599061638116837,
-0.04470450431108475,
0.5847983360290527,
0.32238322496414185,
-0.009872561320662498,
-0.3715185225009918,
-0.12570950388908386,
-0.1890029162... |
func LoginResponse(c *gin.Context, code int, token string, expire time.Time) {
c.JSON(http.StatusOK, gin.H{
"jwt": token,
"time": expire,
})
} | [
-0.46858739852905273,
-0.6582636833190918,
0.5019639730453491,
-0.581831693649292,
0.2723730802536011,
-0.58612060546875,
-1.4438297748565674,
-0.17545165121555328,
0.6869362592697144,
1.0461763143539429,
-1.4492098093032837,
-0.3980955481529236,
-0.2568407952785492,
-0.7886117696762085,
... |
func payloadFunc(data interface{}) jwt.MapClaims {
if v, ok := data.(*models.User); ok {
return jwt.MapClaims{
"uuid": v.UUID,
"access_level": v.AccessLevel,
"first_name": v.FirstName,
}
}
return jwt.MapClaims{}
} | [
0.6065034866333008,
-0.16060347855091095,
0.3919921815395355,
-0.03583309054374695,
-1.355957269668579,
-0.11505059897899628,
0.02852507494390011,
-0.18888084590435028,
0.2051130086183548,
0.37400689721107483,
-0.055693041533231735,
0.04987470433115959,
1.709222674369812,
-0.08360872417688... |
func identityHandler(c *gin.Context) interface{} {
claims := jwt.ExtractClaims(c)
return &models.User{
Email: claims[identityKey].(string),
}
} | [
0.38183683156967163,
-0.5700322389602661,
0.18084180355072021,
0.26815810799598694,
0.05476550757884979,
0.5187209844589233,
-0.2640441060066223,
-0.4171997010707855,
0.9770997762680054,
0.2916759252548218,
-0.19125321507453918,
-0.7024999856948853,
-0.5952678918838501,
-1.0396827459335327... |
func authorizator(data interface{}, c *gin.Context) bool {
if _, ok := data.(*models.User); ok {
return true
}
return false
} | [
-0.7422611117362976,
0.3476755619049072,
0.5473829507827759,
0.6546302437782288,
-0.6793205142021179,
0.613353431224823,
0.6005785465240479,
0.4286138713359833,
0.46984317898750305,
-0.022344980388879776,
0.3310268223285675,
-0.5880864262580872,
0.050735872238874435,
0.20180894434452057,
... |
func Base64Encode(input []byte) []byte {
enc := base64.StdEncoding
encLength := enc.EncodedLen(len(input))
output := make([]byte, encLength)
enc.Encode(output, input)
return output
} | [
0.7371897101402283,
0.10421577095985413,
0.28689339756965637,
1.0962477922439575,
0.12909410893917084,
0.31767868995666504,
0.23455052077770233,
-0.09829110652208328,
0.547207772731781,
0.5796741843223572,
-0.5975411534309387,
-0.04228944331407547,
-1.000343680381775,
0.01648036018013954,
... |
func Base64Decode(input []byte) []byte {
dec := base64.StdEncoding
decLength := dec.DecodedLen(len(input))
output := make([]byte, decLength)
n, err := dec.Decode(output, input)
if err != nil {
panic(err)
}
if n < decLength {
output = output[:n]
}
return output
} | [
0.5776177048683167,
0.08660928905010223,
0.5301323533058167,
1.194337010383606,
-0.15785230696201324,
-0.13535167276859283,
-0.4606305956840515,
-0.07285463809967041,
0.26805242896080017,
0.17823806405067444,
0.10167143493890762,
-0.23813045024871826,
-0.950575053691864,
0.0737323984503746... |
func NewFileAction(action string, path string) (*FileAction, error) {
fa := new(FileAction)
if err := fa.SetAction(action); err != nil {
return nil, err
}
fa.Path = path
return fa, nil
} | [
0.14462456107139587,
-1.0982619524002075,
0.20118214190006256,
0.2798675298690796,
-0.32808566093444824,
-0.7545581459999084,
0.5665884017944336,
-0.22705012559890747,
-0.185543030500412,
0.28393125534057617,
-0.652415931224823,
0.6374886631965637,
-0.3110297620296478,
0.05275736004114151,... |
func NewFileActionFromMSG(msg *nats.Msg) (*FileAction, error) {
fa := new(FileAction)
err := json.Unmarshal(msg.Data, &fa)
if err != nil {
return nil, err
}
return fa, nil
} | [
0.01506670843809843,
-0.9925187826156616,
0.2950917184352875,
-0.41131800413131714,
-0.7708512544631958,
-0.8048349618911743,
0.08204885572195053,
-0.2242376208305359,
-0.269959032535553,
-0.13392767310142517,
0.02732301689684391,
0.49285629391670227,
-0.0565103217959404,
0.700005412101745... |
func (fa *FileAction) SetAction(action string) error {
var ok bool
switch action {
case SelectFile, GetFileStructure, AddFile, MoveFile, DeleteFile, StreamFile:
ok = true
default:
ok = false
}
if !ok {
return fmt.Errorf("File Action not available: %v", action)
}
fa.Action = action
return nil
} | [
-0.14826737344264984,
-1.2727118730545044,
0.43353527784347534,
0.3417714238166809,
0.3657624125480652,
0.4636877179145813,
0.8989477157592773,
0.21128837764263153,
0.3633267879486084,
0.16958250105381012,
-0.4826961159706116,
0.5070706009864807,
-0.03607800230383873,
0.6921940445899963,
... |
func (fa *FileAction) SendAction(nc *nats.Conn, timeout time.Duration) (reply *nats.Msg, err error) {
data, err := json.Marshal(fa)
if err != nil {
return nil, err
}
reply, err = nc.Request(fa.Action, data, timeout)
if err != nil {
return nil, err
}
return reply, nil
} | [
-0.6535190939903259,
-0.6043737530708313,
0.5079062581062317,
-0.18717551231384277,
0.35631024837493896,
-0.16402781009674072,
-0.16395635902881622,
-0.6228442192077637,
-0.07686466723680496,
0.883876383304596,
-0.24053475260734558,
0.683244526386261,
-0.3642946779727936,
0.521511137485504... |
func NewFSProgressFromMSG(msg *nats.Msg) (*FSProgress, error) {
// make FSP
fsp := new(FSProgress)
// unmarshal the data from the msg
err := json.Unmarshal(msg.Data, fsp)
if err != nil {
return nil, err
}
return fsp, nil
} | [
0.04733698442578316,
-0.325298935174942,
0.3040259778499603,
-0.4003519117832184,
-1.118181586265564,
-0.8360120058059692,
-0.7688733339309692,
-0.5650942325592041,
0.03189808502793312,
-0.4656142592430115,
-0.27955910563468933,
-0.6494123935699463,
-0.6439656615257263,
0.1340976506471634,... |
func CompareHexHash(hash func() hash.Hash, str, hexStr, key string) (bool, error) {
kb, err := hex.DecodeString(key)
if err != nil {
return false, err
}
orig, err := hex.DecodeString(hexStr)
if err != nil {
return false, err
}
sum := pbkdf2.Key([]byte(str), kb, Iter, KeyLength, hash)
return subtle.Constan... | [
0.41795095801353455,
-0.8938525915145874,
0.6814165711402893,
0.32893791794776917,
-0.4226234257221222,
0.2960675358772278,
-0.9653573036193848,
0.46776288747787476,
-0.8586276173591614,
0.20468097925186157,
-0.6413246393203735,
-0.5364888906478882,
-0.6537203788757324,
0.7865895628929138,... |
func CompareB64Hash(hash func() hash.Hash, str, b64Str, key string) (bool, error) {
kb, err := hex.DecodeString(key)
if err != nil {
return false, err
}
orig, err := base64.StdEncoding.DecodeString(b64Str)
if err != nil {
return false, err
}
sum := pbkdf2.Key([]byte(str), kb, Iter, KeyLength, hash)
return... | [
0.6506739258766174,
-0.8131298422813416,
0.5786543488502502,
0.9220324754714966,
-0.3508124351501465,
-0.07325392961502075,
-0.6376246213912964,
0.12717823684215546,
-1.1615344285964966,
0.6634266376495361,
-0.29111161828041077,
-0.2718404531478882,
-0.964750349521637,
0.6113463044166565,
... |
func PumpHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
// path should be something like /api/pump/X
parts := strings.Split(r.URL.Path, "/")
id, _ := strconv.Atoi(parts[3])
// return the pump info
if r.Method == "GET" {
pump, err := models.GetPump(id)
if... | [
-0.7467483282089233,
-0.35369497537612915,
0.85179603099823,
0.018843060359358788,
0.13056033849716187,
0.020668087527155876,
0.3349625766277313,
-0.25815001130104065,
0.3519860506057739,
0.20427387952804565,
0.02365531399846077,
-0.669515073299408,
-0.6851634383201599,
0.398700088262558,
... |
func PumpListHandler(w http.ResponseWriter, r *http.Request) {
json, _ := json.Marshal(hw.Pumps)
fmt.Fprintf(w, string(json))
} | [
-0.9692016839981079,
-0.8463362455368042,
0.4753299951553345,
-0.48612678050994873,
-0.38119471073150635,
0.3303464949131012,
-0.15880174934864044,
-0.2513355314731598,
0.20870502293109894,
0.9287558197975159,
-0.552945077419281,
-0.5155209302902222,
-0.3817136585712433,
0.2206401526927948... |
func New(conn *grpc.ClientConn) token_grpc.TokenServiceInterface {
var tokenEndpoint = grpctransport.NewClient(
conn, "v1.TokenService", "Generate",
token_grpc.EncodeGRPCTokenRequest,
token_grpc.DecodeGRPCTokenResponse,
pb.TokenResponse{},
).Endpoint()
var tokenVerifyEndpoint = grpctransport.NewClient(
co... | [
-0.27200397849082947,
-0.7926816940307617,
0.48884642124176025,
-0.7609372735023499,
-0.2978876829147339,
-0.01843429170548916,
0.3172451853752136,
-0.5062474608421326,
-0.6083729863166809,
-0.12362643331289291,
0.04073462262749672,
0.5976573824882507,
-0.2516101598739624,
-0.1349072307348... |
func loadConfig(filename string) ConfigFile {
// Deliberately don't catch errors, want script to crash on config file load error
configFile, _ := ioutil.ReadFile(filename)
var config ConfigFile
yaml.Unmarshal(configFile, &config)
// Return the struct
return (config)
} | [
0.4607168436050415,
-0.48079320788383484,
0.48693224787712097,
-0.30116188526153564,
-0.6624757647514343,
-0.012194070965051651,
0.5280336141586304,
1.0332603454589844,
-0.8316501379013062,
0.019461801275610924,
-0.4655786454677582,
-0.49827590584754944,
-0.3234598636627197,
0.554803729057... |
func ServiceClient() *gophercloud.ServiceClient {
return &gophercloud.ServiceClient{
ProviderClient: &gophercloud.ProviderClient{TokenID: TokenID},
Endpoint: testhelper.Endpoint(),
}
} | [
0.5109997391700745,
-0.228800967335701,
0.037745025008916855,
-0.4412502944469452,
0.3658035695552826,
-0.12075263261795044,
0.6681386828422546,
-0.36331504583358765,
-0.0051606944762170315,
0.10573377460241318,
-0.1646200567483902,
1.2858357429504395,
-0.9159714579582214,
-0.4480422735214... |
func NewRoutingTable(me Contact) *RoutingTable {
routingTable := &RoutingTable{}
for i := 0; i < IDLength*8; i++ {
routingTable.buckets[i] = newBucket()
}
routingTable.me = me
return routingTable
} | [
-0.19500038027763367,
0.4818762540817261,
0.5209012627601624,
0.16701097786426544,
-0.9760741591453552,
-0.060413360595703125,
0.7284528017044067,
-0.9322977066040039,
-0.1913994401693344,
0.1306261122226715,
-0.8613478541374207,
-0.4303957223892212,
-0.5402876138687134,
-0.209710046648979... |
func (routingTable *RoutingTable) AddContact(contact Contact) {
bucketIndex := routingTable.getBucketIndex(contact.ID)
routingTable.mutex.Lock()
defer routingTable.mutex.Unlock()
bucket := routingTable.buckets[bucketIndex]
bucket.AddContact(contact)
} | [
-0.29864203929901123,
-0.02347765490412712,
0.8317769169807434,
0.5758803486824036,
0.15974292159080505,
-0.07926248013973236,
0.7381229400634766,
-0.9523661136627197,
-0.3054375946521759,
0.012428591027855873,
0.10253728926181793,
-0.736018717288971,
-0.27207228541374207,
0.12779997289180... |
func (routingTable *RoutingTable) FindClosestContacts(target *KademliaID, count int) []Contact {
var candidates []Contact
bucketIndex := routingTable.getBucketIndex(target)
routingTable.mutex.Lock()
defer routingTable.mutex.Unlock()
bucket := routingTable.buckets[bucketIndex]
candidates = append(candidates, bu... | [
-0.16436824202537537,
-0.9896657466888428,
0.9020470380783081,
0.15115037560462952,
-0.6838359832763672,
-0.36047929525375366,
0.8382340669631958,
-1.5855038166046143,
-0.292033314704895,
0.2709659934043884,
0.21653181314468384,
-0.14012624323368073,
-0.7738271951675415,
0.1581655591726303... |
func (routingTable *RoutingTable) getBucketIndex(id *KademliaID) int {
routingTable.mutex.Lock()
defer routingTable.mutex.Unlock()
distance := id.CalcDistance(routingTable.me.ID)
for i := 0; i < IDLength; i++ {
for j := 0; j < 8; j++ {
if (distance[i]>>uint8(7-j))&0x1 != 0 {
return i*8 + j
}
}
}
r... | [
-0.4003903865814209,
0.2544713318347931,
0.7612386345863342,
-0.43390142917633057,
-0.2812005281448364,
-0.0681510642170906,
0.43905115127563477,
-0.3418934941291809,
-0.06881468743085861,
0.11825118213891983,
-0.5340701341629028,
0.060057688504457474,
-0.4383707046508789,
-0.4187328219413... |
func (im *instrumentingMiddleware) instrumenting(begin time.Time, method string, err error) {
im.requestCount.With("method", method).Add(1)
if err != nil {
im.requestError.With("method", method).Add(1)
}
im.requestLatency.With("method", method).Observe(time.Since(begin).Seconds())
} | [
-0.8401709198951721,
0.06206611543893814,
0.7714150547981262,
0.17148825526237488,
0.18951061367988586,
0.10411026328802109,
-0.009262839332222939,
0.26618218421936035,
0.2222656011581421,
0.2680349349975586,
0.6081905961036682,
0.5882885456085205,
-0.031998492777347565,
1.171947956085205,... |
func (AppModuleBasic) Name() string {
return types.ModuleName
} | [
-0.45558008551597595,
-0.7744801044464111,
0.3471018373966217,
0.8236920833587646,
-0.2751672863960266,
1.139162302017212,
-0.5973710417747498,
-1.264533519744873,
-0.26170867681503296,
0.945909321308136,
-0.1166713684797287,
-0.27387088537216187,
0.4173685908317566,
0.5937542915344238,
... |
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterLegacyAminoCodec(cdc)
} | [
0.3904978036880493,
-0.20405201613903046,
0.5275859236717224,
-0.48907706141471863,
0.056303802877664566,
0.14128521084785461,
-0.24475319683551788,
0.0062751155346632,
0.6903110146522522,
-1.4028536081314087,
-0.8004726767539978,
1.3021115064620972,
0.48452290892601013,
0.9213565587997437... |
func (AppModuleBasic) RegisterInterfaces(registry codecTypes.InterfaceRegistry) {
types.RegisterInterfaces(registry)
} | [
-0.5181245803833008,
1.1885415315628052,
0.35416123270988464,
0.4435320198535919,
1.3125243186950684,
0.7630013823509216,
0.5164445638656616,
-0.43181121349334717,
0.24589195847511292,
-0.5905942916870117,
-0.8649469017982483,
0.4677768051624298,
-0.6762191653251648,
0.8450706005096436,
... |
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage {
return cdc.MustMarshalJSON(types.DefaultGenesisState())
} | [
-0.8920877575874329,
0.32406291365623474,
0.29572102427482605,
0.21530881524085999,
0.3246067464351654,
-0.12171989679336548,
-0.46921494603157043,
-0.7506784200668335,
-0.564002513885498,
-0.14620250463485718,
-0.3140956461429596,
-0.9838088750839233,
0.047131359577178955,
1.4606679677963... |
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, _ client.TxEncodingConfig, bz json.RawMessage) error {
var data types.GenesisState
err := cdc.UnmarshalJSON(bz, &data)
if err != nil {
return err
}
return types.ValidateGenesis(data)
} | [
-1.0718228816986084,
-0.20659112930297852,
0.3225199282169342,
0.13067331910133362,
-0.2913019061088562,
0.26464155316352844,
0.6932249665260315,
-0.20576319098472595,
-0.9379847645759583,
0.199184849858284,
-0.37130919098854065,
0.11853120476007462,
-0.3743465840816498,
1.0172172784805298... |
func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) {} | [
-0.12979447841644287,
0.15073548257350922,
0.29787886142730713,
0.731278657913208,
0.05832093209028244,
-0.13882586359977722,
-0.6477587223052979,
-0.41663458943367004,
0.4136093258857727,
-0.23010700941085815,
-0.8844612836837769,
0.42904144525527954,
-1.481002926826477,
-0.02938472479581... |
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.NewTxCmd()
} | [
1.3697160482406616,
-0.4978802502155304,
0.5404051542282104,
0.44973403215408325,
0.5836762189865112,
0.18974833190441132,
-0.8048878312110901,
-0.13603797554969788,
-0.20079301297664642,
-0.698652982711792,
0.3220752477645874,
0.2555558979511261,
-0.11141190677881241,
0.07884934544563293,... |
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.NewQueryCmd()
} | [
0.7935831546783447,
-0.48665955662727356,
0.44251707196235657,
0.5948091149330139,
0.617361307144165,
0.7623401284217834,
-0.3641866445541382,
-0.10547385364770889,
-0.059632450342178345,
-1.6258026361465454,
0.6274838447570801,
1.0107418298721313,
-0.19453935325145721,
0.3410738706588745,... |
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
} | [
0.07058776915073395,
-0.039634134620428085,
0.4032384157180786,
-0.11336774379014969,
0.8717811703681946,
1.2060846090316772,
0.33343228697776794,
-0.5602214336395264,
-1.1010864973068237,
0.022135328501462936,
-0.22715763747692108,
0.688003659248352,
-1.4632488489151,
-0.07295796275138855... |
func NewAppModule(k keeper.Keeper,
accountKeeper types.AccountKeeper,
) AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{},
keeper: k,
accountKeeper: accountKeeper,
}
} | [
0.27856695652008057,
-0.5373422503471375,
0.3400556147098541,
1.1643850803375244,
-0.3916032314300537,
1.3259888887405396,
-1.155422329902649,
-0.20548580586910248,
0.19295886158943176,
0.19364666938781738,
-0.11913830786943436,
0.28517717123031616,
0.6122073531150818,
0.6565122604370117,
... |
func (AppModule) Name() string {
return types.ModuleName
} | [
-0.41787388920783997,
-0.7772024273872375,
0.23767878115177155,
0.4639391601085663,
-0.2679980397224426,
1.0729248523712158,
-0.3723086714744568,
-0.7443119883537292,
0.24912092089653015,
1.2376611232757568,
0.01946939527988434,
-0.04762470722198486,
0.3576582372188568,
0.8474292755126953,... |
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), keeper.MsgServer(am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), keeper.QueryServer(am.keeper))
} | [
-0.7218555212020874,
0.8194702863693237,
0.4037451446056366,
0.17073701322078705,
0.7076522707939148,
0.6198126077651978,
0.14322829246520996,
-0.6112914681434631,
0.1485360711812973,
-0.4092260003089905,
-0.03870818391442299,
-0.05746105685830116,
-0.42925503849983215,
2.040414810180664,
... |
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} | [
-0.3780871331691742,
0.15741777420043945,
0.33615919947624207,
0.3729782700538635,
0.19121089577674866,
0.9775264859199524,
0.3495546281337738,
0.02683964930474758,
0.008653480559587479,
-0.05258007347583771,
-0.8468137383460999,
0.8036711812019348,
-1.022814154624939,
0.38162609934806824,... |
func (am AppModule) Route() sdk.Route {
return sdk.NewRoute(types.ModuleName, NewHandler(am.keeper))
} | [
0.3263327181339264,
-0.14801709353923798,
0.013159922324120998,
0.9213035702705383,
0.3672001361846924,
0.6833430528640747,
-0.21086084842681885,
-0.3214029371738434,
0.022427057847380638,
-0.6016969084739685,
0.5481137633323669,
0.34444373846054077,
0.391651451587677,
1.1303335428237915,
... |
func (AppModule) QuerierRoute() string {
return types.QuerierRoute
} | [
1.0394582748413086,
-0.735567569732666,
0.21763142943382263,
-0.0718015655875206,
1.1491048336029053,
1.5357587337493896,
-0.756696879863739,
-0.29065805673599243,
-0.22966711223125458,
-0.9543866515159607,
0.1340426653623581,
-0.20025132596492767,
-0.5982688665390015,
0.7612514495849609,
... |
func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
return keeper.NewQuerier(am.keeper, legacyQuerierCdc)
} | [
1.0167262554168701,
-1.0037782192230225,
0.27532124519348145,
-0.4433707594871521,
-0.6047141551971436,
0.4842172861099243,
-0.7866924405097961,
0.28959617018699646,
0.5928723216056824,
-1.1051321029663086,
0.12686680257320404,
0.01676487922668457,
0.15200231969356537,
0.7648692727088928,
... |
func (am AppModule) InitGenesis(ctx sdk.Context, mrshl codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate {
var genesisState types.GenesisState
mrshl.MustUnmarshalJSON(data, &genesisState)
InitGenesis(ctx, am.keeper, genesisState)
return []abci.ValidatorUpdate{}
} | [
-0.8620906472206116,
-0.5103899240493774,
0.6002826690673828,
0.7949865460395813,
0.13986892998218536,
0.27068886160850525,
-0.011807859875261784,
0.24784590303897858,
-0.3977564573287964,
0.3161739706993103,
-0.6731193661689758,
0.3327450752258301,
-0.22953860461711884,
1.4955191612243652... |
func (am AppModule) ExportGenesis(ctx sdk.Context, mrshl codec.JSONMarshaler) json.RawMessage {
gs := ExportGenesis(ctx, am.keeper)
return mrshl.MustMarshalJSON(gs)
} | [
-0.8555101752281189,
-0.26859334111213684,
0.33142200112342834,
0.8210623860359192,
-0.3373974859714508,
0.3591350018978119,
-0.4336147904396057,
-0.7834770679473877,
0.08780895918607712,
0.867115318775177,
-0.22020699083805084,
0.35149189829826355,
0.06256446987390518,
1.8352419137954712,... |
func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {} | [
-0.4005165696144104,
-0.042398516088724136,
0.7209445834159851,
0.8639587759971619,
-0.04920453950762749,
0.957088828086853,
0.6464210152626038,
-0.5936022400856018,
0.9169721007347107,
-0.28026390075683594,
0.7539003491401672,
1.1459635496139526,
-0.3002046048641205,
1.055668830871582,
... |
func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
return []abci.ValidatorUpdate{}
} | [
-0.9281064867973328,
-0.21642950177192688,
0.655408501625061,
0.690991997718811,
0.2999360263347626,
0.4038011431694031,
-0.3543509244918823,
-0.07954393327236176,
0.09469440579414368,
-0.5748990178108215,
0.08105086535215378,
0.516596257686615,
-1.2301150560379028,
1.0496271848678589,
0... |
func (daemon *Daemon) ContainerUnpause(name string) error {
container, err := daemon.GetContainer(name)
if err != nil {
return err
}
if err := daemon.containerUnpause(container); err != nil {
return err
}
return nil
} | [
-0.7145382165908813,
-0.35120174288749695,
0.8223602771759033,
-0.29276415705680847,
0.7815349698066711,
-1.6654824018478394,
0.38102835416793823,
-0.2257315218448639,
0.5902617573738098,
0.7490224242210388,
0.5844342112541199,
-0.40648388862609863,
-0.7333727478981018,
0.10769043862819672... |
func (daemon *Daemon) containerUnpause(container *container.Container) error {
container.Lock()
defer container.Unlock()
// We cannot unpause the container which is not paused
if !container.Paused {
return fmt.Errorf("Container %s is not paused", container.ID)
}
if err := daemon.containerd.Resume(context.Back... | [
-0.2153749167919159,
-0.08177941292524338,
0.6361801028251648,
-0.33863145112991333,
1.1373920440673828,
-1.2949833869934082,
0.35735175013542175,
0.25651583075523376,
0.9030925631523132,
0.5027710199356079,
0.6643527150154114,
-0.11789169907569885,
-0.5510715246200562,
-0.3766919672489166... |
func ParseEndpoint(endpoint string) (*url.URL, error) {
endpoint = FormatEndpoint(endpoint)
u, err := url.Parse(endpoint)
if err != nil {
return nil, err
}
return u, nil
} | [
0.21757745742797852,
-0.32123497128486633,
0.39813098311424255,
0.09813935309648514,
-0.03358237072825432,
0.3088725507259369,
-0.4678468704223633,
0.42208489775657654,
-0.08120506256818771,
-0.2645939588546753,
0.22274577617645264,
0.1854850798845291,
-0.448478102684021,
0.318726003170013... |
func ParseRepository(repository string) (project, rest string) {
repository = strings.TrimLeft(repository, "/")
repository = strings.TrimRight(repository, "/")
if !strings.ContainsRune(repository, '/') {
rest = repository
return
}
index := strings.LastIndex(repository, "/")
project = repository[0:index]
rest... | [
-0.7047666311264038,
-0.461760938167572,
0.4224662482738495,
-0.6784034967422485,
-0.5333693027496338,
-0.41004639863967896,
-0.16669301688671112,
-0.06896991282701492,
0.162184476852417,
0.1537007987499237,
-0.15752370655536652,
-0.5554444193840027,
-1.026840090751648,
-0.4013239443302154... |
func GenerateRandomString() string {
length := 32
rand.Seed(time.Now().UTC().UnixNano())
const chars = "abcdefghijklmnopqrstuvwxyz0123456789"
result := make([]byte, length)
for i := 0; i < length; i++ {
result[i] = chars[rand.Intn(len(chars))]
}
return string(result)
} | [
-0.30999013781547546,
0.5691775679588318,
0.4914727807044983,
-0.9190248847007751,
0.05617758259177208,
1.3666192293167114,
-0.5633609890937805,
-0.5462689995765686,
0.5337233543395996,
-0.2925202548503876,
-0.4444968104362488,
0.24233321845531464,
0.008484994061291218,
-0.2299425452947616... |
func StringInSlice(a string, list []string) bool {
for _, b := range list {
if b == a {
return true
}
}
return false
} | [
0.1872318536043167,
-1.2441215515136719,
0.33633801341056824,
0.2545374035835266,
-0.6286222338676453,
-0.49445807933807373,
-0.8293318152427673,
0.6134192943572998,
0.006875546183437109,
0.880862295627594,
-0.6804824471473694,
0.20464710891246796,
-0.6598539352416992,
0.15983858704566956,... |
func (o *PutMeInstallationTemplateTemplateNamePartitionSchemeSchemeNamePartitionMountpointReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPutMeInstallationTemplateTemplateNamePartitionSchemeSchemeNamePartitionMo... | [
-0.00661926344037056,
-0.9089949727058411,
0.6585609316825867,
0.022429151460528374,
-0.3144093155860901,
-0.6153625845909119,
-0.3070424199104309,
-0.31868839263916016,
0.09043411910533905,
0.6379135847091675,
0.47661975026130676,
-1.1133947372436523,
-1.312256932258606,
-0.54818016290664... |
func NewPutMeInstallationTemplateTemplateNamePartitionSchemeSchemeNamePartitionMountpointOK() *PutMeInstallationTemplateTemplateNamePartitionSchemeSchemeNamePartitionMountpointOK {
return &PutMeInstallationTemplateTemplateNamePartitionSchemeSchemeNamePartitionMountpointOK{}
} | [
0.5896278619766235,
-0.5516700744628906,
0.8358970880508423,
0.3476004898548126,
-0.6116547584533691,
-0.18496352434158325,
-0.8610193133354187,
0.27383118867874146,
-0.5288894772529602,
0.8437942266464233,
-0.27025333046913147,
-1.2931724786758423,
-0.6771138906478882,
-0.6028058528900146... |
func NewPutMeInstallationTemplateTemplateNamePartitionSchemeSchemeNamePartitionMountpointDefault(code int) *PutMeInstallationTemplateTemplateNamePartitionSchemeSchemeNamePartitionMountpointDefault {
return &PutMeInstallationTemplateTemplateNamePartitionSchemeSchemeNamePartitionMountpointDefault{
_statusCode: code,
... | [
0.7323591709136963,
-0.2503972351551056,
0.7098562121391296,
-0.12084374576807022,
0.4801385700702667,
-0.2263285517692566,
-1.2191256284713745,
0.6306283473968506,
-0.43369346857070923,
0.6223692893981934,
-0.5896004438400269,
-1.1157910823822021,
-1.338301181793213,
-0.6388874053955078,
... |
func (o *PutMeInstallationTemplateTemplateNamePartitionSchemeSchemeNamePartitionMountpointDefault) Code() int {
return o._statusCode
} | [
0.17698611319065094,
-0.17824499309062958,
0.2832384407520294,
-0.38482940196990967,
0.31898629665374756,
-0.1644156575202942,
-0.6812783479690552,
0.1396636813879013,
-0.4134049117565155,
0.5547126531600952,
-0.16052302718162537,
-1.0782427787780762,
-1.061173677444458,
0.2245678901672363... |
func NewSystemIntake() models.SystemIntake {
now := time.Now()
return models.SystemIntake{
ID: uuid.New(),
EUAUserID: null.StringFrom(RandomEUAID()),
Status: models.SystemIntakeStatusINTAKEDRAFT,
State: models.SystemIntakeStateOPEN,
Step:... | [
-0.6182344555854797,
-0.15136085450649261,
0.578454852104187,
-0.062301523983478546,
-0.08726566284894943,
-0.5658318996429443,
0.3314191401004791,
0.08329922705888748,
0.13033881783485413,
0.1679372489452362,
-0.43209320306777954,
-0.21487630903720856,
-0.5514832139015198,
0.2757766246795... |
func (v *VolumeService) VolumeCreate(ctx context.Context, options volume.VolumeCreateBody) (types.Volume, error) {
// verify a volume was provided
if len(options.Name) == 0 {
return types.Volume{}, errors.New("no volume provided")
}
// check if the volume is notfound and
// check if the notfound should be ignor... | [
-0.33732298016548157,
-0.4541340470314026,
0.7524593472480774,
-0.30291759967803955,
0.9402762651443481,
-0.20718590915203094,
-0.24406665563583374,
-0.4434964656829834,
0.5061814188957214,
-0.07373124361038208,
0.5876970887184143,
0.17916586995124817,
-0.9620047211647034,
0.07065695524215... |
func (v *VolumeService) VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) {
// verify a volume was provided
if len(volumeID) == 0 {
return types.Volume{}, errors.New("no volume provided")
}
// check if the volume is notfound
if strings.Contains(volumeID, "notfound") {
return types.Volu... | [
-0.2955281138420105,
-1.2395288944244385,
0.625446081161499,
-0.9648669958114624,
0.29998698830604553,
-0.359159916639328,
-0.5128723382949829,
0.06713149696588516,
0.8123931288719177,
-0.05626370385289192,
0.5765148997306824,
0.9031673669815063,
-0.42563891410827637,
0.0905163511633873,
... |
func (v *VolumeService) VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error) {
// verify a volume was provided
if len(volumeID) == 0 {
return types.Volume{}, nil, errors.New("no volume provided")
}
// check if the volume is notfound
if strings.Contains(volumeID, "notfound") {... | [
-0.7357685565948486,
-1.3149709701538086,
0.8515622615814209,
-1.10670006275177,
-0.23213861882686615,
-0.5077901482582092,
-0.6292948126792908,
-0.24333587288856506,
1.0680310726165771,
-0.07797563821077347,
-0.061876535415649414,
0.6326812505722046,
0.2200934886932373,
0.4888005256652832... |
func (v *VolumeService) VolumeList(ctx context.Context, filter filters.Args) (volume.VolumeListOKBody, error) {
return volume.VolumeListOKBody{}, nil
} | [
-0.5132472515106201,
-0.6882855892181396,
0.3192729353904724,
0.5478497743606567,
0.7491845488548279,
-0.26881471276283264,
-0.44804084300994873,
-0.07643232494592667,
0.9124913215637207,
1.0624970197677612,
-0.3567664325237274,
0.18180502951145172,
0.29831764101982117,
0.6950749754905701,... |
func (v *VolumeService) VolumeRemove(ctx context.Context, volumeID string, force bool) error {
// verify a volume was provided
if len(volumeID) == 0 {
return errors.New("no volume provided")
}
return nil
} | [
-0.6491628289222717,
0.26673442125320435,
0.41705089807510376,
0.29596462845802307,
0.8486577868461609,
-0.4564007818698883,
-0.3665677607059479,
1.3247721195220947,
0.8639727830886841,
0.3017250895500183,
-0.04009322077035904,
0.10780007392168045,
-1.6921627521514893,
0.5684165358543396,
... |
func (v *VolumeService) VolumesPrune(ctx context.Context, pruneFilter filters.Args) (types.VolumesPruneReport, error) {
return types.VolumesPruneReport{}, nil
} | [
-0.2363465279340744,
-0.3530867397785187,
0.1518380492925644,
0.16376550495624542,
0.5541044473648071,
-0.6344355940818787,
-0.5201534628868103,
-0.4345117509365082,
0.5078684687614441,
-0.26166391372680664,
0.25128817558288574,
0.02917339839041233,
-0.6604743003845215,
-0.3212399482727051... |
func (s *Service) GetAllQuestions() (pgx.Rows, error) {
return s.db.GetAllQuestions()
} | [
0.45713260769844055,
0.2815357744693756,
0.47679755091667175,
1.438962459564209,
-0.19606497883796692,
0.03529977425932884,
-0.6358243227005005,
-0.7916386723518372,
0.25122296810150146,
-0.8168254494667053,
0.529937744140625,
0.4177817106246948,
-0.3950439989566803,
1.195020079612732,
-... |
func (m *MongoDB) Connect() error {
ctx, cancel := context.WithTimeout(context.Background(), dbTimeout)
defer cancel()
uri := buildMongoURI()
clientOptions := options.Client().ApplyURI(uri)
client, err := mongo.Connect(ctx, clientOptions)
if err != nil {
return err
}
log.Printf("Application connected to Mon... | [
-0.025904428213834763,
-0.04968538507819176,
0.6231546401977539,
0.5507643818855286,
0.10518888384103775,
0.813889741897583,
-0.625173032283783,
-0.513777494430542,
-0.7927948236465454,
0.7778913974761963,
0.6168215274810791,
0.3877399265766144,
-0.8680103421211243,
0.493160218000412,
0.... |
func (opt KubeletRunConfig) MakeNodeConfig(imageRunHelper *run.Runner, out io.Writer) (string, error) {
binds := append(opt.ContainerBinds)
env := []string{}
if len(opt.HTTPProxy) > 0 {
env = append(env, fmt.Sprintf("HTTP_PROXY=%s", opt.HTTPProxy))
}
if len(opt.HTTPSProxy) > 0 {
env = append(env, fmt.Sprintf("... | [
-0.01922927051782608,
-0.31524336338043213,
0.8825668096542358,
-0.30187252163887024,
0.03575323149561882,
-0.4288119375705719,
0.5800344944000244,
-0.3335495591163635,
-0.5573540925979614,
0.7353319525718689,
0.185901939868927,
0.6728482246398926,
-0.22050142288208008,
0.7468334436416626,... |
func autopilotConfigTableSchema() *memdb.TableSchema {
return &memdb.TableSchema{
Name: "autopilot-config",
Indexes: map[string]*memdb.IndexSchema{
"id": &memdb.IndexSchema{
Name: "id",
AllowMissing: true,
Unique: true,
Indexer: &memdb.ConditionalIndex{
Conditional: func(obj i... | [
-0.31954219937324524,
0.3177714943885803,
0.5439743399620056,
0.3046894967556,
-0.6503785848617554,
0.4118858575820923,
-0.026724303141236305,
0.3115067183971405,
-0.5511634945869446,
0.43061962723731995,
-0.3750179708003998,
-0.6826275587081909,
-0.18489740788936615,
0.014214876107871532,... |
func (s *Snapshot) Autopilot() (*autopilot.Config, error) {
c, err := s.tx.First("autopilot-config", "id")
if err != nil {
return nil, err
}
config, ok := c.(*autopilot.Config)
if !ok {
return nil, nil
}
return config, nil
} | [
-0.20763088762760162,
0.7640892863273621,
0.2463119626045227,
0.0406198650598526,
-1.1698803901672363,
-0.6855373978614807,
-0.04112602397799492,
-0.035051070153713226,
0.24785146117210388,
0.5454216599464417,
-0.5627286434173584,
-0.11550311744213104,
-0.205562025308609,
-0.54401248693466... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.