id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
6,000
all-6001
[ "DeleteOutlierReportByCID", "deletes", "outlier", "report", "with", "passed", "cid", "." ]
[ "func", "(", "a", "*", "API", ")", "DeleteOutlierReportByCID", "(", "cid", "CIDType", ")", "(", "bool", ",", "error", ")", "{", "if", "cid", "==", "nil", "||", "*", "cid", "==", "\"", "\"", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "reportCID", ":=", "string", "(", "*", "cid", ")", "\n\n", "matched", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "OutlierReportCIDRegex", ",", "reportCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "reportCID", ")", "\n", "}", "\n\n", "_", ",", "err", "=", "a", ".", "Delete", "(", "reportCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "<mask>", ",", "err", "\n", "}", "\n\n", "return", "true", ",", "nil", "\n", "}" ]
6,001
all-6002
[ "IsSameArray", "returns", "true", "if", "the", "slices", "are", "the", "same", "length", "and", "the", "array", "underlying", "the", "two", "slices", "is", "the", "same", ".", "Always", "returns", "false", "for", "empty", "arrays", "." ]
[ "func", "isSameArray", "(", "val1", ",", "val2", "[", "]", "byte", ")", "bool", "{", "if", "len", "(", "val1", ")", "==", "len", "(", "val2", ")", "&&", "len", "(", "val1", ")", ">", "0", "{", "return", "&", "val1", "[", "0", "]", "==", "&", "val2", "[", "0", "]", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
6,002
all-6003
[ "MakeFakeRepo", "creates", "the", "given", "repo", "and", "makes", "an", "initial", "commit", "." ]
[ "func", "(", "lg", "*", "LocalGit", ")", "MakeFakeRepo", "(", "org", ",", "repo", "string", ")", "error", "{", "rdir", ":=", "filepath", ".", "Join", "(", "lg", ".", "Dir", ",", "org", ",", "repo", ")", "\n", "if", "err", ":=", "os", ".", "MkdirAll", "(", "rdir", ",", "<mask>", ".", "ModePerm", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "runCmd", "(", "lg", ".", "Git", ",", "rdir", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "runCmd", "(", "lg", ".", "Git", ",", "rdir", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "runCmd", "(", "lg", ".", "Git", ",", "rdir", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "runCmd", "(", "lg", ".", "Git", ",", "rdir", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "lg", ".", "AddCommit", "(", "org", ",", "repo", ",", "map", "[", "string", "]", "[", "]", "byte", "{", "\"", "\"", ":", "{", "}", "}", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
6,003
all-6004
[ "NewMember", "creates", "a", "Member", "without", "an", "ID", "and", "generates", "one", "based", "on", "the", "cluster", "name", "peer", "URLs", "and", "time", ".", "This", "is", "used", "for", "bootstrapping", "/", "adding", "new", "member", "." ]
[ "func", "NewMember", "(", "<mask>", "string", ",", "peerURLs", "types", ".", "URLs", ",", "clusterName", "string", ",", "now", "*", "time", ".", "Time", ")", "*", "Member", "{", "m", ":=", "&", "Member", "{", "RaftAttributes", ":", "RaftAttributes", "{", "PeerURLs", ":", "peerURLs", ".", "StringSlice", "(", ")", "}", ",", "Attributes", ":", "Attributes", "{", "Name", ":", "name", "}", ",", "}", "\n\n", "var", "b", "[", "]", "byte", "\n", "sort", ".", "Strings", "(", "m", ".", "PeerURLs", ")", "\n", "for", "_", ",", "p", ":=", "range", "m", ".", "PeerURLs", "{", "b", "=", "append", "(", "b", ",", "[", "]", "byte", "(", "p", ")", "...", ")", "\n", "}", "\n\n", "b", "=", "append", "(", "b", ",", "[", "]", "byte", "(", "clusterName", ")", "...", ")", "\n", "if", "now", "!=", "nil", "{", "b", "=", "append", "(", "b", ",", "[", "]", "byte", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "now", ".", "Unix", "(", ")", ")", ")", "...", ")", "\n", "}", "\n\n", "hash", ":=", "sha1", ".", "Sum", "(", "b", ")", "\n", "m", ".", "ID", "=", "types", ".", "ID", "(", "binary", ".", "BigEndian", ".", "Uint64", "(", "hash", "[", ":", "8", "]", ")", ")", "\n", "return", "m", "\n", "}" ]
6,004
all-6005
[ "Pick", "an", "address", "to", "connect", "to", "with", "new", "/", "old", "bias", "." ]
[ "func", "(", "a", "*", "AddrBook", ")", "PickAddress", "(", "newBias", "int", ")", "*", "NetAddress", "{", "a", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "if", "a", ".", "size", "(", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "if", "newBias", ">", "100", "{", "newBias", "=", "100", "\n", "}", "\n", "if", "newBias", "<", "0", "{", "newBias", "=", "0", "\n", "}", "\n\n", "// Bias between new and old addresses.", "oldCorrelation", ":=", "math", ".", "Sqrt", "(", "float64", "(", "a", ".", "nOld", ")", ")", "*", "(", "100.0", "-", "float64", "(", "newBias", ")", ")", "\n", "newCorrelation", ":=", "math", ".", "Sqrt", "(", "float64", "(", "a", ".", "nNew", ")", ")", "*", "float64", "(", "newBias", ")", "\n\n", "if", "(", "newCorrelation", "+", "oldCorrelation", ")", "*", "a", ".", "rand", ".", "Float64", "(", ")", "<", "oldCorrelation", "{", "// pick random Old bucket.", "var", "bucket", "map", "[", "string", "]", "*", "knownAddress", "=", "nil", "\n", "for", "len", "(", "bucket", ")", "==", "0", "{", "bucket", "=", "a", ".", "addrOld", "[", "a", ".", "rand", ".", "Intn", "(", "len", "(", "a", ".", "addrOld", ")", ")", "]", "\n", "}", "\n", "// pick a random ka from bucket.", "randIndex", ":=", "a", ".", "<mask>", ".", "Intn", "(", "len", "(", "bucket", ")", ")", "\n", "for", "_", ",", "ka", ":=", "range", "bucket", "{", "if", "randIndex", "==", "0", "{", "return", "ka", ".", "Addr", "\n", "}", "\n", "randIndex", "--", "\n", "}", "\n", "PanicSanity", "(", "\"", "\"", ")", "\n", "}", "else", "{", "// pick random New bucket.", "var", "bucket", "map", "[", "string", "]", "*", "knownAddress", "=", "nil", "\n", "for", "len", "(", "bucket", ")", "==", "0", "{", "bucket", "=", "a", ".", "addrNew", "[", "a", ".", "rand", ".", "Intn", "(", "len", "(", "a", ".", "addrNew", ")", ")", "]", "\n", "}", "\n", "// pick a random ka from bucket.", "randIndex", ":=", "a", ".", "rand", ".", "Intn", "(", "len", "(", "bucket", ")", ")", "\n", "for", "_", ",", "ka", ":=", "range", "bucket", "{", "if", "randIndex", "==", "0", "{", "return", "ka", ".", "Addr", "\n", "}", "\n", "randIndex", "--", "\n", "}", "\n", "PanicSanity", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,005
all-6006
[ "determine", "if", "a", "name", "corresponds", "to", "a", "display", "list" ]
[ "func", "IsList", "(", "list", "uint32", ")", "bool", "{", "<mask>", ":=", "C", ".", "glowIsList", "(", "gpIsList", ",", "(", "C", ".", "GLuint", ")", "(", "list", ")", ")", "\n", "return", "ret", "==", "TRUE", "\n", "}" ]
6,006
all-6007
[ "HasId", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "b", "*", "BoardWidget", ")", "HasId", "(", ")", "bool", "{", "if", "b", "!=", "nil", "&&", "b", ".", "Id", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
6,007
all-6008
[ "NewTemplate", "parses", "the", "given", "template", "using", "the", "given", "startTag", "and", "endTag", "as", "tag", "start", "and", "tag", "end", ".", "The", "returned", "template", "can", "be", "executed", "by", "concurrently", "running", "goroutines", "using", "Execute", "*", "methods", "." ]
[ "func", "NewTemplate", "(", "<mask>", ",", "startTag", ",", "endTag", "string", ")", "(", "*", "Template", ",", "error", ")", "{", "var", "t", "Template", "\n", "err", ":=", "t", ".", "Reset", "(", "template", ",", "startTag", ",", "endTag", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "t", ",", "nil", "\n", "}" ]
6,008
all-6009
[ "NewElection", "returns", "a", "new", "election", "on", "a", "given", "key", "prefix", "." ]
[ "func", "NewElection", "(", "s", "*", "Session", ",", "pfx", "string", ")", "*", "Election", "{", "return", "&", "Election", "{", "<mask>", ":", "s", ",", "keyPrefix", ":", "pfx", "+", "\"", "\"", "}", "\n", "}" ]
6,009
all-6010
[ "Remove", "an", "item", "from", "the", "nodetable" ]
[ "func", "(", "nt", "*", "NodeTable", ")", "Remove", "(", "key", "[", "]", "byte", ")", "(", "success", "bool", ",", "nptr", "unsafe", ".", "Pointer", ")", "{", "res", ":=", "nt", ".", "find", "(", "key", ")", "\n", "if", "res", ".", "status", "&", "ntFoundMask", "==", "ntFoundMask", "{", "success", "=", "true", "\n", "if", "res", ".", "status", "==", "ntFoundInFast", "{", "nptr", "=", "decodePointer", "(", "res", ".", "fastHTValue", ")", "\n", "// Key needs to be removed from fastHT. For that we need to move", "// an item present in slowHT and overwrite fastHT entry.", "if", "res", ".", "hasConflict", "{", "slowHTValues", ":=", "nt", ".", "slowHT", "[", "res", ".", "hash", "]", "\n", "v", ":=", "slowHTValues", "[", "0", "]", "// New fastHT candidate", "\n", "slowHTValues", "=", "append", "(", "[", "]", "uint64", "(", "nil", ")", ",", "slowHTValues", "[", "1", ":", "]", "...", ")", "\n", "nt", ".", "slowHTCount", "--", "\n\n", "var", "conflict", "bool", "\n", "if", "len", "(", "slowHTValues", ")", "==", "0", "{", "delete", "(", "nt", ".", "slowHT", ",", "res", ".", "hash", ")", "\n", "nt", ".", "conflicts", "--", "\n", "}", "else", "{", "conflict", "=", "true", "\n", "nt", ".", "slowHT", "[", "res", ".", "hash", "]", "=", "slowHTValues", "\n", "}", "\n\n", "nt", ".", "fastHT", "[", "res", ".", "hash", "]", "=", "encodePointer", "(", "decodePointer", "(", "v", ")", ",", "conflict", ")", "\n", "}", "else", "{", "delete", "(", "nt", ".", "fastHT", ",", "res", ".", "hash", ")", "\n", "nt", ".", "fastHTCount", "--", "\n", "}", "\n", "}", "else", "{", "nptr", "=", "decodePointer", "(", "res", ".", "slowHTValues", "[", "<mask>", ".", "slowHTPos", "]", ")", "\n", "// Remove key from slowHT", "newSlowValue", ":=", "append", "(", "[", "]", "uint64", "(", "nil", ")", ",", "res", ".", "slowHTValues", "[", ":", "res", ".", "slowHTPos", "]", "...", ")", "\n", "if", "res", ".", "slowHTPos", "+", "1", "!=", "len", "(", "res", ".", "slowHTValues", ")", "{", "newSlowValue", "=", "append", "(", "newSlowValue", ",", "res", ".", "slowHTValues", "[", "res", ".", "slowHTPos", "+", "1", ":", "]", "...", ")", "\n", "}", "\n", "nt", ".", "slowHTCount", "--", "\n\n", "if", "len", "(", "newSlowValue", ")", "==", "0", "{", "delete", "(", "nt", ".", "slowHT", ",", "res", ".", "hash", ")", "\n", "nt", ".", "fastHT", "[", "res", ".", "hash", "]", "=", "encodePointer", "(", "decodePointer", "(", "nt", ".", "fastHT", "[", "res", ".", "hash", "]", ")", ",", "false", ")", "\n", "nt", ".", "conflicts", "--", "\n", "}", "else", "{", "nt", ".", "slowHT", "[", "res", ".", "hash", "]", "=", "newSlowValue", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
6,010
all-6011
[ "expandLinkDiscoveryProtocolConfig", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "LinkDiscoveryProtocolConfig", "." ]
[ "func", "expandLinkDiscoveryProtocolConfig", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "<mask>", ".", "LinkDiscoveryProtocolConfig", "{", "obj", ":=", "&", "types", ".", "LinkDiscoveryProtocolConfig", "{", "Operation", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "Protocol", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "}", "\n", "return", "obj", "\n", "}" ]
6,011
all-6012
[ "PutManifest", "writes", "manifest", "to", "the", "destination", ".", "FIXME?", "This", "should", "also", "receive", "a", "MIME", "type", "if", "known", "to", "differentiate", "between", "schema", "versions", ".", "If", "the", "destination", "is", "in", "principle", "available", "refuses", "this", "manifest", "type", "(", "e", ".", "g", ".", "it", "does", "not", "recognize", "the", "schema", ")", "but", "may", "accept", "a", "different", "manifest", "type", "the", "returned", "error", "must", "be", "an", "ManifestTypeRejectedError", "." ]
[ "func", "(", "d", "*", "dirImageDestination", ")", "PutManifest", "(", "ctx", "<mask>", ".", "Context", ",", "manifest", "[", "]", "byte", ")", "error", "{", "return", "ioutil", ".", "WriteFile", "(", "d", ".", "ref", ".", "manifestPath", "(", ")", ",", "manifest", ",", "0644", ")", "\n", "}" ]
6,012
all-6013
[ "GetCustomFgColor", "returns", "the", "CustomFgColor", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "DashboardConditionalFormat", ")", "GetCustomFgColor", "(", ")", "string", "{", "if", "d", "==", "nil", "||", "d", ".", "CustomFgColor", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "<mask>", "*", "d", ".", "CustomFgColor", "\n", "}" ]
6,013
all-6014
[ "loadConfig", "loads", "user", "configuration", ".", "It", "has", "to", "be", "loaded", "before", "of", "edit", "some", "file", "." ]
[ "func", "loadConfig", "(", ")", "{", "config", ".", "Do", "(", "func", "(", ")", "{", "//checkRoot()", "if", "err", ":=", "config", ".", "init", "(", ")", ";", "<mask>", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "}", ")", "\n", "}" ]
6,014
all-6015
[ "Restore", "is", "used", "to", "manually", "force", "Raft", "to", "consume", "an", "external", "snapshot", "such", "as", "if", "restoring", "from", "a", "backup", ".", "We", "will", "use", "the", "current", "Raft", "configuration", "not", "the", "one", "from", "the", "snapshot", "so", "that", "we", "can", "restore", "into", "a", "new", "cluster", ".", "We", "will", "also", "use", "the", "higher", "of", "the", "index", "of", "the", "snapshot", "or", "the", "current", "index", "and", "then", "add", "1", "to", "that", "so", "we", "force", "a", "new", "state", "with", "a", "hole", "in", "the", "Raft", "log", "so", "that", "the", "snapshot", "will", "be", "sent", "to", "followers", "and", "used", "for", "any", "new", "joiners", ".", "This", "can", "only", "be", "run", "on", "the", "leader", "and", "blocks", "until", "the", "restore", "is", "complete", "or", "an", "error", "occurs", ".", "WARNING!", "This", "operation", "has", "the", "leader", "take", "on", "the", "state", "of", "the", "snapshot", "and", "then", "sets", "itself", "up", "so", "that", "it", "replicates", "that", "to", "its", "followers", "though", "the", "install", "snapshot", "process", ".", "This", "involves", "a", "potentially", "dangerous", "period", "where", "the", "leader", "commits", "ahead", "of", "its", "followers", "so", "should", "only", "be", "used", "for", "disaster", "recovery", "into", "a", "fresh", "cluster", "and", "should", "not", "be", "used", "in", "normal", "operations", "." ]
[ "func", "(", "r", "*", "Raft", ")", "Restore", "(", "meta", "*", "SnapshotMeta", ",", "reader", "io", ".", "Reader", ",", "timeout", "time", ".", "Duration", ")", "error", "{", "metrics", ".", "IncrCounter", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", ",", "1", ")", "\n", "var", "<mask>", "<-", "chan", "time", ".", "Time", "\n", "if", "timeout", ">", "0", "{", "timer", "=", "time", ".", "After", "(", "timeout", ")", "\n", "}", "\n\n", "// Perform the restore.", "restore", ":=", "&", "userRestoreFuture", "{", "meta", ":", "meta", ",", "reader", ":", "reader", ",", "}", "\n", "restore", ".", "init", "(", ")", "\n", "select", "{", "case", "<-", "timer", ":", "return", "ErrEnqueueTimeout", "\n", "case", "<-", "r", ".", "shutdownCh", ":", "return", "ErrRaftShutdown", "\n", "case", "r", ".", "userRestoreCh", "<-", "restore", ":", "// If the restore is ingested then wait for it to complete.", "if", "err", ":=", "restore", ".", "Error", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "// Apply a no-op log entry. Waiting for this allows us to wait until the", "// followers have gotten the restore and replicated at least this new", "// entry, which shows that we've also faulted and installed the", "// snapshot with the contents of the restore.", "noop", ":=", "&", "logFuture", "{", "log", ":", "Log", "{", "Type", ":", "LogNoop", ",", "}", ",", "}", "\n", "noop", ".", "init", "(", ")", "\n", "select", "{", "case", "<-", "timer", ":", "return", "ErrEnqueueTimeout", "\n", "case", "<-", "r", ".", "shutdownCh", ":", "return", "ErrRaftShutdown", "\n", "case", "r", ".", "applyCh", "<-", "noop", ":", "return", "noop", ".", "Error", "(", ")", "\n", "}", "\n", "}" ]
6,015
all-6016
[ "OpenFile", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockOS", ")", "OpenFile", "(", "arg0", "string", ",", "arg1", "int", ",", "arg2", "os", ".", "FileMode", ")", "(", "oswrapper", ".", "File", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ",", "arg2", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "oswrapper", ".", "File", ")", "\n", "ret1", ",", "_", ":=", "<mask>", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
6,016
all-6017
[ "newEWMARate", "always", "allocates", "a", "new", "ewmaRate", "as", "this", "guarantees", "the", "atomically", "accessed", "int64", "will", "be", "aligned", "on", "ARM", ".", "See", "prometheus#2666", "." ]
[ "func", "newEWMARate", "(", "<mask>", "float64", ",", "interval", "time", ".", "Duration", ")", "*", "ewmaRate", "{", "return", "&", "ewmaRate", "{", "alpha", ":", "alpha", ",", "interval", ":", "interval", ",", "}", "\n", "}" ]
6,017
all-6018
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkAlignment", "." ]
[ "func", "(", "v", "*", "Alignment", ")", "native", "(", ")", "*", "C", ".", "GtkAlignment", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "<mask>", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "return", "C", ".", "toGtkAlignment", "(", "p", ")", "\n", "}" ]
6,018
all-6019
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "GetEncodedResponseEncoding", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "GetEncodedResponseEncoding", "(", "in", ".", "String", "(", ")", ")", "{", "case", "GetEncodedResponseEncodingWebp", ":", "*", "t", "=", "GetEncodedResponseEncodingWebp", "\n", "case", "GetEncodedResponseEncodingJpeg", ":", "*", "t", "=", "GetEncodedResponseEncodingJpeg", "\n", "case", "GetEncodedResponseEncodingPng", ":", "*", "t", "=", "GetEncodedResponseEncodingPng", "\n\n", "<mask>", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
6,019
all-6020
[ "getSelinuxMountPoint", "returns", "the", "path", "to", "the", "mountpoint", "of", "an", "selinuxfs", "filesystem", "or", "an", "empty", "string", "if", "no", "mountpoint", "is", "found", ".", "Selinuxfs", "is", "a", "proc", "-", "like", "pseudo", "-", "filesystem", "that", "exposes", "the", "selinux", "policy", "API", "to", "processes", ".", "The", "existence", "of", "an", "selinuxfs", "mount", "is", "used", "to", "determine", "whether", "selinux", "is", "currently", "enabled", "or", "not", "." ]
[ "func", "getSelinuxMountPoint", "(", ")", "string", "{", "if", "selinuxfs", "!=", "\"", "\"", "{", "return", "selinuxfs", "\n", "}", "\n", "selinuxfs", "=", "\"", "\"", "\n\n", "mounts", ",", "err", ":=", "mount", ".", "GetMounts", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "selinuxfs", "\n", "}", "\n", "for", "_", ",", "mount", ":=", "<mask>", "mounts", "{", "if", "mount", ".", "Fstype", "==", "\"", "\"", "{", "selinuxfs", "=", "mount", ".", "Mountpoint", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "selinuxfs", "!=", "\"", "\"", "{", "var", "buf", "syscall", ".", "Statfs_t", "\n", "syscall", ".", "Statfs", "(", "selinuxfs", ",", "&", "buf", ")", "\n", "if", "(", "buf", ".", "Flags", "&", "stRdOnly", ")", "==", "1", "{", "selinuxfs", "=", "\"", "\"", "\n", "}", "\n", "}", "\n", "return", "selinuxfs", "\n", "}" ]
6,020
all-6021
[ "New", "returns", "a", "new", "service", "-", "ready", "handler", "given", "an", "application", "handler", ".", "This", "stack", "application", "-", "level", "metrics", "debug", "endpoints", "panic", "recovery", "and", "request", "logging", "in", "that", "order", "." ]
[ "func", "New", "(", "h", "http", ".", "<mask>", ",", "onPanic", "recovery", ".", "PanicHandler", ")", "Service", "{", "l", ":=", "logging", ".", "Wrap", "(", "recovery", ".", "Wrap", "(", "debug", ".", "Wrap", "(", "metrics", ".", "Wrap", "(", "h", ",", ")", ",", ")", ",", "onPanic", ",", ")", ",", "os", ".", "Stdout", ",", ")", "\n", "l", ".", "Start", "(", ")", "\n", "return", "Service", "{", "h", ":", "l", "}", "\n", "}" ]
6,021
all-6022
[ "Return", "a", "string", "representation", "of", "a", "TimerGroup", "." ]
[ "func", "(", "t", "*", "TimerGroup", ")", "String", "(", ")", "string", "{", "timers", ":=", "byCreationTimeSorter", "{", "}", "\n", "for", "_", ",", "timer", ":=", "range", "t", ".", "timers", "{", "timers", ".", "Timers", "=", "append", "(", "timers", ".", "Timers", ",", "timer", ")", "\n", "}", "\n", "sort", ".", "Sort", "(", "timers", ")", "\n", "<mask>", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "for", "_", ",", "timer", ":=", "range", "timers", ".", "Timers", "{", "fmt", ".", "Fprintf", "(", "result", ",", "\"", "\\n", "\"", ",", "timer", ")", "\n", "}", "\n", "return", "result", ".", "String", "(", ")", "\n", "}" ]
6,022
all-6023
[ "Successf", "outputs", "formatted", "Success", "level", "log" ]
[ "func", "Successf", "(", "format", "string", ",", "val", "...", "<mask>", "{", "}", ")", "error", "{", "return", "glg", ".", "out", "(", "OK", ",", "format", ",", "val", "...", ")", "\n", "}" ]
6,023
all-6024
[ "Namespace", "returns", "a", "replacement", "context", "that", "operates", "within", "the", "given", "namespace", "." ]
[ "func", "Namespace", "(", "c", "context", ".", "Context", ",", "namespace", "string", ")", "(", "context", ".", "<mask>", ",", "error", ")", "{", "if", "!", "validNamespace", ".", "MatchString", "(", "namespace", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "namespace", ",", "validNamespace", ")", "\n", "}", "\n", "return", "internal", ".", "NamespacedContext", "(", "c", ",", "namespace", ")", ",", "nil", "\n", "}" ]
6,024
all-6025
[ "ReplaceF", "is", "the", "filter", "form", "of", "strings", ".", "Replace", "." ]
[ "func", "ReplaceF", "(", "<mask>", ",", "new", "string", ",", "n", "int", ")", "func", "(", "string", ")", "string", "{", "return", "func", "(", "s", "string", ")", "string", "{", "return", "strings", ".", "Replace", "(", "s", ",", "old", ",", "new", ",", "n", ")", "\n", "}", "\n", "}" ]
6,025
all-6026
[ "SetByteRange", "sets", "Range", ":", "bytes", "=", "startPos", "-", "endPos", "header", ".", "*", "If", "startPos", "is", "negative", "then", "bytes", "=", "-", "startPos", "value", "is", "set", ".", "*", "If", "endPos", "is", "negative", "then", "bytes", "=", "startPos", "-", "value", "is", "set", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "SetByteRange", "(", "startPos", ",", "endPos", "int", ")", "{", "h", ".", "parseRawHeaders", "(", ")", "\n\n", "b", ":=", "h", ".", "bufKV", ".", "<mask>", "[", ":", "0", "]", "\n", "b", "=", "append", "(", "b", ",", "strBytes", "...", ")", "\n", "b", "=", "append", "(", "b", ",", "'='", ")", "\n", "if", "startPos", ">=", "0", "{", "b", "=", "AppendUint", "(", "b", ",", "startPos", ")", "\n", "}", "else", "{", "endPos", "=", "-", "startPos", "\n", "}", "\n", "b", "=", "append", "(", "b", ",", "'-'", ")", "\n", "if", "endPos", ">=", "0", "{", "b", "=", "AppendUint", "(", "b", ",", "endPos", ")", "\n", "}", "\n", "h", ".", "bufKV", ".", "value", "=", "b", "\n\n", "h", ".", "SetCanonical", "(", "strRange", ",", "h", ".", "bufKV", ".", "value", ")", "\n", "}" ]
6,026
all-6027
[ "connect", "using", "the", "provided", "transport", "and", "block", "until", "connection", "is", "ready" ]
[ "func", "(", "c", "*", "conn", ")", "connect", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "error", "{", "//choose transport", "if", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "==", "\"", "\"", "{", "c", ".", "transport", "=", "&", "eventSourceTransport", "{", "writeTimeout", ":", "c", ".", "state", ".", "WriteTimeout", "}", "\n", "}", "else", "if", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "==", "\"", "\"", "{", "c", ".", "transport", "=", "&", "websocketsTransport", "{", "writeTimeout", ":", "c", ".", "state", ".", "WriteTimeout", "}", "\n", "}", "else", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "//non-blocking connect to client over set transport", "if", "err", ":=", "c", ".", "transport", ".", "connect", "(", "w", ",", "r", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "//initial ping", "if", "err", ":=", "c", ".", "send", "(", "&", "update", "{", "Ping", ":", "true", "}", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "//successfully connected", "c", ".", "connected", "=", "true", "\n", "c", ".", "waiter", ".", "Add", "(", "1", ")", "\n", "//while connected, ping loop (every 25s, browser timesout after 30s)", "go", "func", "(", ")", "{", "for", "{", "select", "{", "case", "<-", "<mask>", ".", "After", "(", "c", ".", "state", ".", "PingInterval", ")", ":", "if", "err", ":=", "c", ".", "send", "(", "&", "update", "{", "Ping", ":", "true", "}", ")", ";", "err", "!=", "nil", "{", "goto", "disconnected", "\n", "}", "\n", "case", "<-", "c", ".", "connectedCh", ":", "goto", "disconnected", "\n", "}", "\n", "}", "\n", "disconnected", ":", "c", ".", "connected", "=", "false", "\n", "c", ".", "Close", "(", ")", "\n", "//unblock waiters", "c", ".", "waiter", ".", "Done", "(", ")", "\n", "}", "(", ")", "\n", "//non-blocking wait on connection", "go", "func", "(", ")", "{", "if", "err", ":=", "c", ".", "transport", ".", "wait", "(", ")", ";", "err", "!=", "nil", "{", "//log error?", "}", "\n", "close", "(", "c", ".", "connectedCh", ")", "\n", "}", "(", ")", "\n", "//now connected, consumer can connection.Wait()", "return", "nil", "\n", "}" ]
6,027
all-6028
[ "/", "*", "Creates", "a", "evaluationStageList", "object", "which", "represents", "an", "execution", "plan", "(", "or", "tree", ")", "which", "is", "used", "to", "completely", "evaluate", "a", "set", "of", "tokens", "at", "evaluation", "-", "time", ".", "The", "three", "stages", "of", "evaluation", "can", "be", "thought", "of", "as", "parsing", "strings", "to", "tokens", "then", "tokens", "to", "a", "stage", "list", "then", "evaluation", "with", "parameters", "." ]
[ "func", "planStages", "(", "tokens", "[", "]", "ExpressionToken", ")", "(", "*", "evaluationStage", ",", "error", ")", "{", "<mask>", ":=", "newTokenStream", "(", "tokens", ")", "\n\n", "stage", ",", "err", ":=", "planTokens", "(", "stream", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// while we're now fully-planned, we now need to re-order same-precedence operators.", "// this could probably be avoided with a different planning method", "reorderStages", "(", "stage", ")", "\n\n", "stage", "=", "elideLiterals", "(", "stage", ")", "\n", "return", "stage", ",", "nil", "\n", "}" ]
6,028
all-6029
[ "GetVersionJSON", "returns", "Kubicorn", "version", "in", "JSON", "format", "." ]
[ "func", "GetVersionJSON", "(", ")", "<mask>", "{", "verBytes", ",", "err", ":=", "json", ".", "Marshal", "(", "GetVersion", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Critical", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "string", "(", "verBytes", ")", "\n", "}" ]
6,029
all-6030
[ "ArgString", "returns", "the", "string", "representatin", "of", "the", "argument" ]
[ "func", "(", "o", "op", ")", "ArgString", "(", ")", "string", "{", "// In most cases we do this because it's a sring", "if", "v", ",", "ok", ":=", "o", ".", "uArg", ".", "(", "string", ")", ";", "<mask>", "{", "return", "v", "\n", "}", "\n", "return", "interfaceToString", "(", "o", ".", "uArg", ")", "\n", "}" ]
6,030
all-6031
[ "GetScaleOk", "returns", "a", "tuple", "with", "the", "Scale", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetAxis", ")", "GetScaleOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "Scale", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "w", ".", "Scale", ",", "<mask>", "\n", "}" ]
6,031
all-6032
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventAccepted", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoTethering1", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
6,032
all-6033
[ "executeRequest", "takes", "a", "prepared", "http", ".", "Request", "and", "returns", "the", "body", "of", "the", "response", "If", "the", "response", "is", "not", "of", "HTTP", "Code", "200", "an", "error", "is", "returned" ]
[ "func", "(", "r", "rpc", ")", "executeRequest", "(", "req", "*", "http", ".", "Request", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "resp", ",", "err", ":=", "r", ".", "auth", ".", "getClient", "(", ")", ".", "Do", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "buf", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "buf", ".", "ReadFrom", "(", "resp", ".", "Body", ")", "\n", "bytes", ":=", "buf", ".", "Bytes", "(", ")", "\n", "if", "resp", ".", "StatusCode", "!=", "200", "{", "if", "len", "(", "bytes", ")", "==", "0", "{", "// Log response body for debugging purposes", "<mask>", ".", "Printf", "(", "\"", "\"", ")", "\n", "}", "else", "{", "log", ".", "Printf", "(", "\"", "\\n", "\\t", "\\n", "\"", ",", "bytes", ")", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "req", ".", "Method", ",", "req", ".", "URL", ",", "resp", ".", "Status", ")", "\n", "}", "\n", "return", "bytes", ",", "nil", "\n", "}" ]
6,033
all-6034
[ "BroadcastAll", "returns", "the", "set", "of", "peer", "names", "that", "should", "be", "notified", "when", "we", "receive", "a", "broadcast", "message", "originating", "from", "the", "named", "peer", "based", "on", "all", "connections", "." ]
[ "func", "(", "r", "*", "routes", ")", "BroadcastAll", "(", "name", "PeerName", ")", "[", "]", "PeerName", "{", "return", "r", ".", "lookupOrCalculate", "(", "<mask>", ",", "&", "r", ".", "broadcastAll", ",", "false", ")", "\n", "}" ]
6,034
all-6035
[ "title", ":", "move", "containers", "path", ":", "/", "docker", "/", "containers", "/", "move", "method", ":", "POST", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "produce", ":", "application", "/", "x", "-", "json", "-", "stream", "responses", ":", "200", ":", "Ok", "400", ":", "Invalid", "data", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "moveContainersHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "params", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "err", "=", "api", ".", "ParseInput", "(", "r", ",", "&", "params", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "from", ":=", "params", "[", "\"", "\"", "]", "\n", "to", ":=", "params", "[", "\"", "\"", "]", "\n", "if", "from", "==", "\"", "\"", "||", "to", "==", "\"", "\"", "{", "return", "&", "tsuruErrors", ".", "ValidationError", "{", "Message", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "from", ",", "to", ")", "}", "\n", "}", "\n", "permContexts", ",", "err", ":=", "moveContainersPermissionContexts", "(", "from", ",", "to", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "!", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermNodeUpdateMoveContainers", ",", "permContexts", "...", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeNode", ",", "Value", ":", "from", "}", ",", "Kind", ":", "permission", ".", "PermNodeUpdateMoveContainers", ",", "Owner", ":", "t", ",", "CustomData", ":", "<mask>", ".", "FormToCustomData", "(", "r", ".", "Form", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermPoolReadEvents", ",", "permContexts", "...", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "keepAliveWriter", ":=", "tsuruIo", ".", "NewKeepAliveWriter", "(", "w", ",", "15", "*", "time", ".", "Second", ",", "\"", "\"", ")", "\n", "defer", "keepAliveWriter", ".", "Stop", "(", ")", "\n", "writer", ":=", "&", "tsuruIo", ".", "SimpleJsonMessageEncoderWriter", "{", "Encoder", ":", "json", ".", "NewEncoder", "(", "keepAliveWriter", ")", "}", "\n", "evt", ".", "SetLogWriter", "(", "writer", ")", "\n", "err", "=", "mainDockerProvisioner", ".", "MoveContainers", "(", "from", ",", "to", ",", "evt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "evt", ",", "\"", "\\n", "\"", ")", "\n", "return", "nil", "\n", "}" ]
6,035
all-6036
[ "SetDeadline", "set", "the", "read", "/", "write", "deadlines", "for", "the", "connection", "in", "seconds", ".", "Default", "value", "for", "read", "/", "write", "deadline", "is", "300", "seconds", "." ]
[ "func", "(", "c", "*", "Conn", ")", "SetDeadline", "(", "<mask>", "int", ")", "{", "c", ".", "deadline", "=", "time", ".", "Second", "*", "time", ".", "Duration", "(", "seconds", ")", "\n", "}" ]
6,036
all-6037
[ "Next", "returns", "the", "next", "page", "of", "resources", ".", "If", "there", "are", "no", "more", "resources", "NoMoreResults", "is", "returned", "." ]
[ "func", "(", "c", "*", "AccountPageIterator", ")", "Next", "(", "ctx", "<mask>", ".", "Context", ")", "(", "*", "AccountPage", ",", "error", ")", "{", "cp", ":=", "new", "(", "AccountPage", ")", "\n", "err", ":=", "c", ".", "p", ".", "Next", "(", "ctx", ",", "cp", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "c", ".", "p", ".", "SetNextPageURI", "(", "cp", ".", "NextPageURI", ")", "\n", "return", "cp", ",", "nil", "\n", "}" ]
6,037
all-6038
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "Cookbook", ")", "Locator", "(", "api", "*", "API", ")", "*", "CookbookLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "CookbookLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,038
all-6039
[ "Center", "returns", "the", "center", "of", "the", "box", "." ]
[ "func", "(", "b", "Box", ")", "Center", "(", ")", "(", "lat", ",", "lng", "float64", ")", "{", "<mask>", "=", "(", "b", ".", "MinLat", "+", "b", ".", "MaxLat", ")", "/", "2.0", "\n", "lng", "=", "(", "b", ".", "MinLng", "+", "b", ".", "MaxLng", ")", "/", "2.0", "\n", "return", "\n", "}" ]
6,039
all-6040
[ "CombinedOutput", "runs", "the", "command", "and", "returns", "its", "combined", "standard", "output", "and", "standard", "error", "." ]
[ "func", "(", "c", "*", "Cmd", ")", "CombinedOutput", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "c", ".", "Stdout", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "c", ".", "Stderr", "!=", "nil", "{", "return", "nil", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "b", "bytes", ".", "Buffer", "\n", "c", ".", "Stdout", "=", "&", "b", "\n", "c", ".", "Stderr", "=", "&", "b", "\n", "err", ":=", "c", ".", "Run", "(", ")", "\n", "return", "b", ".", "Bytes", "(", ")", ",", "err", "\n", "}" ]
6,040
all-6041
[ "SetCurrentName", "is", "a", "wrapper", "around", "gtk_file_chooser_set_current_name", "()", "." ]
[ "func", "(", "v", "*", "FileChooser", ")", "SetCurrentName", "(", "<mask>", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_file_chooser_set_current_name", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "return", "\n", "}" ]
6,041
all-6042
[ "zfsPoolVolumeExists", "verifies", "if", "a", "specific", "ZFS", "pool", "or", "volume", "exists", "." ]
[ "func", "zfsPoolVolumeExists", "(", "dataset", "string", ")", "(", "bool", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "shared", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n\n", "for", "_", ",", "name", ":=", "range", "strings", ".", "Split", "(", "output", ",", "\"", "\\n", "\"", ")", "{", "if", "name", "==", "dataset", "{", "return", "true", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "false", ",", "nil", "\n", "}" ]
6,042
all-6043
[ "toJSONPretty", "converts", "the", "given", "structure", "into", "a", "deeply", "nested", "pretty", "JSON", "string", "." ]
[ "func", "toJSONPretty", "(", "m", "<mask>", "[", "string", "]", "interface", "{", "}", ")", "(", "string", ",", "error", ")", "{", "result", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "m", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "string", "(", "bytes", ".", "TrimSpace", "(", "result", ")", ")", ",", "err", "\n", "}" ]
6,043
all-6044
[ "Generate", "plumbing", "and", "wiring", "code", "for", "the", "desired", "statement", "." ]
[ "func", "(", "s", "*", "Stmt", ")", "Generate", "(", "buf", "*", "file", ".", "Buffer", ")", "error", "{", "if", "strings", ".", "HasPrefix", "(", "s", ".", "kind", ",", "\"", "\"", ")", "{", "return", "s", ".", "objects", "(", "buf", ")", "\n", "}", "\n\n", "if", "strings", ".", "HasPrefix", "(", "s", ".", "kind", ",", "\"", "\"", ")", "&&", "strings", ".", "HasSuffix", "(", "s", ".", "kind", ",", "\"", "\"", ")", "{", "return", "s", ".", "createRef", "(", "buf", ")", "\n", "}", "\n\n", "if", "strings", ".", "HasSuffix", "(", "s", ".", "kind", ",", "\"", "\"", ")", "||", "strings", ".", "Contains", "(", "s", ".", "kind", ",", "\"", "\"", ")", "{", "return", "s", ".", "ref", "(", "buf", ")", "\n", "}", "\n\n", "if", "strings", ".", "HasPrefix", "(", "s", ".", "kind", ",", "\"", "\"", ")", "{", "return", "s", ".", "names", "(", "buf", ")", "\n", "}", "\n\n", "switch", "s", ".", "kind", "{", "case", "\"", "\"", ":", "return", "s", ".", "create", "(", "buf", ")", "\n", "case", "\"", "\"", ":", "return", "s", ".", "id", "(", "buf", ")", "\n", "case", "\"", "\"", ":", "return", "s", ".", "rename", "(", "buf", ")", "\n", "<mask>", "\"", "\"", ":", "return", "s", ".", "update", "(", "buf", ")", "\n", "case", "\"", "\"", ":", "return", "s", ".", "delete", "(", "buf", ")", "\n", "default", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "s", ".", "kind", ")", "\n", "}", "\n", "}" ]
6,044
all-6045
[ "FetchWorksheet", "retrieves", "worksheet", "with", "passed", "cid", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchWorksheet", "(", "cid", "CIDType", ")", "(", "*", "Worksheet", ",", "error", ")", "{", "if", "cid", "==", "nil", "||", "*", "cid", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "worksheetCID", ":=", "string", "(", "*", "cid", ")", "\n\n", "matched", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "WorksheetCIDRegex", ",", "worksheetCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "worksheetCID", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "string", "(", "*", "cid", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "<mask>", ")", ")", "\n", "}", "\n\n", "worksheet", ":=", "new", "(", "Worksheet", ")", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "worksheet", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "worksheet", ",", "nil", "\n", "}" ]
6,045
all-6046
[ "Handle", "satisfies", "hookhandler", "." ]
[ "func", "(", "g", "GenericHook", ")", "Handle", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "repo", "*", "Repo", ")", "(", "int", ",", "error", ")", "{", "if", "r", ".", "Method", "!=", "\"", "\"", "{", "return", "http", ".", "StatusMethodNotAllowed", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "body", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "r", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "http", ".", "StatusRequestTimeout", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "err", "=", "g", ".", "handlePush", "(", "body", ",", "repo", ")", "\n", "if", "err", "!=", "nil", "{", "return", "http", ".", "StatusBadRequest", ",", "err", "\n", "}", "\n\n", "return", "<mask>", ".", "StatusOK", ",", "nil", "\n", "}" ]
6,046
all-6047
[ "NewReaderPool", "creates", "a", "pool", "that", "ensures", "the", "writers", "it", "wraps", "will", "respect", "an", "overall", "maxRate", "with", "maxBurst", "resolution", ".", "The", "semantics", "of", "the", "wrapped", "writers", "are", "the", "same", "as", "those", "of", "using", "a", "plain", "ThrottledReader", "." ]
[ "func", "NewReaderPool", "(", "maxRate", "int", ",", "maxBurst", "time", ".", "Duration", ")", "*", "ReaderPool", "{", "return", "&", "ReaderPool", "{", "maxRate", ":", "maxRate", ",", "maxBurst", ":", "maxBurst", ",", "givenOut", ":", "<mask>", "(", "map", "[", "ThrottlerReader", "]", "struct", "{", "}", ")", ",", "}", "\n", "}" ]
6,047
all-6048
[ "GetExpand", "()", "is", "a", "wrapper", "around", "gtk_tree_view_column_get_expand", "()", "." ]
[ "func", "(", "v", "*", "TreeViewColumn", ")", "GetExpand", "(", ")", "bool", "{", "c", ":=", "C", ".", "gtk_tree_view_column_get_expand", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
6,048
all-6049
[ "Disconnect", "disconnects", "the", "connection" ]
[ "func", "(", "cs", "*", "ClientServerImpl", ")", "Disconnect", "(", "...", "interface", "{", "}", ")", "error", "{", "cs", ".", "writeLock", ".", "Lock", "(", ")", "\n", "defer", "<mask>", ".", "writeLock", ".", "Unlock", "(", ")", "\n\n", "if", "cs", ".", "conn", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Close() in turn results in a an internal flushFrame() call in gorilla", "// as the close frame needs to be sent to the server. Set the deadline", "// for that as well.", "if", "err", ":=", "cs", ".", "conn", ".", "SetWriteDeadline", "(", "time", ".", "Now", "(", ")", ".", "Add", "(", "cs", ".", "RWTimeout", ")", ")", ";", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "err", ",", "cs", ".", "URL", ")", "\n", "}", "\n", "return", "cs", ".", "conn", ".", "Close", "(", ")", "\n", "}" ]
6,049
all-6050
[ "GetMetricQuery", "returns", "the", "MetricQuery", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TimeseriesRequest", ")", "GetMetricQuery", "(", ")", "<mask>", "{", "if", "t", "==", "nil", "||", "t", ".", "MetricQuery", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "MetricQuery", "\n", "}" ]
6,050
all-6051
[ "ConnChange", "subscribes", "to", "changes", "for", "adapter", "connection", "changes", "." ]
[ "func", "(", "h", "*", "Handler", ")", "ConnChange", "(", "ctx", "context", ".", "Context", ",", "product", ",", "productPassword", "string", ")", "(", "*", "rpc", ".", "Subscription", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "product", ")", "\n\n", "logger", ".", "Info", "(", "\"", "\"", ")", "\n\n", "_", ",", "err", ":=", "h", ".", "checkProductPassword", "(", "logger", ",", "product", ",", "productPassword", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "ntf", ",", "ok", ":=", "rpc", ".", "NotifierFromContext", "(", "ctx", ")", "\n", "if", "!", "ok", "{", "logger", ".", "Error", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrInternal", "\n", "}", "\n\n", "sub", ":=", "ntf", ".", "CreateSubscription", "(", ")", "\n", "cb", ":=", "func", "(", "job", "*", "data", ".", "Job", ",", "result", "error", ")", "{", "if", "result", "==", "nil", "{", "h", ".", "handleConnChange", "(", "product", ",", "logger", ",", "ntf", ",", "sub", ",", "job", ")", "\n", "}", "\n", "}", "\n", "jobTypes", ":=", "[", "]", "string", "{", "data", ".", "JobClientPreServiceSuspend", ",", "data", ".", "JobClientPreServiceUnsuspend", ",", "data", ".", "JobClientPreServiceTerminate", ",", "}", "\n\n", "// TODO: testing. fix it later.", "sid", ":=", "string", "(", "sub", ".", "ID", ")", "\n", "if", "err", "=", "h", ".", "queue", ".", "Subscribe", "(", "jobTypes", ",", "sid", ",", "cb", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "nil", ",", "ErrInternal", "\n", "}", "\n\n", "go", "func", "(", ")", "{", "for", "err", ",", "ok", ":=", "<-", "sub", ".", "Err", "(", ")", ";", "<mask>", ";", "{", "if", "err", "!=", "nil", "{", "logger", ".", "Warn", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "err", ":=", "h", ".", "queue", ".", "Unsubscribe", "(", "jobTypes", ",", "sid", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "return", "sub", ",", "nil", "\n", "}" ]
6,051
all-6052
[ "Field", "creates", "a", "Field", "struct", "with", "the", "specified", "name", "and", "defaults", "." ]
[ "func", "(", "idx", "*", "<mask>", ")", "Field", "(", "name", "string", ",", "options", "...", "FieldOption", ")", "*", "Field", "{", "if", "field", ",", "ok", ":=", "idx", ".", "fields", "[", "name", "]", ";", "ok", "{", "return", "field", "\n", "}", "\n", "fieldOptions", ":=", "&", "FieldOptions", "{", "}", "\n", "fieldOptions", "=", "fieldOptions", ".", "withDefaults", "(", ")", "\n", "fieldOptions", ".", "addOptions", "(", "options", "...", ")", "\n", "return", "idx", ".", "fieldWithOptions", "(", "name", ",", "fieldOptions", ")", "\n", "}" ]
6,052
all-6053
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetCurrentTimeParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoAnimation12", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,053
all-6054
[ "UnmarshalText", "hydrates", "this", "instance", "from", "text" ]
[ "func", "(", "u", "*", "ISBN13", ")", "UnmarshalText", "(", "data", "[", "]", "<mask>", ")", "error", "{", "// validation is performed later on", "*", "u", "=", "ISBN13", "(", "string", "(", "data", ")", ")", "\n", "return", "nil", "\n", "}" ]
6,054
all-6055
[ "PanicHunter", "catches", "panic", "in", "case", "of", "an", "enabled", "reporter", "." ]
[ "func", "PanicHunter", "(", ")", "{", "if", "panicIgnore", "{", "return", "\n", "}", "\n\n", "if", "err", ":=", "recover", "(", ")", ";", "err", "!=", "nil", "{", "if", "enable", "&&", "notifier", "!=", "nil", "{", "notifier", ".", "NotifySync", "(", "<mask>", ".", "New", "(", "err", ",", "3", ")", ",", "true", ",", "metadata", "(", "[", "]", "data", ".", "HexString", "{", "defaultAccEth", "}", ")", ")", "\n", "}", "\n", "panic", "(", "err", ")", "\n", "}", "\n", "}" ]
6,055
all-6056
[ "ClearRect", "fills", "the", "current", "canvas", "with", "a", "default", "transparent", "color", "at", "the", "specified", "rectangle" ]
[ "func", "(", "gc", "*", "GraphicContext", ")", "ClearRect", "(", "x1", ",", "y1", ",", "x2", ",", "y2", "int", ")", "{", "imageColor", ":=", "<mask>", ".", "NewUniform", "(", "gc", ".", "Current", ".", "FillColor", ")", "\n", "draw", ".", "Draw", "(", "gc", ".", "img", ",", "image", ".", "Rect", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ")", ",", "imageColor", ",", "image", ".", "ZP", ",", "draw", ".", "Over", ")", "\n", "}" ]
6,056
all-6057
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "DeleteDatabaseParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb16", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,057
all-6058
[ "GetAgentChannels", "gets", "channels", "for", "agent", "." ]
[ "func", "(", "h", "*", "Handler", ")", "GetAgentChannels", "(", "tkn", "string", ",", "channelStatus", ",", "serviceStatus", "[", "]", "string", ",", "offset", ",", "limit", "uint", ")", "(", "*", "GetAgentChannelsResult", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "channelStatus", ",", "\"", "\"", ",", "serviceStatus", ")", "\n\n", "if", "!", "h", ".", "<mask>", ".", "Check", "(", "tkn", ")", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrAccessDenied", "\n", "}", "\n\n", "channels", ",", "total", ",", "err", ":=", "h", ".", "getChannels", "(", "logger", ",", "channelStatus", ",", "serviceStatus", ",", "agentChannelsCondition", ",", "offset", ",", "limit", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "GetAgentChannelsResult", "{", "channels", ",", "total", "}", ",", "err", "\n", "}" ]
6,058
all-6059
[ "Client", "returns", "a", "new", "client", "for", "accessing", "VMWare", "vSphere", "." ]
[ "func", "(", "c", "*", "Config", ")", "Client", "(", ")", "(", "*", "VSphereClient", ",", "error", ")", "{", "client", ":=", "new", "(", "VSphereClient", ")", "\n\n", "u", ",", "err", ":=", "c", ".", "vimURL", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "err", "=", "c", ".", "EnableDebug", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Set up the VIM/govmomi client connection, or load a previous session", "client", ".", "vimClient", ",", "err", "=", "c", ".", "SavedVimSessionOrNew", "(", "u", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "c", ".", "VSphereServer", ")", "\n\n", "if", "isEligibleTagEndpoint", "(", "<mask>", ".", "vimClient", ")", "{", "// Connect to the CIS REST endpoint for tagging, or load a previous session", "client", ".", "tagsClient", ",", "err", "=", "c", ".", "SavedRestSessionOrNew", "(", "u", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "log", ".", "Println", "(", "\"", "\"", ")", "\n", "}", "else", "{", "// Just print a log message so that we know that tags are not available on", "// this connection.", "log", ".", "Printf", "(", "\"", "\"", ",", "viapi", ".", "ParseVersionFromClient", "(", "client", ".", "vimClient", ")", ")", "\n", "}", "\n\n", "// Done, save sessions if we need to and return", "if", "err", ":=", "c", ".", "SaveVimClient", "(", "client", ".", "vimClient", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "err", ":=", "c", ".", "SaveRestClient", "(", "client", ".", "tagsClient", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "client", ",", "nil", "\n", "}" ]
6,059
all-6060
[ "OCIConfig", "returns", "the", "image", "configuration", "as", "per", "OCI", "v1", "image", "-", "spec", ".", "Information", "about", "layers", "in", "the", "resulting", "configuration", "isn", "t", "guaranteed", "to", "be", "returned", "to", "due", "how", "old", "image", "manifests", "work", "(", "docker", "v2s1", "especially", ")", "." ]
[ "func", "(", "m", "*", "manifestSchema1", ")", "OCIConfig", "(", "ctx", "<mask>", ".", "Context", ")", "(", "*", "imgspecv1", ".", "Image", ",", "error", ")", "{", "v2s2", ",", "err", ":=", "m", ".", "convertToManifestSchema2", "(", "nil", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "v2s2", ".", "OCIConfig", "(", "ctx", ")", "\n", "}" ]
6,060
all-6061
[ "SetWMClass", "is", "a", "wrapper", "around", "gtk_window_set_wmclass", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "SetWMClass", "(", "name", ",", "<mask>", "string", ")", "{", "cName", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cName", ")", ")", "\n", "cClass", ":=", "C", ".", "CString", "(", "class", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cClass", ")", ")", "\n", "C", ".", "gtk_window_set_wmclass", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cName", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cClass", ")", ")", "\n", "}" ]
6,061
all-6062
[ "WriteTo", "writes", "data", "to", "w", "." ]
[ "func", "(", "e", "*", "helperMethodConditionalComment", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "var", "bf", "bytes", ".", "<mask>", "\n\n", "// Write an open tag.", "bf", ".", "WriteString", "(", "e", ".", "opts", ".", "DelimLeft", ")", "\n", "bf", ".", "WriteString", "(", "preDefinedFuncNameHTML", ")", "\n", "bf", ".", "WriteString", "(", "space", ")", "\n", "bf", ".", "WriteString", "(", "doubleQuote", ")", "\n", "bf", ".", "WriteString", "(", "lt", ")", "\n", "bf", ".", "WriteString", "(", "exclamation", ")", "\n", "bf", ".", "WriteString", "(", "doubleQuote", ")", "\n", "bf", ".", "WriteString", "(", "e", ".", "opts", ".", "DelimRight", ")", "\n", "if", "e", ".", "commentType", "==", "commentTypeHidden", "{", "bf", ".", "WriteString", "(", "hyphen", ")", "\n", "bf", ".", "WriteString", "(", "hyphen", ")", "\n", "}", "\n", "bf", ".", "WriteString", "(", "bracketOpen", ")", "\n", "bf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "bf", ".", "WriteString", "(", "e", ".", "condition", ")", "\n", "bf", ".", "WriteString", "(", "bracketClose", ")", "\n", "bf", ".", "WriteString", "(", "gt", ")", "\n\n", "bf", ".", "WriteString", "(", "lf", ")", "\n\n", "// Write the children's HTML.", "if", "i", ",", "err", ":=", "e", ".", "writeChildren", "(", "&", "bf", ")", ";", "err", "!=", "nil", "{", "return", "i", ",", "err", "\n", "}", "\n\n", "// Write a close tag.", "bf", ".", "WriteString", "(", "e", ".", "opts", ".", "DelimLeft", ")", "\n", "bf", ".", "WriteString", "(", "preDefinedFuncNameHTML", ")", "\n", "bf", ".", "WriteString", "(", "space", ")", "\n", "bf", ".", "WriteString", "(", "doubleQuote", ")", "\n", "bf", ".", "WriteString", "(", "lt", ")", "\n", "bf", ".", "WriteString", "(", "exclamation", ")", "\n", "bf", ".", "WriteString", "(", "doubleQuote", ")", "\n", "bf", ".", "WriteString", "(", "e", ".", "opts", ".", "DelimRight", ")", "\n", "bf", ".", "WriteString", "(", "bracketOpen", ")", "\n", "bf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "bf", ".", "WriteString", "(", "bracketClose", ")", "\n", "if", "e", ".", "commentType", "==", "commentTypeHidden", "{", "bf", ".", "WriteString", "(", "hyphen", ")", "\n", "bf", ".", "WriteString", "(", "hyphen", ")", "\n", "}", "\n", "bf", ".", "WriteString", "(", "gt", ")", "\n\n", "// Write the buffer.", "i", ",", "err", ":=", "w", ".", "Write", "(", "bf", ".", "Bytes", "(", ")", ")", "\n\n", "return", "int64", "(", "i", ")", ",", "err", "\n", "}" ]
6,062
all-6063
[ "Cleanup", "all", "of", "the", "generated", "files" ]
[ "func", "Cleanup", "(", "opts", "*", "Options", ")", "genny", ".", "RunFn", "{", "return", "func", "(", "r", "*", "genny", ".", "Runner", ")", "error", "{", "defer", "os", ".", "RemoveAll", "(", "filepath", ".", "Join", "(", "opts", ".", "Root", ",", "\"", "\"", ")", ")", "\n", "if", "err", ":=", "jam", ".", "Clean", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "var", "err", "error", "\n", "opts", ".", "rollback", ".", "Range", "(", "func", "(", "k", ",", "v", "<mask>", "{", "}", ")", "bool", "{", "f", ":=", "genny", ".", "NewFileS", "(", "k", ".", "(", "string", ")", ",", "v", ".", "(", "string", ")", ")", "\n", "r", ".", "Logger", ".", "Debugf", "(", "\"", "\"", ",", "f", ".", "Name", "(", ")", ")", "\n", "if", "err", "=", "r", ".", "File", "(", "f", ")", ";", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n", "r", ".", "Disk", ".", "Remove", "(", "f", ".", "Name", "(", ")", ")", "\n", "return", "true", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "_", ",", "f", ":=", "range", "r", ".", "Disk", ".", "Files", "(", ")", "{", "if", "err", ":=", "r", ".", "Disk", ".", "Delete", "(", "f", ".", "Name", "(", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "if", "envy", ".", "Mods", "(", ")", "{", "if", "err", ":=", "r", ".", "Exec", "(", "exec", ".", "Command", "(", "genny", ".", "GoBin", "(", ")", ",", "\"", "\"", ",", "\"", "\"", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}", "\n", "}" ]
6,063
all-6064
[ "Insert", "adds", "an", "item", "into", "the", "skiplist" ]
[ "func", "(", "s", "*", "Skiplist", ")", "Insert", "(", "itm", "unsafe", ".", "Pointer", ",", "cmp", "CompareFn", ",", "buf", "*", "ActionBuffer", ",", "sts", "*", "Stats", ")", "(", "<mask>", "bool", ")", "{", "_", ",", "success", "=", "s", ".", "Insert2", "(", "itm", ",", "cmp", ",", "nil", ",", "buf", ",", "rand", ".", "Float32", ",", "sts", ")", "\n", "return", "\n", "}" ]
6,064
all-6065
[ "RemoveIcon", "()", "is", "a", "wrapper", "around", "gtk_entry_set_icon_from_icon_name", "()", "with", "a", "nil", "pointer", "to", "the", "icon", "name", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "RemoveIcon", "(", "iconPos", "EntryIconPosition", ")", "{", "C", ".", "gtk_entry_set_icon_from_icon_name", "(", "v", ".", "native", "(", ")", ",", "C", ".", "GtkEntryIconPosition", "(", "iconPos", ")", ",", "nil", ")", "\n", "}" ]
6,065
all-6066
[ "containsSomeFunc", "returns", "functions", "to", "implement", "each", "of", "the", "following", ":", "1", ".", "containsAll", "-", "true", "if", "(", "∀x", "∈", "v", "then", "x", "∈", "l", ")", ";", "false", "otherwise", "2", ".", "containsAny", "-", "true", "if", "(", "∃x", "∈", "v", "such", "that", "x", "∈", "l", ")", ";", "false", "otherwise", "3", ".", "containsNone", "-", "true", "if", "(", "∀x", "∈", "v", "then", "x", "∉", "l", ")", ";", "false", "otherwise", "2", ".", "containsNotAll", "-", "true", "if", "(", "∃x", "∈", "v", "such", "that", "x", "∉", "l", ")", ";", "false", "otherwise", "ret_true", "-", "return", "true", "at", "end", "of", "loop", "for", "none", "/", "all", ";", "false", "for", "any", "/", "notall", "invert", "-", "invert", "block", "test", "for", "all", "/", "notall" ]
[ "func", "containsSomeFunc", "(", "retTrue", ",", "invert", "bool", ")", "func", "(", "[", "]", "<mask>", "{", "}", ",", "interface", "{", "}", ")", "(", "bool", ",", "error", ")", "{", "return", "func", "(", "v", "[", "]", "interface", "{", "}", ",", "l", "interface", "{", "}", ")", "(", "bool", ",", "error", ")", "{", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "v", ")", ";", "i", "++", "{", "if", "ok", ",", "_", ":=", "in", "(", "l", ",", "v", "[", "i", "]", ")", ";", "ok", "!=", "invert", "{", "return", "!", "retTrue", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "retTrue", ",", "nil", "\n", "}", "\n", "}" ]
6,066
all-6067
[ "GetChunk", "returns", "the", "merged", "datum", "hashtrees", "of", "a", "particular", "chunk", "(", "if", "available", ")" ]
[ "func", "(", "a", "*", "APIServer", ")", "GetChunk", "(", "request", "*", "GetChunkRequest", ",", "server", "Worker_GetChunkServer", ")", "error", "{", "filter", ":=", "hashtree", ".", "NewFilter", "(", "a", ".", "numShards", ",", "request", ".", "Shard", ")", "\n", "if", "request", ".", "Stats", "{", "return", "a", ".", "chunkStatsCache", ".", "Get", "(", "request", ".", "Id", ",", "grpcutil", ".", "NewStreamingBytesWriter", "(", "server", ")", ",", "filter", ")", "\n", "}", "\n", "return", "a", ".", "chunkCache", ".", "Get", "(", "request", ".", "Id", ",", "grpcutil", ".", "NewStreamingBytesWriter", "(", "<mask>", ")", ",", "filter", ")", "\n", "}" ]
6,067
all-6068
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetBrowserCommandLineParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser16", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
6,068
all-6069
[ "MarshalJSON", "marshals", "the", "recipient", "to", "JSON", "." ]
[ "func", "(", "r", "Recipient", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "toReturn", ":=", "\"", "\"", "\n\n", "if", "r", ".", "isChannel", "(", ")", "{", "toReturn", "=", "fmt", ".", "Sprintf", "(", "\"", "\\\"", "\\\"", "\"", ",", "*", "r", ".", "ChannelID", ")", "\n", "}", "else", "{", "toReturn", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "*", "r", ".", "ChatID", ")", "\n", "}", "\n\n", "return", "[", "]", "<mask>", "(", "toReturn", ")", ",", "nil", "\n", "}" ]
6,069
all-6070
[ "RemoveRemoteFile", "-", "get", "a", "file", "from", "a", "remote", "system", "and", "return", "a", "writecloser", "to", "it" ]
[ "func", "(", "s", "*", "RemoteOperations", ")", "RemoveRemoteFile", "(", ")", "(", "err", "error", ")", "{", "<mask>", "sftpclient", "SFTPClient", "\n", "sftpclient", ",", "err", "=", "s", ".", "getClient", "(", ")", "\n\n", "if", "err", "==", "nil", "{", "err", "=", "SafeRemoveSSH", "(", "sftpclient", ",", "s", ".", "remotePath", ")", "\n", "}", "\n\n", "return", "\n", "}" ]
6,070
all-6071
[ "ErrNotFound", "indicates", "a", "request", "could", "not", "be", "found", "by", "the", "processor", "." ]
[ "func", "ErrNotFound", "(", "id", "string", ")", "error", "{", "return", "ErrorResponse", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ")", ",", "}", "\n", "}" ]
6,071
all-6072
[ "MakeRouter", "returns", "the", "router", "app", ".", "Given", "a", "set", "of", "Routes", "it", "dispatches", "the", "request", "to", "the", "HandlerFunc", "of", "the", "first", "route", "that", "matches", ".", "The", "order", "of", "the", "Routes", "matters", "." ]
[ "func", "MakeRouter", "(", "routes", "...", "*", "<mask>", ")", "(", "App", ",", "error", ")", "{", "r", ":=", "&", "router", "{", "Routes", ":", "routes", ",", "}", "\n", "err", ":=", "r", ".", "start", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "r", ",", "nil", "\n", "}" ]
6,072
all-6073
[ "Run", "clones", "the", "configured", "refs" ]
[ "func", "(", "o", "Options", ")", "Run", "(", ")", "error", "{", "var", "env", "[", "]", "string", "\n", "if", "len", "(", "o", ".", "KeyFiles", ")", ">", "0", "{", "var", "err", "error", "\n", "env", ",", "err", "=", "addSSHKeys", "(", "o", ".", "KeyFiles", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "// Continue on error. Clones will fail with an appropriate error message", "// that initupload can consume whereas quitting without writing the clone", "// record log is silent and results in an errored prow job instead of a", "// failed one.", "}", "\n", "}", "\n", "if", "len", "(", "o", ".", "HostFingerprints", ")", ">", "0", "{", "if", "err", ":=", "addHostFingerprints", "(", "o", ".", "HostFingerprints", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "var", "numWorkers", "int", "\n", "if", "o", ".", "MaxParallelWorkers", "!=", "0", "{", "numWorkers", "=", "o", ".", "MaxParallelWorkers", "\n", "}", "else", "{", "numWorkers", "=", "len", "(", "o", ".", "GitRefs", ")", "\n", "}", "\n\n", "wg", ":=", "&", "sync", ".", "WaitGroup", "{", "}", "\n", "wg", ".", "Add", "(", "numWorkers", ")", "\n\n", "input", ":=", "make", "(", "chan", "prowapi", ".", "Refs", ")", "\n", "output", ":=", "make", "(", "chan", "<mask>", ".", "Record", ",", "len", "(", "o", ".", "GitRefs", ")", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "numWorkers", ";", "i", "++", "{", "go", "func", "(", ")", "{", "defer", "wg", ".", "Done", "(", ")", "\n", "for", "ref", ":=", "range", "input", "{", "output", "<-", "cloneFunc", "(", "ref", ",", "o", ".", "SrcRoot", ",", "o", ".", "GitUserName", ",", "o", ".", "GitUserEmail", ",", "o", ".", "CookiePath", ",", "env", ")", "\n", "}", "\n", "}", "(", ")", "\n", "}", "\n\n", "for", "_", ",", "ref", ":=", "range", "o", ".", "GitRefs", "{", "input", "<-", "ref", "\n", "}", "\n\n", "close", "(", "input", ")", "\n", "wg", ".", "Wait", "(", ")", "\n", "close", "(", "output", ")", "\n\n", "var", "results", "[", "]", "clone", ".", "Record", "\n", "for", "record", ":=", "range", "output", "{", "results", "=", "append", "(", "results", ",", "record", ")", "\n", "}", "\n\n", "logData", ",", "err", ":=", "json", ".", "Marshal", "(", "results", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "if", "err", ":=", "ioutil", ".", "WriteFile", "(", "o", ".", "Log", ",", "logData", ",", "0755", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
6,073
all-6074
[ "DateTime", "produces", "a", "time", ".", "Time", "object", "from", "a", "SystemTimestamp", "object", "." ]
[ "func", "(", "ts", "*", "SystemTimestamp", ")", "DateTime", "(", ")", "<mask>", ".", "Time", "{", "// Assume the server will always give us a valid timestamp,", "// so we don't need to handle the error case.", "// (Famous last words?)", "t", ",", "_", ":=", "time", ".", "Parse", "(", "time", ".", "RFC3339", ",", "ts", ".", "DateTimeStr", ")", "\n", "return", "t", "\n", "}" ]
6,074
all-6075
[ "TreeStoreNew", "is", "a", "wrapper", "around", "gtk_tree_store_newv", "()", "." ]
[ "func", "TreeStoreNew", "(", "types", "...", "glib", ".", "Type", ")", "(", "*", "TreeStore", ",", "error", ")", "{", "gtypes", ":=", "C", ".", "alloc_types", "(", "C", ".", "int", "(", "len", "(", "<mask>", ")", ")", ")", "\n", "for", "n", ",", "val", ":=", "range", "types", "{", "C", ".", "set_type", "(", "gtypes", ",", "C", ".", "int", "(", "n", ")", ",", "C", ".", "GType", "(", "val", ")", ")", "\n", "}", "\n", "defer", "C", ".", "g_free", "(", "C", ".", "gpointer", "(", "gtypes", ")", ")", "\n", "c", ":=", "C", ".", "gtk_tree_store_newv", "(", "C", ".", "gint", "(", "len", "(", "types", ")", ")", ",", "gtypes", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "ts", ":=", "wrapTreeStore", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", "\n", "return", "ts", ",", "nil", "\n", "}" ]
6,075
all-6076
[ "ButtonNewFromStock", "is", "a", "wrapper", "around", "gtk_button_new_from_stock", "()", "." ]
[ "func", "ButtonNewFromStock", "(", "stock", "Stock", ")", "(", "*", "Button", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "string", "(", "stock", ")", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "c", ":=", "C", ".", "gtk_button_new_from_stock", "(", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapButton", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
6,076
all-6077
[ "Err", "retrieves", "any", "errors", "encountered", "in", "the", "course", "of", "calling", "Next", "()", "." ]
[ "func", "(", "l", "*", "LogsIter", ")", "Err", "(", ")", "error", "{", "if", "l", ".", "err", "==", "<mask>", ".", "EOF", "{", "return", "nil", "\n", "}", "\n", "return", "grpcutil", ".", "ScrubGRPC", "(", "l", ".", "err", ")", "\n", "}" ]
6,077
all-6078
[ "applyContainerState", "moves", "the", "container", "to", "the", "given", "state", "by", "calling", "the", "function", "defined", "in", "the", "transitionFunctionMap", "for", "the", "state" ]
[ "func", "(", "engine", "*", "DockerTaskEngine", ")", "applyContainerState", "(", "task", "*", "apitask", ".", "Task", ",", "container", "*", "apicontainer", ".", "Container", ",", "nextState", "apicontainerstatus", ".", "ContainerStatus", ")", "dockerapi", ".", "DockerContainerMetadata", "{", "transitionFunction", ",", "ok", ":=", "engine", ".", "transitionFunctionMap", "(", ")", "[", "nextState", "]", "\n", "if", "!", "ok", "{", "seelog", ".", "Criticalf", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "container", ".", "Name", ",", "nextState", ".", "String", "(", ")", ")", "\n", "return", "dockerapi", ".", "DockerContainerMetadata", "{", "Error", ":", "&", "impossibleTransitionError", "{", "nextState", "}", "}", "\n", "}", "\n", "metadata", ":=", "transitionFunction", "(", "task", ",", "container", ")", "\n", "if", "metadata", ".", "Error", "!=", "nil", "{", "seelog", ".", "Infof", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "container", ".", "Name", ",", "nextState", ".", "String", "(", ")", ",", "metadata", ".", "<mask>", ")", "\n", "}", "else", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "container", ".", "Name", ",", "nextState", ".", "String", "(", ")", ")", "\n", "engine", ".", "saver", ".", "Save", "(", ")", "\n", "}", "\n", "return", "metadata", "\n", "}" ]
6,078
all-6079
[ "GetPalette", "returns", "the", "Palette", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TileDefStyle", ")", "GetPalette", "(", ")", "<mask>", "{", "if", "t", "==", "nil", "||", "t", ".", "Palette", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "Palette", "\n", "}" ]
6,079
all-6080
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "ProwJob", "." ]
[ "func", "(", "in", "*", "ProwJob", ")", "DeepCopy", "(", ")", "*", "ProwJob", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "ProwJob", ")", "\n", "in", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "<mask>", "\n", "}" ]
6,080
all-6081
[ "SetConsoleMode", "sets", "the", "console", "mode", "for", "given", "file", "descriptor", "See", "http", ":", "//", "msdn", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/", "library", "/", "windows", "/", "desktop", "/", "ms686033", "(", "v", "=", "vs", ".", "85", ")", ".", "aspx", "." ]
[ "func", "SetConsoleMode", "(", "handle", "uintptr", ",", "mode", "uint32", ")", "error", "{", "r1", ",", "r2", ",", "err", ":=", "setConsoleModeProc", ".", "Call", "(", "handle", ",", "uintptr", "(", "mode", ")", ",", "0", ")", "\n", "use", "(", "<mask>", ")", "\n", "return", "checkError", "(", "r1", ",", "r2", ",", "err", ")", "\n", "}" ]
6,081
all-6082
[ "GetOptions", "returns", "the", "Options", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "GetOptions", "(", ")", "Options", "{", "if", "m", "==", "nil", "||", "m", ".", "<mask>", "==", "nil", "{", "return", "Options", "{", "}", "\n", "}", "\n", "return", "*", "m", ".", "Options", "\n", "}" ]
6,082
all-6083
[ "FromPayload", "set", "the", "PeriodicProwJobEvent", "from", "the", "PubSub", "message", "payload", "." ]
[ "func", "(", "pe", "*", "PeriodicProwJobEvent", ")", "FromPayload", "(", "data", "[", "]", "<mask>", ")", "error", "{", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "pe", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,083
all-6084
[ "getAlgFromKeyData", "determines", "the", "best", "jwt", ".", "Algorithm", "suitable", "based", "on", "the", "set", "of", "given", "crypto", "primitives", "in", "pem", "." ]
[ "func", "getAlgFromKeyData", "(", "pem", "pemutil", ".", "Store", ")", "(", "jwt", ".", "Algorithm", ",", "error", ")", "{", "for", "_", ",", "v", ":=", "range", "pem", "{", "// loop over crypto primitives in pemstore, and do type assertion. if", "// ecdsa.{PublicKey,PrivateKey} found, then use corresponding ESXXX as", "// algo. if rsa, then use DefaultRSAAlgorithm. if []byte, then use", "// DefaultHMACAlgorithm.", "switch", "k", ":=", "v", ".", "(", "type", ")", "{", "case", "[", "]", "<mask>", ":", "return", "jwt", ".", "HS512", ",", "nil", "\n\n", "case", "*", "ecdsa", ".", "PrivateKey", ":", "return", "getSuitableAlgFromCurve", "(", "k", ".", "Curve", ")", "\n\n", "case", "*", "ecdsa", ".", "PublicKey", ":", "return", "getSuitableAlgFromCurve", "(", "k", ".", "Curve", ")", "\n\n", "case", "*", "rsa", ".", "PrivateKey", ":", "return", "jwt", ".", "PS512", ",", "nil", "\n\n", "case", "*", "rsa", ".", "PublicKey", ":", "return", "jwt", ".", "PS512", ",", "nil", "\n", "}", "\n", "}", "\n\n", "return", "jwt", ".", "NONE", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}" ]
6,084
all-6085
[ "ContainerSetStateful", "toggles", "the", "stateful", "flag", "of", "the", "container", "with", "the", "given", "ID", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ContainerSetStateful", "(", "<mask>", "int", ",", "stateful", "bool", ")", "error", "{", "statefulInt", ":=", "0", "\n", "if", "stateful", "{", "statefulInt", "=", "1", "\n", "}", "\n\n", "err", ":=", "exec", "(", "c", ".", "db", ",", "\"", "\"", ",", "statefulInt", ",", "id", ")", "\n", "return", "err", "\n", "}" ]
6,085
all-6086
[ "canonicalizeSubject", "establishes", "the", "type", "of", "subject", "by", "looking", "for", "one", "of", "pachyderm", "s", "subject", "prefixes", "and", "then", "canonicalizes", "the", "subject", "based", "on", "that", ".", "If", "subject", "has", "no", "prefix", "they", "are", "assumed", "to", "be", "a", "GitHub", "user", ".", "TODO", "(", "msteffen", ")", ":", "We", "d", "like", "to", "require", "that", "subjects", "always", "have", "a", "prefix", "but", "this", "behavior", "hasn", "t", "been", "implemented", "in", "the", "dash", "yet", "." ]
[ "func", "(", "a", "*", "apiServer", ")", "canonicalizeSubject", "(", "ctx", "context", ".", "Context", ",", "subject", "string", ")", "(", "string", ",", "error", ")", "{", "colonIdx", ":=", "strings", ".", "Index", "(", "subject", ",", "\"", "\"", ")", "\n", "if", "colonIdx", "<", "0", "{", "subject", "=", "authclient", ".", "GitHubPrefix", "+", "subject", "\n", "colonIdx", "=", "len", "(", "authclient", ".", "GitHubPrefix", ")", "-", "1", "\n", "}", "\n", "prefix", ":=", "subject", "[", ":", "colonIdx", "]", "\n", "a", ".", "configMu", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "configMu", ".", "Unlock", "(", ")", "\n\n", "// check prefix against config cache", "if", "a", ".", "configCache", "!=", "nil", "{", "if", "prefix", "==", "a", ".", "configCache", ".", "IDP", ".", "Name", "{", "return", "subject", ",", "nil", "\n", "}", "\n", "if", "<mask>", "==", "path", ".", "Join", "(", "\"", "\"", ",", "a", ".", "configCache", ".", "IDP", ".", "Name", ")", "{", "return", "subject", ",", "nil", "// TODO(msteffen): check if this IdP supports groups", "\n", "}", "\n", "}", "\n\n", "// check against fixed prefixes", "prefix", "+=", "\"", "\"", "// append \":\" to match constants", "\n", "switch", "prefix", "{", "case", "authclient", ".", "GitHubPrefix", ":", "var", "err", "error", "\n", "subject", ",", "err", "=", "canonicalizeGitHubUsername", "(", "ctx", ",", "subject", "[", "len", "(", "authclient", ".", "GitHubPrefix", ")", ":", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "case", "authclient", ".", "PipelinePrefix", ",", "authclient", ".", "RobotPrefix", ":", "break", "\n", "default", ":", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "subject", "[", ":", "colonIdx", "+", "1", "]", ")", "\n", "}", "\n", "return", "subject", ",", "nil", "\n", "}" ]
6,086
all-6087
[ "WithAcceptLanguage", "browser", "langugage", "to", "emulate", "." ]
[ "func", "(", "p", "SetUserAgentOverrideParams", ")", "WithAcceptLanguage", "(", "acceptLanguage", "string", ")", "*", "SetUserAgentOverrideParams", "{", "p", ".", "AcceptLanguage", "=", "acceptLanguage", "\n", "<mask>", "&", "p", "\n", "}" ]
6,087
all-6088
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniformMatrix2x4fv", "(", "program", "uint32", ",", "location", "int32", ",", "<mask>", "int32", ",", "transpose", "bool", ",", "value", "*", "float32", ")", "{", "syscall", ".", "Syscall6", "(", "gpProgramUniformMatrix2x4fv", ",", "5", ",", "uintptr", "(", "program", ")", ",", "uintptr", "(", "location", ")", ",", "uintptr", "(", "count", ")", ",", "boolToUintptr", "(", "transpose", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ",", "0", ")", "\n", "}" ]
6,088
all-6089
[ "Setup", "starts", "the", "Pact", "Mock", "Server", ".", "This", "is", "usually", "called", "before", "each", "test", "suite", "begins", ".", "AddInteraction", "()", "will", "automatically", "call", "this", "if", "no", "Mock", "Server", "has", "been", "started", "." ]
[ "func", "(", "p", "*", "Pact", ")", "Setup", "(", "startMockServer", "bool", ")", "*", "Pact", "{", "p", ".", "setupLogging", "(", ")", "\n", "log", ".", "Println", "(", "\"", "\"", ")", "\n", "dir", ",", "_", ":=", "os", ".", "Getwd", "(", ")", "\n\n", "if", "p", ".", "Network", "==", "\"", "\"", "{", "p", ".", "Network", "=", "\"", "\"", "\n", "}", "\n\n", "if", "!", "p", ".", "toolValidityCheck", "&&", "!", "(", "p", ".", "DisableToolValidityCheck", "||", "os", ".", "Getenv", "(", "\"", "\"", ")", "!=", "\"", "\"", ")", "{", "checkCliCompatibility", "(", ")", "\n", "p", ".", "toolValidityCheck", "=", "true", "\n", "}", "\n\n", "if", "p", ".", "Host", "==", "\"", "\"", "{", "p", ".", "Host", "=", "\"", "\"", "\n", "}", "\n\n", "if", "p", ".", "LogDir", "==", "\"", "\"", "{", "p", ".", "LogDir", "=", "fmt", ".", "Sprintf", "(", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", ")", "\n", "}", "\n\n", "if", "p", ".", "PactDir", "==", "\"", "\"", "{", "p", ".", "PactDir", "=", "fmt", ".", "Sprintf", "(", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", ")", "\n", "}", "\n\n", "if", "p", ".", "SpecificationVersion", "==", "0", "{", "p", ".", "SpecificationVersion", "=", "2", "\n", "}", "\n\n", "if", "p", ".", "ClientTimeout", "==", "0", "{", "p", ".", "ClientTimeout", "=", "10", "*", "time", ".", "Second", "\n", "}", "\n\n", "if", "p", ".", "pactClient", "==", "nil", "{", "c", ":=", "NewClient", "(", ")", "\n", "c", ".", "TimeoutDuration", "=", "p", ".", "ClientTimeout", "\n", "p", ".", "pactClient", "=", "c", "\n", "}", "\n\n", "if", "p", ".", "PactFileWriteMode", "==", "\"", "\"", "{", "p", ".", "PactFileWriteMode", "=", "\"", "\"", "\n", "}", "\n\n", "// Need to predefine due to scoping", "var", "port", "int", "\n", "var", "perr", "error", "\n", "if", "p", ".", "AllowedMockServerPorts", "!=", "\"", "\"", "{", "port", ",", "perr", "=", "utils", ".", "FindPortInRange", "(", "p", ".", "AllowedMockServerPorts", ")", "\n", "}", "else", "{", "port", ",", "perr", "=", "utils", ".", "GetFreePort", "(", ")", "\n", "}", "\n", "if", "perr", "!=", "nil", "{", "log", ".", "Println", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "p", ".", "<mask>", "==", "nil", "&&", "startMockServer", "{", "log", ".", "Println", "(", "\"", "\"", ",", "port", ")", "\n", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ".", "SpecificationVersion", ")", ",", "\"", "\"", ",", "filepath", ".", "FromSlash", "(", "p", ".", "PactDir", ")", ",", "\"", "\"", ",", "filepath", ".", "FromSlash", "(", "p", ".", "LogDir", "+", "\"", "\"", "+", "\"", "\"", ")", ",", "\"", "\"", ",", "p", ".", "Consumer", ",", "\"", "\"", ",", "p", ".", "Provider", ",", "\"", "\"", ",", "p", ".", "PactFileWriteMode", ",", "}", "\n\n", "p", ".", "Server", "=", "p", ".", "pactClient", ".", "StartServer", "(", "args", ",", "port", ")", "\n", "}", "\n\n", "return", "p", "\n", "}" ]
6,089
all-6090
[ "HasWidth", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "HasWidth", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "Width", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
6,090
all-6091
[ "newWatcher", "creates", "a", "new", "watcher", "." ]
[ "func", "newWatcher", "(", "c", "*", "config", ".", "Config", ",", "clients", "*", "dep", ".", "ClientSet", ",", "once", "bool", ")", "(", "*", "<mask>", ".", "Watcher", ",", "error", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ")", "\n\n", "w", ",", "err", ":=", "watch", ".", "NewWatcher", "(", "&", "watch", ".", "NewWatcherInput", "{", "Clients", ":", "clients", ",", "MaxStale", ":", "config", ".", "TimeDurationVal", "(", "c", ".", "MaxStale", ")", ",", "Once", ":", "once", ",", "RenewVault", ":", "clients", ".", "Vault", "(", ")", ".", "Token", "(", ")", "!=", "\"", "\"", "&&", "config", ".", "BoolVal", "(", "c", ".", "Vault", ".", "RenewToken", ")", ",", "VaultAgentTokenFile", ":", "config", ".", "StringVal", "(", "c", ".", "Vault", ".", "VaultAgentTokenFile", ")", ",", "RetryFuncConsul", ":", "watch", ".", "RetryFunc", "(", "c", ".", "Consul", ".", "Retry", ".", "RetryFunc", "(", ")", ")", ",", "// TODO: Add a sane default retry - right now this only affects \"local\"", "// dependencies like reading a file from disk.", "RetryFuncDefault", ":", "nil", ",", "RetryFuncVault", ":", "watch", ".", "RetryFunc", "(", "c", ".", "Vault", ".", "Retry", ".", "RetryFunc", "(", ")", ")", ",", "VaultGrace", ":", "config", ".", "TimeDurationVal", "(", "c", ".", "Vault", ".", "Grace", ")", ",", "VaultToken", ":", "clients", ".", "Vault", "(", ")", ".", "Token", "(", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "w", ",", "nil", "\n", "}" ]
6,091
all-6092
[ "CreateComment", "adds", "a", "new", "comment", "to", "the", "system", "." ]
[ "func", "(", "<mask>", "*", "Client", ")", "CreateComment", "(", "handle", ",", "message", "string", ")", "(", "*", "Comment", ",", "error", ")", "{", "var", "out", "reqComment", "\n", "comment", ":=", "Comment", "{", "Message", ":", "String", "(", "message", ")", "}", "\n", "if", "len", "(", "handle", ")", ">", "0", "{", "comment", ".", "Handle", "=", "String", "(", "handle", ")", "\n", "}", "\n", "if", "err", ":=", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "&", "comment", ",", "&", "out", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "out", ".", "Comment", ",", "nil", "\n", "}" ]
6,092
all-6093
[ "Do", "executes", "SystemInfo", ".", "getProcessInfo", "against", "the", "provided", "context", ".", "returns", ":", "processInfo", "-", "An", "array", "of", "process", "info", "blocks", "." ]
[ "func", "(", "p", "*", "GetProcessInfoParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "processInfo", "[", "]", "*", "ProcessInfo", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetProcessInfoReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetProcessInfo", ",", "nil", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "ProcessInfo", ",", "nil", "\n", "}" ]
6,093
all-6094
[ "NewPointsIndex", "creates", "new", "PointsIndex", "that", "maintains", "the", "points", "in", "each", "cell", "." ]
[ "func", "NewPointsIndex", "(", "resolution", "Meters", ")", "*", "PointsIndex", "{", "newSet", ":=", "func", "(", ")", "interface", "{", "}", "{", "return", "newSet", "(", ")", "\n", "}", "\n\n", "return", "&", "PointsIndex", "{", "newGeoIndex", "(", "resolution", ",", "newSet", ")", ",", "<mask>", "(", "map", "[", "string", "]", "Point", ")", "}", "\n", "}" ]
6,094
all-6095
[ "Add", "places", "an", "item", "at", "the", "back", "of", "the", "Queue", "." ]
[ "func", "(", "q", "*", "Queue", ")", "Add", "(", "entry", "interface", "{", "}", ")", "{", "q", ".", "<mask>", ".", "Lock", "(", ")", "\n", "defer", "q", ".", "key", ".", "Unlock", "(", ")", "\n", "if", "nil", "==", "q", ".", "underlyer", "{", "q", ".", "underlyer", "=", "NewLinkedList", "(", ")", "\n", "}", "\n", "q", ".", "underlyer", ".", "AddBack", "(", "entry", ")", "\n", "}" ]
6,095
all-6096
[ "HasName", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "CreatedBy", ")", "HasName", "(", ")", "bool", "{", "if", "c", "!=", "nil", "&&", "c", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
6,096
all-6097
[ "dependsOn", "returns", "a", "boolean", "value", "indicating", "whether", "the", "image", "depends", "on", "target", "." ]
[ "func", "(", "i", "*", "Image", ")", "dependsOn", "(", "target", "*", "Image", ")", "bool", "{", "for", "_", ",", "c", ":=", "range", "i", ".", "drawTrianglesHistory", "{", "if", "c", ".", "image", "==", "<mask>", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
6,097
all-6098
[ "Foreach", "acts", "the", "same", "as", "g_list_foreach", "()", ".", "No", "user_data", "argument", "is", "implemented", "because", "of", "Go", "clojure", "capabilities", "." ]
[ "func", "(", "v", "*", "List", ")", "Foreach", "(", "fn", "func", "(", "item", "<mask>", "{", "}", ")", ")", "{", "for", "l", ":=", "v", ";", "l", "!=", "nil", ";", "l", "=", "l", ".", "Next", "(", ")", "{", "fn", "(", "l", ".", "Data", "(", ")", ")", "\n", "}", "\n", "}" ]
6,098
all-6099
[ "GetAuthTokenCmd", "returns", "a", "cobra", "command", "that", "lets", "a", "user", "get", "a", "pachyderm", "token", "on", "behalf", "of", "themselves", "or", "another", "user" ]
[ "func", "GetAuthTokenCmd", "(", "noMetrics", ",", "noPortForwarding", "*", "bool", ")", "*", "cobra", ".", "Command", "{", "var", "quiet", "bool", "\n", "getAuthToken", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\\\"", "\\\"", "\"", ",", "Long", ":", "\"", "\\\"", "\\\"", "\"", "+", "\"", "\"", ",", "Run", ":", "cmdutil", ".", "RunFixedArgs", "(", "1", ",", "func", "(", "args", "[", "]", "string", ")", "error", "{", "<mask>", ":=", "args", "[", "0", "]", "\n", "c", ",", "err", ":=", "client", ".", "NewOnUserMachine", "(", "!", "*", "noMetrics", ",", "!", "*", "noPortForwarding", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "defer", "c", ".", "Close", "(", ")", "\n", "resp", ",", "err", ":=", "c", ".", "GetAuthToken", "(", "c", ".", "Ctx", "(", ")", ",", "&", "auth", ".", "GetAuthTokenRequest", "{", "Subject", ":", "subject", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "if", "quiet", "{", "fmt", ".", "Println", "(", "resp", ".", "Token", ")", "\n", "}", "else", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ",", "resp", ".", "Subject", ",", "resp", ".", "Token", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ")", ",", "}", "\n", "getAuthToken", ".", "PersistentFlags", "(", ")", ".", "BoolVarP", "(", "&", "quiet", ",", "\"", "\"", ",", "\"", "\"", ",", "false", ",", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", ")", "\n", "return", "cmdutil", ".", "CreateAlias", "(", "getAuthToken", ",", "\"", "\"", ")", "\n", "}" ]
6,099
all-6100
[ "ReservedInstancePurchaseLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "ReservedInstancePurchaseLocator", "(", "href", "string", ")", "*", "ReservedInstancePurchaseLocator", "{", "<mask>", "&", "ReservedInstancePurchaseLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]