id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
2,600
all-2601
[ "GetStat", "provides", "needed", "subset", "of", "FileInfo", "plus", "RealSize", "Atime", "(", "if", "any", ")", "and", "Ctime", "(", "if", "any", ")" ]
[ "func", "GetStat", "(", "i", "<mask>", ".", "FileInfo", ")", "FileStats", "{", "res", ":=", "FileStats", "{", "Size", ":", "i", ".", "Size", "(", ")", ",", "MTime", ":", "i", ".", "ModTime", "(", ")", ".", "Unix", "(", ")", ",", "CTime", ":", "i", ".", "ModTime", "(", ")", ".", "Unix", "(", ")", ",", "}", "\n\n", "s", ":=", "i", ".", "Sys", "(", ")", ".", "(", "*", "syscall", ".", "Stat_t", ")", "\n", "if", "s", "!=", "nil", "{", "res", ".", "RealSize", "=", "s", ".", "Blocks", "*", "512", "\n", "}", "\n\n", "return", "res", "\n", "}" ]
2,601
all-2602
[ "CompressHandlerLevel", "returns", "RequestHandler", "that", "transparently", "compresses", "response", "body", "generated", "by", "h", "if", "the", "request", "contains", "gzip", "or", "deflate", "Accept", "-", "Encoding", "header", ".", "Level", "is", "the", "desired", "compression", "level", ":", "*", "CompressNoCompression", "*", "CompressBestSpeed", "*", "CompressBestCompression", "*", "CompressDefaultCompression", "*", "CompressHuffmanOnly" ]
[ "func", "CompressHandlerLevel", "(", "h", "RequestHandler", ",", "level", "int", ")", "RequestHandler", "{", "return", "func", "(", "ctx", "*", "RequestCtx", ")", "{", "h", "(", "ctx", ")", "\n", "if", "ctx", ".", "Request", ".", "Header", ".", "HasAcceptEncodingBytes", "(", "strGzip", ")", "{", "ctx", ".", "Response", ".", "gzipBody", "(", "level", ")", "\n", "}", "else", "if", "ctx", ".", "Request", ".", "Header", ".", "HasAcceptEncodingBytes", "(", "strDeflate", ")", "{", "ctx", ".", "Response", ".", "deflateBody", "(", "<mask>", ")", "\n", "}", "\n", "}", "\n", "}" ]
2,602
all-2603
[ "Me", "returns", "information", "about", "the", "current", "user" ]
[ "func", "(", "c", "*", "Client", ")", "Me", "(", ")", "(", "*", "User", ",", "error", ")", "{", "user", ":=", "&", "<mask>", "{", "}", "\n\n", "err", ":=", "c", ".", "request", "(", "\"", "\"", ",", "\"", "\"", ",", "user", ",", "nil", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "user", ",", "nil", "\n", "}" ]
2,603
all-2604
[ "TeeReader", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockFileSystem", ")", "TeeReader", "(", "arg0", "<mask>", ".", "Reader", ",", "arg1", "io", ".", "Writer", ")", "io", ".", "Reader", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "io", ".", "Reader", ")", "\n", "return", "ret0", "\n", "}" ]
2,604
all-2605
[ "Calculates", "the", "key", "and", "iv", "for", "AES", "decryption", "given", "a", "password", "and", "salt", "." ]
[ "func", "calcAes30Params", "(", "pass", "[", "]", "uint16", ",", "salt", "[", "]", "byte", ")", "(", "key", ",", "iv", "[", "]", "byte", ")", "{", "p", ":=", "make", "(", "[", "]", "byte", ",", "0", ",", "len", "(", "pass", ")", "*", "2", "+", "len", "(", "salt", ")", ")", "\n", "for", "_", ",", "v", ":=", "range", "pass", "{", "p", "=", "<mask>", "(", "p", ",", "byte", "(", "v", ")", ",", "byte", "(", "v", ">>", "8", ")", ")", "\n", "}", "\n", "p", "=", "append", "(", "p", ",", "salt", "...", ")", "\n\n", "hash", ":=", "sha1", ".", "New", "(", ")", "\n", "iv", "=", "make", "(", "[", "]", "byte", ",", "16", ")", "\n", "s", ":=", "make", "(", "[", "]", "byte", ",", "0", ",", "hash", ".", "Size", "(", ")", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "hashRounds", ";", "i", "++", "{", "hash", ".", "Write", "(", "p", ")", "\n", "hash", ".", "Write", "(", "[", "]", "byte", "{", "byte", "(", "i", ")", ",", "byte", "(", "i", ">>", "8", ")", ",", "byte", "(", "i", ">>", "16", ")", "}", ")", "\n", "if", "i", "%", "(", "hashRounds", "/", "16", ")", "==", "0", "{", "s", "=", "hash", ".", "Sum", "(", "s", "[", ":", "0", "]", ")", "\n", "iv", "[", "i", "/", "(", "hashRounds", "/", "16", ")", "]", "=", "s", "[", "4", "*", "4", "+", "3", "]", "\n", "}", "\n", "}", "\n", "key", "=", "hash", ".", "Sum", "(", "s", "[", ":", "0", "]", ")", "\n", "key", "=", "key", "[", ":", "16", "]", "\n\n", "for", "k", ":=", "key", ";", "len", "(", "k", ")", ">=", "4", ";", "k", "=", "k", "[", "4", ":", "]", "{", "k", "[", "0", "]", ",", "k", "[", "1", "]", ",", "k", "[", "2", "]", ",", "k", "[", "3", "]", "=", "k", "[", "3", "]", ",", "k", "[", "2", "]", ",", "k", "[", "1", "]", ",", "k", "[", "0", "]", "\n", "}", "\n", "return", "key", ",", "iv", "\n", "}" ]
2,605
all-2606
[ "/", "*", "polymorph", "RoutesWrapper", "error", "false", "/", "*", "polymorph", "RoutesWrapper", "routes", "false", "Validate", "validates", "this", "routes", "wrapper" ]
[ "func", "(", "m", "*", "RoutesWrapper", ")", "Validate", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "res", "[", "]", "error", "\n\n", "if", "err", ":=", "m", ".", "validateError", "(", "formats", ")", ";", "err", "!=", "nil", "{", "// prop", "res", "=", "append", "(", "res", ",", "err", ")", "\n", "}", "\n\n", "if", "err", ":=", "m", ".", "validateRoutes", "(", "formats", ")", ";", "err", "!=", "nil", "{", "// prop", "res", "=", "append", "(", "res", ",", "err", ")", "\n", "}", "\n\n", "if", "len", "(", "res", ")", ">", "0", "{", "return", "<mask>", ".", "CompositeValidationError", "(", "res", "...", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,606
all-2607
[ "----------------------------------------", "Misc", "." ]
[ "func", "isExported", "(", "field", "reflect", ".", "StructField", ")", "bool", "{", "// Test 1:", "if", "field", ".", "PkgPath", "!=", "\"", "\"", "{", "return", "false", "\n", "}", "\n", "// Test 2:", "var", "first", "rune", "\n", "for", "_", ",", "c", ":=", "range", "field", ".", "Name", "{", "first", "=", "c", "\n", "break", "\n", "}", "\n", "// TODO: JAE: I'm not sure that the unicode spec", "// is the correct spec to use, so this might be wrong.", "if", "!", "unicode", ".", "IsUpper", "(", "<mask>", ")", "{", "return", "false", "\n", "}", "\n", "// Ok, it's exported.", "return", "true", "\n", "}" ]
2,607
all-2608
[ "ParseConfig", "reads", "data", "stored", "in", "given", "config", "path", "In", ":", "configPath", "-", "path", "to", "the", "config", "file", "Out", ":", "A", "list", "of", "ResourceConfig", "object", "on", "success", "or", "nil", "on", "error", "." ]
[ "func", "ParseConfig", "(", "configPath", "string", ")", "(", "[", "]", "common", ".", "ResourcesConfig", ",", "error", ")", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "configPath", ")", ";", "os", ".", "IsNotExist", "(", "err", ")", "{", "return", "nil", ",", "err", "\n", "}", "\n", "file", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "configPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "<mask>", "data", "common", ".", "MasonConfig", "\n", "err", "=", "yaml", ".", "Unmarshal", "(", "file", ",", "&", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "data", ".", "Configs", ",", "nil", "\n", "}" ]
2,608
all-2609
[ "NewWriter", "-", "get", "a", "new", "s3", "writer" ]
[ "func", "(", "s", "*", "S3Bucket", ")", "NewWriter", "(", "path", "string", ")", "(", "<mask>", ".", "WriteCloser", ",", "error", ")", "{", "return", "s", ".", "bucket", ".", "PutWriter", "(", "path", ",", "nil", ",", "nil", ")", "\n", "}" ]
2,609
all-2610
[ "MoveProjectCard", "moves", "a", "specific", "project", "card", "to", "a", "specified", "column", "in", "the", "same", "project" ]
[ "func", "(", "f", "*", "FakeClient", ")", "MoveProjectCard", "(", "projectCardID", "int", ",", "newColumnID", "int", ")", "error", "{", "// Remove project card from old column", "newCards", ":=", "[", "]", "github", ".", "ProjectCard", "{", "}", "\n", "oldColumnID", ":=", "-", "1", "\n", "projectCard", ":=", "github", ".", "ProjectCard", "{", "}", "\n", "for", "column", ",", "cards", ":=", "range", "f", ".", "ColumnCardsMap", "{", "removalIndex", ":=", "-", "1", "\n", "for", "i", ",", "existingCard", ":=", "range", "cards", "{", "if", "existingCard", ".", "ContentID", "==", "projectCardID", "{", "oldColumnID", "=", "column", "\n", "removalIndex", "=", "i", "\n", "projectCard", "=", "existingCard", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "removalIndex", "!=", "-", "1", "{", "newCards", "=", "cards", "\n", "newCards", "[", "removalIndex", "]", "=", "newCards", "[", "len", "(", "newCards", ")", "-", "1", "]", "\n", "newCards", "=", "newCards", "[", ":", "len", "(", "newCards", ")", "-", "1", "]", "\n", "}", "\n", "}", "\n", "if", "oldColumnID", "!=", "-", "1", "{", "// Update the old column's list of project cards", "f", ".", "ColumnCardsMap", "[", "oldColumnID", "]", "=", "newCards", "\n", "}", "\n\n", "for", "project", ",", "columnIDMap", ":=", "range", "f", ".", "ColumnIDMap", "{", "if", "columnName", ",", "exists", ":=", "columnIDMap", "[", "newColumnID", "]", ";", "exists", "{", "// Add project card to new column", "f", ".", "ColumnCardsMap", "[", "newColumnID", "]", "=", "append", "(", "f", ".", "ColumnCardsMap", "[", "newColumnID", "]", ",", "projectCard", ",", ")", "\n", "f", ".", "Column", "=", "columnName", "\n", "f", ".", "Project", "=", "<mask>", "\n", "break", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,610
all-2611
[ "Glob", "executes", "a", "callback", "for", "each", "path", "that", "matches", "the", "glob", "pattern", "." ]
[ "func", "Glob", "(", "rs", "[", "]", "io", ".", "ReadCloser", ",", "<mask>", "string", ",", "f", "func", "(", "string", ",", "*", "NodeProto", ")", "error", ")", "(", "retErr", "error", ")", "{", "pattern", "=", "clean", "(", "pattern", ")", "\n", "g", ",", "err", ":=", "globlib", ".", "Compile", "(", "pattern", ",", "'/'", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errorf", "(", "MalformedGlob", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "return", "nodes", "(", "rs", ",", "func", "(", "path", "string", ",", "node", "*", "NodeProto", ")", "error", "{", "if", "g", ".", "Match", "(", "path", ")", "{", "return", "f", "(", "externalDefault", "(", "path", ")", ",", "node", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
2,611
all-2612
[ "GetObject", "returns", "the", "LuaObject", "indexed", "at", "the", "sequence", "of", "subfields", "." ]
[ "func", "(", "lo", "*", "LuaObject", ")", "GetObject", "(", "subfields", "...", "interface", "{", "}", ")", "(", "*", "LuaObject", ",", "error", ")", "{", "lo", ".", "Push", "(", ")", "\n", "defer", "lo", ".", "l", ".", "Pop", "(", "1", ")", "\n", "err", ":=", "<mask>", "(", "lo", ".", "l", ",", "subfields", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "val", ":=", "NewLuaObject", "(", "lo", ".", "l", ",", "-", "1", ")", "\n", "lo", ".", "l", ".", "Pop", "(", "1", ")", "\n", "return", "val", ",", "nil", "\n", "}" ]
2,612
all-2613
[ "NewRaftLogger", "converts", "*", "zap", ".", "Logger", "to", "raft", ".", "Logger", "." ]
[ "func", "NewRaftLogger", "(", "lcfg", "*", "zap", ".", "Config", ")", "(", "raft", ".", "Logger", ",", "error", ")", "{", "if", "lcfg", "==", "nil", "{", "return", "nil", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "lg", ",", "err", ":=", "lcfg", ".", "Build", "(", "zap", ".", "AddCallerSkip", "(", "1", ")", ")", "// to annotate caller outside of \"logutil\"", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "zapRaftLogger", "{", "lg", ":", "lg", ",", "sugar", ":", "lg", ".", "Sugar", "(", ")", "}", ",", "nil", "\n", "}" ]
2,613
all-2614
[ "PrintDetailedRepoInfo", "pretty", "-", "prints", "detailed", "repo", "info", "." ]
[ "func", "PrintDetailedRepoInfo", "(", "repoInfo", "*", "PrintableRepoInfo", ")", "error", "{", "template", ",", "err", ":=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Funcs", "(", "funcMap", ")", ".", "Parse", "(", "`Name: {{.Repo.Name}}{{if .Description}}\nDescription: {{.Description}}{{end}}{{if .FullTimestamps}}\nCreated: {{.Created}}{{else}}\nCreated: {{prettyAgo .Created}}{{end}}\nSize of HEAD on master: {{prettySize .SizeBytes}}{{if .AuthInfo}}\nAccess level: {{ .AuthInfo.AccessLevel.String }}{{end}}\n`", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "template", ".", "Execute", "(", "<mask>", ".", "Stdout", ",", "repoInfo", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,614
all-2615
[ "Flush", "flushes", "all", "items", "from", "memcache", "." ]
[ "func", "Flush", "(", "c", "context", ".", "Context", ")", "error", "{", "req", ":=", "&", "pb", ".", "MemcacheFlushRequest", "{", "}", "\n", "res", ":=", "&", "<mask>", ".", "MemcacheFlushResponse", "{", "}", "\n", "return", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", "\n", "}" ]
2,615
all-2616
[ "Camel", "converts", "to", "camel", "case", "(", "foo_bar", "-", ">", "FooBar", ")" ]
[ "func", "Camel", "(", "s", "string", ")", "string", "{", "<mask>", ":=", "strings", ".", "Split", "(", "s", ",", "\"", "\"", ")", "\n", "for", "i", ":=", "range", "words", "{", "words", "[", "i", "]", "=", "Capital", "(", "words", "[", "i", "]", ")", "\n", "}", "\n", "return", "strings", ".", "Join", "(", "words", ",", "\"", "\"", ")", "\n", "}" ]
2,616
all-2617
[ "NewServer", "returns", "a", "server", "type", "that", "statisfies", "the", "http", ".", "Handler", "interface", "." ]
[ "func", "NewServer", "(", "opts", "*", "ServerOptions", ")", "*", "<mask>", "{", "server", ":=", "&", "Server", "{", "signer", ":", "opts", ".", "Signer", ",", "verifier", ":", "opts", ".", "Verifier", ",", "isProcessor", ":", "hasProcessor", "(", "opts", ")", ",", "isController", ":", "hasController", "(", "opts", ")", ",", "headers", ":", "http", ".", "Header", "{", "}", ",", "processorDomain", ":", "opts", ".", "ProcessorDomain", ",", "}", "\n", "server", ".", "headers", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "server", ".", "headers", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "hasProcessor", "(", "opts", ")", "{", "server", ".", "headers", ".", "Set", "(", "\"", "\"", ",", "opts", ".", "ProcessorDomain", ")", "\n", "}", "\n", "router", ":=", "httprouter", ".", "New", "(", ")", "\n", "hm", ":=", "buildHandlerMap", "(", "opts", ")", "\n", "for", "path", ",", "methods", ":=", "range", "hm", "{", "for", "method", ",", "builder", ":=", "range", "methods", "{", "router", ".", "Handle", "(", "method", ",", "path", ",", "server", ".", "handle", "(", "builder", "(", "opts", ")", ")", ")", "\n", "}", "\n", "}", "\n", "server", ".", "handlerFn", "=", "router", ".", "ServeHTTP", "\n", "return", "server", "\n", "}" ]
2,617
all-2618
[ "onlyUpdateStatus", "returns", "the", "response", "to", "the", "request" ]
[ "func", "onlyUpdateStatus", "(", "req", "admissionapi", ".", "AdmissionRequest", ")", "(", "*", "admissionapi", ".", "AdmissionResponse", ",", "error", ")", "{", "logger", ":=", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "req", ".", "Resource", ",", "\"", "\"", ":", "req", ".", "SubResource", ",", "\"", "\"", ":", "req", ".", "Name", ",", "\"", "\"", ":", "req", ".", "Namespace", ",", "\"", "\"", ":", "req", ".", "Operation", ",", "}", ")", "\n\n", "// Does this only update status?", "if", "req", ".", "SubResource", "==", "\"", "\"", "{", "logrus", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "&", "allow", ",", "nil", "\n", "}", "\n\n", "// Otherwise, do the specs match?", "var", "new", "prowjobv1", ".", "ProwJob", "\n", "if", "_", ",", "_", ",", "err", ":=", "codecs", ".", "UniversalDeserializer", "(", ")", ".", "Decode", "(", "req", ".", "Object", ".", "Raw", ",", "nil", ",", "&", "new", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "var", "old", "prowjobv1", ".", "ProwJob", "\n", "if", "_", ",", "_", ",", "err", ":=", "codecs", ".", "UniversalDeserializer", "(", ")", ".", "Decode", "(", "req", ".", "OldObject", ".", "Raw", ",", "nil", ",", "&", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "equality", ".", "Semantic", ".", "DeepEqual", "(", "old", ".", "Spec", ",", "new", ".", "Spec", ")", "{", "logrus", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "&", "allow", ",", "nil", "// yes", "\n", "}", "\n", "logger", ".", "Info", "(", "\"", "\"", ")", "// no", "\n", "return", "&", "reject", ",", "nil", "\n", "}" ]
2,618
all-2619
[ "GetLastBlockNumber", "returns", "last", "known", "block", "number", "." ]
[ "func", "(", "h", "*", "Handler", ")", "GetLastBlockNumber", "(", "tkn", "string", ")", "(", "*", "uint64", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "if", "!", "h", ".", "<mask>", ".", "Check", "(", "tkn", ")", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrAccessDenied", "\n", "}", "\n\n", "minConfirmations", ",", "err", ":=", "h", ".", "minConfirmations", "(", "logger", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "queryRet", "sql", ".", "NullInt64", "\n", "row", ":=", "h", ".", "db", ".", "QueryRow", "(", "\"", "\"", ")", "\n", "if", "err", ":=", "row", ".", "Scan", "(", "&", "queryRet", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "nil", ",", "ErrInternal", "\n", "}", "\n\n", "logger", ".", "Error", "(", "fmt", ".", "Sprint", "(", "queryRet", ".", "Int64", ")", ")", "\n", "ret", ":=", "uint64", "(", "queryRet", ".", "Int64", ")", "+", "minConfirmations", "\n", "return", "&", "ret", ",", "nil", "\n", "}" ]
2,619
all-2620
[ "NewCursor", "create", "a", "new", "cursor", "with", "the", "DefaultCursor", "the", "specified", "input", "and", "position", "at", "the", "end", "of", "the", "specified", "starting", "input", "." ]
[ "func", "NewCursor", "(", "startinginput", "string", ",", "pointer", "Pointer", ",", "eraseDefault", "bool", ")", "Cursor", "{", "if", "pointer", "==", "nil", "{", "pointer", "=", "defaultCursor", "\n", "}", "\n", "cur", ":=", "Cursor", "{", "Cursor", ":", "<mask>", ",", "Position", ":", "len", "(", "startinginput", ")", ",", "input", ":", "[", "]", "rune", "(", "startinginput", ")", ",", "erase", ":", "eraseDefault", "}", "\n", "if", "eraseDefault", "{", "cur", ".", "Start", "(", ")", "\n", "}", "else", "{", "cur", ".", "End", "(", ")", "\n", "}", "\n", "return", "cur", "\n", "}" ]
2,620
all-2621
[ "GetIterAtPosition", "is", "a", "wrapper", "around", "gtk_text_view_get_iter_at_position", "()", "." ]
[ "func", "(", "v", "*", "TextView", ")", "GetIterAtPosition", "(", "x", ",", "y", "int", ")", "(", "*", "TextIter", ",", "int", ")", "{", "<mask>", "iter", "C", ".", "GtkTextIter", "\n", "var", "trailing", "C", ".", "gint", "\n", "C", ".", "gtk_text_view_get_iter_at_position", "(", "v", ".", "native", "(", ")", ",", "&", "iter", ",", "&", "trailing", ",", "C", ".", "gint", "(", "x", ")", ",", "C", ".", "gint", "(", "y", ")", ")", "\n", "return", "(", "*", "TextIter", ")", "(", "&", "iter", ")", ",", "int", "(", "trailing", ")", "\n", "}" ]
2,621
all-2622
[ "ReqTimeout", "returns", "timeout", "for", "request", "to", "finish", "." ]
[ "func", "(", "c", "*", "ServerConfig", ")", "ReqTimeout", "(", ")", "time", ".", "Duration", "{", "// 5s for queue waiting, computation and disk IO delay", "// + 2 * election timeout for possible leader election", "return", "5", "*", "time", ".", "Second", "+", "2", "*", "time", ".", "Duration", "(", "c", ".", "ElectionTicks", "*", "int", "(", "c", ".", "TickMs", ")", ")", "*", "<mask>", ".", "Millisecond", "\n", "}" ]
2,622
all-2623
[ "Handles", "incoming", "msgPackets", ".", "Returns", "a", "msg", "bytes", "if", "msg", "is", "complete", ".", "Not", "goroutine", "-", "safe" ]
[ "func", "(", "ch", "*", "Channel", ")", "recvMsgPacket", "(", "packet", "msgPacket", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// log.Debug(\"Read Msg Packet\", \"conn\", ch.conn, \"packet\", packet)", "if", "ch", ".", "desc", ".", "RecvMessageCapacity", "<", "len", "(", "ch", ".", "recving", ")", "+", "len", "(", "packet", ".", "Bytes", ")", "{", "return", "nil", ",", "wire", ".", "ErrBinaryReadOverflow", "\n", "}", "\n", "ch", ".", "recving", "=", "<mask>", "(", "ch", ".", "recving", ",", "packet", ".", "Bytes", "...", ")", "\n", "if", "packet", ".", "EOF", "==", "byte", "(", "0x01", ")", "{", "msgBytes", ":=", "ch", ".", "recving", "\n", "// clear the slice without re-allocating.", "// http://stackoverflow.com/questions/16971741/how-do-you-clear-a-slice-in-go", "// suggests this could be a memory leak, but we might as well keep the memory for the channel until it closes,", "//\tat which point the recving slice stops being used and should be garbage collected", "ch", ".", "recving", "=", "ch", ".", "recving", "[", ":", "0", "]", "// make([]byte, 0, ch.desc.RecvBufferCapacity)", "\n", "return", "msgBytes", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "nil", "\n", "}" ]
2,623
all-2624
[ "Create", "MAPPING", "-", "START", "." ]
[ "func", "yaml_mapping_start_event_initialize", "(", "event", "*", "yaml_event_t", ",", "anchor", ",", "<mask>", "[", "]", "byte", ",", "implicit", "bool", ",", "style", "yaml_mapping_style_t", ")", "{", "*", "event", "=", "yaml_event_t", "{", "typ", ":", "yaml_MAPPING_START_EVENT", ",", "anchor", ":", "anchor", ",", "tag", ":", "tag", ",", "implicit", ":", "implicit", ",", "style", ":", "yaml_style_t", "(", "style", ")", ",", "}", "\n", "}" ]
2,624
all-2625
[ "Function", "calls", "(", "NOT", "to", "be", "confused", "with", "method", "calls", "which", "are", "totally", "sane", "and", "fine", ")", "in", "go", "-", "xslate", "is", "a", "bit", "different", ".", "Unlike", "in", "non", "-", "compiled", "languages", "like", "Perl", "we", "can", "t", "just", "lookup", "a", "function", "out", "of", "nowhere", "with", "just", "its", "name", ":", "Golang", "s", "reflection", "mechanism", "requires", "that", "you", "have", "a", "concret", "value", "before", "doing", "a", "lookup", ".", "So", "this", "is", "not", "possible", "(", "where", "time", "is", "just", "a", "string", ")", ":", "[", "%", "time", ".", "Now", "()", "%", "]", "However", "it", "s", "possible", "to", "register", "the", "function", "itself", "as", "a", "variable", ":", "tx", ".", "Render", "(", "...", "map", "[", "string", "]", "interface", "{}", "{", "now", ":", "time", ".", "Now", "}", ")", "[", "%", "now", "()", "%", "]", "But", "this", "requires", "function", "names", "to", "be", "globally", "unique", ".", "That", "s", "not", "always", "possible", ".", "To", "avoid", "this", "we", "can", "register", "an", "OBJECT", "named", "time", "before", "hand", "so", "that", "it", "in", "turn", "calls", "the", "ordinary", "time", ".", "Now", "()", "function", "//", "Exact", "usage", "TBD", "tx", ".", "RegisterFunctions", "(", "txtime", ".", "New", "()", ")", "tx", ".", "Render", "(", "...", ")", "[", "%", "time", ".", "Now", "%", "]", "...", "And", "that", "s", "how", "we", "manage", "function", "calls", "See", "also", ":" ]
[ "func", "txFunCall", "(", "st", "*", "State", ")", "{", "// Everything in our lvars up to the current tip is our argument list", "mark", ":=", "st", ".", "CurrentMark", "(", ")", "\n", "tip", ":=", "st", ".", "stack", ".", "Size", "(", ")", "-", "1", "\n", "var", "args", "[", "]", "reflect", ".", "Value", "\n\n", "if", "tip", "-", "mark", "-", "1", ">", "0", "{", "args", "=", "make", "(", "[", "]", "reflect", ".", "Value", ",", "tip", "-", "mark", "-", "1", ")", "\n", "for", "i", ":=", "mark", "+", "1", ";", "tip", ">", "i", ";", "i", "++", "{", "v", ",", "_", ":=", "st", ".", "stack", ".", "Get", "(", "i", ")", "\n", "args", "[", "i", "-", "mark", "]", "=", "reflect", ".", "ValueOf", "(", "v", ")", "\n", "}", "\n", "}", "\n\n", "x", ":=", "st", ".", "sa", "\n", "st", ".", "sa", "=", "nil", "\n", "if", "x", "==", "nil", "{", "// Do nothing, just advance", "st", ".", "Advance", "(", ")", "\n", "return", "\n", "}", "\n\n", "v", ":=", "reflect", ".", "ValueOf", "(", "x", ")", "\n", "if", "v", ".", "<mask>", "(", ")", ".", "Kind", "(", ")", "==", "reflect", ".", "Func", "{", "fun", ":=", "reflect", ".", "ValueOf", "(", "x", ")", "\n", "invokeFuncSingleReturn", "(", "st", ",", "fun", ",", "args", ")", "\n", "}", "\n", "st", ".", "Advance", "(", ")", "\n", "}" ]
2,625
all-2626
[ "Offset", "determines", "the", "character", "offset", "from", "the", "beginning", "of", "the", "current", "line" ]
[ "func", "(", "l", "*", "Lexer", ")", "Offset", "(", ")", "int", "{", "// find last line break", "lineoffset", ":=", "strings", ".", "LastIndex", "(", "l", ".", "<mask>", "[", ":", "l", ".", "Pos", "]", ",", "\"", "\\n", "\"", ")", "\n", "if", "lineoffset", "!=", "-", "1", "{", "// calculate current offset from last line break", "return", "l", ".", "Pos", "-", "lineoffset", "\n", "}", "\n\n", "// first line", "return", "l", ".", "Pos", "\n", "}" ]
2,626
all-2627
[ "Curls", "an", "app", "s", "endpoint", "and", "exit", "successfully", "before", "the", "default", "timeout" ]
[ "func", "CurlApp", "(", "cfg", "helpersinternal", ".", "CurlConfig", ",", "appName", ",", "<mask>", "string", ",", "args", "...", "string", ")", "string", "{", "appCurler", ":=", "helpersinternal", ".", "NewAppCurler", "(", "Curl", ",", "cfg", ")", "\n", "return", "appCurler", ".", "CurlAndWait", "(", "cfg", ",", "appName", ",", "path", ",", "CURL_TIMEOUT", ",", "args", "...", ")", "\n", "}" ]
2,627
all-2628
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkRecentManager", "." ]
[ "func", "(", "v", "*", "RecentChooserMenu", ")", "native", "(", ")", "*", "C", ".", "GtkRecentChooserMenu", "{", "if", "v", "==", "nil", "||", "v", ".", "<mask>", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "return", "C", ".", "toGtkRecentChooserMenu", "(", "p", ")", "\n", "}" ]
2,628
all-2629
[ "NewCert", "generates", "TLS", "cert", "by", "using", "the", "given", "cert", "key", "and", "parse", "function", "." ]
[ "func", "NewCert", "(", "certfile", ",", "keyfile", "string", ",", "parseFunc", "func", "(", "[", "]", "byte", ",", "[", "]", "byte", ")", "(", "tls", ".", "Certificate", ",", "error", ")", ")", "(", "*", "tls", ".", "Certificate", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "certfile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "key", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "keyfile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "parseFunc", "==", "nil", "{", "parseFunc", "=", "tls", ".", "X509KeyPair", "\n", "}", "\n\n", "tlsCert", ",", "err", ":=", "parseFunc", "(", "cert", ",", "key", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "tlsCert", ",", "nil", "\n", "}" ]
2,629
all-2630
[ "isLocalAddress", "works", "by", "checking", "if", "the", "address", "is", "under", "private", "CIDR", "blocks", ".", "List", "of", "private", "CIDR", "blocks", "can", "be", "seen", "on", ":", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Private_network", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Link", "-", "local_address" ]
[ "func", "isPrivateAddress", "(", "address", "string", ")", "(", "bool", ",", "error", ")", "{", "ipAddress", ":=", "net", ".", "ParseIP", "(", "address", ")", "\n", "if", "ipAddress", "==", "nil", "{", "return", "false", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "for", "i", ":=", "range", "cidrs", "{", "if", "cidrs", "[", "i", "]", ".", "Contains", "(", "ipAddress", ")", "{", "return", "true", ",", "nil", "\n", "}", "\n", "}", "\n\n", "return", "false", ",", "nil", "\n", "}" ]
2,630
all-2631
[ "tailSort", "pushes", "nodes", "with", "/", "as", "the", "tail", "to", "the", "end", "of", "the", "list", "for", "param", "nodes", ".", "The", "list", "order", "determines", "the", "traversal", "order", "." ]
[ "func", "(", "<mask>", "nodes", ")", "tailSort", "(", ")", "{", "for", "i", ":=", "len", "(", "ns", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "if", "ns", "[", "i", "]", ".", "typ", ">", "ntStatic", "&&", "ns", "[", "i", "]", ".", "tail", "==", "'/'", "{", "ns", ".", "Swap", "(", "i", ",", "len", "(", "ns", ")", "-", "1", ")", "\n", "return", "\n", "}", "\n", "}", "\n", "}" ]
2,631
all-2632
[ "SetUChar", "is", "a", "wrapper", "around", "g_value_set_uchar", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetUChar", "(", "val", "uint8", ")", "{", "C", ".", "g_value_set_uchar", "(", "v", ".", "native", "(", ")", ",", "C", ".", "guchar", "(", "val", ")", ")", "\n", "}" ]
2,632
all-2633
[ "getRecordID", "returns", "the", "ID", "from", "a", "record", ".", "the", "ID", "is", "mandatory", "to", "update", "and", "delete", "records" ]
[ "func", "(", "p", "*", "DigitalOceanProvider", ")", "getRecordID", "(", "records", "[", "]", "godo", ".", "DomainRecord", ",", "record", "godo", ".", "DomainRecord", ")", "int", "{", "for", "_", ",", "zoneRecord", ":=", "range", "records", "{", "if", "zoneRecord", ".", "Name", "==", "record", ".", "<mask>", "&&", "zoneRecord", ".", "Type", "==", "record", ".", "Type", "{", "return", "zoneRecord", ".", "ID", "\n", "}", "\n", "}", "\n", "return", "0", "\n", "}" ]
2,633
all-2634
[ "skipUPNP", ":", "If", "true", "does", "not", "try", "getUPNPExternalAddress", "()" ]
[ "func", "NewDefaultListener", "(", "protocol", "string", ",", "lAddr", "string", ",", "skipUPNP", "bool", ")", "Listener", "{", "// Local listen IP & port", "lAddrIP", ",", "lAddrPort", ":=", "splitHostPort", "(", "lAddr", ")", "\n\n", "// Create listener", "var", "listener", "net", ".", "Listener", "\n", "var", "err", "error", "\n", "for", "i", ":=", "0", ";", "i", "<", "tryListenSeconds", ";", "i", "++", "{", "listener", ",", "err", "=", "net", ".", "Listen", "(", "protocol", ",", "lAddr", ")", "\n", "if", "err", "==", "nil", "{", "<mask>", "\n", "}", "else", "if", "i", "<", "tryListenSeconds", "-", "1", "{", "time", ".", "Sleep", "(", "time", ".", "Second", "*", "1", ")", "\n", "}", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "PanicCrisis", "(", "err", ")", "\n", "}", "\n", "// Actual listener local IP & port", "listenerIP", ",", "listenerPort", ":=", "splitHostPort", "(", "listener", ".", "Addr", "(", ")", ".", "String", "(", ")", ")", "\n", "log", ".", "Info", "(", "\"", "\"", ",", "\"", "\"", ",", "listenerIP", ",", "\"", "\"", ",", "listenerPort", ")", "\n\n", "// Determine internal address...", "var", "intAddr", "*", "NetAddress", "\n", "intAddr", ",", "err", "=", "NewNetAddressString", "(", "lAddr", ")", "\n", "if", "err", "!=", "nil", "{", "PanicCrisis", "(", "err", ")", "\n", "}", "\n\n", "// Determine external address...", "var", "extAddr", "*", "NetAddress", "\n", "if", "!", "skipUPNP", "{", "// If the lAddrIP is INADDR_ANY, try UPnP", "if", "lAddrIP", "==", "\"", "\"", "||", "lAddrIP", "==", "\"", "\"", "{", "extAddr", "=", "getUPNPExternalAddress", "(", "lAddrPort", ",", "listenerPort", ")", "\n", "}", "\n", "}", "\n", "// Otherwise just use the local address...", "if", "extAddr", "==", "nil", "{", "extAddr", "=", "getNaiveExternalAddress", "(", "listenerPort", ")", "\n", "}", "\n", "if", "extAddr", "==", "nil", "{", "PanicCrisis", "(", "\"", "\"", ")", "\n", "}", "\n\n", "dl", ":=", "&", "DefaultListener", "{", "listener", ":", "listener", ",", "intAddr", ":", "intAddr", ",", "extAddr", ":", "extAddr", ",", "connections", ":", "make", "(", "chan", "net", ".", "Conn", ",", "numBufferedConnections", ")", ",", "}", "\n", "dl", ".", "BaseService", "=", "*", "NewBaseService", "(", "log", ",", "\"", "\"", ",", "dl", ")", "\n", "dl", ".", "Start", "(", ")", "// Started upon construction", "\n", "return", "dl", "\n", "}" ]
2,634
all-2635
[ "expandCustomizationUserData", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "CustomizationUserData", "." ]
[ "func", "expandCustomizationUserData", "(", "d", "*", "schema", ".", "ResourceData", ")", "types", ".", "CustomizationUserData", "{", "obj", ":=", "<mask>", ".", "CustomizationUserData", "{", "FullName", ":", "d", ".", "Get", "(", "cWindowsKeyPrefix", "+", "\"", "\"", "+", "\"", "\"", ")", ".", "(", "string", ")", ",", "OrgName", ":", "d", ".", "Get", "(", "cWindowsKeyPrefix", "+", "\"", "\"", "+", "\"", "\"", ")", ".", "(", "string", ")", ",", "ComputerName", ":", "&", "types", ".", "CustomizationFixedName", "{", "Name", ":", "d", ".", "Get", "(", "cWindowsKeyPrefix", "+", "\"", "\"", "+", "\"", "\"", ")", ".", "(", "string", ")", ",", "}", ",", "ProductId", ":", "d", ".", "Get", "(", "cWindowsKeyPrefix", "+", "\"", "\"", "+", "\"", "\"", ")", ".", "(", "string", ")", ",", "}", "\n", "return", "obj", "\n", "}" ]
2,635
all-2636
[ "Invert", "inverts", "the", "matrix", ".", "If", "g", "is", "not", "invertible", "Invert", "panics", "." ]
[ "func", "(", "g", "*", "GeoM", ")", "Invert", "(", ")", "{", "det", ":=", "g", ".", "det", "(", ")", "\n", "if", "det", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "a", ":=", "(", "g", ".", "d_1", "+", "1", ")", "/", "det", "\n", "b", ":=", "-", "g", ".", "b", "/", "det", "\n", "c", ":=", "-", "g", ".", "c", "/", "det", "\n", "d", ":=", "(", "g", ".", "a_1", "+", "1", ")", "/", "det", "\n", "tx", ":=", "(", "-", "(", "g", ".", "d_1", "+", "1", ")", "*", "g", ".", "<mask>", "+", "g", ".", "b", "*", "g", ".", "ty", ")", "/", "det", "\n", "ty", ":=", "(", "g", ".", "c", "*", "g", ".", "tx", "+", "-", "(", "g", ".", "a_1", "+", "1", ")", "*", "g", ".", "ty", ")", "/", "det", "\n\n", "g", ".", "a_1", "=", "a", "-", "1", "\n", "g", ".", "b", "=", "b", "\n", "g", ".", "c", "=", "c", "\n", "g", ".", "d_1", "=", "d", "-", "1", "\n", "g", ".", "tx", "=", "tx", "\n", "g", ".", "ty", "=", "ty", "\n", "}" ]
2,636
all-2637
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "get", "apps", "app", "params" ]
[ "func", "(", "o", "*", "GetAppsAppParams", ")", "WithHTTPClient", "(", "<mask>", "*", "http", ".", "Client", ")", "*", "GetAppsAppParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
2,637
all-2638
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "InterceptionStage", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "<mask>", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
2,638
all-2639
[ "Valid", "validator" ]
[ "func", "(", "c", "*", "conditionalRule", ")", "Valid", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "<mask>", ")", "bool", "{", "if", "!", "c", ".", "validPredicate", "(", ")", "{", "return", "false", "\n", "}", "\n", "return", "true", "\n", "}" ]
2,639
all-2640
[ "CallSC", "makes", "a", "JSON", "call", "using", "the", "given", "subchannel", "." ]
[ "func", "CallSC", "(", "ctx", "<mask>", ",", "sc", "*", "tchannel", ".", "SubChannel", ",", "method", "string", ",", "arg", ",", "resp", "interface", "{", "}", ")", "error", "{", "call", ",", "err", ":=", "sc", ".", "BeginCall", "(", "ctx", ",", "method", ",", "&", "tchannel", ".", "CallOptions", "{", "Format", ":", "tchannel", ".", "JSON", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "wrapCall", "(", "ctx", ",", "call", ",", "method", ",", "arg", ",", "resp", ")", "\n", "}" ]
2,640
all-2641
[ "Upload", "uploads", "all", "of", "the", "data", "in", "the", "uploadTargets", "map", "to", "GCS", "in", "parallel", ".", "The", "map", "is", "keyed", "on", "GCS", "path", "under", "the", "bucket" ]
[ "func", "Upload", "(", "bucket", "*", "storage", ".", "BucketHandle", ",", "uploadTargets", "map", "[", "string", "]", "UploadFunc", ")", "error", "{", "errCh", ":=", "make", "(", "chan", "error", ",", "len", "(", "uploadTargets", ")", ")", "\n", "<mask>", ":=", "&", "sync", ".", "WaitGroup", "{", "}", "\n", "group", ".", "Add", "(", "len", "(", "uploadTargets", ")", ")", "\n", "for", "dest", ",", "upload", ":=", "range", "uploadTargets", "{", "obj", ":=", "bucket", ".", "Object", "(", "dest", ")", "\n", "logrus", ".", "WithField", "(", "\"", "\"", ",", "dest", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "go", "func", "(", "f", "UploadFunc", ",", "obj", "*", "storage", ".", "ObjectHandle", ",", "name", "string", ")", "{", "defer", "group", ".", "Done", "(", ")", "\n", "if", "err", ":=", "f", "(", "obj", ")", ";", "err", "!=", "nil", "{", "errCh", "<-", "err", "\n", "}", "\n", "logrus", ".", "WithField", "(", "\"", "\"", ",", "name", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "}", "(", "upload", ",", "obj", ",", "dest", ")", "\n", "}", "\n", "group", ".", "Wait", "(", ")", "\n", "close", "(", "errCh", ")", "\n", "if", "len", "(", "errCh", ")", "!=", "0", "{", "var", "uploadErrors", "[", "]", "error", "\n", "for", "err", ":=", "range", "errCh", "{", "uploadErrors", "=", "append", "(", "uploadErrors", ",", "err", ")", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "uploadErrors", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,641
all-2642
[ "char", "*", "pango_font_description_to_filename", "(", "const", "PangoFontDescription", "*", "desc", ")", ";" ]
[ "func", "(", "v", "*", "FontDescription", ")", "ToFilename", "(", ")", "string", "{", "c", ":=", "C", ".", "pango_font_description_to_filename", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", "\n", "}" ]
2,642
all-2643
[ "ServerGroup", "retrieves", "a", "detailed", "view", "on", "one", "server", "group" ]
[ "func", "(", "c", "*", "Client", ")", "ServerGroup", "(", "identifier", "string", ")", "(", "*", "ServerGroup", ",", "error", ")", "{", "group", ":=", "new", "(", "ServerGroup", ")", "\n", "_", ",", "err", ":=", "c", ".", "MakeApiRequest", "(", "\"", "\"", ",", "\"", "\"", "+", "identifier", ",", "nil", ",", "group", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "<mask>", ",", "err", "\n", "}" ]
2,643
all-2644
[ "NewTransport", "Creates", "a", "default", "transport" ]
[ "func", "NewTransport", "(", ")", "*", "http", ".", "Transport", "{", "direct", ":=", "&", "net", ".", "Dialer", "{", "Timeout", ":", "30", "*", "time", ".", "Second", ",", "KeepAlive", ":", "30", "*", "time", ".", "Second", ",", "DualStack", ":", "true", ",", "}", "\n", "tr", ":=", "&", "http", ".", "Transport", "{", "Proxy", ":", "<mask>", ".", "ProxyFromEnvironment", ",", "Dial", ":", "direct", ".", "Dial", ",", "TLSHandshakeTimeout", ":", "10", "*", "time", ".", "Second", ",", "// TODO(dmcgowan): Call close idle connections when complete and use keep alive", "DisableKeepAlives", ":", "true", ",", "}", "\n", "proxyDialer", ",", "err", ":=", "sockets", ".", "DialerFromEnvironment", "(", "direct", ")", "\n", "if", "err", "==", "nil", "{", "tr", ".", "Dial", "=", "proxyDialer", ".", "Dial", "\n", "}", "\n", "return", "tr", "\n", "}" ]
2,644
all-2645
[ "Release", "deletes", "the", "pid", "file", "and", "releases", "our", "lock", "on", "the", "directory", "." ]
[ "func", "(", "guard", "*", "directoryLockGuard", ")", "release", "(", ")", "error", "{", "var", "err", "error", "\n", "if", "!", "guard", ".", "readOnly", "{", "// It's important that we remove the pid file first.", "err", "=", "os", ".", "Remove", "(", "guard", ".", "path", ")", "\n", "}", "\n\n", "if", "closeErr", ":=", "guard", ".", "f", ".", "Close", "(", ")", ";", "err", "==", "nil", "{", "err", "=", "closeErr", "\n", "}", "\n", "<mask>", ".", "path", "=", "\"", "\"", "\n", "guard", ".", "f", "=", "nil", "\n\n", "return", "err", "\n", "}" ]
2,645
all-2646
[ "IsEquivalent", "returns", "true", "if", "other", "represents", "the", "same", "data", "type", "as", "the", "target", "." ]
[ "func", "(", "b", "*", "BasicDataType", ")", "IsEquivalent", "(", "other", "DataType", ")", "bool", "{", "t", ",", "<mask>", ":=", "other", ".", "(", "*", "BasicDataType", ")", "\n", "if", "!", "ok", "{", "return", "false", "\n", "}", "\n", "return", "*", "t", "==", "*", "b", "\n", "}" ]
2,646
all-2647
[ "Scan", "implements", "the", "Scanner", "interface", "." ]
[ "func", "(", "n", "*", "NullTime", ")", "Scan", "(", "value", "interface", "{", "}", ")", "error", "{", "n", ".", "Time", ",", "n", ".", "Valid", "=", "value", ".", "(", "<mask>", ".", "Time", ")", "\n", "return", "nil", "\n", "}" ]
2,647
all-2648
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetFlattenedDocumentParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom43", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
2,648
all-2649
[ "GetBranches", "returns", "all", "branches", "in", "the", "repo", ".", "If", "onlyProtected", "is", "true", "it", "will", "only", "return", "repos", "with", "protection", "enabled", "and", "branch", ".", "Protected", "will", "be", "true", ".", "Otherwise", "Protected", "is", "the", "default", "value", "(", "false", ")", ".", "This", "call", "uses", "multiple", "API", "tokens", "when", "results", "are", "paginated", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "repos", "/", "branches", "/", "#list", "-", "branches" ]
[ "func", "(", "c", "*", "Client", ")", "GetBranches", "(", "org", ",", "repo", "string", ",", "onlyProtected", "bool", ")", "(", "[", "]", "Branch", ",", "error", ")", "{", "c", ".", "<mask>", "(", "\"", "\"", ",", "org", ",", "repo", ")", "\n", "var", "branches", "[", "]", "Branch", "\n", "err", ":=", "c", ".", "readPaginatedResultsWithValues", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ")", ",", "url", ".", "Values", "{", "\"", "\"", ":", "[", "]", "string", "{", "strconv", ".", "FormatBool", "(", "onlyProtected", ")", "}", ",", "\"", "\"", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "}", ",", "acceptNone", ",", "func", "(", ")", "interface", "{", "}", "{", "// newObj", "return", "&", "[", "]", "Branch", "{", "}", "\n", "}", ",", "func", "(", "obj", "interface", "{", "}", ")", "{", "branches", "=", "append", "(", "branches", ",", "*", "(", "obj", ".", "(", "*", "[", "]", "Branch", ")", ")", "...", ")", "\n", "}", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "branches", ",", "nil", "\n", "}" ]
2,649
all-2650
[ "NOTE", ":", "secret", "should", "be", "the", "output", "of", "a", "KDF", "like", "bcrypt", "if", "it", "s", "derived", "from", "user", "input", "." ]
[ "func", "GenPrivKeySecp256k1FromSecret", "(", "<mask>", "[", "]", "byte", ")", "PrivKeySecp256k1", "{", "privKey32", ":=", "Sha256", "(", "secret", ")", "// Not Ripemd160 because we want 32 bytes.", "\n", "priv", ",", "_", ":=", "secp256k1", ".", "PrivKeyFromBytes", "(", "secp256k1", ".", "S256", "(", ")", ",", "privKey32", ")", "\n", "privKeyBytes", ":=", "[", "32", "]", "byte", "{", "}", "\n", "copy", "(", "privKeyBytes", "[", ":", "]", ",", "priv", ".", "Serialize", "(", ")", ")", "\n", "return", "PrivKeySecp256k1", "(", "privKeyBytes", ")", "\n", "}" ]
2,650
all-2651
[ "DebugCookbookPathLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "DebugCookbookPathLocator", "(", "href", "<mask>", ")", "*", "DebugCookbookPathLocator", "{", "return", "&", "DebugCookbookPathLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
2,651
all-2652
[ "LineTo", "adds", "a", "math", ".", "Segment", "to", "the", "path", "which", "starts", "from", "the", "current", "position", "and", "ends", "to", "the", "given", "position", "(", "x", "y", ")", ".", "LineTo", "updates", "the", "current", "position", "to", "(", "x", "y", ")", "." ]
[ "func", "(", "p", "*", "Path", ")", "LineTo", "(", "x", ",", "y", "float32", ")", "{", "if", "len", "(", "p", ".", "segs", ")", "==", "0", "{", "p", ".", "segs", "=", "append", "(", "p", ".", "segs", ",", "[", "]", "math", ".", "Segment", "{", "}", ")", "\n", "}", "\n", "p", ".", "segs", "[", "len", "(", "p", ".", "segs", ")", "-", "1", "]", "=", "<mask>", "(", "p", ".", "segs", "[", "len", "(", "p", ".", "segs", ")", "-", "1", "]", ",", "math", ".", "Segment", "{", "p", ".", "cur", ",", "math", ".", "Point", "{", "x", ",", "y", "}", "}", ")", "\n", "p", ".", "cur", "=", "math", ".", "Point", "{", "x", ",", "y", "}", "\n", "}" ]
2,652
all-2653
[ "Using", "the", "classic", "API", "posts", "a", "count", "to", "a", "stat", "." ]
[ "func", "(", "r", "*", "BasicReporter", ")", "PostCount", "(", "statKey", ",", "userKey", "string", ",", "<mask>", "int", ")", "error", "{", "r", ".", "add", "(", "newClassicStatCount", "(", "statKey", ",", "userKey", ",", "count", ")", ")", "\n", "return", "nil", "\n", "}" ]
2,653
all-2654
[ "generateENIExtraHosts", "returns", "a", "slice", "of", "strings", "of", "the", "form", "hostname", ":", "ip", "that", "is", "generated", "using", "the", "hostname", "and", "ip", "addresses", "allocated", "to", "the", "ENI" ]
[ "func", "(", "task", "*", "Task", ")", "generateENIExtraHosts", "(", ")", "[", "]", "string", "{", "eni", ":=", "<mask>", ".", "GetTaskENI", "(", ")", "\n", "if", "eni", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "hostname", ":=", "eni", ".", "GetHostname", "(", ")", "\n", "if", "hostname", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "extraHosts", ":=", "[", "]", "string", "{", "}", "\n\n", "for", "_", ",", "ip", ":=", "range", "eni", ".", "GetIPV4Addresses", "(", ")", "{", "host", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "hostname", ",", "ip", ")", "\n", "extraHosts", "=", "append", "(", "extraHosts", ",", "host", ")", "\n", "}", "\n", "return", "extraHosts", "\n", "}" ]
2,654
all-2655
[ "Return", "the", "first", "suffix", "found", "or", "the", "empty", "string", "." ]
[ "func", "(", "w", "*", "SnowballWord", ")", "FirstSuffix", "(", "suffixes", "...", "string", ")", "(", "suffix", "<mask>", ",", "suffixRunes", "[", "]", "rune", ")", "{", "return", "w", ".", "FirstSuffixIfIn", "(", "0", ",", "len", "(", "w", ".", "RS", ")", ",", "suffixes", "...", ")", "\n", "}" ]
2,655
all-2656
[ "Do", "executes", "Page", ".", "setLifecycleEventsEnabled", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetLifecycleEventsEnabledParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetLifecycleEventsEnabled", ",", "p", ",", "nil", ")", "\n", "}" ]
2,656
all-2657
[ "ContainerNodeList", "returns", "all", "container", "objects", "on", "the", "local", "node", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ContainerNodeList", "(", ")", "(", "[", "]", "Container", ",", "error", ")", "{", "node", ",", "err", ":=", "c", ".", "NodeName", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "filter", ":=", "ContainerFilter", "{", "Node", ":", "<mask>", ",", "Type", ":", "int", "(", "CTypeRegular", ")", ",", "}", "\n\n", "return", "c", ".", "ContainerList", "(", "filter", ")", "\n", "}" ]
2,657
all-2658
[ "ReadResponse", "reads", "a", "server", "response", "into", "the", "received", "o", "." ]
[ "func", "(", "o", "*", "GetVMByCidReader", ")", "ReadResponse", "(", "response", "runtime", ".", "ClientResponse", ",", "consumer", "runtime", ".", "Consumer", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "<mask>", "response", ".", "Code", "(", ")", "{", "case", "200", ":", "result", ":=", "NewGetVMByCidOK", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n\n", "case", "404", ":", "result", ":=", "NewGetVMByCidNotFound", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "result", "\n\n", "default", ":", "result", ":=", "NewGetVMByCidDefault", "(", "response", ".", "Code", "(", ")", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "result", "\n", "}", "\n", "}" ]
2,658
all-2659
[ "SetEllipsize", "is", "a", "wrapper", "around", "gtk_label_set_ellipsize", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetEllipsize", "(", "mode", "pango", ".", "EllipsizeMode", ")", "{", "C", ".", "gtk_label_set_ellipsize", "(", "v", ".", "native", "(", ")", ",", "C", ".", "PangoEllipsizeMode", "(", "mode", ")", ")", "\n", "}" ]
2,659
all-2660
[ "RmFile", "deletes", "a", "file", "in", "the", "guest", "operating", "system", ".", "Parameters", ":", "filepath", ":", "file", "path", "to", "be", "deleted", "in", "the", "guest", "OS", "Remarks", ":", "*", "Only", "absolute", "paths", "should", "be", "used", "for", "files", "in", "the", "guest", ";", "the", "resolution", "of", "relative", "paths", "is", "not", "specified", ".", "Since", "VMware", "Workstation", "6", ".", "0", "Minimum", "Supported", "Guest", "OS", ":", "Microsoft", "Windows", "NT", "Series", "Linux" ]
[ "func", "(", "g", "*", "Guest", ")", "RmFile", "(", "filepath", "string", ")", "error", "{", "var", "jobHandle", "C", ".", "VixHandle", "=", "C", ".", "VIX_INVALID_HANDLE", "\n", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n\n", "fpath", ":=", "C", ".", "CString", "(", "filepath", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "fpath", ")", ")", "\n\n", "jobHandle", "=", "C", ".", "VixVM_DeleteFileInGuest", "(", "g", ".", "handle", ",", "fpath", ",", "// file path name", "nil", ",", "// callbackProc", "nil", ")", "// clientData", "\n\n", "defer", "C", ".", "Vix_ReleaseHandle", "(", "jobHandle", ")", "\n\n", "err", "=", "C", ".", "vix_job_wait", "(", "jobHandle", ")", "\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "&", "<mask>", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,660
all-2661
[ "Notify", "calls", "NotifierFunc", "(", "subject", "body", ")", "." ]
[ "func", "(", "f", "NotifierFunc", ")", "Notify", "(", "subject", ",", "body", "string", ")", "error", "{", "return", "f", "(", "subject", ",", "<mask>", ")", "\n", "}" ]
2,661
all-2662
[ "snapNames", "returns", "the", "filename", "of", "the", "snapshots", "in", "logical", "time", "order", "(", "from", "newest", "to", "oldest", ")", ".", "If", "there", "is", "no", "available", "snapshots", "an", "ErrNoSnapshot", "will", "be", "returned", "." ]
[ "func", "(", "s", "*", "Snapshotter", ")", "snapNames", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "dir", ",", "err", ":=", "os", ".", "Open", "(", "s", ".", "dir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "dir", ".", "Close", "(", ")", "\n", "names", ",", "err", ":=", "dir", ".", "Readdirnames", "(", "-", "1", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "snaps", ":=", "checkSuffix", "(", "s", ".", "lg", ",", "names", ")", "\n", "if", "len", "(", "snaps", ")", "==", "0", "{", "return", "nil", ",", "ErrNoSnapshot", "\n", "}", "\n", "sort", ".", "Sort", "(", "<mask>", ".", "Reverse", "(", "sort", ".", "StringSlice", "(", "snaps", ")", ")", ")", "\n", "return", "snaps", ",", "nil", "\n", "}" ]
2,662
all-2663
[ "ServeHTTP", "validates", "an", "incoming", "webhook", "and", "puts", "it", "into", "the", "event", "channel", "." ]
[ "func", "(", "s", "*", "Server", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "eventType", ",", "eventGUID", ",", "payload", ",", "ok", ",", "resp", ":=", "github", ".", "ValidateWebhook", "(", "w", ",", "r", ",", "s", ".", "TokenGenerator", "(", ")", ")", "\n", "if", "counter", ",", "err", ":=", "s", ".", "Metrics", ".", "WebhookCounter", ".", "GetMetricWithLabelValues", "(", "strconv", ".", "Itoa", "(", "resp", ")", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "resp", ",", "}", ")", ".", "WithError", "(", "err", ")", ".", "<mask>", "(", "\"", "\"", ")", "\n", "}", "else", "{", "counter", ".", "Inc", "(", ")", "\n", "}", "\n\n", "if", "!", "ok", "{", "return", "\n", "}", "\n", "fmt", ".", "Fprint", "(", "w", ",", "\"", "\"", ")", "\n\n", "if", "err", ":=", "s", ".", "demuxEvent", "(", "eventType", ",", "eventGUID", ",", "payload", ",", "r", ".", "Header", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "}", "\n", "}" ]
2,663
all-2664
[ "String", "satisfies", "the", "stringer", "interface", "." ]
[ "func", "(", "u", "*", "URL", ")", "String", "(", ")", "string", "{", "p", ":=", "&", "<mask>", ".", "URL", "{", "Scheme", ":", "u", ".", "OriginalScheme", ",", "Opaque", ":", "u", ".", "Opaque", ",", "User", ":", "u", ".", "User", ",", "Host", ":", "u", ".", "Host", ",", "Path", ":", "u", ".", "Path", ",", "RawPath", ":", "u", ".", "RawPath", ",", "RawQuery", ":", "u", ".", "RawQuery", ",", "Fragment", ":", "u", ".", "Fragment", ",", "}", "\n\n", "return", "p", ".", "String", "(", ")", "\n", "}" ]
2,664
all-2665
[ "Cross", "returns", "the", "cross", "product", "of", "two", "vectors", ".", "v", "x", "v1" ]
[ "func", "(", "v", "Vec3", ")", "Cross", "(", "v1", "Vec3", ")", "Vec3", "{", "<mask>", "Vec3", "{", "v", "[", "1", "]", "*", "v1", "[", "2", "]", "-", "v", "[", "2", "]", "*", "v1", "[", "1", "]", ",", "v", "[", "2", "]", "*", "v1", "[", "0", "]", "-", "v", "[", "0", "]", "*", "v1", "[", "2", "]", ",", "v", "[", "0", "]", "*", "v1", "[", "1", "]", "-", "v", "[", "1", "]", "*", "v1", "[", "0", "]", ",", "}", "\n", "}" ]
2,665
all-2666
[ "TransferLeadership", "transfers", "the", "leader", "to", "the", "chosen", "transferee", "." ]
[ "func", "(", "s", "*", "EtcdServer", ")", "TransferLeadership", "(", ")", "error", "{", "if", "!", "s", ".", "isLeader", "(", ")", "{", "if", "lg", ":=", "s", ".", "getLogger", "(", ")", ";", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "s", ".", "ID", "(", ")", ".", "String", "(", ")", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "types", ".", "ID", "(", "s", ".", "Lead", "(", ")", ")", ".", "String", "(", ")", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Printf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}", "\n\n", "if", "!", "s", ".", "isMultiNode", "(", ")", "{", "if", "lg", ":=", "s", ".", "getLogger", "(", ")", ";", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "s", ".", "<mask>", "(", ")", ".", "String", "(", ")", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "types", ".", "ID", "(", "s", ".", "Lead", "(", ")", ")", ".", "String", "(", ")", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Printf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}", "\n\n", "transferee", ",", "ok", ":=", "longestConnected", "(", "s", ".", "r", ".", "transport", ",", "s", ".", "cluster", ".", "MemberIDs", "(", ")", ")", "\n", "if", "!", "ok", "{", "return", "ErrUnhealthy", "\n", "}", "\n\n", "tm", ":=", "s", ".", "Cfg", ".", "ReqTimeout", "(", ")", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "s", ".", "ctx", ",", "tm", ")", "\n", "err", ":=", "s", ".", "MoveLeader", "(", "ctx", ",", "s", ".", "Lead", "(", ")", ",", "uint64", "(", "transferee", ")", ")", "\n", "cancel", "(", ")", "\n", "return", "err", "\n", "}" ]
2,666
all-2667
[ "overrideHeaders", "sets", "headers", "if", "the", "call", "options", "contains", "non", "-", "default", "values", "." ]
[ "func", "(", "c", "*", "CallOptions", ")", "overrideHeaders", "(", "<mask>", "transportHeaders", ")", "{", "if", "c", ".", "Format", "!=", "\"", "\"", "{", "headers", "[", "ArgScheme", "]", "=", "c", ".", "Format", ".", "String", "(", ")", "\n", "}", "\n", "if", "c", ".", "ShardKey", "!=", "\"", "\"", "{", "headers", "[", "ShardKey", "]", "=", "c", ".", "ShardKey", "\n", "}", "\n", "if", "c", ".", "RoutingKey", "!=", "\"", "\"", "{", "headers", "[", "RoutingKey", "]", "=", "c", ".", "RoutingKey", "\n", "}", "\n", "if", "c", ".", "RoutingDelegate", "!=", "\"", "\"", "{", "headers", "[", "RoutingDelegate", "]", "=", "c", ".", "RoutingDelegate", "\n", "}", "\n", "if", "c", ".", "callerName", "!=", "\"", "\"", "{", "headers", "[", "CallerName", "]", "=", "c", ".", "callerName", "\n", "}", "\n", "}" ]
2,667
all-2668
[ "DevicePresence", "returns", "data", "about", "presence", "of", "a", "data" ]
[ "func", "(", "p", "*", "Pushy", ")", "DevicePresence", "(", "deviceID", "...", "string", ")", "(", "*", "DevicePresenceResponse", ",", "*", "Error", ",", "error", ")", "{", "url", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ".", "APIEndpoint", ",", "p", ".", "APIToken", ")", "\n", "var", "devicePresenceResponse", "*", "DevicePresenceResponse", "\n", "<mask>", "pushyErr", "*", "Error", "\n", "err", ":=", "post", "(", "p", ".", "httpClient", ",", "url", ",", "DevicePresenceRequest", "{", "Tokens", ":", "deviceID", "}", ",", "&", "devicePresenceResponse", ",", "&", "pushyErr", ")", "\n", "return", "devicePresenceResponse", ",", "pushyErr", ",", "err", "\n", "}" ]
2,668
all-2669
[ "This", "is", "somewhat", "of", "a", "horrible", "hack", ".", "We", "need", "to", "unset", "GPG_AGENT_INFO", "so", "that", "gpgme", "does", "not", "pass", "--", "use", "-", "agent", "to", "GPG", ".", "os", ".", "Unsetenv", "should", "be", "enough", "but", "that", "only", "calls", "the", "underlying", "C", "library", "(", "which", "gpgme", "uses", ")", "if", "cgo", "is", "involved", "-", "and", "cgo", "can", "t", "be", "used", "in", "tests", ".", "So", "provide", "this", "helper", "for", "test", "initialization", "." ]
[ "func", "unsetenvGPGAgentInfo", "(", ")", "{", "v", ":=", "C", ".", "CString", "(", "\"", "\"", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "v", ")", ")", "\n", "C", ".", "unsetenv", "(", "v", ")", "\n", "}" ]
2,669
all-2670
[ "WithHeaders", "if", "set", "overrides", "the", "request", "headrts", "." ]
[ "func", "(", "p", "ContinueRequestParams", ")", "WithHeaders", "(", "<mask>", "[", "]", "*", "HeaderEntry", ")", "*", "ContinueRequestParams", "{", "p", ".", "Headers", "=", "headers", "\n", "return", "&", "p", "\n", "}" ]
2,670
all-2671
[ "submitChanges", "takes", "a", "zone", "and", "a", "collection", "of", "Changes", "and", "sends", "them", "as", "a", "single", "transaction", "." ]
[ "func", "(", "p", "*", "CloudFlareProvider", ")", "submitChanges", "(", "changes", "[", "]", "*", "cloudFlareChange", ")", "error", "{", "// return early if there is nothing to change", "if", "len", "(", "changes", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "zones", ",", "err", ":=", "p", ".", "Zones", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// separate into per-zone change sets to be passed to the API.", "changesByZone", ":=", "p", ".", "changesByZone", "(", "zones", ",", "changes", ")", "\n\n", "for", "zoneID", ",", "changes", ":=", "range", "changesByZone", "{", "records", ",", "err", ":=", "p", ".", "Client", ".", "DNSRecords", "(", "zoneID", ",", "cloudflare", ".", "DNSRecord", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "for", "_", ",", "change", ":=", "range", "changes", "{", "logFields", ":=", "log", ".", "Fields", "{", "\"", "\"", ":", "change", ".", "ResourceRecordSet", "[", "0", "]", ".", "Name", ",", "\"", "\"", ":", "change", ".", "ResourceRecordSet", "[", "0", "]", ".", "Type", ",", "\"", "\"", ":", "change", ".", "ResourceRecordSet", "[", "0", "]", ".", "TTL", ",", "\"", "\"", ":", "len", "(", "change", ".", "ResourceRecordSet", ")", ",", "\"", "\"", ":", "change", ".", "Action", ",", "\"", "\"", ":", "zoneID", ",", "}", "\n\n", "log", ".", "WithFields", "(", "logFields", ")", ".", "Info", "(", "\"", "\"", ")", "\n\n", "if", "p", ".", "DryRun", "{", "continue", "\n", "}", "\n\n", "recordIDs", ":=", "p", ".", "getRecordIDs", "(", "records", ",", "change", ".", "ResourceRecordSet", "[", "0", "]", ")", "\n\n", "// to simplify bookkeeping for multiple records, an update is executed as delete+create", "if", "change", ".", "Action", "==", "cloudFlareDelete", "||", "change", ".", "Action", "==", "cloudFlareUpdate", "{", "for", "_", ",", "recordID", ":=", "range", "recordIDs", "{", "err", ":=", "p", ".", "Client", ".", "DeleteDNSRecord", "(", "zoneID", ",", "recordID", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "WithFields", "(", "logFields", ")", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "change", ".", "<mask>", "==", "cloudFlareCreate", "||", "change", ".", "Action", "==", "cloudFlareUpdate", "{", "for", "_", ",", "record", ":=", "range", "change", ".", "ResourceRecordSet", "{", "_", ",", "err", ":=", "p", ".", "Client", ".", "CreateDNSRecord", "(", "zoneID", ",", "record", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "WithFields", "(", "logFields", ")", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,671
all-2672
[ "flattenClusterFailoverResourcesAdmissionControlPolicy", "saves", "a", "ClusterFailoverResourcesAdmissionControlPolicy", "into", "the", "supplied", "ResourceData", "." ]
[ "func", "flattenClusterFailoverResourcesAdmissionControlPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "types", ".", "ClusterFailoverResourcesAdmissionControlPolicy", ",", "version", "viapi", ".", "VSphereVersion", ",", ")", "error", "{", "// AutoComputePercentages is a vSphere >= 6.5 feature, but when it's", "// enabled the admission control CPU/memory values will be auto-set and", "// caused spurious diffs, so do a nil check to see if we have the value or", "// if it's disabled before we set the values.", "if", "obj", ".", "AutoComputePercentages", "==", "nil", "||", "!", "*", "obj", ".", "AutoComputePercentages", "{", "err", ":=", "structure", ".", "SetBatch", "(", "d", ",", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "obj", ".", "CpuFailoverResourcesPercent", ",", "\"", "\"", ":", "obj", ".", "MemoryFailoverResourcesPercent", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "if", "version", ".", "Newer", "(", "viapi", ".", "VSphereVersion", "{", "Product", ":", "<mask>", ".", "Product", ",", "Major", ":", "6", ",", "Minor", ":", "5", "}", ")", "{", "return", "structure", ".", "SetBatch", "(", "d", ",", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "obj", ".", "AutoComputePercentages", ",", "\"", "\"", ":", "obj", ".", "FailoverLevel", ",", "}", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,672
all-2673
[ "IsWritable", "is", "a", "wrapper", "around", "g_settings_is_writable", "()", "." ]
[ "func", "(", "v", "*", "Settings", ")", "IsWritable", "(", "<mask>", "string", ")", "bool", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "name", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n\n", "return", "gobool", "(", "C", ".", "g_settings_is_writable", "(", "v", ".", "native", "(", ")", ",", "cstr1", ")", ")", "\n", "}" ]
2,673
all-2674
[ "Task", "creates", "a", "Task", "that", "will", "invoke", "the", "function", ".", "Its", "parameters", "may", "be", "tweaked", "before", "adding", "it", "to", "a", "queue", ".", "Users", "should", "not", "modify", "the", "Path", "or", "Payload", "fields", "of", "the", "returned", "Task", "." ]
[ "func", "(", "f", "*", "Function", ")", "Task", "(", "args", "...", "interface", "{", "}", ")", "(", "*", "taskqueue", ".", "Task", ",", "error", ")", "{", "if", "f", ".", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "f", ".", "err", ")", "\n", "}", "\n\n", "nArgs", ":=", "len", "(", "args", ")", "+", "1", "// +1 for the context.Context", "\n", "ft", ":=", "f", ".", "fv", ".", "Type", "(", ")", "\n", "minArgs", ":=", "ft", ".", "NumIn", "(", ")", "\n", "if", "ft", ".", "IsVariadic", "(", ")", "{", "minArgs", "--", "\n", "}", "\n", "if", "nArgs", "<", "minArgs", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "nArgs", ",", "minArgs", ")", "\n", "}", "\n", "if", "!", "ft", ".", "IsVariadic", "(", ")", "&&", "nArgs", ">", "minArgs", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "nArgs", ",", "minArgs", ")", "\n", "}", "\n\n", "// Check arg types.", "for", "i", ":=", "1", ";", "i", "<", "nArgs", ";", "i", "++", "{", "at", ":=", "reflect", ".", "TypeOf", "(", "args", "[", "i", "-", "1", "]", ")", "\n", "var", "dt", "reflect", ".", "Type", "\n", "if", "i", "<", "minArgs", "{", "// not a variadic arg", "dt", "=", "ft", ".", "In", "(", "i", ")", "\n", "}", "else", "{", "// a variadic arg", "dt", "=", "ft", ".", "In", "(", "minArgs", ")", ".", "Elem", "(", ")", "\n", "}", "\n", "// nil arguments won't have a type, so they need special handling.", "if", "at", "==", "nil", "{", "// nil interface", "<mask>", "dt", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Chan", ",", "reflect", ".", "Func", ",", "reflect", ".", "Interface", ",", "reflect", ".", "Map", ",", "reflect", ".", "Ptr", ",", "reflect", ".", "Slice", ":", "continue", "// may be nil", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "i", ",", "dt", ")", "\n", "}", "\n", "switch", "at", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Chan", ",", "reflect", ".", "Func", ",", "reflect", ".", "Interface", ",", "reflect", ".", "Map", ",", "reflect", ".", "Ptr", ",", "reflect", ".", "Slice", ":", "av", ":=", "reflect", ".", "ValueOf", "(", "args", "[", "i", "-", "1", "]", ")", "\n", "if", "av", ".", "IsNil", "(", ")", "{", "// nil value in interface; not supported by gob, so we replace it", "// with a nil interface value", "args", "[", "i", "-", "1", "]", "=", "nil", "\n", "}", "\n", "}", "\n", "if", "!", "at", ".", "AssignableTo", "(", "dt", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "i", ",", "at", ",", "dt", ")", "\n", "}", "\n", "}", "\n\n", "inv", ":=", "invocation", "{", "Key", ":", "f", ".", "key", ",", "Args", ":", "args", ",", "}", "\n\n", "buf", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "if", "err", ":=", "gob", ".", "NewEncoder", "(", "buf", ")", ".", "Encode", "(", "inv", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "&", "taskqueue", ".", "Task", "{", "Path", ":", "path", ",", "Payload", ":", "buf", ".", "Bytes", "(", ")", ",", "}", ",", "nil", "\n", "}" ]
2,674
all-2675
[ "addWarning", "builds", "a", "non", "-", "severe", "Error", "and", "appends", "to", "the", "Part", "error", "slice", "." ]
[ "func", "(", "p", "*", "Part", ")", "addWarning", "(", "name", "string", ",", "detailFmt", "string", ",", "args", "...", "<mask>", "{", "}", ")", "{", "p", ".", "Errors", "=", "append", "(", "p", ".", "Errors", ",", "&", "Error", "{", "name", ",", "fmt", ".", "Sprintf", "(", "detailFmt", ",", "args", "...", ")", ",", "false", ",", "}", ")", "\n", "}" ]
2,675
all-2676
[ "FromItem", "implements", "the", "Object", "interface" ]
[ "func", "(", "in", "*", "ResourcesConfigObject", ")", "FromItem", "(", "i", "common", ".", "Item", ")", "{", "c", ",", "err", ":=", "common", ".", "ItemToResourcesConfig", "(", "i", ")", "\n", "if", "err", "==", "nil", "{", "<mask>", ".", "fromConfig", "(", "c", ")", "\n", "}", "\n", "}" ]
2,676
all-2677
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniform3iv", "(", "program", "uint32", ",", "location", "int32", ",", "count", "int32", ",", "value", "*", "int32", ")", "{", "syscall", ".", "Syscall6", "(", "gpProgramUniform3iv", ",", "4", ",", "uintptr", "(", "program", ")", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "count", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
2,677
all-2678
[ "readRuntimeConstants", "populates", "the", "p", ".", "rtConstants", "map", "." ]
[ "func", "(", "p", "*", "Process", ")", "readRuntimeConstants", "(", ")", "{", "p", ".", "rtConstants", "=", "map", "[", "string", "]", "int64", "{", "}", "\n\n", "// Hardcoded values for Go 1.9.", "// (Go did not have constants in DWARF before 1.10.)", "m", ":=", "p", ".", "rtConstants", "\n", "m", "[", "\"", "\"", "]", "=", "0", "\n", "m", "[", "\"", "\"", "]", "=", "1", "\n", "m", "[", "\"", "\"", "]", "=", "2", "\n", "m", "[", "\"", "\"", "]", "=", "3", "\n", "m", "[", "\"", "\"", "]", "=", "0", "\n", "m", "[", "\"", "\"", "]", "=", "1", "\n", "m", "[", "\"", "\"", "]", "=", "2", "\n", "m", "[", "\"", "\"", "]", "=", "3", "\n", "m", "[", "\"", "\"", "]", "=", "4", "\n", "m", "[", "\"", "\"", "]", "=", "6", "\n", "m", "[", "\"", "\"", "]", "=", "0x1000", "\n", "m", "[", "\"", "\"", "]", "=", "0", "\n", "m", "[", "\"", "\"", "]", "=", "1", "\n", "m", "[", "\"", "\"", "]", "=", "0", "\n", "m", "[", "\"", "\"", "]", "=", "1", "<<", "1", "\n", "m", "[", "\"", "\"", "]", "=", "1", "<<", "6", "\n", "m", "[", "\"", "\"", "]", "=", "1", "<<", "5", "\n", "m", "[", "\"", "\"", "]", "=", "1", "<<", "13", "\n", "m", "[", "\"", "\"", "]", "=", "1", "\n\n", "// From 1.10, these constants are recorded in DWARF records.", "d", ",", "_", ":=", "p", ".", "proc", ".", "DWARF", "(", ")", "\n", "r", ":=", "d", ".", "Reader", "(", ")", "\n", "for", "e", ",", "err", ":=", "r", ".", "Next", "(", ")", ";", "e", "!=", "nil", "&&", "err", "==", "nil", ";", "e", ",", "err", "=", "r", ".", "Next", "(", ")", "{", "if", "e", ".", "Tag", "!=", "dwarf", ".", "TagConstant", "{", "continue", "\n", "}", "\n", "f", ":=", "e", ".", "AttrField", "(", "dwarf", ".", "AttrName", ")", "\n", "if", "f", "==", "nil", "{", "continue", "\n", "}", "\n", "name", ":=", "f", ".", "Val", ".", "(", "string", ")", "\n", "if", "!", "strings", ".", "HasPrefix", "(", "name", ",", "\"", "\"", ")", "{", "continue", "\n", "}", "\n", "name", "=", "<mask>", "[", "8", ":", "]", "\n", "c", ":=", "e", ".", "AttrField", "(", "dwarf", ".", "AttrConstValue", ")", "\n", "if", "c", "==", "nil", "{", "continue", "\n", "}", "\n", "p", ".", "rtConstants", "[", "name", "]", "=", "c", ".", "Val", ".", "(", "int64", ")", "\n", "}", "\n", "}" ]
2,678
all-2679
[ "UpdateAll", "signals", "update", "for", "all", "resources", "hold", "by", "the", "client", "." ]
[ "func", "(", "c", "*", "Client", ")", "UpdateAll", "(", "state", "string", ")", "error", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "resources", ",", "err", ":=", "c", ".", "storage", ".", "List", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "resources", ")", "==", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "allErrors", "error", "\n", "for", "_", ",", "r", ":=", "range", "resources", "{", "if", "err", ":=", "c", ".", "update", "(", "r", ".", "GetName", "(", ")", ",", "state", ",", "nil", ")", ";", "err", "!=", "nil", "{", "allErrors", "=", "multierror", ".", "Append", "(", "allErrors", ",", "err", ")", "\n", "continue", "\n", "}", "\n", "if", "err", ":=", "c", ".", "updateLocalResource", "(", "r", ",", "<mask>", ",", "nil", ")", ";", "err", "!=", "nil", "{", "allErrors", "=", "multierror", ".", "Append", "(", "allErrors", ",", "err", ")", "\n", "}", "\n", "}", "\n", "return", "allErrors", "\n", "}" ]
2,679
all-2680
[ "Range", "returns", "the", "points", "within", "the", "range", "defined", "by", "top", "left", "and", "bottom", "right", "." ]
[ "func", "(", "points", "*", "PointsIndex", ")", "Range", "(", "topLeft", "<mask>", ",", "bottomRight", "Point", ")", "[", "]", "Point", "{", "entries", ":=", "points", ".", "index", ".", "Range", "(", "topLeft", ",", "bottomRight", ")", "\n", "accept", ":=", "func", "(", "point", "Point", ")", "bool", "{", "return", "between", "(", "point", ".", "Lat", "(", ")", ",", "bottomRight", ".", "Lat", "(", ")", ",", "topLeft", ".", "Lat", "(", ")", ")", "&&", "between", "(", "point", ".", "Lon", "(", ")", ",", "topLeft", ".", "Lon", "(", ")", ",", "bottomRight", ".", "Lon", "(", ")", ")", "\n", "}", "\n\n", "return", "getPoints", "(", "entries", ",", "accept", ")", "\n", "}" ]
2,680
all-2681
[ "Get", "gets", "the", "value", "by", "key", "as", "it", "exists", "for", "the", "current", "goroutine", "." ]
[ "func", "Get", "(", "<mask>", "string", ")", "interface", "{", "}", "{", "gid", ":=", "curGoroutineID", "(", ")", "\n", "dataLock", ".", "RLock", "(", ")", "\n", "if", "data", "[", "gid", "]", "==", "nil", "{", "dataLock", ".", "RUnlock", "(", ")", "\n", "return", "nil", "\n", "}", "\n", "value", ":=", "data", "[", "gid", "]", "[", "key", "]", "\n", "dataLock", ".", "RUnlock", "(", ")", "\n", "return", "value", "\n", "}" ]
2,681
all-2682
[ "GenerateRule", "returns", "a", "repository", "rule", "for", "the", "given", "repository", "that", "can", "be", "written", "in", "a", "WORKSPACE", "file", "." ]
[ "func", "GenerateRule", "(", "repo", "Repo", ")", "*", "rule", ".", "Rule", "{", "r", ":=", "rule", ".", "NewRule", "(", "\"", "\"", ",", "repo", ".", "Name", ")", "\n", "if", "repo", ".", "Commit", "!=", "\"", "\"", "{", "r", ".", "SetAttr", "(", "\"", "\"", ",", "repo", ".", "Commit", ")", "\n", "}", "\n", "if", "repo", ".", "<mask>", "!=", "\"", "\"", "{", "r", ".", "SetAttr", "(", "\"", "\"", ",", "repo", ".", "Tag", ")", "\n", "}", "\n", "r", ".", "SetAttr", "(", "\"", "\"", ",", "repo", ".", "GoPrefix", ")", "\n", "if", "repo", ".", "Remote", "!=", "\"", "\"", "{", "r", ".", "SetAttr", "(", "\"", "\"", ",", "repo", ".", "Remote", ")", "\n", "}", "\n", "if", "repo", ".", "VCS", "!=", "\"", "\"", "{", "r", ".", "SetAttr", "(", "\"", "\"", ",", "repo", ".", "VCS", ")", "\n", "}", "\n", "if", "repo", ".", "Version", "!=", "\"", "\"", "{", "r", ".", "SetAttr", "(", "\"", "\"", ",", "repo", ".", "Version", ")", "\n", "}", "\n", "if", "repo", ".", "Sum", "!=", "\"", "\"", "{", "r", ".", "SetAttr", "(", "\"", "\"", ",", "repo", ".", "Sum", ")", "\n", "}", "\n", "if", "repo", ".", "Replace", "!=", "\"", "\"", "{", "r", ".", "SetAttr", "(", "\"", "\"", ",", "repo", ".", "Replace", ")", "\n", "}", "\n", "return", "r", "\n", "}" ]
2,682
all-2683
[ "SetResolutionXY", "()", "is", "a", "wrapper", "around", "gtk_print_settings_set_resolution_xy", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintSettings", ")", "SetResolutionXY", "(", "resolutionX", ",", "resolutionY", "int", ")", "{", "C", ".", "gtk_print_settings_set_resolution_xy", "(", "ps", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "resolutionX", ")", ",", "C", ".", "gint", "(", "resolutionY", ")", ")", "\n", "}" ]
2,683
all-2684
[ "DeleteJob", "deletes", "the", "job", "with", "the", "given", "id", "." ]
[ "func", "(", "c", "*", "Client", ")", "DeleteJob", "(", "id", "string", ")", "error", "{", "return", "c", ".", "<mask>", "(", "[", "]", "string", "{", "\"", "\"", ",", "id", "}", ")", "\n", "}" ]
2,684
all-2685
[ "iterDir", "iterates", "through", "the", "nodes", "under", "path", "it", "errors", "with", "PathNotFound", "if", "path", "doesn", "t", "exist", "it", "errors", "with", "PathConflict", "if", "path", "exists", "but", "isn", "t", "a", "directory", "." ]
[ "func", "iterDir", "(", "tx", "*", "bolt", ".", "Tx", ",", "<mask>", "string", ",", "f", "func", "(", "k", ",", "v", "[", "]", "byte", ",", "c", "*", "bolt", ".", "Cursor", ")", "error", ")", "error", "{", "node", ",", "err", ":=", "get", "(", "tx", ",", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "node", ".", "DirNode", "==", "nil", "{", "return", "errorf", "(", "PathConflict", ",", "\"", "\\\"", "\\\"", "\"", ",", "path", ")", "\n", "}", "\n", "c", ":=", "NewChildCursor", "(", "tx", ",", "path", ")", "\n", "for", "k", ",", "v", ":=", "c", ".", "K", "(", ")", ",", "c", ".", "V", "(", ")", ";", "k", "!=", "nil", ";", "k", ",", "v", "=", "c", ".", "Next", "(", ")", "{", "if", "err", ":=", "f", "(", "k", ",", "v", ",", "c", ".", "c", ")", ";", "err", "!=", "nil", "{", "if", "err", "==", "errutil", ".", "ErrBreak", "{", "return", "nil", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,685
all-2686
[ "readFull", "wraps", "io", ".", "ReadFull", "to", "return", "io", ".", "ErrUnexpectedEOF", "instead", "of", "io", ".", "EOF", "when", "0", "bytes", "are", "read", "." ]
[ "func", "readFull", "(", "r", "io", ".", "Reader", ",", "buf", "[", "]", "<mask>", ")", "error", "{", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "r", ",", "buf", ")", "\n", "if", "err", "==", "io", ".", "EOF", "{", "return", "io", ".", "ErrUnexpectedEOF", "\n", "}", "\n", "return", "err", "\n", "}" ]
2,686
all-2687
[ "FillFrom", "fills", "the", "buffer", "from", "a", "reader" ]
[ "func", "(", "r", "*", "ReadBuffer", ")", "FillFrom", "(", "ior", "<mask>", ".", "Reader", ",", "n", "int", ")", "(", "int", ",", "error", ")", "{", "if", "len", "(", "r", ".", "buffer", ")", "<", "n", "{", "return", "0", ",", "ErrEOF", "\n", "}", "\n\n", "r", ".", "err", "=", "nil", "\n", "r", ".", "remaining", "=", "r", ".", "buffer", "[", ":", "n", "]", "\n", "return", "io", ".", "ReadFull", "(", "ior", ",", "r", ".", "remaining", ")", "\n", "}" ]
2,687
all-2688
[ "recordsForDNS", "gets", "the", "current", "records", ".", "Returns", "the", "current", "records", "or", "an", "error", "if", "the", "operation", "failed", "." ]
[ "func", "(", "p", "*", "AlibabaCloudProvider", ")", "recordsForDNS", "(", ")", "(", "endpoints", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "_", "error", ")", "{", "records", ",", "err", ":=", "p", ".", "records", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "for", "_", ",", "recordList", ":=", "range", "p", ".", "groupRecords", "(", "records", ")", "{", "name", ":=", "p", ".", "getDNSName", "(", "recordList", "[", "0", "]", ".", "RR", ",", "recordList", "[", "0", "]", ".", "DomainName", ")", "\n", "recordType", ":=", "recordList", "[", "0", "]", ".", "Type", "\n", "ttl", ":=", "recordList", "[", "0", "]", ".", "TTL", "\n\n", "if", "ttl", "==", "defaultAlibabaCloudRecordTTL", "{", "ttl", "=", "0", "\n", "}", "\n\n", "var", "targets", "[", "]", "string", "\n", "for", "_", ",", "record", ":=", "range", "recordList", "{", "target", ":=", "record", ".", "<mask>", "\n", "if", "recordType", "==", "\"", "\"", "{", "target", "=", "p", ".", "unescapeTXTRecordValue", "(", "target", ")", "\n", "}", "\n", "targets", "=", "append", "(", "targets", ",", "target", ")", "\n", "}", "\n", "ep", ":=", "endpoint", ".", "NewEndpointWithTTL", "(", "name", ",", "recordType", ",", "endpoint", ".", "TTL", "(", "ttl", ")", ",", "targets", "...", ")", "\n", "endpoints", "=", "append", "(", "endpoints", ",", "ep", ")", "\n", "}", "\n", "return", "endpoints", ",", "nil", "\n", "}" ]
2,688
all-2689
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventLoadingFailed", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork54", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
2,689
all-2690
[ "CONTRACT", ":", "rv", ".", "CanAddr", "()", "is", "true", "." ]
[ "func", "(", "cdc", "*", "Codec", ")", "decodeReflectJSONSlice", "(", "bz", "[", "]", "byte", ",", "<mask>", "*", "TypeInfo", ",", "rv", "reflect", ".", "Value", ",", "fopts", "FieldOptions", ")", "(", "err", "error", ")", "{", "if", "!", "rv", ".", "CanAddr", "(", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "printLog", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "defer", "func", "(", ")", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "}", "(", ")", "\n", "}", "\n\n", "var", "ert", "=", "info", ".", "Type", ".", "Elem", "(", ")", "\n\n", "switch", "ert", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Uint8", ":", "// Special case: byte slice", "err", "=", "json", ".", "Unmarshal", "(", "bz", ",", "rv", ".", "Addr", "(", ")", ".", "Interface", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "if", "rv", ".", "Len", "(", ")", "==", "0", "{", "// Special case when length is 0.", "// NOTE: We prefer nil slices.", "rv", ".", "Set", "(", "info", ".", "ZeroValue", ")", "\n", "}", "else", "{", "// NOTE: Already set via json.Unmarshal() above.", "}", "\n", "return", "\n\n", "default", ":", "// General case.", "var", "einfo", "*", "TypeInfo", "\n", "einfo", ",", "err", "=", "cdc", ".", "getTypeInfo_wlock", "(", "ert", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "// Read into rawSlice.", "var", "rawSlice", "[", "]", "json", ".", "RawMessage", "\n", "if", "err", "=", "json", ".", "Unmarshal", "(", "bz", ",", "&", "rawSlice", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "// Special case when length is 0.", "// NOTE: We prefer nil slices.", "var", "length", "=", "len", "(", "rawSlice", ")", "\n", "if", "length", "==", "0", "{", "rv", ".", "Set", "(", "info", ".", "ZeroValue", ")", "\n", "return", "\n", "}", "\n\n", "// Read into a new slice.", "var", "esrt", "=", "reflect", ".", "SliceOf", "(", "ert", ")", "// TODO could be optimized.", "\n", "var", "srv", "=", "reflect", ".", "MakeSlice", "(", "esrt", ",", "length", ",", "length", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "length", ";", "i", "++", "{", "erv", ":=", "srv", ".", "Index", "(", "i", ")", "\n", "ebz", ":=", "rawSlice", "[", "i", "]", "\n", "err", "=", "cdc", ".", "decodeReflectJSON", "(", "ebz", ",", "einfo", ",", "erv", ",", "fopts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "}", "\n\n", "// TODO do we need this extra step?", "rv", ".", "Set", "(", "srv", ")", "\n", "return", "\n", "}", "\n", "}" ]
2,690
all-2691
[ "ListenAndServe", "listens", "on", "the", "TCP", "network", "address", "server", ".", "Addr", "and", "then", "spawns", "a", "call", "to", "the", "ServeTELNET", "method", "on", "the", "server", ".", "Handler", "to", "serve", "each", "incoming", "connection", ".", "For", "a", "simple", "example", ":", "package", "main", "import", "(", "github", ".", "com", "/", "reiver", "/", "go", "-", "telnet", ")", "func", "main", "()", "{", "var", "handler", "telnet", ".", "Handler", "=", "telnet", ".", "EchoHandler", "server", ":", "=", "&telnet", ".", "Server", "{", "Addr", ":", ":", "5555", "Handler", ":", "handler", "}", "err", ":", "=", "server", ".", "ListenAndServe", "()", "if", "nil", "!", "=", "err", "{", "//" ]
[ "func", "(", "server", "*", "Server", ")", "ListenAndServe", "(", ")", "error", "{", "addr", ":=", "server", ".", "Addr", "\n", "if", "\"", "\"", "==", "addr", "{", "addr", "=", "\"", "\"", "\n", "}", "\n\n\n", "listener", ",", "err", ":=", "<mask>", ".", "Listen", "(", "\"", "\"", ",", "addr", ")", "\n", "if", "nil", "!=", "err", "{", "return", "err", "\n", "}", "\n\n\n", "return", "server", ".", "Serve", "(", "listener", ")", "\n", "}" ]
2,691
all-2692
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RemoteLocation", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
2,692
all-2693
[ "OptQueryColumnAttrs", "enables", "returning", "column", "attributes", "in", "the", "result", "." ]
[ "func", "OptQueryColumnAttrs", "(", "<mask>", "bool", ")", "QueryOption", "{", "return", "func", "(", "options", "*", "QueryOptions", ")", "error", "{", "options", ".", "ColumnAttrs", "=", "enable", "\n", "return", "nil", "\n", "}", "\n", "}" ]
2,693
all-2694
[ "TargetsDropped", "returns", "the", "dropped", "targets", "during", "relabelling", "." ]
[ "func", "(", "m", "*", "Manager", ")", "TargetsDropped", "(", ")", "map", "[", "string", "]", "[", "]", "*", "Target", "{", "m", ".", "mtxScrape", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mtxScrape", ".", "Unlock", "(", ")", "\n\n", "targets", ":=", "make", "(", "<mask>", "[", "string", "]", "[", "]", "*", "Target", ",", "len", "(", "m", ".", "scrapePools", ")", ")", "\n", "for", "tset", ",", "sp", ":=", "range", "m", ".", "scrapePools", "{", "targets", "[", "tset", "]", "=", "sp", ".", "DroppedTargets", "(", ")", "\n", "}", "\n", "return", "targets", "\n", "}" ]
2,694
all-2695
[ "title", ":", "event", "list", "path", ":", "/", "events", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "OK", "204", ":", "No", "content" ]
[ "func", "eventList", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "var", "filter", "*", "event", ".", "Filter", "\n", "err", ":=", "ParseInput", "(", "r", ",", "&", "filter", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "filter", ".", "LoadKindNames", "(", "r", ".", "Form", ")", "\n", "filter", ".", "PruneUserValues", "(", ")", "\n", "filter", ".", "Permissions", ",", "err", "=", "t", ".", "Permissions", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "events", ",", "err", ":=", "event", ".", "List", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "events", ")", "==", "0", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusNoContent", ")", "\n", "return", "nil", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "events", ")", "\n", "}" ]
2,695
all-2696
[ "SetPadding", "is", "a", "wrapper", "around", "gtk_alignment_set_padding", "()", "." ]
[ "func", "(", "v", "*", "Alignment", ")", "SetPadding", "(", "top", ",", "bottom", ",", "left", ",", "right", "uint", ")", "{", "C", ".", "gtk_alignment_set_padding", "(", "v", ".", "native", "(", ")", ",", "C", ".", "guint", "(", "top", ")", ",", "C", ".", "guint", "(", "bottom", ")", ",", "C", ".", "guint", "(", "left", ")", ",", "C", ".", "guint", "(", "<mask>", ")", ")", "\n", "}" ]
2,696
all-2697
[ "PerformAt", "performs", "a", "job", "at", "a", "particular", "time", "using", "a", "goroutine", "." ]
[ "func", "(", "w", "Simple", ")", "PerformAt", "(", "job", "<mask>", ",", "t", "time", ".", "Time", ")", "error", "{", "return", "w", ".", "PerformIn", "(", "job", ",", "time", ".", "Until", "(", "t", ")", ")", "\n", "}" ]
2,697
all-2698
[ "GetWindow", "is", "a", "wrapper", "around", "gdk_gl_context_get_window", "()", "." ]
[ "func", "(", "v", "*", "GLContext", ")", "GetSurface", "(", ")", "(", "*", "Window", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gdk_gl_context_get_window", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "return", "&", "Window", "{", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "}", ",", "nil", "\n", "}" ]
2,698
all-2699
[ "Gets", "all", "build", "ids", "for", "a", "job", "." ]
[ "func", "(", "bucket", "gcsBucket", ")", "listBuildIDs", "(", "root", "string", ")", "(", "[", "]", "int64", ",", "error", ")", "{", "ids", ":=", "[", "]", "int64", "{", "}", "\n", "if", "strings", ".", "HasPrefix", "(", "root", ",", "logsPrefix", ")", "{", "dirs", ",", "err", ":=", "bucket", ".", "listSubDirs", "(", "root", ")", "\n", "if", "err", "!=", "nil", "{", "return", "ids", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "for", "_", ",", "dir", ":=", "range", "dirs", "{", "i", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "path", ".", "<mask>", "(", "dir", ")", ",", "10", ",", "64", ")", "\n", "if", "err", "==", "nil", "{", "ids", "=", "append", "(", "ids", ",", "i", ")", "\n", "}", "else", "{", "logrus", ".", "Warningf", "(", "\"", "\"", ",", "dir", ")", "\n", "}", "\n", "}", "\n", "}", "else", "{", "keys", ",", "err", ":=", "bucket", ".", "listAll", "(", "root", ")", "\n", "if", "err", "!=", "nil", "{", "return", "ids", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "for", "_", ",", "key", ":=", "range", "keys", "{", "matches", ":=", "linkRe", ".", "FindStringSubmatch", "(", "key", ")", "\n", "if", "len", "(", "matches", ")", "==", "2", "{", "i", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "matches", "[", "1", "]", ",", "10", ",", "64", ")", "\n", "if", "err", "==", "nil", "{", "ids", "=", "append", "(", "ids", ",", "i", ")", "\n", "}", "else", "{", "logrus", ".", "Warningf", "(", "\"", "\"", ",", "key", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "ids", ",", "nil", "\n", "}" ]
2,699
all-2700
[ "TotalRootSnapshots", "returns", "the", "number", "of", "top", "-", "level", "(", "root", ")", "snapshots", "belonging", "to", "a", "virtual", "machine", ".", "Remarks", ":", "*", "This", "function", "returns", "the", "number", "of", "top", "-", "level", "(", "root", ")", "snapshots", "belonging", "to", "a", "virtual", "machine", ".", "A", "top", "-", "level", "snapshot", "is", "one", "that", "is", "not", "based", "on", "any", "previous", "snapshot", ".", "If", "the", "virtual", "machine", "has", "more", "than", "one", "snapshot", "the", "snapshots", "can", "be", "a", "sequence", "in", "which", "each", "snapshot", "is", "based", "on", "the", "previous", "one", "leaving", "only", "a", "single", "top", "-", "level", "snapshot", ".", "However", "if", "applications", "create", "branched", "trees", "of", "snapshots", "a", "single", "virtual", "machine", "can", "have", "several", "top", "-", "level", "snapshots", ".", "*", "VMware", "Server", "can", "manage", "only", "a", "single", "snapshot", "for", "each", "virtual", "machine", ".", "All", "other", "snapshots", "in", "a", "sequence", "are", "ignored", ".", "The", "return", "value", "is", "always", "0", "or", "1", ".", "*", "This", "function", "is", "not", "supported", "when", "using", "the", "VMWARE_PLAYER", "provider", "Since", "VMware", "Workstation", "6", ".", "0" ]
[ "func", "(", "v", "*", "VM", ")", "TotalRootSnapshots", "(", ")", "(", "int", ",", "error", ")", "{", "var", "<mask>", "C", ".", "int", "\n", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n\n", "err", "=", "C", ".", "VixVM_GetNumRootSnapshots", "(", "v", ".", "handle", ",", "&", "result", ")", "\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "0", ",", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "return", "int", "(", "result", ")", ",", "nil", "\n", "}" ]