id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
7,600
all-7601
[ "InitiateConnections", "creates", "new", "connections", "to", "the", "provided", "peers", "specified", "in", "host", ":", "port", "format", ".", "If", "replace", "is", "true", "any", "existing", "direct", "peers", "are", "forgotten", ".", "TODO", "(", "pb", ")", ":", "Weave", "Net", "invokes", "router", ".", "ConnectionMaker", ".", "InitiateConnections", ";", "it", "may", "be", "better", "to", "provide", "that", "on", "Router", "directly", "." ]
[ "func", "(", "cm", "*", "connectionMaker", ")", "InitiateConnections", "(", "peers", "[", "]", "string", ",", "replace", "bool", ")", "[", "]", "error", "{", "errors", ":=", "[", "]", "error", "{", "}", "\n", "addrs", ":=", "peerAddrs", "{", "}", "\n", "for", "_", ",", "peer", ":=", "range", "peers", "{", "host", ",", "port", ",", "err", ":=", "net", ".", "SplitHostPort", "(", "peer", ")", "\n", "if", "err", "!=", "nil", "{", "host", "=", "peer", "\n", "port", "=", "\"", "\"", "// we use that as an indication that \"no port was supplied\"", "\n", "}", "\n", "if", "<mask>", "==", "\"", "\"", "||", "!", "isAlnum", "(", "port", ")", "{", "errors", "=", "append", "(", "errors", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "peer", ")", ")", "\n", "}", "else", "if", "addr", ",", "err", ":=", "net", ".", "ResolveTCPAddr", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "host", ",", "port", ")", ")", ";", "err", "!=", "nil", "{", "errors", "=", "append", "(", "errors", ",", "err", ")", "\n", "}", "else", "{", "addrs", "[", "peer", "]", "=", "addr", "\n", "}", "\n", "}", "\n", "cm", ".", "actionChan", "<-", "func", "(", ")", "bool", "{", "if", "replace", "{", "cm", ".", "directPeers", "=", "peerAddrs", "{", "}", "\n", "}", "\n", "for", "peer", ",", "addr", ":=", "range", "addrs", "{", "cm", ".", "directPeers", "[", "peer", "]", "=", "addr", "\n", "// curtail any existing reconnect interval", "if", "target", ",", "found", ":=", "cm", ".", "targets", "[", "cm", ".", "completeAddr", "(", "*", "addr", ")", "]", ";", "found", "{", "target", ".", "nextTryNow", "(", ")", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}", "\n", "return", "errors", "\n", "}" ]
7,601
all-7602
[ "SetUserValue", "stores", "the", "given", "value", "(", "arbitrary", "object", ")", "under", "the", "given", "key", "in", "ctx", ".", "The", "value", "stored", "in", "ctx", "may", "be", "obtained", "by", "UserValue", "*", ".", "This", "functionality", "may", "be", "useful", "for", "passing", "arbitrary", "values", "between", "functions", "involved", "in", "request", "processing", ".", "All", "the", "values", "are", "removed", "from", "ctx", "after", "returning", "from", "the", "top", "RequestHandler", ".", "Additionally", "Close", "method", "is", "called", "on", "each", "value", "implementing", "io", ".", "Closer", "before", "removing", "the", "value", "from", "ctx", "." ]
[ "func", "(", "ctx", "*", "RequestCtx", ")", "SetUserValue", "(", "<mask>", "string", ",", "value", "interface", "{", "}", ")", "{", "ctx", ".", "userValues", ".", "Set", "(", "key", ",", "value", ")", "\n", "}" ]
7,602
all-7603
[ "GetValue", "returns", "the", "Value", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "p", "*", "Period", ")", "GetValue", "(", ")", "string", "{", "if", "p", "==", "nil", "||", "p", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "p", ".", "Value", "\n", "}" ]
7,603
all-7604
[ "Artifacts", "lists", "all", "artifacts", "available", "for", "the", "given", "job", "source" ]
[ "func", "(", "af", "*", "GCSArtifactFetcher", ")", "artifacts", "(", "key", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "src", ",", "err", ":=", "newGCSJobSource", "(", "key", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "key", ",", "err", ")", "\n", "}", "\n\n", "listStart", ":=", "time", ".", "Now", "(", ")", "\n", "bucketName", ",", "<mask>", ":=", "extractBucketPrefixPair", "(", "src", ".", "jobPath", "(", ")", ")", "\n", "artifacts", ":=", "[", "]", "string", "{", "}", "\n", "bkt", ":=", "af", ".", "client", ".", "Bucket", "(", "bucketName", ")", "\n", "q", ":=", "storage", ".", "Query", "{", "Prefix", ":", "prefix", ",", "Versions", ":", "false", ",", "}", "\n", "objIter", ":=", "bkt", ".", "Objects", "(", "context", ".", "Background", "(", ")", ",", "&", "q", ")", "\n", "wait", ":=", "[", "]", "time", ".", "Duration", "{", "16", ",", "32", ",", "64", ",", "128", ",", "256", ",", "256", ",", "512", ",", "512", "}", "\n", "for", "i", ":=", "0", ";", ";", "{", "oAttrs", ",", "err", ":=", "objIter", ".", "Next", "(", ")", "\n", "if", "err", "==", "iterator", ".", "Done", "{", "break", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithFields", "(", "fieldsForJob", "(", "src", ")", ")", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "if", "i", ">=", "len", "(", "wait", ")", "{", "return", "artifacts", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "time", ".", "Sleep", "(", "(", "wait", "[", "i", "]", "+", "time", ".", "Duration", "(", "rand", ".", "Intn", "(", "10", ")", ")", ")", "*", "time", ".", "Millisecond", ")", "\n", "i", "++", "\n", "continue", "\n", "}", "\n", "artifacts", "=", "append", "(", "artifacts", ",", "strings", ".", "TrimPrefix", "(", "oAttrs", ".", "Name", ",", "prefix", ")", ")", "\n", "i", "=", "0", "\n", "}", "\n", "listElapsed", ":=", "time", ".", "Since", "(", "listStart", ")", "\n", "logrus", ".", "WithField", "(", "\"", "\"", ",", "listElapsed", ")", ".", "Infof", "(", "\"", "\"", ",", "len", "(", "artifacts", ")", ")", "\n", "return", "artifacts", ",", "nil", "\n", "}" ]
7,604
all-7605
[ "Stop", "will", "signal", "the", "workers", "to", "exit", "and", "wait", "for", "them", "to", "actually", "do", "that", ".", "It", "also", "releases", "any", "other", "resources", "(", "e", ".", "g", ".", ":", "it", "stops", "the", "supervisor", "goroutine", ")", "so", "call", "this", "method", "when", "you", "re", "done", "with", "the", "Pool", "instance", "to", "allow", "the", "GC", "to", "do", "its", "job", "." ]
[ "func", "(", "pool", "*", "Pool", ")", "Stop", "(", ")", "{", "if", "!", "pool", ".", "workers_started", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "// stop the workers", "for", "i", ":=", "0", ";", "i", "<", "pool", ".", "num_workers", ";", "i", "++", "{", "pool", ".", "worker_kill_pipe", "<-", "true", "\n", "}", "\n", "pool", ".", "worker_wg", ".", "Wait", "(", ")", "\n", "// set the flag", "pool", ".", "workers_started", "=", "<mask>", "\n", "// handle the supervisor", "if", "pool", ".", "supervisor_started", "{", "pool", ".", "stopSupervisor", "(", ")", "\n", "}", "\n", "}" ]
7,605
all-7606
[ "RotateSecret", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "RotateSecret", "(", "arg0", "*", "secretsmanager", ".", "RotateSecretInput", ")", "(", "*", "secretsmanager", ".", "RotateSecretOutput", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "RotateSecretOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
7,606
all-7607
[ "Stab", "returns", "a", "slice", "with", "all", "elements", "in", "the", "tree", "intersecting", "the", "interval", "." ]
[ "func", "(", "ivt", "*", "IntervalTree", ")", "Stab", "(", "<mask>", "Interval", ")", "(", "ivs", "[", "]", "*", "IntervalValue", ")", "{", "if", "ivt", ".", "count", "==", "0", "{", "return", "nil", "\n", "}", "\n", "f", ":=", "func", "(", "n", "*", "IntervalValue", ")", "bool", "{", "ivs", "=", "append", "(", "ivs", ",", "n", ")", ";", "return", "true", "}", "\n", "ivt", ".", "Visit", "(", "iv", ",", "f", ")", "\n", "return", "ivs", "\n", "}" ]
7,607
all-7608
[ "SetData", "assign", "a", "new", "bar", "list", "to", "a", "chart" ]
[ "func", "(", "b", "*", "SparkChart", ")", "SetData", "(", "data", "[", "]", "float64", ")", "{", "b", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "b", ".", "data", "=", "make", "(", "[", "]", "float64", ",", "len", "(", "data", ")", ")", "\n", "copy", "(", "b", ".", "data", ",", "data", ")", "\n\n", "_", ",", "width", ":=", "b", ".", "calculateBarArea", "(", ")", "\n", "if", "len", "(", "b", ".", "data", ")", ">", "width", "{", "b", ".", "data", "=", "b", ".", "data", "[", "len", "(", "b", ".", "data", ")", "-", "<mask>", ":", "]", "\n", "}", "\n", "}" ]
7,608
all-7609
[ "MarshalLogObject", "implements", "zapcore", "ObjectMarshaler", "." ]
[ "func", "(", "rl", "reportLocation", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "<mask>", "{", "enc", ".", "AddString", "(", "\"", "\"", ",", "rl", ".", "FilePath", ")", "\n", "enc", ".", "AddInt", "(", "\"", "\"", ",", "rl", ".", "LineNumber", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "rl", ".", "FunctionName", ")", "\n\n", "return", "nil", "\n", "}" ]
7,609
all-7610
[ "Substitute", "replaces", "all", "occurrences", "of", "the", "regular", "expression", "r", "in", "an", "input", "item", "with", "replacement", ".", "The", "replacement", "string", "can", "contain", "$1", "$2", "etc", ".", "which", "represent", "submatches", "of", "r", "." ]
[ "func", "Substitute", "(", "r", ",", "replacement", "string", ")", "Filter", "{", "return", "FilterFunc", "(", "func", "(", "arg", "Arg", ")", "error", "{", "re", ",", "err", ":=", "regexp", ".", "Compile", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "s", ":=", "range", "arg", ".", "In", "{", "arg", ".", "Out", "<-", "<mask>", ".", "ReplaceAllString", "(", "s", ",", "replacement", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
7,610
all-7611
[ "GetBool", "()", "is", "a", "wrapper", "around", "gtk_print_settings_get_bool", "()", "." ]
[ "func", "(", "ps", "*", "PrintSettings", ")", "GetBool", "(", "key", "string", ")", "bool", "{", "cstr", ":=", "C", ".", "CString", "(", "<mask>", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "c", ":=", "C", ".", "gtk_print_settings_get_bool", "(", "ps", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "return", "gobool", "(", "c", ")", "\n", "}" ]
7,611
all-7612
[ "URL", "finds", "the", "specified", "URL", "for", "a", "service", "based", "off", "of", "the", "service", "s", "name", "and", "which", "interface", "you", "are", "accessing", ".", "Values", "are", "found", "in", "environment", "variables", "fitting", "the", "scheme", ":", "SERVICE_", "{", "SERVICE", "NAME", "}", "_", "{", "INTERFACE", "NAME", "}", "_", "{", "PROTO", "HOST", "PORT", "}", "." ]
[ "func", "URL", "(", "service", ",", "name", "string", ")", "(", "string", ",", "error", ")", "{", "proto", ",", "err", ":=", "Proto", "(", "service", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "host", ",", "err", ":=", "Host", "(", "service", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "port", ",", "err", ":=", "Port", "(", "service", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "rawURL", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "proto", ",", "host", ",", "port", ")", "\n", "u", ",", "err", ":=", "url", ".", "Parse", "(", "rawURL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "kayvee", ".", "FormatLog", "(", "\"", "\"", ",", "kayvee", ".", "Error", ",", "\"", "\"", ",", "logger", ".", "M", "{", "\"", "\"", ":", "rawURL", ",", "\"", "\"", ":", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", ",", "}", ")", ")", "\n", "}", "\n", "return", "u", ".", "<mask>", "(", ")", ",", "nil", "\n", "}" ]
7,612
all-7613
[ "SetDOMBreakpoint", "sets", "breakpoint", "on", "particular", "operation", "with", "DOM", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "DOMDebugger#method", "-", "setDOMBreakpoint", "parameters", ":", "nodeID", "-", "Identifier", "of", "the", "node", "to", "set", "breakpoint", "on", ".", "type", "-", "Type", "of", "the", "operation", "to", "stop", "upon", "." ]
[ "func", "SetDOMBreakpoint", "(", "nodeID", "cdp", ".", "NodeID", ",", "typeVal", "DOMBreakpointType", ")", "*", "SetDOMBreakpointParams", "{", "return", "&", "SetDOMBreakpointParams", "{", "NodeID", ":", "nodeID", ",", "<mask>", ":", "typeVal", ",", "}", "\n", "}" ]
7,613
all-7614
[ "This", "sets", "the", "value", "in", "a", "struct", "of", "an", "indeterminate", "type", "to", "the", "matching", "value", "from", "the", "request", "(", "via", "Form", "middleware", ")", "in", "the", "same", "type", "so", "that", "not", "all", "deserialized", "values", "have", "to", "be", "strings", ".", "Supported", "types", "are", "string", "int", "float", "and", "bool", "." ]
[ "func", "setWithProperType", "(", "valueKind", "reflect", ".", "Kind", ",", "val", "string", ",", "structField", "reflect", ".", "Value", ",", "nameInTag", "string", ",", "errors", "Errors", ")", "{", "switch", "valueKind", "{", "<mask>", "reflect", ".", "Int", ",", "reflect", ".", "Int8", ",", "reflect", ".", "Int16", ",", "reflect", ".", "Int32", ",", "reflect", ".", "Int64", ":", "if", "val", "==", "\"", "\"", "{", "val", "=", "\"", "\"", "\n", "}", "\n", "intVal", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "val", ",", "10", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "errors", ".", "Add", "(", "[", "]", "string", "{", "nameInTag", "}", ",", "TypeError", ",", "\"", "\"", ")", "\n", "}", "else", "{", "structField", ".", "SetInt", "(", "intVal", ")", "\n", "}", "\n", "case", "reflect", ".", "Uint", ",", "reflect", ".", "Uint8", ",", "reflect", ".", "Uint16", ",", "reflect", ".", "Uint32", ",", "reflect", ".", "Uint64", ":", "if", "val", "==", "\"", "\"", "{", "val", "=", "\"", "\"", "\n", "}", "\n", "uintVal", ",", "err", ":=", "strconv", ".", "ParseUint", "(", "val", ",", "10", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "errors", ".", "Add", "(", "[", "]", "string", "{", "nameInTag", "}", ",", "TypeError", ",", "\"", "\"", ")", "\n", "}", "else", "{", "structField", ".", "SetUint", "(", "uintVal", ")", "\n", "}", "\n", "case", "reflect", ".", "Bool", ":", "if", "val", "==", "\"", "\"", "{", "val", "=", "\"", "\"", "\n", "}", "\n", "boolVal", ",", "err", ":=", "strconv", ".", "ParseBool", "(", "val", ")", "\n", "if", "err", "!=", "nil", "{", "errors", ".", "Add", "(", "[", "]", "string", "{", "nameInTag", "}", ",", "TypeError", ",", "\"", "\"", ")", "\n", "}", "else", "{", "structField", ".", "SetBool", "(", "boolVal", ")", "\n", "}", "\n", "case", "reflect", ".", "Float32", ":", "if", "val", "==", "\"", "\"", "{", "val", "=", "\"", "\"", "\n", "}", "\n", "floatVal", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "val", ",", "32", ")", "\n", "if", "err", "!=", "nil", "{", "errors", ".", "Add", "(", "[", "]", "string", "{", "nameInTag", "}", ",", "TypeError", ",", "\"", "\"", ")", "\n", "}", "else", "{", "structField", ".", "SetFloat", "(", "floatVal", ")", "\n", "}", "\n", "case", "reflect", ".", "Float64", ":", "if", "val", "==", "\"", "\"", "{", "val", "=", "\"", "\"", "\n", "}", "\n", "floatVal", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "val", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "errors", ".", "Add", "(", "[", "]", "string", "{", "nameInTag", "}", ",", "TypeError", ",", "\"", "\"", ")", "\n", "}", "else", "{", "structField", ".", "SetFloat", "(", "floatVal", ")", "\n", "}", "\n", "case", "reflect", ".", "String", ":", "structField", ".", "SetString", "(", "val", ")", "\n", "}", "\n", "}" ]
7,614
all-7615
[ "checkConfiguration", "tests", "a", "cluster", "membership", "configuration", "for", "common", "errors", "." ]
[ "func", "checkConfiguration", "(", "configuration", "Configuration", ")", "error", "{", "idSet", ":=", "make", "(", "map", "[", "ServerID", "]", "bool", ")", "\n", "addressSet", ":=", "make", "(", "map", "[", "ServerAddress", "]", "bool", ")", "\n", "var", "voters", "int", "\n", "for", "_", ",", "server", ":=", "range", "configuration", ".", "Servers", "{", "if", "server", ".", "ID", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "configuration", ")", "\n", "}", "\n", "if", "server", ".", "Address", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}", "\n", "if", "idSet", "[", "server", ".", "ID", "]", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "server", ".", "ID", ")", "\n", "}", "\n", "idSet", "[", "server", ".", "ID", "]", "=", "true", "\n", "if", "addressSet", "[", "server", ".", "Address", "]", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "server", ".", "Address", ")", "\n", "}", "\n", "addressSet", "[", "server", ".", "Address", "]", "=", "true", "\n", "if", "server", ".", "Suffrage", "==", "Voter", "{", "voters", "++", "\n", "}", "\n", "}", "\n", "if", "voters", "==", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "configuration", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,615
all-7616
[ "ChainHandlers", "executes", "each", "function", "from", "the", "arguments", "with", "handler", "from", "the", "next", "function", "to", "construct", "a", "chan", "fo", "callers", "." ]
[ "func", "ChainHandlers", "(", "handlers", "...", "func", "(", "http", ".", "<mask>", ")", "http", ".", "Handler", ")", "(", "h", "http", ".", "Handler", ")", "{", "for", "i", ":=", "len", "(", "handlers", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "h", "=", "handlers", "[", "i", "]", "(", "h", ")", "\n", "}", "\n", "return", "\n", "}" ]
7,616
all-7617
[ "AskForConfirmation", "prompts", "user", "for", "yes", "/", "no", "response" ]
[ "func", "AskForConfirmation", "(", ")", "bool", "{", "var", "response", "string", "\n", "_", ",", "err", ":=", "fmt", ".", "Scanln", "(", "&", "response", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n", "okayResponses", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", "\n", "nokayResponses", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", "\n", "if", "StringInSlice", "(", "strings", ".", "ToLower", "(", "response", ")", ",", "okayResponses", ")", "{", "return", "true", "\n", "}", "\n", "if", "StringInSlice", "(", "strings", ".", "ToLower", "(", "<mask>", ")", ",", "nokayResponses", ")", "{", "return", "false", "\n", "}", "\n", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "return", "AskForConfirmation", "(", ")", "\n", "}" ]
7,617
all-7618
[ "export", "gogpgme_seekfunc" ]
[ "func", "gogpgme_seekfunc", "(", "<mask>", "unsafe", ".", "Pointer", ",", "offset", "C", ".", "gpgme_off_t", ",", "whence", "C", ".", "int", ")", "C", ".", "gpgme_off_t", "{", "d", ":=", "callbackLookup", "(", "uintptr", "(", "handle", ")", ")", ".", "(", "*", "Data", ")", "\n", "n", ",", "err", ":=", "d", ".", "s", ".", "Seek", "(", "int64", "(", "offset", ")", ",", "int", "(", "whence", ")", ")", "\n", "if", "err", "!=", "nil", "{", "C", ".", "gpgme_err_set_errno", "(", "C", ".", "EIO", ")", "\n", "return", "-", "1", "\n", "}", "\n", "return", "C", ".", "gpgme_off_t", "(", "n", ")", "\n", "}" ]
7,618
all-7619
[ "UpdateDashboard", "in", "essence", "takes", "a", "Dashboard", "struct", "and", "persists", "it", "back", "to", "the", "server", ".", "Use", "this", "if", "you", "ve", "updated", "your", "local", "and", "need", "to", "push", "it", "back", "." ]
[ "func", "(", "client", "*", "Client", ")", "UpdateDashboard", "(", "dash", "*", "Dashboard", ")", "error", "{", "return", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "*", "dash", ".", "Id", ")", ",", "<mask>", ",", "nil", ")", "\n", "}" ]
7,619
all-7620
[ "HashHex", "returns", "the", "hex", "-", "encoded", "hash", "of", "this", "builder", "s", "transaction" ]
[ "func", "(", "b", "*", "TransactionBuilder", ")", "HashHex", "(", ")", "(", "string", ",", "error", ")", "{", "hash", ",", "err", ":=", "b", ".", "Hash", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "<mask>", ".", "EncodeToString", "(", "hash", "[", ":", "]", ")", ",", "nil", "\n", "}" ]
7,620
all-7621
[ "SetHeader", "is", "a", "file", "setting", "to", "set", "the", "MIME", "header", "of", "the", "message", "part", "that", "contains", "the", "file", "content", ".", "Mandatory", "headers", "are", "automatically", "added", "if", "they", "are", "not", "set", "when", "sending", "the", "email", "." ]
[ "func", "SetHeader", "(", "h", "map", "[", "string", "]", "[", "]", "string", ")", "FileSetting", "{", "return", "func", "(", "f", "*", "file", ")", "{", "for", "k", ",", "v", ":=", "<mask>", "h", "{", "f", ".", "Header", "[", "k", "]", "=", "v", "\n", "}", "\n", "}", "\n", "}" ]
7,621
all-7622
[ "ApplyConfChange", "applies", "a", "config", "change", "to", "the", "local", "node", "." ]
[ "func", "(", "rn", "*", "RawNode", ")", "ApplyConfChange", "(", "cc", "pb", ".", "ConfChange", ")", "*", "pb", ".", "ConfState", "{", "if", "cc", ".", "NodeID", "==", "None", "{", "return", "&", "pb", ".", "ConfState", "{", "Nodes", ":", "rn", ".", "raft", ".", "nodes", "(", ")", ",", "Learners", ":", "rn", ".", "raft", ".", "learnerNodes", "(", ")", "}", "\n", "}", "\n", "switch", "cc", ".", "Type", "{", "case", "pb", ".", "ConfChangeAddNode", ":", "rn", ".", "raft", ".", "addNode", "(", "<mask>", ".", "NodeID", ")", "\n", "case", "pb", ".", "ConfChangeAddLearnerNode", ":", "rn", ".", "raft", ".", "addLearner", "(", "cc", ".", "NodeID", ")", "\n", "case", "pb", ".", "ConfChangeRemoveNode", ":", "rn", ".", "raft", ".", "removeNode", "(", "cc", ".", "NodeID", ")", "\n", "case", "pb", ".", "ConfChangeUpdateNode", ":", "default", ":", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "&", "pb", ".", "ConfState", "{", "Nodes", ":", "rn", ".", "raft", ".", "nodes", "(", ")", ",", "Learners", ":", "rn", ".", "raft", ".", "learnerNodes", "(", ")", "}", "\n", "}" ]
7,622
all-7623
[ "requiresASMDockerAuthData", "returns", "true", "if", "atleast", "one", "container", "in", "the", "task", "needs", "to", "retrieve", "private", "registry", "authentication", "data", "from", "ASM" ]
[ "func", "(", "task", "*", "Task", ")", "requiresASMDockerAuthData", "(", ")", "bool", "{", "for", "_", ",", "container", ":=", "range", "task", ".", "Containers", "{", "if", "container", ".", "ShouldPullWithASMAuth", "(", ")", "{", "return", "<mask>", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
7,623
all-7624
[ "Do", "executes", "Storage", ".", "trackCacheStorageForOrigin", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "TrackCacheStorageForOriginParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandTrackCacheStorageForOrigin", ",", "p", ",", "nil", ")", "\n", "}" ]
7,624
all-7625
[ "AllowLargeResults", "is", "a", "configuration", "function", "that", "can", "be", "used", "to", "enable", "the", "AllowLargeResults", "setting", "of", "a", "bigquery", "request", "as", "well", "as", "a", "temp", "table", "name", "to", "use", "to", "build", "the", "result", "data", "An", "example", "use", "is", ":", "client", ".", "New", "(", "pemPath", "serviceAccountEmailAddress", "serviceUserAccountClientID", "clientSecret", "client", ".", "AllowLargeResults", "(", "true", "tempTableName", "))" ]
[ "func", "AllowLargeResults", "(", "shouldAllow", "bool", ",", "tempTableName", "string", ",", "flattenResults", "bool", ")", "func", "(", "*", "Client", ")", "error", "{", "return", "func", "(", "c", "*", "<mask>", ")", "error", "{", "return", "c", ".", "setAllowLargeResults", "(", "shouldAllow", ",", "tempTableName", ",", "flattenResults", ")", "\n", "}", "\n", "}" ]
7,625
all-7626
[ "UnmarshalJSON", "implements", "the", "json", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "m", "*", "policyTransportScopesWithTransport", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "// We can't unmarshal directly into map values because it is not possible to take an address of a map value.", "// So, use a temporary map of pointers-to-slices and convert.", "tmpMap", ":=", "map", "[", "string", "]", "*", "PolicyRequirements", "{", "}", "\n", "if", "err", ":=", "paranoidUnmarshalJSONObject", "(", "<mask>", ",", "func", "(", "key", "string", ")", "interface", "{", "}", "{", "// paranoidUnmarshalJSONObject detects key duplication for us, check just to be safe.", "if", "_", ",", "ok", ":=", "tmpMap", "[", "key", "]", ";", "ok", "{", "return", "nil", "\n", "}", "\n", "if", "key", "!=", "\"", "\"", "&&", "m", ".", "transport", "!=", "nil", "{", "if", "err", ":=", "m", ".", "transport", ".", "ValidatePolicyConfigurationScope", "(", "key", ")", ";", "err", "!=", "nil", "{", "return", "nil", "\n", "}", "\n", "}", "\n", "ptr", ":=", "&", "PolicyRequirements", "{", "}", "// This allocates a new instance on each call.", "\n", "tmpMap", "[", "key", "]", "=", "ptr", "\n", "return", "ptr", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "key", ",", "ptr", ":=", "range", "tmpMap", "{", "(", "*", "m", ".", "dest", ")", "[", "key", "]", "=", "*", "ptr", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,626
all-7627
[ "Matches", "checks", "that", "a", "string", "matches", "a", "regular", "-", "expression", "." ]
[ "func", "Matches", "(", "tb", "testing", ".", "TB", ",", "expectedMatch", "string", ",", "actual", "string", ",", "msgAndArgs", "...", "interface", "{", "}", ")", "{", "tb", ".", "Helper", "(", ")", "\n", "r", ",", "err", ":=", "regexp", ".", "Compile", "(", "expectedMatch", ")", "\n", "if", "err", "!=", "nil", "{", "fatal", "(", "tb", ",", "msgAndArgs", ",", "\"", "\"", ",", "expectedMatch", ")", "\n", "}", "\n", "if", "!", "r", ".", "MatchString", "(", "actual", ")", "{", "fatal", "(", "tb", ",", "msgAndArgs", ",", "\"", "\"", ",", "<mask>", ",", "expectedMatch", ")", "\n", "}", "\n", "}" ]
7,627
all-7628
[ "UseTimer", "set", "timer", "for", "meaturing", "endpoint", "performance", ".", "If", "timer", "is", "nil", "and", "no", "timer", "exists", "then", "a", "new", "timer", "will", "be", "created", "else", "existing", "timer", "will", "be", "returned", ".", "You", "can", "serve", "statistics", "internal", "using", "Timer", "as", "handler" ]
[ "func", "(", "c4", "*", "Seefor", ")", "UseTimer", "(", "timer", "*", "Timer", ")", "*", "Timer", "{", "if", "timer", "==", "nil", "{", "if", "c4", ".", "timer", "!=", "nil", "{", "return", "c4", ".", "timer", "\n", "}", "\n", "timer", "=", "NewTimer", "(", ")", "\n", "}", "\n", "c4", ".", "<mask>", "=", "timer", "\n\n", "return", "c4", ".", "timer", "\n", "}" ]
7,628
all-7629
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetShowDebugBordersParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay5", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,629
all-7630
[ "UserLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "UserLocator", "(", "href", "string", ")", "*", "UserLocator", "{", "<mask>", "&", "UserLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
7,630
all-7631
[ "StackLines", "prints", "one", "complete", "stack", "trace", "without", "the", "header", "." ]
[ "func", "(", "p", "*", "Palette", ")", "StackLines", "(", "signature", "*", "stack", ".", "Signature", ",", "srcLen", ",", "pkgLen", "int", ",", "fullPath", "bool", ")", "string", "{", "out", ":=", "<mask>", "(", "[", "]", "string", ",", "len", "(", "signature", ".", "Stack", ".", "Calls", ")", ")", "\n", "for", "i", ":=", "range", "signature", ".", "Stack", ".", "Calls", "{", "out", "[", "i", "]", "=", "p", ".", "callLine", "(", "&", "signature", ".", "Stack", ".", "Calls", "[", "i", "]", ",", "srcLen", ",", "pkgLen", ",", "fullPath", ")", "\n", "}", "\n", "if", "signature", ".", "Stack", ".", "Elided", "{", "out", "=", "append", "(", "out", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "strings", ".", "Join", "(", "out", ",", "\"", "\\n", "\"", ")", "+", "\"", "\\n", "\"", "\n", "}" ]
7,631
all-7632
[ "requestVote", "is", "invoked", "when", "we", "get", "an", "request", "vote", "RPC", "call", "." ]
[ "func", "(", "r", "*", "Raft", ")", "requestVote", "(", "rpc", "RPC", ",", "req", "*", "RequestVoteRequest", ")", "{", "defer", "metrics", ".", "MeasureSince", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ",", "time", ".", "Now", "(", ")", ")", "\n", "r", ".", "observe", "(", "*", "req", ")", "\n\n", "// Setup a response", "resp", ":=", "&", "RequestVoteResponse", "{", "RPCHeader", ":", "r", ".", "getRPCHeader", "(", ")", ",", "Term", ":", "r", ".", "getCurrentTerm", "(", ")", ",", "Granted", ":", "false", ",", "}", "\n", "<mask>", "rpcErr", "error", "\n", "defer", "func", "(", ")", "{", "rpc", ".", "Respond", "(", "resp", ",", "rpcErr", ")", "\n", "}", "(", ")", "\n\n", "// Version 0 servers will panic unless the peers is present. It's only", "// used on them to produce a warning message.", "if", "r", ".", "protocolVersion", "<", "2", "{", "resp", ".", "Peers", "=", "encodePeers", "(", "r", ".", "configurations", ".", "latest", ",", "r", ".", "trans", ")", "\n", "}", "\n\n", "// Check if we have an existing leader [who's not the candidate]", "candidate", ":=", "r", ".", "trans", ".", "DecodePeer", "(", "req", ".", "Candidate", ")", "\n", "if", "leader", ":=", "r", ".", "Leader", "(", ")", ";", "leader", "!=", "\"", "\"", "&&", "leader", "!=", "candidate", "{", "r", ".", "logger", ".", "Warn", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "candidate", ",", "leader", ")", ")", "\n", "return", "\n", "}", "\n\n", "// Ignore an older term", "if", "req", ".", "Term", "<", "r", ".", "getCurrentTerm", "(", ")", "{", "return", "\n", "}", "\n\n", "// Increase the term if we see a newer one", "if", "req", ".", "Term", ">", "r", ".", "getCurrentTerm", "(", ")", "{", "// Ensure transition to follower", "r", ".", "setState", "(", "Follower", ")", "\n", "r", ".", "setCurrentTerm", "(", "req", ".", "Term", ")", "\n", "resp", ".", "Term", "=", "req", ".", "Term", "\n", "}", "\n\n", "// Check if we have voted yet", "lastVoteTerm", ",", "err", ":=", "r", ".", "stable", ".", "GetUint64", "(", "keyLastVoteTerm", ")", "\n", "if", "err", "!=", "nil", "&&", "err", ".", "Error", "(", ")", "!=", "\"", "\"", "{", "r", ".", "logger", ".", "Error", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", ")", "\n", "return", "\n", "}", "\n", "lastVoteCandBytes", ",", "err", ":=", "r", ".", "stable", ".", "Get", "(", "keyLastVoteCand", ")", "\n", "if", "err", "!=", "nil", "&&", "err", ".", "Error", "(", ")", "!=", "\"", "\"", "{", "r", ".", "logger", ".", "Error", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", ")", "\n", "return", "\n", "}", "\n\n", "// Check if we've voted in this election before", "if", "lastVoteTerm", "==", "req", ".", "Term", "&&", "lastVoteCandBytes", "!=", "nil", "{", "r", ".", "logger", ".", "Info", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "req", ".", "Term", ")", ")", "\n", "if", "bytes", ".", "Compare", "(", "lastVoteCandBytes", ",", "req", ".", "Candidate", ")", "==", "0", "{", "r", ".", "logger", ".", "Warn", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "req", ".", "Candidate", ")", ")", "\n", "resp", ".", "Granted", "=", "true", "\n", "}", "\n", "return", "\n", "}", "\n\n", "// Reject if their term is older", "lastIdx", ",", "lastTerm", ":=", "r", ".", "getLastEntry", "(", ")", "\n", "if", "lastTerm", ">", "req", ".", "LastLogTerm", "{", "r", ".", "logger", ".", "Warn", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "candidate", ",", "lastTerm", ",", "req", ".", "LastLogTerm", ")", ")", "\n", "return", "\n", "}", "\n\n", "if", "lastTerm", "==", "req", ".", "LastLogTerm", "&&", "lastIdx", ">", "req", ".", "LastLogIndex", "{", "r", ".", "logger", ".", "Warn", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "candidate", ",", "lastIdx", ",", "req", ".", "LastLogIndex", ")", ")", "\n", "return", "\n", "}", "\n\n", "// Persist a vote for safety", "if", "err", ":=", "r", ".", "persistVote", "(", "req", ".", "Term", ",", "req", ".", "Candidate", ")", ";", "err", "!=", "nil", "{", "r", ".", "logger", ".", "Error", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", ")", "\n", "return", "\n", "}", "\n\n", "resp", ".", "Granted", "=", "true", "\n", "r", ".", "setLastContact", "(", ")", "\n", "return", "\n", "}" ]
7,632
all-7633
[ "FilesystemDetect", "returns", "the", "filesystem", "on", "which", "the", "passed", "-", "in", "path", "sits", "." ]
[ "func", "FilesystemDetect", "(", "path", "string", ")", "(", "string", ",", "error", ")", "{", "fs", ":=", "syscall", ".", "Statfs_t", "{", "}", "\n\n", "err", ":=", "syscall", ".", "Statfs", "(", "path", ",", "&", "fs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "switch", "fs", ".", "Type", "{", "case", "FilesystemSuperMagicBtrfs", ":", "return", "\"", "\"", ",", "nil", "\n", "case", "FilesystemSuperMagicZfs", ":", "return", "\"", "\"", ",", "nil", "\n", "case", "FilesystemSuperMagicTmpfs", ":", "return", "\"", "\"", ",", "nil", "\n", "case", "FilesystemSuperMagicExt4", ":", "return", "\"", "\"", ",", "nil", "\n", "case", "FilesystemSuperMagicXfs", ":", "return", "\"", "\"", ",", "nil", "\n", "case", "FilesystemSuperMagicNfs", ":", "return", "\"", "\"", ",", "nil", "\n", "default", ":", "logger", ".", "Debugf", "(", "\"", "\"", ",", "fs", ".", "<mask>", ")", "\n", "return", "string", "(", "fs", ".", "Type", ")", ",", "nil", "\n", "}", "\n", "}" ]
7,633
all-7634
[ "GetCookies", "returns", "all", "cookies", "on", "the", "page", "." ]
[ "func", "(", "p", "*", "Page", ")", "GetCookies", "(", ")", "(", "[", "]", "*", "http", ".", "Cookie", ",", "error", ")", "{", "apiCookies", ",", "err", ":=", "p", ".", "session", ".", "GetCookies", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "cookies", ":=", "[", "]", "*", "http", ".", "Cookie", "{", "}", "\n", "for", "_", ",", "apiCookie", ":=", "<mask>", "apiCookies", "{", "expSeconds", ":=", "int64", "(", "apiCookie", ".", "Expiry", ")", "\n", "expNano", ":=", "int64", "(", "apiCookie", ".", "Expiry", "-", "float64", "(", "expSeconds", ")", ")", "*", "1000000000", "\n", "cookie", ":=", "&", "http", ".", "Cookie", "{", "Name", ":", "apiCookie", ".", "Name", ",", "Value", ":", "apiCookie", ".", "Value", ",", "Path", ":", "apiCookie", ".", "Path", ",", "Domain", ":", "apiCookie", ".", "Domain", ",", "Secure", ":", "apiCookie", ".", "Secure", ",", "HttpOnly", ":", "apiCookie", ".", "HTTPOnly", ",", "Expires", ":", "time", ".", "Unix", "(", "expSeconds", ",", "expNano", ")", ",", "}", "\n", "cookies", "=", "append", "(", "cookies", ",", "cookie", ")", "\n", "}", "\n", "return", "cookies", ",", "nil", "\n", "}" ]
7,634
all-7635
[ "Append", "writes", "len", "(", "b", ")", "bytes", "at", "the", "end", "of", "the", "File", ".", "It", "returns", "an", "error", "if", "any", "." ]
[ "func", "(", "e", "*", "edit", ")", "Append", "(", "b", "[", "]", "byte", ")", "error", "{", "_", ",", "err", ":=", "e", ".", "file", ".", "Seek", "(", "0", ",", "os", ".", "SEEK_END", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "_", ",", "err", "=", "e", ".", "<mask>", ".", "Write", "(", "b", ")", "\n", "return", "err", "\n", "}" ]
7,635
all-7636
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "UniformMatrix4x3fv", "(", "location", "int32", ",", "count", "int32", ",", "transpose", "bool", ",", "value", "*", "float32", ")", "{", "C", ".", "glowUniformMatrix4x3fv", "(", "gpUniformMatrix4x3fv", ",", "(", "C", ".", "GLint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ",", "(", "C", ".", "GLboolean", ")", "(", "boolToInt", "(", "transpose", ")", ")", ",", "(", "*", "C", ".", "GLfloat", ")", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ")", "\n", "}" ]
7,636
all-7637
[ "GetRangeFromIndex", "returns", "a", "subtree", "byte", "range", "in", "a", "serialized", "hashtree", "based", "on", "a", "passed", "in", "prefix", "." ]
[ "func", "GetRangeFromIndex", "(", "r", "io", ".", "Reader", ",", "prefix", "string", ")", "(", "uint64", ",", "uint64", ",", "error", ")", "{", "prefix", "=", "clean", "(", "<mask>", ")", "\n", "pbr", ":=", "pbutil", ".", "NewReader", "(", "r", ")", "\n", "idx", ":=", "&", "Index", "{", "}", "\n", "k", ":=", "b", "(", "prefix", ")", "\n", "var", "lower", ",", "upper", "uint64", "\n", "iter", ":=", "func", "(", "f", "func", "(", "int", ")", "bool", ")", "error", "{", "for", "{", "if", "err", ":=", "pbr", ".", "Read", "(", "idx", ")", ";", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "EOF", "{", "break", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "var", "cmp", "int", "\n", "if", "len", "(", "k", ")", "<", "len", "(", "idx", ".", "K", ")", "{", "cmp", "=", "bytes", ".", "Compare", "(", "k", ",", "idx", ".", "K", "[", ":", "len", "(", "k", ")", "]", ")", "\n", "}", "else", "{", "cmp", "=", "bytes", ".", "Compare", "(", "k", "[", ":", "len", "(", "idx", ".", "K", ")", "]", ",", "idx", ".", "K", ")", "\n", "}", "\n", "if", "f", "(", "cmp", ")", "{", "break", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}", "\n", "low", ":=", "func", "(", "cmp", "int", ")", "bool", "{", "if", "cmp", ">", "0", "{", "lower", "=", "idx", ".", "Offset", "\n", "return", "false", "\n", "}", "else", "if", "cmp", "<", "0", "{", "// Handles the case where a prefix fits within one range", "upper", "=", "idx", ".", "Offset", "\n", "}", "\n", "return", "true", "\n", "}", "\n", "up", ":=", "func", "(", "cmp", "int", ")", "bool", "{", "if", "cmp", "<", "0", "{", "upper", "=", "idx", ".", "Offset", "\n", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}", "\n", "// Find lower", "iter", "(", "low", ")", "\n", "// Find upper", "if", "upper", "<=", "0", "{", "iter", "(", "up", ")", "\n", "}", "\n", "// Handles the case when at the end of the indexes", "if", "upper", "<=", "0", "{", "return", "lower", ",", "0", ",", "nil", "\n", "}", "\n", "// Return offset and size", "return", "lower", ",", "upper", "-", "lower", ",", "nil", "\n", "}" ]
7,637
all-7638
[ "ToFloat64Or", "parses", "s", "as", "a", "float64", "or", "returns", "defaultValue", "." ]
[ "func", "ToFloat64Or", "(", "s", "string", ",", "defaultValue", "float64", ")", "float64", "{", "f", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "s", ",", "64", ")", "\n", "if", "<mask>", "!=", "nil", "{", "return", "defaultValue", "\n", "}", "\n", "return", "f", "\n", "}" ]
7,638
all-7639
[ "ReadIn", "reads", "the", "frame", "from", "the", "given", "io", ".", "Reader", ".", "Deprecated", ":", "Only", "maintained", "for", "backwards", "compatibility", ".", "Callers", "should", "use", "ReadBody", "instead", "." ]
[ "func", "(", "f", "*", "Frame", ")", "ReadIn", "(", "r", "io", ".", "Reader", ")", "error", "{", "header", ":=", "make", "(", "[", "]", "byte", ",", "FrameHeaderSize", ")", "\n", "if", "_", ",", "err", ":=", "<mask>", ".", "ReadFull", "(", "r", ",", "header", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "f", ".", "ReadBody", "(", "header", ",", "r", ")", "\n", "}" ]
7,639
all-7640
[ "InheritedMethods", "returns", "names", "for", "inherited", "methods", "on", "this", "service", "." ]
[ "func", "(", "s", "*", "<mask>", ")", "InheritedMethods", "(", ")", "[", "]", "string", "{", "if", "s", ".", "inheritedMethods", "!=", "nil", "{", "return", "s", ".", "inheritedMethods", "\n", "}", "\n\n", "for", "svc", ":=", "s", ".", "ExtendsService", ";", "svc", "!=", "nil", ";", "svc", "=", "svc", ".", "ExtendsService", "{", "for", "m", ":=", "range", "svc", ".", "Service", ".", "Methods", "{", "s", ".", "inheritedMethods", "=", "append", "(", "s", ".", "inheritedMethods", ",", "m", ")", "\n", "}", "\n", "}", "\n", "sort", ".", "Strings", "(", "s", ".", "inheritedMethods", ")", "\n\n", "return", "s", ".", "inheritedMethods", "\n", "}" ]
7,640
all-7641
[ "UnmarshalJSON", "implements", "json", ".", "Unmarshaler", ".", "It", "supports", "number", "and", "null", "input", ".", "0", "will", "not", "be", "considered", "a", "null", "Float", ".", "It", "also", "supports", "unmarshalling", "a", "sql", ".", "NullFloat64", "." ]
[ "func", "(", "f", "*", "Float", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "var", "err", "error", "\n", "var", "v", "interface", "{", "}", "\n", "if", "err", "=", "json", ".", "Unmarshal", "(", "data", ",", "&", "v", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "switch", "x", ":=", "v", ".", "(", "type", ")", "{", "case", "float64", ":", "f", ".", "Float64", "=", "float64", "(", "x", ")", "\n", "case", "string", ":", "str", ":=", "string", "(", "x", ")", "\n", "if", "len", "(", "str", ")", "==", "0", "{", "f", ".", "Valid", "=", "false", "\n", "return", "nil", "\n", "}", "\n", "f", ".", "Float64", ",", "err", "=", "strconv", ".", "ParseFloat", "(", "str", ",", "64", ")", "\n", "case", "map", "[", "string", "]", "interface", "{", "}", ":", "err", "=", "json", ".", "Unmarshal", "(", "data", ",", "&", "f", ".", "NullFloat64", ")", "\n", "case", "nil", ":", "f", ".", "Valid", "=", "false", "\n", "return", "nil", "\n", "default", ":", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "v", ")", ".", "Name", "(", ")", ")", "\n", "}", "\n", "f", ".", "Valid", "=", "err", "==", "nil", "\n", "return", "err", "\n", "}" ]
7,641
all-7642
[ "Parameter", "callback", "has", "type", "C", ".", "GLDEBUGPROCAMD", "." ]
[ "func", "DebugMessageCallbackAMD", "(", "<mask>", "unsafe", ".", "Pointer", ",", "userParam", "unsafe", ".", "Pointer", ")", "{", "C", ".", "glowDebugMessageCallbackAMD", "(", "gpDebugMessageCallbackAMD", ",", "(", "C", ".", "GLDEBUGPROCAMD", ")", "(", "callback", ")", ",", "userParam", ")", "\n", "}" ]
7,642
all-7643
[ "SetBuffer", "()", "is", "a", "wrapper", "around", "gtk_entry_set_buffer", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetBuffer", "(", "buffer", "*", "EntryBuffer", ")", "{", "C", ".", "gtk_entry_set_buffer", "(", "v", ".", "native", "(", ")", ",", "buffer", ".", "native", "(", ")", ")", "\n", "}" ]
7,643
all-7644
[ "GetApplication", "is", "a", "wrapper", "around", "gtk_window_get_application", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "GetApplication", "(", ")", "(", "*", "<mask>", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_window_get_application", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "return", "wrapApplication", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
7,644
all-7645
[ "parseParent", "splits", "a", "string", "describing", "a", "RBD", "storage", "entity", "into", "its", "components", "This", "can", "be", "used", "on", "strings", "like", "<osd", "-", "pool", "-", "name", ">", "/", "<lxd", "-", "specific", "-", "prefix", ">", "_<rbd", "-", "storage", "-", "volume", ">" ]
[ "func", "parseParent", "(", "parent", "string", ")", "(", "string", ",", "string", ",", "string", ",", "string", ",", "error", ")", "{", "idx", ":=", "strings", ".", "Index", "(", "parent", ",", "\"", "\"", ")", "\n", "if", "idx", "==", "-", "1", "{", "return", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "slider", ":=", "<mask>", "[", "(", "idx", "+", "1", ")", ":", "]", "\n", "poolName", ":=", "parent", "[", ":", "idx", "]", "\n\n", "volumeType", ":=", "slider", "\n", "idx", "=", "strings", ".", "Index", "(", "slider", ",", "\"", "\"", ")", "\n", "if", "idx", "==", "0", "{", "idx", "+=", "len", "(", "\"", "\"", ")", "\n", "volumeType", "=", "slider", "\n", "slider", "=", "slider", "[", "idx", ":", "]", "\n", "}", "\n\n", "idxType", ":=", "strings", ".", "Index", "(", "slider", ",", "\"", "\"", ")", "\n", "if", "idxType", "==", "-", "1", "{", "return", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "idx", "==", "len", "(", "\"", "\"", ")", "{", "idxType", "+=", "idx", "\n", "}", "\n", "volumeType", "=", "volumeType", "[", ":", "idxType", "]", "\n\n", "idx", "=", "strings", ".", "Index", "(", "slider", ",", "\"", "\"", ")", "\n", "if", "idx", "==", "-", "1", "{", "return", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "volumeName", ":=", "slider", "\n", "idx", "=", "strings", ".", "Index", "(", "volumeName", ",", "\"", "\"", ")", "\n", "if", "idx", "==", "-", "1", "{", "return", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "volumeName", "=", "volumeName", "[", "(", "idx", "+", "1", ")", ":", "]", "\n\n", "idx", "=", "strings", ".", "Index", "(", "volumeName", ",", "\"", "\"", ")", "\n", "if", "idx", "==", "-", "1", "{", "return", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "snapshotName", ":=", "volumeName", "[", "(", "idx", "+", "1", ")", ":", "]", "\n", "volumeName", "=", "volumeName", "[", ":", "idx", "]", "\n\n", "return", "poolName", ",", "volumeType", ",", "volumeName", ",", "snapshotName", ",", "nil", "\n", "}" ]
7,645
all-7646
[ "Debugf", "outputs", "formatted", "Debug", "level", "log" ]
[ "func", "(", "g", "*", "Glg", ")", "Debugf", "(", "format", "string", ",", "val", "...", "<mask>", "{", "}", ")", "error", "{", "return", "g", ".", "out", "(", "DEBG", ",", "format", ",", "val", "...", ")", "\n", "}" ]
7,646
all-7647
[ "HasCriticalRecovery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "ThresholdCount", ")", "HasCriticalRecovery", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "CriticalRecovery", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
7,647
all-7648
[ "Parse", "constructs", "a", "new", "KP", "from", "the", "provided", "string", "which", "should", "be", "either", "an", "address", "or", "a", "seed", ".", "If", "the", "provided", "input", "is", "a", "seed", "the", "resulting", "KP", "will", "have", "signing", "capabilities", "." ]
[ "func", "Parse", "(", "addressOrSeed", "string", ")", "(", "KP", ",", "error", ")", "{", "_", ",", "err", ":=", "strkey", ".", "Decode", "(", "strkey", ".", "VersionByteAccountID", ",", "addressOrSeed", ")", "\n", "if", "err", "==", "nil", "{", "return", "&", "FromAddress", "{", "addressOrSeed", "}", ",", "nil", "\n", "}", "\n\n", "if", "err", "!=", "strkey", ".", "ErrInvalidVersionByte", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "_", ",", "err", "=", "strkey", ".", "Decode", "(", "strkey", ".", "VersionByteSeed", ",", "addressOrSeed", ")", "\n", "if", "err", "==", "nil", "{", "return", "&", "Full", "{", "addressOrSeed", "}", ",", "nil", "\n", "}", "\n\n", "<mask>", "nil", ",", "err", "\n", "}" ]
7,648
all-7649
[ "resourceVSphereStorageDrsVMOverrideFindEntry", "attempts", "to", "locate", "an", "existing", "VM", "config", "in", "a", "Storage", "Pod", "s", "DRS", "configuration", ".", "It", "s", "used", "by", "the", "resource", "s", "read", "functionality", "and", "tests", ".", "nil", "is", "returned", "if", "the", "entry", "cannot", "be", "found", "." ]
[ "func", "resourceVSphereStorageDrsVMOverrideFindEntry", "(", "pod", "*", "<mask>", ".", "StoragePod", ",", "vm", "*", "object", ".", "VirtualMachine", ",", ")", "(", "*", "types", ".", "StorageDrsVmConfigInfo", ",", "error", ")", "{", "props", ",", "err", ":=", "storagepod", ".", "Properties", "(", "pod", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "for", "_", ",", "info", ":=", "range", "props", ".", "PodStorageDrsEntry", ".", "StorageDrsConfig", ".", "VmConfig", "{", "if", "*", "info", ".", "Vm", "==", "vm", ".", "Reference", "(", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "Name", "(", ")", ",", "pod", ".", "Name", "(", ")", ")", "\n", "return", "&", "info", ",", "nil", "\n", "}", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "Name", "(", ")", ",", "pod", ".", "Name", "(", ")", ")", "\n", "return", "nil", ",", "nil", "\n", "}" ]
7,649
all-7650
[ "Fatalf", "is", "equivalent", "to", "Errorf", "followed", "by", "a", "call", "to", "os", ".", "Exit", "(", "1", ")", "." ]
[ "func", "(", "t", "*", "T", ")", "Fatalf", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "t", ".", "Errorf", "(", "format", ",", "args", "...", ")", "\n", "<mask>", ".", "Exit", "(", "1", ")", "\n", "}" ]
7,650
all-7651
[ "Do", "executes", "Page", ".", "stopScreencast", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "StopScreencastParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandStopScreencast", ",", "nil", ",", "nil", ")", "\n", "}" ]
7,651
all-7652
[ "ListSecrets", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "ListSecrets", "(", "arg0", "*", "secretsmanager", ".", "ListSecretsInput", ")", "(", "*", "secretsmanager", ".", "ListSecretsOutput", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "ListSecretsOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
7,652
all-7653
[ "GetRepo", "returns", "the", "repo", "for", "the", "provided", "owner", "/", "name", "combination", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "repos", "/", "#get" ]
[ "func", "(", "c", "*", "Client", ")", "GetRepo", "(", "owner", ",", "name", "string", ")", "(", "Repo", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "owner", ",", "name", ")", "\n\n", "var", "repo", "Repo", "\n", "_", ",", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "method", ":", "http", ".", "MethodGet", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "owner", ",", "<mask>", ")", ",", "exitCodes", ":", "[", "]", "int", "{", "200", "}", ",", "}", ",", "&", "repo", ")", "\n", "return", "repo", ",", "err", "\n", "}" ]
7,653
all-7654
[ "Helper", "to", "delete", "an", "image", "file", "from", "the", "local", "images", "directory", "." ]
[ "func", "imageDeleteFromDisk", "(", "fingerprint", "string", ")", "{", "// Remove main image file.", "fname", ":=", "shared", ".", "VarPath", "(", "\"", "\"", ",", "fingerprint", ")", "\n", "if", "shared", ".", "PathExists", "(", "fname", ")", "{", "err", ":=", "<mask>", ".", "Remove", "(", "fname", ")", "\n", "if", "err", "!=", "nil", "&&", "!", "os", ".", "IsNotExist", "(", "err", ")", "{", "logger", ".", "Errorf", "(", "\"", "\"", ",", "fname", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "// Remove the rootfs file for the image.", "fname", "=", "shared", ".", "VarPath", "(", "\"", "\"", ",", "fingerprint", ")", "+", "\"", "\"", "\n", "if", "shared", ".", "PathExists", "(", "fname", ")", "{", "err", ":=", "os", ".", "Remove", "(", "fname", ")", "\n", "if", "err", "!=", "nil", "&&", "!", "os", ".", "IsNotExist", "(", "err", ")", "{", "logger", ".", "Errorf", "(", "\"", "\"", ",", "fname", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}" ]
7,654
all-7655
[ "GetProcessQueryOk", "returns", "a", "tuple", "with", "the", "ProcessQuery", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TimeseriesRequest", ")", "GetProcessQueryOk", "(", ")", "(", "WidgetProcessQuery", ",", "bool", ")", "{", "if", "t", "==", "nil", "||", "t", ".", "ProcessQuery", "==", "nil", "{", "return", "WidgetProcessQuery", "{", "}", ",", "false", "\n", "}", "\n", "return", "*", "t", ".", "ProcessQuery", ",", "<mask>", "\n", "}" ]
7,655
all-7656
[ "CertSave", "stores", "a", "CertBaseInfo", "object", "in", "the", "db", "it", "will", "ignore", "the", "ID", "field", "from", "the", "CertInfo", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "CertSave", "(", "cert", "*", "CertInfo", ")", "error", "{", "err", ":=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "stmt", ",", "err", ":=", "tx", ".", "tx", ".", "Prepare", "(", "`\n\t\t\tINSERT INTO certificates (\n\t\t\t\tfingerprint,\n\t\t\t\ttype,\n\t\t\t\tname,\n\t\t\t\tcertificate\n\t\t\t) VALUES (?, ?, ?, ?)`", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "stmt", ".", "Close", "(", ")", "\n", "_", ",", "err", "=", "stmt", ".", "Exec", "(", "cert", ".", "Fingerprint", ",", "<mask>", ".", "Type", ",", "cert", ".", "Name", ",", "cert", ".", "Certificate", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "return", "err", "\n", "}" ]
7,656
all-7657
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SearchInResponseBodyParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork21", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
7,657
all-7658
[ "Variant", "returns", "the", "variant", "encoded", "in", "uuid", "." ]
[ "func", "(", "uuid", "UUID", ")", "Variant", "(", ")", "Variant", "{", "<mask>", "{", "case", "(", "uuid", "[", "8", "]", "&", "0xc0", ")", "==", "0x80", ":", "return", "RFC4122", "\n", "case", "(", "uuid", "[", "8", "]", "&", "0xe0", ")", "==", "0xc0", ":", "return", "Microsoft", "\n", "case", "(", "uuid", "[", "8", "]", "&", "0xe0", ")", "==", "0xe0", ":", "return", "Future", "\n", "default", ":", "return", "Reserved", "\n", "}", "\n", "}" ]
7,658
all-7659
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "CompositingReasonsReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree19", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
7,659
all-7660
[ "Do", "executes", "Page", ".", "getFrameTree", "against", "the", "provided", "context", ".", "returns", ":", "frameTree", "-", "Present", "frame", "tree", "structure", "." ]
[ "func", "(", "p", "*", "GetFrameTreeParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "frameTree", "*", "FrameTree", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetFrameTreeReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetFrameTree", ",", "nil", ",", "&", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "FrameTree", ",", "nil", "\n", "}" ]
7,660
all-7661
[ "SendSnapshot", "sends", "a", "ZFS", "stream", "of", "a", "snapshot", "to", "the", "input", "io", ".", "Writer", ".", "An", "error", "will", "be", "returned", "if", "the", "input", "dataset", "is", "not", "of", "snapshot", "type", "." ]
[ "func", "(", "d", "*", "Dataset", ")", "SendSnapshot", "(", "output", "io", ".", "Writer", ")", "error", "{", "if", "d", ".", "<mask>", "!=", "DatasetSnapshot", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "c", ":=", "command", "{", "Command", ":", "\"", "\"", ",", "Stdout", ":", "output", "}", "\n", "_", ",", "err", ":=", "c", ".", "Run", "(", "\"", "\"", ",", "d", ".", "Name", ")", "\n", "return", "err", "\n", "}" ]
7,661
all-7662
[ "FieldsFromIncomingContext", "returns", "peer", "information", "and", "MDLogFields", "from", "the", "given", "context" ]
[ "func", "FieldsFromIncomingContext", "(", "ctx", "context", ".", "Context", ")", "ttnlog", ".", "Fields", "{", "fields", ":=", "make", "(", "fieldMap", ")", "\n", "if", "peer", ",", "ok", ":=", "peer", ".", "FromContext", "(", "ctx", ")", ";", "ok", "{", "fields", ".", "addFromPeer", "(", "peer", ")", "\n", "}", "\n", "if", "md", ",", "ok", ":=", "metadata", ".", "FromIncomingContext", "(", "ctx", ")", ";", "ok", "{", "fields", ".", "addFromMD", "(", "<mask>", ")", "\n", "}", "\n", "return", "fields", ".", "LogFields", "(", ")", "\n", "}" ]
7,662
all-7663
[ "validateIdentifier", "makes", "sure", "the", "provided", "identifier", "satisfies", "semver", "spec" ]
[ "func", "validateIdentifier", "(", "id", "string", ")", "error", "{", "if", "<mask>", "!=", "\"", "\"", "&&", "!", "reIdentifier", ".", "MatchString", "(", "id", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "id", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,663
all-7664
[ "SetHeader", "sets", "a", "header", "to", "be", "sent", "with", "the", "request", "for", "internationalization", "https", ":", "//", "developer", ".", "foursquare", ".", "com", "/", "docs", "/", "api", "/", "configuration", "/", "versioning" ]
[ "func", "(", "s", "*", "VenueService", ")", "SetHeader", "(", "key", ",", "<mask>", "string", ")", "*", "VenueService", "{", "s", ".", "sling", ".", "Set", "(", "key", ",", "value", ")", "\n", "return", "s", "\n", "}" ]
7,664
all-7665
[ "ServerTemplateMultiCloudImageLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "ServerTemplateMultiCloudImageLocator", "(", "href", "<mask>", ")", "*", "ServerTemplateMultiCloudImageLocator", "{", "return", "&", "ServerTemplateMultiCloudImageLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
7,665
all-7666
[ "Equal", "gets", "whether", "the", "Data", "and", "specified", "value", "are", "equal", ".", "Supports", "regexp", "values", "." ]
[ "func", "(", "v", "Value", ")", "Equal", "(", "val", "interface", "{", "}", ")", "bool", "{", "var", "str", "string", "\n", "var", "ok", "bool", "\n", "if", "str", ",", "ok", "=", "v", ".", "Data", ".", "(", "string", ")", ";", "!", "<mask>", "{", "return", "v", ".", "Data", "==", "val", "\n", "}", "\n", "if", "isRegex", "(", "str", ")", "{", "// looks like regexp to me", "regex", ":=", "regexp", ".", "MustCompile", "(", "str", "[", "1", ":", "len", "(", "str", ")", "-", "1", "]", ")", "\n", "// turn the value into a string", "valStr", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "val", ")", "\n", "if", "regex", ".", "Match", "(", "[", "]", "byte", "(", "valStr", ")", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Data", ")", "==", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "val", ")", "\n", "}" ]
7,666
all-7667
[ "Subscription", "creates", "a", "subscription", "from", "the", "Cloud", "Pub", "/", "Sub", "Client" ]
[ "func", "(", "c", "*", "pubSubClient", ")", "subscription", "(", "id", "string", ")", "subscriptionInterface", "{", "return", "&", "pubSubSubscription", "{", "sub", ":", "c", ".", "client", ".", "Subscription", "(", "<mask>", ")", ",", "}", "\n", "}" ]
7,667
all-7668
[ "ExpanderNew", "is", "a", "wrapper", "around", "gtk_expander_new", "()", "." ]
[ "func", "ExpanderNew", "(", "label", "string", ")", "(", "*", "Expander", ",", "error", ")", "{", "var", "cstr", "*", "C", ".", "gchar", "\n", "if", "label", "!=", "\"", "\"", "{", "cstr", ":=", "C", ".", "CString", "(", "label", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "}", "\n", "c", ":=", "C", ".", "gtk_expander_new", "(", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapExpander", "(", "obj", ")", ",", "nil", "\n", "}" ]
7,668
all-7669
[ "readTags", "reads", "and", "extracts", "build", "tags", "from", "the", "block", "of", "comments", "and", "blank", "lines", "at", "the", "start", "of", "a", "file", "which", "is", "separated", "from", "the", "rest", "of", "the", "file", "by", "a", "blank", "line", ".", "Each", "string", "in", "the", "returned", "slice", "is", "the", "trimmed", "text", "of", "a", "line", "after", "a", "+", "build", "prefix", ".", "Based", "on", "go", "/", "build", ".", "Context", ".", "shouldBuild", "." ]
[ "func", "readTags", "(", "path", "string", ")", "(", "[", "]", "tagLine", ",", "error", ")", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n", "scanner", ":=", "bufio", ".", "NewScanner", "(", "f", ")", "\n\n", "// Pass 1: Identify leading run of // comments and blank lines,", "// which must be followed by a blank line.", "var", "lines", "[", "]", "string", "\n", "end", ":=", "0", "\n", "for", "scanner", ".", "Scan", "(", ")", "{", "line", ":=", "strings", ".", "TrimSpace", "(", "scanner", ".", "Text", "(", ")", ")", "\n", "if", "line", "==", "\"", "\"", "{", "end", "=", "len", "(", "lines", ")", "\n", "continue", "\n", "}", "\n", "if", "strings", ".", "HasPrefix", "(", "line", ",", "\"", "\"", ")", "{", "lines", "=", "append", "(", "lines", ",", "line", "[", "len", "(", "\"", "\"", ")", ":", "]", ")", "\n", "continue", "\n", "}", "\n", "break", "\n", "}", "\n", "if", "err", ":=", "scanner", ".", "Err", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "<mask>", "=", "lines", "[", ":", "end", "]", "\n\n", "// Pass 2: Process each line in the run.", "var", "tagLines", "[", "]", "tagLine", "\n", "for", "_", ",", "line", ":=", "range", "lines", "{", "fields", ":=", "strings", ".", "Fields", "(", "line", ")", "\n", "if", "len", "(", "fields", ")", ">", "0", "&&", "fields", "[", "0", "]", "==", "\"", "\"", "{", "tagLines", "=", "append", "(", "tagLines", ",", "parseTagsInGroups", "(", "fields", "[", "1", ":", "]", ")", ")", "\n", "}", "\n", "}", "\n", "return", "tagLines", ",", "nil", "\n", "}" ]
7,669
all-7670
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Bucket", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser20", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,670
all-7671
[ "WriteString", "writes", "a", "string", "." ]
[ "func", "(", "w", "*", "<mask>", ")", "WriteString", "(", "s", "string", ")", "{", "if", "w", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "w", ".", "wr", ".", "WriteString", "(", "s", ")", "\n", "}" ]
7,671
all-7672
[ "WriteArgs", "writes", "the", "given", "arguments", "to", "the", "call", "and", "returns", "the", "response", "args", "." ]
[ "func", "WriteArgs", "(", "call", "*", "tchannel", ".", "OutboundCall", ",", "arg2", ",", "arg3", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "[", "]", "byte", ",", "*", "tchannel", ".", "OutboundCallResponse", ",", "error", ")", "{", "if", "err", ":=", "tchannel", ".", "NewArgWriter", "(", "call", ".", "Arg2Writer", "(", ")", ")", ".", "Write", "(", "arg2", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "if", "err", ":=", "tchannel", ".", "NewArgWriter", "(", "call", ".", "Arg3Writer", "(", ")", ")", ".", "Write", "(", "arg3", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "resp", ":=", "<mask>", ".", "Response", "(", ")", "\n", "var", "respArg2", "[", "]", "byte", "\n", "if", "err", ":=", "tchannel", ".", "NewArgReader", "(", "resp", ".", "Arg2Reader", "(", ")", ")", ".", "Read", "(", "&", "respArg2", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "var", "respArg3", "[", "]", "byte", "\n", "if", "err", ":=", "tchannel", ".", "NewArgReader", "(", "resp", ".", "Arg3Reader", "(", ")", ")", ".", "Read", "(", "&", "respArg3", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "return", "respArg2", ",", "respArg3", ",", "resp", ",", "nil", "\n", "}" ]
7,672
all-7673
[ "Contains", "searches", "the", "Dictionary", "to", "see", "if", "the", "specified", "word", "is", "present", ".", "Time", "complexity", ":", "O", "(", "m", ")", "where", "m", "is", "the", "length", "of", "word", "." ]
[ "func", "(", "dict", "Dictionary", ")", "Contains", "(", "word", "string", ")", "bool", "{", "if", "dict", ".", "root", "==", "nil", "{", "return", "false", "\n", "}", "\n", "targetNode", ":=", "dict", ".", "<mask>", ".", "Navigate", "(", "word", ")", "\n", "return", "targetNode", "!=", "nil", "&&", "targetNode", ".", "IsWord", "\n", "}" ]
7,673
all-7674
[ "Initialize", "initializes", "the", "resource", "fileds", "in", "cgroup" ]
[ "func", "(", "cgroup", "*", "CgroupResource", ")", "Initialize", "(", "resourceFields", "*", "taskresource", ".", "ResourceFields", ",", "taskKnownStatus", "status", ".", "TaskStatus", ",", "taskDesiredStatus", "status", ".", "TaskStatus", ")", "{", "cgroup", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "cgroup", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "cgroup", ".", "initializeResourceStatusToTransitionFunction", "(", ")", "\n", "cgroup", ".", "ioutil", "=", "resourceFields", ".", "IOUtil", "\n", "cgroup", ".", "<mask>", "=", "resourceFields", ".", "Control", "\n", "}" ]
7,674
all-7675
[ "Add", "a", "new", "VLAN", "interface", "with", "masterDev", "as", "its", "upper", "device", "This", "is", "identical", "to", "running", ":", "ip", "link", "add", "name", "$name", "link", "$masterdev", "type", "vlan", "id", "$id" ]
[ "func", "NetworkLinkAddVlan", "(", "masterDev", ",", "vlanDev", "string", ",", "vlanId", "uint16", ")", "error", "{", "s", ",", "err", ":=", "getNetlinkSocket", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "s", ".", "Close", "(", ")", "\n\n", "wb", ":=", "newNetlinkRequest", "(", "syscall", ".", "RTM_NEWLINK", ",", "syscall", ".", "NLM_F_CREATE", "|", "syscall", ".", "NLM_F_EXCL", "|", "syscall", ".", "NLM_F_ACK", ")", "\n\n", "masterDevIfc", ",", "err", ":=", "net", ".", "InterfaceByName", "(", "masterDev", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "msg", ":=", "newIfInfomsg", "(", "syscall", ".", "AF_UNSPEC", ")", "\n", "wb", ".", "AddData", "(", "<mask>", ")", "\n\n", "nest1", ":=", "newRtAttr", "(", "syscall", ".", "IFLA_LINKINFO", ",", "nil", ")", "\n", "newRtAttrChild", "(", "nest1", ",", "IFLA_INFO_KIND", ",", "nonZeroTerminated", "(", "\"", "\"", ")", ")", "\n\n", "nest2", ":=", "newRtAttrChild", "(", "nest1", ",", "IFLA_INFO_DATA", ",", "nil", ")", "\n", "vlanData", ":=", "make", "(", "[", "]", "byte", ",", "2", ")", "\n", "native", ".", "PutUint16", "(", "vlanData", ",", "vlanId", ")", "\n", "newRtAttrChild", "(", "nest2", ",", "IFLA_VLAN_ID", ",", "vlanData", ")", "\n", "wb", ".", "AddData", "(", "nest1", ")", "\n\n", "wb", ".", "AddData", "(", "uint32Attr", "(", "syscall", ".", "IFLA_LINK", ",", "uint32", "(", "masterDevIfc", ".", "Index", ")", ")", ")", "\n", "wb", ".", "AddData", "(", "newRtAttr", "(", "syscall", ".", "IFLA_IFNAME", ",", "zeroTerminated", "(", "vlanDev", ")", ")", ")", "\n\n", "if", "err", ":=", "s", ".", "Send", "(", "wb", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "s", ".", "HandleAck", "(", "wb", ".", "Seq", ")", "\n", "}" ]
7,675
all-7676
[ "Listed", "returns", "the", "lists", "that", "this", "venue", "appears", "on", "https", ":", "//", "developer", ".", "foursquare", ".", "com", "/", "docs", "/", "api", "/", "venues", "/", "listed" ]
[ "func", "(", "s", "*", "VenueService", ")", "Listed", "(", "params", "*", "VenueListedParams", ")", "(", "*", "Listed", ",", "*", "http", ".", "Response", ",", "error", ")", "{", "<mask>", ":=", "new", "(", "venueListedResp", ")", "\n", "response", ":=", "new", "(", "Response", ")", "\n\n", "resp", ",", "err", ":=", "s", ".", "sling", ".", "New", "(", ")", ".", "Get", "(", "params", ".", "VenueID", "+", "\"", "\"", ")", ".", "QueryStruct", "(", "params", ")", ".", "Receive", "(", "response", ",", "response", ")", "\n", "if", "err", "==", "nil", "{", "json", ".", "Unmarshal", "(", "response", ".", "Response", ",", "lists", ")", "\n", "}", "\n\n", "return", "&", "lists", ".", "Lists", ",", "resp", ",", "relevantError", "(", "err", ",", "*", "response", ")", "\n", "}" ]
7,676
all-7677
[ "Value", "returns", "the", "current", "ProgressBar", "value" ]
[ "func", "(", "b", "*", "ProgressBar", ")", "<mask>", "(", ")", "int", "{", "b", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "b", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "b", ".", "value", "\n", "}" ]
7,677
all-7678
[ "RemoveLogger", "deletes", "logger", "from", "global", "logger", "registry", "." ]
[ "func", "RemoveLogger", "(", "name", "string", ")", "{", "lock", ".", "Lock", "(", ")", "\n", "delete", "(", "loggers", ",", "name", ")", "\n", "if", "name", "==", "\"", "\"", "{", "defaultLogger", "=", "nil", "\n", "}", "\n", "<mask>", ".", "Unlock", "(", ")", "\n", "}" ]
7,678
all-7679
[ "GetMetric", "returns", "the", "Metric", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TileDefRequest", ")", "GetMetric", "(", ")", "string", "{", "if", "t", "==", "nil", "||", "t", ".", "Metric", "==", "nil", "{", "<mask>", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "Metric", "\n", "}" ]
7,679
all-7680
[ "WithFilter", "creates", "a", "new", "Filtered", "that", "will", "use", "the", "extra", "filters" ]
[ "func", "(", "f", "*", "Filtered", ")", "WithFilters", "(", "filters", "...", "Filter", ")", "*", "Filtered", "{", "return", "&", "Filtered", "{", "Interface", ":", "f", ".", "Interface", ",", "filters", ":", "<mask>", "(", "f", ".", "filters", ",", "filters", "...", ")", ",", "}", "\n", "}" ]
7,680
all-7681
[ "Ads", "a", "Header", "to", "message" ]
[ "func", "(", "m", "*", "Message", ")", "AddHeader", "(", "key", "string", ",", "value", "string", ")", "Header", "{", "newHeader", ":=", "Header", "{", "Key", ":", "key", ",", "Value", ":", "<mask>", "}", "\n", "m", ".", "Headers", "=", "append", "(", "m", ".", "Headers", ",", "newHeader", ")", "\n", "return", "newHeader", "\n", "}" ]
7,681
all-7682
[ "FreeNode", "deallocates", "the", "skiplist", "node", "memory" ]
[ "func", "(", "s", "*", "Skiplist", ")", "FreeNode", "(", "n", "*", "<mask>", ",", "sts", "*", "Stats", ")", "{", "s", ".", "freeNode", "(", "n", ")", "\n", "sts", ".", "AddInt64", "(", "&", "sts", ".", "nodeFrees", ",", "1", ")", "\n", "}" ]
7,682
all-7683
[ "traverse", "tries", "matches", "to", "child", "entries", "." ]
[ "func", "(", "e", "*", "Entry", ")", "traverse", "(", "method", ",", "urlStr", "string", ")", "(", "*", "Route", ",", "[", "]", "string", ")", "{", "for", "_", ",", "<mask>", ":=", "range", "e", ".", "entries", "{", "if", "h", ",", "params", ":=", "entry", ".", "exec", "(", "method", ",", "urlStr", ")", ";", "h", "!=", "nil", "{", "return", "h", ",", "params", "\n", "}", "\n", "}", "\n", "return", "nil", ",", "nil", "\n", "}" ]
7,683
all-7684
[ "expr", "parses", "any", "expression", "." ]
[ "func", "(", "p", "*", "parser", ")", "expr", "(", ")", "Expr", "{", "// Parse the starting expression.", "expr", ":=", "p", ".", "unaryExpr", "(", ")", "\n\n", "// Loop through the operations and construct a binary operation tree based", "// on the operators' precedence.", "for", "{", "// If the next token is not an operator the expression is done.", "op", ":=", "p", ".", "peek", "(", ")", ".", "typ", "\n", "if", "!", "op", ".", "isOperator", "(", ")", "{", "// Check for subquery.", "if", "op", "==", "ItemLeftBracket", "{", "expr", "=", "p", ".", "subqueryOrRangeSelector", "(", "expr", ",", "false", ")", "\n", "if", "s", ",", "ok", ":=", "expr", ".", "(", "*", "SubqueryExpr", ")", ";", "ok", "{", "// Parse optional offset.", "if", "p", ".", "peek", "(", ")", ".", "typ", "==", "ItemOffset", "{", "<mask>", ":=", "p", ".", "offset", "(", ")", "\n", "s", ".", "Offset", "=", "offset", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "expr", "\n", "}", "\n", "p", ".", "next", "(", ")", "// Consume operator.", "\n\n", "// Parse optional operator matching options. Its validity", "// is checked in the type-checking stage.", "vecMatching", ":=", "&", "VectorMatching", "{", "Card", ":", "CardOneToOne", ",", "}", "\n", "if", "op", ".", "isSetOperator", "(", ")", "{", "vecMatching", ".", "Card", "=", "CardManyToMany", "\n", "}", "\n\n", "returnBool", ":=", "false", "\n", "// Parse bool modifier.", "if", "p", ".", "peek", "(", ")", ".", "typ", "==", "ItemBool", "{", "if", "!", "op", ".", "isComparisonOperator", "(", ")", "{", "p", ".", "errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "p", ".", "next", "(", ")", "\n", "returnBool", "=", "true", "\n", "}", "\n\n", "// Parse ON/IGNORING clause.", "if", "p", ".", "peek", "(", ")", ".", "typ", "==", "ItemOn", "||", "p", ".", "peek", "(", ")", ".", "typ", "==", "ItemIgnoring", "{", "if", "p", ".", "peek", "(", ")", ".", "typ", "==", "ItemOn", "{", "vecMatching", ".", "On", "=", "true", "\n", "}", "\n", "p", ".", "next", "(", ")", "\n", "vecMatching", ".", "MatchingLabels", "=", "p", ".", "labels", "(", ")", "\n\n", "// Parse grouping.", "if", "t", ":=", "p", ".", "peek", "(", ")", ".", "typ", ";", "t", "==", "ItemGroupLeft", "||", "t", "==", "ItemGroupRight", "{", "p", ".", "next", "(", ")", "\n", "if", "t", "==", "ItemGroupLeft", "{", "vecMatching", ".", "Card", "=", "CardManyToOne", "\n", "}", "else", "{", "vecMatching", ".", "Card", "=", "CardOneToMany", "\n", "}", "\n", "if", "p", ".", "peek", "(", ")", ".", "typ", "==", "ItemLeftParen", "{", "vecMatching", ".", "Include", "=", "p", ".", "labels", "(", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "ln", ":=", "range", "vecMatching", ".", "MatchingLabels", "{", "for", "_", ",", "ln2", ":=", "range", "vecMatching", ".", "Include", "{", "if", "ln", "==", "ln2", "&&", "vecMatching", ".", "On", "{", "p", ".", "errorf", "(", "\"", "\"", ",", "ln", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "// Parse the next operand.", "rhs", ":=", "p", ".", "unaryExpr", "(", ")", "\n\n", "// Assign the new root based on the precedence of the LHS and RHS operators.", "expr", "=", "p", ".", "balance", "(", "expr", ",", "op", ",", "rhs", ",", "vecMatching", ",", "returnBool", ")", "\n", "}", "\n", "}" ]
7,684
all-7685
[ "ToString", "returns", "the", "list", "of", "hosts", "into", "a", "pretty", "-", "printed", "format" ]
[ "func", "(", "s", "Scan", ")", "ToString", "(", ")", "(", "<mask>", "string", ")", "{", "for", "_", ",", "host", ":=", "range", "s", ".", "Hosts", "{", "out", "+=", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "host", ".", "ToString", "(", ")", ")", "\n", "}", "\n", "return", "\n", "}" ]
7,685
all-7686
[ "HTTP", "creates", "a", "HTTP", "server", "and", "registers", "it", "with", "the", "sentinel", "." ]
[ "func", "(", "s", "*", "Sentinel", ")", "HTTP", "(", "listener", "net", ".", "Listener", ",", "handler", "http", ".", "Handler", ",", "opts", "...", "ServerOption", ")", "error", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n\n", "if", "s", ".", "started", "{", "return", "ErrAlreadyStarted", "\n", "}", "\n\n", "var", "err", "error", "\n\n", "// create server and apply options", "server", ":=", "&", "http", ".", "<mask>", "{", "Handler", ":", "handler", ",", "}", "\n", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "err", "=", "o", "(", "server", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "// register server", "return", "s", ".", "Register", "(", "func", "(", ")", "error", "{", "return", "server", ".", "Serve", "(", "listener", ")", "\n", "}", ",", "server", ".", "Shutdown", ",", "IgnoreServerClosed", ",", "IgnoreNetOpError", ")", "\n", "}" ]
7,686
all-7687
[ "DebugPrintAt", "draws", "the", "string", "str", "on", "the", "image", "at", "(", "x", "y", ")", "position", ".", "The", "available", "runes", "are", "in", "U", "+", "0000", "to", "U", "+", "00FF", "which", "is", "C0", "Controls", "and", "Basic", "Latin", "and", "C1", "Controls", "and", "Latin", "-", "1", "Supplement", "." ]
[ "func", "DebugPrintAt", "(", "image", "*", "ebiten", ".", "Image", ",", "str", "string", ",", "x", ",", "y", "int", ")", "{", "drawDebugText", "(", "<mask>", ",", "str", ",", "x", "+", "1", ",", "y", "+", "1", ",", "true", ")", "\n", "drawDebugText", "(", "image", ",", "str", ",", "x", ",", "y", ",", "false", ")", "\n", "}" ]
7,687
all-7688
[ "NewWebDriver", "returns", "an", "instance", "of", "a", "WebDriver", "specified", "by", "a", "templated", "URL", "and", "command", ".", "The", "URL", "should", "be", "the", "location", "of", "the", "WebDriver", "Wire", "Protocol", "web", "service", "brought", "up", "by", "the", "command", ".", "The", "command", "should", "be", "provided", "as", "a", "list", "of", "arguments", "(", "each", "of", "which", "are", "templated", ")", ".", "The", "Timeout", "Option", "specifies", "how", "many", "seconds", "to", "wait", "for", "the", "web", "service", "to", "become", "available", ".", "The", "default", "timeout", "is", "5", "seconds", ".", "The", "HTTPClient", "Option", "specifies", "a", "*", "http", ".", "Client", "to", "use", "for", "all", "WebDriver", "communications", ".", "The", "default", "client", "is", "http", ".", "DefaultClient", ".", "Any", "other", "provided", "Options", "are", "treated", "as", "default", "Options", "for", "new", "pages", ".", "Valid", "template", "parameters", "are", ":", "{{", ".", "Host", "}}", "-", "local", "address", "to", "bind", "to", "(", "usually", "127", ".", "0", ".", "0", ".", "1", ")", "{{", ".", "Port", "}}", "-", "arbitrary", "free", "port", "on", "the", "local", "address", "{{", ".", "Address", "}}", "-", "{{", ".", "Host", "}}", ":", "{{", ".", "Port", "}}", "Selenium", "JAR", "example", ":", "command", ":", "=", "[]", "string", "{", "java", "-", "jar", "selenium", "-", "server", ".", "jar", "-", "port", "{{", ".", "Port", "}}", "}", "agouti", ".", "NewWebDriver", "(", "http", ":", "//", "{{", ".", "Address", "}}", "/", "wd", "/", "hub", "command", ")" ]
[ "func", "NewWebDriver", "(", "url", "string", ",", "command", "[", "]", "string", ",", "options", "...", "Option", ")", "*", "WebDriver", "{", "apiWebDriver", ":=", "api", ".", "NewWebDriver", "(", "<mask>", ",", "command", ")", "\n", "defaultOptions", ":=", "config", "{", "Timeout", ":", "apiWebDriver", ".", "Timeout", "}", ".", "Merge", "(", "options", ")", "\n", "apiWebDriver", ".", "Timeout", "=", "defaultOptions", ".", "Timeout", "\n", "apiWebDriver", ".", "Debug", "=", "defaultOptions", ".", "Debug", "\n", "apiWebDriver", ".", "HTTPClient", "=", "defaultOptions", ".", "HTTPClient", "\n", "return", "&", "WebDriver", "{", "apiWebDriver", ",", "defaultOptions", "}", "\n", "}" ]
7,688
all-7689
[ "WithContext", "adds", "the", "context", "to", "the", "get", "apps", "app", "params" ]
[ "func", "(", "o", "*", "GetAppsAppParams", ")", "WithContext", "(", "ctx", "context", ".", "<mask>", ")", "*", "GetAppsAppParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
7,689
all-7690
[ "ContainerAssociationHandler", "returns", "the", "handler", "method", "for", "handling", "container", "association", "requests", "." ]
[ "func", "ContainerAssociationHandler", "(", "state", "dockerstate", ".", "TaskEngineState", ")", "func", "(", "http", ".", "ResponseWriter", ",", "*", "http", ".", "Request", ")", "{", "return", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "taskARN", ",", "err", ":=", "getTaskARNByRequest", "(", "r", ",", "state", ")", "\n", "if", "err", "!=", "nil", "{", "responseJSON", ",", "_", ":=", "json", ".", "Marshal", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", ")", "\n", "utils", ".", "WriteJSONToResponse", "(", "w", ",", "http", ".", "StatusBadRequest", ",", "responseJSON", ",", "utils", ".", "RequestTypeContainerAssociation", ")", "\n", "return", "\n", "}", "\n\n", "associationType", ",", "err", ":=", "getAssociationTypeByRequest", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "responseJSON", ",", "_", ":=", "json", ".", "Marshal", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", ")", "\n", "utils", ".", "WriteJSONToResponse", "(", "w", ",", "<mask>", ".", "StatusBadRequest", ",", "responseJSON", ",", "utils", ".", "RequestTypeContainerAssociation", ")", "\n", "return", "\n", "}", "\n\n", "associationName", ",", "err", ":=", "getAssociationNameByRequest", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "responseJSON", ",", "_", ":=", "json", ".", "Marshal", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", ")", "\n", "utils", ".", "WriteJSONToResponse", "(", "w", ",", "http", ".", "StatusBadRequest", ",", "responseJSON", ",", "utils", ".", "RequestTypeContainerAssociation", ")", "\n", "return", "\n", "}", "\n\n", "seelog", ".", "Infof", "(", "\"", "\"", ",", "associationName", ",", "associationType", ")", "\n\n", "writeContainerAssociationResponse", "(", "w", ",", "taskARN", ",", "associationType", ",", "associationName", ",", "state", ")", "\n", "}", "\n", "}" ]
7,690
all-7691
[ "ReifyMessage", "takes", "a", "structured", "object", "potentially", "containing", "nested", "Matchers", "and", "returns", "an", "object", "with", "just", "the", "example", "(", "generated", ")", "content", "The", "object", "may", "be", "a", "simple", "JSON", "primitive", "e", ".", "g", ".", "string", "or", "number", "or", "a", "complex", "object" ]
[ "func", "(", "p", "*", "PactClient", ")", "ReifyMessage", "(", "request", "*", "types", ".", "PactReificationRequest", ")", "(", "res", "*", "types", ".", "ReificationResponse", ",", "err", "error", ")", "{", "log", ".", "Println", "(", "\"", "\"", ")", "\n\n", "var", "responseObject", "interface", "{", "}", "\n", "res", "=", "&", "<mask>", ".", "ReificationResponse", "{", "Response", ":", "responseObject", ",", "}", "\n\n", "// Convert request into flags, and validate request", "err", "=", "request", ".", "Validate", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "svc", ":=", "p", ".", "messageSvcManager", ".", "NewService", "(", "request", ".", "Args", ")", "\n", "cmd", ":=", "svc", ".", "Command", "(", ")", "\n\n", "stdOutPipe", ",", "err", ":=", "cmd", ".", "StdoutPipe", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "stdErrPipe", ",", "err", ":=", "cmd", ".", "StderrPipe", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "err", "=", "cmd", ".", "Start", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "stdOut", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "stdOutPipe", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "stdErr", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "stdErrPipe", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "err", "=", "cmd", ".", "Wait", "(", ")", "\n\n", "res", ".", "ResponseRaw", "=", "stdOut", "\n", "decoder", ":=", "json", ".", "NewDecoder", "(", "bytes", ".", "NewReader", "(", "stdOut", ")", ")", "\n\n", "dErr", ":=", "decoder", ".", "Decode", "(", "&", "res", ".", "Response", ")", "\n", "if", "dErr", "==", "nil", "{", "return", "\n", "}", "\n\n", "if", "err", "==", "nil", "{", "err", "=", "dErr", "\n", "}", "\n\n", "if", "err", "==", "nil", "{", "return", "\n", "}", "\n\n", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\\n", "\\n", "\\n", "\\n", "\\n", "\\n", "\"", ",", "err", ",", "stdErr", ",", "stdOut", ")", "\n\n", "return", "\n", "}" ]
7,691
all-7692
[ "SetPrivateAttr", "associates", "a", "value", "with", "a", "key", ".", "Unlike", "SetAttr", "this", "value", "is", "not", "converted", "to", "a", "build", "syntax", "tree", "and", "will", "not", "be", "written", "to", "a", "build", "file", "." ]
[ "func", "(", "r", "*", "Rule", ")", "SetPrivateAttr", "(", "key", "string", ",", "value", "interface", "{", "}", ")", "{", "r", ".", "private", "[", "<mask>", "]", "=", "value", "\n", "}" ]
7,692
all-7693
[ "Do", "executes", "Profiler", ".", "takePreciseCoverage", "against", "the", "provided", "context", ".", "returns", ":", "result", "-", "Coverage", "data", "for", "the", "current", "isolate", "." ]
[ "func", "(", "p", "*", "TakePreciseCoverageParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "result", "[", "]", "*", "ScriptCoverage", ",", "err", "error", ")", "{", "// execute", "var", "res", "TakePreciseCoverageReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandTakePreciseCoverage", ",", "nil", ",", "&", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Result", ",", "nil", "\n", "}" ]
7,693
all-7694
[ "NewErrorReporter", "returns", "a", "very", "basic", "reporter", "that", "writes", "errors", "and", "stack", "traces", "to", "the", "specified", "writer", "." ]
[ "func", "NewErrorReporter", "(", "out", "io", ".", "Writer", ")", "func", "(", "error", ")", "{", "return", "func", "(", "err", "error", ")", "{", "_", ",", "_", "=", "fmt", ".", "Fprintf", "(", "<mask>", ",", "\"", "\\n", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "_", ",", "_", "=", "out", ".", "Write", "(", "debug", ".", "Stack", "(", ")", ")", "\n", "_", ",", "_", "=", "fmt", ".", "Fprintln", "(", "out", ",", "\"", "\"", ")", "\n", "}", "\n", "}" ]
7,694
all-7695
[ "Connect", "connects", "to", "GCM", "CCS", "server", "denoted", "by", "host", "(", "production", "or", "staging", "CCS", "endpoint", "URI", ")", "along", "with", "relevant", "credentials", ".", "Debug", "mode", "dumps", "all", "CSS", "communications", "to", "stdout", "." ]
[ "func", "Connect", "(", "<mask>", ",", "senderID", ",", "apiKey", "string", ",", "debug", "bool", ")", "(", "*", "Conn", ",", "error", ")", "{", "if", "!", "strings", ".", "Contains", "(", "senderID", ",", "gcmDomain", ")", "{", "senderID", "+=", "\"", "\"", "+", "gcmDomain", "\n", "}", "\n\n", "c", ",", "err", ":=", "xmpp", ".", "NewClient", "(", "host", ",", "senderID", ",", "apiKey", ",", "debug", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "debug", "{", "log", ".", "Printf", "(", "\"", "\\n", "\"", ",", "c", ")", "\n", "}", "\n\n", "return", "&", "Conn", "{", "Host", ":", "host", ",", "SenderID", ":", "senderID", ",", "debug", ":", "debug", ",", "xmppConn", ":", "c", ",", "}", ",", "nil", "\n", "}" ]
7,695
all-7696
[ "GetProjectID", "returns", "the", "ProjectID", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "i", "*", "IntegrationGCPCreateRequest", ")", "GetProjectID", "(", ")", "<mask>", "{", "if", "i", "==", "nil", "||", "i", ".", "ProjectID", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "i", ".", "ProjectID", "\n", "}" ]
7,696
all-7697
[ "DeleteUserFromGroup", "removes", "a", "user", "from", "a", "group" ]
[ "func", "(", "c", "*", "Client", ")", "DeleteUserFromGroup", "(", "groupid", "string", ",", "userid", "string", ")", "(", "*", "http", ".", "Header", ",", "error", ")", "{", "url", ":=", "umGroupUsersPath", "(", "groupid", ",", "userid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "<mask>", ".", "Header", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Delete", "(", "url", ",", "ret", ",", "http", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
7,697
all-7698
[ "ReadResponse", "reads", "a", "server", "response", "into", "the", "received", "o", "." ]
[ "func", "(", "o", "*", "GetAppsAppRoutesRouteReader", ")", "ReadResponse", "(", "response", "runtime", ".", "ClientResponse", ",", "consumer", "runtime", ".", "Consumer", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "switch", "response", ".", "Code", "(", ")", "{", "case", "200", ":", "result", ":=", "NewGetAppsAppRoutesRouteOK", "(", ")", "\n", "if", "err", ":=", "<mask>", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n\n", "case", "404", ":", "result", ":=", "NewGetAppsAppRoutesRouteNotFound", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "result", "\n\n", "default", ":", "result", ":=", "NewGetAppsAppRoutesRouteDefault", "(", "response", ".", "Code", "(", ")", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "response", ".", "Code", "(", ")", "/", "100", "==", "2", "{", "return", "result", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "result", "\n", "}", "\n", "}" ]
7,698
all-7699
[ "Write", "in", "ProgressWriter", "is", "the", "same", "as", "io", ".", "Write" ]
[ "func", "(", "pt", "*", "ProgressWriter", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "// Do normal writer tasks", "n", ",", "err", ":=", "pt", ".", "WriteCloser", ".", "Write", "(", "p", ")", "\n\n", "// Do the actual progress tracking", "if", "pt", ".", "Tracker", "!=", "nil", "{", "<mask>", ".", "Tracker", ".", "total", "+=", "int64", "(", "n", ")", "\n", "pt", ".", "Tracker", ".", "update", "(", "n", ")", "\n", "}", "\n\n", "return", "n", ",", "err", "\n", "}" ]
7,699
all-7700
[ "Do", "executes", "Page", ".", "bringToFront", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "BringToFrontParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandBringToFront", ",", "nil", ",", "nil", ")", "\n", "}" ]