id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
2,200
all-2201
[ "GetModifiedOk", "returns", "a", "tuple", "with", "the", "Modified", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "DashboardLite", ")", "GetModifiedOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "d", "==", "nil", "||", "d", ".", "Modified", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "d", ".", "Modified", ",", "<mask>", "\n", "}" ]
2,201
all-2202
[ "From", "returns", "a", "copy", "of", "MailBuilder", "with", "the", "specified", "From", "header", "." ]
[ "func", "(", "p", "MailBuilder", ")", "From", "(", "name", ",", "addr", "string", ")", "MailBuilder", "{", "p", ".", "from", "=", "mail", ".", "Address", "{", "Name", ":", "name", ",", "<mask>", ":", "addr", "}", "\n", "return", "p", "\n", "}" ]
2,202
all-2203
[ "Set", "appends", "a", "value", "onto", "the", "strslice", "." ]
[ "func", "(", "ss", "*", "strslice", ")", "Set", "(", "value", "string", ")", "error", "{", "*", "ss", "=", "append", "(", "*", "ss", ",", "<mask>", ")", "\n", "return", "nil", "\n", "}" ]
2,203
all-2204
[ "Set", "is", "required", "for", "kingpin", "interfaces", "to", "allow", "command", "line", "params", "to", "be", "set", "to", "our", "map", "datatype" ]
[ "func", "(", "o", "*", "MapInt32Option", ")", "<mask>", "(", "value", "string", ")", "error", "{", "parts", ":=", "stringMapRegex", ".", "Split", "(", "value", ",", "2", ")", "\n", "if", "len", "(", "parts", ")", "!=", "2", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "value", ")", "\n", "}", "\n", "val", ":=", "Int32Option", "{", "}", "\n", "val", ".", "Set", "(", "parts", "[", "1", "]", ")", "\n", "(", "*", "o", ")", "[", "parts", "[", "0", "]", "]", "=", "val", "\n", "return", "nil", "\n", "}" ]
2,204
all-2205
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ApplicationCache", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache11", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
2,205
all-2206
[ "getDatacenter", "gets", "the", "higher", "-", "level", "datacenter", "object", "for", "the", "datacenter", "name", "supplied", "by", "dc", ".", "The", "default", "datacenter", "is", "denoted", "by", "using", "an", "empty", "string", ".", "When", "working", "with", "ESXi", "directly", "the", "default", "datacenter", "is", "always", "selected", "." ]
[ "func", "getDatacenter", "(", "c", "*", "govmomi", ".", "Client", ",", "dc", "string", ")", "(", "*", "object", ".", "Datacenter", ",", "error", ")", "{", "finder", ":=", "find", ".", "NewFinder", "(", "c", ".", "Client", ",", "true", ")", "\n", "t", ":=", "c", ".", "ServiceContent", ".", "About", ".", "ApiType", "\n", "switch", "t", "{", "case", "\"", "\"", ":", "return", "finder", ".", "DefaultDatacenter", "(", "context", ".", "TODO", "(", ")", ")", "\n", "case", "\"", "\"", ":", "if", "dc", "!=", "\"", "\"", "{", "return", "finder", ".", "Datacenter", "(", "context", ".", "TODO", "(", ")", ",", "dc", ")", "\n", "}", "\n", "return", "<mask>", ".", "DefaultDatacenter", "(", "context", ".", "TODO", "(", ")", ")", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "t", ")", "\n", "}" ]
2,206
all-2207
[ "ValidateClusterAndAssignIDs", "validates", "the", "local", "cluster", "by", "matching", "the", "PeerURLs", "with", "the", "existing", "cluster", ".", "If", "the", "validation", "succeeds", "it", "assigns", "the", "IDs", "from", "the", "existing", "cluster", "to", "the", "local", "cluster", ".", "If", "the", "validation", "fails", "an", "error", "will", "be", "returned", "." ]
[ "func", "ValidateClusterAndAssignIDs", "(", "lg", "*", "zap", ".", "Logger", ",", "local", "*", "RaftCluster", ",", "existing", "*", "RaftCluster", ")", "error", "{", "ems", ":=", "existing", ".", "Members", "(", ")", "\n", "lms", ":=", "local", ".", "Members", "(", ")", "\n", "if", "len", "(", "ems", ")", "!=", "len", "(", "lms", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "sort", ".", "Sort", "(", "MembersByPeerURLs", "(", "ems", ")", ")", "\n", "<mask>", ".", "Sort", "(", "MembersByPeerURLs", "(", "lms", ")", ")", "\n\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "TODO", "(", ")", ",", "30", "*", "time", ".", "Second", ")", "\n", "defer", "cancel", "(", ")", "\n", "for", "i", ":=", "range", "ems", "{", "if", "ok", ",", "err", ":=", "netutil", ".", "URLStringsEqual", "(", "ctx", ",", "lg", ",", "ems", "[", "i", "]", ".", "PeerURLs", ",", "lms", "[", "i", "]", ".", "PeerURLs", ")", ";", "!", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "lms", "[", "i", "]", ".", "ID", "=", "ems", "[", "i", "]", ".", "ID", "\n", "}", "\n", "local", ".", "members", "=", "make", "(", "map", "[", "types", ".", "ID", "]", "*", "Member", ")", "\n", "for", "_", ",", "m", ":=", "range", "lms", "{", "local", ".", "members", "[", "m", ".", "ID", "]", "=", "m", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,207
all-2208
[ "Scan", "takes", "a", "code", "input", "(", "i", ".", "e", ".", "from", "the", "user", ")", "and", "scans", "ahead", "within", "a", "certain", "window", "of", "counter", "values", ".", "This", "can", "be", "used", "in", "the", "case", "where", "the", "server", "s", "counter", "and", "the", "user", "s", "counter", "have", "fallen", "out", "of", "sync", "." ]
[ "func", "(", "otp", "*", "HOTP", ")", "Scan", "(", "<mask>", "string", ",", "window", "int", ")", "bool", "{", "var", "valid", "bool", "\n", "codeBytes", ":=", "[", "]", "byte", "(", "code", ")", "\n", "counter", ":=", "otp", ".", "Counter", "(", ")", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "window", ";", "i", "++", "{", "genCode", ":=", "[", "]", "byte", "(", "otp", ".", "OTP", "(", ")", ")", "\n", "if", "subtle", ".", "ConstantTimeCompare", "(", "codeBytes", ",", "genCode", ")", "==", "1", "{", "valid", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "!", "valid", "{", "otp", ".", "setCounter", "(", "counter", ")", "\n", "}", "\n", "return", "valid", "\n", "}" ]
2,208
all-2209
[ "retrieve", "the", "label", "of", "a", "sync", "object", "identified", "by", "a", "pointer" ]
[ "func", "GetObjectPtrLabel", "(", "ptr", "unsafe", ".", "Pointer", ",", "bufSize", "int32", ",", "length", "*", "int32", ",", "<mask>", "*", "uint8", ")", "{", "C", ".", "glowGetObjectPtrLabel", "(", "gpGetObjectPtrLabel", ",", "ptr", ",", "(", "C", ".", "GLsizei", ")", "(", "bufSize", ")", ",", "(", "*", "C", ".", "GLsizei", ")", "(", "unsafe", ".", "Pointer", "(", "length", ")", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "label", ")", ")", ")", "\n", "}" ]
2,209
all-2210
[ "OptFieldTypeMutex", "adds", "a", "mutex", "field", "." ]
[ "func", "OptFieldTypeMutex", "(", "cacheType", "CacheType", ",", "cacheSize", "int", ")", "FieldOption", "{", "return", "func", "(", "options", "*", "FieldOptions", ")", "{", "<mask>", ".", "fieldType", "=", "FieldTypeMutex", "\n", "options", ".", "cacheType", "=", "cacheType", "\n", "options", ".", "cacheSize", "=", "cacheSize", "\n", "}", "\n", "}" ]
2,210
all-2211
[ "GetExecutablePath", "returns", "the", "absolute", "path", "to", "the", "currently", "running", "executable", ".", "It", "is", "used", "internally", "by", "the", "godaemon", "package", "and", "exported", "publicly", "because", "it", "s", "useful", "outside", "of", "the", "package", "too", "." ]
[ "func", "GetExecutablePath", "(", ")", "(", "string", ",", "error", ")", "{", "buf", ":=", "make", "(", "[", "]", "uint16", ",", "syscall", ".", "MAX_PATH", "+", "1", ")", "\n\n", "res", ",", "_", ",", "err", ":=", "getModuleFileName", ".", "Call", "(", "0", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "&", "buf", "[", "0", "]", ")", ")", ",", "uintptr", "(", "len", "(", "buf", ")", ")", ")", "\n", "if", "res", "==", "0", "||", "<mask>", ">=", "syscall", ".", "MAX_PATH", "||", "buf", "[", "0", "]", "==", "0", "||", "buf", "[", "res", "-", "1", "]", "==", "0", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "res", ",", "err", ")", "\n", "}", "\n\n", "return", "string", "(", "utf16", ".", "Decode", "(", "buf", "[", ":", "res", "]", ")", ")", ",", "nil", "\n", "}" ]
2,211
all-2212
[ "MakeBufferWithLength", "allocates", "a", "new", "zero", "-", "filled", "buffer", "of", "a", "given", "length", ".", "Reference", ":", "https", ":", "//", "developer", ".", "apple", ".", "com", "/", "documentation", "/", "metal", "/", "mtldevice", "/", "1433375", "-", "newbufferwithlength" ]
[ "func", "(", "d", "Device", ")", "MakeBufferWithLength", "(", "length", "uintptr", ",", "opt", "ResourceOptions", ")", "Buffer", "{", "return", "Buffer", "{", "C", ".", "Device_MakeBufferWithLength", "(", "d", ".", "device", ",", "C", ".", "size_t", "(", "<mask>", ")", ",", "C", ".", "uint16_t", "(", "opt", ")", ")", "}", "\n", "}" ]
2,212
all-2213
[ "GetAsVersion", "indicates", "an", "expected", "call", "of", "GetAsVersion" ]
[ "func", "(", "mr", "*", "MockResultMockRecorder", ")", "GetAsVersion", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockResult", ")", "(", "nil", ")", ".", "GetAsVersion", ")", ",", "arg0", ")", "\n", "}" ]
2,213
all-2214
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventAnimationCreated", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation14", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
2,214
all-2215
[ "PangoContext", "*", "pango_context_new", "(", "void", ")", ";" ]
[ "func", "ContextNew", "(", ")", "*", "<mask>", "{", "c", ":=", "C", ".", "pango_context_new", "(", ")", "\n\n", "context", ":=", "new", "(", "Context", ")", "\n", "context", ".", "pangoContext", "=", "(", "*", "C", ".", "PangoContext", ")", "(", "c", ")", "\n\n", "return", "context", "\n", "}" ]
2,215
all-2216
[ "enableDVSNetworkResourceManagement", "exposes", "the", "EnableNetworkResourceManagement", "method", "of", "the", "DistributedVirtualSwitch", "MO", ".", "This", "local", "implementation", "may", "go", "away", "if", "this", "is", "exposed", "in", "the", "higher", "-", "level", "object", "upstream", "." ]
[ "func", "enableDVSNetworkResourceManagement", "(", "client", "*", "govmomi", ".", "Client", ",", "dvs", "*", "object", ".", "VmwareDistributedVirtualSwitch", ",", "enabled", "bool", ")", "error", "{", "req", ":=", "&", "types", ".", "EnableNetworkResourceManagement", "{", "This", ":", "dvs", ".", "Reference", "(", ")", ",", "Enable", ":", "enabled", ",", "}", "\n\n", "ctx", ",", "cancel", ":=", "<mask>", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "defaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "_", ",", "err", ":=", "methods", ".", "EnableNetworkResourceManagement", "(", "ctx", ",", "client", ",", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,216
all-2217
[ "Returns", "true", "if", "level", "zero", "may", "be", "compacted", "without", "accounting", "for", "compactions", "that", "already", "might", "be", "happening", "." ]
[ "func", "(", "s", "*", "levelsController", ")", "isLevel0Compactable", "(", ")", "bool", "{", "return", "s", ".", "levels", "[", "0", "]", ".", "numTables", "(", ")", ">=", "s", ".", "kv", ".", "<mask>", ".", "NumLevelZeroTables", "\n", "}" ]
2,217
all-2218
[ "fail", "panics", "with", "demangleErr", "to", "be", "caught", "in", "doDemangle", "." ]
[ "func", "(", "st", "*", "<mask>", ")", "fail", "(", "err", "string", ")", "{", "panic", "(", "demangleErr", "{", "err", ":", "err", ",", "off", ":", "st", ".", "off", "}", ")", "\n", "}" ]
2,218
all-2219
[ "putOneSignature", "stores", "one", "signature", "to", "url", ".", "NOTE", ":", "Keep", "this", "in", "sync", "with", "docs", "/", "signature", "-", "protocols", ".", "md!" ]
[ "func", "(", "d", "*", "dockerImageDestination", ")", "putOneSignature", "(", "url", "*", "url", ".", "URL", ",", "signature", "[", "]", "byte", ")", "error", "{", "switch", "url", ".", "Scheme", "{", "case", "\"", "\"", ":", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "url", ".", "<mask>", ")", "\n", "err", ":=", "os", ".", "MkdirAll", "(", "filepath", ".", "Dir", "(", "url", ".", "Path", ")", ",", "0755", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "ioutil", ".", "WriteFile", "(", "url", ".", "Path", ",", "signature", ",", "0644", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n\n", "case", "\"", "\"", ",", "\"", "\"", ":", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "url", ".", "Scheme", ",", "url", ".", "String", "(", ")", ")", "\n", "default", ":", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "url", ".", "String", "(", ")", ")", "\n", "}", "\n", "}" ]
2,219
all-2220
[ "LogEvent", "belongs", "to", "the", "Span", "interface" ]
[ "func", "(", "s", "*", "MockSpan", ")", "LogEvent", "(", "<mask>", "string", ")", "{", "s", ".", "LogFields", "(", "log", ".", "String", "(", "\"", "\"", ",", "event", ")", ")", "\n", "}" ]
2,220
all-2221
[ "native", "()", "returns", "a", "pointer", "to", "the", "underlying", "GMenu", "." ]
[ "func", "(", "m", "*", "<mask>", ")", "native", "(", ")", "*", "C", ".", "GMenu", "{", "if", "m", "==", "nil", "||", "m", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "m", ".", "GObject", ")", "\n", "return", "C", ".", "toGMenu", "(", "p", ")", "\n", "}" ]
2,221
all-2222
[ "GetAuthorizationToken", "calls", "the", "ecr", "api", "to", "get", "the", "docker", "auth", "for", "the", "specified", "registry" ]
[ "func", "(", "client", "*", "ecrClient", ")", "GetAuthorizationToken", "(", "registryId", "string", ")", "(", "*", "ecrapi", ".", "AuthorizationData", ",", "error", ")", "{", "<mask>", ".", "Debugf", "(", "\"", "\"", ",", "registryId", ")", "\n\n", "output", ",", "err", ":=", "client", ".", "sdkClient", ".", "GetAuthorizationToken", "(", "&", "ecrapi", ".", "GetAuthorizationTokenInput", "{", "RegistryIds", ":", "[", "]", "*", "string", "{", "aws", ".", "String", "(", "registryId", ")", "}", ",", "}", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "len", "(", "output", ".", "AuthorizationData", ")", "!=", "1", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "len", "(", "output", ".", "AuthorizationData", ")", ")", "\n", "}", "\n", "return", "output", ".", "AuthorizationData", "[", "0", "]", ",", "nil", "\n", "}" ]
2,222
all-2223
[ "GetText", "returns", "the", "Text", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetText", "(", ")", "string", "{", "if", "w", "==", "nil", "||", "w", ".", "Text", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "w", ".", "<mask>", "\n", "}" ]
2,223
all-2224
[ "AddAttribute", "()", "is", "a", "wrapper", "around", "gtk_tree_view_column_add_attribute", "()", "." ]
[ "func", "(", "v", "*", "TreeViewColumn", ")", "AddAttribute", "(", "renderer", "ICellRenderer", ",", "attribute", "string", ",", "column", "int", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "attribute", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_tree_view_column_add_attribute", "(", "v", ".", "native", "(", ")", ",", "renderer", ".", "toCellRenderer", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "C", ".", "gint", "(", "column", ")", ")", "\n", "}" ]
2,224
all-2225
[ "EveryGo", "calls", "the", "given", "ProcessFunc", "at", "periodic", "intervals", ".", "Internally", "it", "uses", "<", "-", "time", ".", "After", "(", "interval", ")", "This", "is", "not", "rate", "limited", "multiple", "calls", "could", "be", "in", "-", "flight", "at", "the", "same", "time", "." ]
[ "func", "EveryGo", "(", "interval", "time", ".", "Duration", ",", "procfunc", "gp", ".", "ProcessFunc", ")", "gp", ".", "Process", "{", "return", "gp", ".", "Go", "(", "func", "(", "proc", "gp", ".", "Process", ")", "{", "for", "{", "select", "{", "<mask>", "<-", "time", ".", "After", "(", "interval", ")", ":", "proc", ".", "Go", "(", "procfunc", ")", "\n", "case", "<-", "proc", ".", "Closing", "(", ")", ":", "// we're told to close", "return", "\n", "}", "\n", "}", "\n", "}", ")", "\n", "}" ]
2,225
all-2226
[ "Do", "executes", "Browser", ".", "getHistograms", "against", "the", "provided", "context", ".", "returns", ":", "histograms", "-", "Histograms", "." ]
[ "func", "(", "p", "*", "GetHistogramsParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "histograms", "[", "]", "*", "Histogram", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetHistogramsReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetHistograms", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Histograms", ",", "nil", "\n", "}" ]
2,226
all-2227
[ "ReadResponse", "reads", "a", "server", "response", "into", "the", "received", "o", "." ]
[ "func", "(", "o", "*", "DeleteAppsAppReader", ")", "ReadResponse", "(", "response", "runtime", ".", "ClientResponse", ",", "consumer", "runtime", ".", "Consumer", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "switch", "response", ".", "Code", "(", ")", "{", "case", "200", ":", "result", ":=", "NewDeleteAppsAppOK", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n\n", "case", "404", ":", "result", ":=", "NewDeleteAppsAppNotFound", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "result", "\n\n", "default", ":", "result", ":=", "NewDeleteAppsAppDefault", "(", "response", ".", "Code", "(", ")", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "<mask>", ".", "Code", "(", ")", "/", "100", "==", "2", "{", "return", "result", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "result", "\n", "}", "\n", "}" ]
2,227
all-2228
[ "FetchOutlierReport", "retrieves", "outlier", "report", "with", "passed", "cid", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchOutlierReport", "(", "cid", "CIDType", ")", "(", "*", "OutlierReport", ",", "error", ")", "{", "if", "cid", "==", "nil", "||", "*", "cid", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "reportCID", ":=", "string", "(", "*", "cid", ")", "\n\n", "matched", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "OutlierReportCIDRegex", ",", "reportCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "reportCID", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "reportCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "result", ")", ")", "\n", "}", "\n\n", "report", ":=", "&", "OutlierReport", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "report", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "report", ",", "nil", "\n", "}" ]
2,228
all-2229
[ "SetBlackboxedRanges", "makes", "backend", "skip", "steps", "in", "the", "script", "in", "blackboxed", "ranges", ".", "VM", "will", "try", "leave", "blacklisted", "scripts", "by", "performing", "step", "in", "several", "times", "finally", "resorting", "to", "step", "out", "if", "unsuccessful", ".", "Positions", "array", "contains", "positions", "where", "blackbox", "state", "is", "changed", ".", "First", "interval", "isn", "t", "blackboxed", ".", "Array", "should", "be", "sorted", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "Debugger#method", "-", "setBlackboxedRanges", "parameters", ":", "scriptID", "-", "Id", "of", "the", "script", ".", "positions" ]
[ "func", "SetBlackboxedRanges", "(", "scriptID", "runtime", ".", "ScriptID", ",", "positions", "[", "]", "*", "ScriptPosition", ")", "*", "SetBlackboxedRangesParams", "{", "<mask>", "&", "SetBlackboxedRangesParams", "{", "ScriptID", ":", "scriptID", ",", "Positions", ":", "positions", ",", "}", "\n", "}" ]
2,229
all-2230
[ "WriteTo", "writes", "data", "to", "w", "." ]
[ "func", "(", "e", "*", "helperMethodCSS", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "var", "bf", "bytes", ".", "<mask>", "\n\n", "// Write an open tag.", "bf", ".", "WriteString", "(", "lt", ")", "\n", "bf", ".", "WriteString", "(", "`style type=\"text/css\"`", ")", "\n", "bf", ".", "WriteString", "(", "gt", ")", "\n\n", "bf", ".", "WriteString", "(", "lf", ")", "\n\n", "// Write the children's HTML.", "if", "i", ",", "err", ":=", "e", ".", "writeChildren", "(", "&", "bf", ")", ";", "err", "!=", "nil", "{", "return", "i", ",", "err", "\n", "}", "\n\n", "// Write an open tag.", "bf", ".", "WriteString", "(", "lt", ")", "\n", "bf", ".", "WriteString", "(", "slash", ")", "\n", "bf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "bf", ".", "WriteString", "(", "gt", ")", "\n\n", "// Write the buffer.", "i", ",", "err", ":=", "w", ".", "Write", "(", "bf", ".", "Bytes", "(", ")", ")", "\n\n", "return", "int64", "(", "i", ")", ",", "err", "\n", "}" ]
2,230
all-2231
[ "Call", "the", "parent", "CloseNotify", ".", "Provided", "in", "order", "to", "implement", "the", "http", ".", "CloseNotifier", "interface", "." ]
[ "func", "(", "w", "*", "jsonpResponseWriter", ")", "CloseNotify", "(", ")", "<-", "chan", "bool", "{", "notifier", ":=", "w", ".", "ResponseWriter", ".", "(", "<mask>", ".", "CloseNotifier", ")", "\n", "return", "notifier", ".", "CloseNotify", "(", ")", "\n", "}" ]
2,231
all-2232
[ "Register", "starts", "handling", "signals", "." ]
[ "func", "(", "h", "*", "Handler", ")", "Register", "(", ")", "{", "go", "func", "(", ")", "{", "h", ".", "timer", "=", "time", ".", "NewTimer", "(", "time", ".", "Duration", "(", "h", ".", "timeoutSeconds", ")", "*", "time", ".", "Second", ")", "\n", "for", "{", "select", "{", "case", "s", ":=", "<-", "h", ".", "signals", ":", "switch", "{", "case", "s", "==", "os", ".", "Interrupt", ":", "if", "h", ".", "signalReceived", "==", "0", "{", "h", ".", "signalReceived", "=", "1", "\n", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n", "continue", "\n", "}", "\n", "h", ".", "signalReceived", "=", "signalTerminate", "\n", "debug", ".", "PrintStack", "(", ")", "\n", "os", ".", "Exit", "(", "130", ")", "\n", "break", "\n", "case", "s", "==", "syscall", ".", "SIGQUIT", ":", "h", ".", "signalReceived", "=", "signalAbort", "\n", "break", "\n", "case", "s", "==", "syscall", ".", "SIGTERM", ":", "h", ".", "signalReceived", "=", "signalTerminate", "\n", "os", ".", "Exit", "(", "3", ")", "\n", "break", "\n", "}", "\n", "<mask>", "<-", "h", ".", "timer", ".", "C", ":", "os", ".", "Exit", "(", "4", ")", "\n", "break", "\n", "}", "\n", "}", "\n\n", "}", "(", ")", "\n", "}" ]
2,232
all-2233
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "FrameResource", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage47", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
2,233
all-2234
[ "FilterMatched", "returns", "true", "if", "the", "set", "of", "input", "filters", "match", "the", "feature", "s", "tags", "." ]
[ "func", "(", "s", "*", "Scenario", ")", "FilterMatched", "(", "f", "*", "Feature", ",", "filters", "...", "string", ")", "bool", "{", "t", ":=", "[", "]", "string", "{", "}", "\n", "t", "=", "append", "(", "t", ",", "f", ".", "Tags", "...", ")", "\n", "t", "=", "<mask>", "(", "t", ",", "s", ".", "Tags", "...", ")", "\n", "return", "matchTags", "(", "t", ",", "filters", ")", "\n", "}" ]
2,234
all-2235
[ "/", "*", "Comparison", "can", "either", "be", "between", "numbers", "or", "lexicographic", "between", "two", "strings", "but", "never", "between", "the", "two", "." ]
[ "func", "comparatorTypeCheck", "(", "left", "interface", "{", "}", ",", "right", "interface", "{", "}", ")", "bool", "{", "if", "isFloat64", "(", "left", ")", "&&", "isFloat64", "(", "right", ")", "{", "return", "true", "\n", "}", "\n", "if", "isString", "(", "left", ")", "&&", "isString", "(", "<mask>", ")", "{", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
2,235
all-2236
[ "IsEmpty", "returns", "true", "when", "the", "rule", "contains", "none", "of", "the", "attributes", "in", "attrs", "for", "its", "kind", ".", "attrs", "should", "contain", "attributes", "that", "make", "the", "rule", "buildable", "like", "srcs", "or", "deps", "and", "not", "descriptive", "attributes", "like", "name", "or", "visibility", "." ]
[ "func", "(", "r", "*", "Rule", ")", "IsEmpty", "(", "info", "KindInfo", ")", "bool", "{", "if", "info", ".", "NonEmptyAttrs", "==", "nil", "{", "return", "false", "\n", "}", "\n", "for", "k", ":=", "range", "info", ".", "NonEmptyAttrs", "{", "if", "_", ",", "ok", ":=", "r", ".", "attrs", "[", "k", "]", ";", "<mask>", "{", "return", "false", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
2,236
all-2237
[ "org", "/", "repo#number", "-", ">", "pr" ]
[ "func", "byRepoAndNumber", "(", "prs", "[", "]", "PullRequest", ")", "map", "[", "string", "]", "PullRequest", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "PullRequest", ")", "\n", "for", "_", ",", "pr", ":=", "<mask>", "prs", "{", "key", ":=", "prKey", "(", "&", "pr", ")", "\n", "m", "[", "key", "]", "=", "pr", "\n", "}", "\n", "return", "m", "\n", "}" ]
2,237
all-2238
[ "WithPayload", "adds", "the", "payload", "to", "the", "update", "Vm", "with", "state", "o", "k", "response" ]
[ "func", "(", "o", "*", "UpdateVMWithStateOK", ")", "WithPayload", "(", "payload", "<mask>", ")", "*", "UpdateVMWithStateOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
2,238
all-2239
[ "InitPProf", "registers", "pprof", "handlers", "to", "the", "ServeMux", ".", "The", "pprof", "handlers", "can", "be", "specified", "a", "customized", "prefix", "." ]
[ "func", "(", "mux", "*", "ServerMux", ")", "InitPProf", "(", "prefix", "string", ")", "{", "if", "prefix", "==", "\"", "\"", "{", "prefix", "=", "\"", "\"", "\n", "}", "\n", "mux", ".", "HandleFunc", "(", "router", ".", "Wildcard", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "prefix", ")", ")", ",", "WrapHTTPHandlerFunc", "(", "pprofIndex", "(", "prefix", ")", ")", ",", "nil", ")", "\n", "mux", ".", "HandleFunc", "(", "router", ".", "Simple", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "prefix", ")", ")", ",", "WrapHTTPHandlerFunc", "(", "http", ".", "HandlerFunc", "(", "pprof", ".", "Cmdline", ")", ")", ",", "nil", ")", "\n", "mux", ".", "HandleFunc", "(", "router", ".", "Simple", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "prefix", ")", ")", ",", "WrapHTTPHandlerFunc", "(", "http", ".", "HandlerFunc", "(", "pprof", ".", "Profile", ")", ")", ",", "nil", ")", "\n", "mux", ".", "HandleFunc", "(", "router", ".", "Simple", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ")", ")", ",", "WrapHTTPHandlerFunc", "(", "http", ".", "HandlerFunc", "(", "pprof", ".", "Symbol", ")", ")", ",", "nil", ")", "\n", "}" ]
2,239
all-2240
[ "Select", "a", "broker", "for", "use", "when", "creating", "a", "check", "if", "a", "specific", "broker", "was", "not", "specified", "." ]
[ "func", "(", "cm", "*", "CheckManager", ")", "selectBroker", "(", ")", "(", "*", "api", ".", "Broker", ",", "error", ")", "{", "var", "brokerList", "*", "[", "]", "api", ".", "Broker", "\n", "var", "err", "error", "\n", "enterpriseType", ":=", "\"", "\"", "\n\n", "if", "len", "(", "cm", ".", "brokerSelectTag", ")", ">", "0", "{", "filter", ":=", "api", ".", "SearchFilterType", "{", "\"", "\"", ":", "cm", ".", "brokerSelectTag", ",", "}", "\n", "brokerList", ",", "err", "=", "cm", ".", "apih", ".", "SearchBrokers", "(", "nil", ",", "&", "filter", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "else", "{", "brokerList", ",", "err", "=", "cm", ".", "apih", ".", "FetchBrokers", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "*", "brokerList", ")", "==", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "validBrokers", ":=", "make", "(", "map", "[", "string", "]", "api", ".", "Broker", ")", "\n", "haveEnterprise", ":=", "false", "\n\n", "for", "_", ",", "broker", ":=", "<mask>", "*", "brokerList", "{", "broker", ":=", "broker", "\n", "if", "cm", ".", "isValidBroker", "(", "&", "broker", ")", "{", "validBrokers", "[", "broker", ".", "CID", "]", "=", "broker", "\n", "if", "broker", ".", "Type", "==", "enterpriseType", "{", "haveEnterprise", "=", "true", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "haveEnterprise", "{", "// eliminate non-enterprise brokers from valid brokers", "for", "k", ",", "v", ":=", "range", "validBrokers", "{", "if", "v", ".", "Type", "!=", "enterpriseType", "{", "delete", "(", "validBrokers", ",", "k", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "validBrokers", ")", "==", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "len", "(", "*", "brokerList", ")", ")", "\n", "}", "\n\n", "validBrokerKeys", ":=", "reflect", ".", "ValueOf", "(", "validBrokers", ")", ".", "MapKeys", "(", ")", "\n", "selectedBroker", ":=", "validBrokers", "[", "validBrokerKeys", "[", "rand", ".", "Intn", "(", "len", "(", "validBrokerKeys", ")", ")", "]", ".", "String", "(", ")", "]", "\n\n", "if", "cm", ".", "Debug", "{", "cm", ".", "Log", ".", "Printf", "(", "\"", "\\n", "\"", ",", "selectedBroker", ".", "Name", ")", "\n", "}", "\n\n", "return", "&", "selectedBroker", ",", "nil", "\n\n", "}" ]
2,240
all-2241
[ "Connect", "indicates", "an", "expected", "call", "of", "Connect" ]
[ "func", "(", "mr", "*", "MockClientServerMockRecorder", ")", "Connect", "(", ")", "*", "gomock", ".", "Call", "{", "<mask>", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockClientServer", ")", "(", "nil", ")", ".", "Connect", ")", ")", "\n", "}" ]
2,241
all-2242
[ "Vec3Add", "performs", "a", "vector", "addition", ".", "dest", "=", "v1", "+", "v2", "dest", "[", "out", "]", "The", "result", "vector", ".", "v1", "[", "in", "]", "The", "base", "vector", ".", "v2", "[", "in", "]", "The", "vector", "to", "add", "to", "v1", "." ]
[ "func", "Vec3Add", "(", "<mask>", ",", "v1", ",", "v2", "Vec3", ")", "{", "dest", "[", "0", "]", "=", "v1", "[", "0", "]", "+", "v2", "[", "0", "]", "\n", "dest", "[", "1", "]", "=", "v1", "[", "1", "]", "+", "v2", "[", "1", "]", "\n", "dest", "[", "2", "]", "=", "v1", "[", "2", "]", "+", "v2", "[", "2", "]", "\n", "}" ]
2,242
all-2243
[ "CheckoutPullRequest", "does", "exactly", "that", "." ]
[ "func", "(", "r", "*", "Repo", ")", "CheckoutPullRequest", "(", "number", "int", ")", "error", "{", "r", ".", "logger", ".", "Infof", "(", "\"", "\"", ",", "r", ".", "repo", ",", "number", ")", "\n", "if", "b", ",", "err", ":=", "retryCmd", "(", "r", ".", "logger", ",", "r", ".", "Dir", ",", "r", ".", "git", ",", "\"", "\"", ",", "r", ".", "base", "+", "\"", "\"", "+", "r", ".", "repo", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "number", ",", "number", ")", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "number", ",", "err", ",", "string", "(", "b", ")", ")", "\n", "}", "\n", "co", ":=", "r", ".", "gitCommand", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ")", ")", "\n", "if", "b", ",", "err", ":=", "co", ".", "CombinedOutput", "(", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "number", ",", "err", ",", "string", "(", "b", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,243
all-2244
[ "IsReady", "returns", "a", "boolean", "value", "indicating", "whether", "the", "audio", "is", "ready", "or", "not", ".", "On", "some", "browsers", "user", "interaction", "like", "click", "or", "pressing", "keys", "is", "required", "to", "start", "audio", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "IsReady", "(", ")", "bool", "{", "c", ".", "m", ".", "Lock", "(", ")", "\n", "r", ":=", "c", ".", "ready", "\n", "c", ".", "m", ".", "Unlock", "(", ")", "\n", "return", "r", "\n", "}" ]
2,244
all-2245
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "get", "tasks", "params" ]
[ "func", "(", "o", "*", "GetTasksParams", ")", "WithTimeout", "(", "timeout", "<mask>", ".", "Duration", ")", "*", "GetTasksParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
2,245
all-2246
[ "RunCommand", "is", "the", "entrypoint", "to", "the", "client", ".", "Sends", "an", "arbitray", "command", "string", "to", "HAProxy", "." ]
[ "func", "(", "h", "*", "HAProxyClient", ")", "RunCommand", "(", "cmd", "string", ")", "(", "*", "<mask>", ".", "Buffer", ",", "error", ")", "{", "err", ":=", "h", ".", "dial", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "h", ".", "conn", ".", "Close", "(", ")", "\n\n", "result", ":=", "bytes", ".", "NewBuffer", "(", "nil", ")", "\n\n", "_", ",", "err", "=", "h", ".", "conn", ".", "Write", "(", "[", "]", "byte", "(", "cmd", "+", "\"", "\\n", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "_", ",", "err", "=", "io", ".", "Copy", "(", "result", ",", "h", ".", "conn", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "strings", ".", "HasPrefix", "(", "result", ".", "String", "(", ")", ",", "\"", "\"", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "cmd", ")", "\n", "}", "\n\n", "return", "result", ",", "nil", "\n", "}" ]
2,246
all-2247
[ "NewCloser", "constructs", "a", "new", "Closer", "with", "an", "initial", "count", "on", "the", "WaitGroup", "." ]
[ "func", "NewCloser", "(", "initial", "int", ")", "*", "Closer", "{", "ret", ":=", "&", "Closer", "{", "closed", ":", "<mask>", "(", "chan", "struct", "{", "}", ")", "}", "\n", "ret", ".", "waiting", ".", "Add", "(", "initial", ")", "\n", "return", "ret", "\n", "}" ]
2,247
all-2248
[ "Currently", "populateCache", "takes", "a", "transformer", "due", "to", "the", "fact", "that", "a", "fetchCachedDirectory", "uses", "only", "a", "TarTransformer", "which", "overwrites", "what", "is", "currently", "set", ".", "This", "way", "one", "transformer", "can", "be", "used", "to", "call", "Fetch", "and", "FetchAsDirectory" ]
[ "func", "(", "c", "*", "cachedDownloader", ")", "populateCache", "(", "logger", "lager", ".", "Logger", ",", "url", "*", "url", ".", "URL", ",", "name", "string", ",", "cachingInfo", "CachingInfoType", ",", "checksum", "ChecksumInfoType", ",", "transformer", "CacheTransformer", ",", "cancelChan", "<-", "chan", "struct", "{", "}", ",", ")", "(", "download", ",", "bool", ",", "int64", ",", "error", ")", "{", "filename", ",", "cachingInfo", ",", "err", ":=", "c", ".", "downloader", ".", "Download", "(", "logger", ",", "url", ",", "func", "(", ")", "(", "*", "os", ".", "File", ",", "error", ")", "{", "return", "ioutil", ".", "TempFile", "(", "c", ".", "uncachedPath", ",", "name", "+", "\"", "\"", ")", "\n", "}", ",", "cachingInfo", ",", "checksum", ",", "cancelChan", ")", "\n", "if", "err", "!=", "nil", "{", "return", "download", "{", "}", ",", "false", ",", "0", ",", "err", "\n", "}", "\n\n", "if", "filename", "==", "\"", "\"", "{", "return", "download", "{", "}", ",", "true", ",", "0", ",", "nil", "\n", "}", "\n\n", "fileInfo", ",", "err", ":=", "os", ".", "Stat", "(", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "return", "download", "{", "}", ",", "false", ",", "0", ",", "err", "\n", "}", "\n", "defer", "os", ".", "Remove", "(", "filename", ")", "\n\n", "cachedFile", ",", "err", ":=", "ioutil", ".", "TempFile", "(", "c", ".", "uncachedPath", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "download", "{", "}", ",", "false", ",", "0", ",", "err", "\n", "}", "\n\n", "err", "=", "cachedFile", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "download", "{", "}", ",", "false", ",", "0", ",", "err", "\n", "}", "\n\n", "cachedSize", ",", "err", ":=", "transformer", "(", "filename", ",", "cachedFile", ".", "Name", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "<mask>", "{", "}", ",", "false", ",", "0", ",", "err", "\n", "}", "\n\n", "return", "download", "{", "path", ":", "cachedFile", ".", "Name", "(", ")", ",", "size", ":", "cachedSize", ",", "cachingInfo", ":", "cachingInfo", ",", "}", ",", "false", ",", "fileInfo", ".", "Size", "(", ")", ",", "nil", "\n", "}" ]
2,248
all-2249
[ "flattenClusterDpmConfigInfo", "saves", "a", "ClusterDpmConfigInfo", "into", "the", "supplied", "ResourceData", "." ]
[ "func", "flattenClusterDpmConfigInfo", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "<mask>", ".", "ClusterDpmConfigInfo", ")", "error", "{", "return", "structure", ".", "SetBatch", "(", "d", ",", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "obj", ".", "DefaultDpmBehavior", ",", "\"", "\"", ":", "obj", ".", "Enabled", ",", "\"", "\"", ":", "obj", ".", "HostPowerActionRate", ",", "}", ")", "\n", "}" ]
2,249
all-2250
[ "Wrap", "initializes", "the", "buffer", "to", "read", "from", "the", "given", "byte", "slice" ]
[ "func", "(", "r", "*", "ReadBuffer", ")", "Wrap", "(", "b", "[", "]", "byte", ")", "{", "r", ".", "<mask>", "=", "b", "\n", "r", ".", "remaining", "=", "b", "\n", "r", ".", "err", "=", "nil", "\n", "}" ]
2,250
all-2251
[ "Return", "the", "names", "of", "the", "nodes", "the", "given", "pool", "is", "defined", "on", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "storagePoolNodes", "(", "poolID", "int64", ")", "(", "[", "]", "string", ",", "error", ")", "{", "stmt", ":=", "`\nSELECT nodes.name FROM nodes\n JOIN storage_pools_nodes ON storage_pools_nodes.node_id = nodes.id\n WHERE storage_pools_nodes.storage_pool_id = ?\n`", "\n", "<mask>", "nodes", "[", "]", "string", "\n", "err", ":=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "var", "err", "error", "\n", "nodes", ",", "err", "=", "query", ".", "SelectStrings", "(", "tx", ".", "tx", ",", "stmt", ",", "poolID", ")", "\n", "return", "err", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nodes", ",", "nil", "\n", "}" ]
2,251
all-2252
[ "Const", "returns", "the", "package", "-", "level", "constant", "of", "the", "specified", "name", "or", "nil", "if", "not", "found", "." ]
[ "func", "(", "p", "*", "Package", ")", "Const", "(", "name", "string", ")", "(", "c", "*", "NamedConst", ")", "{", "c", ",", "_", "=", "p", ".", "Members", "[", "<mask>", "]", ".", "(", "*", "NamedConst", ")", "\n", "return", "\n", "}" ]
2,252
all-2253
[ "GetPageSet", "()", "is", "a", "wrapper", "around", "gtk_print_settings_get_page_set", "()", "." ]
[ "func", "(", "ps", "*", "PrintSettings", ")", "GetPageSet", "(", "<mask>", "PrintPages", ")", "PageSet", "{", "c", ":=", "C", ".", "gtk_print_settings_get_page_set", "(", "ps", ".", "native", "(", ")", ")", "\n", "return", "PageSet", "(", "c", ")", "\n", "}" ]
2,253
all-2254
[ "UnmarshalYAML", "implements", "the", "yaml", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "c", "*", "AlertingConfig", ")", "UnmarshalYAML", "(", "unmarshal", "func", "(", "<mask>", "{", "}", ")", "error", ")", "error", "{", "// Create a clean global config as the previous one was already populated", "// by the default due to the YAML parser behavior for empty blocks.", "*", "c", "=", "AlertingConfig", "{", "}", "\n", "type", "plain", "AlertingConfig", "\n", "if", "err", ":=", "unmarshal", "(", "(", "*", "plain", ")", "(", "c", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "for", "_", ",", "rlcfg", ":=", "range", "c", ".", "AlertRelabelConfigs", "{", "if", "rlcfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,254
all-2255
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "LayoutViewport", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage28", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
2,255
all-2256
[ "WriteGzip", "writes", "gzipped", "p", "to", "w", "and", "returns", "the", "number", "of", "compressed", "bytes", "written", "to", "w", "." ]
[ "func", "WriteGzip", "(", "w", "io", ".", "<mask>", ",", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "return", "WriteGzipLevel", "(", "w", ",", "p", ",", "CompressDefaultCompression", ")", "\n", "}" ]
2,256
all-2257
[ "SortIssueChan", "reads", "issues", "from", "one", "channel", "sorts", "them", "and", "returns", "them", "to", "another", "channel" ]
[ "func", "SortIssueChan", "(", "issues", "chan", "*", "Issue", ",", "order", "[", "]", "string", ")", "chan", "*", "Issue", "{", "out", ":=", "make", "(", "chan", "*", "Issue", ",", "1000000", ")", "\n", "sorted", ":=", "&", "sortedIssues", "{", "issues", ":", "[", "]", "*", "Issue", "{", "}", ",", "order", ":", "order", ",", "}", "\n", "<mask>", "func", "(", ")", "{", "for", "issue", ":=", "range", "issues", "{", "sorted", ".", "issues", "=", "append", "(", "sorted", ".", "issues", ",", "issue", ")", "\n", "}", "\n", "sort", ".", "Sort", "(", "sorted", ")", "\n", "for", "_", ",", "issue", ":=", "range", "sorted", ".", "issues", "{", "out", "<-", "issue", "\n", "}", "\n", "close", "(", "out", ")", "\n", "}", "(", ")", "\n", "return", "out", "\n", "}" ]
2,257
all-2258
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventConsoleProfileStarted", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler22", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
2,258
all-2259
[ "ImageAliasUpdate", "updates", "the", "alias", "with", "the", "given", "ID", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImageAliasUpdate", "(", "id", "int", ",", "imageID", "int", ",", "desc", "string", ")", "error", "{", "stmt", ":=", "`UPDATE images_aliases SET image_id=?, description=? WHERE id=?`", "\n", "err", ":=", "<mask>", "(", "c", ".", "db", ",", "stmt", ",", "imageID", ",", "desc", ",", "id", ")", "\n", "return", "err", "\n", "}" ]
2,259
all-2260
[ "C", "returns", "a", "value", "representing", "the", "named", "collection", ".", "Creating", "this", "value", "is", "a", "very", "lightweight", "operation", "and", "involves", "no", "network", "communication", "." ]
[ "func", "(", "db", "*", "Database", ")", "C", "(", "name", "string", ")", "*", "Collection", "{", "return", "&", "Collection", "{", "db", ",", "name", ",", "<mask>", ".", "Name", "+", "\"", "\"", "+", "name", "}", "\n", "}" ]
2,260
all-2261
[ "Return", "string", "for", "minor", "number", "of", "nvidia", "device", "corresponding", "to", "the", "given", "pci", "id" ]
[ "func", "findNvidiaMinor", "(", "pci", "string", ")", "(", "string", ",", "error", ")", "{", "nvidiaPath", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pci", ")", "\n", "buf", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "nvidiaPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "strBuf", ":=", "strings", ".", "TrimSpace", "(", "string", "(", "buf", ")", ")", "\n", "idx", ":=", "strings", ".", "Index", "(", "strBuf", ",", "\"", "\"", ")", "\n", "if", "idx", "!=", "-", "1", "{", "idx", "+=", "len", "(", "\"", "\"", ")", "\n", "strBuf", "=", "strBuf", "[", "idx", ":", "]", "\n", "strBuf", "=", "strings", ".", "TrimSpace", "(", "strBuf", ")", "\n", "<mask>", ":=", "strings", ".", "SplitN", "(", "strBuf", ",", "\"", "\\n", "\"", ",", "2", ")", "\n", "_", ",", "err", "=", "strconv", ".", "Atoi", "(", "parts", "[", "0", "]", ")", "\n", "if", "err", "==", "nil", "{", "return", "parts", "[", "0", "]", ",", "nil", "\n", "}", "\n", "}", "\n\n", "minor", ",", "err", ":=", "findNvidiaMinorOld", "(", ")", "\n", "if", "err", "==", "nil", "{", "return", "minor", ",", "nil", "\n", "}", "\n\n", "return", "\"", "\"", ",", "err", "\n", "}" ]
2,261
all-2262
[ "UpdateDashboard", "updates", "passed", "dashboard", "." ]
[ "func", "(", "a", "*", "API", ")", "UpdateDashboard", "(", "cfg", "*", "Dashboard", ")", "(", "*", "Dashboard", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "dashboardCID", ":=", "string", "(", "cfg", ".", "CID", ")", "\n\n", "matched", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "DashboardCIDRegex", ",", "dashboardCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "dashboardCID", ")", "\n", "}", "\n\n", "jsonCfg", ",", "err", ":=", "json", ".", "Marshal", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "jsonCfg", ")", ")", "\n", "}", "\n\n", "<mask>", ",", "err", ":=", "a", ".", "Put", "(", "dashboardCID", ",", "jsonCfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "dashboard", ":=", "&", "Dashboard", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "dashboard", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "dashboard", ",", "nil", "\n", "}" ]
2,262
all-2263
[ "expandClusterDependencyRuleInfo", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "ClusterDependencyRuleInfo", "." ]
[ "func", "expandClusterDependencyRuleInfo", "(", "d", "*", "schema", ".", "ResourceData", ")", "(", "*", "<mask>", ".", "ClusterDependencyRuleInfo", ",", "error", ")", "{", "obj", ":=", "&", "types", ".", "ClusterDependencyRuleInfo", "{", "ClusterRuleInfo", ":", "types", ".", "ClusterRuleInfo", "{", "Enabled", ":", "structure", ".", "GetBool", "(", "d", ",", "\"", "\"", ")", ",", "Mandatory", ":", "structure", ".", "GetBool", "(", "d", ",", "\"", "\"", ")", ",", "Name", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "UserCreated", ":", "structure", ".", "BoolPtr", "(", "true", ")", ",", "}", ",", "DependsOnVmGroup", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "VmGroup", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "}", "\n", "return", "obj", ",", "nil", "\n", "}" ]
2,263
all-2264
[ "Dereference", "decrements", "the", "refcount", "of", "the", "matching", "peer", ".", "TODO", "(", "pb", ")", ":", "this", "is", "an", "awkward", "way", "to", "use", "the", "mutex", ";", "consider", "refactoring" ]
[ "func", "(", "peers", "*", "Peers", ")", "dereference", "(", "peer", "*", "Peer", ")", "{", "peers", ".", "Lock", "(", ")", "\n", "defer", "peers", ".", "Unlock", "(", ")", "\n", "<mask>", ".", "localRefCount", "--", "\n", "}" ]
2,264
all-2265
[ "Render", "implements", "the", "Render", "interface", ".", "This", "is", "called", "from", "queue", "context", "so", "be", "careful", "to", "not", "use", "blocking", "calls", "." ]
[ "func", "(", "l", "*", "<mask>", ")", "Render", "(", ")", "{", "if", "len", "(", "l", ".", "content", ")", "==", "0", "||", "l", ".", "visibility", "==", "VisibilityHide", "{", "return", "\n", "}", "\n\n", "l", ".", "Display", "(", "Current", ")", "\n", "}" ]
2,265
all-2266
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ActivateTargetParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget32", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
2,266
all-2267
[ "Open", "requests", "the", "S3", "object", "at", "url", ".", "An", "HTTP", "status", "other", "than", "200", "is", "considered", "an", "error", ".", "If", "c", "is", "nil", "Open", "uses", "DefaultConfig", "." ]
[ "func", "Open", "(", "url", "string", ",", "c", "*", "Config", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "if", "c", "==", "nil", "{", "c", "=", "DefaultConfig", "\n", "}", "\n", "// TODO(kr): maybe parallel range fetching", "r", ",", "_", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "url", ",", "nil", ")", "\n", "r", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "time", ".", "Now", "(", ")", ".", "UTC", "(", ")", ".", "Format", "(", "http", ".", "TimeFormat", ")", ")", "\n", "c", ".", "Sign", "(", "r", ",", "*", "c", ".", "Keys", ")", "\n", "client", ":=", "c", ".", "<mask>", "\n", "if", "client", "==", "nil", "{", "client", "=", "http", ".", "DefaultClient", "\n", "}", "\n", "resp", ",", "err", ":=", "client", ".", "Do", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "resp", ".", "StatusCode", "!=", "200", "{", "return", "nil", ",", "newRespError", "(", "resp", ")", "\n", "}", "\n", "return", "resp", ".", "Body", ",", "nil", "\n", "}" ]
2,267
all-2268
[ "getImage", "loads", "the", "specified", "image", "object", "." ]
[ "func", "(", "c", "*", "openshiftClient", ")", "getImage", "(", "ctx", "context", ".", "Context", ",", "imageStreamImageName", "string", ")", "(", "*", "image", ",", "error", ")", "{", "// FIXME: validate components per validation.IsValidPathSegmentName?", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "<mask>", ".", "namespace", ",", "c", ".", "ref", ".", "stream", ",", "imageStreamImageName", ")", "\n", "body", ",", "err", ":=", "c", ".", "doRequest", "(", "ctx", ",", "\"", "\"", ",", "path", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "// Note: This does absolutely no kind/version checking or conversions.", "var", "isi", "imageStreamImage", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "body", ",", "&", "isi", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "isi", ".", "Image", ",", "nil", "\n", "}" ]
2,268
all-2269
[ "TriggerIncidentKeyWithDetails", "triggers", "an", "incident", "using", "the", "default", "client", "with", "a", "given", "incident", "key", "only", "if", "that", "incident", "has", "been", "resolved", "or", "if", "that", "incident", "doesn", "t", "exist", "yet", "." ]
[ "func", "TriggerIncidentKeyWithDetails", "(", "description", "string", ",", "key", "string", ",", "details", "map", "[", "string", "]", "<mask>", "{", "}", ")", "(", "incidentKey", "string", ",", "err", "error", ")", "{", "return", "trigger", "(", "description", ",", "key", ",", "details", ")", "\n", "}" ]
2,269
all-2270
[ "FileServer", "conveniently", "sets", "up", "a", "http", ".", "FileServer", "handler", "to", "serve", "static", "files", "from", "a", "http", ".", "FileSystem", "." ]
[ "func", "FileServer", "(", "r", "chi", ".", "Router", ",", "path", "string", ",", "root", "http", ".", "FileSystem", ")", "{", "if", "strings", ".", "ContainsAny", "(", "path", ",", "\"", "\"", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "fs", ":=", "<mask>", ".", "StripPrefix", "(", "path", ",", "http", ".", "FileServer", "(", "root", ")", ")", "\n\n", "if", "path", "!=", "\"", "\"", "&&", "path", "[", "len", "(", "path", ")", "-", "1", "]", "!=", "'/'", "{", "r", ".", "Get", "(", "path", ",", "http", ".", "RedirectHandler", "(", "path", "+", "\"", "\"", ",", "301", ")", ".", "ServeHTTP", ")", "\n", "path", "+=", "\"", "\"", "\n", "}", "\n", "path", "+=", "\"", "\"", "\n\n", "r", ".", "Get", "(", "path", ",", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "fs", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", ")", ")", "\n", "}" ]
2,270
all-2271
[ "AddCreditSection", "is", "a", "wrapper", "around", "gtk_about_dialog_add_credit_section", "()", "." ]
[ "func", "(", "v", "*", "AboutDialog", ")", "AddCreditSection", "(", "sectionName", "string", ",", "people", "[", "]", "string", ")", "{", "cname", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "sectionName", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cname", ")", ")", "\n\n", "cpeople", ":=", "C", ".", "make_strings", "(", "C", ".", "int", "(", "len", "(", "people", ")", ")", "+", "1", ")", "\n", "defer", "C", ".", "destroy_strings", "(", "cpeople", ")", "\n", "for", "i", ",", "p", ":=", "<mask>", "people", "{", "cp", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "p", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cp", ")", ")", "\n", "C", ".", "set_string", "(", "cpeople", ",", "C", ".", "int", "(", "i", ")", ",", "cp", ")", "\n", "}", "\n", "C", ".", "set_string", "(", "cpeople", ",", "C", ".", "int", "(", "len", "(", "people", ")", ")", ",", "nil", ")", "\n\n", "C", ".", "gtk_about_dialog_add_credit_section", "(", "v", ".", "native", "(", ")", ",", "cname", ",", "cpeople", ")", "\n", "}" ]
2,271
all-2272
[ "RemoveEntity", "removes", "the", "entity", "across", "all", "systems", "." ]
[ "func", "(", "w", "*", "World", ")", "RemoveEntity", "(", "e", "BasicEntity", ")", "{", "for", "_", ",", "sys", ":=", "<mask>", "w", ".", "systems", "{", "sys", ".", "Remove", "(", "e", ")", "\n", "}", "\n", "}" ]
2,272
all-2273
[ "ReadHeaders", "reads", "key", "-", "value", "pairs", "encoded", "using", "WriteHeaders", "." ]
[ "func", "ReadHeaders", "(", "r", "io", ".", "Reader", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "<mask>", ":=", "typed", ".", "NewReader", "(", "r", ")", "\n", "m", ",", "err", ":=", "readHeaders", "(", "reader", ")", "\n", "reader", ".", "Release", "(", ")", "\n\n", "return", "m", ",", "err", "\n", "}" ]
2,273
all-2274
[ "GetImageNamesCount", "returns", "number", "of", "image", "names" ]
[ "func", "(", "imageState", "*", "ImageState", ")", "GetImageNamesCount", "(", ")", "int", "{", "imageState", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "imageState", ".", "lock", ".", "RUnlock", "(", ")", "\n", "return", "len", "(", "imageState", ".", "<mask>", ".", "Names", ")", "\n", "}" ]
2,274
all-2275
[ "Values", "matches", "the", "regexp", "and", "returns", "the", "results", "for", "positional", "and", "named", "groups", ".", "Positional", "values", "are", "stored", "using", "an", "empty", "string", "as", "key", ".", "If", "the", "string", "doesn", "t", "match", "it", "returns", "nil", "." ]
[ "func", "(", "r", "*", "Regexp", ")", "Values", "(", "s", "string", ")", "<mask>", ".", "Values", "{", "match", ":=", "r", ".", "compiled", ".", "FindStringSubmatch", "(", "s", ")", "\n", "if", "match", "!=", "nil", "{", "values", ":=", "url", ".", "Values", "{", "}", "\n", "for", "k", ",", "v", ":=", "range", "r", ".", "groups", "{", "values", ".", "Add", "(", "v", ",", "match", "[", "r", ".", "indices", "[", "k", "]", "]", ")", "\n", "}", "\n", "return", "values", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,275
all-2276
[ "InputLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "InputLocator", "(", "href", "<mask>", ")", "*", "InputLocator", "{", "return", "&", "InputLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
2,276
all-2277
[ "loadConfigs", "loads", "the", "configuration", "from", "the", "list", "of", "paths", ".", "The", "optional", "configuration", "is", "the", "list", "of", "overrides", "to", "apply", "at", "the", "very", "end", "taking", "precedence", "over", "any", "configurations", "that", "were", "loaded", "from", "the", "paths", ".", "If", "any", "errors", "occur", "when", "reading", "or", "parsing", "those", "sub", "-", "configs", "it", "is", "returned", "." ]
[ "func", "loadConfigs", "(", "paths", "[", "]", "string", ",", "o", "*", "config", ".", "Config", ")", "(", "*", "config", ".", "Config", ",", "error", ")", "{", "finalC", ":=", "config", ".", "DefaultConfig", "(", ")", "\n\n", "for", "_", ",", "<mask>", ":=", "range", "paths", "{", "c", ",", "err", ":=", "config", ".", "FromPath", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "finalC", "=", "finalC", ".", "Merge", "(", "c", ")", "\n", "}", "\n\n", "finalC", "=", "finalC", ".", "Merge", "(", "o", ")", "\n", "finalC", ".", "Finalize", "(", ")", "\n", "return", "finalC", ",", "nil", "\n", "}" ]
2,277
all-2278
[ "Exec", "executes", "the", "replacePixelsCommand", "." ]
[ "func", "(", "c", "*", "replacePixelsCommand", ")", "Exec", "(", "indexOffset", "int", ")", "error", "{", "c", ".", "dst", ".", "image", ".", "ReplacePixels", "(", "c", ".", "pixels", ",", "c", ".", "x", ",", "c", ".", "y", ",", "c", ".", "<mask>", ",", "c", ".", "height", ")", "\n", "return", "nil", "\n", "}" ]
2,278
all-2279
[ "FirstByButton", "finds", "the", "first", "button", "element", "with", "the", "provided", "text", ".", "Supports", "<button", ">", "<input", "type", "=", "button", ">", "and", "<input", "type", "=", "submit", ">", "." ]
[ "func", "(", "s", "*", "selectable", ")", "FirstByButton", "(", "text", "string", ")", "*", "Selection", "{", "return", "newSelection", "(", "s", ".", "session", ",", "s", ".", "selectors", ".", "Append", "(", "target", ".", "Button", ",", "<mask>", ")", ".", "At", "(", "0", ")", ")", "\n", "}" ]
2,279
all-2280
[ "Index", "returns", "the", "0", "-", "based", "index", "of", "the", "first", "occurrence", "of", "the", "given", "value", "within", "the", "range", ".", "If", "the", "value", "does", "not", "exist", "in", "the", "range", "a", "value", "of", "-", "1", "will", "be", "returned", "." ]
[ "func", "(", "l", "*", "InclusiveRanges", ")", "Index", "(", "<mask>", "int", ")", "int", "{", "var", "idx", ",", "n", "int", "\n\n", "for", "_", ",", "b", ":=", "range", "l", ".", "blocks", "{", "// If the value is within the current block", "// then return the local index, offset by the", "// number of previous values we have tracked", "if", "idx", "=", "b", ".", "Index", "(", "value", ")", ";", "idx", ">=", "0", "{", "return", "idx", "+", "n", "\n", "}", "\n", "// Update the offset for the values we have seen", "n", "+=", "b", ".", "Len", "(", ")", "\n", "}", "\n\n", "// The previous loop ended in error", "return", "-", "1", "\n", "}" ]
2,280
all-2281
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetLayoutMetricsParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage37", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
2,281
all-2282
[ "GetFile", "uses", "GitHub", "repo", "contents", "API", "to", "retrieve", "the", "content", "of", "a", "file", "with", "commit", "SHA", ".", "If", "commit", "is", "empty", "it", "will", "grab", "content", "from", "repo", "s", "default", "branch", "usually", "master", ".", "TODO", "(", "krzyzacy", ")", ":", "Support", "retrieve", "a", "directory", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "repos", "/", "contents", "/", "#get", "-", "contents" ]
[ "func", "(", "c", "*", "Client", ")", "GetFile", "(", "org", ",", "repo", ",", "filepath", ",", "commit", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "repo", ",", "filepath", ",", "commit", ")", "\n\n", "<mask>", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "filepath", ")", "\n", "if", "commit", "!=", "\"", "\"", "{", "url", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ",", "commit", ")", "\n", "}", "\n\n", "var", "res", "Content", "\n", "code", ",", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "method", ":", "http", ".", "MethodGet", ",", "path", ":", "url", ",", "exitCodes", ":", "[", "]", "int", "{", "200", ",", "404", "}", ",", "}", ",", "&", "res", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "code", "==", "404", "{", "return", "nil", ",", "&", "FileNotFound", "{", "org", ":", "org", ",", "repo", ":", "repo", ",", "path", ":", "filepath", ",", "commit", ":", "commit", ",", "}", "\n", "}", "\n\n", "decoded", ",", "err", ":=", "base64", ".", "StdEncoding", ".", "DecodeString", "(", "res", ".", "Content", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "res", ".", "Content", ",", "err", ")", "\n", "}", "\n\n", "return", "decoded", ",", "nil", "\n", "}" ]
2,282
all-2283
[ "overrideDNS", "overrides", "a", "container", "s", "host", "config", "if", "the", "following", "conditions", "are", "true", ":", "1", ".", "Task", "has", "an", "ENI", "associated", "with", "it", "2", ".", "ENI", "has", "custom", "DNS", "IPs", "and", "search", "list", "associated", "with", "it", "This", "should", "only", "be", "done", "for", "the", "pause", "container", "as", "other", "containers", "inherit", "/", "etc", "/", "resolv", ".", "conf", "of", "this", "container", "(", "they", "share", "the", "network", "namespace", ")" ]
[ "func", "(", "task", "*", "Task", ")", "overrideDNS", "(", "hostConfig", "*", "dockercontainer", ".", "HostConfig", ")", "*", "dockercontainer", ".", "HostConfig", "{", "eni", ":=", "<mask>", ".", "GetTaskENI", "(", ")", "\n", "if", "eni", "==", "nil", "{", "return", "hostConfig", "\n", "}", "\n\n", "hostConfig", ".", "DNS", "=", "eni", ".", "DomainNameServers", "\n", "hostConfig", ".", "DNSSearch", "=", "eni", ".", "DomainNameSearchList", "\n\n", "return", "hostConfig", "\n", "}" ]
2,283
all-2284
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetDownloadBehaviorParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage11", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
2,284
all-2285
[ "getUserMachineAddrAndOpts", "is", "a", "helper", "for", "NewOnUserMachine", "that", "uses", "environment", "variables", "config", "files", "etc", "to", "figure", "out", "which", "address", "a", "user", "running", "a", "command", "should", "connect", "to", "." ]
[ "func", "getUserMachineAddrAndOpts", "(", "cfg", "*", "config", ".", "Config", ")", "(", "string", ",", "[", "]", "Option", ",", "error", ")", "{", "// 1) PACHD_ADDRESS environment variable (shell-local) overrides global config", "if", "envAddr", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "\"", "\"", ")", ";", "ok", "{", "if", "!", "strings", ".", "Contains", "(", "envAddr", ",", "\"", "\"", ")", "{", "envAddr", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "envAddr", ",", "DefaultPachdNodePort", ")", "\n", "}", "\n", "options", ",", "err", ":=", "getCertOptionsFromEnv", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "nil", ",", "err", "\n", "}", "\n", "return", "envAddr", ",", "options", ",", "nil", "\n", "}", "\n\n", "// 2) Get target address from global config if possible", "if", "cfg", "!=", "nil", "&&", "cfg", ".", "V1", "!=", "nil", "&&", "cfg", ".", "V1", ".", "PachdAddress", "!=", "\"", "\"", "{", "// Also get cert info from config (if set)", "if", "cfg", ".", "V1", ".", "ServerCAs", "!=", "\"", "\"", "{", "pemBytes", ",", "err", ":=", "base64", ".", "StdEncoding", ".", "DecodeString", "(", "cfg", ".", "V1", ".", "ServerCAs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "cfg", ".", "V1", ".", "PachdAddress", ",", "[", "]", "Option", "{", "WithAdditionalRootCAs", "(", "pemBytes", ")", "}", ",", "nil", "\n", "}", "\n", "return", "cfg", ".", "V1", ".", "PachdAddress", ",", "nil", ",", "nil", "\n", "}", "\n\n", "// 3) Use default address (broadcast) if nothing else works", "options", ",", "err", ":=", "getCertOptionsFromEnv", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "nil", ",", "err", "\n", "}", "\n", "return", "\"", "\"", ",", "<mask>", ",", "nil", "\n", "}" ]
2,285
all-2286
[ "HasTitleAlign", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "EventTimelineDefinition", ")", "HasTitleAlign", "(", ")", "bool", "{", "if", "e", "!=", "nil", "&&", "e", ".", "TitleAlign", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
2,286
all-2287
[ "HasFillMax", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "h", "*", "HostmapStyle", ")", "HasFillMax", "(", ")", "bool", "{", "if", "h", "!=", "nil", "&&", "h", ".", "FillMax", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
2,287
all-2288
[ "UpdateProvisionBroker", "updates", "a", "broker", "definition", "[", "request", "]", "." ]
[ "func", "(", "a", "*", "API", ")", "UpdateProvisionBroker", "(", "cid", "CIDType", ",", "cfg", "*", "ProvisionBroker", ")", "(", "*", "ProvisionBroker", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "cid", "==", "nil", "||", "*", "cid", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "brokerCID", ":=", "string", "(", "*", "cid", ")", "\n\n", "matched", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "ProvisionBrokerCIDRegex", ",", "brokerCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "brokerCID", ")", "\n", "}", "\n\n", "jsonCfg", ",", "err", ":=", "json", ".", "Marshal", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "jsonCfg", ")", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Put", "(", "brokerCID", ",", "jsonCfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "broker", ":=", "&", "ProvisionBroker", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "broker", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "broker", ",", "nil", "\n", "}" ]
2,288
all-2289
[ "simplify", "replaces", "template", "parameters", "with", "their", "expansions", "and", "merges", "qualifiers", "." ]
[ "func", "simplify", "(", "a", "AST", ")", "AST", "{", "var", "seen", "[", "]", "AST", "\n", "skip", ":=", "func", "(", "a", "AST", ")", "bool", "{", "for", "_", ",", "v", ":=", "range", "seen", "{", "if", "v", "==", "a", "{", "return", "true", "\n", "}", "\n", "}", "\n", "seen", "=", "append", "(", "<mask>", ",", "a", ")", "\n", "return", "false", "\n", "}", "\n", "if", "r", ":=", "a", ".", "Copy", "(", "simplifyOne", ",", "skip", ")", ";", "r", "!=", "nil", "{", "return", "r", "\n", "}", "\n", "return", "a", "\n", "}" ]
2,289
all-2290
[ "Create", "a", "new", "Key", ".", "Note", "the", "Secret", "is", "only", "returned", "in", "response", "to", "a", "Create", "you", "can", "t", "retrieve", "it", "later", ".", "https", ":", "//", "www", ".", "twilio", ".", "com", "/", "docs", "/", "api", "/", "rest", "/", "keys#list", "-", "post" ]
[ "func", "(", "c", "*", "KeyService", ")", "Create", "(", "ctx", "context", ".", "Context", ",", "data", "url", ".", "Values", ")", "(", "*", "Key", ",", "error", ")", "{", "key", ":=", "new", "(", "Key", ")", "\n", "err", ":=", "c", ".", "client", ".", "CreateResource", "(", "ctx", ",", "keyPathPart", ",", "<mask>", ",", "key", ")", "\n", "return", "key", ",", "err", "\n", "}" ]
2,290
all-2291
[ "NewRateScale", "creates", "a", "new", "rate", "instruments", "with", "the", "given", "unit", "." ]
[ "func", "NewRateScale", "(", "d", "time", ".", "Duration", ")", "*", "Rate", "{", "return", "&", "Rate", "{", "time", ":", "<mask>", ".", "Now", "(", ")", ".", "UnixNano", "(", ")", ",", "unit", ":", "d", ".", "Seconds", "(", ")", ",", "}", "\n", "}" ]
2,291
all-2292
[ "ListDevices", "()", "is", "a", "wrapper", "around", "gdk_device_manager_list_devices", "()", "." ]
[ "func", "(", "v", "*", "DeviceManager", ")", "ListDevices", "(", "tp", "DeviceType", ")", "*", "glib", ".", "List", "{", "clist", ":=", "C", ".", "gdk_device_manager_list_devices", "(", "v", ".", "native", "(", ")", ",", "C", ".", "GdkDeviceType", "(", "tp", ")", ")", "\n", "if", "clist", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "//TODO: WrapList should set the finalizer", "glist", ":=", "glib", ".", "WrapList", "(", "uintptr", "(", "unsafe", ".", "Pointer", "(", "clist", ")", ")", ")", "\n", "glist", ".", "DataWrapper", "(", "func", "(", "ptr", "unsafe", ".", "Pointer", ")", "interface", "{", "}", "{", "return", "&", "<mask>", "{", "&", "glib", ".", "Object", "{", "glib", ".", "ToGObject", "(", "ptr", ")", "}", "}", "\n", "}", ")", "\n", "runtime", ".", "SetFinalizer", "(", "glist", ",", "func", "(", "glist", "*", "glib", ".", "List", ")", "{", "glist", ".", "Free", "(", ")", "\n", "}", ")", "\n", "return", "glist", "\n", "}" ]
2,292
all-2293
[ "GetPaperSize", "()", "is", "a", "wrapper", "around", "gtk_page_setup_get_paper_size", "()", "." ]
[ "func", "(", "ps", "*", "PageSetup", ")", "GetPaperSize", "(", ")", "*", "PaperSize", "{", "c", ":=", "C", ".", "gtk_page_setup_get_paper_size", "(", "ps", ".", "native", "(", ")", ")", "\n", "p", ":=", "&", "PaperSize", "{", "c", "}", "\n", "runtime", ".", "SetFinalizer", "(", "p", ",", "(", "*", "PaperSize", ")", ".", "<mask>", ")", "\n", "return", "p", "\n", "}" ]
2,293
all-2294
[ "title", ":", "node", "container", "info", "path", ":", "/", "docker", "/", "nodecontainers", "/", "{", "name", "}", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "Ok", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "nodeContainerInfo", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "pools", ",", "err", ":=", "permission", ".", "ListContextValues", "(", "t", ",", "permission", ".", "PermNodecontainerRead", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "name", ":=", "r", ".", "<mask>", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "configMap", ",", "err", ":=", "nodecontainer", ".", "LoadNodeContainersForPools", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "nodecontainer", ".", "ErrNodeContainerNotFound", "{", "return", "&", "tsuruErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", ",", "}", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "if", "pools", "!=", "nil", "{", "poolMap", ":=", "map", "[", "string", "]", "struct", "{", "}", "{", "}", "\n", "for", "_", ",", "p", ":=", "range", "pools", "{", "poolMap", "[", "p", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "for", "poolName", ":=", "range", "configMap", "{", "if", "poolName", "==", "\"", "\"", "{", "continue", "\n", "}", "\n", "if", "_", ",", "ok", ":=", "poolMap", "[", "poolName", "]", ";", "!", "ok", "{", "delete", "(", "configMap", ",", "poolName", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "configMap", ")", "\n", "}" ]
2,294
all-2295
[ "SetShowOther", "()", "is", "a", "wrapper", "around", "gtk_app_chooser_widget_set_show_other", "()", "." ]
[ "func", "(", "v", "*", "AppChooserWidget", ")", "SetShowOther", "(", "<mask>", "bool", ")", "{", "C", ".", "gtk_app_chooser_widget_set_show_other", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "setting", ")", ")", "\n", "}" ]
2,295
all-2296
[ "PSCGetOfferingInfo", "calls", "getOfferingInfo", "of", "Privatix", "service", "contract", "." ]
[ "func", "(", "b", "*", "backendInstance", ")", "PSCGetOfferingInfo", "(", "opts", "*", "bind", ".", "CallOpts", ",", "hash", "[", "common", ".", "HashLength", "]", "byte", ")", "(", "agentAddr", "common", ".", "Address", ",", "minDeposit", "uint64", ",", "maxSupply", "uint16", ",", "currentSupply", "uint16", ",", "updateBlockNumber", "uint32", ",", "active", "bool", ",", "err", "error", ")", "{", "ctx2", ",", "cancel", ":=", "b", ".", "addTimeout", "(", "opts", ".", "<mask>", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "opts", ".", "Context", "=", "ctx2", "\n\n", "agentAddr", ",", "minDeposit", ",", "maxSupply", ",", "currentSupply", ",", "updateBlockNumber", ",", "err", "=", "b", ".", "psc", ".", "GetOfferingInfo", "(", "opts", ",", "hash", ")", "\n", "active", "=", "updateBlockNumber", "!=", "0", "\n", "if", "err", "!=", "nil", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "agentAddr", ",", "minDeposit", ",", "maxSupply", ",", "currentSupply", ",", "updateBlockNumber", ",", "active", ",", "err", "\n", "}" ]
2,296
all-2297
[ "FormatRecord", "describes", "the", "record", "in", "a", "human", "-", "readable", "manner", "for", "inclusion", "into", "build", "logs" ]
[ "func", "FormatRecord", "(", "record", "Record", ")", "string", "{", "output", ":=", "bytes", ".", "Buffer", "{", "}", "\n", "if", "<mask>", ".", "Failed", "{", "fmt", ".", "Fprintln", "(", "&", "output", ",", "\"", "\"", ")", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "&", "output", ",", "\"", "\"", ",", "record", ".", "Refs", ".", "Org", ",", "record", ".", "Refs", ".", "Repo", ",", "record", ".", "Refs", ".", "BaseRef", ")", "\n", "if", "record", ".", "Refs", ".", "BaseSHA", "!=", "\"", "\"", "{", "fmt", ".", "Fprintf", "(", "&", "output", ",", "\"", "\"", ",", "record", ".", "Refs", ".", "BaseSHA", ")", "\n", "}", "\n", "output", ".", "WriteString", "(", "\"", "\\n", "\"", ")", "\n", "if", "len", "(", "record", ".", "Refs", ".", "Pulls", ")", ">", "0", "{", "output", ".", "WriteString", "(", "\"", "\\n", "\"", ")", "\n", "for", "_", ",", "pull", ":=", "range", "record", ".", "Refs", ".", "Pulls", "{", "fmt", ".", "Fprintf", "(", "&", "output", ",", "\"", "\\t", "\"", ",", "pull", ".", "Number", ")", "\n", "if", "pull", ".", "SHA", "!=", "\"", "\"", "{", "fmt", ".", "Fprintf", "(", "&", "output", ",", "\"", "\"", ",", "pull", ".", "SHA", ")", "\n", "}", "\n", "fmt", ".", "Fprint", "(", "&", "output", ",", "\"", "\\n", "\"", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "command", ":=", "range", "record", ".", "Commands", "{", "fmt", ".", "Fprintf", "(", "&", "output", ",", "\"", "\\n", "\"", ",", "command", ".", "Command", ")", "\n", "fmt", ".", "Fprint", "(", "&", "output", ",", "command", ".", "Output", ")", "\n", "if", "command", ".", "Error", "!=", "\"", "\"", "{", "fmt", ".", "Fprintf", "(", "&", "output", ",", "\"", "\\n", "\"", ",", "command", ".", "Error", ")", "\n", "}", "\n", "}", "\n\n", "return", "output", ".", "String", "(", ")", "\n", "}" ]
2,297
all-2298
[ "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "19747207", "/", "rethinkdb", "-", "index", "-", "for", "-", "filter", "-", "orderby", "TODO", ":", "fix", "index", "selection", "it", "should", "favour", "compound", "indexes", "more" ]
[ "func", "(", "s", "RethinkStore", ")", "getRootTerm", "(", "store", "string", ",", "filter", "map", "[", "string", "]", "interface", "{", "}", ",", "opts", "ObjectStoreOptions", ",", "args", "...", "interface", "{", "}", ")", "(", "rootTerm", "r", ".", "Term", ")", "{", "rootTerm", "=", "r", ".", "DB", "(", "s", ".", "Database", ")", ".", "Table", "(", "store", ")", "\n", "var", "hasIndex", "=", "false", "\n", "var", "hasMultiIndex", "=", "false", "\n", "var", "indexName", "string", "\n", "var", "indexVal", "string", "\n", "if", "opts", "!=", "nil", "{", "indexes", ":=", "opts", ".", "GetIndexes", "(", ")", "\n", "logger", ".", "Info", "(", "\"", "\"", ",", "\"", "\"", ",", "indexes", ")", "\n", "for", "name", ":=", "range", "indexes", "{", "if", "val", ",", "ok", ":=", "filter", "[", "name", "]", ".", "(", "string", ")", ";", "ok", "{", "hasIndex", "=", "true", "\n", "indexVal", "=", "val", "\n", "indexName", "=", "name", "\n", "ix_id_name", ":=", "name", "+", "\"", "\"", "\n", "if", "_", ",", "ok", ":=", "indexes", "[", "ix_id_name", "]", ";", "ok", "{", "indexName", "=", "ix_id_name", "\n", "hasMultiIndex", "=", "true", "\n", "break", "\n", "}", "\n", "break", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "!", "hasIndex", "{", "if", "len", "(", "args", ")", "==", "0", "{", "rootTerm", "=", "rootTerm", ".", "OrderBy", "(", "r", ".", "OrderByOpts", "{", "Index", ":", "r", ".", "Desc", "(", "\"", "\"", ")", "}", ")", "\n", "}", "\n", "}", "else", "{", "if", "hasMultiIndex", "{", "rootTerm", "=", "rootTerm", ".", "Between", "(", "[", "]", "interface", "{", "}", "{", "indexVal", ",", "r", ".", "MinVal", "}", ",", "[", "]", "interface", "{", "}", "{", "indexVal", ",", "r", ".", "MaxVal", "}", ",", "r", ".", "BetweenOpts", "{", "Index", ":", "indexName", ",", "RightBound", ":", "\"", "\"", "}", ")", ".", "OrderBy", "(", "r", ".", "OrderByOpts", "{", "<mask>", ":", "r", ".", "Desc", "(", "indexName", ")", "}", ")", "\n", "}", "else", "{", "rootTerm", "=", "rootTerm", ".", "GetAllByIndex", "(", "indexName", ",", "indexVal", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "filter", ")", ">", "0", "{", "rootTerm", "=", "rootTerm", ".", "Filter", "(", "s", ".", "transformFilter", "(", "nil", ",", "filter", ")", ")", "\n", "}", "\n", "return", "\n", "}" ]
2,298
all-2299
[ "SetSwarmConfigFromFlags", "configures", "the", "driver", "for", "swarm" ]
[ "func", "(", "d", "*", "BaseDriver", ")", "SetSwarmConfigFromFlags", "(", "flags", "DriverOptions", ")", "{", "d", ".", "SwarmMaster", "=", "flags", ".", "Bool", "(", "\"", "\"", ")", "\n", "d", ".", "SwarmHost", "=", "<mask>", ".", "String", "(", "\"", "\"", ")", "\n", "d", ".", "SwarmDiscovery", "=", "flags", ".", "String", "(", "\"", "\"", ")", "\n", "}" ]
2,299
all-2300
[ "Items", "emits", "items", "." ]
[ "func", "Items", "(", "items", "...", "string", ")", "Filter", "{", "return", "FilterFunc", "(", "func", "(", "arg", "Arg", ")", "error", "{", "for", "_", ",", "s", ":=", "range", "<mask>", "{", "arg", ".", "Out", "<-", "s", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]