id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
6,200
all-6201
[ "next", "returns", "the", "next", "token", "." ]
[ "func", "(", "p", "*", "parser", ")", "next", "(", ")", "item", "{", "if", "p", ".", "peekCount", ">", "0", "{", "p", ".", "peekCount", "--", "\n", "}", "else", "{", "t", ":=", "p", ".", "lex", ".", "nextItem", "(", ")", "\n", "// Skip comments.", "for", "t", ".", "typ", "==", "ItemComment", "{", "t", "=", "p", ".", "lex", ".", "nextItem", "(", ")", "\n", "}", "\n", "p", ".", "<mask>", "[", "0", "]", "=", "t", "\n", "}", "\n", "if", "p", ".", "token", "[", "p", ".", "peekCount", "]", ".", "typ", "==", "ItemError", "{", "p", ".", "errorf", "(", "\"", "\"", ",", "p", ".", "token", "[", "p", ".", "peekCount", "]", ".", "val", ")", "\n", "}", "\n", "return", "p", ".", "token", "[", "p", ".", "peekCount", "]", "\n", "}" ]
6,201
all-6202
[ "Hash", "returns", "a", "part", "of", "a", "MD5", "sum", "of", "a", "file", "." ]
[ "func", "(", "s", "MD5Hasher", ")", "Hash", "(", "<mask>", "io", ".", "Reader", ")", "(", "string", ",", "error", ")", "{", "hash", ":=", "md5", ".", "New", "(", ")", "\n", "if", "_", ",", "err", ":=", "io", ".", "Copy", "(", "hash", ",", "reader", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "h", ":=", "hash", ".", "Sum", "(", "nil", ")", "\n", "if", "len", "(", "h", ")", "<", "s", ".", "HashLength", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n", "return", "strings", ".", "TrimRight", "(", "hex", ".", "EncodeToString", "(", "h", ")", "[", ":", "s", ".", "HashLength", "]", ",", "\"", "\"", ")", ",", "nil", "\n", "}" ]
6,202
all-6203
[ "dump", "sorts", "the", "results", "and", "writes", "the", "generated", "code", "to", "a", "file" ]
[ "func", "(", "t", "*", "templateData", ")", "<mask>", "(", ")", "error", "{", "if", "len", "(", "t", ".", "Accessors", ")", "==", "0", "{", "logf", "(", "\"", "\"", ",", "t", ".", "Filename", ")", "\n", "return", "nil", "\n", "}", "\n\n", "// Sort accessors by ReceiverType.FieldName", "sort", ".", "Sort", "(", "byName", "(", "t", ".", "Accessors", ")", ")", "\n\n", "var", "buf", "bytes", ".", "Buffer", "\n", "if", "err", ":=", "sourceTmpl", ".", "Execute", "(", "&", "buf", ",", "t", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "clean", ",", "err", ":=", "format", ".", "Source", "(", "buf", ".", "Bytes", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "outFile", ":=", "filepath", ".", "Join", "(", "filepath", ".", "Dir", "(", "t", ".", "sourceFile", ")", ",", "t", ".", "Filename", ")", "\n", "logf", "(", "\"", "\"", ",", "outFile", ")", "\n", "return", "ioutil", ".", "WriteFile", "(", "outFile", ",", "clean", ",", "0644", ")", "\n", "}" ]
6,203
all-6204
[ "Main", "function", "Typical", "run", "with", "production", "configuration", "should", "require", "no", "parameters", "It", "expects", ":", "labels", "file", "in", "/", "etc", "/", "config", "/", "labels", ".", "yaml", "github", "OAuth2", "token", "in", "/", "etc", "/", "github", "/", "oauth", "this", "token", "must", "have", "write", "access", "to", "all", "org", "s", "repos", "It", "uses", "request", "retrying", "(", "in", "case", "of", "run", "out", "of", "GH", "API", "points", ")", "It", "took", "about", "10", "minutes", "to", "process", "all", "my", "8", "repos", "with", "all", "wanted", "kubernetes", "labels", "(", "70", "+", ")", "Next", "run", "takes", "about", "22", "seconds", "to", "check", "if", "all", "labels", "are", "correct", "on", "all", "repos" ]
[ "func", "main", "(", ")", "{", "logrus", ".", "SetFormatter", "(", "logrusutil", ".", "NewDefaultFieldsFormatter", "(", "nil", ",", "logrus", ".", "Fields", "{", "\"", "\"", ":", "\"", "\"", "}", ")", ",", ")", "\n\n", "flag", ".", "Parse", "(", ")", "\n", "if", "*", "debug", "{", "logrus", ".", "SetLevel", "(", "logrus", ".", "DebugLevel", ")", "\n", "}", "\n\n", "config", ",", "err", ":=", "LoadConfig", "(", "*", "labelsPath", ",", "*", "orgs", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Fatalf", "(", "\"", "\"", ",", "*", "labelsPath", ")", "\n", "}", "\n\n", "if", "*", "onlyRepos", "!=", "\"", "\"", "&&", "*", "skipRepos", "!=", "\"", "\"", "{", "logrus", ".", "Fatalf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "*", "onlyRepos", "!=", "\"", "\"", "&&", "*", "orgs", "!=", "\"", "\"", "{", "logrus", ".", "Fatalf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "switch", "{", "case", "*", "<mask>", "==", "\"", "\"", ":", "if", "err", ":=", "writeDocs", "(", "*", "docsTemplate", ",", "*", "docsOutput", ",", "*", "config", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Fatalf", "(", "\"", "\"", ",", "*", "docsTemplate", ",", "*", "docsOutput", ")", "\n", "}", "\n", "case", "*", "action", "==", "\"", "\"", ":", "if", "err", ":=", "writeCSS", "(", "*", "cssTemplate", ",", "*", "cssOutput", ",", "*", "config", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Fatalf", "(", "\"", "\"", ",", "*", "cssTemplate", ",", "*", "cssOutput", ")", "\n", "}", "\n", "case", "*", "action", "==", "\"", "\"", ":", "githubClient", ",", "err", ":=", "newClient", "(", "*", "token", ",", "*", "tokens", ",", "*", "tokenBurst", ",", "!", "*", "confirm", ",", "*", "graphqlEndpoint", ",", "endpoint", ".", "Strings", "(", ")", "...", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Fatal", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// there are three ways to configure which repos to sync:", "// - a whitelist of org/repo values", "// - a list of orgs for which we sync all repos", "// - a list of orgs with a blacklist of org/repo values", "if", "*", "onlyRepos", "!=", "\"", "\"", "{", "reposToSync", ",", "parseError", ":=", "parseCommaDelimitedList", "(", "*", "onlyRepos", ")", "\n", "if", "parseError", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Fatal", "(", "\"", "\"", ")", "\n", "}", "\n", "for", "org", ":=", "range", "reposToSync", "{", "if", "err", "=", "syncOrg", "(", "org", ",", "githubClient", ",", "*", "config", ",", "reposToSync", "[", "org", "]", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Fatalf", "(", "\"", "\"", ",", "org", ")", "\n", "}", "\n", "}", "\n", "return", "\n", "}", "\n\n", "skippedRepos", ":=", "map", "[", "string", "]", "[", "]", "string", "{", "}", "\n", "if", "*", "skipRepos", "!=", "\"", "\"", "{", "reposToSkip", ",", "parseError", ":=", "parseCommaDelimitedList", "(", "*", "skipRepos", ")", "\n", "if", "parseError", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Fatal", "(", "\"", "\"", ")", "\n", "}", "\n", "skippedRepos", "=", "reposToSkip", "\n", "}", "\n\n", "for", "_", ",", "org", ":=", "range", "strings", ".", "Split", "(", "*", "orgs", ",", "\"", "\"", ")", "{", "org", "=", "strings", ".", "TrimSpace", "(", "org", ")", "\n", "logger", ":=", "logrus", ".", "WithField", "(", "\"", "\"", ",", "org", ")", "\n", "logger", ".", "Info", "(", "\"", "\"", ")", "\n", "repos", ",", "err", ":=", "loadRepos", "(", "org", ",", "githubClient", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "WithError", "(", "err", ")", ".", "Fatalf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "skipped", ",", "exist", ":=", "skippedRepos", "[", "org", "]", ";", "exist", "{", "repos", "=", "sets", ".", "NewString", "(", "repos", "...", ")", ".", "Difference", "(", "sets", ".", "NewString", "(", "skipped", "...", ")", ")", ".", "UnsortedList", "(", ")", "\n", "}", "\n", "if", "err", "=", "syncOrg", "(", "org", ",", "githubClient", ",", "*", "config", ",", "repos", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Fatalf", "(", "\"", "\"", ",", "org", ")", "\n", "}", "\n", "}", "\n", "default", ":", "logrus", ".", "Fatalf", "(", "\"", "\"", ",", "*", "action", ")", "\n", "}", "\n", "}" ]
6,204
all-6205
[ "ToIDHeader", "encodes", "a", "Content", "-", "ID", "or", "Message", "-", "ID", "header", "value", "(", "RFC", "2392", ")", "from", "a", "utf", "-", "8", "string", "." ]
[ "func", "ToIDHeader", "(", "v", "string", ")", "string", "{", "v", "=", "<mask>", ".", "QueryEscape", "(", "v", ")", "\n", "return", "\"", "\"", "+", "strings", ".", "Replace", "(", "v", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "+", "\"", "\"", "\n", "}" ]
6,205
all-6206
[ "readUint32", "reads", "an", "uint32", "into", "the", "supplied", "buffer", ".", "The", "idea", "is", "to", "make", "use", "of", "the", "already", "allocated", "buffers", "avoiding", "additional", "allocations", "." ]
[ "func", "(", "z", "*", "Reader", ")", "readUint32", "(", ")", "(", "uint32", ",", "error", ")", "{", "buf", ":=", "z", ".", "buf", "[", ":", "4", "]", "\n", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "z", ".", "src", ",", "buf", ")", "\n", "x", ":=", "<mask>", ".", "LittleEndian", ".", "Uint32", "(", "buf", ")", "\n", "return", "x", ",", "err", "\n", "}" ]
6,206
all-6207
[ "TakeWhile", "continues", "returning", "items", "as", "long", "as", "criteria", "holds", "true", "." ]
[ "func", "(", "iter", "Enumerator", ")", "TakeWhile", "(", "criteria", "func", "(", "interface", "{", "}", ",", "uint", ")", "bool", ")", "Enumerator", "{", "results", ":=", "make", "(", "chan", "interface", "{", "}", ")", "\n\n", "<mask>", "func", "(", ")", "{", "defer", "close", "(", "results", ")", "\n", "i", ":=", "uint", "(", "0", ")", "\n", "for", "entry", ":=", "range", "iter", "{", "if", "!", "criteria", "(", "entry", ",", "i", ")", "{", "return", "\n", "}", "\n", "i", "++", "\n", "results", "<-", "entry", "\n", "}", "\n", "}", "(", ")", "\n\n", "return", "results", "\n", "}" ]
6,207
all-6208
[ "Output", "json", "format", "records", "the", "log", "with", "special", "callstack", "depth", "and", "log", "level", "." ]
[ "func", "(", "l", "*", "Logger", ")", "OutputJson", "(", "callDepth", "int", ",", "level", "Level", ",", "body", "<mask>", "{", "}", ")", "{", "if", "l", ".", "level", ">", "level", "{", "return", "\n", "}", "\n\n", "buf", ":=", "l", ".", "bufs", ".", "Get", "(", ")", ".", "(", "[", "]", "byte", ")", "\n", "buf", "=", "buf", "[", "0", ":", "0", "]", "\n", "defer", "l", ".", "bufs", ".", "Put", "(", "buf", ")", "\n\n", "type", "JsonLog", "struct", "{", "Time", "string", "`json:\"log_time\"`", "\n", "Level", "string", "`json:\"log_level\"`", "\n", "File", "string", "`json:\"log_file\"`", "\n", "Line", "string", "`json:\"log_line\"`", "\n", "Body", "interface", "{", "}", "`json:\"log_body\"`", "\n", "}", "\n\n", "var", "jsonlog", "JsonLog", "\n", "if", "l", ".", "flag", "&", "Ltime", ">", "0", "{", "now", ":=", "time", ".", "Now", "(", ")", ".", "Format", "(", "timeFormat", ")", "\n", "jsonlog", ".", "Time", "=", "now", "\n", "}", "\n\n", "if", "l", ".", "flag", "&", "Llevel", ">", "0", "{", "jsonlog", ".", "Level", "=", "level", ".", "String", "(", ")", "\n", "}", "\n\n", "if", "l", ".", "flag", "&", "Lfile", ">", "0", "{", "_", ",", "file", ",", "line", ",", "ok", ":=", "runtime", ".", "Caller", "(", "callDepth", ")", "\n", "if", "!", "ok", "{", "file", "=", "\"", "\"", "\n", "line", "=", "0", "\n", "}", "else", "{", "for", "i", ":=", "len", "(", "file", ")", "-", "1", ";", "i", ">", "0", ";", "i", "--", "{", "if", "file", "[", "i", "]", "==", "'/'", "{", "file", "=", "file", "[", "i", "+", "1", ":", "]", "\n", "break", "\n", "}", "\n", "}", "\n", "}", "\n\n", "jsonlog", ".", "File", "=", "file", "\n", "jsonlog", ".", "Line", "=", "string", "(", "strconv", ".", "AppendInt", "(", "buf", ",", "int64", "(", "line", ")", ",", "10", ")", ")", "\n", "}", "\n\n", "jsonlog", ".", "Body", "=", "body", "\n\n", "msg", ",", "_", ":=", "json", ".", "Marshal", "(", "jsonlog", ")", "\n", "msg", "=", "append", "(", "msg", ",", "'\\n'", ")", "\n\n", "l", ".", "hLock", ".", "Lock", "(", ")", "\n", "l", ".", "handler", ".", "Write", "(", "msg", ")", "\n", "l", ".", "hLock", ".", "Unlock", "(", ")", "\n", "}" ]
6,208
all-6209
[ "Sort", "rearranges", "the", "positions", "of", "the", "entries", "in", "this", "list", "so", "that", "they", "are", "ascending", "." ]
[ "func", "(", "list", "*", "LinkedList", ")", "Sort", "(", "comparator", "Comparator", ")", "error", "{", "list", ".", "key", ".", "Lock", "(", ")", "\n", "defer", "list", ".", "key", ".", "Unlock", "(", ")", "\n", "var", "err", "error", "\n", "list", ".", "first", ",", "err", "=", "mergeSort", "(", "list", ".", "first", ",", "comparator", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "<mask>", ".", "last", "=", "findLast", "(", "list", ".", "first", ")", "\n", "return", "err", "\n", "}" ]
6,209
all-6210
[ "NewIstioGatewaySource", "creates", "a", "new", "gatewaySource", "with", "the", "given", "config", "." ]
[ "func", "NewIstioGatewaySource", "(", "kubeClient", "kubernetes", ".", "Interface", ",", "istioClient", "istiomodel", ".", "ConfigStore", ",", "istioIngressGatewayServices", "[", "]", "string", ",", "namespace", "string", ",", "annotationFilter", "string", ",", "fqdnTemplate", "string", ",", "combineFqdnAnnotation", "bool", ",", "ignoreHostnameAnnotation", "bool", ",", ")", "(", "Source", ",", "error", ")", "{", "var", "(", "tmpl", "*", "template", ".", "Template", "\n", "err", "error", "\n", ")", "\n", "for", "_", ",", "lbService", ":=", "range", "istioIngressGatewayServices", "{", "if", "_", ",", "_", ",", "err", "=", "parseIngressGateway", "(", "lbService", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "if", "fqdnTemplate", "!=", "\"", "\"", "{", "tmpl", ",", "err", "=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Funcs", "(", "<mask>", ".", "FuncMap", "{", "\"", "\"", ":", "strings", ".", "TrimPrefix", ",", "}", ")", ".", "Parse", "(", "fqdnTemplate", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "return", "&", "gatewaySource", "{", "kubeClient", ":", "kubeClient", ",", "istioClient", ":", "istioClient", ",", "istioIngressGatewayServices", ":", "istioIngressGatewayServices", ",", "namespace", ":", "namespace", ",", "annotationFilter", ":", "annotationFilter", ",", "fqdnTemplate", ":", "tmpl", ",", "combineFQDNAnnotation", ":", "combineFqdnAnnotation", ",", "ignoreHostnameAnnotation", ":", "ignoreHostnameAnnotation", ",", "}", ",", "nil", "\n", "}" ]
6,210
all-6211
[ "Records", "returns", "the", "list", "of", "records", "." ]
[ "func", "(", "r", "rfc2136Provider", ")", "Records", "(", ")", "(", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "error", ")", "{", "rrs", ",", "err", ":=", "r", ".", "List", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "eps", "[", "]", "*", "endpoint", ".", "Endpoint", "\n\n", "OuterLoop", ":", "for", "_", ",", "rr", ":=", "range", "rrs", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "rr", ")", "\n\n", "if", "rr", ".", "Header", "(", ")", ".", "Class", "!=", "dns", ".", "ClassINET", "{", "continue", "\n", "}", "\n\n", "rrFqdn", ":=", "rr", ".", "Header", "(", ")", ".", "Name", "\n", "rrTTL", ":=", "endpoint", ".", "TTL", "(", "rr", ".", "Header", "(", ")", ".", "Ttl", ")", "\n", "var", "rrType", "string", "\n", "var", "rrValues", "[", "]", "string", "\n", "switch", "rr", ".", "<mask>", "(", ")", ".", "Rrtype", "{", "case", "dns", ".", "TypeCNAME", ":", "rrValues", "=", "[", "]", "string", "{", "rr", ".", "(", "*", "dns", ".", "CNAME", ")", ".", "Target", "}", "\n", "rrType", "=", "\"", "\"", "\n", "case", "dns", ".", "TypeA", ":", "rrValues", "=", "[", "]", "string", "{", "rr", ".", "(", "*", "dns", ".", "A", ")", ".", "A", ".", "String", "(", ")", "}", "\n", "rrType", "=", "\"", "\"", "\n", "case", "dns", ".", "TypeAAAA", ":", "rrValues", "=", "[", "]", "string", "{", "rr", ".", "(", "*", "dns", ".", "AAAA", ")", ".", "AAAA", ".", "String", "(", ")", "}", "\n", "rrType", "=", "\"", "\"", "\n", "case", "dns", ".", "TypeTXT", ":", "rrValues", "=", "(", "rr", ".", "(", "*", "dns", ".", "TXT", ")", ".", "Txt", ")", "\n", "rrType", "=", "\"", "\"", "\n", "default", ":", "continue", "// Unhandled record type", "\n", "}", "\n\n", "for", "idx", ",", "existingEndpoint", ":=", "range", "eps", "{", "if", "existingEndpoint", ".", "DNSName", "==", "rrFqdn", "&&", "existingEndpoint", ".", "RecordType", "==", "rrType", "{", "eps", "[", "idx", "]", ".", "Targets", "=", "append", "(", "eps", "[", "idx", "]", ".", "Targets", ",", "rrValues", "...", ")", "\n", "continue", "OuterLoop", "\n", "}", "\n", "}", "\n\n", "ep", ":=", "endpoint", ".", "NewEndpointWithTTL", "(", "rrFqdn", ",", "rrType", ",", "rrTTL", ",", "rrValues", "...", ",", ")", "\n\n", "eps", "=", "append", "(", "eps", ",", "ep", ")", "\n", "}", "\n\n", "return", "eps", ",", "nil", "\n", "}" ]
6,211
all-6212
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniform1i", "(", "<mask>", "uint32", ",", "location", "int32", ",", "v0", "int32", ")", "{", "C", ".", "glowProgramUniform1i", "(", "gpProgramUniform1i", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLint", ")", "(", "v0", ")", ")", "\n", "}" ]
6,212
all-6213
[ "String", "returns", "the", "human", "-", "friendly", "version", "of", "this", "dependency", "." ]
[ "func", "(", "d", "*", "KVListQuery", ")", "String", "(", ")", "string", "{", "<mask>", ":=", "d", ".", "prefix", "\n", "if", "d", ".", "dc", "!=", "\"", "\"", "{", "prefix", "=", "prefix", "+", "\"", "\"", "+", "d", ".", "dc", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "prefix", ")", "\n", "}" ]
6,213
all-6214
[ "Dump", "writes", "debug", "information", "from", "the", "server", "to", "w", "." ]
[ "func", "(", "c", "APIClient", ")", "Dump", "(", "w", "<mask>", ".", "Writer", ")", "error", "{", "goroClient", ",", "err", ":=", "c", ".", "DebugClient", ".", "Dump", "(", "c", ".", "Ctx", "(", ")", ",", "&", "debug", ".", "DumpRequest", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "return", "grpcutil", ".", "ScrubGRPC", "(", "grpcutil", ".", "WriteFromStreamingBytesClient", "(", "goroClient", ",", "w", ")", ")", "\n", "}" ]
6,214
all-6215
[ "ImagesGetOnCurrentNode", "returns", "all", "images", "that", "the", "current", "LXD", "node", "instance", "has", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImagesGetOnCurrentNode", "(", ")", "(", "<mask>", "[", "string", "]", "[", "]", "string", ",", "error", ")", "{", "return", "c", ".", "ImagesGetByNodeID", "(", "c", ".", "nodeID", ")", "\n", "}" ]
6,215
all-6216
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "ReferrerPolicy", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "<mask>", ")", "{", "out", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
6,216
all-6217
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetShowAdHighlightsParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay6", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,217
all-6218
[ "NewReader", "creates", "a", "Reader", "reading", "from", "r", ".", "NewReader", "only", "supports", "single", "volume", "archives", ".", "Multi", "-", "volume", "archives", "must", "use", "OpenReader", "." ]
[ "func", "NewReader", "(", "r", "io", ".", "Reader", ",", "password", "string", ")", "(", "*", "Reader", ",", "error", ")", "{", "br", ",", "ok", ":=", "r", ".", "(", "*", "bufio", ".", "Reader", ")", "\n", "if", "!", "ok", "{", "br", "=", "bufio", ".", "NewReader", "(", "r", ")", "\n", "}", "\n", "fbr", ",", "err", ":=", "newFileBlockReader", "(", "<mask>", ",", "password", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "rr", ":=", "new", "(", "Reader", ")", "\n", "rr", ".", "init", "(", "fbr", ")", "\n", "return", "rr", ",", "nil", "\n", "}" ]
6,218
all-6219
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "StopAllWorkersParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoServiceworker4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
6,219
all-6220
[ "ReadResponse", "reads", "a", "server", "response", "into", "the", "received", "o", "." ]
[ "func", "(", "o", "*", "GetAppsReader", ")", "ReadResponse", "(", "response", "runtime", ".", "ClientResponse", ",", "consumer", "runtime", ".", "Consumer", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "switch", "response", ".", "Code", "(", ")", "{", "case", "200", ":", "result", ":=", "NewGetAppsOK", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "<mask>", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n\n", "default", ":", "result", ":=", "NewGetAppsDefault", "(", "response", ".", "Code", "(", ")", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "response", ".", "Code", "(", ")", "/", "100", "==", "2", "{", "return", "result", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "result", "\n", "}", "\n", "}" ]
6,220
all-6221
[ "release", "the", "mapping", "of", "a", "buffer", "object", "s", "data", "store", "into", "the", "client", "s", "address", "space" ]
[ "func", "UnmapNamedBuffer", "(", "buffer", "uint32", ")", "bool", "{", "ret", ":=", "C", ".", "glowUnmapNamedBuffer", "(", "gpUnmapNamedBuffer", ",", "(", "C", ".", "GLuint", ")", "(", "buffer", ")", ")", "\n", "return", "<mask>", "==", "TRUE", "\n", "}" ]
6,221
all-6222
[ "GetSSHPort", "returns", "port", "for", "use", "with", "ssh" ]
[ "func", "(", "r", "*", "RPCServerDriver", ")", "GetSSHPort", "(", "_", "*", "struct", "{", "}", ",", "<mask>", "*", "int", ")", "error", "{", "port", ",", "err", ":=", "r", ".", "ActualDriver", ".", "GetSSHPort", "(", ")", "\n", "*", "reply", "=", "port", "\n", "return", "err", "\n", "}" ]
6,222
all-6223
[ "reverse", "computes", "and", "stores", "reverse", "edges", "for", "each", "vertex", "." ]
[ "func", "(", "d", "*", "dominators", ")", "reverse", "(", ")", "{", "// One inbound edge per vertex. Then we need an extra so that you can", "// always look at ridx[i+1], and another for working storage while", "// populating redge.", "cnt", ":=", "make", "(", "[", "]", "int", ",", "len", "(", "d", ".", "idom", ")", "+", "2", ")", "\n\n", "// Fill cnt[2:] with the number of outbound edges for each vertex.", "tmp", ":=", "cnt", "[", "2", ":", "]", "\n", "for", "_", ",", "idom", ":=", "range", "d", ".", "idom", "{", "tmp", "[", "idom", "]", "++", "\n", "}", "\n\n", "// Make tmp cumulative. After this step, cnt[1:] is what we want for", "// ridx, but the next step messes it up.", "var", "n", "int", "\n", "for", "idx", ",", "c", ":=", "range", "tmp", "{", "n", "+=", "c", "\n", "tmp", "[", "idx", "]", "=", "n", "\n", "}", "\n\n", "// Store outbound edges in redge, using cnt[1:] as the index to store", "// the next edge for each vertex. After we're done, everything's been", "// shifted over one, and cnt is ridx.", "redge", ":=", "<mask>", "(", "[", "]", "vName", ",", "len", "(", "d", ".", "idom", ")", ")", "\n", "tmp", "=", "cnt", "[", "1", ":", "]", "\n", "for", "i", ",", "idom", ":=", "range", "d", ".", "idom", "{", "redge", "[", "tmp", "[", "idom", "]", "]", "=", "vName", "(", "i", ")", "\n", "tmp", "[", "idom", "]", "++", "\n", "}", "\n", "d", ".", "redge", ",", "d", ".", "ridx", "=", "redge", ",", "cnt", "[", ":", "len", "(", "cnt", ")", "-", "1", "]", "\n", "}" ]
6,223
all-6224
[ "Set", "the", "bool", "according", "to", "the", "string", "." ]
[ "func", "(", "b", "*", "Bool", ")", "Set", "(", "s", "string", ")", "error", "{", "v", ",", "err", ":=", "strconv", ".", "ParseBool", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "b", ".", "Explicit", "=", "<mask>", "\n", "b", ".", "Value", "=", "v", "\n", "return", "nil", "\n", "}" ]
6,224
all-6225
[ "nolint", ":", "gocyclo" ]
[ "func", "processOutput", "(", "dbg", "debugFunction", ",", "state", "*", "linterState", ",", "out", "[", "]", "byte", ")", "{", "re", ":=", "state", ".", "regex", "\n", "all", ":=", "re", ".", "FindAllSubmatchIndex", "(", "out", ",", "-", "1", ")", "\n", "dbg", "(", "\"", "\"", ",", "state", ".", "Name", ",", "len", "(", "all", ")", ",", "state", ".", "Pattern", ")", "\n\n", "cwd", ",", "err", ":=", "os", ".", "Getwd", "(", ")", "\n", "if", "err", "!=", "nil", "{", "warning", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Create a local copy of vars so they can be modified by the linter output", "vars", ":=", "state", ".", "vars", ".", "Copy", "(", ")", "\n\n", "for", "_", ",", "indices", ":=", "range", "all", "{", "group", ":=", "[", "]", "[", "]", "byte", "{", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "indices", ")", ";", "i", "+=", "2", "{", "var", "fragment", "[", "]", "byte", "\n", "if", "indices", "[", "i", "]", "!=", "-", "1", "{", "fragment", "=", "out", "[", "indices", "[", "i", "]", ":", "indices", "[", "i", "+", "1", "]", "]", "\n", "}", "\n", "group", "=", "append", "(", "group", ",", "fragment", ")", "\n", "}", "\n\n", "issue", ",", "err", ":=", "NewIssue", "(", "state", ".", "Linter", ".", "Name", ",", "config", ".", "formatTemplate", ")", "\n", "kingpin", ".", "FatalIfError", "(", "err", ",", "\"", "\"", ")", "\n\n", "for", "i", ",", "name", ":=", "range", "re", ".", "SubexpNames", "(", ")", "{", "if", "group", "[", "i", "]", "==", "nil", "{", "continue", "\n", "}", "\n", "part", ":=", "string", "(", "group", "[", "i", "]", ")", "\n", "if", "name", "!=", "\"", "\"", "{", "vars", "[", "<mask>", "]", "=", "part", "\n", "}", "\n", "switch", "name", "{", "case", "\"", "\"", ":", "issue", ".", "Path", ",", "err", "=", "newIssuePathFromAbsPath", "(", "cwd", ",", "part", ")", "\n", "if", "err", "!=", "nil", "{", "warning", "(", "\"", "\"", ",", "part", ",", "err", ")", "\n", "}", "\n", "case", "\"", "\"", ":", "n", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "part", ",", "10", ",", "32", ")", "\n", "kingpin", ".", "FatalIfError", "(", "err", ",", "\"", "\"", ")", "\n", "issue", ".", "Line", "=", "int", "(", "n", ")", "\n\n", "case", "\"", "\"", ":", "n", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "part", ",", "10", ",", "32", ")", "\n", "kingpin", ".", "FatalIfError", "(", "err", ",", "\"", "\"", ")", "\n", "issue", ".", "Col", "=", "int", "(", "n", ")", "\n\n", "case", "\"", "\"", ":", "issue", ".", "Message", "=", "part", "\n\n", "case", "\"", "\"", ":", "}", "\n", "}", "\n", "// TODO: set messageOveride and severity on the Linter instead of reading", "// them directly from the static config", "if", "m", ",", "ok", ":=", "config", ".", "MessageOverride", "[", "state", ".", "Name", "]", ";", "ok", "{", "issue", ".", "Message", "=", "vars", ".", "Replace", "(", "m", ")", "\n", "}", "\n", "if", "sev", ",", "ok", ":=", "config", ".", "Severity", "[", "state", ".", "Name", "]", ";", "ok", "{", "issue", ".", "Severity", "=", "Severity", "(", "sev", ")", "\n", "}", "\n", "if", "state", ".", "exclude", "!=", "nil", "&&", "state", ".", "exclude", ".", "MatchString", "(", "issue", ".", "String", "(", ")", ")", "{", "continue", "\n", "}", "\n", "if", "state", ".", "include", "!=", "nil", "&&", "!", "state", ".", "include", ".", "MatchString", "(", "issue", ".", "String", "(", ")", ")", "{", "continue", "\n", "}", "\n", "state", ".", "issues", "<-", "issue", "\n", "}", "\n", "}" ]
6,225
all-6226
[ "storePid", "is", "used", "to", "write", "out", "a", "PID", "file", "to", "disk", "." ]
[ "func", "(", "r", "*", "Runner", ")", "storePid", "(", ")", "error", "{", "path", ":=", "config", ".", "StringVal", "(", "r", ".", "config", ".", "PidFile", ")", "\n", "if", "path", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "path", ")", "\n\n", "f", ",", "err", ":=", "os", ".", "OpenFile", "(", "path", ",", "os", ".", "O_CREATE", "|", "os", ".", "O_WRONLY", "|", "os", ".", "O_TRUNC", ",", "0666", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n\n", "pid", ":=", "os", ".", "Getpid", "(", ")", "\n", "_", ",", "err", "=", "f", ".", "WriteString", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pid", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,226
all-6227
[ "NewCollection", "creates", "a", "new", "collection", "." ]
[ "func", "NewCollection", "(", "etcdClient", "*", "etcd", ".", "Client", ",", "<mask>", "string", ",", "indexes", "[", "]", "*", "Index", ",", "template", "proto", ".", "Message", ",", "keyCheck", "func", "(", "string", ")", "error", ",", "valCheck", "func", "(", "proto", ".", "Message", ")", "error", ")", "Collection", "{", "// We want to ensure that the prefix always ends with a trailing", "// slash. Otherwise, when you list the items under a collection", "// such as `foo`, you might end up listing items under `foobar`", "// as well.", "if", "len", "(", "prefix", ")", ">", "0", "&&", "prefix", "[", "len", "(", "prefix", ")", "-", "1", "]", "!=", "'/'", "{", "prefix", "=", "prefix", "+", "\"", "\"", "\n", "}", "\n\n", "return", "&", "collection", "{", "prefix", ":", "prefix", ",", "etcdClient", ":", "etcdClient", ",", "indexes", ":", "indexes", ",", "limit", ":", "defaultLimit", ",", "template", ":", "template", ",", "keyCheck", ":", "keyCheck", ",", "valCheck", ":", "valCheck", ",", "}", "\n", "}" ]
6,227
all-6228
[ "RemoveTrust", "is", "a", "helper", "that", "creates", "ChangeTrustBuilder" ]
[ "func", "RemoveTrust", "(", "code", ",", "issuer", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "<mask>", "ChangeTrustBuilder", ")", "{", "mutators", ":=", "[", "]", "interface", "{", "}", "{", "CreditAsset", "(", "code", ",", "issuer", ")", ",", "Limit", "(", "\"", "\"", ")", ",", "}", "\n\n", "for", "_", ",", "mut", ":=", "range", "args", "{", "mutators", "=", "append", "(", "mutators", ",", "mut", ")", "\n", "}", "\n\n", "return", "ChangeTrust", "(", "mutators", "...", ")", "\n", "}" ]
6,228
all-6229
[ "Attach", "sets", "this", "writer", "as", "the", "output", "destination", "for", "the", "specified", "logger", ".", "If", "the", "logger", "is", "not", "specified", "then", "this", "writer", "attaches", "to", "the", "log", "package", "standard", "logger", ".", "This", "method", "calls", "SetOutput", "for", "the", "specified", "logger", "(", "or", "the", "standard", "logger", ")", "to", "set", "its", "output", "writer", "." ]
[ "func", "(", "w", "*", "Writer", ")", "Attach", "(", "logger", "...", "*", "log", ".", "Logger", ")", "{", "if", "len", "(", "logger", ")", "==", "0", "{", "logger", "=", "[", "]", "*", "log", ".", "Logger", "{", "nil", "}", "\n", "}", "\n", "for", "_", ",", "l", ":=", "range", "logger", "{", "lw", ":=", "newLogWriter", "(", "w", ",", "l", ")", "\n", "if", "l", "==", "nil", "{", "<mask>", ".", "SetOutput", "(", "lw", ")", "\n", "}", "else", "{", "l", ".", "SetOutput", "(", "lw", ")", "\n", "}", "\n", "}", "\n", "}" ]
6,229
all-6230
[ "notifyOnOOM", "returns", "channel", "on", "which", "you", "can", "expect", "event", "about", "OOM", "if", "process", "died", "without", "OOM", "this", "channel", "will", "be", "closed", ".", "s", "is", "current", "*", "libcontainer", ".", "State", "for", "container", "." ]
[ "func", "notifyOnOOM", "(", "paths", "map", "[", "string", "]", "string", ")", "(", "<-", "chan", "struct", "{", "}", ",", "error", ")", "{", "dir", ":=", "paths", "[", "oomCgroupName", "]", "\n", "if", "dir", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "oomCgroupName", ")", "\n", "}", "\n", "oomControl", ",", "err", ":=", "os", ".", "Open", "(", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "fd", ",", "_", ",", "syserr", ":=", "syscall", ".", "RawSyscall", "(", "syscall", ".", "SYS_EVENTFD2", ",", "0", ",", "syscall", ".", "FD_CLOEXEC", ",", "0", ")", "\n", "if", "syserr", "!=", "0", "{", "oomControl", ".", "Close", "(", ")", "\n", "return", "nil", ",", "syserr", "\n", "}", "\n\n", "eventfd", ":=", "os", ".", "NewFile", "(", "fd", ",", "\"", "\"", ")", "\n\n", "eventControlPath", ":=", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", "\n", "<mask>", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "eventfd", ".", "Fd", "(", ")", ",", "oomControl", ".", "Fd", "(", ")", ")", "\n", "if", "err", ":=", "ioutil", ".", "WriteFile", "(", "eventControlPath", ",", "[", "]", "byte", "(", "data", ")", ",", "0700", ")", ";", "err", "!=", "nil", "{", "eventfd", ".", "Close", "(", ")", "\n", "oomControl", ".", "Close", "(", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "ch", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "go", "func", "(", ")", "{", "defer", "func", "(", ")", "{", "close", "(", "ch", ")", "\n", "eventfd", ".", "Close", "(", ")", "\n", "oomControl", ".", "Close", "(", ")", "\n", "}", "(", ")", "\n", "buf", ":=", "make", "(", "[", "]", "byte", ",", "8", ")", "\n", "for", "{", "if", "_", ",", "err", ":=", "eventfd", ".", "Read", "(", "buf", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "// When a cgroup is destroyed, an event is sent to eventfd.", "// So if the control path is gone, return instead of notifying.", "if", "_", ",", "err", ":=", "os", ".", "Lstat", "(", "eventControlPath", ")", ";", "os", ".", "IsNotExist", "(", "err", ")", "{", "return", "\n", "}", "\n", "ch", "<-", "struct", "{", "}", "{", "}", "\n", "}", "\n", "}", "(", ")", "\n", "return", "ch", ",", "nil", "\n", "}" ]
6,230
all-6231
[ "RequestLogger", "returns", "a", "logger", "handler", "using", "a", "custom", "LogFormatter", "." ]
[ "func", "RequestLogger", "(", "f", "LogFormatter", ")", "func", "(", "next", "http", ".", "<mask>", ")", "http", ".", "Handler", "{", "return", "func", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "fn", ":=", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "entry", ":=", "f", ".", "NewLogEntry", "(", "r", ")", "\n", "ww", ":=", "NewWrapResponseWriter", "(", "w", ",", "r", ".", "ProtoMajor", ")", "\n\n", "t1", ":=", "time", ".", "Now", "(", ")", "\n", "defer", "func", "(", ")", "{", "entry", ".", "Write", "(", "ww", ".", "Status", "(", ")", ",", "ww", ".", "BytesWritten", "(", ")", ",", "time", ".", "Since", "(", "t1", ")", ")", "\n", "}", "(", ")", "\n\n", "next", ".", "ServeHTTP", "(", "ww", ",", "WithLogEntry", "(", "r", ",", "entry", ")", ")", "\n", "}", "\n", "return", "http", ".", "HandlerFunc", "(", "fn", ")", "\n", "}", "\n", "}" ]
6,231
all-6232
[ "Scan", "implements", "the", "database", "/", "sql", "Scanner", "interface", "." ]
[ "func", "(", "f", "*", "Float32", ")", "Scan", "(", "src", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "switch", "t", ":=", "src", ".", "(", "type", ")", "{", "case", "string", ":", "_", ",", "err", "=", "fmt", ".", "Sscan", "(", "t", ",", "f", ")", "\n", "case", "[", "]", "byte", ":", "_", ",", "err", "=", "fmt", ".", "Sscan", "(", "string", "(", "t", ")", ",", "f", ")", "\n", "case", "float64", ":", "*", "f", "=", "Float32", "(", "t", ")", "\n", "<mask>", "int64", ":", "*", "f", "=", "Float32", "(", "t", ")", "\n", "default", ":", "_", ",", "err", "=", "fmt", ".", "Sscan", "(", "fmt", ".", "Sprint", "(", "t", ")", ",", "f", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
6,232
all-6233
[ "LastScrapeDuration", "returns", "how", "long", "the", "last", "scrape", "of", "the", "target", "took", "." ]
[ "func", "(", "t", "*", "Target", ")", "LastScrapeDuration", "(", ")", "<mask>", ".", "Duration", "{", "t", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "t", ".", "mtx", ".", "RUnlock", "(", ")", "\n\n", "return", "t", ".", "lastScrapeDuration", "\n", "}" ]
6,233
all-6234
[ "NewMockLoader", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockLoader", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockLoader", "{", "mock", ":=", "&", "MockLoader", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockLoaderMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
6,234
all-6235
[ "WithErrorReason", "if", "set", "this", "causes", "the", "request", "to", "fail", "with", "the", "given", "reason", ".", "Passing", "Aborted", "for", "requests", "marked", "with", "isNavigationRequest", "also", "cancels", "the", "navigation", ".", "Must", "not", "be", "set", "in", "response", "to", "an", "authChallenge", "." ]
[ "func", "(", "p", "ContinueInterceptedRequestParams", ")", "WithErrorReason", "(", "errorReason", "ErrorReason", ")", "*", "ContinueInterceptedRequestParams", "{", "p", ".", "ErrorReason", "=", "errorReason", "\n", "<mask>", "&", "p", "\n", "}" ]
6,235
all-6236
[ "BasicAuthorizer", "authorizes", "requests", "based", "on", "a", "simple", "credentials", "list", "." ]
[ "func", "BasicAuthorizer", "(", "credentials", "map", "[", "string", "]", "string", ")", "*", "Callback", "{", "return", "C", "(", "\"", "\"", ",", "All", "(", ")", ",", "func", "(", "ctx", "*", "Context", ")", "error", "{", "// check for credentials", "user", ",", "<mask>", ",", "ok", ":=", "ctx", ".", "HTTPRequest", ".", "BasicAuth", "(", ")", "\n", "if", "!", "ok", "{", "return", "ErrAccessDenied", "\n", "}", "\n\n", "// check if credentials match", "if", "val", ",", "ok", ":=", "credentials", "[", "user", "]", ";", "!", "ok", "||", "val", "!=", "password", "{", "return", "ErrAccessDenied", "\n", "}", "\n\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
6,236
all-6237
[ "Create", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockControl", ")", "Create", "(", "arg0", "*", "control", ".", "Spec", ")", "(", "cgroups", ".", "Cgroup", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "cgroups", ".", "Cgroup", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
6,237
all-6238
[ "Do", "executes", "Runtime", ".", "evaluate", "against", "the", "provided", "context", ".", "returns", ":", "result", "-", "Evaluation", "result", ".", "exceptionDetails", "-", "Exception", "details", "." ]
[ "func", "(", "p", "*", "EvaluateParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "result", "*", "RemoteObject", ",", "exceptionDetails", "*", "ExceptionDetails", ",", "err", "error", ")", "{", "// execute", "var", "res", "EvaluateReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandEvaluate", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Result", ",", "res", ".", "ExceptionDetails", ",", "nil", "\n", "}" ]
6,238
all-6239
[ "export", "FS_AllocStats" ]
[ "func", "FS_AllocStats", "(", ")", "*", "C", ".", "<mask>", "{", "s", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "sFrameSets", ".", "Len", "(", ")", ",", "sFileSeqs", ".", "Len", "(", ")", ")", "\n", "// string is freed by caller", "return", "C", ".", "CString", "(", "s", ")", "\n", "}" ]
6,239
all-6240
[ "DefaultCluster", "returns", "the", "default", "Cluster", "." ]
[ "func", "DefaultCluster", "(", ")", "*", "Cluster", "{", "return", "&", "Cluster", "{", "hosts", ":", "make", "(", "[", "]", "*", "URI", ",", "0", ")", ",", "okList", ":", "<mask>", "(", "[", "]", "bool", ",", "0", ")", ",", "mutex", ":", "&", "sync", ".", "RWMutex", "{", "}", ",", "}", "\n", "}" ]
6,240
all-6241
[ "NetworkNodeJoin", "adds", "a", "new", "entry", "in", "the", "networks_nodes", "table", ".", "It", "should", "only", "be", "used", "when", "a", "new", "node", "joins", "the", "cluster", "when", "it", "s", "safe", "to", "assume", "that", "the", "relevant", "network", "has", "already", "been", "created", "on", "the", "joining", "node", "and", "we", "just", "need", "to", "track", "it", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "NetworkNodeJoin", "(", "networkID", ",", "nodeID", "int64", ")", "error", "{", "columns", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", "\n", "<mask>", ":=", "[", "]", "interface", "{", "}", "{", "networkID", ",", "nodeID", "}", "\n", "_", ",", "err", ":=", "query", ".", "UpsertObject", "(", "c", ".", "tx", ",", "\"", "\"", ",", "columns", ",", "values", ")", "\n", "return", "err", "\n", "}" ]
6,241
all-6242
[ "SuccessFunc", "outputs", "Success", "level", "log", "returned", "from", "the", "function" ]
[ "func", "SuccessFunc", "(", "f", "func", "(", ")", "string", ")", "error", "{", "if", "isModeEnable", "(", "OK", ")", "{", "return", "glg", ".", "out", "(", "<mask>", ",", "\"", "\"", ",", "f", "(", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,242
all-6243
[ "ReadInt16", "returns", "an", "int16", "read", "from", "address", "a", "of", "the", "inferior", "." ]
[ "func", "(", "p", "*", "<mask>", ")", "ReadInt16", "(", "a", "Address", ")", "int16", "{", "return", "int16", "(", "p", ".", "ReadUint16", "(", "a", ")", ")", "\n", "}" ]
6,243
all-6244
[ "Append", "appends", "the", "SQLNode", "to", "the", "buffer", "." ]
[ "func", "Append", "(", "buf", "*", "bytes", ".", "Buffer", ",", "node", "SQLNode", ")", "{", "tbuf", ":=", "&", "TrackedBuffer", "{", "Buffer", ":", "buf", ",", "}", "\n", "<mask>", ".", "Format", "(", "tbuf", ")", "\n", "}" ]
6,244
all-6245
[ "SeparatorToolItemNew", "is", "a", "wrapper", "around", "gtk_separator_tool_item_new", "()", "." ]
[ "func", "SeparatorToolItemNew", "(", ")", "(", "*", "SeparatorToolItem", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_separator_tool_item_new", "(", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapSeparatorToolItem", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
6,245
all-6246
[ "Action", "returns", "an", "action", "that", "should", "be", "registered", "in", "the", "group", "under", "the", "watch", "name", "." ]
[ "func", "(", "w", "*", "Watcher", ")", "Action", "(", ")", "*", "fire", ".", "Action", "{", "return", "&", "fire", ".", "Action", "{", "Methods", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Callback", ":", "fire", ".", "C", "(", "\"", "\"", ",", "<mask>", ".", "All", "(", ")", ",", "func", "(", "ctx", "*", "fire", ".", "Context", ")", "error", "{", "// handle connection", "w", ".", "manager", ".", "handle", "(", "ctx", ")", "\n\n", "return", "nil", "\n", "}", ")", ",", "}", "\n", "}" ]
6,246
all-6247
[ "PutFile", "writes", "a", "file", "to", "PFS", "from", "a", "reader", "." ]
[ "func", "(", "c", "APIClient", ")", "PutFile", "(", "repoName", "string", ",", "commitID", "string", ",", "path", "string", ",", "reader", "<mask>", ".", "Reader", ")", "(", "_", "int", ",", "retErr", "error", ")", "{", "pfc", ",", "err", ":=", "c", ".", "newOneoffPutFileClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "return", "pfc", ".", "PutFile", "(", "repoName", ",", "commitID", ",", "path", ",", "reader", ")", "\n", "}" ]
6,247
all-6248
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EndParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoTracing11", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
6,248
all-6249
[ "DeepCopy", "copies", "the", "receiver", "into", "a", "new", "ObjectId", "." ]
[ "func", "(", "id", "*", "ObjectId", ")", "DeepCopy", "(", ")", "*", "ObjectId", "{", "if", "id", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "ObjectId", ")", "\n", "<mask>", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
6,249
all-6250
[ "putSignaturesToLookaside", "implements", "PutSignatures", "()", "from", "the", "lookaside", "location", "configured", "in", "s", ".", "c", ".", "signatureBase", "which", "is", "not", "nil", "." ]
[ "func", "(", "d", "*", "dockerImageDestination", ")", "putSignaturesToLookaside", "(", "signatures", "[", "]", "[", "]", "byte", ")", "error", "{", "// FIXME? This overwrites files one at a time, definitely not atomic.", "// A failure when updating signatures with a reordered copy could lose some of them.", "// Skip dealing with the manifest digest if not necessary.", "if", "len", "(", "signatures", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "if", "d", ".", "manifestDigest", ".", "String", "(", ")", "==", "\"", "\"", "{", "// This shouldn’t happen, ImageDestination users are required to call PutManifest before PutSignatures", "return", "errors", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// NOTE: Keep this in sync with docs/signature-protocols.md!", "for", "i", ",", "signature", ":=", "<mask>", "signatures", "{", "url", ":=", "signatureStorageURL", "(", "d", ".", "c", ".", "signatureBase", ",", "d", ".", "manifestDigest", ",", "i", ")", "\n", "if", "url", "==", "nil", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "err", ":=", "d", ".", "putOneSignature", "(", "url", ",", "signature", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "// Remove any other signatures, if present.", "// We stop at the first missing signature; if a previous deleting loop aborted", "// prematurely, this may not clean up all of them, but one missing signature", "// is enough for dockerImageSource to stop looking for other signatures, so that", "// is sufficient.", "for", "i", ":=", "len", "(", "signatures", ")", ";", ";", "i", "++", "{", "url", ":=", "signatureStorageURL", "(", "d", ".", "c", ".", "signatureBase", ",", "d", ".", "manifestDigest", ",", "i", ")", "\n", "if", "url", "==", "nil", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "missing", ",", "err", ":=", "d", ".", "c", ".", "deleteOneSignature", "(", "url", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "missing", "{", "break", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
6,250
all-6251
[ "ReceiveIssueEvent", "calls", "plugin", ".", "ReceiveIssueEvent", "()", "for", "all", "plugins" ]
[ "func", "(", "m", "*", "MultiplexerPluginWrapper", ")", "ReceiveIssueEvent", "(", "event", "sql", ".", "IssueEvent", ")", "[", "]", "<mask>", "{", "points", ":=", "[", "]", "Point", "{", "}", "\n\n", "for", "_", ",", "plugin", ":=", "range", "m", ".", "plugins", "{", "points", "=", "append", "(", "points", ",", "plugin", ".", "ReceiveIssueEvent", "(", "event", ")", "...", ")", "\n", "}", "\n\n", "return", "points", "\n", "}" ]
6,251
all-6252
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Message", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdproto1", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,252
all-6253
[ "SetBodyStreamWriter", "registers", "the", "given", "sw", "for", "populating", "response", "body", ".", "This", "function", "may", "be", "used", "in", "the", "following", "cases", ":", "*", "if", "response", "body", "is", "too", "big", "(", "more", "than", "10MB", ")", ".", "*", "if", "response", "body", "is", "streamed", "from", "slow", "external", "sources", ".", "*", "if", "response", "body", "must", "be", "streamed", "to", "the", "client", "in", "chunks", "(", "aka", "http", "server", "push", "or", "chunked", "transfer", "-", "encoding", ")", ".", "See", "also", "SetBodyStream", "." ]
[ "func", "(", "resp", "*", "<mask>", ")", "SetBodyStreamWriter", "(", "sw", "StreamWriter", ")", "{", "sr", ":=", "NewStreamReader", "(", "sw", ")", "\n", "resp", ".", "SetBodyStream", "(", "sr", ",", "-", "1", ")", "\n", "}" ]
6,253
all-6254
[ "New", "creates", "a", "new", "Checksum", "of", "the", "given", "type" ]
[ "func", "(", "t", "ChecksumType", ")", "New", "(", ")", "Checksum", "{", "s", ":=", "t", ".", "pool", "(", ")", ".", "Get", "(", ")", ".", "(", "Checksum", ")", "\n", "s", ".", "Reset", "(", ")", "\n", "<mask>", "s", "\n", "}" ]
6,254
all-6255
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "QuerySelectorAllReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom21", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,255
all-6256
[ "Crop", "retrieves", "an", "image", "that", "is", "a", "cropped", "copy", "of", "the", "original", "img", ".", "The", "crop", "is", "made", "given", "the", "informations", "provided", "in", "config", "." ]
[ "func", "Crop", "(", "img", "image", ".", "Image", ",", "c", "Config", ")", "(", "image", ".", "Image", ",", "error", ")", "{", "maxBounds", ":=", "c", ".", "maxBounds", "(", "img", ".", "Bounds", "(", ")", ")", "\n", "size", ":=", "c", ".", "computeSize", "(", "maxBounds", ",", "<mask>", ".", "Point", "{", "c", ".", "Width", ",", "c", ".", "Height", "}", ")", "\n", "cr", ":=", "c", ".", "computedCropArea", "(", "img", ".", "Bounds", "(", ")", ",", "size", ")", "\n", "cr", "=", "img", ".", "Bounds", "(", ")", ".", "Intersect", "(", "cr", ")", "\n\n", "if", "c", ".", "Options", "&", "Copy", "==", "Copy", "{", "return", "cropWithCopy", "(", "img", ",", "cr", ")", "\n", "}", "\n", "if", "dImg", ",", "ok", ":=", "img", ".", "(", "subImageSupported", ")", ";", "ok", "{", "return", "dImg", ".", "SubImage", "(", "cr", ")", ",", "nil", "\n", "}", "\n", "return", "cropWithCopy", "(", "img", ",", "cr", ")", "\n", "}" ]
6,256
all-6257
[ "resourceVSphereHAVMOverrideFindEntry", "attempts", "to", "locate", "an", "existing", "VM", "-", "specific", "HA", "config", "in", "a", "cluster", "s", "configuration", ".", "It", "s", "used", "by", "the", "resource", "s", "read", "functionality", "and", "tests", ".", "nil", "is", "returned", "if", "the", "entry", "cannot", "be", "found", "." ]
[ "func", "resourceVSphereHAVMOverrideFindEntry", "(", "cluster", "*", "object", ".", "ClusterComputeResource", ",", "vm", "*", "object", ".", "VirtualMachine", ",", ")", "(", "*", "types", ".", "ClusterDasVmConfigInfo", ",", "error", ")", "{", "props", ",", "err", ":=", "clustercomputeresource", ".", "Properties", "(", "cluster", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "for", "_", ",", "info", ":=", "<mask>", "props", ".", "ConfigurationEx", ".", "(", "*", "types", ".", "ClusterConfigInfoEx", ")", ".", "DasVmConfig", "{", "if", "info", ".", "Key", "==", "vm", ".", "Reference", "(", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "Name", "(", ")", ",", "cluster", ".", "Name", "(", ")", ")", "\n", "return", "&", "info", ",", "nil", "\n", "}", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "Name", "(", ")", ",", "cluster", ".", "Name", "(", ")", ")", "\n", "return", "nil", ",", "nil", "\n", "}" ]
6,257
all-6258
[ "BytesToUint32", "using", "big", "endian", "." ]
[ "func", "BytesToUint32", "(", "b", "[", "]", "byte", ")", "(", "uint32", ",", "error", ")", "{", "if", "len", "(", "b", ")", "!=", "4", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "<mask>", ".", "BigEndian", ".", "Uint32", "(", "b", ")", ",", "nil", "\n", "}" ]
6,258
all-6259
[ "RegisterFlags", "registers", "options", "for", "this", "munger", ";", "returns", "any", "that", "require", "a", "restart", "when", "changed", "." ]
[ "func", "(", "c", "*", "IssueCreator", ")", "RegisterFlags", "(", ")", "{", "flag", ".", "StringVar", "(", "&", "c", ".", "ownerPath", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "flag", ".", "IntVar", "(", "&", "c", ".", "MaxSIGCount", ",", "\"", "\"", ",", "3", ",", "\"", "\"", ")", "\n", "<mask>", ".", "IntVar", "(", "&", "c", ".", "MaxAssignees", ",", "\"", "\"", ",", "3", ",", "\"", "\"", ")", "\n\n", "flag", ".", "StringVar", "(", "&", "c", ".", "tokenFile", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "flag", ".", "StringVar", "(", "&", "c", ".", "project", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "flag", ".", "StringVar", "(", "&", "c", ".", "org", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "flag", ".", "BoolVar", "(", "&", "c", ".", "dryRun", ",", "\"", "\"", ",", "true", ",", "\"", "\"", ")", "\n\n", "for", "_", ",", "src", ":=", "range", "sources", "{", "src", ".", "RegisterFlags", "(", ")", "\n", "}", "\n", "}" ]
6,259
all-6260
[ "return", "a", "string", "describing", "the", "current", "GL", "connection" ]
[ "func", "GetString", "(", "name", "uint32", ")", "*", "uint8", "{", "ret", ":=", "C", ".", "glowGetString", "(", "gpGetString", ",", "(", "C", ".", "GLenum", ")", "(", "name", ")", ")", "\n", "return", "(", "*", "uint8", ")", "(", "<mask>", ")", "\n", "}" ]
6,260
all-6261
[ "FlushCommit", "returns", "an", "iterator", "that", "returns", "commits", "that", "have", "the", "specified", "commits", "as", "provenance", ".", "Note", "that", "the", "iterator", "can", "block", "if", "jobs", "have", "not", "successfully", "completed", ".", "This", "in", "effect", "waits", "for", "all", "of", "the", "jobs", "that", "are", "triggered", "by", "a", "set", "of", "commits", "to", "complete", ".", "If", "toRepos", "is", "not", "nil", "then", "only", "the", "commits", "up", "to", "and", "including", "those", "repos", "will", "be", "considered", "otherwise", "all", "repos", "are", "considered", ".", "Note", "that", "it", "s", "never", "necessary", "to", "call", "FlushCommit", "to", "run", "jobs", "they", "ll", "run", "no", "matter", "what", "FlushCommit", "just", "allows", "you", "to", "wait", "for", "them", "to", "complete", "and", "see", "their", "output", "once", "they", "do", "." ]
[ "func", "(", "c", "APIClient", ")", "FlushCommit", "(", "commits", "[", "]", "*", "pfs", ".", "Commit", ",", "toRepos", "[", "]", "*", "pfs", ".", "Repo", ")", "(", "CommitInfoIterator", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "<mask>", ".", "WithCancel", "(", "c", ".", "Ctx", "(", ")", ")", "\n", "stream", ",", "err", ":=", "c", ".", "PfsAPIClient", ".", "FlushCommit", "(", "ctx", ",", "&", "pfs", ".", "FlushCommitRequest", "{", "Commits", ":", "commits", ",", "ToRepos", ":", "toRepos", ",", "}", ",", ")", "\n", "if", "err", "!=", "nil", "{", "cancel", "(", ")", "\n", "return", "nil", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "return", "&", "commitInfoIterator", "{", "stream", ",", "cancel", "}", ",", "nil", "\n", "}" ]
6,261
all-6262
[ "makeVolatile", "makes", "the", "image", "volatile", ".", "A", "volatile", "image", "is", "always", "cleared", "at", "the", "start", "of", "a", "frame", ".", "This", "is", "suitable", "for", "offscreen", "images", "that", "pixels", "are", "changed", "often", ".", "Regular", "non", "-", "volatile", "images", "need", "to", "record", "drawing", "history", "or", "read", "its", "pixels", "from", "GPU", "if", "necessary", "so", "that", "all", "the", "images", "can", "be", "restored", "automatically", "from", "the", "context", "lost", ".", "However", "such", "recording", "the", "drawing", "history", "or", "reading", "pixels", "from", "GPU", "are", "expensive", "operations", ".", "Volatile", "images", "can", "skip", "such", "oprations", "but", "the", "image", "content", "is", "cleared", "every", "frame", "instead", ".", "When", "the", "image", "is", "disposed", "makeVolatile", "does", "nothing", "." ]
[ "func", "(", "i", "*", "<mask>", ")", "makeVolatile", "(", ")", "{", "if", "i", ".", "isDisposed", "(", ")", "{", "return", "\n", "}", "\n", "i", ".", "mipmap", ".", "orig", ".", "MakeVolatile", "(", ")", "\n", "i", ".", "disposeMipmaps", "(", ")", "\n", "}" ]
6,262
all-6263
[ "InsertAtCursor", "()", "is", "a", "wrapper", "around", "gtk_text_buffer_insert_at_cursor", "()", "." ]
[ "func", "(", "v", "*", "TextBuffer", ")", "InsertAtCursor", "(", "text", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "<mask>", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_text_buffer_insert_at_cursor", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "C", ".", "gint", "(", "len", "(", "text", ")", ")", ")", "\n", "}" ]
6,263
all-6264
[ "StatusIconNewFromStock", "is", "a", "wrapper", "around", "gtk_status_icon_new_from_stock", "()", ".", "Deprecated", "since", "3", ".", "10", "use", "StatusIconNewFromIconName", "(", "gtk_status_icon_new_from_icon_name", ")", "instead", "." ]
[ "func", "StatusIconNewFromStock", "(", "stockId", "string", ")", "(", "*", "StatusIcon", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "stockId", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "c", ":=", "C", ".", "gtk_status_icon_new_from_file", "(", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapStatusIcon", "(", "obj", ")", ",", "nil", "\n", "}" ]
6,264
all-6265
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SkipWaitingParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoServiceworker6", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,265
all-6266
[ "Del", "deletes", "header", "with", "the", "given", "key", "." ]
[ "func", "(", "h", "*", "ResponseHeader", ")", "Del", "(", "<mask>", "string", ")", "{", "k", ":=", "getHeaderKeyBytes", "(", "&", "h", ".", "bufKV", ",", "key", ",", "h", ".", "disableNormalizing", ")", "\n", "h", ".", "del", "(", "k", ")", "\n", "}" ]
6,266
all-6267
[ "Close", "terminates", "the", "session", ".", "It", "s", "a", "runtime", "error", "to", "use", "a", "session", "after", "it", "has", "been", "closed", "." ]
[ "func", "(", "s", "*", "<mask>", ")", "Close", "(", ")", "{", "s", ".", "m", ".", "Lock", "(", ")", "\n", "if", "s", ".", "cluster_", "!=", "nil", "{", "debugf", "(", "\"", "\"", ",", "s", ")", "\n", "s", ".", "unsetSocket", "(", ")", "\n", "s", ".", "cluster_", ".", "Release", "(", ")", "\n", "s", ".", "cluster_", "=", "nil", "\n", "}", "\n", "s", ".", "m", ".", "Unlock", "(", ")", "\n", "}" ]
6,267
all-6268
[ "Create", "a", "throttle", "that", "uses", "time", ".", "Now", "to", "judge", "the", "time", "given", "to", "the", "underlying", "token", "bucket", ".", "Be", "aware", "of", "the", "monotonicity", "issues", ".", "In", "particular", ":", "*", "If", "the", "system", "clock", "jumps", "into", "the", "future", "the", "throttle", "will", "let", "through", "a", "burst", "of", "traffic", ".", "*", "If", "the", "system", "clock", "jumps", "into", "the", "past", "it", "will", "halt", "all", "traffic", "for", "a", "potentially", "very", "long", "amount", "of", "time", "." ]
[ "func", "NewThrottle", "(", "rateHz", "float64", ",", "capacity", "uint64", ")", "(", "t", "Throttle", ")", "{", "typed", ":=", "&", "throttle", "{", "startTime", ":", "time", ".", "Now", "(", ")", ",", "bucket", ":", "NewTokenBucket", "(", "rateHz", ",", "<mask>", ")", ",", "}", "\n\n", "typed", ".", "mu", "=", "syncutil", ".", "NewInvariantMutex", "(", "typed", ".", "checkInvariants", ")", "\n\n", "t", "=", "typed", "\n", "return", "\n", "}" ]
6,268
all-6269
[ "getChildEntry", "returns", "a", "child", "Entry", "that", "matches", "the", "given", "pattern", "string", "." ]
[ "func", "(", "e", "*", "Entry", ")", "getChildEntry", "(", "pat", "string", ")", "*", "Entry", "{", "for", "_", ",", "entry", ":=", "<mask>", "e", ".", "entries", "{", "if", "pat", "==", "entry", ".", "Pattern", "(", ")", "{", "return", "entry", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,269
all-6270
[ "NewDesignateProvider", "is", "a", "factory", "function", "for", "OpenStack", "designate", "providers" ]
[ "func", "NewDesignateProvider", "(", "domainFilter", "DomainFilter", ",", "dryRun", "bool", ")", "(", "Provider", ",", "error", ")", "{", "client", ",", "err", ":=", "newDesignateClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "designateProvider", "{", "client", ":", "<mask>", ",", "domainFilter", ":", "domainFilter", ",", "dryRun", ":", "dryRun", ",", "}", ",", "nil", "\n", "}" ]
6,270
all-6271
[ "MarshalBinary", "interface", "implementation" ]
[ "func", "(", "m", "*", "App", ")", "MarshalBinary", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "if", "m", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "swag", ".", "WriteJSON", "(", "m", ")", "\n", "}" ]
6,271
all-6272
[ "SetGetStartedButton", "sets", "a", "button", "which", "is", "shown", "at", "the", "bottom", "of", "the", "window", "ans", "is", "only", "rendered", "the", "first", "time", "the", "user", "interacts", "with", "the", "Page", "on", "Messenger", "When", "this", "button", "is", "tapped", "we", "will", "trigger", "the", "postback", "received", "callback", "and", "deliver", "the", "person", "s", "page", "-", "scoped", "ID", "(", "PSID", ")", ".", "You", "can", "then", "present", "a", "personalized", "message", "to", "greet", "the", "user", "or", "present", "buttons", "to", "prompt", "him", "or", "her", "to", "take", "an", "action", ".", "https", ":", "//", "developers", ".", "facebook", ".", "com", "/", "docs", "/", "messenger", "-", "platform", "/", "thread", "-", "settings", "/", "get", "-", "started", "-", "button" ]
[ "func", "(", "m", "*", "Messenger", ")", "SetGetStartedButton", "(", "payload", "string", ")", "error", "{", "<mask>", ",", "err", ":=", "m", ".", "changeThreadSettings", "(", "http", ".", "MethodPost", ",", "&", "threadSettings", "{", "Type", ":", "settingTypeCallToActions", ",", "State", ":", "threadStateNew", ",", "CallToActions", ":", "[", "]", "ctaPayload", "{", "ctaPayload", "{", "Payload", ":", "payload", "}", "}", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "result", ".", "Result", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "result", ".", "Result", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,272
all-6273
[ "Do", "executes", "Debugger", ".", "stepOver", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "StepOverParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandStepOver", ",", "nil", ",", "nil", ")", "\n", "}" ]
6,273
all-6274
[ "bind", "one", "or", "more", "named", "texture", "images", "to", "a", "sequence", "of", "consecutive", "image", "units" ]
[ "func", "BindImageTextures", "(", "first", "uint32", ",", "count", "int32", ",", "textures", "*", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpBindImageTextures", ",", "3", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "count", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "textures", ")", ")", ")", "\n", "}" ]
6,274
all-6275
[ "title", ":", "service", "plans", "path", ":", "/", "services", "/", "{", "name", "}", "/", "plans", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "OK", "401", ":", "Unauthorized", "404", ":", "Service", "not", "found" ]
[ "func", "servicePlans", "(", "w", "<mask>", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "serviceName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "s", ",", "err", ":=", "getService", "(", "serviceName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "s", ".", "IsRestricted", "{", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermServiceReadPlans", ",", "contextsForService", "(", "&", "s", ")", "...", ",", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "}", "\n", "requestID", ":=", "requestIDHeader", "(", "r", ")", "\n", "plans", ",", "err", ":=", "service", ".", "GetPlansByService", "(", "s", ",", "requestID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "plans", ")", "\n", "}" ]
6,275
all-6276
[ "Internal", "functions" ]
[ "func", "lxdParseResponse", "(", "resp", "*", "http", ".", "Response", ")", "(", "*", "api", ".", "Response", ",", "string", ",", "error", ")", "{", "// Get the ETag", "etag", ":=", "resp", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n\n", "// Decode the response", "decoder", ":=", "json", ".", "NewDecoder", "(", "resp", ".", "Body", ")", "\n", "response", ":=", "api", ".", "Response", "{", "}", "\n\n", "err", ":=", "decoder", ".", "Decode", "(", "&", "response", ")", "\n", "if", "err", "!=", "nil", "{", "// Check the return value for a cleaner error", "if", "resp", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "return", "nil", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "resp", ".", "Request", ".", "<mask>", ".", "String", "(", ")", ",", "resp", ".", "Status", ")", "\n", "}", "\n\n", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n\n", "// Handle errors", "if", "response", ".", "Type", "==", "api", ".", "ErrorResponse", "{", "return", "nil", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "response", ".", "Error", ")", "\n", "}", "\n\n", "return", "&", "response", ",", "etag", ",", "nil", "\n", "}" ]
6,276
all-6277
[ "return", "parameters", "of", "an", "indexed", "query", "object", "target" ]
[ "func", "GetQueryIndexediv", "(", "target", "uint32", ",", "index", "uint32", ",", "pname", "uint32", ",", "params", "*", "int32", ")", "{", "C", ".", "glowGetQueryIndexediv", "(", "gpGetQueryIndexediv", ",", "(", "C", ".", "GLenum", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLuint", ")", "(", "index", ")", ",", "(", "C", ".", "GLenum", ")", "(", "pname", ")", ",", "(", "*", "C", ".", "GLint", ")", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
6,277
all-6278
[ "NewAPI", "returns", "an", "initialized", "API", "type", "." ]
[ "func", "NewAPI", "(", "qe", "*", "promql", ".", "Engine", ",", "q", "storage", ".", "Queryable", ",", "tr", "targetRetriever", ",", "ar", "alertmanagerRetriever", ",", "configFunc", "func", "(", ")", "config", ".", "Config", ",", "flagsMap", "map", "[", "string", "]", "string", ",", "readyFunc", "func", "(", "http", ".", "HandlerFunc", ")", "http", ".", "HandlerFunc", ",", "db", "func", "(", ")", "TSDBAdmin", ",", "enableAdmin", "bool", ",", "logger", "log", ".", "Logger", ",", "rr", "rulesRetriever", ",", "remoteReadSampleLimit", "int", ",", "remoteReadConcurrencyLimit", "int", ",", "CORSOrigin", "*", "regexp", ".", "Regexp", ",", ")", "*", "API", "{", "return", "&", "API", "{", "QueryEngine", ":", "qe", ",", "Queryable", ":", "q", ",", "targetRetriever", ":", "tr", ",", "alertmanagerRetriever", ":", "<mask>", ",", "now", ":", "time", ".", "Now", ",", "config", ":", "configFunc", ",", "flagsMap", ":", "flagsMap", ",", "ready", ":", "readyFunc", ",", "db", ":", "db", ",", "enableAdmin", ":", "enableAdmin", ",", "rulesRetriever", ":", "rr", ",", "remoteReadSampleLimit", ":", "remoteReadSampleLimit", ",", "remoteReadGate", ":", "gate", ".", "New", "(", "remoteReadConcurrencyLimit", ")", ",", "logger", ":", "logger", ",", "CORSOrigin", ":", "CORSOrigin", ",", "}", "\n", "}" ]
6,278
all-6279
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "StepOutParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger1", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
6,279
all-6280
[ "BuildCommit", "builds", "a", "commit", "in", "a", "single", "call", "from", "an", "existing", "HashTree", "that", "has", "already", "been", "written", "to", "the", "object", "store", ".", "Note", "this", "is", "a", "more", "advanced", "pattern", "for", "creating", "commits", "that", "s", "mostly", "used", "internally", "." ]
[ "func", "(", "c", "APIClient", ")", "BuildCommit", "(", "repoName", "string", ",", "branch", "string", ",", "parent", "string", ",", "treeObject", "string", ")", "(", "*", "pfs", ".", "Commit", ",", "error", ")", "{", "commit", ",", "err", ":=", "c", ".", "PfsAPIClient", ".", "BuildCommit", "(", "c", ".", "Ctx", "(", ")", ",", "&", "pfs", ".", "BuildCommitRequest", "{", "Parent", ":", "NewCommit", "(", "repoName", ",", "parent", ")", ",", "Branch", ":", "branch", ",", "Tree", ":", "&", "pfs", ".", "<mask>", "{", "Hash", ":", "treeObject", "}", ",", "}", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "return", "commit", ",", "nil", "\n", "}" ]
6,280
all-6281
[ "GetTitleSizeOk", "returns", "a", "tuple", "with", "the", "TitleSize", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "l", "*", "LogStreamDefinition", ")", "GetTitleSizeOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "l", "==", "nil", "||", "l", ".", "TitleSize", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "l", ".", "TitleSize", ",", "<mask>", "\n", "}" ]
6,281
all-6282
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CacheData", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoHar14", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,282
all-6283
[ "Scan", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockPlugins", ")", "Scan", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "[", "]", "string", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
6,283
all-6284
[ "initializeASMSecretResource", "builds", "the", "resource", "dependency", "map", "for", "the", "asmsecret", "resource" ]
[ "func", "(", "task", "*", "Task", ")", "initializeASMSecretResource", "(", "credentialsManager", "credentials", ".", "Manager", ",", "resourceFields", "*", "taskresource", ".", "ResourceFields", ")", "{", "asmSecretResource", ":=", "asmsecret", ".", "NewASMSecretResource", "(", "<mask>", ".", "Arn", ",", "task", ".", "getAllASMSecretRequirements", "(", ")", ",", "task", ".", "ExecutionCredentialsID", ",", "credentialsManager", ",", "resourceFields", ".", "ASMClientCreator", ")", "\n", "task", ".", "AddResource", "(", "asmsecret", ".", "ResourceName", ",", "asmSecretResource", ")", "\n\n", "// for every container that needs asm secret vending as envvar, it needs to wait all secrets got retrieved", "for", "_", ",", "container", ":=", "range", "task", ".", "Containers", "{", "if", "container", ".", "ShouldCreateWithASMSecret", "(", ")", "{", "container", ".", "BuildResourceDependency", "(", "asmSecretResource", ".", "GetName", "(", ")", ",", "resourcestatus", ".", "ResourceStatus", "(", "asmsecret", ".", "ASMSecretCreated", ")", ",", "apicontainerstatus", ".", "ContainerCreated", ")", "\n", "}", "\n", "}", "\n", "}" ]
6,284
all-6285
[ "GetErrorHandler", "gets", "the", "error", "handler", "from", "the", "context", "or", "returns", "the", "default" ]
[ "func", "GetErrorHandler", "(", "ctx", "context", ".", "<mask>", ",", "status", "int", ")", "ErrorHandler", "{", "key", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "status", ")", "\n", "if", "h", ",", "ok", ":=", "ctx", ".", "Value", "(", "key", ")", ".", "(", "ErrorHandler", ")", ";", "ok", "{", "return", "h", "\n", "}", "\n\n", "key", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "AllStatusCodes", ")", "\n", "if", "h", ",", "ok", ":=", "ctx", ".", "Value", "(", "key", ")", ".", "(", "ErrorHandler", ")", ";", "ok", "{", "return", "h", "\n", "}", "\n\n", "return", "DefaultErrorHandler", "\n", "}" ]
6,285
all-6286
[ "AddLogger", "adds", "a", "new", "logger", "instance", "to", "the", "Base" ]
[ "func", "(", "b", "*", "Base", ")", "AddLogger", "(", "logger", "Logger", ")", "error", "{", "if", "b", ".", "IsInitialized", "(", ")", "&&", "!", "logger", ".", "IsInitialized", "(", ")", "{", "err", ":=", "logger", ".", "InitLogger", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "if", "!", "b", ".", "IsInitialized", "(", ")", "&&", "logger", ".", "IsInitialized", "(", ")", "{", "err", ":=", "logger", ".", "ShutdownLogger", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "b", ".", "loggers", "=", "append", "(", "b", ".", "loggers", ",", "logger", ")", "\n\n", "if", "hook", ",", "<mask>", ":=", "logger", ".", "(", "HookPreQueue", ")", ";", "ok", "{", "b", ".", "hookPreQueue", "=", "append", "(", "b", ".", "hookPreQueue", ",", "hook", ")", "\n", "}", "\n\n", "logger", ".", "SetBase", "(", "b", ")", "\n", "return", "nil", "\n", "}" ]
6,286
all-6287
[ "addMypType", "adds", "an", "accessor", "for", "a", "map", "type", "for", "a", "given", "receiver", "and", "field" ]
[ "func", "(", "t", "*", "templateData", ")", "addMapType", "(", "x", "*", "ast", ".", "MapType", ",", "receiverType", ",", "fieldName", "string", ")", "{", "// TODO: should we make this dynamic? Could handle more cases than string only", "var", "keyType", "string", "\n", "switch", "key", ":=", "x", ".", "Key", ".", "(", "type", ")", "{", "case", "*", "ast", ".", "Ident", ":", "keyType", "=", "key", ".", "String", "(", ")", "\n", "default", ":", "logf", "(", "\"", "\"", ",", "receiverType", ",", "fieldName", ",", "key", ",", "key", ")", "\n", "return", "\n", "}", "\n\n", "var", "valueType", "string", "\n", "switch", "value", ":=", "x", ".", "Value", ".", "(", "type", ")", "{", "<mask>", "*", "ast", ".", "Ident", ":", "valueType", "=", "value", ".", "String", "(", ")", "\n", "default", ":", "logf", "(", "\"", "\"", ",", "receiverType", ",", "fieldName", ",", "value", ",", "value", ")", "\n", "return", "\n", "}", "\n\n", "fieldType", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "keyType", ",", "valueType", ")", "\n", "zeroValue", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "keyType", ",", "valueType", ")", "\n", "t", ".", "Accessors", "=", "append", "(", "t", ".", "Accessors", ",", "newAccessor", "(", "receiverType", ",", "fieldName", ",", "fieldType", ",", "zeroValue", ")", ")", "\n", "}" ]
6,287
all-6288
[ "NewLogger", "creates", "a", "new", "logger", ".", "name", "is", "a", "non", "-", "empty", "string", "that", "appears", "in", "the", "names", "of", "log", "files", "to", "distinguish", "between", "separate", "instances", "of", "the", "logger", "writing", "to", "the", "same", "directory", ".", "skip", "is", "the", "number", "of", "stack", "frames", "to", "skip", "in", "order", "to", "reach", "the", "call", "point", "to", "be", "logged", ".", "0", "will", "log", "the", "caller", "of", "the", "logging", "methods", "1", "their", "caller", "etc", "." ]
[ "func", "NewLogger", "(", "name", "string", ",", "skip", "int", ")", "*", "Log", "{", "logging", ":=", "&", "Log", "{", "stats", ":", "new", "(", "Stats", ")", "}", "\n", "logging", ".", "setVState", "(", "0", ",", "nil", ",", "nil", ",", "false", ")", "\n", "logging", ".", "skip", "=", "2", "+", "<mask>", "\n", "logging", ".", "maxStackBufSize", "=", "4096", "*", "1024", "\n", "logging", ".", "name", "=", "name", "\n\n", "// Default stderrThreshold is ERROR.", "logging", ".", "stderrThreshold", "=", "ErrorLog", "\n", "logging", ".", "setVState", "(", "0", ",", "nil", ",", "nil", ",", "false", ")", "\n\n", "logging", ".", "severityStats", "[", "InfoLog", "]", "=", "&", "logging", ".", "stats", ".", "Info", "\n", "logging", ".", "severityStats", "[", "WarningLog", "]", "=", "&", "logging", ".", "stats", ".", "Warning", "\n", "logging", ".", "severityStats", "[", "ErrorLog", "]", "=", "&", "logging", ".", "stats", ".", "Error", "\n\n", "logging", ".", "logDirs", "=", "append", "(", "logging", ".", "logDirs", ",", "os", ".", "TempDir", "(", ")", ")", "\n", "go", "logging", ".", "flushDaemon", "(", ")", "\n", "return", "logging", "\n", "}" ]
6,288
all-6289
[ "Accounts", "lists", "the", "acounts", "of", "a", "domain" ]
[ "func", "(", "dom", "*", "Domain", ")", "Accounts", "(", ")", "(", "[", "]", "*", "Account", ",", "error", ")", "{", "var", "al", "accountList", "\n", "err", ":=", "dom", ".", "cgp", ".", "<mask>", "(", "listAccounts", "{", "Domain", ":", "dom", ".", "Name", "}", ",", "&", "al", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "]", "*", "Account", "{", "}", ",", "err", "\n", "}", "\n", "keys", ":=", "al", ".", "SubKeys", "\n", "as", ":=", "make", "(", "[", "]", "*", "Account", ",", "len", "(", "keys", ")", ")", "\n", "for", "i", ",", "k", ":=", "range", "keys", "{", "as", "[", "i", "]", "=", "dom", ".", "Account", "(", "k", ".", "Name", ")", "\n", "}", "\n", "return", "as", ",", "nil", "\n", "}" ]
6,289
all-6290
[ "arg3Reader", "returns", "an", "ArgReader", "to", "read", "arg3", "." ]
[ "func", "(", "r", "*", "reqResReader", ")", "arg3Reader", "(", ")", "(", "ArgReader", ",", "error", ")", "{", "return", "r", ".", "argReader", "(", "<mask>", "/* last */", ",", "reqResReaderPreArg3", ",", "reqResReaderComplete", ")", "\n", "}" ]
6,290
all-6291
[ "TopN", "creates", "a", "TopN", "query", "with", "the", "given", "item", "count", ".", "Returns", "the", "id", "and", "count", "of", "the", "top", "n", "rows", "(", "by", "count", "of", "columns", ")", "in", "the", "field", "." ]
[ "func", "(", "f", "*", "Field", ")", "TopN", "(", "n", "uint64", ")", "*", "PQLRowQuery", "{", "q", ":=", "NewPQLRowQuery", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f", ".", "name", ",", "n", ")", ",", "f", ".", "<mask>", ",", "nil", ")", "\n", "return", "q", "\n", "}" ]
6,291
all-6292
[ "isBtrfsSubVolume", "returns", "true", "if", "the", "given", "Path", "is", "a", "btrfs", "subvolume", "else", "false", "." ]
[ "func", "isBtrfsSubVolume", "(", "subvolPath", "string", ")", "bool", "{", "fs", ":=", "syscall", ".", "Stat_t", "{", "}", "\n", "err", ":=", "syscall", ".", "Lstat", "(", "subvolPath", ",", "&", "fs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n\n", "// Check if BTRFS_FIRST_FREE_OBJECTID", "if", "fs", ".", "Ino", "!=", "256", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
6,292
all-6293
[ "GetURL", "returns", "a", "socket", "address", "to", "connect", "to", "Docker", "engine", "of", "the", "machine", "instance", "." ]
[ "func", "(", "d", "*", "Driver", ")", "GetURL", "(", ")", "(", "string", ",", "error", ")", "{", "if", "err", ":=", "drivers", ".", "MustBeRunning", "(", "d", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "// NOTE (ahmetalpbalkan) I noticed that this is not used until machine is", "// actually created and provisioned. By then GetIP() should be returning", "// a non-empty IP address as the VM is already allocated and connected to.", "ip", ",", "err", ":=", "d", ".", "GetIP", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "u", ":=", "(", "&", "<mask>", ".", "URL", "{", "Scheme", ":", "\"", "\"", ",", "Host", ":", "net", ".", "JoinHostPort", "(", "ip", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "d", ".", "DockerPort", ")", ")", ",", "}", ")", ".", "String", "(", ")", "\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "u", ")", "\n", "return", "u", ",", "nil", "\n", "}" ]
6,293
all-6294
[ "AgentAfterChannelCreate", "registers", "client", "and", "creates", "pre", "service", "create", "job", "." ]
[ "func", "(", "w", "*", "Worker", ")", "AgentAfterChannelCreate", "(", "job", "*", "data", ".", "Job", ")", "error", "{", "if", "w", ".", "isJobInvalid", "(", "job", ",", "data", ".", "JobAgentAfterChannelCreate", ",", "data", ".", "JobChannel", ")", "{", "return", "ErrInvalidJob", "\n", "}", "\n\n", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "job", ")", "\n\n", "ethLog", ",", "err", ":=", "w", ".", "ethLog", "(", "logger", ",", "job", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "ethLogTx", ",", "err", ":=", "w", ".", "ethLogTx", "(", "logger", ",", "ethLog", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "client", ",", "newUser", ",", "err", ":=", "w", ".", "newUser", "(", "logger", ",", "ethLogTx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "client", ")", "\n\n", "tx", ",", "err", ":=", "w", ".", "db", ".", "Begin", "(", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "<mask>", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n", "defer", "tx", ".", "Rollback", "(", ")", "\n\n", "if", "newUser", "{", "if", "err", ":=", "tx", ".", "Insert", "(", "client", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n", "}", "\n\n", "logChannelCreated", ",", "err", ":=", "extractLogChannelCreated", "(", "logger", ",", "ethLog", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "offering", ",", "err", ":=", "w", ".", "offeringByHash", "(", "logger", ",", "logChannelCreated", ".", "offeringHash", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "offering", ".", "CurrentSupply", "--", "\n", "if", "err", ":=", "tx", ".", "Update", "(", "offering", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n\n", "channel", ":=", "&", "data", ".", "Channel", "{", "ID", ":", "job", ".", "RelatedID", ",", "Client", ":", "data", ".", "HexFromBytes", "(", "logChannelCreated", ".", "clientAddr", ".", "Bytes", "(", ")", ")", ",", "Agent", ":", "data", ".", "HexFromBytes", "(", "logChannelCreated", ".", "agentAddr", ".", "Bytes", "(", ")", ")", ",", "TotalDeposit", ":", "logChannelCreated", ".", "deposit", ".", "Uint64", "(", ")", ",", "ChannelStatus", ":", "data", ".", "ChannelActive", ",", "ServiceStatus", ":", "data", ".", "ServicePending", ",", "Offering", ":", "offering", ".", "ID", ",", "Block", ":", "uint32", "(", "ethLog", ".", "Block", ")", ",", "}", "\n\n", "if", "err", ":=", "tx", ".", "Insert", "(", "channel", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n\n", "if", "err", ":=", "w", ".", "addJob", "(", "logger", ",", "tx", ",", "data", ".", "JobAgentPreEndpointMsgCreate", ",", "data", ".", "JobChannel", ",", "channel", ".", "ID", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "tx", ".", "Commit", "(", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "\"", "\"", "+", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
6,294
all-6295
[ "Check", "check", "the", "status", "of", "registered", "checkers", "matching", "names", "and", "return", "a", "list", "of", "results", "." ]
[ "func", "Check", "(", "names", "...", "string", ")", "[", "]", "Result", "{", "results", ":=", "make", "(", "[", "]", "Result", ",", "0", ",", "len", "(", "checkers", ")", ")", "\n", "nameSet", ":=", "set", ".", "FromSlice", "(", "names", ")", "\n", "isAll", ":=", "nameSet", ".", "Includes", "(", "\"", "\"", ")", "\n", "for", "_", ",", "checker", ":=", "range", "checkers", "{", "if", "!", "isAll", "&&", "!", "nameSet", ".", "Includes", "(", "checker", ".", "name", ")", "{", "continue", "\n", "}", "\n", "startTime", ":=", "time", ".", "Now", "(", ")", "\n", "if", "err", ":=", "checker", ".", "check", "(", ")", ";", "err", "!=", "nil", "&&", "err", "!=", "ErrDisabledComponent", "{", "results", "=", "append", "(", "results", ",", "Result", "{", "Name", ":", "checker", ".", "name", ",", "Status", ":", "\"", "\"", "+", "err", ".", "Error", "(", ")", ",", "Duration", ":", "time", ".", "Since", "(", "startTime", ")", ",", "}", ")", "\n", "}", "else", "if", "err", "==", "nil", "{", "<mask>", "=", "append", "(", "results", ",", "Result", "{", "Name", ":", "checker", ".", "name", ",", "Status", ":", "HealthCheckOK", ",", "Duration", ":", "time", ".", "Since", "(", "startTime", ")", ",", "}", ")", "\n", "}", "\n", "}", "\n", "return", "results", "\n", "}" ]
6,295
all-6296
[ "Get", "returns", "the", "mimetype", "or", "an", "empty", "string", "if", "no", "mimetype", "or", "mimetype", "source", "is", "found" ]
[ "func", "(", "mr", "*", "Reader", ")", "Get", "(", "ext", "string", ")", "string", "{", "<mask>", "err", "error", "\n", "// No extension", "if", "len", "(", "ext", ")", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "// Strip the leading dot", "if", "ext", "[", "0", "]", "==", "'.'", "{", "ext", "=", "ext", "[", "1", ":", "]", "\n", "}", "\n", "mr", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "mr", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "mr", ".", "mimetypes", "==", "nil", "{", "mr", ".", "mimetypes", ",", "err", "=", "readMimetypes", "(", "mr", ".", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "// Using the fallback hash map", "if", "mime", ",", "ok", ":=", "fallback", "[", "ext", "]", ";", "ok", "{", "return", "mime", "\n", "}", "\n", "// Unable to find the mime type for the given extension", "return", "\"", "\"", "\n", "}", "\n", "}", "\n", "// Use the value from the hash map", "if", "mime", ",", "ok", ":=", "mr", ".", "mimetypes", "[", "ext", "]", ";", "ok", "{", "return", "mime", "\n", "}", "\n", "// Using the fallback hash map", "if", "mime", ",", "ok", ":=", "fallback", "[", "ext", "]", ";", "ok", "{", "return", "mime", "\n", "}", "\n", "// Unable to find the mime type for the given extension", "return", "\"", "\"", "\n", "}" ]
6,296
all-6297
[ "SetConfigFromFlags", "assigns", "and", "verifies", "the", "command", "-", "line", "arguments", "presented", "to", "the", "driver", "." ]
[ "func", "(", "d", "*", "Driver", ")", "SetConfigFromFlags", "(", "<mask>", "drivers", ".", "DriverOptions", ")", "error", "{", "d", ".", "ActiveTimeout", "=", "flags", ".", "Int", "(", "\"", "\"", ")", "\n", "d", ".", "Username", "=", "flags", ".", "String", "(", "\"", "\"", ")", "\n", "d", ".", "APIKey", "=", "flags", ".", "String", "(", "\"", "\"", ")", "\n", "d", ".", "Region", "=", "flags", ".", "String", "(", "\"", "\"", ")", "\n", "d", ".", "EndpointType", "=", "flags", ".", "String", "(", "\"", "\"", ")", "\n", "d", ".", "ImageId", "=", "flags", ".", "String", "(", "\"", "\"", ")", "\n", "d", ".", "FlavorId", "=", "flags", ".", "String", "(", "\"", "\"", ")", "\n", "d", ".", "SSHUser", "=", "flags", ".", "String", "(", "\"", "\"", ")", "\n", "d", ".", "SSHPort", "=", "flags", ".", "Int", "(", "\"", "\"", ")", "\n", "d", ".", "SetSwarmConfigFromFlags", "(", "flags", ")", "\n\n", "if", "d", ".", "Region", "==", "\"", "\"", "{", "return", "missingEnvOrOption", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "d", ".", "Username", "==", "\"", "\"", "{", "return", "missingEnvOrOption", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "d", ".", "APIKey", "==", "\"", "\"", "{", "return", "missingEnvOrOption", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "d", ".", "ImageId", "==", "\"", "\"", "{", "// Default to the Ubuntu 16.04 image.", "// This is done here, rather than in the option registration, to keep the default value", "// from making \"machine create --help\" ugly.", "d", ".", "ImageId", "=", "\"", "\"", "\n", "}", "\n\n", "if", "d", ".", "EndpointType", "!=", "\"", "\"", "&&", "d", ".", "EndpointType", "!=", "\"", "\"", "&&", "d", ".", "EndpointType", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "d", ".", "EndpointType", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
6,297
all-6298
[ "WithURL", "if", "specified", "deletes", "all", "the", "cookies", "with", "the", "given", "name", "where", "domain", "and", "path", "match", "provided", "URL", "." ]
[ "func", "(", "p", "DeleteCookiesParams", ")", "WithURL", "(", "<mask>", "string", ")", "*", "DeleteCookiesParams", "{", "p", ".", "URL", "=", "url", "\n", "return", "&", "p", "\n", "}" ]
6,298
all-6299
[ "newLoggingPipe", "initializes", "a", "loggingPipe" ]
[ "func", "newLoggingPipe", "(", ")", "*", "loggingPipe", "{", "p", ":=", "&", "loggingPipe", "{", "}", "\n", "p", ".", "clientReader", ",", "p", ".", "clientWriter", "=", "io", ".", "Pipe", "(", ")", "\n", "p", ".", "clientReader", "=", "io", ".", "TeeReader", "(", "p", ".", "clientReader", ",", "&", "p", ".", "ServerToClientBuf", ")", "\n", "p", ".", "serverReader", ",", "p", ".", "serverWriter", "=", "io", ".", "Pipe", "(", ")", "\n", "p", ".", "serverReader", "=", "<mask>", ".", "TeeReader", "(", "p", ".", "serverReader", ",", "&", "p", ".", "ClientToServerBuf", ")", "\n", "return", "p", "\n", "}" ]
6,299
all-6300
[ "Set", "username", "real", "name", "and", "mode" ]
[ "func", "(", "bot", "*", "Bot", ")", "sendUserCommand", "(", "user", ",", "realname", ",", "mode", "string", ")", "{", "<mask>", ".", "Send", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "user", ",", "mode", ",", "realname", ")", ")", "\n", "}" ]