text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func TestRemoveEdgeRevision(t *testing.T) {
var ctx context.Context
c := createClient(t, nil)
db := ensureDatabase(ctx, c, "edge_test", nil, t)
prefix := "remove_edge_revision_"
g := ensureGraph(ctx, db, prefix+"graph", nil, t)
ec := ensureEdgeCollection(ctx, g, prefix+"citiesPerState", []string{prefix + "city"},... | [
0.47629785537719727,
0.07539302855730057,
0.7005984783172607,
-1.0496116876602173,
0.04391772300004959,
-0.13916131854057312,
0.6982806324958801,
1.0424818992614746,
-0.24862819910049438,
0.6772366762161255,
-0.13959482312202454,
0.21199819445610046,
-0.5974316596984863,
-0.800100803375244... |
func TestRemoveEdgeKeyEmpty(t *testing.T) {
var ctx context.Context
c := createClient(t, nil)
db := ensureDatabase(ctx, c, "edge_test", nil, t)
prefix := "remove_edge_nil_"
g := ensureGraph(ctx, db, prefix+"graph", nil, t)
ec := ensureEdgeCollection(ctx, g, prefix+"citiesPerState", []string{prefix + "city"}, []st... | [
-0.22628092765808105,
0.1397649645805359,
0.7169972062110901,
-0.9456731677055359,
0.2592557966709137,
-0.1742652803659439,
0.09631121158599854,
1.2168948650360107,
0.16446448862552643,
1.1127033233642578,
-0.26858916878700256,
-0.37921974062919617,
-0.8724624514579773,
0.25199460983276367... |
func CreateK8sApiserverClient(configFile string) (*KubernetesAPIServer, error) {
klog.Info("[INFO] Creating API Client", configFile)
api := &KubernetesAPIServer{}
if (configFile != "") {
config, err = clientcmd.BuildConfigFromFlags("", configFile)
if err != nil {
... | [
-0.2006586790084839,
-0.8836423754692078,
0.2847805321216583,
-0.30119141936302185,
-0.17436940968036652,
0.32172414660453796,
-0.2009582817554474,
0.2292904108762741,
0.04663660749793053,
0.40529128909111023,
-0.1371961236000061,
-0.5972287058830261,
-0.897053062915802,
-0.100883424282073... |
func NewClient() Client {
return Client{}
} | [
0.2820269763469696,
-0.8105835318565369,
-0.0429547019302845,
0.23435942828655243,
-0.8866615891456604,
0.18641981482505798,
0.7054499387741089,
-0.23948200047016144,
-0.16465502977371216,
-1.0267884731292725,
-0.5952434539794922,
0.8429712653160095,
-0.4172888696193695,
-0.991530537605285... |
func (c *Client) NewRequest(method string, fullPath string, headers map[string]string, body io.Reader) (*http.Request, error) {
req, err := http.NewRequest(method, fullPath, body)
if err != nil {
return nil, errors.New("sangu-bca.client.NewRequest: " + err.Error())
}
if headers != nil {
for k, vv := range head... | [
-0.21411751210689545,
-0.5712989568710327,
0.7228031754493713,
0.22516922652721405,
-0.020766204223036766,
-0.4717423617839813,
-0.9389011859893799,
-0.6265857219696045,
0.2455964982509613,
0.46430569887161255,
0.8182043433189392,
0.7804777026176453,
-0.45077449083328247,
-0.30364808440208... |
func (c *Client) ExecuteRequest(req *http.Request, v interface{}, x interface{}) error {
res, err := httpClient.Do(req)
if err != nil {
return errors.New("sangu-bca.client.ExecuteRequest.Do: " + err.Error())
}
defer res.Body.Close()
resBody, err := ioutil.ReadAll(res.Body)
if err != nil {
return errors.New("... | [
-1.2080636024475098,
-0.9295800924301147,
0.9925095438957214,
-0.1666654348373413,
0.2737446427345276,
0.1274905502796173,
-0.336769700050354,
-0.26646777987480164,
0.16245295107364655,
0.935103178024292,
-0.10917659848928452,
0.932685375213623,
-0.2247288078069687,
0.039353128522634506,
... |
func (c *Client) Call(method, path string, header map[string]string, body io.Reader, v interface{}, x interface{}) error {
req, err := c.NewRequest(method, path, header, body)
if err != nil {
return err
}
return c.ExecuteRequest(req, v, x)
} | [
-0.6628602743148804,
0.0037939660251140594,
0.778325080871582,
-0.1321563869714737,
-0.46839839220046997,
1.0685993432998657,
-1.789469838142395,
-0.42665889859199524,
-0.49003222584724426,
0.3404151201248169,
0.6194385886192322,
0.6977510452270508,
-0.38568687438964844,
-0.380224764347076... |
func main() {
app := stdcli.New()
app.Flags = []cli.Flag{appFlag, rackFlag}
app.Version = Version
terminalSetup()
err := app.Run(os.Args)
if err != nil {
if err.Error() == "Token expired" {
email, err := currentId()
if err != nil {
email = promptForUsername()
} else {
_, err := mail.ParseAdd... | [
0.5496426224708557,
0.4305148720741272,
1.4157851934432983,
0.8169066905975342,
0.479505717754364,
0.815369725227356,
0.14059709012508392,
0.11630351841449738,
-1.2881979942321777,
0.33664992451667786,
-0.16679978370666504,
0.5008050799369812,
-0.18957313895225525,
-0.5569972991943359,
0... |
func (r *ChartReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
log := r.Log.WithValues("chart", req.NamespacedName)
instance := &stablev1.Chart{}
finalizer := "helm.operator.finalizer.io"
forGroundFinalizer := "foregroundDeletion"
// your logic here
if err := r.Get(ctx, req.NamespacedName, instanc... | [
0.1680499017238617,
-0.31998321413993835,
0.8911191821098328,
0.1520112007856369,
0.19013933837413788,
-1.080994725227356,
0.6205858588218689,
0.04887903481721878,
-0.06742788851261139,
-0.4535215198993683,
-0.02776624821126461,
-0.5667498707771301,
-0.06991257518529892,
0.5935914516448975... |
func (r *ChartReconciler) deleteExternalResources(instance *stablev1.Chart) error {
for _, resource := range instance.Status.Resource {
u := &unstructured.Unstructured{}
u.Object = map[string]interface{}{
"metadata": map[string]interface{}{
"name": resource.Name,
"namespace": resource.Namespace,
... | [
-0.10900628566741943,
-0.13409553468227386,
0.5183508396148682,
-0.6791788339614868,
-0.01558021642267704,
0.41255253553390503,
0.3743234872817993,
0.20621071755886078,
-0.29006123542785645,
0.40412187576293945,
-0.21216198801994324,
-0.4766843616962433,
-0.27101412415504456,
0.63205224275... |
func (r *ChartReconciler) UpdateStatus(c *stablev1.Chart) error {
if err := r.Status().Update(ctx, c); err != nil {
return err
}
return nil
} | [
-0.20380286872386932,
-0.37384477257728577,
0.36476418375968933,
-0.5153786540031433,
0.2752024233341217,
0.24211959540843964,
0.3946477472782135,
0.28735971450805664,
0.19064217805862427,
0.20676091313362122,
-0.6799747943878174,
-0.10584194213151932,
-0.2558997571468353,
-0.0279787816107... |
func getChart(c *stablev1.Chart) error {
exec.Command("helm", "repo", "update")
if err := os.MkdirAll("chart/"+c.Spec.Version, os.ModePerm); err != nil {
fmt.Printf("%v\n", err)
}
cmd := exec.Command("helm",
"fetch",
"--untar",
"--version="+c.Spec.Version,
"--untardir=chart/"+c.Spec.Version,
c.Spec.Repo... | [
0.12495473027229309,
0.14623960852622986,
0.7905756831169128,
0.15229713916778564,
0.19840264320373535,
0.45034635066986084,
0.43657398223876953,
-0.3961724638938904,
0.06119736284017563,
-0.4082242250442505,
0.2093813121318817,
1.0413204431533813,
0.19660459458827972,
0.540593147277832,
... |
func templateChart(c *stablev1.Chart) ([]byte, error) {
values := buildValuesString(c)
cmd := exec.Command("helm",
"template",
"--name="+c.GetName(),
"--set="+values,
"--namespace="+c.Spec.NameSpaceSelector,
"chart/"+c.Spec.Version+"/"+c.Spec.Chart)
var out bytes.Buffer
var stderr bytes.Buffer
cmd.Stdout... | [
-0.33047664165496826,
0.3107786476612091,
0.5606720447540283,
-0.77632075548172,
-0.7569504380226135,
-0.66311115026474,
-0.5419057011604309,
-1.1502346992492676,
0.11528755724430084,
0.07791852205991745,
-0.5294600129127502,
0.3131588101387024,
-0.2738237977027893,
0.5114313364028931,
0... |
func buildValuesString(c *stablev1.Chart) string {
var buildString string
for _, valuePair := range c.Spec.Values {
buildString += valuePair.Name + "=" + valuePair.Value + ","
}
if last := len(buildString) - 1; last >= 0 && buildString[last] == ',' {
buildString = buildString[:last]
}
return buildString
} | [
-0.2183452546596527,
-0.7310076951980591,
0.5368599891662598,
-0.4428494870662689,
0.2877601087093353,
0.24979060888290405,
-0.20301292836666107,
-1.0861761569976807,
-0.498369038105011,
0.15895314514636993,
0.7374719977378845,
0.02337559685111046,
0.3293492794036865,
-0.030019475147128105... |
func ignoreNotFound(err error) error {
if apierrs.IsNotFound(err) {
return nil
}
return err
} | [
-0.3733955919742584,
-0.9614057540893555,
0.2627733647823334,
-0.3674359619617462,
0.4287834167480469,
0.8609669804573059,
-0.31554844975471497,
-0.24229687452316284,
1.301289677619934,
-0.2645076811313629,
-0.17479994893074036,
-0.052321191877126694,
-0.3968964219093323,
0.323023974895477... |
func refInSlice(a corev1.ObjectReference, list []corev1.ObjectReference) bool {
for _, b := range list {
if b == a {
return true
}
}
return false
} | [
-0.5219227075576782,
-0.7697972655296326,
0.5480073094367981,
0.16582134366035461,
-0.3640001118183136,
0.1504281461238861,
-0.33156752586364746,
0.15952084958553314,
0.14534589648246765,
1.1934841871261597,
0.15635213255882263,
-0.03357928991317749,
-0.8226572871208191,
0.7410748600959778... |
func containsString(slice []string, s string) bool {
for _, item := range slice {
if item == s {
return true
}
}
return false
} | [
0.04810415208339691,
-1.3337082862854004,
0.0976812094449997,
0.28136488795280457,
-0.344137966632843,
-0.12331268191337585,
-0.8575016856193542,
-0.49491265416145325,
-0.10580432415008545,
0.619733452796936,
-0.4712563455104828,
0.22324824333190918,
0.2490464299917221,
-0.7696039080619812... |
func removeString(slice []string, s string) (result []string) {
for _, item := range slice {
if item == s {
continue
}
result = append(result, item)
}
return
} | [
-0.5591647028923035,
-0.9348670840263367,
0.38670650124549866,
0.17337241768836975,
-0.1957593858242035,
-1.22026526927948,
-0.3644793629646301,
-0.033490460366010666,
-0.06225783750414848,
1.413021206855774,
-0.40211379528045654,
0.4571748375892639,
-0.04478372633457184,
-0.69494342803955... |
func PushToUser(mpush bilin.MultiPush) (offline []int64, err error) {
var (
body []byte
bodyReader io.Reader
request *http.Request
response *http.Response
result pushResult
url = URL + "/pushs"
)
if body, err = pb.Marshal(&mpush); err != nil {
return
}
bodyReader = bytes.NewBuff... | [
-1.0859973430633545,
0.47586652636528015,
0.8235869407653809,
0.31171149015426636,
-0.4890825152397156,
0.06655231863260269,
0.25007930397987366,
-0.3381247818470001,
-0.3669807016849518,
0.562293529510498,
-1.2636264562606812,
0.6673372387886047,
-0.237875297665596,
0.6475324630737305,
... |
func NewContainerRunner() *ContainerRunner {
return &ContainerRunner{
exposedPorts: map[nat.Port]struct{}{},
portBindings: map[nat.Port][]nat.PortBinding{},
env: []string{},
opts: &ContainerRunnerOpts{
RemoveOnFinalization: true,
},
}
} | [
-0.47439050674438477,
-0.8942230343818665,
0.1669432818889618,
0.1255517601966858,
-1.638958215713501,
-0.05994250997900963,
-0.3117217421531677,
0.1723739206790924,
-0.31291621923446655,
0.27598220109939575,
-0.7290046215057373,
0.501007616519928,
-0.12779845297336578,
0.7042843103408813,... |
func (r *ContainerRunner) WithPorts(ports ...int) *ContainerRunner {
for _, p := range ports {
port := strconv.Itoa(p)
r.ports = append(r.ports, port)
r.exposedPorts[nat.Port(port)] = struct{}{}
r.portBindings[nat.Port(port)] = []nat.PortBinding{
{
HostIP: DefaultHostAddress,
HostPort: port,
},... | [
0.0656796395778656,
0.6657934188842773,
0.3360126316547394,
-0.3897460103034973,
0.015659742057323456,
0.4271053373813629,
0.11333373188972473,
-0.7275546789169312,
0.06506551802158356,
-0.4880962371826172,
-0.6712539196014404,
-0.746403694152832,
0.1246122196316719,
0.057769596576690674,
... |
func (r *ContainerRunner) WithImage(image string) *ContainerRunner {
r.image = image
if !substringContainedInSlice(image, RegistryExtensionOptions) {
r.image = fmt.Sprintf("docker.io/library/%v", image)
}
return r
} | [
-0.058245811611413956,
0.19055581092834473,
0.39120423793792725,
0.08682933449745178,
-0.08094707131385803,
0.47857171297073364,
0.6485060453414917,
-0.08334812521934509,
0.3104460835456848,
0.2563306391239166,
0.6801328659057617,
-0.29033568501472473,
-0.12849025428295135,
0.2508864104747... |
func (r *ContainerRunner) WithName(name string) *ContainerRunner {
r.name = name
if len(name) == 0 {
r.name = DefaultContainerName
}
return r
} | [
-0.09834364056587219,
-0.07443782687187195,
0.535758912563324,
0.21752120554447174,
-0.1491553634405136,
-0.7764968872070312,
0.4280815124511719,
-0.41779738664627075,
0.18887749314308167,
0.5482580661773682,
-0.6366416811943054,
-0.8122806549072266,
0.0994965061545372,
0.5681800842285156,... |
func (r *ContainerRunner) WithOptions(opts *ContainerRunnerOpts) *ContainerRunner {
r.opts = opts
return r
} | [
0.11138766258955002,
-0.14757417142391205,
0.23442980647087097,
-0.05732778459787369,
-0.1967492401599884,
-0.07802706956863403,
0.45421504974365234,
-0.7850855588912964,
0.8302629590034485,
-0.6734989285469055,
-0.0664169192314148,
-0.28987663984298706,
0.23485323786735535,
-0.25611665844... |
func (e *ContainerRunner) Start(ctx context.Context) error {
var err error
e.client, err = client.NewEnvClient()
if err != nil {
return fmt.Errorf("creating env client: %w", err)
}
log.Infoln("pulling image")
_, err = e.client.ImagePull(ctx, e.image, types.ImagePullOptions{})
if err != nil {
return fmt.Erro... | [
-0.0817752555012703,
-0.018468869850039482,
0.5779351592063904,
-0.06479357182979584,
0.7368555665016174,
0.07641725242137909,
0.24343743920326233,
0.015151694416999817,
-0.30349069833755493,
0.6172406673431396,
-0.4094335734844208,
0.8891429305076599,
0.2985064685344696,
0.933404266834259... |
func (e *ContainerRunner) Stop(ctx context.Context) error {
log.Infoln("stopping container")
// If we don't have a container id
if len(e.id) == 0 {
return ErrNoContainerId
}
timeout := time.Minute
err := e.client.ContainerStop(ctx, e.id, &timeout)
if err != nil {
return fmt.Errorf("stopping container: %w", ... | [
-0.7201812267303467,
0.08855493366718292,
0.5294352173805237,
0.3092661499977112,
0.6894431114196777,
-0.4657551050186157,
0.04276423901319504,
0.4606521725654602,
0.2182357907295227,
0.9874522089958191,
-0.08338841050863266,
0.13680508732795715,
-0.22465498745441437,
0.4373109042644501,
... |
func substringContainedInSlice(str string, substrs []string) bool {
for _, s := range substrs {
if strings.Contains(str, s) {
return true
}
}
return false
} | [
0.39443451166152954,
-1.068185806274414,
0.15678033232688904,
-0.6229979395866394,
0.01009702030569315,
0.4522005319595337,
-0.6823539733886719,
-0.15141797065734863,
-0.8139110207557678,
0.28802376985549927,
-0.374330997467041,
-0.09433126449584961,
-0.0532987080514431,
-0.528462767601013... |
func (env *Env) View(res http.ResponseWriter, req *http.Request, title string) {
env.Log.V(1, "beginning handling of View.")
env.Log.V(1, "loading requested page from cache.")
p, err := env.Cache.LoadPageFromCache(title)
if err != nil {
env.Log.V(1, "if file from cache not found, then retrieve requested page from... | [
-0.728674590587616,
-0.1560046374797821,
0.7441244721412659,
-0.4038642942905426,
-0.11376947909593582,
-0.13374651968479156,
-0.22557248175144196,
0.314540833234787,
-0.002705037361010909,
-0.0049215201288461685,
0.709982693195343,
-0.0161637831479311,
-0.052866131067276,
0.17445293068885... |
func (env *Env) Edit(res http.ResponseWriter, req *http.Request, title string) {
env.Log.V(1, "beginning handling of Edit.")
env.Log.V(1, "loading requested page from cache.")
p, err := env.Cache.LoadPageFromCache(title)
if err != nil {
env.Log.V(1, "if file from cache not found, then retrieve requested page from... | [
-0.9191315174102783,
-0.33030059933662415,
0.8209365010261536,
-0.16175268590450287,
0.18224398791790009,
0.036963921040296555,
0.08586042374372482,
0.3213459253311157,
-0.46017611026763916,
0.5294901728630066,
0.9734967350959778,
-0.036502230912446976,
-0.01256557833403349,
0.210366666316... |
func (env *Env) Save(res http.ResponseWriter, req *http.Request, title string) {
env.Log.V(1, "beginning hanlding of Save.")
title = strings.Replace(strings.Title(title), " ", "_", -1)
body := []byte(req.FormValue("body"))
page := &webAppGo.Page{Title: title, Body: body}
err := env.Cache.SaveToCache(page)
if err ... | [
-0.7957538962364197,
0.37902024388313293,
0.9468110203742981,
0.026486722752451897,
0.407168984413147,
0.5999200344085693,
-0.21499426662921906,
-0.25782209634780884,
-0.5357398986816406,
0.8067029118537903,
-0.2490358054637909,
-0.08188311755657196,
-0.19937194883823395,
0.444153010845184... |
func (env *Env) Create(res http.ResponseWriter, req *http.Request) {
switch req.Method {
case "GET":
env.Log.V(1, "beginning handling of GET request for Create endnode.")
p := &webAppGo.Page{}
env.Log.V(1, "rendering the create template.")
env.Render(res, "create", p)
case "POST":
env.Log.V(1, "beginning h... | [
-0.9726530909538269,
0.6733982563018799,
0.9675083160400391,
0.3027649521827698,
0.5544124841690063,
0.6418465971946716,
-0.1312226802110672,
-0.18762454390525818,
-0.744717001914978,
0.7316620349884033,
0.4534706175327301,
-0.6694892644882202,
-0.038045335561037064,
1.0710012912750244,
... |
func NewServer(logger *logrus.Logger, port int, handler http.Handler) *Server {
server := &http.Server{
Handler: handler,
Addr: fmt.Sprintf(":%d", port),
ReadTimeout: time.Second * 30,
WriteTimeout: time.Second * 60,
IdleTimeout: time.Second * 60,
}
return &Server{
port: port,
logger:... | [
-0.5110489130020142,
-0.9984663724899292,
0.6890409588813782,
-0.7094284296035767,
-0.5048702955245972,
0.6037561893463135,
-0.0950106680393219,
-0.02552810125052929,
-0.3435889780521393,
-0.4451678693294525,
0.013242395594716072,
1.142815113067627,
0.03817800432443619,
0.16118167340755463... |
func (s Server) ListenAndServe() {
go func() {
s.logger.Infof("Server is running on port :%d", s.port)
s.logger.Error(s.server.ListenAndServe())
}()
} | [
0.5483137965202332,
-1.4041162729263306,
0.3672879636287689,
-0.23765598237514496,
0.5724506378173828,
-0.0818001925945282,
-0.302131712436676,
1.0773191452026367,
-0.18967100977897644,
-0.5962834358215332,
-0.6310529708862305,
0.3863670825958252,
0.15669535100460052,
0.7400294542312622,
... |
func (s Server) Shutdown() {
s.logger.Error(s.server.Shutdown(context.Background()))
} | [
-0.2547245919704437,
-0.24438229203224182,
0.2545563876628876,
0.38138487935066223,
0.2879248559474945,
0.4946279525756836,
0.1926991194486618,
0.2659814655780792,
0.27063003182411194,
0.14127027988433838,
0.05151565372943878,
1.6238287687301636,
-0.28474098443984985,
0.5153524279594421,
... |
func ArrayContainsString(array []string, value string) bool {
hasValue := false
for i := 0; i < len(array); i++ {
if array[i] == value {
hasValue = true
}
}
return hasValue
} | [
0.5355117321014404,
-1.251131534576416,
0.40393781661987305,
0.44107237458229065,
-0.22046515345573425,
0.04046771675348282,
-0.5202242136001587,
-0.6651852130889893,
-0.1848984956741333,
1.2804107666015625,
0.8222792148590088,
-0.033893734216690063,
0.6062820553779602,
0.17744803428649902... |
func (m *Message) Send() error {
//fillMessageDefaults(m)
bd := body{
Attachments: []Attachment{
Attachment{
Fallback: m.subject,
Text: m.msg,
Color: m.color,
AuthorLink: m.service.authorLink,
AuthorName: m.service.authorName,
Title: m.subject,
Fields: m.fields,
... | [
-0.12990231812000275,
0.2154974788427353,
0.9186816811561584,
0.3149872422218323,
0.18549928069114685,
0.047338563948869705,
-0.3836609721183777,
-0.7092726826667786,
-0.8657519817352295,
0.14551883935928345,
-0.08007067441940308,
1.0248571634292603,
-0.7310299873352051,
0.9009207487106323... |
func (csc *CoreStoreClient) RegisterDatasource(metadata DataSourceMetadata) error {
path := "/cat"
token, err := csc.Arbiter.RequestToken(csc.ZEndpoint+path, "POST", "")
if err != nil {
return err
}
hypercatJSON, err := csc.dataSourceMetadataToHypercat(metadata, csc.ZEndpoint)
_, writeErr := csc.ZestC.Post(s... | [
-1.0500595569610596,
0.8543562293052673,
0.3707929253578186,
-0.5637192130088806,
0.4457622468471527,
-0.6558980941772461,
-0.586249589920044,
0.209360733628273,
-0.582958996295929,
-0.3151525855064392,
-1.5611484050750732,
0.6079161763191223,
-0.16796652972698212,
0.2413819134235382,
0.... |
func (csc *CoreStoreClient) dataSourceMetadataToHypercat(metadata DataSourceMetadata, endPoint string) ([]byte, error) {
if metadata.Description == "" ||
metadata.ContentType == "" ||
metadata.Vendor == "" ||
metadata.DataSourceType == "" ||
metadata.DataSourceID == "" ||
metadata.StoreType == "" {
retur... | [
-0.11690637469291687,
0.023293524980545044,
0.8093026280403137,
-1.265708565711975,
0.1831153780221939,
-0.2109229862689972,
-0.5616022348403931,
-0.34647035598754883,
-0.09583847224712372,
-0.052632056176662445,
-0.05040457099676132,
0.7066566348075867,
0.4330640733242035,
-0.030961023643... |
func (v *Int64) Load() int64 {
i, _ := v.i.Load().(int64)
return i
} | [
-1.6503329277038574,
0.09901518374681473,
0.1772134155035019,
-0.19188496470451355,
-0.6707471609115601,
-0.2750454545021057,
0.7651726007461548,
-0.45915520191192627,
-0.14882028102874756,
0.1125837117433548,
-0.40022727847099304,
-0.32381629943847656,
-1.186116337776184,
-0.4247353374958... |
func (v *Int64) Store(i int64) {
v.i.Store(i)
} | [
-0.8077902793884277,
0.25673648715019226,
-0.09954668581485748,
0.4536784589290619,
-0.17809244990348816,
0.7548167705535889,
1.0427131652832031,
-0.3964444398880005,
0.5181307196617126,
-0.757317304611206,
-1.0122076272964478,
-0.2693941295146942,
-0.42752787470817566,
0.5754832029342651,... |
func NewCommandRouter(name string) *cobra.Command {
flag.Set("v", "4")
cfg := clientcmd.NewConfig()
cmd := &cobra.Command{
Use: fmt.Sprintf("%s%s", name, clientcmd.ConfigSyntax),
Short: "Start an OpenShift router",
Long: longCommandDesc,
Run: func(c *cobra.Command, args []string) {
if err := start(cfg... | [
-0.15788011252880096,
-0.7336957454681396,
0.7160028219223022,
-0.5860416889190674,
-0.5276411771774292,
0.09164828062057495,
0.12357678264379501,
0.0347464382648468,
-0.3930242359638214,
-0.49823129177093506,
0.22077617049217224,
0.13767331838607788,
-0.8475262522697449,
1.032981514930725... |
func start(cfg *clientcmd.Config) error {
kubeClient, osClient, err := cfg.Clients()
if err != nil {
return err
}
routes := haproxy.NewRouter()
factory := controllerfactory.RouterControllerFactory{kubeClient, osClient}
controller := factory.Create(routes)
controller.Run()
select {}
return nil
} | [
0.8066034317016602,
-0.015262234956026077,
0.4804425835609436,
-0.07112707197666168,
0.5519242286682129,
0.050033293664455414,
0.8458508253097534,
0.6765508651733398,
-1.1845769882202148,
0.4936150014400482,
-0.2938527464866638,
0.7329027056694031,
-0.07234782725572586,
0.3431302011013031,... |
func CreateUser(w http.ResponseWriter, r *http.Request) {
enableCors(&w)
vars := mux.Vars(r)
uid := vars["uid"]
//uuid := uuid.New().String()
//ip := strings.Split(r.RemoteAddr, ":")[0]
filesFirstore := StructToJSON(userFiles)
_, err := db.Collection("users").Doc(uid).Update(context.Background(), []firestore.Upd... | [
-0.5124207139015198,
-0.1242174282670021,
0.6660259962081909,
0.6611646413803101,
0.5042195916175842,
1.1129889488220215,
0.8523637056350708,
0.2692135274410248,
-0.18849262595176697,
0.29850083589553833,
-0.153933584690094,
-1.0426446199417114,
-0.7618515491485596,
0.19811230897903442,
... |
func (s stringStack) Items() []string {
return s
} | [
-0.06480146944522858,
-0.6073021292686462,
0.2514539361000061,
-0.46195241808891296,
0.27009132504463196,
-0.012297021225094795,
-0.6530123949050903,
-0.2840311825275421,
0.2528166174888611,
0.030397064983844757,
-0.36950457096099854,
0.806869387626648,
-0.541253924369812,
-0.2687851786613... |
func IsEnabled() bool {
return false
} | [
-0.040493112057447433,
-0.3080907464027405,
0.2736331820487976,
1.2852965593338013,
-0.0739031657576561,
0.565342128276825,
-0.2600066661834717,
1.3958888053894043,
0.7402230501174927,
-0.31789007782936096,
-1.1010370254516602,
-0.2500302195549011,
-1.6853766441345215,
0.03923282399773598,... |
func InstallDefault(name string) error {
return ErrApparmorUnsupported
} | [
-0.26715701818466187,
0.010590856894850731,
0.361114501953125,
0.9120890498161316,
0.6046949028968811,
0.519464910030365,
0.3378761112689972,
0.8370758891105652,
0.3482045829296112,
0.9377498030662537,
-0.9075482487678528,
-0.8816424012184143,
-0.8361356854438782,
0.7084787487983704,
-0.... |
func IsLoaded(name string) (bool, error) {
return false, ErrApparmorUnsupported
} | [
-1.0121623277664185,
0.06569314002990723,
0.7761214375495911,
0.3394545316696167,
-0.7589086890220642,
0.4537595510482788,
-0.7358776330947876,
-0.4544260799884796,
1.1202757358551025,
0.18869967758655548,
-1.8043627738952637,
-0.7902085781097412,
-0.5558488368988037,
-0.43563467264175415,... |
func (c component) Matches(s string) (bool, string) {
if c == wildOne || c == wildMulti {
return true, "" // matches everything, captures nothing
} else if string(c) == s {
return true, ""
} else if l := len(c); l < 2 {
return false, ""
} else if c[0] == '{' && c[l-1] == '}' {
return true, strings.TrimSpace... | [
-0.37487170100212097,
-1.0987673997879028,
0.7517849206924438,
-0.16304895281791687,
-0.1615985780954361,
-0.40752410888671875,
-0.38092565536499023,
0.6100884079933167,
0.24408140778541565,
-0.3415788412094116,
-0.6820089817047119,
0.06715473532676697,
-0.2392808049917221,
-0.024455377832... |
func splitPath(s string, sep rune, vars bool) (string, string) {
var invar bool
for i, e := range s {
if e == sep && !invar {
return s[:i], s[i+1:]
} else if vars && e == '{' {
invar = true
} else if vars && e == '}' {
invar = false
}
}
return s, ""
} | [
-0.5779162645339966,
-0.6731712222099304,
0.5835289359092712,
0.6042316555976868,
-1.0147625207901,
-0.28874531388282776,
0.512762188911438,
0.22411216795444489,
-0.4882054030895233,
0.6744924783706665,
0.035392336547374725,
-0.05881205201148987,
-0.7309803366661072,
-0.7416527271270752,
... |
func Parse(s string) Path {
return ParseSeparator(s, defaultSep)
} | [
0.7016465067863464,
0.1459178328514099,
0.1651914119720459,
1.0946935415267944,
-0.3877403736114502,
-0.0981048047542572,
0.09073770046234131,
0.1146651953458786,
0.2557927072048187,
-1.101919412612915,
0.11631347239017487,
-1.8635098934173584,
-0.3148348927497864,
-0.5371227860450745,
-... |
func ParseSeparator(s string, sep rune) Path {
var p []component
var c string
for s != "" {
c, s = splitPath(s, sep, true)
p = append(p, component(c))
}
return Path{
cmp: p,
sep: sep,
}
} | [
0.15821702778339386,
-0.8377023935317993,
0.4031069576740265,
0.3335294723510742,
-1.1841633319854736,
-0.9579038023948669,
0.3688994348049164,
0.25892335176467896,
0.04185539111495018,
-0.8381163477897644,
-0.04483473673462868,
-0.8555379509925842,
0.1544441133737564,
-0.35514017939567566... |
func (p Path) Matches(s string) (bool, Vars) {
var vars map[string]string
var c string
var e component
for _, e = range p.cmp {
c, s = splitPath(s, p.sep, false)
m, n := e.Matches(c)
if !m {
return false, nil
}
if n != "" {
if vars == nil {
vars = make(map[string]string)
}
vars[n] = c
}
... | [
-0.6873627305030823,
-0.9625614881515503,
0.5801968574523926,
-0.1555660516023636,
-1.0546869039535522,
-0.18111573159694672,
-0.07904692739248276,
0.8887044787406921,
-0.0872340276837349,
-0.6159939765930176,
-0.6331064701080322,
-0.6156499981880188,
-0.4204652011394501,
-0.10146479308605... |
func Run() {
cfg, err := config.Read()
if err != nil {
logger.WithFields(logrus.Fields{
"error": err.Error(),
}).Fatalf("cannot read configuration.")
}
logging.ConfigureLogging(cfg)
beConn, err := rpc.GRPCClientFromConfig(cfg, "api.backend")
if err != nil {
logger.Fatalf("failed to connect to Open Match... | [
-0.48209914565086365,
-0.5109683871269226,
0.9444571137428284,
-0.0991477519273758,
0.634887158870697,
0.32908499240875244,
0.8803771734237671,
0.3669884204864502,
-1.09648859500885,
0.7197079062461853,
-0.058616068214178085,
0.42963504791259766,
-0.8240196108818054,
-0.1758054494857788,
... |
func doFetch(cfg config.View, be pb.BackendClient) {
startTime := time.Now()
mprofiles := profiles.Generate(cfg)
for {
var wg sync.WaitGroup
for _, p := range mprofiles {
wg.Add(1)
go func(wg *sync.WaitGroup, p *pb.MatchProfile) {
defer wg.Done()
fetch(be, p)
}(&wg, p)
}
// Wait for all Fe... | [
0.5774029493331909,
0.4155447483062744,
0.9055492877960205,
-0.036968279629945755,
0.2141077220439911,
0.3480687141418457,
0.5430191159248352,
-0.3786389231681824,
-0.9885327816009521,
0.19437891244888306,
-0.06375646591186523,
0.04491685703396797,
-0.21822881698608398,
0.7193524837493896,... |
func doAssign(be pb.BackendClient) {
for {
match := <-matches
ids := []string{}
for _, t := range match.Tickets {
ids = append(ids, t.Id)
}
req := &pb.AssignTicketsRequest{
TicketIds: ids,
Assignment: &pb.Assignment{
Connection: fmt.Sprintf("%d.%d.%d.%d:2222", rand.Intn(256), rand.Intn(256), r... | [
-0.7823597192764282,
-0.3712770342826843,
1.0226763486862183,
-0.23280741274356842,
0.6241515874862671,
-0.31836777925491333,
0.5287607908248901,
0.13885435461997986,
-0.9362702369689941,
0.42842134833335876,
-0.03876548632979393,
-0.15758229792118073,
-1.097291350364685,
0.309819579124450... |
func doDelete(fe pb.FrontendClient) {
for {
id := <-deleteIds
req := &pb.DeleteTicketRequest{
TicketId: id,
}
if _, err := fe.DeleteTicket(context.Background(), req); err != nil {
errMsg := fmt.Sprintf("failed to delete tickets: %w", err)
errRead, ok := errMap.Load(errMsg)
if !ok {
errRead = 0... | [
-0.2424221932888031,
0.47028428316116333,
0.7317730188369751,
0.1762266457080841,
1.7448482513427734,
-0.1124582290649414,
0.19250652194023132,
-0.22812002897262573,
-0.39203712344169617,
-0.5286844968795776,
0.26186156272888184,
-0.1772705763578415,
-0.7011679410934448,
0.8016296029090881... |
func fixToFloat(x int32) float32 {
return float32(x>>6) + float32(x&0x3f)/0x3f
} | [
1.4674259424209595,
0.4830392897129059,
0.4354088008403778,
-0.39454385638237,
0.16187727451324463,
0.9490352869033813,
-0.5018720626831055,
-0.3070042133331299,
0.3074062466621399,
-0.988461434841156,
-0.8666519522666931,
-0.14535412192344666,
0.1446574628353119,
0.4580065906047821,
0.1... |
func floatToFix(x float32) int32 {
return int32(x * 64.0)
} | [
0.4001038670539856,
1.00334632396698,
0.30323776602745056,
-0.3723721206188202,
0.12063521891832352,
0.6768661141395569,
-0.33295443654060364,
-0.23018567264080048,
-0.39781656861305237,
-0.8357343673706055,
-0.8213796615600586,
0.7283726334571838,
0.32991451025009155,
0.7360497713088989,
... |
func NewClosestValidPenalty(isFeasible func(individual *base.Float64Individual) bool, adjust func(individual *base.Float64Individual) *base.Float64Individual, alpha float64, distance func(ind1, ind2 *base.Float64Individual) float64, evaluator benchmarks.Float64Evaluator) *ClosestValidPenalty {
return &ClosestValidPena... | [
0.22031277418136597,
-0.8830533623695374,
0.5191290974617004,
0.4220244586467743,
-1.7182791233062744,
0.7255926132202148,
-0.6347106099128723,
0.06639236956834793,
-0.12272987514734268,
-0.05839649960398674,
0.5565553307533264,
0.4272387623786926,
-0.53228759765625,
-0.5441239476203918,
... |
func (con *ClosestValidPenalty) AdjustAndEvolve(individual *base.Float64Individual) []float64 {
if con.isFeasible(individual) {
return con.evaluator(individual)
}
fInd := con.adjust(individual)
fAns := con.evaluator(fInd)
fWeights := individual.GetFitness().GetWeights()
weights := make([]float64, len(fWeights))... | [
-0.24542251229286194,
-0.14057593047618866,
0.971217155456543,
0.9983692169189453,
-0.3051339387893677,
0.34494271874427795,
-0.18770736455917358,
0.5705681443214417,
-0.13400450348854065,
-0.06084981560707092,
0.2685219645500183,
0.2754228413105011,
-0.3648781180381775,
0.8404639959335327... |
func (m *CloudTowerApplicationPackageWhereInput) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAND(formats); err != nil {
res = append(res, err)
}
if err := m.validateNOT(formats); err != nil {
res = append(res, err)
}
if err := m.validateOR(formats); err != nil {
res = ap... | [
0.2945769131183624,
-0.10884510725736618,
0.5519341230392456,
0.3307485580444336,
-0.24770884215831757,
0.5361462235450745,
1.061572551727295,
-0.31257933378219604,
-0.5086544156074524,
0.021003197878599167,
0.3775171637535095,
-0.30101487040519714,
-0.5822030901908875,
0.9180806875228882,... |
func (m *CloudTowerApplicationPackageWhereInput) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateAND(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateNOT(ctx, formats); err != nil {
res = append(res, err)
}
if e... | [
0.1137654259800911,
-0.2590124011039734,
0.7673547863960266,
0.2705990970134735,
-0.2940666377544403,
0.7940862774848938,
0.9640395641326904,
-0.29125362634658813,
0.29268452525138855,
0.2053729146718979,
0.39262983202934265,
-0.05389828607439995,
-0.8434340357780457,
0.5776285529136658,
... |
func AuthKeyFromBytes(key []byte) (*ecdsa.PrivateKey, error) {
var err error
// Parse PEM block
var block *pem.Block
if block, _ = pem.Decode(key); block == nil {
return nil, errors.New("token: AuthKey must be a valid .p8 PEM file")
}
// Parse the key
var parsedKey interface{}
if parsedKey, err = x509.Parse... | [
-0.15617862343788147,
-0.320525199174881,
0.33095836639404297,
-0.47099968791007996,
-0.17932237684726715,
0.03114524483680725,
-0.05687285214662552,
-0.7863489389419556,
1.1491780281066895,
0.44326233863830566,
0.13251939415931702,
-0.028317060321569443,
-0.29439249634742737,
0.2131917774... |
func GetBaseType(base interface{}) reflect.Type {
element := reflect.TypeOf(base)
if element.Kind() == reflect.Ptr {
return element.Elem()
}
return element
} | [
0.5203728675842285,
0.456033855676651,
0.48526638746261597,
0.7361481785774231,
0.7141527533531189,
0.18033762276172638,
0.6826837658882141,
-0.9830603003501892,
0.812976062297821,
-0.02667977847158909,
-0.010839033871889114,
0.5953162908554077,
-1.65684974193573,
1.0989446640014648,
1.5... |
func GetBaseValue(base interface{}) reflect.Value {
element := reflect.ValueOf(base)
if element.Kind() == reflect.Ptr {
return element.Elem()
}
return element
} | [
-0.028655463829636574,
0.11166205257177353,
0.6452702283859253,
0.9751397967338562,
-0.21313408017158508,
0.0645146369934082,
0.2634121775627136,
-0.9105184674263,
0.08349357545375824,
-0.14901040494441986,
0.35452067852020264,
1.0641535520553589,
-0.8485457897186279,
1.0775469541549683,
... |
func GetBaseTypeString(base interface{}) string {
// Need Value.Type, not TypeOf
valueOf := GetBaseValue(base)
if !valueOf.IsValid() {
typeOf := reflect.TypeOf(base)
log.Dump("Have an invalid type", base, valueOf, typeOf)
return typeOf.String()
}
return valueOf.Type().String()
} | [
-0.2797873020172119,
-0.5600035786628723,
0.617104172706604,
0.31799110770225525,
-0.010539943352341652,
0.35436853766441345,
0.45353326201438904,
-1.5806846618652344,
-0.05125684663653374,
0.3357502222061157,
0.32891538739204407,
0.22329995036125183,
-1.3739649057388306,
0.369423061609268... |
func GetChildren(input interface{}) []Child {
typeOf := reflect.TypeOf(input)
// TODO: Shouldn't need to manually ignore recursion
/*
if typeOf.String() == "big.Int" {
return []Child{}
}
*/
kind := typeOf.Kind()
switch kind {
case reflect.Struct:
return GetChildrenStruct(input)
case reflect.Map:
... | [
-0.4750559628009796,
0.3606090247631073,
0.6146736741065979,
0.5023362636566162,
-0.05328822880983353,
0.1671372801065445,
0.8379810452461243,
-1.1055943965911865,
0.7152999043464661,
-1.1629347801208496,
-0.8206263184547424,
0.9889154434204102,
-0.6312015056610107,
1.008564829826355,
0.... |
func GetChildrenStruct(input interface{}) []Child {
typeOf := reflect.TypeOf(input)
valueOf := GetBaseValue(input)
count := valueOf.NumField()
var children []Child
children = make([]Child, count)
for i := 0; i < count; i++ {
fieldType := typeOf.Field(i)
field := valueOf.Field(i)
//if element.IsValid() &... | [
-0.41525909304618835,
0.10913603752851486,
0.6581394672393799,
-0.20948439836502075,
-0.32722029089927673,
0.1342310756444931,
0.8557964563369751,
-1.0544624328613281,
0.14352475106716156,
-0.8642887473106384,
-1.2924623489379883,
-0.05768418684601784,
-0.23848401010036469,
-0.312460124492... |
func GetChildrenMap(input interface{}) []Child {
valueOf := GetBaseValue(input)
var children []Child
children = make([]Child, 0)
for _, key := range valueOf.MapKeys() {
value := valueOf.MapIndex(key)
kind := value.Kind()
name := Value2String(key)
children = append(children, Child{Name: name, Value: value... | [
-0.7781757712364197,
-0.09114883095026016,
0.5797653198242188,
0.04957384988665581,
-0.6170244216918945,
0.6145917177200317,
0.3322639763355255,
-0.7013334035873413,
0.034063056111335754,
-0.3225909471511841,
-1.2513729333877563,
0.5095760226249695,
0.22712847590446472,
0.2652184069156647,... |
func GetChildrenSlice(input interface{}) []Child {
//typeOf := reflect.TypeOf(input)
valueOf := GetBaseValue(input)
var children []Child
children = make([]Child, 0)
/*
// TODO: Check this, optimization?
if typeOf.String() == "[]byte" {
return children
}
*/
for i := 0; i < valueOf.Len(); i++ {
value... | [
-0.9219887256622314,
0.40090930461883545,
0.5842606425285339,
0.40127813816070557,
-0.16830642521381378,
-0.40826666355133057,
-0.002333309268578887,
-1.3387030363082886,
-0.347730815410614,
-0.22738488018512726,
-0.6530271768569946,
0.7647560834884644,
-0.19262690842151642,
0.488402992486... |
func GetChildrenArray(input interface{}) []Child {
valueOf := GetBaseValue(input)
var children []Child
children = make([]Child, 0)
for i := 0; i < valueOf.Len(); i++ {
value := valueOf.Index(i).Interface()
kind := reflect.ValueOf(value).Kind()
name := fmt.Sprintf("%d", i)
children = append(children, Chil... | [
-0.971848726272583,
-0.24123398959636688,
0.7066455483436584,
0.02591271884739399,
-0.07502123713493347,
0.29475972056388855,
0.4561980366706848,
-1.3870750665664673,
-0.40573588013648987,
-0.0845143124461174,
-0.824977457523346,
0.8478430509567261,
-0.5117214918136597,
0.866496741771698,
... |
func Iterate(input interface{}, action *Action, depth int) interface{} {
// TODO: add in cycle detection
// Initialize on first call
if action.Processed == nil {
action.Processed = make(map[string]Parameters, 0)
action.Path = *NewStack()
action.Path.Push("root")
}
// Some types of not implemented
if IsDif... | [
-0.7138625383377075,
0.01937568187713623,
0.876005232334137,
0.29037854075431824,
-0.2391546666622162,
-0.3656853437423706,
1.3132573366165161,
-0.6028892397880554,
-0.03279847651720047,
0.3947044312953949,
0.5730598568916321,
0.5697435736656189,
-0.47998568415641785,
0.6691878437995911,
... |
func FillAliases(a *Aliases, tables []drivers.Table) {
if a.Tables == nil {
a.Tables = make(map[string]TableAlias)
}
for _, t := range tables {
if t.IsJoinTable {
jt, ok := a.Tables[t.Name]
if !ok {
a.Tables[t.Name] = TableAlias{Relationships: make(map[string]RelationshipAlias)}
} else if jt.Relati... | [
-0.5630934238433838,
0.18591487407684326,
0.8877598643302917,
-0.4412647485733032,
-0.44996142387390137,
0.4070701003074646,
0.30478325486183167,
0.1333102583885193,
-0.13960127532482147,
0.1916790008544922,
0.2620615065097809,
-0.4506620764732361,
0.359247088432312,
1.0106712579727173,
... |
func (a Aliases) Table(table string) TableAlias {
t, ok := a.Tables[table]
if !ok {
panic("could not find table aliases for: " + table)
}
return t
} | [
0.8107969760894775,
-0.452848345041275,
0.13194580376148224,
0.47192656993865967,
-0.4270588457584381,
0.30084463953971863,
-0.2432992160320282,
-0.0957123339176178,
-0.01791742816567421,
0.5312429666519165,
0.45638686418533325,
0.013189692050218582,
0.8140967488288879,
-0.0352959632873535... |
func (t TableAlias) Column(column string) string {
c, ok := t.Columns[column]
if !ok {
panic(fmt.Sprintf("could not find column alias for: %s.%s", t.UpSingular, column))
}
return c
} | [
0.21609072387218475,
-0.8914198875427246,
0.33553069829940796,
0.47756272554397583,
-0.10924659669399261,
-0.10694997757673264,
0.8879119157791138,
-0.3655783534049988,
-0.2540108859539032,
0.7079229950904846,
0.16309547424316406,
0.21159270405769348,
1.121224284172058,
0.212662473320961,
... |
func (t TableAlias) Relationship(fkey string) RelationshipAlias {
r, ok := t.Relationships[fkey]
if !ok {
panic(fmt.Sprintf("could not find relationship alias for: %s.%s", t.UpSingular, fkey))
}
return r
} | [
-0.3905493915081024,
0.05828249454498291,
0.38178586959838867,
0.39545896649360657,
-0.3202360272407532,
-0.06202363967895508,
-0.26563024520874023,
-0.8070967793464661,
0.26720067858695984,
0.7153238654136658,
0.8535134196281433,
-0.6687538623809814,
0.2850324511528015,
0.4549326598644256... |
func (a Aliases) ManyRelationship(table, fkey, joinTable, joinTableFKey string) RelationshipAlias {
var lookupTable, lookupFKey string
if len(joinTable) != 0 {
lookupTable, lookupFKey = joinTable, joinTableFKey
} else {
lookupTable, lookupFKey = table, fkey
}
t := a.Table(lookupTable)
return t.Relationship(l... | [
-0.8211661577224731,
-0.3081088960170746,
0.7117281556129456,
0.5129522085189819,
-0.22803731262683868,
-0.3028113842010498,
-0.8454319834709167,
0.4674839675426483,
-0.02109951339662075,
0.14212852716445923,
0.4460487961769104,
-0.7618674635887146,
0.3176884651184082,
0.23163379728794098,... |
func NewSquare10() *Square10 {
randomTiles := [100]api.Color{}
for id := range randomTiles {
randomTiles[id] = api.Color(rand.Intn(len(api.Color_name)))
}
for _, next := range []int{1, 10, 89, 98} {
for randomTiles[next] == randomTiles[0] || randomTiles[next] == randomTiles[99] {
randomTiles[next]++
if ra... | [
-0.12238167226314545,
-0.8970195651054382,
0.37004151940345764,
-0.6469999551773071,
0.47460949420928955,
-0.8092013001441956,
0.2891186475753784,
0.6576363444328308,
0.6809400320053101,
0.033394768834114075,
-0.2973005473613739,
0.042088039219379425,
0.5016955733299255,
0.5558202266693115... |
func (e *Square10) CurrentBoard(referencePlayer int) []api.Color {
referenceBoard := [100]api.Color{}
for tile, color := range e.tiles {
targetID := referencePlayer*99 - tile*(referencePlayer*2-1)
referenceBoard[targetID] = color
}
return referenceBoard[:]
} | [
-1.287458896636963,
-0.4624605178833008,
0.47895434498786926,
-0.04164951294660568,
0.3663002848625183,
-0.1644323319196701,
0.7988390922546387,
0.07953180372714996,
0.6973097324371338,
0.9104249477386475,
-0.029957067221403122,
0.8267418146133423,
-0.13249656558036804,
1.0618947744369507,... |
func (e *Square10) Reference(modifiers map[int]api.Color, refPlayer int) map[int]api.Color {
referenceBoard := make(map[int]api.Color, len(modifiers))
for tile, color := range modifiers {
targetID := refPlayer*99 - tile*(refPlayer*2-1)
referenceBoard[targetID] = color
}
return referenceBoard
} | [
-1.0673627853393555,
-0.22462958097457886,
0.5529898405075073,
-0.8484586477279663,
0.487993448972702,
-0.36330515146255493,
0.45524996519088745,
-0.18309196829795837,
0.4622032940387726,
0.8515040874481201,
0.18658505380153656,
0.4194161891937256,
-0.07716048508882523,
0.6590474247932434,... |
func (e *Square10) ProcessMove(player int, newColor api.Color) (map[int]api.Color, error) {
if player != e.turnPlayer {
return nil, fmt.Errorf("invalid player, this should be caught in game.go")
}
if newColor == e.tiles[0] || newColor == e.tiles[99] {
return nil, fmt.Errorf("illegal move: no player's current col... | [
-0.9248282313346863,
-0.7926381230354309,
0.7275744080543518,
-0.5164824724197388,
0.34525778889656067,
-1.1400260925292969,
0.2803628146648407,
-0.02865660935640335,
0.2558020353317261,
0.8729696869850159,
0.02536149136722088,
0.19707638025283813,
-0.38857531547546387,
0.4227624535560608,... |
func (e *Square10) DetermineWinner() int {
score := []int{0, 0}
for _, owner := range e.ownership {
if owner == contested {
continue
}
score[owner]++
}
for player, points := range score {
if points+player > 50 {
return player
}
}
return -1
} | [
-0.7719058990478516,
-0.5951699614524841,
0.5775949954986572,
0.5761223435401917,
0.4502190053462982,
-0.9567342400550842,
0.9536945819854736,
0.17822657525539398,
0.32921451330184937,
0.12448456138372421,
0.08773209154605865,
0.1295912116765976,
0.13477559387683868,
0.7001392245292664,
... |
func NewServiceFactoryRegistry() *ServiceFactoryRegistry {
return &ServiceFactoryRegistry{
goals: make(map[string]*int),
}
} | [
-0.31923869252204895,
0.3388260006904602,
-0.18052859604358673,
1.071168065071106,
-0.13320325314998627,
-0.7837913036346436,
0.6196423172950745,
0.055995069444179535,
-0.6798091530799866,
-0.781650185585022,
-0.6238633990287781,
0.36891260743141174,
0.6448707580566406,
0.3052819073200226,... |
func (r *ServiceFactoryRegistry) Register(goals []string, factory ServiceFactory) {
// add factory
factoryIndex := len(r.factories)
r.factories = append(r.factories, factory)
// point goals to new factory
for _, goal := range goals {
if r.goals[goal] != nil {
panic(fmt.Sprintf("goal '%s' was previously defin... | [
-0.9445493817329407,
0.5991206765174866,
0.3441857099533081,
0.8487994074821472,
0.8222707509994507,
0.2775471806526184,
-0.028011569753289223,
-0.175818532705307,
-0.7544523477554321,
-0.1782510131597519,
-0.1701747626066208,
0.41965949535369873,
0.16501584649085999,
0.1559455245733261,
... |
func (r *ServiceFactoryRegistry) Goals() []string {
var goals []string
for name, _ := range r.goals {
goals = append(goals, name)
}
return goals
} | [
-0.7786778211593628,
0.4282965064048767,
0.20532777905464172,
1.0512595176696777,
0.22073878347873688,
0.9409977197647095,
-0.9468106031417847,
-0.583060622215271,
-0.4016406238079071,
0.1360381841659546,
-0.5171581506729126,
0.4278399646282196,
0.1665668785572052,
0.6781945824623108,
0.... |
func (r *ServiceFactoryRegistry) CreateServices(goals []string, facts *Facts) (*ServiceRegistry, error) {
services := ServiceRegistry{}
for _, goal := range goals {
if r.goals[goal] == nil {
return nil, errors.New(fmt.Sprintf("no service available for '%s'", goal))
}
if services[goal] == nil {
factoryInd... | [
-0.7518196702003479,
0.7937366962432861,
0.24750512838363647,
0.6116142868995667,
0.7007431983947754,
0.4030916690826416,
0.19837430119514465,
-0.48338809609413147,
-0.7989402413368225,
-0.19126150012016296,
0.805438220500946,
-0.7362036108970642,
-0.06386776268482208,
1.0132029056549072,
... |
func RegisterService(goals []string, factory ServiceFactory) {
serviceFactories.Register(goals, factory)
} | [
-0.4885089695453644,
0.6545270681381226,
0.08941750973463058,
1.4067585468292236,
1.2090009450912476,
0.40296536684036255,
-0.5873889327049255,
-0.07988771051168442,
-0.6325479745864868,
-0.40248903632164,
-0.6216577887535095,
0.5905053615570068,
0.515899121761322,
0.8312592506408691,
-0... |
func ServiceFactories() ServiceFactoryRegistry {
return serviceFactories
} | [
-0.12962792813777924,
0.8735859990119934,
0.18998990952968597,
0.5529333353042603,
-0.025374656543135643,
-0.5609538555145264,
0.8069080710411072,
-0.1734507828950882,
0.41378840804100037,
-0.9222809076309204,
-0.9297962188720703,
0.6462313532829285,
-0.11135279387235641,
0.020368983969092... |
func Run(ctx context.Context) error {
ctx, cancel := context.WithCancel(ctx)
logger := log.WithContext(nil)
tester := server.Prepare(&server.Options{
Name: "tester",
InsecureAddr: viper.GetString(options.FlagServerInsecureBindAddress.GetLong()),
SecureAddr: viper.GetString(options.FlagServerSecureBi... | [
0.4882560968399048,
0.07337241619825363,
0.9229984879493713,
0.23959442973136902,
0.4447198808193207,
0.8072873950004578,
1.159422516822815,
-0.3424212634563446,
-0.6434808969497681,
-0.13434292376041412,
0.189412459731102,
0.5432440638542175,
-1.2080979347229004,
0.823436975479126,
0.42... |
func (c *Client) GetBlueprintDetails(projectID string, blueprintID string, ret *BlueprintDetails) error {
path := fmt.Sprintf("projects/%s/blueprints/%s", projectID, blueprintID)
return c.makeGetRequest(path, ret, nil)
} | [
-0.14181271195411682,
0.11522463709115982,
0.5955449938774109,
0.1416044533252716,
0.5957567095756531,
-0.14923274517059326,
-0.7262680530548096,
-0.7135154604911804,
-0.1329331248998642,
-0.11518948525190353,
-0.5174079537391663,
1.9538166522979736,
-1.6493463516235352,
0.3989565372467041... |
func (c *Client) GetProjects(ret *[]Project) error {
return c.makeGetRequest("projects", ret, nil)
} | [
-1.1355273723602295,
1.2997909784317017,
0.25182706117630005,
0.7133080363273621,
1.1901776790618896,
-0.1973811835050583,
-0.14583249390125275,
-1.4300929307937622,
0.5504302382469177,
-0.3189166486263275,
-0.3723294138908386,
0.7307080626487732,
-1.9361050128936768,
-0.01728946901857853,... |
func (c *Client) GetProjectDetails(projectID string, ret *ProjectDetails) error {
path := fmt.Sprintf("projects/%s", projectID)
return c.makeGetRequest(path, ret, nil)
} | [
-0.2704790234565735,
1.2424962520599365,
0.26998022198677063,
0.4915156066417694,
0.6008898019790649,
-0.08443298190832138,
-0.5682206749916077,
-0.8173980712890625,
0.4798356294631958,
0.18433794379234314,
-0.29552966356277466,
0.2922142446041107,
-1.8911867141723633,
0.17958545684814453,... |
func (c *Client) GetBlueprints(projectID string, ret *[]Blueprint) error {
path := fmt.Sprintf("projects/%s/blueprints", projectID)
return c.makeGetRequest(path, ret, nil)
} | [
-1.1136305332183838,
0.4234062135219574,
0.4102751910686493,
0.5451868772506714,
0.725505530834198,
-0.40541860461235046,
-0.4052867591381073,
-1.3165283203125,
-0.0894552543759346,
0.5298190116882324,
-0.3897210657596588,
1.4419801235198975,
-2.5816142559051514,
0.7365567088127136,
0.24... |
func (c *Client) GetPolicies(projectID string, ret *[]Policy) error {
path := fmt.Sprintf("projects/%s/policies", projectID)
return c.makeGetRequest(path, ret, nil)
} | [
-0.8012488484382629,
0.9013477563858032,
0.06312142312526703,
0.1345779299736023,
1.0504708290100098,
0.39272573590278625,
-0.8343194723129272,
-0.7908997535705566,
0.37074291706085205,
0.37408509850502014,
0.050426192581653595,
0.18524016439914703,
-1.8865967988967896,
0.47169604897499084... |
func (c *Client) GetEnvironments(brief bool, criteria string, ret *Environments) error {
query := url.Values{}
query.Add("brief", strconv.FormatBool(brief))
query.Add("criteria", criteria)
return c.makeGetRequest("envs", ret, &query)
} | [
-0.785954475402832,
1.1742897033691406,
0.3718019425868988,
0.4683016240596771,
0.5331461429595947,
-0.3945388197898865,
-0.15917468070983887,
-0.3530416786670685,
0.13918684422969818,
0.29642927646636963,
0.34368881583213806,
0.660171627998352,
-0.915862500667572,
0.31660890579223633,
-... |
func (c *Client) GetEnvironment(id string, permission string, ret *Environment) error {
path := fmt.Sprintf("envs/%s", id)
query := url.Values{}
query.Add("permission", permission)
return c.makeGetRequest(path, ret, &query)
} | [
-0.6532756090164185,
0.4732607305049896,
0.3597204089164734,
0.6258894801139832,
0.5714473128318787,
-0.9756057262420654,
0.13317762315273285,
-0.37699103355407715,
0.25898435711860657,
0.6184298992156982,
0.5681889653205872,
0.8645206093788147,
-1.0535557270050049,
-0.33607494831085205,
... |
func (c *Client) GetEnvironmentExtended(id string, ret *EnvironmentExtended) error {
query := url.Values{}
query.Add("envId", id)
return c.makeGetRequest("envs/actions/getextended", ret, &query)
} | [
-0.3453257977962494,
0.48251593112945557,
0.37455958127975464,
0.5202711820602417,
-0.1061977818608284,
0.013245818205177784,
-0.3475342094898224,
-0.2866281270980835,
0.7835586667060852,
0.940257728099823,
-0.699304461479187,
1.7719424962997437,
-0.8754674792289734,
0.6028204560279846,
... |
func (c *Client) EnvironmentCreateFromTemplate(request *EnvironmentTemplateRequest, response *CreateTemplateEnvResponse) error {
return c.makePostRequest("envs", response, nil, request)
} | [
-0.7092117667198181,
-0.0840255543589592,
0.1278071403503418,
0.05127408355474472,
0.08697043359279633,
0.3655320703983307,
0.20911332964897156,
-0.6351920366287231,
-0.3728095591068268,
0.4171070158481598,
-0.1734476387500763,
-0.4840809106826782,
-0.5220721960067749,
0.6627053022384644,
... |
func (c *Client) EnvironmentResume(envID string) error {
return c.envPutActionByID("resume", envID)
} | [
-0.37316814064979553,
-0.3046019971370697,
0.21298572421073914,
-0.487612247467041,
0.0006760954856872559,
0.39480453729629517,
0.2929779589176178,
-0.7601514458656311,
-0.3058268129825592,
0.8329543471336365,
-0.36736854910850525,
1.0592526197433472,
-0.6535667777061462,
-0.80653309822082... |
func (c *Client) EnvironmentSuspend(envID string) error {
return c.envPutActionByID("suspend", envID)
} | [
-1.0638481378555298,
-0.8337002396583557,
0.254950612783432,
-1.169276475906372,
-0.09565693885087967,
0.5384974479675293,
1.010933518409729,
-0.8119300603866577,
-0.11017608642578125,
1.22927987575531,
-0.9412263631820679,
0.35013532638549805,
-0.6866599321365356,
0.483511358499527,
0.2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.