id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
1,900
all-1901
[ "TaskContainerMetadataHandler", "creates", "response", "for", "the", "v1", "/", "tasks", "API", ".", "Lists", "all", "tasks", "if", "the", "request", "doesn", "t", "contain", "any", "fields", ".", "Returns", "a", "Task", "if", "either", "of", "dockerid", "or", "taskarn", "are", "specified", "in", "the", "request", "." ]
[ "func", "TaskContainerMetadataHandler", "(", "taskEngine", "utils", ".", "DockerStateResolver", ")", "func", "(", "http", ".", "ResponseWriter", ",", "*", "http", ".", "Request", ")", "{", "return", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "var", "responseJSON", "[", "]", "byte", "\n", "dockerTaskEngineState", ":=", "taskEngine", ".", "State", "(", ")", "\n", "dockerID", ",", "dockerIDExists", ":=", "utils", ".", "ValueFromRequest", "(", "r", ",", "dockerIDQueryField", ")", "\n", "taskArn", ",", "taskARNExists", ":=", "utils", ".", "ValueFromRequest", "(", "r", ",", "taskARNQueryField", ")", "\n", "var", "status", "int", "\n", "if", "dockerIDExists", "&&", "taskARNExists", "{", "seelog", ".", "Info", "(", "\"", "\"", ",", "dockerIDQueryField", ",", "\"", "\"", ",", "taskARNQueryField", ",", "\"", "\"", ")", "\n", "w", ".", "WriteHeader", "(", "http", ".", "StatusBadRequest", ")", "\n", "w", ".", "Write", "(", "responseJSON", ")", "\n", "return", "\n", "}", "\n", "if", "dockerIDExists", "{", "// Create TaskResponse for the docker id in the query.", "var", "task", "*", "apitask", ".", "Task", "\n", "var", "found", "bool", "\n", "if", "len", "(", "dockerID", ")", ">", "dockerShortIDLen", "{", "task", ",", "found", "=", "dockerTaskEngineState", ".", "TaskByID", "(", "dockerID", ")", "\n", "}", "else", "{", "tasks", ",", "_", ":=", "dockerTaskEngineState", ".", "TaskByShortID", "(", "dockerID", ")", "\n", "if", "len", "(", "tasks", ")", "==", "0", "{", "task", "=", "nil", "\n", "found", "=", "false", "\n", "}", "else", "if", "len", "(", "tasks", ")", "==", "1", "{", "task", "=", "tasks", "[", "0", "]", "\n", "found", "=", "true", "\n", "}", "else", "{", "seelog", ".", "Info", "(", "\"", "\"", "+", "dockerID", ")", "\n", "w", ".", "WriteHeader", "(", "http", ".", "StatusBadRequest", ")", "\n", "w", ".", "Write", "(", "responseJSON", ")", "\n", "return", "\n", "}", "\n", "}", "\n", "responseJSON", ",", "status", "=", "createTaskResponse", "(", "task", ",", "found", ",", "dockerID", ",", "dockerTaskEngineState", ")", "\n", "w", ".", "WriteHeader", "(", "<mask>", ")", "\n", "}", "else", "if", "taskARNExists", "{", "// Create TaskResponse for the task arn in the query.", "task", ",", "found", ":=", "dockerTaskEngineState", ".", "TaskByArn", "(", "taskArn", ")", "\n", "responseJSON", ",", "status", "=", "createTaskResponse", "(", "task", ",", "found", ",", "taskArn", ",", "dockerTaskEngineState", ")", "\n", "w", ".", "WriteHeader", "(", "status", ")", "\n", "}", "else", "{", "// List all tasks.", "responseJSON", ",", "_", "=", "json", ".", "Marshal", "(", "NewTasksResponse", "(", "dockerTaskEngineState", ")", ")", "\n", "}", "\n", "w", ".", "Write", "(", "responseJSON", ")", "\n", "}", "\n", "}" ]
1,901
all-1902
[ "recoverAndclean", "function", "help", "to", "do", "recovery", ".", "Two", "things", "need", "to", "be", "done", ":", "1", ".", "recovery", "structure", ";", "2", ".", "delete", "expired", "nodes", "If", "the", "node", "is", "a", "directory", "it", "will", "help", "recover", "children", "s", "parent", "pointer", "and", "recursively", "call", "this", "function", "on", "its", "children", ".", "We", "check", "the", "expire", "last", "since", "we", "need", "to", "recover", "the", "whole", "structure", "first", "and", "add", "all", "the", "notifications", "into", "the", "event", "history", "." ]
[ "func", "(", "n", "*", "node", ")", "recoverAndclean", "(", ")", "{", "if", "n", ".", "IsDir", "(", ")", "{", "for", "_", ",", "child", ":=", "range", "n", ".", "Children", "{", "<mask>", ".", "Parent", "=", "n", "\n", "child", ".", "store", "=", "n", ".", "store", "\n", "child", ".", "recoverAndclean", "(", ")", "\n", "}", "\n", "}", "\n\n", "if", "!", "n", ".", "ExpireTime", ".", "IsZero", "(", ")", "{", "n", ".", "store", ".", "ttlKeyHeap", ".", "push", "(", "n", ")", "\n", "}", "\n", "}" ]
1,902
all-1903
[ "TODO", ":", "fix", "index", "creation", "indexes", "are", "not", "created", "properly" ]
[ "func", "(", "rs", "RethinkStore", ")", "CreateTable", "(", "store", "string", ",", "schema", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "logger", ".", "Info", "(", "\"", "\"", "+", "<mask>", ")", "\n", "var", "res", "[", "]", "interface", "{", "}", "\n", "_", "=", "r", ".", "DB", "(", "rs", ".", "Database", ")", ".", "TableCreate", "(", "store", ")", ".", "Exec", "(", "rs", ".", "Session", ")", "\n", "// if err != nil{", "// \t// logger.Warn(\"unable to create table \", \"table\", store)", "//", "// }", "result", ",", "err", ":=", "r", ".", "DB", "(", "rs", ".", "Database", ")", ".", "Table", "(", "store", ")", ".", "IndexList", "(", ")", ".", "Run", "(", "rs", ".", "Session", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "if", "result", ".", "Err", "(", ")", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "result", ".", "All", "(", "&", "res", ")", "\n", "logger", ".", "Debug", "(", "store", "+", "\"", "\"", ",", "res", ")", "\n", "//also create indexes", "if", "schema", "!=", "nil", "{", "s", ":=", "schema", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "if", "indexes", ",", "ok", ":=", "s", "[", "\"", "\"", "]", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", ";", "ok", "{", "for", "name", ",", "_vals", ":=", "range", "indexes", "{", "if", "!", "hasIndex", "(", "name", ",", "res", ")", "{", "logger", ".", "Info", "(", "\"", "\"", ",", "\"", "\"", ",", "name", ",", "\"", "\"", ",", "_vals", ")", "\n", "if", "vals", ",", "ok", ":=", "_vals", ".", "(", "[", "]", "interface", "{", "}", ")", ";", "ok", "&&", "len", "(", "vals", ")", ">", "0", "{", "logger", ".", "Info", "(", "\"", "\"", ",", "\"", "\"", ",", "name", ",", "\"", "\"", ",", "vals", ")", "\n", "if", "_", ",", "err", "=", "r", ".", "DB", "(", "rs", ".", "Database", ")", ".", "Table", "(", "store", ")", ".", "IndexCreateFunc", "(", "name", ",", "func", "(", "row", "r", ".", "Term", ")", "interface", "{", "}", "{", "index_fields", ":=", "[", "]", "interface", "{", "}", "{", "}", "\n", "for", "_", ",", "v", ":=", "range", "vals", "{", "index_fields", "=", "append", "(", "index_fields", ",", "row", ".", "Field", "(", "v", ".", "(", "string", ")", ")", ")", "\n", "}", "\n", "return", "index_fields", "\n", "}", ")", ".", "RunWrite", "(", "rs", ".", "Session", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "}", "else", "{", "logger", ".", "Info", "(", "\"", "\"", ",", "\"", "\"", ",", "name", ")", "\n", "if", "err", "=", "r", ".", "DB", "(", "rs", ".", "Database", ")", ".", "Table", "(", "store", ")", ".", "IndexCreate", "(", "name", ")", ".", "Exec", "(", "rs", ".", "Session", ")", ";", "err", "!=", "nil", "{", "// logger.Warn(\"cannot create index [\" + name + \"] in \" + store)", "// logger.Warn(\"cannot create index\")", "println", "(", "err", ".", "Error", "(", ")", ")", "\n\n", "}", "else", "{", "if", "err", "=", "r", ".", "DB", "(", "rs", ".", "Database", ")", ".", "Table", "(", "store", ")", ".", "IndexWait", "(", "name", ")", ".", "Exec", "(", "rs", ".", "Session", ")", ";", "err", "==", "nil", "{", "logger", ".", "Info", "(", "\"", "\"", "+", "name", "+", "\"", "\"", "+", "store", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "\n", "}" ]
1,903
all-1904
[ "WithBody", "a", "response", "body", "." ]
[ "func", "(", "p", "FulfillRequestParams", ")", "WithBody", "(", "<mask>", "string", ")", "*", "FulfillRequestParams", "{", "p", ".", "Body", "=", "body", "\n", "return", "&", "p", "\n", "}" ]
1,904
all-1905
[ "removeLegacyGazelle", "removes", "loads", "of", "the", "gazelle", "macro", "from" ]
[ "func", "removeLegacyGazelle", "(", "c", "*", "config", ".", "Config", ",", "f", "*", "rule", ".", "<mask>", ")", "{", "for", "_", ",", "l", ":=", "range", "f", ".", "Loads", "{", "if", "l", ".", "Name", "(", ")", "==", "\"", "\"", "&&", "l", ".", "Has", "(", "\"", "\"", ")", "{", "l", ".", "Remove", "(", "\"", "\"", ")", "\n", "if", "l", ".", "IsEmpty", "(", ")", "{", "l", ".", "Delete", "(", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
1,905
all-1906
[ "Stability", ":", "***", "EXPERIMENTAL", "***", "Given", "an", "OIDC", "access_token", "from", "a", "trusted", "OpenID", "provider", "return", "a", "set", "of", "Taskcluster", "credentials", "for", "use", "on", "behalf", "of", "the", "identified", "user", ".", "This", "method", "is", "typically", "not", "called", "with", "a", "Taskcluster", "client", "library", "and", "does", "not", "accept", "Hawk", "credentials", ".", "The", "access_token", "should", "be", "given", "in", "an", "Authorization", "header", ":", "Authorization", ":", "Bearer", "abc", ".", "xyz", "The", "access_token", "is", "first", "verified", "against", "the", "named", ":", "provider", "then", "passed", "to", "the", "provider", "s", "APIBuilder", "to", "retrieve", "a", "user", "profile", ".", "That", "profile", "is", "then", "used", "to", "generate", "Taskcluster", "credentials", "appropriate", "to", "the", "user", ".", "Note", "that", "the", "resulting", "credentials", "may", "or", "may", "not", "include", "a", "certificate", "property", ".", "Callers", "should", "be", "prepared", "for", "either", "alternative", ".", "The", "given", "credentials", "will", "expire", "in", "a", "relatively", "short", "time", ".", "Callers", "should", "monitor", "this", "expiration", "and", "refresh", "the", "credentials", "if", "necessary", "by", "calling", "this", "endpoint", "again", "if", "they", "have", "expired", ".", "See", "#oidcCredentials" ]
[ "func", "(", "login", "*", "Login", ")", "OidcCredentials", "(", "provider", "string", ")", "(", "*", "CredentialsResponse", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "<mask>", "(", "*", "login", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "provider", ")", ",", "new", "(", "CredentialsResponse", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "CredentialsResponse", ")", ",", "err", "\n", "}" ]
1,906
all-1907
[ "GetTickEdgeOk", "returns", "a", "tuple", "with", "the", "TickEdge", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetTickEdgeOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "TickEdge", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "w", ".", "TickEdge", ",", "true", "\n", "}" ]
1,907
all-1908
[ "/", "*", "Record", "the", "current", "amount", "of", "memory", "being", "used", "." ]
[ "func", "RecordMemoryUsage", "(", "memMB", "float64", ")", "(", "int", ",", "error", ")", "{", "<mask>", "errNo", "(", "C", ".", "newrelic_record_memory_usage", "(", "C", ".", "double", "(", "memMB", ")", ")", ")", "\n", "}" ]
1,908
all-1909
[ "WithPrefix", "enables", "Get", "Delete", "or", "Watch", "requests", "to", "operate", "on", "the", "keys", "with", "matching", "prefix", ".", "For", "example", "Get", "(", "foo", "WithPrefix", "()", ")", "can", "return", "foo1", "foo2", "and", "so", "on", "." ]
[ "func", "WithPrefix", "(", ")", "OpOption", "{", "return", "func", "(", "op", "*", "Op", ")", "{", "if", "len", "(", "op", ".", "key", ")", "==", "0", "{", "op", ".", "key", ",", "op", ".", "end", "=", "[", "]", "byte", "{", "0", "}", ",", "[", "]", "byte", "{", "0", "}", "\n", "return", "\n", "}", "\n", "op", ".", "end", "=", "getPrefix", "(", "op", ".", "<mask>", ")", "\n", "}", "\n", "}" ]
1,909
all-1910
[ "newImageDestination", "returns", "a", "types", ".", "ImageDestination", "for", "the", "specified", "image", "reference", "." ]
[ "func", "newImageDestination", "(", "ctx", "context", ".", "<mask>", ",", "sys", "*", "types", ".", "SystemContext", ",", "ref", "daemonReference", ")", "(", "types", ".", "ImageDestination", ",", "error", ")", "{", "if", "ref", ".", "ref", "==", "nil", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "ref", ".", "StringWithinTransport", "(", ")", ")", "\n", "}", "\n", "namedTaggedRef", ",", "ok", ":=", "ref", ".", "ref", ".", "(", "reference", ".", "NamedTagged", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "ref", ".", "StringWithinTransport", "(", ")", ")", "\n", "}", "\n\n", "var", "mustMatchRuntimeOS", "=", "true", "\n", "if", "sys", "!=", "nil", "&&", "sys", ".", "DockerDaemonHost", "!=", "client", ".", "DefaultDockerHost", "{", "mustMatchRuntimeOS", "=", "false", "\n", "}", "\n\n", "c", ",", "err", ":=", "newDockerClient", "(", "sys", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "reader", ",", "writer", ":=", "io", ".", "Pipe", "(", ")", "\n", "// Commit() may never be called, so we may never read from this channel; so, make this buffered to allow imageLoadGoroutine to write status and terminate even if we never read it.", "statusChannel", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n\n", "goroutineContext", ",", "goroutineCancel", ":=", "context", ".", "WithCancel", "(", "ctx", ")", "\n", "go", "imageLoadGoroutine", "(", "goroutineContext", ",", "c", ",", "reader", ",", "statusChannel", ")", "\n\n", "return", "&", "daemonImageDestination", "{", "ref", ":", "ref", ",", "mustMatchRuntimeOS", ":", "mustMatchRuntimeOS", ",", "Destination", ":", "tarfile", ".", "NewDestination", "(", "writer", ",", "namedTaggedRef", ")", ",", "goroutineCancel", ":", "goroutineCancel", ",", "statusChannel", ":", "statusChannel", ",", "writer", ":", "writer", ",", "committed", ":", "false", ",", "}", ",", "nil", "\n", "}" ]
1,910
all-1911
[ "SetInputHints", "()", "is", "a", "wrapper", "around", "gtk_entry_set_input_hints", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetInputHints", "(", "hints", "InputHints", ")", "{", "C", ".", "gtk_entry_set_input_hints", "(", "v", ".", "native", "(", ")", ",", "C", ".", "GtkInputHints", "(", "hints", ")", ")", "\n", "}" ]
1,911
all-1912
[ "NewBackendQuota", "creates", "a", "quota", "layer", "with", "the", "given", "storage", "limit", "." ]
[ "func", "NewBackendQuota", "(", "s", "*", "EtcdServer", ",", "name", "string", ")", "Quota", "{", "lg", ":=", "s", ".", "getLogger", "(", ")", "\n", "quotaBackendBytes", ".", "Set", "(", "float64", "(", "s", ".", "Cfg", ".", "QuotaBackendBytes", ")", ")", "\n\n", "if", "s", ".", "Cfg", ".", "QuotaBackendBytes", "<", "0", "{", "// disable quotas if negative", "quotaLogOnce", ".", "Do", "(", "func", "(", ")", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "name", ")", ",", "zap", ".", "Int64", "(", "\"", "\"", ",", "s", ".", "Cfg", ".", "QuotaBackendBytes", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Warningf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", ")", "\n", "return", "&", "passthroughQuota", "{", "}", "\n", "}", "\n\n", "if", "s", ".", "Cfg", ".", "QuotaBackendBytes", "==", "0", "{", "// use default size if no quota size given", "quotaLogOnce", ".", "Do", "(", "func", "(", ")", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "name", ")", ",", "zap", ".", "Int64", "(", "\"", "\"", ",", "DefaultQuotaBytes", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "DefaultQuotaSize", ")", ",", ")", "\n", "}", "\n", "}", ")", "\n", "quotaBackendBytes", ".", "Set", "(", "float64", "(", "DefaultQuotaBytes", ")", ")", "\n", "return", "&", "backendQuota", "{", "s", ",", "DefaultQuotaBytes", "}", "\n", "}", "\n\n", "quotaLogOnce", ".", "Do", "(", "func", "(", ")", "{", "if", "s", ".", "Cfg", ".", "QuotaBackendBytes", ">", "MaxQuotaBytes", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "<mask>", "(", "\"", "\"", ",", "name", ")", ",", "zap", ".", "Int64", "(", "\"", "\"", ",", "s", ".", "Cfg", ".", "QuotaBackendBytes", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "humanize", ".", "Bytes", "(", "uint64", "(", "s", ".", "Cfg", ".", "QuotaBackendBytes", ")", ")", ")", ",", "zap", ".", "Int64", "(", "\"", "\"", ",", "MaxQuotaBytes", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "maxQuotaSize", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Warningf", "(", "\"", "\"", ",", "s", ".", "Cfg", ".", "QuotaBackendBytes", ",", "MaxQuotaBytes", ")", "\n", "}", "\n", "}", "\n", "if", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "name", ")", ",", "zap", ".", "Int64", "(", "\"", "\"", ",", "s", ".", "Cfg", ".", "QuotaBackendBytes", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "humanize", ".", "Bytes", "(", "uint64", "(", "s", ".", "Cfg", ".", "QuotaBackendBytes", ")", ")", ")", ",", ")", "\n", "}", "\n", "}", ")", "\n", "return", "&", "backendQuota", "{", "s", ",", "s", ".", "Cfg", ".", "QuotaBackendBytes", "}", "\n", "}" ]
1,912
all-1913
[ "Render", "the", "provided", "Data", "to", "the", "provider", "Writer", "using", "the", "RendererFunc", "provide", "." ]
[ "func", "(", "s", "funcRenderer", ")", "Render", "(", "w", "io", ".", "Writer", ",", "data", "Data", ")", "error", "{", "return", "s", ".", "renderFunc", "(", "w", ",", "<mask>", ")", "\n", "}" ]
1,913
all-1914
[ "CloseResultsetID", "releases", "the", "hdb", "resultset", "handle", "." ]
[ "func", "(", "s", "*", "<mask>", ")", "CloseResultsetID", "(", "id", "uint64", ")", "error", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "s", ".", "resultsetID", ".", "id", "=", "&", "id", "\n", "if", "err", ":=", "s", ".", "writeRequest", "(", "mtCloseResultset", ",", "false", ",", "s", ".", "resultsetID", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "s", ".", "readReply", "(", "nil", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
1,914
all-1915
[ "GetProgressFraction", "()", "is", "a", "wrapper", "around", "gtk_entry_get_progress_fraction", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetProgressFraction", "(", ")", "float64", "{", "c", ":=", "C", ".", "gtk_entry_get_progress_fraction", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
1,915
all-1916
[ "NewDefragCommand", "returns", "the", "cobra", "command", "for", "Defrag", "." ]
[ "func", "NewDefragCommand", "(", ")", "*", "cobra", ".", "Command", "{", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Run", ":", "defragCommandFunc", ",", "}", "\n", "cmd", ".", "PersistentFlags", "(", ")", ".", "BoolVar", "(", "&", "epClusterEndpoints", ",", "\"", "\"", ",", "<mask>", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "StringVar", "(", "&", "defragDataDir", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "cmd", "\n", "}" ]
1,916
all-1917
[ "GetSession", "get", "session" ]
[ "func", "(", "ctx", "*", "Context", ")", "GetSession", "(", ")", "IStore", "{", "<mask>", ":=", "ctx", ".", "Data", "[", "\"", "\"", "]", "\n", "if", "store", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "st", ",", "ok", ":=", "store", ".", "(", "IStore", ")", "\n", "if", "ok", "==", "false", "{", "return", "nil", "\n", "}", "\n", "return", "st", "\n", "}" ]
1,917
all-1918
[ "collides", "returns", "a", "boolean", "value", "indicating", "whether", "the", "piece", "at", "(", "x", "y", ")", "with", "the", "given", "angle", "would", "collide", "with", "the", "field", "s", "blocks", "." ]
[ "func", "(", "p", "*", "Piece", ")", "collides", "(", "<mask>", "*", "Field", ",", "x", ",", "y", "int", ",", "angle", "Angle", ")", "bool", "{", "size", ":=", "len", "(", "p", ".", "blocks", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "size", ";", "i", "++", "{", "for", "j", ":=", "0", ";", "j", "<", "size", ";", "j", "++", "{", "if", "field", ".", "IsBlocked", "(", "x", "+", "i", ",", "y", "+", "j", ")", "&&", "p", ".", "isBlocked", "(", "i", ",", "j", ",", "angle", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
1,918
all-1919
[ "GetMin", "returns", "the", "Min", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "WidgetAxis", ")", "GetMin", "(", ")", "<mask>", "{", "if", "w", "==", "nil", "||", "w", ".", "Min", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "w", ".", "Min", "\n", "}" ]
1,919
all-1920
[ "NewPFSInput", "returns", "a", "new", "PFS", "input", ".", "It", "only", "includes", "required", "options", "." ]
[ "func", "NewPFSInput", "(", "repo", "string", ",", "glob", "string", ")", "*", "pps", ".", "Input", "{", "return", "&", "pps", ".", "<mask>", "{", "Pfs", ":", "&", "pps", ".", "PFSInput", "{", "Repo", ":", "repo", ",", "Glob", ":", "glob", ",", "}", ",", "}", "\n", "}" ]
1,920
all-1921
[ "NewDiskSubresource", "returns", "a", "subresource", "populated", "with", "all", "of", "the", "necessary", "fields", "." ]
[ "func", "NewDiskSubresource", "(", "client", "*", "govmomi", ".", "<mask>", ",", "rdd", "resourceDataDiff", ",", "d", ",", "old", "map", "[", "string", "]", "interface", "{", "}", ",", "idx", "int", ")", "*", "DiskSubresource", "{", "sr", ":=", "&", "DiskSubresource", "{", "Subresource", ":", "&", "Subresource", "{", "schema", ":", "DiskSubresourceSchema", "(", ")", ",", "client", ":", "client", ",", "srtype", ":", "subresourceTypeDisk", ",", "data", ":", "d", ",", "olddata", ":", "old", ",", "rdd", ":", "rdd", ",", "}", ",", "}", "\n", "sr", ".", "Index", "=", "idx", "\n", "return", "sr", "\n", "}" ]
1,921
all-1922
[ "NewMysqlDump", "-", "will", "initialize", "a", "mysqldump", "for", "local", "execution" ]
[ "func", "NewMysqlDump", "(", "<mask>", ",", "username", ",", "password", "string", ")", "*", "MysqlDump", "{", "lo", ".", "G", ".", "Debug", "(", "\"", "\"", ")", "\n", "m", ":=", "&", "MysqlDump", "{", "IP", ":", "ip", ",", "Username", ":", "username", ",", "Password", ":", "password", ",", "Caller", ":", "command", ".", "NewLocalExecuter", "(", ")", ",", "}", "\n", "return", "m", "\n", "}" ]
1,922
all-1923
[ "UnmarshalYAML", "implements", "Unmarshaler", ".", "Avoid", "use", "of", "env", "in", "the", "YAML", "file", "." ]
[ "func", "(", "m", "*", "Environment", ")", "UnmarshalYAML", "(", "unmarshal", "func", "(", "interface", "{", "}", ")", "error", ")", "error", "{", "var", "aux", "struct", "{", "Env", "map", "[", "string", "]", "struct", "{", "Config", "`yaml:\"mongo\"`", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "unmarshal", "(", "&", "aux", ".", "Env", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "m", ".", "Env", "=", "make", "(", "<mask>", "[", "string", "]", "Config", ")", "\n", "for", "env", ",", "conf", ":=", "range", "aux", ".", "Env", "{", "m", ".", "Env", "[", "env", "]", "=", "conf", ".", "Config", "\n", "}", "\n", "return", "nil", "\n", "}" ]
1,923
all-1924
[ "Layout", "set", "layout", "for", "template", "." ]
[ "func", "(", "render", "*", "Render", ")", "Layout", "(", "name", "string", ")", "*", "Template", "{", "return", "&", "Template", "{", "render", ":", "render", ",", "<mask>", ":", "name", "}", "\n", "}" ]
1,924
all-1925
[ "FormSessionKey", "is", "used", "during", "encrypted", "protocol", "introduction", "." ]
[ "func", "formSessionKey", "(", "remotePublicKey", ",", "localPrivateKey", "*", "[", "32", "]", "byte", ",", "secretKey", "[", "]", "byte", ")", "*", "[", "32", "]", "byte", "{", "<mask>", "sharedKey", "[", "32", "]", "byte", "\n", "box", ".", "Precompute", "(", "&", "sharedKey", ",", "remotePublicKey", ",", "localPrivateKey", ")", "\n", "sharedKeySlice", ":=", "sharedKey", "[", ":", "]", "\n", "sharedKeySlice", "=", "append", "(", "sharedKeySlice", ",", "secretKey", "...", ")", "\n", "sessionKey", ":=", "sha256", ".", "Sum256", "(", "sharedKeySlice", ")", "\n", "return", "&", "sessionKey", "\n", "}" ]
1,925
all-1926
[ "Stat", "sends", "pubsub", "receiver", "s", "internal", "stats", "to", "specified", "callback" ]
[ "func", "(", "rcv", "*", "PubSub", ")", "Stat", "(", "<mask>", "helper", ".", "StatCallback", ")", "{", "messagesReceived", ":=", "atomic", ".", "LoadUint32", "(", "&", "rcv", ".", "messagesReceived", ")", "\n", "send", "(", "\"", "\"", ",", "float64", "(", "messagesReceived", ")", ")", "\n\n", "metricsReceived", ":=", "atomic", ".", "LoadUint32", "(", "&", "rcv", ".", "metricsReceived", ")", "\n", "send", "(", "\"", "\"", ",", "float64", "(", "metricsReceived", ")", ")", "\n\n", "errors", ":=", "atomic", ".", "LoadUint32", "(", "&", "rcv", ".", "errors", ")", "\n", "send", "(", "\"", "\"", ",", "float64", "(", "errors", ")", ")", "\n\n", "if", "!", "rcv", ".", "statsAsCounters", "{", "atomic", ".", "AddUint32", "(", "&", "rcv", ".", "messagesReceived", ",", "-", "messagesReceived", ")", "\n", "atomic", ".", "AddUint32", "(", "&", "rcv", ".", "metricsReceived", ",", "-", "metricsReceived", ")", "\n", "atomic", ".", "AddUint32", "(", "&", "rcv", ".", "errors", ",", "-", "errors", ")", "\n", "}", "\n", "}" ]
1,926
all-1927
[ "resourceVSphereDatastoreClusterApplyTags", "processes", "the", "tags", "step", "for", "both", "create", "and", "update", "for", "vsphere_datastore_cluster", "." ]
[ "func", "resourceVSphereDatastoreClusterApplyTags", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ",", "pod", "*", "<mask>", ".", "StoragePod", ")", "error", "{", "tagsClient", ",", "err", ":=", "tagsClientIfDefined", "(", "d", ",", "meta", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Apply any pending tags now", "if", "tagsClient", "==", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereDatastoreClusterIDString", "(", "d", ")", ")", "\n", "return", "nil", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereDatastoreClusterIDString", "(", "d", ")", ")", "\n", "return", "processTagDiff", "(", "tagsClient", ",", "d", ",", "pod", ")", "\n", "}" ]
1,927
all-1928
[ "Recover", "creates", "middleware", "that", "can", "recover", "from", "a", "panic", "in", "a", "handler", "storing", "a", "PanicError", "for", "future", "handling", "." ]
[ "func", "Recover", "(", ")", "Middleware", "{", "return", "func", "(", "next", "http", ".", "<mask>", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "defer", "func", "(", ")", "{", "if", "v", ":=", "recover", "(", ")", ";", "v", "!=", "nil", "{", "Store", "(", "r", ",", "PanicError", "{", "value", ":", "v", ",", "stack", ":", "stack", "(", "1", ")", ",", "}", ")", "\n", "}", "\n", "}", "(", ")", "\n", "next", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", ")", "\n", "}", "\n", "}" ]
1,928
all-1929
[ "CleanupVirtualNetworkIfExists", "removes", "a", "subnet", "if", "there", "are", "no", "subnets", "attached", "to", "it", ".", "Note", "that", "this", "method", "is", "not", "safe", "for", "multiple", "concurrent", "writers", "in", "case", "of", "races", "deployment", "of", "a", "machine", "could", "fail", "or", "resource", "might", "not", "be", "cleaned", "up", "." ]
[ "func", "(", "a", "AzureClient", ")", "CleanupVirtualNetworkIfExists", "(", "resourceGroup", ",", "name", "string", ")", "error", "{", "return", "a", ".", "cleanupResourceIfExists", "(", "&", "vnetCleanup", "{", "rg", ":", "resourceGroup", ",", "name", ":", "<mask>", "}", ")", "\n", "}" ]
1,929
all-1930
[ "GetDescription", "returns", "the", "Description", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "b", "*", "Board", ")", "GetDescription", "(", ")", "string", "{", "if", "b", "==", "nil", "||", "b", ".", "Description", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "b", ".", "<mask>", "\n", "}" ]
1,930
all-1931
[ "LoginRequired", "verifies", "that", "the", "current", "user", "is", "authenticated", ".", "Any", "routes", "that", "require", "a", "login", "should", "have", "this", "handler", "placed", "in", "the", "flow", ".", "If", "the", "user", "is", "not", "authenticated", "they", "will", "be", "redirected", "to", "/", "login", "with", "the", "next", "get", "parameter", "set", "to", "the", "attempted", "URL", "." ]
[ "func", "LoginRequired", "(", "r", "render", ".", "Render", ",", "user", "User", ",", "req", "*", "http", ".", "Request", ")", "{", "if", "user", ".", "IsAuthenticated", "(", ")", "==", "false", "{", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "RedirectUrl", ",", "RedirectParam", ",", "req", ".", "URL", ".", "<mask>", ")", "\n", "r", ".", "Redirect", "(", "path", ",", "302", ")", "\n", "}", "\n", "}" ]
1,931
all-1932
[ "<non", "-", "negative", "number", ">", "_" ]
[ "func", "(", "st", "*", "<mask>", ")", "compactNumber", "(", ")", "int", "{", "if", "len", "(", "st", ".", "str", ")", "==", "0", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "st", ".", "str", "[", "0", "]", "==", "'_'", "{", "st", ".", "advance", "(", "1", ")", "\n", "return", "0", "\n", "}", "else", "if", "st", ".", "str", "[", "0", "]", "==", "'n'", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "n", ":=", "st", ".", "number", "(", ")", "\n", "if", "len", "(", "st", ".", "str", ")", "==", "0", "||", "st", ".", "str", "[", "0", "]", "!=", "'_'", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "st", ".", "advance", "(", "1", ")", "\n", "return", "n", "+", "1", "\n", "}" ]
1,932
all-1933
[ "If", "a", "holiday", "falls", "on", "a", "Saturday", "it", "is", "celebrated", "the", "preceding", "Friday", ";", "if", "a", "holiday", "falls", "on", "a", "Sunday", "it", "is", "celebrated", "the", "following", "Monday", "." ]
[ "func", "(", "h", "holidaysUSNational", ")", "fixWeekend", "(", "in", "time", ".", "Time", ")", "time", ".", "Time", "{", "switch", "in", ".", "Weekday", "(", ")", "{", "case", "time", ".", "Saturday", ":", "return", "in", ".", "Add", "(", "-", "1", "*", "24", "*", "<mask>", ".", "Hour", ")", "\n", "case", "time", ".", "Sunday", ":", "return", "in", ".", "Add", "(", "1", "*", "24", "*", "time", ".", "Hour", ")", "\n", "default", ":", "return", "in", "\n", "}", "\n", "}" ]
1,933
all-1934
[ "specify", "a", "one", "-", "dimensional", "texture", "subimage" ]
[ "func", "TextureSubImage1D", "(", "texture", "uint32", ",", "level", "int32", ",", "xoffset", "int32", ",", "width", "int32", ",", "format", "uint32", ",", "xtype", "uint32", ",", "pixels", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall9", "(", "gpTextureSubImage1D", ",", "7", ",", "uintptr", "(", "texture", ")", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "xoffset", ")", ",", "uintptr", "(", "width", ")", ",", "uintptr", "(", "format", ")", ",", "uintptr", "(", "xtype", ")", ",", "uintptr", "(", "pixels", ")", ",", "0", ",", "0", ")", "\n", "}" ]
1,934
all-1935
[ "HasTitleSize", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TimeseriesDefinition", ")", "HasTitleSize", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "TitleSize", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
1,935
all-1936
[ "FillStringAt", "draws", "the", "text", "at", "the", "specified", "point", "(", "x", "y", ")" ]
[ "func", "(", "gc", "*", "GraphicContext", ")", "FillStringAt", "(", "text", "string", ",", "x", ",", "y", "float64", ")", "(", "width", "float64", ")", "{", "f", ",", "err", ":=", "gc", ".", "loadCurrentFont", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Println", "(", "err", ")", "\n", "return", "0.0", "\n", "}", "\n", "startx", ":=", "x", "\n", "prev", ",", "hasPrev", ":=", "truetype", ".", "Index", "(", "0", ")", ",", "false", "\n", "fontName", ":=", "gc", ".", "GetFontName", "(", ")", "\n", "for", "_", ",", "r", ":=", "range", "text", "{", "index", ":=", "f", ".", "Index", "(", "r", ")", "\n", "if", "hasPrev", "{", "x", "+=", "fUnitsToFloat64", "(", "f", ".", "Kern", "(", "fixed", ".", "Int26_6", "(", "gc", ".", "Current", ".", "Scale", ")", ",", "prev", ",", "index", ")", ")", "\n", "}", "\n", "glyph", ":=", "gc", ".", "glyphCache", ".", "Fetch", "(", "gc", ",", "fontName", ",", "r", ")", "\n", "x", "+=", "glyph", ".", "Fill", "(", "gc", ",", "x", ",", "y", ")", "\n", "prev", ",", "hasPrev", "=", "<mask>", ",", "true", "\n", "}", "\n", "return", "x", "-", "startx", "\n", "}" ]
1,936
all-1937
[ "GetPosition", "is", "a", "wrapper", "around", "gtk_window_get_position", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "GetPosition", "(", ")", "(", "root_x", ",", "root_y", "int", ")", "{", "<mask>", "x", ",", "y", "C", ".", "gint", "\n", "C", ".", "gtk_window_get_position", "(", "v", ".", "native", "(", ")", ",", "&", "x", ",", "&", "y", ")", "\n", "return", "int", "(", "x", ")", ",", "int", "(", "y", ")", "\n", "}" ]
1,937
all-1938
[ "/", "*", "assign", "callback", "for", "mouse", "events" ]
[ "func", "(", "win", "*", "Window", ")", "SetMouseCallback", "(", "on_mouse", "MouseFunc", ",", "param", "...", "interface", "{", "}", ")", "{", "switch", "f", ":=", "on_mouse", ".", "(", "type", ")", "{", "case", "MouseFuncA", ":", "win", ".", "mouseHandle", "=", "MouseFunc", "(", "f", ")", "\n", "case", "MouseFuncB", ":", "win", ".", "mouseHandle", "=", "MouseFunc", "(", "f", ")", "\n", "<mask>", "func", "(", "event", ",", "x", ",", "y", ",", "flags", "int", ")", ":", "win", ".", "mouseHandle", "=", "MouseFunc", "(", "f", ")", "\n", "case", "func", "(", "event", ",", "x", ",", "y", ",", "flags", "int", ",", "param", "...", "interface", "{", "}", ")", ":", "win", ".", "mouseHandle", "=", "MouseFunc", "(", "f", ")", "\n", "default", ":", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "len", "(", "param", ")", ">", "0", "{", "win", ".", "param", "=", "param", "\n", "}", "else", "{", "win", ".", "param", "=", "nil", "\n", "}", "\n", "}" ]
1,938
all-1939
[ "Checksum32S", "returns", "the", "checksum", "of", "the", "input", "bytes", "with", "the", "specific", "seed", "." ]
[ "func", "Checksum32S", "(", "in", "[", "]", "byte", ",", "seed", "uint32", ")", "(", "h", "uint32", ")", "{", "var", "i", "int", "\n\n", "if", "len", "(", "in", ")", ">", "15", "{", "var", "(", "v1", "=", "seed", "+", "prime32x1", "+", "prime32x2", "\n", "v2", "=", "seed", "+", "prime32x2", "\n", "v3", "=", "seed", "+", "0", "\n", "v4", "=", "seed", "-", "prime32x1", "\n", ")", "\n", "for", ";", "i", "<", "len", "(", "in", ")", "-", "15", ";", "i", "+=", "16", "{", "in", ":=", "in", "[", "i", ":", "i", "+", "16", ":", "len", "(", "in", ")", "]", "\n", "v1", "+=", "u32", "(", "in", "[", "0", ":", "4", ":", "len", "(", "in", ")", "]", ")", "*", "prime32x2", "\n", "v1", "=", "rotl32_13", "(", "v1", ")", "*", "prime32x1", "\n\n", "v2", "+=", "u32", "(", "in", "[", "4", ":", "8", ":", "len", "(", "in", ")", "]", ")", "*", "prime32x2", "\n", "v2", "=", "rotl32_13", "(", "v2", ")", "*", "prime32x1", "\n\n", "v3", "+=", "u32", "(", "in", "[", "8", ":", "12", ":", "len", "(", "<mask>", ")", "]", ")", "*", "prime32x2", "\n", "v3", "=", "rotl32_13", "(", "v3", ")", "*", "prime32x1", "\n\n", "v4", "+=", "u32", "(", "in", "[", "12", ":", "16", ":", "len", "(", "in", ")", "]", ")", "*", "prime32x2", "\n", "v4", "=", "rotl32_13", "(", "v4", ")", "*", "prime32x1", "\n", "}", "\n\n", "h", "=", "rotl32_1", "(", "v1", ")", "+", "rotl32_7", "(", "v2", ")", "+", "rotl32_12", "(", "v3", ")", "+", "rotl32_18", "(", "v4", ")", "\n\n", "}", "else", "{", "h", "=", "seed", "+", "prime32x5", "\n", "}", "\n\n", "h", "+=", "uint32", "(", "len", "(", "in", ")", ")", "\n", "for", ";", "i", "<=", "len", "(", "in", ")", "-", "4", ";", "i", "+=", "4", "{", "in", ":=", "in", "[", "i", ":", "i", "+", "4", ":", "len", "(", "in", ")", "]", "\n", "h", "+=", "u32", "(", "in", "[", "0", ":", "4", ":", "len", "(", "in", ")", "]", ")", "*", "prime32x3", "\n", "h", "=", "rotl32_17", "(", "h", ")", "*", "prime32x4", "\n", "}", "\n\n", "for", ";", "i", "<", "len", "(", "in", ")", ";", "i", "++", "{", "h", "+=", "uint32", "(", "in", "[", "i", "]", ")", "*", "prime32x5", "\n", "h", "=", "rotl32_11", "(", "h", ")", "*", "prime32x1", "\n", "}", "\n\n", "h", "^=", "h", ">>", "15", "\n", "h", "*=", "prime32x2", "\n", "h", "^=", "h", ">>", "13", "\n", "h", "*=", "prime32x3", "\n", "h", "^=", "h", ">>", "16", "\n\n", "return", "\n", "}" ]
1,939
all-1940
[ "NewLimiter", "creates", "a", "new", "instance", "of", "a", "rate", "limiter", "." ]
[ "func", "NewLimiter", "(", "client", "*", "redis", ".", "Client", ",", "hasher", "RateHasher", ",", "max", "int64", ",", ")", "*", "RateLimiter", "{", "return", "&", "RateLimiter", "{", "redisClient", ":", "<mask>", ",", "hasher", ":", "hasher", ",", "max", ":", "max", ",", "}", "\n", "}" ]
1,940
all-1941
[ "I64", "returns", "the", "two", "halfs", "of", "the", "SHA512", "HMAC", "of", "key", "and", "data", "." ]
[ "func", "I64", "(", "key", "[", "]", "byte", ",", "data", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "[", "]", "byte", ")", "{", "<mask>", ":=", "hmac", ".", "New", "(", "sha512", ".", "New", ",", "key", ")", "\n", "mac", ".", "Write", "(", "data", ")", "\n", "I", ":=", "mac", ".", "Sum", "(", "nil", ")", "\n", "return", "I", "[", ":", "32", "]", ",", "I", "[", "32", ":", "]", "\n", "}" ]
1,941
all-1942
[ "Resize", "changes", "the", "map", "size", "in", "pixel", ".", "Sizes", "larger", "than", "16k", "pixels", "are", "ignored", "by", "Mapnik", ".", "Use", "NewSized", "to", "initialize", "larger", "maps", "." ]
[ "func", "(", "m", "*", "Map", ")", "Resize", "(", "<mask>", ",", "height", "int", ")", "{", "C", ".", "mapnik_map_resize", "(", "m", ".", "m", ",", "C", ".", "uint", "(", "width", ")", ",", "C", ".", "uint", "(", "height", ")", ")", "\n", "m", ".", "width", "=", "width", "\n", "m", ".", "height", "=", "height", "\n", "}" ]
1,942
all-1943
[ "GetTypeOk", "returns", "a", "tuple", "with", "the", "Type", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TraceServiceDefinition", ")", "GetTypeOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "t", "==", "nil", "||", "t", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "t", ".", "Type", ",", "true", "\n", "}" ]
1,943
all-1944
[ "/", "*", "Allocates", "and", "initializes", "IplImage", "header" ]
[ "func", "CreateImageHeader", "(", "w", ",", "h", ",", "<mask>", ",", "channels", "int", ")", "*", "IplImage", "{", "hdr", ":=", "C", ".", "cvCreateImageHeader", "(", "C", ".", "cvSize", "(", "C", ".", "int", "(", "w", ")", ",", "C", ".", "int", "(", "h", ")", ")", ",", "C", ".", "int", "(", "depth", ")", ",", "C", ".", "int", "(", "channels", ")", ",", ")", "\n", "return", "(", "*", "IplImage", ")", "(", "hdr", ")", "\n", "}" ]
1,944
all-1945
[ "GetAlphaNum4", "retrieves", "the", "AlphaNum4", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "<mask>", ")", "GetAlphaNum4", "(", ")", "(", "result", "AssetAlphaNum4", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "AlphaNum4", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
1,945
all-1946
[ "Error", "returns", "any", "errors", "encountered", "so", "far", ".", "No", "commits", "would", "be", "run", "once", "an", "error", "is", "detected", "." ]
[ "func", "(", "wb", "*", "WriteBatch", ")", "<mask>", "(", ")", "error", "{", "wb", ".", "Lock", "(", ")", "\n", "defer", "wb", ".", "Unlock", "(", ")", "\n", "return", "wb", ".", "err", "\n", "}" ]
1,946
all-1947
[ "Fetch", "the", "binary", "from", "S3" ]
[ "func", "(", "s", "*", "S3", ")", "Fetch", "(", ")", "(", "io", ".", "Reader", ",", "error", ")", "{", "//delay fetches after first", "if", "s", ".", "delay", "{", "time", ".", "Sleep", "(", "s", ".", "Interval", ")", "\n", "}", "\n", "s", ".", "delay", "=", "true", "\n", "//status check using HEAD", "head", ",", "err", ":=", "s", ".", "client", ".", "HeadObject", "(", "&", "s3", ".", "HeadObjectInput", "{", "Bucket", ":", "&", "s", ".", "Bucket", ",", "Key", ":", "&", "s", ".", "Key", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "s", ".", "lastETag", "==", "*", "<mask>", ".", "ETag", "{", "return", "nil", ",", "nil", "//skip, file match", "\n", "}", "\n", "s", ".", "lastETag", "=", "*", "head", ".", "ETag", "\n", "//binary fetch using GET", "get", ",", "err", ":=", "s", ".", "client", ".", "GetObject", "(", "&", "s3", ".", "GetObjectInput", "{", "Bucket", ":", "&", "s", ".", "Bucket", ",", "Key", ":", "&", "s", ".", "Key", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "//extract gz files", "if", "strings", ".", "HasSuffix", "(", "s", ".", "Key", ",", "\"", "\"", ")", "&&", "aws", ".", "StringValue", "(", "get", ".", "ContentEncoding", ")", "!=", "\"", "\"", "{", "return", "gzip", ".", "NewReader", "(", "get", ".", "Body", ")", "\n", "}", "\n", "//success!", "return", "get", ".", "Body", ",", "nil", "\n", "}" ]
1,947
all-1948
[ "AppendHandlers", "implements", "Dispatcher", ".", "AppendHandlers" ]
[ "func", "(", "d", "*", "SerialDispatcher", ")", "AppendHandlers", "(", "handlers", "...", "Handler", ")", "{", "d", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "Loop", ":", "for", "_", ",", "newHandler", ":=", "range", "handlers", "{", "for", "_", ",", "existingHandler", ":=", "range", "d", ".", "handlers", "{", "if", "newHandler", "==", "existingHandler", "{", "continue", "Loop", "\n", "}", "\n", "}", "\n", "d", ".", "handlers", "=", "<mask>", "(", "d", ".", "handlers", ",", "newHandler", ")", "\n", "}", "\n", "}" ]
1,948
all-1949
[ "newSubmitStateChangeClient", "returns", "a", "client", "intended", "to", "be", "used", "for", "Submit", "*", "StateChange", "APIs", "which", "has", "the", "behavior", "of", "retrying", "the", "call", "on", "retriable", "errors", "for", "an", "extended", "period", "of", "time", "(", "roughly", "24", "hours", ")", "." ]
[ "func", "newSubmitStateChangeClient", "(", "awsConfig", "*", "aws", ".", "Config", ")", "*", "ecs", ".", "ECS", "{", "sscConfig", ":=", "awsConfig", ".", "Copy", "(", ")", "\n", "sscConfig", ".", "Retryer", "=", "&", "oneDayRetrier", "{", "}", "\n", "client", ":=", "ecs", ".", "New", "(", "session", ".", "New", "(", "sscConfig", ")", ")", "\n", "return", "<mask>", "\n", "}" ]
1,949
all-1950
[ "/", "*", "Attempts", "to", "parse", "the", "[", "candidate", "]", "as", "a", "Time", ".", "Tries", "a", "series", "of", "standardized", "date", "formats", "returns", "the", "Time", "if", "one", "applies", "otherwise", "returns", "false", "through", "the", "second", "return", "." ]
[ "func", "tryParseTime", "(", "candidate", "string", ")", "(", "time", ".", "Time", ",", "bool", ")", "{", "var", "ret", "time", ".", "Time", "\n", "var", "found", "bool", "\n\n", "timeFormats", ":=", "[", "...", "]", "string", "{", "time", ".", "ANSIC", ",", "time", ".", "UnixDate", ",", "time", ".", "RubyDate", ",", "time", ".", "Kitchen", ",", "time", ".", "RFC3339", ",", "time", ".", "RFC3339Nano", ",", "\"", "\"", ",", "// RFC 3339", "\"", "\"", ",", "// RFC 3339 with minutes", "\"", "\"", ",", "// RFC 3339 with seconds", "\"", "\"", ",", "// RFC 3339 with seconds and timezone", "\"", "\"", ",", "// ISO8601 with hour", "\"", "\"", ",", "// ISO8601 with minutes", "\"", "\"", ",", "// ISO8601 with seconds", "\"", "\"", ",", "// ISO8601 with nanoseconds", "}", "\n\n", "for", "_", ",", "format", ":=", "range", "timeFormats", "{", "ret", ",", "found", "=", "tryParseExactTime", "(", "candidate", ",", "<mask>", ")", "\n", "if", "found", "{", "return", "ret", ",", "true", "\n", "}", "\n", "}", "\n\n", "return", "time", ".", "Now", "(", ")", ",", "false", "\n", "}" ]
1,950
all-1951
[ "Return", "the", "names", "of", "the", "nodes", "the", "given", "network", "is", "defined", "on", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "networkNodes", "(", "networkID", "int64", ")", "(", "[", "]", "string", ",", "error", ")", "{", "stmt", ":=", "`\nSELECT nodes.name FROM nodes\n JOIN networks_nodes ON networks_nodes.node_id = nodes.id\n WHERE networks_nodes.network_id = ?\n`", "\n", "var", "nodes", "[", "]", "string", "\n", "err", ":=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "<mask>", "err", "error", "\n", "nodes", ",", "err", "=", "query", ".", "SelectStrings", "(", "tx", ".", "tx", ",", "stmt", ",", "networkID", ")", "\n", "return", "err", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nodes", ",", "nil", "\n", "}" ]
1,951
all-1952
[ "define", "an", "array", "of", "generic", "vertex", "attribute", "data" ]
[ "func", "VertexAttribPointer", "(", "index", "uint32", ",", "size", "int32", ",", "xtype", "uint32", ",", "normalized", "bool", ",", "stride", "int32", ",", "pointer", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall6", "(", "gpVertexAttribPointer", ",", "6", ",", "uintptr", "(", "index", ")", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "xtype", ")", ",", "boolToUintptr", "(", "normalized", ")", ",", "uintptr", "(", "stride", ")", ",", "uintptr", "(", "pointer", ")", ")", "\n", "}" ]
1,952
all-1953
[ "mount", "initializes", "the", "console", "inside", "the", "rootfs", "mounting", "with", "the", "specified", "mount", "label", "and", "applying", "the", "correct", "ownership", "of", "the", "console", "." ]
[ "func", "(", "c", "*", "linuxConsole", ")", "<mask>", "(", "rootfs", ",", "mountLabel", "string", ",", "uid", ",", "gid", "int", ")", "error", "{", "oldMask", ":=", "syscall", ".", "Umask", "(", "0000", ")", "\n", "defer", "syscall", ".", "Umask", "(", "oldMask", ")", "\n", "if", "err", ":=", "label", ".", "SetFileLabel", "(", "c", ".", "slavePath", ",", "mountLabel", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "dest", ":=", "filepath", ".", "Join", "(", "rootfs", ",", "\"", "\"", ")", "\n", "f", ",", "err", ":=", "os", ".", "Create", "(", "dest", ")", "\n", "if", "err", "!=", "nil", "&&", "!", "os", ".", "IsExist", "(", "err", ")", "{", "return", "err", "\n", "}", "\n", "if", "f", "!=", "nil", "{", "f", ".", "Close", "(", ")", "\n", "}", "\n", "return", "syscall", ".", "Mount", "(", "c", ".", "slavePath", ",", "dest", ",", "\"", "\"", ",", "syscall", ".", "MS_BIND", ",", "\"", "\"", ")", "\n", "}" ]
1,953
all-1954
[ "NewColumnIteratorWithTimestampFormat", "creates", "a", "new", "iterator", "for", "column", "data", "with", "timestamp", "." ]
[ "func", "NewColumnIteratorWithTimestampFormat", "(", "format", "Format", ",", "reader", "io", ".", "Reader", ",", "timestampFormat", "string", ")", "*", "Iterator", "{", "return", "NewIterator", "(", "<mask>", ",", "ColumnUnmarshallerWithTimestamp", "(", "format", ",", "timestampFormat", ")", ")", "\n", "}" ]
1,954
all-1955
[ "DeepCopy", "copies", "the", "receiver", "into", "a", "new", "UUID4", "." ]
[ "func", "(", "u", "*", "UUID4", ")", "DeepCopy", "(", ")", "*", "UUID4", "{", "if", "u", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "<mask>", "(", "UUID4", ")", "\n", "u", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
1,955
all-1956
[ "New", "instantiates", "a", "new", "client", "with", "the", "given", "params", "and", "return", "a", "reference", "to", "it" ]
[ "func", "New", "(", "pemPath", "string", ",", "options", "...", "func", "(", "*", "Client", ")", "error", ")", "*", "Client", "{", "c", ":=", "Client", "{", "pemPath", ":", "pemPath", ",", "RequestTimeout", ":", "defaultRequestTimeout", ",", "}", "\n\n", "c", ".", "PrintDebug", "=", "false", "\n\n", "for", "_", ",", "option", ":=", "range", "<mask>", "{", "err", ":=", "option", "(", "&", "c", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", "\n", "}", "\n", "}", "\n\n", "return", "&", "c", "\n", "}" ]
1,956
all-1957
[ "GetPullCredentials", "returns", "the", "pull", "credentials", "in", "the", "auth" ]
[ "func", "(", "auth", "*", "ECRAuthData", ")", "GetPullCredentials", "(", ")", "credentials", ".", "IAMRoleCredentials", "{", "auth", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "auth", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "auth", ".", "pullCredentials", "\n", "}" ]
1,957
all-1958
[ "listHostInterfaces", "returns", "a", "map", "of", "net", ".", "IPNet", "addresses", "of", "host", "interfaces", "that", "are", "UP", "and", "not", "loopback", "adapters", "and", "not", "virtualbox", "host", "-", "only", "networks", "(", "given", "by", "excludeNets", ")", "keyed", "by", "CIDR", "string", "." ]
[ "func", "listHostInterfaces", "(", "hif", "HostInterfaces", ",", "excludeNets", "map", "[", "string", "]", "*", "hostOnlyNetwork", ")", "(", "map", "[", "string", "]", "*", "net", ".", "IPNet", ",", "error", ")", "{", "ifaces", ",", "err", ":=", "hif", ".", "Interfaces", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "m", ":=", "map", "[", "string", "]", "*", "net", ".", "IPNet", "{", "}", "\n\n", "for", "_", ",", "iface", ":=", "range", "ifaces", "{", "addrs", ",", "err", ":=", "hif", ".", "Addrs", "(", "&", "iface", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Check if an address of the interface is in the list of excluded addresses", "ifaceExcluded", ":=", "false", "\n", "for", "_", ",", "a", ":=", "range", "addrs", "{", "switch", "ipnet", ":=", "a", ".", "(", "type", ")", "{", "case", "*", "net", ".", "IPNet", ":", "_", ",", "excluded", ":=", "excludeNets", "[", "ipnet", ".", "String", "(", ")", "]", "\n", "if", "excluded", "{", "ifaceExcluded", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "}", "\n\n", "// If excluded, or not up, or a loopback interface, skip the interface", "if", "ifaceExcluded", "||", "iface", ".", "Flags", "&", "net", ".", "FlagUp", "==", "0", "||", "iface", ".", "Flags", "&", "net", ".", "FlagLoopback", "!=", "0", "{", "continue", "\n", "}", "\n\n", "// This is a host interface, so add all its addresses to the map", "for", "_", ",", "a", ":=", "range", "addrs", "{", "switch", "ipnet", ":=", "a", ".", "(", "<mask>", ")", "{", "case", "*", "net", ".", "IPNet", ":", "m", "[", "ipnet", ".", "String", "(", ")", "]", "=", "ipnet", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "m", ",", "nil", "\n", "}" ]
1,958
all-1959
[ "NewCheckCommand", "returns", "the", "cobra", "command", "for", "check", "." ]
[ "func", "NewCheckCommand", "(", ")", "*", "cobra", ".", "Command", "{", "cc", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "}", "\n\n", "cc", ".", "AddCommand", "(", "NewCheckPerfCommand", "(", ")", ")", "\n", "<mask>", ".", "AddCommand", "(", "NewCheckDatascaleCommand", "(", ")", ")", "\n\n", "return", "cc", "\n", "}" ]
1,959
all-1960
[ "/", "*", "BufferReader", "returns", "a", "new", "gbytes", ".", "Buffer", "that", "wraps", "a", "reader", ".", "The", "reader", "s", "contents", "are", "read", "into", "the", "Buffer", "via", "io", ".", "Copy" ]
[ "func", "BufferReader", "(", "reader", "io", ".", "Reader", ")", "*", "Buffer", "{", "b", ":=", "&", "Buffer", "{", "lock", ":", "&", "<mask>", ".", "Mutex", "{", "}", ",", "}", "\n\n", "go", "func", "(", ")", "{", "io", ".", "Copy", "(", "b", ",", "reader", ")", "\n", "b", ".", "Close", "(", ")", "\n", "}", "(", ")", "\n\n", "return", "b", "\n", "}" ]
1,960
all-1961
[ "Init", "initializes", "the", "embedded", "newrelic", "agent", "with", "the", "given", "app", "name", "and", "license", "key", "." ]
[ "func", "Init", "(", "app", ",", "key", "string", ")", "{", "if", "_", ",", "err", ":=", "sdk", ".", "InitEmbeddedMode", "(", "<mask>", ",", "app", ")", ";", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "}" ]
1,961
all-1962
[ "Options", "adds", "the", "route", "pattern", "that", "matches", "a", "OPTIONS", "http", "method", "to", "execute", "the", "handlerFn", "http", ".", "HandlerFunc", "." ]
[ "func", "(", "mx", "*", "Mux", ")", "Options", "(", "pattern", "string", ",", "handlerFn", "<mask>", ".", "HandlerFunc", ")", "{", "mx", ".", "handle", "(", "mOPTIONS", ",", "pattern", ",", "handlerFn", ")", "\n", "}" ]
1,962
all-1963
[ "PushNote", "sends", "a", "note", "to", "the", "specific", "device", "with", "the", "given", "title", "and", "body" ]
[ "func", "(", "d", "*", "<mask>", ")", "PushNote", "(", "title", ",", "body", "string", ")", "error", "{", "return", "d", ".", "Client", ".", "PushNote", "(", "d", ".", "Iden", ",", "title", ",", "body", ")", "\n", "}" ]
1,963
all-1964
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventInlineStyleInvalidated", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom60", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
1,964
all-1965
[ "handleMessage", "dispatches", "a", "message", "to", "the", "correct", "requestHandler", "for", "its", "type", ".", "If", "no", "request", "handler", "is", "found", "the", "message", "is", "discarded", "." ]
[ "func", "(", "cs", "*", "ClientServerImpl", ")", "handleMessage", "(", "data", "[", "]", "byte", ")", "{", "typedMessage", ",", "typeStr", ",", "err", ":=", "DecodeData", "(", "data", ",", "cs", ".", "TypeDecoder", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "typeStr", ")", "\n\n", "if", "cs", ".", "AnyRequestHandler", "!=", "nil", "{", "reflect", ".", "ValueOf", "(", "cs", ".", "AnyRequestHandler", ")", ".", "Call", "(", "[", "]", "reflect", ".", "Value", "{", "reflect", ".", "ValueOf", "(", "typedMessage", ")", "}", ")", "\n", "}", "\n\n", "if", "handler", ",", "ok", ":=", "cs", ".", "RequestHandlers", "[", "typeStr", "]", ";", "ok", "{", "reflect", ".", "ValueOf", "(", "handler", ")", ".", "Call", "(", "[", "]", "reflect", ".", "<mask>", "{", "reflect", ".", "ValueOf", "(", "typedMessage", ")", "}", ")", "\n", "}", "else", "{", "seelog", ".", "Infof", "(", "\"", "\"", ",", "typeStr", ")", "\n", "}", "\n", "}" ]
1,965
all-1966
[ "SetOffer", "mutates", "key", "such", "that", "it", "represents", "the", "identity", "of", "the", "data", "entry", "owned", "by", "account", "and", "for", "offer", "id", "." ]
[ "func", "(", "key", "*", "LedgerKey", ")", "SetOffer", "(", "account", "AccountId", ",", "id", "uint64", ")", "error", "{", "data", ":=", "LedgerKeyOffer", "{", "account", ",", "Uint64", "(", "id", ")", "}", "\n", "nkey", ",", "err", ":=", "NewLedgerKey", "(", "LedgerEntryTypeOffer", ",", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "*", "<mask>", "=", "nkey", "\n", "return", "nil", "\n", "}" ]
1,966
all-1967
[ "AddBack", "creates", "an", "entry", "in", "the", "LinkedList", "that", "is", "logically", "at", "the", "back", "of", "the", "list", "." ]
[ "func", "(", "list", "*", "LinkedList", ")", "AddBack", "(", "entry", "interface", "{", "}", ")", "{", "toAppend", ":=", "&", "llNode", "{", "payload", ":", "entry", ",", "}", "\n\n", "list", ".", "key", ".", "Lock", "(", ")", "\n", "defer", "list", ".", "key", ".", "Unlock", "(", ")", "\n\n", "<mask>", ".", "length", "++", "\n\n", "if", "list", ".", "first", "==", "nil", "{", "list", ".", "first", "=", "toAppend", "\n", "list", ".", "last", "=", "toAppend", "\n", "return", "\n", "}", "\n\n", "list", ".", "last", ".", "next", "=", "toAppend", "\n", "list", ".", "last", "=", "toAppend", "\n", "}" ]
1,967
all-1968
[ "return", "parameters", "of", "a", "query", "object" ]
[ "func", "GetQueryObjectuiv", "(", "<mask>", "uint32", ",", "pname", "uint32", ",", "params", "*", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpGetQueryObjectuiv", ",", "3", ",", "uintptr", "(", "id", ")", ",", "uintptr", "(", "pname", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
1,968
all-1969
[ "AsEnumerable", "allows", "for", "easy", "conversion", "of", "a", "slice", "to", "a", "re", "-", "usable", "Enumerable", "object", "." ]
[ "func", "AsEnumerable", "(", "entries", "...", "interface", "{", "}", ")", "Enumerable", "{", "if", "len", "(", "entries", ")", "!=", "1", "{", "return", "enumerableSlice", "(", "entries", ")", "\n", "}", "\n\n", "val", ":=", "reflect", ".", "ValueOf", "(", "entries", "[", "0", "]", ")", "\n\n", "if", "<mask>", ":=", "val", ".", "Kind", "(", ")", ";", "kind", "==", "reflect", ".", "Slice", "||", "kind", "==", "reflect", ".", "Array", "{", "return", "enumerableValue", "{", "Value", ":", "val", ",", "}", "\n", "}", "\n", "return", "enumerableSlice", "(", "entries", ")", "\n", "}" ]
1,969
all-1970
[ "IsRetriableError", "returns", "a", "boolean", "indicating", "whether", "the", "call", "that", "generated", "the", "error", "can", "be", "retried", ".", "When", "stopping", "a", "container", "most", "errors", "that", "we", "can", "get", "should", "be", "considered", "retriable", ".", "However", "in", "the", "case", "where", "the", "container", "is", "already", "stopped", "or", "doesn", "t", "exist", "at", "all", "there", "s", "no", "sense", "in", "retrying", "." ]
[ "func", "(", "err", "CannotStopContainerError", ")", "IsRetriableError", "(", ")", "bool", "{", "if", "_", ",", "ok", ":=", "err", ".", "FromError", ".", "(", "NoSuchContainerError", ")", ";", "ok", "{", "return", "false", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
1,970
all-1971
[ "Classic", "creates", "a", "classic", "Martini", "with", "some", "basic", "default", "middleware", "-", "martini", ".", "Logger", "martini", ".", "Recovery", "and", "martini", ".", "Static", ".", "Classic", "also", "maps", "martini", ".", "Routes", "as", "a", "service", "." ]
[ "func", "Classic", "(", ")", "*", "ClassicMartini", "{", "r", ":=", "NewRouter", "(", ")", "\n", "m", ":=", "New", "(", ")", "\n", "m", ".", "Use", "(", "Logger", "(", ")", ")", "\n", "m", ".", "Use", "(", "Recovery", "(", ")", ")", "\n", "m", ".", "Use", "(", "Static", "(", "\"", "\"", ")", ")", "\n", "m", ".", "Use", "(", "ContextRender", "(", "\"", "\"", ",", "RenderOptions", "{", "Extensions", ":", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ",", "}", ")", ")", "\n", "m", ".", "MapTo", "(", "r", ",", "(", "*", "Routes", ")", "(", "nil", ")", ")", "\n", "m", ".", "<mask>", "(", "r", ".", "Handle", ")", "\n", "return", "&", "ClassicMartini", "{", "m", ",", "r", "}", "\n", "}" ]
1,971
all-1972
[ "ReadAtMost", "reads", "at", "most", "n", "bytes" ]
[ "func", "(", "a", "*", "PodLogArtifact", ")", "ReadAtMost", "(", "n", "int64", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "logs", ",", "err", ":=", "a", ".", "jobAgent", ".", "GetJobLog", "(", "a", ".", "name", ",", "a", ".", "buildID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "reader", ":=", "bytes", ".", "NewReader", "(", "logs", ")", "\n", "var", "byteCount", "int64", "\n", "<mask>", "p", "[", "]", "byte", "\n", "for", "byteCount", "<", "n", "{", "b", ",", "err", ":=", "reader", ".", "ReadByte", "(", ")", "\n", "if", "err", "==", "io", ".", "EOF", "{", "return", "p", ",", "io", ".", "EOF", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "p", "=", "append", "(", "p", ",", "b", ")", "\n", "byteCount", "++", "\n", "}", "\n", "return", "p", ",", "nil", "\n", "}" ]
1,972
all-1973
[ "newProxierWithNoProxyCIDR", "is", "a", "modified", "copy", "of", "k8s", ".", "io", "/", "apimachinery", "/", "pkg", "/", "util", "/", "net", ".", "NewProxierWithNoProxyCIDR", ".", "NewProxierWithNoProxyCIDR", "constructs", "a", "Proxier", "function", "that", "respects", "CIDRs", "in", "NO_PROXY", "and", "delegates", "if", "no", "matching", "CIDRs", "are", "found" ]
[ "func", "newProxierWithNoProxyCIDR", "(", "delegate", "func", "(", "req", "*", "http", ".", "Request", ")", "(", "*", "url", ".", "URL", ",", "error", ")", ")", "func", "(", "req", "*", "http", ".", "Request", ")", "(", "*", "url", ".", "URL", ",", "error", ")", "{", "// we wrap the default method, so we only need to perform our check if the NO_PROXY envvar has a CIDR in it", "noProxyEnv", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "noProxyRules", ":=", "strings", ".", "Split", "(", "noProxyEnv", ",", "\"", "\"", ")", "\n\n", "cidrs", ":=", "[", "]", "*", "net", ".", "IPNet", "{", "}", "\n", "for", "_", ",", "noProxyRule", ":=", "range", "noProxyRules", "{", "_", ",", "cidr", ",", "_", ":=", "net", ".", "ParseCIDR", "(", "noProxyRule", ")", "\n", "if", "cidr", "!=", "nil", "{", "cidrs", "=", "append", "(", "cidrs", ",", "cidr", ")", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "cidrs", ")", "==", "0", "{", "return", "delegate", "\n", "}", "\n\n", "return", "func", "(", "req", "*", "http", ".", "Request", ")", "(", "*", "url", ".", "<mask>", ",", "error", ")", "{", "host", ":=", "req", ".", "URL", ".", "Host", "\n", "// for some urls, the Host is already the host, not the host:port", "if", "net", ".", "ParseIP", "(", "host", ")", "==", "nil", "{", "var", "err", "error", "\n", "host", ",", "_", ",", "err", "=", "net", ".", "SplitHostPort", "(", "req", ".", "URL", ".", "Host", ")", "\n", "if", "err", "!=", "nil", "{", "return", "delegate", "(", "req", ")", "\n", "}", "\n", "}", "\n\n", "ip", ":=", "net", ".", "ParseIP", "(", "host", ")", "\n", "if", "ip", "==", "nil", "{", "return", "delegate", "(", "req", ")", "\n", "}", "\n\n", "for", "_", ",", "cidr", ":=", "range", "cidrs", "{", "if", "cidr", ".", "Contains", "(", "ip", ")", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "}", "\n\n", "return", "delegate", "(", "req", ")", "\n", "}", "\n", "}" ]
1,973
all-1974
[ "DispatchSyncEvent", "[", "no", "description", "]", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "ServiceWorker#method", "-", "dispatchSyncEvent", "parameters", ":", "origin", "registrationID", "tag", "lastChance" ]
[ "func", "DispatchSyncEvent", "(", "origin", "string", ",", "registrationID", "RegistrationID", ",", "tag", "string", ",", "lastChance", "bool", ")", "*", "DispatchSyncEventParams", "{", "return", "&", "DispatchSyncEventParams", "{", "Origin", ":", "origin", ",", "RegistrationID", ":", "registrationID", ",", "<mask>", ":", "tag", ",", "LastChance", ":", "lastChance", ",", "}", "\n", "}" ]
1,974
all-1975
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ResetPermissionsParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
1,975
all-1976
[ "syncWatchersLoop", "syncs", "the", "watcher", "in", "the", "unsynced", "map", "every", "100ms", "." ]
[ "func", "(", "s", "*", "watchableStore", ")", "syncWatchersLoop", "(", ")", "{", "defer", "s", ".", "wg", ".", "Done", "(", ")", "\n\n", "for", "{", "s", ".", "mu", ".", "RLock", "(", ")", "\n", "st", ":=", "time", ".", "Now", "(", ")", "\n", "lastUnsyncedWatchers", ":=", "s", ".", "unsynced", ".", "size", "(", ")", "\n", "s", ".", "mu", ".", "RUnlock", "(", ")", "\n\n", "unsyncedWatchers", ":=", "0", "\n", "if", "lastUnsyncedWatchers", ">", "0", "{", "unsyncedWatchers", "=", "s", ".", "syncWatchers", "(", ")", "\n", "}", "\n", "syncDuration", ":=", "time", ".", "Since", "(", "st", ")", "\n\n", "waitDuration", ":=", "100", "*", "time", ".", "Millisecond", "\n", "// more work pending?", "if", "unsyncedWatchers", "!=", "0", "&&", "lastUnsyncedWatchers", ">", "unsyncedWatchers", "{", "// be fair to other store operations by yielding time taken", "waitDuration", "=", "syncDuration", "\n", "}", "\n\n", "<mask>", "{", "case", "<-", "time", ".", "After", "(", "waitDuration", ")", ":", "case", "<-", "s", ".", "stopc", ":", "return", "\n", "}", "\n", "}", "\n", "}" ]
1,976
all-1977
[ "String", "representation", "." ]
[ "func", "(", "p", "*", "Peer", ")", "<mask>", "(", ")", "string", "{", "if", "p", ".", "outbound", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ".", "mconn", ",", "p", ".", "Key", "[", ":", "12", "]", ")", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ".", "mconn", ",", "p", ".", "Key", "[", ":", "12", "]", ")", "\n", "}" ]
1,977
all-1978
[ "CreateChildAnchor", "()", "is", "a", "wrapper", "around", "gtk_text_buffer_create_child_anchor", "()", ".", "Since", "it", "copies", "garbage", "from", "the", "stack", "into", "the", "padding", "bytes", "of", "iter", "iter", "can", "t", "be", "reliably", "reused", "after", "this", "call", "unless", "GODEBUG", "=", "cgocheck", "=", "0", "." ]
[ "func", "(", "v", "*", "TextBuffer", ")", "CreateChildAnchor", "(", "iter", "*", "TextIter", ")", "*", "TextChildAnchor", "{", "ret", ":=", "C", ".", "gtk_text_buffer_create_child_anchor", "(", "v", ".", "native", "(", ")", ",", "iter", ".", "native", "(", ")", ")", "\n", "return", "(", "*", "TextChildAnchor", ")", "(", "<mask>", ")", "\n", "}" ]
1,978
all-1979
[ "Adds", "directly", "to", "the", "node", "table", "." ]
[ "func", "(", "s", "*", "Server", ")", "AddNode", "(", "ni", "krpc", ".", "NodeInfo", ")", "error", "{", "id", ":=", "int160FromByteArray", "(", "ni", ".", "ID", ")", "\n", "if", "<mask>", ".", "IsZero", "(", ")", "{", "return", "s", ".", "Ping", "(", "ni", ".", "Addr", ".", "UDP", "(", ")", ",", "nil", ")", "\n", "}", "\n", "_", ",", "err", ":=", "s", ".", "getNode", "(", "NewAddr", "(", "ni", ".", "Addr", ".", "UDP", "(", ")", ")", ",", "int160FromByteArray", "(", "ni", ".", "ID", ")", ",", "true", ")", "\n", "return", "err", "\n", "}" ]
1,979
all-1980
[ "Explain", "returns", "a", "number", "of", "details", "about", "how", "the", "MongoDB", "server", "would", "execute", "the", "requested", "pipeline", "such", "as", "the", "number", "of", "objects", "examined", "the", "number", "of", "times", "the", "read", "lock", "was", "yielded", "to", "allow", "writes", "to", "go", "in", "and", "so", "on", ".", "For", "example", ":", "var", "m", "bson", ".", "M", "err", ":", "=", "collection", ".", "Pipe", "(", "pipeline", ")", ".", "Explain", "(", "&m", ")", "if", "err", "==", "nil", "{", "fmt", ".", "Printf", "(", "Explain", ":", "%#v", "\\", "n", "m", ")", "}" ]
[ "func", "(", "p", "*", "Pipe", ")", "Explain", "(", "result", "interface", "{", "}", ")", "error", "{", "c", ":=", "p", ".", "collection", "\n", "cmd", ":=", "pipeCmd", "{", "Aggregate", ":", "c", ".", "Name", ",", "Pipeline", ":", "p", ".", "pipeline", ",", "AllowDisk", ":", "p", ".", "allowDisk", ",", "Explain", ":", "true", ",", "}", "\n", "return", "c", ".", "Database", ".", "Run", "(", "cmd", ",", "<mask>", ")", "\n", "}" ]
1,980
all-1981
[ "NewClient", "returns", "a", "client", "that", "talks", "to", "GitHub", ".", "It", "will", "fail", "if", "git", "is", "not", "in", "the", "PATH", "." ]
[ "func", "NewClient", "(", ")", "(", "*", "Client", ",", "error", ")", "{", "g", ",", "err", ":=", "exec", ".", "LookPath", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "t", ",", "err", ":=", "ioutil", ".", "TempDir", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "Client", "{", "logger", ":", "logrus", ".", "WithField", "(", "\"", "\"", ",", "\"", "\"", ")", ",", "dir", ":", "t", ",", "git", ":", "g", ",", "<mask>", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "github", ")", ",", "repoLocks", ":", "make", "(", "map", "[", "string", "]", "*", "sync", ".", "Mutex", ")", ",", "}", ",", "nil", "\n", "}" ]
1,981
all-1982
[ "Metrics", "retuns", "all", "Prometheus", "metrics", "that", "should", "be", "registered", "." ]
[ "func", "(", "c", "*", "Counter", ")", "Metrics", "(", ")", "(", "<mask>", "[", "]", "prometheus", ".", "Collector", ")", "{", "return", "[", "]", "prometheus", ".", "Collector", "{", "c", ".", "vector", "}", "\n", "}" ]
1,982
all-1983
[ "/", "*", "Get1D", "return", "a", "specific", "element", "from", "a", "1", "-", "dimensional", "matrix", "." ]
[ "func", "(", "img", "*", "IplImage", ")", "Get1D", "(", "x", "int", ")", "Scalar", "{", "<mask>", ":=", "C", ".", "cvGet1D", "(", "unsafe", ".", "Pointer", "(", "img", ")", ",", "C", ".", "int", "(", "x", ")", ")", "\n", "return", "Scalar", "(", "ret", ")", "\n", "}" ]
1,983
all-1984
[ "Validate", "that", "options", "are", "usuable" ]
[ "func", "(", "opts", "*", "Options", ")", "Validate", "(", ")", "error", "{", "if", "opts", ".", "Options", "==", "nil", "{", "opts", ".", "Options", "=", "&", "core", ".", "<mask>", "{", "}", "\n", "}", "\n\n", "if", "err", ":=", "opts", ".", "Options", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "opts", ".", "Docker", "!=", "nil", "{", "if", "opts", ".", "Docker", ".", "App", ".", "IsZero", "(", ")", "{", "opts", ".", "Docker", ".", "App", "=", "opts", ".", "App", "\n", "}", "\n", "if", "err", ":=", "opts", ".", "Docker", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "if", "opts", ".", "Webpack", "!=", "nil", "{", "if", "opts", ".", "Webpack", ".", "App", ".", "IsZero", "(", ")", "{", "opts", ".", "Webpack", ".", "App", "=", "opts", ".", "App", "\n", "}", "\n", "if", "err", ":=", "opts", ".", "Webpack", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "if", "opts", ".", "Standard", "!=", "nil", "&&", "opts", ".", "Webpack", "!=", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
1,984
all-1985
[ "UnmarshalJSON", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskEngineState", ")", "UnmarshalJSON", "(", "arg0", "[", "]", "byte", ")", "error", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "error", ")", "\n", "return", "ret0", "\n", "}" ]
1,985
all-1986
[ "GetAttrs", "returns", "all", "attributes", "of", "the", "element" ]
[ "func", "(", "x", "*", "XMLEle", ")", "GetAttrs", "(", ")", "[", "]", "tree", ".", "Node", "{", "ret", ":=", "make", "(", "[", "]", "<mask>", ".", "Node", ",", "len", "(", "x", ".", "Attrs", ")", ")", "\n", "for", "i", ":=", "range", "x", ".", "Attrs", "{", "ret", "[", "i", "]", "=", "x", ".", "Attrs", "[", "i", "]", "\n", "}", "\n", "return", "ret", "\n", "}" ]
1,986
all-1987
[ "NewNetworkNumber", "returns", "a", "equivalent", "NetworkNumber", "to", "given", "IP", "address", "return", "nil", "if", "ip", "is", "neither", "IPv4", "nor", "IPv6", "." ]
[ "func", "NewNetworkNumber", "(", "ip", "net", ".", "IP", ")", "NetworkNumber", "{", "if", "ip", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "coercedIP", ":=", "ip", ".", "To4", "(", ")", "\n", "parts", ":=", "1", "\n", "if", "coercedIP", "==", "nil", "{", "coercedIP", "=", "ip", ".", "To16", "(", ")", "\n", "parts", "=", "4", "\n", "}", "\n", "if", "coercedIP", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "nn", ":=", "make", "(", "NetworkNumber", ",", "parts", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "<mask>", ";", "i", "++", "{", "idx", ":=", "i", "*", "net", ".", "IPv4len", "\n", "nn", "[", "i", "]", "=", "binary", ".", "BigEndian", ".", "Uint32", "(", "coercedIP", "[", "idx", ":", "idx", "+", "net", ".", "IPv4len", "]", ")", "\n", "}", "\n", "return", "nn", "\n", "}" ]
1,987
all-1988
[ "EncodeIntWithPrecision", "encodes", "the", "point", "(", "lat", "lng", ")", "to", "an", "integer", "with", "the", "specified", "number", "of", "bits", "." ]
[ "func", "EncodeIntWithPrecision", "(", "lat", ",", "lng", "float64", ",", "bits", "uint", ")", "uint64", "{", "hash", ":=", "EncodeInt", "(", "lat", ",", "lng", ")", "\n", "return", "<mask>", ">>", "(", "64", "-", "bits", ")", "\n", "}" ]
1,988
all-1989
[ "MustNewCmdWithRunner", "returns", "the", "result", "of", "NewCmdWithRunner", "and", "panics", "in", "cases", "where", "the", "function", "returns", "an", "error", "." ]
[ "func", "MustNewCmdWithRunner", "(", "cmdName", "string", ",", "<mask>", "func", "(", ")", ")", "*", "CmdWithRunner", "{", "cmdWithRunner", ",", "err", ":=", "NewCmdWithRunner", "(", "cmdName", ",", "runner", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "cmdWithRunner", "\n", "}" ]
1,989
all-1990
[ "Send", "envoie", "un", "email" ]
[ "func", "(", "m", "*", "MailService", ")", "Send", "(", "message", "string", ",", "subject", "string", ",", "from", "string", ",", "to", "string", ")", "(", "err", "error", ")", "{", "t", ":=", "[", "]", "string", "{", "to", "}", "\n", "msg", ":=", "[", "]", "byte", "(", "\"", "\"", "+", "from", "+", "\"", "\\r", "\\n", "\"", "+", "\"", "\"", "+", "to", "+", "\"", "\\r", "\\n", "\"", "+", "\"", "\"", "+", "subject", "+", "\"", "\\r", "\\n", "\"", "+", "\"", "\\r", "\\n", "\"", "+", "message", "+", "\"", "\\r", "\\n", "\"", ")", "\n\n", "err", "=", "m", ".", "SMTP", ".", "SendMail", "(", "from", ",", "t", ",", "<mask>", ")", "\n\n", "return", "\n", "}" ]
1,990
all-1991
[ "newSTMRepeatable", "initiates", "new", "repeatable", "read", "transaction", ";", "reads", "within", "the", "same", "transaction", "attempt", "to", "always", "return", "the", "same", "data", "." ]
[ "func", "newSTMRepeatable", "(", "ctx", "context", ".", "Context", ",", "c", "*", "v3", ".", "Client", ",", "apply", "func", "(", "STM", ")", "error", ")", "(", "*", "v3", ".", "TxnResponse", ",", "error", ")", "{", "s", ":=", "&", "stm", "{", "client", ":", "c", ",", "ctx", ":", "ctx", ",", "getOpts", ":", "[", "]", "v3", ".", "OpOption", "{", "v3", ".", "WithSerializable", "(", ")", "}", "}", "\n", "return", "runSTM", "(", "s", ",", "<mask>", ",", "false", ")", "\n", "}" ]
1,991
all-1992
[ "/", "*", "GetAppsAppRoutesRoute", "gets", "route", "by", "name" ]
[ "func", "(", "a", "*", "<mask>", ")", "GetAppsAppRoutesRoute", "(", "params", "*", "GetAppsAppRoutesRouteParams", ")", "(", "*", "GetAppsAppRoutesRouteOK", ",", "error", ")", "{", "// TODO: Validate the params before sending", "if", "params", "==", "nil", "{", "params", "=", "NewGetAppsAppRoutesRouteParams", "(", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "transport", ".", "Submit", "(", "&", "runtime", ".", "ClientOperation", "{", "ID", ":", "\"", "\"", ",", "Method", ":", "\"", "\"", ",", "PathPattern", ":", "\"", "\"", ",", "ProducesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "ConsumesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Schemes", ":", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", ",", "Params", ":", "params", ",", "Reader", ":", "&", "GetAppsAppRoutesRouteReader", "{", "formats", ":", "a", ".", "formats", "}", ",", "Context", ":", "params", ".", "Context", ",", "Client", ":", "params", ".", "HTTPClient", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ".", "(", "*", "GetAppsAppRoutesRouteOK", ")", ",", "nil", "\n\n", "}" ]
1,992
all-1993
[ "RemoveLatency", "resets", "latency", "configurations", "." ]
[ "func", "RemoveLatency", "(", ")", "error", "{", "ifces", ",", "err", ":=", "GetDefaultInterfaces", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "ifce", ":=", "<mask>", "ifces", "{", "_", ",", "err", "=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ifce", ")", ")", ".", "Output", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
1,993
all-1994
[ "FetchVersion", "fetches", "version", "information", "from", "discovery", "client", "and", "parses" ]
[ "func", "FetchVersion", "(", "v", "discovery", ".", "ServerVersionInterface", ")", "(", "<mask>", "ServerVersion", ",", "err", "error", ")", "{", "version", ",", "err", ":=", "v", ".", "ServerVersion", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "ServerVersion", "{", "}", ",", "err", "\n", "}", "\n", "return", "ParseVersion", "(", "version", ")", "\n", "}" ]
1,994
all-1995
[ "ensureInRange", "adjusts", "the", "passed", "value", "if", "necessary", "to", "ensure", "it", "is", "within", "the", "passed", "min", "/", "max", "range", "." ]
[ "func", "ensureInRange", "(", "n", "int16", ",", "min", "int16", ",", "<mask>", "int16", ")", "int16", "{", "if", "n", "<", "min", "{", "return", "min", "\n", "}", "else", "if", "n", ">", "max", "{", "return", "max", "\n", "}", "else", "{", "return", "n", "\n", "}", "\n", "}" ]
1,995
all-1996
[ "NewKubeClient", "returns", "a", "new", "Kubernetes", "client", "object", ".", "It", "takes", "a", "Config", "and", "uses", "KubeMaster", "and", "KubeConfig", "attributes", "to", "connect", "to", "the", "cluster", ".", "If", "KubeConfig", "isn", "t", "provided", "it", "defaults", "to", "using", "the", "recommended", "default", "." ]
[ "func", "NewKubeClient", "(", "kubeConfig", ",", "kubeMaster", "string", ",", "requestTimeout", "time", ".", "Duration", ")", "(", "*", "kubernetes", ".", "Clientset", ",", "error", ")", "{", "if", "kubeConfig", "==", "\"", "\"", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "clientcmd", ".", "RecommendedHomeFile", ")", ";", "err", "==", "nil", "{", "kubeConfig", "=", "clientcmd", ".", "RecommendedHomeFile", "\n", "}", "\n", "}", "\n\n", "config", ",", "err", ":=", "clientcmd", ".", "BuildConfigFromFlags", "(", "kubeMaster", ",", "kubeConfig", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "config", ".", "WrapTransport", "=", "func", "(", "rt", "http", ".", "RoundTripper", ")", "http", ".", "RoundTripper", "{", "return", "instrumented_http", ".", "NewTransport", "(", "rt", ",", "&", "instrumented_http", ".", "Callbacks", "{", "PathProcessor", ":", "func", "(", "path", "string", ")", "string", "{", "parts", ":=", "strings", ".", "Split", "(", "<mask>", ",", "\"", "\"", ")", "\n", "return", "parts", "[", "len", "(", "parts", ")", "-", "1", "]", "\n", "}", ",", "}", ")", "\n", "}", "\n\n", "config", ".", "Timeout", "=", "requestTimeout", "\n\n", "client", ",", "err", ":=", "kubernetes", ".", "NewForConfig", "(", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "log", ".", "Infof", "(", "\"", "\"", ",", "config", ".", "Host", ")", "\n\n", "return", "client", ",", "nil", "\n", "}" ]
1,996
all-1997
[ "ToPhone", "will", "format", "the", "provided", "string", "as", "a", "Phone", "Number", ".", "Only", "supports", "US", "numbers", "currently", "." ]
[ "func", "ToPhone", "(", "theString", ",", "delimiter", "string", ")", "(", "string", ",", "error", ")", "{", "f", ":=", "New", "(", "theString", ")", "\n", "f", ".", "removeNonDigits", "(", ")", "\n\n", "if", "f", ".", "length", "<", "10", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "lengthError", ")", "\n", "}", "\n\n", "var", "buffer", "<mask>", ".", "Buffer", "\n", "count", ":=", "0", "\n", "switch", "f", ".", "length", "{", "case", "10", ":", "buffer", ".", "WriteString", "(", "\"", "\"", ")", "\n", "for", "_", ",", "i", ":=", "range", "f", ".", "theString", "{", "count", "++", "\n", "buffer", ".", "WriteString", "(", "string", "(", "i", ")", ")", "\n", "switch", "count", "{", "case", "3", ":", "buffer", ".", "WriteString", "(", "\"", "\"", ")", "\n", "case", "6", ":", "buffer", ".", "WriteString", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "delimiter", ")", ")", "\n", "}", "\n", "}", "\n", "case", "11", ":", "for", "_", ",", "i", ":=", "range", "f", ".", "theString", "{", "count", "++", "\n", "buffer", ".", "WriteString", "(", "string", "(", "i", ")", ")", "\n", "switch", "count", "{", "case", "1", ":", "buffer", ".", "WriteString", "(", "\"", "\"", ")", "\n", "case", "4", ":", "buffer", ".", "WriteString", "(", "\"", "\"", ")", "\n", "case", "7", ":", "buffer", ".", "WriteString", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "delimiter", ")", ")", "\n", "}", "\n", "}", "\n", "default", ":", "return", "\"", "\"", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "buffer", ".", "String", "(", ")", ",", "nil", "\n", "}" ]
1,997
all-1998
[ "Step", "4", ":", "Search", "for", "the", "longest", "among", "the", "following", "suffixes", "and", "if", "found", "and", "in", "R2", "perform", "the", "action", "indicated", ".", "al", "ance", "ence", "er", "ic", "able", "ible", "ant", "ement", "ment", "ent", "ism", "ate", "iti", "ous", "ive", "ize", "delete", "ion", "delete", "if", "preceded", "by", "s", "or", "t" ]
[ "func", "step4", "(", "w", "*", "snowballword", ".", "SnowballWord", ")", "bool", "{", "// Find all endings in R1", "suffix", ",", "suffixRunes", ":=", "w", ".", "FirstSuffix", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", ")", "\n\n", "// If it does not fit in R2, do nothing.", "if", "len", "(", "suffixRunes", ")", ">", "len", "(", "w", ".", "RS", ")", "-", "w", ".", "R2start", "{", "return", "false", "\n", "}", "\n\n", "// Handle special cases", "<mask>", "suffix", "{", "case", "\"", "\"", ":", "return", "false", "\n\n", "case", "\"", "\"", ":", "// Replace by og if preceded by l", "// l = 108", "rsLen", ":=", "len", "(", "w", ".", "RS", ")", "\n", "if", "rsLen", ">=", "4", "{", "switch", "w", ".", "RS", "[", "rsLen", "-", "4", "]", "{", "case", "115", ",", "116", ":", "w", ".", "RemoveLastNRunes", "(", "len", "(", "suffixRunes", ")", ")", "\n", "return", "true", "\n", "}", "\n\n", "}", "\n", "return", "false", "\n", "}", "\n\n", "// Handle basic replacements", "w", ".", "RemoveLastNRunes", "(", "len", "(", "suffixRunes", ")", ")", "\n", "return", "true", "\n\n", "}" ]
1,998
all-1999
[ "Build", "builds", "the", "URL", "path", "using", "the", "given", "positional", "and", "named", "variables", "and", "writes", "it", "to", "the", "given", "URL", "." ]
[ "func", "(", "m", "*", "GorillaPathPrefix", ")", "Build", "(", "u", "*", "url", ".", "URL", ",", "values", "url", ".", "Values", ")", "error", "{", "path", ",", "err", ":=", "m", ".", "RevertValid", "(", "values", ")", "\n", "if", "err", "==", "nil", "{", "u", ".", "<mask>", "=", "path", "\n", "}", "\n", "return", "err", "\n", "}" ]
1,999
all-2000
[ "NewTokenSource", "creates", "a", "oauth2", ".", "TokenSource", "that", "generates", "auth", "tokens", "redeemed", "using", "the", "JWT", "Bearer", "Grant", "assertion", "auth", "flow", "using", "the", "supplied", "jwt", ".", "Signer", ".", "A", "token", "redemption", "will", "be", "invoked", "at", "the", "tokenURL", "using", "the", "supplied", "context", ".", "Use", "the", "Claim", "option", "to", "pass", "additional", "claims", "to", "the", "token", "source", "." ]
[ "func", "NewTokenSource", "(", "signer", "jwt", ".", "Signer", ",", "tokenURL", "string", ",", "ctxt", "context", ".", "Context", ",", "opts", "...", "Option", ")", "(", "*", "Bearer", ",", "error", ")", "{", "var", "err", "error", "\n\n", "b", ":=", "&", "Bearer", "{", "signer", ":", "signer", ",", "tokenURL", ":", "tokenURL", ",", "context", ":", "ctxt", ",", "claims", ":", "make", "(", "<mask>", "[", "string", "]", "interface", "{", "}", ")", ",", "}", "\n\n", "// apply opts", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "err", "=", "o", "(", "b", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "return", "b", ",", "nil", "\n", "}" ]