id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
5,000
all-5001
[ "StartTime", "implements", "the", "Storage", "interface", "." ]
[ "func", "(", "a", "adapter", ")", "StartTime", "(", ")", "(", "int64", ",", "error", ")", "{", "var", "startTime", "int64", "\n\n", "if", "len", "(", "a", ".", "db", ".", "Blocks", "(", ")", ")", ">", "0", "{", "startTime", "=", "a", ".", "<mask>", ".", "Blocks", "(", ")", "[", "0", "]", ".", "Meta", "(", ")", ".", "MinTime", "\n", "}", "else", "{", "startTime", "=", "time", ".", "Now", "(", ")", ".", "Unix", "(", ")", "*", "1000", "\n", "}", "\n\n", "// Add a safety margin as it may take a few minutes for everything to spin up.", "return", "startTime", "+", "a", ".", "startTimeMargin", ",", "nil", "\n", "}" ]
5,001
all-5002
[ "succContext", "returns", "a", "context", "given", "a", "state", ".", "succ", "index" ]
[ "func", "(", "a", "*", "subAllocator", ")", "succContext", "(", "i", "int32", ")", "*", "<mask>", "{", "if", "i", "<=", "0", "{", "return", "nil", "\n", "}", "\n", "return", "&", "context", "{", "i", ":", "i", ",", "s", ":", "a", ".", "states", "[", "i", ":", "i", "+", "2", ":", "i", "+", "2", "]", ",", "a", ":", "a", "}", "\n", "}" ]
5,002
all-5003
[ "GetEthTransactions", "returns", "transactions", "by", "related", "object", "." ]
[ "func", "(", "h", "*", "Handler", ")", "GetEthTransactions", "(", "tkn", ",", "relType", ",", "relID", "string", ",", "offset", ",", "limit", "uint", ")", "(", "*", "GetEthTransactionsResult", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "relType", ",", "\"", "\"", ",", "relID", ",", "\"", "\"", ",", "limit", ",", "\"", "\"", ",", "offset", ")", "\n\n", "if", "!", "h", ".", "token", ".", "Check", "(", "tkn", ")", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrAccessDenied", "\n", "}", "\n\n", "conds", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "args", ":=", "<mask>", "(", "[", "]", "interface", "{", "}", ",", "0", ")", "\n", "// If the relType is `accountAggregated`, then gets an Ethereum", "// address of the account and find all transactions where this address", "// is the sender.", "if", "relType", "==", "AccountAggregatedType", "{", "var", "acc", "data", ".", "Account", "\n", "if", "err", ":=", "h", ".", "findByPrimaryKey", "(", "logger", ",", "ErrAccountNotFound", ",", "&", "acc", ",", "relID", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "args", "=", "append", "(", "args", ",", "acc", ".", "EthAddr", ")", "\n", "conds", "=", "append", "(", "conds", ",", "\"", "\"", "+", "h", ".", "db", ".", "Placeholder", "(", "len", "(", "args", ")", ")", ")", "\n", "}", "else", "if", "relType", "!=", "\"", "\"", "{", "args", "=", "append", "(", "args", ",", "relType", ")", "\n", "conds", "=", "append", "(", "conds", ",", "\"", "\"", "+", "h", ".", "db", ".", "Placeholder", "(", "len", "(", "args", ")", ")", ")", "\n", "}", "\n", "if", "relID", "!=", "\"", "\"", "&&", "relType", "!=", "AccountAggregatedType", "{", "args", "=", "append", "(", "args", ",", "relID", ")", "\n", "conds", "=", "append", "(", "conds", ",", "\"", "\"", "+", "h", ".", "db", ".", "Placeholder", "(", "len", "(", "args", ")", ")", ")", "\n", "}", "\n\n", "tail", ":=", "\"", "\"", "\n", "if", "len", "(", "conds", ")", ">", "0", "{", "tail", "=", "\"", "\"", "+", "strings", ".", "Join", "(", "conds", ",", "\"", "\"", ")", "\n", "}", "\n\n", "count", ",", "err", ":=", "h", ".", "numberOfObjects", "(", "logger", ",", "data", ".", "EthTxTable", ".", "Name", "(", ")", ",", "tail", ",", "args", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "offsetLimit", ":=", "h", ".", "offsetLimit", "(", "offset", ",", "limit", ")", "\n\n", "sorting", ":=", "`ORDER BY issued DESC`", "\n\n", "tail", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "tail", ",", "sorting", ",", "offsetLimit", ")", "\n\n", "txs", ",", "err", ":=", "h", ".", "selectAllFrom", "(", "logger", ",", "data", ".", "EthTxTable", ",", "tail", ",", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "ret", ":=", "make", "(", "[", "]", "data", ".", "EthTx", ",", "len", "(", "txs", ")", ")", "\n\n", "for", "i", ",", "v", ":=", "range", "txs", "{", "ret", "[", "i", "]", "=", "*", "v", ".", "(", "*", "data", ".", "EthTx", ")", "\n", "}", "\n", "return", "&", "GetEthTransactionsResult", "{", "ret", ",", "count", "}", ",", "nil", "\n", "}" ]
5,003
all-5004
[ "NewGitHubDeferredChangedFilesProvider", "uses", "a", "closure", "to", "lazily", "retrieve", "the", "file", "changes", "only", "if", "they", "are", "needed", ".", "We", "only", "have", "to", "fetch", "the", "changes", "if", "there", "is", "at", "least", "one", "RunIfChanged", "job", "that", "is", "not", "being", "force", "run", "(", "due", "to", "a", "/", "retest", "after", "a", "failure", "or", "because", "it", "is", "explicitly", "triggered", "with", "/", "test", "foo", ")", "." ]
[ "func", "NewGitHubDeferredChangedFilesProvider", "(", "client", "githubClient", ",", "org", ",", "repo", "string", ",", "num", "int", ")", "ChangedFilesProvider", "{", "<mask>", "changedFiles", "[", "]", "string", "\n", "return", "func", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "// Fetch the changed files from github at most once.", "if", "changedFiles", "==", "nil", "{", "changes", ",", "err", ":=", "client", ".", "GetPullRequestChanges", "(", "org", ",", "repo", ",", "num", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "for", "_", ",", "change", ":=", "range", "changes", "{", "changedFiles", "=", "append", "(", "changedFiles", ",", "change", ".", "Filename", ")", "\n", "}", "\n", "}", "\n", "return", "changedFiles", ",", "nil", "\n", "}", "\n", "}" ]
5,004
all-5005
[ "PathIsSelected", "is", "a", "wrapper", "around", "gtk_icon_view_path_is_selected", "()", "." ]
[ "func", "(", "v", "*", "IconView", ")", "PathIsSelected", "(", "<mask>", "*", "TreePath", ")", "bool", "{", "return", "gobool", "(", "C", ".", "gtk_icon_view_path_is_selected", "(", "v", ".", "native", "(", ")", ",", "path", ".", "native", "(", ")", ")", ")", "\n", "}" ]
5,005
all-5006
[ "GetTokenGenerator", "returns", "a", "function", "that", "gets", "the", "value", "of", "a", "given", "secret", "." ]
[ "func", "(", "a", "*", "<mask>", ")", "GetTokenGenerator", "(", "secretPath", "string", ")", "func", "(", ")", "[", "]", "byte", "{", "return", "func", "(", ")", "[", "]", "byte", "{", "return", "a", ".", "GetSecret", "(", "secretPath", ")", "\n", "}", "\n", "}" ]
5,006
all-5007
[ "RegisterPath", "register", "view", "paths" ]
[ "func", "(", "fs", "*", "AssetFileSystem", ")", "RegisterPath", "(", "pth", "string", ")", "error", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "pth", ")", ";", "!", "os", ".", "IsNotExist", "(", "err", ")", "{", "<mask>", "existing", "bool", "\n", "for", "_", ",", "p", ":=", "range", "fs", ".", "paths", "{", "if", "p", "==", "pth", "{", "existing", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "!", "existing", "{", "fs", ".", "paths", "=", "append", "(", "fs", ".", "paths", ",", "pth", ")", "\n", "}", "\n", "return", "nil", "\n", "}", "\n", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}" ]
5,007
all-5008
[ "AppendUnique", "creates", "and", "adds", "another", "range", "of", "values", "to", "the", "total", "range", "list", ".", "Only", "unique", "values", "from", "the", "given", "range", "are", "appended", "to", "the", "total", "range", "." ]
[ "func", "(", "l", "*", "InclusiveRanges", ")", "AppendUnique", "(", "start", ",", "end", ",", "step", "int", ")", "{", "if", "step", "==", "0", "{", "return", "\n", "}", "\n\n", "subStart", ":=", "start", "\n", "subEnd", ":=", "start", "\n", "subStep", ":=", "step", "\n", "last", ":=", "start", "\n", "pending", ":=", "0", "// Track unique value count", "\n\n", "// Handle loop test for both increasing", "// and decreasing ranges", "var", "pred", "func", "(", ")", "bool", "\n", "if", "start", "<=", "end", "{", "if", "step", "<", "0", "{", "step", "*=", "-", "1", "\n", "}", "\n", "pred", "=", "func", "(", ")", "bool", "{", "return", "subEnd", "<=", "end", "}", "\n", "}", "else", "{", "if", "step", ">", "0", "{", "step", "*=", "-", "1", "\n", "}", "\n", "pred", "=", "func", "(", ")", "bool", "{", "return", "subEnd", ">=", "end", "}", "\n", "}", "\n\n", "// Short-circuit if this is the first range being added", "if", "len", "(", "l", ".", "blocks", ")", "==", "0", "{", "l", ".", "Append", "(", "start", ",", "<mask>", ",", "step", ")", "\n", "return", "\n", "}", "\n\n", "// TODO: More intelligent fast-paths for easy-to-identify", "// overlapping ranges. Such as when the existing range is:", "// 1-100x1 and we are appending 50-150x1. Should be easy", "// enough to just know we can Append(101,150,1)", "for", ";", "pred", "(", ")", ";", "subEnd", "+=", "step", "{", "if", "!", "l", ".", "Contains", "(", "subEnd", ")", "{", "// Is a unique value in the range", "last", "=", "subEnd", "\n", "if", "pending", "==", "0", "{", "subStart", "=", "last", "\n", "}", "\n", "pending", "++", "\n", "continue", "\n", "}", "\n\n", "if", "pending", "==", "0", "{", "// Nothing to add yet", "continue", "\n", "}", "\n\n", "// Current value is already in range.", "// Add previous values", "l", ".", "Append", "(", "subStart", ",", "last", ",", "subStep", ")", "\n", "subStart", "=", "subEnd", "+", "step", "\n", "pending", "=", "0", "\n", "}", "\n\n", "// Flush the remaining values", "if", "pending", ">", "0", "{", "l", ".", "Append", "(", "subStart", ",", "last", ",", "subStep", ")", "\n", "}", "\n", "}" ]
5,008
all-5009
[ "makeUnicastRouteStatusSlice", "takes", "a", "snapshot", "of", "the", "unicast", "routes", "in", "routes", "." ]
[ "func", "makeUnicastRouteStatusSlice", "(", "r", "*", "routes", ")", "[", "]", "unicastRouteStatus", "{", "r", ".", "RLock", "(", ")", "\n", "defer", "r", ".", "RUnlock", "(", ")", "\n\n", "var", "<mask>", "[", "]", "unicastRouteStatus", "\n", "for", "dest", ",", "via", ":=", "range", "r", ".", "unicast", "{", "slice", "=", "append", "(", "slice", ",", "unicastRouteStatus", "{", "dest", ".", "String", "(", ")", ",", "via", ".", "String", "(", ")", "}", ")", "\n", "}", "\n", "return", "slice", "\n", "}" ]
5,009
all-5010
[ "UpdateMetricCluster", "updates", "passed", "metric", "cluster", "." ]
[ "func", "(", "a", "*", "API", ")", "UpdateMetricCluster", "(", "cfg", "*", "MetricCluster", ")", "(", "*", "MetricCluster", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "clusterCID", ":=", "string", "(", "cfg", ".", "CID", ")", "\n\n", "<mask>", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "MetricClusterCIDRegex", ",", "clusterCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "clusterCID", ")", "\n", "}", "\n\n", "jsonCfg", ",", "err", ":=", "json", ".", "Marshal", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "jsonCfg", ")", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Put", "(", "clusterCID", ",", "jsonCfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "cluster", ":=", "&", "MetricCluster", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "cluster", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "cluster", ",", "nil", "\n", "}" ]
5,010
all-5011
[ "MarshalText", "turns", "this", "instance", "into", "text" ]
[ "func", "(", "id", "*", "ObjectId", ")", "MarshalText", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "[", "]", "byte", "(", "bson", ".", "ObjectId", "(", "*", "<mask>", ")", ".", "Hex", "(", ")", ")", ",", "nil", "\n", "}" ]
5,011
all-5012
[ "MustPeers", "retrieves", "the", "Peers", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "StellarMessage", ")", "MustPeers", "(", ")", "[", "]", "PeerAddress", "{", "val", ",", "<mask>", ":=", "u", ".", "GetPeers", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
5,012
all-5013
[ "ChangeActionState", "is", "a", "wrapper", "around", "g_action_group_change_action_state" ]
[ "func", "(", "v", "*", "ActionGroup", ")", "ChangeActionState", "(", "actionName", "string", ",", "value", "*", "Variant", ")", "{", "C", ".", "g_action_group_change_action_state", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "actionName", ")", ")", ",", "<mask>", ".", "native", "(", ")", ")", "\n", "}" ]
5,013
all-5014
[ "WithStrictSignatureVerification", "is", "an", "option", "to", "enable", "or", "disable", "strict", "message", "signing", ".", "When", "enabled", "(", "which", "is", "the", "default", ")", "unsigned", "messages", "will", "be", "discarded", "." ]
[ "func", "WithStrictSignatureVerification", "(", "<mask>", "bool", ")", "Option", "{", "return", "func", "(", "p", "*", "PubSub", ")", "error", "{", "p", ".", "signStrict", "=", "required", "\n", "return", "nil", "\n", "}", "\n", "}" ]
5,014
all-5015
[ "Start", "creates", "a", "goroutine", "to", "handle", "the", "logging", "IO", "." ]
[ "func", "(", "al", "*", "LoggingHandler", ")", "Start", "(", ")", "{", "<mask>", "func", "(", ")", "{", "for", "s", ":=", "range", "al", ".", "buffer", "{", "fmt", ".", "Fprint", "(", "al", ".", "w", ",", "s", ")", "\n", "}", "\n", "close", "(", "al", ".", "quit", ")", "\n", "}", "(", ")", "\n", "}" ]
5,015
all-5016
[ "HasLabel", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetAxis", ")", "HasLabel", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
5,016
all-5017
[ "NewAuth", "returns", "an", "auth" ]
[ "func", "NewAuth", "(", "opts", "...", "Options", ")", "*", "Auth", "{", "o", ":=", "<mask>", "{", "}", "\n", "if", "len", "(", "opts", ")", "!=", "0", "{", "o", "=", "opts", "[", "0", "]", "\n", "}", "\n\n", "h", ":=", "defaultAuthErrorHandler", "\n", "if", "o", ".", "AuthErrorHandler", "!=", "nil", "{", "h", "=", "o", ".", "AuthErrorHandler", "\n", "}", "\n\n", "return", "&", "Auth", "{", "opt", ":", "o", ",", "authErrHandler", ":", "http", ".", "HandlerFunc", "(", "h", ")", ",", "}", "\n", "}" ]
5,017
all-5018
[ "ReorderChild", "()", "is", "a", "wrapper", "around", "gtk_menu_reorder_child", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "ReorderChild", "(", "child", "IWidget", ",", "position", "int", ")", "{", "C", ".", "gtk_menu_reorder_child", "(", "v", ".", "native", "(", ")", ",", "child", ".", "toWidget", "(", ")", ",", "C", ".", "gint", "(", "position", ")", ")", "\n", "}" ]
5,018
all-5019
[ "GetApmQueryOk", "returns", "a", "tuple", "with", "the", "ApmQuery", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "ScatterplotRequest", ")", "GetApmQueryOk", "(", ")", "(", "WidgetApmOrLogQuery", ",", "bool", ")", "{", "if", "s", "==", "nil", "||", "s", ".", "ApmQuery", "==", "nil", "{", "return", "WidgetApmOrLogQuery", "{", "}", ",", "false", "\n", "}", "\n", "return", "*", "s", ".", "ApmQuery", ",", "<mask>", "\n", "}" ]
5,019
all-5020
[ "parseDockerContainerMetadata", "parses", "the", "metadata", "in", "a", "docker", "container", "and", "packages", "this", "data", "for", "JSON", "marshaling", "Since", "we", "accept", "incomplete", "metadata", "fields", "we", "should", "not", "return", "errors", "here", "and", "handle", "them", "at", "this", "stage", "." ]
[ "func", "parseDockerContainerMetadata", "(", "taskARN", "string", ",", "containerName", "string", ",", "dockerContainer", "*", "types", ".", "ContainerJSON", ")", "DockerContainerMetadata", "{", "if", "dockerContainer", "==", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "taskARN", ",", "containerName", ")", "\n", "return", "DockerContainerMetadata", "{", "}", "\n", "}", "\n\n", "// In most cases a container should never lack a config but we check regardless to avoid", "// nil pointer exceptions (Could occur if there is some error in the docker api call, if the", "// container we receive has incomplete information)", "imageNameFromConfig", ":=", "\"", "\"", "\n", "if", "dockerContainer", ".", "Config", "!=", "nil", "{", "imageNameFromConfig", "=", "dockerContainer", ".", "Config", ".", "Image", "\n", "}", "else", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "taskARN", ",", "containerName", ")", "\n", "}", "\n\n", "if", "dockerContainer", ".", "ContainerJSONBase", "==", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "taskARN", ",", "containerName", ")", "\n", "return", "DockerContainerMetadata", "{", "imageName", ":", "imageNameFromConfig", ",", "}", "\n", "}", "\n", "networkMetadata", ",", "err", ":=", "parseNetworkMetadata", "(", "dockerContainer", ".", "NetworkSettings", ",", "dockerContainer", ".", "HostConfig", ")", "\n\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "taskARN", ",", "containerName", ",", "err", ")", "\n", "}", "\n\n", "// Get Port bindings from NetworkSettings", "var", "<mask>", "[", "]", "apicontainer", ".", "PortBinding", "\n", "ports", ",", "err", "=", "apicontainer", ".", "PortBindingFromDockerPortBinding", "(", "dockerContainer", ".", "NetworkSettings", ".", "Ports", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "taskARN", ",", "containerName", ",", "err", ")", "\n", "}", "\n\n", "return", "DockerContainerMetadata", "{", "containerID", ":", "dockerContainer", ".", "ID", ",", "dockerContainerName", ":", "dockerContainer", ".", "Name", ",", "imageID", ":", "dockerContainer", ".", "Image", ",", "imageName", ":", "imageNameFromConfig", ",", "ports", ":", "ports", ",", "networkInfo", ":", "networkMetadata", ",", "}", "\n", "}" ]
5,020
all-5021
[ "GetQuery", "returns", "the", "Query", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "l", "*", "LogStreamDefinition", ")", "GetQuery", "(", ")", "string", "{", "if", "l", "==", "nil", "||", "l", ".", "Query", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "l", ".", "<mask>", "\n", "}" ]
5,021
all-5022
[ "ContainsSameLabelset", "checks", "if", "a", "matrix", "has", "samples", "with", "the", "same", "labelset", "Such", "a", "behavior", "is", "semantically", "undefined", "https", ":", "//", "github", ".", "com", "/", "prometheus", "/", "prometheus", "/", "issues", "/", "4562" ]
[ "func", "(", "m", "Matrix", ")", "ContainsSameLabelset", "(", ")", "bool", "{", "l", ":=", "make", "(", "map", "[", "uint64", "]", "struct", "{", "}", ",", "len", "(", "m", ")", ")", "\n", "for", "_", ",", "ss", ":=", "<mask>", "m", "{", "hash", ":=", "ss", ".", "Metric", ".", "Hash", "(", ")", "\n", "if", "_", ",", "ok", ":=", "l", "[", "hash", "]", ";", "ok", "{", "return", "true", "\n", "}", "\n", "l", "[", "hash", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
5,022
all-5023
[ "This", "only", "uses", "the", "OS", "s", "randomness" ]
[ "func", "randBytes", "(", "numBytes", "int", ")", "[", "]", "<mask>", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "numBytes", ")", "\n", "_", ",", "err", ":=", "crand", ".", "Read", "(", "b", ")", "\n", "if", "err", "!=", "nil", "{", "PanicCrisis", "(", "err", ")", "\n", "}", "\n", "return", "b", "\n", "}" ]
5,023
all-5024
[ "GetNewLedgerVersion", "retrieves", "the", "NewLedgerVersion", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "LedgerUpgrade", ")", "GetNewLedgerVersion", "(", ")", "(", "result", "Uint32", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "NewLedgerVersion", "\n", "<mask>", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
5,024
all-5025
[ "RegisterLint", "must", "be", "called", "once", "for", "each", "lint", "to", "be", "excuted", ".", "Duplicate", "lint", "names", "are", "squashed", ".", "Normally", "RegisterLint", "is", "called", "during", "init", "()", "." ]
[ "func", "RegisterLint", "(", "l", "*", "Lint", ")", "{", "if", "err", ":=", "l", ".", "Lint", ".", "Initialize", "(", ")", ";", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", "+", "l", ".", "Name", "+", "\"", "\"", "+", "err", ".", "<mask>", "(", ")", ")", "\n", "}", "\n", "Lints", "[", "l", ".", "Name", "]", "=", "l", "\n", "}" ]
5,025
all-5026
[ "NewTmpBackend", "creates", "a", "backend", "implementation", "for", "testing", "." ]
[ "func", "NewTmpBackend", "(", "batchInterval", "time", ".", "Duration", ",", "batchLimit", "int", ")", "(", "*", "backend", ",", "string", ")", "{", "dir", ",", "err", ":=", "ioutil", ".", "TempDir", "(", "os", ".", "TempDir", "(", ")", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "tmpPath", ":=", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", "\n", "bcfg", ":=", "DefaultBackendConfig", "(", ")", "\n", "bcfg", ".", "<mask>", ",", "bcfg", ".", "BatchInterval", ",", "bcfg", ".", "BatchLimit", "=", "tmpPath", ",", "batchInterval", ",", "batchLimit", "\n", "return", "newBackend", "(", "bcfg", ")", ",", "tmpPath", "\n", "}" ]
5,026
all-5027
[ "SetHeadersVisible", "is", "a", "wrapper", "around", "gtk_tree_view_set_headers_visible", "()", "." ]
[ "func", "(", "v", "*", "TreeView", ")", "SetHeadersVisible", "(", "<mask>", "bool", ")", "{", "C", ".", "gtk_tree_view_set_headers_visible", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "show", ")", ")", "\n", "}" ]
5,027
all-5028
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "Datacenter", ")", "Locator", "(", "api", "*", "API", ")", "*", "DatacenterLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "DatacenterLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
5,028
all-5029
[ "Contains", "returns", "true", "if", "any", "string", "in", "substrs", "is", "within", "s" ]
[ "func", "Contains", "(", "s", "string", ",", "substrs", "[", "]", "string", ")", "bool", "{", "for", "_", ",", "substr", ":=", "<mask>", "substrs", "{", "if", "strings", ".", "Contains", "(", "s", ",", "substr", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
5,029
all-5030
[ "cephRBDVolumeRename", "renames", "a", "given", "RBD", "storage", "volume", "Note", "that", "if", "the", "snapshot", "is", "mapped", "-", "which", "it", "usually", "shouldn", "t", "be", "-", "this", "usually", "requires", "that", "the", "snapshot", "be", "unmapped", "under", "its", "original", "name", "then", "renamed", "and", "finally", "will", "be", "remapped", "again", ".", "If", "it", "is", "not", "unmapped", "under", "its", "original", "name", "and", "the", "caller", "maps", "it", "under", "its", "new", "name", "the", "snapshot", "will", "be", "mapped", "twice", ".", "This", "will", "prevent", "it", "from", "being", "deleted", "." ]
[ "func", "cephRBDVolumeSnapshotRename", "(", "clusterName", "string", ",", "poolName", "string", ",", "volumeName", "string", ",", "volumeType", "string", ",", "oldSnapshotName", "string", ",", "newSnapshotName", "string", ",", "userName", "string", ")", "error", "{", "_", ",", "err", ":=", "<mask>", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "userName", ",", "\"", "\"", ",", "clusterName", ",", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "poolName", ",", "volumeType", ",", "volumeName", ",", "oldSnapshotName", ")", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "poolName", ",", "volumeType", ",", "volumeName", ",", "newSnapshotName", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
5,030
all-5031
[ "BaseFromReference", "returns", "a", "BaseComputeResource", "for", "a", "given", "managed", "object", "reference", "." ]
[ "func", "BaseFromReference", "(", "client", "*", "govmomi", ".", "Client", ",", "ref", "types", ".", "ManagedObjectReference", ")", "(", "BaseComputeResource", ",", "error", ")", "{", "switch", "ref", ".", "Type", "{", "case", "\"", "\"", ":", "return", "StandaloneFromID", "(", "client", ",", "ref", ".", "Value", ")", "\n", "case", "\"", "\"", ":", "return", "StandaloneFromID", "(", "<mask>", ",", "ref", ".", "Value", ")", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "ref", ".", "Type", ")", "\n", "}" ]
5,031
all-5032
[ "AllCursor", "provides", "a", "mock", "function", "with", "given", "fields", ":", "store" ]
[ "func", "(", "_m", "*", "ObjectStore", ")", "AllCursor", "(", "store", "string", ")", "(", "gostore", ".", "ObjectRows", ",", "error", ")", "{", "ret", ":=", "_m", ".", "Called", "(", "store", ")", "\n\n", "var", "r0", "gostore", ".", "ObjectRows", "\n", "if", "rf", ",", "ok", ":=", "ret", ".", "Get", "(", "0", ")", ".", "(", "func", "(", "string", ")", "gostore", ".", "ObjectRows", ")", ";", "ok", "{", "r0", "=", "rf", "(", "store", ")", "\n", "}", "else", "{", "if", "ret", ".", "Get", "(", "0", ")", "!=", "nil", "{", "r0", "=", "ret", ".", "Get", "(", "0", ")", ".", "(", "gostore", ".", "ObjectRows", ")", "\n", "}", "\n", "}", "\n\n", "var", "r1", "error", "\n", "if", "rf", ",", "ok", ":=", "<mask>", ".", "Get", "(", "1", ")", ".", "(", "func", "(", "string", ")", "error", ")", ";", "ok", "{", "r1", "=", "rf", "(", "store", ")", "\n", "}", "else", "{", "r1", "=", "ret", ".", "Error", "(", "1", ")", "\n", "}", "\n\n", "return", "r0", ",", "r1", "\n", "}" ]
5,032
all-5033
[ "CheckFlags", "looks", "for", "comments", "matching", "regexes" ]
[ "func", "(", "c", "*", "CommentCounterPlugin", ")", "CheckFlags", "(", ")", "error", "{", "for", "_", ",", "<mask>", ":=", "range", "c", ".", "pattern", "{", "matcher", ",", "err", ":=", "regexp", ".", "Compile", "(", "pattern", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "c", ".", "matcher", "=", "append", "(", "c", ".", "matcher", ",", "matcher", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
5,033
all-5034
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetMetricsReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPerformance2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
5,034
all-5035
[ "GetHostname", "returns", "the", "hostname", "from", "request", "Host", "field", ".", "It", "returns", "empty", "string", "if", "Host", "field", "contains", "invalid", "value", "(", "e", ".", "g", ".", "localhost", ":::", "with", "too", "many", "colons", ")", "." ]
[ "func", "GetHostname", "(", "req", "*", "http", ".", "Request", ")", "string", "{", "if", "req", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "h", ",", "_", ",", "err", ":=", "<mask>", ".", "SplitHostPort", "(", "req", ".", "Host", ")", "\n", "if", "err", "!=", "nil", "{", "return", "req", ".", "Host", "\n", "}", "\n", "return", "h", "\n", "}" ]
5,035
all-5036
[ "ItemActivated", "is", "a", "wrapper", "around", "gtk_icon_view_item_activated", "()", "." ]
[ "func", "(", "v", "*", "IconView", ")", "ItemActivated", "(", "path", "*", "TreePath", ")", "{", "C", ".", "gtk_icon_view_item_activated", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "native", "(", ")", ")", "\n", "}" ]
5,036
all-5037
[ "ListTeamInvitations", "gets", "a", "list", "of", "team", "members", "with", "pending", "invitations", "for", "the", "given", "team", "id", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "teams", "/", "members", "/", "#list", "-", "pending", "-", "team", "-", "invitations" ]
[ "func", "(", "c", "*", "Client", ")", "ListTeamInvitations", "(", "id", "int", ")", "(", "[", "]", "OrgInvitation", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "id", ")", "\n", "if", "c", ".", "fake", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "id", ")", "\n", "<mask>", "ret", "[", "]", "OrgInvitation", "\n", "err", ":=", "c", ".", "readPaginatedResults", "(", "path", ",", "acceptNone", ",", "func", "(", ")", "interface", "{", "}", "{", "return", "&", "[", "]", "OrgInvitation", "{", "}", "\n", "}", ",", "func", "(", "obj", "interface", "{", "}", ")", "{", "ret", "=", "append", "(", "ret", ",", "*", "(", "obj", ".", "(", "*", "[", "]", "OrgInvitation", ")", ")", "...", ")", "\n", "}", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "ret", ",", "nil", "\n", "}" ]
5,037
all-5038
[ "handleAcquireByState", ":", "Handler", "for", "/", "acquirebystate", "Method", ":", "POST", "URLParams", ":", "Required", ":", "state", "=", "[", "string", "]", ":", "current", "state", "of", "the", "requested", "resource", "Required", ":", "dest", "=", "[", "string", "]", ":", "destination", "state", "of", "the", "requested", "resource", "Required", ":", "owner", "=", "[", "string", "]", ":", "requester", "of", "the", "resource", "Required", ":", "names", "=", "[", "string", "]", ":", "expected", "resources", "names" ]
[ "func", "handleAcquireByState", "(", "r", "*", "ranch", ".", "Ranch", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "res", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "logrus", ".", "WithField", "(", "\"", "\"", ",", "\"", "\"", ")", ".", "Infof", "(", "\"", "\"", ",", "req", ".", "RemoteAddr", ")", "\n\n", "if", "req", ".", "Method", "!=", "http", ".", "MethodPost", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "req", ".", "Method", ")", "\n", "logrus", ".", "Warning", "(", "msg", ")", "\n", "http", ".", "Error", "(", "res", ",", "msg", ",", "http", ".", "StatusMethodNotAllowed", ")", "\n", "return", "\n", "}", "\n\n", "// TODO(krzyzacy) - sanitize user input", "state", ":=", "req", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "dest", ":=", "req", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "owner", ":=", "req", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "names", ":=", "req", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "state", "==", "\"", "\"", "||", "dest", "==", "\"", "\"", "||", "owner", "==", "\"", "\"", "||", "names", "==", "\"", "\"", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "state", ",", "dest", ",", "owner", ",", "names", ")", "\n", "logrus", ".", "Warning", "(", "msg", ")", "\n", "http", ".", "Error", "(", "res", ",", "msg", ",", "http", ".", "StatusBadRequest", ")", "\n", "return", "\n", "}", "\n", "rNames", ":=", "strings", ".", "Split", "(", "<mask>", ",", "\"", "\"", ")", "\n", "logrus", ".", "Infof", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "rNames", ",", "\"", "\"", ")", ",", "state", ",", "owner", ",", "dest", ")", "\n\n", "resources", ",", "err", ":=", "r", ".", "AcquireByState", "(", "state", ",", "dest", ",", "owner", ",", "rNames", ")", "\n\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ")", "\n", "http", ".", "Error", "(", "res", ",", "err", ".", "Error", "(", ")", ",", "ErrorToStatus", "(", "err", ")", ")", "\n", "return", "\n", "}", "\n\n", "resBytes", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n\n", "if", "err", ":=", "json", ".", "NewEncoder", "(", "resBytes", ")", ".", "Encode", "(", "resources", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "resources", ")", "\n", "http", ".", "Error", "(", "res", ",", "err", ".", "Error", "(", ")", ",", "ErrorToStatus", "(", "err", ")", ")", "\n", "for", "_", ",", "resource", ":=", "range", "resources", "{", "err", ":=", "r", ".", "Release", "(", "resource", ".", "Name", ",", "state", ",", "owner", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Warningf", "(", "\"", "\"", ",", "resource", ".", "Name", ")", "\n", "}", "\n", "}", "\n", "return", "\n", "}", "\n", "logrus", ".", "Infof", "(", "\"", "\"", ",", "resBytes", ".", "String", "(", ")", ")", "\n", "fmt", ".", "Fprint", "(", "res", ",", "resBytes", ".", "String", "(", ")", ")", "\n", "}", "\n", "}" ]
5,038
all-5039
[ "listDHCPServers", "lists", "all", "DHCP", "server", "settings", "in", "a", "map", "keyed", "by", "DHCP", ".", "NetworkName", "." ]
[ "func", "listDHCPServers", "(", "vbox", "VBoxManager", ")", "(", "map", "[", "string", "]", "*", "dhcpServer", ",", "error", ")", "{", "out", ",", "err", ":=", "vbox", ".", "vbmOut", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "m", ":=", "map", "[", "string", "]", "*", "dhcpServer", "{", "}", "\n", "dhcp", ":=", "&", "dhcpServer", "{", "}", "\n\n", "err", "=", "parseKeyValues", "(", "out", ",", "reColonLine", ",", "func", "(", "key", ",", "val", "string", ")", "error", "{", "switch", "key", "{", "case", "\"", "\"", ":", "dhcp", "=", "&", "dhcpServer", "{", "}", "\n", "m", "[", "val", "]", "=", "dhcp", "\n", "dhcp", ".", "NetworkName", "=", "val", "\n", "case", "\"", "\"", ":", "dhcp", ".", "IPv4", ".", "IP", "=", "net", ".", "ParseIP", "(", "val", ")", "\n", "case", "\"", "\"", ":", "dhcp", ".", "UpperIP", "=", "net", ".", "ParseIP", "(", "val", ")", "\n", "case", "\"", "\"", ":", "dhcp", ".", "LowerIP", "=", "net", ".", "ParseIP", "(", "val", ")", "\n", "case", "\"", "\"", ":", "dhcp", ".", "IPv4", ".", "Mask", "=", "parseIPv4Mask", "(", "val", ")", "\n", "<mask>", "\"", "\"", ":", "dhcp", ".", "Enabled", "=", "(", "val", "==", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "m", ",", "nil", "\n", "}" ]
5,039
all-5040
[ "DefaultPolicy", "returns", "a", "simple", "policy", "that", "uses", "all", "built", "-", "in", "models", "and", "strategies", ".", "Note", ":", "The", "secret", "should", "be", "at", "least", "16", "characters", "long", "." ]
[ "func", "DefaultPolicy", "(", "<mask>", "string", ")", "*", "Policy", "{", "return", "&", "Policy", "{", "Secret", ":", "[", "]", "byte", "(", "secret", ")", ",", "Token", ":", "&", "Token", "{", "}", ",", "Clients", ":", "[", "]", "Client", "{", "&", "Application", "{", "}", "}", ",", "ResourceOwners", ":", "func", "(", "_", "Client", ")", "[", "]", "ResourceOwner", "{", "return", "[", "]", "ResourceOwner", "{", "&", "User", "{", "}", "}", "\n", "}", ",", "GrantStrategy", ":", "DefaultGrantStrategy", ",", "TokenData", ":", "DefaultTokenData", ",", "AccessTokenLifespan", ":", "time", ".", "Hour", ",", "RefreshTokenLifespan", ":", "7", "*", "24", "*", "time", ".", "Hour", ",", "}", "\n", "}" ]
5,040
all-5041
[ "NewMemCache", "creates", "a", "GitHub", "cache", "RoundTripper", "that", "is", "backed", "by", "a", "memory", "cache", "." ]
[ "func", "NewMemCache", "(", "delegate", "<mask>", ".", "RoundTripper", ",", "maxConcurrency", "int", ")", "http", ".", "RoundTripper", "{", "return", "NewFromCache", "(", "delegate", ",", "httpcache", ".", "NewMemoryCache", "(", ")", ",", "maxConcurrency", ")", "\n", "}" ]
5,041
all-5042
[ "Stats", "returns", "allocator", "statistics", "Returns", "jemalloc", "stats" ]
[ "func", "Stats", "(", ")", "string", "{", "mu", ".", "Lock", "(", ")", "\n", "defer", "mu", ".", "Unlock", "(", ")", "\n\n", "buf", ":=", "C", ".", "mm_stats", "(", ")", "\n", "s", ":=", "\"", "\\n", "\"", "\n", "if", "Debug", "{", "s", "+=", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", "+", "\"", "\\n", "\"", ",", "stats", ".", "allocs", ",", "stats", ".", "frees", ")", "\n", "}", "\n\n", "if", "buf", "!=", "nil", "{", "s", "+=", "C", ".", "GoString", "(", "buf", ")", "\n", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "buf", ")", ")", "\n", "}", "\n\n", "return", "s", "\n", "}" ]
5,042
all-5043
[ "FailFunc", "outputs", "Fail", "level", "log", "returned", "from", "the", "function" ]
[ "func", "FailFunc", "(", "f", "func", "(", ")", "string", ")", "error", "{", "if", "isModeEnable", "(", "FAIL", ")", "{", "return", "glg", ".", "<mask>", "(", "FAIL", ",", "\"", "\"", ",", "f", "(", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
5,043
all-5044
[ "newEmpty", "creates", "and", "returns", "an", "empty", "element", "." ]
[ "func", "newEmptyElement", "(", "ln", "*", "line", ",", "rslt", "*", "result", ",", "src", "*", "source", ",", "parent", "element", ",", "opts", "*", "Options", ")", "*", "emptyElement", "{", "return", "&", "emptyElement", "{", "elementBase", ":", "newElementBase", "(", "ln", ",", "rslt", ",", "src", ",", "<mask>", ",", "opts", ")", ",", "}", "\n", "}" ]
5,044
all-5045
[ "GenVoltDB", "generates", "a", "VoltDB", "DSN", "from", "the", "passed", "URL", "." ]
[ "func", "GenVoltDB", "(", "u", "*", "URL", ")", "(", "string", ",", "error", ")", "{", "host", ",", "port", ":=", "\"", "\"", ",", "\"", "\"", "\n", "if", "h", ":=", "hostname", "(", "u", ".", "Host", ")", ";", "h", "!=", "\"", "\"", "{", "host", "=", "h", "\n", "}", "\n", "if", "p", ":=", "hostport", "(", "u", ".", "Host", ")", ";", "p", "!=", "\"", "\"", "{", "<mask>", "=", "p", "\n", "}", "\n", "return", "host", "+", "\"", "\"", "+", "port", ",", "nil", "\n", "}" ]
5,045
all-5046
[ "ServeHTTP" ]
[ "func", "(", "mux", "*", "LoggingServeMux", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ")", "{", "mux", ".", "serveMux", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}" ]
5,046
all-5047
[ "CreateVolume", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockDockerClient", ")", "CreateVolume", "(", "arg0", "context", ".", "Context", ",", "arg1", ",", "arg2", "string", ",", "arg3", ",", "arg4", "map", "[", "string", "]", "string", ",", "arg5", "time", ".", "Duration", ")", "dockerapi", ".", "SDKVolumeResponse", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ",", "arg2", ",", "arg3", ",", "arg4", ",", "arg5", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "dockerapi", ".", "SDKVolumeResponse", ")", "\n", "return", "ret0", "\n", "}" ]
5,047
all-5048
[ "ExpiresIn", "is", "an", "option", "that", "will", "set", "the", "expiration", "duration", "generated", "for", "tokens", "to", "the", "specified", "duration", "." ]
[ "func", "ExpiresIn", "(", "d", "time", ".", "Duration", ")", "Option", "{", "return", "func", "(", "tok", "*", "Bearer", ")", "error", "{", "if", "d", "!=", "0", "{", "tok", ".", "addExpiration", "=", "<mask>", "\n", "tok", ".", "expiresIn", "=", "d", "\n", "}", "else", "{", "tok", ".", "addExpiration", "=", "false", "\n", "tok", ".", "expiresIn", "=", "0", "\n", "}", "\n\n", "return", "nil", "\n", "}", "\n", "}" ]
5,048
all-5049
[ "simultaneously", "specify", "storage", "for", "all", "levels", "of", "a", "three", "-", "dimensional", "two", "-", "dimensional", "array", "or", "cube", "-", "map", "array", "texture" ]
[ "func", "TextureStorage3D", "(", "texture", "uint32", ",", "levels", "int32", ",", "internalformat", "uint32", ",", "width", "int32", ",", "<mask>", "int32", ",", "depth", "int32", ")", "{", "C", ".", "glowTextureStorage3D", "(", "gpTextureStorage3D", ",", "(", "C", ".", "GLuint", ")", "(", "texture", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "levels", ")", ",", "(", "C", ".", "GLenum", ")", "(", "internalformat", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "width", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "height", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "depth", ")", ")", "\n", "}" ]
5,049
all-5050
[ "SetLicense", "is", "a", "wrapper", "around", "gtk_about_dialog_set_license", "()", "." ]
[ "func", "(", "v", "*", "AboutDialog", ")", "SetLicense", "(", "license", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "license", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_about_dialog_set_license", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
5,050
all-5051
[ "HasUrl", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "Event", ")", "HasUrl", "(", ")", "bool", "{", "if", "e", "!=", "nil", "&&", "e", ".", "Url", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
5,051
all-5052
[ "ToBytes", "returns", "the", "bytes", "represented", "by", "the", "base64", "string", "s", "." ]
[ "func", "ToBytes", "(", "s", "Base64String", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "return", "base64", ".", "URLEncoding", ".", "DecodeString", "(", "strings", ".", "TrimSpace", "(", "string", "(", "s", ")", ")", ")", "\n", "}" ]
5,052
all-5053
[ "Records", "returns", "the", "list", "of", "records", "in", "all", "relevant", "zones", "." ]
[ "func", "(", "p", "*", "GoogleProvider", ")", "Records", "(", ")", "(", "endpoints", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "_", "error", ")", "{", "zones", ",", "err", ":=", "p", ".", "Zones", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "f", ":=", "func", "(", "resp", "*", "dns", ".", "ResourceRecordSetsListResponse", ")", "error", "{", "for", "_", ",", "r", ":=", "<mask>", "resp", ".", "Rrsets", "{", "if", "!", "supportedRecordType", "(", "r", ".", "Type", ")", "{", "continue", "\n", "}", "\n", "endpoints", "=", "append", "(", "endpoints", ",", "endpoint", ".", "NewEndpointWithTTL", "(", "r", ".", "Name", ",", "r", ".", "Type", ",", "endpoint", ".", "TTL", "(", "r", ".", "Ttl", ")", ",", "r", ".", "Rrdatas", "...", ")", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}", "\n\n", "for", "_", ",", "z", ":=", "range", "zones", "{", "if", "err", ":=", "p", ".", "resourceRecordSetsClient", ".", "List", "(", "p", ".", "project", ",", "z", ".", "Name", ")", ".", "Pages", "(", "context", ".", "TODO", "(", ")", ",", "f", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "return", "endpoints", ",", "nil", "\n", "}" ]
5,053
all-5054
[ "GetCreatedBy", "returns", "the", "CreatedBy", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "DashboardLite", ")", "GetCreatedBy", "(", ")", "CreatedBy", "{", "if", "d", "==", "nil", "||", "d", ".", "CreatedBy", "==", "nil", "{", "<mask>", "CreatedBy", "{", "}", "\n", "}", "\n", "return", "*", "d", ".", "CreatedBy", "\n", "}" ]
5,054
all-5055
[ "Returns", "the", "name", "of", "the", "field", "at", "offset", "off", "in", "x", "." ]
[ "func", "objField", "(", "c", "*", "gocore", ".", "Process", ",", "x", "gocore", ".", "Object", ",", "off", "int64", ")", "string", "{", "t", ",", "r", ":=", "c", ".", "<mask>", "(", "x", ")", "\n", "if", "t", "==", "nil", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "off", ")", "\n", "}", "\n", "s", ":=", "\"", "\"", "\n", "if", "r", ">", "1", "{", "s", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "off", "/", "t", ".", "Size", ")", "\n", "off", "%=", "t", ".", "Size", "\n", "}", "\n", "return", "s", "+", "typeFieldName", "(", "t", ",", "off", ")", "\n", "}" ]
5,055
all-5056
[ "Next", "advances", "to", "the", "next", "file", "in", "the", "archive", "." ]
[ "func", "(", "r", "*", "Reader", ")", "Next", "(", ")", "(", "*", "FileHeader", ",", "error", ")", "{", "if", "r", ".", "solidr", "!=", "nil", "{", "// solid files must be read fully to update decoder information", "if", "_", ",", "err", ":=", "io", ".", "Copy", "(", "ioutil", ".", "Discard", ",", "r", ".", "solidr", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "h", ",", "err", ":=", "r", ".", "pr", ".", "next", "(", ")", "// skip to next file", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "r", ".", "solidr", "=", "nil", "\n\n", "br", ":=", "byteReader", "(", "&", "r", ".", "pr", ")", "// start with packed file reader", "\n\n", "// check for encryption", "if", "len", "(", "h", ".", "key", ")", ">", "0", "&&", "len", "(", "h", ".", "iv", ")", ">", "0", "{", "br", "=", "newAesDecryptReader", "(", "br", ",", "h", ".", "key", ",", "h", ".", "iv", ")", "// decrypt", "\n", "}", "\n", "r", ".", "r", "=", "br", "\n", "// check for compression", "if", "h", ".", "decoder", "!=", "nil", "{", "err", "=", "r", ".", "dr", ".", "init", "(", "br", ",", "h", ".", "decoder", ",", "h", ".", "winSize", ",", "!", "h", ".", "solid", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "r", ".", "r", "=", "&", "r", ".", "dr", "\n", "if", "r", ".", "pr", ".", "r", ".", "isSolid", "(", ")", "{", "r", ".", "solidr", "=", "r", ".", "r", "\n", "}", "\n", "}", "\n", "if", "h", ".", "UnPackedSize", ">=", "0", "&&", "!", "h", ".", "UnKnownSize", "{", "// Limit reading to UnPackedSize as there may be padding", "r", ".", "r", "=", "&", "limitedReader", "{", "r", ".", "r", ",", "h", ".", "UnPackedSize", ",", "errShortFile", "}", "\n", "}", "\n", "r", ".", "cksum", "=", "h", ".", "cksum", "\n", "if", "r", ".", "cksum", "!=", "nil", "{", "r", ".", "r", "=", "<mask>", ".", "TeeReader", "(", "r", ".", "r", ",", "h", ".", "cksum", ")", "// write file data to checksum as it is read", "\n", "}", "\n", "fh", ":=", "new", "(", "FileHeader", ")", "\n", "*", "fh", "=", "h", ".", "FileHeader", "\n", "return", "fh", ",", "nil", "\n", "}" ]
5,056
all-5057
[ "GetResource", "returns", "the", "Resource", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "DashboardLite", ")", "GetResource", "(", ")", "string", "{", "if", "d", "==", "nil", "||", "d", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "d", ".", "Resource", "\n", "}" ]
5,057
all-5058
[ "UnmarshalText", "converts", "text", "from", "config", "file", "to", "a", "enum", "." ]
[ "func", "(", "p", "*", "Protocol", ")", "UnmarshalText", "(", "text", "[", "]", "byte", ")", "error", "{", "protocolName", ":=", "string", "(", "<mask>", ")", "\n\n", "switch", "strings", ".", "ToLower", "(", "protocolName", ")", "{", "case", "\"", "\"", ":", "*", "p", "=", "ProtocolPlain", "\n", "case", "\"", "\"", ":", "*", "p", "=", "ProtocolProtobuf", "\n", "case", "\"", "\"", ":", "*", "p", "=", "ProtocolPickle", "\n", "default", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "protocolName", ",", "supportedProtocols", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
5,058
all-5059
[ "GetLogQuery", "returns", "the", "LogQuery", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "ToplistRequest", ")", "GetLogQuery", "(", ")", "WidgetApmOrLogQuery", "{", "if", "t", "==", "nil", "||", "t", ".", "LogQuery", "==", "nil", "{", "<mask>", "WidgetApmOrLogQuery", "{", "}", "\n", "}", "\n", "return", "*", "t", ".", "LogQuery", "\n", "}" ]
5,059
all-5060
[ "Register", "maps", "a", "request", "Content", "-", "Type", "(", "application", "/", "json", ")", "to", "a", "Binder", "." ]
[ "func", "Register", "(", "contentType", "string", ",", "fn", "Binder", ")", "{", "<mask>", ".", "Lock", "(", ")", "\n", "defer", "lock", ".", "Unlock", "(", ")", "\n\n", "binders", "[", "strings", ".", "ToLower", "(", "contentType", ")", "]", "=", "fn", "\n", "}" ]
5,060
all-5061
[ "TaskLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "TaskLocator", "(", "href", "string", ")", "*", "TaskLocator", "{", "<mask>", "&", "TaskLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
5,061
all-5062
[ "Step", "advances", "the", "state", "machine", "using", "msgs", ".", "The", "ctx", ".", "Err", "()", "will", "be", "returned", "if", "any", "." ]
[ "func", "(", "n", "*", "node", ")", "stepWithWaitOption", "(", "ctx", "context", ".", "Context", ",", "m", "pb", ".", "Message", ",", "wait", "bool", ")", "error", "{", "if", "m", ".", "Type", "!=", "<mask>", ".", "MsgProp", "{", "select", "{", "case", "n", ".", "recvc", "<-", "m", ":", "return", "nil", "\n", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "ctx", ".", "Err", "(", ")", "\n", "case", "<-", "n", ".", "done", ":", "return", "ErrStopped", "\n", "}", "\n", "}", "\n", "ch", ":=", "n", ".", "propc", "\n", "pm", ":=", "msgWithResult", "{", "m", ":", "m", "}", "\n", "if", "wait", "{", "pm", ".", "result", "=", "make", "(", "chan", "error", ",", "1", ")", "\n", "}", "\n", "select", "{", "case", "ch", "<-", "pm", ":", "if", "!", "wait", "{", "return", "nil", "\n", "}", "\n", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "ctx", ".", "Err", "(", ")", "\n", "case", "<-", "n", ".", "done", ":", "return", "ErrStopped", "\n", "}", "\n", "select", "{", "case", "err", ":=", "<-", "pm", ".", "result", ":", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "ctx", ".", "Err", "(", ")", "\n", "case", "<-", "n", ".", "done", ":", "return", "ErrStopped", "\n", "}", "\n", "return", "nil", "\n", "}" ]
5,062
all-5063
[ "Do", "executes", "Profiler", ".", "startTypeProfile", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "StartTypeProfileParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandStartTypeProfile", ",", "nil", ",", "nil", ")", "\n", "}" ]
5,063
all-5064
[ "submitChange", "takes", "a", "zone", "and", "a", "Change", "and", "sends", "it", "to", "Google", "." ]
[ "func", "(", "p", "*", "GoogleProvider", ")", "submitChange", "(", "change", "*", "dns", ".", "Change", ")", "error", "{", "if", "len", "(", "change", ".", "Additions", ")", "==", "0", "&&", "len", "(", "change", ".", "Deletions", ")", "==", "0", "{", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n\n", "zones", ",", "err", ":=", "p", ".", "Zones", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// separate into per-zone change sets to be passed to the API.", "changes", ":=", "separateChange", "(", "zones", ",", "change", ")", "\n\n", "for", "z", ",", "c", ":=", "range", "changes", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "z", ")", "\n", "for", "_", ",", "del", ":=", "range", "c", ".", "Deletions", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "del", ".", "Name", ",", "del", ".", "Type", ",", "del", ".", "Rrdatas", ",", "del", ".", "Ttl", ")", "\n", "}", "\n", "for", "_", ",", "add", ":=", "range", "c", ".", "Additions", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "add", ".", "Name", ",", "add", ".", "<mask>", ",", "add", ".", "Rrdatas", ",", "add", ".", "Ttl", ")", "\n", "}", "\n", "}", "\n\n", "if", "p", ".", "dryRun", "{", "return", "nil", "\n", "}", "\n\n", "for", "z", ",", "c", ":=", "range", "changes", "{", "if", "_", ",", "err", ":=", "p", ".", "changesClient", ".", "Create", "(", "p", ".", "project", ",", "z", ",", "c", ")", ".", "Do", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
5,064
all-5065
[ "NewInfiniteLoopWithIntro", "creates", "a", "new", "infinite", "loop", "stream", "with", "an", "intro", "part", ".", "NewInfiniteLoopWithIntro", "accepts", "a", "source", "stream", "src", "introLength", "in", "bytes", "and", "loopLength", "in", "bytes", "." ]
[ "func", "NewInfiniteLoopWithIntro", "(", "src", "ReadSeekCloser", ",", "introLength", "int64", ",", "loopLength", "int64", ")", "*", "InfiniteLoop", "{", "return", "&", "InfiniteLoop", "{", "src", ":", "src", ",", "lstart", ":", "introLength", ",", "llength", ":", "loopLength", ",", "<mask>", ":", "-", "1", ",", "}", "\n", "}" ]
5,065
all-5066
[ "GenClickhouse", "generates", "a", "clickhouse", "DSN", "from", "the", "passed", "URL", "." ]
[ "func", "GenClickhouse", "(", "u", "*", "URL", ")", "(", "string", ",", "error", ")", "{", "z", ":=", "&", "url", ".", "URL", "{", "Scheme", ":", "\"", "\"", ",", "Opaque", ":", "u", ".", "Opaque", ",", "Host", ":", "u", ".", "Host", ",", "Path", ":", "u", ".", "Path", ",", "RawPath", ":", "u", ".", "RawPath", ",", "RawQuery", ":", "u", ".", "RawQuery", ",", "Fragment", ":", "u", ".", "Fragment", ",", "}", "\n\n", "if", "hostport", "(", "z", ".", "Host", ")", "==", "\"", "\"", "{", "z", ".", "Host", "+=", "\"", "\"", "\n", "}", "\n\n", "// add parameters", "q", ":=", "z", ".", "Query", "(", ")", "\n", "if", "u", ".", "User", "!=", "nil", "{", "if", "user", ":=", "u", ".", "User", ".", "Username", "(", ")", ";", "len", "(", "user", ")", ">", "0", "{", "q", ".", "Set", "(", "\"", "\"", ",", "user", ")", "\n", "}", "\n", "if", "pass", ",", "ok", ":=", "u", ".", "User", ".", "Password", "(", ")", ";", "ok", "{", "q", ".", "Set", "(", "\"", "\"", ",", "pass", ")", "\n", "}", "\n", "}", "\n", "z", ".", "RawQuery", "=", "q", ".", "Encode", "(", ")", "\n\n", "return", "z", ".", "<mask>", "(", ")", ",", "nil", "\n", "}" ]
5,066
all-5067
[ "Parser", "returns", "a", "parser", "based", "on", "the", "mime", "if", "none", "can", "be", "matched", "the", "default", "is", "returned" ]
[ "func", "(", "e", "*", "Encoder", ")", "Parser", "(", "r", "*", "http", ".", "Request", ")", "<mask>", "{", "contentType", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "info", ":=", "parseMimeInfo", "(", "contentType", ")", "\n\n", "if", "info", "!=", "nil", "{", "for", "encoding", ",", "i", ":=", "range", "e", ".", "encodings", "{", "if", "i", ".", "equals", "(", "info", ")", "{", "return", "encoding", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "e", ".", "defaultEncoding", "\n", "}" ]
5,067
all-5068
[ "NodesCount", "returns", "the", "number", "of", "nodes", "in", "the", "LXD", "cluster", ".", "Since", "there", "s", "always", "at", "least", "one", "node", "row", "even", "when", "not", "-", "clustered", "the", "return", "value", "is", "greater", "than", "zero" ]
[ "func", "(", "c", "*", "ClusterTx", ")", "NodesCount", "(", ")", "(", "int", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "query", ".", "Count", "(", "c", ".", "tx", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "count", ",", "nil", "\n", "}" ]
5,068
all-5069
[ "Parameter", "context", "has", "type", "*", "C", ".", "struct__cl_context", ".", "Parameter", "event", "has", "type", "*", "C", ".", "struct__cl_event", "." ]
[ "func", "CreateSyncFromCLeventARB", "(", "context", "unsafe", ".", "Pointer", ",", "event", "unsafe", ".", "Pointer", ",", "<mask>", "uint32", ")", "uintptr", "{", "ret", ":=", "C", ".", "glowCreateSyncFromCLeventARB", "(", "gpCreateSyncFromCLeventARB", ",", "(", "*", "C", ".", "struct__cl_context", ")", "(", "context", ")", ",", "(", "*", "C", ".", "struct__cl_event", ")", "(", "event", ")", ",", "(", "C", ".", "GLbitfield", ")", "(", "flags", ")", ")", "\n", "return", "(", "uintptr", ")", "(", "ret", ")", "\n", "}" ]
5,069
all-5070
[ "Attempt", "to", "hijack", "session", "previously", "running", "bot" ]
[ "func", "(", "irc", "*", "Bot", ")", "hijackSession", "(", ")", "bool", "{", "unaddr", ",", "err", ":=", "net", ".", "ResolveUnixAddr", "(", "\"", "\"", ",", "irc", ".", "unixastr", ")", "// The only way to get an error here is if the first parameter is not one of \"unix\", \"unixgram\" or \"unixpacket\". That will never happen.", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "con", ",", "err", ":=", "<mask>", ".", "DialUnix", "(", "\"", "\"", ",", "nil", ",", "unaddr", ")", "\n", "if", "err", "!=", "nil", "{", "irc", ".", "Info", "(", "\"", "\"", ",", "\"", "\"", ",", "err", ")", "\n", "return", "false", "\n", "}", "\n", "ncon", ",", "err", ":=", "sendfd", ".", "RecvFD", "(", "con", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "netcon", ",", "err", ":=", "net", ".", "FileConn", "(", "ncon", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "irc", ".", "reconnecting", "=", "true", "\n", "irc", ".", "con", "=", "netcon", "\n", "return", "true", "\n", "}" ]
5,070
all-5071
[ "AllByID", "finds", "zero", "or", "more", "elements", "with", "a", "given", "ID", "." ]
[ "func", "(", "s", "*", "selectable", ")", "AllByID", "(", "text", "string", ")", "*", "MultiSelection", "{", "return", "newMultiSelection", "(", "s", ".", "<mask>", ",", "s", ".", "selectors", ".", "Append", "(", "target", ".", "ID", ",", "text", ")", ")", "\n", "}" ]
5,071
all-5072
[ "NewMockEC2MetadataClient", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockEC2MetadataClient", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockEC2MetadataClient", "{", "mock", ":=", "&", "MockEC2MetadataClient", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockEC2MetadataClientMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
5,072
all-5073
[ "MustText", "retrieves", "the", "Text", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "Memo", ")", "MustText", "(", ")", "string", "{", "val", ",", "ok", ":=", "u", ".", "GetText", "(", ")", "\n\n", "if", "!", "<mask>", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
5,073
all-5074
[ "DeleteRecord", "wraps", "the", "Delete", "method", "of", "the", "API", "s", "Record", "service" ]
[ "func", "(", "n", "NS1DomainService", ")", "DeleteRecord", "(", "zone", "string", ",", "domain", "string", ",", "t", "string", ")", "(", "*", "<mask>", ".", "Response", ",", "error", ")", "{", "return", "n", ".", "service", ".", "Records", ".", "Delete", "(", "zone", ",", "domain", ",", "t", ")", "\n", "}" ]
5,074
all-5075
[ "NewJobAgent", "is", "a", "JobAgent", "constructor", "." ]
[ "func", "NewJobAgent", "(", "kc", "serviceClusterClient", ",", "plClients", "<mask>", "[", "string", "]", "PodLogClient", ",", "cfg", "config", ".", "Getter", ")", "*", "JobAgent", "{", "return", "&", "JobAgent", "{", "kc", ":", "kc", ",", "pkcs", ":", "plClients", ",", "config", ":", "cfg", ",", "}", "\n", "}" ]
5,075
all-5076
[ "Close", "is", "the", "snapshot", "descructor", "Once", "a", "thread", "has", "finished", "using", "a", "snapshot", "it", "can", "be", "destroyed", "by", "calling", "Close", "()", ".", "Internal", "garbage", "collector", "takes", "care", "of", "freeing", "the", "items", "." ]
[ "func", "(", "s", "*", "Snapshot", ")", "Close", "(", ")", "{", "newRefcount", ":=", "atomic", ".", "AddInt32", "(", "&", "s", ".", "refCount", ",", "-", "1", ")", "\n", "if", "newRefcount", "==", "0", "{", "buf", ":=", "s", ".", "db", ".", "snapshots", ".", "MakeBuf", "(", ")", "\n", "defer", "s", ".", "db", ".", "snapshots", ".", "FreeBuf", "(", "buf", ")", "\n\n", "// Move from live snapshot list to dead list", "s", ".", "db", ".", "snapshots", ".", "Delete", "(", "unsafe", ".", "Pointer", "(", "s", ")", ",", "CompareSnapshot", ",", "buf", ",", "&", "s", ".", "db", ".", "snapshots", ".", "Stats", ")", "\n", "s", ".", "<mask>", ".", "gcsnapshots", ".", "Insert", "(", "unsafe", ".", "Pointer", "(", "s", ")", ",", "CompareSnapshot", ",", "buf", ",", "&", "s", ".", "db", ".", "gcsnapshots", ".", "Stats", ")", "\n", "s", ".", "db", ".", "GC", "(", ")", "\n", "}", "\n", "}" ]
5,076
all-5077
[ "creates", "and", "initializes", "a", "buffer", "object", "s", "data", "store" ]
[ "func", "NamedBufferData", "(", "buffer", "uint32", ",", "size", "int", ",", "data", "unsafe", ".", "Pointer", ",", "usage", "uint32", ")", "{", "syscall", ".", "Syscall6", "(", "gpNamedBufferData", ",", "4", ",", "uintptr", "(", "buffer", ")", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "data", ")", ",", "uintptr", "(", "usage", ")", ",", "0", ",", "0", ")", "\n", "}" ]
5,077
all-5078
[ "ConnectLXD", "lets", "you", "connect", "to", "a", "remote", "LXD", "daemon", "over", "HTTPs", ".", "A", "client", "certificate", "(", "TLSClientCert", ")", "and", "key", "(", "TLSClientKey", ")", "must", "be", "provided", ".", "If", "connecting", "to", "a", "LXD", "daemon", "running", "in", "PKI", "mode", "the", "PKI", "CA", "(", "TLSCA", ")", "must", "also", "be", "provided", ".", "Unless", "the", "remote", "server", "is", "trusted", "by", "the", "system", "CA", "the", "remote", "certificate", "must", "be", "provided", "(", "TLSServerCert", ")", "." ]
[ "func", "ConnectLXD", "(", "url", "string", ",", "args", "*", "ConnectionArgs", ")", "(", "ContainerServer", ",", "error", ")", "{", "logger", ".", "Debugf", "(", "\"", "\"", ")", "\n\n", "// Cleanup URL", "<mask>", "=", "strings", ".", "TrimSuffix", "(", "url", ",", "\"", "\"", ")", "\n\n", "return", "httpsLXD", "(", "url", ",", "args", ")", "\n", "}" ]
5,078
all-5079
[ "Reader", "returns", "the", "data", "contained", "in", "the", "stream", "v", ".", "If", "v", ".", "Kind", "()", "!", "=", "Stream", "Reader", "returns", "a", "ReadCloser", "that", "responds", "to", "all", "reads", "with", "a", "stream", "not", "present", "error", "." ]
[ "func", "(", "v", "Value", ")", "Reader", "(", ")", "io", ".", "ReadCloser", "{", "x", ",", "ok", ":=", "v", ".", "data", ".", "(", "stream", ")", "\n", "if", "!", "ok", "{", "return", "&", "errorReadCloser", "{", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "}", "\n", "}", "\n", "var", "rd", "io", ".", "Reader", "\n", "rd", "=", "io", ".", "NewSectionReader", "(", "v", ".", "r", ".", "f", ",", "x", ".", "offset", ",", "v", ".", "Key", "(", "\"", "\"", ")", ".", "Int64", "(", ")", ")", "\n", "if", "v", ".", "r", ".", "key", "!=", "nil", "{", "rd", "=", "decryptStream", "(", "v", ".", "r", ".", "key", ",", "v", ".", "r", ".", "useAES", ",", "x", ".", "ptr", ",", "rd", ")", "\n", "}", "\n", "filter", ":=", "v", ".", "Key", "(", "\"", "\"", ")", "\n", "param", ":=", "v", ".", "Key", "(", "\"", "\"", ")", "\n", "switch", "filter", ".", "Kind", "(", ")", "{", "default", ":", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "filter", ")", ")", "\n", "case", "Null", ":", "// ok", "case", "Name", ":", "rd", "=", "applyFilter", "(", "rd", ",", "filter", ".", "<mask>", "(", ")", ",", "param", ")", "\n", "case", "Array", ":", "for", "i", ":=", "0", ";", "i", "<", "filter", ".", "Len", "(", ")", ";", "i", "++", "{", "rd", "=", "applyFilter", "(", "rd", ",", "filter", ".", "Index", "(", "i", ")", ".", "Name", "(", ")", ",", "param", ".", "Index", "(", "i", ")", ")", "\n", "}", "\n", "}", "\n\n", "return", "ioutil", ".", "NopCloser", "(", "rd", ")", "\n", "}" ]
5,079
all-5080
[ "EventScrollNewFromEvent", "returns", "an", "EventScroll", "from", "an", "Event", ".", "Using", "widget", ".", "Connect", "()", "for", "a", "key", "related", "signal", "such", "as", "button", "-", "press", "-", "event", "results", "in", "a", "*", "Event", "being", "passed", "as", "the", "callback", "s", "second", "argument", ".", "The", "argument", "is", "actually", "a", "*", "EventScroll", ".", "EventScrollNewFromEvent", "provides", "a", "means", "of", "creating", "an", "EventKey", "from", "the", "Event", "." ]
[ "func", "EventScrollNewFromEvent", "(", "event", "*", "Event", ")", "*", "EventScroll", "{", "ee", ":=", "(", "*", "C", ".", "GdkEvent", ")", "(", "unsafe", ".", "Pointer", "(", "<mask>", ".", "native", "(", ")", ")", ")", "\n", "ev", ":=", "Event", "{", "ee", "}", "\n", "return", "&", "EventScroll", "{", "&", "ev", "}", "\n", "}" ]
5,080
all-5081
[ "SetClockSeq", "sets", "the", "clock", "sequence", "to", "the", "lower", "14", "bits", "of", "seq", ".", "Setting", "to", "-", "1", "causes", "a", "new", "sequence", "to", "be", "generated", "." ]
[ "func", "SetClockSequence", "(", "seq", "int", ")", "{", "if", "seq", "==", "-", "1", "{", "<mask>", "b", "[", "2", "]", "byte", "\n", "randomBits", "(", "b", "[", ":", "]", ")", "// clock sequence", "\n", "seq", "=", "int", "(", "b", "[", "0", "]", ")", "<<", "8", "|", "int", "(", "b", "[", "1", "]", ")", "\n", "}", "\n", "old_seq", ":=", "clock_seq", "\n", "clock_seq", "=", "uint16", "(", "seq", "&", "0x3fff", ")", "|", "0x8000", "// Set our variant", "\n", "if", "old_seq", "!=", "clock_seq", "{", "lasttime", "=", "0", "\n", "}", "\n", "}" ]
5,081
all-5082
[ "NAME", "gh", "-", "user", "-", "Get", "URL", "for", "a", "given", "GitHub", "user", "login", "DESCRIPTION", "Given", "a", "GitHub", "user", "login", "call", "the", "GitHub", "API", "to", "get", "this", "user", "and", "print", "out", "the", "user", "page", "URL", ".", "For", "example", "$", "gotask", "git", "-", "hub", "-", "user", "jingweno", "OPTIONS", "--", "verbose", "-", "v", "run", "in", "verbose", "mode" ]
[ "func", "TaskGitHubUser", "(", "t", "*", "tasking", ".", "T", ")", "{", "if", "len", "(", "t", ".", "Args", ")", "==", "0", "{", "t", ".", "<mask>", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "login", ":=", "t", ".", "Args", "[", "0", "]", "\n", "data", ",", "err", ":=", "fetchGitHubUser", "(", "login", ")", "\n", "if", "err", "!=", "nil", "{", "t", ".", "Error", "(", "err", ")", "\n", "return", "\n", "}", "\n\n", "url", ",", "ok", ":=", "data", "[", "\"", "\"", "]", "\n", "if", "!", "ok", "{", "t", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "login", ")", "\n", "return", "\n", "}", "\n\n", "t", ".", "Logf", "(", "\"", "\\n", "\"", ",", "login", ",", "url", ")", "\n", "}" ]
5,082
all-5083
[ "elementsFromLine", "returns", "a", "list", "of", "elements", "each", "representing", "a", "single", "item", "which", "will", "belong", "to", "a", "column", "of", "output", "." ]
[ "func", "elementsFromLine", "(", "config", "*", "Config", ",", "line", "string", ")", "[", "]", "interface", "{", "}", "{", "separated", ":=", "strings", ".", "Split", "(", "line", ",", "config", ".", "Delim", ")", "\n", "elements", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "separated", ")", ")", "\n", "for", "i", ",", "field", ":=", "range", "separated", "{", "value", ":=", "field", "\n", "if", "!", "config", ".", "NoTrim", "{", "value", "=", "strings", ".", "TrimSpace", "(", "field", ")", "\n", "}", "\n\n", "// Apply the empty value, if configured.", "if", "<mask>", "==", "\"", "\"", "&&", "config", ".", "Empty", "!=", "\"", "\"", "{", "value", "=", "config", ".", "Empty", "\n", "}", "\n", "elements", "[", "i", "]", "=", "value", "\n", "}", "\n", "return", "elements", "\n", "}" ]
5,083
all-5084
[ "Operations", "returns", "all", "operations", "in", "the", "cluster", "filtered", "by", "the", "given", "clause", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "operations", "(", "where", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "[", "]", "Operation", ",", "error", ")", "{", "operations", ":=", "[", "]", "Operation", "{", "}", "\n", "dest", ":=", "func", "(", "i", "int", ")", "[", "]", "<mask>", "{", "}", "{", "operations", "=", "append", "(", "operations", ",", "Operation", "{", "}", ")", "\n", "return", "[", "]", "interface", "{", "}", "{", "&", "operations", "[", "i", "]", ".", "ID", ",", "&", "operations", "[", "i", "]", ".", "UUID", ",", "&", "operations", "[", "i", "]", ".", "NodeAddress", ",", "&", "operations", "[", "i", "]", ".", "Type", ",", "}", "\n", "}", "\n", "sql", ":=", "`\nSELECT operations.id, uuid, nodes.address, type FROM operations JOIN nodes ON nodes.id = node_id `", "\n", "if", "where", "!=", "\"", "\"", "{", "sql", "+=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "where", ")", "\n", "}", "\n", "sql", "+=", "\"", "\"", "\n", "stmt", ",", "err", ":=", "c", ".", "tx", ".", "Prepare", "(", "sql", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "stmt", ".", "Close", "(", ")", "\n", "err", "=", "query", ".", "SelectObjects", "(", "stmt", ",", "dest", ",", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "operations", ",", "nil", "\n", "}" ]
5,084
all-5085
[ "removeLegacyProto", "removes", "uses", "of", "the", "old", "proto", "rules", ".", "It", "deletes", "loads", "from", "go_proto_library", ".", "bzl", ".", "It", "deletes", "proto", "filegroups", ".", "It", "removes", "go_proto_library", "attributes", "which", "are", "no", "longer", "recognized", ".", "New", "rules", "are", "generated", "in", "place", "of", "the", "deleted", "rules", "but", "attributes", "and", "comments", "are", "not", "migrated", "." ]
[ "func", "removeLegacyProto", "(", "c", "*", "config", ".", "Config", ",", "f", "*", "rule", ".", "File", ")", "{", "// Don't fix if the proto mode was set to something other than the default.", "if", "pcMode", ":=", "getProtoMode", "(", "c", ")", ";", "pcMode", "!=", "proto", ".", "DefaultMode", "{", "return", "\n", "}", "\n\n", "// Scan for definitions to delete.", "var", "protoLoads", "[", "]", "*", "rule", ".", "Load", "\n", "for", "_", ",", "l", ":=", "range", "f", ".", "Loads", "{", "if", "l", ".", "Name", "(", ")", "==", "\"", "\"", "{", "protoLoads", "=", "append", "(", "protoLoads", ",", "l", ")", "\n", "}", "\n", "}", "\n", "var", "protoFilegroups", ",", "protoRules", "[", "]", "*", "rule", ".", "Rule", "\n", "for", "_", ",", "r", ":=", "range", "f", ".", "Rules", "{", "if", "r", ".", "Kind", "(", ")", "==", "\"", "\"", "&&", "r", ".", "Name", "(", ")", "==", "legacyProtoFilegroupName", "{", "protoFilegroups", "=", "append", "(", "protoFilegroups", ",", "r", ")", "\n", "}", "\n", "if", "r", ".", "Kind", "(", ")", "==", "\"", "\"", "{", "protoRules", "=", "append", "(", "protoRules", ",", "r", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "protoLoads", ")", "+", "len", "(", "protoFilegroups", ")", "==", "0", "{", "return", "\n", "}", "\n", "if", "!", "c", ".", "ShouldFix", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "f", ".", "Path", ")", "\n", "return", "\n", "}", "\n\n", "// Delete legacy proto loads and filegroups. Only delete go_proto_library", "// rules if we deleted a load.", "for", "_", ",", "l", ":=", "range", "protoLoads", "{", "l", ".", "Delete", "(", ")", "\n", "}", "\n", "for", "_", ",", "r", ":=", "range", "protoFilegroups", "{", "r", ".", "Delete", "(", ")", "\n", "}", "\n", "if", "len", "(", "protoLoads", ")", ">", "0", "{", "for", "_", ",", "r", ":=", "<mask>", "protoRules", "{", "r", ".", "Delete", "(", ")", "\n", "}", "\n", "}", "\n", "}" ]
5,085
all-5086
[ "timestamp", "returns", "the", "current", "UNIX", "timestamp", "in", "UTC", ".", "If", "an", "argument", "is", "specified", "it", "will", "be", "used", "to", "format", "the", "timestamp", "." ]
[ "func", "timestamp", "(", "s", "...", "string", ")", "(", "string", ",", "error", ")", "{", "switch", "len", "(", "s", ")", "{", "case", "0", ":", "return", "now", "(", ")", ".", "Format", "(", "time", ".", "RFC3339", ")", ",", "nil", "\n", "case", "1", ":", "if", "s", "[", "0", "]", "==", "\"", "\"", "{", "return", "strconv", ".", "FormatInt", "(", "<mask>", "(", ")", ".", "Unix", "(", ")", ",", "10", ")", ",", "nil", "\n", "}", "\n", "return", "now", "(", ")", ".", "Format", "(", "s", "[", "0", "]", ")", ",", "nil", "\n", "default", ":", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", "+", "\"", "\"", ",", "len", "(", "s", ")", ")", "\n", "}", "\n", "}" ]
5,086
all-5087
[ "UnmarshalEasyJSON", "sets", "the", "Date", "from", "a", "easyjson", ".", "Lexer" ]
[ "func", "(", "d", "*", "Date", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "if", "data", ":=", "in", ".", "<mask>", "(", ")", ";", "in", ".", "Ok", "(", ")", "{", "tt", ",", "err", ":=", "time", ".", "Parse", "(", "RFC3339FullDate", ",", "data", ")", "\n", "if", "err", "!=", "nil", "{", "in", ".", "AddError", "(", "err", ")", "\n", "return", "\n", "}", "\n", "*", "d", "=", "Date", "(", "tt", ")", "\n", "}", "\n", "}" ]
5,087
all-5088
[ "MustNewMaxTxSetSize", "retrieves", "the", "NewMaxTxSetSize", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "LedgerUpgrade", ")", "MustNewMaxTxSetSize", "(", ")", "Uint32", "{", "val", ",", "<mask>", ":=", "u", ".", "GetNewMaxTxSetSize", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
5,088
all-5089
[ "allJobNames", "returns", "a", "union", "of", "unique", "job", "names", "across", "both", "BOSH", "releases" ]
[ "func", "(", "d", "boshReleaseDiffer", ")", "allJobNames", "(", ")", "[", "]", "string", "{", "jobNamesMap", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "var", "addJobNames", "=", "func", "(", "br", "*", "release", ".", "BoshRelease", ")", "{", "if", "br", "!=", "nil", "{", "for", "jbname", ":=", "<mask>", "br", ".", "JobManifests", "{", "jobNamesMap", "[", "jbname", "]", "=", "jbname", "\n", "}", "\n", "}", "\n", "}", "\n", "addJobNames", "(", "d", ".", "release1", ")", "\n", "addJobNames", "(", "d", ".", "release2", ")", "\n", "var", "jobNames", "[", "]", "string", "\n", "for", "jname", ":=", "range", "jobNamesMap", "{", "jobNames", "=", "append", "(", "jobNames", ",", "jname", ")", "\n", "}", "\n", "return", "jobNames", "\n", "}" ]
5,089
all-5090
[ "fills", "all", "or", "part", "of", "a", "texture", "image", "with", "a", "constant", "value" ]
[ "func", "ClearTexSubImage", "(", "texture", "uint32", ",", "<mask>", "int32", ",", "xoffset", "int32", ",", "yoffset", "int32", ",", "zoffset", "int32", ",", "width", "int32", ",", "height", "int32", ",", "depth", "int32", ",", "format", "uint32", ",", "xtype", "uint32", ",", "data", "unsafe", ".", "Pointer", ")", "{", "C", ".", "glowClearTexSubImage", "(", "gpClearTexSubImage", ",", "(", "C", ".", "GLuint", ")", "(", "texture", ")", ",", "(", "C", ".", "GLint", ")", "(", "level", ")", ",", "(", "C", ".", "GLint", ")", "(", "xoffset", ")", ",", "(", "C", ".", "GLint", ")", "(", "yoffset", ")", ",", "(", "C", ".", "GLint", ")", "(", "zoffset", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "width", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "height", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "depth", ")", ",", "(", "C", ".", "GLenum", ")", "(", "format", ")", ",", "(", "C", ".", "GLenum", ")", "(", "xtype", ")", ",", "data", ")", "\n", "}" ]
5,090
all-5091
[ "MoveTiles", "moves", "tiles", "in", "the", "given", "tiles", "map", "if", "possible", ".", "MoveTiles", "returns", "true", "if", "there", "are", "tiles", "that", "are", "to", "move", "otherwise", "false", ".", "When", "MoveTiles", "is", "called", "all", "tiles", "must", "not", "be", "about", "to", "move", "." ]
[ "func", "MoveTiles", "(", "tiles", "map", "[", "*", "Tile", "]", "struct", "{", "}", ",", "size", "int", ",", "dir", "Dir", ")", "bool", "{", "vx", ",", "vy", ":=", "dir", ".", "Vector", "(", ")", "\n", "tx", ":=", "[", "]", "int", "{", "}", "\n", "ty", ":=", "[", "]", "int", "{", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "size", ";", "i", "++", "{", "tx", "=", "append", "(", "tx", ",", "i", ")", "\n", "ty", "=", "append", "(", "ty", ",", "i", ")", "\n", "}", "\n", "if", "vx", ">", "0", "{", "sort", ".", "Sort", "(", "sort", ".", "Reverse", "(", "sort", ".", "IntSlice", "(", "tx", ")", ")", ")", "\n", "}", "\n", "if", "vy", ">", "0", "{", "sort", ".", "Sort", "(", "sort", ".", "Reverse", "(", "sort", ".", "IntSlice", "(", "ty", ")", ")", ")", "\n", "}", "\n\n", "moved", ":=", "false", "\n", "for", "_", ",", "j", ":=", "range", "ty", "{", "for", "_", ",", "i", ":=", "range", "tx", "{", "t", ":=", "tileAt", "(", "tiles", ",", "i", ",", "j", ")", "\n", "if", "t", "==", "nil", "{", "continue", "\n", "}", "\n", "if", "t", ".", "next", "!=", "(", "TileData", "{", "}", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "t", ".", "IsMoving", "(", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "// (ii, jj) is the next position for tile t.", "// (ii, jj) is updated until a mergeable tile is found or", "// the tile t can't be moved any more.", "ii", ":=", "i", "\n", "jj", ":=", "j", "\n", "for", "{", "ni", ":=", "ii", "+", "vx", "\n", "nj", ":=", "jj", "+", "vy", "\n", "if", "ni", "<", "0", "||", "ni", ">=", "size", "||", "nj", "<", "0", "||", "nj", ">=", "size", "{", "<mask>", "\n", "}", "\n", "tt", ":=", "currentOrNextTileAt", "(", "tiles", ",", "ni", ",", "nj", ")", "\n", "if", "tt", "==", "nil", "{", "ii", "=", "ni", "\n", "jj", "=", "nj", "\n", "moved", "=", "true", "\n", "continue", "\n", "}", "\n", "if", "t", ".", "current", ".", "value", "!=", "tt", ".", "current", ".", "value", "{", "break", "\n", "}", "\n", "if", "0", "<", "tt", ".", "movingCount", "&&", "tt", ".", "current", ".", "value", "!=", "tt", ".", "next", ".", "value", "{", "// tt is already being merged with another tile.", "// Break here without updating (ii, jj).", "break", "\n", "}", "\n", "ii", "=", "ni", "\n", "jj", "=", "nj", "\n", "moved", "=", "true", "\n", "break", "\n", "}", "\n", "// next is the next state of the tile t.", "next", ":=", "TileData", "{", "}", "\n", "next", ".", "value", "=", "t", ".", "current", ".", "value", "\n", "// If there is a tile at the next position (ii, jj), this should be", "// mergeable. Let's merge.", "if", "tt", ":=", "currentOrNextTileAt", "(", "tiles", ",", "ii", ",", "jj", ")", ";", "tt", "!=", "t", "&&", "tt", "!=", "nil", "{", "next", ".", "value", "=", "t", ".", "current", ".", "value", "+", "tt", ".", "current", ".", "value", "\n", "tt", ".", "next", ".", "value", "=", "0", "\n", "tt", ".", "next", ".", "x", "=", "ii", "\n", "tt", ".", "next", ".", "y", "=", "jj", "\n", "tt", ".", "movingCount", "=", "maxMovingCount", "\n", "}", "\n", "next", ".", "x", "=", "ii", "\n", "next", ".", "y", "=", "jj", "\n", "if", "t", ".", "current", "!=", "next", "{", "t", ".", "next", "=", "next", "\n", "t", ".", "movingCount", "=", "maxMovingCount", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "!", "moved", "{", "for", "t", ":=", "range", "tiles", "{", "t", ".", "next", "=", "TileData", "{", "}", "\n", "t", ".", "movingCount", "=", "0", "\n", "}", "\n", "}", "\n", "return", "moved", "\n", "}" ]
5,091
all-5092
[ "AttachReader", "attaches", "a", "file", "using", "an", "io", ".", "Reader" ]
[ "func", "(", "m", "*", "Message", ")", "AttachReader", "(", "name", "string", ",", "r", "io", ".", "Reader", ",", "settings", "...", "FileSetting", ")", "{", "m", ".", "attachments", "=", "m", ".", "appendFile", "(", "m", ".", "attachments", ",", "fileFromReader", "(", "<mask>", ",", "r", ")", ",", "settings", ")", "\n", "}" ]
5,092
all-5093
[ "IsRootDiskDevice", "returns", "true", "if", "the", "given", "device", "representation", "is", "configured", "as", "root", "disk", "for", "a", "container", ".", "It", "typically", "get", "passed", "a", "specific", "entry", "of", "api", ".", "Container", ".", "Devices", "." ]
[ "func", "IsRootDiskDevice", "(", "<mask>", "map", "[", "string", "]", "string", ")", "bool", "{", "if", "device", "[", "\"", "\"", "]", "==", "\"", "\"", "&&", "device", "[", "\"", "\"", "]", "==", "\"", "\"", "&&", "device", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
5,093
all-5094
[ "/", "*", "Set", "the", "transaction", "type", "to", "OtherTransaction", ".", "This", "will", "automatically", "change", "the", "category", "to", "Custom", ".", "You", "can", "change", "the", "transaction", "category", "using", "newrelic_transaction_set_category", "." ]
[ "func", "TransactionSetTypeOther", "(", "<mask>", "int64", ")", "(", "int", ",", "error", ")", "{", "return", "errNo", "(", "C", ".", "newrelic_transaction_set_type_other", "(", "C", ".", "long", "(", "id", ")", ")", ")", "\n", "}" ]
5,094
all-5095
[ "SetWebsite", "is", "a", "wrapper", "around", "gtk_about_dialog_set_website", "()", "." ]
[ "func", "(", "v", "*", "AboutDialog", ")", "SetWebsite", "(", "website", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "website", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_about_dialog_set_website", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
5,095
all-5096
[ "handleCommand", "is", "used", "to", "decode", "and", "dispatch", "a", "single", "command", "." ]
[ "func", "(", "n", "*", "NetworkTransport", ")", "handleCommand", "(", "r", "*", "bufio", ".", "Reader", ",", "dec", "*", "codec", ".", "Decoder", ",", "enc", "*", "codec", ".", "Encoder", ")", "error", "{", "// Get the rpc type", "rpcType", ",", "err", ":=", "r", ".", "ReadByte", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Create the RPC object", "respCh", ":=", "make", "(", "chan", "RPCResponse", ",", "1", ")", "\n", "rpc", ":=", "RPC", "{", "RespChan", ":", "respCh", ",", "}", "\n\n", "// Decode the command", "isHeartbeat", ":=", "false", "\n", "switch", "rpcType", "{", "case", "rpcAppendEntries", ":", "var", "req", "AppendEntriesRequest", "\n", "if", "err", ":=", "dec", ".", "Decode", "(", "&", "req", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "rpc", ".", "Command", "=", "&", "req", "\n\n", "// Check if this is a heartbeat", "if", "req", ".", "Term", "!=", "0", "&&", "req", ".", "Leader", "!=", "nil", "&&", "req", ".", "PrevLogEntry", "==", "0", "&&", "req", ".", "PrevLogTerm", "==", "0", "&&", "len", "(", "req", ".", "Entries", ")", "==", "0", "&&", "req", ".", "LeaderCommitIndex", "==", "0", "{", "isHeartbeat", "=", "true", "\n", "}", "\n\n", "case", "rpcRequestVote", ":", "var", "req", "RequestVoteRequest", "\n", "if", "err", ":=", "dec", ".", "Decode", "(", "&", "req", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "rpc", ".", "Command", "=", "&", "req", "\n\n", "<mask>", "rpcInstallSnapshot", ":", "var", "req", "InstallSnapshotRequest", "\n", "if", "err", ":=", "dec", ".", "Decode", "(", "&", "req", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "rpc", ".", "Command", "=", "&", "req", "\n", "rpc", ".", "Reader", "=", "io", ".", "LimitReader", "(", "r", ",", "req", ".", "Size", ")", "\n\n", "default", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "rpcType", ")", "\n", "}", "\n\n", "// Check for heartbeat fast-path", "if", "isHeartbeat", "{", "n", ".", "heartbeatFnLock", ".", "Lock", "(", ")", "\n", "fn", ":=", "n", ".", "heartbeatFn", "\n", "n", ".", "heartbeatFnLock", ".", "Unlock", "(", ")", "\n", "if", "fn", "!=", "nil", "{", "fn", "(", "rpc", ")", "\n", "goto", "RESP", "\n", "}", "\n", "}", "\n\n", "// Dispatch the RPC", "select", "{", "case", "n", ".", "consumeCh", "<-", "rpc", ":", "case", "<-", "n", ".", "shutdownCh", ":", "return", "ErrTransportShutdown", "\n", "}", "\n\n", "// Wait for response", "RESP", ":", "select", "{", "case", "resp", ":=", "<-", "respCh", ":", "// Send the error first", "respErr", ":=", "\"", "\"", "\n", "if", "resp", ".", "Error", "!=", "nil", "{", "respErr", "=", "resp", ".", "Error", ".", "Error", "(", ")", "\n", "}", "\n", "if", "err", ":=", "enc", ".", "Encode", "(", "respErr", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Send the response", "if", "err", ":=", "enc", ".", "Encode", "(", "resp", ".", "Response", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "case", "<-", "n", ".", "shutdownCh", ":", "return", "ErrTransportShutdown", "\n", "}", "\n", "return", "nil", "\n", "}" ]
5,096
all-5097
[ "Claim", "pending", "task", "(", "s", ")", "for", "the", "given", "provisionerId", "/", "workerType", "queue", ".", "If", "any", "work", "is", "available", "(", "even", "if", "fewer", "than", "the", "requested", "number", "of", "tasks", "this", "will", "return", "immediately", ".", "Otherwise", "it", "will", "block", "for", "tens", "of", "seconds", "waiting", "for", "work", ".", "If", "no", "work", "appears", "it", "will", "return", "an", "emtpy", "list", "of", "tasks", ".", "Callers", "should", "sleep", "a", "short", "while", "(", "to", "avoid", "denial", "of", "service", "in", "an", "error", "condition", ")", "and", "call", "the", "endpoint", "again", ".", "This", "is", "a", "simple", "implementation", "of", "long", "polling", ".", "Required", "scopes", ":", "All", "of", ":", "*", "queue", ":", "claim", "-", "work", ":", "<provisionerId", ">", "/", "<workerType", ">", "*", "queue", ":", "worker", "-", "id", ":", "<workerGroup", ">", "/", "<workerId", ">", "See", "#claimWork" ]
[ "func", "(", "queue", "*", "Queue", ")", "ClaimWork", "(", "provisionerId", ",", "workerType", "string", ",", "payload", "*", "ClaimWorkRequest", ")", "(", "*", "ClaimWorkResponse", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "<mask>", "(", "*", "queue", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "payload", ",", "\"", "\"", ",", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "provisionerId", ")", "+", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "workerType", ")", ",", "new", "(", "ClaimWorkResponse", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "ClaimWorkResponse", ")", ",", "err", "\n", "}" ]
5,097
all-5098
[ "Apply", "satisfies", "the", "StartSpanOption", "interface", "." ]
[ "func", "(", "r", "SpanReference", ")", "Apply", "(", "o", "*", "StartSpanOptions", ")", "{", "if", "r", ".", "ReferencedContext", "!=", "nil", "{", "o", ".", "References", "=", "<mask>", "(", "o", ".", "References", ",", "r", ")", "\n", "}", "\n", "}" ]
5,098
all-5099
[ "GetName", "returns", "the", "Name", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "s", "*", "SyntheticsTest", ")", "GetName", "(", ")", "string", "{", "if", "s", "==", "nil", "||", "s", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "s", ".", "Name", "\n", "}" ]
5,099
all-5100
[ "specify", "the", "organization", "of", "vertex", "arrays" ]
[ "func", "VertexAttribFormat", "(", "attribindex", "uint32", ",", "<mask>", "int32", ",", "xtype", "uint32", ",", "normalized", "bool", ",", "relativeoffset", "uint32", ")", "{", "syscall", ".", "Syscall6", "(", "gpVertexAttribFormat", ",", "5", ",", "uintptr", "(", "attribindex", ")", ",", "uintptr", "(", "size", ")", ",", "uintptr", "(", "xtype", ")", ",", "boolToUintptr", "(", "normalized", ")", ",", "uintptr", "(", "relativeoffset", ")", ",", "0", ")", "\n", "}" ]