id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
23,900
all-23901
[ "ReceiveIssueEvent", "injects", "an", "extra", "opened", "event", "before", "calling", "plugin", ".", "ReceiveIssueEvent", "()" ]
[ "func", "(", "o", "*", "FakeOpenPluginWrapper", ")", "ReceiveIssueEvent", "(", "event", "sql", ".", "IssueEvent", ")", "[", "]", "Point", "{", "points", ":=", "[", "]", "<mask>", "{", "}", "\n\n", "// Inject extra \"opened\" events. Inject \"opened\" before other events at the same time.", "for", "o", ".", "openEvents", ".", "Len", "(", ")", ">", "0", "&&", "!", "o", ".", "openEvents", "[", "0", "]", ".", "EventCreatedAt", ".", "After", "(", "event", ".", "EventCreatedAt", ")", "{", "points", "=", "append", "(", "points", ",", "o", ".", "plugin", ".", "ReceiveIssueEvent", "(", "heap", ".", "Pop", "(", "&", "o", ".", "openEvents", ")", ".", "(", "sql", ".", "IssueEvent", ")", ")", "...", ")", "\n", "}", "\n\n", "return", "append", "(", "points", ",", "o", ".", "plugin", ".", "ReceiveIssueEvent", "(", "event", ")", "...", ")", "\n", "}" ]
23,901
all-23902
[ "ReadNewLogs", "returns", "new", "log", "messages", "of", "the", "provided", "log", "type", ".", "For", "example", "page", ".", "ReadNewLogs", "(", "browser", ")", "returns", "browser", "console", "logs", "such", "as", "JavaScript", "logs", "and", "errors", ".", "Only", "logs", "since", "the", "last", "call", "to", "ReadNewLogs", "are", "returned", ".", "Valid", "log", "types", "may", "be", "obtained", "using", "the", "LogTypes", "method", "." ]
[ "func", "(", "p", "*", "Page", ")", "ReadNewLogs", "(", "logType", "string", ")", "(", "[", "]", "Log", ",", "error", ")", "{", "if", "p", ".", "logs", "==", "nil", "{", "p", ".", "logs", "=", "map", "[", "string", "]", "[", "]", "Log", "{", "}", "\n", "}", "\n\n", "clientLogs", ",", "err", ":=", "p", ".", "session", ".", "NewLogs", "(", "logType", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "messageMatcher", ":=", "regexp", ".", "MustCompile", "(", "`^(?s:(.+))\\s\\(([^)]*:\\w*)\\)$`", ")", "\n\n", "var", "logs", "[", "]", "Log", "\n", "for", "_", ",", "clientLog", ":=", "range", "clientLogs", "{", "matches", ":=", "messageMatcher", ".", "FindStringSubmatch", "(", "clientLog", ".", "Message", ")", "\n", "message", ",", "location", ":=", "clientLog", ".", "Message", ",", "\"", "\"", "\n", "if", "len", "(", "matches", ")", ">", "2", "{", "message", ",", "location", "=", "matches", "[", "1", "]", ",", "matches", "[", "2", "]", "\n", "}", "\n\n", "<mask>", ":=", "Log", "{", "message", ",", "location", ",", "clientLog", ".", "Level", ",", "msToTime", "(", "clientLog", ".", "Timestamp", ")", "}", "\n", "logs", "=", "append", "(", "logs", ",", "log", ")", "\n", "}", "\n", "p", ".", "logs", "[", "logType", "]", "=", "append", "(", "p", ".", "logs", "[", "logType", "]", ",", "logs", "...", ")", "\n\n", "return", "logs", ",", "nil", "\n", "}" ]
23,902
all-23903
[ "IsVTXDisabledInTheVM", "checks", "if", "VT", "-", "X", "is", "disabled", "in", "the", "started", "vm", "." ]
[ "func", "(", "d", "*", "Driver", ")", "IsVTXDisabledInTheVM", "(", ")", "(", "bool", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "d", ".", "readVBoxLog", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "true", ",", "err", "\n", "}", "\n\n", "for", "_", ",", "line", ":=", "range", "lines", "{", "if", "strings", ".", "Contains", "(", "line", ",", "\"", "\"", ")", "&&", "!", "strings", ".", "Contains", "(", "line", ",", "\"", "\"", ")", "{", "return", "true", ",", "nil", "\n", "}", "\n", "if", "strings", ".", "Contains", "(", "line", ",", "\"", "\"", ")", "{", "return", "true", ",", "nil", "\n", "}", "\n", "if", "strings", ".", "Contains", "(", "line", ",", "\"", "\"", ")", "{", "return", "true", ",", "nil", "\n", "}", "\n", "if", "strings", ".", "Contains", "(", "line", ",", "\"", "\"", ")", "&&", "strings", ".", "Contains", "(", "line", ",", "\"", "\"", ")", "{", "return", "true", ",", "nil", "\n", "}", "\n", "}", "\n\n", "return", "false", ",", "nil", "\n", "}" ]
23,903
all-23904
[ "AutoOfferingPopUp", "creates", "AgentPreOfferingPopUp", "jobs", "for", "active", "offerings", ".", "Taken", "into", "account", "a", "current", "balance", "of", "agent", "ETH", ".", "If", "ETH", "is", "not", "enough", "to", "pop", "up", "all", "offerings", "then", "no", "one", "of", "them", "is", "popped", "up", ".", "Function", "calculates", "the", "pop", "up", "time", "." ]
[ "func", "AutoOfferingPopUp", "(", "logger", "log", ".", "Logger", ",", "abi", "abi", ".", "ABI", ",", "db", "*", "reform", ".", "DB", ",", "ethBack", "eth", ".", "Backend", ",", "timeNowFunc", "func", "(", ")", "time", ".", "Time", ",", "period", "uint", ")", "[", "]", "*", "data", ".", "Job", "{", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "do", ",", "err", ":=", "data", ".", "ReadBoolSetting", "(", "db", ".", "Querier", ",", "data", ".", "SettingOfferingAutoPopUp", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Warn", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "var", "jobs", "[", "]", "*", "data", ".", "Job", "\n\n", "if", "<mask>", "{", "jobs", "=", "autoOfferingPopUp", "(", "logger", ",", "abi", ",", "db", ",", "ethBack", ",", "timeNowFunc", ",", "period", ")", "\n", "logger", ".", "Debug", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "len", "(", "jobs", ")", ")", ")", "\n", "}", "\n\n", "return", "jobs", "\n", "}" ]
23,904
all-23905
[ "GetEvaluationDelay", "returns", "the", "EvaluationDelay", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "o", "*", "<mask>", ")", "GetEvaluationDelay", "(", ")", "int", "{", "if", "o", "==", "nil", "||", "o", ".", "EvaluationDelay", "==", "nil", "{", "return", "0", "\n", "}", "\n", "return", "*", "o", ".", "EvaluationDelay", "\n", "}" ]
23,905
all-23906
[ "MoveHostsOutOf", "moves", "a", "supplied", "list", "of", "hosts", "out", "of", "the", "specified", "cluster", ".", "The", "host", "is", "moved", "to", "the", "root", "host", "folder", "for", "the", "datacenter", "that", "the", "cluster", "is", "in", ".", "The", "host", "is", "placed", "into", "maintenance", "mode", "with", "evacuate", "flagged", "on", "ensuring", "that", "as", "many", "VMs", "as", "possible", "are", "moved", "out", "of", "the", "host", "before", "removing", "it", "from", "the", "cluster", ".", "The", "effectiveness", "of", "this", "operation", "is", "dictated", "by", "the", "cluster", "s", "DRS", "settings", "which", "also", "affects", "if", "this", "means", "that", "the", "task", "will", "block", "and", "require", "manual", "intervention", ".", "The", "supplied", "timeout", "is", "passed", "to", "the", "maintenance", "mode", "operations", "and", "represents", "the", "timeout", "in", "seconds", ".", "Individual", "hosts", "are", "taken", "out", "of", "maintenance", "mode", "after", "its", "operation", "is", "complete", "." ]
[ "func", "MoveHostsOutOf", "(", "cluster", "*", "object", ".", "ClusterComputeResource", ",", "hosts", "[", "]", "*", "object", ".", "HostSystem", ",", "timeout", "int", ")", "error", "{", "for", "_", ",", "host", ":=", "<mask>", "hosts", "{", "if", "err", ":=", "moveHostOutOf", "(", "cluster", ",", "host", ",", "timeout", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
23,906
all-23907
[ "generateProto", "creates", "a", "new", "proto_library", "rule", "for", "a", "package", ".", "The", "rule", "may", "be", "empty", "if", "there", "are", "no", "sources", "." ]
[ "func", "generateProto", "(", "pc", "*", "ProtoConfig", ",", "rel", "string", ",", "pkg", "*", "Package", ",", "shouldSetVisibility", "bool", ")", "*", "rule", ".", "Rule", "{", "var", "name", "string", "\n", "if", "pc", ".", "Mode", "==", "DefaultMode", "{", "name", "=", "RuleName", "(", "goPackageName", "(", "pkg", ")", ",", "<mask>", ".", "GoPrefix", ",", "rel", ")", "\n", "}", "else", "{", "name", "=", "RuleName", "(", "pkg", ".", "Options", "[", "pc", ".", "groupOption", "]", ",", "pkg", ".", "Name", ",", "rel", ")", "\n", "}", "\n", "r", ":=", "rule", ".", "NewRule", "(", "\"", "\"", ",", "name", ")", "\n", "srcs", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "pkg", ".", "Files", ")", ")", "\n", "for", "f", ":=", "range", "pkg", ".", "Files", "{", "srcs", "=", "append", "(", "srcs", ",", "f", ")", "\n", "}", "\n", "sort", ".", "Strings", "(", "srcs", ")", "\n", "if", "len", "(", "srcs", ")", ">", "0", "{", "r", ".", "SetAttr", "(", "\"", "\"", ",", "srcs", ")", "\n", "}", "\n", "r", ".", "SetPrivateAttr", "(", "PackageKey", ",", "*", "pkg", ")", "\n", "imports", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "pkg", ".", "Imports", ")", ")", "\n", "for", "i", ":=", "range", "pkg", ".", "Imports", "{", "imports", "=", "append", "(", "imports", ",", "i", ")", "\n", "}", "\n", "sort", ".", "Strings", "(", "imports", ")", "\n", "// NOTE: This attribute should not be used outside this extension. It's still", "// convenient for testing though.", "r", ".", "SetPrivateAttr", "(", "config", ".", "GazelleImportsKey", ",", "imports", ")", "\n", "for", "k", ",", "v", ":=", "range", "pkg", ".", "Options", "{", "r", ".", "SetPrivateAttr", "(", "k", ",", "v", ")", "\n", "}", "\n", "if", "shouldSetVisibility", "{", "vis", ":=", "rule", ".", "CheckInternalVisibility", "(", "rel", ",", "\"", "\"", ")", "\n", "r", ".", "SetAttr", "(", "\"", "\"", ",", "[", "]", "string", "{", "vis", "}", ")", "\n", "}", "\n", "if", "pc", ".", "stripImportPrefix", "!=", "\"", "\"", "{", "r", ".", "SetAttr", "(", "\"", "\"", ",", "pc", ".", "stripImportPrefix", ")", "\n", "}", "\n", "if", "pc", ".", "importPrefix", "!=", "\"", "\"", "{", "r", ".", "SetAttr", "(", "\"", "\"", ",", "pc", ".", "importPrefix", ")", "\n", "}", "\n", "return", "r", "\n", "}" ]
23,907
all-23908
[ "Patch", "changes", "only", "the", "configuration", "keys", "in", "the", "given", "map", "." ]
[ "func", "(", "c", "*", "Config", ")", "Patch", "(", "patch", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "values", ":=", "c", ".", "Dump", "(", ")", "// Use current values as defaults", "\n", "for", "name", ",", "value", ":=", "range", "patch", "{", "values", "[", "name", "]", "=", "value", "\n", "}", "\n\n", "return", "c", ".", "update", "(", "<mask>", ")", "\n", "}" ]
23,908
all-23909
[ "Add", "a", "new", "update", "to", "the", "schema", ".", "It", "will", "be", "appended", "at", "the", "end", "of", "the", "existing", "series", "." ]
[ "func", "(", "s", "*", "Schema", ")", "Add", "(", "<mask>", "Update", ")", "{", "s", ".", "updates", "=", "append", "(", "s", ".", "updates", ",", "update", ")", "\n", "}" ]
23,909
all-23910
[ "match", "reports", "whether", "the", "file", "matches", "the", "pattern", ".", "It", "uses", "a", "string", "comparison", "if", "the", "pattern", "contains", "no", "metacharacters", "." ]
[ "func", "(", "m", "*", "modulePat", ")", "match", "(", "<mask>", "string", ")", "bool", "{", "if", "m", ".", "literal", "{", "return", "file", "==", "m", ".", "pattern", "\n", "}", "\n", "match", ",", "_", ":=", "filepath", ".", "Match", "(", "m", ".", "pattern", ",", "file", ")", "\n", "return", "match", "\n", "}" ]
23,910
all-23911
[ "GetSelectedRows", "is", "a", "wrapper", "around", "gtk_tree_selection_get_selected_rows", "()", ".", "All", "the", "elements", "of", "returned", "list", "are", "wrapped", "into", "(", "*", "gtk", ".", "TreePath", ")", "values", ".", "Please", "note", "that", "a", "runtime", "finalizer", "is", "only", "set", "on", "the", "head", "of", "the", "linked", "list", "and", "must", "be", "kept", "live", "while", "accessing", "any", "item", "in", "the", "list", "or", "the", "Go", "garbage", "collector", "will", "free", "the", "whole", "list", "." ]
[ "func", "(", "v", "*", "TreeSelection", ")", "GetSelectedRows", "(", "model", "ITreeModel", ")", "*", "glib", ".", "List", "{", "var", "pcmodel", "*", "*", "C", ".", "GtkTreeModel", "\n", "if", "model", "!=", "nil", "{", "cmodel", ":=", "model", ".", "toTreeModel", "(", ")", "\n", "pcmodel", "=", "&", "cmodel", "\n", "}", "\n\n", "clist", ":=", "C", ".", "gtk_tree_selection_get_selected_rows", "(", "v", ".", "native", "(", ")", ",", "pcmodel", ")", "\n", "if", "clist", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "glist", ":=", "glib", ".", "WrapList", "(", "uintptr", "(", "unsafe", ".", "Pointer", "(", "clist", ")", ")", ")", "\n", "glist", ".", "DataWrapper", "(", "func", "(", "ptr", "unsafe", ".", "Pointer", ")", "interface", "{", "}", "{", "return", "&", "TreePath", "{", "(", "*", "C", ".", "GtkTreePath", ")", "(", "ptr", ")", "}", "\n", "}", ")", "\n", "runtime", ".", "SetFinalizer", "(", "glist", ",", "func", "(", "glist", "*", "glib", ".", "List", ")", "{", "glist", ".", "FreeFull", "(", "func", "(", "item", "interface", "{", "}", ")", "{", "path", ":=", "item", ".", "(", "*", "TreePath", ")", "\n", "C", ".", "gtk_tree_path_free", "(", "<mask>", ".", "GtkTreePath", ")", "\n", "}", ")", "\n", "}", ")", "\n\n", "return", "glist", "\n", "}" ]
23,911
all-23912
[ "Copy", "returns", "a", "deep", "copy", "of", "this", "configuration", "." ]
[ "func", "(", "c", "*", "ExecConfig", ")", "Copy", "(", ")", "*", "ExecConfig", "{", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "<mask>", "o", "ExecConfig", "\n\n", "o", ".", "Command", "=", "c", ".", "Command", "\n\n", "o", ".", "Enabled", "=", "c", ".", "Enabled", "\n\n", "if", "c", ".", "Env", "!=", "nil", "{", "o", ".", "Env", "=", "c", ".", "Env", ".", "Copy", "(", ")", "\n", "}", "\n\n", "o", ".", "KillSignal", "=", "c", ".", "KillSignal", "\n\n", "o", ".", "KillTimeout", "=", "c", ".", "KillTimeout", "\n\n", "o", ".", "ReloadSignal", "=", "c", ".", "ReloadSignal", "\n\n", "o", ".", "Splay", "=", "c", ".", "Splay", "\n\n", "o", ".", "Timeout", "=", "c", ".", "Timeout", "\n\n", "return", "&", "o", "\n", "}" ]
23,912
all-23913
[ "ReplaceAtLine", "replaces", "all", "regular", "expressions", "mathed", "in", "r", "for", "the", "named", "file", "if", "the", "line", "is", "matched", "at", "the", "first", "." ]
[ "func", "ReplaceAtLine", "(", "filename", "string", ",", "r", "[", "]", "ReplacerAtLine", ")", "error", "{", "e", ",", "err", ":=", "NewEdit", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "=", "e", ".", "genReplaceAtLine", "(", "r", ",", "-", "1", ")", "\n", "err2", ":=", "e", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "err2", "\n", "}" ]
23,913
all-23914
[ "SyncMetrics", "records", "metrics", "for", "the", "cached", "prowjobs", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "SyncMetrics", "(", ")", "{", "c", ".", "pjLock", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "pjLock", ".", "RUnlock", "(", ")", "\n", "kube", ".", "GatherProwJobMetrics", "(", "c", ".", "pjs", ")", "\n", "}" ]
23,914
all-23915
[ "Collect", "cache", "metrics" ]
[ "func", "(", "api", "*", "Api", ")", "Stat", "(", "<mask>", "helper", ".", "StatCallback", ")", "{", "helper", ".", "SendAndSubstractUint32", "(", "\"", "\"", ",", "&", "api", ".", "stat", ".", "cacheRequests", ",", "send", ")", "\n", "helper", ".", "SendAndSubstractUint32", "(", "\"", "\"", ",", "&", "api", ".", "stat", ".", "cacheRequestMetrics", ",", "send", ")", "\n", "helper", ".", "SendAndSubstractUint32", "(", "\"", "\"", ",", "&", "api", ".", "stat", ".", "cacheResponseMetrics", ",", "send", ")", "\n", "helper", ".", "SendAndSubstractUint32", "(", "\"", "\"", ",", "&", "api", ".", "stat", ".", "cacheResponsePoints", ",", "send", ")", "\n", "}" ]
23,915
all-23916
[ "CheckNamedValue", "implements", "NamedValueChecker", "interface", ".", "implemented", "for", "conn", ":", "if", "querier", "or", "execer", "is", "called", "sql", "checks", "parameters", "before", "in", "case", "of", "parameters", "the", "method", "can", "be", "skipped", "and", "force", "the", "prepare", "path", "--", ">", "guarantee", "that", "a", "valid", "driver", "value", "is", "returned", "--", ">", "if", "not", "implemented", "Lob", "need", "to", "have", "a", "pseudo", "Value", "method", "to", "return", "a", "valid", "driver", "value" ]
[ "func", "(", "c", "*", "conn", ")", "CheckNamedValue", "(", "nv", "*", "<mask>", ".", "NamedValue", ")", "error", "{", "switch", "nv", ".", "Value", ".", "(", "type", ")", "{", "case", "Lob", ",", "*", "Lob", ":", "nv", ".", "Value", "=", "nil", "\n", "}", "\n", "return", "nil", "\n", "}" ]
23,916
all-23917
[ "NewServersetDiscovery", "returns", "a", "new", "Discovery", "for", "the", "given", "serverset", "config", "." ]
[ "func", "NewServersetDiscovery", "(", "conf", "*", "ServersetSDConfig", ",", "logger", "<mask>", ".", "Logger", ")", "(", "*", "Discovery", ",", "error", ")", "{", "return", "NewDiscovery", "(", "conf", ".", "Servers", ",", "time", ".", "Duration", "(", "conf", ".", "Timeout", ")", ",", "conf", ".", "Paths", ",", "logger", ",", "parseServersetMember", ")", "\n", "}" ]
23,917
all-23918
[ "RegisterQueueTask", "registers", "the", "internal", "bs", "queue", "task", "for", "later", "execution", "." ]
[ "func", "RegisterQueueTask", "(", "p", "DockerProvisioner", ")", "error", "{", "q", ",", "err", ":=", "<mask>", ".", "Queue", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "q", ".", "RegisterTask", "(", "&", "runBs", "{", "provisioner", ":", "p", "}", ")", "\n", "}" ]
23,918
all-23919
[ "ReadFile", "reads", "a", "file", "content", "from", "the", "embedded", "filesystem", "." ]
[ "func", "ReadFile", "(", "name", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "fs", ".", "New", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "ErrOpenFS", "\n", "}", "\n\n", "file", ",", "err", ":=", "fs", ".", "Open", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "ErrOpenFile", "\n", "}", "\n", "defer", "file", ".", "Close", "(", ")", "\n\n", "data", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "ErrReadFile", "\n", "}", "\n\n", "return", "data", ",", "nil", "\n", "}" ]
23,919
all-23920
[ "Do", "executes", "Runtime", ".", "runScript", "against", "the", "provided", "context", ".", "returns", ":", "result", "-", "Run", "result", ".", "exceptionDetails", "-", "Exception", "details", "." ]
[ "func", "(", "p", "*", "RunScriptParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "result", "*", "RemoteObject", ",", "exceptionDetails", "*", "ExceptionDetails", ",", "err", "error", ")", "{", "// execute", "var", "res", "RunScriptReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandRunScript", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Result", ",", "res", ".", "ExceptionDetails", ",", "nil", "\n", "}" ]
23,920
all-23921
[ "dialSetupOpts", "gives", "the", "dial", "opts", "prior", "to", "any", "authentication", "." ]
[ "func", "(", "c", "*", "Client", ")", "dialSetupOpts", "(", "creds", "*", "credentials", ".", "TransportCredentials", ",", "dopts", "...", "grpc", ".", "DialOption", ")", "(", "opts", "[", "]", "grpc", ".", "DialOption", ",", "err", "error", ")", "{", "if", "c", ".", "cfg", ".", "DialKeepAliveTime", ">", "0", "{", "params", ":=", "keepalive", ".", "ClientParameters", "{", "Time", ":", "c", ".", "cfg", ".", "DialKeepAliveTime", ",", "Timeout", ":", "c", ".", "cfg", ".", "DialKeepAliveTimeout", ",", "PermitWithoutStream", ":", "c", ".", "cfg", ".", "PermitWithoutStream", ",", "}", "\n", "opts", "=", "append", "(", "opts", ",", "grpc", ".", "WithKeepaliveParams", "(", "params", ")", ")", "\n", "}", "\n", "opts", "=", "append", "(", "opts", ",", "dopts", "...", ")", "\n\n", "// Provide a net dialer that supports cancelation and timeout.", "f", ":=", "func", "(", "dialEp", "string", ",", "t", "<mask>", ".", "Duration", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "proto", ",", "host", ",", "_", ":=", "endpoint", ".", "ParseEndpoint", "(", "dialEp", ")", "\n", "select", "{", "case", "<-", "c", ".", "ctx", ".", "Done", "(", ")", ":", "return", "nil", ",", "c", ".", "ctx", ".", "Err", "(", ")", "\n", "default", ":", "}", "\n", "dialer", ":=", "&", "net", ".", "Dialer", "{", "Timeout", ":", "t", "}", "\n", "return", "dialer", ".", "DialContext", "(", "c", ".", "ctx", ",", "proto", ",", "host", ")", "\n", "}", "\n", "opts", "=", "append", "(", "opts", ",", "grpc", ".", "WithDialer", "(", "f", ")", ")", "\n\n", "if", "creds", "!=", "nil", "{", "opts", "=", "append", "(", "opts", ",", "grpc", ".", "WithTransportCredentials", "(", "*", "creds", ")", ")", "\n", "}", "else", "{", "opts", "=", "append", "(", "opts", ",", "grpc", ".", "WithInsecure", "(", ")", ")", "\n", "}", "\n\n", "// Interceptor retry and backoff.", "// TODO: Replace all of clientv3/retry.go with interceptor based retry, or with", "// https://github.com/grpc/proposal/blob/master/A6-client-retries.md#retry-policy", "// once it is available.", "rrBackoff", ":=", "withBackoff", "(", "c", ".", "roundRobinQuorumBackoff", "(", "defaultBackoffWaitBetween", ",", "defaultBackoffJitterFraction", ")", ")", "\n", "opts", "=", "append", "(", "opts", ",", "// Disable stream retry by default since go-grpc-middleware/retry does not support client streams.", "// Streams that are safe to retry are enabled individually.", "grpc", ".", "WithStreamInterceptor", "(", "c", ".", "streamClientInterceptor", "(", "c", ".", "lg", ",", "withMax", "(", "0", ")", ",", "rrBackoff", ")", ")", ",", "grpc", ".", "WithUnaryInterceptor", "(", "c", ".", "unaryClientInterceptor", "(", "c", ".", "lg", ",", "withMax", "(", "defaultUnaryMaxRetries", ")", ",", "rrBackoff", ")", ")", ",", ")", "\n\n", "return", "opts", ",", "nil", "\n", "}" ]
23,921
all-23922
[ "Negotiate", "inspects", "the", "request", "for", "the", "accept", "header", "and", "encodes", "the", "response", "appropriately", "." ]
[ "func", "(", "cn", "*", "ContentNegotiator", ")", "Negotiate", "(", "req", "*", "http", ".", "<mask>", ",", "data", "interface", "{", "}", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "len", "(", "cn", ".", "encoderMap", ")", "<=", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "e", "=", "cn", ".", "getEncoder", "(", "req", ")", "\n", "cn", ".", "ResponseWriter", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "e", ".", "ContentType", "(", ")", ")", "\n", "return", "e", ".", "Encode", "(", "data", ")", "\n", "}" ]
23,922
all-23923
[ "GetColor", "returns", "the", "Color", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "f", "*", "FreeTextDefinition", ")", "GetColor", "(", ")", "string", "{", "if", "f", "==", "nil", "||", "f", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "f", ".", "Color", "\n", "}" ]
23,923
all-23924
[ "GetNetworkSettings", "returns", "the", "networks", "field", "in", "a", "container" ]
[ "func", "(", "c", "*", "Container", ")", "GetNetworkSettings", "(", ")", "*", "types", ".", "NetworkSettings", "{", "c", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "c", ".", "NetworkSettingsUnsafe", "\n", "}" ]
23,924
all-23925
[ "OnStart", "implements", "Service", "." ]
[ "func", "(", "a", "*", "AddrBook", ")", "OnStart", "(", ")", "error", "{", "a", ".", "BaseService", ".", "OnStart", "(", ")", "\n", "a", ".", "loadFromFile", "(", "a", ".", "filePath", ")", "\n", "a", ".", "wg", ".", "Add", "(", "1", ")", "\n", "<mask>", "a", ".", "saveRoutine", "(", ")", "\n", "return", "nil", "\n", "}" ]
23,925
all-23926
[ "LockResource", "locks", "a", "resource", "against", "destroy", "requests", ".", "Support", "brightbox", ".", "CloudIP", "brightbox", ".", "Server", "brightbox", ".", "Image", "and", "brightbox", ".", "LoadBalancer" ]
[ "func", "(", "c", "*", "Client", ")", "LockResource", "(", "resource", "interface", "{", "}", ")", "error", "{", "rpath", ",", "err", ":=", "resourcePath", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "_", ",", "err", "=", "c", ".", "MakeApiRequest", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "rpath", ")", ",", "nil", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
23,926
all-23927
[ "GetEvent", "gets", "a", "single", "event", "given", "an", "identifier", "." ]
[ "func", "(", "<mask>", "*", "Client", ")", "GetEvent", "(", "id", "int", ")", "(", "*", "Event", ",", "error", ")", "{", "var", "out", "reqGetEvent", "\n", "if", "err", ":=", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "id", ")", ",", "nil", ",", "&", "out", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "out", ".", "Event", ",", "nil", "\n", "}" ]
23,927
all-23928
[ "GetOperatorOk", "returns", "a", "tuple", "with", "the", "Operator", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "SyntheticsAssertion", ")", "GetOperatorOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "s", "==", "nil", "||", "s", ".", "Operator", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "s", ".", "Operator", ",", "<mask>", "\n", "}" ]
23,928
all-23929
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "DOMNode", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomsnapshot12", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
23,929
all-23930
[ "MakeCommand", "returns", "a", "filter", "command", "." ]
[ "func", "MakeCommand", "(", ")", "*", "cobra", ".", "Command", "{", "<mask>", ":=", "&", "flags", "{", "}", "\n", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Long", ":", "`Filters a Go coverage file, removing entries that do not match the given flags.`", ",", "Run", ":", "func", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "run", "(", "flags", ",", "cmd", ",", "args", ")", "\n", "}", ",", "}", "\n", "cmd", ".", "Flags", "(", ")", ".", "StringVarP", "(", "&", "flags", ".", "OutputFile", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "StringSliceVar", "(", "&", "flags", ".", "IncludePaths", ",", "\"", "\"", ",", "nil", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "StringSliceVar", "(", "&", "flags", ".", "ExcludePaths", ",", "\"", "\"", ",", "nil", ",", "\"", "\"", ")", "\n", "return", "cmd", "\n", "}" ]
23,930
all-23931
[ "IsLinguistGenerated", "determines", "whether", "a", "file", "given", "here", "by", "its", "full", "path", "is", "included", "in", "the", ".", "gitattributes", "linguist", "-", "generated", "group", ".", "These", "files", "are", "excluded", "from", "language", "stats", "and", "suppressed", "in", "diffs", ".", "https", ":", "//", "github", ".", "com", "/", "github", "/", "linguist", "/", "#generated", "-", "code", "Unmarked", "paths", "(", "linguist", "-", "generated", "=", "false", ")", "are", "not", "supported", "." ]
[ "func", "(", "g", "*", "Group", ")", "IsLinguistGenerated", "(", "path", "string", ")", "bool", "{", "for", "_", ",", "p", ":=", "range", "g", ".", "LinguistGeneratedPatterns", "{", "if", "p", ".", "Match", "(", "path", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
23,931
all-23932
[ "Has", "returns", "true", "if", "sym", "is", "loaded", "by", "this", "statement", "." ]
[ "func", "(", "l", "*", "Load", ")", "Has", "(", "sym", "string", ")", "bool", "{", "_", ",", "ok", ":=", "l", ".", "symbols", "[", "sym", "]", "\n", "return", "<mask>", "\n", "}" ]
23,932
all-23933
[ "Max", "returns", "the", "larger", "of", "a", "and", "b", "." ]
[ "func", "(", "a", "<mask>", ")", "Max", "(", "b", "Address", ")", "Address", "{", "if", "a", ">", "b", "{", "return", "a", "\n", "}", "\n", "return", "b", "\n", "}" ]
23,933
all-23934
[ "SetProjectQuota", "sets", "the", "quota", "on", "the", "project", "id" ]
[ "func", "SetProjectQuota", "(", "<mask>", "string", ",", "id", "uint32", ",", "bytes", "int64", ")", "error", "{", "// Get the backing device", "devPath", ",", "err", ":=", "devForPath", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Call quotactl through CGo", "cDevPath", ":=", "C", ".", "CString", "(", "devPath", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cDevPath", ")", ")", "\n\n", "if", "C", ".", "quota_set", "(", "cDevPath", ",", "C", ".", "uint32_t", "(", "id", ")", ",", "C", ".", "int", "(", "bytes", "/", "1024", ")", ")", "!=", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "id", ",", "path", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
23,934
all-23935
[ "erase", "deletes", "written", "characters", "Caller", "must", "already", "hold", "s", ".", "lock", "." ]
[ "func", "(", "s", "*", "Spinner", ")", "erase", "(", ")", "{", "n", ":=", "utf8", ".", "RuneCountInString", "(", "s", ".", "lastOutput", ")", "\n", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "clearString", ":=", "\"", "\\r", "\"", "\n", "for", "i", ":=", "0", ";", "i", "<", "n", ";", "i", "++", "{", "clearString", "+=", "\"", "\"", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "s", ".", "<mask>", ",", "clearString", ")", "\n", "return", "\n", "}", "\n", "del", ",", "_", ":=", "hex", ".", "DecodeString", "(", "\"", "\"", ")", "\n", "for", "_", ",", "c", ":=", "range", "[", "]", "string", "{", "\"", "\\b", "\"", ",", "string", "(", "del", ")", ",", "\"", "\\b", "\"", ",", "\"", "\\033", "\"", ",", "// for macOS Terminal", "}", "{", "for", "i", ":=", "0", ";", "i", "<", "n", ";", "i", "++", "{", "fmt", ".", "Fprintf", "(", "s", ".", "Writer", ",", "c", ")", "\n", "}", "\n", "}", "\n", "s", ".", "lastOutput", "=", "\"", "\"", "\n", "}" ]
23,935
all-23936
[ "NewMemberAddCommand", "returns", "the", "cobra", "command", "for", "member", "add", "." ]
[ "func", "NewMemberAddCommand", "(", ")", "*", "cobra", ".", "Command", "{", "<mask>", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Run", ":", "memberAddCommandFunc", ",", "}", "\n\n", "cc", ".", "Flags", "(", ")", ".", "StringVar", "(", "&", "memberPeerURLs", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "return", "cc", "\n", "}" ]
23,936
all-23937
[ "GetBottomMargin", "()", "is", "a", "wrapper", "around", "gtk_page_setup_get_bottom_margin", "()", "." ]
[ "func", "(", "ps", "*", "PageSetup", ")", "GetBottomMargin", "(", "unit", "Unit", ")", "float64", "{", "c", ":=", "C", ".", "gtk_page_setup_get_bottom_margin", "(", "<mask>", ".", "native", "(", ")", ",", "C", ".", "GtkUnit", "(", "unit", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
23,937
all-23938
[ "newHypervisorDiscovery", "returns", "a", "new", "hypervisor", "discovery", "." ]
[ "func", "newHypervisorDiscovery", "(", "provider", "*", "gophercloud", ".", "ProviderClient", ",", "opts", "*", "gophercloud", ".", "AuthOptions", ",", "port", "int", ",", "region", "string", ",", "l", "log", ".", "Logger", ")", "*", "HypervisorDiscovery", "{", "return", "&", "HypervisorDiscovery", "{", "provider", ":", "provider", ",", "authOpts", ":", "opts", ",", "<mask>", ":", "region", ",", "port", ":", "port", ",", "logger", ":", "l", "}", "\n", "}" ]
23,938
all-23939
[ "JobInput", "fills", "in", "the", "commits", "for", "a", "JobInfo" ]
[ "func", "JobInput", "(", "pipelineInfo", "*", "pps", ".", "PipelineInfo", ",", "outputCommitInfo", "*", "pfs", ".", "CommitInfo", ")", "*", "pps", ".", "Input", "{", "// branchToCommit maps strings of the form \"<repo>/<branch>\" to PFS commits", "branchToCommit", ":=", "make", "(", "map", "[", "string", "]", "*", "pfs", ".", "Commit", ")", "\n", "key", ":=", "path", ".", "Join", "\n", "for", "_", ",", "prov", ":=", "range", "outputCommitInfo", ".", "Provenance", "{", "branchToCommit", "[", "<mask>", "(", "prov", ".", "Commit", ".", "Repo", ".", "Name", ",", "prov", ".", "Branch", ".", "Name", ")", "]", "=", "prov", ".", "Commit", "\n", "}", "\n", "jobInput", ":=", "proto", ".", "Clone", "(", "pipelineInfo", ".", "Input", ")", ".", "(", "*", "pps", ".", "Input", ")", "\n", "pps", ".", "VisitInput", "(", "jobInput", ",", "func", "(", "input", "*", "pps", ".", "Input", ")", "{", "if", "input", ".", "Pfs", "!=", "nil", "{", "if", "commit", ",", "ok", ":=", "branchToCommit", "[", "key", "(", "input", ".", "Pfs", ".", "Repo", ",", "input", ".", "Pfs", ".", "Branch", ")", "]", ";", "ok", "{", "input", ".", "Pfs", ".", "Commit", "=", "commit", ".", "ID", "\n", "}", "\n", "}", "\n", "if", "input", ".", "Cron", "!=", "nil", "{", "if", "commit", ",", "ok", ":=", "branchToCommit", "[", "key", "(", "input", ".", "Cron", ".", "Repo", ",", "\"", "\"", ")", "]", ";", "ok", "{", "input", ".", "Cron", ".", "Commit", "=", "commit", ".", "ID", "\n", "}", "\n", "}", "\n", "if", "input", ".", "Git", "!=", "nil", "{", "if", "commit", ",", "ok", ":=", "branchToCommit", "[", "key", "(", "input", ".", "Git", ".", "Name", ",", "input", ".", "Git", ".", "Branch", ")", "]", ";", "ok", "{", "input", ".", "Git", ".", "Commit", "=", "commit", ".", "ID", "\n", "}", "\n", "}", "\n", "}", ")", "\n", "return", "jobInput", "\n", "}" ]
23,939
all-23940
[ "Get", "returns", "a", "HTTP", "handler", "which", "is", "a", "chain", "of", "middlewares", "and", "then", "the", "specified", "handler", "." ]
[ "func", "(", "s", "Chain", ")", "Get", "(", "handler", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "for", "i", ":=", "len", "(", "s", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "handler", "=", "s", "[", "i", "]", "(", "<mask>", ")", "\n", "}", "\n", "return", "handler", "\n", "}" ]
23,940
all-23941
[ "ENIByMac", "returns", "the", "eni", "object", "that", "match", "the", "give", "mac", "address" ]
[ "func", "(", "state", "*", "DockerTaskEngineState", ")", "ENIByMac", "(", "mac", "string", ")", "(", "*", "apieni", ".", "ENIAttachment", ",", "bool", ")", "{", "state", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "state", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "eni", ",", "ok", ":=", "state", ".", "eniAttachments", "[", "mac", "]", "\n", "return", "eni", ",", "<mask>", "\n", "}" ]
23,941
all-23942
[ "Purge", "is", "used", "to", "completely", "clear", "the", "cache", "." ]
[ "func", "(", "c", "*", "LRU", ")", "Purge", "(", ")", "{", "for", "k", ":=", "range", "c", ".", "<mask>", "{", "delete", "(", "c", ".", "items", ",", "k", ")", "\n", "}", "\n", "c", ".", "evictList", ".", "Init", "(", ")", "\n", "}" ]
23,942
all-23943
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "find", "vms", "by", "filters", "params" ]
[ "func", "(", "o", "*", "FindVmsByFiltersParams", ")", "WithTimeout", "(", "timeout", "<mask>", ".", "Duration", ")", "*", "FindVmsByFiltersParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
23,943
all-23944
[ "VersionAtLeast", "returns", "whether", "the", "BuildInfo", "version", "is", "greater", "than", "or", "equal", "to", "the", "provided", "version", "number", ".", "If", "more", "than", "one", "number", "is", "provided", "numbers", "will", "be", "considered", "as", "major", "minor", "and", "so", "on", "." ]
[ "func", "(", "bi", "*", "BuildInfo", ")", "VersionAtLeast", "(", "<mask>", "...", "int", ")", "bool", "{", "for", "i", ":=", "range", "version", "{", "if", "i", "==", "len", "(", "bi", ".", "VersionArray", ")", "{", "return", "false", "\n", "}", "\n", "if", "bi", ".", "VersionArray", "[", "i", "]", "<", "version", "[", "i", "]", "{", "return", "false", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
23,944
all-23945
[ "Between", "check", "time", "between", "the", "begin", "end", "time", "or", "not" ]
[ "func", "(", "<mask>", "*", "Now", ")", "Between", "(", "begin", ",", "end", "string", ")", "bool", "{", "beginTime", ":=", "now", ".", "MustParse", "(", "begin", ")", "\n", "endTime", ":=", "now", ".", "MustParse", "(", "end", ")", "\n", "return", "now", ".", "After", "(", "beginTime", ")", "&&", "now", ".", "Before", "(", "endTime", ")", "\n", "}" ]
23,945
all-23946
[ "Through", "appends", "a", "new", "asset", "to", "the", "path" ]
[ "func", "(", "pathSend", "PayWithPath", ")", "Through", "(", "asset", "Asset", ")", "PayWithPath", "{", "pathSend", ".", "Path", "=", "append", "(", "pathSend", ".", "<mask>", ",", "asset", ")", "\n", "return", "pathSend", "\n", "}" ]
23,946
all-23947
[ "finalizeJobConfig", "mutates", "and", "fixes", "entries", "for", "jobspecs" ]
[ "func", "(", "c", "*", "Config", ")", "finalizeJobConfig", "(", ")", "error", "{", "if", "c", ".", "decorationRequested", "(", ")", "{", "if", "c", ".", "Plank", ".", "DefaultDecorationConfig", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "c", ".", "Plank", ".", "DefaultDecorationConfig", ".", "UtilityImages", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "c", ".", "Plank", ".", "DefaultDecorationConfig", ".", "GCSConfiguration", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "c", ".", "Plank", ".", "DefaultDecorationConfig", ".", "GCSCredentialsSecret", "==", "\"", "\"", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "for", "_", ",", "vs", ":=", "range", "c", ".", "Presubmits", "{", "for", "i", ":=", "range", "vs", "{", "setPresubmitDecorationDefaults", "(", "c", ",", "&", "<mask>", "[", "i", "]", ")", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "js", ":=", "range", "c", ".", "Postsubmits", "{", "for", "i", ":=", "range", "js", "{", "setPostsubmitDecorationDefaults", "(", "c", ",", "&", "js", "[", "i", "]", ")", "\n", "}", "\n", "}", "\n\n", "for", "i", ":=", "range", "c", ".", "Periodics", "{", "setPeriodicDecorationDefaults", "(", "c", ",", "&", "c", ".", "Periodics", "[", "i", "]", ")", "\n", "}", "\n", "}", "\n\n", "// Ensure that regexes are valid and set defaults.", "for", "_", ",", "vs", ":=", "range", "c", ".", "Presubmits", "{", "c", ".", "defaultPresubmitFields", "(", "vs", ")", "\n", "if", "err", ":=", "SetPresubmitRegexes", "(", "vs", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "js", ":=", "range", "c", ".", "Postsubmits", "{", "c", ".", "defaultPostsubmitFields", "(", "js", ")", "\n", "if", "err", ":=", "SetPostsubmitRegexes", "(", "js", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "c", ".", "defaultPeriodicFields", "(", "c", ".", "Periodics", ")", "\n\n", "for", "_", ",", "v", ":=", "range", "c", ".", "AllPresubmits", "(", "nil", ")", "{", "if", "err", ":=", "resolvePresets", "(", "v", ".", "Name", ",", "v", ".", "Labels", ",", "v", ".", "Spec", ",", "v", ".", "BuildSpec", ",", "c", ".", "Presets", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "v", ":=", "range", "c", ".", "AllPostsubmits", "(", "nil", ")", "{", "if", "err", ":=", "resolvePresets", "(", "v", ".", "Name", ",", "v", ".", "Labels", ",", "v", ".", "Spec", ",", "v", ".", "BuildSpec", ",", "c", ".", "Presets", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "v", ":=", "range", "c", ".", "AllPeriodics", "(", ")", "{", "if", "err", ":=", "resolvePresets", "(", "v", ".", "Name", ",", "v", ".", "Labels", ",", "v", ".", "Spec", ",", "v", ".", "BuildSpec", ",", "c", ".", "Presets", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
23,947
all-23948
[ "resetRecv", "opens", "a", "new", "lease", "stream", "and", "starts", "sending", "keep", "alive", "requests", "." ]
[ "func", "(", "l", "*", "lessor", ")", "resetRecv", "(", ")", "(", "pb", ".", "Lease_LeaseKeepAliveClient", ",", "error", ")", "{", "sctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "l", ".", "stopCtx", ")", "\n", "stream", ",", "err", ":=", "l", ".", "remote", ".", "LeaseKeepAlive", "(", "sctx", ",", "append", "(", "l", ".", "callOpts", ",", "withMax", "(", "0", ")", ")", "...", ")", "\n", "if", "err", "!=", "nil", "{", "cancel", "(", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "l", ".", "<mask>", "!=", "nil", "&&", "l", ".", "streamCancel", "!=", "nil", "{", "l", ".", "streamCancel", "(", ")", "\n", "}", "\n\n", "l", ".", "streamCancel", "=", "cancel", "\n", "l", ".", "stream", "=", "stream", "\n\n", "go", "l", ".", "sendKeepAliveLoop", "(", "stream", ")", "\n", "return", "stream", ",", "nil", "\n", "}" ]
23,948
all-23949
[ "label", "a", "named", "object", "identified", "within", "a", "namespace" ]
[ "func", "ObjectLabel", "(", "identifier", "uint32", ",", "name", "uint32", ",", "length", "int32", ",", "<mask>", "*", "uint8", ")", "{", "syscall", ".", "Syscall6", "(", "gpObjectLabel", ",", "4", ",", "uintptr", "(", "identifier", ")", ",", "uintptr", "(", "name", ")", ",", "uintptr", "(", "length", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "label", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
23,949
all-23950
[ "getValue", "returns", "the", "handle", "registered", "with", "the", "given", "path", "(", "key", ")", ".", "The", "values", "of", "wildcards", "are", "saved", "to", "a", "map", ".", "If", "no", "handle", "can", "be", "found", "a", "TSR", "(", "trailing", "slash", "redirect", ")", "recommendation", "is", "made", "if", "a", "handle", "exists", "with", "an", "extra", "(", "without", "the", ")", "trailing", "slash", "for", "the", "given", "path", "." ]
[ "func", "(", "n", "*", "node", ")", "getValue", "(", "path", "string", ",", "po", "Params", ",", "unescape", "bool", ")", "(", "handlers", "RouterHandlerChain", ",", "p", "Params", ",", "tsr", "bool", ")", "{", "p", "=", "po", "\n", "walk", ":", "// Outer loop for walking the tree", "for", "{", "if", "len", "(", "path", ")", ">", "len", "(", "n", ".", "path", ")", "{", "if", "path", "[", ":", "len", "(", "n", ".", "path", ")", "]", "==", "n", ".", "path", "{", "path", "=", "path", "[", "len", "(", "n", ".", "path", ")", ":", "]", "\n", "// If this node does not have a wildcard (param or catchAll)", "// child, we can just look up the next child node and continue", "// to walk down the tree", "if", "!", "n", ".", "wildChild", "{", "c", ":=", "path", "[", "0", "]", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "n", ".", "indices", ")", ";", "i", "++", "{", "if", "c", "==", "n", ".", "indices", "[", "i", "]", "{", "n", "=", "n", ".", "children", "[", "i", "]", "\n", "<mask>", "walk", "\n", "}", "\n", "}", "\n\n", "// Nothing found.", "// We can recommend to redirect to the same URL without a", "// trailing slash if a leaf exists for that path.", "tsr", "=", "path", "==", "\"", "\"", "&&", "n", ".", "handlers", "!=", "nil", "\n", "return", "\n", "}", "\n\n", "// handle wildcard child", "n", "=", "n", ".", "children", "[", "0", "]", "\n", "switch", "n", ".", "nType", "{", "case", "param", ":", "// find param end (either '/' or path end)", "end", ":=", "0", "\n", "for", "end", "<", "len", "(", "path", ")", "&&", "path", "[", "end", "]", "!=", "'/'", "{", "end", "++", "\n", "}", "\n\n", "// save param value", "if", "cap", "(", "p", ")", "<", "int", "(", "n", ".", "maxParams", ")", "{", "p", "=", "make", "(", "Params", ",", "0", ",", "n", ".", "maxParams", ")", "\n", "}", "\n", "i", ":=", "len", "(", "p", ")", "\n", "p", "=", "p", "[", ":", "i", "+", "1", "]", "// expand slice within preallocated capacity", "\n", "p", "[", "i", "]", ".", "Key", "=", "n", ".", "path", "[", "1", ":", "]", "\n", "val", ":=", "path", "[", ":", "end", "]", "\n", "if", "unescape", "{", "var", "err", "error", "\n", "if", "p", "[", "i", "]", ".", "Value", ",", "err", "=", "url", ".", "QueryUnescape", "(", "val", ")", ";", "err", "!=", "nil", "{", "p", "[", "i", "]", ".", "Value", "=", "val", "// fallback, in case of error", "\n", "}", "\n", "}", "else", "{", "p", "[", "i", "]", ".", "Value", "=", "val", "\n", "}", "\n\n", "// we need to go deeper!", "if", "end", "<", "len", "(", "path", ")", "{", "if", "len", "(", "n", ".", "children", ")", ">", "0", "{", "path", "=", "path", "[", "end", ":", "]", "\n", "n", "=", "n", ".", "children", "[", "0", "]", "\n", "continue", "walk", "\n", "}", "\n\n", "// ... but we can't", "tsr", "=", "len", "(", "path", ")", "==", "end", "+", "1", "\n", "return", "\n", "}", "\n\n", "if", "handlers", "=", "n", ".", "handlers", ";", "handlers", "!=", "nil", "{", "return", "\n", "}", "\n", "if", "len", "(", "n", ".", "children", ")", "==", "1", "{", "// No handle found. Check if a handle for this path + a", "// trailing slash exists for TSR recommendation", "n", "=", "n", ".", "children", "[", "0", "]", "\n", "tsr", "=", "n", ".", "path", "==", "\"", "\"", "&&", "n", ".", "handlers", "!=", "nil", "\n", "}", "\n\n", "return", "\n\n", "case", "catchAll", ":", "// save param value", "if", "cap", "(", "p", ")", "<", "int", "(", "n", ".", "maxParams", ")", "{", "p", "=", "make", "(", "Params", ",", "0", ",", "n", ".", "maxParams", ")", "\n", "}", "\n", "i", ":=", "len", "(", "p", ")", "\n", "p", "=", "p", "[", ":", "i", "+", "1", "]", "// expand slice within preallocated capacity", "\n", "p", "[", "i", "]", ".", "Key", "=", "n", ".", "path", "[", "2", ":", "]", "\n", "if", "unescape", "{", "var", "err", "error", "\n", "if", "p", "[", "i", "]", ".", "Value", ",", "err", "=", "url", ".", "QueryUnescape", "(", "path", ")", ";", "err", "!=", "nil", "{", "p", "[", "i", "]", ".", "Value", "=", "path", "// fallback, in case of error", "\n", "}", "\n", "}", "else", "{", "p", "[", "i", "]", ".", "Value", "=", "path", "\n", "}", "\n\n", "handlers", "=", "n", ".", "handlers", "\n", "return", "\n\n", "default", ":", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}", "else", "if", "path", "==", "n", ".", "path", "{", "// We should have reached the node containing the handle.", "// Check if this node has a handle registered.", "if", "handlers", "=", "n", ".", "handlers", ";", "handlers", "!=", "nil", "{", "return", "\n", "}", "\n\n", "if", "path", "==", "\"", "\"", "&&", "n", ".", "wildChild", "&&", "n", ".", "nType", "!=", "root", "{", "tsr", "=", "true", "\n", "return", "\n", "}", "\n\n", "// No handle found. Check if a handle for this path + a", "// trailing slash exists for trailing slash recommendation", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "n", ".", "indices", ")", ";", "i", "++", "{", "if", "n", ".", "indices", "[", "i", "]", "==", "'/'", "{", "n", "=", "n", ".", "children", "[", "i", "]", "\n", "tsr", "=", "(", "len", "(", "n", ".", "path", ")", "==", "1", "&&", "n", ".", "handlers", "!=", "nil", ")", "||", "(", "n", ".", "nType", "==", "catchAll", "&&", "n", ".", "children", "[", "0", "]", ".", "handlers", "!=", "nil", ")", "\n", "return", "\n", "}", "\n", "}", "\n\n", "return", "\n", "}", "\n\n", "// Nothing found. We can recommend to redirect to the same URL with an", "// extra trailing slash if a leaf exists for that path", "tsr", "=", "(", "path", "==", "\"", "\"", ")", "||", "(", "len", "(", "n", ".", "path", ")", "==", "len", "(", "path", ")", "+", "1", "&&", "n", ".", "path", "[", "len", "(", "path", ")", "]", "==", "'/'", "&&", "path", "==", "n", ".", "path", "[", ":", "len", "(", "n", ".", "path", ")", "-", "1", "]", "&&", "n", ".", "handlers", "!=", "nil", ")", "\n", "return", "\n", "}", "\n", "}" ]
23,950
all-23951
[ "BufferToWindowCoords", "is", "a", "wrapper", "around", "gtk_text_view_buffer_to_window_coords", "()", "." ]
[ "func", "(", "v", "*", "TextView", ")", "BufferToWindowCoords", "(", "win", "TextWindowType", ",", "buffer_x", ",", "buffer_y", "int", ")", "(", "window_x", ",", "window_y", "int", ")", "{", "<mask>", "wx", ",", "wy", "C", ".", "gint", "\n", "C", ".", "gtk_text_view_buffer_to_window_coords", "(", "v", ".", "native", "(", ")", ",", "C", ".", "GtkTextWindowType", "(", "win", ")", ",", "C", ".", "gint", "(", "buffer_x", ")", ",", "C", ".", "gint", "(", "buffer_y", ")", ",", "&", "wx", ",", "&", "wy", ")", "\n", "return", "int", "(", "wx", ")", ",", "int", "(", "wy", ")", "\n", "}" ]
23,951
all-23952
[ "Enable", "or", "disable", "a", "generic", "vertex", "attribute", "array" ]
[ "func", "EnableVertexArrayAttrib", "(", "vaobj", "uint32", ",", "index", "uint32", ")", "{", "C", ".", "glowEnableVertexArrayAttrib", "(", "gpEnableVertexArrayAttrib", ",", "(", "C", ".", "GLuint", ")", "(", "vaobj", ")", ",", "(", "C", ".", "GLuint", ")", "(", "<mask>", ")", ")", "\n", "}" ]
23,952
all-23953
[ "old", "version", ".", "for", "benchmarks", "only" ]
[ "func", "oldPlain", "(", "body", "[", "]", "byte", ")", "(", "[", "]", "*", "points", ".", "Points", ",", "error", ")", "{", "result", ":=", "make", "(", "[", "]", "*", "points", ".", "Points", ",", "4", ")", "\n\n", "reader", ":=", "bytes", ".", "NewBuffer", "(", "body", ")", "\n\n", "for", "{", "line", ",", "err", ":=", "reader", ".", "ReadBytes", "(", "'\\n'", ")", "\n\n", "if", "err", "!=", "nil", "&&", "err", "!=", "io", ".", "EOF", "{", "return", "result", ",", "err", "\n", "}", "\n\n", "if", "len", "(", "line", ")", "==", "0", "{", "break", "\n", "}", "\n\n", "if", "line", "[", "len", "(", "line", ")", "-", "1", "]", "!=", "'\\n'", "{", "return", "result", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "p", ",", "err", ":=", "points", ".", "ParseText", "(", "string", "(", "line", ")", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "result", ",", "err", "\n", "}", "\n\n", "result", "=", "append", "(", "result", ",", "p", ")", "\n", "}", "\n\n", "return", "<mask>", ",", "nil", "\n", "}" ]
23,953
all-23954
[ "JsonRead", "tries", "to", "read", "client", "sent", "content", "using", "JSON", "deserialization", "and", "writes", "it", "to", "defined", "object", "." ]
[ "func", "JsonRead", "(", "body", "io", ".", "ReadCloser", ",", "obj", "interface", "{", "}", ",", "w", "http", ".", "ResponseWriter", ")", "bool", "{", "content", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "io", ".", "LimitReader", "(", "body", ",", "HTTP_BODY_MAX_LENGTH", ")", ")", "\n", "if", "err", "!=", "nil", "{", "jerr", ":=", "NewJsonErrorFromError", "(", "http", ".", "StatusInternalServerError", ",", "err", ")", "\n", "JsonWrite", "(", "w", ",", "jerr", ".", "<mask>", ",", "jerr", ")", "\n", "return", "false", "\n", "}", "\n\n", "if", "err", ":=", "body", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "jerr", ":=", "NewJsonErrorFromError", "(", "http", ".", "StatusInternalServerError", ",", "err", ")", "\n", "JsonWrite", "(", "w", ",", "jerr", ".", "Status", ",", "jerr", ")", "\n", "return", "false", "\n", "}", "\n\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "content", ",", "obj", ")", ";", "err", "!=", "nil", "{", "jerr", ":=", "NewJsonErrorFromError", "(", "StatusUnprocessableEntity", ",", "err", ")", "\n", "JsonWrite", "(", "w", ",", "jerr", ".", "Status", ",", "jerr", ")", "\n", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
23,954
all-23955
[ "GetMessageArea", "()", "is", "a", "wrapper", "around", "gtk_statusbar_get_message_area", "()", "." ]
[ "func", "(", "v", "*", "Statusbar", ")", "GetMessageArea", "(", ")", "(", "*", "Box", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_statusbar_get_message_area", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "&", "Box", "{", "<mask>", "{", "Widget", "{", "glib", ".", "InitiallyUnowned", "{", "obj", "}", "}", "}", "}", ",", "nil", "\n", "}" ]
23,955
all-23956
[ "recover", "is", "the", "handler", "that", "turns", "panics", "into", "returns", "from", "the", "top", "level", "of", "evaluation", "." ]
[ "func", "(", "ev", "*", "evaluator", ")", "recover", "(", "errp", "*", "error", ")", "{", "e", ":=", "recover", "(", ")", "\n", "if", "e", "==", "nil", "{", "return", "\n", "}", "\n", "if", "err", ",", "ok", ":=", "e", ".", "(", "runtime", ".", "Error", ")", ";", "ok", "{", "// Print the stack trace but do not inhibit the running application.", "buf", ":=", "<mask>", "(", "[", "]", "byte", ",", "64", "<<", "10", ")", "\n", "buf", "=", "buf", "[", ":", "runtime", ".", "Stack", "(", "buf", ",", "false", ")", "]", "\n\n", "level", ".", "Error", "(", "ev", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "e", ",", "\"", "\"", ",", "string", "(", "buf", ")", ")", "\n", "*", "errp", "=", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "else", "{", "*", "errp", "=", "e", ".", "(", "error", ")", "\n", "}", "\n", "}" ]
23,956
all-23957
[ "Do", "sends", "an", "HTTP", "request", "with", "the", "provided", "http", ".", "Client", "and", "returns", "an", "HTTP", "response", ".", "If", "the", "client", "is", "nil", "http", ".", "DefaultClient", "is", "used", ".", "The", "provided", "ctx", "must", "be", "non", "-", "nil", ".", "If", "it", "is", "canceled", "or", "times", "out", "ctx", ".", "Err", "()", "will", "be", "returned", ".", "Borrowed", "originally", "from", "https", ":", "//", "github", ".", "com", "/", "golang", "/", "net", "/", "blob", "/", "master", "/", "context", "/", "ctxhttp", "/", "ctxhttp", ".", "go" ]
[ "func", "ctxhttpDo", "(", "ctx", "context", ".", "<mask>", ",", "client", "*", "http", ".", "Client", ",", "req", "*", "http", ".", "Request", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "if", "client", "==", "nil", "{", "client", "=", "http", ".", "DefaultClient", "\n", "}", "\n", "resp", ",", "err", ":=", "client", ".", "Do", "(", "req", ".", "WithContext", "(", "ctx", ")", ")", "\n", "// If we got an error, and the context has been canceled,", "// the context's error is probably more useful.", "if", "err", "!=", "nil", "{", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "err", "=", "ctx", ".", "Err", "(", ")", "\n", "default", ":", "}", "\n", "}", "\n", "return", "resp", ",", "err", "\n", "}" ]
23,957
all-23958
[ "HasFacet", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "a", "*", "ApmOrLogQueryCompute", ")", "HasFacet", "(", ")", "bool", "{", "if", "a", "!=", "nil", "&&", "a", ".", "Facet", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
23,958
all-23959
[ "next", "advances", "to", "the", "next", "packed", "file", "in", "the", "RAR", "archive", "." ]
[ "func", "(", "f", "*", "packedFileReader", ")", "next", "(", ")", "(", "*", "fileBlockHeader", ",", "error", ")", "{", "if", "f", ".", "h", "!=", "nil", "{", "// skip to last block in current file", "for", "!", "f", ".", "h", ".", "<mask>", "{", "// discard remaining block data", "if", "_", ",", "err", ":=", "io", ".", "Copy", "(", "ioutil", ".", "Discard", ",", "f", ".", "r", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "err", ":=", "f", ".", "nextBlockInFile", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "// discard last block data", "if", "_", ",", "err", ":=", "io", ".", "Copy", "(", "ioutil", ".", "Discard", ",", "f", ".", "r", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "var", "err", "error", "\n", "f", ".", "h", ",", "err", "=", "f", ".", "r", ".", "next", "(", ")", "// get next file block", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "errArchiveEnd", "{", "return", "nil", ",", "io", ".", "EOF", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "f", ".", "h", ".", "first", "{", "return", "nil", ",", "errInvalidFileBlock", "\n", "}", "\n", "return", "f", ".", "h", ",", "nil", "\n", "}" ]
23,959
all-23960
[ "FindRange", "finds", "the", "elements", "of", "an", "array", "between", "the", "specified", "indexes", ";", "inclusive" ]
[ "func", "FindRange", "(", "in", "[", "]", "byte", ",", "pos", ",", "from", ",", "to", "int", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "to", "<", "from", "{", "return", "nil", ",", "errToLessThanFrom", "\n", "}", "\n\n", "pos", ",", "err", ":=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "v", ":=", "in", "[", "pos", "]", ";", "v", "!=", "'['", "{", "return", "nil", ",", "newError", "(", "pos", ",", "v", ")", "\n", "}", "\n", "pos", "++", "\n\n", "idx", ":=", "0", "\n", "itemStart", ":=", "pos", "\n\n", "for", "{", "pos", ",", "err", "=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "idx", "==", "from", "{", "itemStart", "=", "pos", "\n", "}", "\n\n", "// data", "pos", ",", "err", "=", "Any", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "idx", "==", "to", "{", "data", ":=", "in", "[", "itemStart", ":", "pos", "]", "\n", "result", ":=", "make", "(", "[", "]", "byte", ",", "0", ",", "len", "(", "data", ")", "+", "2", ")", "\n", "result", "=", "<mask>", "(", "result", ",", "'['", ")", "\n", "result", "=", "append", "(", "result", ",", "data", "...", ")", "\n", "result", "=", "append", "(", "result", ",", "']'", ")", "\n", "return", "result", ",", "nil", "\n", "}", "\n\n", "pos", ",", "err", "=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "switch", "in", "[", "pos", "]", "{", "case", "','", ":", "pos", "++", "\n", "case", "']'", ":", "return", "nil", ",", "errIndexOutOfBounds", "\n", "}", "\n\n", "idx", "++", "\n", "}", "\n", "}" ]
23,960
all-23961
[ "MarshalJSON", "returns", "the", "HexColor", "as", "JSON" ]
[ "func", "(", "h", "HexColor", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "w", "jwriter", ".", "<mask>", "\n", "h", ".", "MarshalEasyJSON", "(", "&", "w", ")", "\n", "return", "w", ".", "BuildBytes", "(", ")", "\n", "}" ]
23,961
all-23962
[ "LinkList", "indicates", "an", "expected", "call", "of", "LinkList" ]
[ "func", "(", "mr", "*", "MockNetLinkMockRecorder", ")", "LinkList", "(", ")", "*", "gomock", ".", "Call", "{", "<mask>", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockNetLink", ")", "(", "nil", ")", ".", "LinkList", ")", ")", "\n", "}" ]
23,962
all-23963
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "DescribeNodeParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom73", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
23,963
all-23964
[ "URLParam", "returns", "the", "corresponding", "URL", "parameter", "value", "from", "the", "request", "routing", "context", "." ]
[ "func", "(", "x", "*", "<mask>", ")", "URLParam", "(", "key", "string", ")", "string", "{", "for", "k", ":=", "len", "(", "x", ".", "URLParams", ".", "Keys", ")", "-", "1", ";", "k", ">=", "0", ";", "k", "--", "{", "if", "x", ".", "URLParams", ".", "Keys", "[", "k", "]", "==", "key", "{", "return", "x", ".", "URLParams", ".", "Values", "[", "k", "]", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
23,964
all-23965
[ "NetworkDelete", "deletes", "the", "network", "with", "the", "given", "name", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "NetworkDelete", "(", "name", "string", ")", "error", "{", "id", ",", "_", ",", "err", ":=", "c", ".", "NetworkGet", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "=", "<mask>", "(", "c", ".", "db", ",", "\"", "\"", ",", "id", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
23,965
all-23966
[ "Do", "executes", "Tracing", ".", "requestMemoryDump", "against", "the", "provided", "context", ".", "returns", ":", "dumpGUID", "-", "GUID", "of", "the", "resulting", "global", "memory", "dump", ".", "success", "-", "True", "iff", "the", "global", "memory", "dump", "succeeded", "." ]
[ "func", "(", "p", "*", "RequestMemoryDumpParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "dumpGUID", "string", ",", "success", "bool", ",", "err", "error", ")", "{", "// execute", "var", "<mask>", "RequestMemoryDumpReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandRequestMemoryDump", ",", "nil", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "false", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "DumpGUID", ",", "res", ".", "Success", ",", "nil", "\n", "}" ]
23,966
all-23967
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventConsoleProfileFinished", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler23", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
23,967
all-23968
[ "GetBlob", "returns", "a", "stream", "for", "the", "specified", "blob", "and", "the", "blob’s", "size", "(", "or", "-", "1", "if", "unknown", ")", ".", "The", "Digest", "field", "in", "BlobInfo", "is", "guaranteed", "to", "be", "provided", "Size", "may", "be", "-", "1", "and", "MediaType", "may", "be", "optionally", "provided", ".", "May", "update", "BlobInfoCache", "preferably", "after", "it", "knows", "for", "certain", "that", "a", "blob", "truly", "exists", "at", "a", "specific", "location", "." ]
[ "func", "(", "s", "*", "dirImageSource", ")", "GetBlob", "(", "ctx", "context", ".", "Context", ",", "info", "types", ".", "BlobInfo", ",", "cache", "types", ".", "BlobInfoCache", ")", "(", "io", ".", "ReadCloser", ",", "int64", ",", "error", ")", "{", "r", ",", "err", ":=", "os", ".", "Open", "(", "s", ".", "ref", ".", "layerPath", "(", "<mask>", ".", "Digest", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "-", "1", ",", "err", "\n", "}", "\n", "fi", ",", "err", ":=", "r", ".", "Stat", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "-", "1", ",", "err", "\n", "}", "\n", "return", "r", ",", "fi", ".", "Size", "(", ")", ",", "nil", "\n", "}" ]
23,968
all-23969
[ "GetAuthorizationToken", "indicates", "an", "expected", "call", "of", "GetAuthorizationToken" ]
[ "func", "(", "mr", "*", "MockECRClientMockRecorder", ")", "GetAuthorizationToken", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockECRClient", ")", "(", "nil", ")", ".", "GetAuthorizationToken", ")", ",", "arg0", ")", "\n", "}" ]
23,969
all-23970
[ "AcquireByStateWait", "blocks", "until", "AcquireByState", "returns", "the", "specified", "resource", "(", "s", ")", "or", "the", "provided", "context", "is", "cancelled", "or", "its", "deadline", "exceeded", "." ]
[ "func", "(", "c", "*", "Client", ")", "AcquireByStateWait", "(", "ctx", "context", ".", "Context", ",", "state", ",", "dest", "string", ",", "<mask>", "[", "]", "string", ")", "(", "[", "]", "common", ".", "Resource", ",", "error", ")", "{", "if", "ctx", "==", "nil", "{", "return", "nil", ",", "ErrContextRequired", "\n", "}", "\n", "// Try to acquire the resource(s) until available or the context is", "// cancelled or its deadline exceeded.", "for", "{", "r", ",", "err", ":=", "c", ".", "AcquireByState", "(", "state", ",", "dest", ",", "names", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "ErrAlreadyInUse", "||", "err", "==", "ErrNotFound", "{", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "nil", ",", "err", "\n", "case", "<-", "time", ".", "After", "(", "3", "*", "time", ".", "Second", ")", ":", "continue", "\n", "}", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "return", "r", ",", "nil", "\n", "}", "\n", "}" ]
23,970
all-23971
[ "getPRBuildData", "concurrently", "fetches", "metadata", "on", "each", "build", "of", "each", "job", "run", "on", "a", "PR" ]
[ "func", "getPRBuildData", "(", "bucket", "storageBucket", ",", "jobs", "[", "]", "jobBuilds", ")", "[", "]", "buildData", "{", "buildch", ":=", "make", "(", "chan", "buildData", ")", "\n", "defer", "close", "(", "buildch", ")", "\n", "expected", ":=", "0", "\n", "for", "_", ",", "job", ":=", "<mask>", "jobs", "{", "for", "j", ",", "buildPrefix", ":=", "range", "job", ".", "buildPrefixes", "{", "go", "func", "(", "j", "int", ",", "jobName", ",", "buildPrefix", "string", ")", "{", "build", ",", "err", ":=", "getBuildData", "(", "bucket", ",", "buildPrefix", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Warningf", "(", "\"", "\"", ",", "buildPrefix", ")", "\n", "}", "\n", "split", ":=", "strings", ".", "Split", "(", "strings", ".", "TrimSuffix", "(", "buildPrefix", ",", "\"", "\"", ")", ",", "\"", "\"", ")", "\n", "build", ".", "SpyglassLink", "=", "path", ".", "Join", "(", "spyglassPrefix", ",", "bucket", ".", "getName", "(", ")", ",", "buildPrefix", ")", "\n", "build", ".", "ID", "=", "split", "[", "len", "(", "split", ")", "-", "1", "]", "\n", "build", ".", "jobName", "=", "jobName", "\n", "build", ".", "prefix", "=", "buildPrefix", "\n", "build", ".", "index", "=", "j", "\n", "buildch", "<-", "build", "\n", "}", "(", "j", ",", "job", ".", "name", ",", "buildPrefix", ")", "\n", "expected", "++", "\n", "}", "\n", "}", "\n", "builds", ":=", "[", "]", "buildData", "{", "}", "\n", "for", "k", ":=", "0", ";", "k", "<", "expected", ";", "k", "++", "{", "build", ":=", "<-", "buildch", "\n", "builds", "=", "append", "(", "builds", ",", "build", ")", "\n", "}", "\n", "return", "builds", "\n", "}" ]
23,971
all-23972
[ "EtcdHeadlessService", "returns", "a", "headless", "etcd", "service", "which", "is", "only", "for", "DNS", "resolution", "." ]
[ "func", "EtcdHeadlessService", "(", "opts", "*", "AssetOpts", ")", "*", "v1", ".", "Service", "{", "return", "&", "v1", ".", "Service", "{", "TypeMeta", ":", "metav1", ".", "TypeMeta", "{", "Kind", ":", "\"", "\"", ",", "APIVersion", ":", "\"", "\"", ",", "}", ",", "ObjectMeta", ":", "objectMeta", "(", "etcdHeadlessServiceName", ",", "labels", "(", "etcdName", ")", ",", "nil", ",", "opts", ".", "Namespace", ")", ",", "Spec", ":", "v1", ".", "ServiceSpec", "{", "Selector", ":", "<mask>", "[", "string", "]", "string", "{", "\"", "\"", ":", "etcdName", ",", "}", ",", "ClusterIP", ":", "\"", "\"", ",", "Ports", ":", "[", "]", "v1", ".", "ServicePort", "{", "{", "Name", ":", "\"", "\"", ",", "Port", ":", "2380", ",", "}", ",", "}", ",", "}", ",", "}", "\n", "}" ]
23,972
all-23973
[ "SetLastModified", "sets", "Last", "-", "Modified", "header", "to", "the", "given", "value", "." ]
[ "func", "(", "h", "*", "ResponseHeader", ")", "SetLastModified", "(", "t", "time", ".", "Time", ")", "{", "h", ".", "bufKV", ".", "value", "=", "AppendHTTPDate", "(", "h", ".", "bufKV", ".", "value", "[", ":", "0", "]", ",", "t", ")", "\n", "h", ".", "SetCanonical", "(", "strLastModified", ",", "h", ".", "bufKV", ".", "<mask>", ")", "\n", "}" ]
23,973
all-23974
[ "SetResolution", "()", "is", "a", "wrapper", "around", "gtk_print_settings_set_resolution", "()", "." ]
[ "func", "(", "ps", "*", "PrintSettings", ")", "SetResolution", "(", "resolution", "int", ")", "{", "C", ".", "gtk_print_settings_set_resolution", "(", "<mask>", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "resolution", ")", ")", "\n", "}" ]
23,974
all-23975
[ "DrawImage", "draws", "the", "raster", "image", "in", "the", "current", "canvas" ]
[ "func", "(", "gc", "*", "GraphicContext", ")", "DrawImage", "(", "image", "image", ".", "Image", ")", "{", "bounds", ":=", "image", ".", "Bounds", "(", ")", "\n\n", "svgImage", ":=", "&", "Image", "{", "Href", ":", "imageToSvgHref", "(", "<mask>", ")", "}", "\n", "svgImage", ".", "X", "=", "float64", "(", "bounds", ".", "Min", ".", "X", ")", "\n", "svgImage", ".", "Y", "=", "float64", "(", "bounds", ".", "Min", ".", "Y", ")", "\n", "svgImage", ".", "Width", "=", "toSvgLength", "(", "float64", "(", "bounds", ".", "Max", ".", "X", "-", "bounds", ".", "Min", ".", "X", ")", ")", "\n", "svgImage", ".", "Height", "=", "toSvgLength", "(", "float64", "(", "bounds", ".", "Max", ".", "Y", "-", "bounds", ".", "Min", ".", "Y", ")", ")", "\n", "gc", ".", "newGroup", "(", "0", ")", ".", "Image", "=", "svgImage", "\n", "}" ]
23,975
all-23976
[ "runWithAgentCmds", "returns", "the", "list", "of", "commands", "that", "should", "be", "passed", "when", "the", "provisioner", "will", "run", "a", "unit", "using", "tsuru_unit_agent", "to", "start", ".", "This", "will", "only", "be", "called", "for", "legacy", "containers", "that", "have", "not", "been", "re", "-", "deployed", "since", "the", "introduction", "of", "independent", "units", "per", "process", "in", "0", ".", "12", ".", "0", "." ]
[ "func", "runWithAgentCmds", "(", "app", "provision", ".", "App", ")", "(", "[", "]", "string", ",", "error", ")", "{", "runCmd", ",", "err", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "runCmd", "=", "\"", "\"", "\n", "}", "\n", "<mask>", ",", "_", ":=", "config", ".", "GetString", "(", "\"", "\"", ")", "\n", "token", ":=", "app", ".", "Envs", "(", ")", "[", "\"", "\"", "]", ".", "Value", "\n", "return", "[", "]", "string", "{", "\"", "\"", ",", "host", ",", "token", ",", "app", ".", "GetName", "(", ")", ",", "runCmd", "}", ",", "nil", "\n", "}" ]
23,976
all-23977
[ "nextEnts", "returns", "all", "the", "available", "entries", "for", "execution", ".", "If", "applied", "is", "smaller", "than", "the", "index", "of", "snapshot", "it", "returns", "all", "committed", "entries", "after", "the", "index", "of", "snapshot", "." ]
[ "func", "(", "l", "*", "raftLog", ")", "nextEnts", "(", ")", "(", "ents", "[", "]", "pb", ".", "Entry", ")", "{", "off", ":=", "<mask>", "(", "l", ".", "applied", "+", "1", ",", "l", ".", "firstIndex", "(", ")", ")", "\n", "if", "l", ".", "committed", "+", "1", ">", "off", "{", "ents", ",", "err", ":=", "l", ".", "slice", "(", "off", ",", "l", ".", "committed", "+", "1", ",", "l", ".", "maxNextEntsSize", ")", "\n", "if", "err", "!=", "nil", "{", "l", ".", "logger", ".", "Panicf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "ents", "\n", "}", "\n", "return", "nil", "\n", "}" ]
23,977
all-23978
[ "MiddlewareFunc", "returns", "a", "HandlerFunc", "that", "implements", "the", "middleware", "." ]
[ "func", "(", "mw", "*", "JsonpMiddleware", ")", "MiddlewareFunc", "(", "h", "HandlerFunc", ")", "HandlerFunc", "{", "if", "mw", ".", "CallbackNameKey", "==", "\"", "\"", "{", "mw", ".", "CallbackNameKey", "=", "\"", "\"", "\n", "}", "\n\n", "return", "func", "(", "w", "ResponseWriter", ",", "r", "*", "Request", ")", "{", "callbackName", ":=", "r", ".", "URL", ".", "<mask>", "(", ")", ".", "Get", "(", "mw", ".", "CallbackNameKey", ")", "\n", "// TODO validate the callbackName ?", "if", "callbackName", "!=", "\"", "\"", "{", "// the client request JSONP, instantiate JsonpMiddleware.", "writer", ":=", "&", "jsonpResponseWriter", "{", "w", ",", "false", ",", "callbackName", "}", "\n", "// call the handler with the wrapped writer", "h", "(", "writer", ",", "r", ")", "\n", "}", "else", "{", "// do nothing special", "h", "(", "w", ",", "r", ")", "\n", "}", "\n\n", "}", "\n", "}" ]
23,978
all-23979
[ "Describe", "implements", "prometheus", "Collector", "interface", "." ]
[ "func", "(", "s", "*", "Storage", ")", "Describe", "(", "in", "chan", "<-", "*", "prometheus", ".", "Desc", ")", "{", "s", ".", "connections", ".", "Describe", "(", "in", ")", "\n", "s", ".", "queriesTotal", ".", "Describe", "(", "in", ")", "\n", "s", ".", "queriesDuration", ".", "Describe", "(", "in", ")", "\n", "s", ".", "<mask>", ".", "Describe", "(", "in", ")", "\n", "}" ]
23,979
all-23980
[ "establish", "data", "storage", "format", "dimensions", "and", "sample", "count", "of", "a", "renderbuffer", "object", "s", "image" ]
[ "func", "NamedRenderbufferStorageMultisample", "(", "renderbuffer", "uint32", ",", "samples", "int32", ",", "internalformat", "uint32", ",", "width", "int32", ",", "height", "int32", ")", "{", "C", ".", "glowNamedRenderbufferStorageMultisample", "(", "gpNamedRenderbufferStorageMultisample", ",", "(", "C", ".", "GLuint", ")", "(", "renderbuffer", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "samples", ")", ",", "(", "C", ".", "GLenum", ")", "(", "internalformat", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "width", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "<mask>", ")", ")", "\n", "}" ]
23,980
all-23981
[ "Columns", "returns", "the", "current", "list", "of", "table", "columns" ]
[ "func", "(", "l", "*", "TableView", ")", "Columns", "(", ")", "[", "]", "Column", "{", "c", ":=", "make", "(", "[", "]", "Column", ",", "len", "(", "l", ".", "columns", ")", ")", "\n", "<mask>", "(", "c", ",", "l", ".", "columns", ")", "\n", "return", "c", "\n", "}" ]
23,981
all-23982
[ "User", "Data", "are", "used", "to", "store", "custom", "information", "mainly", "by", "Mason", "and", "Masonable", "implementation", ".", "Mason", "used", "a", "LeasedResource", "keys", "to", "store", "information", "about", "other", "resources", "that", "used", "to", "create", "the", "given", "resource", ".", "Set", "marshalls", "a", "struct", "to", "a", "string", "into", "the", "UserData" ]
[ "func", "(", "ud", "*", "UserData", ")", "Set", "(", "id", "string", ",", "in", "<mask>", "{", "}", ")", "error", "{", "b", ",", "err", ":=", "yaml", ".", "Marshal", "(", "in", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "ud", ".", "Store", "(", "id", ",", "string", "(", "b", ")", ")", "\n", "return", "nil", "\n", "}" ]
23,982
all-23983
[ "GetImage", "returns", "an", "Image", "struct", "for", "the", "provided", "fingerprint" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetImage", "(", "fingerprint", "string", ")", "(", "*", "api", ".", "<mask>", ",", "string", ",", "error", ")", "{", "return", "r", ".", "GetPrivateImage", "(", "fingerprint", ",", "\"", "\"", ")", "\n", "}" ]
23,983
all-23984
[ "NewHTTPClient", "returns", "a", "client", "that", "speaks", "to", "tor", "open", "sock", "." ]
[ "func", "NewHTTPClient", "(", "sock", "uint", ")", "(", "*", "http", ".", "Client", ",", "error", ")", "{", "torProxyURL", ",", "err", ":=", "url", ".", "Parse", "(", "fmt", ".", "Sprint", "(", "\"", "\"", ",", "sock", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Set up a custom HTTP transport to use the proxy and create the client", "torTransport", ":=", "&", "http", ".", "Transport", "{", "<mask>", ":", "http", ".", "ProxyURL", "(", "torProxyURL", ")", "}", "\n", "return", "&", "http", ".", "Client", "{", "Transport", ":", "torTransport", ",", "Timeout", ":", "time", ".", "Second", "*", "10", ",", "}", ",", "nil", "\n", "}" ]
23,984
all-23985
[ "Log", "adds", "a", "log", "message", "to", "the", "app", ".", "Specifying", "a", "good", "source", "is", "good", "so", "the", "user", "can", "filter", "where", "the", "message", "come", "from", "." ]
[ "func", "(", "app", "*", "App", ")", "Log", "(", "message", ",", "source", ",", "unit", "string", ")", "error", "{", "messages", ":=", "strings", ".", "Split", "(", "message", ",", "\"", "\\n", "\"", ")", "\n", "logs", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "0", ",", "len", "(", "messages", ")", ")", "\n", "for", "_", ",", "msg", ":=", "range", "messages", "{", "if", "msg", "!=", "\"", "\"", "{", "l", ":=", "Applog", "{", "Date", ":", "<mask>", ".", "Now", "(", ")", ".", "In", "(", "time", ".", "UTC", ")", ",", "Message", ":", "msg", ",", "Source", ":", "source", ",", "AppName", ":", "app", ".", "Name", ",", "Unit", ":", "unit", ",", "}", "\n", "logs", "=", "append", "(", "logs", ",", "l", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "logs", ")", ">", "0", "{", "conn", ",", "err", ":=", "db", ".", "LogConn", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "conn", ".", "Close", "(", ")", "\n", "return", "conn", ".", "AppLogCollection", "(", "app", ".", "Name", ")", ".", "Insert", "(", "logs", "...", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
23,985
all-23986
[ "LastNLinesChunked", "reads", "the", "last", "n", "lines", "from", "an", "artifact", "by", "reading", "chunks", "of", "size", "chunkSize", "from", "the", "end", "of", "the", "artifact", ".", "Best", "performance", "is", "achieved", "by", ":", "argmin", "0<chunkSize<INTMAX", "f", "(", "chunkSize", ")", "=", "chunkSize", "-", "n", "*", "avgLineLength" ]
[ "func", "LastNLinesChunked", "(", "a", "Artifact", ",", "n", ",", "chunkSize", "int64", ")", "(", "[", "]", "string", ",", "error", ")", "{", "toRead", ":=", "chunkSize", "+", "1", "// Add 1 for exclusive upper bound read range", "\n", "chunks", ":=", "int64", "(", "1", ")", "\n", "var", "contents", "[", "]", "byte", "\n", "var", "linesInContents", "int64", "\n", "artifactSize", ",", "err", ":=", "a", ".", "Size", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "offset", ":=", "artifactSize", "-", "chunks", "*", "chunkSize", "\n", "lastOffset", ":=", "offset", "\n", "var", "lastRead", "int64", "\n", "for", "linesInContents", "<", "n", "&&", "offset", "!=", "0", "{", "offset", "=", "lastOffset", "-", "lastRead", "\n", "if", "offset", "<", "0", "{", "toRead", "=", "offset", "+", "chunkSize", "+", "1", "\n", "offset", "=", "0", "\n", "}", "\n", "bytesRead", ":=", "make", "(", "[", "]", "byte", ",", "toRead", ")", "\n", "numBytesRead", ",", "err", ":=", "a", ".", "ReadAt", "(", "bytesRead", ",", "offset", ")", "\n", "if", "err", "!=", "nil", "&&", "err", "!=", "io", ".", "EOF", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "lastRead", "=", "int64", "(", "numBytesRead", ")", "\n", "lastOffset", "=", "offset", "\n", "bytesRead", "=", "bytes", ".", "Trim", "(", "bytesRead", ",", "\"", "\\x00", "\"", ")", "\n", "linesInContents", "+=", "int64", "(", "bytes", ".", "Count", "(", "bytesRead", ",", "[", "]", "byte", "(", "\"", "\\n", "\"", ")", ")", ")", "\n", "contents", "=", "append", "(", "bytesRead", ",", "contents", "...", ")", "\n", "chunks", "++", "\n", "}", "\n\n", "var", "lines", "[", "]", "string", "\n", "scanner", ":=", "bufio", ".", "NewScanner", "(", "bytes", ".", "NewReader", "(", "contents", ")", ")", "\n", "scanner", ".", "Split", "(", "bufio", ".", "ScanLines", ")", "\n", "for", "scanner", ".", "Scan", "(", ")", "{", "line", ":=", "scanner", ".", "Text", "(", ")", "\n", "lines", "=", "append", "(", "<mask>", ",", "line", ")", "\n", "}", "\n", "l", ":=", "int64", "(", "len", "(", "lines", ")", ")", "\n", "if", "l", "<", "n", "{", "return", "lines", ",", "nil", "\n", "}", "\n", "return", "lines", "[", "l", "-", "n", ":", "]", ",", "nil", "\n", "}" ]
23,986
all-23987
[ "WithMetadata", "specifies", "message", "-", "implementation", "specific", "metadata", "to", "go", "with", "the", "content" ]
[ "func", "(", "p", "*", "Message", ")", "WithMetadata", "(", "<mask>", "MapMatcher", ")", "*", "Message", "{", "p", ".", "Metadata", "=", "metadata", "\n", "return", "p", "\n", "}" ]
23,987
all-23988
[ "Put", "saves", "src", "to", "the", "index", ".", "If", "id", "is", "empty", "a", "new", "ID", "is", "allocated", "by", "the", "service", "and", "returned", ".", "If", "id", "is", "not", "empty", "any", "existing", "index", "entry", "for", "that", "ID", "is", "replaced", ".", "The", "ID", "is", "a", "human", "-", "readable", "ASCII", "string", ".", "It", "must", "contain", "no", "whitespace", "characters", "and", "not", "start", "with", "!", ".", "src", "must", "be", "a", "non", "-", "nil", "struct", "pointer", "or", "implement", "the", "FieldLoadSaver", "interface", "." ]
[ "func", "(", "x", "*", "Index", ")", "Put", "(", "c", "context", ".", "<mask>", ",", "id", "string", ",", "src", "interface", "{", "}", ")", "(", "string", ",", "error", ")", "{", "ids", ",", "err", ":=", "x", ".", "PutMulti", "(", "c", ",", "[", "]", "string", "{", "id", "}", ",", "[", "]", "interface", "{", "}", "{", "src", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "ids", "[", "0", "]", ",", "nil", "\n", "}" ]
23,988
all-23989
[ "GetNameOk", "returns", "a", "tuple", "with", "the", "Name", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "Creator", ")", "GetNameOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "c", "==", "nil", "||", "c", ".", "Name", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "c", ".", "<mask>", ",", "true", "\n", "}" ]
23,989
all-23990
[ "CreateSystemDefaultDevice", "returns", "the", "preferred", "system", "default", "Metal", "device", ".", "Reference", ":", "https", ":", "//", "developer", ".", "apple", ".", "com", "/", "documentation", "/", "metal", "/", "1433401", "-", "mtlcreatesystemdefaultdevice", "." ]
[ "func", "CreateSystemDefaultDevice", "(", ")", "(", "Device", ",", "error", ")", "{", "d", ":=", "C", ".", "CreateSystemDefaultDevice", "(", ")", "\n", "if", "d", ".", "Device", "==", "nil", "{", "return", "Device", "{", "}", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "<mask>", "{", "device", ":", "d", ".", "Device", ",", "Headless", ":", "d", ".", "Headless", "!=", "0", ",", "LowPower", ":", "d", ".", "LowPower", "!=", "0", ",", "Name", ":", "C", ".", "GoString", "(", "d", ".", "Name", ")", ",", "}", ",", "nil", "\n", "}" ]
23,990
all-23991
[ "MakeFakeSku", "---" ]
[ "func", "MakeFakeSku", "(", "<mask>", "string", ")", "(", "*", "FakeSku", ",", "*", "taskmanager", ".", "Task", ",", "*", "taskmanager", ".", "Task", ")", "{", "spyTask", ":=", "&", "taskmanager", ".", "Task", "{", "ID", ":", "bson", ".", "NewObjectId", "(", ")", ",", "Expires", ":", "time", ".", "Now", "(", ")", ".", "UnixNano", "(", ")", ",", "PrivateMetaData", ":", "map", "[", "string", "]", "interface", "{", "}", "{", "}", ",", "}", "\n", "myFakeManager", ":=", "&", "FakeTaskManager", "{", "ReturnedTask", ":", "spyTask", ",", "SpyTaskSaved", ":", "new", "(", "taskmanager", ".", "Task", ")", ",", "}", "\n", "spyTask", ".", "Protect", "(", "myFakeManager", ",", "sync", ".", "RWMutex", "{", "}", ")", "\n", "s", ":=", "new", "(", "FakeSku", ")", "\n", "return", "s", ",", "spyTask", ",", "myFakeManager", ".", "SpyTaskSaved", "\n", "}" ]
23,991
all-23992
[ "updateContainerMetadata", "sets", "the", "container", "metadata", "from", "the", "docker", "inspect" ]
[ "func", "updateContainerMetadata", "(", "metadata", "*", "dockerapi", ".", "DockerContainerMetadata", ",", "container", "*", "apicontainer", ".", "Container", ",", "task", "*", "apitask", ".", "Task", ")", "{", "container", ".", "SetCreatedAt", "(", "metadata", ".", "CreatedAt", ")", "\n", "container", ".", "SetStartedAt", "(", "metadata", ".", "StartedAt", ")", "\n", "container", ".", "SetFinishedAt", "(", "metadata", ".", "FinishedAt", ")", "\n\n", "// Set the labels if it's not set", "if", "len", "(", "metadata", ".", "Labels", ")", "!=", "0", "&&", "len", "(", "container", ".", "GetLabels", "(", ")", ")", "==", "0", "{", "container", ".", "SetLabels", "(", "metadata", ".", "Labels", ")", "\n", "}", "\n\n", "// Update volume for empty volume container", "if", "metadata", ".", "Volumes", "!=", "nil", "{", "if", "<mask>", ".", "IsInternal", "(", ")", "{", "task", ".", "UpdateMountPoints", "(", "container", ",", "metadata", ".", "Volumes", ")", "\n", "}", "else", "{", "container", ".", "SetVolumes", "(", "metadata", ".", "Volumes", ")", "\n", "}", "\n", "}", "\n\n", "// Set Exitcode if it's not set", "if", "metadata", ".", "ExitCode", "!=", "nil", "{", "container", ".", "SetKnownExitCode", "(", "metadata", ".", "ExitCode", ")", "\n", "}", "\n\n", "// Set port mappings", "if", "len", "(", "metadata", ".", "PortBindings", ")", "!=", "0", "&&", "len", "(", "container", ".", "GetKnownPortBindings", "(", ")", ")", "==", "0", "{", "container", ".", "SetKnownPortBindings", "(", "metadata", ".", "PortBindings", ")", "\n", "}", "\n", "// update the container health information", "if", "container", ".", "HealthStatusShouldBeReported", "(", ")", "{", "container", ".", "SetHealthStatus", "(", "metadata", ".", "Health", ")", "\n", "}", "\n", "container", ".", "SetNetworkMode", "(", "metadata", ".", "NetworkMode", ")", "\n", "container", ".", "SetNetworkSettings", "(", "metadata", ".", "NetworkSettings", ")", "\n", "}" ]
23,992
all-23993
[ "GetTitleOk", "returns", "a", "tuple", "with", "the", "Title", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "a", "*", "AlertGraphDefinition", ")", "GetTitleOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "a", "==", "nil", "||", "a", ".", "Title", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "a", ".", "Title", ",", "<mask>", "\n", "}" ]
23,993
all-23994
[ "Returns", "a", "boolean", "at", "the", "key", "or", "the", "specified", "value", "if", "it", "doesn", "t", "exist", "or", "isn", "t", "a", "bool" ]
[ "func", "(", "t", "Typed", ")", "BoolOr", "(", "key", "string", ",", "d", "bool", ")", "bool", "{", "if", "value", ",", "exists", ":=", "t", ".", "BoolIf", "(", "key", ")", ";", "exists", "{", "return", "<mask>", "\n", "}", "\n", "return", "d", "\n", "}" ]
23,994
all-23995
[ "increment", "nonce", "big", "-", "endian", "by", "1", "with", "wraparound", "." ]
[ "func", "incrNonce", "(", "nonce", "*", "[", "24", "]", "<mask>", ")", "{", "for", "i", ":=", "23", ";", "0", "<=", "i", ";", "i", "--", "{", "nonce", "[", "i", "]", "+=", "1", "\n", "if", "nonce", "[", "i", "]", "!=", "0", "{", "return", "\n", "}", "\n", "}", "\n", "}" ]
23,995
all-23996
[ "verifyCNIPluginsCapabilities", "returns", "an", "error", "if", "there", "s", "an", "error", "querying", "capabilities", "or", "if", "the", "required", "capability", "is", "absent", "from", "the", "capabilities", "of", "the", "following", "plugins", ":", "a", ".", "ecs", "-", "eni", "b", ".", "ecs", "-", "bridge", "c", ".", "ecs", "-", "ipam", "d", ".", "aws", "-", "appmesh" ]
[ "func", "(", "agent", "*", "ecsAgent", ")", "verifyCNIPluginsCapabilities", "(", ")", "error", "{", "// Check if we can get capabilities from each plugin", "for", "_", ",", "plugin", ":=", "range", "awsVPCCNIPlugins", "{", "capabilities", ",", "err", ":=", "<mask>", ".", "cniClient", ".", "Capabilities", "(", "plugin", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// appmesh plugin is not needed for awsvpc networking capability", "if", "plugin", "==", "ecscni", ".", "ECSAppMeshPluginName", "{", "continue", "\n", "}", "\n", "if", "!", "contains", "(", "capabilities", ",", "ecscni", ".", "CapabilityAWSVPCNetworkingMode", ")", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "plugin", ",", "ecscni", ".", "CapabilityAWSVPCNetworkingMode", ")", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
23,996
all-23997
[ "MarshalBinary", "interface", "implementation" ]
[ "func", "(", "m", "*", "<mask>", ")", "MarshalBinary", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "m", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "swag", ".", "WriteJSON", "(", "m", ")", "\n", "}" ]
23,997
all-23998
[ "DeclareVar", "puts", "a", "new", "variable", "in", "the", "stack", "and", "returns", "the", "index", "where", "it", "now", "resides" ]
[ "func", "(", "f", "*", "Frame", ")", "DeclareVar", "(", "v", "<mask>", "{", "}", ")", "int", "{", "f", ".", "stack", ".", "Push", "(", "v", ")", "\n", "return", "f", ".", "stack", ".", "Size", "(", ")", "-", "1", "\n", "}" ]
23,998
all-23999
[ "printECSAttributes", "prints", "the", "Agent", "s", "ECS", "Attributes", "based", "on", "its", "environment" ]
[ "func", "(", "agent", "*", "ecsAgent", ")", "printECSAttributes", "(", ")", "int", "{", "capabilities", ",", "err", ":=", "<mask>", ".", "capabilities", "(", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "exitcodes", ".", "ExitError", "\n", "}", "\n", "for", "_", ",", "attr", ":=", "range", "capabilities", "{", "fmt", ".", "Printf", "(", "\"", "\\t", "\\n", "\"", ",", "aws", ".", "StringValue", "(", "attr", ".", "Name", ")", ",", "aws", ".", "StringValue", "(", "attr", ".", "Value", ")", ")", "\n", "}", "\n", "return", "exitcodes", ".", "ExitSuccess", "\n", "}" ]
23,999
all-24000
[ "Next", "returns", "the", "index", "of", "the", "element", "after", "from", "or", "-", "1", "if", "no", "more", ".", "returns", "-", "2", "if", "erroneous", "input", "(", "bad", "from", ")", "." ]
[ "func", "(", "f", "*", "FixedSizeRingBuf", ")", "Nextpos", "(", "from", "int", ")", "int", "{", "if", "from", ">=", "f", ".", "N", "||", "from", "<", "0", "{", "return", "-", "2", "\n", "}", "\n", "if", "f", ".", "Readable", "==", "0", "{", "return", "-", "1", "\n", "}", "\n\n", "last", ":=", "f", ".", "Last", "(", ")", "\n", "if", "from", "==", "last", "{", "return", "-", "1", "\n", "}", "\n", "a0", ",", "a1", ",", "b0", ",", "b1", ":=", "f", ".", "LegalPos", "(", ")", "\n", "<mask>", "{", "case", "from", ">=", "a0", "&&", "from", "<", "a1", ":", "return", "from", "+", "1", "\n", "case", "from", "==", "a1", ":", "return", "b0", "// can be -1", "\n", "case", "from", ">=", "b0", "&&", "from", "<", "b1", ":", "return", "from", "+", "1", "\n", "case", "from", "==", "b1", ":", "return", "-", "1", "\n", "}", "\n", "return", "-", "1", "\n", "}" ]