id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
23,000
all-23001
[ "DeleteObject", "removes", "the", "row", "identified", "by", "the", "given", "ID", ".", "The", "given", "table", "must", "have", "a", "primary", "key", "column", "called", "id", ".", "It", "returns", "a", "flag", "indicating", "if", "a", "matching", "row", "was", "actually", "found", "and", "deleted", "or", "not", "." ]
[ "func", "DeleteObject", "(", "<mask>", "*", "sql", ".", "Tx", ",", "table", "string", ",", "id", "int64", ")", "(", "bool", ",", "error", ")", "{", "stmt", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "table", ")", "\n", "result", ",", "err", ":=", "tx", ".", "Exec", "(", "stmt", ",", "id", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "n", ",", "err", ":=", "result", ".", "RowsAffected", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "if", "n", ">", "1", "{", "return", "true", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "n", "==", "1", ",", "nil", "\n", "}" ]
23,001
all-23002
[ "/", "*", "Debugf", "uses", "msg", "as", "a", "format", "string", "with", "subsequent", "parameters", "as", "values", "and", "logs", "the", "resulting", "message", "to", "all", "added", "loggers", "at", "LogLevel", ".", "LevelDebug" ]
[ "func", "(", "b", "*", "Base", ")", "Debugf", "(", "msg", "string", ",", "a", "...", "interface", "{", "}", ")", "error", "{", "return", "b", ".", "Log", "(", "LevelDebug", ",", "nil", ",", "<mask>", ",", "a", "...", ")", "\n", "}" ]
23,002
all-23003
[ "LeastCommonBitPosition", "returns", "the", "smallest", "position", "of", "the", "preceding", "common", "bits", "of", "the", "2", "network", "numbers", "and", "returns", "an", "error", "ErrNoGreatestCommonBit", "if", "the", "two", "network", "number", "diverges", "from", "the", "first", "bit", ".", "e", ".", "g", ".", "if", "the", "network", "number", "diverges", "after", "the", "1st", "bit", "it", "returns", "131", "for", "IPv6", "and", "31", "for", "IPv4", "." ]
[ "func", "(", "n", "NetworkNumber", ")", "LeastCommonBitPosition", "(", "n1", "NetworkNumber", ")", "(", "uint", ",", "error", ")", "{", "if", "len", "(", "n", ")", "!=", "len", "(", "n1", ")", "{", "return", "0", ",", "ErrVersionMismatch", "\n", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "n", ")", ";", "i", "++", "{", "mask", ":=", "uint32", "(", "1", ")", "<<", "31", "\n", "pos", ":=", "uint", "(", "31", ")", "\n", "for", ";", "mask", ">", "0", ";", "mask", ">>=", "1", "{", "if", "n", "[", "i", "]", "&", "mask", "!=", "n1", "[", "i", "]", "&", "mask", "{", "if", "i", "==", "0", "&&", "pos", "==", "31", "{", "return", "0", ",", "ErrNoGreatestCommonBit", "\n", "}", "\n", "return", "(", "pos", "+", "1", ")", "+", "uint", "(", "BitsPerUint32", ")", "*", "uint", "(", "len", "(", "n", ")", "-", "i", "-", "1", ")", ",", "nil", "\n", "}", "\n", "<mask>", "--", "\n", "}", "\n", "}", "\n", "return", "0", ",", "nil", "\n", "}" ]
23,003
all-23004
[ "T61String", "parseT61String", "parses", "a", "ASN", ".", "1", "T61String", "(", "8", "-", "bit", "clean", "string", ")", "from", "the", "given", "byte", "slice", "and", "returns", "it", "." ]
[ "func", "parseT61String", "(", "bytes", "[", "]", "byte", ")", "(", "ret", "string", ",", "err", "error", ")", "{", "return", "string", "(", "<mask>", ")", ",", "nil", "\n", "}" ]
23,004
all-23005
[ "GetDowntimes", "returns", "a", "slice", "of", "all", "downtimes", "." ]
[ "func", "(", "client", "*", "Client", ")", "GetDowntimes", "(", ")", "(", "[", "]", "Downtime", ",", "error", ")", "{", "var", "out", "reqDowntimes", "\n", "if", "err", ":=", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "&", "out", ".", "Downtimes", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "<mask>", ".", "Downtimes", ",", "nil", "\n", "}" ]
23,005
all-23006
[ "Initialize", "AppArmor", "-", "specific", "attributes", "." ]
[ "func", "(", "s", "*", "OS", ")", "initAppArmor", "(", ")", "{", "/* Detect AppArmor availability */", "_", ",", "err", ":=", "exec", ".", "LookPath", "(", "\"", "\"", ")", "\n", "if", "os", ".", "Getenv", "(", "\"", "\"", ")", "==", "\"", "\"", "{", "logger", ".", "Warnf", "(", "\"", "\"", ")", "\n", "}", "else", "if", "!", "shared", ".", "IsDir", "(", "\"", "\"", ")", "{", "logger", ".", "Warnf", "(", "\"", "\"", ")", "\n", "}", "else", "if", "err", "!=", "nil", "{", "logger", ".", "Warnf", "(", "\"", "\"", ")", "\n", "}", "else", "{", "s", ".", "AppArmorAvailable", "=", "true", "\n", "}", "\n\n", "/* Detect AppArmor stacking support */", "s", ".", "AppArmorStacking", "=", "appArmorCanStack", "(", ")", "\n\n", "/* Detect existing AppArmor stack */", "if", "<mask>", ".", "PathExists", "(", "\"", "\"", ")", "{", "contentBytes", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "\"", "\"", ")", "\n", "if", "err", "==", "nil", "&&", "string", "(", "contentBytes", ")", "==", "\"", "\\n", "\"", "{", "s", ".", "AppArmorStacked", "=", "true", "\n", "}", "\n", "}", "\n\n", "/* Detect AppArmor admin support */", "if", "!", "haveMacAdmin", "(", ")", "{", "if", "s", ".", "AppArmorAvailable", "{", "logger", ".", "Warnf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "else", "if", "s", ".", "RunningInUserNS", "&&", "!", "s", ".", "AppArmorStacked", "{", "if", "s", ".", "AppArmorAvailable", "{", "logger", ".", "Warnf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "else", "{", "s", ".", "AppArmorAdmin", "=", "true", "\n", "}", "\n\n", "/* Detect AppArmor confinment */", "profile", ":=", "util", ".", "AppArmorProfile", "(", ")", "\n", "if", "profile", "!=", "\"", "\"", "&&", "profile", "!=", "\"", "\"", "{", "if", "s", ".", "AppArmorAvailable", "{", "logger", ".", "Warnf", "(", "\"", "\"", ")", "\n", "}", "\n", "s", ".", "AppArmorConfined", "=", "true", "\n", "}", "\n", "}" ]
23,006
all-23007
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkApplicationWindow", "." ]
[ "func", "(", "v", "*", "ApplicationWindow", ")", "native", "(", ")", "*", "C", ".", "GtkApplicationWindow", "{", "if", "v", "==", "nil", "||", "v", ".", "Window", ".", "GObject", "==", "nil", "{", "// v.Window is necessary because v.GObject would be ambiguous", "<mask>", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "Window", ".", "GObject", ")", "\n", "return", "C", ".", "toGtkApplicationWindow", "(", "p", ")", "\n", "}" ]
23,007
all-23008
[ "WriteZeroes", "writes", "cnt", "zero", "byte", "values", "." ]
[ "func", "(", "w", "*", "<mask>", ")", "WriteZeroes", "(", "cnt", "int", ")", "{", "if", "w", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "// zero out scratch area", "l", ":=", "cnt", "\n", "if", "l", ">", "len", "(", "w", ".", "b", ")", "{", "l", "=", "len", "(", "w", ".", "b", ")", "\n", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "l", ";", "i", "++", "{", "w", ".", "b", "[", "i", "]", "=", "0", "\n", "}", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "cnt", ";", "{", "j", ":=", "cnt", "-", "i", "\n", "if", "j", ">", "len", "(", "w", ".", "b", ")", "{", "j", "=", "len", "(", "w", ".", "b", ")", "\n", "}", "\n", "n", ",", "_", ":=", "w", ".", "wr", ".", "Write", "(", "w", ".", "b", "[", ":", "j", "]", ")", "\n", "if", "n", "!=", "j", "{", "return", "\n", "}", "\n", "i", "+=", "n", "\n", "}", "\n", "}" ]
23,008
all-23009
[ "AddSaveable", "indicates", "an", "expected", "call", "of", "AddSaveable" ]
[ "func", "(", "mr", "*", "MockSaveableOptionMockRecorder", ")", "AddSaveable", "(", "arg0", ",", "arg1", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockSaveableOption", ")", "(", "nil", ")", ".", "AddSaveable", ")", ",", "arg0", ",", "arg1", ")", "\n", "}" ]
23,009
all-23010
[ "CalcLengths", "returns", "the", "maximum", "length", "of", "the", "source", "lines", "and", "package", "names", "." ]
[ "func", "CalcLengths", "(", "buckets", "[", "]", "*", "stack", ".", "Bucket", ",", "fullPath", "bool", ")", "(", "int", ",", "int", ")", "{", "srcLen", ":=", "0", "\n", "pkgLen", ":=", "0", "\n", "for", "_", ",", "bucket", ":=", "<mask>", "buckets", "{", "for", "_", ",", "line", ":=", "range", "bucket", ".", "Signature", ".", "Stack", ".", "Calls", "{", "l", ":=", "0", "\n", "if", "fullPath", "{", "l", "=", "len", "(", "line", ".", "FullSrcLine", "(", ")", ")", "\n", "}", "else", "{", "l", "=", "len", "(", "line", ".", "SrcLine", "(", ")", ")", "\n", "}", "\n", "if", "l", ">", "srcLen", "{", "srcLen", "=", "l", "\n", "}", "\n", "l", "=", "len", "(", "line", ".", "Func", ".", "PkgName", "(", ")", ")", "\n", "if", "l", ">", "pkgLen", "{", "pkgLen", "=", "l", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "srcLen", ",", "pkgLen", "\n", "}" ]
23,010
all-23011
[ "fileSource", "returns", "a", "source", "ID", "for", "the", "i", "-", "th", "target", "group", "in", "the", "file", "." ]
[ "func", "fileSource", "(", "filename", "string", ",", "i", "int", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ",", "i", ")", "\n", "}" ]
23,011
all-23012
[ "driverPath", "finds", "the", "path", "of", "a", "driver", "binary", "by", "its", "name", ".", "+", "If", "the", "driver", "is", "a", "core", "driver", "there", "is", "no", "separate", "driver", "binary", ".", "We", "reuse", "current", "binary", "if", "it", "s", "docker", "-", "machine", "or", "we", "assume", "docker", "-", "machine", "is", "in", "the", "PATH", ".", "+", "If", "the", "driver", "is", "NOT", "a", "core", "driver", "then", "the", "separate", "binary", "must", "be", "in", "the", "PATH", "and", "it", "s", "name", "must", "be", "docker", "-", "machine", "-", "driver", "-", "driverName" ]
[ "func", "driverPath", "(", "driverName", "string", ")", "string", "{", "for", "_", ",", "coreDriver", ":=", "<mask>", "CoreDrivers", "{", "if", "coreDriver", "==", "driverName", "{", "if", "CurrentBinaryIsDockerMachine", "{", "return", "os", ".", "Args", "[", "0", "]", "\n", "}", "\n\n", "return", "\"", "\"", "\n", "}", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "driverName", ")", "\n", "}" ]
23,012
all-23013
[ "Notification", "is", "the", "builder" ]
[ "func", "Notification", "(", "title", ",", "<mask>", "string", ")", "GNotifier", "{", "config", ":=", "&", "Config", "{", "title", ",", "message", ",", "5000", ",", "\"", "\"", "}", "\n", "n", ":=", "&", "notifier", "{", "Config", ":", "config", "}", "\n", "return", "n", "\n", "}" ]
23,013
all-23014
[ "Session", "will", "be", "used", "to", "set", "the", "current", "language", "." ]
[ "func", "Session", "(", "s", "handler", ".", "<mask>", ")", "Option", "{", "return", "Option", "{", "func", "(", "o", "*", "options", ")", "{", "o", ".", "session", "=", "s", "\n", "}", "}", "\n", "}" ]
23,014
all-23015
[ "Stop", "stops", "RunLoop", "()", ".", "It", "must", "be", "called", "after", "RunLoop", "()", ".", "If", "not", "it", "causes", "panic", "." ]
[ "func", "(", "p", "*", "Pinger", ")", "Stop", "(", ")", "{", "p", ".", "debugln", "(", "\"", "\"", ")", "\n", "<mask>", "(", "p", ".", "ctx", ".", "stop", ")", "\n", "p", ".", "debugln", "(", "\"", "\"", ")", "\n", "<-", "p", ".", "ctx", ".", "done", "\n", "}" ]
23,015
all-23016
[ "Replace", "a", "piece", "of", "middleware", "with", "another", "piece", "of", "middleware", ".", "Great", "for", "testing", "." ]
[ "func", "(", "ms", "*", "MiddlewareStack", ")", "Replace", "(", "mw1", "MiddlewareFunc", ",", "mw2", "MiddlewareFunc", ")", "{", "m1k", ":=", "funcKey", "(", "mw1", ")", "\n", "stack", ":=", "[", "]", "MiddlewareFunc", "{", "}", "\n", "for", "_", ",", "mw", ":=", "range", "ms", ".", "stack", "{", "if", "funcKey", "(", "mw", ")", "==", "m1k", "{", "<mask>", "=", "append", "(", "stack", ",", "mw2", ")", "\n", "}", "else", "{", "stack", "=", "append", "(", "stack", ",", "mw", ")", "\n", "}", "\n", "}", "\n", "ms", ".", "stack", "=", "stack", "\n", "}" ]
23,016
all-23017
[ "FilterNew", "is", "a", "wrapper", "around", "gtk_tree_model_filter_new", "()", "." ]
[ "func", "(", "v", "*", "TreeModel", ")", "FilterNew", "(", "<mask>", "*", "TreePath", ")", "(", "*", "TreeModelFilter", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_tree_model_filter_new", "(", "v", ".", "native", "(", ")", ",", "root", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapTreeModelFilter", "(", "obj", ")", ",", "nil", "\n", "}" ]
23,017
all-23018
[ "DiscoverEndpoints", "will", "make", "HTTPS", "requests", "to", "find", "the", "ac", "-", "discovery", "meta", "tags", "and", "optionally", "will", "use", "HTTP", "if", "insecure", "is", "set", ".", "It", "will", "not", "give", "up", "until", "it", "has", "exhausted", "the", "path", "or", "found", "an", "image", "discovery", "." ]
[ "func", "DiscoverEndpoints", "(", "app", "App", ",", "insecure", "discovery", ".", "InsecureOption", ")", "(", "out", "*", "Endpoints", ",", "attempts", "[", "]", "FailedAttempt", ",", "err", "error", ")", "{", "out", "=", "&", "Endpoints", "{", "}", "\n", "testFn", ":=", "func", "(", "pre", "string", ",", "eps", "*", "Endpoints", ",", "err", "error", ")", "error", "{", "if", "len", "(", "<mask>", ".", "ACIEndpoints", ")", "!=", "0", "||", "len", "(", "out", ".", "Keys", ")", "!=", "0", "||", "len", "(", "out", ".", "ACIPushEndpoints", ")", "!=", "0", "{", "return", "errEnough", "\n", "}", "\n", "return", "nil", "\n", "}", "\n\n", "err", "=", "DiscoverWalk", "(", "app", ",", "insecure", ",", "walker", "(", "out", ",", "&", "attempts", ",", "testFn", ")", ")", "\n", "if", "err", "!=", "nil", "&&", "err", "!=", "errEnough", "{", "return", "nil", ",", "attempts", ",", "err", "\n", "}", "\n\n", "return", "out", ",", "attempts", ",", "nil", "\n", "}" ]
23,018
all-23019
[ "===", "quantile_over_time", "(", "Matrix", "ValueTypeMatrix", ")", "Vector", "===" ]
[ "func", "funcQuantileOverTime", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "q", ":=", "vals", "[", "0", "]", ".", "(", "Vector", ")", "[", "0", "]", ".", "V", "\n", "mat", ":=", "vals", "[", "1", "]", ".", "(", "Matrix", ")", "\n\n", "for", "_", ",", "el", ":=", "range", "mat", "{", "if", "len", "(", "el", ".", "Points", ")", "==", "0", "{", "continue", "\n", "}", "\n\n", "values", ":=", "make", "(", "vectorByValueHeap", ",", "0", ",", "len", "(", "el", ".", "Points", ")", ")", "\n", "for", "_", ",", "v", ":=", "range", "el", ".", "Points", "{", "values", "=", "append", "(", "values", ",", "Sample", "{", "Point", ":", "Point", "{", "V", ":", "v", ".", "V", "}", "}", ")", "\n", "}", "\n", "enh", ".", "out", "=", "append", "(", "enh", ".", "out", ",", "Sample", "{", "Point", ":", "Point", "{", "V", ":", "quantile", "(", "q", ",", "values", ")", "}", ",", "}", ")", "\n", "}", "\n", "return", "enh", ".", "<mask>", "\n", "}" ]
23,019
all-23020
[ "AppLogCollection", "returns", "the", "logs", "collection", "for", "one", "app", "from", "MongoDB", "." ]
[ "func", "(", "s", "*", "LogStorage", ")", "AppLogCollection", "(", "appName", "string", ")", "*", "storage", ".", "Collection", "{", "if", "appName", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n", "return", "s", ".", "<mask>", "(", "\"", "\"", "+", "appName", ")", "\n", "}" ]
23,020
all-23021
[ "isMatchPattern", "see", "if", "given", "string", "is", "match", "pattern", "." ]
[ "func", "isMatchPattern", "(", "s", "string", ")", "bool", "{", "<mask>", "len", "(", "s", ")", ">", "2", "&&", "s", "[", "0", "]", "==", "'<'", "&&", "s", "[", "len", "(", "s", ")", "-", "1", "]", "==", "'>'", "\n", "}" ]
23,021
all-23022
[ "Do", "executes", "Debugger", ".", "searchInContent", "against", "the", "provided", "context", ".", "returns", ":", "result", "-", "List", "of", "search", "matches", "." ]
[ "func", "(", "p", "*", "SearchInContentParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "result", "[", "]", "*", "SearchMatch", ",", "err", "error", ")", "{", "// execute", "var", "res", "SearchInContentReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSearchInContent", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "<mask>", ",", "nil", "\n", "}" ]
23,022
all-23023
[ "/", "*", "OrderVMByFilter", "orders", "a", "free", "vm", "by", "filters", "cpu", "memory", "private", "vlan", "public", "vlan", "state" ]
[ "func", "(", "a", "*", "Client", ")", "OrderVMByFilter", "(", "params", "*", "OrderVMByFilterParams", ")", "(", "*", "OrderVMByFilterOK", ",", "error", ")", "{", "// TODO: Validate the params before sending", "if", "params", "==", "nil", "{", "params", "=", "NewOrderVMByFilterParams", "(", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "transport", ".", "Submit", "(", "&", "runtime", ".", "ClientOperation", "{", "ID", ":", "\"", "\"", ",", "Method", ":", "\"", "\"", ",", "PathPattern", ":", "\"", "\"", ",", "ProducesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "ConsumesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Schemes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Params", ":", "params", ",", "Reader", ":", "&", "OrderVMByFilterReader", "{", "formats", ":", "a", ".", "formats", "}", ",", "<mask>", ":", "params", ".", "Context", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ".", "(", "*", "OrderVMByFilterOK", ")", ",", "nil", "\n\n", "}" ]
23,023
all-23024
[ "FetchTemplate", "returns", "a", "TemplateSource", "representing", "the", "template", "at", "path", "path", ".", "Paths", "are", "searched", "relative", "to", "the", "urls", "given", "to", "NewHTTPTemplateFetcher", "()" ]
[ "func", "(", "l", "*", "HTTPTemplateFetcher", ")", "FetchTemplate", "(", "<mask>", "string", ")", "(", "TemplateSource", ",", "error", ")", "{", "u", ",", "err", ":=", "url", ".", "Parse", "(", "path", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "if", "u", ".", "IsAbs", "(", ")", "{", "return", "nil", ",", "ErrAbsolutePathNotAllowed", "\n", "}", "\n\n", "// XXX Consider caching!", "for", "_", ",", "base", ":=", "range", "l", ".", "URLs", "{", "u", ":=", "base", "+", "\"", "\"", "+", "path", "\n", "res", ",", "err", ":=", "http", ".", "Get", "(", "u", ")", "\n", "if", "err", "!=", "nil", "{", "continue", "\n", "}", "\n\n", "return", "NewHTTPSource", "(", "res", ")", "\n", "}", "\n", "return", "nil", ",", "ErrTemplateNotFound", "\n", "}" ]
23,024
all-23025
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ReplaySnapshotReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree4", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
23,025
all-23026
[ "overlappingTables", "returns", "the", "tables", "that", "intersect", "with", "key", "range", ".", "Returns", "a", "half", "-", "interval", ".", "This", "function", "should", "already", "have", "acquired", "a", "read", "lock", "and", "this", "is", "so", "important", "the", "caller", "must", "pass", "an", "empty", "parameter", "declaring", "such", "." ]
[ "func", "(", "s", "*", "levelHandler", ")", "overlappingTables", "(", "_", "levelHandlerRLocked", ",", "kr", "keyRange", ")", "(", "int", ",", "int", ")", "{", "if", "len", "(", "kr", ".", "left", ")", "==", "0", "||", "len", "(", "kr", ".", "right", ")", "==", "0", "{", "return", "0", ",", "0", "\n", "}", "\n", "left", ":=", "<mask>", ".", "Search", "(", "len", "(", "s", ".", "tables", ")", ",", "func", "(", "i", "int", ")", "bool", "{", "return", "y", ".", "CompareKeys", "(", "kr", ".", "left", ",", "s", ".", "tables", "[", "i", "]", ".", "Biggest", "(", ")", ")", "<=", "0", "\n", "}", ")", "\n", "right", ":=", "sort", ".", "Search", "(", "len", "(", "s", ".", "tables", ")", ",", "func", "(", "i", "int", ")", "bool", "{", "return", "y", ".", "CompareKeys", "(", "kr", ".", "right", ",", "s", ".", "tables", "[", "i", "]", ".", "Smallest", "(", ")", ")", "<", "0", "\n", "}", ")", "\n", "return", "left", ",", "right", "\n", "}" ]
23,026
all-23027
[ "NewRequest", "is", "like", "http", ".", "NewRequest", "with", "the", "exception", "that", "it", "will", "add", "basic", "auth", "headers", "if", "the", "client", "is", "configured", "for", "basic", "auth", "." ]
[ "func", "(", "s", "*", "Client", ")", "NewRequest", "(", "method", ",", "url", "string", ",", "body", "io", ".", "Reader", ")", "(", "*", "http", ".", "Request", ",", "error", ")", "{", "req", ",", "err", ":=", "http", ".", "NewRequest", "(", "method", ",", "url", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "setAuth", "(", "s", ",", "req", ")", "\n", "return", "req", ",", "nil", "\n", "}" ]
23,027
all-23028
[ "IntRangeZoom", "param", "must", "be", "a", "number", "and", "range", "is", "[", "n", "m", "]", "tip", "is", "zoom", "." ]
[ "func", "(", "c", "*", "Controller", ")", "IntRangeZoom", "(", "fieldName", "string", ",", "p", "interface", "{", "}", ",", "n", "int", ",", "m", "int", ",", "zoom", "int", ")", "int", "{", "if", "p", "==", "nil", "{", "p", "=", "0", "\n", "}", "\n", "value", ",", "ok", ":=", "c", ".", "toNumber", "(", "p", ")", "\n\n", "if", "<mask>", "==", "false", "{", "panic", "(", "(", "&", "ValidationError", "{", "}", ")", ".", "New", "(", "fieldName", "+", "\"", "", "", "", "\n", "}", "\n", "b", ":=", "c", ".", "Validate", ".", "Range", "(", "value", ",", "n", ",", "m", ")", "\n", "if", "b", "==", "false", "{", "fN", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "float64", "(", "n", ")", "/", "float64", "(", "zoom", ")", ")", "\n", "fM", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "float64", "(", "m", ")", "/", "float64", "(", "zoom", ")", ")", "\n", "panic", "(", "(", "&", "ValidationError", "{", "}", ")", ".", "New", "(", "fieldName", "+", "\"", " ", " ", "M)", "", "", "", "", "", "", "", "\n", "}", "\n", "return", "value", "\n", "}" ]
23,028
all-23029
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "UniformMatrix2x3fv", "(", "<mask>", "int32", ",", "count", "int32", ",", "transpose", "bool", ",", "value", "*", "float32", ")", "{", "C", ".", "glowUniformMatrix2x3fv", "(", "gpUniformMatrix2x3fv", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ",", "(", "C", ".", "GLboolean", ")", "(", "boolToInt", "(", "transpose", ")", ")", ",", "(", "*", "C", ".", "GLfloat", ")", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ")", "\n", "}" ]
23,029
all-23030
[ "schemaHostNetworkPolicy", "returns", "schema", "items", "for", "resources", "that", "need", "to", "work", "with", "a", "HostNetworkPolicy", "such", "as", "virtual", "switches", "and", "port", "groups", "." ]
[ "func", "schemaHostNetworkPolicy", "(", ")", "map", "[", "string", "]", "*", "schema", ".", "Schema", "{", "return", "map", "[", "string", "]", "*", "schema", ".", "Schema", "{", "// HostNicTeamingPolicy/HostNicFailureCriteria", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeBool", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "// HostNicTeamingPolicy/HostNicOrderPolicy", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeList", ",", "Description", ":", "\"", "\"", ",", "Elem", ":", "&", "schema", ".", "Schema", "{", "Type", ":", "schema", ".", "TypeString", "}", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeList", ",", "Description", ":", "\"", "\"", ",", "Elem", ":", "&", "schema", ".", "Schema", "{", "Type", ":", "schema", ".", "TypeString", "}", ",", "}", ",", "// HostNicTeamingPolicy", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "StringInSlice", "(", "hostNetworkPolicyNicTeamingPolicyAllowedValues", ",", "false", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeBool", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeBool", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "// HostNetworkSecurityPolicy", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeBool", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeBool", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeBool", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "// HostNetworkTrafficShapingPolicy", "\"", "\"", ":", "{", "<mask>", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeBool", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "}", "\n", "}" ]
23,030
all-23031
[ "CreateAcknowledgement", "creates", "a", "new", "acknowledgement", "." ]
[ "func", "(", "a", "*", "API", ")", "CreateAcknowledgement", "(", "cfg", "*", "Acknowledgement", ")", "(", "*", "Acknowledgement", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "jsonCfg", ",", "err", ":=", "json", ".", "Marshal", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "<mask>", ",", "err", ":=", "a", ".", "Post", "(", "config", ".", "AcknowledgementPrefix", ",", "jsonCfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "jsonCfg", ")", ")", "\n", "}", "\n\n", "acknowledgement", ":=", "&", "Acknowledgement", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "acknowledgement", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "acknowledgement", ",", "nil", "\n", "}" ]
23,031
all-23032
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniform4ui", "(", "program", "uint32", ",", "<mask>", "int32", ",", "v0", "uint32", ",", "v1", "uint32", ",", "v2", "uint32", ",", "v3", "uint32", ")", "{", "C", ".", "glowProgramUniform4ui", "(", "gpProgramUniform4ui", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLuint", ")", "(", "v0", ")", ",", "(", "C", ".", "GLuint", ")", "(", "v1", ")", ",", "(", "C", ".", "GLuint", ")", "(", "v2", ")", ",", "(", "C", ".", "GLuint", ")", "(", "v3", ")", ")", "\n", "}" ]
23,032
all-23033
[ "New", "returns", "a", "new", "Circonus", "API" ]
[ "func", "New", "(", "ac", "*", "Config", ")", "(", "*", "API", ",", "error", ")", "{", "if", "ac", "==", "nil", "{", "return", "nil", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "key", ":=", "TokenKeyType", "(", "ac", ".", "TokenKey", ")", "\n", "if", "key", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "app", ":=", "TokenAppType", "(", "ac", ".", "TokenApp", ")", "\n", "if", "app", "==", "\"", "\"", "{", "app", "=", "defaultAPIApp", "\n", "}", "\n\n", "acctID", ":=", "TokenAccountIDType", "(", "ac", ".", "TokenAccountID", ")", "\n\n", "au", ":=", "string", "(", "ac", ".", "URL", ")", "\n", "if", "au", "==", "\"", "\"", "{", "au", "=", "defaultAPIURL", "\n", "}", "\n", "if", "!", "strings", ".", "Contains", "(", "au", ",", "\"", "\"", ")", "{", "// if just a hostname is passed, ASSume \"https\" and a path prefix of \"/v2\"", "au", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ac", ".", "URL", ")", "\n", "}", "\n", "if", "last", ":=", "len", "(", "au", ")", "-", "1", ";", "last", ">=", "0", "&&", "au", "[", "last", "]", "==", "'/'", "{", "// strip off trailing '/'", "au", "=", "au", "[", ":", "last", "]", "\n", "}", "\n", "apiURL", ",", "err", ":=", "url", ".", "Parse", "(", "au", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "a", ":=", "&", "API", "{", "apiURL", ":", "apiURL", ",", "key", ":", "key", ",", "app", ":", "app", ",", "accountID", ":", "acctID", ",", "caCert", ":", "ac", ".", "CACert", ",", "tlsConfig", ":", "ac", ".", "TLSConfig", ",", "Debug", ":", "ac", ".", "Debug", ",", "Log", ":", "ac", ".", "Log", ",", "useExponentialBackoff", ":", "false", ",", "}", "\n\n", "a", ".", "Debug", "=", "ac", ".", "Debug", "\n", "a", ".", "Log", "=", "ac", ".", "Log", "\n", "if", "a", ".", "Debug", "&&", "a", ".", "Log", "==", "nil", "{", "a", ".", "Log", "=", "log", ".", "New", "(", "os", ".", "Stderr", ",", "\"", "\"", ",", "log", ".", "LstdFlags", ")", "\n", "}", "\n", "if", "a", ".", "Log", "==", "nil", "{", "a", ".", "Log", "=", "log", ".", "New", "(", "ioutil", ".", "Discard", ",", "\"", "\"", ",", "log", ".", "LstdFlags", ")", "\n", "}", "\n\n", "return", "a", ",", "nil", "\n", "}" ]
23,033
all-23034
[ "NewManageDataResult", "creates", "a", "new", "ManageDataResult", "." ]
[ "func", "NewManageDataResult", "(", "code", "ManageDataResultCode", ",", "<mask>", "interface", "{", "}", ")", "(", "result", "ManageDataResult", ",", "err", "error", ")", "{", "result", ".", "Code", "=", "code", "\n", "switch", "ManageDataResultCode", "(", "code", ")", "{", "case", "ManageDataResultCodeManageDataSuccess", ":", "// void", "default", ":", "// void", "}", "\n", "return", "\n", "}" ]
23,034
all-23035
[ "Value", "converts", "a", "value", "to", "a", "database", "driver", "value" ]
[ "func", "(", "u", "ISBN", ")", "Value", "(", ")", "(", "<mask>", ".", "Value", ",", "error", ")", "{", "return", "driver", ".", "Value", "(", "string", "(", "u", ")", ")", ",", "nil", "\n", "}" ]
23,035
all-23036
[ "Sign", "returns", "a", "signature", "from", "input", "data" ]
[ "func", "(", "k", "*", "Secp256k1PrivateKey", ")", "Sign", "(", "data", "[", "]", "<mask>", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "hash", ":=", "sha256", ".", "Sum256", "(", "data", ")", "\n", "sig", ",", "err", ":=", "(", "*", "btcec", ".", "PrivateKey", ")", "(", "k", ")", ".", "Sign", "(", "hash", "[", ":", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "sig", ".", "Serialize", "(", ")", ",", "nil", "\n", "}" ]
23,036
all-23037
[ "Pid", "returns", "the", "process", "ID" ]
[ "func", "(", "p", "<mask>", ")", "Pid", "(", ")", "(", "int", ",", "error", ")", "{", "// math.MinInt32 is returned here, because it's invalid value", "// for the kill() system call.", "if", "p", ".", "ops", "==", "nil", "{", "return", "math", ".", "MinInt32", ",", "newGenericError", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ",", "ProcessNotExecuted", ")", "\n", "}", "\n", "return", "p", ".", "ops", ".", "pid", "(", ")", ",", "nil", "\n", "}" ]
23,037
all-23038
[ "Find", "the", "first", "suffix", "that", "ends", "at", "endPos", "in", "the", "word", "among", "those", "provided", ";", "then", "check", "to", "see", "if", "it", "begins", "after", "startPos", ".", "If", "it", "does", "return", "it", "else", "return", "the", "empty", "string", "and", "empty", "rune", "slice", ".", "This", "may", "seem", "a", "counterintuitive", "manner", "to", "do", "this", ".", "However", "it", "matches", "what", "is", "required", "most", "of", "the", "time", "by", "the", "Snowball", "stemmer", "steps", "." ]
[ "func", "(", "w", "*", "SnowballWord", ")", "FirstSuffixIfIn", "(", "startPos", ",", "endPos", "int", ",", "suffixes", "...", "string", ")", "(", "suffix", "string", ",", "suffixRunes", "[", "]", "rune", ")", "{", "for", "_", ",", "suffix", ":=", "<mask>", "suffixes", "{", "suffixRunes", ":=", "[", "]", "rune", "(", "suffix", ")", "\n", "if", "w", ".", "HasSuffixRunesIn", "(", "0", ",", "endPos", ",", "suffixRunes", ")", "{", "if", "endPos", "-", "len", "(", "suffixRunes", ")", ">=", "startPos", "{", "return", "suffix", ",", "suffixRunes", "\n", "}", "else", "{", "// Empty out suffixRunes", "suffixRunes", "=", "suffixRunes", "[", ":", "0", "]", "\n", "return", "\"", "\"", ",", "suffixRunes", "\n", "}", "\n", "}", "\n", "}", "\n\n", "// Empty out suffixRunes", "suffixRunes", "=", "suffixRunes", "[", ":", "0", "]", "\n", "return", "\"", "\"", ",", "suffixRunes", "\n", "}" ]
23,038
all-23039
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "StyleSheetOrigin", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "StyleSheetOrigin", "(", "in", ".", "String", "(", ")", ")", "{", "<mask>", "StyleSheetOriginInjected", ":", "*", "t", "=", "StyleSheetOriginInjected", "\n", "case", "StyleSheetOriginUserAgent", ":", "*", "t", "=", "StyleSheetOriginUserAgent", "\n", "case", "StyleSheetOriginInspector", ":", "*", "t", "=", "StyleSheetOriginInspector", "\n", "case", "StyleSheetOriginRegular", ":", "*", "t", "=", "StyleSheetOriginRegular", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
23,039
all-23040
[ "StartMetricsSession", "starts", "a", "metric", "session", ".", "It", "initializes", "the", "stats", "engine", "and", "invokes", "StartSession", "." ]
[ "func", "StartMetricsSession", "(", "params", "*", "TelemetrySessionParams", ")", "{", "ok", ",", "err", ":=", "params", ".", "isContainerHealthMetricsDisabled", "(", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n", "if", "<mask>", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "err", "=", "params", ".", "StatsEngine", ".", "MustInit", "(", "params", ".", "Ctx", ",", "params", ".", "TaskEngine", ",", "params", ".", "Cfg", ".", "Cluster", ",", "params", ".", "ContainerInstanceArn", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "err", "=", "StartSession", "(", "params", ",", "params", ".", "StatsEngine", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}" ]
23,040
all-23041
[ "Temp", "makes", "a", "copy", "of", "the", "values", "and", "allows", "operation", "on", "those", "values", "temporarily", "during", "the", "run", "of", "the", "function", ".", "At", "the", "end", "of", "the", "function", "run", "the", "copy", "is", "discarded", "and", "the", "original", "values", "are", "replaced", ".", "This", "is", "useful", "for", "testing", ".", "Warning", ":", "This", "function", "is", "NOT", "safe", "to", "use", "from", "a", "goroutine", "or", "from", "code", "which", "may", "access", "any", "Get", "or", "Set", "function", "from", "a", "goroutine" ]
[ "func", "Temp", "(", "f", "func", "(", ")", ")", "{", "oenv", ":=", "env", "\n", "env", "=", "map", "[", "string", "]", "string", "{", "}", "\n", "for", "k", ",", "v", ":=", "<mask>", "oenv", "{", "env", "[", "k", "]", "=", "v", "\n", "}", "\n", "defer", "func", "(", ")", "{", "env", "=", "oenv", "}", "(", ")", "\n", "f", "(", ")", "\n", "}" ]
23,041
all-23042
[ "Emits", "an", "Event", "from", "the", "EventController", ".", "Takes", "an", "EventBody", "which", "is", "used", "to", "build", "an", "Event", ".", "Returns", "number", "of", "handlers", "that", "received", "the", "event", "and", "error", "if", "an", "error", "was", "raised", "." ]
[ "func", "(", "e", "*", "EventController", ")", "Emit", "(", "b", "EventBody", ")", "(", "int", ",", "error", ")", "{", "// int used to count the number of Handlers fired.", "var", "i", "int", "\n", "// We build an event struct to contain the Body and generate a Header.", "event", ":=", "<mask>", "{", "Header", ":", "generateHeader", "(", ")", ",", "Body", ":", "b", "}", "\n\n", "// Fire a gorountine for each handler.", "// By design the is no waiting for any Handlers to complete", "// before firing another. Therefore there is also no guarantee", "// that any Handler will predictably fire before another one.", "//", "// Any synchronizing needs to be within the Handler.", "for", "_", ",", "h", ":=", "range", "e", ".", "Handlers", "{", "i", "++", "\n", "go", "h", ".", "HandleGomitEvent", "(", "event", ")", "\n", "}", "\n\n", "return", "i", ",", "nil", "\n", "}" ]
23,042
all-23043
[ "decodePeers", "is", "used", "to", "deserialize", "an", "old", "list", "of", "peers", "into", "a", "Configuration", ".", "This", "is", "here", "for", "backwards", "compatibility", "with", "old", "log", "entries", "and", "snapshots", ";", "it", "should", "be", "removed", "eventually", "." ]
[ "func", "decodePeers", "(", "buf", "[", "]", "byte", ",", "trans", "Transport", ")", "Configuration", "{", "// Decode the buffer first.", "var", "encPeers", "[", "]", "[", "]", "byte", "\n", "if", "err", ":=", "decodeMsgPack", "(", "buf", ",", "&", "encPeers", ")", ";", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", ")", "\n", "}", "\n\n", "// Deserialize each peer.", "var", "servers", "[", "]", "Server", "\n", "for", "_", ",", "enc", ":=", "<mask>", "encPeers", "{", "p", ":=", "trans", ".", "DecodePeer", "(", "enc", ")", "\n", "servers", "=", "append", "(", "servers", ",", "Server", "{", "Suffrage", ":", "Voter", ",", "ID", ":", "ServerID", "(", "p", ")", ",", "Address", ":", "ServerAddress", "(", "p", ")", ",", "}", ")", "\n", "}", "\n\n", "return", "Configuration", "{", "Servers", ":", "servers", ",", "}", "\n", "}" ]
23,043
all-23044
[ "OptClientSocketTimeout", "is", "the", "maximum", "idle", "socket", "time", "in", "nanoseconds" ]
[ "func", "OptClientSocketTimeout", "(", "timeout", "<mask>", ".", "Duration", ")", "ClientOption", "{", "return", "func", "(", "options", "*", "ClientOptions", ")", "error", "{", "options", ".", "SocketTimeout", "=", "timeout", "\n", "return", "nil", "\n", "}", "\n", "}" ]
23,044
all-23045
[ "accumulateBatch", "returns", "a", "list", "of", "PRs", "that", "can", "be", "merged", "after", "passing", "batch", "testing", "if", "any", "exist", ".", "It", "also", "returns", "a", "list", "of", "PRs", "currently", "being", "batch", "tested", "." ]
[ "func", "accumulateBatch", "(", "presubmits", "map", "[", "int", "]", "[", "]", "config", ".", "Presubmit", ",", "prs", "[", "]", "PullRequest", ",", "pjs", "[", "]", "prowapi", ".", "ProwJob", ",", "log", "*", "logrus", ".", "Entry", ")", "(", "[", "]", "PullRequest", ",", "[", "]", "PullRequest", ")", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "if", "len", "(", "presubmits", ")", "==", "0", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "nil", "\n", "}", "\n", "prNums", ":=", "make", "(", "map", "[", "int", "]", "PullRequest", ")", "\n", "for", "_", ",", "pr", ":=", "range", "prs", "{", "prNums", "[", "int", "(", "pr", ".", "Number", ")", "]", "=", "pr", "\n", "}", "\n", "type", "accState", "struct", "{", "prs", "[", "]", "PullRequest", "\n", "jobStates", "map", "[", "string", "]", "simpleState", "\n", "// Are the pull requests in the ref still acceptable? That is, do they", "// still point to the heads of the PRs?", "validPulls", "bool", "\n", "}", "\n", "states", ":=", "make", "(", "map", "[", "string", "]", "*", "accState", ")", "\n", "for", "_", ",", "pj", ":=", "range", "pjs", "{", "if", "pj", ".", "Spec", ".", "Type", "!=", "prowapi", ".", "BatchJob", "{", "continue", "\n", "}", "\n", "// First validate the batch job's refs.", "ref", ":=", "pj", ".", "Spec", ".", "Refs", ".", "String", "(", ")", "\n", "if", "_", ",", "ok", ":=", "states", "[", "<mask>", "]", ";", "!", "ok", "{", "state", ":=", "&", "accState", "{", "jobStates", ":", "make", "(", "map", "[", "string", "]", "simpleState", ")", ",", "validPulls", ":", "true", ",", "}", "\n", "for", "_", ",", "pull", ":=", "range", "pj", ".", "Spec", ".", "Refs", ".", "Pulls", "{", "if", "pr", ",", "ok", ":=", "prNums", "[", "pull", ".", "Number", "]", ";", "ok", "&&", "string", "(", "pr", ".", "HeadRefOID", ")", "==", "pull", ".", "SHA", "{", "state", ".", "prs", "=", "append", "(", "state", ".", "prs", ",", "pr", ")", "\n", "}", "else", "if", "!", "ok", "{", "state", ".", "validPulls", "=", "false", "\n", "log", ".", "WithField", "(", "\"", "\"", ",", "ref", ")", ".", "WithFields", "(", "pr", ".", "logFields", "(", ")", ")", ".", "Debug", "(", "\"", "\"", ")", "\n", "break", "\n", "}", "else", "{", "state", ".", "validPulls", "=", "false", "\n", "log", ".", "WithField", "(", "\"", "\"", ",", "ref", ")", ".", "WithFields", "(", "pr", ".", "logFields", "(", ")", ")", ".", "Debug", "(", "\"", "\"", ")", "\n", "break", "\n", "}", "\n", "}", "\n", "states", "[", "ref", "]", "=", "state", "\n", "}", "\n", "if", "!", "states", "[", "ref", "]", ".", "validPulls", "{", "// The batch contains a PR ref that has changed. Skip it.", "continue", "\n", "}", "\n\n", "// Batch job refs are valid. Now accumulate job states by batch ref.", "context", ":=", "pj", ".", "Spec", ".", "Context", "\n", "jobState", ":=", "toSimpleState", "(", "pj", ".", "Status", ".", "State", ")", "\n", "// Store the best result for this ref+context.", "if", "s", ",", "ok", ":=", "states", "[", "ref", "]", ".", "jobStates", "[", "context", "]", ";", "!", "ok", "||", "s", "==", "failureState", "||", "jobState", "==", "successState", "{", "states", "[", "ref", "]", ".", "jobStates", "[", "context", "]", "=", "jobState", "\n", "}", "\n", "}", "\n", "var", "pendingBatch", ",", "successBatch", "[", "]", "PullRequest", "\n", "for", "ref", ",", "state", ":=", "range", "states", "{", "if", "!", "state", ".", "validPulls", "{", "continue", "\n", "}", "\n", "requiredPresubmits", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "_", ",", "pr", ":=", "range", "state", ".", "prs", "{", "for", "_", ",", "job", ":=", "range", "presubmits", "[", "int", "(", "pr", ".", "Number", ")", "]", "{", "requiredPresubmits", ".", "Insert", "(", "job", ".", "Context", ")", "\n", "}", "\n", "}", "\n", "overallState", ":=", "successState", "\n", "for", "_", ",", "p", ":=", "range", "requiredPresubmits", ".", "List", "(", ")", "{", "if", "s", ",", "ok", ":=", "state", ".", "jobStates", "[", "p", "]", ";", "!", "ok", "||", "s", "==", "failureState", "{", "overallState", "=", "failureState", "\n", "log", ".", "WithField", "(", "\"", "\"", ",", "ref", ")", ".", "Debugf", "(", "\"", "\"", ",", "p", ")", "\n", "break", "\n", "}", "else", "if", "s", "==", "pendingState", "&&", "overallState", "==", "successState", "{", "overallState", "=", "pendingState", "\n", "}", "\n", "}", "\n", "switch", "overallState", "{", "// Currently we only consider 1 pending batch and 1 success batch at a time.", "// If more are somehow present they will be ignored.", "case", "pendingState", ":", "pendingBatch", "=", "state", ".", "prs", "\n", "case", "successState", ":", "successBatch", "=", "state", ".", "prs", "\n", "}", "\n", "}", "\n", "return", "successBatch", ",", "pendingBatch", "\n", "}" ]
23,045
all-23046
[ "Next", "returns", "the", "next", "page", "of", "resources", ".", "We", "may", "need", "to", "fetch", "multiple", "pages", "from", "the", "Twilio", "API", "before", "we", "find", "one", "in", "the", "right", "date", "range", "so", "latency", "may", "be", "higher", "than", "usual", ".", "If", "page", "is", "non", "-", "nil", "it", "contains", "at", "least", "one", "result", "." ]
[ "func", "(", "a", "*", "alertDateIterator", ")", "Next", "(", "ctx", "context", ".", "<mask>", ")", "(", "*", "AlertPage", ",", "error", ")", "{", "var", "page", "*", "AlertPage", "\n", "for", "{", "// just wipe it clean every time to avoid remnants hanging around", "page", "=", "new", "(", "AlertPage", ")", "\n", "if", "err", ":=", "a", ".", "p", ".", "Next", "(", "ctx", ",", "page", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "len", "(", "page", ".", "Alerts", ")", "==", "0", "{", "return", "nil", ",", "NoMoreResults", "\n", "}", "\n", "times", ":=", "make", "(", "[", "]", "time", ".", "Time", ",", "len", "(", "page", ".", "Alerts", ")", ",", "len", "(", "page", ".", "Alerts", ")", ")", "\n", "for", "i", ",", "alert", ":=", "range", "page", ".", "Alerts", "{", "if", "!", "alert", ".", "DateCreated", ".", "Valid", "{", "// we really should not ever hit this case but if we can't parse", "// a date, better to give you back an error than to give you back", "// a list of alerts that may or may not be in the time range", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "alert", ")", "\n", "}", "\n", "times", "[", "i", "]", "=", "alert", ".", "DateCreated", ".", "Time", "\n", "}", "\n", "if", "containsResultsInRange", "(", "a", ".", "start", ",", "a", ".", "end", ",", "times", ")", "{", "indexesToDelete", ":=", "indexesOutsideRange", "(", "a", ".", "start", ",", "a", ".", "end", ",", "times", ")", "\n", "// reverse order so we don't delete the wrong index", "for", "i", ":=", "len", "(", "indexesToDelete", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "index", ":=", "indexesToDelete", "[", "i", "]", "\n", "page", ".", "Alerts", "=", "append", "(", "page", ".", "Alerts", "[", ":", "index", "]", ",", "page", ".", "Alerts", "[", "index", "+", "1", ":", "]", "...", ")", "\n", "}", "\n", "a", ".", "p", ".", "SetNextPageURI", "(", "page", ".", "Meta", ".", "NextPageURL", ")", "\n", "return", "page", ",", "nil", "\n", "}", "\n", "if", "shouldContinuePaging", "(", "a", ".", "start", ",", "times", ")", "{", "a", ".", "p", ".", "SetNextPageURI", "(", "page", ".", "Meta", ".", "NextPageURL", ")", "\n", "continue", "\n", "}", "else", "{", "// should not continue paging and no results in range, stop", "return", "nil", ",", "NoMoreResults", "\n", "}", "\n", "}", "\n", "}" ]
23,046
all-23047
[ "Do", "executes", "DOMDebugger", ".", "setEventListenerBreakpoint", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetEventListenerBreakpointParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetEventListenerBreakpoint", ",", "p", ",", "nil", ")", "\n", "}" ]
23,047
all-23048
[ "AddOffsetValue", "()", "is", "a", "wrapper", "around", "gtk_level_bar_add_offset_value", "()", "." ]
[ "func", "(", "v", "*", "LevelBar", ")", "AddOffsetValue", "(", "name", "string", ",", "value", "float64", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "<mask>", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_level_bar_add_offset_value", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "C", ".", "gdouble", "(", "value", ")", ")", "\n", "}" ]
23,048
all-23049
[ "Between", "adds", "BETWEEN", "...", "AND", "...", "clause", "to", "the", "Condition", "and", "returns", "it", "for", "method", "chain", "." ]
[ "func", "(", "c", "*", "Condition", ")", "Between", "(", "from", ",", "to", "<mask>", "{", "}", ")", "*", "Condition", "{", "return", "c", ".", "appendQuery", "(", "100", ",", "Between", ",", "&", "between", "{", "from", ",", "to", "}", ")", "\n", "}" ]
23,049
all-23050
[ "base64URLDecode", "decodes", "the", "given", "string", "as", "a", "URL", "-", "safe", "base64", "string", "." ]
[ "func", "base64URLDecode", "(", "s", "string", ")", "(", "string", ",", "error", ")", "{", "v", ",", "err", ":=", "base64", ".", "URLEncoding", ".", "DecodeString", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "<mask>", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "string", "(", "v", ")", ",", "nil", "\n", "}" ]
23,050
all-23051
[ "Info", "outputs", "Info", "level", "log" ]
[ "func", "Info", "(", "val", "...", "<mask>", "{", "}", ")", "error", "{", "return", "glg", ".", "out", "(", "INFO", ",", "blankFormat", "(", "len", "(", "val", ")", ")", ",", "val", "...", ")", "\n", "}" ]
23,051
all-23052
[ "SetTooltipCell", "is", "a", "wrapper", "around", "gtk_icon_view_set_tooltip_cell", "()", "." ]
[ "func", "(", "v", "*", "IconView", ")", "SetTooltipCell", "(", "tooltip", "*", "Tooltip", ",", "path", "*", "TreePath", ",", "cell", "*", "CellRenderer", ")", "{", "C", ".", "gtk_icon_view_set_tooltip_cell", "(", "v", ".", "native", "(", ")", ",", "tooltip", ".", "native", "(", ")", ",", "path", ".", "native", "(", ")", ",", "<mask>", ".", "native", "(", ")", ")", "\n", "}" ]
23,052
all-23053
[ "GetNotifyAuditOk", "returns", "a", "tuple", "with", "the", "NotifyAudit", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "o", "*", "Options", ")", "GetNotifyAuditOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "o", "==", "nil", "||", "o", ".", "NotifyAudit", "==", "nil", "{", "return", "false", ",", "<mask>", "\n", "}", "\n", "return", "*", "o", ".", "NotifyAudit", ",", "true", "\n", "}" ]
23,053
all-23054
[ "destroy", "is", "a", "wrapper", "around", "cairo_destroy", "()", "." ]
[ "func", "(", "v", "*", "Context", ")", "destroy", "(", ")", "{", "if", "v", ".", "<mask>", "!=", "nil", "{", "C", ".", "cairo_destroy", "(", "v", ".", "native", "(", ")", ")", "\n", "v", ".", "context", "=", "nil", "\n", "}", "\n", "}" ]
23,054
all-23055
[ "Dispatch", "receives", "channels", "to", "each", "type", "of", "events", "and", "dispatch", "them", "to", "each", "plugins", "." ]
[ "func", "Dispatch", "(", "plugin", "plugins", ".", "Plugin", ",", "DB", "*", "InfluxDB", ",", "issues", "chan", "sql", ".", "Issue", ",", "eventsCommentsChannel", "chan", "interface", "{", "}", ")", "{", "for", "{", "var", "points", "[", "]", "plugins", ".", "Point", "\n", "select", "{", "case", "issue", ",", "ok", ":=", "<-", "issues", ":", "if", "!", "ok", "{", "return", "\n", "}", "\n", "points", "=", "plugin", ".", "ReceiveIssue", "(", "issue", ")", "\n", "case", "event", ",", "ok", ":=", "<-", "eventsCommentsChannel", ":", "if", "!", "ok", "{", "return", "\n", "}", "\n", "switch", "event", ":=", "event", ".", "(", "<mask>", ")", "{", "case", "sql", ".", "IssueEvent", ":", "points", "=", "plugin", ".", "ReceiveIssueEvent", "(", "event", ")", "\n", "case", "sql", ".", "Comment", ":", "points", "=", "plugin", ".", "ReceiveComment", "(", "event", ")", "\n", "default", ":", "glog", ".", "Fatal", "(", "\"", "\"", ",", "event", ")", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "point", ":=", "range", "points", "{", "if", "err", ":=", "DB", ".", "Push", "(", "point", ".", "Tags", ",", "point", ".", "Values", ",", "point", ".", "Date", ")", ";", "err", "!=", "nil", "{", "glog", ".", "Fatal", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
23,055
all-23056
[ "getAuthToken", "extracts", "the", "auth", "token", "embedded", "in", "ctx", "if", "there", "is", "on" ]
[ "func", "getAuthToken", "(", "ctx", "context", ".", "Context", ")", "(", "string", ",", "error", ")", "{", "<mask>", ",", "ok", ":=", "metadata", ".", "FromIncomingContext", "(", "ctx", ")", "\n", "if", "!", "ok", "{", "return", "\"", "\"", ",", "authclient", ".", "ErrNoMetadata", "\n", "}", "\n", "if", "len", "(", "md", "[", "authclient", ".", "ContextTokenKey", "]", ")", ">", "1", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "else", "if", "len", "(", "md", "[", "authclient", ".", "ContextTokenKey", "]", ")", "==", "0", "{", "return", "\"", "\"", ",", "authclient", ".", "ErrNotSignedIn", "\n", "}", "\n", "return", "md", "[", "authclient", ".", "ContextTokenKey", "]", "[", "0", "]", ",", "nil", "\n", "}" ]
23,056
all-23057
[ "CommandFilter", "builds", "a", "filter", "for", "/", "test", "foo" ]
[ "func", "CommandFilter", "(", "<mask>", "string", ")", "Filter", "{", "return", "func", "(", "p", "config", ".", "Presubmit", ")", "(", "bool", ",", "bool", ",", "bool", ")", "{", "return", "p", ".", "TriggerMatches", "(", "body", ")", ",", "p", ".", "TriggerMatches", "(", "body", ")", ",", "true", "\n", "}", "\n", "}" ]
23,057
all-23058
[ "MustAddHandler", "calls", "AddHandler", "and", "panics", "in", "case", "of", "an", "error", "." ]
[ "func", "(", "r", "*", "MapErrorRegistry", ")", "MustAddHandler", "(", "code", "int", ",", "<mask>", "func", "(", "body", "[", "]", "byte", ")", "error", ")", "{", "if", "err", ":=", "r", ".", "AddHandler", "(", "code", ",", "handler", ")", ";", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "}" ]
23,058
all-23059
[ "SetRole", "is", "a", "wrapper", "around", "gtk_window_set_role", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "SetRole", "(", "s", "string", ")", "{", "cstr", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "s", ")", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_window_set_role", "(", "v", ".", "native", "(", ")", ",", "cstr", ")", "\n", "}" ]
23,059
all-23060
[ "RequestEntries", "requests", "data", "from", "cache", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "CacheStorage#method", "-", "requestEntries", "parameters", ":", "cacheID", "-", "ID", "of", "cache", "to", "get", "entries", "from", ".", "skipCount", "-", "Number", "of", "records", "to", "skip", ".", "pageSize", "-", "Number", "of", "records", "to", "fetch", "." ]
[ "func", "RequestEntries", "(", "cacheID", "CacheID", ",", "skipCount", "int64", ",", "pageSize", "int64", ")", "*", "RequestEntriesParams", "{", "<mask>", "&", "RequestEntriesParams", "{", "CacheID", ":", "cacheID", ",", "SkipCount", ":", "skipCount", ",", "PageSize", ":", "pageSize", ",", "}", "\n", "}" ]
23,060
all-23061
[ "SetLogger", "wraps", "the", "standard", "library", "log", "package", ".", "It", "allows", "the", "internal", "logging", "of", "s3gof3r", "to", "be", "set", "to", "a", "desired", "output", "and", "format", ".", "Setting", "debug", "to", "true", "enables", "debug", "logging", "output", ".", "s3gof3r", "does", "not", "log", "output", "by", "default", "." ]
[ "func", "SetLogger", "(", "out", "io", ".", "Writer", ",", "prefix", "string", ",", "<mask>", "int", ",", "debug", "bool", ")", "{", "logger", "=", "internalLogger", "{", "log", ".", "New", "(", "out", ",", "prefix", ",", "flag", ")", ",", "debug", ",", "}", "\n", "}" ]
23,061
all-23062
[ "ServeHTTP", "validates", "an", "incoming", "Push", "Pub", "/", "Sub", "subscription", "and", "handle", "them", "." ]
[ "func", "(", "s", "*", "PushServer", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "HTTPCode", ":=", "http", ".", "StatusOK", "\n", "subscription", ":=", "\"", "\"", "\n", "var", "finalError", "error", "\n\n", "defer", "func", "(", ")", "{", "s", ".", "Subscriber", ".", "Metrics", ".", "ResponseCounter", ".", "With", "(", "prometheus", ".", "Labels", "{", "subscriptionLabel", ":", "subscription", ",", "responseCodeLabel", ":", "string", "(", "HTTPCode", ")", ",", "}", ")", ".", "Inc", "(", ")", "\n", "if", "finalError", "!=", "nil", "{", "http", ".", "Error", "(", "w", ",", "finalError", ".", "Error", "(", ")", ",", "HTTPCode", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "if", "s", ".", "TokenGenerator", "!=", "nil", "{", "token", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "tokenLabel", ")", "\n", "if", "token", "!=", "string", "(", "s", ".", "TokenGenerator", "(", ")", ")", "{", "finalError", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "HTTPCode", "=", "http", ".", "StatusForbidden", "\n", "return", "\n", "}", "\n", "}", "\n", "// Get the payload and act on it.", "pr", ":=", "&", "pushRequest", "{", "}", "\n", "if", "err", ":=", "json", ".", "NewDecoder", "(", "r", ".", "Body", ")", ".", "Decode", "(", "pr", ")", ";", "err", "!=", "nil", "{", "finalError", "=", "err", "\n", "HTTPCode", "=", "http", ".", "StatusBadRequest", "\n", "return", "\n", "}", "\n\n", "msg", ":=", "pubsub", ".", "<mask>", "{", "Data", ":", "pr", ".", "Message", ".", "Data", ",", "ID", ":", "pr", ".", "Message", ".", "ID", ",", "Attributes", ":", "pr", ".", "Message", ".", "Attributes", ",", "}", "\n\n", "if", "err", ":=", "s", ".", "Subscriber", ".", "handleMessage", "(", "&", "pubSubMessage", "{", "Message", ":", "msg", "}", ",", "pr", ".", "Subscription", ")", ";", "err", "!=", "nil", "{", "finalError", "=", "err", "\n", "HTTPCode", "=", "http", ".", "StatusNotModified", "\n", "return", "\n", "}", "\n", "}" ]
23,062
all-23063
[ "AddAt", "injects", "values", "beginning", "at", "pos", ".", "If", "multiple", "values", "are", "provided", "in", "entries", "they", "are", "placed", "in", "the", "same", "order", "they", "are", "provided", "." ]
[ "func", "(", "l", "*", "List", ")", "AddAt", "(", "pos", "uint", ",", "entries", "...", "interface", "{", "}", ")", "{", "l", ".", "key", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "key", ".", "Unlock", "(", ")", "\n\n", "l", ".", "underlyer", "=", "append", "(", "l", ".", "underlyer", "[", ":", "pos", "]", ",", "<mask>", "(", "entries", ",", "l", ".", "underlyer", "[", "pos", ":", "]", "...", ")", "...", ")", "\n", "}" ]
23,063
all-23064
[ "CompareIssue", "two", "Issues", "and", "return", "true", "if", "left", "should", "sort", "before", "right", "nolint", ":", "gocyclo" ]
[ "func", "CompareIssue", "(", "l", ",", "r", "Issue", ",", "order", "[", "]", "string", ")", "bool", "{", "for", "_", ",", "key", ":=", "range", "order", "{", "switch", "{", "case", "key", "==", "\"", "\"", "&&", "l", ".", "Path", "!=", "r", ".", "Path", ":", "return", "l", ".", "Path", ".", "String", "(", ")", "<", "r", ".", "Path", ".", "<mask>", "(", ")", "\n", "case", "key", "==", "\"", "\"", "&&", "l", ".", "Line", "!=", "r", ".", "Line", ":", "return", "l", ".", "Line", "<", "r", ".", "Line", "\n", "case", "key", "==", "\"", "\"", "&&", "l", ".", "Col", "!=", "r", ".", "Col", ":", "return", "l", ".", "Col", "<", "r", ".", "Col", "\n", "case", "key", "==", "\"", "\"", "&&", "l", ".", "Severity", "!=", "r", ".", "Severity", ":", "return", "l", ".", "Severity", "<", "r", ".", "Severity", "\n", "case", "key", "==", "\"", "\"", "&&", "l", ".", "Message", "!=", "r", ".", "Message", ":", "return", "l", ".", "Message", "<", "r", ".", "Message", "\n", "case", "key", "==", "\"", "\"", "&&", "l", ".", "Linter", "!=", "r", ".", "Linter", ":", "return", "l", ".", "Linter", "<", "r", ".", "Linter", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
23,064
all-23065
[ "Close", "gracefully", "shuts", "down", "all", "servers", "/", "listeners", ".", "Client", "requests", "will", "be", "terminated", "with", "request", "timeout", ".", "After", "timeout", "enforce", "remaning", "requests", "be", "closed", "immediately", "." ]
[ "func", "(", "e", "*", "Etcd", ")", "Close", "(", ")", "{", "fields", ":=", "[", "]", "zap", ".", "Field", "{", "zap", ".", "String", "(", "\"", "\"", ",", "e", ".", "cfg", ".", "Name", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "e", ".", "cfg", ".", "Dir", ")", ",", "zap", ".", "Strings", "(", "\"", "\"", ",", "e", ".", "cfg", ".", "getAPURLs", "(", ")", ")", ",", "zap", ".", "Strings", "(", "\"", "\"", ",", "e", ".", "cfg", ".", "getACURLs", "(", ")", ")", ",", "}", "\n", "lg", ":=", "e", ".", "GetLogger", "(", ")", "\n", "if", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ",", "fields", "...", ")", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ",", "fields", "...", ")", "\n", "lg", ".", "Sync", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "e", ".", "closeOnce", ".", "Do", "(", "func", "(", ")", "{", "close", "(", "e", ".", "stopc", ")", "}", ")", "\n\n", "// close client requests with request timeout", "timeout", ":=", "2", "*", "time", ".", "Second", "\n", "if", "e", ".", "Server", "!=", "nil", "{", "timeout", "=", "e", ".", "Server", ".", "Cfg", ".", "ReqTimeout", "(", ")", "\n", "}", "\n", "for", "_", ",", "sctx", ":=", "range", "e", ".", "sctxs", "{", "for", "ss", ":=", "range", "sctx", ".", "serversC", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "timeout", ")", "\n", "stopServers", "(", "ctx", ",", "ss", ")", "\n", "cancel", "(", ")", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "sctx", ":=", "range", "e", ".", "sctxs", "{", "sctx", ".", "cancel", "(", ")", "\n", "}", "\n\n", "for", "i", ":=", "range", "e", ".", "Clients", "{", "if", "e", ".", "Clients", "[", "i", "]", "!=", "nil", "{", "e", ".", "Clients", "[", "i", "]", ".", "Close", "(", ")", "\n", "}", "\n", "}", "\n\n", "for", "i", ":=", "range", "e", ".", "metricsListeners", "{", "e", ".", "metricsListeners", "[", "i", "]", ".", "Close", "(", ")", "\n", "}", "\n\n", "// close rafthttp transports", "if", "e", ".", "Server", "!=", "nil", "{", "e", ".", "Server", ".", "Stop", "(", ")", "\n", "}", "\n\n", "// close all idle connections in peer handler (wait up to 1-second)", "for", "i", ":=", "range", "e", ".", "Peers", "{", "if", "e", ".", "Peers", "[", "i", "]", "!=", "nil", "&&", "e", ".", "Peers", "[", "i", "]", ".", "<mask>", "!=", "nil", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "time", ".", "Second", ")", "\n", "e", ".", "Peers", "[", "i", "]", ".", "close", "(", "ctx", ")", "\n", "cancel", "(", ")", "\n", "}", "\n", "}", "\n", "}" ]
23,065
all-23066
[ "CreateTags", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockClientSDK", ")", "CreateTags", "(", "arg0", "*", "ec20", ".", "CreateTagsInput", ")", "(", "*", "ec20", ".", "CreateTagsOutput", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "ec20", ".", "CreateTagsOutput", ")", "\n", "ret1", ",", "_", ":=", "<mask>", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
23,066
all-23067
[ "serve", "starts", "a", "http", "server", "and", "serves", "prometheus", "metrics", ".", "Meant", "to", "be", "called", "inside", "a", "goroutine", "." ]
[ "func", "serve", "(", ")", "{", "http", ".", "Handle", "(", "\"", "\"", ",", "promhttp", ".", "<mask>", "(", ")", ")", "\n", "logrus", ".", "WithError", "(", "http", ".", "ListenAndServe", "(", "\"", "\"", ",", "nil", ")", ")", ".", "Fatal", "(", "\"", "\"", ")", "\n", "}" ]
23,067
all-23068
[ "handleRemoveSubscription", "removes", "Subscription", "sub", "from", "bookeeping", ".", "If", "this", "was", "the", "last", "Subscription", "for", "a", "given", "topic", "it", "will", "also", "announce", "that", "this", "node", "is", "not", "subscribing", "to", "this", "topic", "anymore", ".", "Only", "called", "from", "processLoop", "." ]
[ "func", "(", "p", "*", "PubSub", ")", "handleRemoveSubscription", "(", "<mask>", "*", "Subscription", ")", "{", "subs", ":=", "p", ".", "myTopics", "[", "sub", ".", "topic", "]", "\n\n", "if", "subs", "==", "nil", "{", "return", "\n", "}", "\n\n", "sub", ".", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "close", "(", "sub", ".", "ch", ")", "\n", "delete", "(", "subs", ",", "sub", ")", "\n\n", "if", "len", "(", "subs", ")", "==", "0", "{", "delete", "(", "p", ".", "myTopics", ",", "sub", ".", "topic", ")", "\n", "p", ".", "announce", "(", "sub", ".", "topic", ",", "false", ")", "\n", "p", ".", "rt", ".", "Leave", "(", "sub", ".", "topic", ")", "\n", "}", "\n", "}" ]
23,068
all-23069
[ "/", "*", "Boolean", "looks", "for", "the", "specified", "key", "and", "returns", "it", "as", "a", "bool", ".", "If", "not", "found", "the", "default", "value", "def", "is", "returned", "." ]
[ "func", "(", "config", "*", "Config", ")", "Boolean", "(", "key", "string", ",", "def", "bool", ")", "bool", "{", "return", "getBoolean", "(", "config", ".", "values", ",", "<mask>", ",", "def", ")", "\n", "}" ]
23,069
all-23070
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "Uniform2iv", "(", "location", "int32", ",", "count", "int32", ",", "value", "*", "int32", ")", "{", "C", ".", "glowUniform2iv", "(", "gpUniform2iv", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "<mask>", ")", ",", "(", "*", "C", ".", "GLint", ")", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ")", "\n", "}" ]
23,070
all-23071
[ "SchedulerLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "SchedulerLocator", "(", "href", "<mask>", ")", "*", "SchedulerLocator", "{", "return", "&", "SchedulerLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
23,071
all-23072
[ "keep", "finds", "the", "revision", "to", "be", "kept", "if", "compact", "is", "called", "at", "given", "atRev", "." ]
[ "func", "(", "ki", "*", "keyIndex", ")", "keep", "(", "atRev", "int64", ",", "available", "map", "[", "revision", "]", "struct", "{", "}", ")", "{", "if", "ki", ".", "isEmpty", "(", ")", "{", "return", "\n", "}", "\n\n", "genIdx", ",", "revIndex", ":=", "ki", ".", "doCompact", "(", "atRev", ",", "<mask>", ")", "\n", "g", ":=", "&", "ki", ".", "generations", "[", "genIdx", "]", "\n", "if", "!", "g", ".", "isEmpty", "(", ")", "{", "// remove any tombstone", "if", "revIndex", "==", "len", "(", "g", ".", "revs", ")", "-", "1", "&&", "genIdx", "!=", "len", "(", "ki", ".", "generations", ")", "-", "1", "{", "delete", "(", "available", ",", "g", ".", "revs", "[", "revIndex", "]", ")", "\n", "}", "\n", "}", "\n", "}" ]
23,072
all-23073
[ "/", "*", "NewProgressBar", "creates", "a", "new", "ProgressBar", ".", "parent", "-", "is", "container", "that", "keeps", "the", "control", ".", "width", "and", "heigth", "-", "are", "minimal", "size", "of", "the", "control", ".", "scale", "-", "the", "way", "of", "scaling", "the", "control", "when", "the", "parent", "is", "resized", ".", "Use", "DoNotScale", "constant", "if", "the", "control", "should", "keep", "its", "original", "size", "." ]
[ "func", "CreateProgressBar", "(", "parent", "Control", ",", "width", ",", "height", "int", ",", "scale", "int", ")", "*", "ProgressBar", "{", "b", ":=", "new", "(", "ProgressBar", ")", "\n", "b", ".", "BaseControl", "=", "NewBaseControl", "(", ")", "\n\n", "if", "<mask>", "==", "AutoSize", "{", "height", "=", "1", "\n", "}", "\n", "if", "width", "==", "AutoSize", "{", "width", "=", "10", "\n", "}", "\n\n", "b", ".", "SetSize", "(", "width", ",", "height", ")", "\n", "b", ".", "SetConstraints", "(", "width", ",", "height", ")", "\n", "b", ".", "SetTabStop", "(", "false", ")", "\n", "b", ".", "SetScale", "(", "scale", ")", "\n", "b", ".", "min", "=", "0", "\n", "b", ".", "max", "=", "10", "\n", "b", ".", "direction", "=", "Horizontal", "\n", "b", ".", "parent", "=", "parent", "\n", "b", ".", "align", "=", "AlignCenter", "\n\n", "if", "parent", "!=", "nil", "{", "parent", ".", "AddChild", "(", "b", ")", "\n", "}", "\n\n", "return", "b", "\n", "}" ]
23,073
all-23074
[ "Schema", "updates", "begin", "here", "Copy", "core", ".", "https_address", "to", "cluster", ".", "https_address", "in", "case", "this", "node", "is", "clustered", "." ]
[ "func", "updateFromV37", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "count", ",", "err", ":=", "query", ".", "Count", "(", "tx", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "<mask>", "==", "0", "{", "// This node is not clustered, nothing to do.", "return", "nil", "\n", "}", "\n\n", "// Copy the core.https_address config.", "_", ",", "err", "=", "tx", ".", "Exec", "(", "`\nINSERT INTO config (key, value)\n SELECT 'cluster.https_address', value FROM config WHERE key = 'core.https_address'\n`", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
23,074
all-23075
[ "NewResponseWriter", "creates", "a", "ResponseWriter", "that", "wraps", "an", "http", ".", "ResponseWriter" ]
[ "func", "NewResponseWriter", "(", "<mask>", "string", ",", "rw", "http", ".", "ResponseWriter", ")", "ResponseWriter", "{", "return", "&", "responseWriter", "{", "method", ",", "rw", ",", "0", ",", "0", ",", "nil", "}", "\n", "}" ]
23,075
all-23076
[ "Set", "is", "required", "for", "kingpin", "interfaces", "to", "allow", "command", "line", "params", "to", "be", "set", "to", "our", "map", "datatype" ]
[ "func", "(", "o", "*", "ListComplex64Option", ")", "Set", "(", "value", "string", ")", "error", "{", "val", ":=", "Complex64Option", "{", "}", "\n", "val", ".", "Set", "(", "value", ")", "\n", "*", "o", "=", "<mask>", "(", "*", "o", ",", "val", ")", "\n", "return", "nil", "\n", "}" ]
23,076
all-23077
[ "specify", "implementation", "-", "specific", "hints" ]
[ "func", "Hint", "(", "<mask>", "uint32", ",", "mode", "uint32", ")", "{", "C", ".", "glowHint", "(", "gpHint", ",", "(", "C", ".", "GLenum", ")", "(", "target", ")", ",", "(", "C", ".", "GLenum", ")", "(", "mode", ")", ")", "\n", "}" ]
23,077
all-23078
[ "GetWithExpiration", "returns", "an", "item", "and", "its", "expiration", "time", "from", "the", "cache", ".", "It", "returns", "the", "item", "or", "nil", "the", "expiration", "time", "if", "one", "is", "set", "(", "if", "the", "item", "never", "expires", "a", "zero", "value", "for", "time", ".", "Time", "is", "returned", ")", "and", "a", "bool", "indicating", "whether", "the", "key", "was", "found", "." ]
[ "func", "(", "c", "*", "cache", ")", "GetWithExpiration", "(", "k", "string", ")", "(", "interface", "{", "}", ",", "time", ".", "Time", ",", "bool", ")", "{", "c", ".", "mu", ".", "RLock", "(", ")", "\n", "// \"Inlining\" of get and Expired", "item", ",", "found", ":=", "c", ".", "<mask>", "[", "k", "]", "\n", "if", "!", "found", "{", "c", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "nil", ",", "time", ".", "Time", "{", "}", ",", "false", "\n", "}", "\n\n", "if", "item", ".", "Expiration", ">", "0", "{", "if", "time", ".", "Now", "(", ")", ".", "UnixNano", "(", ")", ">", "item", ".", "Expiration", "{", "c", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "nil", ",", "time", ".", "Time", "{", "}", ",", "false", "\n", "}", "\n\n", "// Return the item and the expiration time", "c", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "item", ".", "Object", ",", "time", ".", "Unix", "(", "0", ",", "item", ".", "Expiration", ")", ",", "true", "\n", "}", "\n\n", "// If expiration <= 0 (i.e. no expiration time set) then return the item", "// and a zeroed time.Time", "c", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "item", ".", "Object", ",", "time", ".", "Time", "{", "}", ",", "true", "\n", "}" ]
23,078
all-23079
[ "indicate", "modifications", "to", "a", "range", "of", "a", "mapped", "buffer" ]
[ "func", "FlushMappedNamedBufferRange", "(", "buffer", "uint32", ",", "<mask>", "int", ",", "length", "int", ")", "{", "syscall", ".", "Syscall", "(", "gpFlushMappedNamedBufferRange", ",", "3", ",", "uintptr", "(", "buffer", ")", ",", "uintptr", "(", "offset", ")", ",", "uintptr", "(", "length", ")", ")", "\n", "}" ]
23,079
all-23080
[ "HelpProvider", "constructs", "the", "PluginHelp", "for", "this", "plugin", "that", "takes", "into", "account", "enabled", "repositories", ".", "HelpProvider", "defines", "the", "type", "for", "function", "that", "construct", "the", "PluginHelp", "for", "plugins", "." ]
[ "func", "HelpProvider", "(", "enabledRepos", "[", "]", "string", ")", "(", "*", "pluginhelp", ".", "PluginHelp", ",", "error", ")", "{", "return", "&", "pluginhelp", ".", "PluginHelp", "{", "<mask>", ":", "`The needs-rebase plugin manages the '`", "+", "labels", ".", "NeedsRebase", "+", "`' label by removing it from Pull Requests that are mergeable and adding it to those which are not.\nThe plugin reacts to commit changes on PRs in addition to periodically scanning all open PRs for any changes to mergeability that could have resulted from changes in other PRs.`", ",", "}", ",", "nil", "\n", "}" ]
23,080
all-23081
[ "HasFillMax", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "Style", ")", "HasFillMax", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "FillMax", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
23,081
all-23082
[ "SelectRegion", "is", "a", "wrapper", "around", "gtk_label_select_region", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SelectRegion", "(", "startOffset", ",", "endOffset", "int", ")", "{", "C", ".", "gtk_label_select_region", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "startOffset", ")", ",", "C", ".", "gint", "(", "endOffset", ")", ")", "\n", "}" ]
23,082
all-23083
[ "RecordDigestUncompressedPair", "records", "that", "the", "uncompressed", "version", "of", "anyDigest", "is", "uncompressed", ".", "It’s", "allowed", "for", "anyDigest", "==", "uncompressed", ".", "WARNING", ":", "Only", "call", "this", "for", "LOCALLY", "VERIFIED", "data", ";", "don’t", "record", "a", "digest", "pair", "just", "because", "some", "remote", "author", "claims", "so", "(", "e", ".", "g", ".", "because", "a", "manifest", "/", "config", "pair", "exists", ")", ";", "otherwise", "the", "cache", "could", "be", "poisoned", "and", "allow", "substituting", "unexpected", "blobs", ".", "(", "Eventually", "the", "DiffIDs", "in", "image", "config", "could", "detect", "the", "substitution", "but", "that", "may", "be", "too", "late", "and", "not", "all", "image", "formats", "contain", "that", "data", ".", ")" ]
[ "func", "(", "mem", "*", "cache", ")", "RecordDigestUncompressedPair", "(", "anyDigest", "digest", ".", "Digest", ",", "uncompressed", "digest", ".", "Digest", ")", "{", "mem", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "mem", ".", "mutex", ".", "Unlock", "(", ")", "\n", "if", "previous", ",", "ok", ":=", "mem", ".", "uncompressedDigests", "[", "anyDigest", "]", ";", "ok", "&&", "previous", "!=", "uncompressed", "{", "logrus", ".", "Warnf", "(", "\"", "\"", ",", "anyDigest", ",", "previous", ",", "uncompressed", ")", "\n", "}", "\n", "mem", ".", "uncompressedDigests", "[", "anyDigest", "]", "=", "uncompressed", "\n\n", "anyDigestSet", ",", "<mask>", ":=", "mem", ".", "digestsByUncompressed", "[", "uncompressed", "]", "\n", "if", "!", "ok", "{", "anyDigestSet", "=", "map", "[", "digest", ".", "Digest", "]", "struct", "{", "}", "{", "}", "\n", "mem", ".", "digestsByUncompressed", "[", "uncompressed", "]", "=", "anyDigestSet", "\n", "}", "\n", "anyDigestSet", "[", "anyDigest", "]", "=", "struct", "{", "}", "{", "}", "// Possibly writing the same struct{}{} presence marker again.", "\n", "}" ]
23,083
all-23084
[ "BuildTypeDecoder", "takes", "a", "list", "of", "interfaces", "and", "stores", "them", "internally", "as", "a", "list", "of", "typeMappings", "in", "the", "format", "below", ".", "MyMessage", ":", "TypeOf", "(", "ecstcs", ".", "MyMessage", ")" ]
[ "func", "BuildTypeDecoder", "(", "recognizedTypes", "[", "]", "interface", "{", "}", ")", "TypeDecoder", "{", "typeMappings", ":=", "make", "(", "map", "[", "string", "]", "reflect", ".", "Type", ")", "\n", "for", "_", ",", "recognizedType", ":=", "<mask>", "recognizedTypes", "{", "typeMappings", "[", "reflect", ".", "TypeOf", "(", "recognizedType", ")", ".", "Name", "(", ")", "]", "=", "reflect", ".", "TypeOf", "(", "recognizedType", ")", "\n", "}", "\n\n", "return", "&", "TypeDecoderImpl", "{", "typeMappings", ":", "typeMappings", "}", "\n", "}" ]
23,084
all-23085
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "put", "apps", "app", "params" ]
[ "func", "(", "o", "*", "PutAppsAppParams", ")", "WithTimeout", "(", "timeout", "<mask>", ".", "Duration", ")", "*", "PutAppsAppParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
23,085
all-23086
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetBreakpointsActiveParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger9", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
23,086
all-23087
[ "Do", "executes", "Network", ".", "getRequestPostData", "against", "the", "provided", "context", ".", "returns", ":", "postData", "-", "Request", "body", "string", "omitting", "files", "from", "multipart", "requests" ]
[ "func", "(", "p", "*", "GetRequestPostDataParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "postData", "string", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetRequestPostDataReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetRequestPostData", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "PostData", ",", "nil", "\n", "}" ]
23,087
all-23088
[ "From", "returns", "a", "new", "context", "with", "key", "/", "value", "pairs", "copied", "both", "from", "the", "list", "and", "the", "context", "." ]
[ "func", "(", "l", "List", ")", "From", "(", "ctx", "context", ".", "Context", ")", "<mask>", "{", "ctx", "=", "newContext", "(", "ctx", ",", "l", ")", "\n", "return", "&", "contextT", "{", "ctx", ":", "ctx", "}", "\n", "}" ]
23,088
all-23089
[ "splitMappingsAt", "ensures", "that", "a", "is", "not", "in", "the", "middle", "of", "any", "mapping", ".", "Splits", "mappings", "as", "necessary", "." ]
[ "func", "(", "p", "*", "Process", ")", "splitMappingsAt", "(", "a", "Address", ")", "{", "for", "_", ",", "m", ":=", "range", "p", ".", "memory", ".", "mappings", "{", "if", "a", "<", "m", ".", "min", "||", "a", ">", "m", ".", "max", "{", "continue", "\n", "}", "\n", "if", "a", "==", "m", ".", "min", "||", "a", "==", "m", ".", "max", "{", "return", "\n", "}", "\n", "// Split this mapping at a.", "m2", ":=", "new", "(", "Mapping", ")", "\n", "*", "m2", "=", "*", "m", "\n", "m", ".", "max", "=", "a", "\n", "m2", ".", "<mask>", "=", "a", "\n", "if", "m2", ".", "f", "!=", "nil", "{", "m2", ".", "off", "+=", "m", ".", "Size", "(", ")", "\n", "}", "\n", "if", "m2", ".", "origF", "!=", "nil", "{", "m2", ".", "origOff", "+=", "m", ".", "Size", "(", ")", "\n", "}", "\n", "p", ".", "memory", ".", "mappings", "=", "append", "(", "p", ".", "memory", ".", "mappings", ",", "m2", ")", "\n", "return", "\n", "}", "\n", "}" ]
23,089
all-23090
[ "typeObject", "takes", "an", "address", "and", "a", "type", "for", "the", "data", "at", "that", "address", ".", "For", "each", "pointer", "it", "finds", "in", "the", "memory", "at", "that", "address", "it", "calls", "add", "with", "the", "pointer", "and", "the", "type", "+", "repeat", "count", "of", "the", "thing", "that", "it", "points", "to", "." ]
[ "func", "(", "p", "*", "Process", ")", "typeObject", "(", "a", "core", ".", "Address", ",", "t", "*", "<mask>", ",", "r", "reader", ",", "add", "func", "(", "core", ".", "Address", ",", "*", "Type", ",", "int64", ")", ")", "{", "ptrSize", ":=", "p", ".", "proc", ".", "PtrSize", "(", ")", "\n\n", "switch", "t", ".", "Kind", "{", "case", "KindBool", ",", "KindInt", ",", "KindUint", ",", "KindFloat", ",", "KindComplex", ":", "// Nothing to do", "case", "KindEface", ",", "KindIface", ":", "// interface. Use the type word to determine the type", "// of the pointed-to object.", "typPtr", ":=", "r", ".", "ReadPtr", "(", "a", ")", "\n", "if", "typPtr", "==", "0", "{", "// nil interface", "return", "\n", "}", "\n", "data", ":=", "a", ".", "Add", "(", "ptrSize", ")", "\n", "if", "t", ".", "Kind", "==", "KindIface", "{", "typPtr", "=", "p", ".", "proc", ".", "ReadPtr", "(", "typPtr", ".", "Add", "(", "p", ".", "findType", "(", "\"", "\"", ")", ".", "field", "(", "\"", "\"", ")", ".", "Off", ")", ")", "\n", "}", "\n", "// TODO: for KindEface, type typPtr. It might point to the heap", "// if the type was allocated with reflect.", "typ", ":=", "p", ".", "runtimeType2Type", "(", "typPtr", ")", "\n", "typr", ":=", "region", "{", "p", ":", "p", ",", "a", ":", "typPtr", ",", "typ", ":", "p", ".", "findType", "(", "\"", "\"", ")", "}", "\n", "if", "typr", ".", "Field", "(", "\"", "\"", ")", ".", "Uint8", "(", ")", "&", "uint8", "(", "p", ".", "rtConstants", "[", "\"", "\"", "]", ")", "==", "0", "{", "// Indirect interface: the interface introduced a new", "// level of indirection, not reflected in the type.", "// Read through it.", "add", "(", "r", ".", "ReadPtr", "(", "data", ")", ",", "typ", ",", "1", ")", "\n", "return", "\n", "}", "\n\n", "// Direct interface: the contained type is a single pointer.", "// Figure out what it is and type it. See isdirectiface() for the rules.", "directTyp", ":=", "typ", "\n", "findDirect", ":", "for", "{", "if", "directTyp", ".", "Kind", "==", "KindArray", "{", "directTyp", "=", "typ", ".", "Elem", "\n", "continue", "findDirect", "\n", "}", "\n", "if", "directTyp", ".", "Kind", "==", "KindStruct", "{", "for", "_", ",", "f", ":=", "range", "directTyp", ".", "Fields", "{", "if", "f", ".", "Type", ".", "Size", "!=", "0", "{", "directTyp", "=", "f", ".", "Type", "\n", "continue", "findDirect", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "directTyp", ".", "Kind", "!=", "KindFunc", "&&", "directTyp", ".", "Kind", "!=", "KindPtr", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "typ", ",", "typ", ".", "Kind", ",", "directTyp", ",", "directTyp", ".", "Kind", ")", ")", "\n", "}", "\n", "break", "\n", "}", "\n", "add", "(", "data", ",", "directTyp", ",", "1", ")", "\n", "case", "KindString", ":", "ptr", ":=", "r", ".", "ReadPtr", "(", "a", ")", "\n", "len", ":=", "r", ".", "ReadInt", "(", "a", ".", "Add", "(", "ptrSize", ")", ")", "\n", "add", "(", "ptr", ",", "t", ".", "Elem", ",", "len", ")", "\n", "case", "KindSlice", ":", "ptr", ":=", "r", ".", "ReadPtr", "(", "a", ")", "\n", "cap", ":=", "r", ".", "ReadInt", "(", "a", ".", "Add", "(", "2", "*", "ptrSize", ")", ")", "\n", "add", "(", "ptr", ",", "t", ".", "Elem", ",", "cap", ")", "\n", "case", "KindPtr", ":", "if", "t", ".", "Elem", "!=", "nil", "{", "// unsafe.Pointer has a nil Elem field.", "add", "(", "r", ".", "ReadPtr", "(", "a", ")", ",", "t", ".", "Elem", ",", "1", ")", "\n", "}", "\n", "case", "KindFunc", ":", "// The referent is a closure. We don't know much about the", "// type of the referent. Its first entry is a code pointer.", "// The runtime._type we want exists in the binary (for all", "// heap-allocated closures, anyway) but it would be hard to find", "// just given the pc.", "closure", ":=", "r", ".", "ReadPtr", "(", "a", ")", "\n", "if", "closure", "==", "0", "{", "break", "\n", "}", "\n", "pc", ":=", "p", ".", "proc", ".", "ReadPtr", "(", "closure", ")", "\n", "f", ":=", "p", ".", "funcTab", ".", "find", "(", "pc", ")", "\n", "if", "f", "==", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pc", ")", ")", "\n", "}", "\n", "ft", ":=", "f", ".", "closure", "\n", "if", "ft", "==", "nil", "{", "ft", "=", "&", "Type", "{", "Name", ":", "\"", "\"", "+", "f", ".", "name", ",", "Size", ":", "ptrSize", ",", "Kind", ":", "KindPtr", "}", "\n", "// For now, treat a closure like an unsafe.Pointer.", "// TODO: better value for size?", "f", ".", "closure", "=", "ft", "\n", "}", "\n", "p", ".", "typeObject", "(", "closure", ",", "ft", ",", "r", ",", "add", ")", "\n", "case", "KindArray", ":", "n", ":=", "t", ".", "Elem", ".", "Size", "\n", "for", "i", ":=", "int64", "(", "0", ")", ";", "i", "<", "t", ".", "Count", ";", "i", "++", "{", "p", ".", "typeObject", "(", "a", ".", "Add", "(", "i", "*", "n", ")", ",", "t", ".", "Elem", ",", "r", ",", "add", ")", "\n", "}", "\n", "case", "KindStruct", ":", "if", "strings", ".", "HasPrefix", "(", "t", ".", "Name", ",", "\"", "\"", ")", "{", "// Special case - maps have a pointer to the first bucket", "// but it really types all the buckets (like a slice would).", "var", "bPtr", "core", ".", "Address", "\n", "var", "bTyp", "*", "Type", "\n", "var", "n", "int64", "\n", "for", "_", ",", "f", ":=", "range", "t", ".", "Fields", "{", "if", "f", ".", "Name", "==", "\"", "\"", "{", "bPtr", "=", "p", ".", "proc", ".", "ReadPtr", "(", "a", ".", "Add", "(", "f", ".", "Off", ")", ")", "\n", "bTyp", "=", "f", ".", "Type", ".", "Elem", "\n", "}", "\n", "if", "f", ".", "Name", "==", "\"", "\"", "{", "n", "=", "int64", "(", "1", ")", "<<", "p", ".", "proc", ".", "ReadUint8", "(", "a", ".", "Add", "(", "f", ".", "Off", ")", ")", "\n", "}", "\n", "}", "\n", "add", "(", "bPtr", ",", "bTyp", ",", "n", ")", "\n", "// TODO: also oldbuckets", "}", "\n", "// TODO: also special case for channels?", "for", "_", ",", "f", ":=", "range", "t", ".", "Fields", "{", "p", ".", "typeObject", "(", "a", ".", "Add", "(", "f", ".", "Off", ")", ",", "f", ".", "Type", ",", "r", ",", "add", ")", "\n", "}", "\n", "default", ":", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "t", ".", "Kind", ")", ")", "\n", "}", "\n", "}" ]
23,090
all-23091
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "StickyPositionConstraint", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
23,091
all-23092
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SnapshotCommandLogParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
23,092
all-23093
[ "Sets", "the", "output", "path", "for", "generated", "snapshots", ".", "The", "directory", "will", "be", "created", "with", "the", "specified", "permission", "bits", "if", "it", "does", "not", "already", "exist", ".", "If", "perm", "is", "0", "a", "default", "of", "0755", "will", "be", "used", "." ]
[ "func", "(", "t", "*", "BTTracer", ")", "SetOutputPath", "(", "path", "string", ",", "perm", "<mask>", ".", "FileMode", ")", "error", "{", "if", "perm", "==", "0", "{", "perm", "=", "0755", "\n", "}", "\n\n", "if", "err", ":=", "os", ".", "MkdirAll", "(", "path", ",", "perm", ")", ";", "err", "!=", "nil", "{", "t", ".", "Logf", "(", "LogError", ",", "\"", "\\n", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n\n", "t", ".", "m", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "m", ".", "Unlock", "(", ")", "\n\n", "t", ".", "outputDir", "=", "path", "\n\n", "return", "nil", "\n", "}" ]
23,093
all-23094
[ "TODO", ":", "use", "balancer", ".", "epsToAddrs" ]
[ "func", "epsToAddrs", "(", "eps", "...", "string", ")", "(", "addrs", "[", "]", "resolver", ".", "Address", ")", "{", "addrs", "=", "make", "(", "[", "]", "resolver", ".", "Address", ",", "0", ",", "len", "(", "eps", ")", ")", "\n", "for", "_", ",", "ep", ":=", "range", "eps", "{", "addrs", "=", "<mask>", "(", "addrs", ",", "resolver", ".", "Address", "{", "Addr", ":", "ep", "}", ")", "\n", "}", "\n", "return", "addrs", "\n", "}" ]
23,094
all-23095
[ "BuildLoginRequest", "builds", "session", "create", "requests", "from", "users", "email", "and", "password", "." ]
[ "func", "(", "b", "*", "basicLoginRequestBuilder", ")", "BuildLoginRequest", "(", "host", "string", ")", "(", "*", "http", ".", "Request", ",", "error", ")", "{", "if", "<mask>", "==", "\"", "\"", "{", "host", "=", "\"", "\"", "\n", "}", "\n", "jsonStr", ":=", "fmt", ".", "Sprintf", "(", "`{\"email\":\"%s\",\"password\":\"%s\",\"account_href\":\"/api/accounts/%d\"}`", ",", "b", ".", "username", ",", "b", ".", "password", ",", "b", ".", "accountID", ")", "\n", "authReq", ",", "err", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "buildURL", "(", "host", ",", "\"", "\"", ")", ",", "bytes", ".", "NewBufferString", "(", "jsonStr", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "authReq", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "authReq", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "authReq", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "authReq", ",", "nil", "\n", "}" ]
23,095
all-23096
[ "Get", "a", "value", "from", "the", "ENV", ".", "If", "it", "doesn", "t", "exist", "the", "default", "value", "will", "be", "returned", "." ]
[ "func", "Get", "(", "key", "string", ",", "<mask>", "string", ")", "string", "{", "gil", ".", "RLock", "(", ")", "\n", "defer", "gil", ".", "RUnlock", "(", ")", "\n", "if", "v", ",", "ok", ":=", "env", "[", "key", "]", ";", "ok", "{", "return", "v", "\n", "}", "\n", "return", "value", "\n", "}" ]
23,096
all-23097
[ "GetNew", "returns", "a", "new", "previously", "unselected", "peer", "from", "the", "peer", "list", "or", "nil", "if", "no", "new", "unselected", "peer", "can", "be", "found", "." ]
[ "func", "(", "l", "*", "PeerList", ")", "GetNew", "(", "prevSelected", "map", "[", "string", "]", "struct", "{", "}", ")", "(", "*", "Peer", ",", "error", ")", "{", "l", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "Unlock", "(", ")", "\n", "if", "l", ".", "peerHeap", ".", "Len", "(", ")", "==", "0", "{", "return", "nil", ",", "ErrNoPeers", "\n", "}", "\n\n", "// Select a peer, avoiding previously selected peers. If all peers have been previously", "// selected, then it's OK to repick them.", "peer", ":=", "l", ".", "choosePeer", "(", "prevSelected", ",", "true", "/* avoidHost */", ")", "\n", "if", "<mask>", "==", "nil", "{", "peer", "=", "l", ".", "choosePeer", "(", "prevSelected", ",", "false", "/* avoidHost */", ")", "\n", "}", "\n", "if", "peer", "==", "nil", "{", "return", "nil", ",", "ErrNoNewPeers", "\n", "}", "\n", "return", "peer", ",", "nil", "\n", "}" ]
23,097
all-23098
[ "Int32", "returns", "param", "as", "int32" ]
[ "func", "(", "p", "Param", ")", "Int32", "(", ")", "(", "int32", ",", "error", ")", "{", "i", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "string", "(", "p", ")", ",", "10", ",", "32", ")", "\n", "return", "int32", "(", "i", ")", ",", "<mask>", "\n", "}" ]
23,098
all-23099
[ "Create", "takes", "the", "representation", "of", "a", "prowJob", "and", "creates", "it", ".", "Returns", "the", "server", "s", "representation", "of", "the", "prowJob", "and", "an", "error", "if", "there", "is", "any", "." ]
[ "func", "(", "c", "*", "prowJobs", ")", "Create", "(", "prowJob", "*", "v1", ".", "ProwJob", ")", "(", "result", "*", "v1", ".", "ProwJob", ",", "err", "error", ")", "{", "result", "=", "&", "v1", ".", "ProwJob", "{", "}", "\n", "err", "=", "c", ".", "<mask>", ".", "Post", "(", ")", ".", "Namespace", "(", "c", ".", "ns", ")", ".", "Resource", "(", "\"", "\"", ")", ".", "Body", "(", "prowJob", ")", ".", "Do", "(", ")", ".", "Into", "(", "result", ")", "\n", "return", "\n", "}" ]
23,099
all-23100
[ "This", "method", "loads", "basic", "config", "and", "returns", "a", "copy", "of", "the", "config", "object", "." ]
[ "func", "(", "s", "*", "SAMLAuthScheme", ")", "loadConfig", "(", ")", "(", "BaseConfig", ",", "error", ")", "{", "if", "s", ".", "BaseConfig", ".", "EntityID", "!=", "\"", "\"", "{", "return", "s", ".", "BaseConfig", ",", "nil", "\n", "}", "\n", "if", "s", ".", "Parser", "==", "nil", "{", "s", ".", "Parser", "=", "s", "\n", "}", "\n", "var", "emptyConfig", "BaseConfig", "\n", "publicCert", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "privateKey", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "idpURL", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "displayName", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "displayName", "=", "\"", "\"", "\n", "<mask>", ".", "Debugf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "description", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "description", "=", "\"", "\"", "\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "idpPublicCert", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "entityId", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "signRequest", ",", "err", ":=", "config", ".", "GetBool", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "signedResponse", ",", "err", ":=", "config", ".", "GetBool", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "emptyConfig", ",", "err", "\n", "}", "\n", "deflatEncodedResponse", ",", "err", ":=", "config", ".", "GetBool", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "deflatEncodedResponse", "=", "false", "\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "s", ".", "BaseConfig", "=", "BaseConfig", "{", "EntityID", ":", "entityId", ",", "DisplayName", ":", "displayName", ",", "Description", ":", "description", ",", "PublicCert", ":", "publicCert", ",", "PrivateKey", ":", "privateKey", ",", "IdpURL", ":", "idpURL", ",", "IdpPublicCert", ":", "idpPublicCert", ",", "SignRequest", ":", "signRequest", ",", "SignedResponse", ":", "signedResponse", ",", "DeflatEncodedResponse", ":", "deflatEncodedResponse", ",", "}", "\n", "return", "s", ".", "BaseConfig", ",", "nil", "\n", "}" ]