id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
12,100
all-12101
[ "WriteResource", "writest", "the", "code", "for", "a", "resource", "." ]
[ "func", "(", "c", "*", "ClientWriter", ")", "WriteResource", "(", "resource", "*", "gen", ".", "Resource", ",", "w", "io", ".", "<mask>", ")", "error", "{", "return", "c", ".", "resourceTmpl", ".", "Execute", "(", "w", ",", "resource", ")", "\n", "}" ]
12,101
all-12102
[ "Lazy", "load", "Handlers", "slice", "/", "mutex", "for", "EventController" ]
[ "func", "(", "e", "*", "EventController", ")", "lazyLoadHandler", "(", ")", "{", "// Lazy loading of EventController handler mutex", "if", "e", ".", "handlerMutex", "==", "nil", "{", "e", ".", "handlerMutex", "=", "new", "(", "<mask>", ".", "Mutex", ")", "\n", "}", "\n\n", "// Lazy loading of EventController handler map", "if", "e", ".", "Handlers", "==", "nil", "{", "e", ".", "handlerMutex", ".", "Lock", "(", ")", "\n", "e", ".", "Handlers", "=", "make", "(", "map", "[", "string", "]", "Handler", ")", "\n", "e", ".", "handlerMutex", ".", "Unlock", "(", ")", "\n", "}", "\n\n", "}" ]
12,102
all-12103
[ "ScheduledActionLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "ScheduledActionLocator", "(", "href", "<mask>", ")", "*", "ScheduledActionLocator", "{", "return", "&", "ScheduledActionLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
12,103
all-12104
[ "NewTimestampCollector", "creates", "a", "TimestampCollector", "." ]
[ "func", "NewTimestampCollector", "(", ")", "*", "TimestampCollector", "{", "return", "&", "TimestampCollector", "{", "<mask>", ":", "prometheus", ".", "NewDesc", "(", "\"", "\"", ",", "\"", "\"", ",", "[", "]", "string", "{", "\"", "\"", "}", ",", "nil", ",", ")", ",", "discoverers", ":", "make", "(", "map", "[", "*", "Discovery", "]", "struct", "{", "}", ")", ",", "}", "\n", "}" ]
12,104
all-12105
[ "GetVAdjustment", "()", "is", "a", "wrapper", "around", "gtk_scrolled_window_get_vadjustment", "()", "." ]
[ "func", "(", "v", "*", "ScrolledWindow", ")", "GetVAdjustment", "(", ")", "*", "Adjustment", "{", "c", ":=", "C", ".", "gtk_scrolled_window_get_vadjustment", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "<mask>", "nil", "\n", "}", "\n", "return", "wrapAdjustment", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", "\n", "}" ]
12,105
all-12106
[ "layerInfosToStrings", "converts", "a", "list", "of", "layer", "infos", "presumably", "obtained", "from", "a", "Manifest", ".", "LayerInfos", "()", "method", "call", "into", "a", "format", "suitable", "for", "inclusion", "in", "a", "types", ".", "ImageInspectInfo", "structure", "." ]
[ "func", "layerInfosToStrings", "(", "infos", "[", "]", "LayerInfo", ")", "[", "]", "string", "{", "layers", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "infos", ")", ")", "\n", "for", "i", ",", "info", ":=", "range", "infos", "{", "layers", "[", "i", "]", "=", "<mask>", ".", "Digest", ".", "String", "(", ")", "\n", "}", "\n", "return", "layers", "\n", "}" ]
12,106
all-12107
[ "MutateTransaction", "for", "CreateAccountBuilder", "causes", "the", "underylying", "CreateAccountOp", "to", "be", "added", "to", "the", "operation", "list", "for", "the", "provided", "transaction" ]
[ "func", "(", "m", "CreateAccountBuilder", ")", "MutateTransaction", "(", "o", "*", "TransactionBuilder", ")", "error", "{", "if", "m", ".", "Err", "!=", "nil", "{", "return", "m", ".", "Err", "\n", "}", "\n\n", "m", ".", "O", ".", "Body", ",", "m", ".", "Err", "=", "xdr", ".", "NewOperationBody", "(", "xdr", ".", "OperationTypeCreateAccount", ",", "m", ".", "CA", ")", "\n", "o", ".", "TX", ".", "Operations", "=", "<mask>", "(", "o", ".", "TX", ".", "Operations", ",", "m", ".", "O", ")", "\n", "return", "m", ".", "Err", "\n", "}" ]
12,107
all-12108
[ "NewMemberListCommand", "returns", "the", "cobra", "command", "for", "member", "list", "." ]
[ "func", "NewMemberListCommand", "(", ")", "*", "cobra", ".", "Command", "{", "cc", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Long", ":", "`When --write-out is set to simple, this command prints out comma-separated member lists for each endpoint.\nThe items in the lists are ID, Status, Name, Peer Addrs, Client Addrs.\n`", ",", "Run", ":", "memberListCommandFunc", ",", "}", "\n\n", "return", "<mask>", "\n", "}" ]
12,108
all-12109
[ "Error", "returns", "the", "original", "error", "message", "plus", "the", "stack", "trace", "captured", "at", "the", "time", "the", "error", "was", "first", "wrapped", "." ]
[ "func", "(", "t", "*", "traceableError", ")", "Error", "(", ")", "string", "{", "str", ":=", "t", ".", "err", ".", "Error", "(", ")", "\n", "for", "_", ",", "frame", ":=", "<mask>", "t", ".", "stack", "{", "str", "+=", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "frame", ".", "string", "(", ")", ")", "\n", "}", "\n", "return", "str", "\n", "}" ]
12,109
all-12110
[ "NewMessage", "builds", "a", "new", "message", "." ]
[ "func", "NewMessage", "(", ")", "Message", "{", "return", "<mask>", "{", "Context", ":", "context", ".", "Background", "(", ")", ",", "Headers", ":", "map", "[", "string", "]", "string", "{", "}", ",", "Data", ":", "render", ".", "Data", "{", "}", ",", "moot", ":", "&", "sync", ".", "RWMutex", "{", "}", ",", "}", "\n", "}" ]
12,110
all-12111
[ "Descendants", "returns", "a", "slice", "containing", "all", "descendants", "of", "a", "node", "id", "in", "d", "which", "are", "an", "ancestor", "of", "at", "least", "one", "of", "the", "nodes", "in", "to", "." ]
[ "func", "(", "d", "*", "DAG", ")", "Descendants", "(", "<mask>", "string", ",", "to", "[", "]", "string", ")", "[", "]", "string", "{", "seen", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "for", "_", ",", "toID", ":=", "range", "to", "{", "seen", "[", "toID", "]", "=", "true", "\n", "}", "\n", "return", "bfs", "(", "id", ",", "d", ".", "children", ",", "seen", ")", "\n", "}" ]
12,111
all-12112
[ "Not", "creates", "a", "Not", "query", "." ]
[ "func", "(", "idx", "*", "Index", ")", "Not", "(", "<mask>", "*", "PQLRowQuery", ")", "*", "PQLRowQuery", "{", "return", "NewPQLRowQuery", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "row", ".", "serialize", "(", ")", ")", ",", "idx", ",", "row", ".", "Error", "(", ")", ")", "\n", "}" ]
12,112
all-12113
[ "Message", "returns", "the", "log", "record", "message", "." ]
[ "func", "(", "r", "*", "Record", ")", "Message", "(", ")", "string", "{", "if", "r", ".", "message", "==", "nil", "{", "// Redact the arguments that implements the Redactor interface", "for", "i", ",", "arg", ":=", "range", "r", ".", "Args", "{", "if", "redactor", ",", "ok", ":=", "arg", ".", "(", "Redactor", ")", ";", "ok", "==", "true", "{", "r", ".", "Args", "[", "i", "]", "=", "redactor", ".", "Redacted", "(", ")", "\n", "}", "\n", "}", "\n", "var", "buf", "bytes", ".", "Buffer", "\n", "if", "r", ".", "fmt", "!=", "nil", "{", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "*", "r", ".", "fmt", ",", "r", ".", "Args", "...", ")", "\n", "}", "else", "{", "// use Fprintln to make sure we always get space between arguments", "fmt", ".", "Fprintln", "(", "&", "buf", ",", "r", ".", "Args", "...", ")", "\n", "buf", ".", "Truncate", "(", "buf", ".", "Len", "(", ")", "-", "1", ")", "// strip newline", "\n", "}", "\n", "msg", ":=", "buf", ".", "String", "(", ")", "\n", "r", ".", "message", "=", "&", "msg", "\n", "}", "\n", "return", "*", "r", ".", "<mask>", "\n", "}" ]
12,113
all-12114
[ "Data", "returns", "the", "most", "-", "recently", "-", "received", "data", "from", "Consul", "for", "this", "View", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "Data", "(", ")", "interface", "{", "}", "{", "v", ".", "dataLock", ".", "RLock", "(", ")", "\n", "defer", "v", ".", "dataLock", ".", "RUnlock", "(", ")", "\n", "return", "v", ".", "data", "\n", "}" ]
12,114
all-12115
[ "Scale", "returns", "a", "new", "vector", "that", "is", "the", "result", "of", "v", "*", "t" ]
[ "func", "(", "v", "Vec3", ")", "Scale", "(", "t", "float32", ")", "Vec3", "{", "<mask>", "NewVec3XYZ", "(", "v", "[", "0", "]", "*", "t", ",", "v", "[", "1", "]", "*", "t", ",", "v", "[", "2", "]", "*", "t", ",", ")", "\n", "}" ]
12,115
all-12116
[ "Translate", "translates", "a", "matrix", "by", "the", "given", "amount" ]
[ "func", "(", "m", "*", "Matrix", ")", "Translate", "(", "<mask>", ",", "ty", "float64", ")", "{", "C", ".", "cairo_matrix_translate", "(", "m", ".", "native", "(", ")", ",", "C", ".", "double", "(", "tx", ")", ",", "C", ".", "double", "(", "ty", ")", ")", "\n", "}" ]
12,116
all-12117
[ "HasTitle", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "Graph", ")", "HasTitle", "(", ")", "bool", "{", "if", "g", "!=", "nil", "&&", "g", ".", "Title", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
12,117
all-12118
[ "NodeByAddress", "returns", "the", "node", "with", "the", "given", "network", "address", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "NodeByAddress", "(", "address", "string", ")", "(", "NodeInfo", ",", "error", ")", "{", "null", ":=", "NodeInfo", "{", "}", "\n", "nodes", ",", "err", ":=", "c", ".", "nodes", "(", "false", "/* not pending */", ",", "\"", "\"", ",", "address", ")", "\n", "if", "err", "!=", "nil", "{", "return", "null", ",", "err", "\n", "}", "\n", "switch", "len", "(", "nodes", ")", "{", "case", "0", ":", "return", "null", ",", "ErrNoSuchObject", "\n", "case", "1", ":", "return", "nodes", "[", "0", "]", ",", "nil", "\n", "<mask>", ":", "return", "null", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "}" ]
12,118
all-12119
[ "AppendEntries", "implements", "the", "Transport", "interface", "." ]
[ "func", "(", "i", "*", "InmemTransport", ")", "AppendEntries", "(", "<mask>", "ServerID", ",", "target", "ServerAddress", ",", "args", "*", "AppendEntriesRequest", ",", "resp", "*", "AppendEntriesResponse", ")", "error", "{", "rpcResp", ",", "err", ":=", "i", ".", "makeRPC", "(", "target", ",", "args", ",", "nil", ",", "i", ".", "timeout", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Copy the result back", "out", ":=", "rpcResp", ".", "Response", ".", "(", "*", "AppendEntriesResponse", ")", "\n", "*", "resp", "=", "*", "out", "\n", "return", "nil", "\n", "}" ]
12,119
all-12120
[ "HasWidth", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "SyntheticsDevice", ")", "HasWidth", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Width", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
12,120
all-12121
[ "NewServer", "creates", "a", "new", "pay", "server", "." ]
[ "func", "NewServer", "(", "conf", "*", "Config", ",", "logger", "log", ".", "Logger", ",", "db", "*", "reform", ".", "DB", ")", "*", "Server", "{", "s", ":=", "&", "Server", "{", "<mask>", ":", "srv", ".", "NewServer", "(", "conf", ".", "Config", ")", ",", "logger", ":", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", ",", "db", ":", "db", ",", "}", "\n\n", "s", ".", "HandleFunc", "(", "payPath", ",", "s", ".", "RequireHTTPMethods", "(", "s", ".", "logger", ",", "s", ".", "handlePay", ",", "http", ".", "MethodPost", ")", ")", "\n\n", "return", "s", "\n", "}" ]
12,121
all-12122
[ "Increment", "will", "increment", "an", "HOTP", "source", "s", "counter", ".", "This", "is", "useful", "for", "providers", "like", "the", "Google", "Authenticator", "app", "which", "immediately", "increments", "the", "counter", "and", "uses", "the", "0", "counter", "value", "as", "an", "integrity", "check", "." ]
[ "func", "(", "otp", "HOTP", ")", "Increment", "(", ")", "{", "for", "i", ":=", "ctrSize", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "if", "otp", ".", "<mask>", "[", "i", "]", "++", ";", "otp", ".", "counter", "[", "i", "]", "!=", "0", "{", "return", "\n", "}", "\n", "}", "\n", "}" ]
12,122
all-12123
[ "AttrKeys", "returns", "a", "sorted", "list", "of", "attribute", "keys", "used", "in", "this", "rule", "." ]
[ "func", "(", "r", "*", "Rule", ")", "AttrKeys", "(", ")", "[", "]", "string", "{", "<mask>", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "r", ".", "attrs", ")", ")", "\n", "for", "k", ":=", "range", "r", ".", "attrs", "{", "keys", "=", "append", "(", "keys", ",", "k", ")", "\n", "}", "\n", "sort", ".", "SliceStable", "(", "keys", ",", "func", "(", "i", ",", "j", "int", ")", "bool", "{", "if", "cmp", ":=", "bt", ".", "NamePriority", "[", "keys", "[", "i", "]", "]", "-", "bt", ".", "NamePriority", "[", "keys", "[", "j", "]", "]", ";", "cmp", "!=", "0", "{", "return", "cmp", "<", "0", "\n", "}", "\n", "return", "keys", "[", "i", "]", "<", "keys", "[", "j", "]", "\n", "}", ")", "\n", "return", "keys", "\n", "}" ]
12,123
all-12124
[ "Do", "executes", "DOM", ".", "collectClassNamesFromSubtree", "against", "the", "provided", "context", ".", "returns", ":", "classNames", "-", "Class", "name", "list", "." ]
[ "func", "(", "p", "*", "CollectClassNamesFromSubtreeParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "classNames", "[", "]", "string", ",", "err", "error", ")", "{", "// execute", "var", "res", "CollectClassNamesFromSubtreeReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandCollectClassNamesFromSubtree", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "ClassNames", ",", "nil", "\n", "}" ]
12,124
all-12125
[ "SpinButtonNew", "()", "is", "a", "wrapper", "around", "gtk_spin_button_new", "()", "." ]
[ "func", "SpinButtonNew", "(", "adjustment", "*", "Adjustment", ",", "climbRate", "float64", ",", "digits", "uint", ")", "(", "*", "SpinButton", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_spin_button_new", "(", "adjustment", ".", "native", "(", ")", ",", "C", ".", "gdouble", "(", "climbRate", ")", ",", "C", ".", "guint", "(", "digits", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapSpinButton", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
12,125
all-12126
[ "newHelperMethodContent", "creates", "and", "returns", "a", "helper", "method", "content", "." ]
[ "func", "newHelperMethodContent", "(", "ln", "*", "line", ",", "rslt", "*", "result", ",", "src", "*", "source", ",", "parent", "element", ",", "opts", "*", "Options", ")", "(", "*", "helperMethodContent", ",", "error", ")", "{", "if", "len", "(", "ln", ".", "tokens", ")", "<", "3", "||", "ln", ".", "tokens", "[", "2", "]", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "ln", ".", "fileName", "(", ")", ",", "ln", ".", "no", ")", "\n", "}", "\n\n", "e", ":=", "&", "helperMethodContent", "{", "elementBase", ":", "newElementBase", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", ",", "<mask>", ":", "ln", ".", "tokens", "[", "2", "]", ",", "}", "\n\n", "return", "e", ",", "nil", "\n", "}" ]
12,126
all-12127
[ "DeleteMetricCluster", "deletes", "passed", "metric", "cluster", "." ]
[ "func", "(", "a", "*", "API", ")", "DeleteMetricCluster", "(", "cfg", "*", "MetricCluster", ")", "(", "bool", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "<mask>", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "a", ".", "DeleteMetricClusterByCID", "(", "CIDType", "(", "&", "cfg", ".", "CID", ")", ")", "\n", "}" ]
12,127
all-12128
[ "IsDate", "returns", "true", "when", "the", "string", "is", "a", "valid", "date" ]
[ "func", "IsDate", "(", "str", "string", ")", "bool", "{", "_", ",", "err", ":=", "<mask>", ".", "Parse", "(", "RFC3339FullDate", ",", "str", ")", "\n", "return", "err", "==", "nil", "\n", "}" ]
12,128
all-12129
[ "ClearRow", "creates", "a", "ClearRow", "query", ".", "ClearRow", "sets", "all", "bits", "to", "0", "in", "a", "given", "row", "of", "the", "binary", "matrix", "thus", "disassociating", "the", "given", "row", "in", "the", "given", "field", "from", "all", "columns", "." ]
[ "func", "(", "f", "*", "Field", ")", "ClearRow", "(", "rowIDOrKey", "interface", "{", "}", ")", "*", "PQLBaseQuery", "{", "rowStr", ",", "err", ":=", "formatIDKeyBool", "(", "rowIDOrKey", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NewPQLBaseQuery", "(", "\"", "\"", ",", "f", ".", "index", ",", "err", ")", "\n", "}", "\n", "text", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f", ".", "name", ",", "rowStr", ")", "\n", "q", ":=", "NewPQLBaseQuery", "(", "text", ",", "f", ".", "<mask>", ",", "nil", ")", "\n", "return", "q", "\n", "}" ]
12,129
all-12130
[ "AddTask", "indicates", "an", "expected", "call", "of", "AddTask" ]
[ "func", "(", "mr", "*", "MockTaskEngineMockRecorder", ")", "AddTask", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockTaskEngine", ")", "(", "nil", ")", ".", "AddTask", ")", ",", "arg0", ")", "\n", "}" ]
12,130
all-12131
[ "Next", "returns", "the", "next", "page", "of", "resources", ".", "If", "there", "are", "no", "more", "resources", "NoMoreResults", "is", "returned", "." ]
[ "func", "(", "o", "*", "OutgoingCallerIDPageIterator", ")", "Next", "(", "ctx", "context", ".", "<mask>", ")", "(", "*", "OutgoingCallerIDPage", ",", "error", ")", "{", "op", ":=", "new", "(", "OutgoingCallerIDPage", ")", "\n", "err", ":=", "o", ".", "p", ".", "Next", "(", "ctx", ",", "op", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "o", ".", "p", ".", "SetNextPageURI", "(", "op", ".", "NextPageURI", ")", "\n", "return", "op", ",", "nil", "\n", "}" ]
12,131
all-12132
[ "String", "returns", "a", "human", "readable", "string", "representation", "of", "this", "object" ]
[ "func", "(", "cs", "ContainerStatus", ")", "String", "(", ")", "string", "{", "for", "k", ",", "v", ":=", "range", "containerStatusMap", "{", "if", "v", "==", "<mask>", "{", "return", "k", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
12,132
all-12133
[ "GetId", "returns", "the", "Id", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "Comment", ")", "GetId", "(", ")", "int", "{", "if", "c", "==", "nil", "||", "c", ".", "<mask>", "==", "nil", "{", "return", "0", "\n", "}", "\n", "return", "*", "c", ".", "Id", "\n", "}" ]
12,133
all-12134
[ "specify", "a", "three", "-", "dimensional", "texture", "subimage", "in", "a", "compressed", "format" ]
[ "func", "CompressedTextureSubImage3D", "(", "texture", "uint32", ",", "level", "int32", ",", "xoffset", "int32", ",", "yoffset", "int32", ",", "zoffset", "int32", ",", "width", "int32", ",", "height", "int32", ",", "<mask>", "int32", ",", "format", "uint32", ",", "imageSize", "int32", ",", "data", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall12", "(", "gpCompressedTextureSubImage3D", ",", "11", ",", "uintptr", "(", "texture", ")", ",", "uintptr", "(", "level", ")", ",", "uintptr", "(", "xoffset", ")", ",", "uintptr", "(", "yoffset", ")", ",", "uintptr", "(", "zoffset", ")", ",", "uintptr", "(", "width", ")", ",", "uintptr", "(", "height", ")", ",", "uintptr", "(", "depth", ")", ",", "uintptr", "(", "format", ")", ",", "uintptr", "(", "imageSize", ")", ",", "uintptr", "(", "data", ")", ",", "0", ")", "\n", "}" ]
12,134
all-12135
[ "MutateTransaction", "for", "MemoID", "sets", "the", "memo", "." ]
[ "func", "(", "m", "MemoID", ")", "MutateTransaction", "(", "o", "*", "TransactionBuilder", ")", "(", "err", "error", ")", "{", "o", ".", "TX", ".", "Memo", ",", "err", "=", "xdr", ".", "NewMemo", "(", "xdr", ".", "MemoTypeMemoId", ",", "xdr", ".", "Uint64", "(", "m", ".", "<mask>", ")", ")", "\n", "return", "\n", "}" ]
12,135
all-12136
[ "UnmarshalJSON", "implements", "json", ".", "Unmarshaler", ".", "It", "supports", "string", "and", "null", "input", ".", "Blank", "string", "input", "produces", "a", "null", "String", ".", "It", "also", "supports", "unmarshalling", "a", "sql", ".", "NullString", "." ]
[ "func", "(", "s", "*", "String", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "err", "error", "\n", "var", "v", "interface", "{", "}", "\n", "if", "err", "=", "json", ".", "Unmarshal", "(", "data", ",", "&", "v", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "switch", "x", ":=", "v", ".", "(", "type", ")", "{", "case", "string", ":", "s", ".", "String", "=", "x", "\n", "<mask>", "map", "[", "string", "]", "interface", "{", "}", ":", "err", "=", "json", ".", "Unmarshal", "(", "data", ",", "&", "s", ".", "NullString", ")", "\n", "case", "nil", ":", "s", ".", "Valid", "=", "false", "\n", "return", "nil", "\n", "default", ":", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "v", ")", ".", "Name", "(", ")", ")", "\n", "}", "\n", "s", ".", "Valid", "=", "(", "err", "==", "nil", ")", "&&", "(", "s", ".", "String", "!=", "\"", "\"", ")", "\n", "return", "err", "\n", "}" ]
12,136
all-12137
[ "Abandon", "implements", "storage", "interface", "." ]
[ "func", "(", "s", "*", "Storage", ")", "Abandon", "(", "ctx", "context", ".", "Context", ",", "accessToken", "string", ")", "(", "bool", ",", "error", ")", "{", "span", ",", "ctx", ":=", "opentracing", ".", "StartSpanFromContext", "(", "ctx", ",", "\"", "\"", ")", "\n", "defer", "span", ".", "Finish", "(", ")", "\n\n", "<mask>", ":=", "time", ".", "Now", "(", ")", "\n", "labels", ":=", "prometheus", ".", "Labels", "{", "\"", "\"", ":", "\"", "\"", "}", "\n\n", "result", ",", "err", ":=", "s", ".", "db", ".", "ExecContext", "(", "ctx", ",", "s", ".", "queryAbandon", ",", "accessToken", ")", "\n", "s", ".", "incQueries", "(", "labels", ",", "start", ")", "\n", "if", "err", "!=", "nil", "{", "s", ".", "incError", "(", "labels", ")", "\n", "return", "false", ",", "err", "\n", "}", "\n\n", "affected", ",", "err", ":=", "result", ".", "RowsAffected", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "if", "affected", "==", "0", "{", "return", "false", ",", "storage", ".", "ErrSessionNotFound", "\n", "}", "\n\n", "return", "true", ",", "nil", "\n", "}" ]
12,137
all-12138
[ "Attempt", "to", "shorten", "action", "pattern", "for", "display", "by", "looking", "at", "other", "action", "hrefs", "and", "picking", "one", "that", "doesn", "t", "have", "the", "suffix", "if", "there", "is", "one", "." ]
[ "func", "shortenPattern", "(", "res", "*", "metadata", ".", "Resource", ",", "pattern", ",", "suffix", "string", ")", "(", "string", ",", "bool", ")", "{", "if", "strings", ".", "HasSuffix", "(", "pattern", ",", "suffix", ")", "{", "pat", ":=", "strings", ".", "TrimSuffix", "(", "pattern", ",", "suffix", ")", "\n", "for", "_", ",", "action", ":=", "range", "res", ".", "Actions", "{", "for", "_", ",", "pattern2", ":=", "range", "action", ".", "PathPatterns", "{", "vars", ":=", "pattern2", ".", "Variables", "\n", "ivars", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "vars", ")", ")", "\n", "for", "i", ",", "v", ":=", "range", "vars", "{", "ivars", "[", "i", "]", "=", "interface", "{", "}", "(", "\"", "\"", "+", "v", ")", "\n", "}", "\n", "subPattern", ":=", "pattern2", ".", "<mask>", "\n", "pat2", ":=", "fmt", ".", "Sprintf", "(", "subPattern", ",", "ivars", "...", ")", "\n", "if", "pat", "==", "pat2", "{", "return", "pat", ",", "true", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "pattern", ",", "false", "\n", "}" ]
12,138
all-12139
[ "func", "IterRows", "(", "rows", "ObjectRows", "eachFunc", "func", "()", "done", "chan", "bool", ")", "(", "err", "error", ")", "{", "defer", "rows", ".", "Close", "()", "ok", ":", "=", "false", "for", "{", "select", "{", "case", "<", "-", "done", ":", "logger", ".", "Info", "(", "done", ")", "return", "default", ":", "var", "element", "interface", "{}", "ok", "err", "=", "rows", ".", "Next", "(", "&element", ")", "if", "err", "!", "=", "nil", "{", "logger", ".", "Error", "(", "error", "retrieving", "row", "err", "err", ")", "return", "}", "logger", ".", "Info", "(", "element", "el", "element", ")", "if", "ok", "{", "logger", ".", "Info", "(", "next", "element", "el", "element", ")", "results", "=", "append", "(", "results", "element", ")", "}", "else", "{", "if", "err", "!", "=", "nil", "{", "logger", ".", "Warn", "(", "Error", "retrieving", "rows", "err", "err", ")", "}", "return", "}", "}", "}", "return", "}" ]
[ "func", "ParseAllRows", "(", "rows", "ObjectRows", ",", "done", "chan", "bool", ")", "(", "results", "[", "]", "interface", "{", "}", ",", "err", "error", ")", "{", "defer", "rows", ".", "Close", "(", ")", "\n", "ok", ":=", "false", "\n", "for", "{", "select", "{", "case", "<-", "done", ":", "logger", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "\n", "default", ":", "var", "element", "<mask>", "{", "}", "\n", "ok", ",", "err", "=", "rows", ".", "Next", "(", "&", "element", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "\"", "\"", ",", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n", "logger", ".", "Info", "(", "\"", "\"", ",", "\"", "\"", ",", "element", ")", "\n", "if", "ok", "{", "logger", ".", "Info", "(", "\"", "\"", ",", "\"", "\"", ",", "element", ")", "\n", "results", "=", "append", "(", "results", ",", "element", ")", "\n\n", "}", "else", "{", "if", "err", "!=", "nil", "{", "logger", ".", "Warn", "(", "\"", "\"", ",", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
12,139
all-12140
[ "WaitFunc", "waits", "until", "specified", "function", "returns", "true", "." ]
[ "func", "WaitFunc", "(", "interval", ",", "timeout", "time", ".", "Duration", ",", "f", "func", "(", ")", "bool", ")", "bool", "{", "after", ":=", "time", ".", "After", "(", "timeout", ")", "\n", "for", "{", "select", "{", "case", "<-", "time", ".", "After", "(", "interval", ")", ":", "if", "f", "(", ")", "{", "return", "true", "\n", "}", "\n", "case", "<-", "<mask>", ":", "return", "false", "\n", "}", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
12,140
all-12141
[ "Fatalf", "calls", "Logger", ".", "Criticalf", "method", "with", "provided", "arguments", "." ]
[ "func", "(", "g", "GRPCLoggerV2", ")", "Fatalf", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "g", ".", "l", ".", "Criticalf", "(", "<mask>", ",", "args", "...", ")", "\n", "}" ]
12,141
all-12142
[ "RegisterLens", "registers", "new", "viewers" ]
[ "func", "RegisterLens", "(", "lens", "Lens", ")", "error", "{", "config", ":=", "lens", ".", "Config", "(", ")", "\n", "_", ",", "<mask>", ":=", "lensReg", "[", "config", ".", "Name", "]", "\n", "if", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "config", ".", "Name", ")", "\n", "}", "\n\n", "if", "config", ".", "Title", "==", "\"", "\"", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "config", ".", "Priority", "<", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "lensReg", "[", "config", ".", "Name", "]", "=", "lens", "\n", "logrus", ".", "Infof", "(", "\"", "\"", ",", "config", ".", "Name", ",", "config", ".", "Title", ")", "\n", "return", "nil", "\n", "}" ]
12,142
all-12143
[ "Purge", "removes", "a", "node", "entirely", "from", "the", "cluster", "database", "." ]
[ "func", "Purge", "(", "cluster", "*", "db", ".", "Cluster", ",", "name", "string", ")", "error", "{", "logger", ".", "Debugf", "(", "\"", "\"", ",", "name", ")", "\n\n", "return", "cluster", ".", "Transaction", "(", "func", "(", "<mask>", "*", "db", ".", "ClusterTx", ")", "error", "{", "// Get the node (if it doesn't exists an error is returned).", "node", ",", "err", ":=", "tx", ".", "NodeByName", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "name", ")", "\n", "}", "\n\n", "err", "=", "tx", ".", "NodeClear", "(", "node", ".", "ID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "name", ")", "\n", "}", "\n\n", "err", "=", "tx", ".", "NodeRemove", "(", "node", ".", "ID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
12,143
all-12144
[ "sanitiseRubyResponse", "removes", "Ruby", "-", "isms", "from", "the", "response", "content", "making", "the", "output", "much", "more", "human", "readable" ]
[ "func", "sanitiseRubyResponse", "(", "response", "string", ")", "string", "{", "log", ".", "Println", "(", "\"", "\"", ",", "<mask>", ")", "\n\n", "r", ":=", "regexp", ".", "MustCompile", "(", "\"", "\\\\", "\"", ")", "\n", "s", ":=", "r", ".", "ReplaceAllString", "(", "response", ",", "\"", "\"", ")", "\n\n", "r", "=", "regexp", ".", "MustCompile", "(", "\"", "\"", ")", "\n", "s", "=", "r", ".", "ReplaceAllString", "(", "s", ",", "\"", "\"", ")", "\n\n", "r", "=", "regexp", ".", "MustCompile", "(", "\"", "\\\\", "\"", ")", "\n", "s", "=", "r", ".", "ReplaceAllString", "(", "s", ",", "\"", "\\n", "\"", ")", "\n\n", "return", "s", "\n", "}" ]
12,144
all-12145
[ "Connect", "adds", "the", "route", "pattern", "that", "matches", "a", "CONNECT", "http", "method", "to", "execute", "the", "handlerFn", "http", ".", "HandlerFunc", "." ]
[ "func", "(", "mx", "*", "Mux", ")", "Connect", "(", "pattern", "string", ",", "handlerFn", "http", ".", "HandlerFunc", ")", "{", "mx", ".", "handle", "(", "mCONNECT", ",", "<mask>", ",", "handlerFn", ")", "\n", "}" ]
12,145
all-12146
[ "RetryLeaseClient", "implements", "a", "LeaseClient", "." ]
[ "func", "RetryLeaseClient", "(", "c", "*", "Client", ")", "pb", ".", "LeaseClient", "{", "return", "&", "retryLeaseClient", "{", "lc", ":", "pb", ".", "NewLeaseClient", "(", "c", ".", "<mask>", ")", ",", "}", "\n", "}" ]
12,146
all-12147
[ "AskString", "asks", "the", "user", "to", "enter", "a", "string", "which", "optionally", "conforms", "to", "a", "validation", "function", "." ]
[ "func", "AskString", "(", "question", "string", ",", "defaultAnswer", "string", ",", "validate", "func", "(", "string", ")", "error", ")", "string", "{", "for", "{", "<mask>", ":=", "askQuestion", "(", "question", ",", "defaultAnswer", ")", "\n\n", "if", "validate", "!=", "nil", "{", "error", ":=", "validate", "(", "answer", ")", "\n", "if", "error", "!=", "nil", "{", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "\"", "\\n", "\\n", "\"", ",", "error", ")", "\n", "continue", "\n", "}", "\n\n", "return", "answer", "\n", "}", "\n\n", "if", "len", "(", "answer", ")", "!=", "0", "{", "return", "answer", "\n", "}", "\n\n", "invalidInput", "(", ")", "\n", "}", "\n", "}" ]
12,147
all-12148
[ "GetLockedOk", "returns", "a", "tuple", "with", "the", "Locked", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "o", "*", "Options", ")", "GetLockedOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "o", "==", "nil", "||", "o", ".", "Locked", "==", "nil", "{", "return", "false", ",", "<mask>", "\n", "}", "\n", "return", "*", "o", ".", "Locked", ",", "true", "\n", "}" ]
12,148
all-12149
[ "Dial", "connects", "to", "the", "address", "addr", "on", "the", "network", "protocol", ".", "The", "address", "format", "is", "host", ":", "port", "where", "host", "may", "be", "a", "hostname", "or", "an", "IP", "address", ".", "Known", "protocols", "are", "tcp", "and", "udp", ".", "The", "returned", "connection", "satisfies", "net", ".", "Conn", "and", "is", "valid", "while", "ctx", "is", "valid", ";", "if", "the", "connection", "is", "to", "be", "used", "after", "ctx", "becomes", "invalid", "invoke", "SetContext", "with", "the", "new", "context", "." ]
[ "func", "Dial", "(", "ctx", "<mask>", ".", "Context", ",", "protocol", ",", "addr", "string", ")", "(", "*", "Conn", ",", "error", ")", "{", "return", "DialTimeout", "(", "ctx", ",", "protocol", ",", "addr", ",", "0", ")", "\n", "}" ]
12,149
all-12150
[ "PreloadFile", "returns", "the", "view", "which", "can", "preload", "static", "files", "and", "serve", "them", ".", "The", "different", "between", "StaticFile", "and", "PreloadFile", "is", "that", "StaticFile", "load", "the", "content", "of", "file", "at", "every", "request", "while", "PreloadFile", "load", "the", "content", "into", "memory", "at", "the", "initial", "stage", ".", "Despite", "that", "PreloadFile", "will", "be", "using", "more", "memories", "and", "could", "not", "update", "the", "content", "in", "time", "until", "restart", "the", "application", "it", "should", "be", "fast", "than", "StaticFile", "in", "runtime", "." ]
[ "func", "PreloadFile", "(", "filename", "string", ",", "contentType", "string", ")", "(", "preloadFile", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "return", "preloadFile", "{", "}", ",", "err", "\n", "}", "\n", "if", "contentType", "==", "\"", "\"", "{", "contentType", "=", "mime", ".", "TypeByExtension", "(", "path", ".", "Ext", "(", "filename", ")", ")", "\n", "}", "\n", "header", ":=", "make", "(", "http", ".", "Header", ")", "\n", "header", ".", "Set", "(", "\"", "\"", ",", "contentType", ")", "\n", "return", "preloadFile", "{", "body", ",", "header", "}", ",", "nil", "\n", "}" ]
12,150
all-12151
[ "HasOrderBy", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TileDefRequest", ")", "HasOrderBy", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "OrderBy", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
12,151
all-12152
[ "KeepCoveringApprovers", "finds", "who", "we", "should", "keep", "as", "suggested", "approvers", "given", "a", "pre", "-", "selection", "knownApprovers", "must", "be", "a", "subset", "of", "potentialApprovers", "." ]
[ "func", "(", "o", "Owners", ")", "KeepCoveringApprovers", "(", "reverseMap", "map", "[", "string", "]", "sets", ".", "String", ",", "knownApprovers", "sets", ".", "String", ",", "potentialApprovers", "[", "]", "string", ")", "sets", ".", "String", "{", "if", "len", "(", "potentialApprovers", ")", "==", "0", "{", "o", ".", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "}", "\n", "keptApprovers", ":=", "sets", ".", "NewString", "(", ")", "\n\n", "unapproved", ":=", "o", ".", "temporaryUnapprovedFiles", "(", "knownApprovers", ")", "\n\n", "for", "_", ",", "suggestedApprover", ":=", "range", "o", ".", "GetSuggestedApprovers", "(", "reverseMap", ",", "potentialApprovers", ")", ".", "<mask>", "(", ")", "{", "if", "reverseMap", "[", "suggestedApprover", "]", ".", "Intersection", "(", "unapproved", ")", ".", "Len", "(", ")", "!=", "0", "{", "keptApprovers", ".", "Insert", "(", "suggestedApprover", ")", "\n", "}", "\n", "}", "\n\n", "return", "keptApprovers", "\n", "}" ]
12,152
all-12153
[ "expandCustomizationGlobalIPSettings", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "CustomizationGlobalIPSettings", "." ]
[ "func", "expandCustomizationGlobalIPSettings", "(", "d", "*", "schema", ".", "ResourceData", ")", "types", ".", "CustomizationGlobalIPSettings", "{", "obj", ":=", "types", ".", "CustomizationGlobalIPSettings", "{", "DnsSuffixList", ":", "structure", ".", "SliceInterfacesToStrings", "(", "d", ".", "Get", "(", "cKeyPrefix", "+", "\"", "\"", "+", "\"", "\"", ")", ".", "(", "[", "]", "<mask>", "{", "}", ")", ")", ",", "DnsServerList", ":", "structure", ".", "SliceInterfacesToStrings", "(", "d", ".", "Get", "(", "cKeyPrefix", "+", "\"", "\"", "+", "\"", "\"", ")", ".", "(", "[", "]", "interface", "{", "}", ")", ")", ",", "}", "\n", "return", "obj", "\n", "}" ]
12,153
all-12154
[ "RecycleSocket", "puts", "socket", "back", "into", "the", "unused", "cache", "." ]
[ "func", "(", "server", "*", "mongoServer", ")", "RecycleSocket", "(", "socket", "*", "mongoSocket", ")", "{", "server", ".", "Lock", "(", ")", "\n", "if", "!", "server", ".", "closed", "{", "<mask>", ".", "unusedSockets", "=", "append", "(", "server", ".", "unusedSockets", ",", "socket", ")", "\n", "}", "\n", "server", ".", "Unlock", "(", ")", "\n", "}" ]
12,154
all-12155
[ "Import", "-", "will", "import", "to", "mysql", "from", "the", "given", "reader" ]
[ "func", "(", "s", "*", "MysqlDump", ")", "Import", "(", "lfile", "<mask>", ".", "Reader", ")", "(", "err", "error", ")", "{", "if", "err", "=", "s", ".", "RemoteOps", ".", "UploadFile", "(", "lfile", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "=", "s", ".", "restore", "(", ")", "\n", "lo", ".", "G", ".", "Debug", "(", "\"", "\"", ",", "err", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "err", "=", "s", ".", "RemoteOps", ".", "RemoveRemoteFile", "(", ")", "\n\n", "lo", ".", "G", ".", "Debug", "(", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}" ]
12,155
all-12156
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventInterstitialShown", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage58", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
12,156
all-12157
[ "we", "re", "using", "the", "challenges", "from", "the", "/", "v2", "/", "ping", "response", "and", "not", "the", "one", "from", "the", "destination", "URL", "in", "this", "request", "because", ":", "1", ")", "docker", "does", "that", "as", "well", "2", ")", "gcr", ".", "io", "is", "sending", "401", "without", "a", "WWW", "-", "Authenticate", "header", "in", "the", "real", "request", "debugging", ":", "https", ":", "//", "github", ".", "com", "/", "containers", "/", "image", "/", "pull", "/", "211#issuecomment", "-", "273426236", "and", "follows", "up" ]
[ "func", "(", "c", "*", "dockerClient", ")", "setupRequestAuth", "(", "req", "*", "http", ".", "Request", ",", "extraScope", "*", "authScope", ")", "error", "{", "if", "len", "(", "c", ".", "challenges", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "schemeNames", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "c", ".", "challenges", ")", ")", "\n", "for", "_", ",", "challenge", ":=", "range", "c", ".", "challenges", "{", "schemeNames", "=", "append", "(", "schemeNames", ",", "challenge", ".", "Scheme", ")", "\n", "switch", "challenge", ".", "Scheme", "{", "case", "\"", "\"", ":", "req", ".", "SetBasicAuth", "(", "c", ".", "username", ",", "c", ".", "password", ")", "\n", "return", "nil", "\n", "case", "\"", "\"", ":", "cacheKey", ":=", "\"", "\"", "\n", "scopes", ":=", "[", "]", "authScope", "{", "c", ".", "scope", "}", "\n", "if", "extraScope", "!=", "nil", "{", "// Using ':' as a separator here is unambiguous because getBearerToken below uses the same separator when formatting a remote request (and because repository names can't contain colons).", "cacheKey", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "extraScope", ".", "remoteName", ",", "extraScope", ".", "actions", ")", "\n", "scopes", "=", "append", "(", "scopes", ",", "*", "extraScope", ")", "\n", "}", "\n", "var", "token", "bearerToken", "\n", "t", ",", "inCache", ":=", "c", ".", "tokenCache", ".", "Load", "(", "cacheKey", ")", "\n", "if", "inCache", "{", "token", "=", "t", ".", "(", "bearerToken", ")", "\n", "}", "\n", "if", "!", "inCache", "||", "time", ".", "Now", "(", ")", ".", "After", "(", "token", ".", "expirationTime", ")", "{", "t", ",", "err", ":=", "c", ".", "getBearerToken", "(", "req", ".", "Context", "(", ")", ",", "challenge", ",", "scopes", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "token", "=", "*", "t", "\n", "c", ".", "tokenCache", ".", "Store", "(", "cacheKey", ",", "<mask>", ")", "\n", "}", "\n", "req", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "token", ".", "Token", ")", ")", "\n", "return", "nil", "\n", "default", ":", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "challenge", ".", "Scheme", ")", "\n", "}", "\n", "}", "\n", "logrus", ".", "Infof", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "schemeNames", ",", "\"", "\"", ")", ")", "\n", "return", "nil", "\n", "}" ]
12,157
all-12158
[ "redirectPath", "returns", "a", "handler", "that", "redirects", "if", "the", "path", "trailing", "slash", "differs", "from", "the", "request", "URL", "path", "." ]
[ "func", "redirectPath", "(", "path", "string", ",", "r", "*", "http", ".", "Request", ")", "http", ".", "Handler", "{", "t1", ":=", "strings", ".", "HasSuffix", "(", "path", ",", "\"", "\"", ")", "\n", "t2", ":=", "strings", ".", "HasSuffix", "(", "r", ".", "URL", ".", "Path", ",", "\"", "\"", ")", "\n", "if", "t1", "!=", "t2", "{", "u", ",", "_", ":=", "url", ".", "Parse", "(", "r", ".", "URL", ".", "String", "(", ")", ")", "\n", "if", "t1", "{", "u", ".", "Path", "+=", "\"", "\"", "\n", "}", "else", "{", "u", ".", "Path", "=", "u", ".", "Path", "[", ":", "len", "(", "u", ".", "Path", ")", "-", "1", "]", "\n", "}", "\n", "return", "http", ".", "RedirectHandler", "(", "u", ".", "<mask>", "(", ")", ",", "301", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
12,158
all-12159
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "App", "." ]
[ "func", "(", "in", "*", "App", ")", "DeepCopy", "(", ")", "*", "App", "{", "if", "<mask>", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "App", ")", "\n", "in", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
12,159
all-12160
[ "Log", "will", "log", "a", "message", "at", "the", "provided", "level", "to", "all", "loggers", "added", "to", "the", "Base", "associated", "with", "this", "LogAdapter" ]
[ "func", "(", "la", "*", "LogAdapter", ")", "Log", "(", "level", "LogLevel", ",", "attrs", "*", "Attrs", ",", "msg", "string", ",", "a", "...", "<mask>", "{", "}", ")", "error", "{", "if", "la", ".", "logLevel", "!=", "nil", "&&", "level", ">", "*", "la", ".", "logLevel", "{", "return", "nil", "\n", "}", "\n\n", "mergedAttrs", ":=", "la", ".", "attrs", ".", "clone", "(", ")", "\n", "mergedAttrs", ".", "MergeAttrs", "(", "attrs", ")", "\n", "return", "la", ".", "base", ".", "Log", "(", "level", ",", "mergedAttrs", ",", "msg", ",", "a", "...", ")", "\n", "}" ]
12,160
all-12161
[ "NewController", "constructs", "a", "new", "controller", "to", "reconcile", "stauses", "on", "config", "change" ]
[ "func", "NewController", "(", "continueOnError", "bool", ",", "addedPresubmitBlacklist", "sets", ".", "<mask>", ",", "prowJobClient", "prowv1", ".", "ProwJobInterface", ",", "githubClient", "*", "github", ".", "Client", ",", "configAgent", "*", "config", ".", "Agent", ",", "pluginAgent", "*", "plugins", ".", "ConfigAgent", ")", "*", "Controller", "{", "return", "&", "Controller", "{", "continueOnError", ":", "continueOnError", ",", "addedPresubmitBlacklist", ":", "addedPresubmitBlacklist", ",", "prowJobTriggerer", ":", "&", "kubeProwJobTriggerer", "{", "prowJobClient", ":", "prowJobClient", ",", "githubClient", ":", "githubClient", ",", "configAgent", ":", "configAgent", ",", "}", ",", "githubClient", ":", "githubClient", ",", "statusMigrator", ":", "&", "gitHubMigrator", "{", "githubClient", ":", "githubClient", ",", "continueOnError", ":", "continueOnError", ",", "}", ",", "trustedChecker", ":", "&", "githubTrustedChecker", "{", "githubClient", ":", "githubClient", ",", "pluginAgent", ":", "pluginAgent", ",", "}", ",", "}", "\n", "}" ]
12,161
all-12162
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "Violation", ")", "MarshalEasyJSON", "(", "<mask>", "*", "jwriter", ".", "Writer", ")", "{", "out", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
12,162
all-12163
[ "String", "returns", "a", "string", "representation", "of", "the", "key", "/", "value", "pairs", "in", "logfmt", "format", ":", "key1", "=", "value1", "key2", "=", "value2", "...", "." ]
[ "func", "(", "l", "List", ")", "<mask>", "(", ")", "string", "{", "buf", ":=", "pool", ".", "AllocBuffer", "(", ")", "\n", "defer", "pool", ".", "ReleaseBuffer", "(", "buf", ")", "\n", "l", ".", "writeToBuffer", "(", "buf", ")", "\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
12,163
all-12164
[ "DeleteImage", "deletes", "the", "named", "image", "from", "the", "registry", "if", "supported", "." ]
[ "func", "(", "ref", "ociArchiveReference", ")", "DeleteImage", "(", "ctx", "<mask>", ".", "Context", ",", "sys", "*", "types", ".", "SystemContext", ")", "error", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}" ]
12,164
all-12165
[ "Flatten", "flattens", "the", "FieldError", "hierarchical", "structure", "into", "a", "flat", "namespace", "style", "field", "name", "for", "those", "that", "want", "/", "need", "it", ".", "This", "is", "now", "needed", "because", "of", "the", "new", "dive", "functionality" ]
[ "func", "(", "e", "*", "FieldError", ")", "Flatten", "(", ")", "map", "[", "string", "]", "*", "FieldError", "{", "errs", ":=", "map", "[", "string", "]", "*", "FieldError", "{", "}", "\n\n", "if", "e", ".", "IsPlaceholderErr", "{", "if", "e", ".", "IsSliceOrArray", "{", "for", "key", ",", "err", ":=", "range", "e", ".", "SliceOrArrayErrs", "{", "fe", ",", "ok", ":=", "err", ".", "(", "*", "FieldError", ")", "\n\n", "if", "ok", "{", "if", "flat", ":=", "fe", ".", "Flatten", "(", ")", ";", "flat", "!=", "nil", "&&", "len", "(", "flat", ")", ">", "0", "{", "for", "k", ",", "v", ":=", "range", "flat", "{", "if", "fe", ".", "IsPlaceholderErr", "{", "errs", "[", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "key", ",", "k", ")", "]", "=", "v", "\n", "}", "else", "{", "errs", "[", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "key", ")", "]", "=", "v", "\n", "}", "\n\n", "}", "\n", "}", "\n", "}", "else", "{", "se", ":=", "err", ".", "(", "*", "StructErrors", ")", "\n\n", "if", "flat", ":=", "se", ".", "Flatten", "(", ")", ";", "flat", "!=", "nil", "&&", "len", "(", "flat", ")", ">", "0", "{", "for", "k", ",", "v", ":=", "<mask>", "flat", "{", "errs", "[", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "key", ",", "se", ".", "Struct", ",", "k", ")", "]", "=", "v", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "e", ".", "IsMap", "{", "for", "key", ",", "err", ":=", "range", "e", ".", "MapErrs", "{", "fe", ",", "ok", ":=", "err", ".", "(", "*", "FieldError", ")", "\n\n", "if", "ok", "{", "if", "flat", ":=", "fe", ".", "Flatten", "(", ")", ";", "flat", "!=", "nil", "&&", "len", "(", "flat", ")", ">", "0", "{", "for", "k", ",", "v", ":=", "range", "flat", "{", "if", "fe", ".", "IsPlaceholderErr", "{", "errs", "[", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "key", ",", "k", ")", "]", "=", "v", "\n", "}", "else", "{", "errs", "[", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "key", ")", "]", "=", "v", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "else", "{", "se", ":=", "err", ".", "(", "*", "StructErrors", ")", "\n\n", "if", "flat", ":=", "se", ".", "Flatten", "(", ")", ";", "flat", "!=", "nil", "&&", "len", "(", "flat", ")", ">", "0", "{", "for", "k", ",", "v", ":=", "range", "flat", "{", "errs", "[", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "key", ",", "se", ".", "Struct", ",", "k", ")", "]", "=", "v", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "errs", "\n", "}", "\n\n", "errs", "[", "e", ".", "Field", "]", "=", "e", "\n\n", "return", "errs", "\n", "}" ]
12,165
all-12166
[ "Copy", "creates", "a", "new", "Set", "containing", "the", "values", "of", "the", "first" ]
[ "func", "(", "us", "*", "unsafeSet", ")", "Copy", "(", ")", "<mask>", "{", "cp", ":=", "NewUnsafeSet", "(", ")", "\n", "for", "val", ":=", "range", "us", ".", "d", "{", "cp", ".", "Add", "(", "val", ")", "\n", "}", "\n\n", "return", "cp", "\n", "}" ]
12,166
all-12167
[ "NewTemplateWithFuncMap", "creates", "a", "new", "Template", "from", "the", "given", "string", "and", "a", "template", "FuncMap", ".", "The", "FuncMap", "available", "to", "the", "template", "during", "evaluation", "will", "also", "include", "the", "default", "values", "if", "not", "overridden", ".", "An", "error", "is", "returned", "if", "the", "template", "fails", "to", "compile", "." ]
[ "func", "NewTemplateWithFuncMap", "(", "tpl", "string", ",", "funcMap", "template", ".", "FuncMap", ")", "(", "*", "Template", ",", "error", ")", "{", "var", "levels", "=", "[", "]", "LogLevel", "{", "LevelNone", ",", "LevelDebug", ",", "LevelInfo", ",", "LevelWarning", ",", "LevelError", ",", "LevelFatal", "}", "\n", "tpls", ":=", "make", "(", "map", "[", "LogLevel", "]", "*", "template", ".", "Template", ",", "0", ")", "\n", "for", "_", ",", "<mask>", ":=", "range", "levels", "{", "// If color is overridden, we need to ensure that {{reset}} resets for all levels.", "_", ",", "forceReset", ":=", "funcMap", "[", "\"", "\"", "]", "\n", "fMap", ":=", "getFuncMap", "(", "level", ",", "forceReset", ")", "\n", "for", "name", ",", "f", ":=", "range", "funcMap", "{", "fMap", "[", "name", "]", "=", "f", "\n", "}", "\n\n", "parsedTpl", ",", "err", ":=", "template", ".", "New", "(", "getLevelName", "(", "level", ")", ")", ".", "Funcs", "(", "fMap", ")", ".", "Parse", "(", "tpl", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "tpls", "[", "level", "]", "=", "parsedTpl", "\n", "}", "\n\n", "newTpl", ":=", "&", "Template", "{", "tpls", ":", "tpls", ",", "}", "\n\n", "return", "newTpl", ",", "nil", "\n", "}" ]
12,167
all-12168
[ "Returns", "a", "signed", "URL", "for", "AzureTableSAS", "valid", "for", "the", "specified", "duration", ".", "Required", "scopes", ":", "If", "levelIsReadOnly", ":", "Any", "of", ":", "-", "auth", ":", "azure", "-", "table", ":", "read", "-", "only", ":", "<account", ">", "/", "<table", ">", "-", "auth", ":", "azure", "-", "table", ":", "read", "-", "write", ":", "<account", ">", "/", "<table", ">", "See", "AzureTableSAS", "for", "more", "details", "." ]
[ "func", "(", "auth", "*", "Auth", ")", "AzureTableSAS_SignedURL", "(", "account", ",", "table", ",", "level", "string", ",", "duration", "time", ".", "Duration", ")", "(", "*", "url", ".", "URL", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "Client", "(", "*", "auth", ")", "\n", "return", "(", "&", "cd", ")", ".", "SignedURL", "(", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "account", ")", "+", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "table", ")", "+", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "<mask>", ")", ",", "nil", ",", "duration", ")", "\n", "}" ]
12,168
all-12169
[ "AddImageName", "adds", "image", "name", "to", "image", "state" ]
[ "func", "(", "imageState", "*", "ImageState", ")", "AddImageName", "(", "imageName", "string", ")", "{", "imageState", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "imageState", ".", "lock", ".", "Unlock", "(", ")", "\n", "if", "!", "imageState", ".", "HasImageName", "(", "imageName", ")", "{", "seelog", ".", "Infof", "(", "\"", "\"", ",", "imageName", ",", "imageState", ".", "<mask>", ".", "ImageID", ")", "\n", "imageState", ".", "Image", ".", "Names", "=", "append", "(", "imageState", ".", "Image", ".", "Names", ",", "imageName", ")", "\n", "}", "\n", "}" ]
12,169
all-12170
[ "NewManager", "is", "the", "Manager", "constructor" ]
[ "func", "NewManager", "(", "logger", "log", ".", "Logger", ",", "app", "Appendable", ")", "*", "Manager", "{", "if", "logger", "==", "nil", "{", "logger", "=", "log", ".", "NewNopLogger", "(", ")", "\n", "}", "\n", "return", "&", "Manager", "{", "append", ":", "app", ",", "logger", ":", "logger", ",", "scrapeConfigs", ":", "make", "(", "map", "[", "string", "]", "*", "config", ".", "ScrapeConfig", ")", ",", "scrapePools", ":", "make", "(", "map", "[", "string", "]", "*", "scrapePool", ")", ",", "graceShut", ":", "<mask>", "(", "chan", "struct", "{", "}", ")", ",", "triggerReload", ":", "make", "(", "chan", "struct", "{", "}", ",", "1", ")", ",", "}", "\n", "}" ]
12,170
all-12171
[ "HTMLSnippet", "returns", "an", "HTML", "snippet", "representing", "this", "rule", "." ]
[ "func", "(", "rule", "*", "RecordingRule", ")", "HTMLSnippet", "(", "pathPrefix", "string", ")", "<mask>", ".", "HTML", "{", "ruleExpr", ":=", "rule", ".", "vector", ".", "String", "(", ")", "\n", "labels", ":=", "make", "(", "map", "[", "string", "]", "string", ",", "len", "(", "rule", ".", "labels", ")", ")", "\n", "for", "_", ",", "l", ":=", "range", "rule", ".", "labels", "{", "labels", "[", "l", ".", "Name", "]", "=", "template", ".", "HTMLEscapeString", "(", "l", ".", "Value", ")", "\n", "}", "\n\n", "r", ":=", "rulefmt", ".", "Rule", "{", "Record", ":", "fmt", ".", "Sprintf", "(", "`<a href=\"%s\">%s</a>`", ",", "pathPrefix", "+", "strutil", ".", "TableLinkForExpression", "(", "rule", ".", "name", ")", ",", "rule", ".", "name", ")", ",", "Expr", ":", "fmt", ".", "Sprintf", "(", "`<a href=\"%s\">%s</a>`", ",", "pathPrefix", "+", "strutil", ".", "TableLinkForExpression", "(", "ruleExpr", ")", ",", "template", ".", "HTMLEscapeString", "(", "ruleExpr", ")", ")", ",", "Labels", ":", "labels", ",", "}", "\n\n", "byt", ",", "err", ":=", "yaml", ".", "Marshal", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "template", ".", "HTML", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "template", ".", "HTMLEscapeString", "(", "err", ".", "Error", "(", ")", ")", ")", ")", "\n", "}", "\n\n", "return", "template", ".", "HTML", "(", "byt", ")", "\n", "}" ]
12,171
all-12172
[ "limitByteReader", "returns", "a", "limitedByteReader", "that", "reads", "from", "r", "and", "stops", "with", "io", ".", "EOF", "after", "n", "bytes", ".", "If", "r", "returns", "an", "io", ".", "EOF", "before", "reading", "n", "bytes", "io", ".", "ErrUnexpectedEOF", "is", "returned", "." ]
[ "func", "limitByteReader", "(", "r", "byteReader", ",", "n", "int64", ")", "*", "limitedByteReader", "{", "return", "&", "limitedByteReader", "{", "limitedReader", "{", "r", ",", "n", ",", "<mask>", ".", "ErrUnexpectedEOF", "}", ",", "r", "}", "\n", "}" ]
12,172
all-12173
[ "ForEachZone", "calls", "handler", "for", "each", "zone", "managed", "by", "the", "Designate" ]
[ "func", "(", "c", "designateClient", ")", "ForEachZone", "(", "<mask>", "func", "(", "zone", "*", "zones", ".", "Zone", ")", "error", ")", "error", "{", "pager", ":=", "zones", ".", "List", "(", "c", ".", "serviceClient", ",", "zones", ".", "ListOpts", "{", "}", ")", "\n", "return", "pager", ".", "EachPage", "(", "func", "(", "page", "pagination", ".", "Page", ")", "(", "bool", ",", "error", ")", "{", "list", ",", "err", ":=", "zones", ".", "ExtractZones", "(", "page", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "for", "_", ",", "zone", ":=", "range", "list", "{", "err", ":=", "handler", "(", "&", "zone", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "}", "\n", "return", "true", ",", "nil", "\n", "}", ",", ")", "\n", "}" ]
12,173
all-12174
[ "Initialize", "indicates", "an", "expected", "call", "of", "Initialize" ]
[ "func", "(", "mr", "*", "MockTaskResourceMockRecorder", ")", "Initialize", "(", "arg0", ",", "arg1", ",", "arg2", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockTaskResource", ")", "(", "nil", ")", ".", "Initialize", ")", ",", "arg0", ",", "arg1", ",", "arg2", ")", "\n", "}" ]
12,174
all-12175
[ "metricUnits", "attempts", "to", "detect", "known", "unit", "types", "used", "as", "part", "of", "a", "metric", "name", "e", ".", "g", ".", "foo_bytes_total", "or", "bar_baz_milligrams", "." ]
[ "func", "metricUnits", "(", "m", "string", ")", "(", "unit", "string", ",", "base", "string", ",", "ok", "bool", ")", "{", "ss", ":=", "strings", ".", "Split", "(", "m", ",", "\"", "\"", ")", "\n\n", "for", "_", ",", "u", ":=", "range", "baseUnits", "{", "// Also check for \"no prefix\".", "for", "_", ",", "p", ":=", "range", "append", "(", "unitPrefixes", ",", "\"", "\"", ")", "{", "for", "_", ",", "s", ":=", "range", "<mask>", "{", "// Attempt to explicitly match a known unit with a known prefix,", "// as some words may look like \"units\" when matching suffix.", "//", "// As an example, \"thermometers\" should not match \"meters\", but", "// \"kilometers\" should.", "if", "s", "==", "p", "+", "u", "{", "return", "p", "+", "u", ",", "u", ",", "true", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "\"", "\"", ",", "\"", "\"", ",", "false", "\n", "}" ]
12,175
all-12176
[ "UpdateOrgMembership", "invites", "a", "user", "to", "the", "org", "and", "/", "or", "updates", "their", "permission", "level", ".", "If", "the", "user", "is", "not", "already", "a", "member", "this", "will", "invite", "them", ".", "This", "will", "also", "change", "the", "role", "to", "/", "from", "admin", "on", "either", "the", "invitation", "or", "membership", "setting", ".", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "orgs", "/", "members", "/", "#add", "-", "or", "-", "update", "-", "organization", "-", "membership" ]
[ "func", "(", "c", "*", "Client", ")", "UpdateOrgMembership", "(", "org", ",", "user", "string", ",", "admin", "bool", ")", "(", "*", "OrgMembership", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "user", ",", "admin", ")", "\n", "om", ":=", "OrgMembership", "{", "}", "\n", "if", "admin", "{", "om", ".", "<mask>", "=", "RoleAdmin", "\n", "}", "else", "{", "om", ".", "Role", "=", "RoleMember", "\n", "}", "\n", "if", "c", ".", "dry", "{", "return", "&", "om", ",", "nil", "\n", "}", "\n\n", "_", ",", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "method", ":", "http", ".", "MethodPut", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "user", ")", ",", "requestBody", ":", "&", "om", ",", "exitCodes", ":", "[", "]", "int", "{", "200", "}", ",", "}", ",", "&", "om", ")", "\n", "return", "&", "om", ",", "err", "\n", "}" ]
12,176
all-12177
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "ProwJobSpec", "." ]
[ "func", "(", "in", "*", "ProwJobSpec", ")", "DeepCopy", "(", ")", "*", "ProwJobSpec", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "<mask>", "(", "ProwJobSpec", ")", "\n", "in", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
12,177
all-12178
[ "AlignmentNew", "is", "a", "wrapper", "around", "gtk_alignment_new", "()", "." ]
[ "func", "AlignmentNew", "(", "xalign", ",", "yalign", ",", "xscale", ",", "yscale", "float32", ")", "(", "*", "Alignment", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_alignment_new", "(", "C", ".", "gfloat", "(", "xalign", ")", ",", "C", ".", "gfloat", "(", "yalign", ")", ",", "C", ".", "gfloat", "(", "xscale", ")", ",", "C", ".", "gfloat", "(", "yscale", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapAlignment", "(", "obj", ")", ",", "nil", "\n", "}" ]
12,178
all-12179
[ "GetRedactedVersion", "-", "returns", "a", "redacted", "version", "of", "this", "task", "removing", "private", "info" ]
[ "func", "(", "s", "*", "Task", ")", "GetRedactedVersion", "(", ")", "RedactedTask", "{", "s", ".", "mutex", ".", "RLock", "(", ")", "\n", "rt", ":=", "RedactedTask", "{", "ID", ":", "s", ".", "<mask>", ",", "Timestamp", ":", "s", ".", "Timestamp", ",", "Expires", ":", "s", ".", "Expires", ",", "Status", ":", "s", ".", "Status", ",", "Profile", ":", "s", ".", "Profile", ",", "CallerName", ":", "s", ".", "CallerName", ",", "MetaData", ":", "s", ".", "MetaData", ",", "}", "\n", "s", ".", "mutex", ".", "RUnlock", "(", ")", "\n", "return", "rt", "\n", "}" ]
12,179
all-12180
[ "Transport", "is", "an", "option", "that", "sets", "an", "underlying", "client", "transport", "to", "the", "exchange", "process", "." ]
[ "func", "Transport", "(", "transport", "<mask>", ".", "RoundTripper", ")", "Option", "{", "return", "func", "(", "tok", "*", "Bearer", ")", "error", "{", "tok", ".", "transport", "=", "transport", "\n", "return", "nil", "\n", "}", "\n", "}" ]
12,180
all-12181
[ "GetHAdjustment", "()", "is", "a", "wrapper", "around", "gtk_scrolled_window_get_hadjustment", "()", "." ]
[ "func", "(", "v", "*", "ScrolledWindow", ")", "GetHAdjustment", "(", ")", "*", "Adjustment", "{", "c", ":=", "C", ".", "gtk_scrolled_window_get_hadjustment", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "<mask>", "wrapAdjustment", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", "\n", "}" ]
12,181
all-12182
[ "SetMaxValue", "()", "is", "a", "wrapper", "around", "gtk_level_bar_set_max_value", "()", "." ]
[ "func", "(", "v", "*", "LevelBar", ")", "SetMaxValue", "(", "<mask>", "float64", ")", "{", "C", ".", "gtk_level_bar_set_max_value", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gdouble", "(", "value", ")", ")", "\n", "}" ]
12,182
all-12183
[ "ContainerNodeAddress", "returns", "the", "address", "of", "the", "node", "hosting", "the", "container", "with", "the", "given", "name", "in", "the", "given", "project", ".", "It", "returns", "the", "empty", "string", "if", "the", "container", "is", "hosted", "on", "this", "node", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ContainerNodeAddress", "(", "project", "string", ",", "name", "string", ")", "(", "string", ",", "error", ")", "{", "stmt", ":=", "`\nSELECT nodes.id, nodes.address\n FROM nodes\n JOIN containers ON containers.node_id = nodes.id\n JOIN projects ON projects.id = containers.project_id\n WHERE projects.name = ? AND containers.name = ?\n`", "\n", "var", "address", "string", "\n", "var", "id", "int64", "\n", "rows", ",", "err", ":=", "c", ".", "tx", ".", "Query", "(", "stmt", ",", "project", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "defer", "rows", ".", "Close", "(", ")", "\n\n", "if", "!", "rows", ".", "Next", "(", ")", "{", "return", "\"", "\"", ",", "ErrNoSuchObject", "\n", "}", "\n\n", "err", "=", "rows", ".", "Scan", "(", "&", "id", ",", "&", "address", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "if", "rows", ".", "Next", "(", ")", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "err", "=", "rows", ".", "Err", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "if", "<mask>", "==", "c", ".", "nodeID", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n\n", "return", "address", ",", "nil", "\n", "}" ]
12,183
all-12184
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "DetachFromTargetParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget21", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
12,184
all-12185
[ "ItemByThumbPosition", "calculates", "item", "number", "by", "scrollbar", "thumb", "position", ".", "Position", "-", "thumb", "position", "inside", "scrollbar", "itemCount", "-", "total", "number", "of", "items", "lenght", "-", "lenght", "or", "heigth", "of", "scrollbar", ".", "Return", "-", "1", "if", "it", "is", "not", "possible", "to", "calculate", ":", "e", ".", "g", "itemCount", "equals", "zero" ]
[ "func", "ItemByThumbPosition", "(", "<mask>", ",", "itemCount", ",", "length", "int", ")", "int", "{", "length", "-=", "2", "\n", "if", "position", "<", "1", "{", "return", "-", "1", "\n", "}", "\n", "if", "itemCount", "<", "1", "{", "return", "-", "1", "\n", "}", "\n", "if", "itemCount", "==", "1", "{", "return", "0", "\n", "}", "\n\n", "newPos", ":=", "int", "(", "float32", "(", "itemCount", "-", "1", ")", "*", "float32", "(", "position", "-", "1", ")", "/", "float32", "(", "length", "-", "1", ")", "+", "0.9", ")", "\n\n", "if", "newPos", "<", "0", "{", "newPos", "=", "0", "\n", "}", "else", "if", "newPos", ">=", "itemCount", "{", "newPos", "=", "itemCount", "-", "1", "\n", "}", "\n\n", "return", "newPos", "\n", "}" ]
12,185
all-12186
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetHeapUsageParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime26", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
12,186
all-12187
[ "newKV", "creates", "a", "Key", "-", "Value", "pair" ]
[ "func", "newKV", "(", "store", "*", "store", ",", "nodePath", "string", ",", "<mask>", "string", ",", "createdIndex", "uint64", ",", "parent", "*", "node", ",", "expireTime", "time", ".", "Time", ")", "*", "node", "{", "return", "&", "node", "{", "Path", ":", "nodePath", ",", "CreatedIndex", ":", "createdIndex", ",", "ModifiedIndex", ":", "createdIndex", ",", "Parent", ":", "parent", ",", "store", ":", "store", ",", "ExpireTime", ":", "expireTime", ",", "Value", ":", "value", ",", "}", "\n", "}" ]
12,187
all-12188
[ "Install", "adds", "an", "adapter", "for", "typ", ".", "The", "function", "panics", "if", "one", "of", "the", "encoder", "and", "decoder", "functions", "of", "the", "adapter", "are", "nil", ".", "A", "typical", "use", "case", "for", "this", "function", "is", "to", "be", "called", "during", "the", "package", "initialization", "phase", "to", "extend", "objconv", "support", "for", "new", "types", "." ]
[ "func", "Install", "(", "typ", "reflect", ".", "Type", ",", "adapter", "Adapter", ")", "{", "if", "adapter", ".", "Encode", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "adapter", ".", "Decode", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "adapterMutex", ".", "Lock", "(", ")", "\n", "adapterStore", "[", "typ", "]", "=", "adapter", "\n", "adapterMutex", ".", "Unlock", "(", ")", "\n\n", "// We have to clear the struct cache because it may now have become invalid.", "// Because installing adapters is done in the package initialization phase", "// it's unlikely that any encoding or decoding operations are taking place", "// at this time so there should be no performance impact of clearing the", "// cache.", "structCache", ".", "<mask>", "(", ")", "\n", "}" ]
12,188
all-12189
[ "Index", "returns", "the", "index", "of", "the", "first", "instance", "of", "t", "in", "the", "alphabet", "or", "an", "error", "if", "t", "is", "not", "present", "." ]
[ "func", "(", "a", "*", "alphabet", ")", "<mask>", "(", "t", "string", ")", "(", "int64", ",", "error", ")", "{", "for", "i", ",", "char", ":=", "range", "a", ".", "chars", "{", "if", "char", "==", "t", "{", "return", "int64", "(", "i", ")", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "t", ")", "\n", "}" ]
12,189
all-12190
[ "EmitString", "belongs", "to", "the", "log", ".", "Encoder", "interface" ]
[ "func", "(", "m", "*", "MockKeyValue", ")", "EmitString", "(", "key", ",", "value", "string", ")", "{", "m", ".", "Key", "=", "key", "\n", "m", ".", "ValueKind", "=", "reflect", ".", "TypeOf", "(", "value", ")", ".", "Kind", "(", ")", "\n", "m", ".", "ValueString", "=", "fmt", ".", "Sprint", "(", "<mask>", ")", "\n", "}" ]
12,190
all-12191
[ "extractRedirectURL", "is", "a", "helper", "function", "that", "extracts", "the", "Location", "header", "from", "a", "redirect", "response", ".", "It", "returns", "nil", "if", "the", "header", "is", "missing", "an", "error", "if", "it", "s", "malformed", "." ]
[ "func", "extractRedirectURL", "(", "resp", "*", "http", ".", "Response", ")", "(", "*", "url", ".", "<mask>", ",", "error", ")", "{", "var", "u", "*", "url", ".", "URL", "\n", "if", "resp", ".", "StatusCode", ">", "299", "&&", "resp", ".", "StatusCode", "<", "399", "{", "loc", ":=", "resp", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "loc", "!=", "\"", "\"", "{", "var", "err", "error", "\n", "u", ",", "err", "=", "url", ".", "Parse", "(", "loc", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "loc", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "u", ",", "nil", "\n", "}" ]
12,191
all-12192
[ "StorageVolumeMoveToLVMThinPoolNameKey", "upgrades", "the", "config", "keys", "of", "LVM", "volumes", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "StorageVolumeMoveToLVMThinPoolNameKey", "(", ")", "error", "{", "err", ":=", "<mask>", "(", "c", ".", "db", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "=", "exec", "(", "c", ".", "db", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
12,192
all-12193
[ "UserDataFromMap", "returns", "a", "UserData", "from", "a", "map" ]
[ "func", "UserDataFromMap", "(", "m", "UserDataMap", ")", "*", "UserData", "{", "ud", ":=", "&", "UserData", "{", "}", "\n", "for", "k", ",", "v", ":=", "range", "m", "{", "ud", ".", "<mask>", "(", "k", ",", "v", ")", "\n", "}", "\n", "return", "ud", "\n", "}" ]
12,193
all-12194
[ "Next", "returns", "the", "next", "page", "of", "resources", ".", "If", "there", "are", "no", "more", "resources", "NoMoreResults", "is", "returned", "." ]
[ "func", "(", "c", "*", "callPageIterator", ")", "Next", "(", "ctx", "context", ".", "<mask>", ")", "(", "*", "CallPage", ",", "error", ")", "{", "cp", ":=", "new", "(", "CallPage", ")", "\n", "err", ":=", "c", ".", "p", ".", "Next", "(", "ctx", ",", "cp", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "c", ".", "p", ".", "SetNextPageURI", "(", "cp", ".", "NextPageURI", ")", "\n", "return", "cp", ",", "nil", "\n", "}" ]
12,194
all-12195
[ "Accept", "accepts", "the", "next", "stream", "from", "the", "connection", "." ]
[ "func", "(", "m", "*", "Multiplex", ")", "Accept", "(", ")", "(", "*", "Stream", ",", "error", ")", "{", "select", "{", "<mask>", "s", ",", "ok", ":=", "<-", "m", ".", "nstreams", ":", "if", "!", "ok", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "s", ",", "nil", "\n", "case", "<-", "m", ".", "closed", ":", "return", "nil", ",", "m", ".", "shutdownErr", "\n", "}", "\n", "}" ]
12,195
all-12196
[ "Set", "is", "required", "for", "kingpin", "interfaces", "to", "allow", "command", "line", "params", "to", "be", "set", "to", "our", "map", "datatype" ]
[ "func", "(", "o", "*", "MapUintptrOption", ")", "Set", "(", "value", "string", ")", "error", "{", "parts", ":=", "stringMapRegex", ".", "Split", "(", "value", ",", "2", ")", "\n", "if", "len", "(", "parts", ")", "!=", "2", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}", "\n", "val", ":=", "UintptrOption", "{", "}", "\n", "val", ".", "Set", "(", "parts", "[", "1", "]", ")", "\n", "(", "*", "o", ")", "[", "parts", "[", "0", "]", "]", "=", "val", "\n", "return", "nil", "\n", "}" ]
12,196
all-12197
[ "Register", "registers", "a", "handler", "for", "a", "method", ".", "The", "handler", "is", "registered", "with", "the", "service", "name", "used", "when", "the", "Channel", "was", "created", ".", "To", "register", "a", "handler", "with", "a", "different", "service", "name", "obtain", "a", "SubChannel", "for", "that", "service", "with", "GetSubChannel", "and", "Register", "a", "handler", "under", "that", ".", "You", "may", "also", "use", "SetHandler", "on", "a", "SubChannel", "to", "set", "up", "a", "catch", "-", "all", "Handler", "for", "that", "service", ".", "See", "the", "docs", "for", "SetHandler", "for", "more", "information", ".", "Register", "panics", "if", "the", "channel", "was", "constructed", "with", "an", "alternate", "root", "handler", "." ]
[ "func", "(", "ch", "*", "Channel", ")", "Register", "(", "h", "<mask>", ",", "methodName", "string", ")", "{", "if", "_", ",", "ok", ":=", "ch", ".", "handler", ".", "(", "channelHandler", ")", ";", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "ch", ".", "GetSubChannel", "(", "ch", ".", "PeerInfo", "(", ")", ".", "ServiceName", ")", ".", "Register", "(", "h", ",", "methodName", ")", "\n", "}" ]
12,197
all-12198
[ "HasId", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "<mask>", ")", "HasId", "(", ")", "bool", "{", "if", "e", "!=", "nil", "&&", "e", ".", "Id", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
12,198
all-12199
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetCacheDisabledParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork16", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
12,199
all-12200
[ "OnGossipBroadcast", "implements", "Gossiper", "." ]
[ "func", "(", "*", "surrogateGossiper", ")", "OnGossipBroadcast", "(", "_", "PeerName", ",", "<mask>", "[", "]", "byte", ")", "(", "GossipData", ",", "error", ")", "{", "return", "newSurrogateGossipData", "(", "update", ")", ",", "nil", "\n", "}" ]