id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
8,200
all-8201
[ "Ellipsize", "truncates", "text", "to", "maxWidth", "by", "replacing", "a", "substring", "in", "the", "middle", "with", "ellipsis", "and", "keeping", "the", "beginning", "and", "ending", "of", "the", "string", "untouched", ".", "If", "maxWidth", "is", "less", "than", "5", "then", "no", "ellipsis", "is", "added", "the", "text", "is", "just", "truncated", "from", "the", "right", "." ]
[ "func", "Ellipsize", "(", "str", "string", ",", "maxWidth", "int", ")", "string", "{", "ln", ":=", "xs", ".", "Len", "(", "str", ")", "\n", "if", "ln", "<=", "maxWidth", "{", "return", "str", "\n", "}", "\n\n", "if", "maxWidth", "<", "5", "{", "return", "xs", ".", "Slice", "(", "str", ",", "0", ",", "maxWidth", ")", "\n", "}", "\n\n", "left", ":=", "int", "(", "(", "maxWidth", "-", "3", ")", "/", "2", ")", "\n", "right", ":=", "maxWidth", "-", "left", "-", "3", "\n", "return", "xs", ".", "Slice", "(", "str", ",", "0", ",", "left", ")", "+", "\"", "\"", "+", "xs", ".", "Slice", "(", "str", ",", "ln", "-", "<mask>", ",", "-", "1", ")", "\n", "}" ]
8,201
all-8202
[ "ListContainers", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockDockerClient", ")", "ListContainers", "(", "arg0", "context", ".", "Context", ",", "arg1", "bool", ",", "arg2", "time", ".", "Duration", ")", "dockerapi", ".", "ListContainersResponse", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ",", "arg2", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "dockerapi", ".", "ListContainersResponse", ")", "\n", "return", "ret0", "\n", "}" ]
8,202
all-8203
[ "replaceTables", "will", "replace", "tables", "[", "left", ":", "right", "]", "with", "newTables", ".", "Note", "this", "EXCLUDES", "tables", "[", "right", "]", ".", "You", "must", "call", "decr", "()", "to", "delete", "the", "old", "tables", "_after_", "writing", "the", "update", "to", "the", "manifest", "." ]
[ "func", "(", "s", "*", "levelHandler", ")", "replaceTables", "(", "toDel", ",", "toAdd", "[", "]", "*", "table", ".", "Table", ")", "error", "{", "// Need to re-search the range of tables in this level to be replaced as other goroutines might", "// be changing it as well. (They can't touch our tables, but if they add/remove other tables,", "// the indices get shifted around.)", "s", ".", "Lock", "(", ")", "// We s.Unlock() below.", "\n\n", "toDelMap", ":=", "<mask>", "(", "map", "[", "uint64", "]", "struct", "{", "}", ")", "\n", "for", "_", ",", "t", ":=", "range", "toDel", "{", "toDelMap", "[", "t", ".", "ID", "(", ")", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "var", "newTables", "[", "]", "*", "table", ".", "Table", "\n", "for", "_", ",", "t", ":=", "range", "s", ".", "tables", "{", "_", ",", "found", ":=", "toDelMap", "[", "t", ".", "ID", "(", ")", "]", "\n", "if", "!", "found", "{", "newTables", "=", "append", "(", "newTables", ",", "t", ")", "\n", "continue", "\n", "}", "\n", "s", ".", "totalSize", "-=", "t", ".", "Size", "(", ")", "\n", "}", "\n\n", "// Increase totalSize first.", "for", "_", ",", "t", ":=", "range", "toAdd", "{", "s", ".", "totalSize", "+=", "t", ".", "Size", "(", ")", "\n", "t", ".", "IncrRef", "(", ")", "\n", "newTables", "=", "append", "(", "newTables", ",", "t", ")", "\n", "}", "\n\n", "// Assign tables.", "s", ".", "tables", "=", "newTables", "\n", "sort", ".", "Slice", "(", "s", ".", "tables", ",", "func", "(", "i", ",", "j", "int", ")", "bool", "{", "return", "y", ".", "CompareKeys", "(", "s", ".", "tables", "[", "i", "]", ".", "Smallest", "(", ")", ",", "s", ".", "tables", "[", "j", "]", ".", "Smallest", "(", ")", ")", "<", "0", "\n", "}", ")", "\n", "s", ".", "Unlock", "(", ")", "// s.Unlock before we DecrRef tables -- that can be slow.", "\n", "return", "decrRefs", "(", "toDel", ")", "\n", "}" ]
8,203
all-8204
[ "Revoke", "removes", "a", "set", "of", "permissions", "to", "the", "permission", "object", "on", "which", "it", "is", "called", "returning", "a", "new", "permission", "object", "." ]
[ "func", "(", "rw", "RWPermission", ")", "Revoke", "(", "lg", "*", "zap", ".", "Logger", ",", "n", "RWPermission", ")", "(", "RWPermission", ",", "error", ")", "{", "<mask>", "out", "RWPermission", "\n", "currentRead", ":=", "types", ".", "NewUnsafeSet", "(", "rw", ".", "Read", "...", ")", "\n", "for", "_", ",", "r", ":=", "range", "n", ".", "Read", "{", "if", "!", "currentRead", ".", "Contains", "(", "r", ")", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "r", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Noticef", "(", "\"", "\"", ",", "r", ")", "\n", "}", "\n", "continue", "\n", "}", "\n", "currentRead", ".", "Remove", "(", "r", ")", "\n", "}", "\n", "currentWrite", ":=", "types", ".", "NewUnsafeSet", "(", "rw", ".", "Write", "...", ")", "\n", "for", "_", ",", "w", ":=", "range", "n", ".", "Write", "{", "if", "!", "currentWrite", ".", "Contains", "(", "w", ")", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "w", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Noticef", "(", "\"", "\"", ",", "w", ")", "\n", "}", "\n", "continue", "\n", "}", "\n", "currentWrite", ".", "Remove", "(", "w", ")", "\n", "}", "\n", "out", ".", "Read", "=", "currentRead", ".", "Values", "(", ")", "\n", "out", ".", "Write", "=", "currentWrite", ".", "Values", "(", ")", "\n", "sort", ".", "Strings", "(", "out", ".", "Read", ")", "\n", "sort", ".", "Strings", "(", "out", ".", "Write", ")", "\n", "return", "out", ",", "nil", "\n", "}" ]
8,204
all-8205
[ "Rand", "picks", "one", "HandlerFunc", "(", "s", ")", "in", "the", "slide", "." ]
[ "func", "Rand", "(", "h", "...", "HandlerFunc", ")", "HandlerFunc", "{", "f", ":=", "func", "(", "ctx", "*", "<mask>", ")", "error", "{", "if", "err", ":=", "h", "[", "rand", ".", "Intn", "(", "len", "(", "h", ")", ")", "]", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}", "\n", "return", "f", "\n", "}" ]
8,205
all-8206
[ "Extract", "all", "cluster", "state", "call", "f", "with", "each", "operation", "." ]
[ "func", "(", "c", "APIClient", ")", "Extract", "(", "objects", "bool", ",", "f", "func", "(", "op", "*", "admin", ".", "Op", ")", "error", ")", "error", "{", "extractClient", ",", "err", ":=", "c", ".", "AdminAPIClient", ".", "Extract", "(", "c", ".", "Ctx", "(", ")", ",", "&", "admin", ".", "ExtractRequest", "{", "NoObjects", ":", "!", "objects", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "for", "{", "op", ",", "err", ":=", "extractClient", ".", "Recv", "(", ")", "\n", "if", "err", "==", "io", ".", "EOF", "{", "<mask>", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "if", "err", ":=", "f", "(", "op", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,206
all-8207
[ "Error", "returns", "the", "string", "representation", "of", "an", "Error", "." ]
[ "func", "(", "e", "<mask>", ")", "Error", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "Err", ",", "e", ".", "Debug", ",", "e", ".", "Stderr", ")", "\n", "}" ]
8,207
all-8208
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "ErrorReason", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
8,208
all-8209
[ "commandArgs", "is", "the", "command", "arguments", "after", "spf13", "/", "cobra", "parses", "all", "watch", "command", "flags", "strips", "out", "special", "characters", "(", "e", ".", "g", ".", "--", ")", ".", "orArgs", "is", "the", "raw", "arguments", "passed", "to", "watch", "command", "(", "e", ".", "g", ".", ".", "/", "bin", "/", "etcdctl", "watch", "foo", "--", "rev", "1", "bar", ")", ".", "--", "characters", "are", "invalid", "arguments", "for", "spf13", "/", "cobra", "library", "so", "no", "need", "to", "handle", "such", "cases", "." ]
[ "func", "parseWatchArgs", "(", "osArgs", ",", "commandArgs", "[", "]", "string", ",", "envKey", ",", "envRange", "string", ",", "interactive", "bool", ")", "(", "watchArgs", "[", "]", "string", ",", "execArgs", "[", "]", "string", ",", "err", "error", ")", "{", "rawArgs", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "osArgs", ")", ")", "\n", "copy", "(", "rawArgs", ",", "osArgs", ")", "\n", "watchArgs", "=", "make", "(", "[", "]", "string", ",", "len", "(", "commandArgs", ")", ")", "\n", "copy", "(", "watchArgs", ",", "commandArgs", ")", "\n\n", "// remove preceding commands (e.g. ./bin/etcdctl watch)", "// handle \"./bin/etcdctl watch foo -- echo watch event\"", "for", "idx", ":=", "range", "rawArgs", "{", "if", "rawArgs", "[", "idx", "]", "==", "\"", "\"", "{", "rawArgs", "=", "rawArgs", "[", "idx", "+", "1", ":", "]", "\n", "break", "\n", "}", "\n", "}", "\n\n", "// remove preceding commands (e.g. \"watch foo bar\" in interactive mode)", "// handle \"./bin/etcdctl watch foo -- echo watch event\"", "if", "interactive", "{", "if", "watchArgs", "[", "0", "]", "!=", "\"", "\"", "{", "// \"watch\" not found", "watchPrefix", ",", "watchRev", ",", "watchPrevKey", "=", "<mask>", ",", "0", ",", "false", "\n", "return", "nil", ",", "nil", ",", "errBadArgsInteractiveWatch", "\n", "}", "\n", "watchArgs", "=", "watchArgs", "[", "1", ":", "]", "\n", "}", "\n\n", "execIdx", ",", "execExist", ":=", "0", ",", "false", "\n", "if", "!", "interactive", "{", "for", "execIdx", "=", "range", "rawArgs", "{", "if", "rawArgs", "[", "execIdx", "]", "==", "\"", "\"", "{", "execExist", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "execExist", "&&", "execIdx", "==", "len", "(", "rawArgs", ")", "-", "1", "{", "// \"watch foo bar --\" should error", "return", "nil", ",", "nil", ",", "errBadArgsNumSeparator", "\n", "}", "\n", "// \"watch\" with no argument should error", "if", "!", "execExist", "&&", "len", "(", "rawArgs", ")", "<", "1", "&&", "envKey", "==", "\"", "\"", "{", "return", "nil", ",", "nil", ",", "errBadArgsNum", "\n", "}", "\n", "if", "execExist", "&&", "envKey", "!=", "\"", "\"", "{", "// \"ETCDCTL_WATCH_KEY=foo watch foo -- echo 1\" should error", "// (watchArgs==[\"foo\",\"echo\",\"1\"])", "widx", ",", "ridx", ":=", "len", "(", "watchArgs", ")", "-", "1", ",", "len", "(", "rawArgs", ")", "-", "1", "\n", "for", ";", "widx", ">=", "0", ";", "widx", "--", "{", "if", "watchArgs", "[", "widx", "]", "==", "rawArgs", "[", "ridx", "]", "{", "ridx", "--", "\n", "continue", "\n", "}", "\n", "// watchArgs has extra:", "// ETCDCTL_WATCH_KEY=foo watch foo -- echo 1", "// watchArgs: foo echo 1", "if", "ridx", "==", "execIdx", "{", "return", "nil", ",", "nil", ",", "errBadArgsNumConflictEnv", "\n", "}", "\n", "}", "\n", "}", "\n", "// check conflicting arguments", "// e.g. \"watch --rev 1 -- echo Hello World\" has no conflict", "if", "!", "execExist", "&&", "len", "(", "watchArgs", ")", ">", "0", "&&", "envKey", "!=", "\"", "\"", "{", "// \"ETCDCTL_WATCH_KEY=foo watch foo\" should error", "// (watchArgs==[\"foo\"])", "return", "nil", ",", "nil", ",", "errBadArgsNumConflictEnv", "\n", "}", "\n", "}", "else", "{", "for", "execIdx", "=", "range", "watchArgs", "{", "if", "watchArgs", "[", "execIdx", "]", "==", "\"", "\"", "{", "execExist", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "execExist", "&&", "execIdx", "==", "len", "(", "watchArgs", ")", "-", "1", "{", "// \"watch foo bar --\" should error", "watchPrefix", ",", "watchRev", ",", "watchPrevKey", "=", "false", ",", "0", ",", "false", "\n", "return", "nil", ",", "nil", ",", "errBadArgsNumSeparator", "\n", "}", "\n\n", "flagset", ":=", "NewWatchCommand", "(", ")", ".", "Flags", "(", ")", "\n", "if", "perr", ":=", "flagset", ".", "Parse", "(", "watchArgs", ")", ";", "perr", "!=", "nil", "{", "watchPrefix", ",", "watchRev", ",", "watchPrevKey", "=", "false", ",", "0", ",", "false", "\n", "return", "nil", ",", "nil", ",", "perr", "\n", "}", "\n", "pArgs", ":=", "flagset", ".", "Args", "(", ")", "\n\n", "// \"watch\" with no argument should error", "if", "!", "execExist", "&&", "envKey", "==", "\"", "\"", "&&", "len", "(", "pArgs", ")", "<", "1", "{", "watchPrefix", ",", "watchRev", ",", "watchPrevKey", "=", "false", ",", "0", ",", "false", "\n", "return", "nil", ",", "nil", ",", "errBadArgsNum", "\n", "}", "\n", "// check conflicting arguments", "// e.g. \"watch --rev 1 -- echo Hello World\" has no conflict", "if", "!", "execExist", "&&", "len", "(", "pArgs", ")", ">", "0", "&&", "envKey", "!=", "\"", "\"", "{", "// \"ETCDCTL_WATCH_KEY=foo watch foo\" should error", "// (watchArgs==[\"foo\"])", "watchPrefix", ",", "watchRev", ",", "watchPrevKey", "=", "false", ",", "0", ",", "false", "\n", "return", "nil", ",", "nil", ",", "errBadArgsNumConflictEnv", "\n", "}", "\n", "}", "\n\n", "argsWithSep", ":=", "rawArgs", "\n", "if", "interactive", "{", "// interactive mode directly passes \"--\" to the command args", "argsWithSep", "=", "watchArgs", "\n", "}", "\n\n", "idx", ",", "foundSep", ":=", "0", ",", "false", "\n", "for", "idx", "=", "range", "argsWithSep", "{", "if", "argsWithSep", "[", "idx", "]", "==", "\"", "\"", "{", "foundSep", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "foundSep", "{", "execArgs", "=", "argsWithSep", "[", "idx", "+", "1", ":", "]", "\n", "}", "\n\n", "if", "interactive", "{", "flagset", ":=", "NewWatchCommand", "(", ")", ".", "Flags", "(", ")", "\n", "if", "perr", ":=", "flagset", ".", "Parse", "(", "argsWithSep", ")", ";", "perr", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "perr", "\n", "}", "\n", "watchArgs", "=", "flagset", ".", "Args", "(", ")", "\n\n", "watchPrefix", ",", "err", "=", "flagset", ".", "GetBool", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "watchRev", ",", "err", "=", "flagset", ".", "GetInt64", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "watchPrevKey", ",", "err", "=", "flagset", ".", "GetBool", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "// \"ETCDCTL_WATCH_KEY=foo watch -- echo hello\"", "// should translate \"watch foo -- echo hello\"", "// (watchArgs=[\"echo\",\"hello\"] should be [\"foo\",\"echo\",\"hello\"])", "if", "envKey", "!=", "\"", "\"", "{", "ranges", ":=", "[", "]", "string", "{", "envKey", "}", "\n", "if", "envRange", "!=", "\"", "\"", "{", "ranges", "=", "append", "(", "ranges", ",", "envRange", ")", "\n", "}", "\n", "watchArgs", "=", "append", "(", "ranges", ",", "watchArgs", "...", ")", "\n", "}", "\n\n", "if", "!", "foundSep", "{", "return", "watchArgs", ",", "nil", ",", "nil", "\n", "}", "\n\n", "// \"watch foo bar --rev 1 -- echo hello\" or \"watch foo --rev 1 bar -- echo hello\",", "// then \"watchArgs\" is \"foo bar echo hello\"", "// so need ignore args after \"argsWithSep[idx]\", which is \"--\"", "endIdx", ":=", "0", "\n", "for", "endIdx", "=", "len", "(", "watchArgs", ")", "-", "1", ";", "endIdx", ">=", "0", ";", "endIdx", "--", "{", "if", "watchArgs", "[", "endIdx", "]", "==", "argsWithSep", "[", "idx", "+", "1", "]", "{", "break", "\n", "}", "\n", "}", "\n", "watchArgs", "=", "watchArgs", "[", ":", "endIdx", "]", "\n\n", "return", "watchArgs", ",", "execArgs", ",", "nil", "\n", "}" ]
8,209
all-8210
[ "Using", "the", "EZ", "API", "posts", "a", "count", "of", "1", "to", "a", "stat", "." ]
[ "func", "(", "r", "*", "BasicReporter", ")", "PostEZCountOne", "(", "statName", ",", "ezkey", "string", ")", "error", "{", "<mask>", "r", ".", "PostEZCount", "(", "statName", ",", "ezkey", ",", "1", ")", "\n", "}" ]
8,210
all-8211
[ "ComputeMastersFromSeed", "returns", "the", "master", "public", "key", "master", "secret", "and", "chain", "code", "in", "hex", "." ]
[ "func", "ComputeMastersFromSeed", "(", "seed", "string", ")", "(", "string", ",", "string", ",", "string", ")", "{", "key", ",", "data", ":=", "[", "]", "byte", "(", "\"", "\"", ")", ",", "[", "]", "byte", "(", "seed", ")", "\n", "secret", ",", "chain", ":=", "I64", "(", "key", ",", "data", ")", "\n", "pubKeyBytes", ":=", "PubKeyBytesFromPrivKeyBytes", "(", "secret", ",", "true", ")", "\n", "return", "HexEncode", "(", "pubKeyBytes", ")", ",", "HexEncode", "(", "secret", ")", ",", "HexEncode", "(", "<mask>", ")", "\n", "}" ]
8,211
all-8212
[ "GetSMTP", "returns", "a", "SMTP", "Server", "configurations" ]
[ "func", "GetSMTP", "(", "source", "interface", "{", "}", ",", "environment", "string", ")", "(", "smtp", "Config", ",", "err", "error", ")", "{", "var", "smtpEnvironment", "SMTPEnvironment", "\n", "i", ",", "err", ":=", "config", ".", "Get", "(", "<mask>", ",", "environment", ",", "&", "smtpEnvironment", ")", "\n", "smtp", "=", "i", ".", "(", "Config", ")", "\n", "return", "\n", "}" ]
8,212
all-8213
[ "String", "returns", "the", "name", "of", "e" ]
[ "func", "(", "e", "CreateAccountResultCode", ")", "String", "(", ")", "string", "{", "<mask>", ",", "_", ":=", "createAccountResultCodeMap", "[", "int32", "(", "e", ")", "]", "\n", "return", "name", "\n", "}" ]
8,213
all-8214
[ "ListOrgInvitations", "lists", "pending", "invitations", "to", "th", "org", ".", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "orgs", "/", "members", "/", "#list", "-", "pending", "-", "organization", "-", "invitations" ]
[ "func", "(", "c", "*", "Client", ")", "ListOrgInvitations", "(", "org", "string", ")", "(", "[", "]", "OrgInvitation", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ")", "\n", "if", "c", ".", "fake", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ")", "\n", "<mask>", "ret", "[", "]", "OrgInvitation", "\n", "err", ":=", "c", ".", "readPaginatedResults", "(", "path", ",", "acceptNone", ",", "func", "(", ")", "interface", "{", "}", "{", "return", "&", "[", "]", "OrgInvitation", "{", "}", "\n", "}", ",", "func", "(", "obj", "interface", "{", "}", ")", "{", "ret", "=", "append", "(", "ret", ",", "*", "(", "obj", ".", "(", "*", "[", "]", "OrgInvitation", ")", ")", "...", ")", "\n", "}", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "ret", ",", "nil", "\n", "}" ]
8,214
all-8215
[ "String", "returns", "the", "formatted", "sequence" ]
[ "func", "(", "s", "*", "FileSequence", ")", "String", "(", ")", "string", "{", "var", "fs", "string", "\n", "if", "s", ".", "frameSet", "!=", "nil", "{", "fs", "=", "s", ".", "frameSet", ".", "String", "(", ")", "\n", "}", "\n", "buf", ":=", "<mask>", ".", "NewBufferString", "(", "s", ".", "dir", ")", "\n", "buf", ".", "WriteString", "(", "s", ".", "basename", ")", "\n", "buf", ".", "WriteString", "(", "fs", ")", "\n", "buf", ".", "WriteString", "(", "s", ".", "padChar", ")", "\n", "buf", ".", "WriteString", "(", "s", ".", "ext", ")", "\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
8,215
all-8216
[ "===", "day_of_month", "(", "v", "Vector", ")", "Scalar", "===" ]
[ "func", "funcDayOfMonth", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "return", "dateWrapper", "(", "vals", ",", "enh", ",", "func", "(", "t", "<mask>", ".", "Time", ")", "float64", "{", "return", "float64", "(", "t", ".", "Day", "(", ")", ")", "\n", "}", ")", "\n", "}" ]
8,216
all-8217
[ "NewWriter", "creates", "a", "new", "Writer", "instance", "." ]
[ "func", "NewWriter", "(", "w", "io", ".", "Writer", ")", "*", "Writer", "{", "return", "&", "<mask>", "{", "wr", ":", "bufio", ".", "NewWriter", "(", "w", ")", ",", "b", ":", "make", "(", "[", "]", "byte", ",", "writerBufferSize", ")", ",", "tr", ":", "unicode", ".", "Utf8ToCesu8Transformer", ",", "}", "\n", "}" ]
8,217
all-8218
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventChildNodeInserted", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom64", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,218
all-8219
[ "String", "implements", "stringer", "for", "VSphereVersion", "." ]
[ "func", "(", "v", "VSphereVersion", ")", "<mask>", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "Product", ",", "v", ".", "Major", ",", "v", ".", "Minor", ",", "v", ".", "Patch", ",", "v", ".", "Build", ")", "\n", "}" ]
8,219
all-8220
[ "Finds", "the", "region", "after", "the", "first", "non", "-", "vowel", "following", "a", "vowel", "or", "a", "the", "null", "region", "at", "the", "end", "of", "the", "word", "if", "there", "is", "no", "such", "non", "-", "vowel", ".", "Returns", "the", "index", "in", "the", "Word", "where", "the", "region", "starts", ";", "optionally", "skips", "the", "first", "start", "characters", "." ]
[ "func", "VnvSuffix", "(", "word", "*", "snowballword", ".", "SnowballWord", ",", "f", "isVowelFunc", ",", "start", "int", ")", "int", "{", "for", "i", ":=", "1", ";", "i", "<", "len", "(", "word", ".", "RS", "[", "start", ":", "]", ")", ";", "i", "++", "{", "j", ":=", "start", "+", "i", "\n", "if", "f", "(", "<mask>", ".", "RS", "[", "j", "-", "1", "]", ")", "&&", "!", "f", "(", "word", ".", "RS", "[", "j", "]", ")", "{", "return", "j", "+", "1", "\n", "}", "\n", "}", "\n", "return", "len", "(", "word", ".", "RS", ")", "\n", "}" ]
8,220
all-8221
[ "Push", "pushes", "the", "data", "to", "a", "specific", "device", "registered", "with", "PushBullet", ".", "The", "data", "parameter", "is", "marshaled", "to", "JSON", "and", "sent", "as", "the", "request", "body", ".", "Most", "users", "should", "call", "one", "of", "PusNote", "PushLink", "PushAddress", "or", "PushList", "." ]
[ "func", "(", "c", "*", "Client", ")", "Push", "(", "endPoint", "string", ",", "data", "interface", "{", "}", ")", "error", "{", "req", ":=", "c", ".", "buildRequest", "(", "endPoint", ",", "data", ")", "\n", "resp", ",", "err", ":=", "c", ".", "Client", ".", "Do", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n\n", "if", "resp", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "var", "errResponse", "errorResponse", "\n", "dec", ":=", "json", ".", "NewDecoder", "(", "resp", ".", "Body", ")", "\n", "err", "=", "dec", ".", "Decode", "(", "&", "errResponse", ")", "\n", "if", "err", "==", "nil", "{", "return", "&", "errResponse", ".", "ErrResponse", "\n", "}", "\n\n", "return", "<mask>", ".", "New", "(", "resp", ".", "Status", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
8,221
all-8222
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkShortcutsShortcut", "." ]
[ "func", "(", "v", "*", "ShortcutsShortcut", ")", "native", "(", ")", "*", "C", ".", "GtkShortcutsShortcut", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "<mask>", "C", ".", "toGtkShortcutsShortcut", "(", "p", ")", "\n", "}" ]
8,222
all-8223
[ "When", "modifying", "this", "don", "t", "forget", "to", "update", "loadFromFile", "()" ]
[ "func", "(", "a", "*", "AddrBook", ")", "init", "(", ")", "{", "a", ".", "key", "=", "crypto", ".", "CRandHex", "(", "24", ")", "// 24/2 * 8 = 96 bits", "\n", "// New addr buckets", "a", ".", "addrNew", "=", "make", "(", "[", "]", "map", "[", "string", "]", "*", "knownAddress", ",", "newBucketCount", ")", "\n", "for", "i", ":=", "range", "a", ".", "addrNew", "{", "a", ".", "addrNew", "[", "i", "]", "=", "<mask>", "(", "map", "[", "string", "]", "*", "knownAddress", ")", "\n", "}", "\n", "// Old addr buckets", "a", ".", "addrOld", "=", "make", "(", "[", "]", "map", "[", "string", "]", "*", "knownAddress", ",", "oldBucketCount", ")", "\n", "for", "i", ":=", "range", "a", ".", "addrOld", "{", "a", ".", "addrOld", "[", "i", "]", "=", "make", "(", "map", "[", "string", "]", "*", "knownAddress", ")", "\n", "}", "\n", "}" ]
8,223
all-8224
[ "specify", "a", "one", "-", "dimensional", "texture", "subimage", "in", "a", "compressed", "format" ]
[ "func", "CompressedTexSubImage1D", "(", "<mask>", "uint32", ",", "level", "int32", ",", "xoffset", "int32", ",", "width", "int32", ",", "format", "uint32", ",", "imageSize", "int32", ",", "data", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall9", "(", "gpCompressedTexSubImage1D", ",", "7", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "level", ")", ",", "uintptr", "(", "xoffset", ")", ",", "uintptr", "(", "width", ")", ",", "uintptr", "(", "format", ")", ",", "uintptr", "(", "imageSize", ")", ",", "uintptr", "(", "data", ")", ",", "0", ",", "0", ")", "\n", "}" ]
8,224
all-8225
[ "determine", "if", "a", "name", "corresponds", "to", "a", "transform", "feedback", "object" ]
[ "func", "IsTransformFeedback", "(", "id", "uint32", ")", "bool", "{", "ret", ":=", "C", ".", "glowIsTransformFeedback", "(", "gpIsTransformFeedback", ",", "(", "C", ".", "GLuint", ")", "(", "<mask>", ")", ")", "\n", "return", "ret", "==", "TRUE", "\n", "}" ]
8,225
all-8226
[ "NewLease", "-", "create", "and", "return", "a", "new", "lease", "object" ]
[ "func", "NewLease", "(", "taskCollection", "integrations", ".", "Collection", ",", "availableSkus", "<mask>", "[", "string", "]", "skurepo", ".", "SkuBuilder", ")", "*", "Lease", "{", "return", "&", "Lease", "{", "taskCollection", ":", "taskCollection", ",", "taskManager", ":", "taskmanager", ".", "NewTaskManager", "(", "taskCollection", ")", ",", "availableSkus", ":", "availableSkus", ",", "Task", ":", "taskmanager", ".", "RedactedTask", "{", "}", ",", "}", "\n", "}" ]
8,226
all-8227
[ "MakeFunction", "returns", "a", "pre", "-", "compiled", "non", "-", "specialized", "function", ".", "Reference", ":", "https", ":", "//", "developer", ".", "apple", ".", "com", "/", "documentation", "/", "metal", "/", "mtllibrary", "/", "1515524", "-", "makefunction", "." ]
[ "func", "(", "l", "Library", ")", "MakeFunction", "(", "name", "string", ")", "(", "Function", ",", "error", ")", "{", "f", ":=", "C", ".", "Library_MakeFunction", "(", "l", ".", "library", ",", "C", ".", "CString", "(", "name", ")", ")", "\n", "if", "f", "==", "nil", "{", "return", "Function", "{", "}", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}", "\n\n", "return", "Function", "{", "f", "}", ",", "nil", "\n", "}" ]
8,227
all-8228
[ "Send", "sets", "the", "headers", "on", "response", "to", "instruct", "App", "Engine", "to", "send", "a", "blob", "as", "the", "response", "body", ".", "This", "is", "more", "efficient", "than", "reading", "and", "writing", "it", "out", "manually", "and", "isn", "t", "subject", "to", "normal", "response", "size", "limits", "." ]
[ "func", "Send", "(", "response", "http", ".", "ResponseWriter", ",", "blobKey", "appengine", ".", "BlobKey", ")", "{", "hdr", ":=", "response", ".", "Header", "(", ")", "\n", "hdr", ".", "Set", "(", "\"", "\"", ",", "string", "(", "blobKey", ")", ")", "\n\n", "if", "hdr", ".", "Get", "(", "\"", "\"", ")", "==", "\"", "\"", "{", "// This value is known to dev_appserver to mean automatic.", "// In production this is remapped to the empty value which", "// means automatic.", "hdr", ".", "<mask>", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n", "}" ]
8,228
all-8229
[ "Pristine", "creates", "a", "new", "pristine", "document", "instance", "based", "on", "the", "input", "data" ]
[ "func", "(", "d", "*", "Document", ")", "Pristine", "(", ")", "*", "Document", "{", "dd", ",", "_", ":=", "Analyzed", "(", "d", ".", "Raw", "(", ")", ",", "d", ".", "<mask>", "(", ")", ")", "\n", "return", "dd", "\n", "}" ]
8,229
all-8230
[ "RevertToSnapshot", "restores", "the", "virtual", "machine", "to", "the", "state", "when", "the", "specified", "snapshot", "was", "created", ".", "Parameters", ":", "snapshot", ":", "A", "Snapshot", "instance", ".", "Call", "VVM", ".", "GetRootSnapshot", "()", "to", "get", "a", "snapshot", "instance", ".", "options", ":", "Any", "applicable", "VMPowerOption", ".", "If", "the", "virtual", "machine", "was", "powered", "on", "when", "the", "snapshot", "was", "created", "then", "this", "will", "determine", "how", "the", "virtual", "machine", "is", "powered", "back", "on", ".", "To", "prevent", "the", "virtual", "machine", "from", "being", "powered", "on", "regardless", "of", "the", "power", "state", "when", "the", "flag", ".", "VMPOWEROP_SUPPRESS_SNAPSHOT_POWERON", "is", "mutually", "exclusive", "to", "all", "other", "VMPowerOpOptions", ".", "Remarks", ":", "*", "Restores", "the", "virtual", "machine", "to", "the", "state", "when", "the", "specified", "snapshot", "was", "created", ".", "This", "function", "can", "power", "on", "power", "off", "or", "suspend", "a", "virtual", "machine", ".", "The", "resulting", "power", "state", "reflects", "the", "power", "state", "when", "the", "snapshot", "was", "created", ".", "*", "When", "you", "revert", "a", "powered", "on", "virtual", "machine", "and", "want", "it", "to", "display", "in", "the", "Workstation", "user", "interface", "options", "must", "have", "the", "VMPOWEROP_LAUNCH_GUI", "flag", "unless", "the", "VMPOWEROP_SUPPRESS_SNAPSHOT_POWERON", "is", "used", ".", "*", "The", "ToolsState", "property", "of", "the", "virtual", "machine", "is", "undefined", "after", "the", "snapshot", "is", "reverted", ".", "*", "Starting", "in", "VMware", "Workstation", "6", ".", "5", "snapshot", "operations", "are", "allowed", "on", "virtual", "machines", "that", "are", "part", "of", "a", "team", ".", "Previously", "this", "operation", "failed", "with", "error", "code", "PROPERTY_VM_IN_VMTEAM", ".", "Team", "members", "snapshot", "independently", "so", "they", "can", "have", "different", "and", "inconsistent", "snapshot", "states", ".", "*", "This", "function", "is", "not", "supported", "when", "using", "the", "VMWARE_PLAYER", "provider", "*", "If", "the", "virtual", "machine", "is", "open", "and", "powered", "off", "in", "the", "UI", "this", "function", "now", "closes", "the", "virtual", "machine", "in", "the", "UI", "before", "reverting", "to", "the", "snapshot", ".", "To", "refresh", "this", "property", "you", "must", "wait", "for", "tools", "in", "the", "guest", ".", "*", "After", "reverting", "to", "a", "snapshot", "you", "must", "call", "VM", ".", "WaitForToolsInGuest", "()", "before", "executing", "guest", "operations", "or", "querying", "guest", "properties", ".", "Since", "VMware", "Server", "1", ".", "0" ]
[ "func", "(", "v", "*", "VM", ")", "RevertToSnapshot", "(", "snapshot", "*", "Snapshot", ",", "options", "VMPowerOption", ")", "error", "{", "var", "jobHandle", "C", ".", "VixHandle", "=", "C", ".", "VIX_INVALID_HANDLE", "\n", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n\n", "jobHandle", "=", "C", ".", "VixVM_RevertToSnapshot", "(", "v", ".", "handle", ",", "snapshot", ".", "<mask>", ",", "0", ",", "// options", "C", ".", "VIX_INVALID_HANDLE", ",", "// propertyListHandle", "nil", ",", "// callbackProc", "nil", ")", "// clientData", "\n\n", "defer", "C", ".", "Vix_ReleaseHandle", "(", "jobHandle", ")", "\n\n", "err", "=", "C", ".", "vix_job_wait", "(", "jobHandle", ")", "\n\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
8,230
all-8231
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EvaluateOnCallFrameReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger42", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,231
all-8232
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetPropertiesParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime22", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,232
all-8233
[ "Get", "temporary", "DSN", "(", "access", "credentials", ")", "for", "a", "sentry", "project", ".", "The", "credentials", "returned", "can", "be", "used", "with", "any", "Sentry", "client", "for", "up", "to", "24", "hours", "after", "which", "the", "credentials", "will", "be", "automatically", "disabled", ".", "If", "the", "project", "doesn", "t", "exist", "it", "will", "be", "created", "and", "assigned", "to", "the", "initial", "team", "configured", "for", "this", "component", ".", "Contact", "a", "Sentry", "admin", "to", "have", "the", "project", "transferred", "to", "a", "team", "you", "have", "access", "to", "if", "needed", "Required", "scopes", ":", "auth", ":", "sentry", ":", "<project", ">", "See", "#sentryDSN" ]
[ "func", "(", "auth", "*", "Auth", ")", "SentryDSN", "(", "project", "string", ")", "(", "*", "SentryDSNResponse", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "<mask>", "(", "*", "auth", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "project", ")", "+", "\"", "\"", ",", "new", "(", "SentryDSNResponse", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "SentryDSNResponse", ")", ",", "err", "\n", "}" ]
8,233
all-8234
[ "GetCreateFlags", "registers", "the", "flags", "this", "driver", "adds", "to", "docker", "hosts", "create" ]
[ "func", "(", "d", "*", "Driver", ")", "GetCreateFlags", "(", ")", "[", "]", "mcnflag", ".", "Flag", "{", "return", "[", "]", "mcnflag", ".", "Flag", "{", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultZone", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultMachineType", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultImageName", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultUser", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultServiceAccount", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultScopes", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "IntFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultDiskSize", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultDiskType", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultNetwork", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "<mask>", ":", "defaultSubnetwork", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "EnvVar", ":", "\"", "\"", ",", "Value", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringSliceFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "}", ",", "}", "\n", "}" ]
8,234
all-8235
[ "Counter", "returns", "the", "incrementing", "value", "part", "of", "the", "id", ".", "It", "s", "a", "runtime", "error", "to", "call", "this", "method", "with", "an", "invalid", "id", "." ]
[ "func", "(", "<mask>", "ObjectId", ")", "Counter", "(", ")", "int32", "{", "b", ":=", "id", ".", "byteSlice", "(", "9", ",", "12", ")", "\n", "// Counter is stored as big-endian 3-byte value", "return", "int32", "(", "uint32", "(", "b", "[", "0", "]", ")", "<<", "16", "|", "uint32", "(", "b", "[", "1", "]", ")", "<<", "8", "|", "uint32", "(", "b", "[", "2", "]", ")", ")", "\n", "}" ]
8,235
all-8236
[ "Vec3SAdd", "performs", "a", "scaled", "vector", "addition", ".", "dest", "=", "v1", "+", "(", "v2", "*", "s", ")", "dest", "[", "out", "]", "The", "result", "vector", ".", "v1", "[", "in", "]", "The", "base", "vector", ".", "v1", "[", "in", "]", "The", "vector", "to", "scale", "and", "add", "to", "v1", ".", "s", "[", "in", "]", "The", "amount", "to", "scale", "v2", "by", "before", "adding", "to", "v1", "." ]
[ "func", "Vec3SAdd", "(", "<mask>", ",", "v1", ",", "v2", "Vec3", ",", "s", "float32", ")", "{", "dest", "[", "0", "]", "=", "v1", "[", "0", "]", "+", "v2", "[", "0", "]", "*", "s", "\n", "dest", "[", "1", "]", "=", "v1", "[", "1", "]", "+", "v2", "[", "1", "]", "*", "s", "\n", "dest", "[", "2", "]", "=", "v1", "[", "2", "]", "+", "v2", "[", "2", "]", "*", "s", "\n", "}" ]
8,236
all-8237
[ "WaitTimeout", "sets", "the", "upper", "limit", "on", "the", "time", "to", "wait", "before", "executing", "the", "query", "." ]
[ "func", "(", "q", "*", "Query", ")", "WaitTimeout", "(", "d", "time", ".", "Duration", ")", "*", "Query", "{", "q", ".", "<mask>", "=", "append", "(", "q", ".", "headers", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "d", "/", "time", ".", "Millisecond", ")", ")", "\n", "return", "q", "\n", "}" ]
8,237
all-8238
[ "HasSilenced", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "a", "*", "Alert", ")", "HasSilenced", "(", ")", "bool", "{", "if", "a", "!=", "nil", "&&", "a", ".", "Silenced", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
8,238
all-8239
[ "Set", "redefines", "the", "inuse", "units", "of", "the", "app", ".", "This", "new", "value", "must", "be", "smaller", "than", "or", "equal", "to", "the", "current", "limit", "of", "the", "app", ".", "It", "also", "must", "be", "a", "non", "negative", "number", ".", "Set", "implements", "Set", "method", "from", "QuotaService", "interface" ]
[ "func", "(", "s", "*", "QuotaService", ")", "Set", "(", "appName", "string", ",", "inUse", "int", ")", "error", "{", "q", ",", "err", ":=", "s", ".", "Storage", ".", "Get", "(", "appName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "inUse", "<", "0", "{", "return", "quota", ".", "ErrLessThanZero", "\n", "}", "\n", "if", "!", "q", ".", "IsUnlimited", "(", ")", "&&", "inUse", ">", "q", ".", "Limit", "{", "return", "&", "quota", ".", "QuotaExceededError", "{", "Requested", ":", "uint", "(", "inUse", ")", ",", "Available", ":", "uint", "(", "q", ".", "Limit", ")", ",", "}", "\n", "}", "\n", "return", "s", ".", "Storage", ".", "<mask>", "(", "appName", ",", "inUse", ")", "\n", "}" ]
8,239
all-8240
[ "GetBindvars", "returns", "a", "map", "of", "the", "bind", "vars", "referenced", "in", "the", "statement", ".", "TODO", "(", "sougou", ")", ";", "This", "function", "gets", "called", "again", "from", "vtgate", "/", "planbuilder", ".", "Ideally", "this", "should", "be", "done", "only", "once", "." ]
[ "func", "GetBindvars", "(", "stmt", "Statement", ")", "map", "[", "string", "]", "struct", "{", "}", "{", "bindvars", ":=", "make", "(", "map", "[", "string", "]", "struct", "{", "}", ")", "\n", "_", "=", "Walk", "(", "func", "(", "node", "SQLNode", ")", "(", "kontinue", "bool", ",", "err", "error", ")", "{", "switch", "<mask>", ":=", "node", ".", "(", "type", ")", "{", "case", "*", "SQLVal", ":", "if", "node", ".", "Type", "==", "ValArg", "{", "bindvars", "[", "string", "(", "node", ".", "Val", "[", "1", ":", "]", ")", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "case", "ListArg", ":", "bindvars", "[", "string", "(", "node", "[", "2", ":", "]", ")", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "return", "true", ",", "nil", "\n", "}", ",", "stmt", ")", "\n", "return", "bindvars", "\n", "}" ]
8,240
all-8241
[ "prepareLoopDev", "()", "detects", "and", "sets", "up", "a", "loop", "device", "for", "source", ".", "It", "returns", "an", "open", "file", "descriptor", "to", "the", "free", "loop", "device", "and", "the", "path", "of", "the", "free", "loop", "device", ".", "It", "s", "the", "callers", "responsibility", "to", "close", "the", "open", "file", "descriptor", "." ]
[ "func", "prepareLoopDev", "(", "source", "string", ",", "flags", "int", ")", "(", "*", "<mask>", ".", "File", ",", "error", ")", "{", "cLoopDev", ":=", "C", ".", "malloc", "(", "C", ".", "size_t", "(", "C", ".", "LO_NAME_SIZE", ")", ")", "\n", "if", "cLoopDev", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "defer", "C", ".", "free", "(", "cLoopDev", ")", "\n\n", "cSource", ":=", "C", ".", "CString", "(", "source", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cSource", ")", ")", "\n", "loopFd", ",", "_", ":=", "C", ".", "find_associated_loop_device", "(", "cSource", ",", "(", "*", "C", ".", "char", ")", "(", "cLoopDev", ")", ")", "\n", "if", "loopFd", ">=", "0", "{", "return", "os", ".", "NewFile", "(", "uintptr", "(", "loopFd", ")", ",", "C", ".", "GoString", "(", "(", "*", "C", ".", "char", ")", "(", "cLoopDev", ")", ")", ")", ",", "nil", "\n", "}", "\n\n", "loopFd", ",", "err", ":=", "C", ".", "prepare_loop_dev_retry", "(", "cSource", ",", "(", "*", "C", ".", "char", ")", "(", "cLoopDev", ")", ",", "C", ".", "int", "(", "flags", ")", ")", "\n", "if", "loopFd", "<", "0", "{", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "source", ")", "\n", "}", "\n\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "source", ")", "\n", "}", "\n\n", "return", "os", ".", "NewFile", "(", "uintptr", "(", "loopFd", ")", ",", "C", ".", "GoString", "(", "(", "*", "C", ".", "char", ")", "(", "cLoopDev", ")", ")", ")", ",", "nil", "\n", "}" ]
8,241
all-8242
[ "GetStateCmd", "returns", "a", "cobra", ".", "Command", "to", "activate", "the", "enterprise", "features", "of", "Pachyderm", "within", "a", "Pachyderm", "cluster", ".", "All", "repos", "will", "go", "from", "publicly", "-", "accessible", "to", "accessible", "only", "by", "the", "owner", "who", "can", "subsequently", "add", "users" ]
[ "func", "GetStateCmd", "(", "noMetrics", ",", "noPortForwarding", "*", "bool", ")", "*", "cobra", ".", "Command", "{", "getState", ":=", "&", "cobra", ".", "Command", "{", "Short", ":", "\"", "\"", "+", "\"", "\"", ",", "Long", ":", "\"", "\"", "+", "\"", "\"", ",", "Run", ":", "cmdutil", ".", "Run", "(", "func", "(", "args", "[", "]", "string", ")", "error", "{", "c", ",", "err", ":=", "client", ".", "NewOnUserMachine", "(", "!", "*", "noMetrics", ",", "!", "*", "noPortForwarding", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "defer", "c", ".", "Close", "(", ")", "\n", "resp", ",", "err", ":=", "c", ".", "Enterprise", ".", "GetState", "(", "c", ".", "Ctx", "(", ")", ",", "&", "enterprise", ".", "GetStateRequest", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "resp", ".", "State", "==", "enterprise", ".", "State_NONE", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n", "ts", ",", "err", ":=", "types", ".", "TimestampFromProto", "(", "resp", ".", "Info", ".", "Expires", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", "+", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "fmt", ".", "Printf", "(", "\"", "\\n", "\\n", "\"", ",", "resp", ".", "State", ".", "String", "(", ")", ",", "ts", ".", "<mask>", "(", ")", ")", "\n", "return", "nil", "\n", "}", ")", ",", "}", "\n", "return", "cmdutil", ".", "CreateAlias", "(", "getState", ",", "\"", "\"", ")", "\n", "}" ]
8,242
all-8243
[ "<unnamed", "-", "type", "-", "name", ">", "::", "=", "Ut", "[", "<nonnegative", "number", ">", "]", "_" ]
[ "func", "(", "st", "*", "state", ")", "unnamedTypeName", "(", ")", "AST", "{", "st", ".", "checkChar", "(", "'U'", ")", "\n", "st", ".", "checkChar", "(", "'t'", ")", "\n", "num", ":=", "st", ".", "compactNumber", "(", ")", "\n", "<mask>", ":=", "&", "UnnamedType", "{", "Num", ":", "num", "}", "\n", "st", ".", "subs", ".", "add", "(", "ret", ")", "\n", "return", "ret", "\n", "}" ]
8,243
all-8244
[ "State", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockCgroup", ")", "State", "(", ")", "cgroups", ".", "State", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "cgroups", ".", "State", ")", "\n", "return", "ret0", "\n", "}" ]
8,244
all-8245
[ "PangoFontDescription", "*", "pango_font_description_new", "(", "void", ")", ";" ]
[ "func", "FontDescriptionNew", "(", ")", "*", "FontDescription", "{", "c", ":=", "C", ".", "pango_font_description_new", "(", ")", "\n", "v", ":=", "<mask>", "(", "FontDescription", ")", "\n", "v", ".", "pangoFontDescription", "=", "c", "\n", "return", "v", "\n", "}" ]
8,245
all-8246
[ "enqueueKey", "schedules", "an", "item", "for", "reconciliation", "." ]
[ "func", "(", "c", "*", "controller", ")", "enqueueKey", "(", "ctx", "string", ",", "obj", "interface", "{", "}", ")", "{", "switch", "o", ":=", "obj", ".", "(", "<mask>", ")", "{", "case", "*", "prowjobv1", ".", "ProwJob", ":", "c", ".", "workqueue", ".", "AddRateLimited", "(", "toKey", "(", "ctx", ",", "o", ".", "Spec", ".", "Namespace", ",", "o", ".", "Name", ")", ")", "\n", "case", "*", "buildv1alpha1", ".", "Build", ":", "c", ".", "workqueue", ".", "AddRateLimited", "(", "toKey", "(", "ctx", ",", "o", ".", "Namespace", ",", "o", ".", "Name", ")", ")", "\n", "default", ":", "logrus", ".", "Warnf", "(", "\"", "\"", ",", "o", ",", "obj", ")", "\n", "return", "\n", "}", "\n", "}" ]
8,246
all-8247
[ "copy", "a", "three", "-", "dimensional", "texture", "subimage" ]
[ "func", "CopyTexSubImage3D", "(", "target", "uint32", ",", "<mask>", "int32", ",", "xoffset", "int32", ",", "yoffset", "int32", ",", "zoffset", "int32", ",", "x", "int32", ",", "y", "int32", ",", "width", "int32", ",", "height", "int32", ")", "{", "C", ".", "glowCopyTexSubImage3D", "(", "gpCopyTexSubImage3D", ",", "(", "C", ".", "GLenum", ")", "(", "target", ")", ",", "(", "C", ".", "GLint", ")", "(", "level", ")", ",", "(", "C", ".", "GLint", ")", "(", "xoffset", ")", ",", "(", "C", ".", "GLint", ")", "(", "yoffset", ")", ",", "(", "C", ".", "GLint", ")", "(", "zoffset", ")", ",", "(", "C", ".", "GLint", ")", "(", "x", ")", ",", "(", "C", ".", "GLint", ")", "(", "y", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "width", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "height", ")", ")", "\n", "}" ]
8,247
all-8248
[ "WithPlatform", "the", "platform", "navigator", ".", "platform", "should", "return", "." ]
[ "func", "(", "p", "SetUserAgentOverrideParams", ")", "WithPlatform", "(", "platform", "string", ")", "*", "SetUserAgentOverrideParams", "{", "p", ".", "<mask>", "=", "platform", "\n", "return", "&", "p", "\n", "}" ]
8,248
all-8249
[ "ProtoSend", "sends", "a", "protobuf", "message", "over", "a", "websocket" ]
[ "func", "ProtoSend", "(", "ws", "*", "websocket", ".", "Conn", ",", "msg", "proto", ".", "Message", ")", "error", "{", "w", ",", "err", ":=", "<mask>", ".", "NextWriter", "(", "websocket", ".", "BinaryMessage", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "w", ".", "Close", "(", ")", "\n\n", "data", ",", "err", ":=", "proto", ".", "Marshal", "(", "msg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "=", "shared", ".", "WriteAll", "(", "w", ",", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
8,249
all-8250
[ "prowToGCS", "returns", "the", "GCS", "key", "corresponding", "to", "the", "given", "prow", "key" ]
[ "func", "(", "s", "*", "Spyglass", ")", "prowToGCS", "(", "prowKey", "string", ")", "(", "string", ",", "error", ")", "{", "jobName", ",", "buildID", ",", "err", ":=", "s", ".", "KeyToJob", "(", "prowKey", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "job", ",", "err", ":=", "s", ".", "jobAgent", ".", "GetProwJob", "(", "jobName", ",", "buildID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "prowKey", ",", "err", ")", "\n", "}", "\n\n", "url", ":=", "job", ".", "Status", ".", "URL", "\n", "<mask>", ":=", "s", ".", "config", "(", ")", ".", "Plank", ".", "GetJobURLPrefix", "(", "job", ".", "Spec", ".", "Refs", ")", "\n", "if", "!", "strings", ".", "HasPrefix", "(", "url", ",", "prefix", ")", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "url", ",", "prefix", ")", "\n", "}", "\n", "return", "url", "[", "len", "(", "prefix", ")", ":", "]", ",", "nil", "\n", "}" ]
8,250
all-8251
[ "GetIdOk", "returns", "a", "tuple", "with", "the", "Id", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "b", "*", "BoardWidget", ")", "GetIdOk", "(", ")", "(", "int", ",", "bool", ")", "{", "if", "b", "==", "nil", "||", "b", ".", "Id", "==", "nil", "{", "return", "0", ",", "false", "\n", "}", "\n", "return", "*", "b", ".", "Id", ",", "<mask>", "\n", "}" ]
8,251
all-8252
[ "--------------------------------------------------------------------", "Performs", "a", "heartbeat", "part", "of", "the", "mainLoop", "()" ]
[ "func", "(", "c", "*", "<mask>", ")", "heartbeat", "(", ")", "error", "{", "broker", ",", "err", ":=", "c", ".", "client", ".", "Coordinator", "(", "c", ".", "groupID", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "closeCoordinator", "(", "broker", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n\n", "memberID", ",", "generationID", ":=", "c", ".", "membership", "(", ")", "\n", "resp", ",", "err", ":=", "broker", ".", "Heartbeat", "(", "&", "sarama", ".", "HeartbeatRequest", "{", "GroupId", ":", "c", ".", "groupID", ",", "MemberId", ":", "memberID", ",", "GenerationId", ":", "generationID", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "closeCoordinator", "(", "broker", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n", "return", "resp", ".", "Err", "\n", "}" ]
8,252
all-8253
[ "NewTransaction", "creates", "a", "new", "transaction", ".", "Badger", "supports", "concurrent", "execution", "of", "transactions", "providing", "serializable", "snapshot", "isolation", "avoiding", "write", "skews", ".", "Badger", "achieves", "this", "by", "tracking", "the", "keys", "read", "and", "at", "Commit", "time", "ensuring", "that", "these", "read", "keys", "weren", "t", "concurrently", "modified", "by", "another", "transaction", ".", "For", "read", "-", "only", "transactions", "set", "update", "to", "false", ".", "In", "this", "mode", "we", "don", "t", "track", "the", "rows", "read", "for", "any", "changes", ".", "Thus", "any", "long", "running", "iterations", "done", "in", "this", "mode", "wouldn", "t", "pay", "this", "overhead", ".", "Running", "transactions", "concurrently", "is", "OK", ".", "However", "a", "transaction", "itself", "isn", "t", "thread", "safe", "and", "should", "only", "be", "run", "serially", ".", "It", "doesn", "t", "matter", "if", "a", "transaction", "is", "created", "by", "one", "goroutine", "and", "passed", "down", "to", "other", "as", "long", "as", "the", "Txn", "APIs", "are", "called", "serially", ".", "When", "you", "create", "a", "new", "transaction", "it", "is", "absolutely", "essential", "to", "call", "Discard", "()", ".", "This", "should", "be", "done", "irrespective", "of", "what", "the", "update", "param", "is", "set", "to", ".", "Commit", "API", "internally", "runs", "Discard", "but", "running", "it", "twice", "wouldn", "t", "cause", "any", "issues", ".", "txn", ":", "=", "db", ".", "NewTransaction", "(", "false", ")", "defer", "txn", ".", "Discard", "()", "//", "Call", "various", "APIs", "." ]
[ "func", "(", "db", "*", "DB", ")", "NewTransaction", "(", "update", "bool", ")", "*", "Txn", "{", "return", "db", ".", "newTransaction", "(", "<mask>", ",", "false", ")", "\n", "}" ]
8,253
all-8254
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Cache", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoHar15", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,254
all-8255
[ "GetCookie", "returns", "given", "cookie", "value", "from", "request", "header", "." ]
[ "func", "(", "ctx", "*", "Context", ")", "GetCookie", "(", "<mask>", "string", ")", "string", "{", "cookie", ",", "err", ":=", "ctx", ".", "Req", ".", "Cookie", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "val", ",", "_", ":=", "url", ".", "QueryUnescape", "(", "cookie", ".", "Value", ")", "\n", "return", "val", "\n", "}" ]
8,255
all-8256
[ "/", "*", "GetImage", "returns", "the", "image", "header", "for", "the", "matrix", "." ]
[ "func", "(", "m", "*", "Mat", ")", "GetImage", "(", "channels", "int", ")", "*", "IplImage", "{", "tmp", ":=", "CreateImage", "(", "m", ".", "Cols", "(", ")", ",", "m", ".", "Rows", "(", ")", ",", "m", ".", "<mask>", "(", ")", ",", "channels", ")", "\n", "img", ":=", "C", ".", "cvGetImage", "(", "unsafe", ".", "Pointer", "(", "m", ")", ",", "(", "*", "C", ".", "IplImage", ")", "(", "tmp", ")", ")", "\n\n", "return", "(", "*", "IplImage", ")", "(", "img", ")", "\n", "}" ]
8,256
all-8257
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventScriptFailedToParse", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger38", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
8,257
all-8258
[ "GracefulClose", "drains", "http", ".", "Response", ".", "Body", "until", "it", "hits", "EOF", "and", "closes", "it", ".", "This", "prevents", "TCP", "/", "TLS", "connections", "from", "closing", "therefore", "available", "for", "reuse", ".", "Borrowed", "from", "golang", "/", "net", "/", "context", "/", "ctxhttp", "/", "cancelreq", ".", "go", "." ]
[ "func", "GracefulClose", "(", "resp", "*", "<mask>", ".", "Response", ")", "{", "io", ".", "Copy", "(", "ioutil", ".", "Discard", ",", "resp", ".", "Body", ")", "\n", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "}" ]
8,258
all-8259
[ "return", "the", "pointer", "to", "a", "mapped", "buffer", "object", "s", "data", "store" ]
[ "func", "GetNamedBufferPointerv", "(", "buffer", "uint32", ",", "pname", "uint32", ",", "params", "*", "unsafe", ".", "Pointer", ")", "{", "C", ".", "glowGetNamedBufferPointerv", "(", "gpGetNamedBufferPointerv", ",", "(", "C", ".", "GLuint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLenum", ")", "(", "pname", ")", ",", "params", ")", "\n", "}" ]
8,259
all-8260
[ "HTTPClient", "is", "an", "option", "that", "sets", "the", "http", ".", "Client", "to", "be", "used", "when", "creating", "the", "Stackdriver", "service", "." ]
[ "func", "HTTPClient", "(", "client", "*", "http", ".", "Client", ")", "Option", "{", "return", "func", "(", "sh", "*", "StackdriverHook", ")", "error", "{", "// create logging service", "l", ",", "err", ":=", "logging", ".", "New", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// create error reporting service", "e", ",", "err", ":=", "errorReporting", ".", "New", "(", "client", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "else", "{", "ErrorService", "(", "e", ")", "\n", "}", "\n\n", "return", "LoggingService", "(", "l", ")", "(", "sh", ")", "\n", "}", "\n", "}" ]
8,260
all-8261
[ "EncodeRune", "writes", "into", "p", "(", "which", "must", "be", "large", "enough", ")", "the", "CESU", "-", "8", "encoding", "of", "the", "rune", ".", "It", "returns", "the", "number", "of", "bytes", "written", "." ]
[ "func", "EncodeRune", "(", "p", "[", "]", "<mask>", ",", "r", "rune", ")", "int", "{", "if", "r", "<=", "rune3Max", "{", "return", "encodeRune", "(", "p", ",", "r", ")", "\n", "}", "\n", "high", ",", "low", ":=", "utf16", ".", "EncodeRune", "(", "r", ")", "\n", "n", ":=", "encodeRune", "(", "p", ",", "high", ")", "\n", "n", "+=", "encodeRune", "(", "p", "[", "n", ":", "]", ",", "low", ")", "\n", "return", "n", "\n", "}" ]
8,261
all-8262
[ "SameKey", "checks", "for", "key", "equality", "ignoring", "the", "version", "timestamp", "suffix", "." ]
[ "func", "SameKey", "(", "src", ",", "dst", "[", "]", "<mask>", ")", "bool", "{", "if", "len", "(", "src", ")", "!=", "len", "(", "dst", ")", "{", "return", "false", "\n", "}", "\n", "return", "bytes", ".", "Equal", "(", "ParseKey", "(", "src", ")", ",", "ParseKey", "(", "dst", ")", ")", "\n", "}" ]
8,262
all-8263
[ "Do", "executes", "ServiceWorker", ".", "deliverPushMessage", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "DeliverPushMessageParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandDeliverPushMessage", ",", "p", ",", "nil", ")", "\n", "}" ]
8,263
all-8264
[ "SetBoolean", "is", "a", "wrapper", "around", "g_settings_set_boolean", "()", "." ]
[ "func", "(", "v", "*", "Settings", ")", "SetBoolean", "(", "<mask>", "string", ",", "value", "bool", ")", "bool", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "name", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n\n", "return", "gobool", "(", "C", ".", "g_settings_set_boolean", "(", "v", ".", "native", "(", ")", ",", "cstr1", ",", "gbool", "(", "value", ")", ")", ")", "\n", "}" ]
8,264
all-8265
[ "Queryer", "implements", "the", "database", "/", "sql", "/", "driver", "/", "Queryer", "interface", ".", "delete", "after", "go", "1", ".", "9", "compatibility", "is", "given", "up", "." ]
[ "func", "(", "c", "*", "conn", ")", "Query", "(", "query", "string", ",", "args", "[", "]", "driver", ".", "<mask>", ")", "(", "driver", ".", "Rows", ",", "error", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}" ]
8,265
all-8266
[ "Execute", "-", "Copy", "the", "output", "from", "a", "command", "to", "the", "specified", "io", ".", "Writer" ]
[ "func", "(", "executor", "*", "DefaultRemoteExecutor", ")", "Execute", "(", "<mask>", "io", ".", "Writer", ",", "command", "string", ")", "(", "err", "error", ")", "{", "var", "session", "SSHSession", "\n", "var", "stdoutReader", "io", ".", "Reader", "\n\n", "if", "executor", ".", "once", ".", "Do", "(", "executor", ".", "LazyClientDial", ")", ";", "executor", ".", "Client", "!=", "nil", "{", "session", ",", "err", "=", "executor", ".", "Client", ".", "NewSession", "(", ")", "\n", "defer", "session", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "stdoutReader", ",", "err", "=", "session", ".", "StdoutPipe", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "err", "=", "session", ".", "Start", "(", "command", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "_", ",", "err", "=", "io", ".", "Copy", "(", "dest", ",", "stdoutReader", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "err", "=", "session", ".", "Wait", "(", ")", "\n", "}", "else", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "lo", ".", "G", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "return", "\n", "}" ]
8,266
all-8267
[ "removedBlockingPresubmits", "determines", "stale", "blocking", "presubmits", "based", "on", "a", "config", "update", ".", "Presubmits", "that", "are", "no", "longer", "blocking", "due", "to", "no", "longer", "reporting", "or", "being", "optional", "require", "no", "action", "as", "Tide", "will", "honor", "those", "statuses", "correctly", "." ]
[ "func", "removedBlockingPresubmits", "(", "old", ",", "new", "map", "[", "string", "]", "[", "]", "config", ".", "Presubmit", ")", "map", "[", "string", "]", "[", "]", "config", ".", "Presubmit", "{", "removed", ":=", "map", "[", "string", "]", "[", "]", "config", ".", "Presubmit", "{", "}", "\n\n", "for", "repo", ",", "oldPresubmits", ":=", "range", "old", "{", "removed", "[", "repo", "]", "=", "[", "]", "config", ".", "Presubmit", "{", "}", "\n", "for", "_", ",", "oldPresubmit", ":=", "range", "oldPresubmits", "{", "if", "!", "oldPresubmit", ".", "ContextRequired", "(", ")", "{", "continue", "\n", "}", "\n", "var", "found", "bool", "\n", "for", "_", ",", "newPresubmit", ":=", "range", "new", "[", "repo", "]", "{", "if", "oldPresubmit", ".", "Name", "==", "newPresubmit", ".", "Name", "{", "found", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "!", "found", "{", "removed", "[", "repo", "]", "=", "append", "(", "removed", "[", "repo", "]", ",", "oldPresubmit", ")", "\n", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "repo", ",", "\"", "\"", ":", "oldPresubmit", ".", "Name", ",", "}", ")", ".", "Debug", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "<mask>", "numRemoved", "int", "\n", "for", "_", ",", "presubmits", ":=", "range", "removed", "{", "numRemoved", "+=", "len", "(", "presubmits", ")", "\n", "}", "\n", "logrus", ".", "Infof", "(", "\"", "\"", ",", "numRemoved", ")", "\n", "return", "removed", "\n", "}" ]
8,267
all-8268
[ "HavePrefix", "succeeds", "if", "actual", "is", "a", "string", "or", "stringer", "that", "contains", "the", "passed", "-", "in", "string", "as", "a", "prefix", ".", "Optional", "arguments", "can", "be", "provided", "to", "construct", "via", "fmt", ".", "Sprintf", "()", "." ]
[ "func", "HavePrefix", "(", "prefix", "string", ",", "args", "...", "interface", "{", "}", ")", "types", ".", "GomegaMatcher", "{", "return", "&", "matchers", ".", "HavePrefixMatcher", "{", "Prefix", ":", "<mask>", ",", "Args", ":", "args", ",", "}", "\n", "}" ]
8,268
all-8269
[ "GetTitleSize", "returns", "the", "TitleSize", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "ToplistDefinition", ")", "GetTitleSize", "(", ")", "string", "{", "if", "t", "==", "nil", "||", "t", ".", "TitleSize", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "<mask>", "*", "t", ".", "TitleSize", "\n", "}" ]
8,269
all-8270
[ "Valid", "validator" ]
[ "func", "(", "c", "*", "chainedRule", ")", "Valid", "(", "w", "<mask>", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "bool", "{", "if", "!", "c", ".", "Rule", ".", "Valid", "(", "w", ",", "r", ")", "{", "return", "false", "\n", "}", "\n", "return", "c", ".", "next", ".", "Valid", "(", "w", ",", "r", ")", "\n", "}" ]
8,270
all-8271
[ "specify", "the", "organization", "of", "vertex", "arrays" ]
[ "func", "VertexArrayAttribFormat", "(", "vaobj", "uint32", ",", "attribindex", "uint32", ",", "size", "int32", ",", "xtype", "uint32", ",", "normalized", "bool", ",", "relativeoffset", "uint32", ")", "{", "C", ".", "glowVertexArrayAttribFormat", "(", "gpVertexArrayAttribFormat", ",", "(", "C", ".", "GLuint", ")", "(", "vaobj", ")", ",", "(", "C", ".", "GLuint", ")", "(", "attribindex", ")", ",", "(", "C", ".", "GLint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLenum", ")", "(", "xtype", ")", ",", "(", "C", ".", "GLboolean", ")", "(", "boolToInt", "(", "normalized", ")", ")", ",", "(", "C", ".", "GLuint", ")", "(", "relativeoffset", ")", ")", "\n", "}" ]
8,271
all-8272
[ "RegisterStatusEventHandler", "registers", "a", "plugin", "s", "github", ".", "StatusEvent", "handler", "." ]
[ "func", "RegisterStatusEventHandler", "(", "name", "string", ",", "fn", "StatusEventHandler", ",", "help", "HelpProvider", ")", "{", "pluginHelp", "[", "name", "]", "=", "help", "\n", "statusEventHandlers", "[", "<mask>", "]", "=", "fn", "\n", "}" ]
8,272
all-8273
[ "title", ":", "event", "info", "path", ":", "/", "events", "/", "{", "uuid", "}", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "OK", "400", ":", "Invalid", "uuid", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "eventInfo", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "<mask>", ")", "error", "{", "uuid", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "!", "bson", ".", "IsObjectIdHex", "(", "uuid", ")", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "uuid", ")", "\n", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "msg", "}", "\n", "}", "\n", "objID", ":=", "bson", ".", "ObjectIdHex", "(", "uuid", ")", "\n", "e", ",", "err", ":=", "event", ".", "GetByID", "(", "objID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "scheme", ",", "err", ":=", "permission", ".", "SafeGet", "(", "e", ".", "Allowed", ".", "Scheme", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "scheme", ",", "e", ".", "Allowed", ".", "Contexts", "...", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "e", ")", "\n", "}" ]
8,273
all-8274
[ "generate", "query", "object", "names" ]
[ "func", "GenQueries", "(", "n", "int32", ",", "ids", "*", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpGenQueries", ",", "2", ",", "uintptr", "(", "n", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ",", "0", ")", "\n", "}" ]
8,274
all-8275
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "DeleteCacheParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCachestorage8", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,275
all-8276
[ "Create", "a", "message", "with", "the", "given", "url", ".", "Values", ".", "For", "more", "information", "on", "valid", "values", "see", "https", ":", "//", "www", ".", "twilio", ".", "com", "/", "docs", "/", "api", "/", "rest", "/", "sending", "-", "messages", "or", "use", "the", "SendMessage", "helper", "." ]
[ "func", "(", "m", "*", "MessageService", ")", "Create", "(", "ctx", "context", ".", "Context", ",", "data", "url", ".", "Values", ")", "(", "*", "Message", ",", "error", ")", "{", "msg", ":=", "<mask>", "(", "Message", ")", "\n", "err", ":=", "m", ".", "client", ".", "CreateResource", "(", "ctx", ",", "messagesPathPart", ",", "data", ",", "msg", ")", "\n", "return", "msg", ",", "err", "\n", "}" ]
8,276
all-8277
[ "ReadEnvelope", "is", "a", "wrapper", "around", "ReadParts", "and", "EnvelopeFromPart", ".", "It", "parses", "the", "content", "of", "the", "provided", "reader", "into", "an", "Envelope", "downconverting", "HTML", "to", "plain", "text", "if", "needed", "and", "sorting", "the", "attachments", "inlines", "and", "other", "parts", "into", "their", "respective", "slices", ".", "Errors", "are", "collected", "from", "all", "Parts", "and", "placed", "into", "the", "Envelope", ".", "Errors", "slice", "." ]
[ "func", "ReadEnvelope", "(", "r", "io", ".", "Reader", ")", "(", "*", "Envelope", ",", "error", ")", "{", "// Read MIME parts from reader", "root", ",", "err", ":=", "ReadParts", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "WithMessage", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "EnvelopeFromPart", "(", "<mask>", ")", "\n", "}" ]
8,277
all-8278
[ "ParseTagJSON", "is", "similar", "to", "ParseTag", "but", "only", "supports", "features", "supported", "by", "the", "standard", "encoding", "/", "json", "package", "." ]
[ "func", "ParseTagJSON", "(", "s", "string", ")", "Tag", "{", "<mask>", "name", "string", "\n", "var", "omitempty", "bool", "\n\n", "name", ",", "s", "=", "parseNextTagToken", "(", "s", ")", "\n\n", "for", "len", "(", "s", ")", "!=", "0", "{", "var", "token", "string", "\n", "switch", "token", ",", "s", "=", "parseNextTagToken", "(", "s", ")", ";", "token", "{", "case", "\"", "\"", ":", "omitempty", "=", "true", "\n", "}", "\n", "}", "\n\n", "return", "Tag", "{", "Name", ":", "name", ",", "Omitempty", ":", "omitempty", ",", "}", "\n", "}" ]
8,278
all-8279
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "ButtonType", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "<mask>", ")", "{", "out", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
8,279
all-8280
[ "Setup", "the", "Management", "services", "." ]
[ "func", "(", "s", "*", "ServiceManager", ")", "Setup", "(", ")", "{", "log", ".", "Println", "(", "\"", "\"", ")", "\n\n", "s", ".", "commandCreatedChan", "=", "make", "(", "chan", "*", "exec", ".", "Cmd", ")", "\n", "s", ".", "commandCompleteChan", "=", "make", "(", "chan", "*", "exec", ".", "Cmd", ")", "\n", "s", ".", "processMap", "=", "processMap", "{", "processes", ":", "make", "(", "map", "[", "int", "]", "*", "exec", ".", "Cmd", ")", "}", "\n\n", "// Listen for service create/kill", "go", "s", ".", "addServiceMonitor", "(", ")", "\n", "<mask>", "s", ".", "removeServiceMonitor", "(", ")", "\n", "}" ]
8,280
all-8281
[ "SetTabDetachable", "()", "is", "a", "wrapper", "around", "gtk_notebook_set_tab_detachable", "()", "." ]
[ "func", "(", "v", "*", "Notebook", ")", "SetTabDetachable", "(", "<mask>", "IWidget", ",", "detachable", "bool", ")", "{", "C", ".", "gtk_notebook_set_tab_detachable", "(", "v", ".", "native", "(", ")", ",", "child", ".", "toWidget", "(", ")", ",", "gbool", "(", "detachable", ")", ")", "\n", "}" ]
8,281
all-8282
[ "GetSort", "returns", "the", "Sort", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "a", "*", "ApmOrLogQueryGroupBy", ")", "GetSort", "(", ")", "ApmOrLogQueryGroupBySort", "{", "if", "a", "==", "nil", "||", "a", ".", "Sort", "==", "nil", "{", "return", "ApmOrLogQueryGroupBySort", "{", "}", "\n", "}", "\n", "<mask>", "*", "a", ".", "Sort", "\n", "}" ]
8,282
all-8283
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventJavascriptDialogClosed", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage57", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,283
all-8284
[ "GetIndex", "finds", "the", "index", "of", "the", "words", "to", "create", "bytes", "Generates", "a", "map", "the", "first", "time", "it", "is", "loaded", "to", "avoid", "needless", "computation", "when", "list", "is", "not", "used", "." ]
[ "func", "(", "c", "*", "WordCodec", ")", "GetIndex", "(", "word", "string", ")", "(", "int", ",", "error", ")", "{", "// generate the first time", "if", "c", ".", "bytes", "==", "nil", "{", "b", ":=", "map", "[", "string", "]", "int", "{", "}", "\n", "for", "i", ",", "w", ":=", "<mask>", "c", ".", "words", "{", "if", "_", ",", "ok", ":=", "b", "[", "w", "]", ";", "ok", "{", "return", "-", "1", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "w", ")", "\n", "}", "\n", "b", "[", "w", "]", "=", "i", "\n", "}", "\n", "c", ".", "bytes", "=", "b", "\n", "}", "\n\n", "// get the index, or an error", "rem", ",", "ok", ":=", "c", ".", "bytes", "[", "word", "]", "\n", "if", "!", "ok", "{", "return", "-", "1", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "word", ")", "\n", "}", "\n", "return", "rem", ",", "nil", "\n", "}" ]
8,284
all-8285
[ "GetHeader", "processes", "the", "specified", "header", "for", "RFC", "2047", "encoded", "words", "and", "returns", "the", "result", "as", "a", "UTF", "-", "8", "string" ]
[ "func", "(", "e", "*", "Envelope", ")", "GetHeader", "(", "<mask>", "string", ")", "string", "{", "if", "e", ".", "header", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "decodeHeader", "(", "e", ".", "header", ".", "Get", "(", "name", ")", ")", "\n", "}" ]
8,285
all-8286
[ "Do", "executes", "IndexedDB", ".", "requestDatabaseNames", "against", "the", "provided", "context", ".", "returns", ":", "databaseNames", "-", "Database", "names", "for", "origin", "." ]
[ "func", "(", "p", "*", "RequestDatabaseNamesParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "databaseNames", "[", "]", "string", ",", "err", "error", ")", "{", "// execute", "var", "<mask>", "RequestDatabaseNamesReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandRequestDatabaseNames", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "DatabaseNames", ",", "nil", "\n", "}" ]
8,286
all-8287
[ "MapSlice", "applies", "a", "function", "that", "processes", "slices", "of", "strings", "to", "the", "strings", "in", "ps", "and", "returns", "a", "new", "PlatformStrings", "with", "the", "results", "." ]
[ "func", "(", "ps", "*", "PlatformStrings", ")", "MapSlice", "(", "f", "func", "(", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", ")", "(", "PlatformStrings", ",", "[", "]", "error", ")", "{", "var", "errors", "[", "]", "error", "\n\n", "mapSlice", ":=", "func", "(", "ss", "[", "]", "string", ")", "[", "]", "string", "{", "rs", ",", "err", ":=", "f", "(", "ss", ")", "\n", "if", "err", "!=", "nil", "{", "errors", "=", "append", "(", "errors", ",", "err", ")", "\n", "return", "nil", "\n", "}", "\n", "return", "rs", "\n", "}", "\n\n", "mapStringMap", ":=", "func", "(", "m", "map", "[", "string", "]", "[", "]", "string", ")", "map", "[", "string", "]", "[", "]", "string", "{", "if", "m", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "rm", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "string", ")", "\n", "for", "k", ",", "ss", ":=", "range", "m", "{", "ss", "=", "mapSlice", "(", "ss", ")", "\n", "if", "len", "(", "ss", ")", ">", "0", "{", "rm", "[", "k", "]", "=", "ss", "\n", "}", "\n", "}", "\n", "if", "len", "(", "rm", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "return", "rm", "\n", "}", "\n\n", "mapPlatformMap", ":=", "func", "(", "m", "map", "[", "Platform", "]", "[", "]", "string", ")", "map", "[", "Platform", "]", "[", "]", "string", "{", "if", "m", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "rm", ":=", "make", "(", "map", "[", "Platform", "]", "[", "]", "string", ")", "\n", "for", "k", ",", "ss", ":=", "range", "m", "{", "ss", "=", "mapSlice", "(", "ss", ")", "\n", "if", "len", "(", "ss", ")", ">", "0", "{", "rm", "[", "k", "]", "=", "ss", "\n", "}", "\n", "}", "\n", "if", "len", "(", "rm", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "return", "rm", "\n", "}", "\n\n", "result", ":=", "PlatformStrings", "{", "Generic", ":", "mapSlice", "(", "ps", ".", "Generic", ")", ",", "OS", ":", "mapStringMap", "(", "ps", ".", "OS", ")", ",", "Arch", ":", "mapStringMap", "(", "ps", ".", "Arch", ")", ",", "<mask>", ":", "mapPlatformMap", "(", "ps", ".", "Platform", ")", ",", "}", "\n", "return", "result", ",", "errors", "\n", "}" ]
8,287
all-8288
[ "SetContentType", "sets", "response", "Content", "-", "Type", "." ]
[ "func", "(", "ctx", "*", "RequestCtx", ")", "SetContentType", "(", "contentType", "string", ")", "{", "ctx", ".", "<mask>", ".", "Header", ".", "SetContentType", "(", "contentType", ")", "\n", "}" ]
8,288
all-8289
[ "Read", "reads", "the", "value", "log", "at", "a", "given", "location", ".", "TODO", ":", "Make", "this", "read", "private", "." ]
[ "func", "(", "vlog", "*", "valueLog", ")", "Read", "(", "vp", "valuePointer", ",", "s", "*", "y", ".", "Slice", ")", "(", "[", "]", "byte", ",", "func", "(", ")", ",", "error", ")", "{", "// Check for valid offset if we are reading to writable log.", "maxFid", ":=", "atomic", ".", "LoadUint32", "(", "&", "vlog", ".", "maxFid", ")", "\n", "if", "vp", ".", "Fid", "==", "maxFid", "&&", "vp", ".", "Offset", ">=", "vlog", ".", "woffset", "(", ")", "{", "return", "nil", ",", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "vp", ".", "Offset", ",", "vlog", ".", "woffset", "(", ")", ")", "\n", "}", "\n\n", "buf", ",", "cb", ",", "err", ":=", "vlog", ".", "readValueBytes", "(", "vp", ",", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "cb", ",", "err", "\n", "}", "\n", "var", "h", "<mask>", "\n", "h", ".", "Decode", "(", "buf", ")", "\n", "n", ":=", "uint32", "(", "headerBufSize", ")", "+", "h", ".", "klen", "\n", "return", "buf", "[", "n", ":", "n", "+", "h", ".", "vlen", "]", ",", "cb", ",", "nil", "\n", "}" ]
8,289
all-8290
[ "Warnf", "formats", "message", "according", "to", "format", "specifier", "prepends", "the", "prefix", "as", "necessary", "and", "writes", "to", "log", "with", "LevelWarn", ".", "This", "is", "part", "of", "the", "Logger", "interface", "implementation", "." ]
[ "func", "(", "l", "*", "slog", ")", "Warnf", "(", "format", "string", ",", "args", "...", "<mask>", "{", "}", ")", "{", "lvl", ":=", "l", ".", "Level", "(", ")", "\n", "if", "lvl", "<=", "LevelWarn", "{", "l", ".", "b", ".", "printf", "(", "\"", "\"", ",", "l", ".", "tag", ",", "format", ",", "args", "...", ")", "\n", "}", "\n", "}" ]
8,290
all-8291
[ "Compose", "is", "a", "short", "-", "hand", "for", "chaining", "the", "specified", "middleware", "and", "handler", "together", "." ]
[ "func", "Compose", "(", "chain", "...", "interface", "{", "}", ")", "http", ".", "Handler", "{", "// check length", "if", "len", "(", "chain", ")", "<", "2", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// get handler", "h", ",", "ok", ":=", "chain", "[", "len", "(", "chain", ")", "-", "1", "]", ".", "(", "http", ".", "Handler", ")", "\n", "if", "!", "ok", "{", "panic", "(", "`fire: expected last chain item to be a \"http.Handler\"`", ")", "\n", "}", "\n\n", "// chain all middleware", "for", "i", ":=", "len", "(", "chain", ")", "-", "2", ";", "i", ">=", "0", ";", "i", "--", "{", "// get middleware", "m", ",", "ok", ":=", "chain", "[", "i", "]", ".", "(", "func", "(", "http", ".", "<mask>", ")", "http", ".", "Handler", ")", "\n", "if", "!", "ok", "{", "panic", "(", "`fire: expected intermediary chain item to be a \"func(http.handler) http.Handler\"`", ")", "\n", "}", "\n\n", "// chain", "h", "=", "m", "(", "h", ")", "\n", "}", "\n\n", "return", "h", "\n", "}" ]
8,291
all-8292
[ "SetPullSucceeded", "sets", "the", "PullSucceeded", "of", "the", "imageState" ]
[ "func", "(", "imageState", "*", "ImageState", ")", "SetPullSucceeded", "(", "pullSucceeded", "bool", ")", "{", "imageState", ".", "<mask>", ".", "Lock", "(", ")", "\n", "defer", "imageState", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "imageState", ".", "PullSucceeded", "=", "pullSucceeded", "\n", "}" ]
8,292
all-8293
[ "Flatten", "flattens", "the", "StructErrors", "hierarchical", "structure", "into", "a", "flat", "namespace", "style", "field", "name", "for", "those", "that", "want", "/", "need", "it" ]
[ "func", "(", "e", "*", "StructErrors", ")", "Flatten", "(", ")", "map", "[", "string", "]", "*", "FieldError", "{", "if", "e", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "errs", ":=", "map", "[", "string", "]", "*", "FieldError", "{", "}", "\n\n", "for", "_", ",", "f", ":=", "range", "e", ".", "Errors", "{", "if", "flat", ":=", "f", ".", "Flatten", "(", ")", ";", "flat", "!=", "nil", "&&", "len", "(", "flat", ")", ">", "0", "{", "for", "k", ",", "fe", ":=", "range", "flat", "{", "if", "f", ".", "IsPlaceholderErr", "{", "errs", "[", "f", ".", "Field", "+", "k", "]", "=", "fe", "\n", "}", "else", "{", "errs", "[", "k", "]", "=", "fe", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "for", "key", ",", "val", ":=", "range", "e", ".", "StructErrors", "{", "otherErrs", ":=", "val", ".", "Flatten", "(", ")", "\n\n", "for", "_", ",", "f2", ":=", "range", "otherErrs", "{", "f2", ".", "Field", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ",", "f2", ".", "Field", ")", "\n", "errs", "[", "f2", ".", "Field", "]", "=", "f2", "\n", "}", "\n", "}", "\n\n", "return", "errs", "\n", "}" ]
8,293
all-8294
[ "Iter", "executes", "the", "pipeline", "and", "returns", "an", "iterator", "capable", "of", "going", "over", "all", "the", "generated", "results", "." ]
[ "func", "(", "p", "*", "Pipe", ")", "Iter", "(", ")", "*", "Iter", "{", "// Clone session and set it to Monotonic mode so that the server", "// used for the query may be safely obtained afterwards, if", "// necessary for iteration when a cursor is received.", "cloned", ":=", "p", ".", "session", ".", "Clone", "(", ")", "\n", "cloned", ".", "SetMode", "(", "Monotonic", ",", "false", ")", "\n", "defer", "cloned", ".", "Close", "(", ")", "\n", "c", ":=", "p", ".", "collection", ".", "With", "(", "cloned", ")", "\n\n", "var", "result", "struct", "{", "// 2.4, no cursors.", "Result", "[", "]", "bson", ".", "Raw", "\n\n", "// 2.6+, with cursors.", "Cursor", "struct", "{", "FirstBatch", "[", "]", "bson", ".", "Raw", "\"", "\"", "\n", "Id", "int64", "\n", "}", "\n", "}", "\n\n", "cmd", ":=", "pipeCmd", "{", "Aggregate", ":", "c", ".", "Name", ",", "Pipeline", ":", "p", ".", "pipeline", ",", "AllowDisk", ":", "p", ".", "allowDisk", ",", "Cursor", ":", "&", "pipeCmdCursor", "{", "p", ".", "batchSize", "}", ",", "}", "\n", "err", ":=", "c", ".", "<mask>", ".", "Run", "(", "cmd", ",", "&", "result", ")", "\n", "if", "e", ",", "ok", ":=", "err", ".", "(", "*", "QueryError", ")", ";", "ok", "&&", "e", ".", "Message", "==", "`unrecognized field \"cursor`", "{", "cmd", ".", "Cursor", "=", "nil", "\n", "cmd", ".", "AllowDisk", "=", "false", "\n", "err", "=", "c", ".", "Database", ".", "Run", "(", "cmd", ",", "&", "result", ")", "\n", "}", "\n", "firstBatch", ":=", "result", ".", "Result", "\n", "if", "firstBatch", "==", "nil", "{", "firstBatch", "=", "result", ".", "Cursor", ".", "FirstBatch", "\n", "}", "\n", "return", "c", ".", "NewIter", "(", "p", ".", "session", ",", "firstBatch", ",", "result", ".", "Cursor", ".", "Id", ",", "err", ")", "\n", "}" ]
8,294
all-8295
[ "DumpByteCode", "sets", "the", "bitmask", "for", "DumpByteCode", "debug", "flag" ]
[ "func", "(", "f", "*", "Flags", ")", "DumpByteCode", "(", "b", "bool", ")", "{", "if", "b", "{", "f", ".", "flags", "|=", "MaskDumpByteCode", "\n", "}", "else", "{", "f", ".", "<mask>", "&=", "^", "MaskDumpByteCode", "\n", "}", "\n", "}" ]
8,295
all-8296
[ "FileGetLastLine", "reads", "the", "last", "line", "from", "a", "file", ".", "In", "case", "of", "a", "network", "file", "the", "whole", "file", "is", "read", ".", "In", "case", "of", "a", "local", "file", "the", "last", "64kb", "are", "read", "so", "if", "the", "last", "line", "is", "longer", "than", "64kb", "it", "is", "not", "returned", "completely", ".", "The", "first", "optional", "timeout", "is", "used", "for", "network", "files", "only", "." ]
[ "func", "FileGetLastLine", "(", "filenameOrURL", "string", ",", "timeout", "...", "time", ".", "Duration", ")", "(", "line", "string", ",", "err", "error", ")", "{", "if", "strings", ".", "Index", "(", "filenameOrURL", ",", "\"", "\"", ")", "==", "0", "{", "return", "FileGetLastLine", "(", "filenameOrURL", "[", "len", "(", "\"", "\"", ")", ":", "]", ")", "\n", "}", "\n", "var", "<mask>", "[", "]", "byte", "\n", "if", "strings", ".", "Contains", "(", "filenameOrURL", ",", "\"", "\"", ")", "{", "data", ",", "err", "=", "FileGetBytes", "(", "filenameOrURL", ",", "timeout", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "}", "else", "{", "file", ",", "err", ":=", "os", ".", "Open", "(", "filenameOrURL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "defer", "file", ".", "Close", "(", ")", "\n", "info", ",", "err", ":=", "file", ".", "Stat", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "if", "start", ":=", "info", ".", "Size", "(", ")", "-", "64", "*", "1024", ";", "start", ">", "0", "{", "file", ".", "Seek", "(", "start", ",", "os", ".", "SEEK_SET", ")", "\n", "}", "\n", "data", ",", "err", "=", "ioutil", ".", "ReadAll", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "}", "\n", "pos", ":=", "bytes", ".", "LastIndex", "(", "data", ",", "[", "]", "byte", "{", "'\\n'", "}", ")", "\n", "return", "string", "(", "data", "[", "pos", "+", "1", ":", "]", ")", ",", "nil", "\n", "}" ]
8,296
all-8297
[ "NewThrottle", "creates", "a", "new", "throttle", "with", "a", "max", "number", "of", "workers", "." ]
[ "func", "NewThrottle", "(", "max", "int", ")", "*", "Throttle", "{", "return", "&", "Throttle", "{", "ch", ":", "make", "(", "chan", "struct", "{", "}", ",", "max", ")", ",", "errCh", ":", "make", "(", "chan", "error", ",", "<mask>", ")", ",", "}", "\n", "}" ]
8,297
all-8298
[ "WriteHeader", "writes", "the", "generic", "header", "text", "." ]
[ "func", "(", "c", "*", "MetadataWriter", ")", "WriteHeader", "(", "pkg", "string", ",", "w", "<mask>", ".", "Writer", ")", "error", "{", "return", "c", ".", "headerTmpl", ".", "Execute", "(", "w", ",", "pkg", ")", "\n", "}" ]
8,298
all-8299
[ "WriteTo", "writes", "full", "uri", "to", "w", ".", "WriteTo", "implements", "io", ".", "WriterTo", "interface", "." ]
[ "func", "(", "u", "*", "URI", ")", "WriteTo", "(", "w", "io", ".", "<mask>", ")", "(", "int64", ",", "error", ")", "{", "n", ",", "err", ":=", "w", ".", "Write", "(", "u", ".", "FullURI", "(", ")", ")", "\n", "return", "int64", "(", "n", ")", ",", "err", "\n", "}" ]
8,299
all-8300
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "NavigateReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage26", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]