query
stringlengths
7
3.85k
document
stringlengths
11
430k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
listBySubscriptionCreateRequest creates the ListBySubscription request.
func (client *DataCollectionEndpointsClient) listBySubscriptionCreateRequest(ctx context.Context, options *DataCollectionEndpointsListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *DevicesClient) listBySubscriptionCreateRequest(ctx context.Context, options *DevicesClientListBySubscriptionOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/devices\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New...
[ "0.7839764", "0.7792721", "0.777648", "0.7766895", "0.7694845", "0.7682546", "0.76752776", "0.76353943", "0.76195145", "0.7615538", "0.75823325", "0.75491273", "0.7399178", "0.73666984", "0.7287603", "0.6893647", "0.63321304", "0.6311873", "0.6288278", "0.62622976", "0.623596...
0.7618742
9
listBySubscriptionHandleResponse handles the ListBySubscription response.
func (client *DataCollectionEndpointsClient) listBySubscriptionHandleResponse(resp *http.Response) (DataCollectionEndpointsListBySubscriptionResponse, error) { result := DataCollectionEndpointsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResourceListResult); err != nil { return DataCollectionEndpointsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *RedisClient) listBySubscriptionHandleResponse(resp *http.Response) (RedisListBySubscriptionResponse, error) {\n\tresult := RedisListBySubscriptionResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.RedisListResult); err != nil {\n\t\treturn RedisListBySubscriptionResponse{}...
[ "0.83168864", "0.8227859", "0.81885844", "0.81504506", "0.81241256", "0.81087255", "0.809703", "0.8004202", "0.79758334", "0.79476243", "0.7904227", "0.771174", "0.76578695", "0.7624304", "0.7593285", "0.75220805", "0.74099624", "0.7322869", "0.73116237", "0.7243065", "0.7087...
0.82509714
1
updateCreateRequest creates the Update request.
func (client *DataCollectionEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if dataCollectionEndpointName == "" { return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Body != nil { return req, runtime.MarshalAsJSON(req, *options.Body) } return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *ServersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate, options *ServersClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql...
[ "0.71459115", "0.7138837", "0.7115914", "0.7081609", "0.69797033", "0.69454056", "0.6931128", "0.6921976", "0.691563", "0.6890736", "0.6885596", "0.6881603", "0.68747497", "0.6861223", "0.683294", "0.6830553", "0.6821185", "0.6766642", "0.67643875", "0.6764275", "0.67592096",...
0.64908904
47
updateHandleResponse handles the Update response.
func (client *DataCollectionEndpointsClient) updateHandleResponse(resp *http.Response) (DataCollectionEndpointsUpdateResponse, error) { result := DataCollectionEndpointsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResource); err != nil { return DataCollectionEndpointsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *OutputsClient) updateHandleResponse(resp *http.Response) (OutputsUpdateResponse, error) {\n\tresult := OutputsUpdateResponse{RawResponse: resp}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Output); err != nil {\n...
[ "0.80759746", "0.8007575", "0.7810742", "0.77884024", "0.777713", "0.77637255", "0.7760966", "0.77551454", "0.7722201", "0.7672641", "0.76220673", "0.7590562", "0.75634336", "0.7550017", "0.75266266", "0.74942684", "0.7493825", "0.74926215", "0.7406175", "0.74009675", "0.7392...
0.7631488
10
Push reads supporter and donation records and pushes them downstream. Note that the records are maps of strings. Downstream will convert them to useful data.
func (rt *Runtime) Push(d chan map[string]string) (err error) { t := rt.API.NewTable("supporter(supporter_KEY)donation") offset := int32(0) count := 500 c := "donation.RESULT IN 0,-1" for count == 500 { m, err := t.LeftJoinMap(offset, count, c) if err != nil { return err } for _, r := range m { d <- r } count = len(m) log.Printf("Push: read %d from offset %d\n", count, offset) offset += int32(count) } close(d) return err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Read(reader io.Reader) (rj RecordJar, err error) {\n\n\tb := bufio.NewReader(reader)\n\tr := make(Record)\n\n\tcurrentHeader := \"\"\n\tline := \"\"\n\nRECORDS:\n\tfor {\n\n\t\t// If we have a record on the go store it and allocate a new one\n\t\tif len(r) != 0 {\n\t\t\trj = append(rj, r)\n\t\t\tr = make(Reco...
[ "0.5021056", "0.48767054", "0.48742503", "0.48395205", "0.46045676", "0.4591664", "0.45517206", "0.45375064", "0.4508009", "0.44851536", "0.4476698", "0.44636384", "0.44487244", "0.44070694", "0.4406888", "0.43819577", "0.43797287", "0.43710393", "0.436893", "0.43673733", "0....
0.6187916
0
StartService Starts selenium server
func StartService() { opts := []selenium.ServiceOption{ selenium.ChromeDriver(helpers.AutomationPath + driverPath), // Specify the path to GeckoDriver in order to use Firefox. selenium.Output(os.Stderr), // Output debug information to STDERR. } selenium.SetDebug(false) selenium, err := selenium.NewSeleniumService(helpers.AutomationPath+seleniumPath, port, opts...) if err != nil { panic(err) } seleniumService = selenium }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Service) StartService() {\n\tutils.Logger().Info().Msg(\"Starting explorer service.\")\n\ts.Init(true)\n\ts.server = s.Run()\n}", "func (s *Service) StartService() {\n\tutils.Logger().Info().Msg(\"Starting explorer service.\")\n\ts.Init(true)\n\ts.server = s.Run()\n}", "func (env Env) StartService(c *...
[ "0.65938157", "0.65938157", "0.65253013", "0.63578004", "0.63578004", "0.63268375", "0.6300758", "0.6254333", "0.6249277", "0.62008077", "0.6186681", "0.61138135", "0.6103919", "0.60101557", "0.6006752", "0.5996253", "0.59815216", "0.596186", "0.5913349", "0.5891949", "0.5875...
0.79222965
0
StopService stops selenium server
func StopService() { seleniumService.Stop() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func StopService() {\n\tserver.Stop()\n}", "func (n *Node) StopService() {\n\tif n.stopServer == nil {\n\t\treturn\n\t}\n\tn.stopServer()\n\tn.stopServer = nil\n}", "func (s *Service) StopService() {\n\tutils.Logger().Info().Msg(\"Shutting down explorer service.\")\n\tif err := s.server.Shutdown(context.Backgr...
[ "0.70196897", "0.6680899", "0.66318434", "0.66318434", "0.66209775", "0.64933527", "0.6451682", "0.6430011", "0.6388342", "0.6388342", "0.6270665", "0.6192106", "0.61838084", "0.6182933", "0.61214626", "0.6117665", "0.60970193", "0.6061633", "0.60576785", "0.60330755", "0.603...
0.8379308
0
NewDriver create new browser driver
func NewDriver(browser string) selenium.WebDriver { StartService() caps := selenium.Capabilities{"browserName": browser} switch browser { case "chrome": chrCaps := chrome.Capabilities{ Args: []string{ "--no-sandbox", }, W3C: true, } if headless { chrCaps.Args = append(chrCaps.Args, "--headless") } caps.AddChrome(chrCaps) case "htmlunit": caps["javascriptEnabled"] = true } wd, err := selenium.NewRemote(caps, fmt.Sprintf("http://localhost:%d/wd/hub", port)) if err != nil { } driver = wd return wd }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewDriver() godfish.Driver { return &driver{} }", "func newDriver() *driver {\n\treturn &driver{\n\t\tnetworks: map[string]*bridgeNetwork{},\n\t\tportAllocator: portallocator.Get(),\n\t}\n}", "func RegisterNewDriver(driver string, defaultscopes []string, callback func(client *http.Client, u *models.U...
[ "0.678176", "0.6750688", "0.6364941", "0.62132597", "0.6142062", "0.61376053", "0.6127721", "0.6018265", "0.60131764", "0.5968937", "0.59261644", "0.592092", "0.5875122", "0.5862739", "0.58357203", "0.5813662", "0.580961", "0.58073485", "0.5793834", "0.57759947", "0.5756461",...
0.73467785
0
Address will create a new Address service that can interact with the Swyftx addresses endpoints The asset code is required for the Deposit, Withdraw and CheckDeposit endpoints
func (c *Client) Address(assetCode ...string) *AddressService { if len(assetCode) == 0 { assetCode[0] = "" } return &AddressService{service{c}, assetCode[0]} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (as *AddressService) Create(name string) (*Address, error) {\n\tif isEmptyStr(as.assetCode) {\n\t\treturn nil, errAssetCode\n\t}\n\n\tvar (\n\t\taddresses []*Address\n\t\tbody struct {\n\t\t\tAddress struct {\n\t\t\t\tName string `json:\"name\"`\n\t\t\t} `json:\"address\"`\n\t\t}\n\t)\n\tbody.Address.Nam...
[ "0.78183013", "0.7629378", "0.679397", "0.67914236", "0.66517043", "0.6582681", "0.64559764", "0.6390346", "0.6336294", "0.62283635", "0.62227005", "0.62106955", "0.62054926", "0.61936045", "0.6162253", "0.61483634", "0.61028504", "0.60747445", "0.6063984", "0.60360086", "0.6...
0.79032356
0
Create will create a new address for a specific asset and return the newly created address
func (as *AddressService) Create(name string) (*Address, error) { if isEmptyStr(as.assetCode) { return nil, errAssetCode } var ( addresses []*Address body struct { Address struct { Name string `json:"name"` } `json:"address"` } ) body.Address.Name = name if err := as.client.Post(buildString("address/deposit/", as.assetCode), &body, &addresses); err != nil { return nil, err } return addresses[0], nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (handler *Handler) CreateAddress(ctx context.Context, in *candyland_grpc.CreateAddressRequest) (*candyland_grpc.CreateAddressReply, error) {\n\terr := handler.CreateAddressUsecase.Create(in.UserId, in.CountryId, in.StateId, in.CityId, in.StreetId, in.Number, in.Complement.String())\n\n\tif err != nil {\n\t\tl...
[ "0.660583", "0.65768284", "0.655611", "0.6459867", "0.6374091", "0.6367556", "0.6301462", "0.62489724", "0.62117654", "0.6106471", "0.60594046", "0.6023272", "0.60168755", "0.60069805", "0.5987559", "0.5911845", "0.5869427", "0.5815969", "0.5815888", "0.57545626", "0.57401866...
0.81269246
0
GetActive will get all active addresses for an asset
func (as *AddressService) GetActive() ([]*Address, error) { return as.getAddresses("deposit") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *AccountsListCall) Active(active bool) *AccountsListCall {\n\tc.urlParams_.Set(\"active\", fmt.Sprint(active))\n\treturn c\n}", "func (w *Wallet) activeData(dbtx walletdb.ReadTx) ([]btcutil.Address, []wtxmgr.Credit, er.R) {\n\taddrmgrNs := dbtx.ReadBucket(waddrmgrNamespaceKey)\n\ttxmgrNs := dbtx.ReadBuck...
[ "0.595874", "0.5908878", "0.5823863", "0.57964134", "0.57462436", "0.56345075", "0.5600323", "0.54584813", "0.5417571", "0.5400139", "0.5300115", "0.5276993", "0.52485746", "0.5168865", "0.51660424", "0.5158932", "0.513461", "0.51050174", "0.510044", "0.50979775", "0.5083802"...
0.7209901
0
GetSaved will get all saved addresses for an asset
func (as *AddressService) GetSaved() ([]*Address, error) { return as.getAddresses("withdraw") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetSavedSitemaps() []string {\n\treturn savedSitemaps\n}", "func (ws *Wallets) GetAddresses() []string {\n\tvar addresses []string\n\n\tfor address := range ws.Wallets {\n\t\taddresses = append(addresses, address)\n\t}\n\n\treturn addresses\n}", "func (svc *inmemService) GetAddresses(ctx context.Context, ...
[ "0.58940905", "0.5235095", "0.5105615", "0.5036253", "0.49775848", "0.49759227", "0.49557313", "0.4901856", "0.486662", "0.4844012", "0.4823038", "0.48178643", "0.4812065", "0.48031896", "0.4785494", "0.4763713", "0.47625273", "0.4760581", "0.47561753", "0.47330952", "0.46947...
0.7589577
0
Remove will remove a withdrawal adddress given the id of the address
func (as *AddressService) Remove(addressID int) error { if err := as.client.Delete(buildString("address/withdraw/", strconv.Itoa(addressID))); err != nil { return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *wsClientFilter) removeAddress(a btcutil.Address) {\n\tswitch a := a.(type) {\n\tcase *btcutil.AddressPubKeyHash:\n\t\tdelete(f.pubKeyHashes, *a.Hash160())\n\t\treturn\n\tcase *btcutil.AddressScriptHash:\n\t\tdelete(f.scriptHashes, *a.Hash160())\n\t\treturn\n\tcase *btcutil.AddressPubKey:\n\t\tserializedPu...
[ "0.55589956", "0.5514438", "0.54790044", "0.54399794", "0.5416836", "0.5332153", "0.5321886", "0.53084344", "0.5301175", "0.52927023", "0.52401966", "0.52376306", "0.52170765", "0.5206461", "0.5174361", "0.5145053", "0.5140159", "0.51046467", "0.50969785", "0.5090812", "0.508...
0.7032371
0
VerifyWithdrawal will verify a withdrawal given the verification token
func (as *AddressService) VerifyWithdrawal(token string) error { if err := as.client.Get(buildString("address/withdraw/verify/", token), nil); err != nil { return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (_Token *TokenSession) ExecuteWithdrawal() (*types.Transaction, error) {\n\treturn _Token.Contract.ExecuteWithdrawal(&_Token.TransactOpts)\n}", "func (_Token *TokenTransactorSession) ExecuteWithdrawal() (*types.Transaction, error) {\n\treturn _Token.Contract.ExecuteWithdrawal(&_Token.TransactOpts)\n}", "f...
[ "0.6124915", "0.60527366", "0.59476393", "0.5926781", "0.5890346", "0.5857869", "0.58281296", "0.57886124", "0.578397", "0.57604176", "0.5714432", "0.5687001", "0.56778246", "0.56577224", "0.5635493", "0.56080854", "0.559661", "0.55527294", "0.5551587", "0.5543905", "0.553939...
0.7984501
0
VerifyBSB will verify a BSB number and send back the current status of that BSB
func (as *AddressService) VerifyBSB(bsb string) (*BSBStatus, error) { var bsbStatus BSBStatus if err := as.client.Get(buildString("address/withdraw/bsb-verify/", bsb), &bsbStatus); err != nil { return nil, err } return &bsbStatus, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (api *API) fBVerificationExists(token string) (fbid uint64, err error) {\n\ts, err := api.sc.Prepare(\"SELECT fb_id FROM facebook_verification WHERE token = ?\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = s.QueryRow(token).Scan(&fbid)\n\tif err == sql.ErrNoRows {\n\t\terr = NoSuchVerificationToken\n\t}\n\tr...
[ "0.54125434", "0.54113877", "0.535207", "0.532243", "0.52799875", "0.52168584", "0.52088404", "0.5178279", "0.5171409", "0.5150322", "0.5136394", "0.51195115", "0.5100915", "0.5069178", "0.5030368", "0.50266194", "0.50152457", "0.50060326", "0.49994752", "0.49660742", "0.4942...
0.73651963
0
CheckDeposit check a deposit for an address given the address id
func (as *AddressService) CheckDeposit(addressID int) error { if isEmptyStr(as.assetCode) { return errAssetCode } if err := as.client.Get(buildString("address/check/", as.assetCode, "/", strconv.Itoa(addressID)), nil); err != nil { return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (k *Keeper) GetDeposit(ctx sdk.Context, address sdk.AccAddress) (deposit types.Deposit, found bool) {\n\tstore := k.Store(ctx)\n\n\tkey := types.DepositKey(address)\n\tvalue := store.Get(key)\n\tif value == nil {\n\t\treturn deposit, false\n\t}\n\n\tk.cdc.MustUnmarshalBinaryBare(value, &deposit)\n\treturn dep...
[ "0.5865928", "0.5765526", "0.5755803", "0.5730663", "0.57218504", "0.57081556", "0.57029444", "0.56777817", "0.5657796", "0.56503814", "0.55861264", "0.5580167", "0.5546772", "0.551311", "0.55073225", "0.54944414", "0.54910946", "0.54830885", "0.5471482", "0.54598916", "0.545...
0.8275546
0
Deprecated: Use Type.Descriptor instead.
func (Type) EnumDescriptor() ([]byte, []int) { return file_price_price_proto_rawDescGZIP(), []int{0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetTypeDescriptor(typeName string) (protoreflect.Descriptor, error) {\n\treturn dm.GetTypeDescriptor(typeName)\n}", "func (*TypeInformation) Descriptor() ([]byte, []int) {\n\treturn file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{3}\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file...
[ "0.6832599", "0.6623278", "0.6592824", "0.61390984", "0.6112982", "0.6104237", "0.60554916", "0.6050091", "0.6049072", "0.6022466", "0.60134995", "0.60118586", "0.59987587", "0.59904647", "0.59875125", "0.59790707", "0.5977629", "0.59523624", "0.5936686", "0.5931284", "0.5929...
0.5776995
54
Deprecated: Use Price.ProtoReflect.Descriptor instead.
func (*Price) Descriptor() ([]byte, []int) { return file_price_price_proto_rawDescGZIP(), []int{0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Price) Descriptor() ([]byte, []int) {\n\treturn file_proto_supply_proto_rawDescGZIP(), []int{0}\n}", "func (*PriceInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_retail_v2_common_proto_rawDescGZIP(), []int{6}\n}", "func (*PricingPodPriceRequest) Descriptor() ([]byte, []int) {\n\treturn ...
[ "0.7140815", "0.69504553", "0.6876126", "0.6736322", "0.6634963", "0.6624022", "0.65697724", "0.6557077", "0.6546061", "0.6503353", "0.64754117", "0.64043206", "0.6386197", "0.63846004", "0.63826203", "0.63817465", "0.63527876", "0.63320667", "0.6331542", "0.63248783", "0.630...
0.723794
0
Deprecated: Use SearchParams.ProtoReflect.Descriptor instead.
func (*SearchParams) Descriptor() ([]byte, []int) { return file_price_price_proto_rawDescGZIP(), []int{1} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*GetSearchRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{112}\n}", "func (*ConversationSearchRequest) Descriptor() ([]byte, []int) {\n\treturn file_box_search_proto_rawDescGZIP(), []int{14}\n}", "func (*ConversationRelatedSearchRequest) Descri...
[ "0.6757402", "0.66963845", "0.667019", "0.6669961", "0.6665845", "0.66342306", "0.66099745", "0.6583955", "0.658169", "0.657634", "0.6543787", "0.6539887", "0.6536683", "0.6519112", "0.6497361", "0.6452814", "0.6445318", "0.64435625", "0.64422023", "0.6427908", "0.64192164", ...
0.61617607
85
NewInt returns a new integer value.
func NewInt(i int64) T { return big.NewInt(i) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewInt(x int64) *Int {}", "func NewInt(i int) Int { return &i }", "func NewInt(input int) *int {\n\treturn &input\n}", "func NewInt(value int) *Int {\n\treturn &Int{\n\t\tvalue: value,\n\t}\n}", "func NewInt() *Int {\n\treturn &Int{}\n}", "func NewInt(x int64) *big.Int", "func NewInt(i int64) *Val...
[ "0.85864913", "0.8524492", "0.8404486", "0.8297176", "0.8228805", "0.81092215", "0.80563784", "0.80309343", "0.80285656", "0.7866015", "0.7390446", "0.737557", "0.73207617", "0.72236663", "0.71351486", "0.7033165", "0.6993391", "0.6844066", "0.67741734", "0.6760597", "0.66253...
0.7451826
10
NewFloat returns a new floating point value.
func NewFloat(f float64) T { return big.NewFloat(f) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewFloat(x float64) *Float {}", "func NewFloat(x float64) *Float { return new(Float).SetFloat64(x) }", "func NewFloat(v float64) Float {\n\treturn Float{v, true}\n}", "func NewFloat(f float64) *Value {\n\treturn &Value{f, Float}\n}", "func NewFloat(x float64) *big.Float", "func (tp Float) NewFloat(d...
[ "0.8411921", "0.83798766", "0.8243816", "0.81184137", "0.80630434", "0.8013916", "0.77668375", "0.7746606", "0.74970555", "0.7403216", "0.7179319", "0.71489006", "0.6873199", "0.6873199", "0.6780973", "0.6665791", "0.6455097", "0.6424199", "0.636417", "0.6320907", "0.6287495"...
0.74249166
9
Lookup looks up the provided key in map m. The caller must provide the key's digest which is used as a hash.
func (m Map) Lookup(d digest.Digest, key T) T { if _, ok := m.tab[d]; !ok { return nil } entry := *m.tab[d] for entry != nil && Less(entry.Key, key) { entry = entry.Next } if entry == nil || !Equal(entry.Key, key) { return nil } return entry.Value }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *HashRing) Lookup(key string) (string, bool) {\n\tstrs := r.LookupN(key, 1)\n\tif len(strs) == 0 {\n\t\treturn \"\", false\n\t}\n\treturn strs[0], true\n}", "func Get(m Map, key Key) (val Value, ok bool) {\n\thash := key.Hash()\n\tval, ok = m.find(0, hash, key)\n\treturn val, ok\n}", "func (kvStore *KV...
[ "0.61509585", "0.61406755", "0.6085308", "0.58752364", "0.581275", "0.5706347", "0.56950957", "0.56889385", "0.56715703", "0.56559145", "0.5624322", "0.5610662", "0.55261457", "0.5507308", "0.54677755", "0.54677755", "0.546431", "0.54311925", "0.5379146", "0.53141755", "0.529...
0.660354
0
Insert inserts the provided keyvalue pair into the map, overriding any previous definiton of the key. The caller must provide the digest which is used as a hash.
func (m *Map) Insert(d digest.Digest, key, value T) { if m.tab[d] == nil { entry := &mapEntry{Key: key, Value: value} if m.tab == nil { m.tab = make(map[digest.Digest]**mapEntry) } m.n++ m.tab[d] = &entry return } entryp := m.tab[d] for *entryp != nil && Less((*entryp).Key, key) { entryp = &(*entryp).Next } if *entryp == nil || !Equal((*entryp).Key, key) { *entryp = &mapEntry{Key: key, Value: value, Next: *entryp} m.n++ } else { (*entryp).Value = value } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *chaining) Insert(key string, val interface{}) {\n\tif t.loadFactor() > t.maxLoad {\n\t\tt.tableDouble()\n\t}\n\thash := t.hash(key)\n\tif t.values[hash] == nil {\n\t\tt.values[hash] = list.New()\n\t}\n\tt.values[hash].Insert(&pair{key, val})\n\tt.len++\n}", "func (t *Table) Insert(key, value string) {\n...
[ "0.6494451", "0.6408475", "0.6405259", "0.6405259", "0.6362644", "0.63473076", "0.63400483", "0.63359815", "0.62914497", "0.6288232", "0.6270945", "0.6207122", "0.6206332", "0.6141829", "0.61015224", "0.60288703", "0.60228056", "0.5992405", "0.59852684", "0.59811723", "0.5941...
0.65731424
0
Len returns the total number of entries in the map.
func (m Map) Len() int { return m.n }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Len(m Map) int {\n\treturn m.count()\n}", "func (m Map) Len() (n int) {\n\treturn len(m)\n}", "func (m *Map) Len() int {\n\tm.store.RLock()\n\tdefer m.store.RUnlock()\n\tn := len(m.store.kv)\n\treturn n\n}", "func (t *Map) Len() int {\n\treturn t.keys.Len()\n}", "func (tt Map) Len() int {\n\treturn le...
[ "0.8701872", "0.8485359", "0.8478857", "0.8464097", "0.8455641", "0.8452391", "0.84095365", "0.83661574", "0.83578175", "0.8343607", "0.83260924", "0.83082867", "0.8297326", "0.8243439", "0.8224796", "0.8206305", "0.81053", "0.8102362", "0.807258", "0.80620295", "0.8028638", ...
0.8707754
0
Each enumerates all keyvalue pairs in map m in deterministic order. TODO(marius): we really ought to use a representation that's more amenable to such (common) operations.
func (m Map) Each(fn func(k, v T)) { digests := make([]digest.Digest, 0, len(m.tab)) for d := range m.tab { digests = append(digests, d) } sort.Slice(digests, func(i, j int) bool { return digests[i].Less(digests[j]) }) for _, d := range digests { for entry := *m.tab[d]; entry != nil; entry = entry.Next { fn(entry.Key, entry.Value) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func iterateMap() {\n\tnames := map[string]string{\n\t\t\"Kakashi\": \"Hatake\",\n\t\t\"Konohamaru\": \"Sarutobi\",\n\t\t\"Iruka\": \"Umino\",\n\t}\n\tfor k, v := range names {\n\t\tfmt.Println(k, v)\n\t}\n}", "func (m *OrderedMap) Map() map[string][]string {\n\tmapOut := map[string][]string{}\n\tfor _, ...
[ "0.6208769", "0.5858773", "0.5858397", "0.5811261", "0.5794884", "0.5666476", "0.56434906", "0.56392515", "0.5638658", "0.559033", "0.5568864", "0.556023", "0.5512877", "0.55019134", "0.5491342", "0.5469261", "0.5463297", "0.5460558", "0.54502535", "0.5442066", "0.54337984", ...
0.63975227
0
MakeMap is a convenient way to construct a from a set of keyvalue pairs.
func MakeMap(kt *types.T, kvs ...T) *Map { if len(kvs)%2 != 0 { panic("uneven makemap") } m := new(Map) for i := 0; i < len(kvs); i += 2 { m.Insert(Digest(kvs[i], kt), kvs[i], kvs[i+1]) } return m }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func MakeMap(keys ...string) (m Map) {\n\tm = make(Map, len(keys))\n\tfor _, key := range keys {\n\t\tm.Set(key)\n\t}\n\n\treturn\n}", "func MakeSet(s map[interface{}]bool) (*skylark.Set, error) {\n\tset := skylark.Set{}\n\tfor k := range s {\n\t\tkey, err := ToValue(k)\n\t\tif err != nil {\n\t\t\treturn nil, er...
[ "0.77125484", "0.71437055", "0.68389386", "0.6703049", "0.66405773", "0.64570063", "0.6422006", "0.6218442", "0.6120103", "0.6069982", "0.6047246", "0.59845877", "0.5967449", "0.59444195", "0.58951205", "0.5894368", "0.5869038", "0.5853379", "0.5791264", "0.5786959", "0.57680...
0.71328926
2
Len returns the number of entries in the directory.
func (d Dir) Len() int { return len(d.contents) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d DirEntries) Len() int { return len(d) }", "func (d DirInfos) Len() int {\n\treturn len(d)\n}", "func Size() int {\n\treturn len(directory)\n}", "func (d Directory) Size() int { return binary.Size(d) }", "func (s AllDirectoryData) Len() int {\n\treturn len(s.Data)\n}", "func (e DirectoryEntry) Siz...
[ "0.8751995", "0.7923306", "0.771949", "0.7581758", "0.74930316", "0.7462367", "0.7380523", "0.72741103", "0.7082246", "0.6989405", "0.6983188", "0.6956884", "0.6956884", "0.69349474", "0.69129854", "0.69084084", "0.6898496", "0.6883263", "0.68695086", "0.6865111", "0.68371457...
0.8492832
1
Set sets the directory's entry for the provided path. Set overwrites any previous file set at path.
func (d *Dir) Set(path string, file reflow.File) { if d.contents == nil { d.contents = make(map[string]reflow.File) } d.contents[path] = file }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *IndexFile) SetPath(path string) { f.path = path }", "func (l *DirName) Set(dir string) error {\n\tif len(dir) > 0 && dir[0] == '~' {\n\t\treturn fmt.Errorf(\"log directory cannot start with '~': %s\", dir)\n\t}\n\tif len(dir) > 0 {\n\t\tabsDir, err := filepath.Abs(dir)\n\t\tif err != nil {\n\t\t\treturn...
[ "0.7188751", "0.70497656", "0.69994205", "0.69260705", "0.6846642", "0.6761991", "0.67417395", "0.6709446", "0.6564426", "0.64639956", "0.6394431", "0.6356663", "0.63492095", "0.6277019", "0.626828", "0.6263598", "0.6247245", "0.61931396", "0.61799264", "0.61762017", "0.61558...
0.8198673
0
Lookup returns the entry associated with the provided path and a boolean indicating whether the entry was found.
func (d Dir) Lookup(path string) (file reflow.File, ok bool) { file, ok = d.contents[path] return file, ok }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (registry *Registry) Lookup(handle string) *task.Task {\n\t// TODO: Refactor the interface here to explicitly add an `ok`\n\t// return value (in the style of reading a map[...]...)\n\t// to differentiate a present nil value return vs. a\n\t// not-present-at-all value.\n\tregistry.lock.RLock(...
[ "0.6632723", "0.6526417", "0.6502644", "0.6502644", "0.6448711", "0.6315723", "0.6277328", "0.6253912", "0.6245476", "0.6245476", "0.62231034", "0.6216919", "0.62092924", "0.6153425", "0.61027765", "0.6026127", "0.5986551", "0.59215796", "0.590627", "0.59048736", "0.5899805",...
0.72718596
0
Scan advances the scanner to the next entry (the first entry for a fresh scanner). It returns false when the scan stops with no more entries.
func (s *DirScanner) Scan() bool { if len(s.todo) == 0 { return false } s.path = s.todo[0] s.todo = s.todo[1:] return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *scanner) Scan() bool {\n\tok := s.Scanner.Scan()\n\tif ok {\n\t\ts.line++\n\t}\n\treturn ok\n}", "func (sc *Scanner) Scan() bool {\n\tif sc.err != nil {\n\t\treturn false\n\t}\n\tfor {\n\t\trecord, err := sc.parseRecord()\n\t\tif err != nil {\n\t\t\tsc.err = errors.Wrap(err, \"stanza: Scan\")\n\t\t\tret...
[ "0.75100935", "0.73737305", "0.70878965", "0.67532665", "0.6742028", "0.662504", "0.6594801", "0.6585331", "0.6568856", "0.65153414", "0.6491675", "0.64756805", "0.6306259", "0.6269406", "0.6056796", "0.60155344", "0.598887", "0.5958128", "0.5958128", "0.5942838", "0.59334344...
0.6287024
13
Path returns the path of the currently scanned entry.
func (s *DirScanner) Path() string { return s.path }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (e *entry) Path() string {\n\treturn e.path\n}", "func (fi *fileInfo) Path() string {\n\treturn fi.fullPath\n}", "func Path() string {\n\treturn c.Path\n}", "func (r *readerWithStats) Path() string {\n\treturn r.r.Path()\n}", "func (i *Instance) Path() (string, error) {\n\tref, _, _, err := i.GetAsAny...
[ "0.814329", "0.7101329", "0.6913344", "0.69013375", "0.6842367", "0.67836183", "0.673894", "0.67302", "0.6706463", "0.66323745", "0.6622492", "0.66114634", "0.6606461", "0.6588219", "0.6560654", "0.6534897", "0.65255404", "0.64959705", "0.6493998", "0.6484852", "0.6484852", ...
0.7185758
1
File returns the file of the currently scanned entry.
func (s *DirScanner) File() reflow.File { return s.contents[s.path] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m Matcher) File() File { return File{} }", "func (cfg *Configuration) File() string {\n\treturn cfg.FilePath\n}", "func (c *Config) File() string {\n\tif c == nil || c.mx == nil {\n\t\treturn \"\"\n\t}\n\n\treturn c.file\n}", "func (pos *Position) File() string {\n\treturn *pos.file\n}", "func GetFil...
[ "0.67540044", "0.67068243", "0.6687292", "0.66767365", "0.66577923", "0.66560775", "0.66108453", "0.65874934", "0.65597", "0.65354407", "0.6456274", "0.64512724", "0.641237", "0.64050615", "0.63878703", "0.63815755", "0.6373724", "0.6353302", "0.6353302", "0.63308656", "0.632...
0.7276619
0
Equal compares the file names and digests in the directory.
func (d Dir) Equal(e Dir) bool { if d.Len() != e.Len() { return false } for lk, lv := range d.contents { if rv, ok := e.contents[lk]; !ok || !rv.Equal(lv) { return false } } return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func EqualFiles(a, b string) (bool, error) {\n\tam, as, err := sha256sum(a)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"could not hash %s: %w\", a, err)\n\t}\n\tbm, bs, err := sha256sum(b)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"could not hash %s: %w\", b, err)\n\t}\n\treturn as == bs && am == bm...
[ "0.6744939", "0.6428002", "0.61854255", "0.6098924", "0.60972404", "0.59272534", "0.59265554", "0.5844345", "0.58044773", "0.578544", "0.5746756", "0.57349694", "0.5720256", "0.56391513", "0.56384194", "0.56288624", "0.5608989", "0.55871016", "0.55184263", "0.55086523", "0.55...
0.6108174
3
Equal tells whether values v and w are structurally equal.
func Equal(v, w T) bool { switch v := v.(type) { case reflow.File: l, r := v, w.(reflow.File) return l.Equal(r) default: } return reflect.DeepEqual(v, w) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (v Value) Equal(w Value) bool {\n\treturn v.v == w.v\n}", "func TestEqual(t *testing.T) {\n\tslc := make([]float64, 10)\n\tfor i := range slc {\n\t\tslc[i] = float64(i)\n\t}\n\n\tv := NewFrom(slc)\n\tw := NewFrom(slc)\n\tif !Equal(v, w) {\n\t\tt.Error(\"Equal() != true for equal vectors.\")\n\t}\n\n\tw = Ne...
[ "0.7338705", "0.64570975", "0.6389764", "0.628415", "0.61077344", "0.5877148", "0.5758056", "0.57365495", "0.57364357", "0.5642112", "0.56111157", "0.5589437", "0.5572632", "0.55673397", "0.55565006", "0.5533532", "0.5520422", "0.5506255", "0.55059606", "0.5499088", "0.549045...
0.63866067
3
Less tells whether value v is (structurally) less than w.
func Less(v, w T) bool { if v == Unit { return false } switch v := v.(type) { case *big.Int: return v.Cmp(w.(*big.Int)) < 0 case *big.Float: return v.Cmp(w.(*big.Float)) < 0 case string: return v < w.(string) case bool: return !v && w.(bool) case reflow.File: w := w.(reflow.File) if v.IsRef() != w.IsRef() { return v.IsRef() } if !v.IsRef() { return v.ID.Less(w.ID) } else if v.Source != w.Source { return v.Source < w.Source } else { return v.ETag < w.ETag } case Dir: w := w.(Dir) if v.Len() != w.Len() { return v.Len() < w.Len() } var ( vkeys = make([]string, 0, v.Len()) wkeys = make([]string, 0, w.Len()) ) for k := range v.contents { vkeys = append(vkeys, k) } for k := range w.contents { wkeys = append(wkeys, k) } sort.Strings(vkeys) sort.Strings(wkeys) for i := range vkeys { if vkeys[i] != wkeys[i] { return vkeys[i] < wkeys[i] } else if Less(v.contents[vkeys[i]], w.contents[wkeys[i]]) { return true } } return false case List: w := w.(List) if len(v) != len(w) { return len(v) < len(w) } for i := range v { if Less(v[i], w[i]) { return true } } return false case *Map: w := w.(*Map) if n, m := v.Len(), w.Len(); n != m { return n < m } var ( ventries = make([]*mapEntry, 0, v.Len()) wentries = make([]*mapEntry, 0, w.Len()) ) for _, entryp := range v.tab { for entry := *entryp; entry != nil; entry = entry.Next { ventries = append(ventries, entry) } } for _, entryp := range w.tab { for entry := *entryp; entry != nil; entry = entry.Next { wentries = append(wentries, entry) } } sort.Slice(ventries, func(i, j int) bool { return Less(ventries[i].Key, ventries[j].Key) }) sort.Slice(wentries, func(i, j int) bool { return Less(wentries[i].Key, wentries[j].Key) }) for i := range ventries { ventry, wentry := ventries[i], wentries[i] if !Equal(ventry.Key, wentry.Key) { return Less(ventry.Key, wentry.Key) } if !Equal(ventry.Value, wentry.Value) { return Less(ventry.Value, wentry.Value) } } return false case Tuple: w := w.(Tuple) for i := range v { if !Equal(v[i], w[i]) { return Less(v[i], w[i]) } } return false case Struct: w := w.(Struct) keys := make([]string, 0, len(v)) for k := range v { keys = append(keys, k) } sort.Strings(keys) for _, k := range keys { if !Equal(v[k], w[k]) { return Less(v[k], w[k]) } } return false case Module: w := w.(Module) keys := make([]string, 0, len(v)) for k := range v { keys = append(keys, k) } sort.Strings(keys) for _, k := range keys { if !Equal(v[k], w[k]) { return Less(v[k], w[k]) } } return false default: panic("attempted to compare incomparable values") } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (v Version) Less(w Version) bool {\n\treturn v.Cmp(w) < 0\n}", "func (v Version) Less(w Version) bool {\n\treturn v.Compare(w) < 0\n}", "func (v Value) Less(b Value) bool {\n\treturn v.LessCase(b, false)\n}", "func (w Words) Less(i int, j int) bool {\n\treturn w[i] < w[j]\n}", "func (i *info) less(b *...
[ "0.7416697", "0.7210338", "0.67413294", "0.6604478", "0.6261659", "0.6218948", "0.6203722", "0.61974305", "0.61092466", "0.607995", "0.6053616", "0.60527766", "0.59950066", "0.5985393", "0.5887996", "0.5887226", "0.5881947", "0.5881279", "0.5880172", "0.5875157", "0.58737886"...
0.6616858
3
Sprint returns a prettyprinted version of value v with type t.
func Sprint(v T, t *types.T) string { switch arg := v.(type) { case shorter: return arg.Short() case stringer: return arg.String() case digester: return fmt.Sprintf("delayed(%v)", arg.Digest()) } switch t.Kind { case types.ErrorKind, types.BottomKind: panic("illegal type") case types.IntKind: return v.(*big.Int).String() case types.FloatKind: return v.(*big.Float).String() case types.StringKind: return fmt.Sprintf("%q", v.(string)) case types.BoolKind: if v.(bool) { return "true" } return "false" case types.FileKind: file := v.(reflow.File) if file.IsRef() { return fmt.Sprintf("file(source=%s, etag=%s)", file.Source, file.ETag) } return fmt.Sprintf("file(sha256=%s, size=%d)", file.ID, file.Size) case types.DirKind: dir := v.(Dir) entries := make([]string, 0, dir.Len()) for scan := dir.Scan(); scan.Scan(); { entries = append(entries, fmt.Sprintf("%q: %s", scan.Path(), Sprint(scan.File(), types.File))) } return fmt.Sprintf("dir(%s)", strings.Join(entries, ", ")) case types.FilesetKind: // We can't access the FileSet struct here because it would introduce // a circular dependency between reflow/ and reflow/values. We could // move the fileset definition elsewhere, but since this is anyway just a // backwards compatibility issue, we'll keep it opaque for now. d := v.(digester) return fmt.Sprintf("fileset(%s)", d.Digest().Short()) case types.UnitKind: return "()" case types.ListKind: list := v.(List) elems := make([]string, len(list)) for i, e := range list { elems[i] = Sprint(e, t.Elem) } return fmt.Sprintf("[%v]", strings.Join(elems, ", ")) case types.MapKind: var keys, values []string for _, entryp := range v.(*Map).tab { for entry := *entryp; entry != nil; entry = entry.Next { keys = append(keys, Sprint(entry.Key, t.Index)) values = append(values, Sprint(entry.Value, t.Elem)) } } elems := make([]string, len(keys)) for i := range keys { elems[i] = fmt.Sprintf("%s: %s", keys[i], values[i]) } return fmt.Sprintf("[%s]", strings.Join(elems, ", ")) case types.TupleKind: tuple := v.(Tuple) elems := make([]string, len(t.Fields)) for i, f := range t.Fields { elems[i] = Sprint(tuple[i], f.T) } return fmt.Sprintf("(%s)", strings.Join(elems, ", ")) case types.StructKind: s := v.(Struct) elems := make([]string, len(t.Fields)) for i, f := range t.Fields { elems[i] = fmt.Sprintf("%s: %s", f.Name, Sprint(s[f.Name], f.T)) } return fmt.Sprintf("{%s}", strings.Join(elems, ", ")) case types.ModuleKind: s := v.(Module) elems := make([]string, len(t.Fields)) for i, f := range t.Fields { elems[i] = fmt.Sprintf("val %s = %s", f.Name, Sprint(s[f.Name], f.T)) } return fmt.Sprintf("module{%s}", strings.Join(elems, "; ")) case types.SumKind: variant := v.(*Variant) variantTyp := t.VariantMap()[variant.Tag] if variantTyp == nil { return fmt.Sprintf("#%s", variant.Tag) } return fmt.Sprintf("#%s(%s)", variant.Tag, Sprint(variant.Elem, variantTyp)) case types.FuncKind: return fmt.Sprintf("func(?)") default: panic("unknown type " + t.String()) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func PrettyPrint(v interface{}) {\n\tfmt.Printf(\"%# v\\n\", pretty.Formatter(v))\n}", "func (p *Printer) PrintT(template string, v ...interface{}) FullPrinter {\n state, fc := p.initState()\n defer p.reset(state)\n p.formatter.PrintTemplate(fc, template, v...)\n state.Buffer.WriteNewLine()\n p.fc...
[ "0.66413844", "0.60485935", "0.6026737", "0.6004122", "0.5987677", "0.5987677", "0.5957976", "0.5933606", "0.58966583", "0.5868913", "0.58346736", "0.5832137", "0.5808272", "0.5807705", "0.5788891", "0.578023", "0.57239884", "0.5717909", "0.5705717", "0.5700035", "0.56876427"...
0.6356819
1
Digest computes the digest for value v, given type t.
func Digest(v T, t *types.T) digest.Digest { w := Digester.NewWriter() WriteDigest(w, v, t) return w.Digest() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func WriteDigest(w io.Writer, v T, t *types.T) {\n\tif d, ok := v.(digester); ok {\n\t\tdigest.WriteDigest(w, d.Digest())\n\t\treturn\n\t}\n\n\tw.Write([]byte{t.Kind.ID()})\n\tswitch t.Kind {\n\tcase types.ErrorKind, types.BottomKind, types.RefKind:\n\t\tpanic(\"illegal type\")\n\tcase types.IntKind:\n\t\tvi := v....
[ "0.71098894", "0.64068437", "0.57950824", "0.573337", "0.5672699", "0.55973285", "0.55431145", "0.5513988", "0.5474869", "0.5373887", "0.5371913", "0.53038967", "0.52510256", "0.5207102", "0.52021974", "0.5186848", "0.5170909", "0.513816", "0.50961375", "0.50706947", "0.50424...
0.7762607
0
WriteDigest writes digest material for value v (given type t) into the writer w.
func WriteDigest(w io.Writer, v T, t *types.T) { if d, ok := v.(digester); ok { digest.WriteDigest(w, d.Digest()) return } w.Write([]byte{t.Kind.ID()}) switch t.Kind { case types.ErrorKind, types.BottomKind, types.RefKind: panic("illegal type") case types.IntKind: vi := v.(*big.Int) // Bytes returns the normalized big-endian (i.e., free of a zero // prefix) representation of the absolute value of the integer. p := vi.Bytes() if len(p) == 0 { // This is the representation of "0" return } if p[0] == 0 { panic("big.Int byte representation is not normalized") } if vi.Sign() < 0 { w.Write([]byte{0}) } w.Write(p) case types.FloatKind: w.Write([]byte(v.(*big.Float).Text('e', 10))) case types.StringKind: io.WriteString(w, v.(string)) case types.BoolKind: if v.(bool) { w.Write(trueByte) } else { w.Write(falseByte) } case types.FileKind: digest.WriteDigest(w, v.(reflow.File).Digest()) case types.DirKind: dir := v.(Dir) for scan := dir.Scan(); scan.Scan(); { io.WriteString(w, scan.Path()) digest.WriteDigest(w, scan.File().Digest()) } // Filesets are digesters, so they don't need to be handled here. case types.UnitKind: case types.ListKind: writeLength(w, len(v.(List))) for _, e := range v.(List) { WriteDigest(w, e, t.Elem) } case types.MapKind: m := v.(*Map) writeLength(w, m.Len()) type kd struct { k T d digest.Digest } keys := make([]kd, 0, m.Len()) for _, entryp := range m.tab { for entry := *entryp; entry != nil; entry = entry.Next { keys = append(keys, kd{entry.Key, Digest(entry.Key, t.Index)}) } } // Sort the map so that it produces a consistent digest. We sort // its keys by their digest because the values may not yet be // evaluated. sort.Slice(keys, func(i, j int) bool { return keys[i].d.Less(keys[j].d) }) for _, k := range keys { WriteDigest(w, k.k, t.Index) WriteDigest(w, m.Lookup(k.d, k.k), t.Elem) } case types.TupleKind: writeLength(w, len(t.Fields)) tuple := v.(Tuple) for i, f := range t.Fields { WriteDigest(w, tuple[i], f.T) } case types.StructKind: writeLength(w, len(t.Fields)) s := v.(Struct) keys := make([]string, len(t.Fields)) for i, f := range t.Fields { keys[i] = f.Name } sort.Strings(keys) fm := t.FieldMap() for _, k := range keys { WriteDigest(w, s[k], fm[k]) } case types.ModuleKind: writeLength(w, len(t.Fields)) s := v.(Module) keys := make([]string, len(t.Fields)) for i, f := range t.Fields { keys[i] = f.Name } sort.Strings(keys) fm := t.FieldMap() for _, k := range keys { WriteDigest(w, s[k], fm[k]) } case types.SumKind: variant := v.(*Variant) io.WriteString(w, variant.Tag) WriteDigest(w, variant.Elem, t.VariantMap()[variant.Tag]) case types.FuncKind: digest.WriteDigest(w, v.(Func).Digest()) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Digest(v T, t *types.T) digest.Digest {\n\tw := Digester.NewWriter()\n\tWriteDigest(w, v, t)\n\treturn w.Digest()\n}", "func (q *Qsign) Digest(v interface{}) ([]byte, error) {\n\tbuf := new(bytes.Buffer)\n\n\tif q.prefixGenerator != nil {\n\t\tif _, err := buf.WriteString(q.prefixGenerator()); err != nil {\...
[ "0.7222287", "0.61005545", "0.55415916", "0.5209088", "0.5083807", "0.5052842", "0.4941014", "0.48079118", "0.48077276", "0.48063084", "0.4738801", "0.4712518", "0.4684972", "0.46651158", "0.4654325", "0.4654092", "0.46490794", "0.46484983", "0.46432567", "0.46338454", "0.463...
0.8357803
0
OnUpdateManifest is called when a new manifest is added. It updates metadb according to the type of image pushed(normal images, signatues, etc.). In care of any errors, it makes sure to keep consistency between metadb and the image store.
func OnUpdateManifest(repo, reference, mediaType string, digest godigest.Digest, body []byte, storeController storage.StoreController, metaDB mTypes.MetaDB, log log.Logger, ) error { imgStore := storeController.GetImageStore(repo) // check if image is a signature isSignature, signatureType, signedManifestDigest, err := storage.CheckIsImageSignature(repo, body, reference) if err != nil { log.Error().Err(err).Msg("can't check if image is a signature or not") if err := imgStore.DeleteImageManifest(repo, reference, false); err != nil { log.Error().Err(err).Str("manifest", reference).Str("repository", repo).Msg("couldn't remove image manifest in repo") return err } return err } metadataSuccessfullySet := true if isSignature { layersInfo, errGetLayers := GetSignatureLayersInfo(repo, reference, digest.String(), signatureType, body, imgStore, log) if errGetLayers != nil { metadataSuccessfullySet = false err = errGetLayers } else { err = metaDB.AddManifestSignature(repo, signedManifestDigest, mTypes.SignatureMetadata{ SignatureType: signatureType, SignatureDigest: digest.String(), LayersInfo: layersInfo, }) if err != nil { log.Error().Err(err).Msg("metadb: error while putting repo meta") metadataSuccessfullySet = false } else { err = metaDB.UpdateSignaturesValidity(repo, signedManifestDigest) if err != nil { log.Error().Err(err).Str("repository", repo).Str("reference", reference).Str("digest", signedManifestDigest.String()).Msg("metadb: failed verify signatures validity for signed image") metadataSuccessfullySet = false } } } } else { err = SetImageMetaFromInput(repo, reference, mediaType, digest, body, imgStore, metaDB, log) if err != nil { metadataSuccessfullySet = false } } if !metadataSuccessfullySet { log.Info().Str("tag", reference).Str("repository", repo).Msg("uploading image meta was unsuccessful for tag in repo") if err := imgStore.DeleteImageManifest(repo, reference, false); err != nil { log.Error().Err(err).Str("reference", reference).Str("repository", repo). Msg("couldn't remove image manifest in repo") return err } return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func OnGetManifest(name, reference string, body []byte,\n\tstoreController storage.StoreController, metaDB mTypes.MetaDB, log log.Logger,\n) error {\n\t// check if image is a signature\n\tisSignature, _, _, err := storage.CheckIsImageSignature(name, body, reference)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg...
[ "0.7010766", "0.66876704", "0.6556861", "0.5991127", "0.59570235", "0.5899974", "0.5800305", "0.5798259", "0.5712472", "0.5641731", "0.5567172", "0.55645925", "0.5563863", "0.5545608", "0.55113065", "0.54682016", "0.54171425", "0.5391867", "0.53072697", "0.5294346", "0.524912...
0.8265896
0
OnDeleteManifest is called when a manifest is deleted. It updates metadb according to the type of image pushed(normal images, signatues, etc.). In care of any errors, it makes sure to keep consistency between metadb and the image store.
func OnDeleteManifest(repo, reference, mediaType string, digest godigest.Digest, manifestBlob []byte, storeController storage.StoreController, metaDB mTypes.MetaDB, log log.Logger, ) error { imgStore := storeController.GetImageStore(repo) isSignature, signatureType, signedManifestDigest, err := storage.CheckIsImageSignature(repo, manifestBlob, reference) if err != nil { log.Error().Err(err).Msg("can't check if image is a signature or not") return err } manageRepoMetaSuccessfully := true if isSignature { err = metaDB.DeleteSignature(repo, signedManifestDigest, mTypes.SignatureMetadata{ SignatureDigest: digest.String(), SignatureType: signatureType, }) if err != nil { log.Error().Err(err).Msg("metadb: can't check if image is a signature or not") manageRepoMetaSuccessfully = false } } else { err = metaDB.DeleteRepoTag(repo, reference) if err != nil { log.Info().Msg("metadb: restoring image store") // restore image store _, _, err := imgStore.PutImageManifest(repo, reference, mediaType, manifestBlob) if err != nil { log.Error().Err(err).Msg("metadb: error while restoring image store, database is not consistent") } manageRepoMetaSuccessfully = false } if referredDigest, hasSubject := common.GetReferredSubject(manifestBlob); hasSubject { err := metaDB.DeleteReferrer(repo, referredDigest, digest) if err != nil { log.Error().Err(err).Msg("metadb: error while deleting referrer") return err } } } if !manageRepoMetaSuccessfully { log.Info().Str("tag", reference).Str("repository", repo). Msg("metadb: deleting image meta was unsuccessful for tag in repo") return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (imh *manifestHandler) DeleteManifest(w http.ResponseWriter, r *http.Request) {\n\tdcontext.GetLogger(imh).Debug(\"DeleteImageManifest\")\n\n\tif imh.App.isCache {\n\t\timh.Errors = append(imh.Errors, errcode.ErrorCodeUnsupported)\n\t\treturn\n\t}\n\n\tif imh.Tag != \"\" {\n\t\tdcontext.GetLogger(imh).Debug(\...
[ "0.7518358", "0.72563094", "0.6750114", "0.6628918", "0.6548979", "0.65356153", "0.6269419", "0.61748946", "0.6108742", "0.5964179", "0.5844784", "0.5762061", "0.57612425", "0.5721427", "0.5636067", "0.55578166", "0.55270004", "0.54325235", "0.5378246", "0.5231348", "0.513938...
0.86380994
0
OnDeleteManifest is called when a manifest is downloaded. It increments the download couter on that manifest.
func OnGetManifest(name, reference string, body []byte, storeController storage.StoreController, metaDB mTypes.MetaDB, log log.Logger, ) error { // check if image is a signature isSignature, _, _, err := storage.CheckIsImageSignature(name, body, reference) if err != nil { log.Error().Err(err).Msg("can't check if manifest is a signature or not") return err } if !isSignature { err := metaDB.IncrementImageDownloads(name, reference) if err != nil { log.Error().Err(err).Str("repository", name).Str("reference", reference). Msg("unexpected error for image") return err } } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func OnDeleteManifest(repo, reference, mediaType string, digest godigest.Digest, manifestBlob []byte,\n\tstoreController storage.StoreController, metaDB mTypes.MetaDB, log log.Logger,\n) error {\n\timgStore := storeController.GetImageStore(repo)\n\n\tisSignature, signatureType, signedManifestDigest, err := storage...
[ "0.6862908", "0.65429384", "0.6432694", "0.6220848", "0.6173658", "0.58912337", "0.58835965", "0.58701575", "0.56467897", "0.56270117", "0.5577935", "0.5576489", "0.54664457", "0.54631424", "0.54426086", "0.5428752", "0.5319357", "0.5285182", "0.5155966", "0.5142746", "0.5140...
0.5517863
12
committee_api GetCommitteeRequest api request get_committee_request
func (api *API) GetCommitteeRequest(id uint32, count int32) (*CommitteeObject, error) { var resp CommitteeObject err := api.call("committee_api", "get_committee_request", []interface{}{id, count}, &resp) return &resp, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (_IOrakuruCore *IOrakuruCoreCallerSession) GetRequest(_requestId [32]byte) (struct {\n\tId [32]byte\n\tDataSource string\n\tSelector string\n\tCallbackAddr common.Address\n\tExecutionTimestamp *big.Int\n\tIsFulfilled bool\n\tAggrType uint8\n\tPrecision ...
[ "0.6219865", "0.6180947", "0.60726804", "0.57100993", "0.56391525", "0.55845666", "0.55674565", "0.55537844", "0.5511908", "0.5506123", "0.542247", "0.54088473", "0.5395237", "0.5330503", "0.53254104", "0.5315587", "0.52814925", "0.52538687", "0.524927", "0.524927", "0.521511...
0.8301529
0
GetCommitteeRequestVotes api request get_committee_request_votes
func (api *API) GetCommitteeRequestVotes(id uint32) ([]*CommitteeVoteState, error) { var resp []*CommitteeVoteState err := api.call("committee_api", "get_committee_request_votes", []interface{}{id}, &resp) return resp, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (n *Node) requestVotes(currTerm uint64) (fallback, electionResult bool) {\n\t// TODO: Students should implement this method\n\treturn\n}", "func (api *API) GetCommitteeRequest(id uint32, count int32) (*CommitteeObject, error) {\n\tvar resp CommitteeObject\n\terr := api.call(\"committee_api\", \"get_committe...
[ "0.61757547", "0.6035921", "0.55281144", "0.5522556", "0.5502034", "0.5381857", "0.5226636", "0.51511484", "0.5136846", "0.5118304", "0.50843143", "0.5066021", "0.5065501", "0.50638837", "0.49484923", "0.49452785", "0.49406174", "0.4903563", "0.48684135", "0.48664993", "0.484...
0.8009276
0
GetCommitteeRequestsList api request get_committee_requests_list
func (api *API) GetCommitteeRequestsList(status uint16) ([]*uint16, error) { var resp []*uint16 err := api.call("committee_api", "get_committee_requests_list", []interface{}{status}, &resp) return resp, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (api *API) GetCommitteeRequest(id uint32, count int32) (*CommitteeObject, error) {\n\tvar resp CommitteeObject\n\terr := api.call(\"committee_api\", \"get_committee_request\", []interface{}{id, count}, &resp)\n\treturn &resp, err\n}", "func (api *API) GetCommitteeRequestVotes(id uint32) ([]*CommitteeVoteSta...
[ "0.6726568", "0.60950726", "0.586521", "0.58409595", "0.58262", "0.5651529", "0.56400454", "0.5546509", "0.54614383", "0.54555523", "0.54187846", "0.5413614", "0.53488183", "0.5328241", "0.5320421", "0.5247767", "0.5227244", "0.5193367", "0.51814556", "0.51613", "0.51548237",...
0.8405216
0
connect to bitcoind with HTTP RPC transport
func NewBtcClient() (*BtcClient, error) { var BtcHostPort = fmt.Sprintf("%s:%s",config.RpcConfig.BtcHost,config.RpcConfig.BtcPort) var BtcrpcUser = config.RpcConfig.BtcRpcUser var BtcrpcPassword = config.RpcConfig.BtcRpcPwd connCfg := &rpcclient.ConnConfig{ Host: BtcHostPort, User: BtcrpcUser, Pass: BtcrpcPassword, HTTPPostMode: true, DisableTLS: true, } client := &BtcClient{} var err error client.rpcClient, err = rpcclient.New(connCfg, nil) if err != nil { return nil, err } if err != nil { return nil, err } fmt.Printf("network:%d coins=>btc_wallet=>initClinet sccuess.",client.rpcClient.NextID()) return client, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func setupBitcoind(t *testing.T, minerAddr string,\n\trpcPolling bool) *BitcoindClient {\n\n\t// Start a bitcoind instance and connect it to miner1.\n\ttempBitcoindDir, err := ioutil.TempDir(\"\", \"bitcoind\")\n\trequire.NoError(t, err)\n\n\tzmqBlockHost := \"ipc:///\" + tempBitcoindDir + \"/blocks.socket\"\n\tzm...
[ "0.63428277", "0.622701", "0.62245643", "0.59835815", "0.57889086", "0.5719119", "0.56793374", "0.5646093", "0.5581715", "0.5572185", "0.5528617", "0.55063194", "0.5499948", "0.5494585", "0.54556996", "0.5449738", "0.5431415", "0.54304606", "0.54102886", "0.5409134", "0.53914...
0.0
-1
TODO GetNewAddress does map to `getnewaddress` rpc call now rpcclient doesn't have such golang wrapper func.
func (client *BtcClient) GetNewAddress(account string) (string, error) { if len(account) == 0 { account = DEFAULT_ACCOUNT } address, err := client.rpcClient.GetNewAddress(account) if err != nil { return "", err } return address.String(), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (b *Bitcoind) GetNewAddress(account ...string) (addr string, err error) {\n\t// 0 or 1 account\n\tif len(account) > 1 {\n\t\terr = errors.New(\"Bad parameters for GetNewAddress: you can set 0 or 1 account\")\n\t\treturn\n\t}\n\n\tr, err := b.client.call(\"getnewaddress\", account)\n\tif err = handleError(err,...
[ "0.7285334", "0.7254116", "0.7206184", "0.7199894", "0.71601254", "0.7149224", "0.66494334", "0.6274284", "0.6202237", "0.61646694", "0.608202", "0.5939763", "0.58696765", "0.58615035", "0.5792989", "0.57605034", "0.57210624", "0.5708498", "0.5630859", "0.56129843", "0.561159...
0.77015626
0
TODO check validity of account and have sufficent balance
func (client *BtcClient) SendFrom(account, address string, amount float64) (string, error) { decoded, err := decodeAddress(address, btcEnv) if err != nil { return "", err } btcAmount, err := convertToBtcAmount(amount) if err != nil { return "", err } hash, err := client.rpcClient.SendFrom(account, decoded, btcAmount) if err != nil { return "", err } return hash.String(), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func getAccountBal(num hedera.AccountID) float64{\n\taccountID := num\n\tclient, err := hedera.Dial(server)\n\tif err != nil{\n\t\tpanic(err)\n\t}\n\n\toperatorAccountID := hedera.AccountID{Account: 1001}\n\n\toperatorSecret,err := hedera.SecretKeyFromString(secret)\n\tif err != nil{\n\t\tpanic(err)\n\t}\n\tclient...
[ "0.7146157", "0.6948025", "0.68929577", "0.68679476", "0.683919", "0.6832782", "0.6798275", "0.67196774", "0.6715751", "0.6714826", "0.6670434", "0.66580254", "0.6650628", "0.65918165", "0.6572852", "0.65724254", "0.65653", "0.6563838", "0.6559949", "0.6548054", "0.6547226", ...
0.0
-1
btc send raw transaction
func (client *BtcClient)BtcSendRawTrans(serial string , tx []byte)(string,error ){ var redeemTx wire.MsgTx err := json.Unmarshal(tx,&redeemTx) if err != nil { return "",err } sendResult,err := client.rpcClient.SendRawTransaction(&redeemTx,false) //sendResult,err := btcClient.SendRawTransactionAsync(&redeemTx,false).Receive() if err != nil { return "",err } return sendResult.String(),nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func sendRawTx(eth *thereum.Thereum, msg *rpcMessage) (*rpcMessage, error) {\n\t// unmarshal into temp data structs (passed via json as a slice of a single hex string)\n\tvar hexTx []string\n\terr := json.Unmarshal(msg.Params, &hexTx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// ensure that some data was pas...
[ "0.75618804", "0.7431252", "0.7406614", "0.700521", "0.6965261", "0.69638187", "0.69369", "0.6910495", "0.68955934", "0.6840324", "0.682656", "0.6720636", "0.66406167", "0.6629154", "0.6592851", "0.6590758", "0.6585054", "0.6555446", "0.65178925", "0.65044934", "0.6460261", ...
0.7520837
1
decodeAddress from string to decodedAddress
func decodeAddress(address string, cfg *chaincfg.Params) (btcutil.Address, error) { decodedAddress, err := btcutil.DecodeAddress(address, cfg) if err != nil { return nil, err } return decodedAddress, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeString(addr string) (Address, error) {\n\t// Remove any leading slashes.\n\tif strings.HasPrefix(addr, \"/\") {\n\t\taddr = addr[1:]\n\t}\n\n\taddrParts := strings.Split(addr, \"/\")\n\tif len(addrParts) != 4 {\n\t\treturn Address{}, fmt.Errorf(\"invalid format %v\", addr)\n\t}\n\tvar protocol Protocol\...
[ "0.762846", "0.72298115", "0.72216547", "0.70370436", "0.7010531", "0.6963402", "0.69541156", "0.6823345", "0.68193984", "0.6794519", "0.67006904", "0.66820186", "0.6623264", "0.65907305", "0.65661985", "0.65495574", "0.648334", "0.6466039", "0.62854505", "0.6275847", "0.6274...
0.74612874
1
GetHTTPClient returns http client for the purpose of test
func (c Client) GetHTTPClient() *http.Client { return &c.httpClient }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetHTTPClient() *http.Client {\r\n tlsConfig := &tls.Config {\r\n InsecureSkipVerify: true, //for this test, ignore ssl certificate\r\n }\r\n\r\n tr := &http.Transport{TLSClientConfig: tlsConfig}\r\n client := &http.Client{Transport: tr}\r\n\r\n return client\r\n}", "func GetHTTPClient...
[ "0.840997", "0.84031147", "0.82243925", "0.8215249", "0.81582445", "0.8098461", "0.7828292", "0.781695", "0.77948695", "0.7714", "0.7694769", "0.7684848", "0.7631528", "0.7596621", "0.7594578", "0.7573144", "0.75554603", "0.7527961", "0.75186354", "0.7507211", "0.74942607", ...
0.7969526
6
Helper for tests and output
func JsonPrint(data interface{}) { var p []byte p, err := json.Marshal(data) if err != nil { fmt.Println(err) return } fmt.Printf("%s \n", p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func writeout() {\n\tworden := \"test, test\" // temporary\n\n\tfmt.Println(bar)\n\tfmt.Printf(\"%v\\n%v %s %v\\n%v\", bar, sd, worden, sd, bar)\n\t/* file io should replace prints */\n}", "func TestCaptureUserOut(t *testing.T) {\n\tassert := asrt.New(t)\n\trestoreOutput := util.CaptureUserOut()\n\ttext := util....
[ "0.5921244", "0.5917927", "0.58908236", "0.58242327", "0.5802392", "0.57774836", "0.57616454", "0.56760526", "0.567026", "0.5658049", "0.5656105", "0.5647464", "0.5606502", "0.5605456", "0.55558556", "0.55383164", "0.551986", "0.5514595", "0.55137485", "0.54991525", "0.548850...
0.0
-1
Function for generate IMT Hash
func Generate(data []byte) ([]byte, error) { if len(data) == 0 { return nil, ErrEmptySlice } var tempHash = make([]int, len(data)*8) var hash []byte var index = 0 for _, ib := range data { for i, coefficient := range Coefficients { var temp int if i > 0 { temp = i - 1 } tempHash[index] = ((tempHash[temp] + int(ib)) * coefficient) % 255 index++ } } // []int to []byte Conversion - Is not elegant, but works fine for _, h := range tempHash { hash = append(hash, byte(h)) } return hash, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Hashit(tox string) string {\n h:= sha256.New()\n h.Write([]byte(tox))\n bs := h.Sum([]byte{})\n str := base64.StdEncoding.EncodeToString(bs)\n return str\n}", "func (tx *Tx) generateHash() [32]byte {\n\ttxInSlices := make([][]byte, 0)\n\tfor _, txIn := range tx.Inputs {\n\t\ttxInSlices = append(txInSli...
[ "0.682205", "0.63708305", "0.6320564", "0.62342554", "0.6228108", "0.62187105", "0.6194701", "0.61638", "0.6110786", "0.6078033", "0.6066673", "0.60372865", "0.6024374", "0.6024374", "0.6024374", "0.6024374", "0.6024374", "0.6024374", "0.6024374", "0.6024374", "0.6024374", ...
0.0
-1
Test that Pool does not hold pointers to previously cached resources.
func TestPoolGC(t *testing.T) { testPool(t, true) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestPool(t *testing.T, p pool.Pool) {\n\tt.Helper()\n\tctx := context.Background()\n\toffers, err := p.Offers(ctx)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif got, want := len(offers), 1; got != want {\n\t\tt.Fatalf(\"got %v, want %v\", got, want)\n\t}\n\t// We accept half the memory and disk; we use 0 CP...
[ "0.66354775", "0.65084225", "0.64718693", "0.6448212", "0.64091086", "0.6374555", "0.61580724", "0.61445475", "0.6142347", "0.6084883", "0.6079117", "0.60385364", "0.5989658", "0.5920169", "0.5905672", "0.58007514", "0.5796426", "0.5788675", "0.57364124", "0.57043797", "0.567...
0.58948064
15
Test that Pool releases resources on GC.
func TestPoolRelease(t *testing.T) { testPool(t, false) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestPoolGC(t *testing.T) {\n\ttestPool(t, true)\n}", "func TestPool(t *testing.T) {\n\tdefer leaktest.Check(t)()\n\n\tgo func() {\n\t\tfor {\n\t\t\ttime.Sleep(time.Second)\n\t\t}\n\t}()\n}", "func (this *PoolTestSuite) TestInvalidateFreesCapacity() {\n\tthis.pool.Config.MaxTotal = 2\n\tthis.pool.Config.Ma...
[ "0.79037666", "0.77005196", "0.7212689", "0.69314015", "0.68882775", "0.6821975", "0.677085", "0.67185074", "0.67125475", "0.6660586", "0.66495705", "0.6595156", "0.65770125", "0.6570085", "0.65700454", "0.65200526", "0.651361", "0.64882994", "0.6450801", "0.6413368", "0.6399...
0.79534227
0
Simulate object starvation in order to force Ps to steal objects from other Ps.
func BenchmarkPoolStarvation(b *testing.B) { var p Pool count := 100 // Reduce number of putted objects by 33 %. It creates objects starvation // that force P-local storage to steal objects from other Ps. countStarved := count - int(float32(count)*0.33) b.RunParallel(func(pb *testing.PB) { for pb.Next() { for b := 0; b < countStarved; b++ { p.Put(1) } for b := 0; b < count; b++ { p.Get() } } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func SyncRuntimeDoSpin()", "func (this *PoolTestSuite) TestInvalidateFreesCapacity() {\n\tthis.pool.Config.MaxTotal = 2\n\tthis.pool.Config.MaxWaitMillis = 500\n\tthis.pool.Config.BlockWhenExhausted = true\n\t// Borrow an instance and hold if for 5 seconds\n\tch1 := waitTestGoroutine(this.pool, 5000)\n\t// Borro...
[ "0.57773536", "0.5751083", "0.55268425", "0.5509779", "0.5475696", "0.54533315", "0.5447968", "0.5350582", "0.5280517", "0.52645826", "0.5243615", "0.52426934", "0.5230957", "0.5226076", "0.5213898", "0.51857793", "0.51736426", "0.51404357", "0.51184314", "0.5090954", "0.5056...
0.6317484
0
NewMockFetcher creates a new mock instance
func NewMockFetcher(ctrl *gomock.Controller) *MockFetcher { mock := &MockFetcher{ctrl: ctrl} mock.recorder = &MockFetcherMockRecorder{mock} return mock }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newTestFetcher() *FetcherTest {\n\treturn &FetcherTest{}\n}", "func New() *Mock {\n\treturn &Mock{\n\t\tm: mockMap{},\n\t\toldTransport: http.DefaultTransport,\n\t}\n}", "func (c *Crawler) newFetcher(height uint64) {\n\t\n\t// Stop previous fetcher\n\tif c.fetcherStop != nil {\n\t\tc.fetcherSto...
[ "0.7179141", "0.62835836", "0.6230573", "0.6191782", "0.618321", "0.61163497", "0.6053471", "0.6033386", "0.6015921", "0.5985766", "0.59277", "0.58966744", "0.5880312", "0.58772784", "0.5871133", "0.5871133", "0.58683485", "0.5854461", "0.5852765", "0.5817213", "0.58112985", ...
0.6813213
1
EXPECT returns an object that allows the caller to indicate expected use
func (m *MockFetcher) EXPECT() *MockFetcherMockRecorder { return m.recorder }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (mmGetObject *mClientMockGetObject) Expect(ctx context.Context, head insolar.Reference) *mClientMockGetObject {\n\tif mmGetObject.mock.funcGetObject != nil {\n\t\tmmGetObject.mock.t.Fatalf(\"ClientMock.GetObject mock is already set by Set\")\n\t}\n\n\tif mmGetObject.defaultExpectation == nil {\n\t\tmmGetObjec...
[ "0.58157563", "0.5714918", "0.5672776", "0.5639812", "0.56273276", "0.5573085", "0.5567367", "0.5529613", "0.55066866", "0.5486919", "0.54729885", "0.54647803", "0.5460882", "0.54414886", "0.5440682", "0.5405729", "0.54035264", "0.53890616", "0.53831995", "0.53831995", "0.536...
0.0
-1
FetchLocalImage mocks base method
func (m *MockFetcher) FetchLocalImage(arg0 string) (image.Image, error) { ret := m.ctrl.Call(m, "FetchLocalImage", arg0) ret0, _ := ret[0].(image.Image) ret1, _ := ret[1].(error) return ret0, ret1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *MockFetcher) FetchUpdatedLocalImage(arg0 context.Context, arg1 string, arg2 io.Writer) (image.Image, error) {\n\tret := m.ctrl.Call(m, \"FetchUpdatedLocalImage\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(image.Image)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockFetcher) FetchRemot...
[ "0.72084695", "0.6717672", "0.6187629", "0.60904604", "0.5996021", "0.58322525", "0.5825194", "0.5771793", "0.5758451", "0.57340926", "0.5726534", "0.5694318", "0.56871355", "0.5607126", "0.5600493", "0.55343837", "0.548785", "0.53960055", "0.537409", "0.53434074", "0.5329744...
0.78663063
0
FetchLocalImage indicates an expected call of FetchLocalImage
func (mr *MockFetcherMockRecorder) FetchLocalImage(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchLocalImage", reflect.TypeOf((*MockFetcher)(nil).FetchLocalImage), arg0) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *MockFetcher) FetchLocalImage(arg0 string) (image.Image, error) {\n\tret := m.ctrl.Call(m, \"FetchLocalImage\", arg0)\n\tret0, _ := ret[0].(image.Image)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (mr *MockFetcherMockRecorder) FetchUpdatedLocalImage(arg0, arg1, arg2 interface{}) *gomock....
[ "0.7089123", "0.64089054", "0.64003843", "0.6323396", "0.6199627", "0.6125763", "0.6094584", "0.60674024", "0.602652", "0.5980229", "0.59721696", "0.58975357", "0.5887362", "0.57745016", "0.5712181", "0.56382984", "0.558818", "0.5585266", "0.550621", "0.54520273", "0.54474455...
0.67842525
1
FetchRemoteImage mocks base method
func (m *MockFetcher) FetchRemoteImage(arg0 string) (image.Image, error) { ret := m.ctrl.Call(m, "FetchRemoteImage", arg0) ret0, _ := ret[0].(image.Image) ret1, _ := ret[1].(error) return ret0, ret1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *MockFetcher) FetchLocalImage(arg0 string) (image.Image, error) {\n\tret := m.ctrl.Call(m, \"FetchLocalImage\", arg0)\n\tret0, _ := ret[0].(image.Image)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockFetcher) FetchUpdatedLocalImage(arg0 context.Context, arg1 string, arg2 io.Writer) ...
[ "0.6551211", "0.63521427", "0.6168074", "0.5930461", "0.59249926", "0.59170794", "0.5911446", "0.5879098", "0.58760864", "0.5863561", "0.5850105", "0.5846192", "0.5763224", "0.5747897", "0.57216996", "0.57001495", "0.56998503", "0.56664616", "0.5652397", "0.56486833", "0.5608...
0.75892
0
FetchRemoteImage indicates an expected call of FetchRemoteImage
func (mr *MockFetcherMockRecorder) FetchRemoteImage(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchRemoteImage", reflect.TypeOf((*MockFetcher)(nil).FetchRemoteImage), arg0) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *MockFetcher) FetchRemoteImage(arg0 string) (image.Image, error) {\n\tret := m.ctrl.Call(m, \"FetchRemoteImage\", arg0)\n\tret0, _ := ret[0].(image.Image)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestFetch(t *testing.T) {\n\timage := \"rkt-inspect-fetch.aci\"\n\n\tctx := newRktRunCtx(...
[ "0.6768596", "0.64943826", "0.6419135", "0.6157075", "0.6140877", "0.6051301", "0.6051102", "0.6015688", "0.6012333", "0.5803486", "0.5785222", "0.5717334", "0.568571", "0.5613724", "0.55998373", "0.5590659", "0.5588034", "0.5576534", "0.55490285", "0.55427665", "0.5537828", ...
0.66579026
1
FetchUpdatedLocalImage mocks base method
func (m *MockFetcher) FetchUpdatedLocalImage(arg0 context.Context, arg1 string, arg2 io.Writer) (image.Image, error) { ret := m.ctrl.Call(m, "FetchUpdatedLocalImage", arg0, arg1, arg2) ret0, _ := ret[0].(image.Image) ret1, _ := ret[1].(error) return ret0, ret1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *MockFetcher) FetchLocalImage(arg0 string) (image.Image, error) {\n\tret := m.ctrl.Call(m, \"FetchLocalImage\", arg0)\n\tret0, _ := ret[0].(image.Image)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockFetcher) FetchRemoteImage(arg0 string) (image.Image, error) {\n\tret := m.ctrl.Call...
[ "0.7315873", "0.6466252", "0.621011", "0.58941764", "0.5832389", "0.5714767", "0.57144743", "0.5696898", "0.56600785", "0.5652856", "0.5563077", "0.5445605", "0.54443705", "0.5374082", "0.53736216", "0.5362618", "0.5343925", "0.533864", "0.532144", "0.53188276", "0.5303848", ...
0.805092
0
FetchUpdatedLocalImage indicates an expected call of FetchUpdatedLocalImage
func (mr *MockFetcherMockRecorder) FetchUpdatedLocalImage(arg0, arg1, arg2 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchUpdatedLocalImage", reflect.TypeOf((*MockFetcher)(nil).FetchUpdatedLocalImage), arg0, arg1, arg2) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *MockFetcher) FetchUpdatedLocalImage(arg0 context.Context, arg1 string, arg2 io.Writer) (image.Image, error) {\n\tret := m.ctrl.Call(m, \"FetchUpdatedLocalImage\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(image.Image)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockFetcher) FetchLocal...
[ "0.70878696", "0.63165396", "0.6095992", "0.6031656", "0.6025517", "0.55363476", "0.5509565", "0.548924", "0.54534054", "0.54503196", "0.5307194", "0.52465767", "0.5211706", "0.5209486", "0.5193103", "0.5190094", "0.5184434", "0.5166309", "0.5161391", "0.51610816", "0.5121715...
0.69185567
1
NewProtocol creates a new protocol
func NewProtocol( store s.Store, epochCtx *epochctx.EpochCtx, rewardingConfig indexprotocol.Rewarding, gravityChainCfg indexprotocol.GravityChain, ) *Protocol { return &Protocol{ Store: store, RewardConfig: rewardingConfig, epochCtx: epochCtx, gravityChainCfg: gravityChainCfg, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewProtocol(bc blockchain.Blockchain) *Protocol { return &Protocol{bc} }", "func NewProtocol(action string, hID int64, note string) Protocol {\n\treturn Protocol{\n\t\tTime: time.Now(),\n\t\tAction: action,\n\t\tHeroID: hID,\n\t\tNote: note,\n\t}\n}", "func (s *Service) NewProtocol(n *onet.TreeNodeIns...
[ "0.82395333", "0.7932014", "0.7890012", "0.78431666", "0.76969916", "0.75500846", "0.7542913", "0.7482777", "0.74068224", "0.7114767", "0.7084508", "0.70643973", "0.7062169", "0.70373213", "0.694992", "0.6846281", "0.67778176", "0.6698597", "0.6665437", "0.6652466", "0.649211...
0.7420354
8
Initialize initializes rewards protocol
func (p *Protocol) Initialize(context.Context, *sql.Tx, *indexprotocol.Genesis) error { return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (agent *Agent) init(state_size int, action_size int, dqn bool) Agent {\n\tagent.learning_rate = 0.95\n\tagent.action_size = action_size\n\tagent.state_size = state_size\n\tagent.epsilon = 1.0\n\tagent.epsilon_min = 0.01\n\tagent.epsilon_decay = 0.995\n\tagent.gamma = 0.95\n\tagent.HISTORY_LENGTH = 2000\n\tage...
[ "0.5713748", "0.5581605", "0.5409013", "0.5395823", "0.53937817", "0.5388697", "0.53284436", "0.52667344", "0.52412826", "0.5227323", "0.51680535", "0.5149312", "0.5135256", "0.51343644", "0.51328707", "0.5130539", "0.51271385", "0.5116818", "0.5077328", "0.50768316", "0.5060...
0.48114556
61
getRewardHistory reads reward history
func (p *Protocol) getRewardHistory(actionHash string) ([]*RewardHistory, error) { db := p.Store.GetDB() getQuery := fmt.Sprintf(selectRewardHistory, RewardHistoryTableName) stmt, err := db.Prepare(getQuery) if err != nil { return nil, errors.Wrap(err, "failed to prepare get query") } defer stmt.Close() rows, err := stmt.Query(actionHash) if err != nil { return nil, errors.Wrap(err, "failed to execute get query") } var rewardHistory RewardHistory parsedRows, err := s.ParseSQLRows(rows, &rewardHistory) if err != nil { return nil, errors.Wrap(err, "failed to parse results") } if len(parsedRows) == 0 { return nil, indexprotocol.ErrNotExist } var rewardHistoryList []*RewardHistory for _, parsedRow := range parsedRows { rewards := parsedRow.(*RewardHistory) rewardHistoryList = append(rewardHistoryList, rewards) } return rewardHistoryList, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (as AccountStorage) GetRewardHistory(\n\tctx sdk.Context, me types.AccountKey, bucketSlot int64) (*RewardHistory, sdk.Error) {\n\tstore := ctx.KVStore(as.key)\n\trewardHistoryBytes := store.Get(getRewardHistoryKey(me, bucketSlot))\n\tif rewardHistoryBytes == nil {\n\t\treturn nil, nil\n\t}\n\thistory := new(R...
[ "0.70522064", "0.6610849", "0.65936154", "0.6502668", "0.62767226", "0.62686336", "0.6237844", "0.6173763", "0.61523086", "0.61413825", "0.6135928", "0.6079403", "0.60785544", "0.60713136", "0.6067368", "0.60503054", "0.60456854", "0.6004538", "0.5992135", "0.59637904", "0.59...
0.7648041
0
getAccountReward reads account reward details
func (p *Protocol) getAccountReward(epochNumber uint64, candidateName string) (*AccountReward, error) { db := p.Store.GetDB() getQuery := fmt.Sprintf(selectAccountReward, AccountRewardTableName) stmt, err := db.Prepare(getQuery) if err != nil { return nil, errors.Wrap(err, "failed to prepare get query") } defer stmt.Close() rows, err := stmt.Query(epochNumber, candidateName) if err != nil { return nil, errors.Wrap(err, "failed to execute get query") } var accountReward AccountReward parsedRows, err := s.ParseSQLRows(rows, &accountReward) if err != nil { return nil, errors.Wrap(err, "failed to parse results") } if len(parsedRows) == 0 { return nil, indexprotocol.ErrNotExist } if len(parsedRows) > 1 { return nil, errors.New("only one row is expected") } return parsedRows[0].(*AccountReward), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (as AccountStorage) GetReward(ctx sdk.Context, accKey types.AccountKey) (*Reward, sdk.Error) {\n\tstore := ctx.KVStore(as.key)\n\trewardByte := store.Get(getRewardKey(accKey))\n\tif rewardByte == nil {\n\t\treturn nil, ErrRewardNotFound()\n\t}\n\treward := new(Reward)\n\tif err := as.cdc.UnmarshalJSON(rewardB...
[ "0.7359368", "0.7301453", "0.7164745", "0.71411335", "0.7125285", "0.7048926", "0.7008327", "0.69872797", "0.69602764", "0.6954469", "0.690628", "0.6885635", "0.6868693", "0.68661374", "0.6859745", "0.67821544", "0.66738814", "0.6654499", "0.6475623", "0.64529395", "0.6261458...
0.75374323
0
updateRewardHistory stores reward information into reward history table
func (p *Protocol) updateRewardHistory(tx *sql.Tx, epochNumber uint64, actionHash string, rewardInfoMap map[string]*RewardInfo) error { valStrs := make([]string, 0, len(rewardInfoMap)) valArgs := make([]interface{}, 0, len(rewardInfoMap)*7) for rewardAddress, rewards := range rewardInfoMap { blockReward := rewards.BlockReward.String() epochReward := rewards.EpochReward.String() foundationBonus := rewards.FoundationBonus.String() var candidateName string // If more than one candidates share the same reward address, just use the first candidate as their delegate if len(p.RewardAddrToName[rewardAddress]) > 0 { candidateName = p.RewardAddrToName[rewardAddress][0] } valStrs = append(valStrs, "(?, ?, ?, ?, CAST(? as DECIMAL(65, 0)), CAST(? as DECIMAL(65, 0)), CAST(? as DECIMAL(65, 0)))") valArgs = append(valArgs, epochNumber, actionHash, rewardAddress, candidateName, blockReward, epochReward, foundationBonus) } insertQuery := fmt.Sprintf(insertRewardHistory, RewardHistoryTableName, strings.Join(valStrs, ",")) if _, err := tx.Exec(insertQuery, valArgs...); err != nil { return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *MemoryRewardStorage) Update(reward rewards.Reward) {\n\tfor index, r := range m.rewards {\n\t\tif r.ID == reward.ID {\n\t\t\tm.rewards[index] = reward\n\t\t}\n\t}\n}", "func (_Token *TokenSession) BaseRewardHistory(index *big.Int) (*big.Int, *big.Int, *big.Int, *big.Int, error) {\n\treturn _Token.Contra...
[ "0.60458004", "0.5921379", "0.5813828", "0.5810859", "0.5760177", "0.5708256", "0.55621254", "0.5539769", "0.5532216", "0.5519636", "0.54246104", "0.54080886", "0.53458893", "0.53254765", "0.53176856", "0.5306303", "0.527214", "0.52710384", "0.5270779", "0.52167344", "0.52020...
0.8028916
0
stringToBigInt transforms a string to big int
func stringToBigInt(estr string) (*big.Int, error) { ret, ok := big.NewInt(0).SetString(estr, 10) if !ok { return nil, errors.New("failed to parse string to big int") } return ret, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func stringToBigInt(stringValue string) *big.Int {\n\n\tintToReturn := big.NewInt(0)\n\tintToReturn.SetString(stringValue, 10)\n\n\treturn intToReturn\n}", "func HexStrToBigInt(s string) (*big.Int, error) {\n\tregstr := \"^0[xX][0-9a-fA-F]+$\"\n\tif matched, err := regexp.Match(regstr, []byte(s)); err != nil || ...
[ "0.8503275", "0.8007486", "0.7599278", "0.74680173", "0.74680173", "0.73421395", "0.70222", "0.6859304", "0.68342394", "0.6643473", "0.6609426", "0.6585258", "0.6492842", "0.63858724", "0.6366537", "0.63351583", "0.631695", "0.6280062", "0.62524414", "0.6239087", "0.6191838",...
0.8299093
1
NewStorageReader creates a new instance of StorageReader
func NewStorageReader(accountName, accountKey, containerName string) (*StorageReader, error) { logp.Debug( "storage_reader", "Creating new instance of storage reader", ) c := &Config{ accountName: accountName, accountKey: accountKey, containerName: containerName, } sr := &StorageReader{ config: c, } err := sr.initialize() if err != nil { return nil, err } return sr, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func StorageReader(storage StorageAPI, volume, path string, offset int64) io.Reader {\n\treturn &storageReader{storage, volume, path, offset}\n}", "func newStorage() *storage {\n\tr := make(map[string][]byte)\n\treturn &storage{\n\t\trepository: r,\n\t}\n}", "func NewReader(r io.Reader) io.Reader {\n return...
[ "0.7486464", "0.6991443", "0.6769339", "0.6694343", "0.6630447", "0.6618453", "0.65807104", "0.65728444", "0.65710235", "0.6547296", "0.6508507", "0.6461586", "0.64510155", "0.6447975", "0.64442575", "0.643639", "0.64106154", "0.64028615", "0.64025176", "0.6393443", "0.638589...
0.77779114
0
ListBlobsModifiedBetween Get list of blobs modified between two specified timestamps
func (sr *StorageReader) ListBlobsModifiedBetween(startTime, endTime int64) *[]BlobDetails { logp.Debug("storage_reader", "Listing blobs modified between %v and %v.", startTime, endTime) ctx := context.Background() var blobItems []BlobDetails i := 0 for marker := (azblob.Marker{}); marker.NotDone(); { listBlob, err := sr.container.ListBlobsFlatSegment(ctx, marker, azblob.ListBlobsSegmentOptions{}) marker = listBlob.NextMarker if err != nil { logp.Error(err) continue } for _, blobInfo := range listBlob.Segment.BlobItems { i++ lastModified := blobInfo.Properties.LastModified.UTC().Unix() if lastModified > startTime && lastModified < endTime { length := *blobInfo.Properties.ContentLength if length == int64(0) { continue } blobItems = append(blobItems, NewBlobDetails(blobInfo.Name, string(blobInfo.Properties.Etag), length, lastModified)) } } } logp.Info("Found %v blobs in container. Found %v blobs modified between %v and %v.", i, len(blobItems), startTime, endTime, ) return &blobItems }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (w *Wallet) ListSinceBlock(start, end, syncHeight int32) ([]btcjson.ListTransactionsResult, er.R) {\n\ttxList := []btcjson.ListTransactionsResult{}\n\terr := walletdb.View(w.db, func(tx walletdb.ReadTx) er.R {\n\t\ttxmgrNs := tx.ReadBucket(wtxmgrNamespaceKey)\n\n\t\trangeFn := func(details []wtxmgr.TxDetails)...
[ "0.5353702", "0.50202537", "0.4984611", "0.49060214", "0.4898732", "0.4884065", "0.48787692", "0.48241475", "0.48237765", "0.47981906", "0.47307202", "0.47307202", "0.47245994", "0.4690016", "0.4667888", "0.46565905", "0.46333495", "0.45517814", "0.45401368", "0.4535804", "0....
0.8394095
0
ReadBlobData Reads blob from specified starting location
func (sr *StorageReader) ReadBlobData(path string, startIndex, length int64) []byte { ctx := context.Background() blobURL := sr.container.NewBlockBlobURL(path) downloadResponse, err := blobURL.Download(ctx, startIndex, length, azblob.BlobAccessConditions{}, false) logp.Info("Attempting to download blob %s at %v", path, startIndex) bodyStream := downloadResponse.Body(azblob.RetryReaderOptions{MaxRetryRequests: 10}) downloadedData := bytes.Buffer{} _, err = downloadedData.ReadFrom(bodyStream) if err != nil { panic(err) } return downloadedData.Bytes() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ReadBlob(length int32, data []byte) ([]byte, int64) {\n\tl := length\n\tif length > int32(len(data)) {\n\t\tl = int32(len(data))\n\t}\n\n\tvar idx int32\n\tfor idx = l; (idx % 4) != 0; idx++ {\n\t\tif idx >= int32(len(data)) {\n\t\t\tdata = append(data, 0)\n\t\t}\n\t}\n\treturn data[:idx], int64(idx)\n}", "...
[ "0.7054809", "0.6706905", "0.6526644", "0.6507054", "0.6507054", "0.64965016", "0.6126463", "0.6124615", "0.6026566", "0.6013546", "0.5956357", "0.59294546", "0.5917369", "0.58980083", "0.58980083", "0.5863768", "0.58041257", "0.5774745", "0.5771428", "0.565637", "0.5630689",...
0.73583215
0
Returns true if the key is supported, false if it wasn't.
func (r *Response) Supported() bool { return !strings.Contains(r.String(), NotSupported) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func isSupported(key ssh.PublicKey) bool {\n\t_, ok := supportedKeyTypesMap[key.Type()]\n\treturn ok\n}", "func Supported() bool {\n\treturn gobool(C.keybinder_supported())\n}", "func KeyIsSuitable(key []byte) bool {\n\treturn subtle.ConstantTimeEq(int32(len(key)), int32(KeySize)) == 1\n}", "func Supported(v...
[ "0.7739214", "0.7222214", "0.6585144", "0.6423749", "0.639911", "0.6383442", "0.63143355", "0.62209886", "0.62209886", "0.6198825", "0.6188862", "0.6180553", "0.6123782", "0.61136216", "0.6100996", "0.6090964", "0.6056407", "0.6042656", "0.60423505", "0.6014734", "0.59600395"...
0.5702351
49
Convenience wrapper to return Response.Data as a string.
func (r *Response) String() string { return string(r.Data) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r Response) String() string {\n\tJSON, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn string(JSON)\n}", "func (r *Response) String() string {\n\tif r.Error != nil {\n\t\treturn \"\"\n\t}\n\n\tr.populateResponseByteBuffer()\n\n\treturn r.internalByteBuffer.String()\n}", "fu...
[ "0.65663695", "0.6464477", "0.63433754", "0.62904406", "0.62059665", "0.6119778", "0.6021124", "0.6019827", "0.5965781", "0.5939541", "0.5917699", "0.5897104", "0.58647394", "0.5861402", "0.5832401", "0.5828792", "0.57842326", "0.57667345", "0.5754301", "0.56678456", "0.56670...
0.75903463
0
Convenience wrapper to return Response.Data as a bool.
func (r *Response) Bool() (bool, error) { return strconv.ParseBool(r.String()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (res Response) AsBool() (bool, error) {\n\treturn res.Bits.AsBool(), res.Error\n}", "func (client PrimitiveClient) GetBoolResponder(resp *http.Response) (result BooleanWrapper, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnles...
[ "0.59523034", "0.5925134", "0.5816356", "0.571438", "0.56353575", "0.55800897", "0.55623347", "0.55264825", "0.5524063", "0.55136734", "0.5495956", "0.5488293", "0.5482601", "0.545401", "0.5432316", "0.53984827", "0.53884727", "0.5387247", "0.5371247", "0.5367065", "0.536553"...
0.58634365
2
Convenience wrapper to return Response.Data as an int.
func (r *Response) Int() (int, error) { return strconv.Atoi(r.String()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (res Response) AsInt() (int, error) {\n\treturn res.Bits.AsInt(), res.Error\n}", "func (r *Decoder) Int() int { x := r.Int64(); v := int(x); assert(int64(v) == x); return v }", "func GetInt64Data(response *bcsmonitor.QueryResponse) int64 {\n\tif len(response.Data.Result) == 0 {\n\t\treturn 0\n\t}\n\tvalue...
[ "0.6555175", "0.6241124", "0.61665976", "0.5970528", "0.5872309", "0.5627681", "0.5596786", "0.55721736", "0.55685365", "0.5532696", "0.55013376", "0.5430772", "0.5414721", "0.5408866", "0.5398135", "0.53445405", "0.5334568", "0.53330725", "0.5322254", "0.52992433", "0.528896...
0.6545365
1
Convenience wrapper to return Response.Data as an int64.
func (r *Response) Int64() (int64, error) { return strconv.ParseInt(r.String(), 10, 64) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetInt64Data(response *bcsmonitor.QueryResponse) int64 {\n\tif len(response.Data.Result) == 0 {\n\t\treturn 0\n\t}\n\tvalueStr, ok := response.Data.Result[0].Value[1].(string)\n\tif !ok {\n\t\treturn 0\n\t}\n\tvalue, err := strconv.ParseInt(valueStr, 10, 64)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn val...
[ "0.7620368", "0.6956235", "0.6308384", "0.60723186", "0.5968573", "0.5942842", "0.59171957", "0.5859009", "0.5852559", "0.5840035", "0.5835712", "0.5815407", "0.57881236", "0.5754577", "0.5732076", "0.57312083", "0.56497526", "0.5623139", "0.5620109", "0.5567401", "0.55656445...
0.6651416
2
Convenience wrapper to return Response.Data as an float64.
func (r *Response) Float64() (float64, error) { return strconv.ParseFloat(r.String(), 64) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetFloatData(response *bcsmonitor.QueryResponse) float64 {\n\tif len(response.Data.Result) == 0 {\n\t\treturn 0\n\t}\n\tvalueStr, ok := response.Data.Result[0].Value[1].(string)\n\tif !ok {\n\t\treturn 0\n\t}\n\tvalue, err := strconv.ParseFloat(valueStr, 64)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn val...
[ "0.7289144", "0.63614255", "0.61734873", "0.6018624", "0.5833616", "0.58181524", "0.57975155", "0.5772632", "0.576887", "0.57428145", "0.57083213", "0.5594193", "0.55241936", "0.546558", "0.54640913", "0.54607713", "0.5460503", "0.54176515", "0.5403042", "0.5389518", "0.53746...
0.61657727
3
/ Convert Response.Data to the most appropriate type. Useful when you want a concrete type but don't know it ahead of time.
func (r *Response) Interface() interface{} { // Attempt int64 i, err := strconv.ParseInt(r.String(), 10, 64) if err == nil { return i } // Attempt float64 f, err := strconv.ParseFloat(r.String(), 64) if err == nil { return f } // Attempt bool b, err := strconv.ParseBool(r.String()) if err == nil { return b } return r.String() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ctx *impl) Data(obj interface{}) (rsp []byte, err error) {\n\tvar (\n\t\treq *bytes.Buffer\n\t\twritten int64\n\t\tct string\n\t)\n\n\tif ctx.Request == nil {\n\t\trsp, err = ctx.DataError(\"net/http is nil, can't retrieve data\")\n\t\treturn\n\t}\n\treq = &bytes.Buffer{}\n\t// Получение запроса\n\t...
[ "0.6067754", "0.6017849", "0.5930762", "0.57525027", "0.5741373", "0.5659038", "0.565784", "0.5640045", "0.5633768", "0.55646974", "0.5547578", "0.55453074", "0.55345553", "0.5497515", "0.5489349", "0.5478702", "0.54747427", "0.543881", "0.53859806", "0.5373251", "0.5371848",...
0.5069115
45
Create a new Response type
func newResponse() *Response { return &Response{ // Header is always 5 bytes Header: make([]byte, 5), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newResponse(r *http.Response) *Response {\n\tresponse := Response{Response: r}\n\n\treturn &response\n}", "func newResponse(r *http.Response) *Response {\n\treturn &Response{Response: r}\n}", "func newResponse(r *http.Response) *Response {\n\tresponse := &Response{Response: r}\n\treturn response\n}", "f...
[ "0.69555134", "0.6907398", "0.686758", "0.686758", "0.686758", "0.6756983", "0.672033", "0.6685266", "0.66744035", "0.66368026", "0.6636733", "0.66237515", "0.6606498", "0.6605905", "0.6589414", "0.6578238", "0.6569864", "0.65480584", "0.6515209", "0.65057844", "0.6501976", ...
0.66314137
11
Serve sets up the server and listens for requests
func Serve(ctx context.Context, serviceName string, options ...ServerOption) error { var err error // Setup the server options serverOptions := &serverOptions{ serviceName: serviceName, log: log.WithField("service", serviceName), } options = append([]ServerOption{ WithServerConfig(ServerConfig{ Bind: "0.0.0.0", Listen: 5000, TLS: TLSConfig{}, }), WithHealthCheck(nil), WithPrometheusMetrics(), }, options...) // Process all server options (which may override any of the above) for _, option := range options { err = option.apply(ctx, serverOptions) if err != nil { return err } } handlers := &handlerHeap{} heap.Init(handlers) for _, option := range options { err = option.addHandler(ctx, serverOptions, handlers) if err != nil { return err } } // Create the HTTP server mux := http.NewServeMux() for handlers.Len() > 0 { pair := heap.Pop(handlers).(*handlerPair) serverOptions.log.WithField("endpoint", pair.pattern).Info("adding handler") mux.Handle(pair.pattern, pair.handler) } w := log.Writer() defer w.Close() // Start listening serverOptions.log.Info("listening") ln, err := net.Listen("tcp", serverOptions.addr) if err != nil { return err } // Serve requests if serverOptions.config.GetTLS().GetEnabled() { serverOptions.log.Trace("loading server tls certs") config, err := NewServerTLSConfig(serverOptions.config.GetTLS(), serverOptions.vault) if err != nil { ln.Close() return err } ln = tls.NewListener(ln, config) } defer ln.Close() serverOptions.log.Info("serving") srv := &http.Server{ Addr: serverOptions.addr, Handler: mux, ErrorLog: syslog.New(w, "[http]", 0), } return srv.Serve(ln) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func serve() error {\n\n\trouter := configureRoutes()\n\n\thttp.Handle(\"/\", router)\n\n\t// Define port and set to default if environment variable is not set\n\tport := PORT\n\tif len(os.Getenv(\"GO_PORT\")) > 0 {\n\t\tport = os.Getenv(\"GO_PORT\")\n\t}\n\n\tlogger.Info(\"Initiating HTTP Server on Port %v\", por...
[ "0.7704274", "0.75560105", "0.7507622", "0.7234669", "0.7211", "0.71590436", "0.7141204", "0.71229917", "0.7110679", "0.7095706", "0.70953053", "0.7070322", "0.70478725", "0.70459193", "0.7036709", "0.70193183", "0.6962676", "0.69522464", "0.69483596", "0.69476694", "0.693784...
0.6517445
90
NewPolicyDefinitionsClient creates a new instance of PolicyDefinitionsClient with the specified values.
func NewPolicyDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PolicyDefinitionsClient { cp := arm.ClientOptions{} if options != nil { cp = *options } if len(cp.Host) == 0 { cp.Host = arm.AzurePublicCloud } return &PolicyDefinitionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewRegistrationDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RegistrationDefinitionsClient, error) {\n\tcl, err := arm.NewClient(moduleName+\".RegistrationDefinitionsClient\", moduleVersion, credential, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := &Re...
[ "0.5942576", "0.573209", "0.57141393", "0.54691076", "0.53663653", "0.5332414", "0.5331938", "0.53184956", "0.53092986", "0.52872276", "0.5274721", "0.52648884", "0.52600336", "0.5255136", "0.5240479", "0.52287835", "0.51977056", "0.5182397", "0.51636803", "0.5156131", "0.511...
0.80434936
0
createOrUpdateCreateRequest creates the CreateOrUpdate request.
func (client *PolicyDefinitionsClient) createOrUpdateCreateRequest(ctx context.Context, policyDefinitionName string, parameters PolicyDefinition, options *PolicyDefinitionsCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}" if policyDefinitionName == "" { return nil, errors.New("parameter policyDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{policyDefinitionName}", url.PathEscape(policyDefinitionName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *RoleDefinitionsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, roleDefinitionID string, roleDefinition RoleDefinition, options *RoleDefinitionsCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefin...
[ "0.716981", "0.6974975", "0.69614655", "0.6951513", "0.69285613", "0.68497676", "0.6784493", "0.67738926", "0.6750997", "0.67280304", "0.6690952", "0.6675086", "0.6671258", "0.6670252", "0.664669", "0.6608871", "0.6569229", "0.65341884", "0.6533084", "0.647038", "0.6438516", ...
0.7014643
1
createOrUpdateHandleResponse handles the CreateOrUpdate response.
func (client *PolicyDefinitionsClient) createOrUpdateHandleResponse(resp *http.Response) (PolicyDefinitionsCreateOrUpdateResponse, error) { result := PolicyDefinitionsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyDefinition); err != nil { return PolicyDefinitionsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *ActionsClient) createOrUpdateHandleResponse(resp *http.Response) (ActionsClientCreateOrUpdateResponse, error) {\n\tresult := ActionsClientCreateOrUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ActionResponse); err != nil {\n\t\treturn ActionsClientCreateOrUpdateResponse{}, err\n\...
[ "0.77074736", "0.76244164", "0.7601424", "0.75650877", "0.7548688", "0.7540541", "0.75193167", "0.73697567", "0.73658377", "0.730312", "0.72981757", "0.7290304", "0.7289147", "0.7269985", "0.7257409", "0.72332484", "0.7225668", "0.7180523", "0.71755373", "0.7170585", "0.71641...
0.7500699
7
createOrUpdateAtManagementGroupCreateRequest creates the CreateOrUpdateAtManagementGroup request.
func (client *PolicyDefinitionsClient) createOrUpdateAtManagementGroupCreateRequest(ctx context.Context, policyDefinitionName string, managementGroupID string, parameters PolicyDefinition, options *PolicyDefinitionsCreateOrUpdateAtManagementGroupOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}" if policyDefinitionName == "" { return nil, errors.New("parameter policyDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{policyDefinitionName}", url.PathEscape(policyDefinitionName)) if managementGroupID == "" { return nil, errors.New("parameter managementGroupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *GroupClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters, options *GroupCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupNa...
[ "0.5988593", "0.5798292", "0.5685915", "0.558678", "0.5551827", "0.5526636", "0.54961526", "0.5459959", "0.54404885", "0.5392508", "0.5279132", "0.5272559", "0.5239537", "0.5215954", "0.5215764", "0.51848537", "0.51664686", "0.5060169", "0.505902", "0.5002327", "0.49339387", ...
0.7278163
0
createOrUpdateAtManagementGroupHandleResponse handles the CreateOrUpdateAtManagementGroup response.
func (client *PolicyDefinitionsClient) createOrUpdateAtManagementGroupHandleResponse(resp *http.Response) (PolicyDefinitionsCreateOrUpdateAtManagementGroupResponse, error) { result := PolicyDefinitionsCreateOrUpdateAtManagementGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyDefinition); err != nil { return PolicyDefinitionsCreateOrUpdateAtManagementGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *GroupClient) createOrUpdateHandleResponse(resp *http.Response) (GroupCreateOrUpdateResponse, error) {\n\tresult := GroupCreateOrUpdateResponse{RawResponse: resp}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Group...
[ "0.64995533", "0.6087047", "0.59565717", "0.577954", "0.5716804", "0.56633455", "0.5627714", "0.5607213", "0.55736977", "0.55376047", "0.5450639", "0.5443918", "0.532295", "0.52404857", "0.5232235", "0.52103275", "0.5207438", "0.5142607", "0.51312053", "0.5121249", "0.5118213...
0.7587764
0
deleteCreateRequest creates the Delete request.
func (client *PolicyDefinitionsClient) deleteCreateRequest(ctx context.Context, policyDefinitionName string, options *PolicyDefinitionsDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}" if policyDefinitionName == "" { return nil, errors.New("parameter policyDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{policyDefinitionName}", url.PathEscape(policyDefinitionName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *FactoriesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, factoryName string, options *FactoriesClientDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{facto...
[ "0.76320505", "0.7584632", "0.75717694", "0.7566521", "0.7531389", "0.75282", "0.7505947", "0.7504906", "0.7492394", "0.7492235", "0.74904436", "0.7432695", "0.7426466", "0.74185693", "0.7404809", "0.73585665", "0.7352774", "0.7342807", "0.7289017", "0.72818315", "0.7280017",...
0.7662335
0
deleteAtManagementGroupCreateRequest creates the DeleteAtManagementGroup request.
func (client *PolicyDefinitionsClient) deleteAtManagementGroupCreateRequest(ctx context.Context, policyDefinitionName string, managementGroupID string, options *PolicyDefinitionsDeleteAtManagementGroupOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}" if policyDefinitionName == "" { return nil, errors.New("parameter policyDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{policyDefinitionName}", url.PathEscape(policyDefinitionName)) if managementGroupID == "" { return nil, errors.New("parameter managementGroupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CreateDeleteCorpGroupRequest() (request *DeleteCorpGroupRequest) {\n\trequest = &DeleteCorpGroupRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Vcs\", \"2020-05-15\", \"DeleteCorpGroup\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *GroupCli...
[ "0.6350999", "0.6210928", "0.6089093", "0.6042023", "0.6032062", "0.6019282", "0.59526217", "0.5916635", "0.5828889", "0.58183795", "0.58183795", "0.5775107", "0.56965506", "0.5609115", "0.56069195", "0.55307055", "0.55185777", "0.5498397", "0.54778063", "0.54416555", "0.5410...
0.782387
0
getCreateRequest creates the Get request.
func (client *PolicyDefinitionsClient) getCreateRequest(ctx context.Context, policyDefinitionName string, options *PolicyDefinitionsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}" if policyDefinitionName == "" { return nil, errors.New("parameter policyDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{policyDefinitionName}", url.PathEscape(policyDefinitionName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *UserMetricsKeysClient) getCreateRequest(ctx context.Context, options *UserMetricsKeysClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, ...
[ "0.7216396", "0.7151208", "0.71419024", "0.7099855", "0.7065104", "0.70532906", "0.70396507", "0.70303977", "0.7029218", "0.7008257", "0.69958997", "0.6993072", "0.6982644", "0.69472474", "0.69467354", "0.69425017", "0.69257015", "0.6924219", "0.6909365", "0.69073766", "0.689...
0.69831
12
getHandleResponse handles the Get response.
func (client *PolicyDefinitionsClient) getHandleResponse(resp *http.Response) (PolicyDefinitionsGetResponse, error) { result := PolicyDefinitionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyDefinition); err != nil { return PolicyDefinitionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *LiveOutputsClient) getHandleResponse(resp *http.Response) (LiveOutputsClientGetResponse, error) {\n\tresult := LiveOutputsClientGetResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.LiveOutput); err != nil {\n\t\treturn LiveOutputsClientGetResponse{}, err\n\t}\n\treturn result, nil\n}", ...
[ "0.7495375", "0.74194175", "0.7407496", "0.73024285", "0.7190589", "0.71616685", "0.7149459", "0.7110431", "0.7099549", "0.7077434", "0.7042537", "0.7032869", "0.7018246", "0.6996379", "0.69687", "0.6964784", "0.69636226", "0.6963067", "0.6956996", "0.69501376", "0.69436526",...
0.67575526
46
getAtManagementGroupCreateRequest creates the GetAtManagementGroup request.
func (client *PolicyDefinitionsClient) getAtManagementGroupCreateRequest(ctx context.Context, policyDefinitionName string, managementGroupID string, options *PolicyDefinitionsGetAtManagementGroupOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}" if policyDefinitionName == "" { return nil, errors.New("parameter policyDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{policyDefinitionName}", url.PathEscape(policyDefinitionName)) if managementGroupID == "" { return nil, errors.New("parameter managementGroupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *PolicyDefinitionsClient) listByManagementGroupCreateRequest(ctx context.Context, managementGroupID string, options *PolicyDefinitionsListByManagementGroupOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Author...
[ "0.6663986", "0.6623923", "0.6412561", "0.6097547", "0.6086163", "0.6060779", "0.60292196", "0.5974149", "0.5945237", "0.5898692", "0.58942294", "0.58754694", "0.5872743", "0.5866616", "0.5856541", "0.58479375", "0.5844044", "0.58033", "0.5794953", "0.57581514", "0.57564795",...
0.77720493
0
getAtManagementGroupHandleResponse handles the GetAtManagementGroup response.
func (client *PolicyDefinitionsClient) getAtManagementGroupHandleResponse(resp *http.Response) (PolicyDefinitionsGetAtManagementGroupResponse, error) { result := PolicyDefinitionsGetAtManagementGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyDefinition); err != nil { return PolicyDefinitionsGetAtManagementGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *PolicyDefinitionsClient) listByManagementGroupHandleResponse(resp *http.Response) (PolicyDefinitionsListByManagementGroupResponse, error) {\n\tresult := PolicyDefinitionsListByManagementGroupResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.PolicyDefinitionListResult); er...
[ "0.66376185", "0.6585092", "0.64261913", "0.6391692", "0.6382366", "0.63312274", "0.63303494", "0.6312258", "0.63077897", "0.62958425", "0.6260882", "0.62083423", "0.6203065", "0.61537623", "0.6131575", "0.61313987", "0.61255515", "0.61254406", "0.6121473", "0.61212695", "0.6...
0.7855107
0
getBuiltInCreateRequest creates the GetBuiltIn request.
func (client *PolicyDefinitionsClient) getBuiltInCreateRequest(ctx context.Context, policyDefinitionName string, options *PolicyDefinitionsGetBuiltInOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}" if policyDefinitionName == "" { return nil, errors.New("parameter policyDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{policyDefinitionName}", url.PathEscape(policyDefinitionName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *PolicyDefinitionsClient) listBuiltInCreateRequest(ctx context.Context, options *PolicyDefinitionsListBuiltInOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Authorization/policyDefinitions\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, ur...
[ "0.71907246", "0.6112511", "0.607343", "0.6039145", "0.6004508", "0.60000503", "0.5975623", "0.596344", "0.5930511", "0.5888355", "0.5842194", "0.58329374", "0.58214843", "0.58069664", "0.5786372", "0.57797956", "0.5777607", "0.5739794", "0.5726773", "0.5718954", "0.57172954"...
0.77959424
0
getBuiltInHandleResponse handles the GetBuiltIn response.
func (client *PolicyDefinitionsClient) getBuiltInHandleResponse(resp *http.Response) (PolicyDefinitionsGetBuiltInResponse, error) { result := PolicyDefinitionsGetBuiltInResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyDefinition); err != nil { return PolicyDefinitionsGetBuiltInResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *PolicyDefinitionsClient) listBuiltInHandleResponse(resp *http.Response) (PolicyDefinitionsListBuiltInResponse, error) {\n\tresult := PolicyDefinitionsListBuiltInResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.PolicyDefinitionListResult); err != nil {\n\t\treturn PolicyD...
[ "0.76707584", "0.621644", "0.617529", "0.6060703", "0.60193557", "0.59729016", "0.5909901", "0.5874821", "0.5868759", "0.5813757", "0.57856905", "0.5783472", "0.57720095", "0.5766566", "0.57617915", "0.5760955", "0.57606834", "0.5749354", "0.57492363", "0.572956", "0.5728529"...
0.8222317
0
listCreateRequest creates the List request.
func (client *PolicyDefinitionsClient) listCreateRequest(ctx context.Context, options *PolicyDefinitionsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-06-01") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() unencodedParams := []string{req.Raw().URL.RawQuery} if options != nil && options.Filter != nil { unencodedParams = append(unencodedParams, "$filter="+*options.Filter) } req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") req.Raw().Header.Set("Accept", "application/json") return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewListRequest() *todopb.ListRequest {\n\tmessage := &todopb.ListRequest{}\n\treturn message\n}", "func (client *KustoOperationsClient) listCreateRequest(ctx context.Context, options *KustoOperationsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Synapse/kustooperations\"\...
[ "0.78801435", "0.75768954", "0.75035113", "0.74889725", "0.7465826", "0.74646765", "0.7455195", "0.743538", "0.74343836", "0.7423846", "0.73989666", "0.7356956", "0.73457086", "0.73375124", "0.73339075", "0.7325205", "0.73243415", "0.7319237", "0.7268763", "0.7210874", "0.720...
0.7192149
21
listHandleResponse handles the List response.
func (client *PolicyDefinitionsClient) listHandleResponse(resp *http.Response) (PolicyDefinitionsListResponse, error) { result := PolicyDefinitionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyDefinitionListResult); err != nil { return PolicyDefinitionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *LiveOutputsClient) listHandleResponse(resp *http.Response) (LiveOutputsClientListResponse, error) {\n\tresult := LiveOutputsClientListResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.LiveOutputListResult); err != nil {\n\t\treturn LiveOutputsClientListResponse{}, err\n\t}\n\treturn resul...
[ "0.79782814", "0.7962708", "0.7869895", "0.7809686", "0.78079766", "0.78077203", "0.77588916", "0.77508783", "0.77483225", "0.7747638", "0.77462274", "0.77179635", "0.7717475", "0.7716036", "0.7704544", "0.76879525", "0.7673159", "0.7667837", "0.76593477", "0.76441395", "0.76...
0.7666352
18
listBuiltInCreateRequest creates the ListBuiltIn request.
func (client *PolicyDefinitionsClient) listBuiltInCreateRequest(ctx context.Context, options *PolicyDefinitionsListBuiltInOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Authorization/policyDefinitions" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-06-01") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() unencodedParams := []string{req.Raw().URL.RawQuery} if options != nil && options.Filter != nil { unencodedParams = append(unencodedParams, "$filter="+*options.Filter) } req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") req.Raw().Header.Set("Accept", "application/json") return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *SapMonitorsClient) listCreateRequest(ctx context.Context, options *SapMonitorsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.HanaOnAzure/sapMonitors\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter clien...
[ "0.60232586", "0.5982126", "0.5869841", "0.5857119", "0.5838637", "0.5705415", "0.56493896", "0.56372064", "0.5619246", "0.5618151", "0.56148225", "0.56142336", "0.5599064", "0.55896854", "0.5574594", "0.55553883", "0.55527395", "0.5521917", "0.5519978", "0.5480475", "0.54769...
0.7813031
0
listBuiltInHandleResponse handles the ListBuiltIn response.
func (client *PolicyDefinitionsClient) listBuiltInHandleResponse(resp *http.Response) (PolicyDefinitionsListBuiltInResponse, error) { result := PolicyDefinitionsListBuiltInResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyDefinitionListResult); err != nil { return PolicyDefinitionsListBuiltInResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *PolicyDefinitionsClient) getBuiltInHandleResponse(resp *http.Response) (PolicyDefinitionsGetBuiltInResponse, error) {\n\tresult := PolicyDefinitionsGetBuiltInResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.PolicyDefinition); err != nil {\n\t\treturn PolicyDefinitionsGet...
[ "0.7082903", "0.65406626", "0.6517782", "0.6450229", "0.6407186", "0.6368368", "0.6320369", "0.626896", "0.62285346", "0.6223435", "0.6213455", "0.62095153", "0.61994046", "0.617806", "0.6167983", "0.6167837", "0.6165637", "0.6164217", "0.6158206", "0.61385083", "0.6090056", ...
0.85405135
0
listByManagementGroupCreateRequest creates the ListByManagementGroup request.
func (client *PolicyDefinitionsClient) listByManagementGroupCreateRequest(ctx context.Context, managementGroupID string, options *PolicyDefinitionsListByManagementGroupOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions" if managementGroupID == "" { return nil, errors.New("parameter managementGroupID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-06-01") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() unencodedParams := []string{req.Raw().URL.RawQuery} if options != nil && options.Filter != nil { unencodedParams = append(unencodedParams, "$filter="+*options.Filter) } req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") req.Raw().Header.Set("Accept", "application/json") return req, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *MonitorsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *MonitorsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors\"\n\tif...
[ "0.69496083", "0.6796391", "0.67800164", "0.67291677", "0.6685094", "0.65846455", "0.65812635", "0.6464833", "0.64444846", "0.64438474", "0.6417571", "0.6413473", "0.6367035", "0.6345273", "0.6328532", "0.6325075", "0.63092667", "0.6294302", "0.6265202", "0.6218708", "0.62121...
0.78612286
0
listByManagementGroupHandleResponse handles the ListByManagementGroup response.
func (client *PolicyDefinitionsClient) listByManagementGroupHandleResponse(resp *http.Response) (PolicyDefinitionsListByManagementGroupResponse, error) { result := PolicyDefinitionsListByManagementGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyDefinitionListResult); err != nil { return PolicyDefinitionsListByManagementGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client UsageDetailsClient) ListByManagementGroupResponder(resp *http.Response) (result UsageDetailsListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosin...
[ "0.7555561", "0.70824856", "0.70370066", "0.70273715", "0.7022419", "0.70222783", "0.70171577", "0.6928565", "0.6868567", "0.6856361", "0.6823024", "0.6822074", "0.68173724", "0.6772575", "0.677189", "0.67256725", "0.67240644", "0.67218256", "0.6714559", "0.67127115", "0.6708...
0.8073399
0