text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func GetListen() string {
return GetStringDefault("listen", defaultListen)
} | [
1.0896726846694946,
-0.024277206510305405,
0.4465635120868683,
0.8653901219367981,
0.529137372970581,
0.3052420914173126,
-0.2462710291147232,
0.18249236047267914,
-0.40153929591178894,
-0.26444825530052185,
0.008843488991260529,
0.6507178544998169,
-0.05599530041217804,
-0.269339561462402... |
func GetMailConfig() MailConfig {
prefix := "mail."
pass := GetString(prefix + "password")
if os.Getenv(pass) != "" {
pass = os.Getenv(pass)
}
mailConfig := MailConfig{
Host: GetString(prefix + "host"),
Port: GetInt(prefix + "port"),
User: GetString(prefix + "user"),
Password: pass,
}
valid... | [
0.5195599794387817,
0.025182249024510384,
0.6484376192092896,
0.25607380270957947,
-0.8334950804710388,
0.42088308930397034,
-1.107335090637207,
0.23331017792224884,
-0.5146486759185791,
0.03476966172456741,
-0.9168664813041687,
1.2430216073989868,
-0.05554142966866493,
0.541424036026001,
... |
func (m *JSONContentTypeMiddleware) ServeHTTP(w http.ResponseWriter, req *http.Request, next http.HandlerFunc) {
// Add Content-Type header
w.Header().Add("content-type", "application/json; charset=UTF-8")
// Call the next middleware handler
next(w, req)
} | [
-0.08082529157400131,
-0.3880167007446289,
0.5767990946769714,
-0.17267002165317535,
-0.8455294966697693,
-0.18744172155857086,
-0.5122084021568298,
-0.5843350887298584,
-0.415654718875885,
0.8217036128044128,
-0.28373947739601135,
0.26552093029022217,
-0.5273630619049072,
0.58663958311080... |
func InitFilesystem(fsType FileSystemType) FileSystem {
var fs FileSystem
switch fsType {
case Local:
fs = &LocalFileSystem{}
case S3:
fs = &S3FileSystem{}
}
fs.Init()
return fs
} | [
0.11092542111873627,
-0.5405769348144531,
0.5685908198356628,
0.07978585362434387,
0.6247248649597168,
-0.13833673298358917,
-0.3658963739871979,
-0.4778766632080078,
0.9082854390144348,
-0.9067436456680298,
-0.6245642900466919,
0.1785615235567093,
0.03935627266764641,
0.528144121170044,
... |
func InferFilesystem(location string) FileSystem {
var fs FileSystem
if strings.HasPrefix(location, "s3://") {
fs = &S3FileSystem{}
} else {
fs = &LocalFileSystem{}
}
fs.Init()
return fs
} | [
0.4766836166381836,
-0.6771032810211182,
0.5634253025054932,
-0.07845975458621979,
0.708314836025238,
-0.17813803255558014,
-0.16246922314167023,
-0.08622344583272934,
1.262035608291626,
-1.3672144412994385,
-0.4710268974304199,
0.06415868550539017,
0.028823846951127052,
-0.181160107254982... |
func TestInterfacePresenterFile(t *testing.T){
// Build
statement, err := testPresenterGenerator.File(testEntity)
// Return
if err != nil {
t.Errorf(`File() failed with error %v`, err)
}
f, err := os.Create("./testing/interface/presenter/created/" + testOutputInterfacePresenterFileName)
if err != nil {
t.... | [
0.6150520443916321,
-0.32347097992897034,
0.9682860374450684,
-0.5356236696243286,
0.28501009941101074,
0.8715108633041382,
1.485445499420166,
0.38640332221984863,
-0.3969901204109192,
-0.0032023645471781492,
0.2532620429992676,
-1.1184515953063965,
-0.7807027101516724,
-0.2381343096494674... |
func TestScaffoldInterfacePresenterFile(t *testing.T){
// Build
statement, err := testPresenterGenerator.ScaffoldFile(testEntity)
// Return
if err != nil {
t.Errorf(`scaffoldInterfacePresenterFile() failed with error %v`, err)
}
f, err := os.Create("./testing/interface/presenter/created/" + testOutputScaffol... | [
0.9793611764907837,
-0.05819599702954292,
0.8418282866477966,
-0.20959657430648804,
0.35721921920776367,
0.8787420392036438,
1.6621999740600586,
0.5567116737365723,
-0.0062766727060079575,
-0.22551219165325165,
0.048302143812179565,
-0.9005566239356995,
-0.6262624859809875,
0.3826189637184... |
func TestScaffoldInterfacePresenterStruct(t *testing.T){
// Build
statement, err := testPresenterGenerator.scaffoldInterfacePresenterStruct(testEntity)
// Return
if err != nil {
t.Errorf(`scaffoldInterfacePresenterStruct() failed with error %v`, err)
}
f, err := os.Create("./testing/interface/presenter/creat... | [
0.6166291236877441,
-0.13201554119586945,
0.6945832371711731,
-0.4037501811981201,
-0.15054212510585785,
0.59480220079422,
1.2040655612945557,
0.013631248846650124,
0.8355748057365417,
-0.632552981376648,
-0.22387319803237915,
-0.499644011259079,
-0.8159139156341553,
0.1602914184331894,
... |
func TestScaffoldInterfacePresenterInterface(t *testing.T){
// Build
statement, err := testPresenterGenerator.scaffoldInterfacePresenterInterface(testEntity)
// Return
if err != nil {
t.Errorf(`scaffoldInterfacePresenterInterface() failed with error %v`, err)
}
f, err := os.Create("./testing/interface/presen... | [
0.5804505348205566,
-0.1081777960062027,
0.7855283617973328,
-0.23546084761619568,
-0.16059674322605133,
0.550830066204071,
1.3931151628494263,
0.17803791165351868,
0.5785131454467773,
-0.2076631337404251,
-0.09234410524368286,
-0.8528908491134644,
-0.9517555832862854,
0.47644245624542236,... |
func TestScaffoldInterfacePresenterConstructorFunction(t *testing.T){
// Build
statement, err := testPresenterGenerator.interfacePresenterConstructorFunction(testEntity)
// Return
if err != nil {
t.Errorf(`scaffoldInterfacePresenterConstructorFunction() failed with error %v`, err)
}
f, err := os.Create("./te... | [
0.5783683657646179,
-0.25179535150527954,
0.46044859290122986,
-0.07795500010251999,
0.00950855016708374,
-0.0002478109090588987,
1.3482024669647217,
0.39759886264801025,
0.13526302576065063,
-0.5761641263961792,
-0.031139273196458817,
-0.5802245736122131,
-0.27880561351776123,
0.436117649... |
func (f SegmentStorageMainFactory) NewInstance() storage.SegmentStorage {
return NewSegmentStorageAdapter(Client, conf.Data.Redis.Prefix)
} | [
-0.2580133378505707,
-0.22870081663131714,
0.31312301754951477,
-0.6603372097015381,
0.2881292402744293,
0.14627845585346222,
-0.03137043118476868,
-0.19826503098011017,
0.5089011192321777,
0.33025166392326355,
0.1385648250579834,
-0.880029022693634,
0.2803032696247101,
0.2156066745519638,... |
func Router() *echo.Echo {
e := echo.New()
e.Pre(middleware.RemoveTrailingSlash())
e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.Use(middleware.BodyDump(handler.BodyDumper))
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"localhost:8000"},
AllowHeaders: []string{echo... | [
0.4368351697921753,
-0.3991561532020569,
0.6774287819862366,
0.8697522878646851,
-1.0943043231964111,
0.7695508003234863,
0.5296838879585266,
-0.2326333373785019,
0.20799463987350464,
-0.7050694823265076,
0.3041304349899292,
0.7839449644088745,
0.17540721595287323,
0.9257630705833435,
0.... |
func GetClient() (client *horizon.Client, err error) {
env, err := agoraenv.FromEnvVariable()
if err != nil {
return nil, err
}
switch env {
case agoraenv.AgoraEnvironmentProd:
return kinProdHorizonClient, nil
default:
return kinTestHorizonClient, nil
}
} | [
0.32379812002182007,
-0.3285593092441559,
0.4665398895740509,
0.9294561147689819,
0.6906158924102783,
0.8050126433372498,
0.10058940947055817,
-0.8558693528175354,
-0.5637364983558655,
0.38201484084129333,
0.780526876449585,
1.3722823858261108,
-0.848849892616272,
-0.1342352032661438,
1.... |
func GetClientV2() (client *horizonclient.Client, err error) {
env, err := agoraenv.FromEnvVariable()
if err != nil {
return nil, err
}
switch env {
case agoraenv.AgoraEnvironmentProd:
return kinProdHorizonClientV2, nil
default:
return kinTestHorizonClientV2, nil
}
} | [
0.22111043334007263,
-1.071109414100647,
0.3667204678058624,
0.7950713038444519,
0.0764121487736702,
0.21996504068374634,
0.014013251289725304,
-0.8508222699165344,
-0.6615384221076965,
0.4043552577495575,
0.5556302666664124,
1.8013979196548462,
-0.6202513575553894,
0.2257961481809616,
1... |
func GetNetwork() (network build.Network, err error) {
env, err := agoraenv.FromEnvVariable()
if err != nil {
return build.Network{}, err
}
switch env {
case agoraenv.AgoraEnvironmentProd:
return prodNetwork, nil
default:
return testNetwork, nil
}
} | [
-0.7165799736976624,
-0.13683153688907623,
0.3993397355079651,
1.394059419631958,
1.1344413757324219,
0.3116316497325897,
0.21501126885414124,
-0.6349430084228516,
0.0711197778582573,
-0.3566551208496094,
0.5321038365364075,
0.9565776586532593,
-0.5039207935333252,
0.04007711634039879,
0... |
func GetClientByKinNetwork(net network.KinNetwork) (client *horizon.Client, err error) {
if !net.IsValid() {
return nil, ErrInvalidKinNetwork
}
switch net {
case network.MainNetwork:
return kinProdHorizonClient, nil
default:
return kinTestHorizonClient, nil
}
} | [
0.8848283886909485,
-0.41264137625694275,
0.10183695703744888,
1.1057273149490356,
0.0543498769402504,
0.2722746729850769,
-0.021983476355671883,
-1.050392985343933,
0.269072562456131,
0.19353336095809937,
0.5934591889381409,
-0.16612079739570618,
-1.3418833017349243,
-0.1458444446325302,
... |
func GetNetworkByKinNetwork(net network.KinNetwork) (buildNetwork build.Network, err error) {
if !net.IsValid() {
return build.Network{}, ErrInvalidKinNetwork
}
switch net {
case network.MainNetwork:
return prodNetwork, nil
default:
return testNetwork, nil
}
} | [
-0.2239476442337036,
-0.2685549259185791,
0.20512312650680542,
1.5742225646972656,
0.3926108777523041,
-0.004198508802801371,
-0.3604033887386322,
-0.7929863929748535,
1.0652427673339844,
-0.3726903796195984,
0.36161676049232483,
-0.12892849743366241,
-1.112781047821045,
0.4365013837814331... |
func dff(a attribute.Bag) (bool, error) {
var v interface{}
var b bool
if v, b = a.Get("a"); !b {
return false, errors.New("a not found")
}
aa := v.(int64)
if aa == 20 {
return true, nil
}
if v, b = a.Get("request.header"); !b {
return false, errors.New("a not found")
}
ss := v.(map[string]string)["hos... | [
-0.5307694673538208,
0.3046364188194275,
0.8157393336296082,
-0.3356356918811798,
0.04446140676736832,
0.13647805154323578,
0.32219526171684265,
-0.2485530525445938,
-0.1246081218123436,
-0.7283241748809814,
-0.7803180813789368,
-0.25148308277130127,
-0.0950094684958458,
1.0891319513320923... |
func NewCmdJoin(f cmdutil.Factory, cmdOut io.Writer, config util.AdminConfig) *cobra.Command {
opts := &joinFederation{}
cmd := &cobra.Command{
Use: "join CLUSTER_NAME --host-cluster-context=HOST_CONTEXT",
Short: "Join a cluster to a federation",
Long: join_long,
Example: join_example,
Run: func(c... | [
0.24548062682151794,
-0.3889275789260864,
0.4829258322715759,
0.24241067469120026,
-0.19861072301864624,
-0.07346600294113159,
0.31646475195884705,
0.008246252313256264,
-0.5674533247947693,
-0.8558712601661682,
0.2421664297580719,
0.13956227898597717,
-0.21368488669395447,
0.7167992591857... |
func (j *joinFederation) Complete(cmd *cobra.Command, args []string, config util.AdminConfig) error {
err := j.commonOptions.SetName(cmd, args)
if err != nil {
return err
}
j.options.dryRun = cmdutil.GetDryRunFlag(cmd)
if j.options.clusterContext == "" {
j.options.clusterContext = j.commonOptions.Name
}
g... | [
-0.30066412687301636,
0.41948652267456055,
0.8527430891990662,
0.2565574645996094,
0.8143628835678101,
0.21571442484855652,
0.5022381544113159,
-0.30163949728012085,
-0.3960222601890564,
0.6504851579666138,
0.06405685842037201,
0.1386898159980774,
-0.1986246556043625,
0.9526160955429077,
... |
func (j *joinFederation) performPreflightChecks(config util.AdminConfig) error {
joiningClusterFactory := j.joningClusterFactory(config)
// If RBAC is not available, then skip checking for a service account.
// If RBAC availability cannot be determined, return an error.
rbacVersionedClientset, err := util.GetVersi... | [
-0.23089642822742462,
0.47714969515800476,
0.8646301627159119,
0.48415279388427734,
0.7591516375541687,
0.2426380068063736,
0.869857668876648,
-0.901537299156189,
0.05634651333093643,
0.1296297162771225,
1.358274221420288,
0.30832841992378235,
-0.6697199940681458,
1.1483629941940308,
0.7... |
func (j *joinFederation) joningClusterFactory(config util.AdminConfig) cmdutil.Factory {
return config.ClusterFactory(j.options.clusterContext, j.commonOptions.Kubeconfig)
} | [
-0.22042623162269592,
0.5792456865310669,
0.3765973448753357,
0.3527105152606964,
0.35473087430000305,
0.16219589114189148,
-0.20587700605392456,
-0.6428806781768799,
-0.2330256998538971,
0.16369685530662537,
0.4527286887168884,
0.5889431238174438,
-0.6437019109725952,
0.32472842931747437,... |
func (j *joinFederation) Run(f cmdutil.Factory, cmdOut io.Writer, config util.AdminConfig, cmd *cobra.Command) error {
clusterContext := j.options.clusterContext
dryRun := j.options.dryRun
federationNamespace := j.commonOptions.FederationSystemNamespace
host := j.commonOptions.Host
kubeconfig := j.commonOptions.Ku... | [
-0.1457349956035614,
0.7148215174674988,
0.8993605971336365,
0.3686615824699402,
0.7821683883666992,
0.2746005356311798,
1.0071531534194946,
-0.5084463953971863,
-0.019083060324192047,
-0.36459654569625854,
-0.3248629868030548,
0.40926215052604675,
-0.39480075240135193,
1.1791198253631592,... |
func minifyConfig(clientConfig *clientcmdapi.Config, context string) (*clientcmdapi.Config, error) {
// MinifyConfig inline-modifies the passed clientConfig. So we make a
// copy of it before passing the config to it. A shallow copy is
// sufficient because the underlying fields will be reconstructed by
// MinifyCo... | [
-0.035672202706336975,
-0.6776236295700073,
0.35010722279548645,
-0.6395677328109741,
-0.290448397397995,
-0.3055955171585083,
0.30026787519454956,
0.043187420815229416,
0.6391168236732483,
0.03521500900387764,
-0.9387457966804504,
0.5679442286491394,
-0.4697897136211395,
0.758119404315948... |
func createSecret(clientset internalclientset.Interface, clientConfig *clientcmdapi.Config, namespace, federationName, joiningClusterName, contextName, secretName string, dryRun bool) (runtime.Object, error) {
// Minify the kubeconfig to ensure that there is only information
// relevant to the cluster we are register... | [
0.2028435319662094,
0.16763535141944885,
0.6309475898742676,
0.09713525325059891,
0.14083349704742432,
-0.4271153509616852,
-0.41559529304504395,
-0.9007030129432678,
-0.6348555088043213,
0.314987450838089,
-0.13891072571277618,
0.10328487306833267,
-0.9778022766113281,
0.27878260612487793... |
func createConfigMap(hostClientSet internalclientset.Interface, config util.AdminConfig, fedSystemNamespace, federationName, joiningClusterName, targetClusterContext, kubeconfigPath string, dryRun bool) (*api.ConfigMap, error) {
cmDep, err := getCMDeployment(hostClientSet, fedSystemNamespace)
if err != nil {
return... | [
-1.0465641021728516,
0.18193937838077545,
0.872919499874115,
-0.1311192363500595,
0.4923475682735443,
0.11525268852710724,
-0.350486159324646,
-0.6303936243057251,
0.6710675954818726,
0.30906200408935547,
-0.04687606170773506,
0.5287012457847595,
-0.5286482572555542,
0.603140115737915,
0... |
func clusterGenerator(clientConfig *clientcmdapi.Config, name, contextName, secretName, serviceAccountName, clusterRoleName string) (kubectl.StructuredGenerator, error) {
// Get the context from the config.
ctx, found := clientConfig.Contexts[contextName]
if !found {
return nil, fmt.Errorf("cluster context %q not ... | [
-0.3881109058856964,
-0.016690224409103394,
0.5504738092422485,
-0.447175532579422,
-0.47615402936935425,
-0.2681345045566559,
-0.10805276036262512,
-0.017697425559163094,
0.40747541189193726,
0.33826711773872375,
0.37029126286506653,
0.8432832360267639,
-0.5734022855758667,
-0.62018901109... |
func extractScheme(url string) string {
scheme := ""
segs := strings.SplitN(url, "://", 2)
if len(segs) == 2 {
scheme = segs[0]
}
return scheme
} | [
-0.8199043273925781,
0.5394194722175598,
0.5760561227798462,
0.80913245677948,
0.5568143725395203,
-0.9611136317253113,
0.3393210172653198,
0.1712031215429306,
0.395055890083313,
0.5071873664855957,
-0.17116095125675201,
-0.812393307685852,
-0.5119010806083679,
-0.2827584147453308,
0.820... |
func getFederationName(hostClientSet internalclientset.Interface, fedNamespace string) (string, error) {
d, err := getCMDeployment(hostClientSet, fedNamespace)
if err != nil {
return "", err
}
name, ok := d.Annotations[federation.FederationNameAnnotation]
if !ok {
return "", fmt.Errorf("Federation control man... | [
-0.08075766265392303,
0.19982898235321045,
0.38170161843299866,
-0.042370233684778214,
-0.4051058888435364,
-0.5940991640090942,
0.01773160509765148,
-0.41131338477134705,
-0.027421260252594948,
0.5739128589630127,
0.023168504238128662,
0.07269299030303955,
-0.31333765387535095,
1.31205403... |
func createFederationSystemNamespace(clusterClientset internalclientset.Interface, federationNamespace, federationName, joiningClusterName string, dryRun bool) (*api.Namespace, error) {
federationNS := &api.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: federationNamespace,
Annotations: map[string]string{
... | [
-0.4983171820640564,
0.3455658257007599,
0.3794132173061371,
0.22348326444625854,
0.09741459786891937,
0.0033569743391126394,
-0.1458137184381485,
-1.1706758737564087,
0.7126328349113464,
-0.5327013731002808,
-0.057166483253240585,
0.1817837655544281,
-0.20616526901721954,
0.91424149274826... |
func createRBACSecret(hostClusterClientset, joiningClusterClientset internalclientset.Interface, namespace, federationName, joiningClusterName, hostClusterContext, joiningClusterContext, secretName string, dryRun bool) (*api.Secret, string, string, error) {
glog.V(2).Info("Creating service account in joining cluster")... | [
0.7342307567596436,
-0.09583044052124023,
0.9120429158210754,
0.5971498489379883,
0.4650101065635681,
0.4808458387851715,
0.3028741180896759,
-0.988333523273468,
-0.929766833782196,
-0.11741137504577637,
-0.9193795323371887,
0.6422516703605652,
-0.6827355623245239,
0.6144196391105652,
2.... |
func createServiceAccount(clusterClientset internalclientset.Interface, namespace, federationName, joiningClusterName, hostContext string, dryRun bool) (string, error) {
saName := util.ClusterServiceAccountName(joiningClusterName, hostContext)
sa := &api.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Name: ... | [
-0.08989036828279495,
-0.17392052710056305,
0.4996800124645233,
0.2856173515319824,
-0.5678748488426208,
0.42007508873939514,
0.7171277403831482,
-0.29968634247779846,
-0.032039348036050797,
0.3032931983470917,
-0.04046982526779175,
0.8800428509712219,
-0.6037289500236511,
0.56032943725585... |
func createClusterRoleBinding(clusterClientset internalclientset.Interface, saName, namespace, federationName, joiningClusterName string, dryRun bool) (*rbac.ClusterRoleBinding, error) {
roleName := util.ClusterRoleName(federationName, saName)
role := &rbac.ClusterRole{
ObjectMeta: metav1.ObjectMeta{
Name: ... | [
0.07622858881950378,
0.5193743109703064,
0.8228195309638977,
0.04443930462002754,
0.06420183181762695,
0.7974522709846497,
0.3913416266441345,
-0.21519474685192108,
0.3817983865737915,
0.13964025676250458,
0.35136160254478455,
0.8242555856704712,
-0.5846316814422607,
0.49748310446739197,
... |
func populateSecretInHostCluster(clusterClientset, hostClientset internalclientset.Interface, saName, namespace, federationName, joiningClusterName, secretName string, dryRun bool) (*api.Secret, error) {
if dryRun {
// The secret is created indirectly with the service account, and so there is no local copy to return... | [
0.36470261216163635,
0.7343937158584595,
0.9088522791862488,
0.8515183329582214,
0.1210821345448494,
0.5380581617355347,
0.1820582151412964,
-0.10719802975654602,
-0.7704567313194275,
0.5702937841415405,
-0.30111029744148254,
1.112930417060852,
-0.2586001455783844,
-0.1555173248052597,
1... |
func main() {
prefix := "/api/v1/"
http.HandleFunc(prefix+"quote/", handleQuote)
// TODO: Register handler
http.HandleFunc("/", hello)
err := http.ListenAndServe("localhost:8000", nil)
if err != nil {
log.Fatalln("ListenAndServe:", err)
}
} | [
0.307411789894104,
-0.6525493264198303,
0.7027311325073242,
0.6437528729438782,
1.3619269132614136,
-0.00331325875595212,
0.29451820254325867,
0.7639521956443787,
-0.4546041488647461,
-0.640347957611084,
-0.3432946503162384,
0.61431884765625,
0.344582736492157,
-0.06998442858457565,
0.39... |
func (a *goAction) Call(ctx px.Context, method px.ObjFunc, args []px.Value, block px.Lambda) (px.Value, bool) {
if method.Name() != `do` {
return nil, false
}
fvType := a.doer.Type()
parameters := args[0].(px.OrderedMap)
params := make([]reflect.Value, 0)
if fvType.NumIn() > 0 {
inType := fvType.In(0)
if i... | [
-1.279018521308899,
0.6166091561317444,
1.094117283821106,
0.31172510981559753,
-0.34151074290275574,
0.29322493076324463,
-0.016800738871097565,
-0.7216440439224243,
-0.3493034243583679,
0.46520164608955383,
0.014775837771594524,
0.2612207233905792,
-0.13198943436145782,
0.729559719562530... |
func (client *gasStationClient) GetGasPrice() (*GasPrice, error) {
gasPrice := &GasPrice{}
_, err := client.Request(http.MethodGet, GasPriceEndpoint, gasPrice)
if err != nil {
return nil, err
}
return gasPrice, nil
} | [
-0.6155103445053101,
0.45845940709114075,
0.376756489276886,
1.152163028717041,
-0.1252135932445526,
-0.8098649382591248,
-1.0467525720596313,
-0.5499130487442017,
-0.9360013008117676,
-0.16617415845394135,
-0.43388622999191284,
0.3981875777244568,
-1.1885106563568115,
0.42826467752456665,... |
func (s *Session) IsUnrestricted() bool {
return s.Local
} | [
-0.4180087149143219,
-0.08669207245111465,
0.502819299697876,
-0.6502507328987122,
-0.7797964215278625,
-0.7705053687095642,
-0.23587922751903534,
-0.2282441109418869,
0.5340323448181152,
-0.6118398308753967,
-0.8021532893180847,
0.4073866009712219,
-0.32544493675231934,
-0.549181997776031... |
func testRoundTripUint32(t *testing.T, encoder func([]byte, []uint32) int, decoder func([]uint32, []byte), data []uint32, expectedSize int) {
encodedRaw := make([]byte, MaxSize32(len(data)))
encodedSize := encoder(encodedRaw, data)
if expectedSize >= 0 && encodedSize != expectedSize {
t.Errorf("got encodedSize: %d... | [
0.16709081828594208,
0.4531545341014862,
0.8097745180130005,
-1.2266716957092285,
-0.4878545105457306,
0.41947615146636963,
0.0205730851739645,
0.3806976079940796,
0.5704467296600342,
-0.9287953972816467,
-0.0798749327659607,
0.02458213083446026,
0.399033784866333,
0.2906266450881958,
0.... |
func testRoundTripInt32(t *testing.T, encoder func([]byte, []int32) int, decoder func([]int32, []byte), data []int32, expectedSize int) {
encodedRaw := make([]byte, MaxSize32(len(data)))
encodedSize := encoder(encodedRaw, data)
if expectedSize >= 0 && encodedSize != expectedSize {
t.Errorf("got encodedSize: %d, ex... | [
0.20954546332359314,
0.29143720865249634,
0.7943928241729736,
-1.3131704330444336,
-0.5890449285507202,
0.4299766719341278,
0.0032736898865550756,
-0.12840576469898224,
0.30227065086364746,
-0.8319915533065796,
-0.3898750841617584,
0.18124403059482574,
0.2159385085105896,
0.356310158967971... |
func (Complaint) Fields() []ent.Field {
return nil
} | [
0.5790976285934448,
0.4239978790283203,
0.25319355726242065,
-1.0286701917648315,
0.9804615378379822,
0.7736955285072327,
-0.40970489382743835,
-0.000733083812519908,
0.23704741895198822,
-1.170263409614563,
-0.16412986814975739,
-0.5124576687812805,
-0.6385802626609802,
-0.311178147792816... |
func (Complaint) Edges() []ent.Edge {
return nil
} | [
0.26170891523361206,
-0.28225186467170715,
0.3405778408050537,
-0.28354763984680176,
0.8078729510307312,
0.283873975276947,
-1.159681797027588,
0.308816134929657,
0.3081079423427582,
-0.9075157642364502,
0.7867183685302734,
0.25200051069259644,
-0.7754164338111877,
-0.0012783376732841134,
... |
func ExtractPaginationFromArgs(args map[string]interface{}) (*Pagination, error) {
limit, ok := args["limit"]
if !ok {
return nil, nil
}
return &Pagination{
Limit: limit.(int),
}, nil
} | [
-0.03719446808099747,
-0.1611153781414032,
0.6487348675727844,
0.07065321505069733,
0.23817117512226105,
-1.3922175168991089,
0.045517582446336746,
0.1772432029247284,
0.3164522349834442,
0.4902626574039459,
0.3674487769603729,
-0.7084453701972961,
-0.7110316157341003,
0.30236268043518066,... |
func (c *Client) UpdateAlertPolicyChannels(policyID int, channelIDs []int) error {
channelIDStrings := make([]string, len(channelIDs))
for i, channelID := range channelIDs {
channelIDStrings[i] = strconv.Itoa(channelID)
}
reqURL, err := url.Parse("/alerts_policy_channels.json")
if err != nil {
return err
}
... | [
-0.411784291267395,
-1.318207025527954,
0.17514725029468536,
-0.9721167087554932,
0.38023999333381653,
0.6349794864654541,
-1.0932400226593018,
-0.9049969911575317,
0.09632664173841476,
1.1926213502883911,
0.1962503045797348,
1.73533034324646,
-0.7974455952644348,
-0.1833823323249817,
-0... |
func (c *Client) DeleteAlertPolicyChannel(policyID int, channelID int) error {
reqURL, err := url.Parse("/alerts_policy_channels.json")
if err != nil {
return err
}
qs := url.Values{
"policy_id": []string{strconv.Itoa(policyID)},
"channel_id": []string{strconv.Itoa(channelID)},
}
reqURL.RawQuery = qs.Enco... | [
0.2673966586589813,
-1.1272944211959839,
0.2586664855480194,
-0.8224315643310547,
0.4600045084953308,
0.5862765908241272,
-0.773219108581543,
-0.4915196895599365,
0.3799391984939575,
0.5199853181838989,
0.6701620221138,
1.8654614686965942,
-0.899097740650177,
0.15640437602996826,
0.64936... |
func main() {
fmt.Println("NEW VERSION")
updater := goupdate.CreateUpdater("https://connorwright.uk/goupdate/updater.json", "1.0.0.0", 5000, true)
available, err := updater.CheckForUpdate()
if err != nil {
fmt.Println(err)
}
if available {
fmt.Println("An update is available!")
err := updater.Perf... | [
-0.15046556293964386,
-0.7018243074417114,
0.7015533447265625,
0.34123241901397705,
0.030413785949349403,
0.6149705052375793,
-0.11706356704235077,
0.7388371229171753,
-0.7761901617050171,
0.6427474021911621,
-0.30226147174835205,
0.07308612018823624,
-0.2754327952861786,
0.617636084556579... |
func (t ISOTime) MarshalJSON() ([]byte, error) {
if y := time.Time(t).Year(); y < 0 || y >= 10000 {
// ISO 8901 uses 4 digits for the years
return nil, errors.New("ISOTime.MarshalJSON: year outside of range [0,9999]")
}
b := make([]byte, 0, len(iso8601)+2)
b = append(b, '"')
b = time.Time(t).AppendFormat(b, i... | [
0.17090867459774017,
-0.026858311146497726,
0.7093881964683533,
0.03794887661933899,
-0.6930080056190491,
0.6801500916481018,
-0.900888204574585,
-0.22369660437107086,
0.6810004711151123,
1.3884270191192627,
-0.2778089642524719,
0.35613057017326355,
-0.06326673179864883,
0.3922463059425354... |
func NewMockRedisClient(ctrl *gomock.Controller) *MockRedisClient {
mock := &MockRedisClient{ctrl: ctrl}
mock.recorder = &MockRedisClientMockRecorder{mock}
return mock
} | [
0.17284205555915833,
0.5457631349563599,
0.10956604033708572,
0.1746397763490677,
-0.5310543179512024,
0.13402706384658813,
0.28316667675971985,
-0.43487679958343506,
0.829508364200592,
0.34655916690826416,
-0.3712831139564514,
0.35219624638557434,
-0.4377133846282959,
0.6499654650688171,
... |
func (m *MockRedisClient) EXPECT() *MockRedisClientMockRecorder {
return m.recorder
} | [
0.07813988626003265,
0.48900991678237915,
0.31113240122795105,
-0.32522323727607727,
-0.1748037487268448,
0.17113031446933746,
-0.24748875200748444,
0.07872755825519562,
0.542408287525177,
-0.08134913444519043,
0.6475403904914856,
0.9936532974243164,
-0.8721173405647278,
0.8570865392684937... |
func (m *MockRedisClient) Expire(arg0 string, arg1 time.Duration) (bool, error) {
ret := m.ctrl.Call(m, "Expire", arg0, arg1)
ret0, _ := ret[0].(bool)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
-0.7721523642539978,
0.026368021965026855,
0.5836043953895569,
0.6074622869491577,
0.9266806244850159,
0.2411077469587326,
-0.18927401304244995,
-0.06062859669327736,
-0.9366365671157837,
0.31837546825408936,
-0.37251439690589905,
-0.7738426923751831,
-0.6724153161048889,
1.212684035301208... |
func (mr *MockRedisClientMockRecorder) Expire(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Expire", reflect.TypeOf((*MockRedisClient)(nil).Expire), arg0, arg1)
} | [
-0.32290521264076233,
0.655078649520874,
0.5831019282341003,
0.37312525510787964,
0.24434982240200043,
0.08630727231502533,
-0.807314932346344,
-0.7482830286026001,
0.2174694687128067,
0.7583814263343811,
0.5673498511314392,
0.41883954405784607,
-0.8867867588996887,
1.7341010570526123,
-... |
func (m *MockRedisClient) ZAdd(arg0 string, arg1 ...redis.Z) (int64, error) {
varargs := []interface{}{arg0}
for _, a := range arg1 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "ZAdd", varargs...)
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
-0.5844712853431702,
-0.7574694156646729,
0.24170586466789246,
-0.4844187796115875,
0.5044755935668945,
1.315125823020935,
0.738183319568634,
-0.5180242657661438,
-0.48539718985557556,
-0.6025747656822205,
0.5725289583206177,
0.11610034853219986,
-1.405775547027588,
1.0098720788955688,
0... |
func (mr *MockRedisClientMockRecorder) ZAdd(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
varargs := append([]interface{}{arg0}, arg1...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ZAdd", reflect.TypeOf((*MockRedisClient)(nil).ZAdd), varargs...)
} | [
0.08973590284585953,
-0.1477384865283966,
0.21205414831638336,
-0.5791232585906982,
-0.35966789722442627,
1.2791446447372437,
-0.2741660475730896,
-0.9592412114143372,
0.5214253664016724,
-0.009395039640367031,
1.411313533782959,
1.165346384048462,
-1.4491456747055054,
1.250023603439331,
... |
func (m *MockRedisClient) ZCard(arg0 string) (int64, error) {
ret := m.ctrl.Call(m, "ZCard", arg0)
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
-1.2683743238449097,
-0.07986022531986237,
0.14772459864616394,
-0.6471678018569946,
0.7401923537254333,
-0.063844695687294,
0.9474499225616455,
-0.650246262550354,
-0.6884804964065552,
-0.25800231099128723,
-0.7141510248184204,
-0.38249140977859497,
-0.9486320614814758,
0.9393243193626404... |
func (mr *MockRedisClientMockRecorder) ZCard(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ZCard", reflect.TypeOf((*MockRedisClient)(nil).ZCard), arg0)
} | [
-0.5119945406913757,
0.751248300075531,
0.2472188025712967,
-0.6344520449638367,
-0.4134118854999542,
0.09277104586362839,
-0.3287273347377777,
-0.8850526213645935,
0.887485921382904,
0.5326414704322815,
0.41136425733566284,
1.1031705141067505,
-0.9855123162269592,
1.2349854707717896,
0.... |
func (m *MockRedisClient) ZRemRangeByScore(arg0, arg1, arg2 string) (int64, error) {
ret := m.ctrl.Call(m, "ZRemRangeByScore", arg0, arg1, arg2)
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
-0.8033657670021057,
-0.5389792323112488,
0.5565283298492432,
-0.009957882575690746,
0.6476383805274963,
-0.49994632601737976,
0.8591206669807434,
-0.42008668184280396,
-0.980174720287323,
-0.3082079291343689,
-1.3485562801361084,
-0.3086155652999878,
-1.3078629970550537,
0.658726334571838... |
func (mr *MockRedisClientMockRecorder) ZRemRangeByScore(arg0, arg1, arg2 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ZRemRangeByScore", reflect.TypeOf((*MockRedisClient)(nil).ZRemRangeByScore), arg0, arg1, arg2)
} | [
-0.40037816762924194,
-0.05110042914748192,
0.5866808891296387,
-0.3297034204006195,
-0.14123471081256866,
-0.3503739833831787,
-0.040586572140455246,
-0.8208543658256531,
-0.027216892689466476,
0.6446357369422913,
-0.6658756136894226,
0.49963611364364624,
-1.1300628185272217,
0.6451371312... |
func maxSumOfThreeSubarrays(nums []int, k int) []int {
// to find 3 non-overlapping subarrays in nums[:i],
// if we use nums[i-k: i], we need to find 2 subarrays in nums[:i-k];
// if we don't use, we need to find 3 subrarrys in nums[:i-1]
sum := make([]int, len(nums)+1)
for i:=1; i<=len(nums); i++ ... | [
0.670866072177887,
-0.089787058532238,
1.2351340055465698,
0.509939968585968,
-0.48409485816955566,
0.12308906763792038,
0.975631833076477,
-0.5586155652999878,
0.19011853635311127,
0.6574947834014893,
-0.907406210899353,
-0.15487390756607056,
-0.11844481527805328,
-0.4836438000202179,
-... |
func checkSecurityGroupFlags() string {
checkResult := ""
checkResult += checkGroupId()
checkResult += checkProtocol()
checkResult += checkWay()
return checkResult
} | [
0.18071191012859344,
0.36953043937683105,
0.353200763463974,
0.8476706743240356,
0.4026050865650177,
0.29936084151268005,
0.43226805329322815,
-0.5976444482803345,
-0.7363251447677612,
-0.19544804096221924,
-0.8990374803543091,
-0.17896105349063873,
-2.2669224739074707,
1.1547486782073975,... |
func checkGroupId() string {
if commons.Flags.GroupId == "" {
return "required group-id --groupid string\n"
}
return ""
} | [
0.5946382880210876,
0.08698771148920059,
0.3755151331424713,
0.5548374056816101,
0.7549358606338501,
0.9693405032157898,
-0.09300623834133148,
-0.32064786553382874,
-0.08125367015600204,
0.9538502097129822,
1.2867634296417236,
1.4000388383865356,
-1.2904194593429565,
1.7791699171066284,
... |
func checkProtocol() string {
if (commons.Flags.Protocol != "tcp") && (commons.Flags.Protocol != "udp") && (commons.Flags.Protocol != "icmp") && (commons.Flags.Protocol != "any") && (commons.Flags.Protocol != "") {
return "invalid protocol (tcp, udp, icmp, any)\n"
}
return ""
} | [
0.21460820734500885,
0.1961059719324112,
0.5736528038978577,
0.3063708543777466,
0.23357100784778595,
1.4510469436645508,
-0.33199095726013184,
-0.3402668237686157,
-0.7785471677780151,
0.46085092425346375,
0.6080065965652466,
-0.32394012808799744,
-2.1652321815490723,
0.1240154430270195,
... |
func checkWay() string {
if commons.Flags.Way == "" {
return "required way of packet --way string\n"
} else if (commons.Flags.Way != "ingress") && (commons.Flags.Way != "egress") {
return "invalid way of packet (ingress or egress)\n"
}
return ""
} | [
-0.05555121228098869,
-0.4586048424243927,
0.5020153522491455,
-0.07931309193372726,
0.6907455325126648,
0.6137911081314087,
-0.8615283966064453,
-0.23145723342895508,
-0.12165886163711548,
0.26091882586479187,
0.7492731213569641,
0.6660639643669128,
-1.3192431926727295,
1.5289061069488525... |
func (a *FixedAllocateAction) Err(errCode pbcommon.ErrCode, errMsg string) error {
a.resp.ErrCode = errCode
a.resp.ErrMsg = errMsg
return errors.New(errMsg)
} | [
0.41386738419532776,
-0.8143720626831055,
0.16509129106998444,
0.05727593973278999,
-0.2005946785211563,
0.2217138707637787,
0.19202028214931488,
0.18516509234905243,
1.0771377086639404,
-0.35598957538604736,
1.0237319469451904,
0.5259653329849243,
-0.06058206036686897,
0.7280492782592773,... |
func (a *FixedAllocateAction) Input() error {
if err := a.validate(); err != nil {
return a.Err(pbcommon.ErrCode_ERROR_CLOUD_NETSERVICE_INVALID_PARAMS, err.Error())
}
return nil
} | [
0.6977528929710388,
0.40151435136795044,
0.34299594163894653,
0.24988877773284912,
-0.10506308823823929,
1.140995979309082,
1.4382723569869995,
-0.05240657925605774,
0.8178480863571167,
-0.2976842224597931,
0.8852204084396362,
0.9241203665733337,
-0.5159570574760437,
0.6486738920211792,
... |
func (a *FixedAllocateAction) queryEniFromCloud() (pbcommon.ErrCode, string) {
eni, err := a.cloudIf.QueryEni(a.req.EniID)
if err != nil {
return pbcommon.ErrCode_ERROR_CLOUD_NETSERVICE_CLOUDAPI_QUERY_ENI_FAILED, err.Error()
}
if a.req.VpcID != eni.VpcID ||
a.req.Region != eni.Region ||
a.req.SubnetID != eni.... | [
-0.02186298929154873,
-0.5606968998908997,
0.582469642162323,
0.2408207207918167,
0.4896791875362396,
0.478880912065506,
-0.10934247076511383,
-0.7924450635910034,
0.08693715929985046,
0.1599443256855011,
0.794768750667572,
-0.2884637117385864,
-0.7688214778900146,
0.3394058346748352,
0.... |
func (a *FixedAllocateAction) checkIPOccupied() (pbcommon.ErrCode, string) {
existedIP, err := a.storeIf.GetIPObject(a.ctx, a.req.Address)
if err != nil {
if k8serrors.IsNotFound(err) {
blog.Infof("no allocated ip, try to allocate one")
return pbcommon.ErrCode_ERROR_OK, ""
}
return pbcommon.ErrCode_ERROR_... | [
-0.6548210382461548,
-1.0590914487838745,
0.9414827823638916,
-0.01996871456503868,
0.07216935604810715,
0.6309086680412292,
0.5953085422515869,
-0.5808534622192383,
0.43280285596847534,
0.3699306547641754,
0.9681832790374756,
-0.4699868857860565,
0.026507506147027016,
-0.1593829244375229,... |
func (a *FixedAllocateAction) findAvailableVictimIPObject() (pbcommon.ErrCode, string) {
victimObjects, err := a.storeIf.ListIPObject(a.ctx, map[string]string{
kube.CrdNameLabelsEni: a.req.EniID,
kube.CrdNameLabelsIsFixed: strconv.FormatBool(false),
kube.CrdNameLabelsStatus: types.IP_STATUS_AVAILABLE,
})... | [
-0.5552514791488647,
-1.485194206237793,
0.6018455028533936,
-0.4335555136203766,
-0.41954487562179565,
0.14021383225917816,
0.3594611883163452,
-0.20188523828983307,
0.3320992588996887,
1.0166747570037842,
0.2472449690103531,
0.0021638511680066586,
-0.3419635593891144,
-0.2231404781341552... |
func (a *FixedAllocateAction) updateVictimIPObject() (pbcommon.ErrCode, string) {
a.ipObj = &types.IPObject{
Address: a.victimIPObj.Address,
VpcID: a.victimIPObj.VpcID,
Region: a.victimIPObj.Region,
SubnetID: a.victimIPObj.SubnetID,
SubnetCidr: a.victimIPObj.SubnetCidr,... | [
-0.17862235009670258,
-2.0920803546905518,
0.7049340605735779,
-0.4706413149833679,
-0.4858129322528839,
0.09191378206014633,
0.5616127252578735,
-0.47436097264289856,
0.3807075023651123,
0.8099262714385986,
-0.3295106887817383,
-0.2621159553527832,
-0.4748493731021881,
-1.6007272005081177... |
func (a *FixedAllocateAction) deleteVictimIPObject() (pbcommon.ErrCode, string) {
a.victimIPObj.Status = types.IP_STATUS_DELETING
err := a.storeIf.UpdateIPObject(a.ctx, a.victimIPObj)
if err != nil {
return pbcommon.ErrCode_ERROR_CLOUD_NETSERVICE_STOREOPS_FAILED,
fmt.Sprintf("trans victim ip object %+v to delet... | [
0.09997659921646118,
-1.4234201908111572,
0.9408955574035645,
-0.11753647029399872,
-0.49065402150154114,
0.06980383396148682,
0.5225333571434021,
0.06403922289609909,
0.5716400742530823,
0.6208260655403137,
0.06187694892287254,
-0.27903246879577637,
-0.14121660590171814,
-0.69673734903335... |
func (a *FixedAllocateAction) Do() error {
// query subent from store
if errCode, errMsg := a.querySubnetFromStore(); errCode != pbcommon.ErrCode_ERROR_OK {
return a.Err(errCode, errMsg)
}
// query eni info from cloud
if errCode, errMsg := a.queryEniFromCloud(); errCode != pbcommon.ErrCode_ERROR_OK {
return a.... | [
-0.17087773978710175,
0.08547044545412064,
1.2134524583816528,
0.26962485909461975,
0.5467832684516907,
0.31608524918556213,
0.04127417504787445,
-1.0611430406570435,
0.5135012269020081,
0.8601108193397522,
1.0410692691802979,
0.014819744043052197,
0.08570545166730881,
-0.02217249944806099... |
func Agpe(fid int32, f fType, a, b float64, pointsAndBuf2 []float64, epsabs, epsrel float64, alist, blist, rlist, elist, pts []float64, iord, level, ndin []int32) (result, abserr float64, neval, last int32) {
// check nubmer of points
npts2 := int32(len(pointsAndBuf2))
if npts2 < 2 {
chk.Panic("number of points (... | [
-0.14536210894584656,
0.8404003977775574,
1.010224461555481,
-0.02376929298043251,
0.4860483407974243,
-0.03751854971051216,
0.30720505118370056,
-0.5011382102966309,
-0.4536491632461548,
0.2606189250946045,
-0.04470536485314369,
-0.18794257938861847,
-0.4590015709400177,
0.213243693113327... |
func checkIer(ier int32) {
if ier == 0 {
return
}
switch ier {
case 1:
chk.Panic("error # 1: maximum number of subdivisions reached\n")
case 2:
chk.Panic("error # 2: the occurrence of roundoff error is detected\n")
case 3:
chk.Panic("error # 3: extremely bad integrand behaviour\n")
case 4:
chk.Panic("e... | [
-0.17025350034236908,
-0.19386541843414307,
0.5282461047172546,
-0.11235512793064117,
-0.3420913517475128,
0.7636502981185913,
0.008587352000176907,
-0.024884911254048347,
-0.26888197660446167,
-0.1298992782831192,
0.5606860518455505,
-0.37448135018348694,
-0.7275804877281189,
1.0893267393... |
func testNondedupContentExists(t *testing.T, cluster ardb.StorageCluster, vdiskID string, blockIndex int64, content []byte) {
storageKey := nonDedupedStorageKey(vdiskID)
contentReceived, err := ardb.Bytes(
cluster.DoFor(blockIndex, ardb.Command(command.HashGet, storageKey, blockIndex)))
if err != nil {
debug.Pri... | [
-0.19129446148872375,
0.2885775566101074,
0.5175814032554626,
0.23940393328666687,
1.189061164855957,
0.16946293413639069,
-0.08029323071241379,
-0.5198990106582642,
-0.19081616401672363,
0.35408326983451843,
-0.0809316635131836,
-0.11766651272773743,
-0.7210963368415833,
-0.10658976435661... |
func testNondedupContentDoesNotExist(t *testing.T, cluster ardb.StorageCluster, vdiskID string, blockIndex int64, content []byte) {
storageKey := nonDedupedStorageKey(vdiskID)
contentReceived, err := ardb.Bytes(
cluster.DoFor(blockIndex, ardb.Command(command.HashGet, storageKey, blockIndex)))
if err != nil || byt... | [
-0.30649110674858093,
0.4413745403289795,
0.5149989724159241,
0.35632818937301636,
1.2135292291641235,
0.47918835282325745,
-0.06993373483419418,
-0.8292406797409058,
-0.3562151789665222,
0.4623907208442688,
0.1604444980621338,
-0.43468403816223145,
-0.7169540524482727,
0.03789933025836944... |
func TestNonDedupedDeadlock(t *testing.T) {
const (
vdiskID = "a"
blockSize = 128
blockCount = 512
)
cluster := redisstub.NewUniCluster(true)
defer cluster.Close()
storage, err := NonDeduped(vdiskID, "", blockSize, cluster, nil)
if err != nil || storage == nil {
t.Fatalf("storage could not be create... | [
-0.6012037396430969,
1.5505831241607666,
0.6100484132766724,
0.521750271320343,
0.6141316890716553,
0.19082435965538025,
0.5021510124206543,
-0.29243922233581543,
0.8992124199867249,
-0.26367372274398804,
-0.2737998068332672,
0.37055113911628723,
-0.1565808653831482,
0.8849499821662903,
... |
func TestGetNondedupedTemplateContent(t *testing.T) {
const (
vdiskID = "a"
)
clusterA := redisstub.NewUniCluster(false)
defer clusterA.Close()
storageA, err := NonDeduped(vdiskID, "", 8, clusterA, ardb.ErrorCluster{Error: ardb.ErrNoServersAvailable})
if err != nil || storageA == nil {
t.Fatalf("storageA co... | [
-0.36047497391700745,
-0.1136133223772049,
0.9204201698303223,
0.28426384925842285,
0.7000097632408142,
-0.10303021967411041,
0.7228298187255859,
-0.5150898694992065,
0.001604663673788309,
-0.3422175645828247,
-0.2141636162996292,
0.12058578431606293,
-0.3018347918987274,
0.474517673254013... |
func TestNonDedupedStorageTemplateServerDown(t *testing.T) {
const (
vdiskID = "a"
)
clusterA := redisstub.NewUniCluster(false)
defer clusterA.Close()
storageA, err := NonDeduped(vdiskID, "", 8, clusterA, nil)
if err != nil || storageA == nil {
t.Fatalf("storageA could not be created: %v", err)
}
cluster... | [
-0.08414148539304733,
0.30528250336647034,
1.0133193731307983,
0.7438809871673584,
0.6926912069320679,
-0.264169305562973,
0.9131816029548645,
-0.40075716376304626,
0.2517356872558594,
-0.24836526811122894,
-0.4968259632587433,
-0.0361209511756897,
-0.543113648891449,
0.3398510813713074,
... |
func testSetLegacyReplicationLagAlgorithm(newLegacy bool) {
legacyReplicationLagAlgorithm.Set(newLegacy)
} | [
0.6720824241638184,
0.8928790092468262,
0.29398781061172485,
0.44058436155319214,
-0.2956916391849518,
0.0812884271144867,
0.21769081056118011,
1.0623754262924194,
0.16009294986724854,
0.23633013665676117,
-1.1882944107055664,
0.7659003138542175,
-0.14204710721969604,
0.3096074163913727,
... |
func testSetMinNumTablets(newMin int) {
minNumTablets.Set(newMin)
} | [
0.49718618392944336,
-0.3164413273334503,
0.40923675894737244,
0.5465867519378662,
-1.1136717796325684,
0.5401539206504822,
0.31217390298843384,
-1.4293185472488403,
0.39824020862579346,
-0.23709823191165924,
-1.0749177932739258,
0.09560418128967285,
-0.30024945735931396,
0.053356450051069... |
func StringOpen(l *State) int {
NewLibrary(l, stringLibrary)
l.CreateTable(0, 1)
l.PushString("")
l.PushValue(-2)
l.SetMetaTable(-2)
l.Pop(1)
l.PushValue(-2)
l.SetField(-2, "__index")
l.Pop(1)
return 1
} | [
-1.1284675598144531,
0.18081729114055634,
0.6495617628097534,
-1.1697497367858887,
-1.051974892616272,
-0.06573181599378586,
0.7596881985664368,
0.8242913484573364,
-0.46518751978874207,
0.18602584302425385,
-0.23637478053569794,
0.20692454278469086,
-0.3962598741054535,
-0.900843739509582... |
func (m *Condition) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAnd(formats); err != nil {
res = append(res, err)
}
if err := m.validateBetween(formats); err != nil {
res = append(res, err)
}
if err := m.validateEquals(formats); err != nil {
res = append(res, err)
}
i... | [
0.4082871675491333,
-0.335335910320282,
0.5190949440002441,
0.15901334583759308,
0.006190151441842318,
0.0858936607837677,
0.6662057042121887,
-0.8863633275032043,
-0.7948856949806213,
-0.3322998285293579,
0.39453399181365967,
-0.9555876851081848,
-0.7469485998153687,
1.0555144548416138,
... |
func NewAuthorizationRequest(body io.Reader) (*AuthorizationRequest, error) {
var req *AuthorizationRequest
decoder := json.NewDecoder(body)
err := decoder.Decode(&req)
return req, err
} | [
-0.6565036773681641,
-0.11293090134859085,
0.3260260820388794,
0.2568568289279938,
-1.3301762342453003,
-0.7638076543807983,
-0.7678696513175964,
0.20702609419822693,
0.16725869476795197,
0.7070227861404419,
0.19994302093982697,
0.40693551301956177,
0.2181568145751953,
-0.04568612203001976... |
func (r *AuthorizationRequest) Namespace() string {
if !r.IsResourceRequest() {
return "__MAGIC__NOMATCH_*_KEY__"
}
return r.Spec.ResourceAttributes.Namespace
} | [
-0.1391158103942871,
-0.21932536363601685,
0.4728725552558899,
1.1502538919448853,
-0.8109148740768433,
0.3132168650627136,
0.2622579336166382,
-0.8839713335037231,
1.0840976238250732,
-0.12271003425121307,
2.1078734397888184,
0.629586935043335,
-0.18445217609405518,
0.44788554310798645,
... |
func (r *AuthorizationRequest) Path() string {
if r.IsResourceRequest() {
return "__MAGIC__NOMATCH_*_KEY__"
}
return r.Spec.NonResourceAttributes.Path
} | [
-0.5897953510284424,
-0.4586404263973236,
0.2972314655780792,
0.7126593589782715,
-1.187617301940918,
1.1688568592071533,
0.9038475751876831,
-0.8870546817779541,
-0.18478234112262726,
0.3977009654045105,
2.1370129585266113,
-0.06265930086374283,
-0.6628286242485046,
0.5356786251068115,
... |
func (c Command) FullName() string {
if c.commandNamePath == nil {
return c.Name
}
return strings.Join(c.commandNamePath, " ")
} | [
1.3208508491516113,
-0.4729502499103546,
0.6001021265983582,
0.6923884153366089,
0.06708536297082901,
0.02412637695670128,
0.04241781309247017,
0.2528504729270935,
0.26380977034568787,
-0.0400628037750721,
0.1534423828125,
-0.44911903142929077,
-0.44144660234451294,
0.9030925035476685,
0... |
func (c Command) Run(ctx *Context) (err error) {
if !c.SkipFlagParsing {
if len(c.Subcommands) > 0 {
return c.startApp(ctx)
}
}
if !c.HideHelp && (HelpFlag != BoolFlag{}) {
// append help to flags
c.Flags = append(
c.Flags,
HelpFlag,
)
}
if ctx.App.UseShortOptionHandling {
c.UseShortOptionHa... | [
0.46322861313819885,
-0.47166091203689575,
1.0801023244857788,
0.44373831152915955,
-0.03741101920604706,
0.32462430000305176,
0.5110072493553162,
-0.06630013138055801,
-0.06988345086574554,
-0.32539746165275574,
-0.2653539478778839,
-0.21546149253845215,
-0.25533363223075867,
1.0350110530... |
func reorderArgs(commandFlags []Flag, args []string) []string {
var remainingArgs, reorderedArgs []string
nextIndexMayContainValue := false
for i, arg := range args {
// if we're expecting an option-value, check if this arg is a value, in
// which case it should be re-ordered next to its associated flag
if n... | [
-0.07977800816297531,
0.1313643604516983,
0.6163328289985657,
0.1853788197040558,
0.37551349401474,
-0.3657764494419098,
-1.0701706409454346,
-0.3614543080329895,
-0.5996425151824951,
0.49793022871017456,
0.6036967635154724,
0.5633524656295776,
-1.0421990156173706,
0.6858519911766052,
-0... |
func argIsFlag(commandFlags []Flag, arg string) bool {
if arg == "-" || arg == "--" {
// `-` is never a flag
// `--` is an option-value when following a flag, and a delimiter indicating the end of options in other cases.
return false
}
// flags always start with a -
if !strings.HasPrefix(arg, "-") {
return ... | [
0.027355452999472618,
-0.08961910754442215,
0.5198473930358887,
0.02341241016983986,
0.1786690205335617,
-0.007327290717512369,
-0.9425826072692871,
0.5776066780090332,
-0.8140304684638977,
-0.20817194879055023,
-0.0595114529132843,
0.998350977897644,
-0.5831249952316284,
1.114633321762085... |
func (c Command) Names() []string {
names := []string{c.Name}
if c.ShortName != "" {
names = append(names, c.ShortName)
}
return append(names, c.Aliases...)
} | [
-0.3033836781978607,
-0.2752363979816437,
0.47040003538131714,
-0.6719028949737549,
0.35281893610954285,
-0.02564215287566185,
-1.092278003692627,
-0.05599874630570412,
-0.1602163016796112,
0.10804741829633713,
-0.8779353499412537,
0.4449344575405121,
0.5274655818939209,
1.6856133937835693... |
func (c Command) HasName(name string) bool {
for _, n := range c.Names() {
if n == name {
return true
}
}
return false
} | [
-0.21819178760051727,
0.11157096922397614,
0.49526190757751465,
0.04916307330131531,
0.32549232244491577,
-0.5717260837554932,
-0.3497544527053833,
-0.24013151228427887,
-0.5583224892616272,
0.49947550892829895,
-1.0111347436904907,
-0.37427935004234314,
-0.4121933877468109,
1.195807218551... |
func (c Command) VisibleFlags() []Flag {
return visibleFlags(c.Flags)
} | [
1.3637804985046387,
0.3557259142398834,
0.4450976550579071,
0.30804964900016785,
-0.1544545739889145,
0.9711557030677795,
-0.008485769852995872,
-0.18268422782421112,
0.023617329075932503,
0.26471948623657227,
-0.8605518937110901,
1.1988246440887451,
-0.7942240834236145,
1.1356219053268433... |
func FromLogMsgToStringMap(doc *log.LogMessage, m map[string]string) {
msg := reflect.Indirect(reflect.ValueOf(*doc))
for i := 0; i < msg.NumField(); i++ {
currName := msg.Type().Field(i).Name
currValue := msg.Field(i)
switch currValue.Kind() {
case reflect.String:
m[currName] = currValue.Interface().(st... | [
-0.5628639459609985,
-1.1356631517410278,
0.5829751491546631,
-1.4326077699661255,
-0.9308106303215027,
0.3607548177242279,
-0.3269675076007843,
-0.39000821113586426,
-0.5865222811698914,
0.6127488613128662,
0.20411314070224762,
0.377042680978775,
0.06249317154288292,
0.3768697679042816,
... |
func convertTimeToTs(ts time.Time) int32 {
return int32(ts.Unix())
} | [
-0.20776893198490143,
-0.04069571569561958,
0.6545106172561646,
-0.839293897151947,
-0.10824425518512726,
0.04701340198516846,
-0.9538787603378296,
-0.7354450225830078,
0.49840667843818665,
0.11267774552106857,
-0.46391621232032776,
-0.5624271631240845,
0.7525513172149658,
0.74973696470260... |
func CreateShaEndpoint(w http.ResponseWriter, req *http.Request) {
if req.Body == nil {
errorHandler(w, req, http.StatusBadRequest)
return
}
var r MessageRequest
_ = json.NewDecoder(req.Body).Decode(&r)
err := r.Validate(w, req)
if err != nil {
errorHandler(w, req, http.S... | [
0.39543184638023376,
-0.40127652883529663,
0.870675265789032,
-0.16783587634563446,
0.7780364751815796,
-0.2182876467704773,
-0.5116674304008484,
0.15525443851947784,
0.4691004455089569,
0.1857159286737442,
-0.23544396460056305,
-0.1083783507347107,
-0.020138781517744064,
0.555524051189422... |
func CreateMessageResponseEndpoint(w http.ResponseWriter, req *http.Request) {
params := mux.Vars(req)
var sha Sha_256
sha.Digest = params["digest"]
m, ok := digests[sha]
if !ok {
errorHandler(w, req, http.StatusNotFound)
return
}
json.NewEncoder(w).Encode(m)
} | [
0.24765345454216003,
-1.339252233505249,
0.521199107170105,
-0.46685293316841125,
0.37988898158073425,
-0.2378062605857849,
-0.32127174735069275,
-0.5382683277130127,
0.48175719380378723,
0.32612520456314087,
0.5265620946884155,
-0.7189629673957825,
-0.5796136260032654,
1.0556368827819824,... |
func errorHandler(w http.ResponseWriter, req *http.Request, status int) {
w.WriteHeader(status)
if status == http.StatusNotFound {
e := Error{ErrMsg: "MessageResponse not found", ErrCode:http.StatusNotFound}
json.NewEncoder(w).Encode(e)
}
if status == http.StatusBadRequest {
e :=... | [
-0.4430066645145416,
-1.4313397407531738,
0.6601061820983887,
-0.4108812212944031,
-0.02836337313055992,
0.5314606428146362,
0.008860085159540176,
0.14435376226902008,
-0.14968694746494293,
0.12485937029123306,
-0.07781457901000977,
-0.14567528665065765,
0.1883426308631897,
0.5310122370719... |
func checkResponse(r io.Reader) error {
response, err := ParseResponse(r)
if err != nil {
return err
}
if response.IsFailure() {
return errors.New(response.GetMessage())
}
return nil
} | [
0.5064978003501892,
-1.0396368503570557,
0.4457879662513733,
0.47859635949134827,
0.6456154584884644,
-0.6118648648262024,
-0.6292452812194824,
-0.47947484254837036,
0.714234471321106,
0.213560551404953,
0.3634662926197052,
-1.1735142469406128,
-1.3995531797409058,
0.09729964286088943,
0... |
func CopyN(writer io.Writer, src io.Reader, size int64) (int64, error) {
var total int64
total = 0
for total < size {
n, err := io.CopyN(writer, src, size)
if err != nil {
return 0, err
}
total += n
}
return total, nil
} | [
-0.7427622079849243,
0.17752064764499664,
0.5569561123847961,
0.496644526720047,
-0.4221620261669159,
-1.484560489654541,
0.5709540247917175,
-0.29968395829200745,
-0.12542781233787537,
-0.35077357292175293,
-0.9047072529792786,
-0.6775792241096497,
0.788129448890686,
0.41178515553474426,
... |
func ParseResponse(reader io.Reader) (Response, error) {
buffer := make([]uint8, 1)
_, err := reader.Read(buffer)
if err != nil {
return Response{}, err
}
responseType := buffer[0]
message := ""
if responseType > 0 {
bufferedReader := bufio.NewReader(reader)
message, err = bufferedReader.ReadString('\n')
... | [
0.5238192081451416,
-0.8363217115402222,
0.4570297598838806,
-0.07838854193687439,
-0.7100266218185425,
-0.9999523758888245,
0.2230905145406723,
-0.6413977146148682,
1.4217103719711304,
-0.5897324085235596,
0.14441390335559845,
-0.31975361704826355,
-1.165352702140808,
0.3436608910560608,
... |
func (r *Response) IsFailure() bool {
return r.Type > 0
} | [
-0.8233467936515808,
-0.3972508907318115,
0.22293904423713684,
0.6989530324935913,
0.6941962838172913,
-0.5552992224693298,
-0.40857037901878357,
-0.727575421333313,
0.8433595895767212,
-0.17349940538406372,
-0.49044573307037354,
-0.44563260674476624,
-1.2124683856964111,
0.664277255535125... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.