anchor stringlengths 10 14.3k | positive stringlengths 10 14.9k |
|---|---|
IsScriptRenderDelaying returns true if the node has one of these values for attribute 'customelement': ampdynamiccssclasses, ampexperiment, ampstory. | func IsScriptRenderDelaying(n *html.Node) bool {
if n.DataAtom != atom.Script {
return false
}
if IsScriptAMPViewer(n) {
return true
}
if v, ok := htmlnode.GetAttributeVal(n, "", AMPCustomElement); ok {
// TODO(b/77581738): Remove amp-story from this list.
return (v == AMPDynamicCSSClasses ||
v == AMPEx... |
createContext creates a new context based on transactionId, actionId, actionName, threadId, threadName, ProcessName | func createContext(transactionID, actionID, actionName, threadID, threadName, ProcessName string) context.Context {
ctx := context.Background()
ctx = context.WithValue(ctx, common.TransactionID, transactionID)
ctx = context.WithValue(ctx, common.ActionID, actionID)
ctx = context.WithValue(ctx, common.ActionName, ac... |
ToPatchRequestInformation update the navigation property journalLines in financials | func (m *CompaniesItemJournalsItemJournalLinesJournalLineItemRequestBuilder) ToPatchRequestInformation(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.JournalLineable, requestConfiguration *CompaniesItemJournalsItemJournalLinesJournalLineItemRequestBuilderPatchRequestConfigur... |
ShortNames implements the ShortNamesProvider interface. Returns a list of short names for a resource. | func (r *REST) ShortNames() []string {
return []string{"pvc"}
} |
IsNativeResource returns true if the resource name is in the kubernetes.io/ namespace. Partiallyqualified (unprefixed) names are implicitly in the kubernetes.io/ namespace. | func IsNativeResource(name corev1.ResourceName) bool {
return !strings.Contains(string(name), "/") ||
strings.Contains(string(name), corev1.ResourceDefaultNamespacePrefix)
} |
Serialize serializes information the current object | func (m *ManagementTemplateStepTenantSummary) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
err := m.Entity.Serialize(writer)
if err != nil {
return err
}
{
err = writer.WriteInt32Value("assignedTenantsCount", m.GetAssign... |
Status used to set new status of record domain: Domain name recordID:The specified record ID that you want to get information enable:Status of the record to set, if incoming false, parsing does not take effect. | func (p *RecordAPI) Status(domain string, recordID int64, enable Enable) (err error) {
params := url.Values{}
params.Set("login_token", p.loginToken)
params.Set("format", "json")
params.Set("domain", domain)
params.Set("record_id", strconv.FormatInt(recordID, 10))
params.Set("status", enable.String())
res, err... |
Get returns expanded value of section's option. Panics if section or option are not found or if there's any Eval error. | func Get(section, option string) string {
return cfg.Get(section, option)
} |
Where adds a new predicate for the InstanceRuntimeQuery builder. | func (irq *InstanceRuntimeQuery) Where(ps ...predicate.InstanceRuntime) *InstanceRuntimeQuery {
irq.predicates = append(irq.predicates, ps...)
return irq
} |
DeleteAlbum will delete a given album | func DeleteAlbum(albumDeleteHash string, clientID string) {
url := "https://api.imgur.com/3/album/" + albumDeleteHash
method := "DELETE"
payload := &bytes.Buffer{}
writer := multipart.NewWriter(payload)
err := writer.Close()
if err != nil {
fmt.Println(err)
}
client := &http.Client{}
req, err := http.NewRe... |
WaitTime sets the basic wait time | func (r *Retry) WaitTime(waitTime time.Duration) dataflow.Retry {
r.waitTime = waitTime
return r
} |
how many paths from idx to the end? | func pathsFrom(idx int) int {
// are we already at the end? there's only one path then.
if idx == len(numbers)-1 {
return 1
}
// did we already calculate the paths from idx to the end? not calculate
// again.
paths, alreadyCalculated := pathsFromIndex[idx]
if alreadyCalculated {
return paths
}
for nxt :=... |
HasInterval returns a boolean if a field has been set. | func (o *ActionRunStatsInputProperties) HasInterval() bool {
if o != nil && o.Interval != nil {
return true
}
return false
} |
LoadUserLoggedProfile Load the user profile | func LoadUserLoggedProfile(w http.ResponseWriter, r *http.Request) {
cookie, _ := cookies.Read(r)
userID, _ := strconv.ParseUint(cookie["id"], 10, 64)
user, err := models.SearchCompleteUser(userID, r)
if err != nil {
responses.JSON(w, http.StatusInternalServerError, responses.ErrorAPI{Err: err.Error()})
return... |
EngineClient returns a client to the Unsure Engine. | func (s *State) EngineClient() engine.Client {
return s.engineClient
} |
marshalStationviewsStationUploadViewToStationUploadResponseBody builds a value of type StationUploadResponseBody from a value of type stationviews.StationUploadView. | func marshalStationviewsStationUploadViewToStationUploadResponseBody(v *stationviews.StationUploadView) *StationUploadResponseBody {
res := &StationUploadResponseBody{
ID: *v.ID,
Time: *v.Time,
UploadID: *v.UploadID,
Size: *v.Size,
URL: *v.URL,
Type: *v.Type,
}
if v.Blocks != nil {... |
SparseCollectionToInterface casts a slice of interfaces to an interface of the correct type for the provided sparse collection. This should be used for sparse as it should be faster for larger arrays. | func SparseCollectionToInterface(elms []interface{}, indexes []int, size int) (interface{}, error) {
if len(elms) == 0 {
return nil, nil
}
first := elms[0]
var ok bool
switch v := first.(type) {
case bool:
arr := make([]bool, size)
for i, idx := range indexes {
e := elms[i]
if e == nil {
continu... |
ResolveReferences of this LBTargetGroup. | func (mg *LBTargetGroup) ResolveReferences(ctx context.Context, c client.Reader) error {
r := reference.NewAPIResolver(c, mg)
var rsp reference.ResolutionResponse
var err error
rsp, err = r.Resolve(ctx, reference.ResolutionRequest{
CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VpcID),
Extract: ... |
Passing an arrays between functions | func PassingArraysToFunctions() {
// Passing an array between functions can be an expensive operation in terms of memory and performance.
// When you pass variables between functions, they’re always passed by value. When your variable is an array,
// this means the entire array, regardless of its size, is copied and... |
NewGetUserIssueSearchOptionsOfProjectVersionParamsWithHTTPClient creates a new GetUserIssueSearchOptionsOfProjectVersionParams object with the default values initialized, and the ability to set a custom HTTPClient for a request | func NewGetUserIssueSearchOptionsOfProjectVersionParamsWithHTTPClient(client *http.Client) *GetUserIssueSearchOptionsOfProjectVersionParams {
var ()
return &GetUserIssueSearchOptionsOfProjectVersionParams{
HTTPClient: client,
}
} |
SetShowsuppressed adds the showsuppressed to the list issue group of project version params | func (o *ListIssueGroupOfProjectVersionParams) SetShowsuppressed(showsuppressed *bool) {
o.Showsuppressed = showsuppressed
} |
culls the dead servers from vs.servers and returns the mostrecently pinged idle server | func (vs *ViewServer) cullDead() string {
mostRecentPing := ""
for key, element := range vs.servers {
if age := time.Since(element); age > (DeadPings * PingInterval){
if key == vs.thisView.Primary{
vs.mustReplacePrimary = true
} else if key == vs.thisView.Backup {
vs.mustReplaceBackup = true
}
d... |
calcID calculates the message ID for the given message node. The ID changes if the text content or meaning attribute changes. It is invariant to changes in description. | func calcID(n *ast.MsgNode) uint64 {
var buf bytes.Buffer
writeFingerprint(&buf, n, false)
var fp = fingerprint(buf.Bytes())
if n.Meaning != "" {
var topbit uint64
if fp&(1<<63) > 0 {
topbit = 1
}
fp = (fp << 1) + topbit + fingerprint([]byte(n.Meaning))
}
return fp & 0x7fffffffffffffff
} |
ExpandEnv like os.ExpandEnv, except supports `_FILE` vars as well | func ExpandEnv(s string) string {
fsys := datafs.WrapWdFS(osfs.NewFS())
return expandEnvVFS(fsys, s)
} |
NewTopic generates a new Topic for a given project and topic name. | func NewTopic(project, name string) Topic {
return Topic(newResource(project, "topics", name))
} |
HasFilter returns if a logger has a given filter by name. | func (l *Logger) HasFilter(flag, filterName string) bool {
l.Lock()
defer l.Unlock()
if l.Filters == nil {
return false
}
filters, ok := l.Filters[flag]
if !ok {
return false
}
_, ok = filters[filterName]
return ok
} |
GetSessionKeyInfo returns session key expiration info | func GetSessionKeyInfo(sessionKey string, clientCode string, client HttpClient) (*SessionKeyInfo, error) {
requestUrl := fmt.Sprintf(common.BaseUrl, clientCode)
params := url.Values{}
params.Add("sessionKey", sessionKey)
params.Add("request", "getSessionKeyInfo")
params.Add("clientCode", clientCode)
req, err := ... |
QueryUsers finds users in the DB that match parameters given in the 'query' map | func (stor *arrayUserStorage) Query(query map[string]interface{}) (out []User) {
stor.lock.RLock()
defer stor.lock.RUnlock()
if query == nil {
out = make([]User, len(stor.db))
copy(out, stor.db)
return
}
for _, user := range stor.db {
if matchesQuery(query, user) {
out = append(out, user)
}
}
return... |
Write writes content to a file named by path. A successful call returns err == nil | func (f FileManager) Write(path string, content []byte) error {
return ioutil.WriteFile(path, content, os.ModePerm)
} |
rename tmp file to final file | func renameFile(oldName string, newName string) bool {
err := os.Rename(oldName, newName)
if err != nil {
_ = os.Remove(oldName)
log.Println("Failed to rename file")
return false
}
return true
} |
Scatter returns false for diffuse light materials. | func (dl *DiffuseLight) Scatter(_ ray.Ray, _ *hitrecord.HitRecord, _ *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool) {
return nil, nil, false
} |
getProvider looks up the registered openidconnect auth provider with the given ID. | func getProvider(id string) *provider {
if mockGetProviderValue != nil {
return mockGetProviderValue
}
p, _ := auth.GetProviderByConfigID(auth.ProviderConfigID{Type: providerType, ID: id}).(*provider)
return p
} |
WithProxyConfig returns a proxy config functional option | func WithProxyConfig(cfg config.Proxy) GRPCOption {
return func(h *GRPCHandler) {
h.proxyCfg = cfg
}
} |
ReadContent read the content of the csv file , handler func(string) | func ReadContent(file *os.File) (header []string, body [][]string, err error) {
r := csv.NewReader(file)
// 逐行读取
records, err := r.ReadAll()
if err != nil {
return nil, nil, err
}
header = records[0]
body = records[1:]
return header, body, nil
} |
NewLanguages returns a list of supported programming languages. NOTE: The 'timeout' value zero is passed into each New call as it's only useful during the `compute build` phase and is expected to be provided by the user via a flag on the build command. | func NewLanguages(kits config.StarterKitLanguages) []*Language {
// WARNING: Do not reorder these options as they affect the rendered output.
// They are placed in order of language maturity/importance.
//
// A change to this order will also break the tests, as the logic defaults to
// the first language in the li... |
/ Userdata set/get. Sets a user value that the DSP object will store internally. Can be retrieved with "DSP.UserData". This function is primarily used in case the user wishes to 'attach' data to an FMOD object. It can be useful if an FMOD callback passes an object of this type as a parameter, and the user does not know... | func (d *DSP) SetUserData(userdata interface{}) error {
data := *(*[]*C.char)(unsafe.Pointer(&userdata))
res := C.FMOD_DSP_SetUserData(d.cptr, unsafe.Pointer(&data))
return errs[res]
} |
shared by Put and Append. you can send an RPC with code like this: ok := ck.servers[i].Call("KVServer.PutAppend", &args, &reply) the types of args and reply (including whether they are pointers) must match the declared types of the RPC handler function's arguments. and reply must be passed as a pointer. | func (ck *Clerk) PutAppend(key string, value string, op string) {
// You will have to modify this function.
args := PutAppendArgs{
ClerkId: ck.clerkId,
Key: key,
Value: value,
Op: op,
}
if !ck.reSendFlag {
ck.opId++
}
args.OpId = ck.opId
reply := PutAppendReply{}
ok := ck.servers[ck.leader]... |
OnEndpointsUpdate is called whenever modification of an existing endpoints object is observed. | func (proxier *Proxier) OnEndpointsUpdate(oldEndpoints, endpoints *api.Endpoints) {
namespacedName := types.NamespacedName{Namespace: endpoints.Namespace, Name: endpoints.Name}
if proxier.endpointsChanges.Update(&namespacedName, oldEndpoints, endpoints) && proxier.isInitialized() {
// proxier.syncRunner.Run()
prox... |
ownerToString generate a string to identify the owner matches nodeToString format | func ownerToString(node *yaml.RNode) (string, error) {
meta, err := node.GetMeta()
if err != nil {
return "", err
}
namespace := meta.Namespace
owners, err := node.Pipe(yaml.Lookup("metadata", "ownerReferences"))
if err != nil {
return "", err
}
if owners == nil {
return "", nil
}
elements, err := own... |
DeleteOrgHook deletes and existing org level webhook. | func (c *client) DeleteOrgHook(org string, id int, req HookRequest) error {
c.log("DeleteOrgHook", org, id)
path := fmt.Sprintf("/orgs/%s/hooks/%d", org, id)
return c.deleteHook(org, path)
} |
An array of string values. If the operator is In or NotIn, the values array must be nonempty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a stra... | func (o QperfSpecClientConfigurationPodSchedulingAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecutionNodeSelectorTermsMatchExpressionsOutput) Values() pulumi.StringArrayOutput {
return o.ApplyT(func(v QperfSpecClientConfigurationPodSchedulingAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecut... |
EncryptText does not decrypt, just sends the text back as plaintext | func (v nullVault) DecryptText(text string) (string, error) {
return text, nil
} |
Get sends a simple Get requests to specific endpoint | func (c *Client) Get(endpoint string, params map[string]string) *grequests.Response {
url := c.Endpoint + endpoint
resp, err := grequests.Get(url, &grequests.RequestOptions{
Params: params,
})
if err != nil {
utilities.CheckError(resp.Error, "Unable to make requests")
}
if resp.Ok != true {
log.Println("Re... |
ProcessAccountToUmodeChange processes Add/Remove/List operations for channel persistent usermodes. | func (channel *Channel) ProcessAccountToUmodeChange(client *Client, change modes.ModeChange) (results []modes.ModeChange, err error) {
changed := false
defer func() {
if changed {
channel.MarkDirty(IncludeLists)
}
}()
account := client.Account()
isOperChange := client.HasRoleCapabs("chanreg")
channel.sta... |
Save creates the App in the database. | func (ac *AppCreate) Save(ctx context.Context) (*App, error) {
if err := ac.preSave(); err != nil {
return nil, err
}
var (
err error
node *App
)
if len(ac.hooks) == 0 {
node, err = ac.sqlSave(ctx)
} else {
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation,... |
GetFirstInstance implement init mul level proxy, RealInstance and proxys make sure both implement the same interface return firstProxy | realInstance | func (this *ProxyFactory) GetFirstInstance(realName string, realInstance interface{}, proxys ...func() interface{}) interface{} {
var firstProxy interface{}
var proxyInses []interface{}
proxyInses = this.GetInstances(realName, proxys...)
proxyNum := len(proxyInses)
if proxyNum > 0 {
firstProxy = proxyInses[0]... |
Required. A pod affinity term, associated with the corresponding weight. | func (o IopingSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionOutput) PodAffinityTerm() IopingSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput {
return o.ApplyT(func(v IopingSpecPodConfigPodSchedulingAffinityPo... |
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 DataCollecti... |
String returns a text representation of this operation | func (o DelayTimerOp) String() string {
return fmt.Sprintf("DT = V%X", o.register)
} |
XXX_OneofFuncs is for the internal use of the proto package. | func (*ChannelPoint) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _ChannelPoint_OneofMarshaler, _ChannelPoint_OneofUnmarshaler, _ChannelPoint_OneofSizer, []interface{}{
... |
ByteCount returns the number of bytes required to serialize the object. | func (f *CreateBundleReply) ByteCount() int {
return 4
} |
IterateLocalData iterates over all record with specified prefix and calls handler with key and value of that record. The key will be returned without prefix (e.g. the remaining slice) and value will be returned as it was saved. | func (db *DB) IterateLocalData(ctx context.Context, pulse core.PulseNumber, prefix []byte, handler func(k, v []byte) error) error {
fullPrefix := bytes.Join([][]byte{{scopeIDLocal}, pulse.Bytes(), prefix}, nil)
return db.db.View(func(txn *badger.Txn) error {
it := txn.NewIterator(badger.DefaultIteratorOptions)
d... |
Debugln is Logln with DebugLevel | func (v *MultiLogger) Debugln(args ...interface{}) {
v.Self().Logln(logrus.DebugLevel, args...)
} |
newJobRunner returns a new job runner with the provided agent configuration. | func newJobRunner(cfg config.Config, back backend.Backend, updater jobrunner.CheckStateUpdater, logger log.Logger) (*jobrunner.Runner, error) {
// Build the aborted checks component that will be used to know if a check
// has been aborted or not before starting to execute it.
var (
err error
abortedChe... |
ClearDuty clears the value of the "duty" field. | func (m *OrgUnitPositionMutation) ClearDuty() {
m.duty = nil
m.clearedFields[orgunitposition.FieldDuty] = struct{}{}
} |
An array of string values. If the operator is In or NotIn, the values array must be nonempty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a stra... | func (o PgbenchSpecPodConfigPodSchedulingAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecutionNodeSelectorTermsMatchExpressionsOutput) Values() pulumi.StringArrayOutput {
return o.ApplyT(func(v PgbenchSpecPodConfigPodSchedulingAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecutionNodeSelectorT... |
Err returns the first error returned by a factory func or nil if there was none. | func (r *Registry) Err() error {
return r.err
} |
DurationOrDefault returns the default value (or 0) if input is nil, otherwise returns the referenced value. | func DurationOrDefault(input *time.Duration, defaultValue ...time.Duration) time.Duration {
if input == nil {
if len(defaultValue) > 0 {
return defaultValue[0]
}
return 0
}
return *input
} |
Next returns the node that follows this one | func (e *Node) Next() *Node {
return e.next
} |
Enables a rule. If the rule does not exist, the operation fails. Note: When you make a change with this action, incoming events might not immediately start matching to a newly enabled rule. Please allow a short period of time for changes to take effect. | func (c *CloudWatchEvents) EnableRule(input *EnableRuleInput) (*EnableRuleOutput, error) {
req, out := c.EnableRuleRequest(input)
err := req.Send()
return out, err
} |
HasIsRead returns a boolean if a field has been set. | func (o *InlineResponse200115) HasIsRead() bool {
if o != nil && o.IsRead != nil {
return true
}
return false
} |
An array of string values. If the operator is In or NotIn, the values array must be nonempty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a stra... | func (o IopingSpecPodConfigPodSchedulingAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionPreferenceMatchFieldsOutput) Values() pulumi.StringArrayOutput {
return o.ApplyT(func(v IopingSpecPodConfigPodSchedulingAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecutionPreferenceMatchFields) []... |
GetRbls returns all rbls from the config | func (c *Config) GetRbls(cfg *ini.File) []string {
return cfg.Section("rbl").Key("server").ValueWithShadows()
} |
Describes node affinity scheduling rules for the pod. | func (o SysbenchSpecPodSchedulingAffinityOutput) NodeAffinity() SysbenchSpecPodSchedulingAffinityNodeAffinityPtrOutput {
return o.ApplyT(func(v SysbenchSpecPodSchedulingAffinity) *SysbenchSpecPodSchedulingAffinityNodeAffinity {
return v.NodeAffinity
}).(SysbenchSpecPodSchedulingAffinityNodeAffinityPtrOutput)
} |
QueryGroups finds Groups in the DB that match parameters given in the 'query' map | func (stor *arrayGroupStorage) Query(query map[string]interface{}) (out []Group) {
stor.lock.RLock()
defer stor.lock.RUnlock()
// nil means get all - we copy the slice so modifications don't disturb the DB
if query == nil {
out = make([]Group, len(stor.db))
copy(out, stor.db)
return
}
for _, Group := range ... |
Add registers ric entry. | func (t *RicTable) Add(c *RicEntry) {
t.Mutex.Lock()
defer t.Mutex.Unlock()
t.Entries[c.Rt] = c
} |
NewSlackBot returns new Bot object | func NewSlackBot() *Bot {
c, err := config.New()
if err != nil {
logging.Logger.Fatal(fmt.Sprintf("Error in loading configuration. Error:%s", err.Error()))
}
return &Bot{
Token: c.Communications.Slack.Token,
AllowKubectl: c.Settings.AllowKubectl,
}
} |
Insert inserts keyvalue to the map | func (this *Map) Insert(key, value interface{}) {
node := this.tree.FindNode(key)
if node != nil {
node.SetValue(value)
return
}
this.tree.Insert(key, value)
} |
NewRedisQueueWithFunc returns new RedisStore with specified push and pop func | func NewRedisQueueWithFunc(
r *redis.Client,
push func(interface{}) (interface{}, error),
pop func(interface{}) (interface{}, error)) *RedisQueue {
return &RedisQueue{
key: fmt.Sprintf("queue:%v", time.Now().Nanosecond()),
r: r,
push: push,
pop: pop,
}
} |
GetStackTags mocks base method. | func (m *MockCfnClient) GetStackTags(stackName string) (map[string]string, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetStackTags", stackName)
ret0, _ := ret[0].(map[string]string)
ret1, _ := ret[1].(error)
return ret0, ret1
} |
UnmarshalJSON supports json.Unmarshaler interface | func (v *EventPlayerEventsAdded) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComChromedpCdprotoMedia4(&r, v)
return r.Error()
} |
ChainStreamClient creates a single interceptor out of a chain of many interceptors. Execution is done in lefttoright order, including passing of context. For example ChainStreamClient(one, two, three) will execute one before two before three. | func ChainStreamClient(interceptors ...grpc.StreamClientInterceptor) grpc.StreamClientInterceptor {
n := len(interceptors)
// interceptors length more than 1.
if n > 1 {
// chain callback function.
var chain func(idx int, ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer g... |
/ need to store a map of which keys need to be nonrepeating | func PushKeyOnce(k string) bool {
if k != prevkey {
prevkey = k
return true
}
prevkey = k
return false
} |
return parameters of a buffer object | func GetBufferParameteri64v(target uint32, pname uint32, params *int64) {
C.glowGetBufferParameteri64v(gpGetBufferParameteri64v, (C.GLenum)(target), (C.GLenum)(pname), (*C.GLint64)(unsafe.Pointer(params)))
} |
ReadOnly here will force the NFS export to be mounted with readonly permissions. Defaults to false. More info: | func (o IopingSpecVolumeVolumeSourceNfsPtrOutput) ReadOnly() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *IopingSpecVolumeVolumeSourceNfs) *bool {
if v == nil {
return nil
}
return v.ReadOnly
}).(pulumi.BoolPtrOutput)
} |
ResetContagion reset all changes of the "Contagion" field. | func (m *DiseaseMutation) ResetContagion() {
m._Contagion = nil
} |
GenDefaultID uses "" and does a sha1 hash. | func (b *Base) GenDefaultID() string {
s := fmt.Sprintf("%s-%d", b.GetLastSource(), b.Time.UnixNano())
return Sha1HashString(s)
} |
ListByKind provides a mock function with given fields: kind | func (_m *VirtualMachine) ListByKind(kind vm.Kind) ([]vm.VirtualMachine, error) {
ret := _m.Called(kind)
var r0 []vm.VirtualMachine
if rf, ok := ret.Get(0).(func(vm.Kind) []vm.VirtualMachine); ok {
r0 = rf(kind)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]vm.VirtualMachine)
}
}
var r1 error
if ... |
RunJSONSerializationTestForHostNameMatchConditionParameters_STATUS runs a test to see if a specific instance of HostNameMatchConditionParameters_STATUS round trips to JSON and back losslessly | func RunJSONSerializationTestForHostNameMatchConditionParameters_STATUS(subject HostNameMatchConditionParameters_STATUS) string {
// Serialize to JSON
bin, err := json.Marshal(subject)
if err != nil {
return err.Error()
}
// Deserialize back into memory
var actual HostNameMatchConditionParameters_STATUS
err =... |
/ 1. verify(zkproof) 2, check tree root hash exist 3, check authorize pubkey hash in config or not 4. check authorize hash if exist in authorize pool 5. set authorize hash and authorize_spend hash | func (a *action) Authorize(authorize *mixTy.MixAuthorizeAction) (*types.Receipt, error) {
execer, symbol := mixTy.GetAssetExecSymbol(a.api.GetConfig(), authorize.AssetExec, authorize.AssetSymbol)
input, err := a.authorizePubInputs(execer, symbol, authorize.ProofInfo)
if err != nil {
return nil, err
}
//zk-proo... |
LoadProviders loads the configured external providers. | func (pv *Providers) LoadProviders(c *config.Config) error {
pv.mu.Lock()
defer pv.mu.Unlock()
pv.internal = c.Provider()
for name, v := range c.Providers {
err := pv.useProvider(name, v.ClientKey, v.Secret, v.CallbackURL, v.Scopes...)
if err != nil {
err = fmt.Errorf("load %s provider failed: %w", name, err... |
New returns an instance of docsy. | func New(hugoExe string, docsyDir string, docPath string) *docsy {
return &docsy{
hugoExe: hugoExe,
docsyDir: docsyDir,
docPath: docPath,
renderMetric: metrics2.GetFloat64SummaryMetric("docsyserver_docsy_render"),
}
} |
Modify adds a query modifier for attaching custom logic to queries. | func (ouq *OrgUnitQuery) Modify(modifiers ...func(s *sql.Selector)) *OrgUnitSelect {
ouq.modifiers = append(ouq.modifiers, modifiers...)
return ouq.Select()
} |
SpendOutput is a paid mutator transaction binding the contract method 0x57d61c0b. Solidity: function spendOutput(bytes32 _root, bytes32 _id) returns(uint256) | func (_OutboxEntry *OutboxEntrySession) SpendOutput(_root [32]byte, _id [32]byte) (*types.Transaction, error) {
return _OutboxEntry.Contract.SpendOutput(&_OutboxEntry.TransactOpts, _root, _id)
} |
NewEntityCollection return a collection of entity. | func (impl *Server) NewEntityCollection() interface{} {
return new([]entity.Server)
} |
GetAllPlants is a function used by our gRPC server to return plant by a given name | func (s *Server) GetAllPlants(ctx context.Context, e *Empty) (*Plants, error) {
plants, err := getAllPlantsFromDB()
if err != nil {
log.Fatalf("Failure fetching all the plants from the DB: %s\n", err)
}
return plants, nil
} |
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NopOperator. | func (in *NopOperator) DeepCopy() *NopOperator {
if in == nil {
return nil
}
out := new(NopOperator)
in.DeepCopyInto(out)
return out
} |
Reusable update batch function. Provide a query and an array of argument arrays to pass to that query. | func updateBatch(db *IndexerDb, updateQuery string, data [][]interface{}) error {
db.accountingLock.Lock()
defer db.accountingLock.Unlock()
tx, err := db.db.Begin()
if err != nil {
return err
}
defer tx.Rollback() // ignored if .Commit() first
update, err := tx.Prepare(updateQuery)
if err != nil {
return ... |
MaxKey returns the maximum key having the given searchPrefix, or the maximum key in the whole index if searchIndex is nil. Maximum means the last key in the lexicographic order. If keys are uint64 in BigEndian it is also the largest number. If ok is false the index is empty. For example, if we store temperature reading... | func (idx *Tree) MaxKey(searchPrefix []byte) (v uint64, ok bool) {
raw, _ := idx.partialSearch(searchPrefix)
if raw == 0 {
return 0, false
}
if isLeaf(raw) {
return getLeafValue(raw), true
}
// now find the max
searchLoop:
for {
_, node, count, prefixLen := explodeNode(raw)
block := int(node >> blockSlot... |
Parameters: DbName TblName PartVals MaxParts | func (p *ThriftHiveMetastoreClient) GetPartitionNamesPs(ctx context.Context, db_name string, tbl_name string, part_vals []string, max_parts int16) (r []string, err error) {
var _args94 ThriftHiveMetastoreGetPartitionNamesPsArgs
_args94.DbName = db_name
_args94.TblName = tbl_name
_args94.PartVals = part_vals
_... |
GetMarketDetail returns the ticker for the specified symbol | func (h *HUOBI) GetMarketDetail(ctx context.Context, symbol currency.Pair) (Detail, error) {
vals := url.Values{}
symbolValue, err := h.FormatSymbol(symbol, asset.Spot)
if err != nil {
return Detail{}, err
}
vals.Set("symbol", symbolValue)
type response struct {
Response
Tick Detail `json:"tick"`
}
var ... |
add Creator credentials Username, Password | func (t *SimpleChaincode) creatorCredentials(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {
if len(args) != 2 {
return shim.Error("Incorrect number of arguments. Expecting 2")
}
if len(args[0]) <= 0 {
return shim.Error("1 argument must be a non-empty string")
}
if len(args[1]) <= 0 {
retu... |
NewOptions creates a new OptionsProvider. | func NewOptions(spec Spec) *OptionsProvider {
o := &OptionsProvider{spec, make(map[string]string), make(map[string]bool)}
v := reflect.ValueOf(spec)
if v.CanSet() {
panic(fmt.Sprintf("The spec passed in must be a pointer, got type %v",
v.Type().Name()))
}
v = v.Elem()
specType := v.Type()
for i := 0; i < sp... |
GetPeerByIdx is a compatibility function for getting a peer by its "peer id". | func (pm *PeerManager) GetPeerByIdx(id int32) *Peer {
if id < 0 || id >= int32(len(pm.peers)) {
return nil
}
return pm.peerMap[pm.peers[id]]
} |
GetLastUpdated returns the LastUpdated field value if set, zero value otherwise. | func (o *ArchivedAnalysis) GetLastUpdated() time.Time {
if o == nil || o.LastUpdated == nil {
var ret time.Time
return ret
}
return *o.LastUpdated
} |
logging a method calling information | func WithMethodCallingLoggerServerInterceptor(logger *logger.Logger) grpc.UnaryServerInterceptor {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
l := logger.WithServiceInfo(info.FullMethod)
requestID := GetRequestIDFromConte... |
Start initializes the server | func (s *Server) Start() error {
address := s.Address
if address == "" {
address = "0.0.0.0"
}
addr := fmt.Sprintf("%s:%d", address, s.Port)
s.httpServer = &http.Server{
Addr: addr,
Handler: s.Routes(),
}
return s.httpServer.ListenAndServe()
} |
IncStarted Increments perfunction instancestarted counter | func (cs *Stats) IncStarted(fID string) {
atomic.AddUint64(&cs.statMap[fID].started, 1)
} |
handleObject enqueues CHI which is owner of `obj` into reconcile loop | func (c *Controller) handleObject(obj interface{}) {
// TODO review
object, ok := obj.(metaV1.Object)
if !ok {
ts, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
utilRuntime.HandleError(fmt.Errorf(messageUnableToDecode))
return
}
object, ok = ts.Obj.(metaV1.Object)
if !ok {
utilRuntime.Handle... |
New returns a new Bar | func New(fore, back color.Color, width, height int) *Bar {
c := xdom.Canvas()
c.Width = width
c.Height = height
r, g, b, _ := fore.RGBA()
foreground := "rgb(" + strconv.Itoa(int(r>>8)) + ", " + strconv.Itoa(int(g>>8)) + ", " + strconv.Itoa(int(b>>8)) + ")"
r, g, b, _ = back.RGBA()
background := "rgb(" + strconv.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.