id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
21,800
all-21801
[ "constructor" ]
[ "func", "newInputs", "(", "d", "string", ")", "*", "inputs", "{", "in", ":=", "new", "(", "inputs", ")", "\n", "in", ".", "<mask>", "=", "d", "+", "\"", "\"", "\n", "return", "in", "\n", "}" ]
21,801
all-21802
[ "New", "returns", "a", "client", "/", "server", "to", "bidirectionally", "communicate", "with", "the", "backend", ".", "The", "returned", "struct", "should", "have", "both", "Connect", "and", "Serve", "called", "upon", "it", "before", "being", "used", "." ]
[ "func", "New", "(", "url", "string", ",", "cfg", "*", "config", ".", "Config", ",", "credentialProvider", "*", "credentials", ".", "Credentials", ",", "statsEngine", "stats", ".", "Engine", ",", "publishMetricsInterval", "<mask>", ".", "Duration", ",", "rwTimeout", "time", ".", "Duration", ",", "disableResourceMetrics", "bool", ")", "wsclient", ".", "ClientServer", "{", "cs", ":=", "&", "clientServer", "{", "statsEngine", ":", "statsEngine", ",", "publishTicker", ":", "nil", ",", "publishHealthTicker", ":", "nil", ",", "publishMetricsInterval", ":", "publishMetricsInterval", ",", "}", "\n", "cs", ".", "URL", "=", "url", "\n", "cs", ".", "AgentConfig", "=", "cfg", "\n", "cs", ".", "CredentialProvider", "=", "credentialProvider", "\n", "cs", ".", "ServiceError", "=", "&", "tcsError", "{", "}", "\n", "cs", ".", "RequestHandlers", "=", "make", "(", "map", "[", "string", "]", "wsclient", ".", "RequestHandler", ")", "\n", "cs", ".", "MakeRequestHook", "=", "signRequestFunc", "(", "url", ",", "cs", ".", "AgentConfig", ".", "AWSRegion", ",", "credentialProvider", ")", "\n", "cs", ".", "TypeDecoder", "=", "NewTCSDecoder", "(", ")", "\n", "cs", ".", "RWTimeout", "=", "rwTimeout", "\n", "cs", ".", "disableResourceMetrics", "=", "disableResourceMetrics", "\n", "// TODO make this context inherited from the handler", "cs", ".", "ctx", ",", "cs", ".", "cancel", "=", "context", ".", "WithCancel", "(", "context", ".", "TODO", "(", ")", ")", "\n", "return", "cs", "\n", "}" ]
21,802
all-21803
[ "expandStates", "expands", "the", "states", "list", "by", "one" ]
[ "func", "(", "c", "*", "context", ")", "expandStates", "(", ")", "[", "]", "<mask>", "{", "states", ":=", "c", ".", "states", "(", ")", "\n", "ns", ":=", "len", "(", "states", ")", "\n", "if", "ns", "==", "1", "{", "s", ":=", "states", "[", "0", "]", "\n", "n", ":=", "c", ".", "a", ".", "allocUnits", "(", "1", ")", "\n", "if", "n", "==", "0", "{", "return", "nil", "\n", "}", "\n", "c", ".", "setStatesIndex", "(", "n", ")", "\n", "states", "=", "c", ".", "a", ".", "states", "[", "n", ":", "]", "\n", "states", "[", "0", "]", "=", "s", "\n", "}", "else", "if", "ns", "&", "0x1", "==", "0", "{", "u", ":=", "ns", ">>", "1", "\n", "i1", ":=", "units2Index", "[", "u", "]", "\n", "i2", ":=", "units2Index", "[", "u", "+", "1", "]", "\n", "if", "i1", "!=", "i2", "{", "n", ":=", "c", ".", "a", ".", "allocUnits", "(", "i2", ")", "\n", "if", "n", "==", "0", "{", "return", "nil", "\n", "}", "\n", "copy", "(", "c", ".", "a", ".", "states", "[", "n", ":", "]", ",", "states", ")", "\n", "c", ".", "a", ".", "addFreeBlock", "(", "c", ".", "statesIndex", "(", ")", ",", "i1", ")", "\n", "c", ".", "setStatesIndex", "(", "n", ")", "\n", "states", "=", "c", ".", "a", ".", "states", "[", "n", ":", "]", "\n", "}", "\n", "}", "\n", "c", ".", "setNumStates", "(", "ns", "+", "1", ")", "\n", "return", "states", "[", ":", "ns", "+", "1", "]", "\n", "}" ]
21,803
all-21804
[ "ClearCache", "clears", "the", "cache", "of", "the", "specified", "project", "Returns", "the", "status", "returned", "by", "CircleCI" ]
[ "func", "(", "c", "*", "Client", ")", "ClearCache", "(", "account", ",", "repo", "string", ")", "(", "string", ",", "error", ")", "{", "status", ":=", "&", "struct", "{", "Status", "string", "`json:\"status\"`", "\n", "}", "{", "}", "\n\n", "err", ":=", "c", ".", "<mask>", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "account", ",", "repo", ")", ",", "status", ",", "nil", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "status", ".", "Status", ",", "nil", "\n", "}" ]
21,804
all-21805
[ "UpdateProgress", "is", "a", "helper", "to", "update", "the", "status", "using", "an", "iopgress", "instance" ]
[ "func", "(", "p", "*", "ProgressRenderer", ")", "UpdateProgress", "(", "<mask>", "ioprogress", ".", "ProgressData", ")", "{", "p", ".", "Update", "(", "progress", ".", "Text", ")", "\n", "}" ]
21,805
all-21806
[ "SaveConfigFile", "writes", "configuration", "file", "to", "local", "file", "system" ]
[ "func", "SaveConfigFile", "(", "c", "*", "ConfigFile", ",", "filename", "string", ")", "(", "err", "error", ")", "{", "// Write configuration file by filename.", "var", "f", "*", "<mask>", ".", "File", "\n", "if", "f", ",", "err", "=", "os", ".", "Create", "(", "filename", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "SaveConfigData", "(", "c", ",", "f", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "f", ".", "Close", "(", ")", "\n", "}" ]
21,806
all-21807
[ "CreateRuleSet", "creates", "a", "new", "rule", "set", "." ]
[ "func", "(", "a", "*", "API", ")", "CreateRuleSet", "(", "cfg", "*", "RuleSet", ")", "(", "*", "RuleSet", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "jsonCfg", ",", "err", ":=", "json", ".", "Marshal", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "jsonCfg", ")", ")", "\n", "}", "\n\n", "resp", ",", "err", ":=", "a", ".", "Post", "(", "config", ".", "RuleSetPrefix", ",", "jsonCfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "ruleset", ":=", "&", "RuleSet", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "resp", ",", "ruleset", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "ruleset", ",", "nil", "\n", "}" ]
21,807
all-21808
[ "WithEnd", "end", "of", "range", "to", "search", "possible", "breakpoint", "locations", "in", "(", "excluding", ")", ".", "When", "not", "specified", "end", "of", "scripts", "is", "used", "as", "end", "of", "range", "." ]
[ "func", "(", "p", "GetPossibleBreakpointsParams", ")", "WithEnd", "(", "end", "*", "<mask>", ")", "*", "GetPossibleBreakpointsParams", "{", "p", ".", "End", "=", "end", "\n", "return", "&", "p", "\n", "}" ]
21,808
all-21809
[ "set", "front", "and", "back", "function", "and", "reference", "value", "for", "stencil", "testing" ]
[ "func", "StencilFunc", "(", "xfunc", "uint32", ",", "ref", "int32", ",", "mask", "uint32", ")", "{", "C", ".", "glowStencilFunc", "(", "gpStencilFunc", ",", "(", "C", ".", "GLenum", ")", "(", "xfunc", ")", ",", "(", "C", ".", "GLint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLuint", ")", "(", "mask", ")", ")", "\n", "}" ]
21,809
all-21810
[ "InitArgs", "returns", "an", "options", "func", "to", "configure", "a", "LinuxFactory", "with", "the", "provided", "init", "arguments", "." ]
[ "func", "InitArgs", "(", "args", "...", "string", ")", "func", "(", "*", "LinuxFactory", ")", "error", "{", "return", "func", "(", "l", "*", "LinuxFactory", ")", "error", "{", "name", ":=", "args", "[", "0", "]", "\n", "if", "filepath", ".", "Base", "(", "name", ")", "==", "name", "{", "if", "lp", ",", "err", ":=", "<mask>", ".", "LookPath", "(", "name", ")", ";", "err", "==", "nil", "{", "name", "=", "lp", "\n", "}", "\n", "}", "\n", "l", ".", "InitPath", "=", "name", "\n", "l", ".", "InitArgs", "=", "append", "(", "[", "]", "string", "{", "name", "}", ",", "args", "[", "1", ":", "]", "...", ")", "\n", "return", "nil", "\n", "}", "\n", "}" ]
21,810
all-21811
[ "GetInflationResult", "retrieves", "the", "InflationResult", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "OperationResultTr", ")", "GetInflationResult", "(", ")", "(", "result", "InflationResult", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "<mask>", "=", "*", "u", ".", "InflationResult", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
21,811
all-21812
[ "Do", "executes", "the", "function", "in", "a", "transaction", "." ]
[ "func", "Do", "(", "d", "<mask>", ",", "f", "func", "(", "t", "Tx", ")", "error", ")", "error", "{", "t", ",", "err", ":=", "d", ".", "TxBegin", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "t", ".", "TxFinish", "(", ")", "\n", "err", "=", "f", "(", "t", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "t", ".", "TxCommit", "(", ")", "\n", "}" ]
21,812
all-21813
[ "NewBodyLimiter", "returns", "a", "new", "body", "limiter", "for", "the", "specified", "request", "." ]
[ "func", "NewBodyLimiter", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "<mask>", ",", "n", "int64", ")", "*", "BodyLimiter", "{", "return", "&", "BodyLimiter", "{", "Original", ":", "r", ".", "Body", ",", "ReadCloser", ":", "http", ".", "MaxBytesReader", "(", "w", ",", "r", ".", "Body", ",", "n", ")", ",", "}", "\n", "}" ]
21,813
all-21814
[ "SetEvaluationTimestamp", "updates", "evaluationTimestamp", "to", "the", "timestamp", "of", "when", "the", "rule", "was", "last", "evaluated", "." ]
[ "func", "(", "rule", "*", "RecordingRule", ")", "SetEvaluationTimestamp", "(", "<mask>", "time", ".", "Time", ")", "{", "rule", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "rule", ".", "mtx", ".", "Unlock", "(", ")", "\n", "rule", ".", "evaluationTimestamp", "=", "ts", "\n", "}" ]
21,814
all-21815
[ "NewRemoteMysqlDump", "-", "will", "initialize", "a", "mysqldmp", "for", "remote", "execution" ]
[ "func", "NewRemoteMysqlDump", "(", "username", ",", "password", "string", ",", "sshCfg", "command", ".", "SshConfig", ")", "(", "*", "MysqlDump", ",", "error", ")", "{", "return", "NewRemoteMysqlDumpWithPath", "(", "username", ",", "<mask>", ",", "sshCfg", ",", "\"", "\"", ")", "\n", "}" ]
21,815
all-21816
[ "GetQueryOk", "returns", "a", "tuple", "with", "the", "Query", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TileDefEvent", ")", "GetQueryOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "t", "==", "nil", "||", "t", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "t", ".", "Query", ",", "true", "\n", "}" ]
21,816
all-21817
[ "ContainerDockerStats", "indicates", "an", "expected", "call", "of", "ContainerDockerStats" ]
[ "func", "(", "mr", "*", "MockEngineMockRecorder", ")", "ContainerDockerStats", "(", "arg0", ",", "arg1", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockEngine", ")", "(", "nil", ")", ".", "ContainerDockerStats", ")", ",", "arg0", ",", "arg1", ")", "\n", "}" ]
21,817
all-21818
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "FrameResourceTree", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage46", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
21,818
all-21819
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetMetadataParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb12", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
21,819
all-21820
[ "===", "day_of_week", "(", "v", "Vector", ")", "Scalar", "===" ]
[ "func", "funcDayOfWeek", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "return", "dateWrapper", "(", "vals", ",", "enh", ",", "func", "(", "t", "<mask>", ".", "Time", ")", "float64", "{", "return", "float64", "(", "t", ".", "Weekday", "(", ")", ")", "\n", "}", ")", "\n", "}" ]
21,820
all-21821
[ "dedupEnvCase", "is", "dedupEnv", "with", "a", "case", "option", "for", "testing", ".", "If", "caseInsensitive", "is", "true", "the", "case", "of", "keys", "is", "ignored", "." ]
[ "func", "dedupEnvCase", "(", "caseInsensitive", "bool", ",", "env", "[", "]", "string", ")", "[", "]", "string", "{", "out", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "env", ")", ")", "\n", "saw", ":=", "map", "[", "string", "]", "int", "{", "}", "// key => index into out", "\n", "for", "_", ",", "kv", ":=", "range", "env", "{", "eq", ":=", "strings", ".", "Index", "(", "kv", ",", "\"", "\"", ")", "\n", "if", "eq", "<", "0", "{", "out", "=", "append", "(", "out", ",", "kv", ")", "\n", "continue", "\n", "}", "\n", "k", ":=", "kv", "[", ":", "eq", "]", "\n", "if", "caseInsensitive", "{", "k", "=", "strings", ".", "ToLower", "(", "k", ")", "\n", "}", "\n", "if", "dupIdx", ",", "isDup", ":=", "saw", "[", "k", "]", ";", "isDup", "{", "out", "[", "dupIdx", "]", "=", "kv", "\n", "continue", "\n", "}", "\n", "saw", "[", "k", "]", "=", "len", "(", "out", ")", "\n", "out", "=", "append", "(", "out", ",", "kv", ")", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
21,821
all-21822
[ "diffNewOld", "returns", "any", "elements", "of", "new", "that", "were", "missing", "in", "old", "." ]
[ "func", "(", "p", "*", "tagDiffProcessor", ")", "diffNewOld", "(", ")", "[", "]", "<mask>", "{", "return", "p", ".", "diff", "(", "p", ".", "newTagIDs", ",", "p", ".", "oldTagIDs", ")", "\n", "}" ]
21,822
all-21823
[ "IsInstanceTypeChangedError", "returns", "true", "if", "the", "error", "when", "registering", "the", "container", "instance", "is", "because", "of", "instance", "type", "being", "changed" ]
[ "func", "IsInstanceTypeChangedError", "(", "err", "error", ")", "bool", "{", "if", "awserr", ",", "ok", ":=", "err", ".", "(", "awserr", ".", "Error", ")", ";", "ok", "{", "return", "strings", ".", "Contains", "(", "awserr", ".", "Message", "(", ")", ",", "InstanceTypeChangedErrorMessage", ")", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
21,823
all-21824
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "OrientationType", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
21,824
all-21825
[ "GetDisplayType", "returns", "the", "DisplayType", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "WidgetMarker", ")", "GetDisplayType", "(", ")", "<mask>", "{", "if", "w", "==", "nil", "||", "w", ".", "DisplayType", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "w", ".", "DisplayType", "\n", "}" ]
21,825
all-21826
[ "LaunchContainers", "launches", "a", "set", "of", "containers", "." ]
[ "func", "LaunchContainers", "(", "c", "lxd", ".", "ContainerServer", ",", "count", "int", ",", "parallel", "int", ",", "image", "string", ",", "privileged", "bool", ",", "start", "bool", ",", "freeze", "bool", ")", "(", "time", ".", "Duration", ",", "error", ")", "{", "var", "duration", "time", ".", "Duration", "\n\n", "batchSize", ",", "err", ":=", "getBatchSize", "(", "parallel", ")", "\n", "if", "err", "!=", "nil", "{", "return", "duration", ",", "err", "\n", "}", "\n\n", "printTestConfig", "(", "count", ",", "batchSize", ",", "image", ",", "privileged", ",", "freeze", ")", "\n\n", "fingerprint", ",", "err", ":=", "ensureImage", "(", "c", ",", "image", ")", "\n", "if", "err", "!=", "nil", "{", "return", "duration", ",", "err", "\n", "}", "\n\n", "batchStart", ":=", "func", "(", "index", "int", ",", "wg", "*", "sync", ".", "WaitGroup", ")", "{", "defer", "wg", ".", "Done", "(", ")", "\n\n", "name", ":=", "getContainerName", "(", "count", ",", "index", ")", "\n\n", "err", ":=", "createContainer", "(", "c", ",", "fingerprint", ",", "name", ",", "privileged", ")", "\n", "if", "err", "!=", "nil", "{", "logf", "(", "\"", "\"", ",", "name", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "if", "start", "{", "err", ":=", "startContainer", "(", "c", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "logf", "(", "\"", "\"", ",", "name", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "if", "freeze", "{", "err", ":=", "freezeContainer", "(", "c", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "logf", "(", "\"", "\"", ",", "name", ",", "err", ")", "\n", "return", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "duration", "=", "processBatch", "(", "count", ",", "batchSize", ",", "batchStart", ")", "\n", "return", "<mask>", ",", "nil", "\n", "}" ]
21,826
all-21827
[ "NewProwJobWithAnnotation", "initializes", "a", "ProwJob", "out", "of", "a", "ProwJobSpec", "with", "annotations", "." ]
[ "func", "NewProwJobWithAnnotation", "(", "spec", "prowapi", ".", "ProwJobSpec", ",", "labels", ",", "annotations", "map", "[", "string", "]", "string", ")", "prowapi", ".", "ProwJob", "{", "return", "newProwJob", "(", "<mask>", ",", "labels", ",", "annotations", ")", "\n", "}" ]
21,827
all-21828
[ "bind", "ranges", "of", "one", "or", "more", "buffer", "objects", "to", "a", "sequence", "of", "indexed", "buffer", "targets" ]
[ "func", "BindBuffersRange", "(", "target", "uint32", ",", "first", "uint32", ",", "count", "int32", ",", "buffers", "*", "uint32", ",", "offsets", "*", "int", ",", "sizes", "*", "int", ")", "{", "C", ".", "glowBindBuffersRange", "(", "gpBindBuffersRange", ",", "(", "C", ".", "GLenum", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLuint", ")", "(", "first", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ",", "(", "*", "C", ".", "GLuint", ")", "(", "unsafe", ".", "Pointer", "(", "buffers", ")", ")", ",", "(", "*", "C", ".", "GLintptr", ")", "(", "unsafe", ".", "Pointer", "(", "offsets", ")", ")", ",", "(", "*", "C", ".", "GLsizeiptr", ")", "(", "unsafe", ".", "Pointer", "(", "sizes", ")", ")", ")", "\n", "}" ]
21,828
all-21829
[ "Retrieves", "the", "flags", "passed", "when", "constructing", "the", "GBinding", "." ]
[ "func", "(", "v", "*", "Binding", ")", "GetFlags", "(", ")", "BindingFlags", "{", "flags", ":=", "C", ".", "g_binding_get_flags", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "BindingFlags", "(", "<mask>", ")", "\n", "}" ]
21,829
all-21830
[ "PerformIn", "performs", "a", "job", "after", "waiting", "for", "a", "specified", "amount", "using", "a", "goroutine", "." ]
[ "func", "(", "w", "Simple", ")", "PerformIn", "(", "job", "Job", ",", "d", "time", ".", "Duration", ")", "error", "{", "go", "func", "(", ")", "{", "select", "{", "case", "<-", "time", ".", "After", "(", "d", ")", ":", "w", ".", "Perform", "(", "job", ")", "\n", "<mask>", "<-", "w", ".", "ctx", ".", "Done", "(", ")", ":", "w", ".", "cancel", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n", "return", "nil", "\n", "}" ]
21,830
all-21831
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "Timestamp", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
21,831
all-21832
[ "CreateContainerTemplateFile", "creates", "an", "a", "template", "for", "a", "container", "." ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "CreateContainerTemplateFile", "(", "containerName", "string", ",", "templateName", "string", ",", "content", "io", ".", "ReadSeeker", ")", "error", "{", "return", "r", ".", "setContainerTemplateFile", "(", "containerName", ",", "templateName", ",", "<mask>", ",", "\"", "\"", ")", "\n", "}" ]
21,832
all-21833
[ "Get", "gets", "the", "value", "associated", "with", "the", "key", ".", "It", "returns", "a", "valid", "value", "if", "it", "finds", "equal", "or", "earlier", "version", "of", "the", "same", "key", "." ]
[ "func", "(", "s", "*", "Skiplist", ")", "Get", "(", "key", "[", "]", "byte", ")", "y", ".", "ValueStruct", "{", "n", ",", "_", ":=", "s", ".", "findNear", "(", "key", ",", "false", ",", "true", ")", "// findGreaterOrEqual.", "\n", "if", "n", "==", "nil", "{", "return", "y", ".", "ValueStruct", "{", "}", "\n", "}", "\n\n", "nextKey", ":=", "s", ".", "arena", ".", "getKey", "(", "n", ".", "keyOffset", ",", "n", ".", "keySize", ")", "\n", "if", "!", "y", ".", "SameKey", "(", "key", ",", "nextKey", ")", "{", "return", "y", ".", "ValueStruct", "{", "}", "\n", "}", "\n\n", "valOffset", ",", "valSize", ":=", "n", ".", "getValueOffset", "(", ")", "\n", "vs", ":=", "s", ".", "arena", ".", "getVal", "(", "valOffset", ",", "valSize", ")", "\n", "<mask>", ".", "Version", "=", "y", ".", "ParseTs", "(", "nextKey", ")", "\n", "return", "vs", "\n", "}" ]
21,833
all-21834
[ "PublishTask", "submits", "the", "task", "taskID", "with", "definition", "tdr", "using", "queue", ".", "The", "task", "is", "claimed", "using", "workerGroup", "and", "workerID", "and", "then", "artifacts", "are", "uploaded", "in", "sequence", "using", "taskcluster", "-", "lib", "-", "artifact", "-", "go", ".", "This", "function", "is", "useful", "for", "e", ".", "g", ".", "integration", "tests", "for", "the", "various", "taskcluster", "go", "libraries", "and", "utilities", "that", "rely", "on", "tasks", "and", "/", "or", "artifact", "content", "to", "test", "their", "features", "." ]
[ "func", "PublishTask", "(", "<mask>", "*", "tcqueue", ".", "Queue", ",", "taskID", "string", ",", "tdr", "tcqueue", ".", "TaskDefinitionRequest", ",", "workerGroup", ",", "workerID", "string", ",", "artifacts", "[", "]", "ArtifactSource", ")", "error", "{", "workerType", ":=", "tdr", ".", "WorkerType", "\n", "provisionerID", ":=", "tdr", ".", "ProvisionerID", "\n", "cwrq", ":=", "tcqueue", ".", "ClaimWorkRequest", "{", "Tasks", ":", "1", ",", "WorkerGroup", ":", "workerGroup", ",", "WorkerID", ":", "workerID", ",", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "taskID", ")", "\n", "_", ",", "err", ":=", "queue", ".", "CreateTask", "(", "taskID", ",", "&", "tdr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "taskID", ",", "err", ")", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "provisionerID", ",", "workerType", ")", "\n", "cwrs", ",", "err", ":=", "queue", ".", "ClaimWork", "(", "provisionerID", ",", "workerType", ",", "&", "cwrq", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "taskID", ",", "err", ")", "\n", "}", "\n", "taskCreds", ":=", "cwrs", ".", "Tasks", "[", "0", "]", ".", "Credentials", "\n", "taskQueue", ":=", "tcqueue", ".", "New", "(", "&", "tcclient", ".", "Credentials", "{", "ClientID", ":", "taskCreds", ".", "ClientID", ",", "AccessToken", ":", "taskCreds", ".", "AccessToken", ",", "Certificate", ":", "taskCreds", ".", "Certificate", ",", "AuthorizedScopes", ":", "nil", ",", "}", ",", "\"", "\"", ")", "\n", "taskQueue", ".", "BaseURL", "=", "queue", ".", "BaseURL", "\n", "for", "_", ",", "as", ":=", "range", "artifacts", "{", "err", "=", "as", ".", "Upload", "(", "taskQueue", ",", "taskID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "as", ".", "Name", ",", "taskID", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "taskID", ")", "\n", "_", ",", "err", "=", "taskQueue", ".", "ReportCompleted", "(", "taskID", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "taskID", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,834
all-21835
[ "New", "()", "creates", "a", "new", "Pool", "." ]
[ "func", "New", "(", "workers", "int", ")", "(", "pool", "*", "Pool", ")", "{", "pool", "=", "new", "(", "Pool", ")", "\n", "pool", ".", "num_workers", "=", "workers", "\n", "pool", ".", "job_wanted_pipe", "=", "make", "(", "chan", "chan", "*", "Job", ")", "\n", "pool", ".", "done_pipe", "=", "make", "(", "chan", "*", "Job", ")", "\n", "pool", ".", "add_pipe", "=", "make", "(", "chan", "*", "<mask>", ")", "\n", "pool", ".", "result_wanted_pipe", "=", "make", "(", "chan", "chan", "*", "Job", ")", "\n", "pool", ".", "jobs_ready_to_run", "=", "list", ".", "New", "(", ")", "\n", "pool", ".", "jobs_completed", "=", "list", ".", "New", "(", ")", "\n", "pool", ".", "working_wanted_pipe", "=", "make", "(", "chan", "chan", "bool", ")", "\n", "pool", ".", "stats_wanted_pipe", "=", "make", "(", "chan", "chan", "stats", ")", "\n", "pool", ".", "worker_kill_pipe", "=", "make", "(", "chan", "bool", ")", "\n", "pool", ".", "supervisor_kill_pipe", "=", "make", "(", "chan", "bool", ")", "\n", "pool", ".", "interval", "=", "1", "\n", "pool", ".", "next_job_id", "=", "0", "\n", "// start the supervisor here so we can accept jobs before a Run call", "pool", ".", "startSupervisor", "(", ")", "\n", "return", "\n", "}" ]
21,835
all-21836
[ "GRPCCodeToType", "converts", "the", "gRPC", "error", "code", "to", "an", "error", "type", "or", "returns", "the", "Unknown", "type", "if", "not", "possible", "." ]
[ "func", "GRPCCodeToType", "(", "code", "codes", ".", "Code", ")", "Type", "{", "switch", "code", "{", "case", "codes", ".", "InvalidArgument", ":", "return", "InvalidArgument", "\n", "case", "codes", ".", "OutOfRange", ":", "return", "OutOfRange", "\n", "case", "codes", ".", "NotFound", ":", "return", "NotFound", "\n", "case", "codes", ".", "AlreadyExists", ":", "return", "AlreadyExists", "\n", "case", "codes", ".", "Unauthenticated", ":", "return", "Unauthorized", "\n", "case", "codes", ".", "PermissionDenied", ":", "return", "PermissionDenied", "\n", "case", "codes", ".", "DeadlineExceeded", ":", "return", "Timeout", "\n", "case", "codes", ".", "Unimplemented", ":", "return", "NotImplemented", "\n", "case", "codes", ".", "Unavailable", ":", "return", "TemporarilyUnavailable", "\n", "case", "codes", ".", "FailedPrecondition", ":", "return", "PermanentlyUnavailable", "\n", "case", "codes", ".", "Canceled", ":", "return", "Canceled", "\n", "case", "codes", ".", "ResourceExhausted", ":", "return", "ResourceExhausted", "\n", "case", "codes", ".", "<mask>", ":", "return", "Unknown", "\n", "}", "\n", "return", "Unknown", "\n", "}" ]
21,836
all-21837
[ "OpGet", "returns", "get", "operation", "based", "on", "given", "key", "and", "operation", "options", "." ]
[ "func", "OpGet", "(", "key", "string", ",", "opts", "...", "OpOption", ")", "Op", "{", "// WithPrefix and WithFromKey are not supported together", "if", "isWithPrefix", "(", "opts", ")", "&&", "isWithFromKey", "(", "opts", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "ret", ":=", "Op", "{", "t", ":", "tRange", ",", "key", ":", "[", "]", "byte", "(", "<mask>", ")", "}", "\n", "ret", ".", "applyOpts", "(", "opts", ")", "\n", "return", "ret", "\n", "}" ]
21,837
all-21838
[ "RsyncRecv", "sets", "up", "the", "receiving", "half", "of", "the", "websocket", "to", "rsync", "(", "the", "other", "half", "set", "up", "by", "RsyncSend", ")", "putting", "the", "contents", "in", "the", "directory", "specified", "by", "path", "." ]
[ "func", "RsyncRecv", "(", "path", "string", ",", "conn", "*", "websocket", ".", "Conn", ",", "writeWrapper", "func", "(", "io", ".", "WriteCloser", ")", "io", ".", "WriteCloser", ",", "features", "[", "]", "string", ")", "error", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "}", "\n\n", "if", "features", "!=", "nil", "&&", "len", "(", "features", ")", ">", "0", "{", "args", "=", "append", "(", "args", ",", "rsyncFeatureArgs", "(", "features", ")", "...", ")", "\n", "}", "\n\n", "args", "=", "append", "(", "args", ",", "[", "]", "string", "{", "\"", "\"", ",", "path", "}", "...", ")", "\n\n", "cmd", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "args", "...", ")", "\n\n", "stdin", ",", "err", ":=", "cmd", ".", "StdinPipe", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "stdout", ",", "err", ":=", "cmd", ".", "StdoutPipe", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "stderr", ",", "err", ":=", "cmd", ".", "StderrPipe", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "cmd", ".", "Start", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "writePipe", ":=", "<mask>", ".", "WriteCloser", "(", "stdin", ")", "\n", "if", "writeWrapper", "!=", "nil", "{", "writePipe", "=", "writeWrapper", "(", "stdin", ")", "\n", "}", "\n\n", "readDone", ",", "writeDone", ":=", "shared", ".", "WebsocketMirror", "(", "conn", ",", "writePipe", ",", "stdout", ",", "nil", ",", "nil", ")", "\n", "output", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "stderr", ")", "\n", "if", "err", "!=", "nil", "{", "cmd", ".", "Process", ".", "Kill", "(", ")", "\n", "cmd", ".", "Wait", "(", ")", "\n", "return", "err", "\n", "}", "\n\n", "err", "=", "cmd", ".", "Wait", "(", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Errorf", "(", "\"", "\"", ",", "path", ",", "err", ",", "string", "(", "output", ")", ")", "\n", "}", "\n\n", "<-", "readDone", "\n", "<-", "writeDone", "\n\n", "return", "err", "\n", "}" ]
21,838
all-21839
[ "ActivePeers", "returns", "a", "channel", "that", "closes", "when", "an", "initial", "peer", "connection", "has", "been", "established", ".", "Use", "this", "to", "wait", "until", "the", "first", "peer", "connection", "becomes", "active", "." ]
[ "func", "(", "t", "*", "Transport", ")", "ActivePeers", "(", ")", "(", "cnt", "int", ")", "{", "t", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "RUnlock", "(", ")", "\n", "for", "_", ",", "p", ":=", "<mask>", "t", ".", "peers", "{", "if", "!", "p", ".", "activeSince", "(", ")", ".", "IsZero", "(", ")", "{", "cnt", "++", "\n", "}", "\n", "}", "\n", "return", "cnt", "\n", "}" ]
21,839
all-21840
[ "Mark", "value", "on", "top", "of", "the", "stack", "as", "visited", "using", "the", "registry", "index", "." ]
[ "func", "(", "v", "*", "visitor", ")", "mark", "(", "val", "reflect", ".", "<mask>", ")", "{", "ptr", ":=", "val", ".", "Pointer", "(", ")", "\n", "if", "ptr", "==", "0", "{", "// We do not mark uninitialized 'val' as this is meaningless and this would", "// bind all uninitialized values to the same mark.", "return", "\n", "}", "\n\n", "v", ".", "L", ".", "RawGeti", "(", "lua", ".", "LUA_REGISTRYINDEX", ",", "v", ".", "index", ")", "\n", "// Copy value on top.", "v", ".", "L", ".", "PushValue", "(", "-", "2", ")", "\n", "// Set value to table.", "// TODO: Handle overflow.", "v", ".", "L", ".", "RawSeti", "(", "-", "2", ",", "int", "(", "ptr", ")", ")", "\n", "v", ".", "L", ".", "Pop", "(", "1", ")", "\n", "}" ]
21,840
all-21841
[ "Panic", "is", "equivalent", "to", "l", ".", "Critical", "(", "fmt", ".", "Sprint", "()", ")", "followed", "by", "a", "call", "to", "panic", "()", "." ]
[ "func", "(", "l", "*", "Logger", ")", "Panic", "(", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "<mask>", "(", "CRITICAL", ",", "nil", ",", "args", "...", ")", "\n", "panic", "(", "fmt", ".", "Sprint", "(", "args", "...", ")", ")", "\n", "}" ]
21,841
all-21842
[ "WriteInt8", "writes", "an", "int8", "." ]
[ "func", "(", "w", "*", "<mask>", ")", "WriteInt8", "(", "i", "int8", ")", "{", "if", "w", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "w", ".", "wr", ".", "WriteByte", "(", "byte", "(", "i", ")", ")", "\n", "}" ]
21,842
all-21843
[ "GetKnownStatus", "safely", "returns", "the", "currently", "known", "status", "of", "the", "task" ]
[ "func", "(", "cgroup", "*", "CgroupResource", ")", "GetKnownStatus", "(", ")", "resourcestatus", ".", "ResourceStatus", "{", "cgroup", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "cgroup", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "cgroup", ".", "knownStatusUnsafe", "\n", "}" ]
21,843
all-21844
[ "SplitMetricID", "takes", "a", "metric", "ID", "ans", "splits", "it", "into", "name", "and", "tags" ]
[ "func", "SplitMetricID", "(", "metricID", "string", ")", "(", "name", "string", ",", "tags", "[", "]", "string", ")", "{", "if", "metricID", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n\n", "pos", ":=", "strings", ".", "LastIndexByte", "(", "metricID", ",", "'|'", ")", "\n", "if", "pos", ">", "0", "&&", "<mask>", "<", "len", "(", "metricID", ")", "-", "1", "{", "return", "metricID", "[", ":", "pos", "]", ",", "strings", ".", "Split", "(", "metricID", "[", "pos", "+", "1", ":", "]", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "metricID", ",", "nil", "\n", "}" ]
21,844
all-21845
[ "RequestURI", "returns", "RequestURI", "from", "the", "first", "HTTP", "request", "line", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "RequestURI", "(", ")", "[", "]", "<mask>", "{", "requestURI", ":=", "h", ".", "requestURI", "\n", "if", "len", "(", "requestURI", ")", "==", "0", "{", "requestURI", "=", "strSlash", "\n", "}", "\n", "return", "requestURI", "\n", "}" ]
21,845
all-21846
[ "Tags", "returns", "a", "copy", "of", "tags", "accumulated", "by", "the", "span", "so", "far" ]
[ "func", "(", "s", "*", "MockSpan", ")", "Tags", "(", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "s", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "RUnlock", "(", ")", "\n", "tags", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "for", "k", ",", "v", ":=", "range", "s", ".", "tags", "{", "tags", "[", "k", "]", "=", "v", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
21,846
all-21847
[ "AddLabel", "adds", "a", "label" ]
[ "func", "(", "f", "*", "FakeClient", ")", "AddLabel", "(", "owner", ",", "repo", "string", ",", "<mask>", "int", ",", "label", "string", ")", "error", "{", "labelString", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "owner", ",", "repo", ",", "number", ",", "label", ")", "\n", "if", "sets", ".", "NewString", "(", "f", ".", "IssueLabelsAdded", "...", ")", ".", "Has", "(", "labelString", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "label", ",", "owner", ",", "repo", ",", "number", ")", "\n", "}", "\n", "if", "f", ".", "RepoLabelsExisting", "==", "nil", "{", "f", ".", "IssueLabelsAdded", "=", "append", "(", "f", ".", "IssueLabelsAdded", ",", "labelString", ")", "\n", "return", "nil", "\n", "}", "\n", "for", "_", ",", "l", ":=", "range", "f", ".", "RepoLabelsExisting", "{", "if", "label", "==", "l", "{", "f", ".", "IssueLabelsAdded", "=", "append", "(", "f", ".", "IssueLabelsAdded", ",", "labelString", ")", "\n", "return", "nil", "\n", "}", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "label", ",", "owner", ",", "repo", ",", "number", ")", "\n", "}" ]
21,847
all-21848
[ "successive", "Fibonacci", "numbers", "." ]
[ "func", "Fib", "(", ")", "func", "(", ")", "time", ".", "Duration", "{", "a", ",", "b", ":=", "0", ",", "1", "\n", "return", "func", "(", ")", "time", ".", "Duration", "{", "a", ",", "b", "=", "b", ",", "a", "+", "b", "\n", "return", "<mask>", ".", "Duration", "(", "a", "*", "10", ")", "*", "time", ".", "Millisecond", "\n", "}", "\n", "}" ]
21,848
all-21849
[ "ReadFloat32", "reads", "and", "returns", "a", "float32", "." ]
[ "func", "(", "r", "*", "Reader", ")", "ReadFloat32", "(", ")", "float32", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "var", "n", "int", "\n", "n", ",", "r", ".", "err", "=", "io", ".", "ReadFull", "(", "r", ".", "rd", ",", "r", ".", "b", "[", ":", "4", "]", ")", "\n", "r", ".", "cnt", "+=", "n", "\n", "if", "r", ".", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "bits", ":=", "binary", ".", "LittleEndian", ".", "Uint32", "(", "r", ".", "b", "[", ":", "4", "]", ")", "\n", "return", "math", ".", "Float32frombits", "(", "<mask>", ")", "\n", "}" ]
21,849
all-21850
[ "RunWithoutMainLoop", "runs", "the", "game", "but", "don", "t", "call", "the", "loop", "on", "the", "main", "(", "UI", ")", "thread", ".", "Different", "from", "Run", "RunWithoutMainLoop", "returns", "immediately", ".", "Ebiten", "users", "should", "NOT", "call", "RunWithoutMainLoop", ".", "Instead", "functions", "in", "github", ".", "com", "/", "hajimehoshi", "/", "ebiten", "/", "mobile", "package", "calls", "this", "." ]
[ "func", "RunWithoutMainLoop", "(", "f", "func", "(", "*", "Image", ")", "error", ",", "width", ",", "<mask>", "int", ",", "scale", "float64", ",", "title", "string", ")", "<-", "chan", "error", "{", "f", "=", "(", "&", "imageDumper", "{", "f", ":", "f", "}", ")", ".", "update", "\n\n", "c", ":=", "newUIContext", "(", "f", ")", "\n", "theUIContext", ".", "Store", "(", "c", ")", "\n\n", "atomic", ".", "StoreInt32", "(", "&", "isRunning", ",", "1", ")", "\n", "return", "uiDriver", "(", ")", ".", "RunWithoutMainLoop", "(", "width", ",", "height", ",", "scale", ",", "title", ",", "c", ",", "graphicsDriver", "(", ")", ")", "\n", "}" ]
21,850
all-21851
[ "MustManageOfferOp", "retrieves", "the", "ManageOfferOp", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "OperationBody", ")", "MustManageOfferOp", "(", ")", "ManageOfferOp", "{", "val", ",", "<mask>", ":=", "u", ".", "GetManageOfferOp", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
21,851
all-21852
[ "UnmarshalEasyJSON", "sets", "the", "Email", "from", "a", "easyjson", ".", "Lexer" ]
[ "func", "(", "e", "*", "Email", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "if", "data", ":=", "in", ".", "String", "(", ")", ";", "in", ".", "Ok", "(", ")", "{", "*", "e", "=", "Email", "(", "<mask>", ")", "\n", "}", "\n", "}" ]
21,852
all-21853
[ "NotNull", "creates", "a", "not", "equal", "to", "null", "query", "." ]
[ "func", "(", "f", "*", "Field", ")", "NotNull", "(", ")", "*", "PQLRowQuery", "{", "<mask>", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f", ".", "name", ")", "\n", "q", ":=", "NewPQLRowQuery", "(", "text", ",", "f", ".", "index", ",", "nil", ")", "\n", "q", ".", "hasKeys", "=", "f", ".", "options", ".", "keys", "||", "f", ".", "index", ".", "options", ".", "keys", "\n", "return", "q", "\n", "}" ]
21,853
all-21854
[ "NotFound", "specifys", "a", "not", "found", "handler", "for", "a", "route" ]
[ "func", "(", "r", "*", "Router", ")", "NotFound", "(", "i", "interface", "{", "}", ")", "{", "<mask>", ":=", "r", ".", "buildHandler", "(", "i", ")", "\n", "r", ".", "dispatcher", ".", "NotFoundHandler", "(", "r", ".", "route", ",", "handler", ")", "\n", "}" ]
21,854
all-21855
[ "RevealerNew", "is", "a", "wrapper", "around", "gtk_revealer_new", "()" ]
[ "func", "RevealerNew", "(", ")", "(", "*", "Revealer", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_revealer_new", "(", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapRevealer", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
21,855
all-21856
[ "digitalOceanchangesByZone", "separates", "a", "multi", "-", "zone", "change", "into", "a", "single", "change", "per", "zone", "." ]
[ "func", "digitalOceanChangesByZone", "(", "zones", "[", "]", "godo", ".", "Domain", ",", "changeSet", "[", "]", "*", "DigitalOceanChange", ")", "map", "[", "string", "]", "[", "]", "*", "DigitalOceanChange", "{", "changes", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "*", "DigitalOceanChange", ")", "\n", "zoneNameIDMapper", ":=", "zoneIDName", "{", "}", "\n", "for", "_", ",", "z", ":=", "range", "zones", "{", "zoneNameIDMapper", ".", "Add", "(", "z", ".", "Name", ",", "z", ".", "Name", ")", "\n", "changes", "[", "z", ".", "Name", "]", "=", "[", "]", "*", "DigitalOceanChange", "{", "}", "\n", "}", "\n\n", "for", "_", ",", "c", ":=", "range", "changeSet", "{", "<mask>", ",", "_", ":=", "zoneNameIDMapper", ".", "FindZone", "(", "c", ".", "ResourceRecordSet", ".", "Name", ")", "\n", "if", "zone", "==", "\"", "\"", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "c", ".", "ResourceRecordSet", ".", "Name", ")", "\n", "continue", "\n", "}", "\n", "changes", "[", "zone", "]", "=", "append", "(", "changes", "[", "zone", "]", ",", "c", ")", "\n", "}", "\n\n", "return", "changes", "\n", "}" ]
21,856
all-21857
[ "NewLedgerEntryData", "creates", "a", "new", "LedgerEntryData", "." ]
[ "func", "NewLedgerEntryData", "(", "aType", "LedgerEntryType", ",", "value", "interface", "{", "}", ")", "(", "result", "LedgerEntryData", ",", "err", "error", ")", "{", "result", ".", "Type", "=", "aType", "\n", "switch", "LedgerEntryType", "(", "aType", ")", "{", "case", "LedgerEntryTypeAccount", ":", "tv", ",", "ok", ":=", "<mask>", ".", "(", "AccountEntry", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "Account", "=", "&", "tv", "\n", "case", "LedgerEntryTypeTrustline", ":", "tv", ",", "ok", ":=", "value", ".", "(", "TrustLineEntry", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "TrustLine", "=", "&", "tv", "\n", "case", "LedgerEntryTypeOffer", ":", "tv", ",", "ok", ":=", "value", ".", "(", "OfferEntry", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "Offer", "=", "&", "tv", "\n", "case", "LedgerEntryTypeData", ":", "tv", ",", "ok", ":=", "value", ".", "(", "DataEntry", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "Data", "=", "&", "tv", "\n", "}", "\n", "return", "\n", "}" ]
21,857
all-21858
[ "/", "*", "InitLoggers", "will", "run", "InitLogger", "on", "each", "Logger", "that", "has", "been", "added", "to", "the", "Base", ".", "If", "an", "error", "occurs", "in", "initializing", "a", "logger", "the", "loggers", "that", "have", "already", "been", "initialized", "will", "continue", "to", "be", "initialized", "." ]
[ "func", "(", "b", "*", "Base", ")", "InitLoggers", "(", ")", "error", "{", "if", "b", ".", "queue", "==", "nil", "{", "b", ".", "queue", "=", "newQueue", "(", "b", ",", "b", ".", "config", ".", "MaxQueueSize", ")", "\n", "}", "\n\n", "for", "_", ",", "logger", ":=", "<mask>", "b", ".", "loggers", "{", "err", ":=", "logger", ".", "InitLogger", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "b", ".", "queue", ".", "startWorker", "(", ")", "\n", "b", ".", "isInitialized", "=", "true", "\n\n", "return", "nil", "\n", "}" ]
21,858
all-21859
[ "Find", "gets", "the", "IntervalValue", "for", "the", "node", "matching", "the", "given", "interval" ]
[ "func", "(", "ivt", "*", "IntervalTree", ")", "Find", "(", "ivl", "Interval", ")", "(", "ret", "*", "IntervalValue", ")", "{", "n", ":=", "ivt", ".", "<mask>", "(", "ivl", ")", "\n", "if", "n", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "&", "n", ".", "iv", "\n", "}" ]
21,859
all-21860
[ "walkDepth", "walks", "the", "trie", "in", "depth", "order", "for", "unit", "testing", "." ]
[ "func", "(", "p", "*", "prefixTrie", ")", "walkDepth", "(", ")", "<-", "chan", "RangerEntry", "{", "entries", ":=", "make", "(", "chan", "RangerEntry", ")", "\n", "<mask>", "func", "(", ")", "{", "if", "p", ".", "hasEntry", "(", ")", "{", "entries", "<-", "p", ".", "entry", "\n", "}", "\n", "childEntriesList", ":=", "[", "]", "<-", "chan", "RangerEntry", "{", "}", "\n", "for", "_", ",", "trie", ":=", "range", "p", ".", "children", "{", "if", "trie", "==", "nil", "{", "continue", "\n", "}", "\n", "childEntriesList", "=", "append", "(", "childEntriesList", ",", "trie", ".", "walkDepth", "(", ")", ")", "\n", "}", "\n", "for", "_", ",", "childEntries", ":=", "range", "childEntriesList", "{", "for", "entry", ":=", "range", "childEntries", "{", "entries", "<-", "entry", "\n", "}", "\n", "}", "\n", "close", "(", "entries", ")", "\n", "}", "(", ")", "\n", "return", "entries", "\n", "}" ]
21,860
all-21861
[ "HasApmQuery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "ChangeRequest", ")", "HasApmQuery", "(", ")", "bool", "{", "if", "c", "!=", "nil", "&&", "c", ".", "ApmQuery", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
21,861
all-21862
[ "write", "a", "block", "of", "pixels", "to", "the", "frame", "buffer" ]
[ "func", "DrawPixels", "(", "<mask>", "int32", ",", "height", "int32", ",", "format", "uint32", ",", "xtype", "uint32", ",", "pixels", "unsafe", ".", "Pointer", ")", "{", "C", ".", "glowDrawPixels", "(", "gpDrawPixels", ",", "(", "C", ".", "GLsizei", ")", "(", "width", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "height", ")", ",", "(", "C", ".", "GLenum", ")", "(", "format", ")", ",", "(", "C", ".", "GLenum", ")", "(", "xtype", ")", ",", "pixels", ")", "\n", "}" ]
21,862
all-21863
[ "HasAccessRole", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "u", "*", "User", ")", "HasAccessRole", "(", ")", "bool", "{", "if", "u", "!=", "nil", "&&", "u", ".", "AccessRole", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
21,863
all-21864
[ "query", "the", "properties", "of", "a", "sync", "object" ]
[ "func", "GetSynciv", "(", "sync", "uintptr", ",", "pname", "uint32", ",", "bufSize", "int32", ",", "length", "*", "int32", ",", "values", "*", "int32", ")", "{", "syscall", ".", "Syscall6", "(", "gpGetSynciv", ",", "5", ",", "uintptr", "(", "sync", ")", ",", "uintptr", "(", "pname", ")", ",", "uintptr", "(", "bufSize", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "values", ")", ")", ",", "0", ")", "\n", "}" ]
21,864
all-21865
[ "ForwardedResponseIfContainerIsRemote", "redirects", "a", "request", "to", "the", "node", "running", "the", "container", "with", "the", "given", "name", ".", "If", "the", "container", "is", "local", "nothing", "gets", "done", "and", "nil", "is", "returned", "." ]
[ "func", "ForwardedResponseIfContainerIsRemote", "(", "d", "*", "Daemon", ",", "r", "*", "http", ".", "Request", ",", "<mask>", ",", "name", "string", ")", "(", "Response", ",", "error", ")", "{", "cert", ":=", "d", ".", "endpoints", ".", "NetworkCert", "(", ")", "\n", "client", ",", "err", ":=", "cluster", ".", "ConnectIfContainerIsRemote", "(", "d", ".", "cluster", ",", "project", ",", "name", ",", "cert", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "client", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "ForwardedResponse", "(", "client", ",", "r", ")", ",", "nil", "\n", "}" ]
21,865
all-21866
[ "GetDisplayName", "returns", "the", "DisplayName", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "s", "*", "Series", ")", "GetDisplayName", "(", ")", "<mask>", "{", "if", "s", "==", "nil", "||", "s", ".", "DisplayName", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "s", ".", "DisplayName", "\n", "}" ]
21,866
all-21867
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "InitiatorType", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "<mask>", ")", "{", "out", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
21,867
all-21868
[ "HasDescription", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "b", "*", "Board", ")", "HasDescription", "(", ")", "bool", "{", "if", "b", "!=", "nil", "&&", "b", ".", "Description", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
21,868
all-21869
[ "CheckType", "checks", "to", "make", "sure", "val", "has", "the", "same", "type", "as", "template", "unless", "template", "is", "nil", "in", "which", "case", "it", "always", "returns", "nil", "." ]
[ "func", "CheckType", "(", "template", "proto", ".", "Message", ",", "val", "interface", "{", "}", ")", "error", "{", "if", "template", "!=", "nil", "{", "valType", ",", "templateType", ":=", "reflect", ".", "TypeOf", "(", "val", ")", ",", "reflect", ".", "TypeOf", "(", "<mask>", ")", "\n", "if", "valType", "!=", "templateType", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "valType", ",", "templateType", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,869
all-21870
[ "targetURL", "determines", "the", "URL", "used", "for", "more", "details", "in", "the", "status", "context", "on", "GitHub", ".", "If", "no", "PR", "dashboard", "is", "configured", "we", "will", "use", "the", "administrative", "Prow", "overview", "." ]
[ "func", "targetURL", "(", "c", "config", ".", "Getter", ",", "pr", "*", "PullRequest", ",", "log", "*", "logrus", ".", "Entry", ")", "string", "{", "var", "link", "string", "\n", "if", "tideURL", ":=", "c", "(", ")", ".", "Tide", ".", "TargetURL", ";", "tideURL", "!=", "\"", "\"", "{", "link", "=", "tideURL", "\n", "}", "else", "if", "baseURL", ":=", "c", "(", ")", ".", "Tide", ".", "PRStatusBaseURL", ";", "baseURL", "!=", "\"", "\"", "{", "parseURL", ",", "err", ":=", "url", ".", "Parse", "(", "baseURL", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "}", "else", "{", "prQuery", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pr", ".", "Repository", ".", "NameWithOwner", ",", "pr", ".", "Author", ".", "Login", ",", "pr", ".", "HeadRefName", ")", "\n", "values", ":=", "parseURL", ".", "Query", "(", ")", "\n", "values", ".", "Set", "(", "\"", "\"", ",", "prQuery", ")", "\n", "parseURL", ".", "RawQuery", "=", "values", ".", "Encode", "(", ")", "\n", "link", "=", "parseURL", ".", "String", "(", ")", "\n", "}", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
21,870
all-21871
[ "flushMemtable", "must", "keep", "running", "until", "we", "send", "it", "an", "empty", "flushTask", ".", "If", "there", "are", "errors", "during", "handling", "the", "flush", "task", "we", "ll", "retry", "indefinitely", "." ]
[ "func", "(", "db", "*", "DB", ")", "flushMemtable", "(", "lc", "*", "y", ".", "Closer", ")", "error", "{", "defer", "lc", ".", "Done", "(", ")", "\n\n", "for", "ft", ":=", "range", "db", ".", "flushChan", "{", "if", "ft", ".", "mt", "==", "nil", "{", "// We close db.flushChan now, instead of sending a nil ft.mt.", "continue", "\n", "}", "\n", "for", "{", "err", ":=", "db", ".", "handleFlushTask", "(", "ft", ")", "\n", "if", "err", "==", "nil", "{", "// Update s.imm. Need a lock.", "db", ".", "Lock", "(", ")", "\n", "// This is a single-threaded operation. ft.mt corresponds to the head of", "// db.imm list. Once we flush it, we advance db.imm. The next ft.mt", "// which would arrive here would match db.imm[0], because we acquire a", "// lock over DB when pushing to flushChan.", "// TODO: This logic is dirty AF. Any change and this could easily break.", "y", ".", "AssertTrue", "(", "ft", ".", "mt", "==", "db", ".", "imm", "[", "0", "]", ")", "\n", "db", ".", "imm", "=", "db", ".", "imm", "[", "1", ":", "]", "\n", "ft", ".", "mt", ".", "DecrRef", "(", ")", "// Return memory.", "\n", "db", ".", "Unlock", "(", ")", "\n\n", "break", "\n", "}", "\n", "// Encountered error. Retry indefinitely.", "<mask>", ".", "opt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "time", ".", "Sleep", "(", "time", ".", "Second", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,871
all-21872
[ "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", "*", "storageImageSource", ")", "GetBlob", "(", "ctx", "context", ".", "Context", ",", "info", "<mask>", ".", "BlobInfo", ",", "cache", "types", ".", "BlobInfoCache", ")", "(", "rc", "io", ".", "ReadCloser", ",", "n", "int64", ",", "err", "error", ")", "{", "if", "info", ".", "Digest", "==", "image", ".", "GzippedEmptyLayerDigest", "{", "return", "ioutil", ".", "NopCloser", "(", "bytes", ".", "NewReader", "(", "image", ".", "GzippedEmptyLayer", ")", ")", ",", "int64", "(", "len", "(", "image", ".", "GzippedEmptyLayer", ")", ")", ",", "nil", "\n", "}", "\n", "rc", ",", "n", ",", "_", ",", "err", "=", "s", ".", "getBlobAndLayerID", "(", "info", ")", "\n", "return", "rc", ",", "n", ",", "err", "\n", "}" ]
21,872
all-21873
[ "SetPflagsFromEnv", "is", "similar", "to", "SetFlagsFromEnv", ".", "However", "the", "accepted", "flagset", "type", "is", "pflag", ".", "FlagSet", "and", "it", "does", "not", "do", "any", "logging", "." ]
[ "func", "SetPflagsFromEnv", "(", "prefix", "string", ",", "fs", "*", "pflag", ".", "FlagSet", ")", "error", "{", "var", "err", "error", "\n", "alreadySet", ":=", "<mask>", "(", "map", "[", "string", "]", "bool", ")", "\n", "usedEnvKey", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "fs", ".", "VisitAll", "(", "func", "(", "f", "*", "pflag", ".", "Flag", ")", "{", "if", "f", ".", "Changed", "{", "alreadySet", "[", "FlagToEnv", "(", "prefix", ",", "f", ".", "Name", ")", "]", "=", "true", "\n", "}", "\n", "if", "serr", ":=", "setFlagFromEnv", "(", "fs", ",", "prefix", ",", "f", ".", "Name", ",", "usedEnvKey", ",", "alreadySet", ",", "false", ")", ";", "serr", "!=", "nil", "{", "err", "=", "serr", "\n", "}", "\n", "}", ")", "\n", "verifyEnv", "(", "prefix", ",", "usedEnvKey", ",", "alreadySet", ")", "\n", "return", "err", "\n", "}" ]
21,873
all-21874
[ "BeginMany", "works", "like", "Begin", "but", "accepts", "multiple", "indices", "." ]
[ "func", "(", "w", "*", "WaterMark", ")", "BeginMany", "(", "indices", "[", "]", "uint64", ")", "{", "atomic", ".", "StoreUint64", "(", "&", "w", ".", "lastIndex", ",", "indices", "[", "len", "(", "indices", ")", "-", "1", "]", ")", "\n", "w", ".", "markCh", "<-", "mark", "{", "<mask>", ":", "0", ",", "indices", ":", "indices", ",", "done", ":", "false", "}", "\n", "}" ]
21,874
all-21875
[ "EncodeMap", "provides", "the", "implementation", "of", "the", "map", "encoding", "algorithm", "where", "n", "is", "the", "number", "of", "elements", "in", "the", "map", "and", "f", "a", "function", "called", "to", "encode", "each", "element", ".", "The", "n", "argument", "can", "be", "set", "to", "a", "negative", "value", "to", "indicate", "that", "the", "program", "doesn", "t", "know", "how", "many", "elements", "it", "will", "output", "to", "the", "map", ".", "Be", "mindful", "that", "not", "all", "emitters", "support", "encoding", "maps", "of", "unknown", "length", ".", "The", "f", "function", "is", "called", "to", "encode", "each", "element", "of", "the", "map", "it", "is", "expected", "to", "encode", "two", "values", "the", "first", "one", "being", "the", "key", "follow", "by", "the", "associated", "value", ".", "The", "first", "encoder", "must", "be", "used", "to", "encode", "the", "key", "the", "second", "for", "the", "value", "." ]
[ "func", "(", "e", "Encoder", ")", "EncodeMap", "(", "n", "int", ",", "f", "func", "(", "Encoder", ",", "Encoder", ")", "error", ")", "(", "err", "error", ")", "{", "if", "e", ".", "key", "{", "if", "e", ".", "key", ",", "err", "=", "<mask>", ",", "e", ".", "Emitter", ".", "EmitMapValue", "(", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "}", "\n\n", "if", "err", "=", "e", ".", "Emitter", ".", "EmitMapBegin", "(", "n", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "encodeMap", ":", "for", "i", ":=", "0", ";", "n", "<", "0", "||", "i", "<", "n", ";", "i", "++", "{", "if", "i", "!=", "0", "{", "if", "err", "=", "e", ".", "Emitter", ".", "EmitMapNext", "(", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "}", "\n", "e", ".", "key", "=", "true", "\n", "err", "=", "f", "(", "Encoder", "{", "Emitter", ":", "e", ".", "Emitter", ",", "SortMapKeys", ":", "e", ".", "SortMapKeys", "}", ",", "Encoder", "{", "Emitter", ":", "e", ".", "Emitter", ",", "SortMapKeys", ":", "e", ".", "SortMapKeys", ",", "key", ":", "true", "}", ",", ")", "\n", "// Because internal calls don't use the exported methods they may not", "// reset this flag to false when expected, forcing the value here.", "e", ".", "key", "=", "false", "\n\n", "switch", "err", "{", "case", "nil", ":", "case", "End", ":", "break", "encodeMap", "\n", "default", ":", "return", "\n", "}", "\n", "}", "\n\n", "return", "e", ".", "Emitter", ".", "EmitMapEnd", "(", ")", "\n", "}" ]
21,875
all-21876
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetAllCookiesReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork38", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,876
all-21877
[ "Establish", "a", "client", "connection", "to", "get", "events", "from", "the", "given", "node", "." ]
[ "func", "eventsConnect", "(", "address", "string", ",", "cert", "*", "shared", ".", "CertInfo", ")", "(", "*", "lxd", ".", "EventListener", ",", "error", ")", "{", "client", ",", "err", ":=", "Connect", "(", "address", ",", "<mask>", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Set the project to the special wildcard in order to get notified", "// about all events across all projects.", "client", "=", "client", ".", "UseProject", "(", "\"", "\"", ")", "\n\n", "return", "client", ".", "GetEvents", "(", ")", "\n", "}" ]
21,877
all-21878
[ "GetGroupOk", "returns", "a", "tuple", "with", "the", "Group", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetGroupOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "w", ".", "Group", ",", "true", "\n", "}" ]
21,878
all-21879
[ "Do", "executes", "Overlay", ".", "highlightNode", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "HighlightNodeParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandHighlightNode", ",", "p", ",", "nil", ")", "\n", "}" ]
21,879
all-21880
[ "RandString", "returns", "a", "random", "alphabetical", "string", "of", "size", "n" ]
[ "func", "RandString", "(", "r", "*", "rand", ".", "Rand", ",", "n", "int", ")", "string", "{", "b", ":=", "make", "(", "[", "]", "<mask>", ",", "n", ")", "\n", "for", "i", ":=", "range", "b", "{", "b", "[", "i", "]", "=", "letters", "[", "r", ".", "Intn", "(", "len", "(", "letters", ")", ")", "]", "\n", "}", "\n", "return", "string", "(", "b", ")", "\n", "}" ]
21,880
all-21881
[ "getCachedMonitor", "returns", "a", "monitor", "for", "the", "given", "window", "x", "/", "y", "returns", "false", "if", "monitor", "is", "not", "found", ".", "getCachedMonitor", "must", "be", "called", "on", "the", "main", "thread", "." ]
[ "func", "getCachedMonitor", "(", "wx", ",", "wy", "int", ")", "(", "*", "cachedMonitor", ",", "bool", ")", "{", "for", "_", ",", "m", ":=", "range", "monitors", "{", "if", "m", ".", "x", "<=", "wx", "&&", "wx", "<", "m", ".", "x", "+", "m", ".", "vm", ".", "Width", "&&", "m", ".", "y", "<=", "wy", "&&", "wy", "<", "m", ".", "y", "+", "m", ".", "vm", ".", "Height", "{", "return", "m", ",", "<mask>", "\n", "}", "\n", "}", "\n", "return", "nil", ",", "false", "\n", "}" ]
21,881
all-21882
[ "Translate", "is", "a", "wrapper", "around", "cairo_translate", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "Translate", "(", "tx", ",", "ty", "float64", ")", "{", "C", ".", "cairo_translate", "(", "v", ".", "native", "(", ")", ",", "C", ".", "double", "(", "tx", ")", ",", "C", ".", "double", "(", "ty", ")", ")", "\n", "}" ]
21,882
all-21883
[ "CheckConnection", "connects", "to", "the", "specified", "host", "on", "the", "specified", "port", ".", "If", "the", "connection", "is", "successful", "then", "return", "true", "." ]
[ "func", "CheckConnection", "(", "network", ",", "ip", "string", ",", "port", "int", ",", "timeout", "time", ".", "Duration", ")", "bool", "{", "conn", ",", "_", ":=", "net", ".", "DialTimeout", "(", "network", ",", "net", ".", "JoinHostPort", "(", "ip", ",", "strconv", ".", "Itoa", "(", "port", ")", ")", ",", "timeout", ")", "\n", "if", "conn", "!=", "nil", "{", "conn", ".", "Close", "(", ")", "\n", "return", "<mask>", "\n", "}", "\n", "return", "false", "\n", "}" ]
21,883
all-21884
[ "pipelineDecode", "is", "used", "to", "decode", "the", "responses", "of", "pipelined", "requests", "." ]
[ "func", "(", "r", "*", "Raft", ")", "pipelineDecode", "(", "s", "*", "followerReplication", ",", "p", "AppendPipeline", ",", "stopCh", ",", "finishCh", "chan", "struct", "{", "}", ")", "{", "defer", "close", "(", "finishCh", ")", "\n", "respCh", ":=", "p", ".", "Consumer", "(", ")", "\n", "for", "{", "select", "{", "case", "ready", ":=", "<-", "respCh", ":", "req", ",", "resp", ":=", "ready", ".", "<mask>", "(", ")", ",", "ready", ".", "Response", "(", ")", "\n", "appendStats", "(", "string", "(", "s", ".", "peer", ".", "ID", ")", ",", "ready", ".", "Start", "(", ")", ",", "float32", "(", "len", "(", "req", ".", "Entries", ")", ")", ")", "\n\n", "// Check for a newer term, stop running", "if", "resp", ".", "Term", ">", "req", ".", "Term", "{", "r", ".", "handleStaleTerm", "(", "s", ")", "\n", "return", "\n", "}", "\n\n", "// Update the last contact", "s", ".", "setLastContact", "(", ")", "\n\n", "// Abort pipeline if not successful", "if", "!", "resp", ".", "Success", "{", "return", "\n", "}", "\n\n", "// Update our replication state", "updateLastAppended", "(", "s", ",", "req", ")", "\n", "case", "<-", "stopCh", ":", "return", "\n", "}", "\n", "}", "\n", "}" ]
21,884
all-21885
[ "SetRuleSelector", "modifies", "the", "rule", "selector", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "CSS#method", "-", "setRuleSelector", "parameters", ":", "styleSheetID", "range", "selector" ]
[ "func", "SetRuleSelector", "(", "styleSheetID", "StyleSheetID", ",", "rangeVal", "*", "SourceRange", ",", "selector", "string", ")", "*", "SetRuleSelectorParams", "{", "return", "&", "SetRuleSelectorParams", "{", "StyleSheetID", ":", "styleSheetID", ",", "<mask>", ":", "rangeVal", ",", "Selector", ":", "selector", ",", "}", "\n", "}" ]
21,885
all-21886
[ "Make", "sure", "all", "our", "directories", "are", "available", "." ]
[ "func", "(", "s", "*", "OS", ")", "initDirs", "(", ")", "error", "{", "dirs", ":=", "[", "]", "struct", "{", "path", "string", "\n", "mode", "os", ".", "FileMode", "\n", "}", "{", "{", "s", ".", "VarDir", ",", "0711", "}", ",", "{", "filepath", ".", "Join", "(", "s", ".", "VarDir", ",", "\"", "\"", ")", ",", "0700", "}", ",", "{", "s", ".", "CacheDir", ",", "0700", "}", ",", "{", "filepath", ".", "Join", "(", "s", ".", "VarDir", ",", "\"", "\"", ")", ",", "0711", "}", ",", "{", "filepath", ".", "Join", "(", "s", ".", "VarDir", ",", "\"", "\"", ")", ",", "0700", "}", ",", "{", "filepath", ".", "Join", "(", "s", ".", "VarDir", ",", "\"", "\"", ")", ",", "0711", "}", ",", "{", "filepath", ".", "Join", "(", "s", ".", "VarDir", ",", "\"", "\"", ")", ",", "0755", "}", ",", "{", "filepath", ".", "Join", "(", "s", ".", "VarDir", ",", "\"", "\"", ")", ",", "0700", "}", ",", "{", "filepath", ".", "Join", "(", "s", ".", "VarDir", ",", "\"", "\"", ")", ",", "0700", "}", ",", "{", "s", ".", "LogDir", ",", "0700", "}", ",", "{", "filepath", ".", "Join", "(", "s", ".", "VarDir", ",", "\"", "\"", ")", ",", "0711", "}", ",", "{", "filepath", ".", "Join", "(", "s", ".", "VarDir", ",", "\"", "\"", ")", ",", "0700", "}", ",", "{", "filepath", ".", "Join", "(", "s", ".", "VarDir", ",", "\"", "\"", ")", ",", "0711", "}", ",", "{", "filepath", ".", "Join", "(", "s", ".", "VarDir", ",", "\"", "\"", ")", ",", "0700", "}", ",", "{", "filepath", ".", "Join", "(", "s", ".", "VarDir", ",", "\"", "\"", ")", ",", "0711", "}", ",", "}", "\n\n", "for", "_", ",", "dir", ":=", "<mask>", "dirs", "{", "err", ":=", "os", ".", "Mkdir", "(", "dir", ".", "path", ",", "dir", ".", "mode", ")", "\n", "if", "err", "!=", "nil", "&&", "!", "os", ".", "IsExist", "(", "err", ")", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "dir", ".", "path", ")", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
21,886
all-21887
[ "AddFlags", "adds", "flags", "to", "the", "FlagSet", "that", "populate", "the", "wrapper", "options", "struct", "provided", "." ]
[ "func", "(", "o", "*", "<mask>", ")", "AddFlags", "(", "fs", "*", "flag", ".", "FlagSet", ")", "{", "fs", ".", "StringVar", "(", "&", "o", ".", "ProcessLog", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fs", ".", "StringVar", "(", "&", "o", ".", "MarkerFile", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fs", ".", "StringVar", "(", "&", "o", ".", "MetadataFile", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}" ]
21,887
all-21888
[ "copyFile", "copies", "src", "to", "tar", "file", "dst", "." ]
[ "func", "copyFile", "(", "tw", "*", "tar", ".", "Writer", ",", "dst", ",", "src", "string", ")", "error", "{", "s", ",", "err", ":=", "os", ".", "Open", "(", "src", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "src", ",", "err", ")", "\n", "}", "\n", "defer", "s", ".", "Close", "(", ")", "\n", "fi", ",", "err", ":=", "s", ".", "Stat", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "src", ",", "err", ")", "\n", "}", "\n\n", "hdr", ",", "err", ":=", "tar", ".", "FileInfoHeader", "(", "fi", ",", "dst", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "dst", ",", "err", ")", "\n", "}", "\n", "hdr", ".", "<mask>", "=", "dst", "\n", "if", "err", ":=", "tw", ".", "WriteHeader", "(", "hdr", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "dst", ",", "err", ")", "\n", "}", "\n", "_", ",", "err", "=", "io", ".", "Copy", "(", "tw", ",", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "src", ",", "dst", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,888
all-21889
[ "DialJournal", "returns", "no", "error", "if", "the", "process", "can", "dial", "journal", "socket", ".", "Returns", "an", "error", "if", "dial", "failed", "whichi", "indicates", "journald", "is", "not", "available", "(", "e", ".", "g", ".", "run", "embedded", "etcd", "as", "docker", "daemon", ")", ".", "Reference", ":", "https", ":", "//", "github", ".", "com", "/", "coreos", "/", "go", "-", "systemd", "/", "blob", "/", "master", "/", "journal", "/", "journal", ".", "go", "." ]
[ "func", "DialJournal", "(", ")", "error", "{", "conn", ",", "err", ":=", "net", ".", "Dial", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "conn", "!=", "nil", "{", "defer", "<mask>", ".", "Close", "(", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
21,889
all-21890
[ "BuildCNIConfig", "constructs", "the", "cni", "configuration", "from", "eni" ]
[ "func", "(", "task", "*", "Task", ")", "BuildCNIConfig", "(", ")", "(", "*", "ecscni", ".", "Config", ",", "error", ")", "{", "if", "!", "<mask>", ".", "isNetworkModeVPC", "(", ")", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "cfg", ":=", "&", "ecscni", ".", "Config", "{", "}", "\n", "convertENIToCNIConfig", "(", "task", ".", "GetTaskENI", "(", ")", ",", "cfg", ")", "\n", "if", "task", ".", "GetAppMesh", "(", ")", "!=", "nil", "{", "convertAppMeshToCNIConfig", "(", "task", ".", "GetAppMesh", "(", ")", ",", "cfg", ")", "\n", "}", "\n\n", "return", "cfg", ",", "nil", "\n", "}" ]
21,890
all-21891
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Effect", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoAnimation17", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,891
all-21892
[ "Mutate", "applies", "the", "provided", "mutators", "to", "this", "builder", "s", "payment", "or", "operation", "." ]
[ "func", "(", "b", "*", "ChangeTrustBuilder", ")", "Mutate", "(", "muts", "...", "interface", "{", "}", ")", "{", "for", "_", ",", "m", ":=", "range", "muts", "{", "var", "err", "error", "\n", "switch", "mut", ":=", "m", ".", "(", "type", ")", "{", "<mask>", "ChangeTrustMutator", ":", "err", "=", "mut", ".", "MutateChangeTrust", "(", "&", "b", ".", "CT", ")", "\n", "case", "OperationMutator", ":", "err", "=", "mut", ".", "MutateOperation", "(", "&", "b", ".", "O", ")", "\n", "default", ":", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "err", "!=", "nil", "{", "b", ".", "Err", "=", "err", "\n", "return", "\n", "}", "\n", "}", "\n", "}" ]
21,892
all-21893
[ "Log", "implements", "the", "Backend", "interface", "." ]
[ "func", "(", "b", "*", "SyslogBackend", ")", "Log", "(", "level", "Level", ",", "calldepth", "int", ",", "rec", "*", "Record", ")", "error", "{", "line", ":=", "rec", ".", "Formatted", "(", "calldepth", "+", "1", ")", "\n", "switch", "<mask>", "{", "case", "CRITICAL", ":", "return", "b", ".", "Writer", ".", "Crit", "(", "line", ")", "\n", "case", "ERROR", ":", "return", "b", ".", "Writer", ".", "Err", "(", "line", ")", "\n", "case", "WARNING", ":", "return", "b", ".", "Writer", ".", "Warning", "(", "line", ")", "\n", "case", "NOTICE", ":", "return", "b", ".", "Writer", ".", "Notice", "(", "line", ")", "\n", "case", "INFO", ":", "return", "b", ".", "Writer", ".", "Info", "(", "line", ")", "\n", "case", "DEBUG", ":", "return", "b", ".", "Writer", ".", "Debug", "(", "line", ")", "\n", "default", ":", "}", "\n", "panic", "(", "\"", "\"", ")", "\n", "}" ]
21,893
all-21894
[ "UpdateIssues", "downloads", "new", "issues", "and", "saves", "in", "database" ]
[ "func", "UpdateIssues", "(", "db", "*", "gorm", ".", "DB", ",", "client", "ClientInterface", ")", "{", "latest", ",", "err", ":=", "findLatestIssueUpdate", "(", "db", ",", "client", ".", "RepositoryName", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "glog", ".", "Error", "(", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n", "c", ":=", "make", "(", "chan", "*", "github", ".", "Issue", ",", "200", ")", "\n\n", "go", "client", ".", "FetchIssues", "(", "latest", ",", "c", ")", "\n", "for", "issue", ":=", "range", "c", "{", "issueOrm", ",", "err", ":=", "NewIssue", "(", "issue", ",", "client", ".", "RepositoryName", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "glog", ".", "Error", "(", "\"", "\"", ",", "err", ")", "\n", "continue", "\n", "}", "\n", "if", "db", ".", "Create", "(", "issueOrm", ")", ".", "Error", "!=", "nil", "{", "// We assume record already exists. Let's", "// update. First we need to delete labels and", "// assignees, as they are just concatenated", "// otherwise.", "db", ".", "Delete", "(", "sql", ".", "Label", "{", "}", ",", "\"", "\"", ",", "issueOrm", ".", "ID", ",", "client", ".", "RepositoryName", "(", ")", ")", "\n", "db", ".", "Delete", "(", "sql", ".", "Assignee", "{", "}", ",", "\"", "\"", ",", "issueOrm", ".", "ID", ",", "client", ".", "RepositoryName", "(", ")", ")", "\n\n", "if", "err", ":=", "db", ".", "Save", "(", "issueOrm", ")", ".", "Error", ";", "err", "!=", "nil", "{", "glog", ".", "Error", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "// Issue is updated, find if we have new comments", "UpdateComments", "(", "*", "issue", ".", "Number", ",", "issueOrm", ".", "IsPR", ",", "db", ",", "<mask>", ")", "\n", "// and find if we have new events", "UpdateIssueEvents", "(", "*", "issue", ".", "Number", ",", "db", ",", "client", ")", "\n", "}", "\n", "}" ]
21,894
all-21895
[ "FindRegistry", "returns", "the", "Registry", "with", "the", "longest", "prefix", "for", "ref", "which", "is", "a", "registry", "repository", "namespace", "repository", "or", "image", "reference", "(", "as", "formatted", "by", "reference", ".", "Domain", "()", "reference", ".", "Named", ".", "Name", "()", "or", "reference", ".", "Reference", ".", "String", "()", "—", "note", "that", "this", "requires", "the", "name", "to", "start", "with", "an", "explicit", "hostname!", ")", ".", "If", "no", "Registry", "prefixes", "the", "image", "nil", "is", "returned", "." ]
[ "func", "FindRegistry", "(", "ctx", "*", "types", ".", "SystemContext", ",", "ref", "string", ")", "(", "*", "Registry", ",", "error", ")", "{", "registries", ",", "err", ":=", "GetRegistries", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "reg", ":=", "Registry", "{", "}", "\n", "prefixLen", ":=", "0", "\n", "for", "_", ",", "r", ":=", "range", "registries", "{", "if", "refMatchesPrefix", "(", "ref", ",", "r", ".", "Prefix", ")", "{", "length", ":=", "len", "(", "r", ".", "Prefix", ")", "\n", "if", "length", ">", "prefixLen", "{", "reg", "=", "r", "\n", "prefixLen", "=", "<mask>", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "prefixLen", "!=", "0", "{", "return", "&", "reg", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "nil", "\n", "}" ]
21,895
all-21896
[ "matrixSelector", "evaluates", "a", "*", "MatrixSelector", "expression", "." ]
[ "func", "(", "ev", "*", "evaluator", ")", "matrixSelector", "(", "node", "*", "MatrixSelector", ")", "Matrix", "{", "checkForSeriesSetExpansion", "(", "ev", ".", "ctx", ",", "node", ")", "\n\n", "var", "(", "offset", "=", "durationMilliseconds", "(", "node", ".", "Offset", ")", "\n", "maxt", "=", "ev", ".", "startTimestamp", "-", "offset", "\n", "mint", "=", "maxt", "-", "durationMilliseconds", "(", "node", ".", "Range", ")", "\n", "matrix", "=", "make", "(", "Matrix", ",", "0", ",", "len", "(", "<mask>", ".", "series", ")", ")", "\n", ")", "\n\n", "it", ":=", "storage", ".", "NewBuffer", "(", "durationMilliseconds", "(", "node", ".", "Range", ")", ")", "\n", "for", "i", ",", "s", ":=", "range", "node", ".", "series", "{", "if", "err", ":=", "contextDone", "(", "ev", ".", "ctx", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "ev", ".", "error", "(", "err", ")", "\n", "}", "\n", "it", ".", "Reset", "(", "s", ".", "Iterator", "(", ")", ")", "\n", "ss", ":=", "Series", "{", "Metric", ":", "node", ".", "series", "[", "i", "]", ".", "Labels", "(", ")", ",", "}", "\n\n", "ss", ".", "Points", "=", "ev", ".", "matrixIterSlice", "(", "it", ",", "mint", ",", "maxt", ",", "getPointSlice", "(", "16", ")", ")", "\n\n", "if", "len", "(", "ss", ".", "Points", ")", ">", "0", "{", "matrix", "=", "append", "(", "matrix", ",", "ss", ")", "\n", "}", "else", "{", "putPointSlice", "(", "ss", ".", "Points", ")", "\n", "}", "\n", "}", "\n", "return", "matrix", "\n", "}" ]
21,896
all-21897
[ "RunValueLogGC", "triggers", "a", "value", "log", "garbage", "collection", ".", "It", "picks", "value", "log", "files", "to", "perform", "GC", "based", "on", "statistics", "that", "are", "collected", "duing", "compactions", ".", "If", "no", "such", "statistics", "are", "available", "then", "log", "files", "are", "picked", "in", "random", "order", ".", "The", "process", "stops", "as", "soon", "as", "the", "first", "log", "file", "is", "encountered", "which", "does", "not", "result", "in", "garbage", "collection", ".", "When", "a", "log", "file", "is", "picked", "it", "is", "first", "sampled", ".", "If", "the", "sample", "shows", "that", "we", "can", "discard", "at", "least", "discardRatio", "space", "of", "that", "file", "it", "would", "be", "rewritten", ".", "If", "a", "call", "to", "RunValueLogGC", "results", "in", "no", "rewrites", "then", "an", "ErrNoRewrite", "is", "thrown", "indicating", "that", "the", "call", "resulted", "in", "no", "file", "rewrites", ".", "We", "recommend", "setting", "discardRatio", "to", "0", ".", "5", "thus", "indicating", "that", "a", "file", "be", "rewritten", "if", "half", "the", "space", "can", "be", "discarded", ".", "This", "results", "in", "a", "lifetime", "value", "log", "write", "amplification", "of", "2", "(", "1", "from", "original", "write", "+", "0", ".", "5", "rewrite", "+", "0", ".", "25", "+", "0", ".", "125", "+", "...", "=", "2", ")", ".", "Setting", "it", "to", "higher", "value", "would", "result", "in", "fewer", "space", "reclaims", "while", "setting", "it", "to", "a", "lower", "value", "would", "result", "in", "more", "space", "reclaims", "at", "the", "cost", "of", "increased", "activity", "on", "the", "LSM", "tree", ".", "discardRatio", "must", "be", "in", "the", "range", "(", "0", ".", "0", "1", ".", "0", ")", "both", "endpoints", "excluded", "otherwise", "an", "ErrInvalidRequest", "is", "returned", ".", "Only", "one", "GC", "is", "allowed", "at", "a", "time", ".", "If", "another", "value", "log", "GC", "is", "running", "or", "DB", "has", "been", "closed", "this", "would", "return", "an", "ErrRejected", ".", "Note", ":", "Every", "time", "GC", "is", "run", "it", "would", "produce", "a", "spike", "of", "activity", "on", "the", "LSM", "tree", "." ]
[ "func", "(", "db", "*", "DB", ")", "RunValueLogGC", "(", "discardRatio", "float64", ")", "error", "{", "if", "discardRatio", ">=", "1.0", "||", "discardRatio", "<=", "0.0", "{", "return", "ErrInvalidRequest", "\n", "}", "\n\n", "// Find head on disk", "headKey", ":=", "y", ".", "KeyWithTs", "(", "head", ",", "math", ".", "MaxUint64", ")", "\n", "// Need to pass with timestamp, lsm get removes the last 8 bytes and compares key", "val", ",", "err", ":=", "db", ".", "lc", ".", "get", "(", "headKey", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "<mask>", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "var", "head", "valuePointer", "\n", "if", "len", "(", "val", ".", "Value", ")", ">", "0", "{", "head", ".", "Decode", "(", "val", ".", "Value", ")", "\n", "}", "\n\n", "// Pick a log file and run GC", "return", "db", ".", "vlog", ".", "runGC", "(", "discardRatio", ",", "head", ")", "\n", "}" ]
21,897
all-21898
[ "Delete", "takes", "name", "of", "the", "prowJob", "and", "deletes", "it", ".", "Returns", "an", "error", "if", "one", "occurs", "." ]
[ "func", "(", "c", "*", "FakeProwJobs", ")", "Delete", "(", "name", "string", ",", "<mask>", "*", "v1", ".", "DeleteOptions", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "Fake", ".", "Invokes", "(", "testing", ".", "NewDeleteAction", "(", "prowjobsResource", ",", "c", ".", "ns", ",", "name", ")", ",", "&", "prowjobsv1", ".", "ProwJob", "{", "}", ")", "\n\n", "return", "err", "\n", "}" ]
21,898
all-21899
[ "/", "*", "IndentString", "takes", "a", "string", "and", "indents", "each", "line", "by", "the", "specified", "amount", "." ]
[ "func", "IndentString", "(", "s", "string", ",", "indentation", "uint", ")", "string", "{", "components", ":=", "strings", ".", "Split", "(", "s", ",", "\"", "\\n", "\"", ")", "\n", "result", ":=", "\"", "\"", "\n", "indent", ":=", "strings", ".", "Repeat", "(", "Indent", ",", "int", "(", "indentation", ")", ")", "\n", "for", "i", ",", "component", ":=", "<mask>", "components", "{", "result", "+=", "indent", "+", "component", "\n", "if", "i", "<", "len", "(", "components", ")", "-", "1", "{", "result", "+=", "\"", "\\n", "\"", "\n", "}", "\n", "}", "\n\n", "return", "result", "\n", "}" ]
21,899
all-21900
[ "expandClusterDrsVMConfigInfo", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "ClusterDrsVmConfigInfo", "." ]
[ "func", "expandClusterDrsVMConfigInfo", "(", "d", "*", "schema", ".", "ResourceData", ",", "vm", "*", "object", ".", "VirtualMachine", ")", "(", "*", "<mask>", ".", "ClusterDrsVmConfigInfo", ",", "error", ")", "{", "obj", ":=", "&", "types", ".", "ClusterDrsVmConfigInfo", "{", "Behavior", ":", "types", ".", "DrsBehavior", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ")", ",", "Enabled", ":", "structure", ".", "GetBool", "(", "d", ",", "\"", "\"", ")", ",", "Key", ":", "vm", ".", "Reference", "(", ")", ",", "}", "\n\n", "return", "obj", ",", "nil", "\n", "}" ]