id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
11,300
all-11301
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventCharacterDataModified", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom66", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
11,301
all-11302
[ "ArgInt", "returns", "the", "integer", "representation", "of", "the", "argument" ]
[ "func", "(", "o", "op", ")", "ArgInt", "(", ")", "int", "{", "v", ":=", "interfaceToNumeric", "(", "o", ".", "uArg", ")", "\n", "<mask>", "int", "(", "v", ".", "Int", "(", ")", ")", "\n", "}" ]
11,302
all-11303
[ "GetPaymentResult", "retrieves", "the", "PaymentResult", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "OperationResultTr", ")", "GetPaymentResult", "(", ")", "(", "result", "PaymentResult", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "<mask>", "=", "*", "u", ".", "PaymentResult", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
11,303
all-11304
[ "NewSimple", "returns", "a", "new", "Simple", "Queue" ]
[ "func", "NewSimple", "(", ")", "Simple", "{", "q", ":=", "&", "simpleQueue", "{", "queue", ":", "make", "(", "[", "]", "<mask>", "{", "}", ",", "0", ")", ",", "}", "\n", "q", ".", "available", "=", "sync", ".", "NewCond", "(", "&", "q", ".", "mu", ")", "\n", "return", "q", "\n", "}" ]
11,304
all-11305
[ "return", "-", "based", "exit", "code", "so", "the", "defer", "works" ]
[ "func", "_main", "(", ")", "int", "{", "var", "typesOnly", "bool", "\n", "flag", ".", "BoolVar", "(", "&", "typesOnly", ",", "\"", "\"", ",", "false", ",", "\"", "\"", ")", "\n", "flag", ".", "Parse", "(", ")", "\n\n", "apiFile", ":=", "\"", "\"", "\n", "<mask>", "err", "error", "\n", "if", "typesOnly", "{", "err", "=", "genTypesOnlyAPI", "(", "apiFile", ")", "\n", "}", "else", "{", "err", "=", "genFull", "(", "apiFile", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "fmt", ".", "Println", "(", "err", ")", "\n", "return", "1", "\n", "}", "\n", "return", "0", "\n", "}" ]
11,305
all-11306
[ "title", ":", "remove", "platform", "path", ":", "/", "platforms", "/", "{", "name", "}", "method", ":", "DELETE", "responses", ":", "200", ":", "Platform", "removed", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "platformRemove", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "canDeletePlatform", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermPlatformDelete", ")", "\n", "if", "!", "canDeletePlatform", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "<mask>", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypePlatform", ",", "Value", ":", "name", "}", ",", "Kind", ":", "permission", ".", "PermPlatformDelete", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermPlatformReadEvents", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "err", "=", "servicemanager", ".", "Platform", ".", "Remove", "(", "name", ")", "\n", "if", "err", "==", "appTypes", ".", "ErrPlatformNotFound", "{", "return", "&", "tErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "return", "err", "\n", "}" ]
11,306
all-11307
[ "Copy", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockFileSystem", ")", "Copy", "(", "arg0", "io", ".", "Writer", ",", "arg1", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "int64", ")", "\n", "ret1", ",", "_", ":=", "<mask>", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
11,307
all-11308
[ "Panic", "records", "the", "log", "with", "fatal", "level", "and", "panics" ]
[ "func", "Panic", "(", "args", "...", "interface", "{", "}", ")", "{", "msg", ":=", "fmt", ".", "Sprint", "(", "args", "...", ")", "\n", "logger", ".", "Output", "(", "2", ",", "LevelError", ",", "msg", ")", "\n", "panic", "(", "<mask>", ")", "\n", "}" ]
11,308
all-11309
[ "Rotate", "rotates", "the", "following", "text", "drawings", "and", "images", ".", "Angle", "is", "specified", "in", "radians", "and", "measured", "clockwise", "from", "the", "3", "o", "clock", "position", ".", "This", "must", "be", "placed", "between", "gc", ".", "Save", "()", "and", "gc", ".", "Restore", "()", "otherwise", "the", "pdf", "is", "invalid", "." ]
[ "func", "(", "gc", "*", "GraphicContext", ")", "Rotate", "(", "<mask>", "float64", ")", "{", "gc", ".", "StackGraphicContext", ".", "Rotate", "(", "angle", ")", "\n", "gc", ".", "pdf", ".", "TransformRotate", "(", "-", "angle", "*", "180", "/", "math", ".", "Pi", ",", "0", ",", "0", ")", "\n", "}" ]
11,309
all-11310
[ "/", "*", "Infom", "uses", "msg", "as", "a", "format", "string", "with", "subsequent", "parameters", "as", "values", "and", "logs", "the", "resulting", "message", "to", "all", "added", "loggers", "at", "LogLevel", ".", "LevelInfo", ".", "It", "will", "also", "merge", "all", "attributes", "passed", "in", "m", "with", "any", "attributes", "added", "to", "Base", "and", "include", "them", "with", "the", "message", "if", "the", "Logger", "supports", "it", "." ]
[ "func", "(", "b", "*", "Base", ")", "Infom", "(", "m", "*", "Attrs", ",", "msg", "string", ",", "a", "...", "interface", "{", "}", ")", "error", "{", "return", "b", ".", "<mask>", "(", "LevelInfo", ",", "m", ",", "msg", ",", "a", "...", ")", "\n", "}" ]
11,310
all-11311
[ "ImageGetNodesWithoutImage", "returns", "the", "addresses", "of", "online", "nodes", "which", "don", "t", "have", "the", "image", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImageGetNodesWithoutImage", "(", "fingerprint", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "q", ":=", "`\nSELECT DISTINCT nodes.address FROM nodes WHERE nodes.address NOT IN (\n SELECT DISTINCT nodes.address FROM nodes\n LEFT JOIN images_nodes ON images_nodes.node_id = nodes.id\n LEFT JOIN images ON images_nodes.image_id = images.id\n WHERE images.fingerprint = ?)\n`", "\n", "<mask>", "c", ".", "getNodesByImageFingerprint", "(", "q", ",", "fingerprint", ")", "\n", "}" ]
11,311
all-11312
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "ScreenshotParamsFormat", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
11,312
all-11313
[ "RenameProject", "renames", "an", "existing", "project", "resource", "in", "RBAC", "." ]
[ "func", "(", "r", "*", "<mask>", ")", "RenameProject", "(", "id", "int64", ",", "name", "string", ")", "error", "{", "return", "r", ".", "AddProject", "(", "id", ",", "name", ")", "\n", "}" ]
11,313
all-11314
[ "findExpiredLeases", "loops", "leases", "in", "the", "leaseMap", "until", "reaching", "expired", "limit", "and", "returns", "the", "expired", "leases", "that", "needed", "to", "be", "revoked", "." ]
[ "func", "(", "le", "*", "lessor", ")", "findExpiredLeases", "(", "limit", "int", ")", "[", "]", "*", "Lease", "{", "leases", ":=", "make", "(", "[", "]", "*", "Lease", ",", "0", ",", "16", ")", "\n\n", "for", "{", "l", ",", "ok", ",", "next", ":=", "le", ".", "expireExists", "(", ")", "\n", "if", "!", "ok", "&&", "!", "next", "{", "<mask>", "\n", "}", "\n", "if", "!", "ok", "{", "continue", "\n", "}", "\n", "if", "next", "{", "continue", "\n", "}", "\n\n", "if", "l", ".", "expired", "(", ")", "{", "leases", "=", "append", "(", "leases", ",", "l", ")", "\n\n", "// reach expired limit", "if", "len", "(", "leases", ")", "==", "limit", "{", "break", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "leases", "\n", "}" ]
11,314
all-11315
[ "GetAccelPath", "is", "a", "wrapper", "around", "gtk_menu_item_get_accel_path", "()", "." ]
[ "func", "(", "v", "*", "MenuItem", ")", "GetAccelPath", "(", ")", "string", "{", "c", ":=", "C", ".", "gtk_menu_item_get_accel_path", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", "\n", "}" ]
11,315
all-11316
[ "BuildOpts", "triggeres", "a", "new", "build", "for", "the", "givent", "project", "on", "the", "given", "branch", "Marshaling", "the", "struct", "into", "json", "and", "passing", "in", "the", "post", "body", ".", "Returns", "the", "new", "build", "information" ]
[ "func", "(", "c", "*", "Client", ")", "BuildOpts", "(", "<mask>", ",", "repo", ",", "branch", "string", ",", "opts", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "*", "Build", ",", "error", ")", "{", "build", ":=", "&", "Build", "{", "}", "\n\n", "err", ":=", "c", ".", "request", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "account", ",", "repo", ",", "branch", ")", ",", "build", ",", "nil", ",", "opts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "build", ",", "nil", "\n", "}" ]
11,316
all-11317
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetBlackboxedRangesParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger16", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
11,317
all-11318
[ "HasDisabled", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "CreatedBy", ")", "HasDisabled", "(", ")", "bool", "{", "if", "c", "!=", "nil", "&&", "c", ".", "Disabled", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
11,318
all-11319
[ "Remove", "adjectival", "endings", "and", "return", "true", "if", "one", "was", "removed", "." ]
[ "func", "removeAdjectivalEnding", "(", "word", "*", "snowballword", ".", "SnowballWord", ")", "bool", "{", "// Remove adjectival endings. Start by looking for", "// an adjective ending.", "//", "suffix", ",", "_", ":=", "word", ".", "RemoveFirstSuffixIn", "(", "word", ".", "RVstart", ",", "\"", "\"", "ы", "и", "о", "\"", " ", " ", "\"", "м", "м", "у", ",", " ", "\"", "е", "", "", "", "", "", "", "", "", "\"", " ", "\"", "е", "е", "й", ",", "\"", ",", "\"", " ", "\"", "й", "е", "м", ",", "\"", ",", "\"", "", "", "", "", "", "", "", "", "\"", " ", "\"", "х", "ы", "х", ",", "\"", ",", "\"", " ", "\"", "я", "я", "я", ",", "\"", ",", "\"", "", "", "", "", "", "", "", "", ")", "\n", "if", "suffix", "!=", "\"", "\"", "{", "// We found an adjective ending. Remove optional participle endings.", "//", "newSuffix", ",", "newSuffixRunes", ":=", "<mask>", ".", "FirstSuffixIn", "(", "word", ".", "RVstart", ",", "len", "(", "word", ".", "RS", ")", ",", "\"", "\"", "ы", "ш", "щ", "\"", "", "", "", "\"", " ", "\"", "н", "в", "ш", ",", "\"", ",", "\"", "", "", "", "", "", ")", "\n", "switch", "newSuffix", "{", "case", "\"", " ", "\"", "н", "в", "ш", ",", "\"", ",", "\"", "", "", "", "", "", "// These are \"Group 1\" participle endings.", "// Group 1 endings must follow а (a) or я (ia) in RV.", "if", "precededByARinRV", "(", "word", ",", "len", "(", "newSuffixRunes", ")", ")", "==", "false", "{", "newSuffix", "=", "\"", "\"", "\n", "}", "\n", "}", "\n\n", "if", "newSuffix", "!=", "\"", "\"", "{", "word", ".", "RemoveLastNRunes", "(", "len", "(", "newSuffixRunes", ")", ")", "\n", "}", "\n", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
11,319
all-11320
[ "Initializes", "the", "Global", "MetricsEngine", "used", "throughout", "Agent", "Currently", "we", "use", "the", "Prometheus", "Global", "Default", "Registerer", "which", "also", "collecs", "basic", "Go", "application", "metrics", "that", "we", "use", "(", "like", "memory", "usage", ")", ".", "In", "future", "cases", "we", "can", "use", "a", "custom", "Prometheus", "Registry", "to", "group", "metrics", ".", "For", "unit", "testing", "purposes", "we", "only", "focus", "on", "API", "calls", "and", "use", "our", "own", "Registry" ]
[ "func", "MustInit", "(", "cfg", "*", "config", ".", "Config", ",", "registry", "...", "*", "prometheus", ".", "Registry", ")", "{", "if", "!", "cfg", ".", "PrometheusMetricsEnabled", "{", "return", "\n", "}", "\n", "var", "registryToUse", "*", "prometheus", ".", "Registry", "\n", "if", "len", "(", "registry", ")", ">", "0", "{", "registryToUse", "=", "registry", "[", "0", "]", "\n", "}", "else", "{", "registryToUse", "=", "prometheus", ".", "DefaultRegisterer", ".", "(", "*", "prometheus", ".", "Registry", ")", "\n", "}", "\n", "MetricsEngineGlobal", "=", "NewMetricsEngine", "(", "cfg", ",", "registryToUse", ")", "\n", "MetricsEngineGlobal", ".", "collection", "=", "<mask>", "\n", "}" ]
11,320
all-11321
[ "readCodeLengthTable", "reads", "a", "new", "code", "length", "table", "into", "codeLength", "from", "br", ".", "If", "addOld", "is", "set", "the", "old", "table", "is", "added", "to", "the", "new", "one", "." ]
[ "func", "readCodeLengthTable", "(", "br", "bitReader", ",", "codeLength", "[", "]", "byte", ",", "addOld", "bool", ")", "error", "{", "var", "bitlength", "[", "20", "]", "byte", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "bitlength", ")", ";", "i", "++", "{", "n", ",", "err", ":=", "br", ".", "readBits", "(", "4", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "n", "==", "0xf", "{", "cnt", ",", "err", ":=", "br", ".", "readBits", "(", "4", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "cnt", ">", "0", "{", "// array already zero'd dont need to explicitly set", "i", "+=", "cnt", "+", "1", "\n", "continue", "\n", "}", "\n", "}", "\n", "bitlength", "[", "i", "]", "=", "byte", "(", "n", ")", "\n", "}", "\n\n", "var", "bl", "huffmanDecoder", "\n", "bl", ".", "init", "(", "bitlength", "[", ":", "]", ")", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "codeLength", ")", ";", "i", "++", "{", "l", ",", "err", ":=", "bl", ".", "readSym", "(", "br", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "l", "<", "16", "{", "if", "addOld", "{", "codeLength", "[", "i", "]", "=", "(", "codeLength", "[", "i", "]", "+", "byte", "(", "l", ")", ")", "&", "0xf", "\n", "}", "else", "{", "codeLength", "[", "i", "]", "=", "byte", "(", "l", ")", "\n", "}", "\n", "continue", "\n", "}", "\n\n", "var", "count", "int", "\n", "var", "value", "byte", "\n\n", "switch", "l", "{", "case", "16", ",", "18", ":", "count", ",", "err", "=", "br", ".", "readBits", "(", "3", ")", "\n", "count", "+=", "3", "\n", "<mask>", ":", "count", ",", "err", "=", "br", ".", "readBits", "(", "7", ")", "\n", "count", "+=", "11", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "l", "<", "18", "{", "if", "i", "==", "0", "{", "return", "errInvalidLengthTable", "\n", "}", "\n", "value", "=", "codeLength", "[", "i", "-", "1", "]", "\n", "}", "\n", "for", ";", "count", ">", "0", "&&", "i", "<", "len", "(", "codeLength", ")", ";", "i", "++", "{", "codeLength", "[", "i", "]", "=", "value", "\n", "count", "--", "\n", "}", "\n", "i", "--", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,321
all-11322
[ "resolve", "loads", "all", "of", "the", "clients", "we", "need", "and", "caches", "them", "for", "future", "calls", "." ]
[ "func", "(", "o", "*", "ExperimentalKubernetesOptions", ")", "resolve", "(", "dryRun", "bool", ")", "(", "err", "error", ")", "{", "if", "o", ".", "resolved", "{", "return", "nil", "\n", "}", "\n\n", "o", ".", "dryRun", "=", "dryRun", "\n", "if", "dryRun", "{", "return", "nil", "\n", "}", "\n\n", "clusterConfigs", ",", "err", ":=", "kube", ".", "LoadClusterConfigs", "(", "o", ".", "kubeconfig", ",", "o", ".", "buildCluster", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "o", ".", "kubeconfig", ",", "o", ".", "buildCluster", ",", "err", ")", "\n", "}", "\n", "clients", ":=", "map", "[", "string", "]", "kubernetes", ".", "Interface", "{", "}", "\n", "for", "context", ",", "config", ":=", "range", "clusterConfigs", "{", "<mask>", ",", "err", ":=", "kubernetes", ".", "NewForConfig", "(", "&", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "context", ",", "err", ")", "\n", "}", "\n", "clients", "[", "context", "]", "=", "client", "\n", "}", "\n\n", "localCfg", ":=", "clusterConfigs", "[", "kube", ".", "InClusterContext", "]", "\n", "pjClient", ",", "err", ":=", "prow", ".", "NewForConfig", "(", "&", "localCfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "o", ".", "prowJobClientset", "=", "pjClient", "\n", "o", ".", "kubernetesClientsByContext", "=", "clients", "\n", "o", ".", "resolved", "=", "true", "\n\n", "return", "nil", "\n", "}" ]
11,322
all-11323
[ "version", "-", "gen", "is", "a", "simple", "program", "that", "generates", "the", "agent", "s", "version", "file", "containing", "information", "about", "the", "agent", "s", "version", "commit", "hash", "and", "repository", "cleanliness", "." ]
[ "func", "main", "(", ")", "{", "versionStr", ",", "_", ":=", "ioutil", ".", "ReadFile", "(", "filepath", ".", "Join", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", ")", "\n\n", "// default values", "info", ":=", "versionInfo", "{", "Version", ":", "strings", ".", "TrimSpace", "(", "string", "(", "versionStr", ")", ")", ",", "Dirty", ":", "true", ",", "Hash", ":", "\"", "\"", ",", "}", "\n\n", "if", "strings", ".", "TrimSpace", "(", "os", ".", "Getenv", "(", "\"", "\"", ")", ")", "==", "\"", "\"", "{", "// 'clean' release; all other releases assumed dirty", "info", ".", "Dirty", "=", "gitDirty", "(", ")", "\n", "}", "\n", "if", "os", ".", "Getenv", "(", "\"", "\"", ")", "==", "\"", "\"", "{", "// When the version file is updated, the above is set", "// Setting UNKNOWN version allows the version committed in git to never", "// have a commit hash so that it does not churn with every commit. This", "// env var should not be set when building, and go generate should be", "// run before any build, such that the commithash will be set correctly.", "info", ".", "Hash", "=", "gitHash", "(", ")", "\n", "}", "\n\n", "outFile", ",", "err", ":=", "os", ".", "Create", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatalf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "t", ":=", "template", ".", "Must", "(", "template", ".", "New", "(", "\"", "\"", ")", ".", "Parse", "(", "versiongoTemplate", ")", ")", "\n\n", "err", "=", "t", ".", "Execute", "(", "outFile", ",", "info", ")", "\n", "if", "err", "!=", "nil", "{", "<mask>", ".", "Fatalf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}" ]
11,323
all-11324
[ "ListPlugins", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockDockerClient", ")", "ListPlugins", "(", "arg0", "context", ".", "Context", ",", "arg1", "<mask>", ".", "Duration", ",", "arg2", "filters", ".", "Args", ")", "dockerapi", ".", "ListPluginsResponse", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ",", "arg2", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "dockerapi", ".", "ListPluginsResponse", ")", "\n", "return", "ret0", "\n", "}" ]
11,324
all-11325
[ "currentClusters", "returns", "a", "{", "name", ":", "cluster", "}", "map", "." ]
[ "func", "currentClusters", "(", "proj", "string", ")", "(", "map", "[", "string", "]", "cluster", ",", "error", ")", "{", "clusters", ",", "err", ":=", "output", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "+", "proj", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "options", ":=", "map", "[", "string", "]", "cluster", "{", "}", "\n", "for", "_", ",", "line", ":=", "range", "strings", ".", "Split", "(", "clusters", ",", "\"", "\\n", "\"", ")", "{", "if", "len", "(", "line", ")", "==", "0", "{", "continue", "\n", "}", "\n", "parts", ":=", "strings", ".", "Split", "(", "line", ",", "\"", "\\t", "\"", ")", "\n", "if", "len", "(", "parts", ")", "!=", "2", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "line", ")", "\n", "}", "\n", "c", ":=", "cluster", "{", "name", ":", "<mask>", "[", "0", "]", ",", "zone", ":", "parts", "[", "1", "]", ",", "project", ":", "proj", "}", "\n", "options", "[", "c", ".", "name", "]", "=", "c", "\n", "}", "\n", "return", "options", ",", "nil", "\n", "}" ]
11,325
all-11326
[ "Returns", "a", "signed", "URL", "for", "GetTriggerToken", "valid", "for", "the", "specified", "duration", ".", "Required", "scopes", ":", "hooks", ":", "get", "-", "trigger", "-", "token", ":", "<hookGroupId", ">", "/", "<hookId", ">", "See", "GetTriggerToken", "for", "more", "details", "." ]
[ "func", "(", "hooks", "*", "Hooks", ")", "GetTriggerToken_SignedURL", "(", "hookGroupId", ",", "hookId", "string", ",", "<mask>", "time", ".", "Duration", ")", "(", "*", "url", ".", "URL", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "Client", "(", "*", "hooks", ")", "\n", "return", "(", "&", "cd", ")", ".", "SignedURL", "(", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "hookGroupId", ")", "+", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "hookId", ")", "+", "\"", "\"", ",", "nil", ",", "duration", ")", "\n", "}" ]
11,326
all-11327
[ "UnsafeSeqPut", "must", "be", "called", "holding", "the", "lock", "on", "the", "tx", "." ]
[ "func", "(", "t", "*", "batchTx", ")", "UnsafeSeqPut", "(", "bucketName", "[", "]", "byte", ",", "key", "[", "]", "<mask>", ",", "value", "[", "]", "byte", ")", "{", "t", ".", "unsafePut", "(", "bucketName", ",", "key", ",", "value", ",", "true", ")", "\n", "}" ]
11,327
all-11328
[ "sendTaskStatusToECS", "invokes", "the", "SubmitTaskStateChange", "API", "to", "send", "a", "task", "status", "change", "to", "ECS" ]
[ "func", "sendTaskStatusToECS", "(", "client", "api", ".", "ECSClient", ",", "<mask>", "*", "sendableEvent", ")", "error", "{", "return", "client", ".", "SubmitTaskStateChange", "(", "event", ".", "taskChange", ")", "\n", "}" ]
11,328
all-11329
[ "AddCompilationCache", "seeds", "compilation", "cache", "for", "given", "url", ".", "Compilation", "cache", "does", "not", "survive", "cross", "-", "process", "navigation", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "Page#method", "-", "addCompilationCache", "parameters", ":", "url", "data", "-", "Base64", "-", "encoded", "data" ]
[ "func", "AddCompilationCache", "(", "url", "string", ",", "<mask>", "string", ")", "*", "AddCompilationCacheParams", "{", "return", "&", "AddCompilationCacheParams", "{", "URL", ":", "url", ",", "Data", ":", "data", ",", "}", "\n", "}" ]
11,329
all-11330
[ "ClientAfterChannelCreate", "activates", "channel", "and", "triggers", "endpoint", "retrieval", "." ]
[ "func", "(", "w", "*", "Worker", ")", "ClientAfterChannelCreate", "(", "job", "*", "data", ".", "Job", ")", "error", "{", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "job", ")", "\n\n", "ch", ",", "err", ":=", "w", ".", "relatedChannel", "(", "logger", ",", "job", ",", "data", ".", "JobClientAfterChannelCreate", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "ethLog", ",", "err", ":=", "w", ".", "ethLog", "(", "logger", ",", "job", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "ch", ",", "\"", "\"", ",", "ethLog", ")", "\n\n", "ch", ".", "Block", "=", "uint32", "(", "ethLog", ".", "Block", ")", "\n", "ch", ".", "ChannelStatus", "=", "<mask>", ".", "ChannelActive", "\n", "if", "err", "=", "w", ".", "saveRecord", "(", "logger", ",", "w", ".", "db", ".", "Querier", ",", "ch", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "key", ",", "err", ":=", "w", ".", "keyFromChannelData", "(", "logger", ",", "ch", ".", "ID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "key", ")", "\n\n", "var", "endpointMsgSealed", "[", "]", "byte", "\n\n", "offering", ",", "err", ":=", "w", ".", "offering", "(", "logger", ",", "ch", ".", "Offering", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", "==", "nil", "{", "client", ",", "err", ":=", "w", ".", "somcClientBuilder", ".", "NewClient", "(", "offering", ".", "SOMCType", ",", "offering", ".", "SOMCData", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrGetEndpoint", "\n", "}", "\n", "rawMsg", ",", "err", ":=", "client", ".", "Endpoint", "(", "key", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrGetEndpoint", "\n", "}", "\n", "endpointMsgSealed", ",", "err", "=", "data", ".", "ToBytes", "(", "rawMsg", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrGetEndpoint", "\n", "}", "\n", "}", "\n\n", "err", "=", "w", ".", "addJobWithData", "(", "logger", ",", "nil", ",", "data", ".", "JobClientEndpointRestore", ",", "data", ".", "JobChannel", ",", "ch", ".", "ID", ",", "&", "data", ".", "JobEndpointCreateData", "{", "EndpointSealed", ":", "endpointMsgSealed", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "client", ",", "err", ":=", "w", ".", "account", "(", "logger", ",", "ch", ".", "Client", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "w", ".", "addJob", "(", "logger", ",", "nil", ",", "data", ".", "JobAccountUpdateBalances", ",", "data", ".", "JobAccount", ",", "client", ".", "ID", ")", "\n", "}" ]
11,330
all-11331
[ "querystring", "implements", "querystringer", "to", "represent", "the", "photo", "." ]
[ "func", "(", "op", "*", "OutgoingPhoto", ")", "querystring", "(", ")", "querystring", "{", "toReturn", ":=", "<mask>", "[", "string", "]", "string", "(", "op", ".", "getBaseQueryString", "(", ")", ")", "\n\n", "if", "op", ".", "Caption", "!=", "\"", "\"", "{", "toReturn", "[", "\"", "\"", "]", "=", "op", ".", "Caption", "\n", "}", "\n\n", "return", "querystring", "(", "toReturn", ")", "\n", "}" ]
11,331
all-11332
[ "Count", "returns", "the", "number", "of", "results", "for", "the", "query", ".", "The", "running", "time", "and", "number", "of", "API", "calls", "made", "by", "Count", "scale", "linearly", "with", "the", "sum", "of", "the", "query", "s", "offset", "and", "limit", ".", "Unless", "the", "result", "count", "is", "expected", "to", "be", "small", "it", "is", "best", "to", "specify", "a", "limit", ";", "otherwise", "Count", "will", "continue", "until", "it", "finishes", "counting", "or", "the", "provided", "context", "expires", "." ]
[ "func", "(", "q", "*", "Query", ")", "Count", "(", "c", "context", ".", "Context", ")", "(", "int", ",", "error", ")", "{", "// Check that the query is well-formed.", "if", "q", ".", "err", "!=", "nil", "{", "return", "0", ",", "q", ".", "err", "\n", "}", "\n\n", "// Run a copy of the query, with keysOnly true (if we're not a projection,", "// since the two are incompatible), and an adjusted offset. We also set the", "// limit to zero, as we don't want any actual entity data, just the number", "// of skipped results.", "newQ", ":=", "q", ".", "<mask>", "(", ")", "\n", "newQ", ".", "keysOnly", "=", "len", "(", "newQ", ".", "projection", ")", "==", "0", "\n", "newQ", ".", "limit", "=", "0", "\n", "if", "q", ".", "limit", "<", "0", "{", "// If the original query was unlimited, set the new query's offset to maximum.", "newQ", ".", "offset", "=", "math", ".", "MaxInt32", "\n", "}", "else", "{", "newQ", ".", "offset", "=", "q", ".", "offset", "+", "q", ".", "limit", "\n", "if", "newQ", ".", "offset", "<", "0", "{", "// Do the best we can, in the presence of overflow.", "newQ", ".", "offset", "=", "math", ".", "MaxInt32", "\n", "}", "\n", "}", "\n", "req", ":=", "&", "pb", ".", "Query", "{", "}", "\n", "if", "err", ":=", "newQ", ".", "toProto", "(", "req", ",", "internal", ".", "FullyQualifiedAppID", "(", "c", ")", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "res", ":=", "&", "pb", ".", "QueryResult", "{", "}", "\n", "if", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "// n is the count we will return. For example, suppose that our original", "// query had an offset of 4 and a limit of 2008: the count will be 2008,", "// provided that there are at least 2012 matching entities. However, the", "// RPCs will only skip 1000 results at a time. The RPC sequence is:", "// call RunQuery with (offset, limit) = (2012, 0) // 2012 == newQ.offset", "// response has (skippedResults, moreResults) = (1000, true)", "// n += 1000 // n == 1000", "// call Next with (offset, limit) = (1012, 0) // 1012 == newQ.offset - n", "// response has (skippedResults, moreResults) = (1000, true)", "// n += 1000 // n == 2000", "// call Next with (offset, limit) = (12, 0) // 12 == newQ.offset - n", "// response has (skippedResults, moreResults) = (12, false)", "// n += 12 // n == 2012", "// // exit the loop", "// n -= 4 // n == 2008", "var", "n", "int32", "\n", "for", "{", "// The QueryResult should have no actual entity data, just skipped results.", "if", "len", "(", "res", ".", "Result", ")", "!=", "0", "{", "return", "0", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "n", "+=", "res", ".", "GetSkippedResults", "(", ")", "\n", "if", "!", "res", ".", "GetMoreResults", "(", ")", "{", "break", "\n", "}", "\n", "if", "err", ":=", "callNext", "(", "c", ",", "res", ",", "newQ", ".", "offset", "-", "n", ",", "q", ".", "count", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "}", "\n", "n", "-=", "q", ".", "offset", "\n", "if", "n", "<", "0", "{", "// If the offset was greater than the number of matching entities,", "// return 0 instead of negative.", "n", "=", "0", "\n", "}", "\n", "return", "int", "(", "n", ")", ",", "nil", "\n", "}" ]
11,332
all-11333
[ "GetAdjustment", "is", "a", "wrapper", "around", "gtk_list_box_get_adjustment", "()", "." ]
[ "func", "(", "v", "*", "ListBox", ")", "GetAdjustment", "(", ")", "*", "Adjustment", "{", "c", ":=", "C", ".", "gtk_list_box_get_adjustment", "(", "v", ".", "native", "(", ")", ")", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "<mask>", "&", "Adjustment", "{", "glib", ".", "InitiallyUnowned", "{", "obj", "}", "}", "\n", "}" ]
11,333
all-11334
[ "Returns", "the", "location", "of", "a", "uniform", "variable" ]
[ "func", "GetUniformLocation", "(", "program", "uint32", ",", "<mask>", "*", "uint8", ")", "int32", "{", "ret", ":=", "C", ".", "glowGetUniformLocation", "(", "gpGetUniformLocation", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ")", "\n", "return", "(", "int32", ")", "(", "ret", ")", "\n", "}" ]
11,334
all-11335
[ "Parameter", "callback", "has", "type", "C", ".", "GLDEBUGPROCKHR", "." ]
[ "func", "DebugMessageCallbackKHR", "(", "callback", "unsafe", ".", "Pointer", ",", "userParam", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall", "(", "gpDebugMessageCallbackKHR", ",", "2", ",", "syscall", ".", "NewCallback", "(", "<mask>", ")", ",", "uintptr", "(", "userParam", ")", ",", "0", ")", "\n", "}" ]
11,335
all-11336
[ "RecordMetricsWithRecorder", "records", "metrics", "with", "the", "given", "recorder", "." ]
[ "func", "RecordMetricsWithRecorder", "(", "r", "Recorder", ")", "{", "ticker", ":=", "time", ".", "NewTicker", "(", "r", ".", "Interval", "(", ")", ")", "\n", "<mask>", "func", "(", ")", "{", "for", "_", "=", "range", "ticker", ".", "C", "{", "r", ".", "Record", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n", "}" ]
11,336
all-11337
[ "GetImage", "()", "is", "a", "wrapper", "around", "gtk_button_get_image", "()", "." ]
[ "func", "(", "v", "*", "Button", ")", "GetImage", "(", ")", "(", "*", "Widget", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_button_get_image", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapWidget", "(", "obj", ")", ",", "nil", "\n", "}" ]
11,337
all-11338
[ "AdjustmentNew", "is", "a", "wrapper", "around", "gtk_adjustment_new", "()", "." ]
[ "func", "AdjustmentNew", "(", "value", ",", "lower", ",", "upper", ",", "stepIncrement", ",", "pageIncrement", ",", "pageSize", "float64", ")", "(", "*", "Adjustment", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_adjustment_new", "(", "C", ".", "gdouble", "(", "value", ")", ",", "C", ".", "gdouble", "(", "<mask>", ")", ",", "C", ".", "gdouble", "(", "upper", ")", ",", "C", ".", "gdouble", "(", "stepIncrement", ")", ",", "C", ".", "gdouble", "(", "pageIncrement", ")", ",", "C", ".", "gdouble", "(", "pageSize", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapAdjustment", "(", "obj", ")", ",", "nil", "\n", "}" ]
11,338
all-11339
[ "String", "returns", "the", "human", "-", "friendly", "version", "of", "this", "dependency", "." ]
[ "func", "(", "d", "*", "CatalogServiceQuery", ")", "String", "(", ")", "string", "{", "name", ":=", "d", ".", "name", "\n", "if", "d", ".", "tag", "!=", "\"", "\"", "{", "name", "=", "d", ".", "tag", "+", "\"", "\"", "+", "<mask>", "\n", "}", "\n", "if", "d", ".", "dc", "!=", "\"", "\"", "{", "name", "=", "name", "+", "\"", "\"", "+", "d", ".", "dc", "\n", "}", "\n", "if", "d", ".", "near", "!=", "\"", "\"", "{", "name", "=", "name", "+", "\"", "\"", "+", "d", ".", "near", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", "\n", "}" ]
11,339
all-11340
[ "DeleteContainerConsoleLog", "deletes", "the", "requested", "container", "s", "console", "log" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "DeleteContainerConsoleLog", "(", "containerName", "string", ",", "args", "*", "ContainerConsoleLogArgs", ")", "error", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "// Send the request", "_", ",", "_", ",", "err", ":=", "r", ".", "<mask>", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "containerName", ")", ")", ",", "nil", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
11,340
all-11341
[ "NewGRPCLoggerV2", "converts", "*", "zap", ".", "Logger", "to", "grpclog", ".", "LoggerV2", ".", "It", "discards", "all", "INFO", "level", "logging", "in", "gRPC", "if", "debug", "level", "is", "not", "enabled", "in", "*", "zap", ".", "Logger", "." ]
[ "func", "NewGRPCLoggerV2", "(", "lcfg", "zap", ".", "Config", ")", "(", "grpclog", ".", "LoggerV2", ",", "<mask>", ")", "{", "lg", ",", "err", ":=", "lcfg", ".", "Build", "(", "zap", ".", "AddCallerSkip", "(", "1", ")", ")", "// to annotate caller outside of \"logutil\"", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "zapGRPCLogger", "{", "lg", ":", "lg", ",", "sugar", ":", "lg", ".", "Sugar", "(", ")", "}", ",", "nil", "\n", "}" ]
11,341
all-11342
[ "PrefixMatch", "returns", "a", "list", "of", "at", "most", "num", "nodes", "which", "match", "the", "prefix", "of", "the", "key", ".", "If", "num", "is", "0", "it", "returns", "all", "matches", ".", "For", "example", "if", "the", "following", "keys", "were", "inserted", ":", "id", "key", "19", "abc", "23", "ab", "37", "abcd", "then", "PrefixMatch", "(", "[]", "byte", "(", "abc", ")", "1", ")", "=", "[", "23", "]", "//", "match", "[", "ab", "]", "PrefixMatch", "(", "[]", "byte", "(", "abcd", ")", "0", ")", "=", "[", "23", "19", "37", "]", "//", "match", "[", "ab", "abc", "abcd", "]" ]
[ "func", "(", "da", "*", "Cedar", ")", "PrefixMatch", "(", "key", "[", "]", "byte", ",", "num", "int", ")", "(", "ids", "[", "]", "int", ")", "{", "for", "from", ",", "i", ":=", "0", ",", "0", ";", "i", "<", "len", "(", "<mask>", ")", ";", "i", "++", "{", "to", ",", "err", ":=", "da", ".", "Jump", "(", "key", "[", "i", ":", "i", "+", "1", "]", ",", "from", ")", "\n", "if", "err", "!=", "nil", "{", "break", "\n", "}", "\n", "if", "_", ",", "err", ":=", "da", ".", "Value", "(", "to", ")", ";", "err", "==", "nil", "{", "ids", "=", "append", "(", "ids", ",", "to", ")", "\n", "num", "--", "\n", "if", "num", "==", "0", "{", "return", "\n", "}", "\n", "}", "\n", "from", "=", "to", "\n", "}", "\n", "return", "\n", "}" ]
11,342
all-11343
[ "GetDevices", "returns", "the", "GPU", "devices", "as", "PlatformDevices" ]
[ "func", "(", "n", "*", "NvidiaGPUManager", ")", "GetDevices", "(", ")", "[", "]", "*", "ecs", ".", "PlatformDevice", "{", "n", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "n", ".", "lock", ".", "RUnlock", "(", ")", "\n", "return", "n", ".", "GPUDevices", "\n", "}" ]
11,343
all-11344
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventExceptionThrown", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime33", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
11,344
all-11345
[ "Formats", "for", "rendering", "as", "an", "http", "header", ".", "E", ".", "G", ".", "default", "-", "src", "self", ";", "script", "-", "src", "self", "https", ":", "//", "apis", ".", "google", ".", "com" ]
[ "func", "(", "o", "Opts", ")", "Header", "(", ")", "string", "{", "h", ":=", "<mask>", "(", "[", "]", "string", ",", "0", ")", "\n\n", "var", "fields", "=", "[", "]", "struct", "{", "desc", "string", "\n", "sites", "[", "]", "string", "\n", "}", "{", "{", "\"", "\"", ",", "o", ".", "DefaultSrc", "}", ",", "{", "\"", "\"", ",", "o", ".", "ConnectSrc", "}", ",", "{", "\"", "\"", ",", "o", ".", "FrameSrc", "}", ",", "{", "\"", "\"", ",", "o", ".", "FontSrc", "}", ",", "{", "\"", "\"", ",", "o", ".", "ImgSrc", "}", ",", "{", "\"", "\"", ",", "o", ".", "MediaSrc", "}", ",", "{", "\"", "\"", ",", "o", ".", "ObjectSrc", "}", ",", "{", "\"", "\"", ",", "o", ".", "StyleSrc", "}", ",", "{", "\"", "\"", ",", "o", ".", "ScriptSrc", "}", ",", "}", "\n", "for", "_", ",", "f", ":=", "range", "fields", "{", "if", "f", ".", "sites", "!=", "nil", "{", "h", "=", "append", "(", "h", ",", "f", ".", "desc", "+", "\"", "\"", "+", "strings", ".", "Join", "(", "f", ".", "sites", ",", "\"", "\"", ")", ")", "\n", "}", "\n", "}", "\n", "if", "o", ".", "ReportUri", "!=", "\"", "\"", "{", "h", "=", "append", "(", "h", ",", "\"", "\"", "+", "o", ".", "ReportUri", ")", "\n", "}", "\n", "return", "strings", ".", "Join", "(", "h", ",", "\"", "\"", ")", "\n", "}" ]
11,345
all-11346
[ "All", "writes", "out", "all", "the", "release", "data", "to", "writer", "." ]
[ "func", "(", "s", "*", "ShowCmd", ")", "All", "(", "w", "io", ".", "Writer", ")", "error", "{", "if", "filepath", ".", "Ext", "(", "s", ".", "release", ")", "==", "\"", "\"", "{", "pivnetRelease", ",", "err", ":=", "<mask>", ".", "LoadPivnetRelease", "(", "s", ".", "releaseRepo", ",", "s", ".", "release", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "_", ",", "br", ":=", "range", "pivnetRelease", ".", "BoshRelease", "{", "s", ".", "printBoshRelease", "(", "w", ",", "br", ")", "\n", "}", "\n", "return", "nil", "\n", "}", "\n", "boshRelease", ",", "err", ":=", "release", ".", "LoadBoshRelease", "(", "s", ".", "releaseRepo", ",", "s", ".", "release", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "s", ".", "printBoshRelease", "(", "w", ",", "boshRelease", ")", "\n", "return", "nil", "\n", "}" ]
11,346
all-11347
[ "Renew", "renews", "the", "caller", "s", "credentials", "(", "and", "extends", "the", "TTL", "of", "their", "Pachyderm", "token", "by", "sending", "a", "request", "to", "Pachyderm", ")", ".", "Unlike", "other", "handlers", "it", "doesn", "t", "get", "assigned", "to", "a", "path", ";", "instead", "it", "s", "called", "by", "the", "vault", "lease", "API", "when", "a", "token", "s", "lease", "is", "renewed", ".", "It", "s", "set", "in", "Backend", ".", "Secrets", "[", "0", "]", ".", "Revoke", "in", "backend", ".", "go" ]
[ "func", "(", "b", "*", "backend", ")", "Renew", "(", "ctx", "context", ".", "Context", ",", "req", "*", "logical", ".", "Request", ",", "d", "*", "framework", ".", "FieldData", ")", "(", "resp", "*", "logical", ".", "Response", ",", "retErr", "error", ")", "{", "// renew seems to be handled specially, and req.ID doesn't seem to be set", "b", ".", "Logger", "(", ")", ".", "Debug", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "req", ".", "Operation", ",", "req", ".", "<mask>", ")", ")", "\n", "defer", "func", "(", ")", "{", "b", ".", "Logger", "(", ")", ".", "Debug", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "req", ".", "Operation", ",", "req", ".", "Path", ",", "retErr", "==", "nil", "&&", "!", "resp", ".", "IsError", "(", ")", ")", ")", "\n", "}", "(", ")", "\n\n", "// Extract pachyderm token from vault secret", "tokenIface", ",", "ok", ":=", "req", ".", "Secret", ".", "InternalData", "[", "\"", "\"", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "userToken", ",", "ok", ":=", "tokenIface", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "tokenIface", ")", "\n", "}", "\n\n", "// Get pach address and admin token from config", "config", ",", "err", ":=", "getConfig", "(", "ctx", ",", "req", ".", "Storage", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "len", "(", "config", ".", "AdminToken", ")", "==", "0", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "config", ".", "PachdAddress", ")", "==", "0", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Extract TTL from request first, and then config (if unset)", "ttl", ",", "maxTTL", ":=", "req", ".", "Secret", ".", "LeaseOptions", ".", "Increment", ",", "b", ".", "System", "(", ")", ".", "MaxLeaseTTL", "(", ")", "\n", "if", "ttl", "==", "0", "{", "ttl", ",", "maxTTL", ",", "err", "=", "b", ".", "SanitizeTTLStr", "(", "config", ".", "TTL", ",", "maxTTL", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "// Renew creds in Pachyderm", "err", "=", "renewUserCredentials", "(", "ctx", ",", "config", ".", "PachdAddress", ",", "config", ".", "AdminToken", ",", "userToken", ",", "ttl", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Renew vault lease", "return", "framework", ".", "LeaseExtend", "(", "ttl", ",", "maxTTL", ",", "b", ".", "System", "(", ")", ")", "(", "ctx", ",", "req", ",", "d", ")", "\n", "}" ]
11,347
all-11348
[ "Criticalf", "logs", "a", "message", "using", "CRITICAL", "as", "log", "level", "." ]
[ "func", "(", "l", "*", "Logger", ")", "Criticalf", "(", "format", "string", ",", "args", "...", "<mask>", "{", "}", ")", "{", "l", ".", "log", "(", "CRITICAL", ",", "&", "format", ",", "args", "...", ")", "\n", "}" ]
11,348
all-11349
[ "Remove", "erases", "current", "container", "from", "Docker", "." ]
[ "func", "(", "s", "*", "Container", ")", "Remove", "(", ")", "error", "{", "return", "exec", ".", "Command", "(", "s", ".", "docker", ".", "binCmd", ",", "\"", "\"", ",", "s", ".", "<mask>", ")", ".", "Run", "(", ")", "\n", "}" ]
11,349
all-11350
[ "Dump", "the", "current", "configuration", "held", "by", "this", "Map", ".", "Keys", "that", "match", "their", "default", "value", "will", "not", "be", "included", "in", "the", "dump", ".", "Also", "if", "a", "Key", "has", "its", "Hidden", "attribute", "set", "to", "true", "it", "will", "be", "rendered", "as", "true", "for", "obfuscating", "the", "actual", "value", "." ]
[ "func", "(", "m", "*", "Map", ")", "Dump", "(", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "values", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n\n", "for", "name", ",", "key", ":=", "<mask>", "m", ".", "schema", "{", "value", ":=", "m", ".", "GetRaw", "(", "name", ")", "\n", "if", "value", "!=", "key", ".", "Default", "{", "if", "key", ".", "Hidden", "{", "values", "[", "name", "]", "=", "true", "\n", "}", "else", "{", "values", "[", "name", "]", "=", "value", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "values", "\n", "}" ]
11,350
all-11351
[ "newDriver", "is", "used", "to", "create", "a", "new", "Driver", "instance" ]
[ "func", "newDriver", "(", "env", "*", "serviceenv", ".", "ServiceEnv", ",", "etcdPrefix", "string", ",", "treeCache", "*", "hashtree", ".", "Cache", ",", "storageRoot", "string", ",", "memoryRequest", "int64", ")", "(", "*", "driver", ",", "error", ")", "{", "// Validate arguments", "if", "treeCache", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "// Initialize driver", "etcdClient", ":=", "env", ".", "GetEtcdClient", "(", ")", "\n", "d", ":=", "&", "driver", "{", "etcdClient", ":", "etcdClient", ",", "prefix", ":", "etcdPrefix", ",", "repos", ":", "pfsdb", ".", "Repos", "(", "etcdClient", ",", "etcdPrefix", ")", ",", "putFileRecords", ":", "pfsdb", ".", "PutFileRecords", "(", "etcdClient", ",", "etcdPrefix", ")", ",", "commits", ":", "func", "(", "repo", "string", ")", "col", ".", "Collection", "{", "return", "pfsdb", ".", "Commits", "(", "etcdClient", ",", "etcdPrefix", ",", "repo", ")", "\n", "}", ",", "branches", ":", "func", "(", "repo", "string", ")", "col", ".", "Collection", "{", "return", "pfsdb", ".", "Branches", "(", "etcdClient", ",", "etcdPrefix", ",", "repo", ")", "\n", "}", ",", "openCommits", ":", "pfsdb", ".", "OpenCommits", "(", "etcdClient", ",", "etcdPrefix", ")", ",", "treeCache", ":", "treeCache", ",", "storageRoot", ":", "storageRoot", ",", "// Allow up to a third of the requested memory to be used for memory intensive operations", "memoryLimiter", ":", "semaphore", ".", "NewWeighted", "(", "memoryRequest", "/", "3", ")", ",", "}", "\n", "// Create spec repo (default repo)", "repo", ":=", "client", ".", "NewRepo", "(", "ppsconsts", ".", "SpecRepo", ")", "\n", "repoInfo", ":=", "&", "pfs", ".", "RepoInfo", "{", "Repo", ":", "repo", ",", "Created", ":", "<mask>", "(", ")", ",", "}", "\n", "if", "_", ",", "err", ":=", "col", ".", "NewSTM", "(", "context", ".", "Background", "(", ")", ",", "etcdClient", ",", "func", "(", "stm", "col", ".", "STM", ")", "error", "{", "repos", ":=", "d", ".", "repos", ".", "ReadWrite", "(", "stm", ")", "\n", "return", "repos", ".", "Create", "(", "repo", ".", "Name", ",", "repoInfo", ")", "\n", "}", ")", ";", "err", "!=", "nil", "&&", "!", "col", ".", "IsErrExists", "(", "err", ")", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "d", ",", "nil", "\n", "}" ]
11,351
all-11352
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventInterstitialHidden", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage59", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
11,352
all-11353
[ "GetFileReader", "returns", "a", "reader", "for", "the", "contents", "of", "a", "file", "at", "a", "specific", "Commit", ".", "offset", "specifies", "a", "number", "of", "bytes", "that", "should", "be", "skipped", "in", "the", "beginning", "of", "the", "file", ".", "size", "limits", "the", "total", "amount", "of", "data", "returned", "note", "you", "will", "get", "fewer", "bytes", "than", "size", "if", "you", "pass", "a", "value", "larger", "than", "the", "size", "of", "the", "file", ".", "If", "size", "is", "set", "to", "0", "then", "all", "of", "the", "data", "will", "be", "returned", "." ]
[ "func", "(", "c", "APIClient", ")", "GetFileReader", "(", "repoName", "string", ",", "commitID", "string", ",", "path", "string", ",", "offset", "int64", ",", "size", "int64", ")", "(", "io", ".", "Reader", ",", "error", ")", "{", "apiGetFileClient", ",", "err", ":=", "c", ".", "getFile", "(", "repoName", ",", "commitID", ",", "path", ",", "<mask>", ",", "size", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "return", "grpcutil", ".", "NewStreamingBytesReader", "(", "apiGetFileClient", ",", "nil", ")", ",", "nil", "\n", "}" ]
11,353
all-11354
[ "RegisterCrypt", "registers", "a", "function", "that", "returns", "a", "new", "instance", "of", "the", "given", "crypt", "function", ".", "This", "is", "intended", "to", "be", "called", "from", "the", "init", "function", "in", "packages", "that", "implement", "crypt", "functions", "." ]
[ "func", "RegisterCrypt", "(", "c", "Crypt", ",", "f", "func", "(", ")", "Crypter", ",", "prefix", "string", ")", "{", "if", "c", ">=", "maxCrypt", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "crypts", "[", "c", "]", "=", "f", "\n", "cryptPrefixes", "[", "c", "]", "=", "<mask>", "\n", "}" ]
11,354
all-11355
[ "GetAll", "retrieves", "all", "regions", "from", "the", "AWS", "API" ]
[ "func", "GetAll", "(", "sess", "*", "session", ".", "Session", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "regions", "[", "]", "string", "\n", "svc", ":=", "ec2", ".", "New", "(", "sess", ",", "&", "aws", ".", "Config", "{", "Region", ":", "aws", ".", "String", "(", "Default", ")", "}", ")", "\n", "resp", ",", "err", ":=", "svc", ".", "DescribeRegions", "(", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "for", "_", ",", "region", ":=", "<mask>", "resp", ".", "Regions", "{", "regions", "=", "append", "(", "regions", ",", "*", "region", ".", "RegionName", ")", "\n", "}", "\n", "return", "regions", ",", "nil", "\n", "}" ]
11,355
all-11356
[ "WithMethod", "if", "set", "the", "request", "method", "is", "overridden", "." ]
[ "func", "(", "p", "ContinueRequestParams", ")", "WithMethod", "(", "<mask>", "string", ")", "*", "ContinueRequestParams", "{", "p", ".", "Method", "=", "method", "\n", "return", "&", "p", "\n", "}" ]
11,356
all-11357
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "PerformSearchReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom27", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
11,357
all-11358
[ "KeyExists", "returns", "a", "comparison", "operation", "that", "evaluates", "to", "true", "iff", "the", "given", "key", "exists", ".", "It", "does", "this", "by", "checking", "if", "the", "key", "Version", "is", "greater", "than", "0", ".", "It", "is", "a", "useful", "guard", "in", "transaction", "delete", "operations", "." ]
[ "func", "KeyExists", "(", "key", "string", ")", "clientv3", ".", "Cmp", "{", "return", "clientv3", ".", "Compare", "(", "clientv3", ".", "<mask>", "(", "key", ")", ",", "\"", "\"", ",", "0", ")", "\n", "}" ]
11,358
all-11359
[ "Description", "returns", "a", "description", "of", "the", "mode", "of", "this", "call", "suitable", "for", "a", "user", "interface", "e", ".", "g", ".", "static", "method", "call", "." ]
[ "func", "(", "c", "*", "CallCommon", ")", "Description", "(", ")", "string", "{", "switch", "fn", ":=", "c", ".", "<mask>", ".", "(", "type", ")", "{", "case", "*", "Builtin", ":", "return", "\"", "\"", "\n", "case", "*", "MakeClosure", ":", "return", "\"", "\"", "\n", "case", "*", "Function", ":", "if", "fn", ".", "Signature", ".", "Recv", "(", ")", "!=", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "\"", "\"", "\n", "}", "\n", "if", "c", ".", "IsInvoke", "(", ")", "{", "return", "\"", "\"", "// (\"invoke\" mode)", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
11,359
all-11360
[ "WriteKeyValue", "writes", "a", "key", "/", "value", "pair", "to", "the", "writer", "." ]
[ "func", "WriteKeyValue", "(", "buf", "Writer", ",", "key", ",", "value", "interface", "{", "}", ")", "{", "writeKey", "(", "buf", ",", "<mask>", ")", "\n", "buf", ".", "WriteRune", "(", "'='", ")", "\n", "WriteValue", "(", "buf", ",", "value", ")", "\n", "}" ]
11,360
all-11361
[ "VendorLookup", "obtains", "the", "vendor", "organization", "name", "from", "the", "MAC", "address", "s", "." ]
[ "func", "(", "m", "*", "OuiDb", ")", "VendorLookup", "(", "s", "string", ")", "(", "string", ",", "error", ")", "{", "addr", ",", "err", ":=", "net", ".", "ParseMAC", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "<mask>", ":=", "m", ".", "Lookup", "(", "HardwareAddr", "(", "addr", ")", ")", "\n", "if", "block", "==", "nil", "{", "return", "\"", "\"", ",", "ErrInvalidMACAddress", "\n", "}", "\n", "return", "block", ".", "Organization", ",", "nil", "\n", "}" ]
11,361
all-11362
[ "date", "formant", "YYYY", "-", "MM", "-", "DD", "mininum", "date", "0000", "-", "01", "-", "01", "maximum", "date", "9999", "-", "12", "-", "31" ]
[ "func", "hasDatePrefix", "(", "s", "string", ")", "bool", "{", "if", "len", "(", "s", ")", "<", "10", "{", "return", "false", "\n", "}", "\n", "var", "count", "int", "\n", "for", "i", ",", "r", ":=", "range", "s", "{", "if", "count", "!=", "i", "{", "return", "false", "\n", "}", "\n", "switch", "i", "{", "case", "4", ",", "7", ":", "if", "r", "!=", "'-'", "{", "return", "false", "\n", "}", "\n", "<mask>", ":", "if", "!", "isDigit", "(", "r", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n", "if", "i", "==", "9", "{", "// month", "if", "s", "[", "5", "]", "==", "'1'", "{", "if", "s", "[", "6", "]", ">", "'2'", "{", "return", "false", "\n", "}", "\n", "}", "else", "if", "s", "[", "5", "]", "==", "'0'", "{", "if", "s", "[", "6", "]", "==", "'0'", "{", "return", "false", "\n", "}", "\n", "}", "else", "{", "return", "false", "\n", "}", "\n\n", "// day", "if", "s", "[", "8", "]", "==", "'0'", "{", "if", "s", "[", "9", "]", "==", "'0'", "{", "return", "false", "\n", "}", "\n", "}", "else", "if", "s", "[", "8", "]", "==", "'3'", "{", "if", "s", "[", "9", "]", ">", "'1'", "{", "return", "false", "\n", "}", "\n", "}", "else", "if", "s", "[", "8", "]", "!=", "'1'", "&&", "s", "[", "8", "]", "!=", "'2'", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}", "\n", "count", "+=", "1", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
11,362
all-11363
[ "SelectDisks", "looks", "for", "disks", "that", "Terraform", "is", "supposed", "to", "manage", ".", "count", "is", "the", "number", "of", "controllers", "that", "Terraform", "is", "managing", "and", "serves", "as", "an", "upper", "limit", "(", "count", "-", "1", ")", "of", "the", "SCSI", "bus", "number", "for", "a", "controller", "that", "eligible", "disks", "need", "to", "be", "attached", "to", "." ]
[ "func", "SelectDisks", "(", "l", "object", ".", "VirtualDeviceList", ",", "count", "int", ")", "object", ".", "VirtualDeviceList", "{", "devices", ":=", "l", ".", "Select", "(", "func", "(", "device", "types", ".", "BaseVirtualDevice", ")", "bool", "{", "if", "disk", ",", "ok", ":=", "device", ".", "(", "*", "types", ".", "VirtualDisk", ")", ";", "ok", "{", "ctlr", ",", "err", ":=", "findControllerForDevice", "(", "l", ",", "disk", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "l", ".", "<mask>", "(", "disk", ")", ",", "err", ")", "\n", "return", "false", "\n", "}", "\n", "if", "sc", ",", "ok", ":=", "ctlr", ".", "(", "types", ".", "BaseVirtualSCSIController", ")", ";", "ok", "&&", "sc", ".", "GetVirtualSCSIController", "(", ")", ".", "BusNumber", "<", "int32", "(", "count", ")", "{", "cd", ":=", "sc", ".", "(", "types", ".", "BaseVirtualDevice", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "l", ".", "Name", "(", "cd", ")", ",", "l", ".", "Name", "(", "disk", ")", ")", "\n", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}", ")", "\n", "return", "devices", "\n", "}" ]
11,363
all-11364
[ "GetV0", "retrieves", "the", "V0", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "AuthenticatedMessage", ")", "GetV0", "(", ")", "(", "result", "AuthenticatedMessageV0", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "V", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "V0", "\n", "ok", "=", "<mask>", "\n", "}", "\n\n", "return", "\n", "}" ]
11,364
all-11365
[ "SetData", "mutates", "key", "such", "that", "it", "represents", "the", "identity", "of", "the", "data", "entry", "owned", "by", "account", "and", "for", "name", "." ]
[ "func", "(", "key", "*", "LedgerKey", ")", "SetData", "(", "account", "AccountId", ",", "name", "string", ")", "error", "{", "<mask>", ":=", "LedgerKeyData", "{", "account", ",", "String64", "(", "name", ")", "}", "\n", "nkey", ",", "err", ":=", "NewLedgerKey", "(", "LedgerEntryTypeData", ",", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "*", "key", "=", "nkey", "\n", "return", "nil", "\n", "}" ]
11,365
all-11366
[ "This", "method", "loads", "basic", "config", "and", "returns", "a", "copy", "of", "the", "config", "object", "." ]
[ "func", "(", "s", "*", "OAuthScheme", ")", "loadConfig", "(", ")", "(", "oauth2", ".", "Config", ",", "error", ")", "{", "if", "s", ".", "BaseConfig", ".", "ClientID", "!=", "\"", "\"", "{", "return", "s", ".", "BaseConfig", ",", "nil", "\n", "}", "\n", "if", "s", ".", "Parser", "==", "nil", "{", "s", ".", "Parser", "=", "s", "\n", "}", "\n", "var", "emptyConfig", "oauth2", ".", "Config", "\n", "clientId", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "clientSecret", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "<mask>", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "authURL", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "tokenURL", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "infoURL", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "callbackPort", ",", "err", ":=", "config", ".", "GetInt", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "s", ".", "InfoURL", "=", "infoURL", "\n", "s", ".", "CallbackPort", "=", "callbackPort", "\n", "s", ".", "BaseConfig", "=", "oauth2", ".", "Config", "{", "ClientID", ":", "clientId", ",", "ClientSecret", ":", "clientSecret", ",", "Scopes", ":", "[", "]", "string", "{", "scope", "}", ",", "Endpoint", ":", "oauth2", ".", "Endpoint", "{", "AuthURL", ":", "authURL", ",", "TokenURL", ":", "tokenURL", ",", "}", ",", "}", "\n", "return", "s", ".", "BaseConfig", ",", "nil", "\n", "}" ]
11,366
all-11367
[ "SetConfigCmd", "returns", "a", "cobra", "command", "that", "lets", "the", "caller", "configure", "auth", "backends", "in", "Pachyderm" ]
[ "func", "SetConfigCmd", "(", "noPortForwarding", "*", "bool", ")", "*", "cobra", ".", "Command", "{", "var", "file", "string", "\n", "setConfig", ":=", "&", "cobra", ".", "Command", "{", "Short", ":", "\"", "\"", ",", "Long", ":", "\"", "\"", ",", "Run", ":", "cmdutil", ".", "RunFixedArgs", "(", "0", ",", "func", "(", "args", "[", "]", "string", ")", "error", "{", "c", ",", "err", ":=", "client", ".", "NewOnUserMachine", "(", "true", ",", "!", "*", "noPortForwarding", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "defer", "c", ".", "Close", "(", ")", "\n", "var", "configBytes", "[", "]", "byte", "\n", "if", "file", "==", "\"", "\"", "{", "var", "err", "error", "\n", "configBytes", ",", "err", "=", "ioutil", ".", "ReadAll", "(", "os", ".", "Stdin", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "else", "if", "<mask>", "!=", "\"", "\"", "{", "var", "err", "error", "\n", "configBytes", ",", "err", "=", "ioutil", ".", "ReadFile", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "file", ",", "err", ")", "\n", "}", "\n", "}", "else", "{", "return", "errors", ".", "New", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "// Try to parse config as YAML (JSON is a subset of YAML)", "var", "config", "auth", ".", "AuthConfig", "\n", "if", "err", ":=", "yaml", ".", "Unmarshal", "(", "configBytes", ",", "&", "config", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "// TODO(msteffen): try to handle empty config?", "_", ",", "err", "=", "c", ".", "SetConfiguration", "(", "c", ".", "Ctx", "(", ")", ",", "&", "auth", ".", "SetConfigurationRequest", "{", "Configuration", ":", "&", "config", ",", "}", ")", "\n", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", ")", ",", "}", "\n", "setConfig", ".", "Flags", "(", ")", ".", "StringVarP", "(", "&", "file", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "+", "\"", "\"", ")", "\n", "return", "cmdutil", ".", "CreateAlias", "(", "setConfig", ",", "\"", "\"", ")", "\n", "}" ]
11,367
all-11368
[ "RegisterLockHandler", "registers", "the", "http", "handlers", "for", "service", "Lock", "to", "mux", ".", "The", "handlers", "forward", "requests", "to", "the", "grpc", "endpoint", "over", "the", "given", "implementation", "of", "LockClient", ".", "Note", ":", "the", "gRPC", "framework", "executes", "interceptors", "within", "the", "gRPC", "handler", ".", "If", "the", "passed", "in", "LockClient", "doesn", "t", "go", "through", "the", "normal", "gRPC", "flow", "(", "creating", "a", "gRPC", "client", "etc", ".", ")", "then", "it", "will", "be", "up", "to", "the", "passed", "in", "LockClient", "to", "call", "the", "correct", "interceptors", "." ]
[ "func", "RegisterLockHandlerClient", "(", "ctx", "context", ".", "Context", ",", "mux", "*", "runtime", ".", "ServeMux", ",", "client", "v3lockpb", ".", "LockClient", ")", "error", "{", "mux", ".", "Handle", "(", "\"", "\"", ",", "pattern_Lock_Lock_0", ",", "func", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ",", "pathParams", "map", "[", "string", "]", "string", ")", "{", "ctx", ",", "cancel", ":=", "<mask>", ".", "WithCancel", "(", "req", ".", "Context", "(", ")", ")", "\n", "defer", "cancel", "(", ")", "\n", "if", "cn", ",", "ok", ":=", "w", ".", "(", "http", ".", "CloseNotifier", ")", ";", "ok", "{", "go", "func", "(", "done", "<-", "chan", "struct", "{", "}", ",", "closed", "<-", "chan", "bool", ")", "{", "select", "{", "case", "<-", "done", ":", "case", "<-", "closed", ":", "cancel", "(", ")", "\n", "}", "\n", "}", "(", "ctx", ".", "Done", "(", ")", ",", "cn", ".", "CloseNotify", "(", ")", ")", "\n", "}", "\n", "inboundMarshaler", ",", "outboundMarshaler", ":=", "runtime", ".", "MarshalerForRequest", "(", "mux", ",", "req", ")", "\n", "rctx", ",", "err", ":=", "runtime", ".", "AnnotateContext", "(", "ctx", ",", "mux", ",", "req", ")", "\n", "if", "err", "!=", "nil", "{", "runtime", ".", "HTTPError", "(", "ctx", ",", "mux", ",", "outboundMarshaler", ",", "w", ",", "req", ",", "err", ")", "\n", "return", "\n", "}", "\n", "resp", ",", "md", ",", "err", ":=", "request_Lock_Lock_0", "(", "rctx", ",", "inboundMarshaler", ",", "client", ",", "req", ",", "pathParams", ")", "\n", "ctx", "=", "runtime", ".", "NewServerMetadataContext", "(", "ctx", ",", "md", ")", "\n", "if", "err", "!=", "nil", "{", "runtime", ".", "HTTPError", "(", "ctx", ",", "mux", ",", "outboundMarshaler", ",", "w", ",", "req", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "forward_Lock_Lock_0", "(", "ctx", ",", "mux", ",", "outboundMarshaler", ",", "w", ",", "req", ",", "resp", ",", "mux", ".", "GetForwardResponseOptions", "(", ")", "...", ")", "\n\n", "}", ")", "\n\n", "mux", ".", "Handle", "(", "\"", "\"", ",", "pattern_Lock_Unlock_0", ",", "func", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ",", "pathParams", "map", "[", "string", "]", "string", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "req", ".", "Context", "(", ")", ")", "\n", "defer", "cancel", "(", ")", "\n", "if", "cn", ",", "ok", ":=", "w", ".", "(", "http", ".", "CloseNotifier", ")", ";", "ok", "{", "go", "func", "(", "done", "<-", "chan", "struct", "{", "}", ",", "closed", "<-", "chan", "bool", ")", "{", "select", "{", "case", "<-", "done", ":", "case", "<-", "closed", ":", "cancel", "(", ")", "\n", "}", "\n", "}", "(", "ctx", ".", "Done", "(", ")", ",", "cn", ".", "CloseNotify", "(", ")", ")", "\n", "}", "\n", "inboundMarshaler", ",", "outboundMarshaler", ":=", "runtime", ".", "MarshalerForRequest", "(", "mux", ",", "req", ")", "\n", "rctx", ",", "err", ":=", "runtime", ".", "AnnotateContext", "(", "ctx", ",", "mux", ",", "req", ")", "\n", "if", "err", "!=", "nil", "{", "runtime", ".", "HTTPError", "(", "ctx", ",", "mux", ",", "outboundMarshaler", ",", "w", ",", "req", ",", "err", ")", "\n", "return", "\n", "}", "\n", "resp", ",", "md", ",", "err", ":=", "request_Lock_Unlock_0", "(", "rctx", ",", "inboundMarshaler", ",", "client", ",", "req", ",", "pathParams", ")", "\n", "ctx", "=", "runtime", ".", "NewServerMetadataContext", "(", "ctx", ",", "md", ")", "\n", "if", "err", "!=", "nil", "{", "runtime", ".", "HTTPError", "(", "ctx", ",", "mux", ",", "outboundMarshaler", ",", "w", ",", "req", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "forward_Lock_Unlock_0", "(", "ctx", ",", "mux", ",", "outboundMarshaler", ",", "w", ",", "req", ",", "resp", ",", "mux", ".", "GetForwardResponseOptions", "(", ")", "...", ")", "\n\n", "}", ")", "\n\n", "return", "nil", "\n", "}" ]
11,368
all-11369
[ "Step", "2", "is", "the", "removal", "of", "the", "и", "suffix", "." ]
[ "func", "step2", "(", "word", "*", "snowballword", ".", "SnowballWord", ")", "bool", "{", "suffix", ",", "_", ":=", "word", ".", "RemoveFirstSuffixIn", "(", "word", ".", "RVstart", ",", "\"", ")", "", "\n", "if", "suffix", "!=", "\"", "\"", "{", "return", "<mask>", "\n", "}", "\n", "return", "false", "\n", "}" ]
11,369
all-11370
[ "AddFont", "adds", "the", "font", "to", "the", "configuration", "." ]
[ "func", "AddFont", "(", "fontPath", "string", ")", "{", "path", ":=", "(", "*", "C", ".", "uchar", ")", "(", "unsafe", ".", "Pointer", "(", "C", ".", "CString", "(", "fontPath", ")", ")", ")", "\n", "C", ".", "addFont", "(", "<mask>", ")", "\n", "}" ]
11,370
all-11371
[ "Do", "executes", "Overlay", ".", "setShowPaintRects", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetShowPaintRectsParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetShowPaintRects", ",", "p", ",", "nil", ")", "\n", "}" ]
11,371
all-11372
[ "Return", "the", "names", "of", "all", "available", "patches", "." ]
[ "func", "patchesGetNames", "(", ")", "[", "]", "string", "{", "names", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "patches", ")", ")", "\n", "for", "i", ",", "patch", ":=", "range", "patches", "{", "names", "[", "i", "]", "=", "patch", ".", "<mask>", "\n", "}", "\n", "return", "names", "\n", "}" ]
11,372
all-11373
[ "mkTokenCallback", "returns", "a", "callback", "function", "that", "can", "be", "used", "to", "save", "the", "token", "initially", "or", "register", "to", "the", "Azure", "SDK", "to", "be", "called", "when", "the", "token", "is", "refreshed", "." ]
[ "func", "mkTokenCallback", "(", "path", "string", ")", "azure", ".", "TokenRefreshCallback", "{", "return", "func", "(", "t", "azure", ".", "Token", ")", "error", "{", "if", "err", ":=", "azure", ".", "SaveToken", "(", "<mask>", ",", "0600", ",", "t", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n", "}" ]
11,373
all-11374
[ "Do", "executes", "DOM", ".", "redo", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "RedoParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandRedo", ",", "nil", ",", "nil", ")", "\n", "}" ]
11,374
all-11375
[ "CanonicalNetworkAddress", "parses", "the", "given", "network", "address", "and", "returns", "a", "string", "of", "the", "form", "host", ":", "port", "possibly", "filling", "it", "with", "the", "default", "port", "if", "it", "s", "missing", "." ]
[ "func", "CanonicalNetworkAddress", "(", "address", "string", ")", "string", "{", "_", ",", "_", ",", "err", ":=", "net", ".", "SplitHostPort", "(", "address", ")", "\n", "if", "err", "!=", "nil", "{", "ip", ":=", "net", ".", "ParseIP", "(", "address", ")", "\n", "if", "ip", "!=", "nil", "&&", "ip", ".", "To4", "(", ")", "==", "nil", "{", "address", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "address", ",", "<mask>", ".", "DefaultPort", ")", "\n", "}", "else", "{", "address", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "address", ",", "shared", ".", "DefaultPort", ")", "\n", "}", "\n", "}", "\n", "return", "address", "\n", "}" ]
11,375
all-11376
[ "VerifyChannelsForInactivity", "scans", "all", "channels", "that", "are", "not", "terminated", "and", "terminates", "those", "of", "them", "who", "are", "staying", "inactive", "too", "long", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "VerifyChannelsForInactivity", "(", ")", "error", "{", "<mask>", ":=", "`\n SELECT channels.id::text\n\t\tFROM channels\n LEFT JOIN sessions ses\n ON channels.id = ses.channel\n LEFT JOIN offerings offer\n ON channels.offering = offer.id\n INNER JOIN accounts acc\n ON channels.agent = acc.eth_addr\n WHERE channels.service_status IN ('pending', 'active', 'suspended')\n AND channels.channel_status NOT IN ('pending')\n AND acc.in_use\n GROUP BY channels.id, offer.max_inactive_time_sec\n HAVING GREATEST(MAX(ses.last_usage_time), channels.service_changed_time) +\n\t (offer.max_inactive_time_sec * INTERVAL '1 second') < now();`", "\n\n", "return", "m", ".", "processEachChannel", "(", "query", ",", "m", ".", "terminateService", ")", "\n", "}" ]
11,376
all-11377
[ "MarshalEasyJSON", "writes", "the", "Password", "to", "a", "easyjson", ".", "Writer" ]
[ "func", "(", "r", "Password", ")", "MarshalEasyJSON", "(", "w", "*", "jwriter", ".", "<mask>", ")", "{", "w", ".", "String", "(", "string", "(", "r", ")", ")", "\n", "}" ]
11,377
all-11378
[ "this", "init", "function", "is", "deprecated", "but", "I", "m", "keeping", "it", "around", "just", "in", "case", "it", "proves", "useful", "in", "the", "future", "." ]
[ "func", "deprecated_init", "(", ")", "{", "// if piping from stdin we can just exit", "// and use the default Stdin value", "stat", ",", "_", ":=", "<mask>", ".", "Stdin", ".", "Stat", "(", ")", "\n", "if", "(", "stat", ".", "Mode", "(", ")", "&", "os", ".", "ModeCharDevice", ")", "==", "0", "{", "return", "\n", "}", "\n\n", "// check for params after the double dash", "// in the command string", "for", "i", ",", "argv", ":=", "range", "os", ".", "Args", "{", "if", "argv", "==", "\"", "\"", "{", "arg", ":=", "os", ".", "Args", "[", "i", "+", "1", "]", "\n", "buf", ":=", "bytes", ".", "NewBufferString", "(", "arg", ")", "\n", "Stdin", "=", "NewParamSet", "(", "buf", ")", "\n", "return", "\n", "}", "\n", "}", "\n\n", "// else use the first variable in the list", "if", "len", "(", "os", ".", "Args", ")", ">", "1", "{", "buf", ":=", "bytes", ".", "NewBufferString", "(", "os", ".", "Args", "[", "1", "]", ")", "\n", "Stdin", "=", "NewParamSet", "(", "buf", ")", "\n", "}", "\n", "}" ]
11,378
all-11379
[ "KeyMissing", "returns", "a", "comparison", "operation", "that", "evaluates", "to", "true", "iff", "the", "given", "key", "does", "not", "exist", "." ]
[ "func", "KeyMissing", "(", "<mask>", "string", ")", "clientv3", ".", "Cmp", "{", "return", "clientv3", ".", "Compare", "(", "clientv3", ".", "Version", "(", "key", ")", ",", "\"", "\"", ",", "0", ")", "\n", "}" ]
11,379
all-11380
[ "GetThresholdWindowsOk", "returns", "a", "tuple", "with", "the", "ThresholdWindows", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "o", "*", "<mask>", ")", "GetThresholdWindowsOk", "(", ")", "(", "ThresholdWindows", ",", "bool", ")", "{", "if", "o", "==", "nil", "||", "o", ".", "ThresholdWindows", "==", "nil", "{", "return", "ThresholdWindows", "{", "}", ",", "false", "\n", "}", "\n", "return", "*", "o", ".", "ThresholdWindows", ",", "true", "\n", "}" ]
11,380
all-11381
[ "Prepend", "is", "a", "wrapper", "around", "gtk_list_box_prepend", "()", "." ]
[ "func", "(", "v", "*", "ListBox", ")", "Prepend", "(", "<mask>", "IWidget", ")", "{", "C", ".", "gtk_list_box_prepend", "(", "v", ".", "native", "(", ")", ",", "child", ".", "toWidget", "(", ")", ")", "\n", "}" ]
11,381
all-11382
[ "TextBufferNew", "()", "is", "a", "wrapper", "around", "gtk_text_buffer_new", "()", "." ]
[ "func", "TextBufferNew", "(", "<mask>", "*", "TextTagTable", ")", "(", "*", "TextBuffer", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_text_buffer_new", "(", "table", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "e", ":=", "wrapTextBuffer", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", "\n", "return", "e", ",", "nil", "\n", "}" ]
11,382
all-11383
[ "Do", "executes", "Browser", ".", "getHistogram", "against", "the", "provided", "context", ".", "returns", ":", "histogram", "-", "Histogram", "." ]
[ "func", "(", "p", "*", "GetHistogramParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "histogram", "*", "Histogram", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetHistogramReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetHistogram", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Histogram", ",", "nil", "\n", "}" ]
11,383
all-11384
[ "GetProwJob", "finds", "the", "corresponding", "Prowjob", "resource", "from", "the", "provided", "job", "name", "and", "build", "ID" ]
[ "func", "(", "ja", "*", "JobAgent", ")", "GetProwJob", "(", "job", ",", "id", "string", ")", "(", "prowapi", ".", "ProwJob", ",", "error", ")", "{", "if", "ja", "==", "nil", "{", "return", "prowapi", ".", "ProwJob", "{", "}", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "j", "prowapi", ".", "ProwJob", "\n", "ja", ".", "mut", ".", "Lock", "(", ")", "\n", "idMap", ",", "ok", ":=", "ja", ".", "jobsIDMap", "[", "job", "]", "\n", "if", "<mask>", "{", "j", ",", "ok", "=", "idMap", "[", "id", "]", "\n", "}", "\n", "ja", ".", "mut", ".", "Unlock", "(", ")", "\n", "if", "!", "ok", "{", "return", "prowapi", ".", "ProwJob", "{", "}", ",", "errProwjobNotFound", "\n", "}", "\n", "return", "j", ",", "nil", "\n", "}" ]
11,384
all-11385
[ "extractArgumentsType", "returns", "the", "name", "of", "the", "type", "of", "each", "input", "argument", "." ]
[ "func", "extractArgumentsType", "(", "f", "*", "ast", ".", "FuncDecl", ")", "(", "[", "]", "string", ",", "bool", ")", "{", "var", "fields", "[", "]", "*", "ast", ".", "Field", "\n", "if", "f", ".", "Recv", "!=", "nil", "{", "if", "len", "(", "f", ".", "Recv", ".", "List", ")", "!=", "1", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "// If it is an object receiver (vs a pointer receiver), its address is not", "// printed in the stack trace so it needs to be ignored.", "if", "_", ",", "ok", ":=", "f", ".", "Recv", ".", "List", "[", "0", "]", ".", "Type", ".", "(", "*", "ast", ".", "StarExpr", ")", ";", "ok", "{", "fields", "=", "append", "(", "fields", ",", "f", ".", "Recv", ".", "List", "[", "0", "]", ")", "\n", "}", "\n", "}", "\n", "var", "types", "[", "]", "string", "\n", "extra", ":=", "false", "\n", "for", "_", ",", "arg", ":=", "range", "<mask>", "(", "fields", ",", "f", ".", "Type", ".", "Params", ".", "List", "...", ")", "{", "// Assert that extra is only set on the last item of fields?", "var", "t", "string", "\n", "t", ",", "extra", "=", "fieldToType", "(", "arg", ")", "\n", "mult", ":=", "len", "(", "arg", ".", "Names", ")", "\n", "if", "mult", "==", "0", "{", "mult", "=", "1", "\n", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "mult", ";", "i", "++", "{", "types", "=", "append", "(", "types", ",", "t", ")", "\n", "}", "\n", "}", "\n", "return", "types", ",", "extra", "\n", "}" ]
11,385
all-11386
[ "Help", "returns", "the", "metric", "name", "and", "help", "text", "in", "the", "current", "entry", ".", "Must", "only", "be", "called", "after", "Next", "returned", "a", "help", "entry", ".", "The", "returned", "byte", "slices", "become", "invalid", "after", "the", "next", "call", "to", "Next", "." ]
[ "func", "(", "p", "*", "OpenMetricsParser", ")", "Help", "(", ")", "(", "[", "]", "byte", ",", "[", "]", "byte", ")", "{", "m", ":=", "p", ".", "l", ".", "b", "[", "p", ".", "offsets", "[", "0", "]", ":", "p", ".", "offsets", "[", "1", "]", "]", "\n\n", "// Replacer causes allocations. Replace only when necessary.", "if", "strings", ".", "IndexByte", "(", "yoloString", "(", "p", ".", "text", ")", ",", "byte", "(", "'\\\\'", ")", ")", ">=", "0", "{", "// OpenMetrics always uses the Prometheus format label value escaping.", "return", "m", ",", "[", "]", "byte", "(", "lvalReplacer", ".", "Replace", "(", "string", "(", "p", ".", "<mask>", ")", ")", ")", "\n", "}", "\n", "return", "m", ",", "p", ".", "text", "\n", "}" ]
11,386
all-11387
[ "MustParse", "is", "the", "panicking", "version", "of", "Parse" ]
[ "func", "MustParse", "(", "v", "string", ")", "xdr", ".", "Int64", "{", "<mask>", ",", "err", ":=", "Parse", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "ret", "\n", "}" ]
11,387
all-11388
[ "Packages", "creates", "an", "SSA", "program", "for", "a", "set", "of", "packages", "loaded", "from", "source", "syntax", "using", "the", "golang", ".", "org", "/", "x", "/", "tools", "/", "go", "/", "packages", ".", "Load", "function", ".", "It", "creates", "and", "returns", "an", "SSA", "package", "for", "each", "well", "-", "typed", "package", "in", "the", "initial", "list", ".", "The", "resulting", "list", "of", "packages", "has", "the", "same", "length", "as", "initial", "and", "contains", "a", "nil", "if", "SSA", "could", "not", "be", "constructed", "for", "the", "corresponding", "initial", "package", ".", "Code", "for", "bodies", "of", "functions", "is", "not", "built", "until", "Build", "is", "called", "on", "the", "resulting", "Program", ".", "The", "mode", "parameter", "controls", "diagnostics", "and", "checking", "during", "SSA", "construction", "." ]
[ "func", "Packages", "(", "initial", "[", "]", "*", "packages", ".", "Package", ",", "mode", "ssa", ".", "BuilderMode", ")", "(", "*", "ssa", ".", "Program", ",", "[", "]", "*", "ssa", ".", "Package", ")", "{", "var", "fset", "*", "token", ".", "FileSet", "\n", "if", "len", "(", "initial", ")", ">", "0", "{", "fset", "=", "initial", "[", "0", "]", ".", "Fset", "\n", "}", "\n\n", "prog", ":=", "ssa", ".", "NewProgram", "(", "fset", ",", "mode", ")", "\n", "seen", ":=", "make", "(", "map", "[", "*", "packages", ".", "Package", "]", "*", "ssa", ".", "Package", ")", "\n", "var", "create", "func", "(", "p", "*", "packages", ".", "Package", ")", "*", "ssa", ".", "Package", "\n", "create", "=", "func", "(", "p", "*", "packages", ".", "Package", ")", "*", "ssa", ".", "Package", "{", "ssapkg", ",", "ok", ":=", "seen", "[", "p", "]", "\n", "if", "!", "ok", "{", "if", "p", ".", "Types", "==", "nil", "||", "p", ".", "IllTyped", "{", "// not well typed", "seen", "[", "p", "]", "=", "nil", "\n", "return", "nil", "\n", "}", "\n\n", "ssapkg", "=", "prog", ".", "CreatePackage", "(", "p", ".", "Types", ",", "p", ".", "Syntax", ",", "p", ".", "TypesInfo", ",", "true", ")", "\n", "seen", "[", "p", "]", "=", "ssapkg", "\n\n", "for", "_", ",", "imp", ":=", "range", "p", ".", "Imports", "{", "create", "(", "imp", ")", "\n", "}", "\n", "}", "\n", "return", "ssapkg", "\n", "}", "\n\n", "var", "ssapkgs", "[", "]", "*", "ssa", ".", "Package", "\n", "for", "_", ",", "p", ":=", "range", "initial", "{", "ssapkgs", "=", "append", "(", "ssapkgs", ",", "<mask>", "(", "p", ")", ")", "\n", "}", "\n", "return", "prog", ",", "ssapkgs", "\n", "}" ]
11,388
all-11389
[ "MoveColumnAfter", "is", "a", "wrapper", "around", "gtk_tree_view_move_column_after", "()", "." ]
[ "func", "(", "v", "*", "TreeView", ")", "MoveColumnAfter", "(", "column", "*", "TreeViewColumn", ",", "baseColumn", "*", "TreeViewColumn", ")", "{", "C", ".", "gtk_tree_view_move_column_after", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "native", "(", ")", ",", "baseColumn", ".", "native", "(", ")", ")", "\n", "}" ]
11,389
all-11390
[ "NewDiscovery", "returns", "a", "new", "discovery", "along", "Zookeeper", "parses", "with", "the", "given", "parse", "function", "." ]
[ "func", "NewDiscovery", "(", "srvs", "[", "]", "string", ",", "timeout", "time", ".", "Duration", ",", "paths", "[", "]", "string", ",", "logger", "log", ".", "Logger", ",", "pf", "func", "(", "data", "[", "]", "byte", ",", "path", "string", ")", "(", "model", ".", "LabelSet", ",", "error", ")", ",", ")", "(", "*", "Discovery", ",", "error", ")", "{", "if", "logger", "==", "nil", "{", "logger", "=", "<mask>", ".", "NewNopLogger", "(", ")", "\n", "}", "\n\n", "conn", ",", "_", ",", "err", ":=", "zk", ".", "Connect", "(", "srvs", ",", "timeout", ",", "func", "(", "c", "*", "zk", ".", "Conn", ")", "{", "c", ".", "SetLogger", "(", "treecache", ".", "NewZookeeperLogger", "(", "logger", ")", ")", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "updates", ":=", "make", "(", "chan", "treecache", ".", "ZookeeperTreeCacheEvent", ")", "\n", "sd", ":=", "&", "Discovery", "{", "conn", ":", "conn", ",", "updates", ":", "updates", ",", "sources", ":", "map", "[", "string", "]", "*", "targetgroup", ".", "Group", "{", "}", ",", "parse", ":", "pf", ",", "logger", ":", "logger", ",", "}", "\n", "for", "_", ",", "path", ":=", "range", "paths", "{", "sd", ".", "treeCaches", "=", "append", "(", "sd", ".", "treeCaches", ",", "treecache", ".", "NewZookeeperTreeCache", "(", "conn", ",", "path", ",", "updates", ",", "logger", ")", ")", "\n", "}", "\n", "return", "sd", ",", "nil", "\n", "}" ]
11,390
all-11391
[ "getVersions", "returns", "the", "versions", "of", "the", "members", "in", "the", "given", "cluster", ".", "The", "key", "of", "the", "returned", "map", "is", "the", "member", "s", "ID", ".", "The", "value", "of", "the", "returned", "map", "is", "the", "semver", "versions", "string", "including", "server", "and", "cluster", ".", "If", "it", "fails", "to", "get", "the", "version", "of", "a", "member", "the", "key", "will", "be", "nil", "." ]
[ "func", "getVersions", "(", "lg", "*", "zap", ".", "Logger", ",", "cl", "*", "membership", ".", "RaftCluster", ",", "local", "types", ".", "ID", ",", "rt", "http", ".", "RoundTripper", ")", "map", "[", "string", "]", "*", "version", ".", "Versions", "{", "members", ":=", "cl", ".", "Members", "(", ")", "\n", "vers", ":=", "make", "(", "map", "[", "string", "]", "*", "version", ".", "Versions", ")", "\n", "for", "_", ",", "m", ":=", "range", "members", "{", "if", "m", ".", "ID", "==", "local", "{", "cv", ":=", "\"", "\"", "\n", "if", "cl", ".", "Version", "(", ")", "!=", "nil", "{", "cv", "=", "cl", ".", "Version", "(", ")", ".", "String", "(", ")", "\n", "}", "\n", "vers", "[", "m", ".", "ID", ".", "String", "(", ")", "]", "=", "&", "version", ".", "Versions", "{", "Server", ":", "version", ".", "Version", ",", "Cluster", ":", "cv", "}", "\n", "continue", "\n", "}", "\n", "ver", ",", "err", ":=", "getVersion", "(", "lg", ",", "m", ",", "rt", ")", "\n", "if", "err", "!=", "nil", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "m", ".", "ID", ".", "String", "(", ")", ")", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Warningf", "(", "\"", "\"", ",", "m", ".", "ID", ",", "err", ")", "\n", "}", "\n", "vers", "[", "m", ".", "ID", ".", "String", "(", ")", "]", "=", "nil", "\n", "}", "else", "{", "vers", "[", "m", ".", "ID", ".", "String", "(", ")", "]", "=", "<mask>", "\n", "}", "\n", "}", "\n", "return", "vers", "\n", "}" ]
11,391
all-11392
[ "/", "*", "NewTableView", "creates", "a", "new", "frame", ".", "view", "-", "is", "a", "View", "that", "manages", "the", "control", "parent", "-", "is", "container", "that", "keeps", "the", "control", ".", "The", "same", "View", "can", "be", "a", "view", "and", "a", "parent", "at", "the", "same", "time", ".", "width", "and", "height", "-", "are", "minimal", "size", "of", "the", "control", ".", "scale", "-", "the", "way", "of", "scaling", "the", "control", "when", "the", "parent", "is", "resized", ".", "Use", "DoNotScale", "constant", "if", "the", "control", "should", "keep", "its", "original", "size", "." ]
[ "func", "CreateTableView", "(", "parent", "Control", ",", "width", ",", "height", "int", ",", "scale", "int", ")", "*", "TableView", "{", "l", ":=", "new", "(", "TableView", ")", "\n", "l", ".", "BaseControl", "=", "NewBaseControl", "(", ")", "\n\n", "if", "height", "==", "AutoSize", "{", "height", "=", "3", "\n", "}", "\n", "if", "<mask>", "==", "AutoSize", "{", "width", "=", "10", "\n", "}", "\n\n", "l", ".", "SetSize", "(", "width", ",", "height", ")", "\n", "l", ".", "SetConstraints", "(", "width", ",", "height", ")", "\n", "l", ".", "selectedCol", "=", "0", "\n", "l", ".", "selectedRow", "=", "0", "\n", "l", ".", "parent", "=", "parent", "\n", "l", ".", "columns", "=", "make", "(", "[", "]", "Column", ",", "0", ")", "\n", "l", ".", "SetScale", "(", "scale", ")", "\n\n", "l", ".", "SetTabStop", "(", "true", ")", "\n\n", "l", ".", "onDrawCell", "=", "nil", "\n", "l", ".", "onAction", "=", "nil", "\n", "l", ".", "onKeyPress", "=", "nil", "\n", "l", ".", "onSelectCell", "=", "nil", "\n", "l", ".", "lastEventCol", "=", "-", "1", "\n", "l", ".", "lastEventRow", "=", "-", "1", "\n\n", "if", "parent", "!=", "nil", "{", "parent", ".", "AddChild", "(", "l", ")", "\n", "}", "\n\n", "return", "l", "\n", "}" ]
11,392
all-11393
[ "CreateIntegrationAWS", "adds", "a", "new", "AWS", "Account", "in", "the", "AWS", "Integrations", ".", "Use", "this", "if", "you", "want", "to", "setup", "the", "integration", "for", "the", "first", "time", "or", "to", "add", "more", "accounts", "." ]
[ "func", "(", "client", "*", "Client", ")", "CreateIntegrationAWS", "(", "awsAccount", "*", "IntegrationAWSAccount", ")", "(", "*", "IntegrationAWSAccountCreateResponse", ",", "error", ")", "{", "<mask>", "out", "IntegrationAWSAccountCreateResponse", "\n", "if", "err", ":=", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "awsAccount", ",", "&", "out", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "out", ",", "nil", "\n", "}" ]
11,393
all-11394
[ "QueryFloat64", "returns", "query", "result", "in", "float64", "type", "." ]
[ "func", "(", "ctx", "*", "<mask>", ")", "QueryFloat64", "(", "name", "string", ")", "float64", "{", "v", ",", "_", ":=", "strconv", ".", "ParseFloat", "(", "ctx", ".", "Query", "(", "name", ")", ",", "64", ")", "\n", "return", "v", "\n", "}" ]
11,394
all-11395
[ "GetCursorVisible", "is", "a", "wrapper", "around", "gtk_text_view_get_cursor_visible", "()", "." ]
[ "func", "(", "v", "*", "TextView", ")", "GetCursorVisible", "(", ")", "bool", "{", "c", ":=", "C", ".", "gtk_text_view_get_cursor_visible", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
11,395
all-11396
[ "expandSrcDir", "expands", "any", "occurrence", "of", "$", "{", "SRCDIR", "}", "making", "sure", "the", "result", "is", "safe", "for", "the", "shell", ".", "Copied", "from", "go", "/", "build", ".", "expandSrcDir" ]
[ "func", "expandSrcDir", "(", "str", "string", ",", "srcdir", "string", ")", "(", "string", ",", "bool", ")", "{", "// \"\\\" delimited paths cause safeCgoName to fail", "// so convert native paths with a different delimiter", "// to \"/\" before starting (eg: on windows).", "srcdir", "=", "filepath", ".", "ToSlash", "(", "srcdir", ")", "\n", "if", "srcdir", "==", "\"", "\"", "{", "srcdir", "=", "\"", "\"", "\n", "}", "\n\n", "// Spaces are tolerated in ${SRCDIR}, but not anywhere else.", "chunks", ":=", "strings", ".", "Split", "(", "str", ",", "\"", "\"", ")", "\n", "if", "len", "(", "chunks", ")", "<", "2", "{", "return", "str", ",", "safeCgoName", "(", "str", ",", "false", ")", "\n", "}", "\n", "ok", ":=", "true", "\n", "for", "_", ",", "chunk", ":=", "range", "chunks", "{", "ok", "=", "ok", "&&", "(", "chunk", "==", "\"", "\"", "||", "safeCgoName", "(", "chunk", ",", "false", ")", ")", "\n", "}", "\n", "ok", "=", "<mask>", "&&", "(", "srcdir", "==", "\"", "\"", "||", "safeCgoName", "(", "srcdir", ",", "true", ")", ")", "\n", "res", ":=", "strings", ".", "Join", "(", "chunks", ",", "srcdir", ")", "\n", "return", "res", ",", "ok", "&&", "res", "!=", "\"", "\"", "\n", "}" ]
11,396
all-11397
[ "Encode", "expects", "a", "slice", "of", "length", "at", "least", "v", ".", "EncodedSize", "()", "." ]
[ "func", "(", "v", "*", "ValueStruct", ")", "Encode", "(", "b", "[", "]", "byte", ")", "{", "b", "[", "0", "]", "=", "v", ".", "Meta", "\n", "b", "[", "1", "]", "=", "v", ".", "UserMeta", "\n", "sz", ":=", "binary", ".", "PutUvarint", "(", "b", "[", "2", ":", "]", ",", "v", ".", "ExpiresAt", ")", "\n", "<mask>", "(", "b", "[", "2", "+", "sz", ":", "]", ",", "v", ".", "Value", ")", "\n", "}" ]
11,397
all-11398
[ "unquote", "the", "input", ".", "If", "possible", "the", "unquoted", "value", "points", "to", "the", "same", "backing", "array", "as", "input", ".", "Otherwise", "it", "points", "to", "buf", ".", "The", "remainder", "is", "the", "unused", "portion", "of", "buf", "." ]
[ "func", "unquote", "(", "<mask>", "[", "]", "byte", ",", "buf", "[", "]", "byte", ")", "(", "unquoted", "[", "]", "byte", ",", "remainder", "[", "]", "byte", ")", "{", "var", "(", "errorIndicator", "=", "[", "]", "byte", "(", "\"", "\"", ")", "\n", ")", "\n", "if", "len", "(", "input", ")", "<", "2", "{", "return", "errorIndicator", ",", "buf", "\n\n", "}", "\n", "quote", ":=", "input", "[", "0", "]", "\n", "input", "=", "input", "[", "1", ":", "]", "\n", "if", "input", "[", "len", "(", "input", ")", "-", "1", "]", "==", "quote", "{", "input", "=", "input", "[", ":", "len", "(", "input", ")", "-", "1", "]", "\n", "}", "\n", "index", ":=", "bytes", ".", "IndexRune", "(", "input", ",", "'\\\\'", ")", "\n", "if", "index", "<", "0", "{", "// input does not contain any escaped chars", "remainder", "=", "buf", "\n", "unquoted", "=", "input", "\n", "return", "unquoted", ",", "remainder", "\n", "}", "\n", "if", "len", "(", "buf", ")", ">", "0", "{", "unquoted", "=", "buf", "[", ":", "0", "]", "\n", "}", "\n", "strinput", ":=", "toString", "(", "input", ")", "\n", "for", "len", "(", "strinput", ")", ">", "0", "{", "r", ",", "mb", ",", "tail", ",", "err", ":=", "strconv", ".", "UnquoteChar", "(", "strinput", ",", "quote", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errorIndicator", ",", "buf", "\n", "}", "\n", "strinput", "=", "tail", "\n", "if", "mb", "{", "// ensure that there is enough room for the multibyte char", "runeLen", ":=", "utf8", ".", "RuneLen", "(", "r", ")", "\n", "unquotedLen", ":=", "len", "(", "unquoted", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "runeLen", ";", "i", "++", "{", "unquoted", "=", "append", "(", "unquoted", ",", "0", ")", "\n", "}", "\n", "utf8", ".", "EncodeRune", "(", "unquoted", "[", "unquotedLen", ":", "]", ",", "r", ")", "\n", "}", "else", "{", "unquoted", "=", "append", "(", "unquoted", ",", "byte", "(", "r", ")", ")", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "buf", ")", "<", "len", "(", "unquoted", ")", "{", "// used buf up and resorted to memory allocation", "remainder", "=", "nil", "\n", "}", "else", "{", "remainder", "=", "buf", "[", "len", "(", "unquoted", ")", ":", "]", "\n", "}", "\n\n", "return", "unquoted", ",", "remainder", "\n", "}" ]
11,398
all-11399
[ "Subscribe", "adds", "a", "subscription", "to", "job", "result", "notifications", "for", "given", "keys", ".", "Each", "subscription", "key", "can", "be", "be", "a", "job", "type", "or", "a", "job", "related", "id", ".", "SubID", "is", "used", "to", "distinguish", "between", "different", "subscriptions", "." ]
[ "func", "(", "q", "*", "<mask>", ")", "Subscribe", "(", "subKeys", "[", "]", "string", ",", "subID", "string", ",", "subFunc", "SubFunc", ")", "error", "{", "q", ".", "subsMtx", ".", "Lock", "(", ")", "\n", "defer", "q", ".", "subsMtx", ".", "Unlock", "(", ")", "\n\n", "for", "i", ",", "v", ":=", "range", "subKeys", "{", "if", "err", ":=", "q", ".", "subscribe", "(", "v", ",", "subID", ",", "subFunc", ")", ";", "err", "!=", "nil", "{", "for", "j", ":=", "0", ";", "j", "<", "i", ";", "j", "++", "{", "q", ".", "unsubscribe", "(", "subKeys", "[", "j", "]", ",", "subID", ")", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
11,399
all-11400
[ "Register", "allows", "user", "to", "add", "his", "own", "data", "generators", "for", "special", "cases", "that", "we", "could", "not", "cover", "with", "the", "generators", "that", "fako", "includes", "by", "default", "." ]
[ "func", "Register", "(", "identifier", "<mask>", ",", "generator", "func", "(", ")", "string", ")", "{", "fakeType", ":=", "inflect", ".", "Camelize", "(", "identifier", ")", "\n", "customGenerators", "[", "fakeType", "]", "=", "generator", "\n", "}" ]