text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func Templates(basepath string) (messages []Message) {
messages = []Message{}
path := filepath.Join(basepath, "templates")
if fi, err := os.Stat(path); err != nil {
messages = append(messages, Message{Severity: WarningSev, Text: "No templates"})
return
} else if !fi.IsDir() {
messages = append(messages, Messa... | [
-0.06827984750270844,
-0.2827714681625366,
0.8592709302902222,
-0.4021642208099365,
-0.2843657433986664,
-0.522872269153595,
0.22178567945957184,
-0.4519496262073517,
0.16408713161945343,
0.10245350748300552,
0.13932102918624878,
0.19942088425159454,
0.14825448393821716,
0.306484192609787,... |
func New(config *Config) (WebView, error) {
if config == nil {
config = new(Config)
}
if config.WindowConfig == nil {
config.WindowConfig = &WindowConfig{}
}
if config.TransportConfig == nil {
config.TransportConfig = &TransportConfig{}
}
if config.WindowConfig.Title == "" {
dir, err := os.Executable(... | [
0.08415240049362183,
-0.50037682056427,
0.7275007963180542,
0.2955445647239685,
-1.553309679031372,
0.10513249039649963,
0.6471763849258423,
0.19210539758205414,
-0.014647471718490124,
-0.3874994218349457,
-0.35614725947380066,
0.6418321132659912,
0.1894097626209259,
1.4510804414749146,
... |
func Authorize(w http.ResponseWriter, r *http.Request, authorizer Authorizer) {
authReq, err := ParseAuthorizeRequest(r, authorizer.Decoder())
if err != nil {
AuthRequestError(w, r, authReq, err, authorizer.Encoder())
return
}
if authReq.RequestParam != "" && authorizer.RequestObjectSupported() {
authReq, err... | [
-0.6874679923057556,
0.2685858905315399,
0.9642137885093689,
0.7340994477272034,
0.39367571473121643,
-0.652135968208313,
0.030292153358459473,
-0.5631859302520752,
0.5152028203010559,
0.356735497713089,
0.21285201609134674,
0.43475908041000366,
0.12992769479751587,
0.39508724212646484,
... |
func ParseAuthorizeRequest(r *http.Request, decoder httphelper.Decoder) (*oidc.AuthRequest, error) {
err := r.ParseForm()
if err != nil {
return nil, oidc.ErrInvalidRequest().WithDescription("cannot parse form").WithParent(err)
}
authReq := new(oidc.AuthRequest)
err = decoder.Decode(authReq, r.Form)
if err != n... | [
-0.6392091512680054,
-0.30393749475479126,
0.7597827315330505,
-0.029315952211618423,
-0.8443105816841125,
-0.7649192810058594,
-0.14773522317409515,
-0.07932619005441666,
0.40486499667167664,
-0.45971614122390747,
0.7868375778198242,
0.018790561705827713,
0.18903899192810059,
0.4553181231... |
func ParseRequestObject(ctx context.Context, authReq *oidc.AuthRequest, storage Storage, issuer string) (*oidc.AuthRequest, error) {
requestObject := new(oidc.RequestObject)
payload, err := oidc.ParseToken(authReq.RequestParam, requestObject)
if err != nil {
return nil, err
}
if requestObject.ClientID != "" && ... | [
0.2275477796792984,
-1.1714961528778076,
0.9467036724090576,
0.5783231854438782,
-1.0181547403335571,
0.16515390574932098,
-0.08638345450162888,
-1.2244577407836914,
0.8250789046287537,
0.10504293441772461,
0.2079959362745285,
0.16332420706748962,
-0.021685294806957245,
-0.4583154916763305... |
func CopyRequestObjectToAuthRequest(authReq *oidc.AuthRequest, requestObject *oidc.RequestObject) {
if str.Contains(authReq.Scopes, oidc.ScopeOpenID) && len(requestObject.Scopes) > 0 {
authReq.Scopes = requestObject.Scopes
}
if requestObject.RedirectURI != "" {
authReq.RedirectURI = requestObject.RedirectURI
}
... | [
-0.7681174874305725,
-1.2633098363876343,
0.8348714709281921,
0.022443145513534546,
-0.4466056525707245,
0.19089150428771973,
-0.021374961361289024,
-0.9502872228622437,
1.097016453742981,
-0.07763199508190155,
0.04425419121980667,
1.0528042316436768,
0.2405024617910385,
-0.016268955543637... |
func ValidateAuthRequest(ctx context.Context, authReq *oidc.AuthRequest, storage Storage, verifier IDTokenHintVerifier) (sub string, err error) {
authReq.MaxAge, err = ValidateAuthReqPrompt(authReq.Prompt, authReq.MaxAge)
if err != nil {
return "", err
}
client, err := storage.GetClientByClientID(ctx, authReq.Cli... | [
-0.47057244181632996,
-0.9250701665878296,
0.7792832851409912,
-0.38971269130706787,
-0.20894981920719147,
-0.1665181964635849,
0.6593482494354248,
-1.075054407119751,
0.6092895269393921,
-0.037043265998363495,
0.019002236425876617,
0.6910610795021057,
-0.03292768821120262,
0.6312531232833... |
func ValidateAuthReqPrompt(prompts []string, maxAge *uint) (_ *uint, err error) {
for _, prompt := range prompts {
if prompt == oidc.PromptNone && len(prompts) > 1 {
return nil, oidc.ErrInvalidRequest().WithDescription("The prompt parameter `none` must only be used as a single value")
}
if prompt == oidc.Prom... | [
-1.5569581985473633,
-0.6340354084968567,
0.6460457444190979,
0.02433953620493412,
-0.41005945205688477,
0.20605677366256714,
0.3023549020290375,
-0.053604621440172195,
0.9149120450019836,
0.12579315900802612,
0.4843895137310028,
0.3068421185016632,
-1.094639778137207,
0.2528800070285797,
... |
func ValidateAuthReqScopes(client Client, scopes []string) ([]string, error) {
if len(scopes) == 0 {
return nil, oidc.ErrInvalidRequest().
WithDescription("The scope of your request is missing. Please ensure some scopes are requested. " +
"If you have any questions, you may contact the administrator of the ap... | [
-0.9935501217842102,
-0.795452892780304,
0.6523039937019348,
-0.2407793402671814,
-0.4288998246192932,
0.25160932540893555,
-0.17578792572021484,
-0.9585382342338562,
1.0366977453231812,
0.8728911280632019,
0.5937445163726807,
0.8362607955932617,
-1.1436554193496704,
0.3890308141708374,
... |
func ValidateAuthReqRedirectURI(client Client, uri string, responseType oidc.ResponseType) error {
if uri == "" {
return oidc.ErrInvalidRequestRedirectURI().WithDescription("The redirect_uri is missing in the request. " +
"Please ensure it is added to the request. If you have any questions, you may contact the ad... | [
-0.3659646511077881,
-0.5393418073654175,
0.9467530846595764,
0.23770107328891754,
-0.24483349919319153,
0.4893852174282074,
0.6719878911972046,
-1.4812324047088623,
0.8474670648574829,
-0.4802006483078003,
0.8812116980552673,
1.0041966438293457,
-0.8232113122940063,
0.1885126233100891,
... |
func validateAuthReqRedirectURINative(client Client, uri string, responseType oidc.ResponseType) error {
parsedURL, isLoopback := HTTPLoopbackOrLocalhost(uri)
isCustomSchema := !strings.HasPrefix(uri, "http://")
if str.Contains(client.RedirectURIs(), uri) {
if isLoopback || isCustomSchema {
return nil
}
ret... | [
-0.55351322889328,
-0.5850415229797363,
0.8711839914321899,
-0.01131095364689827,
-0.7429677248001099,
0.4375450313091278,
0.24351440370082855,
-1.226382851600647,
0.24228879809379578,
-0.4669627249240875,
0.8962852954864502,
0.8187715411186218,
-0.49348747730255127,
0.2206394076347351,
... |
func ValidateAuthReqResponseType(client Client, responseType oidc.ResponseType) error {
if responseType == "" {
return oidc.ErrInvalidRequest().WithDescription("The response type is missing in your request. " +
"If you have any questions, you may contact the administrator of the application.")
}
if !ContainsRes... | [
0.13873010873794556,
-0.8653993010520935,
0.4058859050273895,
-0.44243547320365906,
0.2880450487136841,
0.4801458716392517,
0.7135887742042542,
-1.3608293533325195,
0.6021947264671326,
-0.10148919373750687,
0.694771409034729,
0.6411586999893188,
-0.6143829226493835,
0.6633466482162476,
1... |
func ValidateAuthReqIDTokenHint(ctx context.Context, idTokenHint string, verifier IDTokenHintVerifier) (string, error) {
if idTokenHint == "" {
return "", nil
}
claims, err := VerifyIDTokenHint(ctx, idTokenHint, verifier)
if err != nil {
return "", oidc.ErrLoginRequired().WithDescription("The id_token_hint is i... | [
0.21723704040050507,
-0.48908451199531555,
0.4026818573474884,
-0.9267138838768005,
-0.025746159255504608,
0.7905476093292236,
-1.0931450128555298,
-1.457120418548584,
0.3769283890724182,
-0.6549442410469055,
0.27977025508880615,
0.7552075982093811,
-0.4599323570728302,
-0.1743049323558807... |
func RedirectToLogin(authReqID string, client Client, w http.ResponseWriter, r *http.Request) {
login := client.LoginURL(authReqID)
http.Redirect(w, r, login, http.StatusFound)
} | [
-1.0970313549041748,
-0.7538125514984131,
0.18175913393497467,
-0.5359278321266174,
0.03921769931912422,
1.094780683517456,
0.37185508012771606,
-0.6618676781654358,
0.7638280391693115,
-0.41257378458976746,
0.026538202539086342,
0.9137111306190491,
0.4779335856437683,
-0.5081197023391724,... |
func AuthorizeCallback(w http.ResponseWriter, r *http.Request, authorizer Authorizer) {
params := mux.Vars(r)
id := params["id"]
authReq, err := authorizer.Storage().AuthRequestByID(r.Context(), id)
if err != nil {
AuthRequestError(w, r, nil, err, authorizer.Encoder())
return
}
if !authReq.Done() {
AuthReq... | [
-0.4113070070743561,
0.1758001148700714,
0.633976399898529,
0.4273384213447571,
0.15340830385684967,
-0.9334419965744019,
0.21372948586940765,
-0.5674543380737305,
1.5396186113357544,
0.712674617767334,
0.5777109265327454,
0.10378047823905945,
-0.0001460639905417338,
0.252408504486084,
0... |
func AuthResponse(authReq AuthRequest, authorizer Authorizer, w http.ResponseWriter, r *http.Request) {
client, err := authorizer.Storage().GetClientByClientID(r.Context(), authReq.GetClientID())
if err != nil {
AuthRequestError(w, r, authReq, err, authorizer.Encoder())
return
}
if authReq.GetResponseType() == ... | [
-0.0348736010491848,
-0.7080927491188049,
0.42330390214920044,
-0.034653909504413605,
0.1343863308429718,
-1.1840839385986328,
0.29985788464546204,
-0.5805562734603882,
1.465488314628601,
0.15599046647548676,
0.30655574798583984,
0.1851596236228943,
-0.07953234016895294,
-0.280795335769653... |
func AuthResponseCode(w http.ResponseWriter, r *http.Request, authReq AuthRequest, authorizer Authorizer) {
code, err := CreateAuthRequestCode(r.Context(), authReq, authorizer.Storage(), authorizer.Crypto())
if err != nil {
AuthRequestError(w, r, authReq, err, authorizer.Encoder())
return
}
codeResponse := stru... | [
-0.7005807757377625,
-0.6407912969589233,
0.515038013458252,
-0.14336305856704712,
-0.06353561580181122,
-0.1168927252292633,
0.8841844201087952,
0.10403946042060852,
1.0859375,
0.05373392999172211,
0.3257065415382385,
-0.10059244930744171,
0.6241331100463867,
0.11409864574670792,
0.6571... |
func AuthResponseToken(w http.ResponseWriter, r *http.Request, authReq AuthRequest, authorizer Authorizer, client Client) {
createAccessToken := authReq.GetResponseType() != oidc.ResponseTypeIDTokenOnly
resp, err := CreateTokenResponse(r.Context(), authReq, client, authorizer, createAccessToken, "", "")
if err != ni... | [
-0.5396125912666321,
-0.8066691756248474,
0.5466817617416382,
-0.5809919834136963,
0.161467507481575,
0.19494931399822235,
1.087234616279602,
-0.2872137725353241,
1.192897915840149,
-0.5764788389205933,
-0.03290223330259323,
0.2141893357038498,
0.5906433463096619,
-0.033418476581573486,
... |
func CreateAuthRequestCode(ctx context.Context, authReq AuthRequest, storage Storage, crypto Crypto) (string, error) {
code, err := BuildAuthRequestCode(authReq, crypto)
if err != nil {
return "", err
}
if err := storage.SaveAuthCode(ctx, authReq.GetID(), code); err != nil {
return "", err
}
return code, nil
... | [
-0.47985363006591797,
-0.6906744241714478,
0.47852274775505066,
0.43419069051742554,
-0.23110729455947876,
-0.22601649165153503,
-0.09243229031562805,
0.17904114723205566,
0.20096981525421143,
-0.053790364414453506,
-0.058307066559791565,
0.11303643137216568,
-0.38799136877059937,
0.475085... |
func BuildAuthRequestCode(authReq AuthRequest, crypto Crypto) (string, error) {
return crypto.Encrypt(authReq.GetID())
} | [
-1.1171460151672363,
-0.7010831832885742,
0.4874458909034729,
0.4945540130138397,
-0.4634748101234436,
-0.43959006667137146,
-0.28522101044654846,
0.3460944890975952,
0.2971270680427551,
0.274676650762558,
0.0978081151843071,
0.8579521179199219,
-0.16495837271213531,
-0.18524515628814697,
... |
func AuthResponseURL(redirectURI string, responseType oidc.ResponseType, responseMode oidc.ResponseMode, response interface{}, encoder httphelper.Encoder) (string, error) {
params, err := httphelper.URLEncodeResponse(response, encoder)
if err != nil {
return "", oidc.ErrServerError().WithParent(err)
}
if response... | [
-0.7448381781578064,
-0.8327739238739014,
0.6392905712127686,
-0.35272595286369324,
0.2104882150888443,
-0.3314705789089203,
0.31960242986679077,
-0.843099057674408,
1.7791029214859009,
-0.07876652479171753,
0.24406248331069946,
0.11750514805316925,
-0.5154015421867371,
-0.5339494943618774... |
func NewAlert(input string) (Alert, error) {
var alert Alert
values := strings.Split(input, " ")
if len(values) != 4 {
err := errors.New("input not valid")
return alert, err
}
name := fmt.Sprintf("BTC_%s", strings.ToUpper(values[1]))
compare := values[2]
value, err := strconv.ParseFloat(values[3], 64)
if... | [
0.7285920977592468,
-0.7062256932258606,
0.577562153339386,
0.38973158597946167,
-1.0001347064971924,
0.009152919985353947,
-0.30413758754730225,
-0.949522852897644,
-0.5001735091209412,
0.6677486896514893,
-0.1733771115541458,
0.19523006677627563,
-0.9901111721992493,
-0.4408136308193207,... |
func (o *officeUserCreator) CreateOfficeUser(officeUser *models.OfficeUser, transportationIDFilter []services.QueryFilter) (*models.OfficeUser, *validate.Errors, error) {
// Use FetchOne to see if we have a transportation office that matches the provided id
var transportationOffice models.TransportationOffice
fetchE... | [
-0.25427475571632385,
0.15191158652305603,
0.698829710483551,
0.3619169294834137,
-0.0026725498028099537,
-0.16269201040267944,
0.4408831298351288,
0.18780812621116638,
0.6261440515518188,
0.8785650730133057,
-0.08574973046779633,
-0.8478496074676514,
-0.6982119083404541,
-0.02345347777009... |
func NewOfficeUserCreator(db *pop.Connection, builder officeUserQueryBuilder) services.OfficeUserCreator {
return &officeUserCreator{db, builder}
} | [
-0.3060721755027771,
0.0027177499141544104,
0.07022023946046829,
0.3622502088546753,
-1.2579736709594727,
0.28886929154396057,
0.24113188683986664,
0.5528801679611206,
0.2782084047794342,
-0.3100813329219818,
-0.3546715974807739,
-0.6643144488334656,
-0.36681368947029114,
-0.03042829036712... |
func ConstructManifestWorkName(instance *agentv1.KlusterletAddonConfig, addon KlusterletAddon) string {
return instance.Name + manifestworkMidName + addon.GetAddonName()
} | [
-0.2917849123477936,
-1.3891271352767944,
0.4814983308315277,
-0.41204169392585754,
-1.2889717817306519,
0.640690267086029,
-1.2194467782974243,
0.516512393951416,
0.4045892059803009,
0.9573409557342529,
-0.02730950154364109,
0.16325139999389648,
-0.021774927154183388,
0.5280945301055908,
... |
func GetAddonFromManifestWorkName(manifestworkName string) (KlusterletAddon, error) {
err := fmt.Errorf("failed to find addon from ManifestWork %s", manifestworkName)
// get addon name
idx := strings.LastIndex(manifestworkName, manifestworkMidName)
if idx < 0 || idx+len(manifestworkMidName) >= len(manifestworkName)... | [
0.21905188262462616,
-1.2444652318954468,
0.8690478801727295,
0.3598718047142029,
-1.3405325412750244,
0.44612494111061096,
-0.9079124331474304,
-0.610896110534668,
0.3844910264015198,
0.28892117738723755,
0.021076085045933723,
0.5355721712112427,
-1.2534773349761963,
-0.24953684210777283,... |
func GetAddonFromManagedClusterAddonName(name string) (KlusterletAddon, error) {
err := fmt.Errorf("failed to find addon from ManagedClusterAddOn %s", name)
if addon, ok := managedClusterAddOnNameMap[name]; ok {
return addon, nil
}
return nil, err
} | [
0.962131679058075,
-0.7545887231826782,
0.594224750995636,
0.2610708773136139,
-1.4655324220657349,
0.5303931832313538,
-1.3693883419036865,
-0.43986228108406067,
0.6575697660446167,
0.38379597663879395,
-0.26084956526756287,
0.9374666213989258,
-1.0240941047668457,
0.46022409200668335,
... |
func NewAddonNamePredicate() predicate.Predicate {
return predicate.Predicate(predicate.Funcs{
GenericFunc: func(e event.GenericEvent) bool { return false },
CreateFunc: func(e event.CreateEvent) bool {
if e.Object == nil {
log.Error(nil, "Create event has no runtime object to create", "event", e)
retur... | [
0.568572461605072,
-0.6717959046363831,
0.9666346907615662,
-0.16217876970767975,
-0.7108069658279419,
0.4569968283176422,
-0.6499197483062744,
-0.34781613945961,
-0.019681500270962715,
0.5622071027755737,
-0.25263410806655884,
0.5889052152633667,
-0.2743571102619171,
0.6570424437522888,
... |
func GetAddonClusterRolePrefix() string {
return os.Getenv("ADDON_CLUSTERROLE_PREFIX")
} | [
0.44578614830970764,
-0.5793454051017761,
0.07649808377027512,
-0.19298037886619568,
0.11337632685899734,
0.561309278011322,
-0.8204799294471741,
0.16634781658649445,
-0.0855455994606018,
0.925604522228241,
-0.36106935143470764,
1.0445164442062378,
-0.36879852414131165,
0.24142403900623322... |
func BoolToString(v Bool) String {
str := &stringFromBool{from: v}
v.AddListener(str)
return str
} | [
0.17617586255073547,
-0.5863274335861206,
0.2810514271259308,
-0.900818407535553,
-0.6301577091217041,
0.890159547328949,
-0.37531915307044983,
-1.1281791925430298,
-0.37661752104759216,
-0.14047405123710632,
-0.6632093787193298,
0.11210469156503677,
0.6063015460968018,
-1.257627010345459,... |
func BoolToStringWithFormat(v Bool, format string) String {
if format == "%t" { // Same as not using custom formatting.
return BoolToString(v)
}
str := &stringFromBool{from: v, format: format}
v.AddListener(str)
return str
} | [
-0.029836613684892654,
-1.3554447889328003,
0.31278279423713684,
-0.5263606905937195,
-0.7289934754371643,
-0.004525196738541126,
-1.379919171333313,
-0.9631174206733704,
-0.46418049931526184,
0.1260802447795868,
0.39316263794898987,
0.07248834520578384,
0.7450934648513794,
-0.703014731407... |
func FloatToString(v Float) String {
str := &stringFromFloat{from: v}
v.AddListener(str)
return str
} | [
0.3597794473171234,
0.02617529034614563,
0.3265526294708252,
-0.9634947180747986,
0.4232867360115051,
0.41580668091773987,
0.2905420660972595,
-0.6734722852706909,
-0.2131718397140503,
-0.3020867705345154,
-0.2378680258989334,
-0.34277650713920593,
0.28302001953125,
0.13074009120464325,
... |
func FloatToStringWithFormat(v Float, format string) String {
if format == "%f" { // Same as not using custom formatting.
return FloatToString(v)
}
str := &stringFromFloat{from: v, format: format}
v.AddListener(str)
return str
} | [
0.18529845774173737,
-0.7537856101989746,
0.4559900462627411,
-0.2384452074766159,
-0.19126655161380768,
-0.4158441722393036,
-1.0120071172714233,
-0.6330334544181824,
-0.007649187929928303,
-0.22647665441036224,
1.0382651090621948,
-0.3205192983150482,
0.4180870056152344,
0.24584017693996... |
func IntToString(v Int) String {
str := &stringFromInt{from: v}
v.AddListener(str)
return str
} | [
0.16011017560958862,
-0.4838905334472656,
0.19792941212654114,
-1.5851157903671265,
-0.1403234601020813,
0.5857436656951904,
0.006617860868573189,
-1.4489914178848267,
0.6938999891281128,
0.4549230933189392,
-0.4478236138820648,
-0.33797597885131836,
0.3356449007987976,
-0.2430457919836044... |
func IntToStringWithFormat(v Int, format string) String {
if format == "%d" { // Same as not using custom formatting.
return IntToString(v)
}
str := &stringFromInt{from: v, format: format}
v.AddListener(str)
return str
} | [
-0.23667392134666443,
-0.9503797888755798,
0.40816837549209595,
-0.8046199083328247,
-0.6377529501914978,
-0.39418911933898926,
-0.9993605017662048,
-1.1990009546279907,
0.8916829228401184,
0.2202267348766327,
0.8168527483940125,
-0.3113052248954773,
0.5635049939155579,
0.10742193460464478... |
func URIToString(v URI) String {
str := &stringFromURI{from: v}
v.AddListener(str)
return str
} | [
-0.443972110748291,
-0.7572671175003052,
0.45263949036598206,
-1.0507837533950806,
-0.09791602939367294,
0.9498499035835266,
-0.1061910018324852,
-0.5285294651985168,
0.6434242129325867,
-0.9904758334159851,
-0.5362863540649414,
-0.3416636884212494,
0.2192809134721756,
-1.233054757118225,
... |
func StringToBool(str String) Bool {
v := &stringToBool{from: str}
str.AddListener(v)
return v
} | [
0.8434881567955017,
-1.1490501165390015,
0.2631537616252899,
-0.25667938590049744,
-0.5534250140190125,
0.6799355745315552,
0.21154718101024628,
-0.32749202847480774,
0.3109076917171478,
0.015969986096024513,
-0.9209707379341125,
0.9391228556632996,
0.596287190914154,
-1.2814931869506836,
... |
func StringToBoolWithFormat(str String, format string) Bool {
if format == "%t" { // Same as not using custom format.
return StringToBool(str)
}
v := &stringToBool{from: str, format: format}
str.AddListener(v)
return v
} | [
0.40010347962379456,
-1.7679803371429443,
0.3724425733089447,
0.0024616229347884655,
-0.5830336213111877,
0.25655707716941833,
-1.3677258491516113,
-0.37252098321914673,
-0.027029098942875862,
0.3322334289550781,
0.2252989560365677,
0.4874733090400696,
0.810845136642456,
-0.585258126258850... |
func StringToFloat(str String) Float {
v := &stringToFloat{from: str}
str.AddListener(v)
return v
} | [
1.6092568635940552,
-1.0488075017929077,
0.32222646474838257,
-0.5427529215812683,
-0.37823933362960815,
-0.18243645131587982,
0.4759441316127777,
-0.7258856296539307,
0.18623191118240356,
-0.8014155626296997,
-0.8133373856544495,
0.3583667576313019,
0.2594497501850128,
-0.3711993396282196... |
func StringToFloatWithFormat(str String, format string) Float {
if format == "%f" { // Same as not using custom format.
return StringToFloat(str)
}
v := &stringToFloat{from: str, format: format}
str.AddListener(v)
return v
} | [
1.0741138458251953,
-1.3035597801208496,
0.4141075015068054,
0.005079984664916992,
-0.48703885078430176,
-0.507583737373352,
-0.9734996557235718,
-0.7394315004348755,
0.08892812579870224,
-0.5423851609230042,
0.4731203615665436,
0.49363934993743896,
0.6773923635482788,
0.10273855924606323,... |
func StringToInt(str String) Int {
v := &stringToInt{from: str}
str.AddListener(v)
return v
} | [
1.1519039869308472,
-1.3467434644699097,
0.273118793964386,
-1.1880441904067993,
-0.9455199837684631,
-0.22796492278575897,
0.4484676718711853,
-1.0643163919448853,
0.1959698647260666,
-0.16067922115325928,
-1.089146375656128,
0.3314935266971588,
-0.017138846218585968,
-0.939778208732605,
... |
func StringToIntWithFormat(str String, format string) Int {
if format == "%d" { // Same as not using custom format.
return StringToInt(str)
}
v := &stringToInt{from: str, format: format}
str.AddListener(v)
return v
} | [
0.5692522525787354,
-1.5775212049484253,
0.4963599145412445,
-0.3300505578517914,
-0.8486238121986389,
-0.5844197273254395,
-0.7177583575248718,
-0.8059374094009399,
0.377714604139328,
-0.07004312425851822,
0.1503199338912964,
0.21030567586421967,
0.07069431245326996,
-0.1949271261692047,
... |
func StringToURI(str String) URI {
v := &stringToURI{from: str}
str.AddListener(v)
return v
} | [
0.2831357419490814,
-0.9701218008995056,
0.3145207464694977,
-0.25585293769836426,
-1.0599851608276367,
-0.12096510827541351,
-0.1309356838464737,
0.45409849286079407,
-0.3941158950328827,
-0.9311312437057495,
-1.2201675176620483,
0.45860010385513306,
0.08186449110507965,
-1.08105993270874... |
func (d *Dao) GitLabFace(c context.Context, username string) (avatarURL string, err error) {
params := url.Values{}
params.Set("username", username)
params.Set("private_token", conf.Conf.Gitlab.Token)
var req *http.Request
if req, err = http.NewRequest(http.MethodGet, _gitUsersAPI, strings.NewReader(params.Encode(... | [
-0.5770837068557739,
0.7622538805007935,
0.7617599964141846,
-0.2643711268901825,
-0.12470560520887375,
0.41607385873794556,
0.10936973989009857,
-1.186535358428955,
-0.5226723551750183,
1.0119272470474243,
-0.4440158009529114,
0.22342658042907715,
-0.35109415650367737,
0.4371444284915924,... |
func (a FilmActorTable) AS(alias string) *FilmActorTable {
return newFilmActorTable(a.SchemaName(), a.TableName(), alias)
} | [
-0.541941225528717,
-0.45252525806427,
0.4712476134300232,
-0.2894735336303711,
-1.2191232442855835,
-0.321338951587677,
0.1401354968547821,
0.45189887285232544,
-0.3909052610397339,
-0.4224461615085602,
-0.3563513457775116,
0.7475952506065369,
1.4681528806686401,
0.09293533116579056,
-0... |
func (a FilmActorTable) FromSchema(schemaName string) *FilmActorTable {
return newFilmActorTable(schemaName, a.TableName(), a.Alias())
} | [
-0.02363959141075611,
0.04705933481454849,
0.3188353478908539,
0.8943647146224976,
-1.2210338115692139,
-0.38375407457351685,
0.5528929233551025,
1.0155572891235352,
0.06946827471256256,
-0.028989436104893684,
-0.6137443780899048,
0.39022865891456604,
-0.0827958732843399,
0.093385167419910... |
func (a FilmActorTable) WithPrefix(prefix string) *FilmActorTable {
return newFilmActorTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
} | [
-0.14802846312522888,
-0.3228220045566559,
0.37174564599990845,
0.3198767900466919,
-1.0604866743087769,
-0.8557436466217041,
0.33342811465263367,
0.0868028849363327,
0.11204980313777924,
-0.4332083761692047,
-0.38590753078460693,
0.4891820549964905,
1.4429829120635986,
-0.0712202191352844... |
func (a FilmActorTable) WithSuffix(suffix string) *FilmActorTable {
return newFilmActorTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
} | [
0.18559430539608002,
-0.2910294830799103,
0.42376095056533813,
0.5436186790466309,
-1.2829313278198242,
-0.39809650182724,
0.22772611677646637,
0.700396716594696,
-0.189087375998497,
-0.7999879121780396,
-1.037891149520874,
0.6789847612380981,
1.1296724081039429,
-0.028180047869682312,
0... |
func NewGoEncoder(w io.Writer) *GoEncoder {
if w == nil {
w = os.Stdout
}
return &GoEncoder{
w: w,
buf: new(bytes.Buffer),
}
} | [
0.09782189875841141,
0.21152326464653015,
0.04340960830450058,
-0.10990197956562042,
-1.159059762954712,
-0.2390444129705429,
0.2069970816373825,
-0.3491266369819641,
-0.6908681988716125,
0.23491859436035156,
-0.25975602865219116,
-0.0782758891582489,
-0.6093555688858032,
1.696174263954162... |
func (enc *GoEncoder) Encode(data interface{}) error {
var err error
stmts, ok := data.([]Stmt)
if !ok {
return fmt.Errorf("fwk/job: expected a []job.Stmt as input. got %T", data)
}
err = enc.encode(stmts)
if err != nil {
return err
}
buf, err := format.Source(enc.buf.Bytes())
if err != nil {
return er... | [
-0.144196018576622,
0.6016055941581726,
0.7066125273704529,
0.5204195976257324,
-0.14267173409461975,
0.08253566920757294,
0.5883479714393616,
-0.3870529532432556,
-0.5818412899971008,
0.41579774022102356,
0.22060076892375946,
0.4929017722606659,
-0.6773207187652588,
1.1717700958251953,
... |
func GetLogger(namespace string) *zap.SugaredLogger {
return logger.GetLogger(fmt.Sprintf("%s - tests", namespace))
} | [
0.886143147945404,
0.2881585955619812,
0.20746050775051117,
-0.13710416853427887,
0.29330435395240784,
-0.4971289336681366,
-0.4639981985092163,
-0.5788880586624146,
1.1529335975646973,
-0.3347199559211731,
0.5338363647460938,
0.4786497950553894,
-0.7178348898887634,
1.4256622791290283,
... |
func GenerateNamespaceName() string {
rand.Seed(time.Now().UnixNano())
ns := fmt.Sprintf("cucumber-%s", RandSeq(4))
if local := getEnvLocalTests(); local == "true" {
username := getEnvUsername()
ns = fmt.Sprintf("%s-local-%s", username, ns)
}
return ns
} | [
0.00003453168028499931,
0.09060966223478317,
0.6406710743904114,
0.7748558521270752,
-0.5900107622146606,
0.4179200530052185,
0.3253030776977539,
0.4932379126548767,
0.5014211535453796,
-0.06942727416753769,
0.08382868021726608,
-0.2144405096769333,
-0.37726736068725586,
1.4411768913269043... |
func RandSeq(size int) string {
randomLetters := []rune("abcdefghijklmnopqrstuvwxyz0123456789")
b := make([]rune, size)
for i := range b {
b[i] = randomLetters[rand.Intn(len(randomLetters))]
}
return string(b)
} | [
-0.9081577062606812,
0.06120513379573822,
0.5039161443710327,
-1.2065716981887817,
-0.12823283672332764,
-0.015089483931660652,
-0.3157903254032135,
-0.30687084794044495,
0.7361277937889099,
0.6681422591209412,
-1.1818351745605469,
0.09815345704555511,
-0.5548069477081299,
-0.5229386687278... |
func ReadFromURI(uri string) (string, error) {
var data []byte
if strings.HasPrefix(uri, "http") {
resp, err := http.Get(uri)
if err != nil {
return "", err
}
defer resp.Body.Close()
data, err = ioutil.ReadAll(resp.Body)
} else {
// It should be a Filesystem uri
absPath, err := filepath.Abs(uri)
d... | [
-0.40458083152770996,
-0.5035688877105713,
0.8717159628868103,
0.15747703611850739,
-0.9310683608055115,
0.6361867189407349,
-0.8315372467041016,
-0.9356639981269836,
0.18945744633674622,
-0.8867979645729065,
1.6911709308624268,
0.27927273511886597,
-0.5141245126724243,
0.08119446784257889... |
func WaitFor(namespace, display string, timeout time.Duration, condition func() (bool, error)) error {
GetLogger(namespace).Infof("Wait %s for %s", timeout.String(), display)
timeoutChan := time.After(timeout)
tick := time.NewTicker(timeout / 60)
defer tick.Stop()
for {
select {
case <-timeoutChan:
return... | [
-0.05090183764696121,
0.3174172639846802,
0.3436327874660492,
-0.9287346601486206,
-0.758956253528595,
-0.011347799561917782,
-0.7474919557571411,
-0.3157293498516083,
-0.7046151757240295,
-0.06631103157997131,
0.47533395886421204,
0.2170383334159851,
0.8929735422134399,
0.2031810581684112... |
func (tsr *TextSearchRequest) BuildUrlForQuery(path string) {
if path == "" {
path = "https://maps.googleapis.com/maps/api/place/textsearch/" // Defualt path
}
u, err := url.Parse(path + tsr.ResponseType) // append response type parameter
if err != nil {
fmt.Println(err.Error())
panic(err.Error())
}
v :=... | [
-1.1334481239318848,
-0.41992032527923584,
0.4735453724861145,
-0.9723831415176392,
-0.04332095384597778,
0.3268449008464813,
-0.6515578627586365,
0.8714174032211304,
-0.33891761302948,
0.057031791657209396,
0.6569769382476807,
-0.24471242725849152,
0.22013479471206665,
0.7947351932525635,... |
func (tsr *TextSearchRequest) Query(qrfj *QueryResult) (string, error) {
// Get data
res, err := http.Get(tsr.Url) // post
if err != nil {
return "ERROR: ", err
}
// Check resposne code
if res.StatusCode != 200 {
return "ERROR: ", errors.New(res.Status)
}
//DEBUG
// // Output response headers
// for k... | [
-0.5677395462989807,
-0.5005784034729004,
0.7995395064353943,
-0.42176055908203125,
-1.2395790815353394,
0.035245031118392944,
-0.8435282707214355,
-0.40198230743408203,
0.08046332001686096,
0.18733569979667664,
0.24790117144584656,
-0.28356653451919556,
-0.7230263948440552,
0.119725152850... |
func (p *point) assignCenter(c *cluster) int {
//update members
c.Members++
//add in the new values
c.X += (int64(p.X) - c.X) / c.Members
c.Y += (int64(p.Y) - c.Y) / c.Members
c.Z += (int64(p.Z) - c.Z) / c.Members
//update the points center
p.Center = c
//TODO return distance that it moved as per optimizations... | [
-0.06837619096040726,
-0.9421062469482422,
0.5217615962028503,
0.06359896808862686,
0.4741745889186859,
0.3458557426929474,
0.3560631573200226,
1.1703119277954102,
0.05868212878704071,
0.9064429998397827,
-0.3812175691127777,
0.12491529434919357,
-0.9901873469352722,
0.39459115266799927,
... |
func (p *point) unassignCenter() int {
if p.Center == nil {
return 0
}
if p.Center.Members > 1 {
//update members
p.Center.Members--
//get rid of the old value
p.Center.X -= (int64(p.X) - p.Center.X) / p.Center.Members
p.Center.Y -= (int64(p.Y) - p.Center.Y) / p.Center.Members
p.Center.Z -= (int64(p.Z)... | [
0.2244267761707306,
-0.6929010152816772,
0.5343422293663025,
-0.6447824239730835,
-0.13075508177280426,
-0.16469566524028778,
0.5698930025100708,
1.1152061223983765,
0.367069810628891,
0.8962766528129578,
0.1417393833398819,
0.17579416930675507,
-1.054739236831665,
0.41966262459754944,
0... |
func check(err error) {
if err != nil {
fmt.Println(err)
}
} | [
0.6978821158409119,
-0.14739498496055603,
0.13993214070796967,
0.9407389760017395,
0.2199765145778656,
0.15274617075920105,
-0.2342842072248459,
0.4733222723007202,
0.3482421636581421,
0.015816180035471916,
0.7391430139541626,
1.2851622104644775,
0.140264093875885,
1.8087072372436523,
0.... |
func getLayout(n int) (int, int) {
var root float64 = math.Sqrt(float64(n))
var h, w int = int(root), 0
for h > 1 {
if n%h == 0 {
//if we find a multiple, we are done
w = n / h
break
}
//if not, try again
h--
}
if h <= 1 {
h = 1
w = n
}
return w, h
} | [
-0.28611454367637634,
0.48946815729141235,
0.7079953551292419,
0.4165703058242798,
-1.1221437454223633,
-0.4317723512649536,
0.924042820930481,
-0.2560710310935974,
0.2078312635421753,
-1.0019062757492065,
0.7048351764678955,
-0.6215773820877075,
-0.9281519055366516,
1.155821681022644,
0... |
func clusterSort(slice []*cluster) []*cluster {
//Base case
if len(slice) == 1 {
return slice
}
var sorted []*cluster = make([]*cluster, len(slice))
var sortedPtr int = 0
//Otherwise, we have some sorting to do
//so sort each half
left := clusterSort(slice[:len(slice)/2])
right := clusterSort(slice[len(slice... | [
0.012780011631548405,
-0.1708027869462967,
0.796972393989563,
0.15787771344184875,
-0.31630808115005493,
0.00101790193002671,
0.3853221535682678,
-1.3175625801086426,
0.441618412733078,
0.2305905818939209,
-0.1001933366060257,
1.1282029151916504,
-1.153093695640564,
0.286163330078125,
-0... |
func iterate(points []*point, clusters []*cluster) bool {
var stabilized bool = true
for _, point := range points {
//find out which is the closest after last iteration.
newClosest := point.findClosest(clusters)
if newClosest != point.Center {
//if it has changed,
//we need to update the cluster TODO can ... | [
-0.2613101601600647,
-0.18676583468914032,
0.5645791292190552,
0.3605034053325653,
0.31631016731262207,
0.18987497687339783,
-0.13009944558143616,
-0.3406961262226105,
-0.010643579997122288,
1.3916244506835938,
0.5731769800186157,
-0.5374694466590881,
-0.9657672047615051,
0.335755556821823... |
func SetPath(p string) error {
if info, err := os.Stat(p); err != nil {
return err
} else if !info.IsDir() {
return fmt.Errorf("path for persistence is not directory")
}
dataPath = p
return nil
} | [
0.47692376375198364,
0.44311392307281494,
0.7744193077087402,
0.7261765003204346,
0.15066412091255188,
1.2011700868606567,
0.5538312792778015,
-0.23308724164962769,
0.4586062729358673,
-0.42893558740615845,
0.13951468467712402,
0.6464316844940186,
-0.3206510543823242,
0.7551336884498596,
... |
func jsonPath(name string) string {
return path.Join(dataPath, fmt.Sprintf("rove-%s.json", name))
} | [
0.2500172555446625,
-0.47913509607315063,
0.5525678992271423,
-0.5734555125236511,
-0.8168867230415344,
0.12844498455524445,
0.0324578694999218,
-1.316125512123108,
-0.02163439430296421,
0.976313054561615,
-0.1833401471376419,
0.26165771484375,
0.4604431688785553,
-0.3945126533508301,
-0... |
func Save(name string, data interface{}) error {
p := jsonPath(name)
b, err := json.MarshalIndent(data, "", " ")
if err != nil {
return err
}
if err := ioutil.WriteFile(p, b, os.ModePerm); err != nil {
return err
}
log.Printf("Saved %s\n", p)
return nil
} | [
-0.03380594030022621,
-0.4753795862197876,
0.6927382946014404,
-0.5316162705421448,
-0.24585719406604767,
0.4482935070991516,
-0.09936051815748215,
-0.2319488227367401,
-0.5275536775588989,
0.9410293102264404,
-1.253873586654663,
0.379557341337204,
-0.8486224412918091,
-0.05875035747885704... |
func Load(name string, data interface{}) error {
p := jsonPath(name)
// Don't load anything if the file doesn't exist
_, err := os.Stat(p)
if os.IsNotExist(err) {
log.Printf("File %s didn't exist, loading with fresh data\n", p)
return nil
}
// Read and unmarshal the json
if b, err := ioutil.ReadFile(p); err... | [
-0.29291966557502747,
-0.3765421211719513,
0.9028237462043762,
-0.9960536360740662,
-0.6521183848381042,
0.1343114674091339,
-0.8838922381401062,
-0.19541142880916595,
-0.4003942608833313,
0.37573251128196716,
0.1345548778772354,
0.19837504625320435,
-0.4053686261177063,
-0.795877277851104... |
func SaveAll(args ...interface{}) error {
return doAll(Save, args...)
} | [
0.17090724408626556,
0.0037792755756527185,
0.5981534123420715,
1.44669771194458,
0.9822431206703186,
0.6292071342468262,
-0.711450457572937,
0.365614652633667,
-0.3702232539653778,
0.2899976074695587,
-0.876605749130249,
0.439239501953125,
-0.1872256100177765,
1.6265969276428223,
-0.435... |
func LoadAll(args ...interface{}) error {
return doAll(Load, args...)
} | [
0.7461364269256592,
0.40929532051086426,
0.614606499671936,
1.1532940864562988,
0.4413813650608063,
0.38501372933387756,
-1.1598931550979614,
-0.24273422360420227,
-0.32932308316230774,
-0.18117250502109528,
-0.2708783745765686,
1.2699395418167114,
-0.1861642450094223,
1.5358306169509888,
... |
func NewCase(evaluator evaluatorFunc, command commandFunc) Case {
return Case{
evaluator: evaluator,
command: command,
}
} | [
0.6410457491874695,
-0.7685310244560242,
0.11552614718675613,
0.8446364998817444,
-0.30868232250213623,
-0.3052561581134796,
-0.31261780858039856,
0.2620319724082947,
0.5033218860626221,
0.2542307674884796,
1.177929401397705,
0.14929966628551483,
-0.14747340977191925,
0.5820910930633545,
... |
func (EventField) Fields() []ent.Field {
return []ent.Field{
field.String("key").Immutable(),
field.String("value").Immutable(),
}
} | [
-0.5926975607872009,
-0.21902711689472198,
0.2271726280450821,
-1.130878210067749,
0.4760478138923645,
0.7449039816856384,
-0.7516784071922302,
0.5028044581413269,
-0.17238716781139374,
-0.05163959413766861,
-0.6667611002922058,
-0.17458947002887726,
-0.13897643983364105,
0.493492066860199... |
func (EventField) Edges() []ent.Edge {
return []ent.Edge{
edge.From("event", Event.Type).Ref("field"),
}
} | [
-0.22969895601272583,
-0.05757281556725502,
0.3505280613899231,
-0.18468600511550903,
1.045503854751587,
0.6784467697143555,
-0.6670631766319275,
0.6520033478736877,
0.21031060814857483,
0.2637714445590973,
-0.09439621865749359,
0.6265314817428589,
-0.16704578697681427,
0.31243038177490234... |
func apmStart(w io.Writer, cancel func(), flags []string) (*apmProc, error) {
apmCmd := apmProc{Cmd: exec.Command("./apm-server", flags...)}
apmCmd.Dir = apmDir()
out.ReplyNL(w, out.Grey)
out.ReplyWithDots(w, apmCmd.Args...)
// apm-server writes to stderr by default, this consumes it as soon is produced
stderr,... | [
-0.20475389063358307,
-0.8359166383743286,
0.953887939453125,
-0.3362722098827362,
-0.4097084403038025,
0.0658186748623848,
0.01022201869636774,
-0.4672345221042633,
0.39471763372421265,
0.24109245836734772,
0.991515040397644,
0.8482282161712646,
-0.26821228861808777,
0.22280243039131165,
... |
func tail(log []string, n int) string {
w := out.NewBufferWriter()
n = int(math.Min(float64(n), 1000))
tailN := int(math.Max(0, float64(len(log)-n)))
for _, line := range log[tailN:] {
if strings.Contains(line, "ERROR") || strings.Contains(line, "Error:") {
out.Reply(w, out.Red)
} else if strings.Contains(li... | [
0.1533348262310028,
-0.23445464670658112,
0.9694291949272156,
-0.4595355987548828,
-0.34408435225486755,
-0.16617879271507263,
-1.2028478384017944,
-1.802167296409607,
-0.314554363489151,
0.28129252791404724,
0.20622876286506653,
1.0440411567687988,
0.20857879519462585,
0.44707128405570984... |
func NewClient(apiToken string) *Client {
baseURL, _ := url.Parse(defaultBaseURL)
return &Client{
apiToken: apiToken,
baseURL: baseURL,
HTTPClient: &http.Client{Timeout: 5 * time.Second},
}
} | [
0.34031036496162415,
-0.4618031084537506,
-0.007771276403218508,
-0.26752665638923645,
-0.35745522379875183,
-0.6111755967140198,
-0.3977600038051605,
-0.05480290576815605,
-0.42683589458465576,
-0.21330749988555908,
-0.8636096119880676,
0.2616196572780609,
-0.6253275275230408,
-0.78337764... |
func Init(svr *grpc.Server) {
sds, _ := grpcreflect.LoadServiceDescriptors(svr)
methodStore = make(map[string]*pbbase.OptionBase)
for _, sd := range sds {
for _, md := range sd.GetMethods() {
opts := md.GetMethodOptions()
val, err := proto.GetExtension(opts, pbbase.E_OptionBase)
if err == nil {
optio... | [
-1.0092600584030151,
0.2582758069038391,
0.6271920800209045,
-0.5421552062034607,
0.3657473921775818,
0.26067325472831726,
0.10149922966957092,
-0.11462996900081635,
-0.20929838716983795,
0.5140071511268616,
0.006588186137378216,
0.5334900617599487,
-0.30276015400886536,
1.1194621324539185... |
func IsIgnoreTokenVerify(methodName string) bool {
val, ok := methodStore[methodName]
if ok {
return val.IgnoreTokenVerify
}
return false
} | [
-0.295790433883667,
0.49807411432266235,
0.21071630716323853,
0.3943561315536499,
-0.6349343657493591,
-0.2116842418909073,
-0.6541033387184143,
-0.5028690695762634,
0.6259238719940186,
-0.03595215082168579,
-0.943120539188385,
0.03185279294848442,
-1.2013109922409058,
0.940575361251831,
... |
func TxOption(methodName string) pbbase.TxOption {
val, ok := methodStore[methodName]
if ok {
return val.TxOption
}
return pbbase.TxOption_ReadWrite
} | [
-0.06526824086904526,
0.31015628576278687,
0.43904009461402893,
0.374580055475235,
-0.12270470708608627,
-0.9265441298484802,
0.9233273267745972,
-0.42351698875427246,
0.7388808727264404,
1.6856201887130737,
-0.035277217626571655,
-0.7021641135215759,
-0.968865156173706,
-0.074810042977333... |
func max(v ...int) int {
out := 0
for i := range v {
if v[i] > out {
out = v[i]
}
}
return out
} | [
-0.741054117679596,
0.713375449180603,
0.40617725253105164,
0.9678909778594971,
0.07934226840734482,
-0.12044186890125275,
-0.47845423221588135,
-0.2547051012516022,
-0.5073512196540833,
0.23099638521671295,
-0.7979682087898254,
0.018840432167053223,
-0.27076929807662964,
0.431758075952529... |
func min(v ...int) int {
out := 0
if len(v) >= 1 {
out = v[0]
}
for i := range v {
if v[i] < out {
out = v[i]
}
}
return out
} | [
-0.7570596933364868,
0.17289093136787415,
0.24841028451919556,
0.9254263639450073,
-0.3274305462837219,
0.03209182992577553,
-0.2501695454120636,
-0.471429705619812,
0.03794539347290993,
-0.38753700256347656,
-0.6672318577766418,
-0.18427784740924835,
-0.7706071138381958,
0.827904880046844... |
func playerInList(p Player, ls []Player) bool {
for _, player := range ls {
if p == player {
return true
}
}
return false
} | [
-0.4345616400241852,
-1.308815836906433,
0.4633677303791046,
0.2876218855381012,
-0.7055214643478394,
0.18292555212974548,
-1.1598625183105469,
1.029269814491272,
0.12738783657550812,
0.5785645246505737,
-0.8008874654769897,
0.010498112998902798,
-1.101670503616333,
0.21044832468032837,
... |
func (b *Board) copy() *Board {
newBoard := &Board{
Player1: make([]Square, len(b.Player1)),
Player2: make([]Square, len(b.Player2)),
result: b.result,
}
for i := range b.Player1 {
newBoard.Player1[i] = b.Player1[i]
}
for i := range b.Player2 {
newBoard.Player2[i] = b.Player2[i]
}
return newBoard
} | [
-0.7634122967720032,
-0.2905516028404236,
0.7792235016822815,
0.7679402828216553,
-1.0176013708114624,
0.8436462879180908,
0.36461159586906433,
-0.2651347517967224,
-0.05748983472585678,
0.7792996168136597,
-0.11101005226373672,
0.4292350709438324,
-1.008389949798584,
-0.7090957760810852,
... |
func (eval *boardEvaluator) isWin() bool {
for _, row := range eval.Rows {
if len(row) == 3 {
return true
}
}
for _, col := range eval.Cols {
if len(col) == 3 {
return true
}
}
for _, diag := range eval.Diag {
if len(diag) == 3 {
return true
}
}
return false
} | [
-0.39079466462135315,
0.36247220635414124,
0.5880765914916992,
0.9666415452957153,
0.020216455683112144,
-0.13477033376693726,
0.3406531810760498,
0.5150274634361267,
0.13242217898368835,
-0.5653107166290283,
-0.44695845246315,
0.7842388153076172,
0.27333304286003113,
0.660880446434021,
... |
func (b *Board) evaluate_static() Player {
if newBoardEvaluator(b.Player1).isWin() {
return Player1
} else if newBoardEvaluator(b.Player2).isWin() {
return Player2
}
return NoPlayer
} | [
-1.048600435256958,
0.05210794135928154,
0.5599395036697388,
0.7432252168655396,
-0.6028671264648438,
0.041731011122465134,
0.18105313181877136,
-0.2640838623046875,
-0.629142701625824,
0.4313865900039673,
0.29809823632240295,
1.1169188022613525,
-0.6749457120895386,
0.7105269432067871,
... |
func (b *Board) score() Player {
static_eval := b.evaluate_static()
if static_eval != NoPlayer {
return static_eval
}
if len(b.vacantSquares()) == 0 {
return NoPlayer
}
branch_evals := func() []Player {
out := []Player{}
for _, branch := range b.possibleMoves() {
out = append(out, branch.score())
}... | [
-0.202522411942482,
0.04976882413029671,
0.8954533338546753,
0.7557759881019592,
-0.40495115518569946,
-0.1680210530757904,
0.6057263016700745,
-0.03171844035387039,
-0.36430659890174866,
0.6611045002937317,
0.20495855808258057,
0.15590082108974457,
-0.968061089515686,
0.3423847258090973,
... |
func MakeOptimalMove(b *Board) {
aiPlayer := b.NextPlayer()
branch_evals := func() []Player {
out := []Player{}
for _, branch := range b.possibleMoves() {
out = append(out, branch.score())
}
return out
}()
var choice Player
switch aiPlayer {
case Player1:
if playerInList(Player1, branch_evals) {
... | [
-0.1777375340461731,
-0.33757153153419495,
0.8635140061378479,
0.33996424078941345,
-0.48806455731391907,
0.20716004073619843,
0.43588951230049133,
0.3450517952442169,
-0.24977470934391022,
0.9396504759788513,
0.02889675460755825,
0.07299302518367767,
-0.30938977003097534,
-0.5046513676643... |
func NewCreateCardPaymentSourceParams() *CreateCardPaymentSourceParams {
var ()
return &CreateCardPaymentSourceParams{
timeout: cr.DefaultTimeout,
}
} | [
-0.05529163032770157,
0.8308323621749878,
0.024032657966017723,
-0.394265741109848,
-0.15646778047084808,
-0.09006427973508835,
-1.0552313327789307,
0.8459032773971558,
0.004793785512447357,
0.7366335391998291,
-0.9522068500518799,
-0.4208402931690216,
-0.7753579616546631,
0.39399001002311... |
func NewCreateCardPaymentSourceParamsWithTimeout(timeout time.Duration) *CreateCardPaymentSourceParams {
var ()
return &CreateCardPaymentSourceParams{
timeout: timeout,
}
} | [
0.3784988224506378,
0.7864222526550293,
0.19222022593021393,
-0.28311899304389954,
-0.153533473610878,
0.46673208475112915,
-1.6384836435317993,
0.37767690420150757,
-0.14301671087741852,
1.6116480827331543,
-0.5954403877258301,
0.11273101717233658,
-0.4396471381187439,
0.6941248774528503,... |
func NewCreateCardPaymentSourceParamsWithContext(ctx context.Context) *CreateCardPaymentSourceParams {
var ()
return &CreateCardPaymentSourceParams{
Context: ctx,
}
} | [
-0.19875416159629822,
0.8967798948287964,
0.4092480540275574,
-0.7912784218788147,
-0.1412842571735382,
0.5065067410469055,
-1.384553074836731,
-0.16906185448169708,
0.4268345236778259,
1.1169096231460571,
-0.804562509059906,
-0.3645009398460388,
-0.3825890123844147,
-0.1424391120672226,
... |
func NewCreateCardPaymentSourceParamsWithHTTPClient(client *http.Client) *CreateCardPaymentSourceParams {
var ()
return &CreateCardPaymentSourceParams{
HTTPClient: client,
}
} | [
-0.07336533814668655,
0.5102617144584656,
0.21248702704906464,
-0.4772176444530487,
0.09263185411691666,
0.6135841608047485,
-0.2913011312484741,
0.3557065427303314,
-0.23298774659633636,
0.7108248472213745,
-0.7062490582466125,
-0.41246962547302246,
-0.3388681709766388,
-0.052975494414567... |
func (o *CreateCardPaymentSourceParams) WithTimeout(timeout time.Duration) *CreateCardPaymentSourceParams {
o.SetTimeout(timeout)
return o
} | [
0.1728784441947937,
1.0124883651733398,
0.16827306151390076,
-0.9678635597229004,
-0.5049761533737183,
-0.040026407688856125,
-1.1605409383773804,
0.0734349712729454,
0.10479371249675751,
0.8852705955505371,
-0.3381105065345764,
-0.0009967641672119498,
0.26862335205078125,
0.30059391260147... |
func (o *CreateCardPaymentSourceParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
} | [
-0.13761036098003387,
1.013916254043579,
0.14402350783348083,
-1.1809189319610596,
-0.020936843007802963,
0.5319859385490417,
-1.014556884765625,
0.21056152880191803,
-0.3860163986682892,
1.0242682695388794,
-0.5197017788887024,
0.3155231475830078,
-0.46126630902290344,
0.5334687829017639,... |
func (o *CreateCardPaymentSourceParams) WithContext(ctx context.Context) *CreateCardPaymentSourceParams {
o.SetContext(ctx)
return o
} | [
-0.6651937961578369,
0.9625486135482788,
0.2911110520362854,
-1.0959975719451904,
-0.6705452799797058,
-0.10167708247900009,
-1.2935943603515625,
-0.5827504396438599,
0.5362778902053833,
0.2620595097541809,
-0.5102307200431824,
-0.28996142745018005,
-0.24228112399578094,
-0.262761712074279... |
func (o *CreateCardPaymentSourceParams) SetContext(ctx context.Context) {
o.Context = ctx
} | [
-0.6696769595146179,
1.0774309635162354,
0.1915680319070816,
-1.0003362894058228,
0.14755024015903473,
0.20074357092380524,
-0.8721247911453247,
-0.5430933833122253,
0.4027369022369385,
0.46462181210517883,
-0.7690533995628357,
0.21873968839645386,
-0.6481872797012329,
0.08588333427906036,... |
func (o *CreateCardPaymentSourceParams) WithHTTPClient(client *http.Client) *CreateCardPaymentSourceParams {
o.SetHTTPClient(client)
return o
} | [
-0.20780742168426514,
0.03817744553089142,
0.06822485476732254,
-1.1903965473175049,
-0.42925870418548584,
-0.01943259686231613,
-0.5083569884300232,
-0.15829135477542877,
-0.27019360661506653,
-0.04812173545360565,
-0.3385281264781952,
-0.38071373105049133,
0.27460846304893494,
-0.6276118... |
func (o *CreateCardPaymentSourceParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
} | [
-0.14605844020843506,
0.34761935472488403,
-0.022341033443808556,
-1.6515992879867554,
-0.2530254125595093,
-0.08642583340406418,
-0.2735579311847687,
-0.12460854649543762,
-0.9004179835319519,
0.24072520434856415,
-0.754882276058197,
0.2669958174228668,
-0.27812623977661133,
-0.6088134646... |
func (o *CreateCardPaymentSourceParams) WithPaymentSourceCreateCardRequest(paymentSourceCreateCardRequest *models.PaymentSourceCreateCardRequest) *CreateCardPaymentSourceParams {
o.SetPaymentSourceCreateCardRequest(paymentSourceCreateCardRequest)
return o
} | [
-0.5254441499710083,
0.5450340509414673,
0.3514380156993866,
-0.6430433392524719,
-0.785402238368988,
-0.2109372615814209,
-1.0577908754348755,
-0.22375284135341644,
0.5992066860198975,
-0.13653507828712463,
0.17137593030929565,
-0.1875564455986023,
0.939995288848877,
0.5431396961212158,
... |
func (o *CreateCardPaymentSourceParams) SetPaymentSourceCreateCardRequest(paymentSourceCreateCardRequest *models.PaymentSourceCreateCardRequest) {
o.PaymentSourceCreateCardRequest = paymentSourceCreateCardRequest
} | [
-0.9830021858215332,
0.5130584239959717,
0.4090130627155304,
-0.9318219423294067,
-0.43965357542037964,
0.06727244704961777,
-0.8127564787864685,
0.06413353234529495,
0.17380647361278534,
0.07225804030895233,
-0.23553994297981262,
0.043067216873168945,
0.6331526637077332,
0.507276952266693... |
func (o *CreateCardPaymentSourceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.PaymentSourceCreateCardRequest != nil {
if err := r.SetBodyParam(o.PaymentSourceCreateCardRequest); err != nil {
ret... | [
-1.0223777294158936,
0.7205359935760498,
0.6075263023376465,
-1.3379584550857544,
0.8947061896324158,
-0.17010276019573212,
0.3285799026489258,
0.2721281349658966,
-0.151727095246315,
0.47896817326545715,
-0.27978214621543884,
-0.13791225850582123,
-0.26470282673835754,
0.1407158374786377,... |
func Open(name string) (*os.File, error) {
return filesharedelete.OpenFile(name, os.O_RDONLY, 0)
} | [
0.21925345063209534,
0.4914710819721222,
0.581516683101654,
0.1889747977256775,
-0.8025397062301636,
0.5071739554405212,
0.5221090912818909,
0.7914911508560181,
-0.41899147629737854,
-0.4342394173145294,
0.3246326446533203,
-0.12261950969696045,
-0.374881774187088,
-0.6843237280845642,
0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.