text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func BadRequest(w http.ResponseWriter, r *http.Request, format interface{}, args ...interface{}) {
var message string
switch v := format.(type) {
case string:
message = v
case error:
message = v.Error()
case fmt.Stringer:
message = v.String()
default:
dvid.Criticalf("BadRequest called with unknown format ... | [
-1.0556342601776123,
-0.9277417063713074,
0.7159605622291565,
0.012825362384319305,
0.8828442692756653,
-0.30154478549957275,
-0.6787909865379333,
-0.39577531814575195,
-0.23987050354480743,
-0.47724586725234985,
1.3605973720550537,
0.7319932579994202,
0.15095919370651245,
0.94942468404769... |
func DecodeJSON(r *http.Request) (dvid.Config, error) {
c := dvid.NewConfig()
if err := c.SetByJSON(r.Body); err != nil {
return dvid.Config{}, fmt.Errorf("Malformed JSON request in body: %v", err)
}
return c, nil
} | [
-1.7192171812057495,
0.2606937885284424,
0.4571976959705353,
-0.18906289339065552,
-0.723943829536438,
-0.878105878829956,
-0.37903735041618347,
-0.5644866824150085,
0.23500744998455048,
0.36104923486709595,
-0.6207643747329712,
0.48626670241355896,
-0.2226329743862152,
0.9820340275764465,... |
func corsValidator(origin string) bool {
if len(corsDomains) == 0 {
return false
}
u, err := url.Parse(origin)
if err != nil {
dvid.Errorf("got bad origin %q for request: %v\n", origin, err)
return false
}
hostnameParts := strings.Split(u.Hostname(), ".")
numParts := len(hostnameParts)
if numParts < 2 {
... | [
-0.9990448951721191,
-0.4190642237663269,
0.8046966791152954,
-0.8531153798103333,
-1.5238109827041626,
0.19385141134262085,
-0.14190839231014252,
0.3565264344215393,
-0.07424643635749817,
-0.6304896473884583,
0.5217746496200562,
0.7399539351463318,
-0.01999022252857685,
0.4580957293510437... |
func adminPrivHandler(c *web.C, h http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
var adminPriv bool
if len(adminToken) != 0 {
queryAdminToken := r.URL.Query().Get("admintoken")
adminPriv = (queryAdminToken == adminToken)
}
c.Env["adminPriv"] = adminPriv
h.ServeHTTP(w,... | [
0.09654249250888824,
-0.25241854786872864,
0.49301961064338684,
-0.48207876086235046,
-0.8915057182312012,
0.2650536894798279,
-0.680396318435669,
-0.4915631413459778,
0.19532310962677002,
-0.12211701273918152,
0.34986260533332825,
0.5292340517044067,
-1.02306067943573,
0.39889955520629883... |
func repoRawSelector(c *web.C, h http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
method := strings.ToLower(r.Method)
adminPriv := c.Env["adminPriv"].(bool)
if !adminPriv && readonly && method != "get" && method != "head" {
BadRequest(w, r, "Server in read-only mode and will o... | [
-1.250789999961853,
-0.5971164703369141,
0.5366190075874329,
-0.41699910163879395,
-0.9869043827056885,
0.23128920793533325,
-0.12801317870616913,
0.004284859634935856,
0.13026030361652374,
0.4388490319252014,
0.10816922038793564,
0.8135988712310791,
-0.12176524847745895,
0.437282651662826... |
func nodeSelector(c *web.C, h http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
uuid, ok := c.Env["uuid"].(dvid.UUID)
if !ok {
msg := fmt.Sprintf("Bad format for UUID %q\n", c.Env["uuid"])
BadRequest(w, r, msg)
return
}
// Make sure locked nodes can't use anything besid... | [
-1.0285167694091797,
-0.21818576753139496,
0.4757954180240631,
-0.3925635814666748,
-0.14569327235221863,
-0.7194745540618896,
0.1516396552324295,
-0.659969687461853,
0.05451492592692375,
0.5725207328796387,
0.8720424175262451,
0.771875262260437,
-0.28439947962760925,
0.02615964040160179,
... |
func repoSelector(c *web.C, h http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
method := strings.ToLower(r.Method)
adminPriv := c.Env["adminPriv"].(bool)
if !adminPriv && readonly && method != "get" && method != "head" {
BadRequest(w, r, "Server in read-only mode and will only... | [
-1.4548648595809937,
-0.3536827862262726,
0.562746524810791,
-0.4912290871143341,
-0.4656396508216858,
0.09259805083274841,
0.004570018965750933,
0.3402262032032013,
0.11425399035215378,
0.5616212487220764,
0.3848641514778137,
0.41382676362991333,
-0.38799381256103516,
-0.02395832538604736... |
func instanceSelector(c *web.C, h http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
t0 := time.Now()
var err error
dataname := dvid.InstanceName(c.URLParams["dataname"])
uuid, ok := c.Env["uuid"].(dvid.UUID)
if !ok {
msg := fmt.Sprintf("Bad format for UUID %q\n", c.Env["uui... | [
-0.650371253490448,
-0.3750341534614563,
0.9003944993019104,
-0.17465583980083466,
-0.48349037766456604,
0.1739429384469986,
0.43088752031326294,
-0.18555337190628052,
0.08580301702022552,
0.4798504114151001,
0.43135377764701843,
0.5985779166221619,
-0.6394430994987488,
1.1651197671890259,... |
func helpHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html")
hostname, err := os.Hostname()
if err != nil {
hostname = "Unknown host"
}
// Get help from all compiled-in data types.
typenames := make([]string, len(datastore.Compiled))
i := 0
for _, typeservice := rang... | [
0.20229412615299225,
0.08055443316698074,
0.7253798246383667,
-0.4454507827758789,
-0.15273286402225494,
0.7433080077171326,
0.6449282169342041,
0.3954562842845917,
-0.8707333207130432,
0.27952784299850464,
0.3607899248600006,
0.5772982239723206,
0.11576791107654572,
0.5240216255187988,
... |
func mainHandler(w http.ResponseWriter, r *http.Request) {
path := r.URL.Path
// Serve from embedded files in executable if not web client directory was specified
if WebClient() == "" {
if len(path) > 0 && path[0:1] == "/" {
path = path[1:]
}
dvid.Debugf("[%s] Serving from embedded files: %s\n", r.Method, ... | [
-0.12129119038581848,
-0.39980459213256836,
1.1561616659164429,
0.8375898003578186,
0.17861907184123993,
0.6249260902404785,
1.220676302909851,
0.09061634540557861,
-0.13813896477222443,
-0.3946346044540405,
0.7149560451507568,
-0.27479639649391174,
-0.0010277496185153723,
0.69707447290420... |
func reposPostHandler(c web.C, w http.ResponseWriter, r *http.Request) {
adminPriv := c.Env["adminPriv"].(bool)
if !adminPriv && readonly {
BadRequest(w, r, "Cannot POST on repos endpoints in read-only mode")
return
}
config := dvid.NewConfig()
if r.Body != nil {
if err := config.SetByJSON(r.Body); err != ni... | [
-0.7718569040298462,
0.2947169244289398,
0.6243153810501099,
-0.26545488834381104,
-0.383441299200058,
0.2853374481201172,
-0.11100220680236816,
0.5232030749320984,
-0.6508882641792297,
0.6836142539978027,
-0.32456541061401367,
-0.5272136926651001,
0.10845853388309479,
0.2616487145423889,
... |
func repoNewVersionHandler(c web.C, w http.ResponseWriter, r *http.Request) {
uuid := c.Env["uuid"].(dvid.UUID)
jsonData := struct {
Note string `json:"note"`
UUID string `json:"uuid"`
}{}
if r.Body != nil {
data, err := ioutil.ReadAll(r.Body)
if err != nil {
BadRequest(w, r, err)
return
}
if le... | [
-0.595117449760437,
0.08972012251615524,
0.8292914032936096,
-0.0436706505715847,
-0.3969797194004059,
0.07471023499965668,
0.49551746249198914,
-0.2672213613986969,
-0.9565917253494263,
1.494580626487732,
-1.0538876056671143,
0.08568723499774933,
0.23391036689281464,
-0.3178858160972595,
... |
func People_status_get_user_status() {
// GET /people/{user_id}/
} | [
-0.3707388937473297,
-0.9022116661071777,
0.08905287086963654,
0.444723904132843,
-0.15662871301174164,
-0.001616945955902338,
-0.4091251492500305,
0.34320521354675293,
-0.3906118869781494,
-1.0702712535858154,
-0.4137594401836395,
0.7087771892547607,
0.29883524775505066,
0.076611518859863... |
func cruop(data uintptr, cursor *uint32) (byte, uint32, uint32) {
addr := uintptr(*cursor) * 8
*cursor++
return *(*byte)(unsafe.Pointer(data + addr + 7)),
*(*uint32)(unsafe.Pointer(data + addr + 4)) & 0x00ffffff,
*(*uint32)(unsafe.Pointer(data + addr))
} | [
0.09874488413333893,
0.2578555643558502,
0.8196568489074707,
-0.5497624278068542,
-0.3863784074783325,
-0.4860048294067383,
-0.027311166748404503,
0.4219878613948822,
0.4160001873970032,
0.5276162624359131,
-0.036677878350019455,
0.26593920588493347,
-0.22110134363174438,
-1.33781445026397... |
func (c *Client) RemoveContainer(opts RemoveContainerOptions) error {
path := "/containers/" + opts.ID + "?" + queryString(opts)
resp, err := c.do(http.MethodDelete, path, doOptions{context: opts.Context})
if err != nil {
var e *Error
if errors.As(err, &e) && e.Status == http.StatusNotFound {
return &NoSuchCo... | [
-1.0758931636810303,
0.1869868040084839,
0.5941669344902039,
-0.12320830672979355,
0.5392045974731445,
-0.6182670593261719,
0.33865898847579956,
-0.24757765233516693,
0.29127219319343567,
-0.2500772774219513,
0.45956751704216003,
0.23229417204856873,
-0.9860391616821289,
0.5552270412445068... |
func TestTriggerController(t *testing.T) {
config, stopFn := framework.RunControlPlane(t)
defer stopFn()
ctx, cancel := context.WithTimeout(context.TODO(), time.Second*20)
defer cancel()
fakeClock := &fakeclock.FakeClock{}
// Build, instantiate and run the trigger controller.
kubeClient, factory, cmCl, cmFacto... | [
1.0366020202636719,
0.12697799503803253,
0.6144773960113525,
-0.4383317828178406,
0.4509028196334839,
0.08647702634334564,
0.6513331532478333,
0.12505726516246796,
-0.03075786493718624,
-0.44142651557922363,
-1.0554890632629395,
0.08596289157867432,
-0.17610807716846466,
0.0720008164644241... |
func CntSents(text string) int {
cnt := 0
wasEnd := false
text = strings.TrimSpace(text) + " "
for _, char := range text {
if char == '.' || char == '?' || char == '!' {
wasEnd = true
} else if unicode.IsLetter(char) {
wasEnd = false
} else if wasEnd && unicode.IsSpace(char) {
cnt++
wasEnd = false... | [
0.6536150574684143,
-0.3031560480594635,
0.7408047318458557,
-0.23649130761623383,
-0.5568439364433289,
-0.2534937560558319,
0.17826983332633972,
-0.3433833122253418,
0.32298582792282104,
0.8081970810890198,
-0.3679899573326111,
0.3053641617298126,
-0.0289373267441988,
1.0544673204421997,
... |
func NewLabelService(concertoService utils.ConcertoService) (*LabelService, error) {
if concertoService == nil {
return nil, fmt.Errorf("must initialize ConcertoService before using it")
}
return &LabelService{
concertoService: concertoService,
}, nil
} | [
-0.7159166932106018,
-0.5531590580940247,
0.23196673393249512,
-0.6389235258102417,
-1.1020445823669434,
0.719927191734314,
-0.38376450538635254,
-0.9342663884162903,
0.2697983980178833,
-0.2288483828306198,
-0.3316507041454315,
0.8019266128540039,
-0.9744843244552612,
1.4109302759170532,
... |
func (lbl *LabelService) GetLabelList() (labels []*types.Label, err error) {
log.Debug("GetLabelList")
data, status, err := lbl.concertoService.Get("/labels")
if err != nil {
return nil, err
}
if err = utils.CheckStandardStatus(status, data); err != nil {
return nil, err
}
if err = json.Unmarshal(data, &l... | [
-0.8776174783706665,
-0.30214983224868774,
0.5522483587265015,
0.07247226685285568,
-0.04638954997062683,
0.3861854672431946,
-1.083850622177124,
-0.4489574730396271,
0.5100895166397095,
0.3995741903781891,
-0.07003866136074066,
0.8097612857818604,
-0.7597600221633911,
1.049115538597107,
... |
func (lbl *LabelService) CreateLabel(labelVector *map[string]interface{}) (label *types.Label, err error) {
log.Debug("CreateLabel")
data, status, err := lbl.concertoService.Post("/labels/", labelVector)
if err != nil {
return nil, err
}
if err = utils.CheckStandardStatus(status, data); err != nil {
return n... | [
-0.9894769787788391,
-0.4482673704624176,
0.5578365325927734,
-0.015070038847625256,
0.27801084518432617,
1.1376457214355469,
-0.038782134652137756,
-1.3040035963058472,
0.40965569019317627,
0.3394888639450073,
-0.3101385235786438,
0.2831968367099762,
-1.524040937423706,
-0.043091297149658... |
func (lbl *LabelService) AddLabel(labelVector *map[string]interface{}, labelID string) (labeledResources []*types.LabeledResource, err error) {
log.Debug("AddLabel")
data, status, err := lbl.concertoService.Post(fmt.Sprintf("/labels/%s/resources", labelID), labelVector)
if err != nil {
return nil, err
}
if err... | [
-1.3026171922683716,
-0.43362194299697876,
0.5806506872177124,
-0.000009539163329463918,
0.38923534750938416,
0.663892388343811,
-0.7161405086517334,
-0.3576384484767914,
0.8408717513084412,
0.567459762096405,
0.09057636559009552,
0.5144361257553101,
-1.079228401184082,
0.8635953664779663,... |
func (lbl *LabelService) RemoveLabel(labelID string, resourceType string, resourceID string) error {
log.Debug("RemoveLabel")
data, status, err := lbl.concertoService.Delete(fmt.Sprintf("/labels/%s/resources/%s/%s", labelID, resourceType, resourceID))
if err != nil {
return err
}
if err = utils.CheckStandardSt... | [
-0.8072376251220703,
-0.6463177800178528,
0.32507845759391785,
-0.11910580098628998,
0.09470085054636002,
0.9162367582321167,
-0.10974600911140442,
0.4700452983379364,
0.3247034549713135,
0.6018735766410828,
0.36151936650276184,
0.419748991727829,
-0.9952632784843445,
0.2609303593635559,
... |
func HaveJSONPointer(p string) HaveJSONPointerMatcher {
return HaveJSONPointerMatcher{p: p}
} | [
0.21056587994098663,
-1.266265869140625,
0.6139176487922668,
-0.5767797231674194,
-1.2731763124465942,
-0.13951125741004944,
-0.3981502056121826,
-0.4046595096588135,
0.49058911204338074,
-0.06084633618593216,
0.1954841911792755,
-0.46960562467575073,
-0.5645853877067566,
0.495551735162735... |
func (m HaveJSONPointerMatcher) Match(actual interface{}) (bool, error) {
switch t := actual.(type) {
default:
return false, fmt.Errorf("not a Data object. Have you done unstructured.Parse[JSON|YAML](...)?")
case unstructured.Data:
return t.HasPointer(m.p)
}
} | [
-0.5771995186805725,
-0.5467522740364075,
0.726013720035553,
-0.12899477779865265,
-0.3893708288669586,
0.47759631276130676,
0.005690140649676323,
-0.001220915699377656,
-0.4868084490299225,
-0.1588832437992096,
0.1309361606836319,
-0.19466683268547058,
-0.19695359468460083,
0.854741156101... |
func (m HaveJSONPointerMatcher) FailureMessage(actual interface{}) (message string) {
actualString := fmt.Sprintf("%+v", actual)
return fmt.Sprintf("expected '%s' to be a unstructured.Data object with pointer '%s'",
truncateString(actualString),
m.p)
} | [
-0.5244215130805969,
-0.48920929431915283,
0.3352431356906891,
-1.2129924297332764,
0.11448175460100174,
-0.05682413652539253,
-0.025029804557561874,
-0.740062415599823,
-0.15447485446929932,
-0.013883398845791817,
0.3883468806743622,
-0.04876062646508217,
-0.30985039472579956,
1.079709649... |
func (m HaveJSONPointerMatcher) NegatedFailureMessage(actual interface{}) (message string) {
actualString := fmt.Sprintf("%+v", actual)
return fmt.Sprintf("expected '%s' not to contain the pointer '%s'",
truncateString(actualString),
m.p)
} | [
-0.4560043513774872,
-0.4370752274990082,
0.317263662815094,
-0.9416047930717468,
-0.18899253010749817,
0.3797380328178406,
-0.20000456273555756,
-0.1764887571334839,
-0.3145274817943573,
-0.19562405347824097,
0.48251864314079285,
0.036257725208997726,
-0.7837540507316589,
0.84916859865188... |
func NewFunction(fnLit *ast.FunctionLiteral, env *Environment) *Function {
return &Function{
Parameters: fnLit.Parameters,
Body: fnLit.Body,
Env: env,
}
} | [
0.027496203780174255,
-0.4899426996707916,
0.2815023958683014,
-0.7977267503738403,
-0.12104370445013046,
-0.5273044109344482,
-0.9948238134384155,
0.27024897933006287,
-0.6128036379814148,
-0.19049163162708282,
-0.08566512912511826,
0.9417033791542053,
0.7274082899093628,
-0.3506480157375... |
func CPULoadHandler(res http.ResponseWriter, req *http.Request) {
log.Println("Entered CPULoadHandler")
flusher, ok := res.(http.Flusher)
if !ok {
http.Error(res, "Server does not support flusher", http.StatusInternalServerError)
return
}
sleepTime := parseOrDefault(req, "seconds", 10)
fmt.Fprintf(res, "Star... | [
-0.4858967363834381,
0.5135337114334106,
0.7920408248901367,
0.0064874994568526745,
-0.6117919683456421,
0.10191228240728378,
0.1850592941045761,
-0.8838727474212646,
-0.6050782203674316,
0.21933256089687347,
-0.5019938945770264,
-0.3707752525806427,
-0.93635493516922,
-0.02769058942794799... |
func NewMemLoadHandler(res http.ResponseWriter, req *http.Request) {
log.Println("Entered NewMemLoadHandler")
flusher, ok := res.(http.Flusher)
if !ok {
http.Error(res, "Server does not support flusher", http.StatusInternalServerError)
return
}
memUsed := parseOrDefault(req, "mib", 1000)
fmt.Fprintf(res, "S... | [
0.2637024223804474,
-0.5484681129455566,
0.8210453987121582,
0.0895734429359436,
-0.5743169784545898,
0.27440938353538513,
0.37190675735473633,
-0.34699514508247375,
0.5184484720230103,
0.31051114201545715,
-0.3715725243091583,
0.1931576132774353,
-1.7999721765518188,
0.9688997268676758,
... |
func ListRoutesHandler(res http.ResponseWriter, req *http.Request) {
paths := "paths: / , cpu , newmem , pet , pupulate , depupulate"
messageResponseJSON(res, http.StatusOK, paths)
return
} | [
-0.5187299251556396,
-0.23752376437187195,
0.4512747824192047,
-0.14691482484340668,
0.2683231830596924,
-0.18490566313266754,
0.08054091036319733,
0.27732616662979126,
-0.009816460311412811,
0.06490006297826767,
-0.26002007722854614,
-0.7629401683807373,
-0.5970554351806641,
0.34749943017... |
func PetHandler(res http.ResponseWriter, req *http.Request) {
switch req.Method {
case http.MethodGet:
handlePetGet(res, req)
case http.MethodPost:
handlePetPost(res, req)
case http.MethodDelete:
handlePetDelete(res, req)
default:
message := "Malformed request; unsupported http method. Supported methods: G... | [
-0.3485661447048187,
-0.6400315761566162,
0.6651133298873901,
0.2016453593969345,
0.21837127208709717,
0.3781856596469879,
-0.8162328600883484,
0.06462603807449341,
-0.17157088220119476,
-0.4047366678714752,
0.08658463507890701,
-0.40921422839164734,
-0.39515629410743713,
-0.06688239425420... |
func PupulateHandler(res http.ResponseWriter, req *http.Request) {
numPups := parseOrDefault(req, numParam, 100)
pupsAdded, err := db.PopulateTable(numPups)
if err != nil {
message := "Could not populate Pets table"
messageResponseJSON(res, http.StatusBadRequest, message)
return
}
jsonResponse(res, http.Stat... | [
-1.493642807006836,
0.6617011427879333,
0.8109442591667175,
0.1848052442073822,
0.5810943245887756,
0.1426142305135727,
-0.6389358639717102,
-0.1658814251422882,
-0.1470823436975479,
0.47924044728279114,
-0.0466468445956707,
-1.1579530239105225,
-0.15945109724998474,
0.039321258664131165,
... |
func DepupulateHandler(res http.ResponseWriter, req *http.Request) {
numPups := parseOrDefault(req, numParam, 100)
err := db.DeleteEntries(numPups)
if err != nil {
message := "Could not delete from Pets table " + err.Error()
messageResponseJSON(res, http.StatusBadRequest, message)
return
}
jsonResponse(res, ... | [
-0.411587655544281,
0.3376632332801819,
0.6642744541168213,
-0.4363374412059784,
0.25405552983283997,
-0.47012659907341003,
-0.30044981837272644,
0.7854152917861938,
-0.332888662815094,
0.3156737685203552,
-0.14262089133262634,
-1.0536950826644897,
-0.3651871681213379,
0.15308083593845367,... |
func parseOrDefault(req *http.Request, requestParam string, defaultValue int) int {
result := defaultValue
paramAsInt, ok := req.URL.Query()[requestParam]
if !ok || len(paramAsInt[0]) < 1 {
log.Printf("no parameter provided in request --> defaulting to %d \n", defaultValue)
} else {
intValue, err := strconv.Ato... | [
-0.5326914191246033,
0.11063127219676971,
0.922178328037262,
0.07328229397535324,
0.8367977142333984,
-0.6244565844535828,
0.05263860523700714,
0.30919399857521057,
-0.2497750222682953,
-0.13477957248687744,
0.5469093322753906,
-0.2310057282447815,
-0.9752804636955261,
0.90660560131073,
... |
func RequiresReplace() tfsdk.AttributePlanModifier {
return requiresReplaceModifier{}
} | [
-0.9651566743850708,
-0.3819255828857422,
0.40416979789733887,
-0.8580299615859985,
-0.560110867023468,
0.7200711965560913,
0.09563346952199936,
0.6178507804870605,
1.0260192155838013,
-0.5043426156044006,
-0.3766153156757355,
-0.13366736471652985,
0.5220475792884827,
0.7232444882392883,
... |
func (r requiresReplaceModifier) Modify(ctx context.Context, req tfsdk.ModifyAttributePlanRequest, resp *tfsdk.ModifyAttributePlanResponse) {
if req.AttributeConfig == nil || req.AttributePlan == nil || req.AttributeState == nil {
// shouldn't happen, but let's not panic if it does
return
}
if req.State.Raw.IsN... | [
-1.0116087198257446,
-0.1134781688451767,
0.4629962742328644,
-0.2979331612586975,
0.36123356223106384,
-0.014055382460355759,
0.51356041431427,
0.13504649698734283,
1.056734323501587,
0.1141567975282669,
0.8610444068908691,
-0.20657537877559662,
0.837253987789154,
0.5423312783241272,
0.... |
func (r requiresReplaceModifier) Description(ctx context.Context) string {
return "If the value of this attribute changes, Terraform will destroy and recreate the resource."
} | [
-0.8647754192352295,
-0.3751181662082672,
0.21719004213809967,
-1.0079054832458496,
0.36404314637184143,
0.4276643991470337,
0.20904897153377533,
0.19829732179641724,
0.4096163213253021,
1.0937116146087646,
0.35145333409309387,
0.5195184350013733,
0.35989049077033997,
0.6613035202026367,
... |
func (r requiresReplaceModifier) MarkdownDescription(ctx context.Context) string {
return "If the value of this attribute changes, Terraform will destroy and recreate the resource."
} | [
-0.22688302397727966,
-0.2985285818576813,
0.4122222065925598,
-0.20305286347866058,
0.2916775941848755,
0.6488559246063232,
0.5444657206535339,
0.5684753656387329,
0.0561959408223629,
0.24032452702522278,
0.6725460886955261,
0.46545618772506714,
-0.07897236943244934,
1.2321723699569702,
... |
func RequiresReplaceIf(f RequiresReplaceIfFunc, description, markdownDescription string) tfsdk.AttributePlanModifier {
return requiresReplaceIfModifier{
f: f,
description: description,
markdownDescription: markdownDescription,
}
} | [
0.2636033594608307,
0.4801620841026306,
0.24783770740032196,
-0.49835196137428284,
-0.6919300556182861,
0.4644765853881836,
-0.5001698732376099,
0.4207059442996979,
0.16272559762001038,
-0.4440886080265045,
0.12154477089643478,
0.486005574464798,
0.6037275195121765,
0.873090922832489,
-0... |
func (r requiresReplaceIfModifier) Modify(ctx context.Context, req tfsdk.ModifyAttributePlanRequest, resp *tfsdk.ModifyAttributePlanResponse) {
if req.AttributeConfig == nil || req.AttributePlan == nil || req.AttributeState == nil {
// shouldn't happen, but let's not panic if it does
return
}
if req.State.Raw.I... | [
-0.926811933517456,
-0.07801594585180283,
0.45155081152915955,
-0.15353238582611084,
0.31809377670288086,
-0.10712555050849915,
0.5429926514625549,
0.06350798159837723,
1.0453475713729858,
0.10554100573062897,
0.8803931474685669,
-0.23044024407863617,
0.8333116173744202,
0.5531895756721497... |
func (r requiresReplaceIfModifier) Description(ctx context.Context) string {
return r.description
} | [
-0.5142678022384644,
0.16918876767158508,
0.05981418117880821,
-0.5252182483673096,
0.3648797273635864,
0.299176961183548,
-0.02292587421834469,
-0.038128599524497986,
1.268865942955017,
0.5362505912780762,
0.347177118062973,
0.3182303309440613,
-0.6254985928535461,
0.5857585072517395,
-... |
func (r requiresReplaceIfModifier) MarkdownDescription(ctx context.Context) string {
return r.markdownDescription
} | [
0.09151666611433029,
0.01441157516092062,
0.3066454827785492,
0.1894403100013733,
0.20850485563278198,
0.46507126092910767,
0.31390371918678284,
0.7631813287734985,
0.73652184009552,
-0.26527076959609985,
0.9389500021934509,
0.35985612869262695,
-0.9599460363388062,
1.0577422380447388,
-... |
func UseStateForUnknown() tfsdk.AttributePlanModifier {
return useStateForUnknownModifier{}
} | [
-0.768825352191925,
-0.004107552580535412,
0.4196016192436218,
-1.0667654275894165,
0.04577663168311119,
-0.4781825840473175,
0.11166281253099442,
0.18005535006523132,
0.249859020113945,
-1.525954246520996,
-0.3084115982055664,
-0.7454429268836975,
1.0915035009384155,
0.30023959279060364,
... |
func (r useStateForUnknownModifier) Modify(ctx context.Context, req tfsdk.ModifyAttributePlanRequest, resp *tfsdk.ModifyAttributePlanResponse) {
if req.AttributeState == nil || resp.AttributePlan == nil || req.AttributeConfig == nil {
return
}
// if we have no state value, there's nothing to preserve
if req.Attr... | [
-1.0817095041275024,
-0.2642010748386383,
0.3713971674442291,
-0.6502612233161926,
0.38521990180015564,
0.22293367981910706,
-0.1769554316997528,
0.1518167406320572,
1.1841727495193481,
-0.9693486094474792,
0.47680070996284485,
-0.43366751074790955,
0.7933632135391235,
0.23979268968105316,... |
func (r useStateForUnknownModifier) Description(ctx context.Context) string {
return "Once set, the value of this attribute in state will not change."
} | [
-0.9297676682472229,
-0.06939616054296494,
0.2436513900756836,
-0.7846086025238037,
0.59462571144104,
0.10339215397834778,
0.23993954062461853,
-0.4246104955673218,
0.5032013654708862,
0.1670127809047699,
-0.2618347406387329,
0.4993036389350891,
0.20056258141994476,
0.4980314373970032,
-... |
func (r useStateForUnknownModifier) MarkdownDescription(ctx context.Context) string {
return "Once set, the value of this attribute in state will not change."
} | [
-0.34297680854797363,
-0.1770322620868683,
0.4322085976600647,
-0.16330836713314056,
0.4233148396015167,
0.24376147985458374,
0.44013091921806335,
0.17272625863552094,
0.11853577196598053,
-0.5248143672943115,
0.3481734097003937,
0.42156291007995605,
-0.07387496531009674,
1.049452781677246... |
func Test_Get(t *testing.T) {
h := NewHttpSend(GetUrlBuild("http://192.168.10.76/lotus/lotustest", map[string]string{"name": "xiaochuan"}))
body, err := h.Get()
if err != nil {
t.Error("请求错误:", err)
//t.Errorf(err.Error())
t.Fail()
} else {
t.Log("正常返回")
var out bytes.Buffer
err = json.Indent(&out, bod... | [
-0.18664249777793884,
-0.22344328463077545,
1.0864838361740112,
0.07480231672525406,
-0.11316000670194626,
0.5205856561660767,
-0.5514495968818665,
0.052365053445100784,
-0.6536172032356262,
-0.40089282393455505,
-0.664314866065979,
1.3270646333694458,
-0.702835202217102,
-0.30981308221817... |
func Create(sid string) *Client {
c := Client{
FirstName: "Site",
LastName: "Visitor",
Name: "Site Visitor",
}
// Generate Client UID
uuid, _ := uuid.NewRandom()
c.Uid = uuid.String()
// Assign Client SID
c.Sid = sid
return &c
} | [
0.10252250730991364,
-0.4248161017894745,
0.37626075744628906,
-0.15217483043670654,
-0.34825336933135986,
0.8403387069702148,
0.58279949426651,
-0.471594899892807,
-0.025260647758841515,
-0.14116187393665314,
-0.3072742819786072,
-0.0037198530044406652,
-0.42983487248420715,
-0.3200721740... |
func (c *Client) GetFullName() string {
if c != nil {
return fmt.Sprintf("%s %s", c.GetFirstName(), c.GetLastName())
}
return ""
} | [
0.7209935784339905,
-0.39833253622055054,
0.8219285011291504,
-0.2554927468299866,
-0.7018725872039795,
-0.08480208367109299,
-0.6812040209770203,
0.162335604429245,
-0.061087716370821,
-0.191818505525589,
-0.28604233264923096,
0.18551649153232574,
-0.20507705211639404,
0.7042708396911621,... |
func (c *Client) UnmarshalJSON(data []byte) error {
u := jsonpb.Unmarshaler{}
buf := bytes.NewBuffer(data)
return u.Unmarshal(buf, &*c)
} | [
-0.3246855139732361,
0.2700401842594147,
0.5159106254577637,
-1.2139415740966797,
-0.9953413009643555,
0.9053289294242859,
0.32836729288101196,
-0.04077603295445442,
0.12726299464702606,
-0.5755674242973328,
-0.7861183285713196,
0.27100569009780884,
-1.2755351066589355,
0.1532568782567978,... |
func (c Client) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
m := jsonpb.Marshaler{}
if err := m.Marshal(&buf, &c); err != nil {
return nil, err
}
return buf.Bytes(), nil
} | [
0.29400619864463806,
-0.14997060596942902,
0.3220594823360443,
-0.06715239584445953,
-0.8397861123085022,
0.5690565705299377,
0.07118526101112366,
0.05853709205985069,
0.18366803228855133,
-0.1286604255437851,
-0.748382031917572,
0.8969534635543823,
-1.3434640169143677,
0.44144025444984436... |
func (c Client) Key() string {
return fmt.Sprintf("client.%s", c.Uid)
} | [
-0.14374883472919464,
-0.3628576099872589,
0.0997757688164711,
-0.6315016746520996,
0.048513058573007584,
1.6395241022109985,
0.06299350410699844,
-0.39645975828170776,
-0.17830689251422882,
0.44511139392852783,
0.12482312321662903,
0.5118635296821594,
-0.7264453172683716,
-0.3784015476703... |
func HashObject(data []byte) []byte {
h := sha1.New()
h.Write(data)
oid := []byte(fmt.Sprintf("%x", h.Sum(nil)))
return oid
} | [
0.42764946818351746,
-0.24391140043735504,
0.7940407991409302,
-0.41311678290367126,
-0.026713524013757706,
1.0587422847747803,
-0.6502856612205505,
0.0791713148355484,
0.3849574327468872,
0.3806670308113098,
-0.990358829498291,
-0.3673861026763916,
-0.19222769141197205,
-0.803936898708343... |
func PutObject(data string, objectType ...ObjectType) (oid string, err error) {
_type := BLOB
if len(objectType) > 0 {
_type = objectType[0]
}
encoded := []byte(string(_type) + string(BYTE_SEPARATOR) + data)
oid = string(HashObject(encoded))
objectPath := fmt.Sprintf("%s/%s/%s", UGIT_DIR, OBJECTS_DIR, oid)
err... | [
-0.1180080771446228,
-0.2755463421344757,
0.7555562853813171,
-0.45007166266441345,
0.04099595174193382,
1.1079891920089722,
0.4351126253604889,
-0.17970046401023865,
-0.3566593527793884,
0.5904518961906433,
-0.6589658856391907,
-0.05126317963004112,
-0.8508005142211914,
-1.004605293273925... |
func GetObject(oid string) (string, ObjectType, error) {
objectPath := fmt.Sprintf("%s/%s/%s", UGIT_DIR, OBJECTS_DIR, oid)
data, err := ioutil.ReadFile(objectPath)
if err != nil {
return "", ObjectType(""), err
}
parts := bytes.Split(data, []byte{BYTE_SEPARATOR})
_type := ObjectType(parts[0])
content := string... | [
-0.3477550745010376,
-0.5716172456741333,
0.7414653301239014,
-0.8673398494720459,
-0.107173390686512,
-0.048315949738025665,
0.5835299491882324,
-0.6317025423049927,
-0.7078747749328613,
0.577576220035553,
-0.6176486015319824,
0.19526855647563934,
0.18512608110904694,
-1.0602463483810425,... |
func (s *Layer) SerialAPIReady(serialLinkReady byte) {
s.l.Debug("serial api ready")
request := &session.Request{
FunctionID: protocol.FnSerialAPIReady,
Payload: []byte{serialLinkReady},
HasReturn: false,
}
s.sessionLayer.MakeRequest(request)
// need to drain all data
time.Sleep(1500 * time.Mi... | [
-0.77164626121521,
-0.9703196287155151,
0.5830934643745422,
-0.2496621459722519,
0.6244136095046997,
-0.22047792375087738,
0.15231755375862122,
-0.47805339097976685,
0.9860172867774963,
-0.0629870817065239,
-1.4304571151733398,
1.378630518913269,
0.1656867414712906,
-0.12553095817565918,
... |
func buyOrSellMA(stockData *finance.Quote) decision {
var dec decision
dec.symbol = stockData.Symbol
if stockData.FiftyDayAverage >= stockData.RegularMarketPrice {
dec.FiftyDayAverage = false
} else {
dec.FiftyDayAverage = true
}
if stockData.TwoHundredDayAverage < stockData.RegularMarketPrice {
dec.TwoHund... | [
-1.1306661367416382,
-0.5513074994087219,
0.5953879952430725,
-0.48437127470970154,
-0.20737963914871216,
-0.04273684322834015,
0.28223031759262085,
0.0416446216404438,
0.9235948324203491,
-0.15883386135101318,
0.8843937516212463,
0.8527437448501587,
0.9661030173301697,
0.46286988258361816... |
func BenchmarkSliceSize(b *testing.B) {
b.ResetTimer()
size := 10
for i := 0; i < b.N; i++ {
data := make([]int, 0, size)
for n := 0; n < size; n++ {
data = append(data, i)
}
}
} | [
0.5023573637008667,
1.0498281717300415,
0.4449813961982727,
-1.123637080192566,
1.37120521068573,
-0.6575929522514343,
0.33920708298683167,
-0.2010624259710312,
-0.013543026521801949,
0.7320271730422974,
-0.478116899728775,
0.8169624209403992,
-0.5326398015022278,
0.6856054663658142,
0.2... |
func BenchmarkIntToStringWithStrconv(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = strconv.Itoa(i)
}
} | [
0.17546576261520386,
-0.16331857442855835,
0.3794804811477661,
-0.5654547810554504,
0.843183696269989,
-0.8483339548110962,
0.13898254930973053,
-0.8111982941627502,
-0.7699792981147766,
0.6766714453697205,
0.1729017049074173,
0.33600670099258423,
-0.32980817556381226,
0.17566046118736267,... |
func BenchmarkStringConversionOnce(b *testing.B) {
b.ResetTimer()
var buf bytes.Buffer
p := []byte("hello word")
for i := 0; i < b.N; i++ {
buf.Write(p)
buf.Reset()
}
} | [
0.5344091057777405,
1.0383391380310059,
0.34872832894325256,
-0.22396697103977203,
1.1883630752563477,
-0.3865719437599182,
0.1501893848180771,
-0.19252070784568787,
-0.34653225541114807,
0.523684024810791,
-0.26016777753829956,
0.4158800542354584,
-1.1631673574447632,
0.5454602837562561,
... |
func NewStringFromGoString(value string) String {
str := NewString()
// https://github.com/godotengine/godot/blob/ef5891091bceef2800b4fae4cd85af219e791467/core/ustring.h#L300
// return true on error
if str.ParseUtf8(value) {
log.Info("unable to parse utf-8", StringField("value", value))
}
return str
} | [
0.20024137198925018,
-0.15076975524425507,
0.36490362882614136,
-0.5878528952598572,
-0.5286113619804382,
0.49592000246047974,
-0.3566874563694,
-0.16862079501152039,
0.20315004885196686,
0.267627090215683,
0.049395717680454254,
-0.7933021783828735,
0.2643328607082367,
-0.5116345286369324,... |
func NewStringNameFromGoString(value string) StringName {
gds := NewStringFromGoString(value)
defer gds.Destroy()
return NewStringName(gds)
} | [
0.02624286338686943,
-0.42914000153541565,
0.14581488072872162,
-0.2127685248851776,
-1.0262131690979004,
-0.2727314233779907,
-0.4670543968677521,
-0.6709182858467102,
-0.04343347251415253,
0.6534191966056824,
0.14085343480110168,
-0.2721876800060272,
0.44572189450263977,
-0.0642839372158... |
func (o *GetBicsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetBicsIDOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
... | [
0.15232853591442108,
-1.023949384689331,
0.8626365661621094,
0.6288115978240967,
0.01744227111339569,
-1.2361141443252563,
0.10494880378246307,
-0.744811475276947,
0.21696753799915314,
0.0025775928515940905,
-0.15970604121685028,
-0.36755767464637756,
-1.3690731525421143,
-0.41688853502273... |
func NewGetBicsIDOK() *GetBicsIDOK {
return &GetBicsIDOK{}
} | [
0.7850579023361206,
-0.13780905306339264,
-0.02700270153582096,
1.7323987483978271,
0.08293868601322174,
-0.6831493377685547,
0.36183202266693115,
-0.08379964530467987,
-0.8904953598976135,
-1.1427569389343262,
-0.7945590019226074,
-0.33022046089172363,
-0.15668885409832,
-0.65277099609375... |
func NewGetBicsIDBadRequest() *GetBicsIDBadRequest {
return &GetBicsIDBadRequest{}
} | [
0.09139661490917206,
-0.24960802495479584,
0.1707465946674347,
1.42278254032135,
-0.5059967637062073,
-0.8059982657432556,
-0.19740770757198334,
-0.2542547285556793,
-0.6479761600494385,
-0.6498774886131287,
-0.13122764229774475,
0.6847620010375977,
-1.1896240711212158,
-0.5718851089477539... |
func NewGetBicsIDUnauthorized() *GetBicsIDUnauthorized {
return &GetBicsIDUnauthorized{}
} | [
0.13042916357517242,
-0.3711020350456238,
-0.08253075927495956,
1.0836631059646606,
-0.5593726634979248,
-0.5092017650604248,
0.8491194844245911,
0.5265077948570251,
-0.2752104103565216,
-1.6079585552215576,
-0.8023456335067749,
0.7396717071533203,
-1.2111201286315918,
-0.8354441523551941,... |
func NewGetBicsIDForbidden() *GetBicsIDForbidden {
return &GetBicsIDForbidden{}
} | [
1.2400315999984741,
-0.27887287735939026,
-0.24213933944702148,
1.1989166736602783,
-0.6056627631187439,
0.10847488045692444,
0.739833652973175,
-0.4822811484336853,
-0.6928966045379639,
-0.9411665201187134,
-0.433106005191803,
0.5877318382263184,
-1.609095573425293,
-1.1536141633987427,
... |
func NewGetBicsIDNotFound() *GetBicsIDNotFound {
return &GetBicsIDNotFound{}
} | [
0.5565698146820068,
-1.1998131275177002,
-0.2660035789012909,
0.33508288860321045,
0.03362944722175598,
0.5905866026878357,
0.7640352845191956,
-0.5300407409667969,
-0.555350124835968,
-0.9953851699829102,
-0.7314075231552124,
0.2990918457508087,
-1.2688171863555908,
-0.5961551070213318,
... |
func NewGetBicsIDConflict() *GetBicsIDConflict {
return &GetBicsIDConflict{}
} | [
0.7349532246589661,
-0.38354936242103577,
0.03099323995411396,
0.6050578355789185,
0.005726679693907499,
-0.6042873859405518,
0.3618501126766205,
-0.5000377893447876,
-0.70500248670578,
-0.9298052191734314,
-0.25933271646499634,
-0.42145130038261414,
-1.491377592086792,
-1.0865565538406372... |
func NewGetBicsIDTooManyRequests() *GetBicsIDTooManyRequests {
return &GetBicsIDTooManyRequests{}
} | [
-0.1997561901807785,
-0.0666075348854065,
0.14618685841560364,
1.4597963094711304,
-0.05459379777312279,
-0.8381965160369873,
-0.7902164459228516,
-0.7612645030021667,
-0.3781704604625702,
-0.9668867588043213,
-1.1347798109054565,
-0.6765561103820801,
-1.4973993301391602,
-0.71826893091201... |
func NewGetBicsIDServiceUnavailable() *GetBicsIDServiceUnavailable {
return &GetBicsIDServiceUnavailable{}
} | [
-0.7220645546913147,
-0.5853856205940247,
0.16801603138446808,
0.23887121677398682,
-0.048254214227199554,
-0.26090699434280396,
0.032921385020017624,
0.4052802324295044,
-0.4454058110713959,
-0.5231534242630005,
-0.6265431046485901,
0.37325549125671387,
-0.8730116486549377,
-1.24047756195... |
func NewBlockChain() *Blockchain {
var tip []byte
// Set up connection to db
bbto := gorocksdb.NewDefaultBlockBasedTableOptions()
bbto.SetBlockCache(gorocksdb.NewLRUCache(3 << 30))
opts := gorocksdb.NewDefaultOptions()
opts.SetBlockBasedTableFactory(bbto)
opts.SetCreateIfMissing(true)
shouldCreateGenesisBlock :... | [
-0.44550609588623047,
-0.262675404548645,
1.2192927598953247,
0.058846212923526764,
1.1074250936508179,
0.030971549451351166,
0.038112130016088486,
0.2401939034461975,
-0.7621749043464661,
0.9160733819007874,
-0.23291756212711334,
-0.3202407658100128,
-0.5942190289497375,
0.331068783998489... |
func (m *Monitor) Configure(conf *Config) error {
m.logger = logrus.WithFields(logrus.Fields{"monitorType": monitorType, "monitorID": conf.MonitorID})
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())
// save config to monitor for con... | [
0.36441853642463684,
0.3533256947994232,
0.4783284366130829,
-0.11990426480770111,
0.670264720916748,
-0.5397666692733765,
0.5937796235084534,
0.18170961737632751,
-0.6625388860702515,
-0.175419420003891,
-0.39157629013061523,
-0.2045993059873581,
-0.6020908951759338,
0.7111321687698364,
... |
func (m *Monitor) Shutdown() {
if m.cancel != nil {
m.cancel()
}
} | [
0.8380544781684875,
0.32855135202407837,
0.37758857011795044,
0.6076224446296692,
0.3323085904121399,
0.47233685851097107,
0.19384735822677612,
0.8837531805038452,
0.6450507640838623,
0.30330872535705566,
0.8844836950302124,
0.014205005019903183,
-1.040907382965088,
0.47293227910995483,
... |
func cpuTimeStatTototalUsed(t *cpu.TimesStat) *totalUsed {
// add up all times if a value doesn't apply then the struct field
// will be 0 and shouldn't affect anything
// Guest and GuestNice are already included in User and Nice so don't
// double count them.
total := t.User +
t.System +
t.Idle +
t.Nice +
... | [
-0.21844634413719177,
0.23713119328022003,
0.36491671204566956,
-0.7359772324562073,
-0.5965917706489563,
-0.5128611922264099,
0.5535314679145813,
-1.066535472869873,
-0.05506303533911705,
0.08024676889181137,
-0.8391925692558289,
-0.008357464335858822,
0.06949135661125183,
0.5873874425888... |
func init() {
router().GET(
"/hello/:userName",
validateUserName,
sayHello,
)
} | [
-0.11423082649707794,
0.2813040316104889,
0.37587770819664,
1.2570518255233765,
0.6042200922966003,
0.19043053686618805,
-0.15628720819950104,
0.44599679112434387,
-1.1977365016937256,
-0.5636113882064819,
-1.1031222343444824,
0.7036826014518738,
0.22392253577709198,
0.2447904646396637,
... |
func validateUserName(c *gin.Context) {
userName := c.Param("userName")
if len(userName) < 5 {
c.Error(errors.NewCustomError(400, "userName debe tener al menos 5 caracteres"))
c.Abort()
return
}
} | [
-0.25323331356048584,
0.600334644317627,
0.4403432309627533,
0.45717352628707886,
-0.08367304503917694,
0.12682504951953888,
0.6224325895309448,
-0.5674266815185547,
-0.3759740889072418,
0.539328396320343,
-0.039959896355867386,
-0.32277849316596985,
-0.6936197876930237,
0.4834374189376831... |
func setupDatabase(driver string, db *sql.DB) error {
return ddl.Migrate(driver, db)
} | [
-0.8871535062789917,
0.5878353714942932,
0.4804277718067169,
1.3202307224273682,
0.6530198454856873,
-0.25891050696372986,
0.11505110561847687,
0.5932268500328064,
0.7526758313179016,
0.576462984085083,
-0.018629517406225204,
-0.5622801780700684,
0.16459622979164124,
1.197836995124817,
0... |
func pingDatabase(db *sql.DB) (err error) {
for i := 0; i < 30; i++ {
err = db.Ping()
if err == nil {
return
}
logrus.Infof("database ping failed. retry in 1s")
time.Sleep(time.Second)
}
return
} | [
-0.7208928465843201,
0.937574028968811,
0.36868277192115784,
0.7057698369026184,
0.7164387106895447,
0.8118698000907898,
0.10667653381824493,
-0.1877032369375229,
0.38247939944267273,
0.6308500170707703,
-0.0013863816857337952,
0.26408877968788147,
-0.993665874004364,
0.8816874623298645,
... |
func setupMeddler(driver string) {
switch driver {
case "sqlite3":
meddler.Default = meddler.SQLite
case "mysql":
meddler.Default = meddler.MySQL
case "postgres":
meddler.Default = meddler.PostgreSQL
}
} | [
-0.6703545451164246,
-0.4149668514728546,
0.3485225737094879,
-0.016303131356835365,
0.7960441708564758,
0.23909418284893036,
-0.35953983664512634,
0.4478496015071869,
0.30623048543930054,
0.1950521320104599,
0.5942453742027283,
-0.13991360366344452,
-0.7289498448371887,
1.685407280921936,... |
func GetNode(namespace string, clusterName string, nodeName string) (*model.Node, error) {
err := verifyNamespace(namespace)
if err != nil {
return nil, err
}
cluster := model.NewCluster(namespace, clusterName)
if exists, err := cluster.Select(); err != nil {
return nil, err
} else if exists {
for _, node ... | [
-0.028977209702134132,
0.5512168407440186,
0.32114744186401367,
0.24687635898590088,
1.2729277610778809,
-0.5635459423065186,
-0.8661597967147827,
-0.6336259841918945,
0.25113704800605774,
0.6065995097160339,
0.7799175977706909,
1.3493067026138306,
-0.9076042771339417,
-0.18601660430431366... |
func AddNode(namespace string, clusterName string, req *app.NodeReq) (*model.NodeList, error) {
// validate namespace
if err := verifyNamespace(namespace); err != nil {
return nil, err
}
// get a cluster-entity
cluster := model.NewCluster(namespace, clusterName)
if exists, err := cluster.Select(); err != nil ... | [
-0.2227206528186798,
0.5354747176170349,
0.8277594447135925,
0.38871312141418457,
1.1043213605880737,
-0.5113155841827393,
-1.011505365371704,
0.67693030834198,
0.19119183719158173,
1.1822795867919922,
0.6940825581550598,
0.7798607349395752,
-0.8921629786491394,
0.566418468952179,
-0.001... |
func RemoveNode(namespace string, clusterName string, nodeName string) (*app.Status, error) {
//validate
if err := verifyNamespace(namespace); err != nil {
return nil, err
}
// get a cluster-entity
cluster := model.NewCluster(namespace, clusterName)
if exists, err := cluster.Select(); err != nil {
return ni... | [
0.438505083322525,
0.3858840763568878,
0.6528270840644836,
-0.31288978457450867,
0.4888268709182739,
-0.30462324619293213,
-0.4612426459789276,
0.45122653245925903,
0.5526906847953796,
0.9029533863067627,
0.5989449620246887,
0.3650217354297638,
-0.8039035201072693,
0.6369558572769165,
0.... |
func cleanUpNodes(provisioner provision.Provisioner) {
for _, machine := range provisioner.GetMachinesAll() {
nodeName := machine.Name
existNode := false
for _, node := range provisioner.Cluster.Nodes {
if node.Name == nodeName {
node.Credential = ""
node.PublicIP = ""
node.PrivateIP = ""
exi... | [
-0.3286036252975464,
0.39010608196258545,
0.48581233620643616,
-1.2966006994247437,
0.6246634125709534,
0.28716331720352173,
0.16520127654075623,
0.20631864666938782,
-0.11691875010728836,
0.8805171251296997,
0.04366128519177437,
0.24792852997779846,
-0.1782740354537964,
0.4337968826293945... |
func (c *Client) ProductsSearch(filter map[string]string) (*ProductsSearchResponse, error) {
// filter:
// keyword string, priceFrom number, priceTo number, category number,
// withSubcategories bool, sortBy enum, offset number, limit number,
// createdFrom date, createdTo date, updatedFrom date, updatedTo date,
/... | [
-1.4889577627182007,
0.20190653204917908,
0.6547993421554565,
-0.36153000593185425,
-0.050158124417066574,
0.21091130375862122,
0.1900988072156906,
-0.9644364714622498,
0.22713324427604675,
0.18898972868919373,
-0.3239138424396515,
0.3415375053882599,
-0.09854764491319656,
-0.0484545938670... |
func (c *Client) Products(ctx context.Context, filter map[string]string) <-chan *Product {
prodChan := make(chan *Product)
go func() {
defer close(prodChan)
c.ProductsTrampoline(filter, func(index uint, product *Product) error {
// FIXME silent error. maybe prodChan <- nil ?
select {
case <-ctx.Done():... | [
-0.6187533736228943,
0.29333484172821045,
0.5764491558074951,
-0.12258649617433548,
0.4686775505542755,
0.16493795812129974,
0.29766565561294556,
-1.7290223836898804,
0.12856151163578033,
-0.29375168681144714,
0.10642211139202118,
0.9405487179756165,
-0.3622766137123108,
-0.683027327060699... |
func (c *Client) ProductGet(productID ID) (*Product, error) {
response, err := c.R().
Get(fmt.Sprintf("/products/%d", productID))
var result Product
return &result, responseUnmarshal(response, err, &result)
} | [
-0.8773793578147888,
0.19150696694850922,
0.1475452482700348,
0.128110870718956,
0.6771958470344543,
-0.24618764221668243,
-0.649729311466217,
-1.4132335186004639,
0.0452759750187397,
-0.29869675636291504,
0.07227030396461487,
0.2927679717540741,
-0.589440643787384,
-0.7023677825927734,
... |
func (c *Client) ProductAdd(product *NewProduct) (ID, error) {
response, err := c.R().
SetHeader("Content-Type", "application/json").
SetBody(product).
Post("/products")
return responseAdd(response, err)
} | [
-1.0194367170333862,
-0.048143576830625534,
0.5969477295875549,
0.8799337148666382,
0.3463451862335205,
1.0449963808059692,
0.10398033261299133,
-0.7970213890075684,
0.6757186651229858,
-0.2861189842224121,
-0.17232994735240936,
0.4235630929470062,
-1.1326394081115723,
0.319540411233902,
... |
func (c *Client) ProductUpdate(productID ID, product *NewProduct) error {
response, err := c.R().
SetHeader("Content-Type", "application/json").
SetBody(product).
Put(fmt.Sprintf("/products/%d", productID))
return responseUpdate(response, err)
} | [
-1.2547715902328491,
-1.1832454204559326,
0.3436529338359833,
0.28199702501296997,
0.2454574555158615,
0.43841469287872314,
-0.6570746898651123,
-1.2881311178207397,
0.6762920022010803,
0.8551183342933655,
-0.5116157531738281,
0.18681477010250092,
-0.914499819278717,
-0.4365018904209137,
... |
func randomPowerStone(portal *sworld.Portal) sworld.Item {
return &sworld.PortalStone{
Level: 10,
Duration: 10 * time.Minute,
Zone: portal.PortalStone.Zone,
}
} | [
0.4627423882484436,
-0.298068106174469,
0.29118582606315613,
-0.9466162919998169,
-0.6846703886985779,
0.7857683897018433,
-0.7650160193443298,
-0.06408160924911499,
0.20565620064735413,
0.0428440161049366,
-0.4976493716239929,
-0.019101185724139214,
-1.0523042678833008,
0.5169903039932251... |
func parseFactoid(row []interface{}, out chan *factoids.Factoid) {
values := parseMultipleValues(toString(row[cValue]))
c := &factoids.FactoidStat{
Nick: bot.Nick(toString(row[cCreator])),
Chan: "",
Count: 1,
}
c.Timestamp, _ = parseTimestamp(row[cCreated])
m := &factoids.FactoidStat{Chan: "", Count: 0}
i... | [
0.24255453050136566,
-0.16577038168907166,
0.3284675180912018,
-0.3197641372680664,
-0.1962573081254959,
-1.0342062711715698,
0.10639070719480515,
0.04117435961961746,
0.10660582780838013,
0.006082461681216955,
-0.2697353661060333,
0.22629937529563904,
1.0878385305404663,
0.593470215797424... |
func parseMultipleValues(v string) []string {
temp_vals := strings.Split(v, "|")
vals := make([]string, 0, len(temp_vals))
for i := 0; i < len(temp_vals); i++ {
str := temp_vals[i]
for strings.HasSuffix(str, "\\") {
// This | separator was escaped!
i++
if i < len(temp_vals) {
str = strings.Join([]st... | [
-0.2808799147605896,
-0.37211552262306213,
0.9276813864707947,
0.38844501972198486,
-0.7866212725639343,
0.05219443887472153,
-0.7628200054168701,
0.7393543124198914,
-0.6033743619918823,
0.28973063826560974,
-0.4464168846607208,
-1.0512205362319946,
0.06550626456737518,
1.1469312906265259... |
func parseValue(k, r, v string) (ft factoids.FactoidType, fv string) {
v = strings.TrimSpace(v)
ft, fv = factoids.ParseValue(v)
if ft == factoids.F_FACT && fv == v {
// If fv == v, ParseValue hasn't stripped off a <reply>, so this is
// just a normal factoid whose value is actually "key relation value"
// as t... | [
0.19264143705368042,
-0.05841493979096413,
0.4615492820739746,
0.006789226550608873,
-0.005157960578799248,
-0.9442076086997986,
0.20877398550510406,
-0.47275519371032715,
0.251836895942688,
0.6518798470497131,
0.8386802673339844,
0.47599413990974426,
0.15191829204559326,
0.638106465339660... |
func parseTimestamp(ts interface{}) (time.Time, bool) {
switch ts.(type) {
case float64:
return time.Unix(int64(ts.(float64)), 0), true
case int64:
return time.Unix(ts.(int64), 0), true
case string:
if tm, err := strconv.ParseInt(ts.(string), 10, 64); err == nil {
return time.Unix(tm, 0), true
} else {
... | [
-0.5923779606819153,
0.6800269484519958,
0.8321909308433533,
-0.5732225775718689,
-0.11988872289657593,
-0.3170231878757477,
-0.5328534245491028,
-0.03990780562162399,
0.3163067698478699,
0.13901926577091217,
-0.35924237966537476,
-0.5766735672950745,
-0.28878340125083923,
0.02587179094552... |
func parseReadOnly(b interface{}) bool {
switch b.(type) {
case float64:
return b.(float64) > 0
case int64:
return b.(int64) > 0
case string:
i, _ := strconv.Atoi(b.(string))
return i > 0
}
// default to ReadOnly == false
return false
} | [
-0.7274003028869629,
-0.24905678629875183,
0.5372735261917114,
0.20707564055919647,
-0.3738107681274414,
0.38558685779571533,
-0.5082337260246277,
-0.017855098471045494,
-0.2593158483505249,
0.18475086987018585,
0.16408559679985046,
0.6168153285980225,
-0.5903931856155396,
0.51261484622955... |
func toString(s interface{}) string {
switch s.(type) {
case float64:
if float64(int(s.(float64))) == s.(float64) {
return strconv.Itoa(int(s.(float64)))
} else {
return strconv.FormatFloat(s.(float64), 'f', -1, 64)
}
case int64:
return strconv.FormatInt(s.(int64), 10)
case string:
return s.(string)... | [
-0.21379634737968445,
-0.20151515305042267,
0.5691178441047668,
0.041413526982069016,
0.09484632313251495,
-0.21476969122886658,
0.6134260892868042,
-1.0791950225830078,
0.5657474994659424,
0.41189125180244446,
0.5117802619934082,
0.20662090182304382,
0.27395355701446533,
0.180351302027702... |
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not foun... | [
-0.7961482405662537,
-1.2313158512115479,
0.6331650614738464,
-0.6093901991844177,
-1.546920895576477,
-0.11101029813289642,
0.129714235663414,
-1.3390333652496338,
-1.135871410369873,
0.4855230152606964,
0.30901390314102173,
0.3249545693397522,
-0.6009676456451416,
-0.44264793395996094,
... |
func MustAsset(name string) []byte {
a, err := Asset(name)
if (err != nil) {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
} | [
-0.007740291301161051,
0.10098768770694733,
0.437966912984848,
-0.523969292640686,
-0.8036118149757385,
0.46165767312049866,
-0.8747084736824036,
-1.594231367111206,
0.13969546556472778,
0.6354658007621765,
-0.5115860104560852,
0.3287637233734131,
-0.023273920640349388,
-0.0659526288509368... |
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("Asset... | [
0.3719695508480072,
-1.1052989959716797,
0.5630441904067993,
-0.9225736260414124,
-1.356386423110962,
0.003355572931468487,
0.6777525544166565,
-0.8006678819656372,
-1.274828553199768,
0.311536967754364,
0.26360753178596497,
0.26388123631477356,
0.06357761472463608,
-0.39880770444869995,
... |
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
} | [
-0.7293784618377686,
-0.8460342288017273,
0.7321816682815552,
-0.39323121309280396,
-0.48951536417007446,
0.7661203145980835,
-0.5028699636459351,
-0.8655748963356018,
-0.4145073890686035,
0.8099913597106934,
0.16903363168239594,
1.163049578666687,
-0.028152840211987495,
0.0342608317732811... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.