id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
22,100
all-22101
[ "GetInvert", "returns", "the", "Invert", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "ConditionalFormat", ")", "GetInvert", "(", ")", "bool", "{", "if", "c", "==", "nil", "||", "c", ".", "Invert", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "c", ".", "Invert", "\n", "}" ]
22,101
all-22102
[ "SetAttr", "will", "set", "key", "to", "the", "provided", "value", ".", "If", "the", "attribute", "already", "exists", "the", "value", "will", "be", "replaced", "with", "the", "new", "value", "." ]
[ "func", "(", "a", "*", "Attrs", ")", "SetAttr", "(", "key", "string", ",", "value", "interface", "{", "}", ")", "*", "Attrs", "{", "a", ".", "attrsLock", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "attrsLock", ".", "Unlock", "(", ")", "\n\n", "valVal", ":=", "reflect", ".", "ValueOf", "(", "value", ")", "\n", "switch", "valVal", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Func", ":", "value", "=", "valVal", ".", "Type", "(", ")", ".", "String", "(", ")", "\n", "}", "\n\n", "hash", ":=", "getAttrHash", "(", "key", ")", "\n", "a", ".", "attrs", "[", "hash", "]", "=", "<mask>", "\n", "return", "a", "\n", "}" ]
22,102
all-22103
[ "OpenReader", "opens", "a", "RAR", "archive", "specified", "by", "the", "name", "and", "returns", "a", "ReadCloser", "." ]
[ "func", "OpenReader", "(", "name", ",", "password", "string", ")", "(", "*", "ReadCloser", ",", "error", ")", "{", "v", ",", "err", ":=", "openVolume", "(", "<mask>", ",", "password", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "rc", ":=", "new", "(", "ReadCloser", ")", "\n", "rc", ".", "v", "=", "v", "\n", "rc", ".", "Reader", ".", "init", "(", "v", ")", "\n", "return", "rc", ",", "nil", "\n", "}" ]
22,103
all-22104
[ "BuildPackage", "builds", "an", "SSA", "program", "with", "IR", "for", "a", "single", "package", ".", "It", "populates", "pkg", "by", "type", "-", "checking", "the", "specified", "file", "ASTs", ".", "All", "dependencies", "are", "loaded", "using", "the", "importer", "specified", "by", "tc", "which", "typically", "loads", "compiler", "export", "data", ";", "SSA", "code", "cannot", "be", "built", "for", "those", "packages", ".", "BuildPackage", "then", "constructs", "an", "ssa", ".", "Program", "with", "all", "dependency", "packages", "created", "and", "builds", "and", "returns", "the", "SSA", "package", "corresponding", "to", "pkg", ".", "The", "caller", "must", "have", "set", "pkg", ".", "Path", "()", "to", "the", "import", "path", ".", "The", "operation", "fails", "if", "there", "were", "any", "type", "-", "checking", "or", "import", "errors", ".", "See", "..", "/", "ssa", "/", "example_test", ".", "go", "for", "an", "example", "." ]
[ "func", "BuildPackage", "(", "tc", "*", "types", ".", "Config", ",", "fset", "*", "token", ".", "FileSet", ",", "pkg", "*", "types", ".", "Package", ",", "files", "[", "]", "*", "ast", ".", "File", ",", "mode", "ssa", ".", "BuilderMode", ")", "(", "*", "ssa", ".", "Package", ",", "*", "types", ".", "Info", ",", "error", ")", "{", "if", "fset", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "pkg", ".", "Path", "(", ")", "==", "\"", "\"", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "info", ":=", "&", "types", ".", "Info", "{", "Types", ":", "make", "(", "map", "[", "ast", ".", "Expr", "]", "types", ".", "TypeAndValue", ")", ",", "Defs", ":", "make", "(", "<mask>", "[", "*", "ast", ".", "Ident", "]", "types", ".", "Object", ")", ",", "Uses", ":", "make", "(", "map", "[", "*", "ast", ".", "Ident", "]", "types", ".", "Object", ")", ",", "Implicits", ":", "make", "(", "map", "[", "ast", ".", "Node", "]", "types", ".", "Object", ")", ",", "Scopes", ":", "make", "(", "map", "[", "ast", ".", "Node", "]", "*", "types", ".", "Scope", ")", ",", "Selections", ":", "make", "(", "map", "[", "*", "ast", ".", "SelectorExpr", "]", "*", "types", ".", "Selection", ")", ",", "}", "\n", "if", "err", ":=", "types", ".", "NewChecker", "(", "tc", ",", "fset", ",", "pkg", ",", "info", ")", ".", "Files", "(", "files", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "prog", ":=", "ssa", ".", "NewProgram", "(", "fset", ",", "mode", ")", "\n\n", "// Create SSA packages for all imports.", "// Order is not significant.", "created", ":=", "make", "(", "map", "[", "*", "types", ".", "Package", "]", "bool", ")", "\n", "var", "createAll", "func", "(", "pkgs", "[", "]", "*", "types", ".", "Package", ")", "\n", "createAll", "=", "func", "(", "pkgs", "[", "]", "*", "types", ".", "Package", ")", "{", "for", "_", ",", "p", ":=", "range", "pkgs", "{", "if", "!", "created", "[", "p", "]", "{", "created", "[", "p", "]", "=", "true", "\n", "prog", ".", "CreatePackage", "(", "p", ",", "nil", ",", "nil", ",", "true", ")", "\n", "createAll", "(", "p", ".", "Imports", "(", ")", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "createAll", "(", "pkg", ".", "Imports", "(", ")", ")", "\n\n", "// Create and build the primary package.", "ssapkg", ":=", "prog", ".", "CreatePackage", "(", "pkg", ",", "files", ",", "info", ",", "false", ")", "\n", "ssapkg", ".", "Build", "(", ")", "\n", "return", "ssapkg", ",", "info", ",", "nil", "\n", "}" ]
22,104
all-22105
[ "GetTaskByIPAddress", "gets", "the", "task", "arn", "for", "an", "IP", "address" ]
[ "func", "(", "state", "*", "DockerTaskEngineState", ")", "GetTaskByIPAddress", "(", "addr", "string", ")", "(", "string", ",", "bool", ")", "{", "state", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "state", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "taskARN", ",", "<mask>", ":=", "state", ".", "ipToTask", "[", "addr", "]", "\n", "return", "taskARN", ",", "ok", "\n", "}" ]
22,105
all-22106
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GdkDevice", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "native", "(", ")", "*", "C", ".", "GdkDevice", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "return", "C", ".", "toGdkDevice", "(", "p", ")", "\n", "}" ]
22,106
all-22107
[ "NewSkiplist", "constructs", "and", "initializes", "a", "new", "empty", "skiplist", ".", "All", "nodes", "keys", "and", "values", "in", "the", "skiplist", "will", "be", "allocated", "from", "the", "given", "arena", "." ]
[ "func", "NewSkiplist", "(", "arena", "*", "Arena", ")", "*", "Skiplist", "{", "// Allocate head and tail nodes.", "head", ",", "err", ":=", "newNode", "(", "arena", ",", "maxHeight", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "tail", ",", "err", ":=", "newNode", "(", "arena", ",", "maxHeight", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Link all head/tail levels together.", "headOffset", ":=", "arena", ".", "GetPointerOffset", "(", "unsafe", ".", "Pointer", "(", "head", ")", ")", "\n", "tailOffset", ":=", "arena", ".", "GetPointerOffset", "(", "unsafe", ".", "Pointer", "(", "tail", ")", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "maxHeight", ";", "i", "++", "{", "head", ".", "tower", "[", "i", "]", ".", "nextOffset", "=", "tailOffset", "\n", "tail", ".", "tower", "[", "i", "]", ".", "prevOffset", "=", "headOffset", "\n", "}", "\n\n", "skl", ":=", "&", "Skiplist", "{", "arena", ":", "arena", ",", "head", ":", "head", ",", "tail", ":", "<mask>", ",", "height", ":", "1", ",", "}", "\n\n", "return", "skl", "\n", "}" ]
22,107
all-22108
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetSamplingProfileParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeapprofiler10", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
22,108
all-22109
[ "Listen", "bind", "port", ".", "Receive", "messages", "and", "send", "to", "out", "channel" ]
[ "func", "(", "rcv", "*", "UDP", ")", "Listen", "(", "addr", "*", "net", ".", "UDPAddr", ")", "error", "{", "return", "rcv", ".", "StartFunc", "(", "func", "(", ")", "error", "{", "var", "err", "error", "\n", "rcv", ".", "conn", ",", "err", "=", "<mask>", ".", "ListenUDP", "(", "\"", "\"", ",", "addr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "rcv", ".", "Go", "(", "func", "(", "exit", "chan", "bool", ")", "{", "<-", "exit", "\n", "rcv", ".", "conn", ".", "Close", "(", ")", "\n", "}", ")", "\n\n", "if", "rcv", ".", "buffer", "!=", "nil", "{", "originalOut", ":=", "rcv", ".", "out", "\n\n", "rcv", ".", "Go", "(", "func", "(", "exit", "chan", "bool", ")", "{", "for", "{", "select", "{", "case", "<-", "exit", ":", "return", "\n", "case", "p", ":=", "<-", "rcv", ".", "buffer", ":", "originalOut", "(", "p", ")", "\n", "}", "\n", "}", "\n", "}", ")", "\n\n", "rcv", ".", "out", "=", "func", "(", "p", "*", "points", ".", "Points", ")", "{", "rcv", ".", "buffer", "<-", "p", "\n", "}", "\n", "}", "\n\n", "rcv", ".", "Go", "(", "rcv", ".", "receiveWorker", ")", "\n\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
22,109
all-22110
[ "FullID", "prints", "repoName", "/", "CommitID" ]
[ "func", "(", "c", "*", "Commit", ")", "FullID", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "Repo", ".", "<mask>", ",", "c", ".", "ID", ")", "\n", "}" ]
22,110
all-22111
[ "StorageVolumeConfigGet", "gets", "the", "config", "of", "a", "storage", "volume", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "StorageVolumeConfigGet", "(", "volumeID", "int64", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "var", "key", ",", "value", "string", "\n", "query", ":=", "\"", "\"", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "volumeID", "}", "\n", "outargs", ":=", "[", "]", "interface", "{", "}", "{", "<mask>", ",", "value", "}", "\n\n", "results", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "query", ",", "inargs", ",", "outargs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "config", ":=", "map", "[", "string", "]", "string", "{", "}", "\n\n", "for", "_", ",", "r", ":=", "range", "results", "{", "key", "=", "r", "[", "0", "]", ".", "(", "string", ")", "\n", "value", "=", "r", "[", "1", "]", ".", "(", "string", ")", "\n\n", "config", "[", "key", "]", "=", "value", "\n", "}", "\n\n", "return", "config", ",", "nil", "\n", "}" ]
22,111
all-22112
[ "Skip", "skips", "over", "the", "n", "initial", "documents", "from", "the", "query", "results", ".", "Note", "that", "this", "only", "makes", "sense", "with", "capped", "collections", "where", "documents", "are", "naturally", "ordered", "by", "insertion", "time", "or", "with", "sorted", "results", "." ]
[ "func", "(", "q", "*", "Query", ")", "Skip", "(", "n", "int", ")", "*", "Query", "{", "q", ".", "m", ".", "Lock", "(", ")", "\n", "q", ".", "op", ".", "<mask>", "=", "int32", "(", "n", ")", "\n", "q", ".", "m", ".", "Unlock", "(", ")", "\n", "return", "q", "\n", "}" ]
22,112
all-22113
[ "Returns", "isDefaultValue", "=", "true", "iff", "is", "ultimately", "nil", "or", "empty", "after", "(", "recursive", ")", "dereferencing", ".", "If", "isDefaultValue", "=", "false", "erv", "is", "set", "to", "the", "non", "-", "nil", "non", "-", "default", "dereferenced", "value", ".", "A", "zero", "/", "empty", "struct", "is", "not", "considered", "default", "for", "this", "function", "." ]
[ "func", "isDefaultValue", "(", "rv", "reflect", ".", "Value", ")", "(", "erv", "reflect", ".", "Value", ",", "isDefaultValue", "bool", ")", "{", "rv", ",", "_", ",", "isNilPtr", ":=", "derefPointers", "(", "rv", ")", "\n", "if", "isNilPtr", "{", "return", "rv", ",", "true", "\n", "}", "else", "{", "switch", "rv", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Bool", ":", "return", "rv", ",", "rv", ".", "Bool", "(", ")", "==", "false", "\n", "case", "reflect", ".", "Int", ",", "reflect", ".", "Int8", ",", "reflect", ".", "Int16", ",", "reflect", ".", "Int32", ",", "reflect", ".", "Int64", ":", "return", "rv", ",", "rv", ".", "Int", "(", ")", "==", "0", "\n", "case", "reflect", ".", "Uint", ",", "reflect", ".", "Uint8", ",", "reflect", ".", "Uint16", ",", "reflect", ".", "Uint32", ",", "reflect", ".", "Uint64", ":", "return", "rv", ",", "rv", ".", "Uint", "(", ")", "==", "0", "\n", "case", "reflect", ".", "String", ":", "return", "rv", ",", "rv", ".", "Len", "(", ")", "==", "0", "\n", "case", "reflect", ".", "Chan", ",", "reflect", ".", "Map", ",", "reflect", ".", "Slice", ":", "return", "rv", ",", "rv", ".", "IsNil", "(", ")", "||", "rv", ".", "Len", "(", ")", "==", "0", "\n", "case", "reflect", ".", "Func", ",", "reflect", ".", "Interface", ":", "return", "rv", ",", "rv", ".", "IsNil", "(", ")", "\n", "default", ":", "return", "rv", ",", "<mask>", "\n", "}", "\n", "}", "\n", "}" ]
22,113
all-22114
[ "Acquire", "lock", "on", "mmap", "/", "file", "if", "you", "are", "calling", "this" ]
[ "func", "(", "lf", "*", "logFile", ")", "read", "(", "p", "valuePointer", ",", "s", "*", "y", ".", "Slice", ")", "(", "buf", "[", "]", "byte", ",", "err", "error", ")", "{", "var", "nbr", "int64", "\n", "offset", ":=", "p", ".", "Offset", "\n", "if", "lf", ".", "loadingMode", "==", "options", ".", "FileIO", "{", "buf", "=", "s", ".", "Resize", "(", "int", "(", "p", ".", "Len", ")", ")", "\n", "var", "n", "int", "\n", "n", ",", "err", "=", "lf", ".", "fd", ".", "ReadAt", "(", "buf", ",", "int64", "(", "offset", ")", ")", "\n", "nbr", "=", "int64", "(", "n", ")", "\n", "}", "else", "{", "// Do not convert size to uint32, because the lf.fmap can be of size", "// 4GB, which overflows the uint32 during conversion to make the size 0,", "// causing the read to fail with ErrEOF. See issue #585.", "size", ":=", "int64", "(", "len", "(", "lf", ".", "fmap", ")", ")", "\n", "valsz", ":=", "p", ".", "Len", "\n", "if", "int64", "(", "offset", ")", ">=", "size", "||", "int64", "(", "offset", "+", "valsz", ")", ">", "<mask>", "{", "err", "=", "y", ".", "ErrEOF", "\n", "}", "else", "{", "buf", "=", "lf", ".", "fmap", "[", "offset", ":", "offset", "+", "valsz", "]", "\n", "nbr", "=", "int64", "(", "valsz", ")", "\n", "}", "\n", "}", "\n", "y", ".", "NumReads", ".", "Add", "(", "1", ")", "\n", "y", ".", "NumBytesRead", ".", "Add", "(", "nbr", ")", "\n", "return", "buf", ",", "err", "\n", "}" ]
22,114
all-22115
[ "SwapBody", "swaps", "response", "body", "with", "the", "given", "body", "and", "returns", "the", "previous", "response", "body", ".", "It", "is", "forbidden", "to", "use", "the", "body", "passed", "to", "SwapBody", "after", "the", "function", "returns", "." ]
[ "func", "(", "resp", "*", "Response", ")", "SwapBody", "(", "body", "[", "]", "byte", ")", "[", "]", "byte", "{", "bb", ":=", "resp", ".", "bodyBuffer", "(", ")", "\n\n", "if", "resp", ".", "bodyStream", "!=", "nil", "{", "bb", ".", "Reset", "(", ")", "\n", "_", ",", "err", ":=", "copyZeroAlloc", "(", "bb", ",", "resp", ".", "bodyStream", ")", "\n", "resp", ".", "closeBodyStream", "(", ")", "\n", "if", "err", "!=", "nil", "{", "bb", ".", "Reset", "(", ")", "\n", "bb", ".", "SetString", "(", "err", ".", "<mask>", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "resp", ".", "bodyRaw", "=", "nil", "\n\n", "oldBody", ":=", "bb", ".", "B", "\n", "bb", ".", "B", "=", "body", "\n", "return", "oldBody", "\n", "}" ]
22,115
all-22116
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetSamplingProfileReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler9", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
22,116
all-22117
[ "RegexpPath", "-----------------------------------------------------------------", "NewRegexpPath", "returns", "a", "regexp", "matcher", "for", "the", "given", "URL", "path", "pattern", "." ]
[ "func", "NewRegexpPath", "(", "<mask>", "string", ")", "(", "*", "RegexpPath", ",", "error", ")", "{", "r", ",", "err", ":=", "CompileRegexp", "(", "pattern", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "RegexpPath", "{", "*", "r", "}", ",", "nil", "\n", "}" ]
22,117
all-22118
[ "ListenAndServeUNIX", "serves", "HTTP", "requests", "from", "the", "given", "UNIX", "addr", "using", "the", "given", "handler", ".", "The", "function", "deletes", "existing", "file", "at", "addr", "before", "starting", "serving", ".", "The", "server", "sets", "the", "given", "file", "mode", "for", "the", "UNIX", "addr", "." ]
[ "func", "ListenAndServeUNIX", "(", "addr", "string", ",", "mode", "os", ".", "FileMode", ",", "<mask>", "RequestHandler", ")", "error", "{", "s", ":=", "&", "Server", "{", "Handler", ":", "handler", ",", "}", "\n", "return", "s", ".", "ListenAndServeUNIX", "(", "addr", ",", "mode", ")", "\n", "}" ]
22,118
all-22119
[ "Sends", "a", "find_node", "query", "to", "addr", ".", "targetID", "is", "the", "node", "we", "re", "looking", "for", "." ]
[ "func", "(", "s", "*", "Server", ")", "findNode", "(", "addr", "Addr", ",", "targetID", "int160", ",", "callback", "func", "(", "krpc", ".", "Msg", ",", "error", ")", ")", "(", "err", "error", ")", "{", "return", "s", ".", "<mask>", "(", "addr", ",", "\"", "\"", ",", "&", "krpc", ".", "MsgArgs", "{", "Target", ":", "targetID", ".", "AsByteArray", "(", ")", ",", "Want", ":", "[", "]", "krpc", ".", "Want", "{", "krpc", ".", "WantNodes", ",", "krpc", ".", "WantNodes6", "}", ",", "}", ",", "func", "(", "m", "krpc", ".", "Msg", ",", "err", "error", ")", "{", "// Scrape peers from the response to put in the server's table before", "// handing the response back to the caller.", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "s", ".", "addResponseNodes", "(", "m", ")", "\n", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "callback", "(", "m", ",", "err", ")", "\n", "}", ")", "\n", "}" ]
22,119
all-22120
[ "ValidKey", "returns", "true", "if", "the", "given", "key", "is", "valid", "otherwise", "false", "." ]
[ "func", "ValidKey", "(", "<mask>", "string", ")", "bool", "{", "return", "len", "(", "key", ")", "<=", "maxKey", "&&", "keyRegex", ".", "Match", "(", "[", "]", "byte", "(", "key", ")", ")", "\n", "}" ]
22,120
all-22121
[ "DrawContour", "draws", "the", "given", "closed", "contour", "at", "the", "given", "sub", "-", "pixel", "offset", "." ]
[ "func", "DrawContour", "(", "path", "draw2d", ".", "PathBuilder", ",", "ps", "[", "]", "truetype", ".", "<mask>", ",", "dx", ",", "dy", "float64", ")", "{", "if", "len", "(", "ps", ")", "==", "0", "{", "return", "\n", "}", "\n", "startX", ",", "startY", ":=", "pointToF64Point", "(", "ps", "[", "0", "]", ")", "\n", "path", ".", "MoveTo", "(", "startX", "+", "dx", ",", "startY", "+", "dy", ")", "\n", "q0X", ",", "q0Y", ",", "on0", ":=", "startX", ",", "startY", ",", "true", "\n", "for", "_", ",", "p", ":=", "range", "ps", "[", "1", ":", "]", "{", "qX", ",", "qY", ":=", "pointToF64Point", "(", "p", ")", "\n", "on", ":=", "p", ".", "Flags", "&", "0x01", "!=", "0", "\n", "if", "on", "{", "if", "on0", "{", "path", ".", "LineTo", "(", "qX", "+", "dx", ",", "qY", "+", "dy", ")", "\n", "}", "else", "{", "path", ".", "QuadCurveTo", "(", "q0X", "+", "dx", ",", "q0Y", "+", "dy", ",", "qX", "+", "dx", ",", "qY", "+", "dy", ")", "\n", "}", "\n", "}", "else", "{", "if", "on0", "{", "// No-op.", "}", "else", "{", "midX", ":=", "(", "q0X", "+", "qX", ")", "/", "2", "\n", "midY", ":=", "(", "q0Y", "+", "qY", ")", "/", "2", "\n", "path", ".", "QuadCurveTo", "(", "q0X", "+", "dx", ",", "q0Y", "+", "dy", ",", "midX", "+", "dx", ",", "midY", "+", "dy", ")", "\n", "}", "\n", "}", "\n", "q0X", ",", "q0Y", ",", "on0", "=", "qX", ",", "qY", ",", "on", "\n", "}", "\n", "// Close the curve.", "if", "on0", "{", "path", ".", "LineTo", "(", "startX", "+", "dx", ",", "startY", "+", "dy", ")", "\n", "}", "else", "{", "path", ".", "QuadCurveTo", "(", "q0X", "+", "dx", ",", "q0Y", "+", "dy", ",", "startX", "+", "dx", ",", "startY", "+", "dy", ")", "\n", "}", "\n", "}" ]
22,121
all-22122
[ "NotAfter", "is", "an", "Option", "for", "setting", "the", "identity", "s", "certificate", "s", "NotAfter", "." ]
[ "func", "NotAfter", "(", "<mask>", "time", ".", "Time", ")", "Option", "{", "return", "func", "(", "c", "*", "configuration", ")", "{", "c", ".", "notAfter", "=", "&", "value", "\n", "}", "\n", "}" ]
22,122
all-22123
[ "Spec", "loads", "a", "new", "spec", "document" ]
[ "func", "Spec", "(", "<mask>", "string", ")", "(", "*", "Document", ",", "error", ")", "{", "specURL", ",", "err", ":=", "url", ".", "Parse", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "var", "lastErr", "error", "\n", "for", "l", ":=", "loaders", ".", "Next", ";", "l", "!=", "nil", ";", "l", "=", "l", ".", "Next", "{", "if", "loaders", ".", "Match", "(", "specURL", ".", "Path", ")", "{", "b", ",", "err2", ":=", "loaders", ".", "Fn", "(", "path", ")", "\n", "if", "err2", "!=", "nil", "{", "lastErr", "=", "err2", "\n", "continue", "\n", "}", "\n", "doc", ",", "err3", ":=", "Analyzed", "(", "b", ",", "\"", "\"", ")", "\n", "if", "err3", "!=", "nil", "{", "return", "nil", ",", "err3", "\n", "}", "\n", "if", "doc", "!=", "nil", "{", "doc", ".", "specFilePath", "=", "path", "\n", "}", "\n", "return", "doc", ",", "nil", "\n", "}", "\n", "}", "\n", "if", "lastErr", "!=", "nil", "{", "return", "nil", ",", "lastErr", "\n", "}", "\n", "b", ",", "err", ":=", "defaultLoader", ".", "Fn", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "document", ",", "err", ":=", "Analyzed", "(", "b", ",", "\"", "\"", ")", "\n", "if", "document", "!=", "nil", "{", "document", ".", "specFilePath", "=", "path", "\n", "}", "\n\n", "return", "document", ",", "err", "\n", "}" ]
22,123
all-22124
[ "CompareAndSwap", "writes", "the", "given", "item", "that", "was", "previously", "returned", "by", "Get", "if", "the", "value", "was", "neither", "modified", "or", "evicted", "between", "the", "Get", "and", "the", "CompareAndSwap", "calls", ".", "The", "item", "s", "Key", "should", "not", "change", "between", "calls", "but", "all", "other", "item", "fields", "may", "differ", ".", "ErrCASConflict", "is", "returned", "if", "the", "value", "was", "modified", "in", "between", "the", "calls", ".", "ErrNotStored", "is", "returned", "if", "the", "value", "was", "evicted", "in", "between", "the", "calls", "." ]
[ "func", "CompareAndSwap", "(", "c", "<mask>", ".", "Context", ",", "item", "*", "Item", ")", "error", "{", "return", "singleError", "(", "set", "(", "c", ",", "[", "]", "*", "Item", "{", "item", "}", ",", "nil", ",", "pb", ".", "MemcacheSetRequest_CAS", ")", ")", "\n", "}" ]
22,124
all-22125
[ "Less", "returns", "true", "if", "this", "field", "value", "sorts", "before", "the", "given", "Record", "." ]
[ "func", "(", "v", "FieldValue", ")", "Less", "(", "<mask>", "Record", ")", "bool", "{", "if", "ov", ",", "ok", ":=", "other", ".", "(", "FieldValue", ")", ";", "ok", "{", "return", "v", ".", "ColumnID", "<", "ov", ".", "ColumnID", "\n", "}", "\n", "return", "false", "\n", "}" ]
22,125
all-22126
[ "Do", "executes", "DOM", ".", "copyTo", "against", "the", "provided", "context", ".", "returns", ":", "nodeID", "-", "Id", "of", "the", "node", "clone", "." ]
[ "func", "(", "p", "*", "CopyToParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "nodeID", "cdp", ".", "NodeID", ",", "err", "error", ")", "{", "// execute", "<mask>", "res", "CopyToReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandCopyTo", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "NodeID", ",", "nil", "\n", "}" ]
22,126
all-22127
[ "NewDiscovery", "returns", "a", "new", "Discovery", "which", "periodically", "refreshes", "its", "targets", "." ]
[ "func", "NewDiscovery", "(", "conf", "SDConfig", ",", "logger", "log", ".", "Logger", ")", "(", "*", "Discovery", ",", "error", ")", "{", "d", ":=", "&", "Discovery", "{", "project", ":", "conf", ".", "Project", ",", "zone", ":", "conf", ".", "Zone", ",", "filter", ":", "conf", ".", "Filter", ",", "port", ":", "conf", ".", "Port", ",", "tagSeparator", ":", "conf", ".", "TagSeparator", ",", "}", "\n", "var", "err", "error", "\n", "d", ".", "client", ",", "err", "=", "google", ".", "DefaultClient", "(", "context", ".", "Background", "(", ")", ",", "compute", ".", "ComputeReadonlyScope", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "d", ".", "svc", ",", "err", "=", "compute", ".", "NewService", "(", "context", ".", "Background", "(", ")", ",", "option", ".", "WithHTTPClient", "(", "d", ".", "<mask>", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "d", ".", "isvc", "=", "compute", ".", "NewInstancesService", "(", "d", ".", "svc", ")", "\n\n", "d", ".", "Discovery", "=", "refresh", ".", "NewDiscovery", "(", "logger", ",", "\"", "\"", ",", "time", ".", "Duration", "(", "conf", ".", "RefreshInterval", ")", ",", "d", ".", "refresh", ",", ")", "\n", "return", "d", ",", "nil", "\n", "}" ]
22,127
all-22128
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "ServerTemplate", ")", "Locator", "(", "api", "*", "API", ")", "*", "ServerTemplateLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "ServerTemplateLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
22,128
all-22129
[ "Columns", "splits", "each", "item", "into", "columns", "and", "yields", "the", "concatenation", "(", "separated", "by", "spaces", ")", "of", "the", "columns", "numbers", "passed", "as", "arguments", ".", "Columns", "are", "numbered", "starting", "at", "1", ".", "If", "a", "column", "number", "is", "bigger", "than", "the", "number", "of", "columns", "in", "an", "item", "it", "is", "skipped", "." ]
[ "func", "Columns", "(", "columns", "...", "int", ")", "Filter", "{", "return", "FilterFunc", "(", "func", "(", "arg", "Arg", ")", "error", "{", "for", "_", ",", "c", ":=", "range", "columns", "{", "if", "c", "<=", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "c", ")", "\n", "}", "\n", "}", "\n", "for", "s", ":=", "range", "arg", ".", "In", "{", "result", ":=", "\"", "\"", "\n", "for", "_", ",", "col", ":=", "range", "columns", "{", "if", "_", ",", "c", ":=", "column", "(", "s", ",", "<mask>", ")", ";", "c", "!=", "\"", "\"", "{", "if", "result", "!=", "\"", "\"", "{", "result", "=", "result", "+", "\"", "\"", "\n", "}", "\n", "result", "=", "result", "+", "c", "\n", "}", "\n", "}", "\n", "arg", ".", "Out", "<-", "result", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
22,129
all-22130
[ "DoTimeout", "performs", "the", "given", "request", "and", "waits", "for", "response", "during", "the", "given", "timeout", "duration", ".", "Request", "must", "contain", "at", "least", "non", "-", "zero", "RequestURI", "with", "full", "url", "(", "including", "scheme", "and", "host", ")", "or", "non", "-", "zero", "Host", "header", "+", "RequestURI", ".", "Client", "determines", "the", "server", "to", "be", "requested", "in", "the", "following", "order", ":", "-", "from", "RequestURI", "if", "it", "contains", "full", "url", "with", "scheme", "and", "host", ";", "-", "from", "Host", "header", "otherwise", ".", "The", "function", "doesn", "t", "follow", "redirects", ".", "Use", "Get", "*", "for", "following", "redirects", ".", "Response", "is", "ignored", "if", "resp", "is", "nil", ".", "ErrTimeout", "is", "returned", "if", "the", "response", "wasn", "t", "returned", "during", "the", "given", "timeout", ".", "ErrNoFreeConns", "is", "returned", "if", "all", "DefaultMaxConnsPerHost", "connections", "to", "the", "requested", "host", "are", "busy", ".", "It", "is", "recommended", "obtaining", "req", "and", "resp", "via", "AcquireRequest", "and", "AcquireResponse", "in", "performance", "-", "critical", "code", ".", "Warning", ":", "DoTimeout", "does", "not", "terminate", "the", "request", "itself", ".", "The", "request", "will", "continue", "in", "the", "background", "and", "the", "response", "will", "be", "discarded", ".", "If", "requests", "take", "too", "long", "and", "the", "connection", "pool", "gets", "filled", "up", "please", "try", "using", "a", "Client", "and", "setting", "a", "ReadTimeout", "." ]
[ "func", "DoTimeout", "(", "req", "*", "Request", ",", "resp", "*", "<mask>", ",", "timeout", "time", ".", "Duration", ")", "error", "{", "return", "defaultClient", ".", "DoTimeout", "(", "req", ",", "resp", ",", "timeout", ")", "\n", "}" ]
22,130
all-22131
[ "Start", "starts", "an", "host" ]
[ "func", "(", "d", "*", "Driver", ")", "Start", "(", ")", "error", "{", "if", "err", ":=", "cmd", "(", "\"", "\\\\", "\"", ",", "d", ".", "MachineName", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "<mask>", ",", "err", ":=", "d", ".", "waitForIP", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "d", ".", "IPAddress", "=", "ip", "\n\n", "return", "nil", "\n", "}" ]
22,131
all-22132
[ "Create", "a", "new", "Graphic", "context", "from", "an", "image" ]
[ "func", "NewStackGraphicContext", "(", ")", "*", "StackGraphicContext", "{", "gc", ":=", "&", "StackGraphicContext", "{", "}", "\n", "gc", ".", "Current", "=", "new", "(", "ContextStack", ")", "\n", "gc", ".", "Current", ".", "Tr", "=", "draw2d", ".", "NewIdentityMatrix", "(", ")", "\n", "gc", ".", "Current", ".", "<mask>", "=", "new", "(", "draw2d", ".", "Path", ")", "\n", "gc", ".", "Current", ".", "LineWidth", "=", "1.0", "\n", "gc", ".", "Current", ".", "StrokeColor", "=", "image", ".", "Black", "\n", "gc", ".", "Current", ".", "FillColor", "=", "image", ".", "White", "\n", "gc", ".", "Current", ".", "Cap", "=", "draw2d", ".", "RoundCap", "\n", "gc", ".", "Current", ".", "FillRule", "=", "draw2d", ".", "FillRuleEvenOdd", "\n", "gc", ".", "Current", ".", "Join", "=", "draw2d", ".", "RoundJoin", "\n", "gc", ".", "Current", ".", "FontSize", "=", "10", "\n", "gc", ".", "Current", ".", "FontData", "=", "DefaultFontData", "\n", "return", "gc", "\n", "}" ]
22,132
all-22133
[ "See", "bcd", ".", "Tracer", ".", "AddKV", "()", "." ]
[ "func", "(", "t", "*", "BTTracer", ")", "AddKV", "(", "<mask>", "[", "]", "string", ",", "key", ",", "val", "string", ")", "[", "]", "string", "{", "return", "options", "\n", "}" ]
22,133
all-22134
[ "TSDBCleanTombstones", "implements", "pb", ".", "AdminServer", "." ]
[ "func", "(", "s", "*", "Admin", ")", "TSDBCleanTombstones", "(", "_", "context", ".", "Context", ",", "_", "*", "pb", ".", "TSDBCleanTombstonesRequest", ")", "(", "*", "pb", ".", "TSDBCleanTombstonesResponse", ",", "error", ")", "{", "db", ":=", "s", ".", "db", "(", ")", "\n", "if", "<mask>", "==", "nil", "{", "return", "nil", ",", "errTSDBNotReady", "\n", "}", "\n\n", "if", "err", ":=", "db", ".", "CleanTombstones", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "status", ".", "Errorf", "(", "codes", ".", "Internal", ",", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "&", "pb", ".", "TSDBCleanTombstonesResponse", "{", "}", ",", "nil", "\n", "}" ]
22,134
all-22135
[ "Find", "the", "price", "in", "the", "given", "package", "with", "the", "specified", "size", "and", "iops" ]
[ "func", "FindPerformanceIOPSPrice", "(", "productPackage", "datatypes", ".", "Product_Package", ",", "size", "int", ",", "iops", "int", ")", "(", "datatypes", ".", "Product_Item_Price", ",", "error", ")", "{", "for", "_", ",", "item", ":=", "range", "productPackage", ".", "Items", "{", "if", "int", "(", "*", "item", ".", "Capacity", ")", "!=", "int", "(", "iops", ")", "{", "continue", "\n", "}", "\n", "for", "_", ",", "price", ":=", "range", "item", ".", "Prices", "{", "// Only collect prices from valid location groups.", "if", "price", ".", "LocationGroupId", "!=", "nil", "{", "continue", "\n", "}", "\n", "if", "!", "hasCategory", "(", "price", ".", "Categories", ",", "\"", "\"", ")", "{", "<mask>", "\n", "}", "\n", "min", ",", "err", ":=", "strconv", ".", "Atoi", "(", "*", "price", ".", "CapacityRestrictionMinimum", ")", "\n", "if", "err", "!=", "nil", "{", "return", "datatypes", ".", "Product_Item_Price", "{", "}", ",", "bosherr", ".", "Errorf", "(", "\"", "\"", ",", "iops", ")", "\n", "}", "\n", "if", "size", "<", "int", "(", "min", ")", "{", "continue", "\n", "}", "\n", "max", ",", "err", ":=", "strconv", ".", "Atoi", "(", "*", "price", ".", "CapacityRestrictionMaximum", ")", "\n", "if", "err", "!=", "nil", "{", "return", "datatypes", ".", "Product_Item_Price", "{", "}", ",", "bosherr", ".", "Errorf", "(", "\"", "\"", ",", "iops", ")", "\n", "}", "\n", "if", "size", ">", "int", "(", "max", ")", "{", "continue", "\n", "}", "\n", "return", "price", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "datatypes", ".", "Product_Item_Price", "{", "}", ",", "bosherr", ".", "Errorf", "(", "\"", "\"", ",", "iops", ")", "\n", "}" ]
22,135
all-22136
[ "PutFileWriter", "writes", "a", "file", "to", "PFS", ".", "NOTE", ":", "PutFileWriter", "returns", "an", "io", ".", "WriteCloser", "you", "must", "call", "Close", "on", "it", "when", "you", "are", "done", "writing", "." ]
[ "func", "(", "c", "*", "putFileClient", ")", "PutFileWriter", "(", "repoName", ",", "commitID", ",", "<mask>", "string", ")", "(", "io", ".", "WriteCloser", ",", "error", ")", "{", "return", "c", ".", "newPutFileWriteCloser", "(", "repoName", ",", "commitID", ",", "path", ",", "pfs", ".", "Delimiter_NONE", ",", "0", ",", "0", ",", "0", ",", "nil", ")", "\n", "}" ]
22,136
all-22137
[ "/", "*", "RespondWith", "returns", "a", "handler", "that", "responds", "to", "a", "request", "with", "the", "specified", "status", "code", "and", "body" ]
[ "func", "RespondWith", "(", "statusCode", "int", ",", "body", "interface", "{", "}", ",", "optionalHeader", "...", "<mask>", ".", "Header", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "if", "len", "(", "optionalHeader", ")", "==", "1", "{", "copyHeader", "(", "optionalHeader", "[", "0", "]", ",", "w", ".", "Header", "(", ")", ")", "\n", "}", "\n", "w", ".", "WriteHeader", "(", "statusCode", ")", "\n", "switch", "x", ":=", "body", ".", "(", "type", ")", "{", "case", "string", ":", "w", ".", "Write", "(", "[", "]", "byte", "(", "x", ")", ")", "\n", "case", "[", "]", "byte", ":", "w", ".", "Write", "(", "x", ")", "\n", "default", ":", "Expect", "(", "body", ")", ".", "Should", "(", "BeNil", "(", ")", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}" ]
22,137
all-22138
[ "GetStoragePoolVolumeSnapshots", "returns", "a", "list", "of", "snapshots", "for", "the", "storage", "volume" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetStoragePoolVolumeSnapshots", "(", "pool", "string", ",", "volumeType", "string", ",", "volumeName", "string", ")", "(", "[", "]", "api", ".", "StorageVolumeSnapshot", ",", "error", ")", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "snapshots", ":=", "[", "]", "api", ".", "StorageVolumeSnapshot", "{", "}", "\n\n", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "pool", ")", ",", "url", ".", "QueryEscape", "(", "volumeType", ")", ",", "url", ".", "QueryEscape", "(", "volumeName", ")", ")", "\n", "_", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "<mask>", ",", "nil", ",", "\"", "\"", ",", "&", "snapshots", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "snapshots", ",", "nil", "\n", "}" ]
22,138
all-22139
[ "SetWithPath", "sets", "a", "cookie", "path", "on", "the", "server", "in", "which", "the", "cookie", "will", "be", "available", "on", ".", "If", "set", "to", "/", "the", "cookie", "will", "be", "available", "within", "the", "entire", "domain", ".", "If", "set", "to", "/", "foo", "/", "the", "cookie", "will", "only", "be", "available", "within", "the", "/", "foo", "/", "directory", "and", "all", "sub", "-", "directories", "such", "as", "/", "foo", "/", "bar", "/", "of", "domain", "." ]
[ "func", "(", "c", "*", "Cookies", ")", "SetWithPath", "(", "name", ",", "value", ",", "path", "string", ")", "{", "ck", ":=", "<mask>", ".", "Cookie", "{", "Name", ":", "name", ",", "Value", ":", "value", ",", "Path", ":", "path", ",", "}", "\n\n", "http", ".", "SetCookie", "(", "c", ".", "res", ",", "&", "ck", ")", "\n", "}" ]
22,139
all-22140
[ "query", "the", "fragment", "color", "index", "of", "a", "named", "variable", "within", "a", "program" ]
[ "func", "GetProgramResourceLocationIndex", "(", "program", "uint32", ",", "programInterface", "uint32", ",", "name", "*", "uint8", ")", "int32", "{", "ret", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpGetProgramResourceLocationIndex", ",", "3", ",", "uintptr", "(", "program", ")", ",", "uintptr", "(", "programInterface", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ")", "\n", "return", "(", "int32", ")", "(", "<mask>", ")", "\n", "}" ]
22,140
all-22141
[ "Initiate", "a", "new", "Call", "." ]
[ "func", "(", "c", "*", "CallService", ")", "Create", "(", "ctx", "<mask>", ".", "Context", ",", "data", "url", ".", "Values", ")", "(", "*", "Call", ",", "error", ")", "{", "call", ":=", "new", "(", "Call", ")", "\n", "err", ":=", "c", ".", "client", ".", "CreateResource", "(", "ctx", ",", "callsPathPart", ",", "data", ",", "call", ")", "\n", "return", "call", ",", "err", "\n", "}" ]
22,141
all-22142
[ "NewOperationBody", "creates", "a", "new", "OperationBody", "." ]
[ "func", "NewOperationBody", "(", "aType", "OperationType", ",", "value", "interface", "{", "}", ")", "(", "result", "OperationBody", ",", "err", "error", ")", "{", "result", ".", "Type", "=", "aType", "\n", "switch", "OperationType", "(", "aType", ")", "{", "case", "OperationTypeCreateAccount", ":", "tv", ",", "ok", ":=", "value", ".", "(", "CreateAccountOp", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "CreateAccountOp", "=", "&", "tv", "\n", "case", "OperationTypePayment", ":", "tv", ",", "ok", ":=", "value", ".", "(", "PaymentOp", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "PaymentOp", "=", "&", "tv", "\n", "case", "OperationTypePathPayment", ":", "tv", ",", "ok", ":=", "value", ".", "(", "PathPaymentOp", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "PathPaymentOp", "=", "&", "tv", "\n", "case", "OperationTypeManageOffer", ":", "tv", ",", "ok", ":=", "value", ".", "(", "ManageOfferOp", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "ManageOfferOp", "=", "&", "tv", "\n", "case", "OperationTypeCreatePassiveOffer", ":", "tv", ",", "ok", ":=", "value", ".", "(", "CreatePassiveOfferOp", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "CreatePassiveOfferOp", "=", "&", "tv", "\n", "case", "OperationTypeSetOptions", ":", "tv", ",", "ok", ":=", "value", ".", "(", "SetOptionsOp", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "SetOptionsOp", "=", "&", "tv", "\n", "case", "OperationTypeChangeTrust", ":", "tv", ",", "ok", ":=", "value", ".", "(", "ChangeTrustOp", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "ChangeTrustOp", "=", "&", "tv", "\n", "case", "OperationTypeAllowTrust", ":", "tv", ",", "ok", ":=", "<mask>", ".", "(", "AllowTrustOp", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "AllowTrustOp", "=", "&", "tv", "\n", "case", "OperationTypeAccountMerge", ":", "tv", ",", "ok", ":=", "value", ".", "(", "AccountId", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "Destination", "=", "&", "tv", "\n", "case", "OperationTypeInflation", ":", "// void", "case", "OperationTypeManageData", ":", "tv", ",", "ok", ":=", "value", ".", "(", "ManageDataOp", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "ManageDataOp", "=", "&", "tv", "\n", "}", "\n", "return", "\n", "}" ]
22,142
all-22143
[ "UnmarshalYAML", "implements", "the", "yaml", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "c", "*", "Role", ")", "UnmarshalYAML", "(", "unmarshal", "func", "(", "interface", "{", "}", ")", "error", ")", "error", "{", "if", "err", ":=", "unmarshal", "(", "(", "*", "string", ")", "(", "c", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "switch", "*", "c", "{", "case", "OpenStackRoleHypervisor", ",", "OpenStackRoleInstance", ":", "return", "nil", "\n", "<mask>", ":", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "*", "c", ")", "\n", "}", "\n", "}" ]
22,143
all-22144
[ "WithPathFilter", "if", "present", "only", "return", "the", "entries", "containing", "this", "substring", "in", "the", "path", "." ]
[ "func", "(", "p", "RequestEntriesParams", ")", "WithPathFilter", "(", "pathFilter", "<mask>", ")", "*", "RequestEntriesParams", "{", "p", ".", "PathFilter", "=", "pathFilter", "\n", "return", "&", "p", "\n", "}" ]
22,144
all-22145
[ "Decode", "decodes", "MP3", "source", "and", "returns", "a", "decoded", "stream", ".", "Decode", "returns", "error", "when", "decoding", "fails", "or", "IO", "error", "happens", ".", "Decode", "automatically", "resamples", "the", "stream", "to", "fit", "with", "the", "audio", "context", "if", "necessary", ".", "Decode", "takes", "the", "ownership", "of", "src", "and", "Stream", "s", "Close", "function", "closes", "src", "." ]
[ "func", "Decode", "(", "<mask>", "*", "audio", ".", "Context", ",", "src", "audio", ".", "ReadSeekCloser", ")", "(", "*", "Stream", ",", "error", ")", "{", "d", ",", "err", ":=", "mp3", ".", "NewDecoder", "(", "src", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "r", "*", "convert", ".", "Resampling", "\n", "if", "d", ".", "SampleRate", "(", ")", "!=", "context", ".", "SampleRate", "(", ")", "{", "r", "=", "convert", ".", "NewResampling", "(", "d", ",", "d", ".", "Length", "(", ")", ",", "d", ".", "SampleRate", "(", ")", ",", "context", ".", "SampleRate", "(", ")", ")", "\n", "}", "\n", "s", ":=", "&", "Stream", "{", "orig", ":", "d", ",", "resampling", ":", "r", ",", "toClose", ":", "src", ",", "}", "\n", "runtime", ".", "SetFinalizer", "(", "s", ",", "(", "*", "Stream", ")", ".", "Close", ")", "\n", "return", "s", ",", "nil", "\n", "}" ]
22,145
all-22146
[ "stringUnsafe", "returns", "a", "string", "representation", "of", "the", "ENI", "Attachment" ]
[ "func", "(", "eni", "*", "ENIAttachment", ")", "stringUnsafe", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "eni", ".", "TaskARN", ",", "eni", ".", "AttachmentARN", ",", "eni", ".", "AttachStatusSent", ",", "eni", ".", "MACAddress", ",", "eni", ".", "<mask>", ".", "String", "(", ")", ",", "eni", ".", "ExpiresAt", ".", "String", "(", ")", ")", "\n", "}" ]
22,146
all-22147
[ "GetNotifyNoDataOk", "returns", "a", "tuple", "with", "the", "NotifyNoData", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "o", "*", "Options", ")", "GetNotifyNoDataOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "o", "==", "nil", "||", "o", ".", "NotifyNoData", "==", "nil", "{", "return", "false", ",", "<mask>", "\n", "}", "\n", "return", "*", "o", ".", "NotifyNoData", ",", "true", "\n", "}" ]
22,147
all-22148
[ "Printf", "logging" ]
[ "func", "(", "l", "*", "MyLogger", ")", "Printf", "(", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "<mask>", ".", "Printf", "(", "msg", ",", "args", "...", ")", "\n", "}" ]
22,148
all-22149
[ "SetRowAttrs", "creates", "a", "SetRowAttrs", "query", ".", "SetRowAttrs", "associates", "arbitrary", "key", "/", "value", "pairs", "with", "a", "row", "in", "a", "field", ".", "Following", "types", "are", "accepted", ":", "integer", "float", "string", "and", "boolean", "types", "." ]
[ "func", "(", "f", "*", "Field", ")", "SetRowAttrs", "(", "rowIDOrKey", "interface", "{", "}", ",", "attrs", "map", "[", "string", "]", "interface", "{", "}", ")", "*", "PQLBaseQuery", "{", "rowStr", ",", "err", ":=", "formatIDKeyBool", "(", "rowIDOrKey", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NewPQLBaseQuery", "(", "\"", "\"", ",", "f", ".", "index", ",", "err", ")", "\n", "}", "\n", "attrsString", ",", "err", ":=", "createAttributesString", "(", "attrs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NewPQLBaseQuery", "(", "\"", "\"", ",", "f", ".", "index", ",", "err", ")", "\n", "}", "\n", "text", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f", ".", "name", ",", "rowStr", ",", "attrsString", ")", "\n", "q", ":=", "NewPQLBaseQuery", "(", "text", ",", "f", ".", "index", ",", "nil", ")", "\n", "q", ".", "hasKeys", "=", "f", ".", "options", ".", "keys", "||", "f", ".", "index", ".", "options", ".", "<mask>", "\n", "return", "q", "\n", "}" ]
22,149
all-22150
[ "forStmt", "emits", "to", "fn", "code", "for", "the", "for", "statement", "s", "optionally", "labelled", "by", "label", "." ]
[ "func", "(", "b", "*", "builder", ")", "forStmt", "(", "fn", "*", "Function", ",", "s", "*", "ast", ".", "ForStmt", ",", "label", "*", "lblock", ")", "{", "//\t...init...", "// jump loop", "// loop:", "// if cond goto body else done", "// body:", "// ...body...", "// jump post", "// post:\t\t\t\t (target of continue)", "// ...post...", "// jump loop", "// done: (target of break)", "if", "s", ".", "Init", "!=", "nil", "{", "b", ".", "stmt", "(", "fn", ",", "s", ".", "Init", ")", "\n", "}", "\n", "body", ":=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n", "done", ":=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "// target of 'break'", "\n", "loop", ":=", "body", "// target of back-edge", "\n", "if", "s", ".", "Cond", "!=", "nil", "{", "loop", "=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n", "}", "\n", "cont", ":=", "loop", "// target of 'continue'", "\n", "if", "s", ".", "Post", "!=", "nil", "{", "cont", "=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "label", "!=", "nil", "{", "label", ".", "_break", "=", "done", "\n", "label", ".", "_continue", "=", "cont", "\n", "}", "\n", "emitJump", "(", "fn", ",", "loop", ")", "\n", "fn", ".", "currentBlock", "=", "loop", "\n", "if", "loop", "!=", "body", "{", "b", ".", "cond", "(", "fn", ",", "s", ".", "Cond", ",", "body", ",", "done", ")", "\n", "fn", ".", "currentBlock", "=", "body", "\n", "}", "\n", "fn", ".", "targets", "=", "&", "targets", "{", "tail", ":", "fn", ".", "targets", ",", "_break", ":", "done", ",", "_continue", ":", "cont", ",", "}", "\n", "b", ".", "stmt", "(", "fn", ",", "s", ".", "<mask>", ")", "\n", "fn", ".", "targets", "=", "fn", ".", "targets", ".", "tail", "\n", "emitJump", "(", "fn", ",", "cont", ")", "\n\n", "if", "s", ".", "Post", "!=", "nil", "{", "fn", ".", "currentBlock", "=", "cont", "\n", "b", ".", "stmt", "(", "fn", ",", "s", ".", "Post", ")", "\n", "emitJump", "(", "fn", ",", "loop", ")", "// back-edge", "\n", "}", "\n", "fn", ".", "currentBlock", "=", "done", "\n", "}" ]
22,150
all-22151
[ "LookupUser", "looks", "up", "an", "user", "by", "name", "." ]
[ "func", "LookupUser", "(", "name", "string", ")", "(", "*", "<mask>", ",", "error", ")", "{", "entries", ",", "err", ":=", "LookupInUser", "(", "U_NAME", ",", "name", ",", "1", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "entries", "[", "0", "]", ",", "err", "\n", "}" ]
22,151
all-22152
[ "ClientConfig", "generates", "a", "tls", ".", "Config", "object", "for", "use", "by", "an", "HTTP", "client", "." ]
[ "func", "(", "info", "TLSInfo", ")", "ClientConfig", "(", ")", "(", "*", "tls", ".", "Config", ",", "error", ")", "{", "var", "cfg", "*", "tls", ".", "Config", "\n", "var", "err", "error", "\n\n", "if", "!", "info", ".", "Empty", "(", ")", "{", "cfg", ",", "err", "=", "info", ".", "baseConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "else", "{", "cfg", "=", "&", "tls", ".", "Config", "{", "ServerName", ":", "info", ".", "ServerName", "}", "\n", "}", "\n", "cfg", ".", "InsecureSkipVerify", "=", "info", ".", "InsecureSkipVerify", "\n\n", "cs", ":=", "info", ".", "cafiles", "(", ")", "\n", "if", "len", "(", "cs", ")", ">", "0", "{", "cfg", ".", "RootCAs", ",", "err", "=", "tlsutil", ".", "NewCertPool", "(", "cs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "if", "info", ".", "selfCert", "{", "cfg", ".", "InsecureSkipVerify", "=", "true", "\n", "}", "\n\n", "if", "info", ".", "EmptyCN", "{", "hasNonEmptyCN", ":=", "false", "\n", "cn", ":=", "\"", "\"", "\n", "tlsutil", ".", "NewCert", "(", "info", ".", "CertFile", ",", "info", ".", "KeyFile", ",", "func", "(", "certPEMBlock", "[", "]", "byte", ",", "keyPEMBlock", "[", "]", "byte", ")", "(", "tls", ".", "Certificate", ",", "error", ")", "{", "var", "block", "*", "pem", ".", "Block", "\n", "<mask>", ",", "_", "=", "pem", ".", "Decode", "(", "certPEMBlock", ")", "\n", "cert", ",", "err", ":=", "x509", ".", "ParseCertificate", "(", "block", ".", "Bytes", ")", "\n", "if", "err", "!=", "nil", "{", "return", "tls", ".", "Certificate", "{", "}", ",", "err", "\n", "}", "\n", "if", "len", "(", "cert", ".", "Subject", ".", "CommonName", ")", "!=", "0", "{", "hasNonEmptyCN", "=", "true", "\n", "cn", "=", "cert", ".", "Subject", ".", "CommonName", "\n", "}", "\n", "return", "tls", ".", "X509KeyPair", "(", "certPEMBlock", ",", "keyPEMBlock", ")", "\n", "}", ")", "\n", "if", "hasNonEmptyCN", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "cn", ")", "\n", "}", "\n", "}", "\n\n", "return", "cfg", ",", "nil", "\n", "}" ]
22,152
all-22153
[ "Returns", "the", "items", "in", "the", "cache", ".", "This", "may", "include", "items", "that", "have", "expired", "but", "have", "not", "yet", "been", "cleaned", "up", ".", "If", "this", "is", "significant", "the", "Expiration", "fields", "of", "the", "items", "should", "be", "checked", ".", "Note", "that", "explicit", "synchronization", "is", "needed", "to", "use", "a", "cache", "and", "its", "corresponding", "Items", "()", "return", "values", "at", "the", "same", "time", "as", "the", "maps", "are", "shared", "." ]
[ "func", "(", "sc", "*", "shardedCache", ")", "Items", "(", ")", "[", "]", "map", "[", "string", "]", "Item", "{", "res", ":=", "make", "(", "[", "]", "<mask>", "[", "string", "]", "Item", ",", "len", "(", "sc", ".", "cs", ")", ")", "\n", "for", "i", ",", "v", ":=", "range", "sc", ".", "cs", "{", "res", "[", "i", "]", "=", "v", ".", "Items", "(", ")", "\n", "}", "\n", "return", "res", "\n", "}" ]
22,153
all-22154
[ "from", "the", "standard", "library", "description", "of", "Bytes", "()", ":", "Bytes", "()", "returns", "a", "slice", "of", "the", "contents", "of", "the", "unread", "portion", "of", "the", "buffer", ".", "If", "the", "caller", "changes", "the", "contents", "of", "the", "returned", "slice", "the", "contents", "of", "the", "buffer", "will", "change", "provided", "there", "are", "no", "intervening", "method", "calls", "on", "the", "Buffer", ".", "The", "largest", "slice", "Bytes", "ever", "returns", "is", "bounded", "above", "by", "the", "maxViewInBytes", "value", "used", "when", "calling", "NewFixedSizeRingBuf", "()", "." ]
[ "func", "(", "b", "*", "FixedSizeRingBuf", ")", "Bytes", "(", ")", "[", "]", "byte", "{", "extent", ":=", "b", ".", "Beg", "+", "b", ".", "Readable", "\n", "if", "extent", "<=", "b", ".", "N", "{", "// we fit contiguously in this buffer without wrapping to the other", "return", "b", ".", "A", "[", "b", ".", "Use", "]", "[", "b", ".", "Beg", ":", "(", "b", ".", "Beg", "+", "b", ".", "Readable", ")", "]", "\n", "}", "\n\n", "// wrap into the other buffer", "src", ":=", "b", ".", "Use", "\n", "dest", ":=", "1", "-", "b", ".", "Use", "\n\n", "n", ":=", "copy", "(", "b", ".", "A", "[", "dest", "]", ",", "b", ".", "A", "[", "src", "]", "[", "b", ".", "Beg", ":", "]", ")", "\n", "n", "+=", "copy", "(", "b", ".", "A", "[", "<mask>", "]", "[", "n", ":", "]", ",", "b", ".", "A", "[", "src", "]", "[", "0", ":", "(", "extent", "%", "b", ".", "N", ")", "]", ")", "\n\n", "b", ".", "Use", "=", "dest", "\n", "b", ".", "Beg", "=", "0", "\n\n", "return", "b", ".", "A", "[", "b", ".", "Use", "]", "[", ":", "n", "]", "\n", "}" ]
22,154
all-22155
[ "HasWidth", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TileDefRequestStyle", ")", "HasWidth", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "Width", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
22,155
all-22156
[ "startInstance", "starts", "the", "instance", "." ]
[ "func", "(", "c", "*", "ComputeUtil", ")", "startInstance", "(", ")", "error", "{", "op", ",", "err", ":=", "c", ".", "service", ".", "Instances", ".", "Start", "(", "c", ".", "<mask>", ",", "c", ".", "zone", ",", "c", ".", "instanceName", ")", ".", "Do", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "c", ".", "waitForRegionalOp", "(", "op", ".", "Name", ")", "\n", "}" ]
22,156
all-22157
[ "NewConfig", "creates", "a", "new", "clientv3", ".", "Config", "from", "a", "yaml", "file", "." ]
[ "func", "NewConfig", "(", "fpath", "string", ")", "(", "*", "clientv3", ".", "Config", ",", "error", ")", "{", "b", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "fpath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "yc", ":=", "&", "yamlConfig", "{", "}", "\n\n", "err", "=", "yaml", ".", "Unmarshal", "(", "b", ",", "yc", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "yc", ".", "InsecureTransport", "{", "return", "&", "yc", ".", "Config", ",", "nil", "\n", "}", "\n\n", "var", "(", "cert", "*", "tls", ".", "Certificate", "\n", "cp", "*", "x509", ".", "CertPool", "\n", ")", "\n\n", "if", "yc", ".", "Certfile", "!=", "\"", "\"", "&&", "yc", ".", "Keyfile", "!=", "\"", "\"", "{", "<mask>", ",", "err", "=", "tlsutil", ".", "NewCert", "(", "yc", ".", "Certfile", ",", "yc", ".", "Keyfile", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "if", "yc", ".", "TrustedCAfile", "!=", "\"", "\"", "{", "cp", ",", "err", "=", "tlsutil", ".", "NewCertPool", "(", "[", "]", "string", "{", "yc", ".", "TrustedCAfile", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "tlscfg", ":=", "&", "tls", ".", "Config", "{", "MinVersion", ":", "tls", ".", "VersionTLS12", ",", "InsecureSkipVerify", ":", "yc", ".", "InsecureSkipTLSVerify", ",", "RootCAs", ":", "cp", ",", "}", "\n", "if", "cert", "!=", "nil", "{", "tlscfg", ".", "Certificates", "=", "[", "]", "tls", ".", "Certificate", "{", "*", "cert", "}", "\n", "}", "\n", "yc", ".", "Config", ".", "TLS", "=", "tlscfg", "\n\n", "return", "&", "yc", ".", "Config", ",", "nil", "\n", "}" ]
22,157
all-22158
[ "NewArchive", "uses", "7z", "to", "extract", "a", "list", "of", "files", "in", ".", "7z", "archive" ]
[ "func", "newArchive", "(", "<mask>", "string", ",", "password", "*", "string", ")", "(", "*", "Archive", ",", "error", ")", "{", "err", ":=", "detect7zCached", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "cmd", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "path", ")", "\n", "out", ",", "err", ":=", "cmd", ".", "CombinedOutput", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "entries", ",", "err", ":=", "parse7zListOutput", "(", "out", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "Archive", "{", "Path", ":", "path", ",", "Entries", ":", "entries", ",", "password", ":", "password", ",", "}", ",", "nil", "\n", "}" ]
22,158
all-22159
[ "Find", "the", "StructType", "node", "for", "the", "structure", "with", "the", "given", "name" ]
[ "func", "findStruct", "(", "scope", "*", "ast", ".", "Scope", ",", "name", "string", ")", "*", "ast", ".", "StructType", "{", "obj", ":=", "scope", ".", "Lookup", "(", "name", ")", "\n", "if", "obj", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "typ", ",", "ok", ":=", "obj", ".", "Decl", ".", "(", "*", "ast", ".", "TypeSpec", ")", "\n", "if", "!", "<mask>", "{", "return", "nil", "\n", "}", "\n\n", "str", ",", "ok", ":=", "typ", ".", "Type", ".", "(", "*", "ast", ".", "StructType", ")", "\n", "if", "!", "ok", "{", "return", "nil", "\n", "}", "\n\n", "return", "str", "\n", "}" ]
22,159
all-22160
[ "WrapWithHeaders", "returns", "a", "Context", "that", "can", "be", "used", "to", "make", "a", "call", "with", "request", "headers", ".", "If", "the", "parent", "ctx", "is", "already", "an", "instance", "of", "ContextWithHeaders", "its", "existing", "headers", "will", "be", "ignored", ".", "In", "order", "to", "merge", "new", "headers", "with", "parent", "headers", "use", "ContextBuilder", "." ]
[ "func", "WrapWithHeaders", "(", "ctx", "context", ".", "Context", ",", "<mask>", "map", "[", "string", "]", "string", ")", "ContextWithHeaders", "{", "h", ":=", "&", "headersContainer", "{", "reqHeaders", ":", "headers", ",", "}", "\n", "newCtx", ":=", "context", ".", "WithValue", "(", "ctx", ",", "contextKeyHeaders", ",", "h", ")", "\n", "return", "headerCtx", "{", "Context", ":", "newCtx", "}", "\n", "}" ]
22,160
all-22161
[ "JavaScript", "renders", "the", "named", "files", "using", "the", "application", "/", "javascript", "content", "type", "and", "the", "github", ".", "com", "/", "gobuffalo", "/", "plush", "package", "for", "templating", ".", "If", "more", "than", "1", "file", "is", "provided", "the", "second", "file", "will", "be", "considered", "a", "layout", "file", "and", "the", "first", "file", "will", "be", "the", "content", "file", "which", "will", "be", "placed", "into", "the", "layout", "using", "<%", "=", "yield", "%", ">", "." ]
[ "func", "JavaScript", "(", "<mask>", "...", "string", ")", "Renderer", "{", "e", ":=", "New", "(", "Options", "{", "}", ")", "\n", "return", "e", ".", "JavaScript", "(", "names", "...", ")", "\n", "}" ]
22,161
all-22162
[ "SetStartedAt", "sets", "the", "timestamp", "for", "container", "s", "start", "time" ]
[ "func", "(", "c", "*", "Container", ")", "SetStartedAt", "(", "startedAt", "time", ".", "Time", ")", "{", "if", "startedAt", ".", "IsZero", "(", ")", "{", "return", "\n", "}", "\n\n", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "<mask>", ".", "Unlock", "(", ")", "\n\n", "c", ".", "startedAt", "=", "startedAt", "\n", "}" ]
22,162
all-22163
[ "TimeFromPtr", "creates", "a", "new", "Time", "that", "will", "be", "null", "if", "t", "is", "nil", "or", "*", "t", "is", "the", "zero", "value", "." ]
[ "func", "TimeFromPtr", "(", "t", "*", "<mask>", ".", "Time", ")", "Time", "{", "if", "t", "==", "nil", "{", "return", "NewTime", "(", "time", ".", "Time", "{", "}", ",", "false", ")", "\n", "}", "\n", "return", "TimeFrom", "(", "*", "t", ")", "\n", "}" ]
22,163
all-22164
[ "DeleteMulti", "deletes", "multiple", "blobs", "." ]
[ "func", "DeleteMulti", "(", "c", "<mask>", ".", "Context", ",", "blobKey", "[", "]", "appengine", ".", "BlobKey", ")", "error", "{", "s", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "blobKey", ")", ")", "\n", "for", "i", ",", "b", ":=", "range", "blobKey", "{", "s", "[", "i", "]", "=", "string", "(", "b", ")", "\n", "}", "\n", "req", ":=", "&", "blobpb", ".", "DeleteBlobRequest", "{", "BlobKey", ":", "s", ",", "}", "\n", "res", ":=", "&", "basepb", ".", "VoidProto", "{", "}", "\n", "if", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
22,164
all-22165
[ "Repaint", "draws", "the", "control", "on", "its", "View", "surface" ]
[ "func", "(", "l", "*", "TextDisplay", ")", "Draw", "(", ")", "{", "if", "l", ".", "<mask>", "{", "return", "\n", "}", "\n\n", "PushAttributes", "(", ")", "\n", "defer", "PopAttributes", "(", ")", "\n\n", "x", ",", "y", ":=", "l", ".", "Pos", "(", ")", "\n", "w", ",", "h", ":=", "l", ".", "Size", "(", ")", "\n\n", "bg", ",", "fg", ":=", "RealColor", "(", "l", ".", "bg", ",", "l", ".", "Style", "(", ")", ",", "ColorEditBack", ")", ",", "RealColor", "(", "l", ".", "fg", ",", "l", ".", "Style", "(", ")", ",", "ColorEditText", ")", "\n", "if", "l", ".", "Active", "(", ")", "{", "bg", ",", "fg", "=", "RealColor", "(", "l", ".", "bg", ",", "l", ".", "Style", "(", ")", ",", "ColorEditActiveBack", ")", ",", "RealColor", "(", "l", ".", "fg", ",", "l", ".", "Style", "(", ")", ",", "ColorEditActiveText", ")", "\n", "}", "\n\n", "SetTextColor", "(", "fg", ")", "\n", "SetBackColor", "(", "bg", ")", "\n", "FillRect", "(", "x", ",", "y", ",", "w", ",", "h", ",", "' '", ")", "\n", "l", ".", "drawText", "(", ")", "\n", "}" ]
22,165
all-22166
[ "Exec", "implements", "the", "database", "/", "sql", "/", "driver", "/", "Execer", "interface", ".", "delete", "after", "go", "1", ".", "9", "compatibility", "is", "given", "up", "." ]
[ "func", "(", "c", "*", "conn", ")", "Exec", "(", "<mask>", "string", ",", "args", "[", "]", "driver", ".", "Value", ")", "(", "driver", ".", "Result", ",", "error", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}" ]
22,166
all-22167
[ "Do", "executes", "Emulation", ".", "setScrollbarsHidden", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetScrollbarsHiddenParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetScrollbarsHidden", ",", "p", ",", "nil", ")", "\n", "}" ]
22,167
all-22168
[ "runCmdBackground", "is", "a", "helper", "function", "to", "run", "commands", "in", "the", "background", ".", "It", "returns", "the", "resulting", "process", "and", "an", "error", "that", "occurs", "during", "while", "starting", "the", "process", "(", "if", "any", ")", "." ]
[ "func", "runCmdBackground", "(", "command", "string", ",", "args", "[", "]", "string", ",", "dir", "string", ")", "(", "*", "<mask>", ".", "Process", ",", "error", ")", "{", "cmd", ":=", "gos", ".", "Command", "(", "command", ",", "args", "...", ")", "\n", "cmd", ".", "Dir", "(", "dir", ")", "\n", "cmd", ".", "Stdout", "(", "os", ".", "Stderr", ")", "\n", "cmd", ".", "Stderr", "(", "os", ".", "Stderr", ")", "\n", "err", ":=", "cmd", ".", "Start", "(", ")", "\n", "return", "cmd", ".", "Process", "(", ")", ",", "err", "\n", "}" ]
22,168
all-22169
[ "processNextItem", "retrieves", "each", "queued", "item", "and", "takes", "the", "necessary", "handler", "action", "based", "off", "of", "if", "the", "item", "was", "created", "or", "deleted", "." ]
[ "func", "(", "c", "*", "Controller", ")", "processNextItem", "(", ")", "bool", "{", "key", ",", "quit", ":=", "c", ".", "queue", ".", "Get", "(", ")", "\n", "if", "quit", "{", "return", "false", "\n", "}", "\n\n", "defer", "c", ".", "queue", ".", "Done", "(", "key", ")", "\n\n", "// assert the string out of the key (format `namespace/name`)", "keyRaw", ":=", "<mask>", ".", "(", "string", ")", "\n", "namespace", ",", "name", ",", "err", ":=", "cache", ".", "SplitMetaNamespaceKey", "(", "keyRaw", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "WithField", "(", "\"", "\"", ",", "keyRaw", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "c", ".", "queue", ".", "Forget", "(", "key", ")", "\n", "return", "true", "\n", "}", "\n\n", "// take the string key and get the object out of the indexer", "//", "// item will contain the complex object for the resource and", "// exists is a bool that'll indicate whether or not the", "// resource was created (true) or deleted (false)", "//", "// if there is an error in getting the key from the index", "// then we want to retry this particular queue key a certain", "// number of times (5 here) before we forget the queue key", "// and throw an error", "pj", ",", "err", ":=", "c", ".", "informer", ".", "Lister", "(", ")", ".", "ProwJobs", "(", "namespace", ")", ".", "Get", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "if", "errors", ".", "IsNotFound", "(", "err", ")", "{", "logrus", ".", "WithField", "(", "\"", "\"", ",", "keyRaw", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "c", ".", "queue", ".", "Forget", "(", "key", ")", "\n", "return", "true", "\n", "}", "\n\n", "return", "c", ".", "retry", "(", "key", ",", "err", ")", "\n", "}", "\n\n", "// not belong to the current reporter", "if", "!", "c", ".", "reporter", ".", "ShouldReport", "(", "pj", ")", "{", "c", ".", "queue", ".", "Forget", "(", "key", ")", "\n", "return", "true", "\n", "}", "\n\n", "// we set omitempty on PrevReportStates, so here we need to init it if is nil", "if", "pj", ".", "Status", ".", "PrevReportStates", "==", "nil", "{", "pj", ".", "Status", ".", "PrevReportStates", "=", "map", "[", "string", "]", "v1", ".", "ProwJobState", "{", "}", "\n", "}", "\n\n", "// already reported current state", "if", "pj", ".", "Status", ".", "PrevReportStates", "[", "c", ".", "reporter", ".", "GetName", "(", ")", "]", "==", "pj", ".", "Status", ".", "State", "{", "logrus", ".", "WithField", "(", "\"", "\"", ",", "keyRaw", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "c", ".", "queue", ".", "Forget", "(", "key", ")", "\n", "return", "true", "\n", "}", "\n\n", "logrus", ".", "WithField", "(", "\"", "\"", ",", "keyRaw", ")", ".", "Infof", "(", "\"", "\"", ",", "pj", ".", "Status", ".", "State", ")", "\n", "pjs", ",", "err", ":=", "c", ".", "reporter", ".", "Report", "(", "pj", ")", "\n", "if", "err", "!=", "nil", "{", "fields", ":=", "logrus", ".", "Fields", "{", "\"", "\"", ":", "keyRaw", ",", "\"", "\"", ":", "pj", ".", "Name", ",", "\"", "\"", ":", "pj", ".", "Status", ",", "}", "\n", "logrus", ".", "WithError", "(", "err", ")", ".", "WithFields", "(", "fields", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "return", "c", ".", "retry", "(", "key", ",", "err", ")", "\n", "}", "\n\n", "logrus", ".", "WithField", "(", "\"", "\"", ",", "keyRaw", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "for", "_", ",", "pjob", ":=", "range", "pjs", "{", "if", "err", ":=", "c", ".", "updateReportState", "(", "pjob", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "WithField", "(", "\"", "\"", ",", "keyRaw", ")", ".", "Error", "(", "\"", "\"", ")", "\n\n", "// theoretically patch should not have this issue, but in case:", "// it might be out-dated, try to re-fetch pj and try again", "updatedPJ", ",", "err", ":=", "c", ".", "pjclientset", ".", "Prow", "(", ")", ".", "ProwJobs", "(", "pjob", ".", "Namespace", ")", ".", "Get", "(", "pjob", ".", "Name", ",", "metav1", ".", "GetOptions", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "WithField", "(", "\"", "\"", ",", "keyRaw", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "c", ".", "queue", ".", "Forget", "(", "key", ")", "\n", "return", "true", "\n", "}", "\n\n", "if", "err", ":=", "c", ".", "updateReportState", "(", "updatedPJ", ")", ";", "err", "!=", "nil", "{", "// shrug", "logrus", ".", "WithError", "(", "err", ")", ".", "WithField", "(", "\"", "\"", ",", "keyRaw", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "c", ".", "queue", ".", "Forget", "(", "key", ")", "\n", "return", "true", "\n", "}", "\n", "}", "\n\n", "logrus", ".", "WithField", "(", "\"", "\"", ",", "keyRaw", ")", ".", "Infof", "(", "\"", "\"", ",", "pjob", ".", "Spec", ".", "Job", ",", "pjob", ".", "Status", ".", "State", ")", "\n", "}", "\n", "c", ".", "queue", ".", "Forget", "(", "key", ")", "\n", "return", "true", "\n", "}" ]
22,169
all-22170
[ "column", "(", "s", "n", ")", "returns", "0", "x", "where", "x", "is", "the", "nth", "column", "(", "1", "-", "based", ")", "in", "s", "or", "-", "1", "if", "s", "does", "not", "have", "n", "columns", ".", "A", "zero", "column", "number", "is", "treated", "specially", ":", "0", "s", "is", "returned", "." ]
[ "func", "column", "(", "s", "string", ",", "n", "int", ")", "(", "int", ",", "string", ")", "{", "if", "n", "==", "0", "{", "return", "0", ",", "s", "\n", "}", "\n", "currentColumn", ":=", "0", "\n", "wstart", ":=", "-", "1", "\n", "for", "i", ",", "c", ":=", "range", "s", "{", "sp", ":=", "unicode", ".", "IsSpace", "(", "c", ")", "\n", "switch", "{", "<mask>", "!", "sp", "&&", "wstart", "<", "0", ":", "// Start of word", "currentColumn", "++", "\n", "wstart", "=", "i", "\n", "case", "sp", "&&", "wstart", ">=", "0", "&&", "currentColumn", "==", "n", ":", "// End of nth col", "return", "0", ",", "s", "[", "wstart", ":", "i", "]", "\n", "case", "sp", "&&", "wstart", ">=", "0", ":", "// End of another column", "wstart", "=", "-", "1", "\n", "}", "\n", "}", "\n", "if", "wstart", ">=", "0", "&&", "currentColumn", "==", "n", "{", "// nth column ends string", "return", "0", ",", "s", "[", "wstart", ":", "]", "\n", "}", "\n\n", "// col not found. Treat as a value smaller than all strings", "return", "-", "1", ",", "\"", "\"", "\n", "}" ]
22,170
all-22171
[ "ManagedObjectReferences", "returns", "all", "MOIDs", "in", "a", "MOIDForUUIDResults", "as", "ManagedObjectReferences", "as", "type", "VirtualMachine", "." ]
[ "func", "(", "r", "MOIDForUUIDResults", ")", "ManagedObjectReferences", "(", ")", "[", "]", "types", ".", "ManagedObjectReference", "{", "var", "refs", "[", "]", "types", ".", "ManagedObjectReference", "\n", "for", "_", ",", "result", ":=", "range", "r", "{", "refs", "=", "append", "(", "refs", ",", "types", ".", "ManagedObjectReference", "{", "<mask>", ":", "\"", "\"", ",", "Value", ":", "result", ".", "MOID", ",", "}", ")", "\n", "}", "\n", "return", "refs", "\n", "}" ]
22,171
all-22172
[ "expandVmwareDistributedVirtualSwitchPvlanSpec", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "VmwareDistributedVirtualSwitchPvlanSpec", "." ]
[ "func", "expandVmwareDistributedVirtualSwitchPvlanSpec", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "types", ".", "VmwareDistributedVirtualSwitchPvlanSpec", "{", "obj", ":=", "&", "<mask>", ".", "VmwareDistributedVirtualSwitchPvlanSpec", "{", "PvlanId", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "}", "\n", "return", "obj", "\n", "}" ]
22,172
all-22173
[ "ImageNewFromFile", "()", "is", "a", "wrapper", "around", "gtk_image_new_from_file", "()", "." ]
[ "func", "ImageNewFromFile", "(", "filename", "string", ")", "(", "*", "<mask>", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "filename", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "c", ":=", "C", ".", "gtk_image_new_from_file", "(", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapImage", "(", "obj", ")", ",", "nil", "\n", "}" ]
22,173
all-22174
[ "checkVersionCompatibility", "checks", "whether", "the", "given", "version", "is", "compatible", "with", "the", "local", "version", "." ]
[ "func", "checkVersionCompatibility", "(", "name", "string", ",", "server", ",", "minCluster", "*", "semver", ".", "Version", ")", "(", "localServer", "*", "semver", ".", "Version", ",", "localMinCluster", "*", "semver", ".", "Version", ",", "err", "error", ")", "{", "localServer", "=", "semver", ".", "Must", "(", "semver", ".", "NewVersion", "(", "version", ".", "Version", ")", ")", "\n", "localMinCluster", "=", "semver", ".", "Must", "(", "semver", ".", "NewVersion", "(", "version", ".", "MinClusterVersion", ")", ")", "\n", "if", "compareMajorMinorVersion", "(", "server", ",", "localMinCluster", ")", "==", "-", "1", "{", "return", "localServer", ",", "localMinCluster", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ",", "server", ",", "localServer", ")", "\n", "}", "\n", "if", "compareMajorMinorVersion", "(", "minCluster", ",", "localServer", ")", "==", "1", "{", "return", "localServer", ",", "localMinCluster", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ",", "server", ",", "localServer", ")", "\n", "}", "\n", "return", "localServer", ",", "localMinCluster", ",", "nil", "\n", "}" ]
22,174
all-22175
[ "InsertAfter", "()", "is", "a", "wrapper", "around", "gtk_list_store_insert_after", "()", "." ]
[ "func", "(", "v", "*", "ListStore", ")", "InsertAfter", "(", "sibling", "*", "TreeIter", ")", "*", "TreeIter", "{", "<mask>", "ti", "C", ".", "GtkTreeIter", "\n", "C", ".", "gtk_list_store_insert_after", "(", "v", ".", "native", "(", ")", ",", "&", "ti", ",", "sibling", ".", "native", "(", ")", ")", "\n", "iter", ":=", "&", "TreeIter", "{", "ti", "}", "\n", "return", "iter", "\n", "}" ]
22,175
all-22176
[ "DockerControlLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "DockerControlLocator", "(", "href", "string", ")", "*", "DockerControlLocator", "{", "<mask>", "&", "DockerControlLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
22,176
all-22177
[ "MkdirAll", "calls", "os", ".", "MkdirAll", "." ]
[ "func", "(", "g", "GitOS", ")", "MkdirAll", "(", "path", "string", ",", "perm", "os", ".", "FileMode", ")", "error", "{", "return", "<mask>", ".", "MkdirAll", "(", "path", ",", "perm", ")", "\n", "}" ]
22,177
all-22178
[ "MarshalLogObject", "implements", "zapcore", "ObjectMarshaler", "." ]
[ "func", "(", "c", "Context", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "error", "{", "if", "c", ".", "HTTPRequest", "!=", "emptyHTTPRequest", "{", "enc", ".", "AddObject", "(", "\"", "\"", ",", "c", ".", "HTTPRequest", ")", "\n", "}", "\n", "if", "c", ".", "User", "!=", "\"", "\"", "{", "enc", ".", "AddString", "(", "\"", "\"", ",", "c", ".", "<mask>", ")", "\n", "}", "\n", "if", "c", ".", "reportLocation", "!=", "emptyReportLocation", "{", "enc", ".", "AddObject", "(", "\"", "\"", ",", "c", ".", "reportLocation", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
22,178
all-22179
[ "MustChangeTrustOp", "retrieves", "the", "ChangeTrustOp", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "OperationBody", ")", "MustChangeTrustOp", "(", ")", "ChangeTrustOp", "{", "val", ",", "ok", ":=", "u", ".", "GetChangeTrustOp", "(", ")", "\n\n", "if", "!", "<mask>", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
22,179
all-22180
[ "CredentialLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "CredentialLocator", "(", "href", "string", ")", "*", "CredentialLocator", "{", "<mask>", "&", "CredentialLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
22,180
all-22181
[ "TimeDurationGoString", "returns", "the", "value", "of", "the", "time", ".", "Duration", "for", "printing", "in", "a", "string", "." ]
[ "func", "TimeDurationGoString", "(", "t", "*", "<mask>", ".", "Duration", ")", "string", "{", "if", "t", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "t", ")", "\n", "}" ]
22,181
all-22182
[ "ReportSnapshot", "reports", "snapshot", "sent", "status", "to", "the", "raft", "state", "machine", "and", "clears", "the", "used", "snapshot", "from", "the", "snapshot", "store", "." ]
[ "func", "(", "s", "*", "EtcdServer", ")", "ReportSnapshot", "(", "id", "uint64", ",", "status", "raft", ".", "SnapshotStatus", ")", "{", "s", ".", "r", ".", "ReportSnapshot", "(", "id", ",", "<mask>", ")", "\n", "}" ]
22,182
all-22183
[ "Deprecated", ":", "see", "NamedValueChecker", ".", "func", "(", "s", "*", "stmt", ")", "ColumnConverter", "(", "idx", "int", ")", "driver", ".", "ValueConverter", "{", "}", "CheckNamedValue", "implements", "NamedValueChecker", "interface", "." ]
[ "func", "(", "s", "*", "stmt", ")", "CheckNamedValue", "(", "nv", "*", "driver", ".", "NamedValue", ")", "error", "{", "if", "nv", ".", "Name", "==", "bulk", "{", "if", "ptr", ",", "ok", ":=", "nv", ".", "Value", ".", "(", "*", "*", "struct", "{", "}", ")", ";", "ok", "{", "switch", "ptr", "{", "case", "&", "noFlushTok", ":", "s", ".", "bulk", ",", "s", ".", "noFlush", "=", "true", ",", "true", "\n", "return", "driver", ".", "ErrRemoveArgument", "\n", "case", "&", "flushTok", ":", "return", "<mask>", ".", "ErrRemoveArgument", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "checkNamedValue", "(", "s", ".", "prmFieldSet", ",", "nv", ")", "\n", "}" ]
22,183
all-22184
[ "SupportsClipboardPersistence", "()", "is", "a", "wrapper", "around", "gdk_display_supports_clipboard_persistence", "()", "." ]
[ "func", "(", "v", "*", "Display", ")", "SupportsClipboardPersistence", "(", ")", "bool", "{", "c", ":=", "C", ".", "gdk_display_supports_clipboard_persistence", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
22,184
all-22185
[ "/", "*", "Runs", "the", "entire", "expression", "using", "the", "given", "[", "parameters", "]", ".", "e", ".", "g", ".", "If", "the", "expression", "contains", "a", "reference", "to", "the", "variable", "foo", "it", "will", "be", "taken", "from", "parameters", ".", "Get", "(", "foo", ")", "." ]
[ "func", "(", "this", "EvaluableExpression", ")", "Eval", "(", "parameters", "Parameters", ")", "(", "<mask>", "{", "}", ",", "error", ")", "{", "if", "this", ".", "evaluationStages", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n\n", "if", "parameters", "!=", "nil", "{", "parameters", "=", "&", "sanitizedParameters", "{", "parameters", "}", "\n", "}", "else", "{", "parameters", "=", "DUMMY_PARAMETERS", "\n", "}", "\n\n", "return", "this", ".", "evaluateStage", "(", "this", ".", "evaluationStages", ",", "parameters", ")", "\n", "}" ]
22,185
all-22186
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventMediaQueryResultChanged", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss54", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
22,186
all-22187
[ "Swap", "calls", "the", "Router", ".", "Swap", "and", "updates", "the", "app", ".", "CName", "in", "the", "database", "." ]
[ "func", "Swap", "(", "app1", ",", "app2", "*", "App", ",", "cnameOnly", "bool", ")", "error", "{", "a1Routers", ":=", "app1", ".", "GetRouters", "(", ")", "\n", "a2Routers", ":=", "app2", ".", "GetRouters", "(", ")", "\n", "if", "len", "(", "a1Routers", ")", "!=", "1", "||", "len", "(", "a2Routers", ")", "!=", "1", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "r1", ",", "err", ":=", "router", ".", "Get", "(", "a1Routers", "[", "0", "]", ".", "Name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "r2", ",", "err", ":=", "router", ".", "Get", "(", "a2Routers", "[", "0", "]", ".", "Name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", "app1", ",", "app2", "*", "App", ")", "{", "rebuild", ".", "RoutesRebuildOrEnqueue", "(", "app1", ".", "Name", ")", "\n", "rebuild", ".", "RoutesRebuildOrEnqueue", "(", "app2", ".", "Name", ")", "\n", "app1", ".", "GetRoutersWithAddr", "(", ")", "\n", "app2", ".", "GetRoutersWithAddr", "(", ")", "\n", "}", "(", "app1", ",", "app2", ")", "\n", "err", "=", "r1", ".", "Swap", "(", "app1", ".", "Name", ",", "app2", ".", "<mask>", ",", "cnameOnly", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "conn", ",", "err", ":=", "db", ".", "Conn", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "conn", ".", "Close", "(", ")", "\n", "app1", ".", "CName", ",", "app2", ".", "CName", "=", "app2", ".", "CName", ",", "app1", ".", "CName", "\n", "updateCName", ":=", "func", "(", "app", "*", "App", ",", "r", "router", ".", "Router", ")", "error", "{", "return", "conn", ".", "Apps", "(", ")", ".", "Update", "(", "bson", ".", "M", "{", "\"", "\"", ":", "app", ".", "Name", "}", ",", "bson", ".", "M", "{", "\"", "\"", ":", "bson", ".", "M", "{", "\"", "\"", ":", "app", ".", "CName", "}", "}", ",", ")", "\n", "}", "\n", "err", "=", "updateCName", "(", "app1", ",", "r1", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "updateCName", "(", "app2", ",", "r2", ")", "\n", "}" ]
22,187
all-22188
[ "cephRBDVolumeGetParent", "will", "return", "the", "snapshot", "the", "RBD", "clone", "was", "created", "from", "-", "If", "the", "RBD", "storage", "volume", "is", "not", "a", "clone", "then", "this", "function", "will", "return", "db", ".", "NoSuchObjectError", ".", "-", "The", "snapshot", "will", "be", "returned", "as", "<osd", "-", "pool", "-", "name", ">", "/", "<rbd", "-", "volume", "-", "name", ">" ]
[ "func", "cephRBDVolumeGetParent", "(", "clusterName", "string", ",", "poolName", "string", ",", "volumeName", "string", ",", "volumeType", "string", ",", "userName", "string", ")", "(", "string", ",", "error", ")", "{", "msg", ",", "err", ":=", "shared", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "userName", ",", "\"", "\"", ",", "clusterName", ",", "\"", "\"", ",", "poolName", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "volumeType", ",", "volumeName", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "idx", ":=", "strings", ".", "Index", "(", "msg", ",", "\"", "\"", ")", "\n", "if", "idx", "==", "-", "1", "{", "return", "\"", "\"", ",", "db", ".", "ErrNoSuchObject", "\n", "}", "\n\n", "msg", "=", "msg", "[", "(", "idx", "+", "len", "(", "\"", "\"", ")", ")", ":", "]", "\n", "msg", "=", "strings", ".", "TrimSpace", "(", "msg", ")", "\n\n", "idx", "=", "strings", ".", "Index", "(", "msg", ",", "\"", "\\n", "\"", ")", "\n", "if", "idx", "==", "-", "1", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "msg", "=", "msg", "[", ":", "idx", "]", "\n", "msg", "=", "strings", ".", "TrimSpace", "(", "msg", ")", "\n\n", "return", "<mask>", ",", "nil", "\n", "}" ]
22,188
all-22189
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventInterstitialHidden", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage59", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
22,189
all-22190
[ "Only", "available", "in", "GLib", "2", ".", "42", "+", "//", "GetResourceBasePath", "is", "a", "wrapper", "around", "g_application_get_resource_base_path", "()", ".", "func", "(", "v", "*", "Application", ")", "GetResourceBasePath", "()", "string", "{", "c", ":", "=", "C", ".", "g_application_get_resource_base_path", "(", "v", ".", "native", "()", ")", "return", "C", ".", "GoString", "((", "*", "C", ".", "char", ")", "(", "c", "))", "}", "Only", "available", "in", "GLib", "2", ".", "42", "+", "//", "SetResourceBasePath", "is", "a", "wrapper", "around", "g_application_set_resource_base_path", "()", ".", "func", "(", "v", "*", "Application", ")", "SetResourceBasePath", "(", "bp", "string", ")", "{", "cstr1", ":", "=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "bp", "))", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr1", "))", "C", ".", "g_application_set_resource_base_path", "(", "v", ".", "native", "()", "cstr1", ")", "}", "GetDbusObjectPath", "is", "a", "wrapper", "around", "g_application_get_dbus_object_path", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetDbusObjectPath", "(", ")", "string", "{", "c", ":=", "C", ".", "g_application_get_dbus_object_path", "(", "v", ".", "native", "(", ")", ")", "\n\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "char", ")", "(", "c", ")", ")", "\n", "}" ]
22,190
all-22191
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "PausedReason", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "out", ".", "<mask>", "(", "string", "(", "t", ")", ")", "\n", "}" ]
22,191
all-22192
[ "Example", "how", "to", "use", "basic", "auth", "together", "with", "r2router" ]
[ "func", "main", "(", ")", "{", "router", ":=", "r2router", ".", "NewSeeforRouter", "(", ")", "\n", "// basic auth for entire router", "router", ".", "Before", "(", "httpauth", ".", "SimpleBasicAuth", "(", "\"", "\"", ",", "\"", "\"", ")", ")", "\n", "router", ".", "Get", "(", "\"", "\"", ",", "func", "(", "w", "<mask>", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "p", "r2router", ".", "Params", ")", "{", "w", ".", "Write", "(", "[", "]", "byte", "(", "p", ".", "Get", "(", "\"", "\"", ")", ")", ")", "\n", "}", ")", "\n\n", "http", ".", "ListenAndServe", "(", "\"", "\"", ",", "router", ")", "\n", "}" ]
22,192
all-22193
[ "Set", "adds", "a", "string", "tag", "to", "the", "span" ]
[ "func", "(", "tag", "stringTagName", ")", "Set", "(", "span", "opentracing", ".", "Span", ",", "value", "string", ")", "{", "span", ".", "SetTag", "(", "string", "(", "tag", ")", ",", "<mask>", ")", "\n", "}" ]
22,193
all-22194
[ "resourceVSphereDatastoreReadFolderOrStorageClusterPath", "checks", "the", "inventory", "path", "of", "the", "supplied", "datastore", "and", "checks", "to", "see", "if", "it", "is", "a", "normal", "folder", "or", "if", "it", "s", "a", "datastore", "cluster", "and", "saves", "the", "attributes", "accordingly", "." ]
[ "func", "resourceVSphereDatastoreReadFolderOrStorageClusterPath", "(", "d", "*", "schema", ".", "ResourceData", ",", "ds", "*", "object", ".", "Datastore", ")", "error", "{", "props", ",", "err", ":=", "datastore", ".", "Properties", "(", "ds", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "<mask>", "props", ".", "Parent", ".", "Type", "{", "case", "\"", "\"", ":", "return", "resourceVSphereDatastoreReadFolderOrStorageClusterPathAsFolder", "(", "d", ",", "ds", ")", "\n", "case", "\"", "\"", ":", "return", "resourceVSphereDatastoreReadFolderOrStorageClusterPathSetAttributes", "(", "d", ",", "\"", "\"", ",", "props", ".", "Parent", ".", "Value", ")", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "props", ".", "Parent", ".", "Type", ")", "\n", "}" ]
22,194
all-22195
[ "PushNote", "sends", "a", "link", "to", "the", "specific", "Channel", "with", "the", "given", "title", "url", "and", "body" ]
[ "func", "(", "s", "*", "Subscription", ")", "PushLink", "(", "title", ",", "u", ",", "<mask>", "string", ")", "error", "{", "return", "s", ".", "Client", ".", "PushLinkToChannel", "(", "s", ".", "Channel", ".", "Tag", ",", "title", ",", "u", ",", "body", ")", "\n", "}" ]
22,195
all-22196
[ "Valid", "validator" ]
[ "func", "(", "h", "*", "headerRule", ")", "Valid", "(", "reqCtx", "*", "fasthttp", ".", "RequestCtx", ")", "bool", "{", "j", ":=", "func", "(", "reqCtx", "*", "fasthttp", ".", "RequestCtx", ")", "bool", "{", "get", ":=", "func", "(", "key", "string", ")", "string", "{", "return", "string", "(", "reqCtx", ".", "Response", ".", "Header", ".", "Peek", "(", "key", ")", ")", "\n", "}", "\n\n", "return", "h", ".", "valid", "(", "<mask>", ")", "\n", "}", "\n", "return", "j", "(", "reqCtx", ")", "\n", "}" ]
22,196
all-22197
[ "export", "FrameSet_Frame" ]
[ "func", "FrameSet_Frame", "(", "id", "FrameSetId", ",", "index", "int", ")", "(", "C", ".", "int", ",", "Error", ")", "{", "fs", ",", "ok", ":=", "sFrameSets", ".", "Get", "(", "id", ")", "\n", "if", "!", "ok", "{", "return", "0", ",", "C", ".", "CString", "(", "\"", "\"", ")", "\n", "}", "\n", "frame", ",", "err", ":=", "fs", ".", "Frame", "(", "index", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "C", ".", "CString", "(", "err", ".", "<mask>", "(", ")", ")", "\n", "}", "\n\n", "// err string is freed by caller", "return", "C", ".", "int", "(", "frame", ")", ",", "nil", "\n", "}" ]
22,197
all-22198
[ "GetContainerMetadata", "returns", "container", "metadata", "." ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetContainerMetadata", "(", "name", "string", ")", "(", "*", "api", ".", "ImageMetadata", ",", "string", ",", "error", ")", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "nil", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "metadata", ":=", "api", ".", "ImageMetadata", "{", "}", "\n\n", "url", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "name", ")", ")", "\n", "etag", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "<mask>", ",", "nil", ",", "\"", "\"", ",", "&", "metadata", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "&", "metadata", ",", "etag", ",", "err", "\n", "}" ]
22,198
all-22199
[ "Map", "adds", "a", "port", "mapping", "on", "NAT", "interface", "and", "keeps", "it", "alive", "until", "interface", "is", "closed", "." ]
[ "func", "Map", "(", "ctx", "context", ".", "<mask>", ",", "conf", "*", "Config", ",", "logger", "log", ".", "Logger", ",", "m", "Interface", ",", "protocol", "string", ",", "extPort", ",", "intPort", "int", ",", "name", "string", ")", "error", "{", "mapUpdateInterval", ":=", "time", ".", "Duration", "(", "conf", ".", "MapUpdateInterval", ")", "*", "time", ".", "Millisecond", "\n\n", "mapTimeout", ":=", "time", ".", "Duration", "(", "conf", ".", "MapTimeout", ")", "*", "time", ".", "Millisecond", "\n\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "protocol", ",", "\"", "\"", ",", "extPort", ",", "\"", "\"", ",", "intPort", ",", "\"", "\"", ",", "mapUpdateInterval", ",", "\"", "\"", ",", "mapTimeout", ",", "\"", "\"", ",", "name", ")", "\n\n", "if", "err", ":=", "m", ".", "AddMapping", "(", "protocol", ",", "extPort", ",", "intPort", ",", "name", ",", "mapTimeout", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrAddMapping", "\n", "}", "\n", "logger", ".", "Info", "(", "\"", "\"", ")", "\n", "go", "func", "(", ")", "{", "timer", ":=", "time", ".", "NewTimer", "(", "mapUpdateInterval", ")", "\n\n", "defer", "func", "(", ")", "{", "timer", ".", "Stop", "(", ")", "\n", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n", "m", ".", "DeleteMapping", "(", "protocol", ",", "extPort", ",", "intPort", ")", "\n", "}", "(", ")", "\n\n", "for", "{", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "\n", "case", "<-", "timer", ".", "C", ":", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n", "if", "err", ":=", "m", ".", "AddMapping", "(", "protocol", ",", "extPort", ",", "intPort", ",", "name", ",", "mapTimeout", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Warn", "(", "\"", "\"", "+", "\"", "\"", "+", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "timer", ".", "Reset", "(", "mapUpdateInterval", ")", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n", "return", "nil", "\n", "}" ]
22,199
all-22200
[ "Equivalent", "to", "HAProxy", "show", "info", "command", "." ]
[ "func", "(", "h", "*", "HAProxyClient", ")", "Info", "(", ")", "(", "*", "Info", ",", "error", ")", "{", "res", ",", "err", ":=", "h", ".", "RunCommand", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "info", ":=", "&", "Info", "{", "}", "\n", "err", "=", "kvcodec", ".", "Unmarshal", "(", "res", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "info", ",", "nil", "\n", "}" ]