text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func New() *NodeKeeper {
nodes := make(map[string]*diztl.Node)
connections := make(map[string]diztl.DiztlServiceClient)
nk := NodeKeeper{Nodes: nodes, Connections: connections, Count: counter.NewAtomic(0)}
return &nk
} | [
-0.2601511776447296,
-0.8929349184036255,
0.07712043076753616,
-0.7440906167030334,
-0.7566750049591064,
0.32801011204719543,
-0.13413429260253906,
-0.09336889535188675,
-1.441308856010437,
-0.40041616559028625,
-0.4390566945075989,
-0.11966250091791153,
0.4182969629764557,
1.1845368146896... |
func (nk *NodeKeeper) Register(node *diztl.Node) {
nk.mux.Lock()
defer nk.mux.Unlock()
nk.invalidateIfExists(node)
uuid, _ := uuid.NewRandom()
node.Id = uuid.String()
nk.Nodes[node.GetIp()] = node
log.Printf("Node successfully registered: %s, %s\n", node.GetIp(), node.GetId())
} | [
-1.3989135026931763,
0.8160787224769592,
0.3296588361263275,
-0.6869358420372009,
0.3700712323188782,
0.14556343853473663,
-0.4737262427806854,
0.4849563241004944,
-0.6861152052879333,
-0.12925103306770325,
-0.9229611158370972,
0.14974015951156616,
-0.08368344604969025,
0.5000279545783997,... |
func (nk *NodeKeeper) GetConnection(node *diztl.Node) (pb.DiztlServiceClient, error) {
if c, exists := nk.Connections[node.GetIp()]; exists {
return c, nil
}
conn, err := grpc.Dial(util.Address(node), grpc.WithInsecure(),
grpc.WithBlock(), grpc.WithTimeout(config.NodeConnectTimeout))
if err != nil {
return ni... | [
-0.5577688217163086,
0.3113594055175781,
0.6615244746208191,
-0.11693359166383743,
0.19727933406829834,
-0.3949105143547058,
0.04768054932355881,
-0.6219706535339355,
-0.43651092052459717,
0.3030453026294708,
0.4180801808834076,
-0.395067423582077,
-0.26049134135246277,
-0.0243280045688152... |
func NewService(
app *userproductapp.App,
) *Service {
return &Service{
app: app,
}
} | [
0.7642408609390259,
-0.594553530216217,
-0.07435008138418198,
1.6341668367385864,
-0.887605607509613,
0.5800431966781616,
-0.4634993374347687,
-1.2855143547058105,
0.832054615020752,
0.3243621587753296,
0.2861607074737549,
1.1616877317428589,
0.26346126198768616,
-0.23537090420722961,
0.... |
func (s *Service) ListUserProducts(ctx context.Context, _ *userproductpb.ListUserProductsRequest) (*userproductpb.ListUserProductsResponse, error) {
appResp, err := s.app.ListUserProducts(
ctx,
"TODO",
)
if err != nil {
return nil, err
}
return appResp.ToListUserProductResponsePB(), nil
} | [
-1.2961901426315308,
-0.20957161486148834,
0.7270825505256653,
0.9589831233024597,
-0.27453747391700745,
0.07667610794305801,
0.6455795764923096,
-0.8261377811431885,
1.3460243940353394,
0.2941557765007019,
-0.7852590680122375,
0.3961736261844635,
-0.4680224657058716,
-0.5906580090522766,
... |
func GetCommands(app *App) []cli.Command {
// if app.IsService {
// return []cli.Command{
// *vmgo.MakeRequireMongo(serviceStartCmd()),
// *vmgo.MakeRequireMongo(createUserCmd()),
// *vmgo.MakeRequireMongo(setupCmd()),
// *vmgo.MakeRequireMongo(resetCmd()),
// *vmgo.MakeRequireMongo(overridePasswordCm... | [
0.6023301482200623,
0.3574158847332001,
0.35972633957862854,
0.9442586898803711,
0.9409140944480896,
0.3186399042606354,
0.09868679940700531,
-0.6763266921043396,
0.4952080249786377,
-0.2237802892923355,
0.4166511595249176,
0.5482935309410095,
-0.28132665157318115,
0.426715224981308,
-0.... |
func DefaultServiceStartCmd() *cli.Command {
return &cli.Command{
Name: "serve",
Usage: "Starts the HTTP service",
Flags: []cli.Flag{
cli.IntFlag{
Name: "port",
Value: 8000,
Usage: "Port at which the service needs to serve",
},
},
Action: func(ctx *cli.Context) (err error) {
ag := vcmn... | [
0.24068662524223328,
-0.02766646444797516,
0.6243360638618469,
-0.8964946866035461,
0.7851970791816711,
0.403676837682724,
-0.2943044602870941,
-0.15851753950119019,
-0.08026377111673355,
-0.36849263310432434,
0.13211043179035187,
0.3861714005470276,
-0.7207493782043457,
0.3774721026420593... |
func GetVApp(ctx *cli.Context) (vapp *App) {
metadata := ctx.App.Metadata
fmt.Println(metadata)
vi, found := metadata["vapp"]
if found {
vapp, _ = vi.(*App)
}
return vapp
} | [
0.44540008902549744,
-0.3931320905685425,
0.4944106340408325,
1.1421037912368774,
0.4409002959728241,
1.0366730690002441,
-0.019333165138959885,
-0.9995344877243042,
0.29089683294296265,
0.5441056489944458,
1.004642367362976,
0.9371023178100586,
0.06170910969376564,
-0.5607558488845825,
... |
func NewCar(speed, batteryDrain int) Car {
panic("Please implement the NewCar function")
} | [
0.23680616915225983,
-0.14682984352111816,
0.3708904981613159,
1.3425648212432861,
0.12866412103176117,
0.5108101963996887,
0.12875507771968842,
-0.09470552951097488,
-1.2411224842071533,
-0.5949855446815491,
0.1725171059370041,
0.4501493275165558,
-0.18286916613578796,
0.37395259737968445... |
func NewTrack(distance int) Track {
panic("Please implement the NewTrack function")
} | [
0.36179119348526,
0.8118464350700378,
0.3603009581565857,
0.8594743609428406,
-0.23073849081993103,
1.2296679019927979,
0.5420818328857422,
-0.332895427942276,
-0.3909728527069092,
-0.42298921942710876,
-0.3596017360687256,
0.25093358755111694,
-0.37092918157577515,
-0.009242075495421886,
... |
func Drive(car Car) Car {
panic("Please implement the Drive function")
} | [
0.0074086724780499935,
0.03662511333823204,
0.3543333113193512,
0.989662766456604,
0.7599891424179077,
1.1021785736083984,
0.2168523371219635,
-0.6823212504386902,
0.004786607809364796,
-0.8591367602348328,
-0.4768008291721344,
0.4935535490512848,
-0.8565673828125,
-0.42310380935668945,
... |
func CanFinish(car Car, track Track) bool {
panic("Please implement the CanFinish function")
} | [
0.08516403287649155,
-0.2442919909954071,
0.3457459807395935,
1.6942206621170044,
-0.673489511013031,
1.4327104091644287,
-0.4082282781600952,
-0.7078813314437866,
-1.9411754608154297,
0.6691291332244873,
-0.6794794201850891,
0.31501084566116333,
-0.04723328724503517,
0.20007063448429108,
... |
func NewPortForwarder(namespace string, labels metav1.LabelSelector, port int) (*PortForward, error) {
pf := &PortForward{
Namespace: namespace,
Labels: labels,
DestinationPort: port,
}
var err error
pf.Config, err = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
clientcmd.NewDefaul... | [
-0.025794915854930878,
0.008604632690548897,
0.37804150581359863,
-1.1429166793823242,
-0.5470993518829346,
-0.1768707036972046,
-0.5980757474899292,
-1.1126594543457031,
-0.5823656320571899,
-0.25319573283195496,
0.10785861313343048,
0.3350818157196045,
-0.2366105169057846,
0.282381355762... |
func (p *PortForward) Start(ctx context.Context) error {
p.stopChan = make(chan struct{}, 1)
readyChan := make(chan struct{}, 1)
errChan := make(chan error, 1)
listenPort, err := p.getListenPort()
if err != nil {
return errors.Wrap(err, "Could not find a port to bind to")
}
dialer, err := p.dialer(ctx)
if e... | [
-0.00772020872682333,
-0.1948218196630478,
0.52391517162323,
-0.6742214560508728,
-0.19994790852069855,
0.1943836659193039,
-0.003322308650240302,
-0.3038121461868286,
-0.5450276136398315,
-0.46480798721313477,
-0.20196308195590973,
1.0484005212783813,
0.03355945646762848,
-0.3294167816638... |
func (p *PortForward) Stop() {
p.stopChan <- struct{}{}
} | [
-0.7673615217208862,
0.23655439913272858,
0.15227936208248138,
-1.2704066038131714,
0.4388006627559662,
1.2458044290542603,
0.06650912016630173,
0.15189774334430695,
-1.3465211391448975,
-0.5157703757286072,
-0.4291166365146637,
0.45590516924858093,
-0.7624952793121338,
-0.2044382393360138... |
func (p *PortForward) getListenPort() (int, error) {
var err error
if p.ListenPort == 0 {
p.ListenPort, err = p.getFreePort()
}
return p.ListenPort, err
} | [
0.6833760142326355,
-0.03445911407470703,
0.6133860945701599,
-0.40371543169021606,
-0.08239869773387909,
0.44584235548973083,
0.5930435061454773,
0.22365614771842957,
-0.05951322987675667,
-0.8631333708763123,
0.18180987238883972,
0.2183874547481537,
-1.8563764095306396,
0.055626247078180... |
func (p *PortForward) getFreePort() (int, error) {
listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
return 0, err
}
port := listener.Addr().(*net.TCPAddr).Port
err = listener.Close()
if err != nil {
return 0, err
}
return port, nil
} | [
0.5577540993690491,
0.4247303903102875,
0.6196150779724121,
-1.1002254486083984,
0.15463632345199585,
0.005154233425855637,
0.6062494516372681,
-0.1527945101261139,
-0.3154831528663635,
-0.6712016463279724,
0.08891400694847107,
0.5085333585739136,
-1.149904727935791,
0.6721349954605103,
... |
func (p *PortForward) dialer(ctx context.Context) (httpstream.Dialer, error) {
pod, err := p.getPodName(ctx)
if err != nil {
return nil, errors.Wrap(err, "Could not get pod name")
}
url := p.Clientset.CoreV1().RESTClient().Post().
Resource("pods").
Namespace(p.Namespace).
Name(pod).
SubResource("portforw... | [
-0.44222190976142883,
-0.43162867426872253,
0.5229783654212952,
0.179682657122612,
-0.3265208601951599,
0.3861440420150757,
-0.1511930525302887,
-0.5012516975402832,
0.09096131473779678,
-0.68631911277771,
0.2923460304737091,
0.2608020305633545,
-0.3340419828891754,
1.0713757276535034,
0... |
func (p *PortForward) getPodName(ctx context.Context) (string, error) {
var err error
if p.Name == "" {
p.Name, err = p.findPodByLabels(ctx)
}
return p.Name, err
} | [
-0.07256707549095154,
0.25882837176322937,
0.6757587194442749,
0.05830076336860657,
-0.09250258654356003,
0.3912101089954376,
-0.35383495688438416,
-0.3240204155445099,
-0.09830653667449951,
0.5936777591705322,
1.3218494653701782,
-0.6410778164863586,
-0.6959857940673828,
-0.28833505511283... |
func (p *PortForward) findPodByLabels(ctx context.Context) (string, error) {
if len(p.Labels.MatchLabels) == 0 && len(p.Labels.MatchExpressions) == 0 {
return "", errors.New("No pod labels specified")
}
pods, err := p.Clientset.CoreV1().Pods(p.Namespace).List(ctx, metav1.ListOptions{
LabelSelector: metav1.Forma... | [
-0.8813849687576294,
-0.8578526377677917,
0.5675757527351379,
-0.7817085981369019,
0.03811103105545044,
0.11122865229845047,
-0.350766122341156,
-0.5939384698867798,
-0.3445485830307007,
1.022801160812378,
0.9510149359703064,
-0.22450344264507294,
-0.9837487936019897,
-0.5129330158233643,
... |
func (*Empty) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{0}
} | [
-0.7720841765403748,
0.23859235644340515,
0.663227379322052,
-0.3870709240436554,
0.15232571959495544,
0.5022211074829102,
0.029680881649255753,
0.14802896976470947,
-0.9100443720817566,
0.36148470640182495,
-0.79535311460495,
0.5238696932792664,
0.14579537510871887,
0.77685546875,
0.885... |
func (*Count) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{1}
} | [
-0.15303508937358856,
0.40552887320518494,
0.654214084148407,
0.271240770816803,
-0.21501043438911438,
-0.02787388302385807,
0.5414689183235168,
0.18488463759422302,
-1.1176016330718994,
0.011025331914424896,
-0.5194661617279053,
-0.5678508281707764,
-0.10032135993242264,
1.410630345344543... |
func (*Pager) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{2}
} | [
-0.3936110734939575,
0.24163439869880676,
0.5546050071716309,
0.028267813846468925,
-0.6843550205230713,
0.5163764953613281,
0.1369601935148239,
-0.0039775436744093895,
-0.38705870509147644,
-0.2093571573495865,
0.04017186164855957,
-0.013210180215537548,
-0.1577133685350418,
1.69742441177... |
func (*YMD) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{3}
} | [
0.04701117426156998,
0.436757892370224,
0.4813101291656494,
-0.2188297063112259,
-0.5814356803894043,
0.3635961413383484,
-0.0526912696659565,
0.4656069874763489,
-0.43849387764930725,
-1.2361661195755005,
-0.2213325947523117,
1.027907133102417,
0.020098749548196793,
1.3189153671264648,
... |
func NewMemorySession() Session {
return memorySession{store: new(sync.Map)}
} | [
0.18247176706790924,
-0.6643175482749939,
0.19703331589698792,
-0.09735942631959915,
-1.3860745429992676,
-1.0384938716888428,
-0.009979018941521645,
-1.031247854232788,
0.8432799577713013,
-0.3376983404159546,
-1.2945268154144287,
0.22543485462665558,
-0.1652376502752304,
0.35856339335441... |
func (Flagr) CaddyModule() caddy.ModuleInfo {
return caddy.ModuleInfo{
ID: "http.handlers.flagr",
New: func() caddy.Module { return new(Flagr) }, // return a singleton.
}
} | [
-0.07600308954715729,
0.17068462073802948,
0.2748134732246399,
-0.3382035493850708,
0.8465611934661865,
0.7250868678092957,
0.2928906977176666,
-0.8827163577079773,
-0.11035345494747162,
-0.7059788107872009,
-0.8396369218826294,
1.01144540309906,
0.27885693311691284,
0.574801504611969,
0... |
func (f *Flagr) Cleanup() error {
return nil
} | [
0.8627076745033264,
-0.3632362186908722,
0.28559836745262146,
0.3253062665462494,
0.280120849609375,
0.23224495351314545,
1.3883765935897827,
0.22304895520210266,
0.032766614109277725,
-1.4953579902648926,
-0.2583693265914917,
-0.1640532910823822,
-0.06258121877908707,
1.5225058794021606,
... |
func parseVar(s string) (v string, err error) {
if regexpFullVar.MatchString(s) {
// If the variable is already a fully-qualified Caddy placeholder,
// return it as is.
return s, nil
}
result := regexpShortVar.FindStringSubmatch(s)
if len(result) != 3 {
return "", fmt.Errorf("invalid key variable: %q", s)
... | [
-0.6162180304527283,
-0.7121652960777283,
0.5720873475074768,
-0.49191609025001526,
-1.3730847835540771,
-0.12819872796535492,
0.34314411878585815,
-0.09987518191337585,
-0.2550028860569,
-0.12545077502727509,
0.25911444425582886,
0.27641332149505615,
-0.19655698537826538,
-0.2167401760816... |
func (m *EventLog) Get(key string) interface{} {
return m.Payload()[key]
} | [
-0.3365022838115692,
-0.07759092003107071,
0.38162359595298767,
-0.440218985080719,
-1.0931757688522339,
-0.3671514391899109,
-1.1273503303527832,
-0.9062675833702087,
-0.5584918856620789,
0.7848922610282898,
0.15294693410396576,
0.4232974350452423,
0.05270092934370041,
-0.0505621805787086... |
func (m *EventLog) Payload() map[string]interface{} {
return m.MapPayload(m)
} | [
0.1252935528755188,
-0.3506944477558136,
0.5241079330444336,
-0.30377522110939026,
-1.1118510961532593,
0.3045313060283661,
-0.3674198091030121,
0.19054482877254486,
0.14454180002212524,
0.1825082153081894,
-0.21386626362800598,
-0.9628058075904846,
0.33441776037216187,
0.1963144689798355,... |
func EventLogModel(tableName string) *EventLog {
return &EventLog{
Model: fazzdb.AutoIncrementModel(tableName,
[]fazzdb.Column{
fazzdb.Col("event_id"),
fazzdb.Col("entity_id"),
fazzdb.Col("entity_version"),
fazzdb.Col("event_type"),
fazzdb.Col("event_data"),
},
"event_id",
true,
fa... | [
0.6907878518104553,
-0.0551295131444931,
0.2676008939743042,
0.3356133699417114,
-0.04443711042404175,
0.09641506522893906,
-0.06422712653875351,
0.7528741359710693,
-0.7045383453369141,
0.3709481358528137,
-0.5939844250679016,
-0.3407759964466095,
0.7008452415466309,
0.08544591069221497,
... |
func requestToken(user, pass, agent, public, private string) string {
client := &http.Client{}
URL := "https://www.reddit.com/api/v1/access_token"
// set values for post request body
vals := url.Values{}
vals.Set("grant_type", "password")
vals.Set("username", user)
vals.Set("password", pass)
req, err := http.Ne... | [
-0.39147448539733887,
-0.5021410584449768,
0.8925970792770386,
0.056404322385787964,
-0.27044349908828735,
0.21953091025352478,
-0.8471131324768066,
0.30506137013435364,
-0.3005678951740265,
-0.6834683418273926,
0.21568626165390015,
1.5702165365219116,
-0.4616096615791321,
0.50304305553436... |
func addPost(item Post) bool {
db := getDBInstance()
defer db.Close()
sqlStatement := `INSERT INTO "Reddit_Posts"
("Title", "Upvotes", "UpvoteRatio", "URL", "Permalink", "Date", "Sub_id")
VALUES
($1, $2, $3, $4, $5, $6, (SELECT id FROM "Subreddits" WHERE "name"=$7))`
_, err := db.Exec(sqlStatement,... | [
-0.2601771950721741,
0.9597939252853394,
0.9637897610664368,
0.8721684217453003,
0.07933244109153748,
1.2270852327346802,
-1.2520695924758911,
-0.002211692277342081,
-0.1456693708896637,
-0.17822885513305664,
-0.2419174164533615,
-0.8783392310142517,
-1.089328408241272,
-0.2970547676086426... |
func CheckMetadataVersion(svc iaas.Service) (string, fail.Error) {
// Read file /version in metadata
var currentMetadataVersion string
folder, xerr := NewMetadataFolder(svc, "")
if xerr != nil {
return "", xerr
}
xerr = folder.Read("/", "version", func(data []byte) fail.Error {
currentMetadataVersion = strin... | [
-0.23712462186813354,
-0.683459997177124,
0.6116800308227539,
0.09316644072532654,
-0.3381011486053467,
0.7637858986854553,
-0.15496110916137695,
-0.9033162593841553,
-0.6205393075942993,
0.9532890915870667,
0.7415531277656555,
0.6161711812019348,
-0.44966229796409607,
0.11281848698854446,... |
func (r *LeveledQueue) Pop() *CrawlItem {
for _, queue := range r.Levels {
// Onderstanade check heeft nog wat meer abstractie nodig
if queue.First != nil && queue.First.NeedsRetry() {
return queue.Pop()
}
}
return nil
} | [
0.2358674257993698,
-0.31281453371047974,
0.5173200368881226,
0.03125325217843056,
-0.25179484486579895,
0.20963454246520996,
-0.34607383608818054,
-0.38292816281318665,
-1.2880443334579468,
1.004353642463684,
0.5096873044967651,
-0.6768708229064941,
-0.6795459985733032,
0.4916840195655823... |
func (c *Client) StartServiceSoftwareUpdate(ctx context.Context, params *StartServiceSoftwareUpdateInput, optFns ...func(*Options)) (*StartServiceSoftwareUpdateOutput, error) {
if params == nil {
params = &StartServiceSoftwareUpdateInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartServiceSoftwareUpd... | [
-0.7131238579750061,
0.3492172360420227,
0.7236420512199402,
0.5591457486152649,
-0.57193523645401,
-0.2076232135295868,
0.48843494057655334,
-0.6726013422012329,
0.6758866906166077,
-0.45119214057922363,
-0.07309286296367645,
0.9393033385276794,
-0.7340754866600037,
0.055836889892816544,
... |
func (c *FakeTraincrds) Get(name string, options v1.GetOptions) (result *apisv1.Traincrd, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(traincrdsResource, c.ns, name), &apisv1.Traincrd{})
if obj == nil {
return nil, err
}
return obj.(*apisv1.Traincrd), err
} | [
-0.523115873336792,
0.19698069989681244,
0.5748869776725769,
-1.0413696765899658,
0.6421625018119812,
-0.7469053268432617,
-0.4862039387226105,
-0.5154253840446472,
-0.41446346044540405,
0.4151930510997772,
-0.12833961844444275,
1.2267085313796997,
-1.1399812698364258,
-0.814289927482605,
... |
func (c *FakeTraincrds) List(opts v1.ListOptions) (result *apisv1.TraincrdList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(traincrdsResource, traincrdsKind, c.ns, opts), &apisv1.TraincrdList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label ... | [
-0.5548855662345886,
-0.40807637572288513,
0.5816527605056763,
-0.326545387506485,
0.7178938984870911,
-0.5413286089897156,
-1.0164839029312134,
0.17613515257835388,
-0.02456303872168064,
0.5895110368728638,
-0.4762926697731018,
0.6636739373207092,
-0.7064347267150879,
-0.1741185039281845,... |
func (c *FakeTraincrds) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(traincrdsResource, c.ns, opts))
} | [
-0.0785369947552681,
0.01941845566034317,
0.23164543509483337,
-0.23769430816173553,
0.39133521914482117,
-0.036539144814014435,
0.33911699056625366,
-0.009037986397743225,
0.08415638655424118,
-0.4651605188846588,
-0.5373589396476746,
1.1662718057632446,
-0.18556109070777893,
-0.119674891... |
func (c *FakeTraincrds) Create(traincrd *apisv1.Traincrd) (result *apisv1.Traincrd, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(traincrdsResource, c.ns, traincrd), &apisv1.Traincrd{})
if obj == nil {
return nil, err
}
return obj.(*apisv1.Traincrd), err
} | [
-0.39867520332336426,
0.3848424255847931,
0.35049521923065186,
-0.6934650540351868,
0.23598532378673553,
-0.07808902859687805,
-0.3796219527721405,
-0.6690151691436768,
-0.5975545048713684,
0.27881893515586853,
-0.14602510631084442,
0.12577399611473083,
-1.179369330406189,
0.07241484522819... |
func (c *FakeTraincrds) Update(traincrd *apisv1.Traincrd) (result *apisv1.Traincrd, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(traincrdsResource, c.ns, traincrd), &apisv1.Traincrd{})
if obj == nil {
return nil, err
}
return obj.(*apisv1.Traincrd), err
} | [
-0.737605094909668,
-0.2794736623764038,
0.46270930767059326,
-0.9021534323692322,
-0.2275109738111496,
-0.3484608232975006,
-0.24911820888519287,
-0.4180202782154083,
-0.09729766845703125,
0.35589516162872314,
-0.23399487137794495,
0.37104660272598267,
-1.1997495889663696,
-0.383177429437... |
func (c *FakeTraincrds) UpdateStatus(traincrd *apisv1.Traincrd) (*apisv1.Traincrd, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(traincrdsResource, "status", c.ns, traincrd), &apisv1.Traincrd{})
if obj == nil {
return nil, err
}
return obj.(*apisv1.Traincrd), err
} | [
-0.5872842073440552,
-0.2859683632850647,
0.6292439699172974,
-0.33045437932014465,
-0.6172716617584229,
-0.03594806045293808,
-0.26135092973709106,
0.6155374646186829,
0.14564017951488495,
0.3589515686035156,
-0.7652580738067627,
0.9242885112762451,
-0.44693154096603394,
-0.02210879512131... |
func (c *FakeTraincrds) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(traincrdsResource, c.ns, name), &apisv1.Traincrd{})
return err
} | [
0.30620163679122925,
0.5424700379371643,
0.4994809329509735,
-0.299420028924942,
0.6379067301750183,
-0.1384550780057907,
-0.008129710331559181,
-0.07587701082229614,
0.018196595832705498,
0.3676172196865082,
-0.31261786818504333,
0.6080026626586914,
-1.1885360479354858,
-0.476934641599655... |
func (c *FakeTraincrds) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(traincrdsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &apisv1.TraincrdList{})
return err
} | [
-0.6448917984962463,
0.2680833339691162,
0.5610870122909546,
0.03540848568081856,
0.8111017942428589,
-0.4198618531227112,
0.2635810077190399,
-0.26209086179733276,
0.11048075556755066,
-0.710595428943634,
-0.29649797081947327,
0.8304787874221802,
-0.23727527260780334,
0.9339420199394226,
... |
func (c *FakeTraincrds) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apisv1.Traincrd, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(traincrdsResource, c.ns, name, pt, data, subresources...), &apisv1.Traincrd{})
if obj == nil {
return nil, err
... | [
-0.0318465493619442,
0.18397241830825806,
0.5258815884590149,
-0.8516873717308044,
-0.9908182621002197,
0.6426887512207031,
-0.6207689642906189,
0.08401063829660416,
-0.13977393507957458,
-0.3602418899536133,
-0.2582855522632599,
0.8587646484375,
-0.8855333924293518,
-0.653572142124176,
... |
func GetConfig(key string) string {
config := make(map[string]string)
b, err := ioutil.ReadFile("config.json")
if err != nil {
panic(err)
}
json.Unmarshal(b, &config)
return config[key]
} | [
-0.3282804787158966,
-0.23614251613616943,
0.6074250936508179,
-0.17394210398197174,
-0.8807534575462341,
0.7249401807785034,
-0.262403666973114,
0.578018307685852,
-1.1403647661209106,
1.6532169580459595,
-0.3372856080532074,
0.08393048495054245,
0.5744310617446899,
0.08130216598510742,
... |
func GenerateTimeInterval(dayOfWeek string, timeOfDay rune) (string, string) {
var daysOfWeek = map[string]time.Weekday{
"Sunday": time.Sunday,
"Monday": time.Monday,
"Tuesday": time.Tuesday,
"Wednesday": time.Wednesday,
"Thursday": time.Thursday,
"Friday": time.Friday,
"Saturday": time.Satu... | [
-0.9597154259681702,
-0.03355477750301361,
0.8153994083404541,
-1.1285845041275024,
-0.24710217118263245,
0.1315566450357437,
-0.4641948342323303,
-0.892869770526886,
0.10609398037195206,
0.6658665537834167,
-0.20140047371387482,
-0.7994516491889954,
-0.23107357323169708,
0.903612434864044... |
func PrefCheck(a, b string) map[rune]bool {
times := map[rune]uint{77: 0, 65: 0, 69: 0}
timesC := map[rune]bool{77: false, 65: false, 69: false}
for _, c := range a {
times[c]++
}
for _, c := range b {
times[c]++
}
for k, v := range times {
if v == 2 {
timesC[k] = true
}
}
return timesC
} | [
-0.2602652311325073,
0.6654894351959229,
0.7342150211334229,
0.04966450482606888,
-0.22431932389736176,
-0.08755149692296982,
0.5168802738189697,
-0.1995464712381363,
-1.07054603099823,
0.6338469982147217,
0.35977160930633545,
0.34264305233955383,
0.5344018936157227,
0.652111828327179,
-... |
func RemoveIDFromTimeTable(timeTable map[string]map[rune][]uint, idsToRemove []uint) map[string]map[rune][]uint {
for a, day := range timeTable {
for time, ids := range day {
temp := []uint{}
for _, id := range ids {
if !idInSlice(id, idsToRemove) {
temp = append(temp, id)
}
}
timeTable[a][t... | [
-0.9804520010948181,
-0.7067404389381409,
0.5525826215744019,
-0.31986451148986816,
-1.3020919561386108,
-0.2314288318157196,
0.19854900240898132,
0.04747223109006882,
-0.02823793888092041,
1.3334259986877441,
-0.4046304225921631,
-0.4967215657234192,
-0.4715096354484558,
-0.06541112810373... |
func TableIdsEach(timeTable map[string]map[rune][]uint, test func([]uint) bool) bool {
b := true
for _, day := range timeTable {
for _, ids := range day {
if test(ids) {
b = false
}
}
}
return b
} | [
-0.9244763255119324,
0.03124932013452053,
0.4141027629375458,
-0.10756045579910278,
-0.4099651277065277,
0.35450226068496704,
0.2075030356645584,
-0.2361452281475067,
-0.7781893610954285,
-0.09407901018857956,
-0.11102420836687088,
-0.3460506498813629,
-0.4495187997817993,
0.57499229907989... |
func SliceUniqMap(s []uint) []uint {
seen := make(map[uint]struct{}, len(s))
j := 0
for _, v := range s {
if _, ok := seen[v]; ok {
continue
}
seen[v] = struct{}{}
s[j] = v
j++
}
return s[:j]
} | [
-1.2063230276107788,
-1.1757527589797974,
0.3370411694049835,
-0.3687543570995331,
-0.3005867600440979,
-0.3554267883300781,
0.9604223966598511,
0.32203975319862366,
1.4680802822113037,
0.4786893427371979,
-0.9294643998146057,
0.25059717893600464,
0.61963951587677,
-0.20666290819644928,
... |
func LeftFromTable(timeTable map[string]map[rune][]uint) (ret []uint) {
for _, day := range timeTable {
for _, ids := range day {
for _, id := range ids {
ret = append(ret, id)
}
}
}
return SliceUniqMap(ret)
} | [
-0.7395663857460022,
-0.8361322283744812,
0.5057364702224731,
-0.06419900804758072,
-0.44249072670936584,
0.3371121287345886,
-0.0016123737441375852,
-0.2077508419752121,
0.09976900368928909,
0.5705031752586365,
-0.620453417301178,
-1.0686300992965698,
0.16971944272518158,
0.82833975553512... |
func IsNewerTime(timeOne string, timeTwo string) bool {
t1, _ := time.Parse(layoutISO, timeOne)
t2, _ := time.Parse(layoutISO, timeTwo)
return t1.After(t2)
} | [
-0.12103493511676788,
-0.3581685423851013,
0.7750661373138428,
0.4261511564254761,
-0.6447342038154602,
0.16883806884288788,
-0.8742863535881042,
-0.4335281550884247,
-1.4178978204727173,
1.1700479984283447,
-0.5117850303649902,
-0.05494816228747368,
-0.23705291748046875,
0.109050475060939... |
func DaysL(days string) string {
if days == "" {
return ""
}
s := strings.Split(days, ",")
c := []rune{}
for _, day := range s {
day = strings.TrimSpace(day)
c = append(c, rune(day[0]))
}
return string(c)
} | [
-0.06677405536174774,
0.12191120535135269,
0.4956734776496887,
-1.2825441360473633,
-0.7133661508560181,
-0.5400058627128601,
-1.1983206272125244,
-0.6314346790313721,
1.3547569513320923,
-0.44424203038215637,
0.10558962821960449,
0.24638396501541138,
0.5377852320671082,
-0.472550064325332... |
func Create(ctx context.Context, options *Options) (_ *JobObject, err error) {
if options == nil {
options = &Options{}
}
var jobName *winapi.UnicodeString
if options.Name != "" {
jobName, err = winapi.NewUnicodeString(options.Name)
if err != nil {
return nil, err
}
}
var jobHandle windows.Handle
if... | [
0.9544233679771423,
-0.16885849833488464,
0.8605141639709473,
0.31814759969711304,
-0.1984487771987915,
0.47523486614227295,
0.2191184014081955,
-0.5494942665100098,
-0.4419213533401489,
-0.3721988797187805,
0.49832653999328613,
-0.32263270020484924,
-1.2669131755828857,
-0.096826002001762... |
func Open(ctx context.Context, options *Options) (_ *JobObject, err error) {
if options == nil || (options != nil && options.Name == "") {
return nil, errors.New("no job object name specified to open")
}
unicodeJobName, err := winapi.NewUnicodeString(options.Name)
if err != nil {
return nil, err
}
var jobHa... | [
0.5082577466964722,
-0.3605206310749054,
0.857824981212616,
-0.07600989937782288,
-0.8881919980049133,
0.7395418286323547,
0.5535179376602173,
-0.04948917031288147,
-0.10191197693347931,
-0.5138981938362122,
0.3066096901893616,
0.22890342772006989,
-1.239150881767273,
-0.4654250741004944,
... |
func setupNotifications(ctx context.Context, job *JobObject) (*queue.MessageQueue, error) {
job.handleLock.RLock()
defer job.handleLock.RUnlock()
if job.handle == 0 {
return nil, ErrAlreadyClosed
}
ioInitOnce.Do(func() {
h, err := windows.CreateIoCompletionPort(windows.InvalidHandle, 0, 0, 0xffffffff)
if e... | [
0.18771213293075562,
-0.46318113803863525,
0.8559909462928772,
-0.23137937486171722,
0.21542689204216003,
-0.2311585545539856,
0.8280959129333496,
-1.1683928966522217,
-0.11740510165691376,
0.1952596753835678,
-0.02115030772984028,
-0.4087289273738861,
-1.0834829807281494,
0.17757464945316... |
func (job *JobObject) PollNotification() (interface{}, error) {
if job.mq == nil {
return nil, ErrNotRegistered
}
return job.mq.Dequeue()
} | [
0.23319914937019348,
-0.006861620582640171,
0.5762810707092285,
0.37148717045783997,
0.08827725052833557,
-0.8038458824157715,
-0.2528386414051056,
0.29748472571372986,
0.6221897006034851,
0.4435897171497345,
-0.7410690784454346,
-0.20047135651111603,
-0.1477595567703247,
0.815681278705596... |
func (job *JobObject) UpdateProcThreadAttribute(attrList *windows.ProcThreadAttributeListContainer) error {
job.handleLock.RLock()
defer job.handleLock.RUnlock()
if job.handle == 0 {
return ErrAlreadyClosed
}
if err := attrList.Update(
winapi.PROC_THREAD_ATTRIBUTE_JOB_LIST,
unsafe.Pointer(&job.handle),
u... | [
-0.8038740754127502,
-1.280729055404663,
0.40235650539398193,
-0.0976390466094017,
-0.25187256932258606,
0.4841208755970001,
0.050529591739177704,
-0.4204821288585663,
-0.25678157806396484,
-0.030127549543976784,
0.22407718002796173,
0.4173581600189209,
-0.8516853451728821,
0.3245960175991... |
func (job *JobObject) Close() error {
job.handleLock.Lock()
defer job.handleLock.Unlock()
if job.handle == 0 {
return ErrAlreadyClosed
}
if err := windows.Close(job.handle); err != nil {
return err
}
if job.mq != nil {
job.mq.Close()
}
// Handles now invalid so if the map entry to receive notification... | [
0.665947675704956,
-0.7601668834686279,
0.6485772728919983,
-0.19488398730754852,
0.13729944825172424,
0.46286848187446594,
0.5757668614387512,
-0.35398542881011963,
-0.5098040103912354,
-1.0852627754211426,
0.1051577553153038,
0.16451334953308105,
-0.6233358383178711,
1.0919642448425293,
... |
func (job *JobObject) Assign(pid uint32) error {
job.handleLock.RLock()
defer job.handleLock.RUnlock()
if job.handle == 0 {
return ErrAlreadyClosed
}
if pid == 0 {
return errors.New("invalid pid: 0")
}
hProc, err := windows.OpenProcess(winapi.PROCESS_ALL_ACCESS, true, pid)
if err != nil {
return err
}
... | [
-0.1259593367576599,
-1.2799049615859985,
0.7946090698242188,
0.09879881143569946,
-0.6405797600746155,
0.8667957782745361,
0.17615966498851776,
-0.18301957845687866,
-0.48609375953674316,
-0.5966701507568359,
0.19603070616722107,
0.20391279458999634,
-0.7213647961616516,
0.992930173873901... |
func (job *JobObject) Terminate(exitCode uint32) error {
job.handleLock.RLock()
defer job.handleLock.RUnlock()
if job.handle == 0 {
return ErrAlreadyClosed
}
return windows.TerminateJobObject(job.handle, exitCode)
} | [
-0.18142729997634888,
0.40293899178504944,
0.6586984395980835,
0.3634288012981415,
0.09281902760267258,
0.1610487699508667,
-0.09493382275104523,
-0.5988399982452393,
0.019533349201083183,
-0.37112224102020264,
-0.8902014493942261,
-0.684626579284668,
-0.977453887462616,
0.4338075220584869... |
func (job *JobObject) Pids() ([]uint32, error) {
job.handleLock.RLock()
defer job.handleLock.RUnlock()
if job.handle == 0 {
return nil, ErrAlreadyClosed
}
info := winapi.JOBOBJECT_BASIC_PROCESS_ID_LIST{}
err := winapi.QueryInformationJobObject(
job.handle,
winapi.JobObjectBasicProcessIdList,
unsafe.Poin... | [
-0.2129317969083786,
-0.5488792657852173,
0.5264425873756409,
-0.4450240433216095,
-0.18998150527477264,
-0.1986122727394104,
-0.527600109577179,
-0.6301286220550537,
-0.5273969173431396,
-0.5307638049125671,
0.303672194480896,
0.513688325881958,
-1.1178200244903564,
0.3769400715827942,
... |
func (job *JobObject) QueryMemoryStats() (*winapi.JOBOBJECT_MEMORY_USAGE_INFORMATION, error) {
job.handleLock.RLock()
defer job.handleLock.RUnlock()
if job.handle == 0 {
return nil, ErrAlreadyClosed
}
info := winapi.JOBOBJECT_MEMORY_USAGE_INFORMATION{}
if err := winapi.QueryInformationJobObject(
job.handle,... | [
0.9521335363388062,
0.32144105434417725,
0.42169496417045593,
-0.5196767449378967,
-0.6307657957077026,
-0.5724181532859802,
-0.3214767277240753,
-1.6648083925247192,
-0.09691184014081955,
-0.8421262502670288,
-0.03350617364048958,
0.10790787637233734,
-1.0106837749481201,
0.34337317943573... |
func (job *JobObject) QueryProcessorStats() (*winapi.JOBOBJECT_BASIC_ACCOUNTING_INFORMATION, error) {
job.handleLock.RLock()
defer job.handleLock.RUnlock()
if job.handle == 0 {
return nil, ErrAlreadyClosed
}
info := winapi.JOBOBJECT_BASIC_ACCOUNTING_INFORMATION{}
if err := winapi.QueryInformationJobObject(
... | [
0.5606191158294678,
0.11105835437774658,
0.5586777925491333,
-0.681755006313324,
-0.6139844655990601,
-0.10497170686721802,
-0.05705210939049721,
-1.1902542114257812,
0.18650449812412262,
-0.8362486958503723,
0.48754146695137024,
0.353211909532547,
-0.688773512840271,
0.20803414285182953,
... |
func (job *JobObject) QueryStorageStats() (*winapi.JOBOBJECT_IO_ATTRIBUTION_INFORMATION, error) {
job.handleLock.RLock()
defer job.handleLock.RUnlock()
if job.handle == 0 {
return nil, ErrAlreadyClosed
}
info := winapi.JOBOBJECT_IO_ATTRIBUTION_INFORMATION{
ControlFlags: winapi.JOBOBJECT_IO_ATTRIBUTION_CONTRO... | [
0.943340539932251,
-0.2069275826215744,
0.4307262599468231,
-0.2685737609863281,
-0.163804829120636,
-0.2661797106266022,
0.290851891040802,
-1.316878318786621,
-0.2736065089702606,
-0.8092667460441589,
0.13702553510665894,
0.022834159433841705,
-0.6812433004379272,
0.04312129318714142,
... |
func (job *JobObject) QueryPrivateWorkingSet() (uint64, error) {
pids, err := job.Pids()
if err != nil {
return 0, err
}
openAndQueryWorkingSet := func(pid uint32) (uint64, error) {
h, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, pid)
if err != nil {
// Continue to the next... | [
-0.3780195415019989,
0.4021950364112854,
0.8144699335098267,
-0.6872671246528625,
-1.0326594114303589,
-0.7417413592338562,
-0.11348389834165573,
-0.8867628574371338,
-0.20775651931762695,
-0.9304689168930054,
0.37852269411087036,
0.46551212668418884,
-1.0473672151565552,
0.268922686576843... |
func (job *JobObject) SetIOTracking() error {
job.handleLock.RLock()
defer job.handleLock.RUnlock()
if job.handle == 0 {
return ErrAlreadyClosed
}
return enableIOTracking(job.handle)
} | [
-0.41179460287094116,
0.5937949419021606,
0.8491508960723877,
0.33670714497566223,
0.5585914850234985,
0.46867942810058594,
1.5005292892456055,
-0.224175363779068,
-0.5189267992973328,
-0.22729915380477905,
-0.3107520043849945,
-0.696253776550293,
-1.0360832214355469,
0.10604463517665863,
... |
func ReadFile(path string) (*Gnc, error) {
// open gnucash file
gnucashFile, err := os.Open(path)
if err != nil {
return nil, err
}
defer gnucashFile.Close()
// decompress gnucash file
reader, err := gzip.NewReader(gnucashFile)
if err != nil {
return nil, err
}
defer reader.Close()
// unmarshall XML
... | [
0.6720641255378723,
0.20194225013256073,
0.5902268886566162,
-0.8181980848312378,
-0.5928406715393066,
0.2872937321662903,
-0.006961195729672909,
-0.3294917941093445,
-1.3314622640609741,
-0.22796180844306946,
0.3952392637729645,
-0.6968788504600525,
-0.334361732006073,
-0.3862397968769073... |
func (gc *recursiveGetContents) download(ctx context.Context) error {
gc.wg.Add(1)
gc.check(gc.recursive(ctx, gc.path))
gc.wg.Wait()
select {
case err := <-gc.errors:
return err
default:
return nil
}
} | [
0.4455336928367615,
0.13206696510314941,
0.6478995084762573,
0.5578572154045105,
0.09461992979049683,
0.02599903754889965,
0.5822716951370239,
-1.178468942642212,
-0.22052058577537537,
-1.0475703477859497,
0.23459166288375854,
0.20977376401424408,
-0.8329922556877136,
0.40483126044273376,
... |
func (gc *recursiveGetContents) recursive(ctx context.Context, root string) error {
defer gc.wg.Done()
log.Printf("Using Github get-content API for path %q", root)
file, entries, _, err := gc.client.Repositories.GetContents(ctx, gc.owner, gc.repo, root, gc.opt())
if err != nil {
return errors.Wrap(err, "github ge... | [
0.39594927430152893,
0.4988006353378296,
0.8934836387634277,
0.32620570063591003,
0.2984795570373535,
-0.9211305975914001,
0.23183630406856537,
-1.004090428352356,
-0.30409157276153564,
-0.3162972927093506,
0.9596368670463562,
0.2897931933403015,
-0.21335339546203613,
0.4012453854084015,
... |
func (gc *recursiveGetContents) downloadContent(ctx context.Context, path string, size int, downloadURL string) error {
defer gc.wg.Done()
content, err := gc.downloadURL(ctx, downloadURL)
if err != nil {
return errors.Wrapf(err, "get content from %s", downloadURL)
}
gc.mu.Lock()
defer gc.mu.Unlock()
return gc.... | [
0.6041147708892822,
-0.13369327783584595,
0.667780339717865,
0.05089719593524933,
-0.696273684501648,
-0.36507686972618103,
0.19434429705142975,
-1.0612783432006836,
0.03288954868912697,
-0.1946367621421814,
-0.1865575760602951,
-0.4599730670452118,
-0.6845583319664001,
-0.5792344808578491... |
func (gc *recursiveGetContents) downloadURL(ctx context.Context, downloadURL string) ([]byte, error) {
req, err := http.NewRequest(http.MethodGet, downloadURL, nil)
if err != nil {
return nil, errors.Wrap(err, "building request")
}
resp, err := gc.httpClient.Do(req.WithContext(ctx))
if err != nil {
return nil,... | [
-0.6352325081825256,
-0.37551069259643555,
0.9049980044364929,
0.6695011258125305,
0.060745589435100555,
-0.41055533289909363,
-0.37583041191101074,
-0.6395160555839539,
0.4211547374725342,
0.02508998103439808,
-0.49977290630340576,
0.4879080057144165,
-0.7894821166992188,
0.13170500099658... |
func (gc *recursiveGetContents) opt() *github.RepositoryContentGetOptions {
if gc.ref == "" {
return nil
}
ref := strings.TrimPrefix(gc.ref, "heads/")
ref = strings.TrimPrefix(ref, "tags/")
return &github.RepositoryContentGetOptions{Ref: ref}
} | [
0.49564477801322937,
0.33105745911598206,
0.41674038767814636,
-0.7066749930381775,
0.547896683216095,
-0.7143459916114807,
-0.37937915325164795,
-1.5464378595352173,
0.058372318744659424,
-0.14861834049224854,
0.4028259813785553,
-0.030748629942536354,
-0.6644508838653564,
0.3137113153934... |
func (r *GoFuncRenderer[T]) Body(f func(r *GoRenderer[T])) {
br := GoFuncBodyRenderer[T]{
r: r,
}
br.Body(f)
} | [
-1.3131719827651978,
0.09920421987771988,
0.4819088578224182,
-0.22653424739837646,
0.6663433313369751,
0.014057496562600136,
0.10843399912118912,
-0.20862391591072083,
-0.0686136782169342,
0.3078588843345642,
-0.6816478371620178,
-0.00422154925763607,
0.4503140151500702,
0.875960528850555... |
func (r *GoFuncBodyRenderer[T]) Body(f func(r *GoRenderer[T])) {
var buf strings.Builder
buf.WriteString("func ")
if r.r.rcvr != nil {
buf.WriteByte('(')
buf.WriteString(r.r.r.S(*r.r.rcvr))
buf.WriteString(") ")
}
buf.WriteString(r.r.r.S(r.r.name))
buf.WriteByte('(')
for i, p := range r.r.params {
if i ... | [
-0.8773888349533081,
-0.3286550045013428,
1.145382285118103,
-1.1252801418304443,
0.1517719030380249,
-0.373201459646225,
-0.3655471205711365,
-0.6528883576393127,
-0.4032272398471832,
0.399402916431427,
-0.2769862711429596,
-0.0675908699631691,
0.17573294043540955,
0.6254591941833496,
-... |
func NewAccount(email string, password string) (*Account, error) {
account := &Account{Email: email}
encryptedPassword, err := utils.Encrypt(password)
if err != nil {
return nil, err
}
account.ID = primitive.NewObjectID()
account.Password = string(encryptedPassword)
tNow := time.Now()
account.CreatedAt = &tNo... | [
0.07192124426364899,
-0.45011022686958313,
0.2599134147167206,
0.5355129837989807,
0.4933846890926361,
0.032838113605976105,
0.19478899240493774,
0.16155041754245758,
0.37239816784858704,
0.72647625207901,
-0.17342671751976013,
0.6748842000961304,
-0.01760309748351574,
-0.1982017308473587,... |
func (acct *Account) Save(allowReplace bool) (int, error) {
validator := validatorimpl.NewDefaultValidator()
errs := validator.Verify(acct)
if len(errs) != 0 {
return 0, fmt.Errorf("Save the account failed due to: %v", errs)
}
ctx, cancel := utils.GetDefaultCtx()
defer cancel()
rst := acct.repo.FindOne(ctx, ac... | [
-0.8780282139778137,
1.04617440700531,
0.7055564522743225,
-0.6040850877761841,
-0.06553489714860916,
-0.12815383076667786,
1.4042088985443115,
0.676235020160675,
-0.0881754532456398,
0.6071833372116089,
-0.017073316499590874,
0.2788180112838745,
-0.9416045546531677,
0.004515207838267088,
... |
func (c *Controller) AdminOnly(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
adminID := c.Sessions.GetString(r.Context(), "id")
if adminID == "" {
http.Error(w, "You are not logged in", http.StatusForbidden)
return
}
next.ServeHTTP(w, r)
})
} | [
0.35953763127326965,
0.17312274873256683,
0.45070189237594604,
-0.1784929633140564,
-0.7188803553581238,
0.39374086260795593,
-0.5824756622314453,
-0.8560376763343811,
0.7197189927101135,
0.6306473016738892,
0.01841789111495018,
1.5739967823028564,
-0.192730113863945,
0.11238498240709305,
... |
func (o *GetAvailabilityZonesUUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAvailabilityZonesUUIDOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
... | [
-0.35803431272506714,
-0.45727455615997314,
0.515758752822876,
0.40069225430488586,
-0.03552790731191635,
-0.532905638217926,
0.4157659709453583,
0.7910385131835938,
0.7356105446815491,
0.4847952723503113,
0.42871758341789246,
-0.5911269783973694,
-0.7646154165267944,
-0.9593609571456909,
... |
func NewGetAvailabilityZonesUUIDOK() *GetAvailabilityZonesUUIDOK {
return &GetAvailabilityZonesUUIDOK{}
} | [
-0.21190744638442993,
-0.28901588916778564,
0.21382123231887817,
1.1687028408050537,
-0.46174266934394836,
0.4189167618751526,
1.147399663925171,
2.594503402709961,
0.6056726574897766,
-0.03736718371510506,
-0.5908709168434143,
-0.4176005721092224,
0.6857428550720215,
-1.244459629058838,
... |
func NewGetAvailabilityZonesUUIDDefault(code int) *GetAvailabilityZonesUUIDDefault {
return &GetAvailabilityZonesUUIDDefault{
_statusCode: code,
}
} | [
0.06722230464220047,
0.18038082122802734,
0.03902164846658707,
0.49956008791923523,
0.6911564469337463,
0.2425982654094696,
0.3698625862598419,
1.9642390012741089,
0.7836045622825623,
0.4983474910259247,
-0.5512436032295227,
-0.3532407581806183,
-0.26092228293418884,
-1.3399434089660645,
... |
func (o *GetAvailabilityZonesUUIDDefault) Code() int {
return o._statusCode
} | [
-0.12509970366954803,
0.2501772344112396,
-0.03205300495028496,
0.8530842065811157,
0.40767842531204224,
0.2846221923828125,
0.2253163605928421,
1.7489027976989746,
0.5470698475837708,
0.4530036449432373,
-0.2134903222322464,
-0.38055795431137085,
-0.01649278774857521,
-0.3317708373069763,... |
func checkMURMigrated(t *testing.T, mur *toolchainv1alpha1.MasterUserRecord) {
// should have tier name set
require.NotEmpty(t, mur.Spec.TierName)
// should not have tier hash label
require.Empty(t, mur.Labels[fmt.Sprintf("toolchain.dev.openshift.com/%s-tier-hash", mur.Spec.TierName)])
require.Len(t, mur.Spec.Us... | [
0.7218471169471741,
-0.07521824538707733,
0.5563073754310608,
-0.14221686124801636,
-0.14677870273590088,
0.7132553458213806,
0.1345960646867752,
-0.17893476784229279,
-0.06876631826162338,
0.14891010522842407,
-0.4551744759082794,
0.7981948256492615,
-0.5427819490432739,
1.022215723991394... |
func Distance(p1, p2 orb.Point) float64 {
dLat := deg2rad(p1[1] - p2[1])
dLon := deg2rad(p1[0] - p2[0])
dLon = math.Abs(dLon)
if dLon > math.Pi {
dLon = 2*math.Pi - dLon
}
// fast way using pythagorean theorem on an equirectangular projection
x := dLon * math.Cos(deg2rad((p1[1]+p2[1])/2.0))
return math.Sqrt... | [
0.17611315846443176,
0.1325395405292511,
0.42315974831581116,
-0.06929480284452438,
-0.7176434993743896,
1.4611319303512573,
-0.7505274415016174,
0.4915107488632202,
0.2608082592487335,
0.6753321290016174,
0.2411794662475586,
0.17093618214130402,
0.007229034788906574,
-0.15639729797840118,... |
func DistanceHaversine(p1, p2 orb.Point) float64 {
dLat := deg2rad(p1[1] - p2[1])
dLon := deg2rad(p1[0] - p2[0])
dLat2Sin := math.Sin(dLat / 2)
dLon2Sin := math.Sin(dLon / 2)
a := dLat2Sin*dLat2Sin + math.Cos(deg2rad(p2[1]))*math.Cos(deg2rad(p1[1]))*dLon2Sin*dLon2Sin
return 2.0 * orb.EarthRadius * math.Atan2(ma... | [
0.5029966831207275,
0.06730131804943085,
0.8715785145759583,
-0.11410778760910034,
0.4316040277481079,
1.2697468996047974,
-0.7664031982421875,
0.0015459988499060273,
-0.6012303829193115,
0.30312708020210266,
-0.48787349462509155,
0.4547280967235565,
0.5355654358863831,
-0.5815529823303223... |
func Bearing(from, to orb.Point) float64 {
dLon := deg2rad(to[0] - from[0])
fromLatRad := deg2rad(from[1])
toLatRad := deg2rad(to[1])
y := math.Sin(dLon) * math.Cos(toLatRad)
x := math.Cos(fromLatRad)*math.Sin(toLatRad) - math.Sin(fromLatRad)*math.Cos(toLatRad)*math.Cos(dLon)
return rad2deg(math.Atan2(y, x))
} | [
0.30280575156211853,
-0.07026786357164383,
0.7436841726303101,
-0.7965265512466431,
-0.382325142621994,
0.836519181728363,
-0.4199173152446747,
-0.08291284739971161,
0.2862040102481842,
-0.09581638872623444,
-0.2608143985271454,
0.3443650007247925,
0.22672781348228455,
-0.6343294978141785,... |
func Midpoint(p, p2 orb.Point) orb.Point {
dLon := deg2rad(p2[0] - p[0])
aLatRad := deg2rad(p[1])
bLatRad := deg2rad(p2[1])
x := math.Cos(bLatRad) * math.Cos(dLon)
y := math.Cos(bLatRad) * math.Sin(dLon)
r := orb.Point{
deg2rad(p[0]) + math.Atan2(y, math.Cos(aLatRad)+x),
math.Atan2(math.Sin(aLatRad)+math.S... | [
0.24217312037944794,
-0.686663806438446,
0.8351395726203918,
-1.3500062227249146,
0.27252593636512756,
0.2475040853023529,
-0.6888169050216675,
0.5745275616645813,
0.297238290309906,
0.6770308017730713,
0.20440195500850677,
0.32079291343688965,
-0.82011878490448,
-0.8667863607406616,
0.6... |
func PointAtBearingAndDistance(p orb.Point, bearing, distance float64) orb.Point {
aLat := deg2rad(p[1])
aLon := deg2rad(p[0])
bearingRadians := deg2rad(bearing)
distanceRatio := distance / orb.EarthRadius
bLat := math.Asin(math.Sin(aLat)*math.Cos(distanceRatio) + math.Cos(aLat)*math.Sin(distanceRatio)*math.Cos(... | [
0.6988913416862488,
-0.9250073432922363,
0.4734291136264801,
-0.6743910312652588,
-0.22289451956748962,
0.9684600234031677,
-0.803010880947113,
0.6529181599617004,
0.5732980966567993,
0.40745285153388977,
0.024797435849905014,
0.08705885708332062,
0.0007147004944272339,
-0.2259363085031509... |
func All(n int, s string) []string {
c := 1 + len(s) - n // how many substrings will we generate?
r := make([]string, c) // allocate our result slice
for x := 0; x < c; x++ { // populate result slice
r[x] = s[x : x+n]
}
return r
} | [
0.6624529361724854,
0.20718269050121307,
0.6251233816146851,
0.18413986265659332,
0.18257635831832886,
0.13535813987255096,
-0.5832176804542542,
-0.34403562545776367,
0.06330689787864685,
-0.009986937046051025,
-0.33201754093170166,
1.2704129219055176,
-0.2957734763622284,
-0.3078612983226... |
func UnsafeFirst(n int, s string) string {
return s[:n] // fingers in ears, eyes closed, "la la la la la ..."
} | [
0.3266465365886688,
0.5526741147041321,
0.3067490756511688,
-0.6647224426269531,
0.08469577878713608,
-0.0820753425359726,
-0.6796581745147705,
-0.5502301454544067,
-0.08612232655286789,
0.7173463106155396,
-0.4757901132106781,
0.8653348088264465,
-0.12366063892841339,
-0.27838894724845886... |
func First(n int, s string) (series string, ok bool) {
if n > len(s) {
return "", false // not possible
}
return s[:n], true // that's more like it
} | [
0.19005461037158966,
0.6241635680198669,
0.5063731074333191,
-0.14319798350334167,
-0.3067098557949066,
-0.7950252890586853,
-1.26491379737854,
-0.635006308555603,
-0.016432711854577065,
0.6107620000839233,
-0.2577671706676483,
0.9134491682052612,
0.15458030998706818,
-0.48982536792755127,... |
func (c *Controller) Run(ctx context.Context) error {
// Start the informer factories to begin populating the informer caches
c.log.Infof("starting step control loop, node name: %s", c.nodeName)
// 初始化runner
c.log.Info("init controller engine")
if err := engine.Init(c.wc, c.informer.Recorder()); err != nil {
re... | [
0.1897955983877182,
0.14450810849666595,
0.57060706615448,
0.4761015474796295,
0.813285768032074,
0.743961751461029,
1.0526442527770996,
0.2886106073856354,
-0.9880951046943665,
-0.15058884024620056,
-0.407210111618042,
0.1471354216337204,
-0.5311874151229858,
0.5572218894958496,
0.21563... |
func (c *Controller) enqueueForAdd(s *pipeline.Step) {
c.log.Infof("receive add object: %s", s)
if err := s.Validate(); err != nil {
c.log.Errorf("invalidate *pipeline.Step obj")
return
}
// 判断入队条件, 已经执行完的无需重复处理
if s.IsComplete() {
c.log.Errorf("step %s is complete, skip enqueue", s.Key)
return
}
c.inf... | [
-0.1491098552942276,
-0.47782793641090393,
0.459208607673645,
0.15455177426338196,
-0.0028760365676134825,
0.6041331887245178,
0.2798292338848114,
-0.2566983103752136,
-0.13068896532058716,
-0.17927467823028564,
0.035548269748687744,
0.2692987620830536,
0.07544507831335068,
0.5630825161933... |
func (c *Controller) enqueueForDelete(s *pipeline.Step) {
c.log.Infof("receive delete object: %s", s)
if err := s.Validate(); err != nil {
c.log.Errorf("invalidate *pipeline.Step obj")
return
}
key := s.MakeObjectKey()
c.workqueue.AddRateLimited(key)
} | [
0.45796599984169006,
-0.4772868752479553,
0.41111668944358826,
0.23119404911994934,
0.633464515209198,
-0.2972240447998047,
-0.2994156777858734,
0.042869340628385544,
0.35116153955459595,
0.10635627061128616,
-0.26143303513526917,
0.42622244358062744,
0.37879079580307007,
0.273780167102813... |
func (c *Controller) runWorker(name string) {
isRunning, ok := c.runningWorkers[name]
if ok && isRunning {
c.log.Warnf("worker %s has running", name)
return
}
c.wLock.Lock()
c.runningWorkers[name] = true
c.log.Infof("start worker %s", name)
c.wLock.Unlock()
for c.processNextWorkItem() {
}
if isRunning, ok... | [
-0.9851239919662476,
-0.946008563041687,
0.6524989008903503,
-0.18329128623008728,
-0.08127094805240631,
-0.17740371823310852,
0.5589287877082825,
0.30620887875556946,
-0.06508435308933258,
0.03459104523062706,
-1.4507904052734375,
-0.3500623404979706,
-0.87452632188797,
0.6643082499504089... |
func (c *Controller) processNextWorkItem() bool {
obj, shutdown := c.workqueue.Get()
if shutdown {
return false
}
c.log.Debugf("get obj from queue: %s", obj)
// We wrap this block in a func so we can defer c.workqueue.Done.
err := func(obj interface{}) error {
// We call Done here so the workqueue knows we ha... | [
-0.07585877925157547,
-0.4359467923641205,
0.8053895831108093,
-0.10244686901569366,
-0.2834286093711853,
0.020700931549072266,
0.1843651980161667,
-1.3772423267364502,
-0.07572177052497864,
0.44685685634613037,
-0.3865378201007843,
-0.08652392029762268,
-0.3600459396839142,
0.274458289146... |
func initCommand(args ...string) []string {
cmd := []string{"singularity"}
cmd = append(cmd, args...)
return cmd
} | [
-0.5524334907531738,
-0.23586274683475494,
0.5536946058273315,
0.6932879090309143,
1.476119875907898,
0.5238963961601257,
-0.6532920598983765,
1.2258164882659912,
0.7381717562675476,
-0.21313859522342682,
-0.31229346990585327,
1.1845169067382812,
-0.2823127806186676,
1.7587149143218994,
... |
func NewReportBalance(args []string) (*ReportBalance, error) {
report := &ReportBalance{
rcf: NewRCformat(),
balance: make(map[string][][]string),
postings: map[string]bool{},
bubbleacc: map[string]bool{},
de: dblentry.NewDoubleEntry("finaltally"),
}
if len(args) > 1 {
filterarg := api.Ma... | [
-0.24250319600105286,
0.21948906779289246,
0.7241393327713013,
0.07162784785032272,
-0.24684052169322968,
-0.5235548615455627,
0.4092722237110138,
-0.18251802027225494,
-0.463313490152359,
0.2217448204755783,
0.5095288753509521,
0.07132570445537567,
-1.0791809558868408,
0.8552186489105225,... |
func NewProductOK() *ProductOK {
return &ProductOK{}
} | [
-0.27630770206451416,
-0.7880865335464478,
0.12787142395973206,
1.3083776235580444,
-0.9538416266441345,
0.26063862442970276,
1.0406813621520996,
-0.597518265247345,
-0.08464842289686203,
0.40448638796806335,
-0.7528716921806335,
0.645604133605957,
0.5639989376068115,
0.18944968283176422,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.