id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
3,500
all-3501
[ "AsyncWithContext", "converts", "a", "Check", "into", "an", "asynchronous", "check", "that", "runs", "in", "a", "background", "goroutine", "at", "a", "fixed", "interval", ".", "The", "check", "is", "called", "at", "a", "fixed", "rate", "not", "with", "a", "fixed", "delay", "between", "invocations", ".", "If", "your", "check", "takes", "longer", "than", "the", "interval", "to", "execute", "the", "next", "execution", "will", "happen", "immediately", ".", "Note", ":", "if", "you", "don", "t", "need", "to", "cancel", "execution", "(", "because", "this", "runs", "forever", ")", "use", "Async", "()" ]
[ "func", "AsyncWithContext", "(", "ctx", "context", ".", "Context", ",", "check", "Check", ",", "interval", "time", ".", "Duration", ")", "Check", "{", "// create a chan that will buffer the most recent check result", "result", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n\n", "// fill it with ErrNoData so we'll start in an initially failing state", "// (we don't want to be ready/live until we've actually executed the check", "// once, but that might be slow).", "<mask>", "<-", "ErrNoData", "\n\n", "// make a wrapper that runs the check, and swaps out the current head of", "// the channel with the latest result", "update", ":=", "func", "(", ")", "{", "err", ":=", "check", "(", ")", "\n", "<-", "result", "\n", "result", "<-", "err", "\n", "}", "\n\n", "// spawn a background goroutine to run the check", "go", "func", "(", ")", "{", "// call once right away (time.Tick() doesn't always tick immediately", "// but we want an initial result as soon as possible)", "update", "(", ")", "\n\n", "// loop forever or until the context is canceled", "ticker", ":=", "time", ".", "Tick", "(", "interval", ")", "\n", "for", "{", "select", "{", "case", "<-", "ticker", ":", "update", "(", ")", "\n", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n\n", "// return a Check function that closes over our result and mutex", "return", "func", "(", ")", "error", "{", "// peek at the head of the channel, then put it back", "err", ":=", "<-", "result", "\n", "result", "<-", "err", "\n", "return", "err", "\n", "}", "\n", "}" ]
3,501
all-3502
[ "Arc", "draws", "an", "arc", "with", "a", "positive", "angle", "(", "clockwise", ")" ]
[ "func", "Arc", "(", "gc", "draw2d", ".", "GraphicContext", ",", "xc", ",", "yc", ",", "width", ",", "height", "float64", ")", "{", "// draw an arc", "xc", "+=", "width", "/", "2", "\n", "yc", "+=", "height", "/", "2", "\n", "radiusX", ",", "radiusY", ":=", "width", "/", "2", ",", "height", "/", "2", "\n", "startAngle", ":=", "45", "*", "(", "math", ".", "Pi", "/", "180.0", ")", "/* angles are specified */", "\n", "angle", ":=", "135", "*", "(", "math", ".", "Pi", "/", "180.0", ")", "/* clockwise in radians */", "\n", "gc", ".", "SetLineWidth", "(", "width", "/", "10", ")", "\n", "gc", ".", "SetLineCap", "(", "draw2d", ".", "ButtCap", ")", "\n", "gc", ".", "SetStrokeColor", "(", "image", ".", "Black", ")", "\n", "gc", ".", "MoveTo", "(", "xc", "+", "math", ".", "Cos", "(", "startAngle", ")", "*", "radiusX", ",", "yc", "+", "math", ".", "Sin", "(", "startAngle", ")", "*", "radiusY", ")", "\n", "gc", ".", "ArcTo", "(", "xc", ",", "yc", ",", "radiusX", ",", "radiusY", ",", "startAngle", ",", "<mask>", ")", "\n", "gc", ".", "Stroke", "(", ")", "\n\n", "// fill a circle", "gc", ".", "SetStrokeColor", "(", "color", ".", "NRGBA", "{", "255", ",", "0x33", ",", "0x33", ",", "0x80", "}", ")", "\n", "gc", ".", "SetFillColor", "(", "color", ".", "NRGBA", "{", "255", ",", "0x33", ",", "0x33", ",", "0x80", "}", ")", "\n", "gc", ".", "SetLineWidth", "(", "width", "/", "20", ")", "\n\n", "gc", ".", "MoveTo", "(", "xc", "+", "math", ".", "Cos", "(", "startAngle", ")", "*", "radiusX", ",", "yc", "+", "math", ".", "Sin", "(", "startAngle", ")", "*", "radiusY", ")", "\n", "gc", ".", "LineTo", "(", "xc", ",", "yc", ")", "\n", "gc", ".", "LineTo", "(", "xc", "-", "radiusX", ",", "yc", ")", "\n", "gc", ".", "Stroke", "(", ")", "\n\n", "gc", ".", "MoveTo", "(", "xc", ",", "yc", ")", "\n", "gc", ".", "ArcTo", "(", "xc", ",", "yc", ",", "width", "/", "10.0", ",", "height", "/", "10.0", ",", "0", ",", "2", "*", "math", ".", "Pi", ")", "\n", "gc", ".", "Fill", "(", ")", "\n", "}" ]
3,502
all-3503
[ "regexpMatch", "matches", "the", "given", "regexp", "and", "extracts", "the", "match", "groups", "into", "a", "named", "map", "." ]
[ "func", "regexpMatch", "(", "re", "*", "regexp", ".", "Regexp", ",", "q", "string", ")", "map", "[", "string", "]", "string", "{", "names", ":=", "re", ".", "SubexpNames", "(", ")", "\n", "match", ":=", "re", ".", "FindAllStringSubmatch", "(", "q", ",", "-", "1", ")", "\n\n", "if", "len", "(", "match", ")", "==", "0", "{", "return", "map", "[", "string", "]", "string", "{", "}", "\n", "}", "\n\n", "m", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "for", "i", ",", "n", ":=", "range", "match", "[", "0", "]", "{", "if", "<mask>", "[", "i", "]", "!=", "\"", "\"", "{", "m", "[", "names", "[", "i", "]", "]", "=", "n", "\n", "}", "\n", "}", "\n\n", "return", "m", "\n", "}" ]
3,503
all-3504
[ "Column", "returns", "the", "attributes", "for", "first", "column", ".", "*", "DEPRECATED", "*" ]
[ "func", "(", "qr", "*", "QueryResponse", ")", "<mask>", "(", ")", "ColumnItem", "{", "if", "len", "(", "qr", ".", "ColumnList", ")", "==", "0", "{", "return", "ColumnItem", "{", "}", "\n", "}", "\n", "return", "qr", ".", "ColumnList", "[", "0", "]", "\n", "}" ]
3,504
all-3505
[ "End", "returns", "the", "last", "value", "of", "the", "last", "range" ]
[ "func", "(", "l", "*", "InclusiveRanges", ")", "End", "(", ")", "int", "{", "if", "l", ".", "blocks", "==", "nil", "{", "return", "0", "\n", "}", "\n", "return", "l", ".", "<mask>", "[", "len", "(", "l", ".", "blocks", ")", "-", "1", "]", ".", "End", "(", ")", "\n", "}" ]
3,505
all-3506
[ "ReadAtMost", "reads", "at", "most", "n", "bytes", "from", "a", "file", "in", "GCS", ".", "If", "the", "file", "is", "compressed", "(", "gzip", ")", "in", "GCS", "n", "bytes", "of", "gzipped", "content", "will", "be", "downloaded", "and", "decompressed", "into", "potentially", "GREATER", "than", "n", "bytes", "of", "content", "." ]
[ "func", "(", "a", "*", "GCSArtifact", ")", "ReadAtMost", "(", "n", "int64", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "reader", "io", ".", "ReadCloser", "\n", "var", "p", "[", "]", "byte", "\n", "gzipped", ",", "err", ":=", "a", ".", "gzipped", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "gzipped", "{", "reader", ",", "err", "=", "a", ".", "<mask>", ".", "NewReader", "(", "a", ".", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "defer", "reader", ".", "Close", "(", ")", "\n", "p", ",", "err", "=", "ioutil", ".", "ReadAll", "(", "reader", ")", "// Must readall for gzipped files", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "artifactSize", ":=", "int64", "(", "len", "(", "p", ")", ")", "\n", "readRange", ":=", "n", "\n", "if", "n", ">", "artifactSize", "{", "readRange", "=", "artifactSize", "\n", "return", "p", "[", ":", "readRange", "]", ",", "io", ".", "EOF", "\n", "}", "\n", "return", "p", "[", ":", "readRange", "]", ",", "nil", "\n\n", "}", "\n", "artifactSize", ",", "err", ":=", "a", ".", "Size", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "readRange", ":=", "n", "\n", "var", "gotEOF", "bool", "\n", "if", "n", ">", "artifactSize", "{", "gotEOF", "=", "true", "\n", "readRange", "=", "artifactSize", "\n", "}", "\n", "reader", ",", "err", "=", "a", ".", "handle", ".", "NewRangeReader", "(", "a", ".", "ctx", ",", "0", ",", "readRange", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "defer", "reader", ".", "Close", "(", ")", "\n", "p", ",", "err", "=", "ioutil", ".", "ReadAll", "(", "reader", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "gotEOF", "{", "return", "p", ",", "io", ".", "EOF", "\n", "}", "\n", "return", "p", ",", "nil", "\n", "}" ]
3,506
all-3507
[ "ServeHTTP", "serves", "the", "cache", "Service", "to", "the", "outside", "world", "it", "is", "used", "only", "when", "you", "want", "to", "achieve", "something", "like", "horizontal", "scaling", "it", "parses", "the", "request", "and", "tries", "to", "return", "the", "response", "with", "the", "cached", "body", "of", "the", "requested", "cache", "key", "server", "-", "side", "function" ]
[ "func", "(", "s", "*", "Handler", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "// println(\"Request to the remote service has been established\")", "key", ":=", "getURLParam", "(", "r", ",", "cfg", ".", "QueryCacheKey", ")", "\n", "if", "key", "==", "\"", "\"", "{", "// println(\"return because key was empty\")", "w", ".", "WriteHeader", "(", "cfg", ".", "FailStatus", ")", "\n", "return", "\n", "}", "\n\n", "// we always need the Entry, so get it now", "entry", ":=", "s", ".", "store", ".", "Get", "(", "<mask>", ")", "\n\n", "if", "entry", "==", "nil", "&&", "r", ".", "Method", "!=", "methodPost", "{", "// if it's nil then means it never setted before", "// it doesn't exists, and client doesn't wants to", "// add a cache entry, so just return", "//", "// no delete action is valid", "// no get action is valid", "// no post action is requested", "w", ".", "WriteHeader", "(", "cfg", ".", "FailStatus", ")", "\n", "return", "\n", "}", "\n\n", "switch", "r", ".", "Method", "{", "case", "methodGet", ":", "{", "// get from the cache and send to client", "res", ",", "ok", ":=", "entry", ".", "Response", "(", ")", "\n", "if", "!", "ok", "{", "// entry exists but it has been expired", "// return", "w", ".", "WriteHeader", "(", "cfg", ".", "FailStatus", ")", "\n", "return", "\n", "}", "\n\n", "// entry exists and response is valid", "// send it to the client", "w", ".", "Header", "(", ")", ".", "Set", "(", "cfg", ".", "ContentTypeHeader", ",", "res", ".", "ContentType", "(", ")", ")", "\n", "w", ".", "WriteHeader", "(", "res", ".", "StatusCode", "(", ")", ")", "\n", "w", ".", "Write", "(", "res", ".", "Body", "(", ")", ")", "\n", "}", "\n", "case", "methodPost", ":", "{", "// save a new cache entry if entry ==nil or", "// update an existing if entry !=nil", "body", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "r", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "||", "len", "(", "body", ")", "==", "0", "{", "// println(\"body's request was empty, return fail\")", "w", ".", "WriteHeader", "(", "cfg", ".", "FailStatus", ")", "\n", "return", "\n", "}", "\n\n", "statusCode", ",", "_", ":=", "getURLParamInt", "(", "r", ",", "cfg", ".", "QueryCacheStatusCode", ")", "\n", "contentType", ":=", "getURLParam", "(", "r", ",", "cfg", ".", "QueryCacheContentType", ")", "\n\n", "// now that we have the information", "// we want to see if this is a totally new cache entry", "// or just update an existing one with the new information", "// (an update can change the status code, content type", "// and ofcourse the body and expiration time by header)", "if", "entry", "==", "nil", "{", "// get the information by its url", "// println(\"we have a post request method, let's save a cached entry \")", "// get the cache expiration via url param", "expirationSeconds", ",", "err", ":=", "getURLParamInt64", "(", "r", ",", "cfg", ".", "QueryCacheDuration", ")", "\n", "// get the body from the requested body", "// get the expiration from the \"cache-control's maxage\" if no url param is setted", "if", "expirationSeconds", "<=", "0", "||", "err", "!=", "nil", "{", "expirationSeconds", "=", "int64", "(", "nethttp", ".", "GetMaxAge", "(", "r", ")", "(", ")", ".", "Seconds", "(", ")", ")", "\n", "}", "\n", "// if not setted then try to get it via", "if", "expirationSeconds", "<=", "0", "{", "expirationSeconds", "=", "int64", "(", "cfg", ".", "MinimumCacheDuration", ".", "Seconds", "(", ")", ")", "\n", "}", "\n\n", "cacheDuration", ":=", "time", ".", "Duration", "(", "expirationSeconds", ")", "*", "time", ".", "Second", "\n\n", "// store by its url+the key in order to be unique key among different servers with the same paths", "s", ".", "store", ".", "Set", "(", "key", ",", "statusCode", ",", "contentType", ",", "body", ",", "cacheDuration", ")", "\n", "}", "else", "{", "// update an existing one and change its duration based on the header", "// (if > existing duration)", "entry", ".", "Reset", "(", "statusCode", ",", "contentType", ",", "body", ",", "nethttp", ".", "GetMaxAge", "(", "r", ")", ")", "\n", "}", "\n\n", "w", ".", "WriteHeader", "(", "cfg", ".", "SuccessStatus", ")", "\n", "}", "\n", "case", "methodDelete", ":", "{", "// remove the entry entirely from the cache", "// manually DELETE cache should remove this entirely", "// no just invalidate it", "s", ".", "store", ".", "Remove", "(", "key", ")", "\n", "w", ".", "WriteHeader", "(", "cfg", ".", "SuccessStatus", ")", "\n", "}", "\n", "default", ":", "w", ".", "WriteHeader", "(", "cfg", ".", "FailStatus", ")", "\n", "}", "\n\n", "}" ]
3,507
all-3508
[ "httpResponseStruct", "returns", "the", "response", "structure", "after", "going", "trough", "all", "the", "intermediary", "response", "writers", "." ]
[ "func", "httpResponseStruct", "(", "v", "reflect", ".", "Value", ")", "reflect", ".", "<mask>", "{", "if", "v", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "v", "=", "v", ".", "Elem", "(", ")", "\n", "}", "\n\n", "if", "v", ".", "Type", "(", ")", ".", "String", "(", ")", "==", "\"", "\"", "{", "return", "v", "\n", "}", "\n\n", "return", "httpResponseStruct", "(", "v", ".", "FieldByName", "(", "\"", "\"", ")", ".", "Elem", "(", ")", ")", "\n", "}" ]
3,508
all-3509
[ "SetMenuLabel", "()", "is", "a", "wrapper", "around", "gtk_notebook_set_menu_label", "()", "." ]
[ "func", "(", "v", "*", "Notebook", ")", "SetMenuLabel", "(", "child", ",", "menuLabel", "IWidget", ")", "{", "C", ".", "gtk_notebook_set_menu_label", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "toWidget", "(", ")", ",", "menuLabel", ".", "toWidget", "(", ")", ")", "\n", "}" ]
3,509
all-3510
[ "BytesPerSec", "tells", "the", "rate", "per", "second", "at", "which", "bytes", "were", "read", "since", "last", "measurement", "." ]
[ "func", "(", "m", "*", "MeasuredReader", ")", "BytesPerSec", "(", ")", "uint64", "{", "return", "uint64", "(", "m", ".", "rate", ".", "Rate", "(", "<mask>", ".", "Second", ")", ")", "\n", "}" ]
3,510
all-3511
[ "GamepadIDButtonPressed", "returns", "a", "gamepad", "ID", "where", "at", "least", "one", "button", "is", "pressed", ".", "If", "no", "button", "is", "pressed", "GamepadIDButtonPressed", "returns", "-", "1", "." ]
[ "func", "(", "i", "*", "Input", ")", "GamepadIDButtonPressed", "(", ")", "int", "{", "for", "_", ",", "id", ":=", "<mask>", "ebiten", ".", "GamepadIDs", "(", ")", "{", "for", "b", ":=", "ebiten", ".", "GamepadButton", "(", "0", ")", ";", "b", "<=", "ebiten", ".", "GamepadButtonMax", ";", "b", "++", "{", "if", "ebiten", ".", "IsGamepadButtonPressed", "(", "id", ",", "b", ")", "{", "return", "id", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "-", "1", "\n", "}" ]
3,511
all-3512
[ "GetVizOk", "returns", "a", "tuple", "with", "the", "Viz", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TileDef", ")", "GetVizOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "t", "==", "nil", "||", "t", ".", "Viz", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "t", ".", "Viz", ",", "true", "\n", "}" ]
3,512
all-3513
[ "Encode", "encodes", "the", "generic", "value", "v", "." ]
[ "func", "(", "e", "Encoder", ")", "Encode", "(", "v", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "if", "err", "=", "e", ".", "encodeMapValueMaybe", "(", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "// This type switch optimizes encoding of common value types, it prevents", "// the use of reflection to identify the type of the value, which saves a", "// dynamic memory allocation.", "switch", "x", ":=", "v", ".", "(", "type", ")", "{", "case", "nil", ":", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n\n", "case", "bool", ":", "return", "e", ".", "Emitter", ".", "EmitBool", "(", "x", ")", "\n\n", "case", "int", ":", "return", "e", ".", "Emitter", ".", "EmitInt", "(", "int64", "(", "x", ")", ",", "0", ")", "\n\n", "case", "int8", ":", "return", "e", ".", "Emitter", ".", "EmitInt", "(", "int64", "(", "x", ")", ",", "8", ")", "\n\n", "case", "int16", ":", "return", "e", ".", "Emitter", ".", "EmitInt", "(", "int64", "(", "x", ")", ",", "16", ")", "\n\n", "case", "int32", ":", "return", "e", ".", "Emitter", ".", "EmitInt", "(", "int64", "(", "x", ")", ",", "32", ")", "\n\n", "<mask>", "int64", ":", "return", "e", ".", "Emitter", ".", "EmitInt", "(", "x", ",", "64", ")", "\n\n", "case", "uint8", ":", "return", "e", ".", "Emitter", ".", "EmitUint", "(", "uint64", "(", "x", ")", ",", "8", ")", "\n\n", "case", "uint16", ":", "return", "e", ".", "Emitter", ".", "EmitUint", "(", "uint64", "(", "x", ")", ",", "16", ")", "\n\n", "case", "uint32", ":", "return", "e", ".", "Emitter", ".", "EmitUint", "(", "uint64", "(", "x", ")", ",", "32", ")", "\n\n", "case", "uint64", ":", "return", "e", ".", "Emitter", ".", "EmitUint", "(", "x", ",", "64", ")", "\n\n", "case", "string", ":", "return", "e", ".", "Emitter", ".", "EmitString", "(", "x", ")", "\n\n", "case", "[", "]", "byte", ":", "return", "e", ".", "Emitter", ".", "EmitBytes", "(", "x", ")", "\n\n", "case", "time", ".", "Time", ":", "return", "e", ".", "Emitter", ".", "EmitTime", "(", "x", ")", "\n\n", "case", "time", ".", "Duration", ":", "return", "e", ".", "Emitter", ".", "EmitDuration", "(", "x", ")", "\n\n", "case", "[", "]", "string", ":", "return", "e", ".", "encodeSliceOfString", "(", "x", ")", "\n\n", "case", "[", "]", "interface", "{", "}", ":", "return", "e", ".", "encodeSliceOfInterface", "(", "x", ")", "\n\n", "case", "map", "[", "string", "]", "string", ":", "return", "e", ".", "encodeMapStringString", "(", "x", ")", "\n\n", "case", "map", "[", "string", "]", "interface", "{", "}", ":", "return", "e", ".", "encodeMapStringInterface", "(", "x", ")", "\n\n", "case", "map", "[", "interface", "{", "}", "]", "interface", "{", "}", ":", "return", "e", ".", "encodeMapInterfaceInterface", "(", "x", ")", "\n\n", "// Also checks for pointer types so the program can use this as a way", "// to avoid the dynamic memory allocation done by runtime.convT2E for", "// converting non-pointer types to empty interfaces.", "case", "*", "bool", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitBool", "(", "*", "x", ")", "\n\n", "case", "*", "int", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitInt", "(", "int64", "(", "*", "x", ")", ",", "int", "(", "8", "*", "unsafe", ".", "Sizeof", "(", "0", ")", ")", ")", "\n\n", "case", "*", "int8", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitInt", "(", "int64", "(", "*", "x", ")", ",", "8", ")", "\n\n", "case", "*", "int16", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitInt", "(", "int64", "(", "*", "x", ")", ",", "16", ")", "\n\n", "case", "*", "int32", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitInt", "(", "int64", "(", "*", "x", ")", ",", "32", ")", "\n\n", "case", "*", "int64", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitInt", "(", "*", "x", ",", "64", ")", "\n\n", "case", "*", "uint8", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitUint", "(", "uint64", "(", "*", "x", ")", ",", "8", ")", "\n\n", "case", "*", "uint16", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitUint", "(", "uint64", "(", "*", "x", ")", ",", "16", ")", "\n\n", "case", "*", "uint32", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitUint", "(", "uint64", "(", "*", "x", ")", ",", "32", ")", "\n\n", "case", "*", "uint64", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitUint", "(", "*", "x", ",", "64", ")", "\n\n", "case", "*", "string", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitString", "(", "*", "x", ")", "\n\n", "case", "*", "[", "]", "byte", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitBytes", "(", "*", "x", ")", "\n\n", "case", "*", "time", ".", "Time", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitTime", "(", "*", "x", ")", "\n\n", "case", "*", "time", ".", "Duration", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "Emitter", ".", "EmitDuration", "(", "*", "x", ")", "\n\n", "case", "*", "[", "]", "string", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "encodeSliceOfString", "(", "*", "x", ")", "\n\n", "case", "*", "[", "]", "interface", "{", "}", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "encodeSliceOfInterface", "(", "*", "x", ")", "\n\n", "case", "*", "map", "[", "string", "]", "string", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "encodeMapStringString", "(", "*", "x", ")", "\n\n", "case", "*", "map", "[", "string", "]", "interface", "{", "}", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "encodeMapStringInterface", "(", "*", "x", ")", "\n\n", "case", "*", "map", "[", "interface", "{", "}", "]", "interface", "{", "}", ":", "if", "x", "==", "nil", "{", "return", "e", ".", "Emitter", ".", "EmitNil", "(", ")", "\n", "}", "\n", "return", "e", ".", "encodeMapInterfaceInterface", "(", "*", "x", ")", "\n\n", "case", "ValueEncoder", ":", "return", "x", ".", "EncodeValue", "(", "e", ")", "\n\n", "default", ":", "return", "e", ".", "encode", "(", "reflect", ".", "ValueOf", "(", "v", ")", ")", "\n", "}", "\n", "}" ]
3,513
all-3514
[ "NewWriter", "creates", "a", "new", "hashtree", "writer", "." ]
[ "func", "NewWriter", "(", "w", "io", ".", "Writer", ")", "*", "<mask>", "{", "return", "&", "Writer", "{", "pbw", ":", "pbutil", ".", "NewWriter", "(", "w", ")", ",", "}", "\n", "}" ]
3,514
all-3515
[ "TrimAboveName", "returns", "a", "slice", "of", "the", "Trace", "with", "all", "entries", "above", "the", "highest", "with", "function", "name", "name", "removed", "." ]
[ "func", "(", "pcs", "Trace", ")", "TrimAboveName", "(", "name", "string", ")", "Trace", "{", "for", "len", "(", "pcs", ")", ">", "0", "&&", "pcs", "[", "len", "(", "pcs", ")", "-", "1", "]", ".", "name", "(", ")", "!=", "<mask>", "{", "pcs", "=", "pcs", "[", ":", "len", "(", "pcs", ")", "-", "1", "]", "\n", "}", "\n", "return", "pcs", "\n", "}" ]
3,515
all-3516
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetShowPaintRectsParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoOverlay2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
3,516
all-3517
[ "ReadByte", "returns", "the", "next", "decrypted", "byte", "." ]
[ "func", "(", "cr", "*", "cipherBlockReader", ")", "ReadByte", "(", ")", "(", "byte", ",", "error", ")", "{", "for", "{", "if", "cr", ".", "n", "<", "len", "(", "cr", ".", "outbuf", ")", "{", "c", ":=", "cr", ".", "outbuf", "[", "cr", ".", "n", "]", "\n", "cr", ".", "n", "++", "\n", "return", "c", ",", "nil", "\n", "}", "\n", "if", "cr", ".", "err", "!=", "nil", "{", "err", ":=", "cr", ".", "err", "\n", "cr", ".", "err", "=", "nil", "\n", "return", "0", ",", "err", "\n", "}", "\n", "// refill outbuf", "<mask>", "n", "int", "\n", "n", ",", "cr", ".", "err", "=", "cr", ".", "read", "(", "cr", ".", "outbuf", "[", ":", "cap", "(", "cr", ".", "outbuf", ")", "]", ")", "\n", "cr", ".", "outbuf", "=", "cr", ".", "outbuf", "[", ":", "n", "]", "\n", "cr", ".", "n", "=", "0", "\n", "}", "\n", "}" ]
3,517
all-3518
[ "SetIdx", "implements", "the", "driver", ".", "Error", "interface", "." ]
[ "func", "(", "e", "*", "hdbErrors", ")", "SetIdx", "(", "idx", "int", ")", "{", "switch", "{", "<mask>", "idx", "<", "0", ":", "e", ".", "idx", "=", "0", "\n", "case", "idx", ">=", "e", ".", "numArg", ":", "e", ".", "idx", "=", "e", ".", "numArg", "-", "1", "\n", "default", ":", "e", ".", "idx", "=", "idx", "\n", "}", "\n", "}" ]
3,518
all-3519
[ "Merge", "merges", "the", "other", "GossipData", "into", "this", "one", "and", "returns", "our", "resulting", "complete", "state", "." ]
[ "func", "(", "st", "*", "state", ")", "Merge", "(", "<mask>", "mesh", ".", "GossipData", ")", "(", "complete", "mesh", ".", "GossipData", ")", "{", "return", "st", ".", "mergeComplete", "(", "other", ".", "(", "*", "state", ")", ".", "copy", "(", ")", ".", "set", ")", "\n", "}" ]
3,519
all-3520
[ "DefaultVersion", "returns", "the", "default", "version", "of", "the", "specified", "module", ".", "If", "module", "is", "the", "empty", "string", "it", "means", "the", "default", "module", "." ]
[ "func", "DefaultVersion", "(", "c", "context", ".", "Context", ",", "module", "string", ")", "(", "string", ",", "error", ")", "{", "req", ":=", "&", "pb", ".", "GetDefaultVersionRequest", "{", "}", "\n", "if", "module", "!=", "\"", "\"", "{", "req", ".", "Module", "=", "&", "module", "\n", "}", "\n", "res", ":=", "&", "pb", ".", "GetDefaultVersionResponse", "{", "}", "\n", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", "\n", "return", "<mask>", ".", "GetVersion", "(", ")", ",", "err", "\n", "}" ]
3,520
all-3521
[ "BlobInfoFromSchema2Descriptor", "returns", "a", "types", ".", "BlobInfo", "based", "on", "the", "input", "schema", "2", "descriptor", "." ]
[ "func", "BlobInfoFromSchema2Descriptor", "(", "desc", "Schema2Descriptor", ")", "types", ".", "BlobInfo", "{", "return", "<mask>", ".", "BlobInfo", "{", "Digest", ":", "desc", ".", "Digest", ",", "Size", ":", "desc", ".", "Size", ",", "URLs", ":", "desc", ".", "URLs", ",", "MediaType", ":", "desc", ".", "MediaType", ",", "}", "\n", "}" ]
3,521
all-3522
[ "NewInMemoryProvider", "returns", "InMemoryProvider", "DNS", "provider", "interface", "implementation" ]
[ "func", "NewInMemoryProvider", "(", "opts", "...", "InMemoryOption", ")", "*", "InMemoryProvider", "{", "im", ":=", "&", "InMemoryProvider", "{", "filter", ":", "&", "filter", "{", "}", ",", "OnApplyChanges", ":", "func", "(", "changes", "*", "plan", ".", "Changes", ")", "{", "}", ",", "OnRecords", ":", "func", "(", ")", "{", "}", ",", "domain", ":", "NewDomainFilter", "(", "[", "]", "string", "{", "\"", "\"", "}", ")", ",", "client", ":", "newInMemoryClient", "(", ")", ",", "}", "\n\n", "for", "_", ",", "opt", ":=", "range", "opts", "{", "<mask>", "(", "im", ")", "\n", "}", "\n\n", "return", "im", "\n", "}" ]
3,522
all-3523
[ "HasTime", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "l", "*", "LogStreamDefinition", ")", "HasTime", "(", ")", "bool", "{", "if", "l", "!=", "nil", "&&", "l", ".", "Time", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
3,523
all-3524
[ "hostDatastoreSystemFromHostSystemID", "locates", "a", "HostDatastoreSystem", "from", "a", "specified", "HostSystem", "managed", "object", "ID", "." ]
[ "func", "hostDatastoreSystemFromHostSystemID", "(", "<mask>", "*", "govmomi", ".", "Client", ",", "hsID", "string", ")", "(", "*", "object", ".", "HostDatastoreSystem", ",", "error", ")", "{", "hs", ",", "err", ":=", "hostsystem", ".", "FromID", "(", "client", ",", "hsID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "defaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "return", "hs", ".", "ConfigManager", "(", ")", ".", "DatastoreSystem", "(", "ctx", ")", "\n", "}" ]
3,524
all-3525
[ "parseBytes", "parses", "the", "byte", "data", "and", "returns", "the", "elements", "." ]
[ "func", "parseBytes", "(", "data", "[", "]", "byte", ",", "rslt", "*", "result", ",", "src", "*", "source", ",", "opts", "*", "Options", ",", "f", "*", "File", ")", "(", "[", "]", "element", ",", "error", ")", "{", "var", "elements", "[", "]", "element", "\n\n", "lines", ":=", "strings", ".", "Split", "(", "formatLF", "(", "string", "(", "<mask>", ")", ")", ",", "lf", ")", "\n\n", "i", ":=", "0", "\n", "l", ":=", "len", "(", "lines", ")", "\n\n", "// Ignore the last empty line.", "if", "l", ">", "0", "&&", "lines", "[", "l", "-", "1", "]", "==", "\"", "\"", "{", "l", "--", "\n", "}", "\n\n", "for", "i", "<", "l", "{", "// Fetch a line.", "ln", ":=", "newLine", "(", "i", "+", "1", ",", "lines", "[", "i", "]", ",", "opts", ",", "f", ")", "\n", "i", "++", "\n\n", "// Ignore the empty line.", "if", "ln", ".", "isEmpty", "(", ")", "{", "continue", "\n", "}", "\n\n", "if", "ln", ".", "isTopIndent", "(", ")", "{", "e", ",", "err", ":=", "newElement", "(", "ln", ",", "rslt", ",", "src", ",", "nil", ",", "opts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Append child elements to the element.", "if", "err", ":=", "appendChildren", "(", "e", ",", "rslt", ",", "lines", ",", "&", "i", ",", "l", ",", "src", ",", "opts", ",", "f", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "elements", "=", "append", "(", "elements", ",", "e", ")", "\n", "}", "\n", "}", "\n\n", "return", "elements", ",", "nil", "\n", "}" ]
3,525
all-3526
[ "New", "Returns", "a", "new", "S3", "domain", "defaults", "to", "DefaultDomain", "if", "empty" ]
[ "func", "New", "(", "<mask>", "string", ",", "keys", "Keys", ")", "*", "S3", "{", "if", "domain", "==", "\"", "\"", "{", "domain", "=", "DefaultDomain", "\n", "}", "\n", "return", "&", "S3", "{", "domain", ",", "keys", "}", "\n", "}" ]
3,526
all-3527
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "LoadSnapshotReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree12", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
3,527
all-3528
[ "Cmds", "returns", "pachctl", "commands", "related", "to", "Pachyderm", "Enterprise" ]
[ "func", "Cmds", "(", "noMetrics", ",", "noPortForwarding", "*", "bool", ")", "[", "]", "*", "cobra", ".", "Command", "{", "var", "commands", "[", "]", "*", "cobra", ".", "Command", "\n\n", "enterprise", ":=", "&", "cobra", ".", "Command", "{", "Short", ":", "\"", "\"", ",", "Long", ":", "\"", "\"", ",", "}", "\n", "commands", "=", "<mask>", "(", "commands", ",", "cmdutil", ".", "CreateAlias", "(", "enterprise", ",", "\"", "\"", ")", ")", "\n\n", "commands", "=", "append", "(", "commands", ",", "ActivateCmd", "(", "noMetrics", ",", "noPortForwarding", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "GetStateCmd", "(", "noMetrics", ",", "noPortForwarding", ")", ")", "\n\n", "return", "commands", "\n", "}" ]
3,528
all-3529
[ "RemoveAll", "removes", "all", "values", "from", "the", "set", "if", "they", "exist", "in", "the", "set", "." ]
[ "func", "(", "s", "*", "Set", ")", "RemoveAll", "(", "values", "...", "interface", "{", "}", ")", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "value", ":=", "range", "values", "{", "delete", "(", "s", ".", "m", ",", "<mask>", ")", "\n", "}", "\n", "}" ]
3,529
all-3530
[ "GetContent", "returns", "the", "Content", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "n", "*", "NoteDefinition", ")", "GetContent", "(", ")", "string", "{", "if", "n", "==", "nil", "||", "n", ".", "Content", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "<mask>", "*", "n", ".", "Content", "\n", "}" ]
3,530
all-3531
[ "Uint8", "returns", "the", "uint8", "value", "stored", "in", "r", ".", "r", "must", "have", "type", "uint8", "." ]
[ "func", "(", "r", "region", ")", "Uint8", "(", ")", "uint8", "{", "if", "r", ".", "typ", ".", "Kind", "!=", "KindUint", "||", "r", ".", "typ", ".", "Size", "!=", "1", "{", "panic", "(", "\"", "\"", "+", "r", ".", "typ", ".", "<mask>", ")", "\n", "}", "\n", "return", "r", ".", "p", ".", "proc", ".", "ReadUint8", "(", "r", ".", "a", ")", "\n", "}" ]
3,531
all-3532
[ "Use", "pushes", "one", "or", "multiple", "middlewares", "to", "the", "stack", "for", "middlewares", "maintained", "in", "the", "Api", "object", "." ]
[ "func", "(", "api", "*", "Api", ")", "Use", "(", "middlewares", "...", "Middleware", ")", "{", "api", ".", "stack", "=", "append", "(", "api", ".", "<mask>", ",", "middlewares", "...", ")", "\n", "}" ]
3,532
all-3533
[ "AddOutput", "adds", "an", "output", "writer", "to", "Bench" ]
[ "func", "(", "b", "*", "Bench", ")", "AddOutput", "(", "interval", "time", ".", "Duration", ",", "writer", "io", ".", "<mask>", ",", "output", "output", ".", "OutputFunc", ")", "{", "o", ":=", "outputContainer", "{", "interval", ":", "interval", ",", "writer", ":", "writer", ",", "function", ":", "output", ",", "}", "\n\n", "b", ".", "outputs", "=", "append", "(", "b", ".", "outputs", ",", "o", ")", "\n", "}" ]
3,533
all-3534
[ "findSegmentForIndex", "finds", "the", "first", "segment", "greater", "than", "or", "equal", "to", "index", "." ]
[ "func", "(", "w", "*", "WALWatcher", ")", "findSegmentForIndex", "(", "index", "int", ")", "(", "int", ",", "error", ")", "{", "refs", ",", "err", ":=", "w", ".", "segments", "(", "w", ".", "walDir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "nil", "\n", "}", "\n\n", "for", "_", ",", "r", ":=", "<mask>", "refs", "{", "if", "r", ">=", "index", "{", "return", "r", ",", "nil", "\n", "}", "\n", "}", "\n\n", "return", "-", "1", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}" ]
3,534
all-3535
[ "NAME", "say", "-", "hello", "-", "Say", "hello", "to", "current", "user", "DESCRIPTION", "Print", "out", "hello", "to", "current", "user", "OPTIONS", "-", "n", "--", "name", "=", "<NAME", ">", "say", "hello", "to", "an", "user", "with", "the", "given", "NAME", "-", "v", "--", "verbose", "run", "in", "verbose", "mode" ]
[ "func", "TaskSayHello", "(", "t", "*", "tasking", ".", "T", ")", "{", "username", ":=", "t", ".", "Flags", ".", "String", "(", "\"", "\"", ")", "\n", "if", "username", "==", "\"", "\"", "{", "user", ",", "_", ":=", "user", ".", "Current", "(", ")", "\n", "username", "=", "user", ".", "<mask>", "\n", "}", "\n\n", "if", "t", ".", "Flags", ".", "Bool", "(", "\"", "\"", ")", "{", "t", ".", "Logf", "(", "\"", "\\n", "\"", ",", "username", ",", "time", ".", "Now", "(", ")", ")", "\n", "}", "else", "{", "t", ".", "Logf", "(", "\"", "\\n", "\"", ",", "username", ")", "\n", "}", "\n", "}" ]
3,535
all-3536
[ "ParseVersion", "parses", "version", ".", "Info", "into", "a", "ServerVersion", "struct" ]
[ "func", "ParseVersion", "(", "v", "*", "version", ".", "Info", ")", "(", "ServerVersion", ",", "error", ")", "{", "var", "ret", "ServerVersion", "\n", "var", "err", "error", "\n", "<mask>", ".", "Major", ",", "err", "=", "strconv", ".", "Atoi", "(", "v", ".", "Major", ")", "\n", "if", "err", "!=", "nil", "{", "// Try to parse using GitVersion", "return", "parseGitVersion", "(", "v", ".", "GitVersion", ")", "\n", "}", "\n\n", "// trim \"+\" in minor version (happened on GKE)", "v", ".", "Minor", "=", "strings", ".", "TrimSuffix", "(", "v", ".", "Minor", ",", "\"", "\"", ")", "\n", "ret", ".", "Minor", ",", "err", "=", "strconv", ".", "Atoi", "(", "v", ".", "Minor", ")", "\n", "if", "err", "!=", "nil", "{", "// Try to parse using GitVersion", "return", "parseGitVersion", "(", "v", ".", "GitVersion", ")", "\n", "}", "\n", "return", "ret", ",", "err", "\n", "}" ]
3,536
all-3537
[ "PangoColor", "*", "pango_color_copy", "(", "const", "PangoColor", "*", "src", ")", ";" ]
[ "func", "(", "v", "*", "Color", ")", "Copy", "(", "c", "*", "<mask>", ")", "*", "Color", "{", "w", ":=", "new", "(", "Color", ")", "\n", "w", ".", "pangoColor", "=", "C", ".", "pango_color_copy", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "w", "\n", "}" ]
3,537
all-3538
[ "GetDescription", "returns", "the", "Description", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "Dashboard", ")", "GetDescription", "(", ")", "string", "{", "if", "d", "==", "nil", "||", "d", ".", "Description", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "d", ".", "<mask>", "\n", "}" ]
3,538
all-3539
[ "GetOrderByOk", "returns", "a", "tuple", "with", "the", "OrderBy", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "ChangeRequest", ")", "GetOrderByOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "c", "==", "nil", "||", "c", ".", "OrderBy", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "c", ".", "OrderBy", ",", "true", "\n", "}" ]
3,539
all-3540
[ "DelCookie", "removes", "cookie", "under", "the", "given", "key", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "DelCookie", "(", "<mask>", "string", ")", "{", "h", ".", "parseRawHeaders", "(", ")", "\n", "h", ".", "collectCookies", "(", ")", "\n", "h", ".", "cookies", "=", "delAllArgs", "(", "h", ".", "cookies", ",", "key", ")", "\n", "}" ]
3,540
all-3541
[ "Image", "handling", "functions", "GetImages", "returns", "a", "list", "of", "available", "images", "as", "Image", "structs" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetImages", "(", ")", "(", "[", "]", "api", ".", "<mask>", ",", "error", ")", "{", "images", ":=", "[", "]", "api", ".", "Image", "{", "}", "\n\n", "_", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "\"", "\"", ",", "&", "images", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "images", ",", "nil", "\n", "}" ]
3,541
all-3542
[ "NormalizeValue", "converts", "a", "value", "to", "something", "that", "is", "suitable", "to", "be", "set", "in", "a", "ResourceData", "and", "can", "be", "useful", "in", "situations", "where", "there", "is", "not", "access", "to", "normal", "helper", "/", "schema", "functionality", "but", "you", "still", "need", "saved", "fields", "to", "behave", "in", "the", "same", "way", ".", "Specifically", "this", "will", "run", "the", "value", "through", "DeRef", "to", "dereference", "any", "pointers", "first", "and", "then", "convert", "numeric", "primitives", "if", "necessary", "." ]
[ "func", "NormalizeValue", "(", "v", "interface", "{", "}", ")", "interface", "{", "}", "{", "v", "=", "DeRef", "(", "v", ")", "\n", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "k", ":=", "reflect", ".", "TypeOf", "(", "v", ")", ".", "Kind", "(", ")", "\n", "switch", "{", "case", "k", ">=", "reflect", ".", "Int8", "&&", "k", "<=", "reflect", ".", "Uint64", ":", "v", "=", "reflect", ".", "ValueOf", "(", "v", ")", ".", "Convert", "(", "reflect", ".", "TypeOf", "(", "int", "(", "0", ")", ")", ")", ".", "Interface", "(", ")", "\n", "<mask>", "k", "==", "reflect", ".", "Float32", ":", "v", "=", "reflect", ".", "ValueOf", "(", "v", ")", ".", "Convert", "(", "reflect", ".", "TypeOf", "(", "float64", "(", "0", ")", ")", ")", ".", "Interface", "(", ")", "\n", "}", "\n", "return", "v", "\n", "}" ]
3,542
all-3543
[ "String", "returns", "a", "readable", "status", "messsage", "usable", "in", "texts", "." ]
[ "func", "(", "s", "<mask>", ")", "String", "(", ")", "string", "{", "str", ":=", "StatusToString", "(", "s", ")", "\n", "str", "=", "strings", ".", "Replace", "(", "str", ",", "\"", "\"", ",", "\"", "\"", ",", "1", ")", "\n", "str", "=", "strings", ".", "Replace", "(", "str", ",", "\"", "\"", ",", "\"", "\"", ",", "0", ")", "\n", "return", "strings", ".", "ToLower", "(", "str", ")", "\n", "}" ]
3,543
all-3544
[ "del", "invokes", "the", "DEL", "command", "of", "the", "given", "plugin" ]
[ "func", "(", "<mask>", "*", "cniClient", ")", "del", "(", "runtimeConfig", "libcni", ".", "RuntimeConf", ",", "cfg", "*", "Config", ",", "pluginConfigFunc", "func", "(", "*", "Config", ")", "(", "string", ",", "*", "libcni", ".", "NetworkConfig", ",", "error", ")", ")", "error", "{", "deviceName", ",", "networkConfig", ",", "err", ":=", "pluginConfigFunc", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "runtimeConfig", ".", "IfName", "=", "deviceName", "\n\n", "return", "client", ".", "libcni", ".", "DelNetwork", "(", "networkConfig", ",", "&", "runtimeConfig", ")", "\n", "}" ]
3,544
all-3545
[ "CreateNewRecord", "-", "creates", "a", "record", "from", "a", "given", "period", "delimited", "property", "and", "enaml", ".", "JobManifestProperty" ]
[ "func", "CreateNewRecord", "(", "property", "string", ",", "yaml", "enaml", ".", "JobManifestProperty", ")", "(", "<mask>", "Record", ")", "{", "elementArray", ":=", "strings", ".", "Split", "(", "property", ",", "\"", "\"", ")", "\n", "record", "=", "Record", "{", "Length", ":", "len", "(", "elementArray", ")", ",", "Orig", ":", "property", ",", "Slice", ":", "elementArray", ",", "Yaml", ":", "yaml", ",", "}", "\n", "return", "\n", "}" ]
3,545
all-3546
[ "Rate", "fetches", "an", "instrument", "from", "the", "registry", "or", "creates", "a", "new", "one", ".", "If", "another", "instrument", "type", "is", "already", "registered", "with", "the", "same", "name", "/", "tags", "a", "blank", "one", "will", "be", "returned", "and", "an", "error", "will", "be", "logged", "to", "the", "Errors", "()", "channel", "." ]
[ "func", "(", "r", "*", "Registry", ")", "Rate", "(", "name", "string", ",", "tags", "[", "]", "string", ")", "*", "Rate", "{", "return", "r", ".", "fetchRate", "(", "<mask>", ",", "tags", ",", "newRate", ")", "\n", "}" ]
3,546
all-3547
[ "ShouldRun", "determines", "if", "we", "can", "know", "for", "certain", "that", "the", "job", "should", "run", ".", "We", "can", "either", "know", "for", "certain", "that", "the", "job", "should", "or", "should", "not", "run", "based", "on", "the", "matcher", "or", "we", "can", "not", "be", "able", "to", "determine", "that", "fact", "at", "all", "." ]
[ "func", "(", "cm", "RegexpChangeMatcher", ")", "ShouldRun", "(", "<mask>", "ChangedFilesProvider", ")", "(", "determined", "bool", ",", "shouldRun", "bool", ",", "err", "error", ")", "{", "if", "cm", ".", "CouldRun", "(", ")", "{", "changeList", ",", "err", ":=", "changes", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "true", ",", "false", ",", "err", "\n", "}", "\n", "return", "true", ",", "cm", ".", "RunsAgainstChanges", "(", "changeList", ")", ",", "nil", "\n", "}", "\n", "return", "false", ",", "false", ",", "nil", "\n", "}" ]
3,547
all-3548
[ "Add", "adds", "the", "given", "key", ":", "value", "header", ".", "Multiple", "headers", "with", "the", "same", "key", "may", "be", "added", "with", "this", "function", ".", "Use", "Set", "for", "setting", "a", "single", "header", "for", "the", "given", "key", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "Add", "(", "key", ",", "<mask>", "string", ")", "{", "k", ":=", "getHeaderKeyBytes", "(", "&", "h", ".", "bufKV", ",", "key", ",", "h", ".", "disableNormalizing", ")", "\n", "h", ".", "h", "=", "appendArg", "(", "h", ".", "h", ",", "b2s", "(", "k", ")", ",", "value", ",", "argsHasValue", ")", "\n", "}" ]
3,548
all-3549
[ "DefaultDaemon", "returns", "a", "new", "un", "-", "initialized", "Daemon", "object", "with", "default", "values", "." ]
[ "func", "DefaultDaemon", "(", ")", "*", "Daemon", "{", "config", ":=", "DefaultDaemonConfig", "(", ")", "\n", "<mask>", ":=", "sys", ".", "DefaultOS", "(", ")", "\n", "return", "NewDaemon", "(", "config", ",", "os", ")", "\n", "}" ]
3,549
all-3550
[ "NewUpdateDirCommand", "returns", "the", "CLI", "command", "for", "updatedir", "." ]
[ "func", "NewUpdateDirCommand", "(", ")", "<mask>", ".", "Command", "{", "return", "cli", ".", "Command", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "ArgsUsage", ":", "\"", "\"", ",", "Flags", ":", "[", "]", "cli", ".", "Flag", "{", "cli", ".", "IntFlag", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "0", ",", "Usage", ":", "\"", "\"", "}", ",", "}", ",", "Action", ":", "func", "(", "c", "*", "cli", ".", "Context", ")", "error", "{", "updatedirCommandFunc", "(", "c", ",", "mustNewKeyAPI", "(", "c", ")", ")", "\n", "return", "nil", "\n", "}", ",", "}", "\n", "}" ]
3,550
all-3551
[ "Send", "sends", "a", "presence", "update", "." ]
[ "func", "(", "p", "*", "Presence", ")", "Send", "(", "c", "context", ".", "Context", ")", "error", "{", "req", ":=", "&", "pb", ".", "XmppSendPresenceRequest", "{", "Jid", ":", "&", "p", ".", "To", ",", "}", "\n", "if", "p", ".", "State", "!=", "\"", "\"", "{", "req", ".", "Show", "=", "&", "p", ".", "State", "\n", "}", "\n", "if", "p", ".", "Type", "!=", "\"", "\"", "{", "req", ".", "Type", "=", "&", "p", ".", "Type", "\n", "}", "\n", "if", "p", ".", "Sender", "!=", "\"", "\"", "{", "req", ".", "FromJid", "=", "&", "p", ".", "Sender", "\n", "}", "\n", "if", "p", ".", "Status", "!=", "\"", "\"", "{", "req", ".", "Status", "=", "&", "p", ".", "Status", "\n", "}", "\n", "res", ":=", "&", "pb", ".", "XmppSendPresenceResponse", "{", "}", "\n", "return", "<mask>", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", "\n", "}" ]
3,551
all-3552
[ "Update", "updates", "the", "timestamp", "of", "a", "target", "resource", ".", "In", ":", "name", "-", "name", "of", "the", "target", "resource", "state", "-", "current", "state", "of", "the", "resource", "owner", "-", "current", "owner", "of", "the", "resource", "info", "-", "information", "on", "how", "to", "use", "the", "resource", "Out", ":", "nil", "on", "success", "or", "OwnerNotMatch", "error", "if", "owner", "does", "not", "match", "current", "owner", "of", "the", "resource", "or", "ResourceNotFound", "error", "if", "target", "named", "resource", "does", "not", "exist", "or", "StateNotMatch", "error", "if", "state", "does", "not", "match", "current", "state", "of", "the", "resource", "." ]
[ "func", "(", "r", "*", "Ranch", ")", "Update", "(", "name", ",", "owner", ",", "state", "string", ",", "ud", "*", "common", ".", "UserData", ")", "error", "{", "r", ".", "resourcesLock", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "resourcesLock", ".", "Unlock", "(", ")", "\n\n", "res", ",", "err", ":=", "r", ".", "Storage", ".", "GetResource", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "return", "&", "ResourceNotFound", "{", "name", "}", "\n", "}", "\n", "if", "owner", "!=", "<mask>", ".", "Owner", "{", "return", "&", "OwnerNotMatch", "{", "owner", ":", "owner", ",", "request", ":", "res", ".", "Owner", "}", "\n", "}", "\n", "if", "state", "!=", "res", ".", "State", "{", "return", "&", "StateNotMatch", "{", "res", ".", "State", ",", "state", "}", "\n", "}", "\n", "if", "res", ".", "UserData", "==", "nil", "{", "res", ".", "UserData", "=", "&", "common", ".", "UserData", "{", "}", "\n", "}", "\n", "res", ".", "UserData", ".", "Update", "(", "ud", ")", "\n", "res", ".", "LastUpdate", "=", "r", ".", "UpdateTime", "(", ")", "\n", "if", "err", ":=", "r", ".", "Storage", ".", "UpdateResource", "(", "res", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "res", ".", "Name", ")", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
3,552
all-3553
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventApplicationCacheStatusUpdated", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache9", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
3,553
all-3554
[ "RemoveENIAttachment", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskEngineState", ")", "RemoveENIAttachment", "(", "arg0", "<mask>", ")", "{", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "}" ]
3,554
all-3555
[ "Collect", "metrics" ]
[ "func", "(", "t", "*", "Tags", ")", "Stat", "(", "send", "helper", ".", "StatCallback", ")", "{", "helper", ".", "SendAndSubstractUint32", "(", "\"", "\"", ",", "&", "t", ".", "q", ".", "stat", ".", "putErrors", ",", "send", ")", "\n", "helper", ".", "SendAndSubstractUint32", "(", "\"", "\"", ",", "&", "t", ".", "q", ".", "stat", ".", "putCount", ",", "send", ")", "\n", "helper", ".", "SendAndSubstractUint32", "(", "\"", "\"", ",", "&", "t", ".", "q", ".", "stat", ".", "deleteErrors", ",", "send", ")", "\n", "helper", ".", "SendAndSubstractUint32", "(", "\"", "\"", ",", "&", "t", ".", "q", ".", "stat", ".", "deleteCount", ",", "<mask>", ")", "\n", "helper", ".", "SendAndSubstractUint32", "(", "\"", "\"", ",", "&", "t", ".", "q", ".", "stat", ".", "sendFail", ",", "send", ")", "\n", "helper", ".", "SendAndSubstractUint32", "(", "\"", "\"", ",", "&", "t", ".", "q", ".", "stat", ".", "sendSuccess", ",", "send", ")", "\n\n", "send", "(", "\"", "\"", ",", "t", ".", "q", ".", "Lag", "(", ")", ".", "Seconds", "(", ")", ")", "\n", "}" ]
3,555
all-3556
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "QuerySelectorAllParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom22", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
3,556
all-3557
[ "generateUserCredentials", "uses", "the", "vault", "plugin", "s", "Admin", "credentials", "to", "generate", "a", "new", "Pachyderm", "authentication", "token", "for", "username", "(", "i", ".", "e", ".", "the", "user", "who", "is", "currently", "requesting", "a", "Pachyderm", "token", "from", "Vault", ")", "." ]
[ "func", "generateUserCredentials", "(", "ctx", "context", ".", "<mask>", ",", "pachdAddress", "string", ",", "adminToken", "string", ",", "username", "string", ",", "ttl", "time", ".", "Duration", ")", "(", "string", ",", "error", ")", "{", "// Setup a single use client w the given admin token / address", "client", ",", "err", ":=", "pclient", ".", "NewFromAddress", "(", "pachdAddress", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "defer", "client", ".", "Close", "(", ")", "// avoid leaking connections", "\n\n", "client", "=", "client", ".", "WithCtx", "(", "ctx", ")", "\n", "client", ".", "SetAuthToken", "(", "adminToken", ")", "\n\n", "resp", ",", "err", ":=", "client", ".", "AuthAPIClient", ".", "GetAuthToken", "(", "client", ".", "Ctx", "(", ")", ",", "&", "auth", ".", "GetAuthTokenRequest", "{", "Subject", ":", "username", ",", "TTL", ":", "int64", "(", "ttl", ".", "Seconds", "(", ")", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "resp", ".", "Token", ",", "nil", "\n", "}" ]
3,557
all-3558
[ "BuildContainerDependency", "adds", "a", "new", "dependency", "container", "and", "satisfied", "status", "to", "the", "dependent", "container" ]
[ "func", "(", "c", "*", "Container", ")", "BuildContainerDependency", "(", "contName", "string", ",", "satisfiedStatus", "apicontainerstatus", ".", "ContainerStatus", ",", "dependentStatus", "apicontainerstatus", ".", "ContainerStatus", ")", "{", "contDep", ":=", "ContainerDependency", "{", "ContainerName", ":", "contName", ",", "SatisfiedStatus", ":", "satisfiedStatus", ",", "}", "\n", "if", "_", ",", "ok", ":=", "c", ".", "TransitionDependenciesMap", "[", "dependentStatus", "]", ";", "!", "ok", "{", "c", ".", "TransitionDependenciesMap", "[", "dependentStatus", "]", "=", "TransitionDependencySet", "{", "}", "\n", "}", "\n", "deps", ":=", "c", ".", "TransitionDependenciesMap", "[", "dependentStatus", "]", "\n", "deps", ".", "ContainerDependencies", "=", "<mask>", "(", "deps", ".", "ContainerDependencies", ",", "contDep", ")", "\n", "c", ".", "TransitionDependenciesMap", "[", "dependentStatus", "]", "=", "deps", "\n", "}" ]
3,558
all-3559
[ "buildAll", "ensures", "that", "all", "builds", "that", "should", "run", "and", "will", "be", "required", "are", "built" ]
[ "func", "buildAll", "(", "c", "<mask>", ",", "pr", "*", "github", ".", "PullRequest", ",", "eventGUID", "string", ",", "elideSkippedContexts", "bool", ")", "error", "{", "org", ",", "repo", ",", "number", ",", "branch", ":=", "pr", ".", "Base", ".", "Repo", ".", "Owner", ".", "Login", ",", "pr", ".", "Base", ".", "Repo", ".", "Name", ",", "pr", ".", "Number", ",", "pr", ".", "Base", ".", "Ref", "\n", "changes", ":=", "config", ".", "NewGitHubDeferredChangedFilesProvider", "(", "c", ".", "GitHubClient", ",", "org", ",", "repo", ",", "number", ")", "\n", "toTest", ",", "toSkipSuperset", ",", "err", ":=", "pjutil", ".", "FilterPresubmits", "(", "pjutil", ".", "TestAllFilter", "(", ")", ",", "changes", ",", "branch", ",", "c", ".", "Config", ".", "Presubmits", "[", "pr", ".", "Base", ".", "Repo", ".", "FullName", "]", ",", "c", ".", "Logger", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "toSkip", ":=", "determineSkippedPresubmits", "(", "toTest", ",", "toSkipSuperset", ",", "c", ".", "Logger", ")", "\n", "return", "runAndSkipJobs", "(", "c", ",", "pr", ",", "toTest", ",", "toSkip", ",", "eventGUID", ",", "elideSkippedContexts", ")", "\n", "}" ]
3,559
all-3560
[ "GetSignatures", "returns", "the", "image", "s", "signatures", ".", "It", "may", "use", "a", "remote", "(", "=", "slow", ")", "service", ".", "If", "instanceDigest", "is", "not", "nil", "it", "contains", "a", "digest", "of", "the", "specific", "manifest", "instance", "to", "retrieve", "signatures", "for", "(", "when", "the", "primary", "manifest", "is", "a", "manifest", "list", ")", ";", "this", "never", "happens", "if", "the", "primary", "manifest", "is", "not", "a", "manifest", "list", "(", "e", ".", "g", ".", "if", "the", "source", "never", "returns", "manifest", "lists", ")", "." ]
[ "func", "(", "s", "*", "dirImageSource", ")", "GetSignatures", "(", "ctx", "context", ".", "Context", ",", "instanceDigest", "*", "digest", ".", "Digest", ")", "(", "[", "]", "[", "]", "<mask>", ",", "error", ")", "{", "if", "instanceDigest", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "`Manifests lists are not supported by \"dir:\"`", ")", "\n", "}", "\n", "signatures", ":=", "[", "]", "[", "]", "byte", "{", "}", "\n", "for", "i", ":=", "0", ";", ";", "i", "++", "{", "signature", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "s", ".", "ref", ".", "signaturePath", "(", "i", ")", ")", "\n", "if", "err", "!=", "nil", "{", "if", "os", ".", "IsNotExist", "(", "err", ")", "{", "break", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "signatures", "=", "append", "(", "signatures", ",", "signature", ")", "\n", "}", "\n", "return", "signatures", ",", "nil", "\n", "}" ]
3,560
all-3561
[ "Init", "allocates", "new", "logger", "based", "on", "given", "options", "." ]
[ "func", "Init", "(", "opts", "Opts", ")", "(", "logger", "*", "zap", ".", "Logger", ",", "err", "error", ")", "{", "var", "(", "cfg", "zap", ".", "Config", "\n", "options", "[", "]", "zap", ".", "Option", "\n", "lvl", "zapcore", ".", "Level", "\n", ")", "\n", "switch", "opts", ".", "Environment", "{", "case", "\"", "\"", ":", "cfg", "=", "zap", ".", "NewProductionConfig", "(", ")", "\n", "<mask>", "\"", "\"", ":", "cfg", "=", "NewStackdriverConfig", "(", ")", "\n", "options", "=", "append", "(", "options", ",", "zap", ".", "Fields", "(", "zap", ".", "Object", "(", "\"", "\"", ",", "&", "ServiceContext", "{", "Service", ":", "\"", "\"", ",", "Version", ":", "opts", ".", "Version", ",", "}", ")", ")", ")", "\n", "case", "\"", "\"", ":", "cfg", "=", "zap", ".", "NewDevelopmentConfig", "(", ")", "\n", "default", ":", "cfg", "=", "zap", ".", "NewProductionConfig", "(", ")", "\n", "}", "\n\n", "if", "err", "=", "lvl", ".", "Set", "(", "opts", ".", "Level", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "cfg", ".", "Level", ".", "SetLevel", "(", "lvl", ")", "\n\n", "logger", ",", "err", "=", "cfg", ".", "Build", "(", "options", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "logger", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "opts", ".", "Environment", ")", ")", "\n\n", "return", "logger", ",", "nil", "\n", "}" ]
3,561
all-3562
[ "render", "primitives", "from", "array", "data" ]
[ "func", "DrawArrays", "(", "<mask>", "uint32", ",", "first", "int32", ",", "count", "int32", ")", "{", "C", ".", "glowDrawArrays", "(", "gpDrawArrays", ",", "(", "C", ".", "GLenum", ")", "(", "mode", ")", ",", "(", "C", ".", "GLint", ")", "(", "first", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ")", "\n", "}" ]
3,562
all-3563
[ "UnmarshalYAML", "implements", "the", "yaml", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "<mask>", "*", "Regexp", ")", "UnmarshalYAML", "(", "unmarshal", "func", "(", "interface", "{", "}", ")", "error", ")", "error", "{", "var", "s", "string", "\n", "if", "err", ":=", "unmarshal", "(", "&", "s", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "r", ",", "err", ":=", "NewRegexp", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "*", "re", "=", "r", "\n", "return", "nil", "\n", "}" ]
3,563
all-3564
[ "SetGaugeFunc", "sets", "a", "gauge", "to", "a", "function", "[", "called", "at", "flush", "interval", "]" ]
[ "func", "(", "m", "*", "CirconusMetrics", ")", "SetGaugeFunc", "(", "metric", "<mask>", ",", "fn", "func", "(", ")", "int64", ")", "{", "m", ".", "gfm", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "gfm", ".", "Unlock", "(", ")", "\n", "m", ".", "gaugeFuncs", "[", "metric", "]", "=", "fn", "\n", "}" ]
3,564
all-3565
[ "title", ":", "unset", "envs", "path", ":", "/", "apps", "/", "{", "app", "}", "/", "env", "method", ":", "DELETE", "produce", ":", "application", "/", "x", "-", "json", "-", "stream", "responses", ":", "200", ":", "Envs", "removed", "400", ":", "Invalid", "data", "401", ":", "Unauthorized", "404", ":", "App", "not", "found" ]
[ "func", "unsetEnv", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "msg", ":=", "\"", "\"", "\n", "if", "InputValue", "(", "r", ",", "\"", "\"", ")", "==", "\"", "\"", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "msg", "}", "\n", "}", "\n", "var", "variables", "[", "]", "string", "\n", "if", "envs", ",", "ok", ":=", "InputValues", "(", "r", ",", "\"", "\"", ")", ";", "ok", "{", "variables", "=", "envs", "\n", "}", "else", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "msg", "}", "\n", "}", "\n", "appName", ":=", "r", ".", "URL", ".", "<mask>", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "a", ",", "err", ":=", "getAppFromContext", "(", "appName", ",", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermAppUpdateEnvUnset", ",", "contextsForApp", "(", "&", "a", ")", "...", ",", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "appTarget", "(", "appName", ")", ",", "Kind", ":", "permission", ".", "PermAppUpdateEnvUnset", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermAppReadEvents", ",", "contextsForApp", "(", "&", "a", ")", "...", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "keepAliveWriter", ":=", "tsuruIo", ".", "NewKeepAliveWriter", "(", "w", ",", "30", "*", "time", ".", "Second", ",", "\"", "\"", ")", "\n", "defer", "keepAliveWriter", ".", "Stop", "(", ")", "\n", "writer", ":=", "&", "tsuruIo", ".", "SimpleJsonMessageEncoderWriter", "{", "Encoder", ":", "json", ".", "NewEncoder", "(", "keepAliveWriter", ")", "}", "\n", "evt", ".", "SetLogWriter", "(", "writer", ")", "\n", "noRestart", ",", "_", ":=", "strconv", ".", "ParseBool", "(", "InputValue", "(", "r", ",", "\"", "\"", ")", ")", "\n", "return", "a", ".", "UnsetEnvs", "(", "bind", ".", "UnsetEnvArgs", "{", "VariableNames", ":", "variables", ",", "ShouldRestart", ":", "!", "noRestart", ",", "Writer", ":", "evt", ",", "}", ")", "\n", "}" ]
3,565
all-3566
[ "Reset", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTimer", ")", "Reset", "(", "arg0", "<mask>", ".", "Duration", ")", "bool", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "bool", ")", "\n", "return", "ret0", "\n", "}" ]
3,566
all-3567
[ "LoadFromFile", "loads", "the", "cedar", "from", "a", "file", "where", "dataType", "is", "either", "json", "or", "gob", "." ]
[ "func", "(", "da", "*", "Cedar", ")", "LoadFromFile", "(", "fileName", "string", ",", "dataType", "string", ")", "error", "{", "file", ",", "err", ":=", "os", ".", "OpenFile", "(", "fileName", ",", "<mask>", ".", "O_RDONLY", ",", "0600", ")", "\n", "defer", "file", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "in", ":=", "bufio", ".", "NewReader", "(", "file", ")", "\n", "return", "da", ".", "Load", "(", "in", ",", "dataType", ")", "\n", "}" ]
3,567
all-3568
[ "Register", "registers", "itself", "as", "a", "grpc", "-", "proxy", "server", "by", "writing", "prefixed", "-", "key", "with", "session", "of", "specified", "TTL", "(", "in", "seconds", ")", ".", "The", "returned", "channel", "is", "closed", "when", "the", "client", "s", "context", "is", "canceled", "." ]
[ "func", "Register", "(", "c", "*", "clientv3", ".", "Client", ",", "prefix", "string", ",", "addr", "string", ",", "ttl", "int", ")", "<-", "chan", "struct", "{", "}", "{", "rm", ":=", "rate", ".", "NewLimiter", "(", "rate", ".", "Limit", "(", "registerRetryRate", ")", ",", "registerRetryRate", ")", "\n\n", "donec", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "go", "func", "(", ")", "{", "defer", "close", "(", "donec", ")", "\n\n", "for", "rm", ".", "Wait", "(", "c", ".", "Ctx", "(", ")", ")", "==", "nil", "{", "ss", ",", "err", ":=", "registerSession", "(", "c", ",", "prefix", ",", "addr", ",", "ttl", ")", "\n", "if", "err", "!=", "nil", "{", "plog", ".", "Warningf", "(", "\"", "\"", ",", "err", ")", "\n", "continue", "\n", "}", "\n", "select", "{", "case", "<-", "c", ".", "Ctx", "(", ")", ".", "Done", "(", ")", ":", "ss", ".", "Close", "(", ")", "\n", "return", "\n\n", "<mask>", "<-", "ss", ".", "Done", "(", ")", ":", "plog", ".", "Warning", "(", "\"", "\"", ")", "\n", "plog", ".", "Warning", "(", "\"", "\"", ")", "\n", "continue", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n\n", "return", "donec", "\n", "}" ]
3,568
all-3569
[ "Actual", "is", "used", "to", "build", "a", "cluster", "based", "on", "instances", "on", "the", "cloud", "provider", "." ]
[ "func", "(", "r", "*", "InstanceGroup", ")", "Actual", "(", "immutable", "*", "cluster", ".", "Cluster", ")", "(", "*", "cluster", ".", "Cluster", ",", "cloud", ".", "Resource", ",", "error", ")", "{", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n", "if", "r", ".", "CachedActual", "!=", "nil", "{", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "immutable", ",", "r", ".", "CachedActual", ",", "nil", "\n", "}", "\n", "newResource", ":=", "&", "InstanceGroup", "{", "Shared", ":", "Shared", "{", "Name", ":", "r", ".", "Name", ",", "CloudID", ":", "r", ".", "ServerPool", ".", "Identifier", ",", "}", ",", "}", "\n\n", "project", ",", "err", ":=", "Sdk", ".", "Service", ".", "Projects", ".", "Get", "(", "immutable", ".", "ProviderConfig", "(", ")", ".", "CloudId", ")", ".", "Do", "(", ")", "\n", "if", "err", "!=", "nil", "&&", "project", "!=", "nil", "{", "instances", ",", "err", ":=", "Sdk", ".", "Service", ".", "Instances", ".", "List", "(", "immutable", ".", "ProviderConfig", "(", ")", ".", "CloudId", ",", "immutable", ".", "ProviderConfig", "(", ")", ".", "Location", ")", ".", "Do", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "count", ":=", "len", "(", "instances", ".", "Items", ")", "\n", "if", "count", ">", "0", "{", "newResource", ".", "Count", "=", "count", "\n\n", "instance", ":=", "instances", ".", "Items", "[", "0", "]", "\n", "newResource", ".", "Name", "=", "instance", ".", "Name", "\n", "newResource", ".", "CloudID", "=", "string", "(", "instance", ".", "Id", ")", "\n", "newResource", ".", "Size", "=", "instance", ".", "Kind", "\n", "newResource", ".", "Image", "=", "r", ".", "<mask>", "\n", "newResource", ".", "Location", "=", "instance", ".", "Zone", "\n", "}", "\n", "}", "\n\n", "newResource", ".", "BootstrapScripts", "=", "r", ".", "ServerPool", ".", "BootstrapScripts", "\n", "newResource", ".", "SSHFingerprint", "=", "immutable", ".", "ProviderConfig", "(", ")", ".", "SSH", ".", "PublicKeyFingerprint", "\n", "newResource", ".", "Name", "=", "r", ".", "Name", "\n", "r", ".", "CachedActual", "=", "newResource", "\n", "return", "immutable", ",", "newResource", ",", "nil", "\n", "}" ]
3,569
all-3570
[ "bind", "a", "named", "texture", "to", "a", "texturing", "target" ]
[ "func", "BindTexture", "(", "<mask>", "uint32", ",", "texture", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpBindTexture", ",", "2", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "texture", ")", ",", "0", ")", "\n", "}" ]
3,570
all-3571
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "NameValuePair", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoHar7", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
3,571
all-3572
[ "SetDateHeader", "sets", "a", "date", "to", "the", "given", "header", "field", "." ]
[ "func", "(", "m", "*", "Message", ")", "SetDateHeader", "(", "field", "string", ",", "date", "time", ".", "Time", ")", "{", "m", ".", "header", "[", "<mask>", "]", "=", "[", "]", "string", "{", "m", ".", "FormatDate", "(", "date", ")", "}", "\n", "}" ]
3,572
all-3573
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetWindowForTargetParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser6", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
3,573
all-3574
[ "RecordKnownLocation", "records", "that", "a", "blob", "with", "the", "specified", "digest", "exists", "within", "the", "specified", "(", "transport", "scope", ")", "scope", "and", "can", "be", "reused", "given", "the", "opaque", "location", "data", "." ]
[ "func", "(", "bdc", "*", "cache", ")", "RecordKnownLocation", "(", "transport", "types", ".", "ImageTransport", ",", "scope", "types", ".", "BICTransportScope", ",", "blobDigest", "digest", ".", "Digest", ",", "location", "types", ".", "BICLocationReference", ")", "{", "_", "=", "bdc", ".", "update", "(", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "error", "{", "b", ",", "err", ":=", "tx", ".", "CreateBucketIfNotExists", "(", "knownLocationsBucket", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "b", ",", "err", "=", "b", ".", "CreateBucketIfNotExists", "(", "[", "]", "byte", "(", "transport", ".", "Name", "(", ")", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "b", ",", "err", "=", "b", ".", "CreateBucketIfNotExists", "(", "[", "]", "byte", "(", "<mask>", ".", "Opaque", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "b", ",", "err", "=", "b", ".", "CreateBucketIfNotExists", "(", "[", "]", "byte", "(", "blobDigest", ".", "String", "(", ")", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "value", ",", "err", ":=", "time", ".", "Now", "(", ")", ".", "MarshalBinary", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "b", ".", "Put", "(", "[", "]", "byte", "(", "location", ".", "Opaque", ")", ",", "value", ")", ";", "err", "!=", "nil", "{", "// Possibly overwriting an older entry.", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "// FIXME? Log error (but throttle the log volume on repeated accesses)?", "\n", "}" ]
3,574
all-3575
[ "GetDeadline", "returns", "the", "status", "code", "and", "body", "of", "url", ".", "The", "contents", "of", "dst", "will", "be", "replaced", "by", "the", "body", "and", "returned", "if", "the", "dst", "is", "too", "small", "a", "new", "slice", "will", "be", "allocated", ".", "The", "function", "follows", "redirects", ".", "Use", "Do", "*", "for", "manually", "handling", "redirects", ".", "ErrTimeout", "error", "is", "returned", "if", "url", "contents", "couldn", "t", "be", "fetched", "until", "the", "given", "deadline", "." ]
[ "func", "GetDeadline", "(", "dst", "[", "]", "byte", ",", "<mask>", "string", ",", "deadline", "time", ".", "Time", ")", "(", "statusCode", "int", ",", "body", "[", "]", "byte", ",", "err", "error", ")", "{", "return", "defaultClient", ".", "GetDeadline", "(", "dst", ",", "url", ",", "deadline", ")", "\n", "}" ]
3,575
all-3576
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "DOMBreakpointType", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
3,576
all-3577
[ "SetSelectable", "is", "a", "wrapper", "around", "gtk_label_set_selectable", "()", "." ]
[ "func", "(", "v", "*", "Label", ")", "SetSelectable", "(", "setting", "bool", ")", "{", "C", ".", "gtk_label_set_selectable", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "<mask>", ")", ")", "\n", "}" ]
3,577
all-3578
[ "zfsModuleVersionGet", "returns", "the", "ZFS", "module", "version" ]
[ "func", "zfsModuleVersionGet", "(", ")", "(", "string", ",", "error", ")", "{", "<mask>", "zfsVersion", "string", "\n\n", "if", "shared", ".", "PathExists", "(", "\"", "\"", ")", "{", "out", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "zfsVersion", "=", "string", "(", "out", ")", "\n", "}", "else", "{", "out", ",", "err", ":=", "shared", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "zfsVersion", "=", "out", "\n", "}", "\n\n", "return", "strings", ".", "TrimSpace", "(", "zfsVersion", ")", ",", "nil", "\n", "}" ]
3,578
all-3579
[ "parseBICLocationReference", "returns", "a", "repository", "for", "encoded", "lr", "." ]
[ "func", "parseBICLocationReference", "(", "lr", "types", ".", "BICLocationReference", ")", "(", "<mask>", ".", "Named", ",", "error", ")", "{", "return", "reference", ".", "ParseNormalizedNamed", "(", "lr", ".", "Opaque", ")", "\n", "}" ]
3,579
all-3580
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventWebSocketFrameReceived", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork43", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
3,580
all-3581
[ "Run", "invokes", "a", "single", "send", "/", "receive", "procedure", ".", "It", "sends", "packets", "to", "all", "hosts", "which", "have", "already", "been", "added", "by", "AddIP", "()", "etc", ".", "and", "wait", "those", "responses", ".", "When", "it", "receives", "a", "response", "it", "calls", "receive", "handler", "registered", "by", "AddHander", "()", ".", "After", "MaxRTT", "seconds", "it", "calls", "idle", "handler", "and", "returns", "to", "caller", "with", "an", "error", "value", ".", "It", "means", "it", "blocks", "until", "MaxRTT", "seconds", "passed", ".", "For", "the", "purpose", "of", "sending", "/", "receiving", "packets", "over", "and", "over", "use", "RunLoop", "()", "." ]
[ "func", "(", "p", "*", "Pinger", ")", "Run", "(", ")", "error", "{", "p", ".", "mu", ".", "Lock", "(", ")", "\n", "p", ".", "ctx", "=", "newContext", "(", ")", "\n", "p", ".", "mu", ".", "Unlock", "(", ")", "\n", "p", ".", "<mask>", "(", "true", ")", "\n", "p", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "p", ".", "ctx", ".", "err", "\n", "}" ]
3,581
all-3582
[ "StaticCallee", "returns", "the", "callee", "if", "this", "is", "a", "trivially", "static", "call", "-", "mode", "call", "to", "a", "function", "." ]
[ "func", "(", "c", "*", "CallCommon", ")", "StaticCallee", "(", ")", "*", "Function", "{", "switch", "fn", ":=", "c", ".", "<mask>", ".", "(", "type", ")", "{", "case", "*", "Function", ":", "return", "fn", "\n", "case", "*", "MakeClosure", ":", "return", "fn", ".", "Fn", ".", "(", "*", "Function", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
3,582
all-3583
[ "Parse", "converts", "a", "byte", "array", "containing", "R", "SEXP", "to", "a", "golang", "object", ".", "This", "can", "be", "converted", "to", "native", "golang", "types", "." ]
[ "func", "Parse", "(", "buf", "[", "]", "byte", ",", "<mask>", "int", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "obj", ",", "_", ",", "err", ":=", "parseReturningOffset", "(", "buf", ",", "offset", ")", "\n", "return", "obj", ",", "err", "\n", "}" ]
3,583
all-3584
[ "Sets", "the", "contents", "of", "register", "sa", "to", "a", "regular", "string", "and", "removes", "the", "raw", "string", "mark", "forcing", "html", "escapes", "to", "be", "applied", "when", "printing", ".", "Note", "that", "this", "effectively", "stringifies", "the", "contents", "of", "register", "sa" ]
[ "func", "txUnmarkRaw", "(", "st", "*", "State", ")", "{", "if", "reflect", ".", "ValueOf", "(", "st", ".", "sa", ")", ".", "<mask>", "(", ")", "==", "rawStringType", "{", "st", ".", "sa", "=", "string", "(", "interfaceToString", "(", "st", ".", "sa", ")", ")", "\n", "}", "\n", "st", ".", "Advance", "(", ")", "\n", "}" ]
3,584
all-3585
[ "UrlFor", "returns", "the", "relative", "URL", "for", "the", "route", "name" ]
[ "func", "UrlFor", "(", "name", "string", ",", "args", "...", "string", ")", "*", "url", ".", "<mask>", "{", "r", ":=", "Router", ".", "Get", "(", "name", ")", "\n", "if", "r", "==", "nil", "{", "log", ".", "Panicf", "(", "\"", "\\n", "\"", ",", "name", ")", "\n", "}", "\n", "u", ",", "err", ":=", "r", ".", "URL", "(", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Panicln", "(", "\"", "\"", "+", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "return", "u", "\n", "}" ]
3,585
all-3586
[ "SetFocusVisible", "is", "a", "wrapper", "around", "gtk_window_set_focus_visible", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "SetFocusVisible", "(", "<mask>", "bool", ")", "{", "C", ".", "gtk_window_set_focus_visible", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "setting", ")", ")", "\n", "}" ]
3,586
all-3587
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ClearDeviceOrientationOverrideParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDeviceorientation1", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
3,587
all-3588
[ "Timeout", "is", "a", "middleware", "that", "cancels", "ctx", "after", "a", "given", "timeout", "and", "return", "a", "504", "Gateway", "Timeout", "error", "to", "the", "client", ".", "It", "s", "required", "that", "you", "select", "the", "ctx", ".", "Done", "()", "channel", "to", "check", "for", "the", "signal", "if", "the", "context", "has", "reached", "its", "deadline", "and", "return", "otherwise", "the", "timeout", "signal", "will", "be", "just", "ignored", ".", "ie", ".", "a", "route", "/", "handler", "may", "look", "like", ":", "r", ".", "Get", "(", "/", "long", "func", "(", "w", "http", ".", "ResponseWriter", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":", "=", "r", ".", "Context", "()", "processTime", ":", "=", "time", ".", "Duration", "(", "rand", ".", "Intn", "(", "4", ")", "+", "1", ")", "*", "time", ".", "Second", "select", "{", "case", "<", "-", "ctx", ".", "Done", "()", ":", "return", "case", "<", "-", "time", ".", "After", "(", "processTime", ")", ":", "//", "The", "above", "channel", "simulates", "some", "hard", "work", ".", "}", "w", ".", "Write", "(", "[]", "byte", "(", "done", "))", "}", ")" ]
[ "func", "Timeout", "(", "timeout", "time", ".", "Duration", ")", "func", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "func", "(", "<mask>", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "fn", ":=", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "r", ".", "Context", "(", ")", ",", "timeout", ")", "\n", "defer", "func", "(", ")", "{", "cancel", "(", ")", "\n", "if", "ctx", ".", "Err", "(", ")", "==", "context", ".", "DeadlineExceeded", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusGatewayTimeout", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "r", "=", "r", ".", "WithContext", "(", "ctx", ")", "\n", "next", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", "\n", "return", "http", ".", "HandlerFunc", "(", "fn", ")", "\n", "}", "\n", "}" ]
3,588
all-3589
[ "bind", "a", "level", "of", "a", "texture", "to", "an", "image", "unit" ]
[ "func", "BindImageTexture", "(", "unit", "uint32", ",", "texture", "uint32", ",", "level", "int32", ",", "layered", "bool", ",", "layer", "int32", ",", "access", "uint32", ",", "format", "uint32", ")", "{", "C", ".", "glowBindImageTexture", "(", "gpBindImageTexture", ",", "(", "C", ".", "GLuint", ")", "(", "unit", ")", ",", "(", "C", ".", "GLuint", ")", "(", "texture", ")", ",", "(", "C", ".", "GLint", ")", "(", "level", ")", ",", "(", "C", ".", "GLboolean", ")", "(", "boolToInt", "(", "layered", ")", ")", ",", "(", "C", ".", "GLint", ")", "(", "layer", ")", ",", "(", "C", ".", "GLenum", ")", "(", "access", ")", ",", "(", "C", ".", "GLenum", ")", "(", "<mask>", ")", ")", "\n", "}" ]
3,589
all-3590
[ "GetIncreaseGoodOk", "returns", "a", "tuple", "with", "the", "IncreaseGood", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TileDefRequest", ")", "GetIncreaseGoodOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "t", "==", "nil", "||", "t", ".", "IncreaseGood", "==", "nil", "{", "return", "false", ",", "<mask>", "\n", "}", "\n", "return", "*", "t", ".", "IncreaseGood", ",", "true", "\n", "}" ]
3,590
all-3591
[ "GetEnvOk", "returns", "a", "tuple", "with", "the", "Env", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetEnvOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "Env", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "w", ".", "Env", ",", "<mask>", "\n", "}" ]
3,591
all-3592
[ "As", "mesured", "by", "the", "timer", "middleware", "." ]
[ "func", "(", "u", "*", "accessLogUtil", ")", "ResponseTime", "(", ")", "*", "time", ".", "Duration", "{", "if", "u", ".", "R", ".", "Env", "[", "\"", "\"", "]", "!=", "nil", "{", "return", "u", ".", "R", ".", "Env", "[", "\"", "\"", "]", ".", "(", "*", "<mask>", ".", "Duration", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
3,592
all-3593
[ "<vector", "-", "type", ">", "::", "=", "Dv", "<number", ">", "_", "<type", ">", "::", "=", "Dv", "_", "<expression", ">", "_", "<type", ">" ]
[ "func", "(", "st", "*", "state", ")", "vectorType", "(", "isCast", "bool", ")", "AST", "{", "if", "len", "(", "st", ".", "str", ")", "==", "0", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n\n", "var", "dim", "AST", "\n", "if", "st", ".", "str", "[", "0", "]", "==", "'_'", "{", "st", ".", "advance", "(", "1", ")", "\n", "dim", "=", "st", ".", "<mask>", "(", ")", "\n", "}", "else", "{", "num", ":=", "st", ".", "number", "(", ")", "\n", "dim", "=", "&", "Name", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "num", ")", "}", "\n", "}", "\n\n", "if", "len", "(", "st", ".", "str", ")", "==", "0", "||", "st", ".", "str", "[", "0", "]", "!=", "'_'", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "st", ".", "advance", "(", "1", ")", "\n\n", "t", ":=", "st", ".", "demangleType", "(", "isCast", ")", "\n\n", "return", "&", "VectorType", "{", "Dimension", ":", "dim", ",", "Base", ":", "t", "}", "\n", "}" ]
3,593
all-3594
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "TakeTypeProfileReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
3,594
all-3595
[ "SetupNS", "indicates", "an", "expected", "call", "of", "SetupNS" ]
[ "func", "(", "mr", "*", "MockCNIClientMockRecorder", ")", "SetupNS", "(", "arg0", ",", "arg1", ",", "arg2", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockCNIClient", ")", "(", "nil", ")", ".", "SetupNS", ")", ",", "arg0", ",", "arg1", ",", "arg2", ")", "\n", "}" ]
3,595
all-3596
[ "NewDryrunSTM", "intiates", "a", "new", "STM", "operation", "but", "the", "final", "commit", "is", "skipped", ".", "It", "uses", "a", "serializable", "model", "." ]
[ "func", "NewDryrunSTM", "(", "ctx", "context", ".", "Context", ",", "c", "*", "v3", ".", "Client", ",", "apply", "func", "(", "STM", ")", "error", ")", "error", "{", "_", ",", "err", ":=", "newSTMSerializable", "(", "ctx", ",", "c", ",", "<mask>", ",", "true", ")", "\n", "return", "err", "\n", "}" ]
3,596
all-3597
[ "FetchCheckBundle", "retrieves", "check", "bundle", "with", "passed", "cid", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchCheckBundle", "(", "cid", "CIDType", ")", "(", "*", "CheckBundle", ",", "error", ")", "{", "if", "cid", "==", "nil", "||", "*", "cid", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "bundleCID", ":=", "string", "(", "*", "cid", ")", "\n\n", "<mask>", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "CheckBundleCIDRegex", ",", "bundleCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "bundleCID", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "bundleCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "result", ")", ")", "\n", "}", "\n\n", "checkBundle", ":=", "&", "CheckBundle", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "checkBundle", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "checkBundle", ",", "nil", "\n", "}" ]
3,597
all-3598
[ "SortTypes", "sorts", "the", "given", "types", "from", "least", "specific", "to", "most", "specific" ]
[ "func", "SortTypes", "(", "types", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "<mask>", ":=", "&", "typeSorter", "{", "types", ":", "make", "(", "[", "]", "string", ",", "len", "(", "types", ")", ")", "}", "\n", "copy", "(", "ts", ".", "types", ",", "types", ")", "\n", "sort", ".", "Sort", "(", "ts", ")", "\n", "if", "ts", ".", "invalid", "{", "return", "types", ",", "ErrNotHierarchy", "\n", "}", "\n", "return", "ts", ".", "types", ",", "nil", "\n", "}" ]
3,598
all-3599
[ "Init", "sets", "the", "Path", "and", "Interval", "options" ]
[ "func", "(", "f", "*", "File", ")", "Init", "(", ")", "error", "{", "if", "f", ".", "Path", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "f", ".", "Interval", "<", "1", "*", "time", ".", "Second", "{", "f", ".", "Interval", "=", "1", "*", "<mask>", ".", "Second", "\n", "}", "\n", "if", "err", ":=", "f", ".", "updateHash", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
3,599
all-3600
[ "merge", "merges", "two", "similar", "Call", "zapping", "out", "differences", "." ]
[ "func", "(", "c", "*", "Call", ")", "merge", "(", "r", "*", "Call", ")", "Call", "{", "<mask>", "Call", "{", "SrcPath", ":", "c", ".", "SrcPath", ",", "Line", ":", "c", ".", "Line", ",", "Func", ":", "c", ".", "Func", ",", "Args", ":", "c", ".", "Args", ".", "merge", "(", "&", "r", ".", "Args", ")", ",", "LocalSrcPath", ":", "c", ".", "LocalSrcPath", ",", "IsStdlib", ":", "c", ".", "IsStdlib", ",", "}", "\n", "}" ]