id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
4,300
all-4301
[ "rewriteUses", "replaces", "all", "uses", "of", "the", "identifier", "x", "and", "!x", "in", "scope", "with", "f", "(", "x", ".", "Pos", "()", ")", "and", "fnot", "(", "x", ".", "Pos", "()", ")", "." ]
[ "func", "rewriteUses", "(", "x", "*", "ast", ".", "Ident", ",", "f", ",", "fnot", "func", "(", "token", ".", "Pos", ")", "ast", ".", "Expr", ",", "scope", "[", "]", "ast", ".", "Stmt", ")", "{", "var", "lastF", "ast", ".", "Expr", "\n", "ff", ":=", "func", "(", "n", "interface", "{", "}", ")", "{", "ptr", ",", "ok", ":=", "n", ".", "(", "*", "ast", ".", "Expr", ")", "\n", "if", "!", "ok", "{", "return", "\n", "}", "\n", "nn", ":=", "*", "ptr", "\n\n", "// The child node was just walked and possibly replaced.", "// If it was replaced and this is a negation, replace with fnot(p).", "not", ",", "ok", ":=", "nn", ".", "(", "*", "ast", ".", "UnaryExpr", ")", "\n", "if", "ok", "&&", "not", ".", "Op", "==", "token", ".", "NOT", "&&", "not", ".", "X", "==", "lastF", "{", "*", "ptr", "=", "fnot", "(", "nn", ".", "Pos", "(", ")", ")", "\n", "return", "\n", "}", "\n", "if", "refersTo", "(", "nn", ",", "x", ")", "{", "lastF", "=", "f", "(", "nn", ".", "Pos", "(", ")", ")", "\n", "*", "ptr", "=", "lastF", "\n", "}", "\n", "}", "\n", "for", "_", ",", "n", ":=", "<mask>", "scope", "{", "walk", "(", "n", ",", "ff", ")", "\n", "}", "\n", "}" ]
4,301
all-4302
[ "DeepCopyInto", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "writing", "into", "out", ".", "in", "must", "be", "non", "-", "nil", "." ]
[ "func", "(", "in", "*", "ProwJob", ")", "DeepCopyInto", "(", "out", "*", "ProwJob", ")", "{", "*", "out", "=", "*", "in", "\n", "out", ".", "TypeMeta", "=", "in", ".", "TypeMeta", "\n", "in", ".", "ObjectMeta", ".", "DeepCopyInto", "(", "&", "out", ".", "ObjectMeta", ")", "\n", "in", ".", "Spec", ".", "DeepCopyInto", "(", "&", "<mask>", ".", "Spec", ")", "\n", "in", ".", "Status", ".", "DeepCopyInto", "(", "&", "out", ".", "Status", ")", "\n", "return", "\n", "}" ]
4,302
all-4303
[ "WaitFor", "will", "block", "until", "a", "message", "matching", "the", "given", "filter", "is", "received" ]
[ "func", "(", "<mask>", "*", "Bot", ")", "WaitFor", "(", "filter", "func", "(", "*", "Message", ")", "bool", ")", "{", "for", "mes", ":=", "range", "bot", ".", "Incoming", "{", "if", "filter", "(", "mes", ")", "{", "return", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
4,303
all-4304
[ "Complex", "pushes", "a", "proxy", "to", "a", "Go", "complex", "on", "the", "stack", ".", "Arguments", ":", "real", "(", "number", ")", "imag", "(", "number", ")", "Returns", ":", "proxy", "(", "complex128", ")" ]
[ "func", "Complex", "(", "L", "*", "lua", ".", "State", ")", "int", "{", "v1", ",", "_", ":=", "luaToGoValue", "(", "L", ",", "1", ")", "\n", "v2", ",", "_", ":=", "luaToGoValue", "(", "L", ",", "2", ")", "\n", "result", ":=", "complex", "(", "valueToNumber", "(", "L", ",", "v1", ")", ",", "valueToNumber", "(", "L", ",", "v2", ")", ")", "\n", "makeValueProxy", "(", "L", ",", "reflect", ".", "ValueOf", "(", "<mask>", ")", ",", "cComplexMeta", ")", "\n", "return", "1", "\n", "}" ]
4,304
all-4305
[ "Float64Var", "defines", "a", "float64", "flag", "with", "specified", "name", "default", "value", "and", "usage", "string", ".", "The", "argument", "p", "points", "to", "a", "float64", "variable", "in", "which", "to", "store", "the", "value", "of", "the", "flag", "." ]
[ "func", "Float64Var", "(", "p", "*", "float64", ",", "name", "string", ",", "<mask>", "float64", ",", "usage", "string", ")", "{", "EnvironmentFlags", ".", "Float64Var", "(", "p", ",", "name", ",", "value", ",", "usage", ")", "\n", "}" ]
4,305
all-4306
[ "Instructions", "for", "creating", "new", "types", ":", "If", "a", "type", "needs", "to", "satisfy", "an", "interface", "declare", "that", "function", "along", "with", "that", "interface", ".", "This", "will", "help", "users", "identify", "the", "list", "of", "types", "to", "which", "they", "can", "assert", "those", "interfaces", ".", "If", "the", "member", "of", "a", "type", "has", "a", "string", "with", "a", "predefined", "list", "of", "values", "declare", "those", "values", "as", "const", "following", "the", "type", ".", "For", "interfaces", "that", "define", "dummy", "functions", "to", "consolidate", "a", "set", "of", "types", "define", "the", "function", "as", "iTypeName", ".", "This", "will", "help", "avoid", "name", "collisions", ".", "Parse", "parses", "the", "SQL", "in", "full", "and", "returns", "a", "Statement", "which", "is", "the", "AST", "representation", "of", "the", "query", ".", "If", "a", "DDL", "statement", "is", "partially", "parsed", "but", "still", "contains", "a", "syntax", "error", "the", "error", "is", "ignored", "and", "the", "DDL", "is", "returned", "anyway", "." ]
[ "func", "Parse", "(", "sql", "string", ")", "(", "Statement", ",", "error", ")", "{", "tokenizer", ":=", "NewStringTokenizer", "(", "sql", ")", "\n", "if", "yyParse", "(", "tokenizer", ")", "!=", "0", "{", "if", "tokenizer", ".", "partialDDL", "!=", "nil", "{", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "sql", ",", "tokenizer", ".", "LastError", ")", "\n", "tokenizer", ".", "ParseTree", "=", "tokenizer", ".", "partialDDL", "\n", "return", "tokenizer", ".", "ParseTree", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "tokenizer", ".", "LastError", "\n", "}", "\n", "return", "tokenizer", ".", "ParseTree", ",", "nil", "\n", "}" ]
4,306
all-4307
[ "Do", "executes", "Page", ".", "addScriptToEvaluateOnNewDocument", "against", "the", "provided", "context", ".", "returns", ":", "identifier", "-", "Identifier", "of", "the", "added", "script", "." ]
[ "func", "(", "p", "*", "AddScriptToEvaluateOnNewDocumentParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "identifier", "ScriptIdentifier", ",", "err", "error", ")", "{", "// execute", "var", "<mask>", "AddScriptToEvaluateOnNewDocumentReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandAddScriptToEvaluateOnNewDocument", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Identifier", ",", "nil", "\n", "}" ]
4,307
all-4308
[ "Open", "returns", "a", "new", "DB", "object", "." ]
[ "func", "Open", "(", "opt", "Options", ")", "(", "db", "*", "DB", ",", "err", "error", ")", "{", "opt", ".", "maxBatchSize", "=", "(", "15", "*", "opt", ".", "MaxTableSize", ")", "/", "100", "\n", "opt", ".", "maxBatchCount", "=", "opt", ".", "maxBatchSize", "/", "int64", "(", "skl", ".", "MaxNodeSize", ")", "\n\n", "if", "opt", ".", "ValueThreshold", ">", "math", ".", "MaxUint16", "-", "16", "{", "return", "nil", ",", "ErrValueThreshold", "\n", "}", "\n\n", "if", "opt", ".", "ReadOnly", "{", "// Can't truncate if the DB is read only.", "opt", ".", "Truncate", "=", "false", "\n", "// Do not perform compaction in read only mode.", "opt", ".", "CompactL0OnClose", "=", "false", "\n", "}", "\n\n", "for", "_", ",", "<mask>", ":=", "range", "[", "]", "string", "{", "opt", ".", "Dir", ",", "opt", ".", "ValueDir", "}", "{", "dirExists", ",", "err", ":=", "exists", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "y", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "path", ")", "\n", "}", "\n", "if", "!", "dirExists", "{", "if", "opt", ".", "ReadOnly", "{", "return", "nil", ",", "y", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "path", ")", "\n", "}", "\n", "// Try to create the directory", "err", "=", "os", ".", "Mkdir", "(", "path", ",", "0700", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "y", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "path", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "absDir", ",", "err", ":=", "filepath", ".", "Abs", "(", "opt", ".", "Dir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "absValueDir", ",", "err", ":=", "filepath", ".", "Abs", "(", "opt", ".", "ValueDir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "var", "dirLockGuard", ",", "valueDirLockGuard", "*", "directoryLockGuard", "\n", "dirLockGuard", ",", "err", "=", "acquireDirectoryLock", "(", "opt", ".", "Dir", ",", "lockFile", ",", "opt", ".", "ReadOnly", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "dirLockGuard", "!=", "nil", "{", "_", "=", "dirLockGuard", ".", "release", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n", "if", "absValueDir", "!=", "absDir", "{", "valueDirLockGuard", ",", "err", "=", "acquireDirectoryLock", "(", "opt", ".", "ValueDir", ",", "lockFile", ",", "opt", ".", "ReadOnly", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "valueDirLockGuard", "!=", "nil", "{", "_", "=", "valueDirLockGuard", ".", "release", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n", "}", "\n", "if", "!", "(", "opt", ".", "ValueLogFileSize", "<=", "2", "<<", "30", "&&", "opt", ".", "ValueLogFileSize", ">=", "1", "<<", "20", ")", "{", "return", "nil", ",", "ErrValueLogSize", "\n", "}", "\n", "if", "!", "(", "opt", ".", "ValueLogLoadingMode", "==", "options", ".", "FileIO", "||", "opt", ".", "ValueLogLoadingMode", "==", "options", ".", "MemoryMap", ")", "{", "return", "nil", ",", "ErrInvalidLoadingMode", "\n", "}", "\n", "manifestFile", ",", "manifest", ",", "err", ":=", "openOrCreateManifestFile", "(", "opt", ".", "Dir", ",", "opt", ".", "ReadOnly", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "manifestFile", "!=", "nil", "{", "_", "=", "manifestFile", ".", "close", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "db", "=", "&", "DB", "{", "imm", ":", "make", "(", "[", "]", "*", "skl", ".", "Skiplist", ",", "0", ",", "opt", ".", "NumMemtables", ")", ",", "flushChan", ":", "make", "(", "chan", "flushTask", ",", "opt", ".", "NumMemtables", ")", ",", "writeCh", ":", "make", "(", "chan", "*", "request", ",", "kvWriteChCapacity", ")", ",", "opt", ":", "opt", ",", "manifest", ":", "manifestFile", ",", "elog", ":", "trace", ".", "NewEventLog", "(", "\"", "\"", ",", "\"", "\"", ")", ",", "dirLockGuard", ":", "dirLockGuard", ",", "valueDirGuard", ":", "valueDirLockGuard", ",", "orc", ":", "newOracle", "(", "opt", ")", ",", "}", "\n\n", "// Calculate initial size.", "db", ".", "calculateSize", "(", ")", "\n", "db", ".", "closers", ".", "updateSize", "=", "y", ".", "NewCloser", "(", "1", ")", "\n", "go", "db", ".", "updateSize", "(", "db", ".", "closers", ".", "updateSize", ")", "\n", "db", ".", "mt", "=", "skl", ".", "NewSkiplist", "(", "arenaSize", "(", "opt", ")", ")", "\n\n", "// newLevelsController potentially loads files in directory.", "if", "db", ".", "lc", ",", "err", "=", "newLevelsController", "(", "db", ",", "&", "manifest", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "!", "opt", ".", "ReadOnly", "{", "db", ".", "closers", ".", "compactors", "=", "y", ".", "NewCloser", "(", "1", ")", "\n", "db", ".", "lc", ".", "startCompact", "(", "db", ".", "closers", ".", "compactors", ")", "\n\n", "db", ".", "closers", ".", "memtable", "=", "y", ".", "NewCloser", "(", "1", ")", "\n", "go", "db", ".", "flushMemtable", "(", "db", ".", "closers", ".", "memtable", ")", "// Need levels controller to be up.", "\n", "}", "\n\n", "headKey", ":=", "y", ".", "KeyWithTs", "(", "head", ",", "math", ".", "MaxUint64", ")", "\n", "// Need to pass with timestamp, lsm get removes the last 8 bytes and compares key", "vs", ",", "err", ":=", "db", ".", "get", "(", "headKey", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "db", ".", "orc", ".", "nextTxnTs", "=", "vs", ".", "Version", "\n", "var", "vptr", "valuePointer", "\n", "if", "len", "(", "vs", ".", "Value", ")", ">", "0", "{", "vptr", ".", "Decode", "(", "vs", ".", "Value", ")", "\n", "}", "\n\n", "replayCloser", ":=", "y", ".", "NewCloser", "(", "1", ")", "\n", "go", "db", ".", "doWrites", "(", "replayCloser", ")", "\n\n", "if", "err", "=", "db", ".", "vlog", ".", "open", "(", "db", ",", "vptr", ",", "db", ".", "replayFunction", "(", ")", ")", ";", "err", "!=", "nil", "{", "return", "db", ",", "err", "\n", "}", "\n", "replayCloser", ".", "SignalAndWait", "(", ")", "// Wait for replay to be applied first.", "\n\n", "// Let's advance nextTxnTs to one more than whatever we observed via", "// replaying the logs.", "db", ".", "orc", ".", "txnMark", ".", "Done", "(", "db", ".", "orc", ".", "nextTxnTs", ")", "\n", "// In normal mode, we must update readMark so older versions of keys can be removed during", "// compaction when run in offline mode via the flatten tool.", "db", ".", "orc", ".", "readMark", ".", "Done", "(", "db", ".", "orc", ".", "nextTxnTs", ")", "\n", "db", ".", "orc", ".", "nextTxnTs", "++", "\n\n", "db", ".", "writeCh", "=", "make", "(", "chan", "*", "request", ",", "kvWriteChCapacity", ")", "\n", "db", ".", "closers", ".", "writes", "=", "y", ".", "NewCloser", "(", "1", ")", "\n", "go", "db", ".", "doWrites", "(", "db", ".", "closers", ".", "writes", ")", "\n\n", "db", ".", "closers", ".", "valueGC", "=", "y", ".", "NewCloser", "(", "1", ")", "\n", "go", "db", ".", "vlog", ".", "waitOnGC", "(", "db", ".", "closers", ".", "valueGC", ")", "\n\n", "valueDirLockGuard", "=", "nil", "\n", "dirLockGuard", "=", "nil", "\n", "manifestFile", "=", "nil", "\n", "return", "db", ",", "nil", "\n", "}" ]
4,308
all-4309
[ "Health", "returns", "true", "as", "default", "Health", "endpoint", "." ]
[ "func", "(", "h", "*", "metaHandler", ")", "Health", "(", "ctx", "Context", ",", "req", "*", "meta", ".", "HealthRequest", ")", "(", "*", "meta", ".", "HealthStatus", ",", "error", ")", "{", "ok", ",", "message", ":=", "h", ".", "healthFn", "(", "ctx", ",", "metaReqToReq", "(", "req", ")", ")", "\n", "if", "message", "==", "\"", "\"", "{", "return", "&", "meta", ".", "HealthStatus", "{", "Ok", ":", "ok", "}", ",", "nil", "\n", "}", "\n", "return", "&", "meta", ".", "HealthStatus", "{", "Ok", ":", "ok", ",", "<mask>", ":", "&", "message", "}", ",", "nil", "\n", "}" ]
4,309
all-4310
[ "SetWidthChars", "is", "a", "wrapper", "around", "gtk_label_set_width_chars", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetWidthChars", "(", "nChars", "int", ")", "{", "C", ".", "gtk_label_set_width_chars", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "nChars", ")", ")", "\n", "}" ]
4,310
all-4311
[ "LoadBalancer", "retrieves", "a", "detailed", "view", "of", "one", "load", "balancer" ]
[ "func", "(", "c", "*", "Client", ")", "LoadBalancer", "(", "identifier", "string", ")", "(", "*", "LoadBalancer", ",", "error", ")", "{", "lb", ":=", "<mask>", "(", "LoadBalancer", ")", "\n", "_", ",", "err", ":=", "c", ".", "MakeApiRequest", "(", "\"", "\"", ",", "\"", "\"", "+", "identifier", ",", "nil", ",", "lb", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "lb", ",", "err", "\n", "}" ]
4,311
all-4312
[ "MOIDs", "returns", "all", "MOIDs", "in", "a", "MOIDForUUIDResults", "." ]
[ "func", "(", "r", "MOIDForUUIDResults", ")", "MOIDs", "(", ")", "[", "]", "string", "{", "var", "moids", "[", "]", "string", "\n", "for", "_", ",", "result", ":=", "range", "r", "{", "moids", "=", "append", "(", "moids", ",", "<mask>", ".", "MOID", ")", "\n", "}", "\n", "return", "moids", "\n", "}" ]
4,312
all-4313
[ "InitEmbeddedMode", "registers", "the", "message", "handler", "with", "the", "newrelic", "embedded", "message", "handler", ".", "and", "calls", "Init", ".", "NOTE", ":", "I", "haven", "t", "been", "able", "to", "get", "embedded", "mode", "to", "work", ".", "Daemon", "mode", "is", "the", "only", "option", "at", "the", "momemt", "." ]
[ "func", "InitEmbeddedMode", "(", "license", "string", ",", "appName", "string", ")", "(", "int", ",", "error", ")", "{", "C", ".", "newrelic_register_message_handler", "(", "(", "*", "[", "0", "]", "byte", ")", "(", "C", ".", "newrelic_message_handler", ")", ")", "\n", "return", "doInit", "(", "license", ",", "appName", ",", "\"", "\"", ",", "runtime", ".", "<mask>", "(", ")", ")", "\n", "}" ]
4,313
all-4314
[ "NewCanceler", "returns", "a", "new", "Canceler", "struct" ]
[ "func", "NewCanceler", "(", ")", "*", "Canceler", "{", "c", ":=", "Canceler", "{", "}", "\n\n", "c", ".", "<mask>", ".", "Lock", "(", ")", "\n", "c", ".", "reqChCancel", "=", "make", "(", "map", "[", "*", "http", ".", "Request", "]", "chan", "struct", "{", "}", ")", "\n", "c", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "return", "&", "c", "\n", "}" ]
4,314
all-4315
[ "DeleteRef", "returns", "an", "error", "indicating", "if", "deletion", "of", "the", "given", "ref", "was", "successful" ]
[ "func", "(", "f", "*", "FakeClient", ")", "DeleteRef", "(", "owner", ",", "repo", ",", "<mask>", "string", ")", "error", "{", "f", ".", "RefsDeleted", "=", "append", "(", "f", ".", "RefsDeleted", ",", "struct", "{", "Org", ",", "Repo", ",", "Ref", "string", "}", "{", "Org", ":", "owner", ",", "Repo", ":", "repo", ",", "Ref", ":", "ref", "}", ")", "\n", "return", "nil", "\n", "}" ]
4,315
all-4316
[ "title", ":", "remove", "event", "block", "path", ":", "/", "events", "/", "blocks", "/", "{", "uuid", "}", "method", ":", "DELETE", "responses", ":", "200", ":", "OK", "400", ":", "Invalid", "uuid", "401", ":", "Unauthorized", "404", ":", "Active", "block", "with", "provided", "uuid", "not", "found" ]
[ "func", "eventBlockRemove", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "if", "!", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermEventBlockRemove", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "uuid", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "!", "bson", ".", "IsObjectIdHex", "(", "uuid", ")", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "uuid", ")", "\n", "return", "&", "<mask>", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "msg", "}", "\n", "}", "\n", "objID", ":=", "bson", ".", "ObjectIdHex", "(", "uuid", ")", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeEventBlock", ",", "Value", ":", "objID", ".", "Hex", "(", ")", "}", ",", "Kind", ":", "permission", ".", "PermEventBlockRemove", ",", "Owner", ":", "t", ",", "CustomData", ":", "[", "]", "map", "[", "string", "]", "interface", "{", "}", "{", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "objID", ".", "Hex", "(", ")", "}", ",", "}", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermEventBlockReadEvents", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "err", "=", "event", ".", "RemoveBlock", "(", "objID", ")", "\n", "if", "_", ",", "ok", ":=", "err", ".", "(", "*", "event", ".", "ErrActiveEventBlockNotFound", ")", ";", "ok", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "return", "err", "\n", "}" ]
4,316
all-4317
[ "expandSliceOfCustomizationAdapterMapping", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "CustomizationAdapterMapping", "slice", "." ]
[ "func", "expandSliceOfCustomizationAdapterMapping", "(", "d", "*", "schema", ".", "ResourceData", ")", "[", "]", "types", ".", "CustomizationAdapterMapping", "{", "s", ":=", "d", ".", "Get", "(", "cKeyPrefix", "+", "\"", "\"", "+", "\"", "\"", ")", ".", "(", "[", "]", "interface", "{", "}", ")", "\n", "if", "len", "(", "s", ")", "<", "1", "{", "return", "nil", "\n", "}", "\n", "result", ":=", "make", "(", "[", "]", "types", ".", "CustomizationAdapterMapping", ",", "len", "(", "s", ")", ")", "\n", "var", "v4gwFound", ",", "v6gwFound", "bool", "\n", "for", "i", ":=", "<mask>", "s", "{", "var", "adapter", "types", ".", "CustomizationIPSettings", "\n", "adapter", ",", "v4gwFound", ",", "v6gwFound", "=", "expandCustomizationIPSettings", "(", "d", ",", "i", ",", "!", "v4gwFound", ",", "!", "v6gwFound", ")", "\n", "obj", ":=", "types", ".", "CustomizationAdapterMapping", "{", "Adapter", ":", "adapter", ",", "}", "\n", "result", "[", "i", "]", "=", "obj", "\n", "}", "\n", "return", "result", "\n", "}" ]
4,317
all-4318
[ "Do", "executes", "Cast", ".", "stopCasting", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "StopCastingParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandStopCasting", ",", "p", ",", "nil", ")", "\n", "}" ]
4,318
all-4319
[ "resourceVSphereDatastoreClusterVMAntiAffinityRuleObjects", "handles", "the", "fetching", "of", "the", "cluster", "and", "rule", "key", "depending", "on", "what", "attributes", "are", "available", ":", "*", "If", "the", "resource", "ID", "is", "available", "the", "data", "is", "derived", "from", "the", "ID", ".", "*", "If", "not", "only", "the", "cluster", "is", "retrieved", "from", "datastore_cluster_id", ".", "-", "1", "is", "returned", "for", "the", "key", "." ]
[ "func", "resourceVSphereDatastoreClusterVMAntiAffinityRuleObjects", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ",", ")", "(", "*", "object", ".", "StoragePod", ",", "int32", ",", "error", ")", "{", "if", "d", ".", "<mask>", "(", ")", "!=", "\"", "\"", "{", "return", "resourceVSphereDatastoreClusterVMAntiAffinityRuleObjectsFromID", "(", "d", ",", "meta", ")", "\n", "}", "\n", "return", "resourceVSphereDatastoreClusterVMAntiAffinityRuleObjectsFromAttributes", "(", "d", ",", "meta", ")", "\n", "}" ]
4,319
all-4320
[ "SetFromFixbuf", "is", "a", "wrapper", "around", "gtk_image_set_from_pixbuf", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetFromPixbuf", "(", "pixbuf", "*", "gdk", ".", "Pixbuf", ")", "{", "pbptr", ":=", "(", "*", "C", ".", "GdkPixbuf", ")", "(", "unsafe", ".", "Pointer", "(", "pixbuf", ".", "Native", "(", ")", ")", ")", "\n", "C", ".", "gtk_image_set_from_pixbuf", "(", "v", ".", "native", "(", ")", ",", "pbptr", ")", "\n", "}" ]
4,320
all-4321
[ "PutEvent", "()", "is", "a", "wrapper", "around", "gdk_display_put_event", "()", "." ]
[ "func", "(", "v", "*", "Display", ")", "PutEvent", "(", "event", "*", "<mask>", ")", "{", "C", ".", "gdk_display_put_event", "(", "v", ".", "native", "(", ")", ",", "event", ".", "native", "(", ")", ")", "\n", "}" ]
4,321
all-4322
[ "Fail", "updates", "the", "FollowerStats", "with", "an", "unsuccessful", "send" ]
[ "func", "(", "fs", "*", "FollowerStats", ")", "Fail", "(", ")", "{", "fs", ".", "Lock", "(", ")", "\n", "defer", "fs", ".", "Unlock", "(", ")", "\n", "<mask>", ".", "Counts", ".", "Fail", "++", "\n", "}" ]
4,322
all-4323
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GObject", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "native", "(", ")", "*", "C", ".", "GObject", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "return", "C", ".", "toGObject", "(", "p", ")", "\n", "}" ]
4,323
all-4324
[ "GetInvisibleChar", "()", "is", "a", "wrapper", "around", "gtk_entry_get_invisible_char", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetInvisibleChar", "(", ")", "rune", "{", "c", ":=", "C", ".", "gtk_entry_get_invisible_char", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "rune", "(", "c", ")", "\n", "}" ]
4,324
all-4325
[ "WithBody", "adds", "the", "body", "to", "the", "add", "Vm", "params" ]
[ "func", "(", "o", "*", "AddVMParams", ")", "WithBody", "(", "<mask>", "*", "models", ".", "VM", ")", "*", "AddVMParams", "{", "o", ".", "SetBody", "(", "body", ")", "\n", "return", "o", "\n", "}" ]
4,325
all-4326
[ "AddBytesK", "adds", "the", "given", "key", ":", "value", "header", ".", "Multiple", "headers", "with", "the", "same", "key", "may", "be", "added", "with", "this", "function", ".", "Use", "SetBytesK", "for", "setting", "a", "single", "header", "for", "the", "given", "key", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "AddBytesK", "(", "<mask>", "[", "]", "byte", ",", "value", "string", ")", "{", "h", ".", "Add", "(", "b2s", "(", "key", ")", ",", "value", ")", "\n", "}" ]
4,326
all-4327
[ "NewSinglePointWriter", "creates", "new", "SinglePointWriter" ]
[ "func", "NewSinglePointWriter", "(", "log", "ttnlog", ".", "Interface", ",", "w", "BatchPointsWriter", ")", "*", "SinglePointWriter", "{", "return", "&", "SinglePointWriter", "{", "log", ":", "<mask>", ",", "writer", ":", "w", ",", "}", "\n", "}" ]
4,327
all-4328
[ "StartCustomProvider", "is", "used", "for", "sdtool", ".", "Only", "use", "this", "if", "you", "know", "what", "you", "re", "doing", "." ]
[ "func", "(", "m", "*", "Manager", ")", "StartCustomProvider", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "worker", "Discoverer", ")", "{", "p", ":=", "&", "provider", "{", "<mask>", ":", "name", ",", "d", ":", "worker", ",", "subs", ":", "[", "]", "string", "{", "name", "}", ",", "}", "\n", "m", ".", "providers", "=", "append", "(", "m", ".", "providers", ",", "p", ")", "\n", "m", ".", "startProvider", "(", "ctx", ",", "p", ")", "\n", "}" ]
4,328
all-4329
[ "decodeToUTF8Base64Header", "decodes", "a", "MIME", "header", "per", "RFC", "2047", "reencoding", "to", "=", "?utf", "-", "8b?" ]
[ "func", "decodeToUTF8Base64Header", "(", "input", "string", ")", "string", "{", "if", "!", "strings", ".", "Contains", "(", "input", ",", "\"", "\"", ")", "{", "// Don't scan if there is nothing to do here", "return", "input", "\n", "}", "\n\n", "tokens", ":=", "strings", ".", "FieldsFunc", "(", "input", ",", "whiteSpaceRune", ")", "\n", "output", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "tokens", ")", ")", "\n", "for", "i", ",", "token", ":=", "range", "tokens", "{", "if", "len", "(", "token", ")", ">", "4", "&&", "strings", ".", "Contains", "(", "token", ",", "\"", "\"", ")", "{", "// Stash parenthesis, they should not be encoded", "<mask>", ":=", "\"", "\"", "\n", "suffix", ":=", "\"", "\"", "\n", "if", "token", "[", "0", "]", "==", "'('", "{", "prefix", "=", "\"", "\"", "\n", "token", "=", "token", "[", "1", ":", "]", "\n", "}", "\n", "if", "token", "[", "len", "(", "token", ")", "-", "1", "]", "==", "')'", "{", "suffix", "=", "\"", "\"", "\n", "token", "=", "token", "[", ":", "len", "(", "token", ")", "-", "1", "]", "\n", "}", "\n", "// Base64 encode token", "output", "[", "i", "]", "=", "prefix", "+", "mime", ".", "BEncoding", ".", "Encode", "(", "\"", "\"", ",", "decodeHeader", "(", "token", ")", ")", "+", "suffix", "\n", "}", "else", "{", "output", "[", "i", "]", "=", "token", "\n", "}", "\n", "}", "\n\n", "// Return space separated tokens", "return", "strings", ".", "Join", "(", "output", ",", "\"", "\"", ")", "\n", "}" ]
4,329
all-4330
[ "HasCallback", "returns", "true", "if", "exists", "any", "callback", "subscribed", "to", "the", "topic", "." ]
[ "func", "(", "bus", "*", "EventBus", ")", "HasCallback", "(", "topic", "string", ")", "bool", "{", "bus", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "bus", ".", "lock", ".", "Unlock", "(", ")", "\n", "_", ",", "ok", ":=", "bus", ".", "handlers", "[", "topic", "]", "\n", "if", "<mask>", "{", "return", "len", "(", "bus", ".", "handlers", "[", "topic", "]", ")", ">", "0", "\n", "}", "\n", "return", "false", "\n", "}" ]
4,330
all-4331
[ "SetStyle", "is", "a", "wrapper", "around", "gtk_toolbar_set_style", "()", "." ]
[ "func", "(", "v", "*", "Toolbar", ")", "SetStyle", "(", "style", "ToolbarStyle", ")", "{", "C", ".", "gtk_toolbar_set_style", "(", "v", ".", "native", "(", ")", ",", "C", ".", "GtkToolbarStyle", "(", "<mask>", ")", ")", "\n", "}" ]
4,331
all-4332
[ "Info", "outputs", "Info", "level", "log" ]
[ "func", "(", "g", "*", "Glg", ")", "Info", "(", "val", "...", "<mask>", "{", "}", ")", "error", "{", "return", "g", ".", "out", "(", "INFO", ",", "blankFormat", "(", "len", "(", "val", ")", ")", ",", "val", "...", ")", "\n", "}" ]
4,332
all-4333
[ "GetBuffer", "()", "is", "a", "wrapper", "around", "gtk_entry_get_buffer", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetBuffer", "(", ")", "(", "*", "EntryBuffer", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_entry_get_buffer", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "&", "EntryBuffer", "{", "obj", "}", ",", "nil", "\n", "}" ]
4,333
all-4334
[ "Under", "lo", ".", "mu", "Locked", "." ]
[ "func", "(", "l", "*", "lockOrder", ")", "other", "(", "ptr", "interface", "{", "}", ")", "{", "empty", ":=", "true", "\n", "for", "k", ":=", "range", "l", ".", "cur", "{", "if", "k", "==", "ptr", "{", "continue", "\n", "}", "\n", "empty", "=", "<mask>", "\n", "}", "\n", "if", "empty", "{", "return", "\n", "}", "\n", "fmt", ".", "Fprintln", "(", "Opts", ".", "LogBuf", ",", "\"", "\"", ")", "\n", "for", "k", ",", "pp", ":=", "range", "l", ".", "cur", "{", "if", "k", "==", "ptr", "{", "continue", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "Opts", ".", "LogBuf", ",", "\"", "\\n", "\"", ",", "pp", ".", "gid", ",", "k", ")", "\n", "printStack", "(", "Opts", ".", "LogBuf", ",", "pp", ".", "stack", ")", "\n", "}", "\n", "fmt", ".", "Fprintln", "(", "Opts", ".", "LogBuf", ")", "\n", "}" ]
4,334
all-4335
[ "RegisterExtractor", "registers", "extractor", "for", "given", "format" ]
[ "func", "(", "t", "*", "MockTracer", ")", "RegisterExtractor", "(", "format", "<mask>", "{", "}", ",", "extractor", "Extractor", ")", "{", "t", ".", "extractors", "[", "format", "]", "=", "extractor", "\n", "}" ]
4,335
all-4336
[ "AppendNormalizedHeaderKey", "appends", "normalized", "header", "key", "(", "name", ")", "to", "dst", "and", "returns", "the", "resulting", "dst", ".", "Normalized", "header", "key", "starts", "with", "uppercase", "letter", ".", "The", "first", "letters", "after", "dashes", "are", "also", "uppercased", ".", "All", "the", "other", "letters", "are", "lowercased", ".", "Examples", ":", "*", "coNTENT", "-", "TYPe", "-", ">", "Content", "-", "Type", "*", "HOST", "-", ">", "Host", "*", "foo", "-", "bar", "-", "baz", "-", ">", "Foo", "-", "Bar", "-", "Baz" ]
[ "func", "AppendNormalizedHeaderKey", "(", "dst", "[", "]", "byte", ",", "key", "string", ")", "[", "]", "byte", "{", "dst", "=", "append", "(", "dst", ",", "key", "...", ")", "\n", "normalizeHeaderKey", "(", "dst", "[", "len", "(", "dst", ")", "-", "len", "(", "key", ")", ":", "]", ",", "<mask>", ")", "\n", "return", "dst", "\n", "}" ]
4,336
all-4337
[ "add", "canned", "acl", "to", "http", ".", "Header" ]
[ "func", "ACL", "(", "h", "http", ".", "Header", ",", "acl", "string", ")", "http", ".", "<mask>", "{", "if", "acl", "!=", "\"", "\"", "{", "h", ".", "Set", "(", "\"", "\"", ",", "acl", ")", "\n", "}", "\n", "return", "h", "\n", "}" ]
4,337
all-4338
[ "Update", "takes", "the", "representation", "of", "a", "app", "and", "updates", "it", ".", "Returns", "the", "server", "s", "representation", "of", "the", "app", "and", "an", "error", "if", "there", "is", "any", "." ]
[ "func", "(", "c", "*", "apps", ")", "Update", "(", "app", "*", "v1", ".", "App", ")", "(", "result", "*", "v1", ".", "App", ",", "err", "error", ")", "{", "result", "=", "&", "v1", ".", "App", "{", "}", "\n", "err", "=", "c", ".", "<mask>", ".", "Put", "(", ")", ".", "Namespace", "(", "c", ".", "ns", ")", ".", "Resource", "(", "\"", "\"", ")", ".", "Name", "(", "app", ".", "Name", ")", ".", "Body", "(", "app", ")", ".", "Do", "(", ")", ".", "Into", "(", "result", ")", "\n", "return", "\n", "}" ]
4,338
all-4339
[ "ExecContext", "implements", "the", "database", "/", "sql", "/", "driver", "/", "ExecerContext", "interface", "." ]
[ "func", "(", "c", "*", "conn", ")", "ExecContext", "(", "ctx", "context", ".", "Context", ",", "query", "string", ",", "args", "[", "]", "driver", ".", "NamedValue", ")", "(", "r", "driver", ".", "Result", ",", "err", "error", ")", "{", "if", "c", ".", "session", ".", "IsBad", "(", ")", "{", "return", "nil", ",", "driver", ".", "ErrBadConn", "\n", "}", "\n\n", "if", "len", "(", "args", ")", "!=", "0", "{", "return", "nil", ",", "driver", ".", "ErrSkip", "//fast path not possible (prepare needed)", "\n", "}", "\n\n", "sqltrace", ".", "Traceln", "(", "query", ")", "\n\n", "done", ":=", "<mask>", "(", "chan", "struct", "{", "}", ")", "\n", "go", "func", "(", ")", "{", "r", ",", "err", "=", "c", ".", "session", ".", "ExecDirect", "(", "query", ")", "\n", "close", "(", "done", ")", "\n", "}", "(", ")", "\n\n", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "nil", ",", "ctx", ".", "Err", "(", ")", "\n", "case", "<-", "done", ":", "return", "r", ",", "err", "\n", "}", "\n", "}" ]
4,339
all-4340
[ "add", "records", "that", "PCs", "in", "the", "range", "[", "min", "max", ")", "map", "to", "function", "f", "." ]
[ "func", "(", "t", "*", "funcTab", ")", "add", "(", "min", ",", "max", "core", ".", "Address", ",", "f", "*", "Func", ")", "{", "t", ".", "entries", "=", "append", "(", "t", ".", "entries", ",", "funcTabEntry", "{", "min", ":", "min", ",", "<mask>", ":", "max", ",", "f", ":", "f", "}", ")", "\n", "}" ]
4,340
all-4341
[ "Set", "is", "required", "for", "kingpin", "interfaces", "to", "allow", "command", "line", "params", "to", "be", "set", "to", "our", "map", "datatype" ]
[ "func", "(", "o", "*", "ListInt32Option", ")", "Set", "(", "<mask>", "string", ")", "error", "{", "val", ":=", "Int32Option", "{", "}", "\n", "val", ".", "Set", "(", "value", ")", "\n", "*", "o", "=", "append", "(", "*", "o", ",", "val", ")", "\n", "return", "nil", "\n", "}" ]
4,341
all-4342
[ "ReadResponse", "reads", "a", "server", "response", "into", "the", "received", "o", "." ]
[ "func", "(", "o", "*", "PatchAppsAppRoutesRouteReader", ")", "ReadResponse", "(", "response", "runtime", ".", "ClientResponse", ",", "consumer", "runtime", ".", "<mask>", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "switch", "response", ".", "Code", "(", ")", "{", "case", "200", ":", "result", ":=", "NewPatchAppsAppRoutesRouteOK", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n\n", "case", "400", ":", "result", ":=", "NewPatchAppsAppRoutesRouteBadRequest", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "result", "\n\n", "case", "404", ":", "result", ":=", "NewPatchAppsAppRoutesRouteNotFound", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "result", "\n\n", "default", ":", "result", ":=", "NewPatchAppsAppRoutesRouteDefault", "(", "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", "}" ]
4,342
all-4343
[ "PeekAlgorithmAndIssuer", "extracts", "the", "signing", "algorithm", "listed", "in", "the", "alg", "field", "and", "the", "issuer", "from", "the", "iss", "field", "of", "the", "serialized", "JWT", "buf", "s", "header", "and", "payload", "attempting", "to", "unmarshal", "alg", "to", "Algorithm", "and", "iss", "to", "a", "string", ".", "An", "error", "will", "be", "returned", "if", "the", "Algorithm", "or", "Issuer", "fields", "are", "not", "specified", "in", "the", "JWT", "header", "and", "payload", "or", "are", "otherwise", "invalid", "." ]
[ "func", "PeekAlgorithmAndIssuer", "(", "buf", "[", "]", "byte", ")", "(", "Algorithm", ",", "string", ",", "error", ")", "{", "<mask>", "err", "error", "\n\n", "// get algorithm", "alg", ",", "err", ":=", "PeekAlgorithm", "(", "buf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NONE", ",", "\"", "\"", ",", "err", "\n", "}", "\n\n", "// get issuer", "issuer", ",", "err", ":=", "PeekPayloadField", "(", "buf", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NONE", ",", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "alg", ",", "issuer", ",", "nil", "\n", "}" ]
4,343
all-4344
[ "HostPath", "returns", "the", "host", "path", "for", "the", "provided", "path", "On", "a", "normal", "system", "this", "does", "nothing", "When", "inside", "of", "a", "snap", "environment", "returns", "the", "real", "path" ]
[ "func", "HostPath", "(", "path", "string", ")", "string", "{", "// Ignore empty paths", "if", "len", "(", "path", ")", "==", "0", "{", "return", "path", "\n", "}", "\n\n", "// Don't prefix stdin/stdout", "if", "path", "==", "\"", "\"", "{", "return", "path", "\n", "}", "\n\n", "// Check if we're running in a snap package", "snap", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "snapName", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "snap", "==", "\"", "\"", "||", "snapName", "!=", "\"", "\"", "{", "return", "path", "\n", "}", "\n\n", "// Handle relative paths", "if", "path", "[", "0", "]", "!=", "os", ".", "PathSeparator", "{", "// Use the cwd of the parent as snap-confine alters our own cwd on launch", "ppid", ":=", "os", ".", "Getppid", "(", ")", "\n", "if", "ppid", "<", "1", "{", "return", "path", "\n", "}", "\n\n", "pwd", ",", "err", ":=", "os", ".", "Readlink", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ppid", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "path", "\n", "}", "\n\n", "path", "=", "filepath", ".", "Clean", "(", "strings", ".", "Join", "(", "[", "]", "string", "{", "pwd", ",", "path", "}", ",", "string", "(", "os", ".", "PathSeparator", ")", ")", ")", "\n", "}", "\n\n", "// Check if the path is already snap-aware", "for", "_", ",", "prefix", ":=", "range", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", "{", "if", "path", "==", "prefix", "||", "strings", ".", "HasPrefix", "(", "path", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "prefix", ")", ")", "{", "return", "<mask>", "\n", "}", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "path", ")", "\n", "}" ]
4,344
all-4345
[ "WithReportProgress", "if", "true", "reportHeapSnapshotProgress", "events", "will", "be", "generated", "while", "snapshot", "is", "being", "taken", "when", "the", "tracking", "is", "stopped", "." ]
[ "func", "(", "p", "StopTrackingHeapObjectsParams", ")", "WithReportProgress", "(", "reportProgress", "bool", ")", "*", "StopTrackingHeapObjectsParams", "{", "p", ".", "ReportProgress", "=", "reportProgress", "\n", "<mask>", "&", "p", "\n", "}" ]
4,345
all-4346
[ "return", "the", "pointer", "to", "a", "mapped", "buffer", "object", "s", "data", "store" ]
[ "func", "GetBufferPointerv", "(", "target", "uint32", ",", "pname", "uint32", ",", "params", "*", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall", "(", "gpGetBufferPointerv", ",", "3", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "pname", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
4,346
all-4347
[ "Health", "returns", "the", "current", "health", "of", "the", "recording", "rule", "." ]
[ "func", "(", "rule", "*", "RecordingRule", ")", "Health", "(", ")", "RuleHealth", "{", "rule", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "rule", ".", "mtx", ".", "Unlock", "(", ")", "\n", "return", "<mask>", ".", "health", "\n", "}" ]
4,347
all-4348
[ "OptImportThreadCount", "is", "the", "number", "of", "goroutines", "allocated", "for", "import", "." ]
[ "func", "OptImportThreadCount", "(", "count", "int", ")", "ImportOption", "{", "return", "func", "(", "<mask>", "*", "ImportOptions", ")", "error", "{", "options", ".", "threadCount", "=", "count", "\n", "return", "nil", "\n", "}", "\n", "}" ]
4,348
all-4349
[ "GetName", "returns", "the", "Name", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "CreatedBy", ")", "GetName", "(", ")", "string", "{", "if", "c", "==", "nil", "||", "c", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "c", ".", "Name", "\n", "}" ]
4,349
all-4350
[ "SetCursor", "sets", "the", "position", "of", "the", "cursor", "in", "the", "list", ".", "Values", "out", "of", "bounds", "will", "be", "clamped", "." ]
[ "func", "(", "l", "*", "List", ")", "SetCursor", "(", "i", "int", ")", "{", "max", ":=", "len", "(", "l", ".", "scope", ")", "-", "1", "\n", "if", "i", ">=", "max", "{", "i", "=", "<mask>", "\n", "}", "\n", "if", "i", "<", "0", "{", "i", "=", "0", "\n", "}", "\n", "l", ".", "cursor", "=", "i", "\n\n", "if", "l", ".", "start", ">", "l", ".", "cursor", "{", "l", ".", "start", "=", "l", ".", "cursor", "\n", "}", "else", "if", "l", ".", "start", "+", "l", ".", "size", "<=", "l", ".", "cursor", "{", "l", ".", "start", "=", "l", ".", "cursor", "-", "l", ".", "size", "+", "1", "\n", "}", "\n", "}" ]
4,350
all-4351
[ "focusWidget", "focuses", "on", "the", "current", "widget", ".", "If", "focus", "is", "-", "1", "it", "ll", "focus", "on", "the", "first", "available", "widget", ".", "focusWidget", "shall", "be", "called", "from", "queue", "context", "." ]
[ "func", "(", "w", "*", "Window", ")", "focusWidget", "(", ")", "{", "setCursor", "(", "-", "1", ",", "-", "1", ")", "// hide", "\n", "if", "w", ".", "focus", "<", "0", "{", "for", "i", ",", "widget", ":=", "range", "w", ".", "widgets", "{", "if", "widget", ".", "CanFocus", "(", ")", "{", "w", ".", "focus", "=", "i", "\n", "widget", ".", "Focus", "(", ")", "\n", "return", "\n", "}", "\n", "}", "\n", "// nothing to do", "return", "\n", "}", "\n\n", "// make sure we are in bounds", "if", "w", ".", "<mask>", ">", "len", "(", "w", ".", "widgets", ")", "{", "// this really should not happen", "return", "\n", "}", "\n\n", "w", ".", "widgets", "[", "w", ".", "focus", "]", ".", "Focus", "(", ")", "\n", "}" ]
4,351
all-4352
[ "HasExtension", "returns", "true", "if", "the", "server", "supports", "a", "given", "API", "extension" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "HasExtension", "(", "extension", "string", ")", "bool", "{", "// If no cached API information, just assume we're good", "// This is needed for those rare cases where we must avoid a GetServer call", "if", "r", ".", "server", "==", "nil", "{", "return", "true", "\n", "}", "\n\n", "for", "_", ",", "entry", ":=", "range", "r", ".", "server", ".", "APIExtensions", "{", "if", "<mask>", "==", "extension", "{", "return", "true", "\n", "}", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
4,352
all-4353
[ "Reset", "re", "-", "uses", "the", "buffer", "with", "a", "new", "iterator", "resetting", "the", "buffered", "time", "delta", "to", "its", "original", "value", "." ]
[ "func", "(", "b", "*", "BufferedSeriesIterator", ")", "Reset", "(", "it", "SeriesIterator", ")", "{", "b", ".", "it", "=", "it", "\n", "b", ".", "lastTime", "=", "math", ".", "MinInt64", "\n", "b", ".", "ok", "=", "true", "\n", "b", ".", "buf", ".", "reset", "(", ")", "\n", "b", ".", "buf", ".", "delta", "=", "b", ".", "delta", "\n", "<mask>", ".", "Next", "(", ")", "\n", "}" ]
4,353
all-4354
[ "GetDisabledOk", "returns", "a", "tuple", "with", "the", "Disabled", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "Downtime", ")", "GetDisabledOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "d", "==", "nil", "||", "d", ".", "Disabled", "==", "nil", "{", "return", "<mask>", ",", "false", "\n", "}", "\n", "return", "*", "d", ".", "Disabled", ",", "true", "\n", "}" ]
4,354
all-4355
[ "Open", "takes", "a", "snapshot", "ID", "and", "returns", "a", "ReadCloser", "for", "that", "snapshot", "." ]
[ "func", "(", "f", "*", "FileSnapshotStore", ")", "Open", "(", "id", "string", ")", "(", "*", "SnapshotMeta", ",", "io", ".", "ReadCloser", ",", "error", ")", "{", "// Get the metadata", "meta", ",", "err", ":=", "f", ".", "readMeta", "(", "id", ")", "\n", "if", "err", "!=", "nil", "{", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "// Open the state file", "statePath", ":=", "filepath", ".", "Join", "(", "f", ".", "path", ",", "id", ",", "stateFilePath", ")", "\n", "fh", ",", "err", ":=", "<mask>", ".", "Open", "(", "statePath", ")", "\n", "if", "err", "!=", "nil", "{", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "// Create a CRC64 hash", "stateHash", ":=", "crc64", ".", "New", "(", "crc64", ".", "MakeTable", "(", "crc64", ".", "ECMA", ")", ")", "\n\n", "// Compute the hash", "_", ",", "err", "=", "io", ".", "Copy", "(", "stateHash", ",", "fh", ")", "\n", "if", "err", "!=", "nil", "{", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "fh", ".", "Close", "(", ")", "\n", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "// Verify the hash", "computed", ":=", "stateHash", ".", "Sum", "(", "nil", ")", "\n", "if", "bytes", ".", "Compare", "(", "meta", ".", "CRC", ",", "computed", ")", "!=", "0", "{", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "meta", ".", "CRC", ",", "computed", ")", "\n", "fh", ".", "Close", "(", ")", "\n", "return", "nil", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Seek to the start", "if", "_", ",", "err", ":=", "fh", ".", "Seek", "(", "0", ",", "0", ")", ";", "err", "!=", "nil", "{", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "fh", ".", "Close", "(", ")", "\n", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "// Return a buffered file", "buffered", ":=", "&", "bufferedFile", "{", "bh", ":", "bufio", ".", "NewReader", "(", "fh", ")", ",", "fh", ":", "fh", ",", "}", "\n\n", "return", "&", "meta", ".", "SnapshotMeta", ",", "buffered", ",", "nil", "\n", "}" ]
4,355
all-4356
[ "Calculates", "the", "per", "-", "element", "bit", "-", "wise", "conjunction", "of", "two", "arrays", "with", "a", "mask", "." ]
[ "func", "AndWithMask", "(", "src1", ",", "src2", ",", "dst", ",", "mask", "*", "IplImage", ")", "{", "C", ".", "cvAnd", "(", "unsafe", ".", "Pointer", "(", "src1", ")", ",", "unsafe", ".", "Pointer", "(", "src2", ")", ",", "unsafe", ".", "Pointer", "(", "dst", ")", ",", "unsafe", ".", "Pointer", "(", "<mask>", ")", ",", ")", "\n", "}" ]
4,356
all-4357
[ "Read", "typ3", "byte", "." ]
[ "func", "decodeTyp3", "(", "bz", "[", "]", "byte", ")", "(", "typ", "Typ3", ",", "n", "int", ",", "err", "error", ")", "{", "if", "len", "(", "bz", ")", "==", "0", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "if", "bz", "[", "0", "]", "&", "0xF8", "!=", "0", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "Typ3", "(", "bz", "[", "0", "]", ")", ".", "<mask>", "(", ")", ")", "\n", "return", "\n", "}", "\n", "typ", "=", "Typ3", "(", "bz", "[", "0", "]", ")", "\n", "n", "=", "1", "\n", "return", "\n", "}" ]
4,357
all-4358
[ "SelectLayers", "enables", "/", "disables", "single", "layers", ".", "LayerSelector", "or", "SelectorFunc", "gets", "called", "for", "each", "layer", ".", "Returns", "true", "if", "at", "least", "one", "layer", "was", "included", "(", "or", "set", "to", "default", ")", "." ]
[ "func", "(", "m", "*", "Map", ")", "SelectLayers", "(", "selector", "LayerSelector", ")", "bool", "{", "m", ".", "storeLayerStatus", "(", ")", "\n", "selected", ":=", "false", "\n", "n", ":=", "C", ".", "mapnik_map_layer_count", "(", "m", ".", "m", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "int", "(", "n", ")", ";", "i", "++", "{", "layerName", ":=", "C", ".", "GoString", "(", "C", ".", "mapnik_map_layer_name", "(", "m", ".", "m", ",", "C", ".", "size_t", "(", "i", ")", ")", ")", "\n", "switch", "selector", ".", "Select", "(", "layerName", ")", "{", "case", "Include", ":", "<mask>", "=", "true", "\n", "C", ".", "mapnik_map_layer_set_active", "(", "m", ".", "m", ",", "C", ".", "size_t", "(", "i", ")", ",", "1", ")", "\n", "case", "Exclude", ":", "C", ".", "mapnik_map_layer_set_active", "(", "m", ".", "m", ",", "C", ".", "size_t", "(", "i", ")", ",", "0", ")", "\n", "case", "Default", ":", "selected", "=", "true", "\n", "}", "\n", "}", "\n", "return", "selected", "\n", "}" ]
4,358
all-4359
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "FunctionCoverage", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler21", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
4,359
all-4360
[ "Convenience", "Wrapper", "for", "NewDotterEx", "()", ".", "Makes", "proper", "assumptions", ".", "For", "more", "see", "NewDotterEx", "()", "." ]
[ "func", "NewDotter", "(", "oType", "OutputType", ",", "gType", "GraphType", ",", "fname", "string", ")", "(", "*", "Dotter", ",", "error", ")", "{", "return", "NewDotterEx", "(", "oType", ",", "PROG_DOT", ",", "gType", ",", "true", ",", "<mask>", ",", "fname", ")", "\n", "}" ]
4,360
all-4361
[ "Servers", "retrieves", "a", "list", "of", "all", "servers" ]
[ "func", "(", "c", "*", "<mask>", ")", "Servers", "(", ")", "(", "[", "]", "Server", ",", "error", ")", "{", "var", "servers", "[", "]", "Server", "\n", "_", ",", "err", ":=", "c", ".", "MakeApiRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "&", "servers", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "servers", ",", "err", "\n", "}" ]
4,361
all-4362
[ "Error", "returns", "a", "string", "representation", "of", "error", "e", "." ]
[ "func", "(", "e", "*", "<mask>", ")", "Error", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "Filename", ",", "e", ".", "LineNum", ",", "e", ".", "Msg", ")", "\n", "}" ]
4,362
all-4363
[ "Get", "takes", "name", "of", "the", "app", "and", "returns", "the", "corresponding", "app", "object", "and", "an", "error", "if", "there", "is", "any", "." ]
[ "func", "(", "c", "*", "FakeApps", ")", "Get", "(", "name", "string", ",", "options", "v1", ".", "GetOptions", ")", "(", "<mask>", "*", "tsuru_v1", ".", "App", ",", "err", "error", ")", "{", "obj", ",", "err", ":=", "c", ".", "Fake", ".", "Invokes", "(", "testing", ".", "NewGetAction", "(", "appsResource", ",", "c", ".", "ns", ",", "name", ")", ",", "&", "tsuru_v1", ".", "App", "{", "}", ")", "\n\n", "if", "obj", "==", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "obj", ".", "(", "*", "tsuru_v1", ".", "App", ")", ",", "err", "\n", "}" ]
4,363
all-4364
[ "Errorln", "records", "the", "log", "with", "error", "level" ]
[ "func", "(", "l", "*", "Logger", ")", "Errorln", "(", "args", "...", "<mask>", "{", "}", ")", "{", "l", ".", "Output", "(", "2", ",", "LevelError", ",", "fmt", ".", "Sprintln", "(", "args", "...", ")", ")", "\n", "}" ]
4,364
all-4365
[ "SearchRegistry", "queries", "a", "registry", "for", "images", "that", "contain", "image", "in", "their", "name", "The", "limit", "is", "the", "max", "number", "of", "results", "desired", "Note", ":", "The", "limit", "value", "doesn", "t", "work", "with", "all", "registries", "for", "example", "registry", ".", "access", ".", "redhat", ".", "com", "returns", "all", "the", "results", "without", "limiting", "it", "to", "the", "limit", "value" ]
[ "func", "SearchRegistry", "(", "ctx", "context", ".", "Context", ",", "sys", "*", "types", ".", "SystemContext", ",", "registry", ",", "image", "string", ",", "limit", "int", ")", "(", "[", "]", "SearchResult", ",", "error", ")", "{", "type", "V2Results", "struct", "{", "// Repositories holds the results returned by the /v2/_catalog endpoint", "Repositories", "[", "]", "string", "`json:\"repositories\"`", "\n", "}", "\n", "type", "V1Results", "struct", "{", "// Results holds the results returned by the /v1/search endpoint", "Results", "[", "]", "SearchResult", "`json:\"results\"`", "\n", "}", "\n", "v2Res", ":=", "&", "V2Results", "{", "}", "\n", "v1Res", ":=", "&", "V1Results", "{", "}", "\n\n", "// Get credentials from authfile for the underlying hostname", "username", ",", "password", ",", "err", ":=", "config", ".", "GetAuthentication", "(", "sys", ",", "registry", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// The /v2/_catalog endpoint has been disabled for docker.io therefore", "// the call made to that endpoint will fail. So using the v1 hostname", "// for docker.io for simplicity of implementation and the fact that it", "// returns search results.", "hostname", ":=", "registry", "\n", "if", "registry", "==", "dockerHostname", "{", "hostname", "=", "dockerV1Hostname", "\n", "}", "\n\n", "client", ",", "err", ":=", "newDockerClient", "(", "sys", ",", "hostname", ",", "registry", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "<mask>", ".", "username", "=", "username", "\n", "client", ".", "password", "=", "password", "\n\n", "// Only try the v1 search endpoint if the search query is not empty. If it is", "// empty skip to the v2 endpoint.", "if", "image", "!=", "\"", "\"", "{", "// set up the query values for the v1 endpoint", "u", ":=", "url", ".", "URL", "{", "Path", ":", "\"", "\"", ",", "}", "\n", "q", ":=", "u", ".", "Query", "(", ")", "\n", "q", ".", "Set", "(", "\"", "\"", ",", "image", ")", "\n", "q", ".", "Set", "(", "\"", "\"", ",", "strconv", ".", "Itoa", "(", "limit", ")", ")", "\n", "u", ".", "RawQuery", "=", "q", ".", "Encode", "(", ")", "\n\n", "logrus", ".", "Debugf", "(", "\"", "\"", ")", "\n", "resp", ",", "err", ":=", "client", ".", "makeRequest", "(", "ctx", ",", "\"", "\"", ",", "u", ".", "String", "(", ")", ",", "nil", ",", "nil", ",", "noAuth", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "registry", ",", "err", ")", "\n", "}", "else", "{", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "resp", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "registry", ",", "resp", ".", "StatusCode", ",", "http", ".", "StatusText", "(", "resp", ".", "StatusCode", ")", ")", "\n", "}", "else", "{", "if", "err", ":=", "json", ".", "NewDecoder", "(", "resp", ".", "Body", ")", ".", "Decode", "(", "v1Res", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "v1Res", ".", "Results", ",", "nil", "\n", "}", "\n", "}", "\n", "}", "\n\n", "logrus", ".", "Debugf", "(", "\"", "\"", ")", "\n", "resp", ",", "err", ":=", "client", ".", "makeRequest", "(", "ctx", ",", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "nil", ",", "v2Auth", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "registry", ",", "err", ")", "\n", "}", "else", "{", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "resp", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "logrus", ".", "Errorf", "(", "\"", "\"", ",", "registry", ",", "resp", ".", "StatusCode", ",", "http", ".", "StatusText", "(", "resp", ".", "StatusCode", ")", ")", "\n", "}", "else", "{", "if", "err", ":=", "json", ".", "NewDecoder", "(", "resp", ".", "Body", ")", ".", "Decode", "(", "v2Res", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "searchRes", ":=", "[", "]", "SearchResult", "{", "}", "\n", "for", "_", ",", "repo", ":=", "range", "v2Res", ".", "Repositories", "{", "if", "strings", ".", "Contains", "(", "repo", ",", "image", ")", "{", "res", ":=", "SearchResult", "{", "Name", ":", "repo", ",", "}", "\n", "searchRes", "=", "append", "(", "searchRes", ",", "res", ")", "\n", "}", "\n", "}", "\n", "return", "searchRes", ",", "nil", "\n", "}", "\n", "}", "\n\n", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "registry", ")", "\n", "}" ]
4,365
all-4366
[ "taken", "from", "go", "s", "ResolveTCP", "code", "but", "uses", "configurable", "ctx" ]
[ "func", "resolveTCPAddrDefault", "(", "ctx", "context", ".", "Context", ",", "addr", "string", ")", "(", "*", "net", ".", "TCPAddr", ",", "error", ")", "{", "host", ",", "port", ",", "serr", ":=", "net", ".", "SplitHostPort", "(", "addr", ")", "\n", "if", "serr", "!=", "nil", "{", "return", "nil", ",", "serr", "\n", "}", "\n", "portnum", ",", "perr", ":=", "net", ".", "DefaultResolver", ".", "LookupPort", "(", "ctx", ",", "\"", "\"", ",", "port", ")", "\n", "if", "perr", "!=", "nil", "{", "return", "nil", ",", "perr", "\n", "}", "\n\n", "var", "ips", "[", "]", "net", ".", "IPAddr", "\n", "if", "ip", ":=", "net", ".", "ParseIP", "(", "host", ")", ";", "ip", "!=", "nil", "{", "ips", "=", "[", "]", "<mask>", ".", "IPAddr", "{", "{", "IP", ":", "ip", "}", "}", "\n", "}", "else", "{", "// Try as a DNS name.", "ipss", ",", "err", ":=", "net", ".", "DefaultResolver", ".", "LookupIPAddr", "(", "ctx", ",", "host", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "ips", "=", "ipss", "\n", "}", "\n", "// randomize?", "ip", ":=", "ips", "[", "0", "]", "\n", "return", "&", "net", ".", "TCPAddr", "{", "IP", ":", "ip", ".", "IP", ",", "Port", ":", "portnum", ",", "Zone", ":", "ip", ".", "Zone", "}", ",", "nil", "\n", "}" ]
4,366
all-4367
[ "Do", "executes", "DOM", ".", "focus", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "FocusParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandFocus", ",", "p", ",", "nil", ")", "\n", "}" ]
4,367
all-4368
[ "GetTotalIncome", "returns", "total", "receipt", "balance", "from", "all", "channels", "." ]
[ "func", "(", "h", "*", "<mask>", ")", "GetTotalIncome", "(", "tkn", "string", ")", "(", "*", "uint", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "return", "h", ".", "uintFromQuery", "(", "logger", ",", "tkn", ",", "`SELECT SUM(channels.receipt_balance)\n\t\t\tFROM channels`", ")", "\n", "}" ]
4,368
all-4369
[ "SendRequest", "sends", "a", "JSON", "-", "RPC", "request", "through", "the", "connection", "with", "an", "auto", "generated", "request", "ID", ".", "resHandler", "is", "called", "when", "a", "response", "is", "returned", "." ]
[ "func", "(", "c", "*", "Conn", ")", "SendRequest", "(", "method", "string", ",", "params", "interface", "{", "}", ",", "resHandler", "func", "(", "res", "*", "ResCtx", ")", "error", ")", "(", "reqID", "string", ",", "err", "error", ")", "{", "<mask>", ",", "err", ":=", "shortid", ".", "UUID", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "req", ":=", "request", "{", "ID", ":", "id", ",", "Method", ":", "method", ",", "Params", ":", "params", "}", "\n", "if", "err", "=", "c", ".", "send", "(", "req", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "c", ".", "resRoutes", ".", "Set", "(", "req", ".", "ID", ",", "resHandler", ")", "\n", "return", "id", ",", "nil", "\n", "}" ]
4,369
all-4370
[ "Replay", "events", "to", "a", "subscriber" ]
[ "func", "(", "e", "*", "EventLog", ")", "Replay", "(", "s", "*", "Subscriber", ")", "{", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "(", "*", "e", ")", ")", ";", "i", "++", "{", "if", "string", "(", "(", "*", "e", ")", "[", "i", "]", ".", "ID", ")", ">=", "s", ".", "eventid", "{", "s", ".", "<mask>", "<-", "(", "*", "e", ")", "[", "i", "]", "\n", "}", "\n", "}", "\n", "}" ]
4,370
all-4371
[ "Internal", "error", "handler" ]
[ "func", "(", "mux", "*", "ServerMux", ")", "err", "(", "<mask>", "error", ")", "{", "if", "mux", ".", "ErrorHandle", "!=", "nil", "{", "mux", ".", "ErrorHandle", "(", "err", ")", "\n", "}", "\n", "}" ]
4,371
all-4372
[ "TODO", ":", "non", "-", "blocking", "snapshot" ]
[ "func", "(", "s", "*", "EtcdServer", ")", "snapshot", "(", "snapi", "uint64", ",", "confState", "raftpb", ".", "ConfState", ")", "{", "clone", ":=", "s", ".", "v2store", ".", "Clone", "(", ")", "\n", "// commit kv to write metadata (for example: consistent index) to disk.", "// KV().commit() updates the consistent index in backend.", "// All operations that update consistent index must be called sequentially", "// from applyAll function.", "// So KV().Commit() cannot run in parallel with apply. It has to be called outside", "// the go routine created below.", "s", ".", "KV", "(", ")", ".", "Commit", "(", ")", "\n\n", "s", ".", "goAttach", "(", "func", "(", ")", "{", "lg", ":=", "s", ".", "getLogger", "(", ")", "\n\n", "d", ",", "err", ":=", "clone", ".", "SaveNoCopy", "(", ")", "\n", "// TODO: current store will never fail to do a snapshot", "// what should we do if the store might fail?", "if", "err", "!=", "nil", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Panic", "(", "\"", "\"", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Panicf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "snap", ",", "err", ":=", "s", ".", "r", ".", "raftStorage", ".", "CreateSnapshot", "(", "snapi", ",", "&", "confState", ",", "d", ")", "\n", "if", "err", "!=", "nil", "{", "// the snapshot was done asynchronously with the progress of raft.", "// raft might have already got a newer snapshot.", "if", "err", "==", "raft", ".", "ErrSnapOutOfDate", "{", "return", "\n", "}", "\n", "if", "lg", "!=", "nil", "{", "lg", ".", "Panic", "(", "\"", "\"", ",", "zap", ".", "<mask>", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Panicf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "// SaveSnap saves the snapshot and releases the locked wal files", "// to the snapshot index.", "if", "err", "=", "s", ".", "r", ".", "storage", ".", "SaveSnap", "(", "snap", ")", ";", "err", "!=", "nil", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Panic", "(", "\"", "\"", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Fatalf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "if", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "Uint64", "(", "\"", "\"", ",", "snap", ".", "Metadata", ".", "Index", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Infof", "(", "\"", "\"", ",", "snap", ".", "Metadata", ".", "Index", ")", "\n", "}", "\n\n", "// When sending a snapshot, etcd will pause compaction.", "// After receives a snapshot, the slow follower needs to get all the entries right after", "// the snapshot sent to catch up. If we do not pause compaction, the log entries right after", "// the snapshot sent might already be compacted. It happens when the snapshot takes long time", "// to send and save. Pausing compaction avoids triggering a snapshot sending cycle.", "if", "atomic", ".", "LoadInt64", "(", "&", "s", ".", "inflightSnapshots", ")", "!=", "0", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ")", "\n", "}", "else", "{", "plog", ".", "Infof", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "\n", "}", "\n\n", "// keep some in memory log entries for slow followers.", "compacti", ":=", "uint64", "(", "1", ")", "\n", "if", "snapi", ">", "s", ".", "Cfg", ".", "SnapshotCatchUpEntries", "{", "compacti", "=", "snapi", "-", "s", ".", "Cfg", ".", "SnapshotCatchUpEntries", "\n", "}", "\n\n", "err", "=", "s", ".", "r", ".", "raftStorage", ".", "Compact", "(", "compacti", ")", "\n", "if", "err", "!=", "nil", "{", "// the compaction was done asynchronously with the progress of raft.", "// raft log might already been compact.", "if", "err", "==", "raft", ".", "ErrCompacted", "{", "return", "\n", "}", "\n", "if", "lg", "!=", "nil", "{", "lg", ".", "Panic", "(", "\"", "\"", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Panicf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "if", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "Uint64", "(", "\"", "\"", ",", "compacti", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Infof", "(", "\"", "\"", ",", "compacti", ")", "\n", "}", "\n", "}", ")", "\n", "}" ]
4,372
all-4373
[ "DeepCopyInto", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "writing", "into", "out", ".", "in", "must", "be", "non", "-", "nil", "." ]
[ "func", "(", "<mask>", "*", "Endpoint", ")", "DeepCopyInto", "(", "out", "*", "Endpoint", ")", "{", "*", "out", "=", "*", "in", "\n", "if", "in", ".", "Targets", "!=", "nil", "{", "in", ",", "out", ":=", "&", "in", ".", "Targets", ",", "&", "out", ".", "Targets", "\n", "*", "out", "=", "make", "(", "Targets", ",", "len", "(", "*", "in", ")", ")", "\n", "copy", "(", "*", "out", ",", "*", "in", ")", "\n", "}", "\n", "if", "in", ".", "Labels", "!=", "nil", "{", "in", ",", "out", ":=", "&", "in", ".", "Labels", ",", "&", "out", ".", "Labels", "\n", "*", "out", "=", "make", "(", "Labels", ",", "len", "(", "*", "in", ")", ")", "\n", "for", "key", ",", "val", ":=", "range", "*", "in", "{", "(", "*", "out", ")", "[", "key", "]", "=", "val", "\n", "}", "\n", "}", "\n", "if", "in", ".", "ProviderSpecific", "!=", "nil", "{", "in", ",", "out", ":=", "&", "in", ".", "ProviderSpecific", ",", "&", "out", ".", "ProviderSpecific", "\n", "*", "out", "=", "make", "(", "ProviderSpecific", ",", "len", "(", "*", "in", ")", ")", "\n", "for", "key", ",", "val", ":=", "range", "*", "in", "{", "(", "*", "out", ")", "[", "key", "]", "=", "val", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
4,373
all-4374
[ "Do", "executes", "Debugger", ".", "setVariableValue", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetVariableValueParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetVariableValue", ",", "p", ",", "nil", ")", "\n", "}" ]
4,374
all-4375
[ "String", "converts", "the", "container", "type", "enum", "to", "a", "string" ]
[ "func", "(", "containerType", "ContainerType", ")", "<mask>", "(", ")", "string", "{", "for", "str", ",", "contType", ":=", "range", "stringToContainerType", "{", "if", "contType", "==", "containerType", "{", "return", "str", "\n", "}", "\n", "}", "\n\n", "return", "\"", "\"", "\n", "}" ]
4,375
all-4376
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "TraceConfig", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTracing", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
4,376
all-4377
[ "PresentWithTime", "is", "a", "wrapper", "around", "gtk_window_present_with_time", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "PresentWithTime", "(", "<mask>", "uint32", ")", "{", "C", ".", "gtk_window_present_with_time", "(", "v", ".", "native", "(", ")", ",", "C", ".", "guint32", "(", "ts", ")", ")", "\n", "}" ]
4,377
all-4378
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TraceServiceDefinition", ")", "GetType", "(", ")", "string", "{", "if", "t", "==", "nil", "||", "t", ".", "Type", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "<mask>", "\n", "}" ]
4,378
all-4379
[ "GetPageIterator", "returns", "an", "iterator", "which", "can", "be", "used", "to", "retrieve", "pages", "." ]
[ "func", "(", "m", "*", "MessageService", ")", "GetPageIterator", "(", "data", "<mask>", ".", "Values", ")", "MessagePageIterator", "{", "iter", ":=", "NewPageIterator", "(", "m", ".", "client", ",", "data", ",", "messagesPathPart", ")", "\n", "return", "&", "messagePageIterator", "{", "p", ":", "iter", ",", "}", "\n", "}" ]
4,379
all-4380
[ "SetPerformer", "sets", "a", "performer", "for", "the", "audio", "file", "(", "optional", ")", "." ]
[ "func", "(", "oa", "*", "OutgoingAudio", ")", "SetPerformer", "(", "to", "<mask>", ")", "*", "OutgoingAudio", "{", "oa", ".", "Performer", "=", "to", "\n", "return", "oa", "\n", "}" ]
4,380
all-4381
[ "ReadParts", "reads", "a", "MIME", "document", "from", "the", "provided", "reader", "and", "parses", "it", "into", "tree", "of", "Part", "objects", "." ]
[ "func", "ReadParts", "(", "r", "io", ".", "Reader", ")", "(", "*", "Part", ",", "error", ")", "{", "br", ":=", "bufio", ".", "NewReader", "(", "r", ")", "\n", "root", ":=", "&", "Part", "{", "PartID", ":", "\"", "\"", "}", "\n", "// Read header; top-level default CT is text/plain us-ascii according to RFC 822.", "err", ":=", "root", ".", "setupHeaders", "(", "br", ",", "`text/plain; charset=\"us-ascii\"`", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "strings", ".", "HasPrefix", "(", "root", ".", "ContentType", ",", "ctMultipartPrefix", ")", "{", "// Content is multipart, parse it.", "err", "=", "parseParts", "(", "root", ",", "br", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "else", "{", "// Content is text or data, decode it.", "if", "err", ":=", "root", ".", "decodeContent", "(", "br", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "return", "<mask>", ",", "nil", "\n", "}" ]
4,381
all-4382
[ "ProposeConfChange", "proposes", "a", "config", "change", "." ]
[ "func", "(", "rn", "*", "RawNode", ")", "ProposeConfChange", "(", "cc", "pb", ".", "ConfChange", ")", "error", "{", "data", ",", "err", ":=", "cc", ".", "Marshal", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "rn", ".", "raft", ".", "Step", "(", "pb", ".", "Message", "{", "Type", ":", "pb", ".", "MsgProp", ",", "Entries", ":", "[", "]", "pb", ".", "Entry", "{", "{", "Type", ":", "<mask>", ".", "EntryConfChange", ",", "Data", ":", "data", "}", ",", "}", ",", "}", ")", "\n", "}" ]
4,382
all-4383
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetCPUThrottlingRateParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation14", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
4,383
all-4384
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetBrowserSamplingProfileReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoMemory12", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
4,384
all-4385
[ "NewHTTPTemplateFetcher", "creates", "a", "new", "struct", ".", "urls", "must", "give", "us", "the", "base", "HTTP", "urls", "for", "us", "to", "look", "the", "templates", "in", "(", "note", ":", "do", "not", "use", "trailing", "slashes", ")" ]
[ "func", "NewHTTPTemplateFetcher", "(", "urls", "[", "]", "string", ")", "(", "*", "HTTPTemplateFetcher", ",", "error", ")", "{", "f", ":=", "&", "HTTPTemplateFetcher", "{", "URLs", ":", "make", "(", "[", "]", "string", ",", "len", "(", "urls", ")", ")", ",", "}", "\n", "for", "k", ",", "v", ":=", "range", "urls", "{", "u", ",", "err", ":=", "<mask>", ".", "Parse", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "!", "u", ".", "IsAbs", "(", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ")", "\n", "}", "\n", "f", ".", "URLs", "[", "k", "]", "=", "u", ".", "String", "(", ")", "\n", "}", "\n", "return", "f", ",", "nil", "\n", "}" ]
4,385
all-4386
[ "Do", "executes", "Target", ".", "getBrowserContexts", "against", "the", "provided", "context", ".", "returns", ":", "browserContextIds", "-", "An", "array", "of", "browser", "context", "ids", "." ]
[ "func", "(", "p", "*", "GetBrowserContextsParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "browserContextIds", "[", "]", "BrowserContextID", ",", "err", "error", ")", "{", "// execute", "var", "<mask>", "GetBrowserContextsReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetBrowserContexts", ",", "nil", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "BrowserContextIds", ",", "nil", "\n", "}" ]
4,386
all-4387
[ "SetUseColor", "()", "is", "a", "wrapper", "around", "gtk_print_settings_set_use_color", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintSettings", ")", "SetUseColor", "(", "color", "bool", ")", "{", "C", ".", "gtk_print_settings_set_use_color", "(", "ps", ".", "native", "(", ")", ",", "gbool", "(", "color", ")", ")", "\n", "}" ]
4,387
all-4388
[ "SetTLSConfig", "sets", "the", "TLS", "configuration", "of", "the", "connector", "." ]
[ "func", "(", "c", "*", "Connector", ")", "SetTLSConfig", "(", "tlsConfig", "*", "tls", ".", "Config", ")", "<mask>", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "c", ".", "tlsConfig", "=", "tlsConfig", "\n", "return", "nil", "\n", "}" ]
4,388
all-4389
[ "SetNetworkMode", "sets", "the", "network", "mode", "of", "the", "container" ]
[ "func", "(", "c", "*", "Container", ")", "SetNetworkMode", "(", "networkMode", "string", ")", "{", "c", ".", "<mask>", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "c", ".", "NetworkModeUnsafe", "=", "networkMode", "\n", "}" ]
4,389
all-4390
[ "GetAPIKeyOk", "returns", "a", "tuple", "with", "the", "APIKey", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "r", "*", "reqAPIKey", ")", "GetAPIKeyOk", "(", ")", "(", "APIKey", ",", "bool", ")", "{", "if", "r", "==", "nil", "||", "r", ".", "APIKey", "==", "nil", "{", "return", "APIKey", "{", "}", ",", "<mask>", "\n", "}", "\n", "return", "*", "r", ".", "APIKey", ",", "true", "\n", "}" ]
4,390
all-4391
[ "expandDVPortgroupConfigSpec", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "DVPortgroupConfigSpec", "." ]
[ "func", "expandDVPortgroupConfigSpec", "(", "d", "*", "schema", ".", "ResourceData", ")", "types", ".", "DVPortgroupConfigSpec", "{", "obj", ":=", "types", ".", "DVPortgroupConfigSpec", "{", "ConfigVersion", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "Name", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "NumPorts", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "PortNameFormat", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "DefaultPortConfig", ":", "expandVMwareDVSPortSetting", "(", "d", ")", ",", "<mask>", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "Type", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "Policy", ":", "expandVMwareDVSPortgroupPolicy", "(", "d", ")", ",", "AutoExpand", ":", "structure", ".", "GetBoolPtr", "(", "d", ",", "\"", "\"", ")", ",", "VmVnicNetworkResourcePoolKey", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "}", "\n", "return", "obj", "\n", "}" ]
4,391
all-4392
[ "Calculate", "the", "trend", "value", "at", "the", "given", "index", "i", "in", "raw", "data", "d", ".", "This", "is", "somewhat", "analogous", "to", "the", "slope", "of", "the", "trend", "at", "the", "given", "index", ".", "The", "argument", "s", "is", "the", "set", "of", "computed", "smoothed", "values", ".", "The", "argument", "b", "is", "the", "set", "of", "computed", "trend", "factors", ".", "The", "argument", "d", "is", "the", "set", "of", "raw", "input", "values", "." ]
[ "func", "calcTrendValue", "(", "i", "int", ",", "sf", ",", "tf", ",", "s0", ",", "s1", ",", "b", "float64", ")", "float64", "{", "if", "i", "==", "0", "{", "return", "b", "\n", "}", "\n\n", "x", ":=", "tf", "*", "(", "s1", "-", "s0", ")", "\n", "y", ":=", "(", "1", "-", "tf", ")", "*", "b", "\n\n", "<mask>", "x", "+", "y", "\n", "}" ]
4,392
all-4393
[ "AddFlags", "parses", "options", "for", "github", "client" ]
[ "func", "(", "client", "*", "Client", ")", "AddFlags", "(", "cmd", "*", "cobra", ".", "Command", ")", "{", "cmd", ".", "PersistentFlags", "(", ")", ".", "StringVar", "(", "&", "client", ".", "Token", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "cmd", ".", "PersistentFlags", "(", ")", ".", "StringVar", "(", "&", "client", ".", "TokenFile", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "cmd", ".", "PersistentFlags", "(", ")", ".", "StringVar", "(", "&", "<mask>", ".", "Org", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "cmd", ".", "PersistentFlags", "(", ")", ".", "StringVar", "(", "&", "client", ".", "Project", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}" ]
4,393
all-4394
[ "NewUbuntuCluster", "creates", "a", "basic", "Azure", "cluster", "profile", "to", "bootstrap", "Kubernetes", "." ]
[ "func", "NewUbuntuCluster", "(", "name", "string", ")", "*", "cluster", ".", "Cluster", "{", "controlPlaneProviderConfig", ":=", "&", "cluster", ".", "ControlPlaneProviderConfig", "{", "Cloud", ":", "cluster", ".", "CloudAzure", ",", "Location", ":", "\"", "\"", ",", "SSH", ":", "&", "cluster", ".", "SSH", "{", "PublicKeyPath", ":", "\"", "\"", ",", "User", ":", "\"", "\"", ",", "}", ",", "KubernetesAPI", ":", "&", "cluster", ".", "KubernetesAPI", "{", "Port", ":", "\"", "\"", ",", "}", ",", "Values", ":", "&", "cluster", ".", "Values", "{", "ItemMap", ":", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "kubeadm", ".", "GetRandomToken", "(", ")", ",", "}", ",", "}", ",", "}", "\n", "machineSetsProviderConfigs", ":=", "[", "]", "*", "cluster", ".", "MachineProviderConfig", "{", "{", "ServerPool", ":", "&", "cluster", ".", "ServerPool", "{", "Type", ":", "cluster", ".", "ServerPoolTypeMaster", ",", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "MaxCount", ":", "1", ",", "<mask>", ":", "\"", "\"", ",", "Size", ":", "\"", "\"", ",", "BootstrapScripts", ":", "[", "]", "string", "{", "}", ",", "Firewalls", ":", "[", "]", "*", "cluster", ".", "Firewall", "{", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "IngressRules", ":", "[", "]", "*", "cluster", ".", "IngressRule", "{", "{", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "}", ",", "EgressRules", ":", "[", "]", "*", "cluster", ".", "EgressRule", "{", "{", "EgressToPort", ":", "\"", "\"", ",", "// By default all egress from VM", "EgressDestination", ":", "\"", "\"", ",", "EgressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "EgressToPort", ":", "\"", "\"", ",", "// By default all egress from VM", "EgressDestination", ":", "\"", "\"", ",", "EgressProtocol", ":", "\"", "\"", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "{", "ServerPool", ":", "&", "cluster", ".", "ServerPool", "{", "Type", ":", "cluster", ".", "ServerPoolTypeNode", ",", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "MaxCount", ":", "1", ",", "Image", ":", "\"", "\"", ",", "Size", ":", "\"", "\"", ",", "BootstrapScripts", ":", "[", "]", "string", "{", "}", ",", "Firewalls", ":", "[", "]", "*", "cluster", ".", "Firewall", "{", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "IngressRules", ":", "[", "]", "*", "cluster", ".", "IngressRule", "{", "{", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "}", ",", "EgressRules", ":", "[", "]", "*", "cluster", ".", "EgressRule", "{", "{", "EgressToPort", ":", "\"", "\"", ",", "// By default all egress from VM", "EgressDestination", ":", "\"", "\"", ",", "EgressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "EgressToPort", ":", "\"", "\"", ",", "// By default all egress from VM", "EgressDestination", ":", "\"", "\"", ",", "EgressProtocol", ":", "\"", "\"", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", "\n", "c", ":=", "cluster", ".", "NewCluster", "(", "name", ")", "\n", "c", ".", "SetProviderConfig", "(", "controlPlaneProviderConfig", ")", "\n", "c", ".", "NewMachineSetsFromProviderConfigs", "(", "machineSetsProviderConfigs", ")", "\n", "return", "c", "\n", "}" ]
4,394
all-4395
[ "PublisherContext", "return", "the", "publisher", "." ]
[ "func", "PublisherContext", "(", "ctx", "context", ".", "Context", ")", "Publisher", "{", "pub", ",", "ok", ":=", "ctx", ".", "Value", "(", "KeyPublisher", ")", ".", "(", "<mask>", ")", "\n", "if", "!", "ok", "{", "return", "nil", "\n", "}", "\n\n", "return", "pub", "\n", "}" ]
4,395
all-4396
[ "SetLabels", "sets", "the", "labels", "for", "a", "container" ]
[ "func", "(", "c", "*", "Container", ")", "SetLabels", "(", "labels", "<mask>", "[", "string", "]", "string", ")", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "c", ".", "labels", "=", "labels", "\n", "}" ]
4,396
all-4397
[ "Lease", "leases", "tasks", "from", "a", "queue", ".", "leaseTime", "is", "in", "seconds", ".", "The", "number", "of", "tasks", "fetched", "will", "be", "at", "most", "maxTasks", "." ]
[ "func", "Lease", "(", "c", "<mask>", ".", "Context", ",", "maxTasks", "int", ",", "queueName", "string", ",", "leaseTime", "int", ")", "(", "[", "]", "*", "Task", ",", "error", ")", "{", "return", "lease", "(", "c", ",", "maxTasks", ",", "queueName", ",", "leaseTime", ",", "false", ",", "nil", ")", "\n", "}" ]
4,397
all-4398
[ "newPRMExactReference", "is", "NewPRMExactReference", "except", "it", "resturns", "the", "private", "type", "." ]
[ "func", "newPRMExactReference", "(", "dockerReference", "string", ")", "(", "*", "prmExactReference", ",", "error", ")", "{", "ref", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "dockerReference", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "InvalidPolicyFormatError", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "dockerReference", ",", "err", ".", "Error", "(", ")", ")", ")", "\n", "}", "\n", "if", "reference", ".", "IsNameOnly", "(", "<mask>", ")", "{", "return", "nil", ",", "InvalidPolicyFormatError", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "dockerReference", ")", ")", "\n", "}", "\n", "return", "&", "prmExactReference", "{", "prmCommon", ":", "prmCommon", "{", "Type", ":", "prmTypeExactReference", "}", ",", "DockerReference", ":", "dockerReference", ",", "}", ",", "nil", "\n", "}" ]
4,398
all-4399
[ "Mute", "sets", "whether", "the", "Client", "is", "muted", ".", "All", "methods", "of", "a", "muted", "Client", "do", "nothing", "and", "return", "immedialtly", ".", "This", "option", "can", "be", "used", "in", "Client", ".", "Clone", "()", "only", "if", "the", "parent", "Client", "is", "not", "muted", ".", "The", "clones", "of", "a", "muted", "Client", "are", "always", "muted", "." ]
[ "func", "Mute", "(", "b", "bool", ")", "Option", "{", "return", "Option", "(", "func", "(", "c", "*", "config", ")", "{", "c", ".", "<mask>", ".", "Muted", "=", "b", "\n", "}", ")", "\n", "}" ]
4,399
all-4400
[ "Encode", "writes", "an", "encoded", "object", "to", "a", "new", "bytes", "buffer", "." ]
[ "func", "encodeMsgPack", "(", "in", "<mask>", "{", "}", ")", "(", "*", "bytes", ".", "Buffer", ",", "error", ")", "{", "buf", ":=", "bytes", ".", "NewBuffer", "(", "nil", ")", "\n", "hd", ":=", "codec", ".", "MsgpackHandle", "{", "}", "\n", "enc", ":=", "codec", ".", "NewEncoder", "(", "buf", ",", "&", "hd", ")", "\n", "err", ":=", "enc", ".", "Encode", "(", "in", ")", "\n", "return", "buf", ",", "err", "\n", "}" ]