text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (v *DCHttpClient) Get(url string, headers map[string]string) (response *DCHttpResponse, err error) {
return v.DoWithoutContent(http.MethodGet, url, headers)
} | [
-1.1090821027755737,
0.06373283267021179,
0.4766142964363098,
-0.5806170701980591,
-0.15804284811019897,
-0.7274917960166931,
-0.7573077082633972,
-0.9073047041893005,
-0.1443076729774475,
-0.5138351321220398,
-0.3255322277545929,
0.11178997904062271,
-0.40524113178253174,
-0.4031039476394... |
func (v *DCHttpClient) PostString(
url string, headers map[string]string, text string) (response *DCHttpResponse, err error) {
return v.DoString(http.MethodPost,url, headers, text)
} | [
-1.078782558441162,
0.012725427746772766,
0.42593246698379517,
-0.1206413209438324,
-0.6603973507881165,
-0.29946252703666687,
-0.8240191340446472,
-0.081932432949543,
-0.16104915738105774,
-0.3842058777809143,
-0.44864973425865173,
-0.5840213894844055,
-0.4420100152492523,
-0.385871767997... |
func (v *DCHttpClient) PostBytes(
url string, headers map[string]string, data []byte) (response *DCHttpResponse, err error) {
return v.DoBytes(http.MethodPost,url, headers, data)
} | [
-1.2880107164382935,
0.9617987275123596,
0.3535135090351105,
-0.7268097996711731,
-0.3947751820087433,
-0.37880274653434753,
-0.7074783444404602,
-0.1745559424161911,
0.2481038123369217,
-0.6521502137184143,
-1.357757329940796,
0.01154300570487976,
-1.2896575927734375,
0.41487446427345276,... |
func (v *DCHttpClient) PostJSON(
url string, headers map[string]string, jsonObject interface{}) (response *DCHttpResponse, err error) {
return v.DoJSON(http.MethodPost,url, headers, jsonObject)
} | [
-1.372574806213379,
-0.4339177906513214,
0.6887233257293701,
-0.30453431606292725,
-1.098089337348938,
-0.4953130781650543,
0.07833652943372726,
0.0017531579360365868,
0.11615009605884552,
-0.2010323852300644,
-1.5428078174591064,
-0.04881729185581207,
-0.013983801007270813,
0.250304967164... |
func (v *DCHttpClient) PostForm(
url string, headers map[string]string, form map[string]string) (response *DCHttpResponse, err error) {
return v.DoForm(http.MethodPost,url, headers, form)
} | [
-1.0668143033981323,
0.29680997133255005,
0.5525325536727905,
-0.30154576897621155,
0.08255863189697266,
-0.8197479248046875,
-0.6987515687942505,
0.195700004696846,
-0.3877599239349365,
-1.2407087087631226,
-0.7392942905426025,
-1.0467946529388428,
-0.27889755368232727,
0.2584945559501648... |
func (v *DCHttpClient) PostMultipartForm(
url string, headers map[string]string, form map[string]string,
fileParam string, filePath string) (response *DCHttpResponse, err error) {
return v.DoMultipartForm(http.MethodPost,url, headers, form, fileParam, filePath)
} | [
-0.7761507630348206,
-0.2297094166278839,
0.6227946877479553,
-0.2767462432384491,
-0.7466417551040649,
-0.4188380539417267,
0.13942110538482666,
0.3151620328426361,
-0.31532153487205505,
-0.7196330428123474,
-1.307861566543579,
-1.1173441410064697,
-0.7117272615432739,
0.20380958914756775... |
func (v *DCHttpClient) Put(
url string, headers map[string]string) (response *DCHttpResponse, err error) {
return v.DoWithoutContent(http.MethodPut, url, headers)
} | [
-1.2523651123046875,
0.12513713538646698,
0.408491313457489,
-0.9070728421211243,
-0.5086079835891724,
-0.13310383260250092,
-0.10338319838047028,
-0.6029953956604004,
-0.1642279475927353,
-0.13331234455108643,
-0.7610765099525452,
-0.26549747586250305,
-0.930004358291626,
-0.4937727749347... |
func (v *DCHttpClient) Delete(
url string, headers map[string]string) (response *DCHttpResponse, err error) {
return v.DoWithoutContent(http.MethodDelete, url, headers)
} | [
-0.5088719129562378,
-0.0009344741702079773,
0.527310848236084,
0.009908491745591164,
-0.08558973670005798,
-0.29229122400283813,
-0.14876210689544678,
-0.6723328828811646,
0.47185248136520386,
-0.1803203821182251,
-0.21797287464141846,
-0.6115642786026001,
-0.7751806974411011,
-0.38944458... |
func (v *DCHttpClient) DoWithoutContent(
method string, url string, headers map[string]string) (response *DCHttpResponse, err error) {
req, err := http.NewRequest(method, url, nil)
if err != nil {
return nil, err
}
return v.do(req, headers)
} | [
-1.1726278066635132,
-0.12013828754425049,
0.8101162314414978,
-0.3987891674041748,
0.20595908164978027,
-0.060447242110967636,
0.10258054733276367,
-1.3249926567077637,
-0.540843665599823,
-0.13990484178066254,
-0.2430034577846527,
-0.3066544532775879,
-0.31092730164527893,
-0.17995336651... |
func (v *DCHttpClient) DoString(
method string, url string, headers map[string]string, text string) (response *DCHttpResponse, err error) {
req, err := http.NewRequest(method, url, strings.NewReader(text))
if err != nil {
return nil, err
}
req.Header.Set("Content-Type", "text/plain")
return v.do(req, headers)
} | [
-1.2900311946868896,
0.49812453985214233,
0.7539158463478088,
-0.7453969717025757,
-0.24273601174354553,
0.03461596742272377,
-0.6017538905143738,
-0.4359636604785919,
0.14056332409381866,
0.44763100147247314,
0.1312730610370636,
-0.025545775890350342,
-0.3195072412490845,
-0.3767026662826... |
func (v *DCHttpClient) DoBytes(
method string, url string, headers map[string]string, data []byte) (response *DCHttpResponse, err error) {
req, err := http.NewRequest(method, url, bytes.NewReader(data))
if err != nil {
return nil, err
}
return v.do(req, headers)
} | [
-0.7958934307098389,
0.8158004879951477,
0.6270642280578613,
-0.7048999071121216,
0.312513142824173,
-0.4365476667881012,
-0.963412880897522,
-0.6708956956863403,
0.08374567329883575,
-0.2281033843755722,
-0.17572741210460663,
0.15750429034233093,
-0.46508079767227173,
-0.00083846086636185... |
func (v *DCHttpClient) DoJSON(
method string, url string, headers map[string]string, jsonObject interface{}) (response *DCHttpResponse, err error) {
jsonStringBytes, err := json.Marshal(jsonObject)
if err != nil {
return nil, err
}
req, err := http.NewRequest(method, url, bytes.NewReader(jsonStringBytes))
if e... | [
-1.1103876829147339,
-0.38368847966194153,
0.9975178241729736,
-0.381367951631546,
-0.23357471823692322,
-0.45252418518066406,
-0.14090213179588318,
-0.30309605598449707,
0.13111720979213715,
0.37743279337882996,
-0.6617107391357422,
0.3678490221500397,
0.23646298050880432,
-0.031735833734... |
func (v *DCHttpClient) DoForm(
method string, url string, headers map[string]string, form map[string]string) (response *DCHttpResponse, err error) {
req, err := http.NewRequest(method, url, nil)
if err != nil {
return nil, err
}
if req.Form == nil {
req.Form = make(map[string][]string)
}
for k,v := range for... | [
-1.1923121213912964,
0.30448684096336365,
0.8147659301757812,
-0.1535995900630951,
0.5117064118385315,
-0.3402567505836487,
-0.9033430814743042,
-0.3675796687602997,
-0.3649355471134186,
-0.5363425612449646,
-0.08830243349075317,
-0.502913773059845,
0.16772454977035522,
1.118199348449707,
... |
func (v *DCHttpClient) DoMultipartForm(
method string, url string, headers map[string]string, form map[string]string,
fileParam string, filePath string) (response *DCHttpResponse, err error) {
// 读取文件
file, err := os.Open(filePath)
if err != nil {
return nil, err
}
defer file.Close()
body := &bytes.Buffer{}... | [
-0.9538869857788086,
-0.07028421759605408,
1.2806836366653442,
-0.22015127539634705,
-0.5316464304924011,
0.09309671074151993,
0.2922133803367615,
-0.12604202330112457,
-0.6697074174880981,
0.29738497734069824,
-0.6858792304992676,
-1.3672189712524414,
-0.33133748173713684,
0.3811520338058... |
func (v *DCHttpClient) do(req *http.Request, headers map[string]string) (response *DCHttpResponse, err error) {
response = &DCHttpResponse{}
for k, v := range v.CHeader {
req.Header.Set(k, v)
}
for k, v := range headers {
req.Header.Set(k, v)
}
if v.Trace {
response.TraceInfo = &DCHttpTrace{}
req = v.... | [
-0.2275766134262085,
0.09368981420993805,
1.1581028699874878,
-0.5045242309570312,
0.07368284463882446,
0.2866338789463043,
-0.24968764185905457,
-0.802420973777771,
-0.24238333106040955,
0.2952646017074585,
-0.4069842994213104,
-0.0951552465558052,
0.008950328454375267,
0.4408170282840729... |
func NewHttpClient() (client *DCHttpClient) {
// Although the http library has a built-in DefaultTransport, it is a pointer object.
// Modifying this object will affect the every new httpClient properties.
// So copying the source code of golang has opened up a Transport object only for the http client created now.... | [
0.023098865523934364,
-0.5277000069618225,
0.7975826859474182,
-0.7081823348999023,
-0.5348333716392517,
0.027042804285883904,
0.18186378479003906,
-0.4897434711456299,
-0.016438499093055725,
-0.17472848296165466,
-0.39247679710388184,
0.20116722583770752,
-0.25472989678382874,
-0.33461990... |
func (v Search) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjson2f147938EncodeGithubComGoParkMailRu20202CodeExpressInternalModels(&w, v)
return w.Buffer.BuildBytes(), w.Error
} | [
-0.7602177858352661,
0.22766076028347015,
0.20242877304553986,
-0.07610438019037247,
-0.372362345457077,
-0.71232670545578,
0.758479118347168,
-0.14956176280975342,
-0.2730916142463684,
0.1966395229101181,
-0.7117973566055298,
0.3429618775844574,
-0.8197675943374634,
0.31242915987968445,
... |
func (v Search) MarshalEasyJSON(w *jwriter.Writer) {
easyjson2f147938EncodeGithubComGoParkMailRu20202CodeExpressInternalModels(w, v)
} | [
-0.8089702725410461,
-0.0972876101732254,
0.19978252053260803,
-0.5804365873336792,
-0.271194726228714,
-1.1350761651992798,
0.45089781284332275,
-0.867309033870697,
-0.06750127673149109,
0.02169477567076683,
-0.9892096519470215,
0.17963658273220062,
-0.3103622794151306,
0.8437926173210144... |
func (v *Search) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjson2f147938DecodeGithubComGoParkMailRu20202CodeExpressInternalModels(&r, v)
return r.Error()
} | [
-0.8485477566719055,
0.4766175448894501,
0.20927424728870392,
-0.7921401262283325,
-0.47529610991477966,
-0.34055182337760925,
0.24831242859363556,
0.011147472076117992,
-0.37322160601615906,
0.2107141762971878,
-0.5925101637840271,
-0.1743931621313095,
-1.0837910175323486,
0.2388965189456... |
func (v *Search) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjson2f147938DecodeGithubComGoParkMailRu20202CodeExpressInternalModels(l, v)
} | [
-0.47048863768577576,
0.20637044310569763,
0.2533828616142273,
-0.751954972743988,
-0.21089288592338562,
-1.3253229856491089,
0.3550959527492523,
0.15482579171657562,
-0.36344751715660095,
0.0998249277472496,
-0.9668995141983032,
-0.21961307525634766,
-0.5258116126060486,
0.703969955444335... |
func DNS(options ...ServicerFunc) Servicer {
s := &dnsService{}
for _, o := range options {
o(s)
}
return s
} | [
-0.49338415265083313,
1.7713654041290283,
0.29520484805107117,
0.452646404504776,
0.2536945641040802,
-1.0493451356887817,
-0.5549731850624084,
-1.2616177797317505,
0.6733885407447815,
-0.6473957896232605,
0.23844927549362183,
0.7330805659294128,
0.10668189078569412,
0.015703070908784866,
... |
func TestNodeManagerWithRoot(t *testing.T) {
nodeManager := NewNodeManager()
tw := &testWorkflow{}
// Subscribe a watcher.
notifications := make(chan []byte, 10)
result, index, err := nodeManager.GetAndWatchFullTree(notifications)
if err != nil {
t.Fatalf("GetAndWatchFullTree failed: %v", err)
}
defer nodeMa... | [
0.6608414649963379,
0.35545220971107483,
0.9138665199279785,
0.04158985614776611,
-0.015408921055495739,
-0.6997682452201843,
0.21113519370555878,
-0.5535780787467957,
0.15646593272686005,
-0.2825832962989807,
-0.5229868292808533,
0.9834550023078918,
0.23712874948978424,
0.9945849180221558... |
func Push(context *endly.Context, process *model.Process) {
var processes = processes(context)
if process.Source != nil {
context.Source = process.Source
}
processes.Push(process)
} | [
0.046703409403562546,
0.23066772520542145,
0.21633949875831604,
-1.0014824867248535,
-0.13107775151729584,
-0.18087030947208405,
-0.9653887152671814,
-0.31979668140411377,
0.5357405543327332,
0.5457189083099365,
-0.6661372184753418,
1.6281565427780151,
0.048886798322200775,
0.6026158332824... |
func Pop(context *endly.Context) *model.Process {
var processes = processes(context)
var process = processes.Pop()
if process != nil && process.Source != nil {
context.Source = process.Source
}
return process
} | [
0.24095551669597626,
0.07311319559812546,
0.37685105204582214,
-1.1660701036453247,
-0.3802260756492615,
-0.11513066291809082,
-0.0816853865981102,
-0.1085154190659523,
0.642098069190979,
0.7083920240402222,
0.13730578124523163,
0.2364574521780014,
-0.060123130679130554,
-0.500992834568023... |
func Last(context *endly.Context) *model.Process {
var processes = processes(context)
return processes.Last()
} | [
0.45802950859069824,
-0.515567421913147,
0.4500890374183655,
-0.9025206565856934,
0.7752113938331604,
-0.25729095935821533,
-0.7691753506660461,
-0.8316236734390259,
-0.0049332063645124435,
-0.11354095488786697,
0.20566773414611816,
0.09042545408010483,
-0.27036646008491516,
-0.78905731439... |
func LastWorkflow(context *endly.Context) *model.Process {
var processes = processes(context)
return processes.LastWorkflow()
} | [
0.16311435401439667,
-0.3771361708641052,
0.2952992618083954,
-0.8839965462684631,
0.4227719008922577,
-0.9064121246337891,
-0.1354140341281891,
-0.9242324829101562,
0.8747668862342834,
-0.7772655487060547,
-0.12308204919099808,
-0.2476525902748108,
-0.6165117621421814,
-0.4549015164375305... |
func FirstWorkflow(context *endly.Context) *model.Process {
var processes = processes(context)
return processes.FirstWorkflow()
} | [
0.7496446967124939,
-0.16745638847351074,
0.25993040204048157,
-0.19965682923793793,
0.6479240655899048,
-1.0753998756408691,
-0.28447723388671875,
-1.0798332691192627,
0.42407724261283875,
-1.340567708015442,
0.1473587602376938,
-0.03755172714591026,
0.09326133131980896,
0.594719409942627... |
func GetResource(dao *Dao, state data.Map, URL string) *url.Resource {
for _, candidate := range getURLs(URL) {
resource := url.NewResource(candidate)
storageService, err := storage.NewServiceForURL(resource.URL, "")
if err != nil {
return nil
}
exists, _ := storageService.Exists(resource.URL)
if exists... | [
-0.1741902381181717,
0.003141730558127165,
0.6176813244819641,
0.27971166372299194,
0.2756807506084442,
-0.6759560704231262,
0.5779326558113098,
0.6989823579788208,
0.7906554341316223,
-0.19663840532302856,
0.5475804209709167,
-0.6619455218315125,
-0.4489559531211853,
0.15947860479354858,
... |
func MakeHelper(ctx context.Context, listenOn []multiaddr.Multiaddr, statedir string, pk crypto.PrivKey, networkID string) (*Helper, error) {
logger := logging.Logger("codanet.Helper")
dso := dsb.DefaultOptions
bp := path.Join(statedir, strconv.Itoa(os.Getpid()))
os.MkdirAll(bp, 0700)
ds, err := dsb.NewDatastore... | [
0.1258542835712433,
0.3889119625091553,
0.628018319606781,
-0.7394977807998657,
-0.39160123467445374,
-0.16798149049282074,
0.3673025965690613,
-0.3262757360935211,
-0.29600244760513306,
-0.3016743063926697,
0.06165429204702377,
-0.07677792012691498,
0.26812687516212463,
0.0898225456476211... |
func OpenPrIfNecessary(config *config.Config, todos map[int]string, prints map[int]string) (string, error) {
if (config.CheckForTODOs && len(todos) > 0) || (config.CheckForPrints && len(prints) > 0) {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Would you still like to open the PR? (Y/n) ")
text, _ := reader.R... | [
-0.525905191898346,
0.2298588752746582,
0.6122525930404663,
0.1139044314622879,
-0.896801769733429,
0.2789442241191864,
-0.20997360348701477,
0.27750617265701294,
0.380206435918808,
-0.5094931125640869,
1.1199918985366821,
0.34908226132392883,
-0.904902994632721,
0.5420268177986145,
0.67... |
func GetCurrentBranch() string {
cmd := exec.Command("git", "branch")
var out bytes.Buffer
cmd.Stdout = &out
cmd.Run()
lines := strings.Split(out.String(), "\n")
for _, line := range lines {
if strings.Contains(line, "*") {
branch := strings.Replace(line, "*", "", -1)
branch = strings.TrimSpace(branch)
... | [
0.29740092158317566,
-0.49103689193725586,
0.6839437484741211,
1.0841753482818604,
-0.5058320164680481,
0.7094805836677551,
-0.2150065153837204,
0.4328535497188568,
-0.4356461763381958,
0.29593393206596375,
0.4853084981441498,
0.9302167296409607,
-1.0776478052139282,
0.8695964813232422,
... |
func GetDiff(oldBranch string, newBranch string) (*diffparser.Diff, error) {
cmd := exec.Command("git", "diff", oldBranch+".."+newBranch)
var out bytes.Buffer
cmd.Stdout = &out
cmd.Run()
return diffparser.Parse(out.String())
} | [
0.5132774114608765,
-0.5307876467704773,
0.803614616394043,
0.5671220421791077,
0.05344013124704361,
-0.016125673428177834,
-0.6185744404792786,
-0.10043523460626602,
-0.5394502282142639,
-0.6649736166000366,
-0.26561957597732544,
1.3622177839279175,
-1.0466933250427246,
0.5095005035400391... |
func NewJunction(rFunc RoutingFunc) Junction {
return Junction{routingFn: rFunc, router: make(map[interface{}]*Pipeline)}
} | [
-0.2833283841609955,
-0.5690346956253052,
0.18597953021526337,
0.39189624786376953,
-0.5509577393531799,
-0.5882944464683533,
1.0330599546432495,
1.370756983757019,
0.0813620388507843,
-1.3290404081344604,
0.046130403876304626,
0.21866239607334137,
0.3493708372116089,
0.34925952553749084,
... |
func (j *Junction) AddPipeline(key interface{}, p *Pipeline) *Junction {
j.router[key] = p
return j
} | [
-1.2864469289779663,
0.14211460947990417,
0.37088215351104736,
-0.06690074503421783,
-0.04726356640458107,
0.013354727067053318,
-0.6394369006156921,
0.9508414268493652,
-0.3379170596599579,
0.17929987609386444,
0.37352126836776733,
-0.6435089111328125,
-0.888882040977478,
0.11002949625253... |
func (j *Junction) route(in chan interface{}) {
go func() {
for item := range in {
routingKey := j.routingFn(item)
j.debug(fmt.Sprintf("routing key: %v", routingKey))
if dest, ok := j.router[routingKey]; ok {
dest.Enqueue(item)
} else {
j.debug(fmt.Sprintf("Junction discarding item: %+v no dest p... | [
-1.4631571769714355,
0.252836674451828,
0.3562195301055908,
0.01934962160885334,
0.40214088559150696,
-0.948884129524231,
0.26303035020828247,
0.17027516663074493,
-0.7592532634735107,
0.8211342692375183,
0.47895628213882446,
-0.17165230214595795,
-0.0440768226981163,
0.14890679717063904,
... |
func (j *Junction) debug(values ...string) {
if j.DebugMode {
log.Println(values)
}
} | [
-0.03827857971191406,
0.38526713848114014,
0.31678056716918945,
0.27598118782043457,
0.8742551207542419,
0.2665487229824066,
-0.3914605975151062,
0.20131203532218933,
-0.17639541625976562,
-0.6622486114501953,
0.4800970256328583,
-0.03441445901989937,
-0.42757195234298706,
0.97933274507522... |
func (ctrl *VMExportController) Init() {
ctrl.vmExportQueue = workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "virt-controller-export-vmexport")
ctrl.VMExportInformer.AddEventHandlerWithResyncPeriod(
cache.ResourceEventHandlerFuncs{
AddFunc: ctrl.handleVMExport,
UpdateFunc: f... | [
0.5846450924873352,
-0.39840349555015564,
0.6793301105499268,
0.6503773927688599,
0.050337497144937515,
0.1828070878982544,
0.5301921367645264,
-0.12966832518577576,
0.08881473541259766,
-0.2855854034423828,
-0.4240255653858185,
-0.10637662559747696,
0.10459225624799728,
0.9024993181228638... |
func (o *OSS) load() {
var client *oss.Client
if client, o.loadError = oss.New(
o.Endpoint,
o.AccessKeyID,
o.AccessKeySecret,
); o.loadError != nil {
return
}
o.bucket, o.loadError = client.Bucket(o.BucketName)
} | [
-0.17099566757678986,
-0.2181204855442047,
0.38654035329818726,
-0.5547557473182678,
0.27740994095802307,
-0.06861548870801926,
-0.1015724465250969,
-0.5111455917358398,
-0.27223238348960876,
-0.5155798196792603,
-0.3098476231098175,
0.29540687799453735,
0.21170638501644135,
-0.93281048536... |
func (o *OSS) NewHash() hash.Hash {
return md5.New()
} | [
0.5442796349525452,
-0.2373325228691101,
0.20682574808597565,
1.1051386594772339,
-0.9038971662521362,
0.507320761680603,
0.1501474380493164,
-0.452534019947052,
-0.17367875576019287,
-0.9968869686126709,
0.09875280410051346,
0.4977618157863617,
-0.0524250790476799,
-0.1146344318985939,
... |
func (o *OSS) Cache(ctx context.Context, name string) (goproxy.Cache, error) {
if o.loadOnce.Do(o.load); o.loadError != nil {
return nil, o.loadError
}
objectName := path.Join(o.Root, name)
if e, err := o.bucket.IsObjectExist(objectName); err != nil {
return nil, err
} else if !e {
return nil, goproxy.ErrCa... | [
-0.2903513014316559,
-0.34032514691352844,
0.7264330983161926,
-0.6029478311538696,
-0.43779444694519043,
-0.3017452657222748,
-0.3578704595565796,
-0.6950774192810059,
0.19033658504486084,
0.422262042760849,
0.4391605854034424,
-0.14591731131076813,
-0.28161823749542236,
-0.29706850647926... |
func (o *OSS) SetCache(ctx context.Context, c goproxy.Cache) error {
if o.loadOnce.Do(o.load); o.loadError != nil {
return o.loadError
}
return o.bucket.PutObject(
path.Join(o.Root, c.Name()),
c,
oss.ContentType(mimeTypeByExtension(path.Ext(c.Name()))),
)
} | [
-0.5636862516403198,
0.32780686020851135,
0.5974665284156799,
-0.12088223546743393,
-0.07697375118732452,
0.27073508501052856,
0.08044011890888214,
-0.44840624928474426,
-0.14222191274166107,
0.15603432059288025,
-0.325029581785202,
0.30895110964775085,
-0.2146461009979248,
-0.126881137490... |
func (oc *ossCache) Read(b []byte) (int, error) {
if oc.closed {
return 0, os.ErrClosed
} else if oc.offset >= oc.size {
return 0, io.EOF
}
rc, err := oc.bucket.GetObject(
oc.objectName,
oss.Range(oc.offset, oc.size),
)
if err != nil {
return 0, err
}
defer rc.Close()
n, err := rc.Read(b)
oc.offse... | [
-0.8083968758583069,
0.06327701359987259,
0.8279318809509277,
-0.29497238993644714,
-0.5733645558357239,
0.2008318156003952,
0.610776960849762,
-0.31292736530303955,
-0.2801334857940674,
-0.09117071330547333,
0.09461767971515656,
0.535889744758606,
-0.25885871052742004,
-0.4565606713294983... |
func (oc *ossCache) Seek(offset int64, whence int) (int64, error) {
if oc.closed {
return 0, os.ErrClosed
}
switch whence {
case io.SeekStart:
case io.SeekCurrent:
offset += oc.offset
case io.SeekEnd:
offset += oc.size
default:
return 0, errors.New("invalid whence")
}
if offset < 0 {
return 0, erro... | [
-0.9125446677207947,
0.31917375326156616,
0.6766909956932068,
-0.5572131276130676,
-0.7484130859375,
-0.008000407367944717,
0.34680935740470886,
-0.39302384853363037,
-0.09466781467199326,
-0.5209516882896423,
0.2800319790840149,
0.34561601281166077,
-0.03080948255956173,
-0.47464358806610... |
func (oc *ossCache) Close() error {
if oc.closed {
return os.ErrClosed
}
oc.closed = true
return nil
} | [
-0.06263242661952972,
0.43643468618392944,
0.508042573928833,
0.028487229719758034,
-0.25614508986473083,
0.4919370114803314,
0.2833373248577118,
-0.8667823672294617,
-0.16477057337760925,
-0.8224575519561768,
-0.023530319333076477,
0.3434179127216339,
-0.029397757723927498,
0.532480537891... |
func (oc *ossCache) Name() string {
return oc.name
} | [
-0.5232973694801331,
-0.04113639146089554,
0.4024016261100769,
0.3907516598701477,
-0.8068723082542419,
-0.020330656319856644,
0.44161924719810486,
-0.8665132522583008,
0.15853145718574524,
1.145670771598816,
-0.4297299385070801,
-0.2759031057357788,
0.7320451140403748,
0.06435438990592957... |
func (oc *ossCache) Size() int64 {
return oc.size
} | [
-0.5045951008796692,
1.3921737670898438,
0.293295294046402,
0.0686563178896904,
-0.060644179582595825,
-0.1896468997001648,
0.9470074772834778,
-0.3178713619709015,
0.3155403733253479,
-0.1361767053604126,
-0.09419776499271393,
-0.05461893975734711,
-0.007139254827052355,
0.324222534894943... |
func (oc *ossCache) ModTime() time.Time {
return oc.modTime
} | [
-0.6853616833686829,
0.3698756992816925,
0.38535746932029724,
-0.24419458210468292,
0.3233489990234375,
0.1593584269285202,
-0.339669793844223,
-0.14350639283657074,
0.6949737668037415,
0.8595502972602844,
0.11303626000881195,
0.20351439714431763,
-0.5752978324890137,
0.4813069701194763,
... |
func (oc *ossCache) Checksum() []byte {
return oc.checksum
} | [
-0.1441950649023056,
0.04633639380335808,
0.25851646065711975,
0.873769223690033,
0.6431086659431458,
0.006089234258979559,
0.3684547245502472,
-0.36514392495155334,
1.0317846536636353,
-0.21744056046009064,
-0.27363139390945435,
0.5129727125167847,
0.26612183451652527,
0.12678983807563782... |
func (t *builderTrait) IsPlatformTrait() bool {
return true
} | [
0.07391723245382309,
-0.46037596464157104,
0.28830307722091675,
0.2820338308811188,
-0.5579560399055481,
1.0371912717819214,
-0.020263148471713066,
0.7665479779243469,
-0.21929152309894562,
-0.7024006247520447,
-1.0885401964187622,
-0.012965588830411434,
-1.418039083480835,
0.8758051395416... |
func (t *builderTrait) InfluencesKit() bool {
return true
} | [
-0.19299721717834473,
0.3978709280490875,
0.4537700414657593,
0.7577832937240601,
-0.3177300989627838,
0.9628884196281433,
0.949948787689209,
0.5082907676696777,
-0.7513855695724487,
-0.9950703978538513,
-0.7129489779472351,
-0.31481924653053284,
-1.3902270793914795,
1.4933701753616333,
... |
func HashPassword(password string) (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(setSecretOnPass(password)), configurations.Configuration.Security.BCryptCost)
return string(bytes), err
} | [
0.9252709150314331,
0.8174891471862793,
0.5431851148605347,
1.270650029182434,
-0.21732623875141144,
0.18233337998390198,
-0.38355135917663574,
0.5773546099662781,
0.4053986966609955,
0.9223459959030151,
-1.0474876165390015,
0.6284052729606628,
-0.5895941853523254,
-0.17435869574546814,
... |
func CheckPasswordHash(password, hash string) bool {
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(setSecretOnPass(password)))
return err == nil
} | [
1.5262296199798584,
-0.06585527211427689,
0.6718541979789734,
1.2521088123321533,
-0.07252061367034912,
0.3596314489841461,
-0.9667788147926331,
0.38868680596351624,
-0.17000947892665863,
0.43827638030052185,
-0.7667152285575867,
0.8781355619430542,
-0.9501933455467224,
0.6616353988647461,... |
func CheckJwtToken(tokenString string) (Token, error) {
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
return []byte(configurations.Configuration.Security.JWTSecret), nil
})
if err != nil {
return Token{Authorized: false}, err
}
claims, ok := token.Claims.(jwt.MapClaims)
i... | [
0.08005055040121078,
-0.9779532551765442,
0.5625500679016113,
-0.5351946949958801,
-1.0941667556762695,
0.22141894698143005,
-0.8428869247436523,
-0.2216547131538391,
-0.09078223258256912,
0.1325271725654602,
-0.6525495052337646,
0.9552794098854065,
0.17354239523410797,
0.08653291314840317... |
func NewJwtToken(t Token, expMinutes int) (string, error) {
t.Authorized = true
return NewJwtTokenV2(t, expMinutes)
} | [
-0.4133335053920746,
-0.31328392028808594,
0.3663187026977539,
-0.7960795760154724,
-2.057591438293457,
-0.1687672734260559,
-0.673027753829956,
0.5771884322166443,
0.05875471234321594,
0.06670689582824707,
-1.532825231552124,
1.383501410484314,
0.8165346384048462,
-0.04911705479025841,
... |
func NewJwtTokenV2(t Token, expMinutes int) (string, error) {
atClaims := jwt.MapClaims{}
atClaims["authorized"] = t.Authorized
atClaims["id"] = t.ID
atClaims["institution"] = t.Institution
atClaims["permission"] = t.Permission
atClaims["exp"] = time.Now().Add(time.Minute * time.Duration(expMinutes)).Unix()
at :... | [
-0.7197396755218506,
-1.373834490776062,
0.6100574731826782,
-0.9655047655105591,
-1.7014232873916626,
-0.25347086787223816,
-1.0162038803100586,
0.12410341948270798,
-0.3309505879878998,
0.4985049366950989,
-1.0084737539291382,
1.3169972896575928,
0.5966358184814453,
0.10498777031898499,
... |
func NewJudgeSearchService(judgeSearchRepository user.JudgeSearchRepository) user.JudgeSearchRepository {
return &JudgeSearchService{judgeSearchRepo: judgeSearchRepository}
} | [
-0.6644705533981323,
0.04792381450533867,
0.32683858275413513,
-0.01196900475770235,
0.24564890563488007,
0.5488892793655396,
-0.2224491983652115,
-0.4707982838153839,
-0.019372640177607536,
0.07788088917732239,
0.24639901518821716,
0.18678806722164154,
-0.8404147624969482,
0.4993414282798... |
func (us *JudgeSearchService) Judges() ([]entity.Judge, []error) {
judges, errs := us.judgeSearchRepo.Judges()
if len(errs) > 0 {
return nil, errs
}
return judges, errs
} | [
-1.0190742015838623,
-0.10269256681203842,
0.07012953609228134,
0.5008597373962402,
1.3217676877975464,
0.8414614200592041,
-1.061614990234375,
0.42134639620780945,
-0.45757877826690674,
-0.1911674588918686,
0.5294634699821472,
0.3429057002067566,
-1.2347837686538696,
1.3345508575439453,
... |
func (us *JudgeSearchService) Judge(judgeID string) (*entity.Judge, []error) {
usr, errs := us.judgeSearchRepo.Judge(judgeID)
if len(errs) > 0 {
return nil, errs
}
return usr, errs
} | [
-1.2452027797698975,
-0.1170225664973259,
0.13237272202968597,
0.48661720752716064,
0.5847314596176147,
0.3430904746055603,
-0.5332849621772766,
0.33727601170539856,
-0.6624544262886047,
0.19984032213687897,
0.25563979148864746,
-0.019318154081702232,
-1.1829391717910767,
1.479587674140930... |
func NewParentMenu(name string) Button {
return map[string]interface{}{"name": name}
} | [
-0.05895250290632248,
-0.908964216709137,
0.4852758049964905,
-0.4609340727329254,
-1.3411953449249268,
0.16496120393276215,
-0.2637884020805359,
-0.07430266588926315,
-0.06677646934986115,
-0.22026163339614868,
-1.5832403898239136,
-0.47933608293533325,
-0.4159032106399536,
0.354816704988... |
func NewButtonClick(name, key string) Button {
return map[string]interface{}{
"type": "click",
"name": name,
"key": key,
}
} | [
0.02592351660132408,
-0.42772987484931946,
0.5009346008300781,
-0.11412598937749863,
-1.2380902767181396,
-0.20647811889648438,
-1.4969850778579712,
0.38611820340156555,
-0.05454635247588158,
0.6210924386978149,
-0.9932008981704712,
0.3916560411453247,
0.009137842804193497,
-0.003933129366... |
func NewButtonView(name, url string) Button {
return map[string]interface{}{
"type": "view",
"name": name,
"url": url,
}
} | [
-0.4014638662338257,
-0.462405264377594,
0.5829825401306152,
-0.3971966505050659,
-1.705364465713501,
-0.2886149287223816,
-0.9591954946517944,
0.360157310962677,
-0.09831416606903076,
-0.854822039604187,
-0.9197835922241211,
0.26446256041526794,
0.19192636013031006,
0.07727998495101929,
... |
func (f *randFile) Read(p []byte) (int, error) {
if f.I >= f.Size {
return 0, io.EOF
}
gap := f.Size - f.I
if gap < len(p) {
f.I += gap
return f.r.Read(p[:gap])
}
f.I += len(p)
return f.r.Read(p)
} | [
-0.48399829864501953,
0.12908399105072021,
0.667561948299408,
-0.5223958492279053,
0.10462101548910141,
1.1338810920715332,
0.9596989154815674,
0.19338743388652802,
-0.34485238790512085,
-0.25685563683509827,
0.39532965421676636,
-0.8100982904434204,
-0.8443747162818909,
-0.461628347635269... |
func (f *emptyFile) Read(p []byte) (int, error) {
if f.I >= f.Size {
return 0, io.EOF
}
f.I += len(p)
copy(p, f.Zeros)
return len(p), nil
} | [
-0.561244547367096,
0.2945829927921295,
0.7009415626525879,
-0.528405487537384,
0.2195313721895218,
0.8869404792785645,
0.6781654953956604,
0.5183432102203369,
-0.6932151317596436,
-0.4948831796646118,
-0.12478886544704437,
-0.5951818227767944,
-0.694002628326416,
-0.2071678638458252,
-0... |
func Marshal(g Message) ([]byte, error) {
b := make([]byte, g.MarshalLen())
if err := g.MarshalTo(b); err != nil {
return nil, err
}
return b, nil
} | [
0.8146786689758301,
0.9735206365585327,
0.30601266026496887,
0.35564321279525757,
-0.24344933032989502,
0.3515400290489197,
-0.5961374044418335,
-0.2108875811100006,
0.17426355183124542,
-0.5206750631332397,
-0.13021327555179596,
1.6201127767562866,
-0.9307823181152344,
0.6746739745140076,... |
func Parse(b []byte) (Message, error) {
var g Message
switch b[1] {
case MsgTypeEchoRequest:
g = &EchoRequest{}
case MsgTypeEchoResponse:
g = &EchoResponse{}
/* XXX - Implement!
case MsgTypeVersionNotSupported:
g = &VerNotSupported{}
case MsgTypeNodeAliveRequest:
g = &NodeAliveReq{}
case MsgTypeNodeAli... | [
0.10304093360900879,
-0.09419761598110199,
0.8611118793487549,
0.18296898901462555,
0.31135404109954834,
0.08291494846343994,
0.4667809307575226,
-1.1485122442245483,
0.4863918125629425,
-0.46629759669303894,
0.2453652322292328,
-0.10122085362672806,
-0.928119421005249,
0.6884496212005615,... |
func Decapsulate(b []byte) ([]byte, error) {
header, err := ParseHeader(b)
if err != nil {
return nil, err
}
if header.Type != MsgTypeTPDU {
return nil, nil
}
return header.Payload, nil
} | [
-0.34518271684646606,
1.1312754154205322,
0.8823967576026917,
-0.5553459525108337,
-0.5466050505638123,
-0.9956709146499634,
-0.7287318110466003,
-0.5755714774131775,
-0.08077870309352875,
0.21709610521793365,
0.024229232221841812,
-0.48060253262519836,
-1.0610123872756958,
0.4173754751682... |
func parseCount(s string) int {
var n int64 = 1
var err error
if len(s) > 0 {
n, err = strconv.ParseInt(s, 10, 32)
if err != nil {
panic("could not parse action multiplier")
}
}
return int(n)
} | [
0.36357825994491577,
0.4034517705440521,
0.6907745003700256,
0.4118441343307495,
-0.5922344326972961,
-0.6113349795341492,
0.7757787704467773,
0.4108484983444214,
-0.3963031768798828,
0.13272416591644287,
0.06595908850431442,
-0.6105121970176697,
-0.0946662500500679,
0.5467658638954163,
... |
func NewContourHTTPProxyMutator(c client.Client, dec *admission.Decoder, defaultClass string) http.Handler {
return &webhook.Admission{Handler: &contourHTTPProxyMutator{c, dec, defaultClass}}
} | [
-0.4002216160297394,
-0.37044864892959595,
0.2705383896827698,
-0.06215065345168114,
-1.4562804698944092,
0.2730165421962738,
0.27856141328811646,
0.7182355523109436,
0.038181234151124954,
-0.038219135254621506,
-0.7485567927360535,
-0.0919317752122879,
-0.3579263985157013,
0.7602291107177... |
func (asc *AsenaSmartContract) Create(ctx contractapi.TransactionContextInterface, key string, value string) error {
fmt.Println("Create: called with key:", key, "and value:", value)
err := ctx.GetStub().PutState(key, []byte(value))
if err != nil {
return fmt.Errorf("Failed to write to world state. %s", err.Erro... | [
-0.250880628824234,
0.7078208923339844,
0.5493478178977966,
0.20171603560447693,
-0.19756582379341125,
0.23476390540599823,
-0.6410561800003052,
-0.5753845572471619,
-0.43269914388656616,
1.0664658546447754,
0.03299439698457718,
-0.6608574390411377,
-0.3039572238922119,
0.267311692237854,
... |
func (asc *AsenaSmartContract) Read(ctx contractapi.TransactionContextInterface, key string) (ResultAsBytes []byte, err error) {
fmt.Println("GetState: called with key:", key)
ResultAsBytes, err = ctx.GetStub().GetState(key)
if err != nil {
return nil, fmt.Errorf("Failed to read from world state. %s", err.Error(... | [
-0.791286289691925,
0.43090561032295227,
0.608906626701355,
-0.13920797407627106,
-1.004016637802124,
-0.26595982909202576,
-0.24222756922245026,
-1.0039186477661133,
0.4618580937385559,
0.7135528326034546,
0.6236311197280884,
0.1669059842824936,
-0.9211386442184448,
0.16994360089302063,
... |
func (asc *AsenaSmartContract) Update(ctx contractapi.TransactionContextInterface, key string, value string) error {
fmt.Println("update: called with key:", key, "and value:", value)
ResultAsBytes, err := ctx.GetStub().GetState(key)
if err != nil {
return fmt.Errorf("Failed to read from world state. %s", err.Err... | [
-0.7456685900688171,
-0.06898299604654312,
0.4910396337509155,
-0.215845987200737,
-1.0237364768981934,
-0.2523765563964844,
-0.49131056666374207,
-0.5380065441131592,
0.13202756643295288,
1.2865245342254639,
0.1257334053516388,
-0.16728617250919342,
-0.594157338142395,
-0.177776038646698,... |
func (asc *AsenaSmartContract) Delete(ctx contractapi.TransactionContextInterface, key string) error {
fmt.Println("Delete: called with key:", key)
err := ctx.GetStub().DelState(key)
if err != nil {
return fmt.Errorf("Failed to del from world state. %s", err.Error())
}
return nil
} | [
0.2220732867717743,
0.6841298937797546,
0.6101943254470825,
0.2907525599002838,
-0.43317538499832153,
0.05328403040766716,
-0.22554612159729004,
-0.06292285770177841,
0.8087170720100403,
1.4290379285812378,
0.42228373885154724,
-0.12964032590389252,
-0.6272231340408325,
0.1711246520280838,... |
func (asc *AsenaSmartContract) InitLedger(ctx contractapi.TransactionContextInterface, args []string) error {
type FirstData struct {
Key string `json:"Key"`
Value string `json:"Value"`
}
List := []FirstData{
{Key: "AsenaSmartContract.Status", Value: "initialized"},
{Key: "AsenaSmartContract.Version", Va... | [
-1.140770435333252,
-0.040994320064783096,
0.6311203241348267,
-0.5984116792678833,
0.12720929086208344,
-0.08061065524816513,
-0.6386862993240356,
0.8220528364181519,
0.12480151653289795,
0.7372166514396667,
-0.6632633209228516,
-0.06425071507692337,
0.3480455279350281,
1.9950923919677734... |
func (asc *AsenaSmartContract) QueryAllCars(ctx contractapi.TransactionContextInterface, args []string) error {
return nil
} | [
-0.1744513064622879,
-0.12973187863826752,
0.4986688196659088,
0.10731054842472076,
-0.4277700185775757,
-0.7562771439552307,
-1.2591694593429565,
-0.5124261975288391,
0.5923404693603516,
-0.5796238780021667,
0.5968436598777771,
0.11413964629173279,
-0.6952619552612305,
0.7186527252197266,... |
func Delete(c messagebird.Client, id string) error {
return c.Request(nil, http.MethodDelete, path+"/"+id, nil)
} | [
0.6328520178794861,
0.7093057036399841,
0.42156270146369934,
0.1710561215877533,
0.9347982406616211,
0.3283487558364868,
-0.5344629883766174,
-0.6429324150085449,
-0.1075860932469368,
-0.022585319355130196,
-0.21142517030239105,
1.1928194761276245,
-1.8002548217773438,
0.5444613099098206,
... |
func List(c messagebird.Client, options *messagebird.PaginationRequest) (*Groups, error) {
groupList := &Groups{}
if err := c.Request(groupList, http.MethodGet, path+"?"+options.QueryParams(), nil); err != nil {
return nil, err
}
return groupList, nil
} | [
-0.5447169542312622,
0.21990303695201874,
0.3082068860530853,
-0.030932258814573288,
1.1829639673233032,
-0.6010447144508362,
0.11542801558971405,
-0.702769935131073,
-0.4444931745529175,
0.07979485392570496,
0.01734870672225952,
0.5790736079216003,
-0.9960244297981262,
0.6948070526123047,... |
func Read(c messagebird.Client, id string) (*Group, error) {
group := &Group{}
if err := c.Request(group, http.MethodGet, path+"/"+id, nil); err != nil {
return nil, err
}
return group, nil
} | [
-0.5849812030792236,
0.5227174162864685,
0.5298944115638733,
-0.6288158297538757,
-0.32914626598358154,
-0.11955063045024872,
-0.4343568980693817,
-1.3092786073684692,
-0.6456733345985413,
-0.5071287155151367,
0.7768946290016174,
1.538071632385254,
-1.5685278177261353,
-0.04686310514807701... |
func Update(c messagebird.Client, id string, request *Request) error {
if err := validateUpdate(request); err != nil {
return err
}
return c.Request(nil, http.MethodPatch, path+"/"+id, request)
} | [
-0.8907700181007385,
-0.3808504343032837,
0.30919012427330017,
0.058304816484451294,
-0.32723385095596313,
0.5034947395324707,
-0.38582658767700195,
-0.5227265954017639,
0.37539011240005493,
-0.11042261123657227,
0.10504499822854996,
0.7910734415054321,
-1.3300199508666992,
0.2163768410682... |
func AddContacts(c messagebird.Client, groupID string, contactIDs []string) error {
if err := validateAddContacts(contactIDs); err != nil {
return err
}
data := addContactsData(contactIDs)
return c.Request(nil, http.MethodPut, path+"/"+groupID+"/"+contactPath, data)
} | [
-1.4742412567138672,
-0.06695210188627243,
0.36360999941825867,
0.3554076552391052,
0.5443168878555298,
0.2674955725669861,
0.33213841915130615,
-1.1683392524719238,
-0.07193563133478165,
-0.302396684885025,
0.6256086826324463,
-0.3367902338504791,
-1.6864269971847534,
0.8761594891548157,
... |
func addContactsData(contactIDs []string) string {
params := make([]string, 0, len(contactIDs))
for _, contactID := range contactIDs {
params = append(params, "ids[]="+contactID)
}
return strings.Join(params, "&")
} | [
-0.9227839708328247,
-0.6903972029685974,
0.3906170427799225,
-1.00396728515625,
0.053165942430496216,
1.0369631052017212,
-0.8135209083557129,
-0.5769419074058533,
0.42605820298194885,
-0.13007812201976776,
1.0255335569381714,
0.22570013999938965,
-0.3950141668319702,
0.6783822178840637,
... |
func ListContacts(c messagebird.Client, groupID string, options *messagebird.PaginationRequest) (*contact.Contacts, error) {
formattedPath := fmt.Sprintf("%s/%s/%s?%s", path, groupID, contactPath, options.QueryParams())
contacts := &contact.Contacts{}
if err := c.Request(contacts, http.MethodGet, formattedPath, nil... | [
-0.8249609470367432,
-0.818588376045227,
0.666690468788147,
-0.06201129034161568,
0.48383671045303345,
-1.078359603881836,
0.05158756300806999,
-1.53560209274292,
0.2305006980895996,
0.042805593460798264,
0.3845495283603668,
0.2475067377090454,
-1.1679346561431885,
0.5721322298049927,
-1... |
func RemoveContact(c messagebird.Client, groupID, contactID string) error {
formattedPath := fmt.Sprintf("%s/%s/contacts/%s", path, groupID, contactID)
return c.Request(nil, http.MethodDelete, formattedPath, nil)
} | [
-0.438221275806427,
-0.4065692722797394,
0.43879932165145874,
0.12480779737234116,
-0.09179028868675232,
-0.7759448885917664,
0.20003315806388855,
-0.43423280119895935,
-0.3463026285171509,
0.8046197891235352,
0.43801620602607727,
0.35447490215301514,
-1.4508534669876099,
0.301772326231002... |
func getRequestedResources(container corev1.Container) (map[string]int64, error) {
for _, v := range container.Env {
if strings.HasPrefix(v.Name, "FPGA_REGION") || strings.HasPrefix(v.Name, "FPGA_AFU") {
return nil, errors.Errorf("environment variable '%s' is not allowed", v.Name)
}
}
// Container may happen... | [
-0.1380152702331543,
-0.40937671065330505,
0.7840192317962646,
-0.5872233510017395,
-0.33906713128089905,
-0.6459910869598389,
0.021057389676570892,
-1.1096490621566772,
0.05039816349744797,
-0.059138793498277664,
0.34597331285476685,
0.3386080861091614,
-0.23656107485294342,
0.59980773925... |
func (b *picnicBasket) happy() bool {
return b.nServings > 1 && b.corkscrew
} | [
-0.4213806390762329,
0.625076174736023,
0.33819064497947693,
0.7595985531806946,
0.2972336411476135,
0.7742319107055664,
-1.1812658309936523,
-0.04937232658267021,
-0.10227173566818237,
0.1013830378651619,
-0.8720914721488953,
-0.015671707689762115,
0.16418848931789398,
0.5959933996200562,... |
func main() {
var pb picnicBasket // create on stack (probably)
pbl := picnicBasket{} // equivalent to above
pbp := &picnicBasket{} // create on heap. pbp is pointer to object.
pbn := new(picnicBasket) // equivalent to above
forTwo := newPicnicBasket(2) // using constructor
// equivalen... | [
0.3824908435344696,
-0.3415067195892334,
0.7250387072563171,
0.6822465062141418,
0.1433674842119217,
0.30408114194869995,
0.06137054041028023,
-0.8200320601463318,
-0.5735015273094177,
-0.20564556121826172,
-1.1671737432479858,
-0.03707180544734001,
0.6009840965270996,
0.07618850469589233,... |
func LookupMaintenanceConfiguration(ctx *pulumi.Context, args *LookupMaintenanceConfigurationArgs, opts ...pulumi.InvokeOption) (*LookupMaintenanceConfigurationResult, error) {
var rv LookupMaintenanceConfigurationResult
err := ctx.Invoke("azure-native:maintenance/v20180601preview:getMaintenanceConfiguration", args, ... | [
-0.3614495098590851,
-0.17716597020626068,
0.8162230253219604,
-0.3069734573364258,
-0.7305099368095398,
0.04854891076683998,
-0.1716620922088623,
0.1705450564622879,
0.9324110150337219,
-0.15055109560489655,
0.5665987133979797,
0.7251414656639099,
-0.224308043718338,
-0.3873906433582306,
... |
func GetTask(id bson.ObjectId) (*Task, error) {
task := Task{}
err := sess.DB("").C(taskC).FindId(id).One(&task)
if err != nil {
return nil, err
}
return &task, nil
} | [
-0.03254632651805878,
1.022916555404663,
0.3448645770549774,
0.9722943305969238,
0.6526594758033752,
0.03595324978232384,
0.763828694820404,
-0.6741155982017517,
0.6983314752578735,
0.5607774257659912,
-0.8064818978309631,
0.37326422333717346,
-0.1413312405347824,
-0.0874808207154274,
0.... |
func ListTasks() ([]Task, error) {
tasks := []Task{}
err := sess.DB("").C(taskC).Find(nil).All(&tasks)
if err != nil {
return nil, err
}
return tasks, nil
} | [
0.6801759004592896,
-0.17005673050880432,
0.29516252875328064,
0.7638252973556519,
0.9552631378173828,
0.5158604383468628,
0.006838085129857063,
-0.36544322967529297,
0.48975256085395813,
0.225836843252182,
-0.5234198570251465,
0.3874782919883728,
-0.5321824550628662,
0.9278907179832458,
... |
func ListTasksByAccountID(id bson.ObjectId) ([]Task, error) {
tasks := []Task{}
err := sess.DB("").C(taskC).Find(bson.M{"account_id": id}).All(&tasks)
if err != nil {
return nil, err
}
return tasks, nil
} | [
1.080849289894104,
-0.06538023054599762,
0.47858700156211853,
0.5624364614486694,
0.9445680379867554,
-0.00990736111998558,
1.0520561933517456,
-0.604153037071228,
1.3663387298583984,
1.0804228782653809,
-0.4547322690486908,
0.8625248670578003,
0.22376927733421326,
0.9880847930908203,
-1... |
func (t *Task) Put() error {
t.ModifiedAt = time.Now()
if t.ID == "" {
t.CreatedAt = t.ModifiedAt
t.ID = bson.NewObjectId()
}
_, err := sess.DB("").C(taskC).UpsertId(t.ID, t)
return err
} | [
-0.9589542746543884,
0.4918260872364044,
0.7342599630355835,
-0.3644164800643921,
0.3550575077533722,
0.8898023962974548,
0.9358134865760803,
0.36688652634620667,
-0.9924275279045105,
0.7870104312896729,
-1.2070802450180054,
-0.23492684960365295,
-0.4493851065635681,
0.21711412072181702,
... |
func (t *Task) Remove() error {
err := sess.DB("").C(taskC).RemoveId(t.ID)
return err
} | [
-0.379618376493454,
0.38820475339889526,
0.18473562598228455,
0.29329636693000793,
-0.06919541954994202,
0.2492455095052719,
0.5436514019966125,
0.9233642220497131,
-0.5766305923461914,
0.8281044960021973,
-0.8851590156555176,
-0.38690051436424255,
-0.2818678617477417,
0.49432364106178284,... |
func New() *asyncPipeRdr {
var instance asyncPipeRdr
instance.channel = make(chan string)
instance.rtnStop = routinestop.New()
return &instance
} | [
-1.0530390739440918,
-0.0041983346454799175,
0.2638736367225647,
-1.4987564086914062,
-0.5816760063171387,
-0.3105752766132355,
-0.35136622190475464,
-0.11576607078313828,
-0.012526120990514755,
0.7469099164009094,
0.3839789032936096,
-0.2691088616847992,
-0.8734479546546936,
-0.1457688659... |
func ParseDefinition(b []byte) (*Definition, error) {
parsed := ordered.NewMap[string, any](0)
if err := yaml.Unmarshal(b, parsed); err != nil {
return nil, err
}
// Marshal the whole lot back into json which will let the jsonschema library
// parse the schema into and object tree 💃🏼
remarshaled, err := json... | [
0.4697857201099396,
-0.6593753695487976,
0.5400272011756897,
0.07699878513813019,
-0.06374099850654602,
-1.1573395729064941,
-0.32439300417900085,
0.6644296050071716,
0.8382800221443176,
-0.31757089495658875,
-1.256271243095398,
0.5238190293312073,
-0.1101268082857132,
0.7399062514305115,
... |
func LoadDefinitionFromDir(dir string) (*Definition, error) {
f, err := findDefinitionFile(dir)
if err != nil {
return nil, err
}
b, err := os.ReadFile(f)
if err != nil {
return nil, err
}
return ParseDefinition(b)
} | [
0.5289793610572815,
-0.04690372943878174,
0.31952667236328125,
0.37020981311798096,
-0.46783196926116943,
-0.38099077343940735,
-0.6517998576164246,
-0.5982885956764221,
-0.13484103977680206,
0.19594743847846985,
-0.5681728720664978,
0.051316168159246445,
-0.047215718775987625,
0.910075664... |
func findDefinitionFile(dir string) (string, error) {
possibleFilenames := []string{
filepath.Join(dir, "plugin.json"),
filepath.Join(dir, "plugin.yaml"),
filepath.Join(dir, "plugin.yml"),
}
for _, filename := range possibleFilenames {
if _, err := os.Stat(filename); err == nil {
return filename, nil
}
... | [
0.24158938229084015,
-0.5390611886978149,
0.678052544593811,
0.32931947708129883,
0.7210302948951721,
-0.7344653010368347,
0.6376492381095886,
0.20671790838241577,
-0.6075990200042725,
0.3497484028339386,
-0.01572646014392376,
0.029620183631777763,
0.28109073638916016,
1.4729472398757935,
... |
func (v Validator) Validate(ctx context.Context, def *Definition, config map[string]any) ValidateResult {
var result ValidateResult
configJSON, err := json.Marshal(config)
if err != nil {
result.errors = append(result.errors, err)
return result
}
commandExistsFunc := v.commandExists
if commandExistsFunc == ... | [
-0.5217621922492981,
-0.021564766764640808,
0.6543247699737549,
0.2518919110298157,
0.4126593768596649,
-0.9952996373176575,
0.09411456435918808,
-0.0023486304562538862,
-0.41978904604911804,
0.41836974024772644,
0.7057501077651978,
-0.13016003370285034,
-0.36471542716026306,
1.16990375518... |
func (vr ValidateResult) Unwrap() []error {
// Support for multi-error wrapping is expected in Go 1.20.
// https://github.com/golang/go/issues/53435#issuecomment-1191752789
return vr.errors
} | [
-0.8195048570632935,
0.2960239052772522,
0.43269720673561096,
0.08935335278511047,
-0.15985871851444244,
-0.11442950367927551,
-0.24396269023418427,
0.3534615933895111,
0.0677919015288353,
0.2593855857849121,
-0.14873038232326508,
0.23194625973701477,
0.07614149153232574,
-0.28181174397468... |
func (vr ValidateResult) Valid() bool {
return len(vr.errors) == 0
} | [
-0.31743061542510986,
-0.5702141523361206,
0.3394172489643097,
0.13194918632507324,
-0.23014512658119202,
0.41117608547210693,
-0.14029894769191742,
-0.06215885281562805,
-0.2734648585319519,
-0.8423577547073364,
-0.02068720944225788,
-0.6336233019828796,
-1.1233468055725098,
-0.5326496958... |
func commandExists(command string) bool {
_, err := exec.LookPath(command)
return err == nil
} | [
-0.36830025911331177,
-0.42112958431243896,
0.8327839970588684,
0.26647159457206726,
1.6563234329223633,
0.37976956367492676,
-0.7266861200332642,
0.5959860682487488,
0.5091174840927124,
-0.4300716817378998,
-0.20541056990623474,
0.16022053360939026,
0.33047184348106384,
0.822908341884613,... |
func ProtoToFirewallPolicyAssociation(p *alphapb.ComputeAlphaFirewallPolicyAssociation) *alpha.FirewallPolicyAssociation {
obj := &alpha.FirewallPolicyAssociation{
Name: dcl.StringOrNil(p.GetName()),
AttachmentTarget: dcl.StringOrNil(p.GetAttachmentTarget()),
FirewallPolicy: dcl.StringOrNil(p.GetFi... | [
0.2564586102962494,
-0.432456374168396,
0.2496815323829651,
-0.9182635545730591,
-0.2486908733844757,
0.29359379410743713,
0.2907252609729767,
-0.5532349348068237,
0.7746018171310425,
-0.3002592623233795,
0.1531081199645996,
0.421567440032959,
0.23446591198444366,
0.1286974996328354,
0.6... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.