id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
21,500
all-21501
[ "Copy", "creates", "a", "new", "copy", "of", "the", "given", "LexSymbolSet" ]
[ "func", "(", "l", "*", "LexSymbolSet", ")", "Copy", "(", ")", "*", "LexSymbolSet", "{", "c", ":=", "NewLexSymbolSet", "(", ")", "\n", "for", "k", ",", "v", ":=", "range", "l", ".", "Map", "{", "c", ".", "<mask>", "[", "k", "]", "=", "LexSymbol", "{", "v", ".", "Name", ",", "v", ".", "Type", ",", "v", ".", "Priority", "}", "\n", "}", "\n", "return", "c", "\n", "}" ]
21,501
all-21502
[ "Validate", "validates", "this", "task" ]
[ "func", "(", "m", "*", "Task", ")", "Validate", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "res", "[", "]", "error", "\n\n", "if", "err", ":=", "m", ".", "NewTask", ".", "Validate", "(", "formats", ")", ";", "err", "!=", "nil", "{", "res", "=", "append", "(", "<mask>", ",", "err", ")", "\n", "}", "\n\n", "if", "err", ":=", "m", ".", "TaskAllOf1", ".", "Validate", "(", "formats", ")", ";", "err", "!=", "nil", "{", "res", "=", "append", "(", "res", ",", "err", ")", "\n", "}", "\n\n", "if", "len", "(", "res", ")", ">", "0", "{", "return", "errors", ".", "CompositeValidationError", "(", "res", "...", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,502
all-21503
[ "FilterGetAll", "provides", "a", "mock", "function", "with", "given", "fields", ":", "filter", "count", "skip", "store", "opts" ]
[ "func", "(", "_m", "*", "ObjectStore", ")", "FilterGetAll", "(", "filter", "map", "[", "string", "]", "interface", "{", "}", ",", "count", "int", ",", "skip", "int", ",", "store", "string", ",", "opts", "gostore", ".", "ObjectStoreOptions", ")", "(", "gostore", ".", "ObjectRows", ",", "error", ")", "{", "ret", ":=", "_m", ".", "Called", "(", "filter", ",", "count", ",", "skip", ",", "store", ",", "opts", ")", "\n\n", "var", "r0", "gostore", ".", "ObjectRows", "\n", "if", "rf", ",", "ok", ":=", "ret", ".", "Get", "(", "0", ")", ".", "(", "func", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "int", ",", "int", ",", "string", ",", "gostore", ".", "ObjectStoreOptions", ")", "gostore", ".", "ObjectRows", ")", ";", "ok", "{", "r0", "=", "rf", "(", "filter", ",", "count", ",", "skip", ",", "store", ",", "opts", ")", "\n", "}", "else", "{", "if", "ret", ".", "Get", "(", "0", ")", "!=", "nil", "{", "r0", "=", "ret", ".", "Get", "(", "0", ")", ".", "(", "gostore", ".", "ObjectRows", ")", "\n", "}", "\n", "}", "\n\n", "var", "r1", "error", "\n", "if", "rf", ",", "ok", ":=", "ret", ".", "Get", "(", "1", ")", ".", "(", "func", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "int", ",", "int", ",", "string", ",", "gostore", ".", "ObjectStoreOptions", ")", "error", ")", ";", "ok", "{", "r1", "=", "rf", "(", "<mask>", ",", "count", ",", "skip", ",", "store", ",", "opts", ")", "\n", "}", "else", "{", "r1", "=", "ret", ".", "Error", "(", "1", ")", "\n", "}", "\n\n", "return", "r0", ",", "r1", "\n", "}" ]
21,503
all-21504
[ "StatusHandler", "can", "be", "used", "in", "JSON", "-", "encoded", "HTTP", "API", "to", "check", "the", "status", "of", "maintenance", "." ]
[ "func", "(", "s", "Service", ")", "StatusHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "<mask>", ",", "err", ":=", "s", ".", "store", ".", "Status", "(", ")", "\n", "if", "err", "!=", "nil", "{", "s", ".", "logger", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "jsonInternalServerErrorResponse", "(", "w", ")", "\n", "return", "\n", "}", "\n", "jsonStatusResponse", "(", "w", ",", "on", ")", "\n", "}" ]
21,504
all-21505
[ "SetBufferLength", "sets", "length", "of", "buffer", "for", "accepting", "log", "records", "." ]
[ "func", "(", "logger", "*", "Logger", ")", "SetBufferLength", "(", "length", "int", ")", "{", "logger", ".", "lock", ".", "Lock", "(", ")", "\n\n", "if", "length", "==", "0", "{", "logger", ".", "buffer", "=", "nil", "\n", "}", "else", "if", "length", "!=", "logger", ".", "buffer", ".", "Len", "(", ")", "{", "logger", ".", "<mask>", "=", "ring", ".", "New", "(", "length", ")", "\n", "}", "\n\n", "logger", ".", "lock", ".", "Unlock", "(", ")", "\n", "}" ]
21,505
all-21506
[ "GetTideContextPolicy", "parses", "the", "prow", "config", "to", "find", "context", "merge", "options", ".", "If", "none", "are", "set", "it", "will", "use", "the", "prow", "jobs", "configured", "and", "use", "the", "default", "github", "combined", "status", ".", "Otherwise", "if", "set", "it", "will", "use", "the", "branch", "protection", "setting", "or", "the", "listed", "jobs", "." ]
[ "func", "(", "c", "Config", ")", "GetTideContextPolicy", "(", "org", ",", "repo", ",", "branch", "string", ")", "(", "*", "TideContextPolicy", ",", "error", ")", "{", "options", ":=", "parseTideContextPolicyOptions", "(", "org", ",", "repo", ",", "branch", ",", "c", ".", "Tide", ".", "ContextOptions", ")", "\n", "// Adding required and optional contexts from options", "required", ":=", "sets", ".", "NewString", "(", "options", ".", "RequiredContexts", "...", ")", "\n", "requiredIfPresent", ":=", "sets", ".", "NewString", "(", "options", ".", "RequiredIfPresentContexts", "...", ")", "\n", "optional", ":=", "sets", ".", "NewString", "(", "options", ".", "OptionalContexts", "...", ")", "\n\n", "// automatically generate required and optional entries for Prow Jobs", "prowRequired", ",", "prowRequiredIfPresent", ",", "prowOptional", ":=", "BranchRequirements", "(", "org", ",", "repo", ",", "branch", ",", "c", ".", "Presubmits", ")", "\n", "required", ".", "Insert", "(", "prowRequired", "...", ")", "\n", "requiredIfPresent", ".", "Insert", "(", "prowRequiredIfPresent", "...", ")", "\n", "optional", ".", "Insert", "(", "prowOptional", "...", ")", "\n\n", "// Using Branch protection configuration", "if", "options", ".", "FromBranchProtection", "!=", "nil", "&&", "*", "options", ".", "FromBranchProtection", "{", "bp", ",", "err", ":=", "c", ".", "GetBranchProtection", "(", "org", ",", "repo", ",", "branch", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Warningf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "branch", ")", "\n", "}", "else", "if", "bp", "!=", "nil", "&&", "bp", ".", "Protect", "!=", "nil", "&&", "*", "bp", ".", "Protect", "&&", "bp", ".", "RequiredStatusChecks", "!=", "nil", "{", "required", ".", "Insert", "(", "bp", ".", "RequiredStatusChecks", ".", "Contexts", "...", ")", "\n", "}", "\n", "}", "\n\n", "t", ":=", "&", "TideContextPolicy", "{", "RequiredContexts", ":", "<mask>", ".", "List", "(", ")", ",", "RequiredIfPresentContexts", ":", "requiredIfPresent", ".", "List", "(", ")", ",", "OptionalContexts", ":", "optional", ".", "List", "(", ")", ",", "SkipUnknownContexts", ":", "options", ".", "SkipUnknownContexts", ",", "}", "\n", "if", "err", ":=", "t", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "t", ",", "err", "\n", "}", "\n", "return", "t", ",", "nil", "\n", "}" ]
21,506
all-21507
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetResponseBodyParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoFetch5", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
21,507
all-21508
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventResetProfiles", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeapprofiler15", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
21,508
all-21509
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "UniformMatrix3x4fv", "(", "location", "int32", ",", "count", "int32", ",", "transpose", "bool", ",", "value", "*", "float32", ")", "{", "syscall", ".", "Syscall6", "(", "gpUniformMatrix3x4fv", ",", "4", ",", "uintptr", "(", "location", ")", ",", "uintptr", "(", "<mask>", ")", ",", "boolToUintptr", "(", "transpose", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
21,509
all-21510
[ "PrefixRangeEnd", "allows", "Get", "Delete", "and", "Watch", "requests", "to", "operate", "on", "all", "keys", "with", "a", "matching", "prefix", ".", "Pass", "the", "prefix", "to", "this", "function", "and", "use", "the", "result", "as", "the", "RangeEnd", "value", "." ]
[ "func", "PrefixRangeEnd", "(", "prefix", "[", "]", "<mask>", ")", "[", "]", "byte", "{", "// https://github.com/coreos/etcd/blob/17e32b6/clientv3/op.go#L187", "end", ":=", "make", "(", "[", "]", "byte", ",", "len", "(", "prefix", ")", ")", "\n", "copy", "(", "end", ",", "prefix", ")", "\n", "for", "i", ":=", "len", "(", "end", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "if", "end", "[", "i", "]", "<", "0xff", "{", "end", "[", "i", "]", "=", "end", "[", "i", "]", "+", "1", "\n", "end", "=", "end", "[", ":", "i", "+", "1", "]", "\n", "return", "end", "\n", "}", "\n", "}", "\n", "// next prefix does not exist (e.g., 0xffff);", "// default to WithFromKey policy", "return", "[", "]", "byte", "{", "0", "}", "\n", "}" ]
21,510
all-21511
[ "Respond", "without", "doing", "anything", ".", "This", "endpoint", "is", "used", "to", "check", "that", "the", "service", "is", "up", ".", "See", "#ping" ]
[ "func", "(", "login", "*", "Login", ")", "Ping", "(", ")", "error", "{", "cd", ":=", "tcclient", ".", "<mask>", "(", "*", "login", ")", "\n", "_", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
21,511
all-21512
[ "processLogs", "is", "used", "to", "apply", "all", "the", "committed", "entries", "that", "haven", "t", "been", "applied", "up", "to", "the", "given", "index", "limit", ".", "This", "can", "be", "called", "from", "both", "leaders", "and", "followers", ".", "Followers", "call", "this", "from", "AppendEntries", "for", "n", "entries", "at", "a", "time", "and", "always", "pass", "future", "=", "nil", ".", "Leaders", "call", "this", "once", "per", "inflight", "when", "entries", "are", "committed", ".", "They", "pass", "the", "future", "from", "inflights", "." ]
[ "func", "(", "r", "*", "Raft", ")", "processLogs", "(", "index", "uint64", ",", "future", "*", "logFuture", ")", "{", "// Reject logs we've applied already", "lastApplied", ":=", "r", ".", "getLastApplied", "(", ")", "\n", "if", "index", "<=", "lastApplied", "{", "r", ".", "logger", ".", "Warn", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "index", ")", ")", "\n", "return", "\n", "}", "\n\n", "// Apply all the preceding logs", "for", "idx", ":=", "r", ".", "getLastApplied", "(", ")", "+", "1", ";", "idx", "<=", "index", ";", "idx", "++", "{", "// Get the log, either from the future or from our log store", "if", "future", "!=", "nil", "&&", "future", ".", "log", ".", "<mask>", "==", "idx", "{", "r", ".", "processLog", "(", "&", "future", ".", "log", ",", "future", ")", "\n", "}", "else", "{", "l", ":=", "new", "(", "Log", ")", "\n", "if", "err", ":=", "r", ".", "logs", ".", "GetLog", "(", "idx", ",", "l", ")", ";", "err", "!=", "nil", "{", "r", ".", "logger", ".", "Error", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "idx", ",", "err", ")", ")", "\n", "panic", "(", "err", ")", "\n", "}", "\n", "r", ".", "processLog", "(", "l", ",", "nil", ")", "\n", "}", "\n\n", "// Update the lastApplied index and term", "r", ".", "setLastApplied", "(", "idx", ")", "\n", "}", "\n", "}" ]
21,512
all-21513
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "AuthChallengeSource", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "<mask>", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
21,513
all-21514
[ "title", ":", "healthcheck", "path", ":", "/", "healthcheck", "method", ":", "GET", "responses", ":", "200", ":", "OK", "500", ":", "Internal", "server", "error" ]
[ "func", "healthcheck", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "<mask>", "checks", "[", "]", "string", "\n", "values", ":=", "r", ".", "URL", ".", "Query", "(", ")", "\n", "if", "values", "!=", "nil", "{", "checks", "=", "values", "[", "\"", "\"", "]", "\n", "}", "\n", "fullHealthcheck", "(", "w", ",", "checks", ")", "\n", "}" ]
21,514
all-21515
[ "NewRemoteOperationsWithPath", "-" ]
[ "func", "NewRemoteOperationsWithPath", "(", "sshCfg", "<mask>", ".", "SshConfig", ",", "remoteImportPath", "string", ")", "*", "RemoteOperations", "{", "if", "len", "(", "remoteImportPath", ")", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "&", "RemoteOperations", "{", "sshCfg", ":", "sshCfg", ",", "remotePath", ":", "remoteImportPath", ",", "GetSSHConnection", ":", "newSSHConnection", ",", "}", "\n", "}" ]
21,515
all-21516
[ "errorf", "causes", "a", "panic", "with", "the", "input", "formatted", "into", "an", "error", "." ]
[ "func", "(", "ev", "*", "evaluator", ")", "errorf", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "ev", ".", "error", "(", "errors", ".", "Errorf", "(", "<mask>", ",", "args", "...", ")", ")", "\n", "}" ]
21,516
all-21517
[ "Metric", "appends", "a", "new", "metric", "to", "the", "reporter", ".", "The", "value", "v", "must", "be", "either", "an", "int64", "or", "float64", "otherwise", "an", "error", "is", "returned" ]
[ "func", "(", "r", "*", "Reporter", ")", "Metric", "(", "name", "string", ",", "tags", "[", "]", "string", ",", "v", "float32", ")", "{", "r", ".", "metrics", "=", "append", "(", "r", ".", "metrics", ",", "Metric", "{", "Name", ":", "name", ",", "Points", ":", "[", "]", "[", "2", "]", "interface", "{", "}", "{", "[", "2", "]", "interface", "{", "}", "{", "r", ".", "timestamp", ",", "v", "}", "}", ",", "Tags", ":", "<mask>", ",", "Host", ":", "r", ".", "Hostname", ",", "}", ")", "\n", "}" ]
21,517
all-21518
[ "IsSelected", "()", "()", "is", "a", "wrapper", "around", "gtk_print_operation_preview_is_selected", "()", "." ]
[ "func", "(", "pop", "*", "PrintOperationPreview", ")", "IsSelected", "(", "<mask>", "int", ")", "bool", "{", "c", ":=", "C", ".", "gtk_print_operation_preview_is_selected", "(", "pop", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "page", ")", ")", "\n", "return", "gobool", "(", "c", ")", "\n", "}" ]
21,518
all-21519
[ "enqueue", "a", "sample", ".", "If", "we", "are", "currently", "in", "the", "process", "of", "shutting", "down", "or", "resharding", "will", "return", "false", ";", "in", "this", "case", "you", "should", "back", "off", "and", "retry", "." ]
[ "func", "(", "s", "*", "shards", ")", "enqueue", "(", "ref", "uint64", ",", "sample", "prompb", ".", "TimeSeries", ")", "bool", "{", "s", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "mtx", ".", "RUnlock", "(", ")", "\n\n", "<mask>", "{", "case", "<-", "s", ".", "softShutdown", ":", "return", "false", "\n", "default", ":", "}", "\n\n", "shard", ":=", "uint64", "(", "ref", ")", "%", "uint64", "(", "len", "(", "s", ".", "queues", ")", ")", "\n", "select", "{", "case", "<-", "s", ".", "softShutdown", ":", "return", "false", "\n", "case", "s", ".", "queues", "[", "shard", "]", "<-", "sample", ":", "return", "true", "\n", "}", "\n", "}" ]
21,519
all-21520
[ "TODO", "needs", "test", "since", "it", "is", "not", "quiet", "right" ]
[ "func", "getPrec", "(", "num", "float64", ",", "better", "bool", ")", "int", "{", "max", ":=", "3", "\n", "eps", ":=", "0.0005", "\n", "if", "better", "{", "<mask>", "=", "6", "\n", "eps", "=", "0.0000005", "\n", "}", "\n", "prec", ":=", "0", "\n", "for", "math", ".", "Mod", "(", "num", ",", "1", ")", ">", "eps", "{", "num", "*=", "10", "\n", "eps", "*=", "10", "\n", "prec", "++", "\n", "}", "\n\n", "if", "max", "<", "prec", "{", "return", "max", "\n", "}", "\n", "return", "prec", "\n", "}" ]
21,520
all-21521
[ "BodyWriteTo", "writes", "request", "body", "to", "w", "." ]
[ "func", "(", "req", "*", "<mask>", ")", "BodyWriteTo", "(", "w", "io", ".", "Writer", ")", "error", "{", "if", "req", ".", "bodyStream", "!=", "nil", "{", "_", ",", "err", ":=", "copyZeroAlloc", "(", "w", ",", "req", ".", "bodyStream", ")", "\n", "req", ".", "closeBodyStream", "(", ")", "\n", "return", "err", "\n", "}", "\n", "if", "req", ".", "onlyMultipartForm", "(", ")", "{", "return", "WriteMultipartForm", "(", "w", ",", "req", ".", "multipartForm", ",", "req", ".", "multipartFormBoundary", ")", "\n", "}", "\n", "_", ",", "err", ":=", "w", ".", "Write", "(", "req", ".", "bodyBytes", "(", ")", ")", "\n", "return", "err", "\n", "}" ]
21,521
all-21522
[ "===", "count_over_time", "(", "Matrix", "ValueTypeMatrix", ")", "Vector", "===" ]
[ "func", "funcCountOverTime", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "return", "aggrOverTime", "(", "vals", ",", "enh", ",", "func", "(", "values", "[", "]", "<mask>", ")", "float64", "{", "return", "float64", "(", "len", "(", "values", ")", ")", "\n", "}", ")", "\n", "}" ]
21,522
all-21523
[ "RawQuery", "allows", "directly", "querying", "the", "LXD", "API", "This", "should", "only", "be", "used", "by", "internal", "LXD", "tools", "." ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "RawQuery", "(", "method", "string", ",", "path", "string", ",", "data", "interface", "{", "}", ",", "ETag", "string", ")", "(", "*", "api", ".", "Response", ",", "string", ",", "error", ")", "{", "// Generate the URL", "url", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "httpHost", ",", "<mask>", ")", "\n\n", "return", "r", ".", "rawQuery", "(", "method", ",", "url", ",", "data", ",", "ETag", ")", "\n", "}" ]
21,523
all-21524
[ "NewClient", "returns", "a", "client", "for", "the", "given", "host", ".", "All", "communication", "will", "be", "performed", "over", "SSL", "unless", "the", "host", "is", "localhost", "." ]
[ "func", "NewClient", "(", "host", "string", ",", "client", "*", "http", ".", "Client", ")", "(", "*", "Client", ",", "error", ")", "{", "// Add an appcfg header to outgoing requests.", "wrapClient", ":=", "new", "(", "http", ".", "Client", ")", "\n", "*", "wrapClient", "=", "*", "client", "\n", "t", ":=", "client", ".", "Transport", "\n", "if", "t", "==", "nil", "{", "t", "=", "<mask>", ".", "DefaultTransport", "\n", "}", "\n", "wrapClient", ".", "Transport", "=", "&", "headerAddingRoundTripper", "{", "t", "}", "\n\n", "url", ":=", "url", ".", "URL", "{", "Scheme", ":", "\"", "\"", ",", "Host", ":", "host", ",", "Path", ":", "\"", "\"", ",", "}", "\n", "if", "host", "==", "\"", "\"", "||", "strings", ".", "HasPrefix", "(", "host", ",", "\"", "\"", ")", "{", "url", ".", "Scheme", "=", "\"", "\"", "\n", "}", "\n", "u", ":=", "url", ".", "String", "(", ")", "\n", "appID", ",", "err", ":=", "getAppID", "(", "wrapClient", ",", "u", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "&", "Client", "{", "hc", ":", "wrapClient", ",", "url", ":", "u", ",", "appID", ":", "appID", ",", "}", ",", "nil", "\n", "}" ]
21,524
all-21525
[ "attach", "a", "buffer", "object", "s", "data", "store", "to", "a", "buffer", "texture", "object" ]
[ "func", "TextureBuffer", "(", "texture", "uint32", ",", "internalformat", "uint32", ",", "<mask>", "uint32", ")", "{", "C", ".", "glowTextureBuffer", "(", "gpTextureBuffer", ",", "(", "C", ".", "GLuint", ")", "(", "texture", ")", ",", "(", "C", ".", "GLenum", ")", "(", "internalformat", ")", ",", "(", "C", ".", "GLuint", ")", "(", "buffer", ")", ")", "\n", "}" ]
21,525
all-21526
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "Uniform2i", "(", "location", "int32", ",", "v0", "int32", ",", "v1", "int32", ")", "{", "C", ".", "glowUniform2i", "(", "gpUniform2i", ",", "(", "C", ".", "GLint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLint", ")", "(", "v0", ")", ",", "(", "C", ".", "GLint", ")", "(", "v1", ")", ")", "\n", "}" ]
21,526
all-21527
[ "createTaskResponse", "creates", "JSON", "response", "and", "sets", "the", "http", "status", "code", "for", "the", "task", "queried", "." ]
[ "func", "createTaskResponse", "(", "task", "*", "apitask", ".", "Task", ",", "found", "bool", ",", "resourceID", "string", ",", "state", "dockerstate", ".", "TaskEngineState", ")", "(", "[", "]", "<mask>", ",", "int", ")", "{", "var", "responseJSON", "[", "]", "byte", "\n", "status", ":=", "http", ".", "StatusOK", "\n", "if", "found", "{", "containerMap", ",", "_", ":=", "state", ".", "ContainerMapByArn", "(", "task", ".", "Arn", ")", "\n", "responseJSON", ",", "_", "=", "json", ".", "Marshal", "(", "NewTaskResponse", "(", "task", ",", "containerMap", ")", ")", "\n", "}", "else", "{", "seelog", ".", "Warn", "(", "\"", "\"", "+", "resourceID", ")", "\n", "responseJSON", ",", "_", "=", "json", ".", "Marshal", "(", "&", "TaskResponse", "{", "}", ")", "\n", "status", "=", "http", ".", "StatusNotFound", "\n", "}", "\n", "return", "responseJSON", ",", "status", "\n", "}" ]
21,527
all-21528
[ "Merge", "combines", "all", "values", "in", "this", "configuration", "with", "the", "values", "in", "the", "other", "configuration", "with", "values", "in", "the", "other", "configuration", "taking", "precedence", ".", "Maps", "and", "slices", "are", "merged", "most", "other", "values", "are", "overwritten", ".", "Complex", "structs", "define", "their", "own", "merge", "functionality", "." ]
[ "func", "(", "c", "*", "SSLConfig", ")", "Merge", "(", "o", "*", "SSLConfig", ")", "*", "SSLConfig", "{", "if", "c", "==", "nil", "{", "if", "o", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "o", ".", "Copy", "(", ")", "\n", "}", "\n\n", "if", "o", "==", "nil", "{", "return", "c", ".", "Copy", "(", ")", "\n", "}", "\n\n", "r", ":=", "c", ".", "Copy", "(", ")", "\n\n", "if", "o", ".", "Cert", "!=", "nil", "{", "r", ".", "Cert", "=", "o", ".", "Cert", "\n", "}", "\n\n", "if", "o", ".", "CaCert", "!=", "nil", "{", "r", ".", "CaCert", "=", "o", ".", "CaCert", "\n", "}", "\n\n", "if", "o", ".", "CaPath", "!=", "nil", "{", "r", ".", "CaPath", "=", "o", ".", "CaPath", "\n", "}", "\n\n", "if", "o", ".", "Enabled", "!=", "nil", "{", "r", ".", "Enabled", "=", "o", ".", "Enabled", "\n", "}", "\n\n", "if", "o", ".", "Key", "!=", "nil", "{", "r", ".", "<mask>", "=", "o", ".", "Key", "\n", "}", "\n\n", "if", "o", ".", "ServerName", "!=", "nil", "{", "r", ".", "ServerName", "=", "o", ".", "ServerName", "\n", "}", "\n\n", "if", "o", ".", "Verify", "!=", "nil", "{", "r", ".", "Verify", "=", "o", ".", "Verify", "\n", "}", "\n\n", "return", "r", "\n", "}" ]
21,528
all-21529
[ "ClientForResource", "returns", "the", "ResourceClient", "for", "a", "given", "object" ]
[ "func", "ClientForResource", "(", "client", "dynamic", ".", "Interface", ",", "mapper", "meta", ".", "RESTMapper", ",", "obj", "runtime", ".", "Object", ",", "defNs", "string", ")", "(", "dynamic", ".", "ResourceInterface", ",", "error", ")", "{", "gvk", ":=", "obj", ".", "GetObjectKind", "(", ")", ".", "GroupVersionKind", "(", ")", "\n\n", "mapping", ",", "err", ":=", "mapper", ".", "RESTMapping", "(", "gvk", ".", "GroupKind", "(", ")", ",", "gvk", ".", "Version", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "rc", ":=", "<mask>", ".", "Resource", "(", "mapping", ".", "Resource", ")", "\n\n", "switch", "mapping", ".", "Scope", ".", "Name", "(", ")", "{", "case", "meta", ".", "RESTScopeNameRoot", ":", "return", "rc", ",", "nil", "\n", "case", "meta", ".", "RESTScopeNameNamespace", ":", "meta", ",", "err", ":=", "meta", ".", "Accessor", "(", "obj", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "namespace", ":=", "meta", ".", "GetNamespace", "(", ")", "\n", "if", "namespace", "==", "\"", "\"", "{", "namespace", "=", "defNs", "\n", "}", "\n", "return", "rc", ".", "Namespace", "(", "namespace", ")", ",", "nil", "\n", "default", ":", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "mapping", ".", "Scope", ")", "\n", "}", "\n", "}" ]
21,529
all-21530
[ "DelUser", "removes", "an", "user", "from", "the", "system", "." ]
[ "func", "DelUser", "(", "name", "string", ")", "(", "err", "error", ")", "{", "err", "=", "del", "(", "<mask>", ",", "&", "User", "{", "}", ")", "\n", "if", "err", "==", "nil", "{", "err", "=", "del", "(", "name", ",", "&", "Shadow", "{", "}", ")", "\n", "}", "\n", "return", "\n", "}" ]
21,530
all-21531
[ "getExtHeader", "generates", "the", "hawk", "ext", "header", "based", "on", "the", "authorizedScopes", "and", "the", "certificate", "used", "in", "the", "case", "of", "temporary", "credentials", ".", "The", "header", "is", "a", "base64", "encoded", "json", "object", "with", "a", "certificate", "property", "set", "to", "the", "certificate", "of", "the", "temporary", "credentials", "and", "a", "authorizedScopes", "property", "set", "to", "the", "array", "of", "authorizedScopes", "if", "provided", ".", "If", "either", "certificate", "or", "authorizedScopes", "is", "not", "supplied", "they", "will", "be", "omitted", "from", "the", "json", "result", ".", "If", "neither", "are", "provided", "an", "empty", "string", "is", "returned", "rather", "than", "a", "base64", "encoded", "representation", "of", "null", "or", "{}", ".", "Hawk", "interprets", "the", "empty", "string", "as", "meaning", "the", "ext", "header", "is", "not", "needed", ".", "See", ":", "*", "https", ":", "//", "docs", ".", "taskcluster", ".", "net", "/", "docs", "/", "manual", "/", "design", "/", "apis", "/", "hawk", "/", "authorized", "-", "scopes", "*", "https", ":", "//", "docs", ".", "taskcluster", ".", "net", "/", "docs", "/", "manual", "/", "design", "/", "apis", "/", "hawk", "/", "temporary", "-", "credentials" ]
[ "func", "getExtHeader", "(", "credentials", "*", "Credentials", ")", "(", "<mask>", "string", ",", "err", "error", ")", "{", "ext", ":=", "&", "ExtHeader", "{", "}", "\n", "if", "credentials", ".", "Certificate", "!=", "\"", "\"", "{", "certObj", ":=", "new", "(", "Certificate", ")", "\n", "err", "=", "json", ".", "Unmarshal", "(", "[", "]", "byte", "(", "credentials", ".", "Certificate", ")", ",", "certObj", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "ext", ".", "Certificate", "=", "certObj", "\n", "}", "\n\n", "if", "credentials", ".", "AuthorizedScopes", "!=", "nil", "{", "ext", ".", "AuthorizedScopes", "=", "&", "credentials", ".", "AuthorizedScopes", "\n", "}", "\n", "extJSON", ",", "err", ":=", "json", ".", "Marshal", "(", "ext", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "if", "string", "(", "extJSON", ")", "!=", "\"", "\"", "{", "return", "base64", ".", "StdEncoding", ".", "EncodeToString", "(", "extJSON", ")", ",", "nil", "\n", "}", "\n", "return", "\"", "\"", ",", "nil", "\n", "}" ]
21,531
all-21532
[ "ProcLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "ProcLocator", "(", "href", "string", ")", "*", "ProcLocator", "{", "<mask>", "&", "ProcLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
21,532
all-21533
[ "Read", "Read" ]
[ "func", "(", "<mask>", "*", "MemoryStore", ")", "Read", "(", ")", "<-", "chan", "string", "{", "chResult", ":=", "make", "(", "chan", "string", ")", "\n", "go", "func", "(", ")", "{", "for", "ele", ":=", "range", "ms", ".", "dataStore", ".", "Elements", "(", ")", "{", "chResult", "<-", "ele", ".", "Key", ".", "(", "string", ")", "\n", "}", "\n", "close", "(", "chResult", ")", "\n", "}", "(", ")", "\n", "return", "chResult", "\n", "}" ]
21,533
all-21534
[ "getSettingsForUid", "returns", "the", "settings", "files", "of", "the", "given", "user", "id", "." ]
[ "func", "getSettingsForUid", "(", "id", "int", ")", "(", "settings", ",", "error", ")", "{", "u", ",", "err", ":=", "user", ".", "LookupUID", "(", "id", ")", "\n", "if", "err", "!=", "nil", "{", "return", "settings", "{", "}", ",", "err", "\n", "}", "\n", "if", "u", ".", "Shell", "==", "\"", "\"", "{", "return", "settings", "{", "}", ",", "NoShellError", "(", "u", ".", "Name", ")", "\n", "}", "\n", "if", "u", ".", "Dir", "==", "\"", "\"", "{", "return", "settings", "{", "}", ",", "NoHomeError", "(", "u", ".", "Name", ")", "\n", "}", "\n\n", "shell", ":=", "path", ".", "Base", "(", "u", ".", "Shell", ")", "\n\n", "_settings", ":=", "settings", "{", "global", ":", "systemFile", "[", "_SHELL_SH", "]", ",", "user", ":", "<mask>", ".", "Join", "(", "u", ".", "Dir", ",", "userFile", "[", "_SHELL_SH", "]", ")", ",", "kde", ":", "path", ".", "Join", "(", "u", ".", "Dir", ",", "kdeFile", ")", ",", "}", "\n", "info", ",", "err", ":=", "os", ".", "Stat", "(", "_settings", ".", "kde", ")", "\n", "if", "err", "==", "nil", "&&", "info", ".", "IsDir", "(", ")", "{", "_settings", ".", "useKDE", "=", "true", "\n", "}", "\n\n", "for", "_", ",", "v", ":=", "range", "shFamily", "{", "if", "v", "==", "shell", "{", "return", "_settings", ",", "nil", "\n", "}", "\n", "}", "\n", "/*for _, v := range cshFamily {\n\t\tif v == shell {\n\t\t\treturn _settings, nil\n\t\t}\n\t}*/", "return", "settings", "{", "}", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "shell", ")", "\n", "}" ]
21,534
all-21535
[ "SetTitle", "is", "a", "wrapper", "around", "gtk_header_bar_set_title", "()", "." ]
[ "func", "(", "v", "*", "HeaderBar", ")", "SetTitle", "(", "title", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "title", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_header_bar_set_title", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
21,535
all-21536
[ "Responder", "returns", "a", "responder", "based", "on", "the", "mime", "if", "none", "can", "be", "matched", "the", "default", "is", "returned" ]
[ "func", "(", "e", "*", "Encoder", ")", "Responder", "(", "r", "*", "http", ".", "Request", ")", "Responder", "{", "accept", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "infoList", ":=", "parseAcceptHeader", "(", "accept", ")", "\n\n", "for", "_", ",", "info", ":=", "<mask>", "infoList", "{", "for", "encoding", ",", "i", ":=", "range", "e", ".", "encodings", "{", "if", "i", ".", "equals", "(", "info", ")", "{", "return", "encoding", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "e", ".", "Parser", "(", "r", ")", ".", "(", "Responder", ")", "\n", "}" ]
21,536
all-21537
[ "QuadVertices", "returns", "the", "vertices", "for", "rendering", "a", "quad", ".", "QuadVertices", "is", "highly", "optimized", "for", "rendering", "quads", "and", "that", "s", "the", "most", "significant", "difference", "from", "PutVertices", "." ]
[ "func", "(", "i", "*", "Image", ")", "QuadVertices", "(", "sx0", ",", "sy0", ",", "sx1", ",", "sy1", "int", ",", "a", ",", "b", ",", "c", ",", "d", ",", "tx", ",", "ty", "float32", ",", "cr", ",", "cg", ",", "cb", ",", "ca", "float32", ")", "[", "]", "float32", "{", "if", "i", ".", "backend", "==", "nil", "{", "i", ".", "allocate", "(", "true", ")", "\n", "}", "\n", "ox", ",", "oy", ",", "_", ",", "_", ":=", "i", ".", "<mask>", "(", ")", "\n", "return", "i", ".", "backend", ".", "restorable", ".", "QuadVertices", "(", "sx0", "+", "ox", ",", "sy0", "+", "oy", ",", "sx1", "+", "ox", ",", "sy1", "+", "oy", ",", "a", ",", "b", ",", "c", ",", "d", ",", "tx", ",", "ty", ",", "cr", ",", "cg", ",", "cb", ",", "ca", ")", "\n", "}" ]
21,537
all-21538
[ "ImportPathToBazelRepoName", "converts", "a", "Go", "import", "path", "into", "a", "bazel", "repo", "name", "following", "the", "guidelines", "in", "http", ":", "//", "bazel", ".", "io", "/", "docs", "/", "be", "/", "functions", ".", "html#workspace" ]
[ "func", "ImportPathToBazelRepoName", "(", "importpath", "string", ")", "string", "{", "importpath", "=", "strings", ".", "ToLower", "(", "importpath", ")", "\n", "components", ":=", "strings", ".", "Split", "(", "importpath", ",", "\"", "\"", ")", "\n", "labels", ":=", "strings", ".", "Split", "(", "components", "[", "0", "]", ",", "\"", "\"", ")", "\n", "var", "reversed", "[", "]", "string", "\n", "for", "i", ":=", "range", "labels", "{", "l", ":=", "labels", "[", "len", "(", "labels", ")", "-", "i", "-", "1", "]", "\n", "reversed", "=", "<mask>", "(", "reversed", ",", "l", ")", "\n", "}", "\n", "repo", ":=", "strings", ".", "Join", "(", "append", "(", "reversed", ",", "components", "[", "1", ":", "]", "...", ")", ",", "\"", "\"", ")", "\n", "return", "strings", ".", "NewReplacer", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", ".", "Replace", "(", "repo", ")", "\n", "}" ]
21,538
all-21539
[ "WaitForGuestIP", "waits", "for", "a", "virtual", "machine", "to", "have", "an", "IP", "address", ".", "The", "timeout", "is", "specified", "in", "minutes", ".", "If", "zero", "or", "a", "negative", "value", "is", "passed", "the", "waiter", "returns", "without", "error", "immediately", "." ]
[ "func", "WaitForGuestIP", "(", "client", "*", "govmomi", ".", "Client", ",", "vm", "*", "<mask>", ".", "VirtualMachine", ",", "timeout", "int", ",", "ignoredGuestIPs", "[", "]", "interface", "{", "}", ")", "error", "{", "if", "timeout", "<", "1", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "InventoryPath", ")", "\n", "return", "nil", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "InventoryPath", ",", "timeout", ",", ")", "\n\n", "p", ":=", "client", ".", "PropertyCollector", "(", ")", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "time", ".", "Minute", "*", "time", ".", "Duration", "(", "timeout", ")", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "err", ":=", "property", ".", "Wait", "(", "ctx", ",", "p", ",", "vm", ".", "Reference", "(", ")", ",", "[", "]", "string", "{", "\"", "\"", "}", ",", "func", "(", "pc", "[", "]", "types", ".", "PropertyChange", ")", "bool", "{", "for", "_", ",", "c", ":=", "range", "pc", "{", "if", "c", ".", "Op", "!=", "types", ".", "PropertyChangeOpAssign", "{", "continue", "\n", "}", "\n\n", "if", "c", ".", "Val", "==", "nil", "{", "continue", "\n", "}", "\n\n", "ip", ":=", "net", ".", "ParseIP", "(", "c", ".", "Val", ".", "(", "string", ")", ")", "\n", "if", "skipIPAddrForWaiter", "(", "ip", ",", "ignoredGuestIPs", ")", "{", "continue", "\n", "}", "\n\n", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}", ")", "\n\n", "if", "err", "!=", "nil", "{", "// Provide a friendly error message if we timed out waiting for a routable IP.", "if", "ctx", ".", "Err", "(", ")", "==", "context", ".", "DeadlineExceeded", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "err", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "InventoryPath", ")", "\n", "return", "nil", "\n", "}" ]
21,539
all-21540
[ "String", "returns", "a", "string", "representation", "of", "the", "key", "." ]
[ "func", "(", "k", "*", "Key", ")", "String", "(", ")", "string", "{", "if", "k", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "b", ":=", "bytes", ".", "NewBuffer", "(", "make", "(", "[", "]", "<mask>", ",", "0", ",", "512", ")", ")", "\n", "k", ".", "marshal", "(", "b", ")", "\n", "return", "b", ".", "String", "(", ")", "\n", "}" ]
21,540
all-21541
[ "addRequest", "adds", "a", "read", "only", "reuqest", "into", "readonly", "struct", ".", "index", "is", "the", "commit", "index", "of", "the", "raft", "state", "machine", "when", "it", "received", "the", "read", "only", "request", ".", "m", "is", "the", "original", "read", "only", "request", "message", "from", "the", "local", "or", "remote", "node", "." ]
[ "func", "(", "ro", "*", "readOnly", ")", "addRequest", "(", "<mask>", "uint64", ",", "m", "pb", ".", "Message", ")", "{", "ctx", ":=", "string", "(", "m", ".", "Entries", "[", "0", "]", ".", "Data", ")", "\n", "if", "_", ",", "ok", ":=", "ro", ".", "pendingReadIndex", "[", "ctx", "]", ";", "ok", "{", "return", "\n", "}", "\n", "ro", ".", "pendingReadIndex", "[", "ctx", "]", "=", "&", "readIndexStatus", "{", "index", ":", "index", ",", "req", ":", "m", ",", "acks", ":", "make", "(", "map", "[", "uint64", "]", "struct", "{", "}", ")", "}", "\n", "ro", ".", "readIndexQueue", "=", "append", "(", "ro", ".", "readIndexQueue", ",", "ctx", ")", "\n", "}" ]
21,541
all-21542
[ "Update", "the", "application", "with", "the", "given", "data", ".", "Valid", "parameters", "may", "be", "found", "here", ":", "https", ":", "//", "www", ".", "twilio", ".", "com", "/", "docs", "/", "api", "/", "rest", "/", "applications#instance", "-", "post" ]
[ "func", "(", "a", "*", "ApplicationService", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "sid", "string", ",", "data", "url", ".", "Values", ")", "(", "*", "Application", ",", "error", ")", "{", "application", ":=", "new", "(", "Application", ")", "\n", "err", ":=", "a", ".", "client", ".", "UpdateResource", "(", "ctx", ",", "applicationPathPart", ",", "sid", ",", "<mask>", ",", "application", ")", "\n", "return", "application", ",", "err", "\n", "}" ]
21,542
all-21543
[ "getUserIdentificationPartialConfig", "is", "a", "modified", "copy", "of", "k8s", ".", "io", "/", "kubernetes", "/", "pkg", "/", "client", "/", "unversioned", "/", "clientcmd", ".", "getUserIdentificationPartialConfig", ".", "clientauth", ".", "Info", "object", "contain", "both", "user", "identification", "and", "server", "identification", ".", "We", "want", "different", "precedence", "orders", "for", "both", "so", "we", "have", "to", "split", "the", "objects", "and", "merge", "them", "separately", "we", "want", "this", "order", "of", "precedence", "for", "user", "identifcation", "1", ".", "configAuthInfo", "minus", "auth", "-", "path", "(", "the", "final", "result", "of", "command", "line", "flags", "and", "merged", ".", "kubeconfig", "files", ")", "2", ".", "configAuthInfo", ".", "auth", "-", "path", "(", "this", "file", "can", "contain", "information", "that", "conflicts", "with", "#1", "and", "we", "want", "#1", "to", "win", "the", "priority", ")", "3", ".", "if", "there", "is", "not", "enough", "information", "to", "idenfity", "the", "user", "load", "try", "the", "~", "/", ".", "kubernetes_auth", "file", "4", ".", "if", "there", "is", "not", "enough", "information", "to", "identify", "the", "user", "prompt", "if", "possible" ]
[ "func", "getUserIdentificationPartialConfig", "(", "configAuthInfo", "clientcmdAuthInfo", ")", "(", "*", "restConfig", ",", "error", ")", "{", "mergedConfig", ":=", "&", "restConfig", "{", "}", "\n\n", "// blindly overwrite existing values based on precedence", "if", "len", "(", "configAuthInfo", ".", "Token", ")", ">", "0", "{", "mergedConfig", ".", "BearerToken", "=", "configAuthInfo", ".", "<mask>", "\n", "}", "\n", "if", "len", "(", "configAuthInfo", ".", "ClientCertificate", ")", ">", "0", "||", "len", "(", "configAuthInfo", ".", "ClientCertificateData", ")", ">", "0", "{", "mergedConfig", ".", "CertFile", "=", "configAuthInfo", ".", "ClientCertificate", "\n", "mergedConfig", ".", "CertData", "=", "configAuthInfo", ".", "ClientCertificateData", "\n", "mergedConfig", ".", "KeyFile", "=", "configAuthInfo", ".", "ClientKey", "\n", "mergedConfig", ".", "KeyData", "=", "configAuthInfo", ".", "ClientKeyData", "\n", "}", "\n", "if", "len", "(", "configAuthInfo", ".", "Username", ")", ">", "0", "||", "len", "(", "configAuthInfo", ".", "Password", ")", ">", "0", "{", "mergedConfig", ".", "Username", "=", "configAuthInfo", ".", "Username", "\n", "mergedConfig", ".", "Password", "=", "configAuthInfo", ".", "Password", "\n", "}", "\n\n", "// REMOVED: prompting for missing information.", "return", "mergedConfig", ",", "nil", "\n", "}" ]
21,543
all-21544
[ "PutUint32", "sets", "a", "32", "-", "bit", "unsigned", "value", "for", "the", "given", "field", "name", ".", "The", "field", "name", "must", "be", "a", "Uint32Field", "otherwise", "an", "error", "will", "be", "returned", ".", "If", "the", "type", "buffer", "no", "longer", "has", "enough", "space", "to", "write", "the", "value", "an", "xbinary", ".", "ErrOutOfRange", "error", "will", "be", "returned", ".", "Upon", "success", "the", "number", "of", "bytes", "written", "as", "well", "as", "a", "nil", "error", "will", "be", "returned", ".", "The", "type", "code", "will", "be", "written", "first", ".", "If", "the", "value", "is", "<", "math", ".", "MaxUint8", "only", "1", "byte", "will", "be", "written", ".", "If", "the", "value", "is", "<", "math", ".", "MaxUint16", "only", "2", "bytes", "will", "be", "written", ".", "Otherwise", "the", "entire", "32", "-", "bit", "value", "will", "be", "written", "." ]
[ "func", "(", "b", "*", "TupleBuilder", ")", "PutUint32", "(", "field", "string", ",", "value", "uint32", ")", "(", "wrote", "uint64", ",", "err", "error", ")", "{", "// field type should be", "if", "err", "=", "b", ".", "typeCheck", "(", "field", ",", "Uint32Field", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "if", "value", "<", "math", ".", "MaxUint8", "{", "// minimum bytes is 2 (type code + value)", "if", "b", ".", "available", "(", ")", "<", "2", "{", "return", "0", ",", "xbinary", ".", "ErrOutOfRange", "\n", "}", "\n\n", "// write type code", "b", ".", "buffer", "[", "b", ".", "pos", "]", "=", "<mask>", "(", "UnsignedInt8Code", ".", "OpCode", ")", "\n\n", "// write value", "b", ".", "buffer", "[", "b", ".", "pos", "+", "1", "]", "=", "byte", "(", "value", ")", "\n\n", "// set field offset", "b", ".", "offsets", "[", "field", "]", "=", "b", ".", "pos", "\n\n", "// incr pos", "b", ".", "pos", "+=", "2", "\n\n", "return", "2", ",", "nil", "\n", "}", "else", "if", "value", "<", "math", ".", "MaxUint16", "{", "// write value", "// length check performed by xbinary", "wrote", ",", "err", "=", "xbinary", ".", "LittleEndian", ".", "PutUint16", "(", "b", ".", "buffer", ",", "b", ".", "pos", "+", "1", ",", "uint16", "(", "value", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "// write type code", "b", ".", "buffer", "[", "b", ".", "pos", "]", "=", "byte", "(", "UnsignedInt16Code", ".", "OpCode", ")", "\n\n", "// set field offset", "b", ".", "offsets", "[", "field", "]", "=", "b", ".", "pos", "\n\n", "// incr pos", "b", ".", "pos", "+=", "3", "\n\n", "// wrote 3 bytes", "return", "3", ",", "nil", "\n", "}", "\n\n", "// write value", "// length check performed by xbinary", "wrote", ",", "err", "=", "xbinary", ".", "LittleEndian", ".", "PutUint32", "(", "b", ".", "buffer", ",", "b", ".", "pos", "+", "1", ",", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "// write type code", "b", ".", "buffer", "[", "b", ".", "pos", "]", "=", "byte", "(", "UnsignedInt32Code", ".", "OpCode", ")", "\n\n", "// set field offset", "b", ".", "offsets", "[", "field", "]", "=", "b", ".", "pos", "\n\n", "// incr pos", "b", ".", "pos", "+=", "5", "\n\n", "// wrote 5 bytes", "return", "5", ",", "nil", "\n", "}" ]
21,544
all-21545
[ "putToTop", "puts", "Sentinel", "address", "to", "the", "top", "of", "address", "list", "-", "this", "means", "that", "all", "next", "requests", "will", "use", "Sentinel", "on", "this", "address", "first", ".", "From", "Sentinel", "guidelines", ":", "The", "first", "Sentinel", "replying", "to", "the", "client", "request", "should", "be", "put", "at", "the", "start", "of", "the", "list", "so", "that", "at", "the", "next", "reconnection", "we", "ll", "try", "first", "the", "Sentinel", "that", "was", "reachable", "in", "the", "previous", "connection", "attempt", "minimizing", "latency", ".", "Lock", "must", "be", "held", "by", "caller", "." ]
[ "func", "(", "s", "*", "Sentinel", ")", "putToTop", "(", "addr", "string", ")", "{", "addrs", ":=", "s", ".", "Addrs", "\n", "if", "addrs", "[", "0", "]", "==", "addr", "{", "// Already on top.", "return", "\n", "}", "\n", "newAddrs", ":=", "[", "]", "string", "{", "addr", "}", "\n", "for", "_", ",", "a", ":=", "<mask>", "addrs", "{", "if", "a", "==", "addr", "{", "continue", "\n", "}", "\n", "newAddrs", "=", "append", "(", "newAddrs", ",", "a", ")", "\n", "}", "\n", "s", ".", "Addrs", "=", "newAddrs", "\n", "}" ]
21,545
all-21546
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SnapshotCommandLogReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree1", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
21,546
all-21547
[ "LoadPlugins", "will", "add", "listeners", "for", "any", "plugins", "that", "support", "events" ]
[ "func", "LoadPlugins", "(", ")", "error", "{", "var", "err", "error", "\n", "oncer", ".", "Do", "(", "\"", "\"", ",", "func", "(", ")", "{", "// don't send plugins events during testing", "if", "envy", ".", "Get", "(", "\"", "\"", ",", "\"", "\"", ")", "==", "\"", "\"", "{", "return", "\n", "}", "\n", "plugs", ",", "err", ":=", "plugins", ".", "Available", "(", ")", "\n", "if", "err", "!=", "nil", "{", "err", "=", "err", "\n", "return", "\n", "}", "\n", "for", "_", ",", "cmds", ":=", "range", "plugs", "{", "for", "_", ",", "c", ":=", "range", "cmds", "{", "if", "c", ".", "BuffaloCommand", "!=", "\"", "\"", "{", "continue", "\n", "}", "\n", "err", ":=", "func", "(", "c", "plugins", ".", "Command", ")", "error", "{", "return", "safe", ".", "RunE", "(", "func", "(", ")", "error", "{", "n", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "Binary", ",", "c", ".", "Name", ")", "\n", "fn", ":=", "func", "(", "e", "events", ".", "Event", ")", "{", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "e", ")", "\n", "if", "err", "!=", "nil", "{", "fmt", ".", "Println", "(", "\"", "\"", ",", "e", ",", "err", ")", "\n", "return", "\n", "}", "\n", "cmd", ":=", "exec", ".", "Command", "(", "c", ".", "Binary", ",", "c", ".", "UseCommand", ",", "string", "(", "b", ")", ")", "\n", "cmd", ".", "Stderr", "=", "os", ".", "Stderr", "\n", "cmd", ".", "Stdout", "=", "<mask>", ".", "Stdout", "\n", "cmd", ".", "Stdin", "=", "os", ".", "Stdin", "\n", "if", "err", ":=", "cmd", ".", "Run", "(", ")", ";", "err", "!=", "nil", "{", "fmt", ".", "Println", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "cmd", ".", "Args", ",", "\"", "\"", ")", ",", "err", ")", "\n", "}", "\n", "}", "\n", "_", ",", "err", ":=", "events", ".", "NamedListen", "(", "n", ",", "events", ".", "Filter", "(", "c", ".", "ListenFor", ",", "fn", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}", "(", "c", ")", "\n", "if", "err", "!=", "nil", "{", "err", "=", "err", "\n", "return", "\n", "}", "\n", "}", "\n\n", "}", "\n", "}", ")", "\n", "return", "err", "\n", "}" ]
21,547
all-21548
[ "Add", "a", "random", "value", "generated", "by", "Generate", "()", "." ]
[ "func", "(", "c", "*", "chdHasher", ")", "Add", "(", "r", "uint64", ")", "{", "c", ".", "r", "=", "<mask>", "(", "c", ".", "r", ",", "r", ")", "\n", "}" ]
21,548
all-21549
[ "Invert", "returns", "a", "new", "FrameSet", "that", "represents", "all", "frames", "*", "not", "*", "within", "the", "current", "FrameSet", ".", "That", "is", "it", "will", "create", "a", "range", "that", "fills", "in", "the", "current", "one", "." ]
[ "func", "(", "s", "*", "FrameSet", ")", "Invert", "(", ")", "*", "FrameSet", "{", "ptr", ":=", "s", ".", "rangePtr", ".", "Inverted", "(", ")", "\n", "return", "&", "FrameSet", "{", "ptr", ".", "<mask>", "(", ")", ",", "ptr", "}", "\n", "}" ]
21,549
all-21550
[ "ServeHTTP", "serves", "a", "JSON", "mapping", "from", "pool", "key", "-", ">", "sorted", "records", "for", "the", "pool", "." ]
[ "func", "(", "h", "*", "History", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "<mask>", ")", "{", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "h", ".", "AllRecords", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "b", "=", "[", "]", "byte", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "_", ",", "err", "=", "w", ".", "Write", "(", "b", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "}", "\n", "}" ]
21,550
all-21551
[ "Filter", "creates", "a", "new", "filter", "with", "rules", "r", "for", "l", "backend", "." ]
[ "func", "<mask>", "(", "l", "LogBackend", ",", "r", "Ruler", ")", "LogBackend", "{", "return", "&", "filter", "{", "LogBackend", ":", "l", ",", "r", ":", "r", ",", "}", "\n", "}" ]
21,551
all-21552
[ "GetInnkeeperClient", "--", "get", "an", "innkeeper", "client", "and", "cache", "it", "in", "the", "object" ]
[ "func", "(", "s", "*", "SkuM1Small", ")", "GetInnkeeperClient", "(", ")", "(", "innkeeperclient", ".", "InnkeeperClient", ",", "error", ")", "{", "var", "err", "error", "\n", "if", "s", ".", "Client", "==", "nil", "{", "if", "clnt", ",", "err", ":=", "s", ".", "InitInnkeeperClient", "(", ")", ";", "err", "==", "nil", "{", "s", ".", "Client", "=", "clnt", "\n", "}", "else", "{", "lo", ".", "G", ".", "Error", "(", "\"", "\"", ",", "err", ".", "<mask>", "(", ")", ")", "\n", "}", "\n", "}", "\n", "return", "s", ".", "Client", ",", "err", "\n", "}" ]
21,552
all-21553
[ "Run", "-", "this", "begins", "the", "running", "of", "an", "agent", "s", "async", "process" ]
[ "func", "(", "s", "*", "Agent", ")", "Run", "(", "process", "func", "(", "*", "Agent", ")", "error", ")", "{", "s", ".", "task", ".", "Update", "(", "func", "(", "t", "*", "Task", ")", "interface", "{", "}", "{", "t", ".", "taskManager", "=", "s", ".", "taskManager", "\n", "t", ".", "Status", "=", "AgentTaskStatusRunning", "\n", "return", "t", "\n", "}", ")", "\n", "s", ".", "statusEmitter", "<-", "AgentTaskStatusRunning", "\n", "go", "s", ".", "startTaskPoller", "(", ")", "\n", "go", "s", ".", "listenForPoll", "(", ")", "\n\n", "go", "func", "(", "<mask>", "Agent", ")", "{", "s", ":=", "&", "agent", "\n", "s", ".", "processExitHanderlDecorate", "(", "process", ")", "\n", "<-", "s", ".", "processComplete", "\n", "}", "(", "*", "s", ")", "\n", "}" ]
21,553
all-21554
[ "/", "*", "Compaction", "period", "1", "-", "hour", ":", "1", ".", "compute", "compaction", "period", "which", "is", "1", "-", "hour", "2", ".", "record", "revisions", "for", "every", "1", "/", "10", "of", "1", "-", "hour", "(", "6", "-", "minute", ")", "3", ".", "keep", "recording", "revisions", "with", "no", "compaction", "for", "first", "1", "-", "hour", "4", ".", "do", "compact", "with", "revs", "[", "0", "]", "-", "success?", "contiue", "on", "for", "-", "loop", "and", "move", "sliding", "window", ";", "revs", "=", "revs", "[", "1", ":", "]", "-", "failure?", "update", "revs", "and", "retry", "after", "1", "/", "10", "of", "1", "-", "hour", "(", "6", "-", "minute", ")" ]
[ "func", "(", "pc", "*", "Periodic", ")", "Run", "(", ")", "{", "compactInterval", ":=", "pc", ".", "getCompactInterval", "(", ")", "\n", "retryInterval", ":=", "pc", ".", "getRetryInterval", "(", ")", "\n", "retentions", ":=", "pc", ".", "getRetentions", "(", ")", "\n\n", "go", "func", "(", ")", "{", "lastSuccess", ":=", "pc", ".", "clock", ".", "Now", "(", ")", "\n", "baseInterval", ":=", "pc", ".", "period", "\n", "for", "{", "pc", ".", "revs", "=", "append", "(", "pc", ".", "revs", ",", "pc", ".", "rg", ".", "Rev", "(", ")", ")", "\n", "if", "len", "(", "pc", ".", "revs", ")", ">", "retentions", "{", "pc", ".", "revs", "=", "pc", ".", "revs", "[", "1", ":", "]", "// pc.revs[0] is always the rev at pc.period ago", "\n", "}", "\n\n", "select", "{", "case", "<-", "pc", ".", "ctx", ".", "Done", "(", ")", ":", "return", "\n", "case", "<-", "pc", ".", "clock", ".", "After", "(", "retryInterval", ")", ":", "pc", ".", "mu", ".", "Lock", "(", ")", "\n", "p", ":=", "pc", ".", "paused", "\n", "pc", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "p", "{", "continue", "\n", "}", "\n", "}", "\n\n", "if", "pc", ".", "clock", ".", "Now", "(", ")", ".", "Sub", "(", "lastSuccess", ")", "<", "baseInterval", "{", "continue", "\n", "}", "\n\n", "// wait up to initial given period", "if", "baseInterval", "==", "<mask>", ".", "period", "{", "baseInterval", "=", "compactInterval", "\n", "}", "\n", "rev", ":=", "pc", ".", "revs", "[", "0", "]", "\n\n", "if", "pc", ".", "lg", "!=", "nil", "{", "pc", ".", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "Int64", "(", "\"", "\"", ",", "rev", ")", ",", "zap", ".", "Duration", "(", "\"", "\"", ",", "pc", ".", "period", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Noticef", "(", "\"", "\"", ",", "rev", ",", "pc", ".", "period", ")", "\n", "}", "\n", "_", ",", "err", ":=", "pc", ".", "c", ".", "Compact", "(", "pc", ".", "ctx", ",", "&", "pb", ".", "CompactionRequest", "{", "Revision", ":", "rev", "}", ")", "\n", "if", "err", "==", "nil", "||", "err", "==", "mvcc", ".", "ErrCompacted", "{", "if", "pc", ".", "lg", "!=", "nil", "{", "pc", ".", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "Int64", "(", "\"", "\"", ",", "rev", ")", ",", "zap", ".", "Duration", "(", "\"", "\"", ",", "pc", ".", "period", ")", ",", "zap", ".", "Duration", "(", "\"", "\"", ",", "time", ".", "Since", "(", "lastSuccess", ")", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Noticef", "(", "\"", "\"", ",", "rev", ")", "\n", "}", "\n", "lastSuccess", "=", "pc", ".", "clock", ".", "Now", "(", ")", "\n", "}", "else", "{", "if", "pc", ".", "lg", "!=", "nil", "{", "pc", ".", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "Int64", "(", "\"", "\"", ",", "rev", ")", ",", "zap", ".", "Duration", "(", "\"", "\"", ",", "pc", ".", "period", ")", ",", "zap", ".", "Duration", "(", "\"", "\"", ",", "retryInterval", ")", ",", "zap", ".", "Error", "(", "err", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Noticef", "(", "\"", "\"", ",", "rev", ",", "err", ")", "\n", "plog", ".", "Noticef", "(", "\"", "\"", ",", "retryInterval", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n", "}" ]
21,554
all-21555
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "GestureType", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "GestureType", "(", "in", ".", "String", "(", ")", ")", "{", "<mask>", "GestureDefault", ":", "*", "t", "=", "GestureDefault", "\n", "case", "GestureTouch", ":", "*", "t", "=", "GestureTouch", "\n", "case", "GestureMouse", ":", "*", "t", "=", "GestureMouse", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
21,555
all-21556
[ "New", "generator", "for", "adding", "travis", "or", "gitlab" ]
[ "func", "New", "(", "opts", "*", "Options", ")", "(", "*", "genny", ".", "Generator", ",", "error", ")", "{", "g", ":=", "genny", ".", "New", "(", ")", "\n\n", "if", "err", ":=", "opts", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "g", ",", "err", "\n", "}", "\n\n", "g", ".", "Transformer", "(", "genny", ".", "Replace", "(", "\"", "\"", ",", "\"", "\"", ")", ")", "\n", "g", ".", "Transformer", "(", "genny", ".", "Dot", "(", ")", ")", "\n\n", "box", ":=", "packr", ".", "New", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "var", "fname", "string", "\n", "switch", "opts", ".", "Provider", "{", "case", "\"", "\"", ",", "\"", "\"", ":", "fname", "=", "\"", "\"", "\n", "case", "\"", "\"", ",", "\"", "\"", ":", "if", "opts", ".", "App", ".", "WithPop", "{", "fname", "=", "\"", "\"", "\n", "}", "else", "{", "fname", "=", "\"", "\"", "\n", "}", "\n", "default", ":", "return", "g", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "opts", ".", "Provider", ")", "\n", "}", "\n\n", "f", ",", "err", ":=", "box", ".", "FindString", "(", "fname", ")", "\n", "if", "err", "!=", "nil", "{", "return", "g", ",", "err", "\n", "}", "\n\n", "g", ".", "File", "(", "genny", ".", "NewFileS", "(", "fname", ",", "f", ")", ")", "\n\n", "data", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "opts", ",", "}", "\n\n", "if", "opts", ".", "DBType", "==", "\"", "\"", "{", "data", "[", "\"", "\"", "]", "=", "\"", "\"", "+", "opts", ".", "App", ".", "Name", ".", "File", "(", ")", ".", "String", "(", ")", "+", "\"", "\"", "\n", "}", "else", "if", "opts", ".", "DBType", "==", "\"", "\"", "{", "data", "[", "\"", "\"", "]", "=", "\"", "\"", "+", "opts", ".", "App", ".", "Name", ".", "File", "(", ")", ".", "String", "(", ")", "+", "\"", "\"", "\n", "}", "else", "{", "data", "[", "\"", "\"", "]", "=", "\"", "\"", "\n", "}", "\n\n", "helpers", ":=", "<mask>", ".", "FuncMap", "{", "}", "\n\n", "t", ":=", "gogen", ".", "TemplateTransformer", "(", "data", ",", "helpers", ")", "\n", "g", ".", "Transformer", "(", "t", ")", "\n\n", "return", "g", ",", "nil", "\n", "}" ]
21,556
all-21557
[ "Duration", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockBackoff", ")", "Duration", "(", ")", "time", ".", "Duration", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "time", ".", "Duration", ")", "\n", "return", "ret0", "\n", "}" ]
21,557
all-21558
[ "GetObjectByHash", "finds", "object", "in", "a", "database", "by", "hash", "then", "returns", "an", "object", "on", "raw", "JSON", "format", "." ]
[ "func", "(", "h", "*", "Handler", ")", "GetObjectByHash", "(", "tkn", ",", "objectType", ",", "hash", "string", ")", "(", "json", ".", "RawMessage", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "objectType", ",", "\"", "\"", ",", "hash", ")", "\n\n", "if", "!", "h", ".", "token", ".", "Check", "(", "tkn", ")", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrAccessDenied", "\n", "}", "\n\n", "table", ",", "ok", ":=", "objectWithHashTypes", "[", "objectType", "]", "\n", "if", "!", "ok", "{", "logger", ".", "Warn", "(", "ErrBadObjectType", ".", "Error", "(", ")", ")", "\n", "return", "nil", ",", "ErrBadObjectType", "\n", "}", "\n\n", "obj", ",", "err", ":=", "h", ".", "<mask>", ".", "FindOneFrom", "(", "table", ",", "\"", "\"", ",", "hash", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "nil", ",", "ErrObjectNotFound", "\n", "}", "\n\n", "raw", ",", "err", ":=", "json", ".", "Marshal", "(", "obj", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "nil", ",", "ErrInternal", "\n", "}", "\n\n", "return", "raw", ",", "nil", "\n", "}" ]
21,558
all-21559
[ "RuntimeLiblxcVersionAtLeast", "checks", "if", "the", "system", "s", "liblxc", "matches", "the", "provided", "version", "requirement" ]
[ "func", "RuntimeLiblxcVersionAtLeast", "(", "major", "int", ",", "minor", "int", ",", "micro", "int", ")", "bool", "{", "version", ":=", "golxc", ".", "Version", "(", ")", "\n", "version", "=", "strings", ".", "Replace", "(", "version", ",", "\"", "\"", ",", "\"", "\"", ",", "1", ")", "\n", "parts", ":=", "strings", ".", "Split", "(", "version", ",", "\"", "\"", ")", "\n", "partsLen", ":=", "len", "(", "parts", ")", "\n", "if", "partsLen", "==", "0", "{", "return", "false", "\n", "}", "\n\n", "develParts", ":=", "strings", ".", "Split", "(", "parts", "[", "partsLen", "-", "1", "]", ",", "\"", "\"", ")", "\n", "if", "len", "(", "develParts", ")", "==", "2", "&&", "develParts", "[", "1", "]", "==", "\"", "\"", "{", "return", "true", "\n", "}", "\n\n", "maj", ":=", "-", "1", "\n", "min", ":=", "-", "1", "\n", "mic", ":=", "-", "1", "\n\n", "for", "i", ",", "v", ":=", "range", "parts", "{", "if", "i", ">", "2", "{", "break", "\n", "}", "\n\n", "num", ",", "err", ":=", "strconv", ".", "Atoi", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n\n", "switch", "i", "{", "case", "0", ":", "maj", "=", "num", "\n", "case", "1", ":", "min", "=", "num", "\n", "case", "2", ":", "mic", "=", "num", "\n", "}", "\n", "}", "\n\n", "/* Major version is greater. */", "if", "maj", ">", "major", "{", "return", "true", "\n", "}", "\n\n", "if", "maj", "<", "major", "{", "return", "<mask>", "\n", "}", "\n\n", "/* Minor number is greater.*/", "if", "min", ">", "minor", "{", "return", "true", "\n", "}", "\n\n", "if", "min", "<", "minor", "{", "return", "false", "\n", "}", "\n\n", "/* Patch number is greater. */", "if", "mic", ">", "micro", "{", "return", "true", "\n", "}", "\n\n", "if", "mic", "<", "micro", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
21,559
all-21560
[ "Command", "creates", "an", "os", "command", "to", "be", "run" ]
[ "func", "(", "s", "*", "ServiceManager", ")", "Command", "(", ")", "*", "exec", ".", "Cmd", "{", "cmd", ":=", "<mask>", ".", "Command", "(", "s", ".", "Cmd", ",", "s", ".", "Args", "...", ")", "\n", "env", ":=", "os", ".", "Environ", "(", ")", "\n", "env", "=", "append", "(", "env", ",", "s", ".", "Env", "...", ")", "\n", "cmd", ".", "Env", "=", "env", "\n\n", "return", "cmd", "\n", "}" ]
21,560
all-21561
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetCookieParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork15", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,561
all-21562
[ "Count", "returns", "the", "number", "of", "non", "-", "tombstone", "items", "in", "the", "relay", "." ]
[ "func", "(", "r", "*", "relayItems", ")", "Count", "(", ")", "int", "{", "r", ".", "RLock", "(", ")", "\n", "n", ":=", "len", "(", "r", ".", "<mask>", ")", "-", "int", "(", "r", ".", "tombs", ")", "\n", "r", ".", "RUnlock", "(", ")", "\n", "return", "n", "\n", "}" ]
21,562
all-21563
[ "AppendOp", "is", "an", "utility", "method", "to", "create", "AND", "append", "a", "new", "op", "code", "to", "the", "current", "list", "of", "op", "codes" ]
[ "func", "(", "b", "*", "ByteCode", ")", "AppendOp", "(", "o", "OpType", ",", "args", "...", "<mask>", "{", "}", ")", "Op", "{", "x", ":=", "NewOp", "(", "o", ",", "args", "...", ")", "\n", "b", ".", "Append", "(", "x", ")", "\n", "return", "x", "\n", "}" ]
21,563
all-21564
[ "Run", "the", "http", "server", ".", "Listening", "on", "os", ".", "GetEnv", "(", "PORT", ")", "or", "4000", "by", "default", "." ]
[ "func", "(", "m", "*", "Macaron", ")", "Run", "(", "args", "...", "interface", "{", "}", ")", "{", "host", ",", "port", ":=", "GetDefaultListenInfo", "(", ")", "\n", "if", "len", "(", "args", ")", "==", "1", "{", "switch", "arg", ":=", "args", "[", "0", "]", ".", "(", "type", ")", "{", "case", "string", ":", "host", "=", "arg", "\n", "case", "int", ":", "port", "=", "arg", "\n", "}", "\n", "}", "else", "if", "len", "(", "args", ")", ">=", "2", "{", "if", "arg", ",", "ok", ":=", "args", "[", "0", "]", ".", "(", "string", ")", ";", "ok", "{", "host", "=", "arg", "\n", "}", "\n", "if", "arg", ",", "ok", ":=", "args", "[", "1", "]", ".", "(", "int", ")", ";", "ok", "{", "port", "=", "arg", "\n", "}", "\n", "}", "\n\n", "addr", ":=", "host", "+", "\"", "\"", "+", "com", ".", "ToStr", "(", "port", ")", "\n", "logger", ":=", "m", ".", "GetVal", "(", "reflect", ".", "TypeOf", "(", "m", ".", "logger", ")", ")", ".", "Interface", "(", ")", ".", "(", "*", "<mask>", ".", "Logger", ")", "\n", "logger", ".", "Printf", "(", "\"", "\\n", "\"", ",", "addr", ",", "safeEnv", "(", ")", ")", "\n", "logger", ".", "Fatalln", "(", "http", ".", "ListenAndServe", "(", "addr", ",", "m", ")", ")", "\n", "}" ]
21,564
all-21565
[ "Calculates", "the", "per", "-", "element", "sum", "of", "two", "arrays", "with", "a", "mask", ".", "dst", "=", "src1", "+", "src2" ]
[ "func", "AddWithMask", "(", "src1", ",", "src2", ",", "dst", ",", "<mask>", "*", "IplImage", ")", "{", "C", ".", "cvAdd", "(", "unsafe", ".", "Pointer", "(", "src1", ")", ",", "unsafe", ".", "Pointer", "(", "src2", ")", ",", "unsafe", ".", "Pointer", "(", "dst", ")", ",", "unsafe", ".", "Pointer", "(", "mask", ")", ",", ")", "\n", "}" ]
21,565
all-21566
[ "toYAML", "converts", "the", "given", "structure", "into", "a", "deeply", "nested", "YAML", "string", "." ]
[ "func", "toYAML", "(", "m", "<mask>", "[", "string", "]", "interface", "{", "}", ")", "(", "string", ",", "error", ")", "{", "result", ",", "err", ":=", "yaml", ".", "Marshal", "(", "m", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "string", "(", "bytes", ".", "TrimSpace", "(", "result", ")", ")", ",", "nil", "\n", "}" ]
21,566
all-21567
[ "SetVisibleChildName", "is", "a", "wrapper", "around", "gtk_stack_set_visible_child_name", "()", "." ]
[ "func", "(", "v", "*", "Stack", ")", "SetVisibleChildName", "(", "<mask>", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_stack_set_visible_child_name", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
21,567
all-21568
[ "HasAliasName", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetMetadata", ")", "HasAliasName", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "AliasName", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
21,568
all-21569
[ "/", "*", "SetData", "assigns", "user", "data", "to", "the", "matrix", "header", "." ]
[ "func", "(", "mat", "*", "Mat", ")", "SetData", "(", "data", "unsafe", ".", "Pointer", ",", "step", "int", ")", "{", "C", ".", "cvSetData", "(", "unsafe", ".", "Pointer", "(", "mat", ")", ",", "<mask>", ",", "C", ".", "int", "(", "step", ")", ")", "\n", "}" ]
21,569
all-21570
[ "Chmod", "indicates", "an", "expected", "call", "of", "Chmod" ]
[ "func", "(", "mr", "*", "MockFileMockRecorder", ")", "Chmod", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockFile", ")", "(", "nil", ")", ".", "Chmod", ")", ",", "arg0", ")", "\n", "}" ]
21,570
all-21571
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "Profile", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoProfiler17", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
21,571
all-21572
[ "GetHomogeneous", "is", "a", "wrapper", "around", "gtk_tool_item_get_homogeneous", "()", "." ]
[ "func", "(", "v", "*", "ToolItem", ")", "GetHomogeneous", "(", ")", "bool", "{", "c", ":=", "C", ".", "gtk_tool_item_get_homogeneous", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
21,572
all-21573
[ "KeyHandler", "implements", "the", "interface", ".", "This", "is", "called", "from", "queue", "context", "so", "be", "careful", "to", "not", "use", "blocking", "calls", "." ]
[ "func", "(", "e", "*", "Edit", ")", "KeyHandler", "(", "ev", "termbox", ".", "Event", ")", "bool", "{", "<mask>", "inString", "int", "\n\n", "switch", "ev", ".", "Key", "{", "case", "termbox", ".", "KeyCtrlA", ",", "termbox", ".", "KeyHome", ":", "e", ".", "cx", "=", "e", ".", "trueX", "\n", "e", ".", "at", "=", "0", "\n", "setCursor", "(", "e", ".", "cx", ",", "e", ".", "cy", ")", "\n", "e", ".", "Render", "(", ")", "\n", "return", "true", "\n", "case", "termbox", ".", "KeyCtrlE", ",", "termbox", ".", "KeyEnd", ":", "if", "len", "(", "e", ".", "display", ")", "<", "e", ".", "trueW", "-", "1", "{", "// no need to call display", "e", ".", "cx", "=", "e", ".", "trueX", "+", "len", "(", "e", ".", "display", ")", "-", "e", ".", "at", "\n", "setCursor", "(", "e", ".", "cx", ",", "e", ".", "cy", ")", "\n", "return", "true", "\n", "}", "\n", "e", ".", "cx", "=", "e", ".", "trueX", "+", "e", ".", "trueW", "-", "1", "\n", "e", ".", "at", "=", "len", "(", "e", ".", "display", ")", "-", "e", ".", "trueW", "+", "1", "\n", "setCursor", "(", "e", ".", "cx", ",", "e", ".", "cy", ")", "\n", "e", ".", "Render", "(", ")", "\n", "return", "true", "\n", "case", "termbox", ".", "KeyCtrlU", ":", "e", ".", "cx", "=", "e", ".", "trueX", "\n", "e", ".", "at", "=", "0", "\n", "e", ".", "display", "=", "[", "]", "rune", "(", "\"", "\"", ")", "\n", "setCursor", "(", "e", ".", "cx", ",", "e", ".", "cy", ")", "\n", "e", ".", "Render", "(", ")", "\n", "return", "true", "\n", "case", "termbox", ".", "KeyArrowRight", ":", "// check to see if we have content on the right hand side", "if", "e", ".", "cx", "-", "e", ".", "trueX", "==", "len", "(", "e", ".", "display", "[", "e", ".", "at", ":", "]", ")", "{", "return", "true", "\n", "}", "\n", "e", ".", "cx", "++", "\n", "if", "e", ".", "cx", ">", "e", ".", "trueW", "+", "e", ".", "trueX", "-", "1", "{", "e", ".", "cx", "=", "e", ".", "trueW", "+", "e", ".", "trueX", "-", "1", "\n\n", "// check for end of string before moving at", "if", "len", "(", "e", ".", "display", "[", "e", ".", "at", ":", "]", ")", "==", "0", "{", "return", "true", "\n", "}", "\n", "e", ".", "at", "++", "\n", "e", ".", "Render", "(", ")", "\n", "return", "true", "\n", "}", "\n", "setCursor", "(", "e", ".", "cx", ",", "e", ".", "cy", ")", "\n", "return", "true", "\n", "case", "termbox", ".", "KeyArrowLeft", ":", "e", ".", "cx", "--", "\n", "if", "e", ".", "cx", "<", "e", ".", "trueX", "{", "e", ".", "cx", "=", "e", ".", "trueX", "\n", "e", ".", "at", "--", "\n", "if", "e", ".", "at", "<", "0", "{", "e", ".", "at", "=", "0", "\n", "}", "\n", "e", ".", "Render", "(", ")", "\n", "}", "\n", "setCursor", "(", "e", ".", "cx", ",", "e", ".", "cy", ")", "\n", "return", "true", "\n", "case", "termbox", ".", "KeyDelete", ":", "inString", "=", "e", ".", "cx", "-", "e", ".", "trueX", "+", "e", ".", "at", "\n", "if", "len", "(", "e", ".", "display", ")", "==", "inString", "{", "return", "true", "\n", "}", "\n", "// remove from slice", "e", ".", "display", "=", "append", "(", "e", ".", "display", "[", ":", "inString", "]", ",", "e", ".", "display", "[", "inString", "+", "1", ":", "]", "...", ")", "\n", "e", ".", "Render", "(", ")", "\n", "return", "true", "\n", "case", "termbox", ".", "KeyBackspace", ",", "termbox", ".", "KeyBackspace2", ":", "inString", "=", "e", ".", "cx", "-", "e", ".", "trueX", "+", "e", ".", "at", "\n", "if", "inString", "<=", "0", "{", "return", "true", "\n", "}", "\n", "e", ".", "display", "=", "append", "(", "e", ".", "display", "[", ":", "inString", "-", "1", "]", ",", "e", ".", "display", "[", "inString", ":", "]", "...", ")", "\n\n", "// cursor left magic", "if", "e", ".", "cx", "==", "e", ".", "trueX", "+", "1", "{", "if", "e", ".", "at", ">", "e", ".", "trueW", "-", "1", "{", "e", ".", "cx", "=", "e", ".", "trueW", "-", "1", "\n", "}", "else", "{", "e", ".", "cx", "=", "e", ".", "at", "+", "e", ".", "trueX", "\n", "}", "\n", "if", "e", ".", "at", ">=", "e", ".", "cx", "{", "e", ".", "at", "-=", "e", ".", "cx", "\n", "}", "\n", "}", "else", "{", "e", ".", "cx", "--", "\n", "}", "\n", "setCursor", "(", "e", ".", "cx", ",", "e", ".", "cy", ")", "\n", "e", ".", "Render", "(", ")", "\n", "return", "true", "\n", "case", "termbox", ".", "KeySpace", ":", "// use space", "ev", ".", "Ch", "=", "' '", "\n", "case", "termbox", ".", "KeyEnter", ":", "*", "e", ".", "target", "=", "string", "(", "e", ".", "display", ")", "\n", "// return false and let the application decide if it wants", "// to consume the action", "return", "false", "\n", "}", "\n\n", "// normal runes are displayed and stored", "if", "ev", ".", "Ch", "!=", "0", "&&", "ev", ".", "Mod", "!=", "0", "&&", "ev", ".", "Key", "==", "0", "{", "// forward special", "return", "false", "\n", "}", "else", "if", "ev", ".", "Ch", "==", "0", "{", "return", "false", "\n", "}", "\n\n", "inString", "=", "e", ".", "cx", "-", "e", ".", "trueX", "+", "e", ".", "at", "\n", "e", ".", "display", "=", "insert", "(", "e", ".", "display", ",", "inString", ",", "ev", ".", "Ch", ")", "\n", "if", "e", ".", "cx", "<", "e", ".", "trueW", "+", "e", ".", "trueX", "-", "1", "{", "e", ".", "cx", "++", "\n", "setCursor", "(", "e", ".", "cx", ",", "e", ".", "cy", ")", "\n", "}", "else", "{", "e", ".", "at", "++", "\n", "}", "\n\n", "e", ".", "Render", "(", ")", "\n", "return", "true", "\n", "}" ]
21,573
all-21574
[ "ArmForSwitch", "returns", "which", "field", "name", "should", "be", "used", "for", "storing", "the", "value", "for", "an", "instance", "of", "PeerAddressIp" ]
[ "func", "(", "u", "PeerAddressIp", ")", "ArmForSwitch", "(", "sw", "int32", ")", "(", "string", ",", "bool", ")", "{", "switch", "IpAddrType", "(", "sw", ")", "{", "<mask>", "IpAddrTypeIPv4", ":", "return", "\"", "\"", ",", "true", "\n", "case", "IpAddrTypeIPv6", ":", "return", "\"", "\"", ",", "true", "\n", "}", "\n", "return", "\"", "\"", ",", "false", "\n", "}" ]
21,574
all-21575
[ "AddRegistry", "switches", "the", "registry", "that", "an", "image", "is", "targeting", "unless", "registry", "is", "blank" ]
[ "func", "AddRegistry", "(", "registry", "string", ",", "imageName", "string", ")", "string", "{", "if", "registry", "==", "\"", "\"", "{", "return", "imageName", "\n", "}", "\n", "<mask>", ":=", "strings", ".", "Split", "(", "imageName", ",", "\"", "\"", ")", "\n", "if", "len", "(", "parts", ")", "==", "3", "{", "parts", "=", "parts", "[", "1", ":", "]", "\n", "}", "\n", "return", "path", ".", "Join", "(", "registry", ",", "parts", "[", "0", "]", ",", "parts", "[", "1", "]", ")", "\n", "}" ]
21,575
all-21576
[ "GetRepositoryTags", "list", "all", "tags", "available", "in", "the", "repository", ".", "The", "tag", "provided", "inside", "the", "ImageReference", "will", "be", "ignored", "." ]
[ "func", "GetRepositoryTags", "(", "ctx", "context", ".", "<mask>", ",", "sys", "*", "types", ".", "SystemContext", ",", "ref", "types", ".", "ImageReference", ")", "(", "[", "]", "string", ",", "error", ")", "{", "dr", ",", "ok", ":=", "ref", ".", "(", "dockerReference", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "path", ":=", "fmt", ".", "Sprintf", "(", "tagsPath", ",", "reference", ".", "Path", "(", "dr", ".", "ref", ")", ")", "\n", "client", ",", "err", ":=", "newDockerClientFromRef", "(", "sys", ",", "dr", ",", "false", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "tags", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n\n", "for", "{", "res", ",", "err", ":=", "client", ".", "makeRequest", "(", "ctx", ",", "\"", "\"", ",", "path", ",", "nil", ",", "nil", ",", "v2Auth", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "res", ".", "Body", ".", "Close", "(", ")", "\n", "if", "res", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "// print url also", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "res", ".", "StatusCode", ",", "http", ".", "StatusText", "(", "res", ".", "StatusCode", ")", ")", "\n", "}", "\n\n", "var", "tagsHolder", "struct", "{", "Tags", "[", "]", "string", "\n", "}", "\n", "if", "err", "=", "json", ".", "NewDecoder", "(", "res", ".", "Body", ")", ".", "Decode", "(", "&", "tagsHolder", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "tags", "=", "append", "(", "tags", ",", "tagsHolder", ".", "Tags", "...", ")", "\n\n", "link", ":=", "res", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "link", "==", "\"", "\"", "{", "break", "\n", "}", "\n\n", "linkURLStr", ":=", "strings", ".", "Trim", "(", "strings", ".", "Split", "(", "link", ",", "\"", "\"", ")", "[", "0", "]", ",", "\"", "\"", ")", "\n", "linkURL", ",", "err", ":=", "url", ".", "Parse", "(", "linkURLStr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "tags", ",", "err", "\n", "}", "\n\n", "// can be relative or absolute, but we only want the path (and I", "// guess we're in trouble if it forwards to a new place...)", "path", "=", "linkURL", ".", "Path", "\n", "if", "linkURL", ".", "RawQuery", "!=", "\"", "\"", "{", "path", "+=", "\"", "\"", "\n", "path", "+=", "linkURL", ".", "RawQuery", "\n", "}", "\n", "}", "\n", "return", "tags", ",", "nil", "\n", "}" ]
21,576
all-21577
[ "See", "bcd", ".", "TracerSig", ".", "SetSigset", "()", "." ]
[ "func", "(", "t", "*", "BTTracer", ")", "SetSigset", "(", "sigs", "...", "os", ".", "Signal", ")", "{", "t", ".", "ss", "=", "append", "(", "[", "]", "<mask>", ".", "Signal", "(", "nil", ")", ",", "sigs", "...", ")", "\n", "}" ]
21,577
all-21578
[ "reduceDelta", "lowers", "the", "buffered", "time", "delta", "dropping", "any", "samples", "that", "are", "out", "of", "the", "new", "delta", "range", "." ]
[ "func", "(", "r", "*", "sampleRing", ")", "reduceDelta", "(", "delta", "int64", ")", "bool", "{", "if", "delta", ">", "r", ".", "delta", "{", "return", "false", "\n", "}", "\n", "r", ".", "delta", "=", "delta", "\n\n", "if", "r", ".", "l", "==", "0", "{", "return", "<mask>", "\n", "}", "\n\n", "// Free head of the buffer of samples that just fell out of the range.", "l", ":=", "len", "(", "r", ".", "buf", ")", "\n", "tmin", ":=", "r", ".", "buf", "[", "r", ".", "i", "]", ".", "t", "-", "delta", "\n", "for", "r", ".", "buf", "[", "r", ".", "f", "]", ".", "t", "<", "tmin", "{", "r", ".", "f", "++", "\n", "if", "r", ".", "f", ">=", "l", "{", "r", ".", "f", "-=", "l", "\n", "}", "\n", "r", ".", "l", "--", "\n", "}", "\n", "return", "true", "\n", "}" ]
21,578
all-21579
[ "Delete", "removes", "a", "key", "from", "the", "bucket", ".", "If", "the", "key", "does", "not", "exist", "then", "nothing", "is", "done", "and", "a", "nil", "error", "is", "returned", ".", "Returns", "an", "error", "if", "the", "bucket", "was", "created", "from", "a", "read", "-", "only", "transaction", "." ]
[ "func", "(", "b", "Bucket", ")", "Delete", "(", "k", "[", "]", "[", "]", "<mask>", ")", "error", "{", "return", "b", ".", "OpenBucket", "(", "k", "[", ":", "len", "(", "k", ")", "-", "1", "]", ",", "func", "(", "b", "Bucket", ")", "error", "{", "return", "errorsp", ".", "WithStacks", "(", "b", ".", "Bucket", ".", "Delete", "(", "k", "[", "len", "(", "k", ")", "-", "1", "]", ")", ")", "\n", "}", ")", "\n", "}" ]
21,579
all-21580
[ "Populates", "the", "node", "table", "." ]
[ "func", "(", "s", "*", "Server", ")", "Bootstrap", "(", ")", "(", "ts", "TraversalStats", ",", "err", "error", ")", "{", "initialAddrs", ",", "err", ":=", "s", ".", "traversalStartingNodes", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "var", "outstanding", "sync", ".", "WaitGroup", "\n", "triedAddrs", ":=", "newBloomFilterForTraversal", "(", ")", "\n", "var", "onAddr", "func", "(", "addr", "Addr", ")", "\n", "onAddr", "=", "func", "(", "addr", "Addr", ")", "{", "if", "triedAddrs", ".", "Test", "(", "[", "]", "byte", "(", "addr", ".", "String", "(", ")", ")", ")", "{", "return", "\n", "}", "\n", "ts", ".", "NumAddrsTried", "++", "\n", "outstanding", ".", "Add", "(", "1", ")", "\n", "triedAddrs", ".", "AddString", "(", "addr", ".", "String", "(", ")", ")", "\n", "s", ".", "findNode", "(", "addr", ",", "s", ".", "id", ",", "func", "(", "m", "krpc", ".", "Msg", ",", "err", "error", ")", "{", "defer", "outstanding", ".", "Done", "(", ")", "\n", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "<mask>", ".", "NumResponses", "++", "\n", "if", "r", ":=", "m", ".", "R", ";", "r", "!=", "nil", "{", "r", ".", "ForAllNodes", "(", "func", "(", "ni", "krpc", ".", "NodeInfo", ")", "{", "onAddr", "(", "NewAddr", "(", "ni", ".", "Addr", ".", "UDP", "(", ")", ")", ")", "\n", "}", ")", "\n", "}", "\n", "}", ")", "\n", "}", "\n", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "for", "_", ",", "addr", ":=", "range", "initialAddrs", "{", "onAddr", "(", "NewAddr", "(", "addr", ".", "Addr", ".", "UDP", "(", ")", ")", ")", "\n", "}", "\n", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "outstanding", ".", "Wait", "(", ")", "\n", "return", "\n", "}" ]
21,580
all-21581
[ "GetCollaborators", "returns", "all", "github", "users", "who", "are", "members", "or", "outside", "collaborators", "of", "the", "repo", "." ]
[ "func", "(", "c", "*", "Client", ")", "GetCollaborators", "(", "org", ",", "repo", "string", ")", "(", "[", "]", "*", "github", ".", "User", ",", "error", ")", "{", "opts", ":=", "&", "github", ".", "ListCollaboratorsOptions", "{", "}", "\n", "collaborators", ",", "err", ":=", "c", ".", "depaginate", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ")", ",", "&", "opts", ".", "ListOptions", ",", "func", "(", ")", "(", "[", "]", "interface", "{", "}", ",", "*", "github", ".", "Response", ",", "error", ")", "{", "page", ",", "resp", ",", "err", ":=", "c", ".", "repoService", ".", "ListCollaborators", "(", "context", ".", "Background", "(", ")", ",", "org", ",", "repo", ",", "opts", ")", "\n\n", "var", "interfaceList", "[", "]", "interface", "{", "}", "\n", "if", "err", "==", "nil", "{", "interfaceList", "=", "<mask>", "(", "[", "]", "interface", "{", "}", ",", "0", ",", "len", "(", "page", ")", ")", "\n", "for", "_", ",", "user", ":=", "range", "page", "{", "interfaceList", "=", "append", "(", "interfaceList", ",", "user", ")", "\n", "}", "\n", "}", "\n", "return", "interfaceList", ",", "resp", ",", "err", "\n", "}", ",", ")", "\n\n", "result", ":=", "make", "(", "[", "]", "*", "github", ".", "User", ",", "0", ",", "len", "(", "collaborators", ")", ")", "\n", "for", "_", ",", "user", ":=", "range", "collaborators", "{", "result", "=", "append", "(", "result", ",", "user", ".", "(", "*", "github", ".", "User", ")", ")", "\n", "}", "\n", "return", "result", ",", "err", "\n", "}" ]
21,581
all-21582
[ "NewClient", "creates", "a", "Client", "for", "interacting", "with", "the", "Twilio", "API", ".", "This", "is", "the", "main", "entrypoint", "for", "API", "interactions", ";", "view", "the", "methods", "on", "the", "subresources", "for", "more", "information", "." ]
[ "func", "NewClient", "(", "accountSid", "string", ",", "authToken", "string", ",", "httpClient", "*", "http", ".", "Client", ")", "*", "Client", "{", "if", "httpClient", "==", "nil", "{", "httpClient", "=", "&", "<mask>", ".", "Client", "{", "Timeout", ":", "defaultTimeout", "}", "\n", "}", "\n", "restClient", ":=", "rest", ".", "NewClient", "(", "accountSid", ",", "authToken", ",", "BaseURL", ")", "\n", "restClient", ".", "Client", "=", "httpClient", "\n", "restClient", ".", "UploadType", "=", "rest", ".", "FormURLEncoded", "\n", "restClient", ".", "ErrorParser", "=", "parseTwilioError", "\n\n", "c", ":=", "&", "Client", "{", "Client", ":", "restClient", ",", "AccountSid", ":", "accountSid", ",", "AuthToken", ":", "authToken", "}", "\n", "c", ".", "APIVersion", "=", "APIVersion", "\n\n", "c", ".", "FullPath", "=", "func", "(", "pathPart", "string", ")", "string", "{", "return", "\"", "\"", "+", "strings", ".", "Join", "(", "[", "]", "string", "{", "c", ".", "APIVersion", ",", "\"", "\"", ",", "c", ".", "AccountSid", ",", "pathPart", "+", "\"", "\"", "}", ",", "\"", "\"", ")", "\n", "}", "\n", "c", ".", "Monitor", "=", "NewMonitorClient", "(", "accountSid", ",", "authToken", ",", "httpClient", ")", "\n", "c", ".", "Pricing", "=", "NewPricingClient", "(", "accountSid", ",", "authToken", ",", "httpClient", ")", "\n\n", "c", ".", "Accounts", "=", "&", "AccountService", "{", "client", ":", "c", "}", "\n", "c", ".", "Applications", "=", "&", "ApplicationService", "{", "client", ":", "c", "}", "\n", "c", ".", "Calls", "=", "&", "CallService", "{", "client", ":", "c", "}", "\n", "c", ".", "Conferences", "=", "&", "ConferenceService", "{", "client", ":", "c", "}", "\n", "c", ".", "Keys", "=", "&", "KeyService", "{", "client", ":", "c", "}", "\n", "c", ".", "Media", "=", "&", "MediaService", "{", "client", ":", "c", "}", "\n", "c", ".", "Messages", "=", "&", "MessageService", "{", "client", ":", "c", "}", "\n", "c", ".", "OutgoingCallerIDs", "=", "&", "OutgoingCallerIDService", "{", "client", ":", "c", "}", "\n", "c", ".", "Queues", "=", "&", "QueueService", "{", "client", ":", "c", "}", "\n", "c", ".", "Recordings", "=", "&", "RecordingService", "{", "client", ":", "c", "}", "\n", "c", ".", "Transcriptions", "=", "&", "TranscriptionService", "{", "client", ":", "c", "}", "\n\n", "c", ".", "IncomingNumbers", "=", "&", "IncomingNumberService", "{", "NumberPurchasingService", ":", "&", "NumberPurchasingService", "{", "client", ":", "c", ",", "pathPart", ":", "\"", "\"", ",", "}", ",", "client", ":", "c", ",", "Local", ":", "&", "NumberPurchasingService", "{", "client", ":", "c", ",", "pathPart", ":", "\"", "\"", ",", "}", ",", "TollFree", ":", "&", "NumberPurchasingService", "{", "client", ":", "c", ",", "pathPart", ":", "\"", "\"", ",", "}", ",", "}", "\n", "return", "c", "\n", "}" ]
21,582
all-21583
[ "FirstByClass", "finds", "the", "first", "element", "with", "a", "given", "CSS", "class", "." ]
[ "func", "(", "s", "*", "selectable", ")", "FindForAppium", "(", "selectorType", "string", ",", "text", "string", ")", "*", "Selection", "{", "return", "newSelection", "(", "s", ".", "<mask>", ",", "s", ".", "selectors", ".", "Append", "(", "target", ".", "Class", ",", "text", ")", ".", "At", "(", "0", ")", ")", "\n", "}" ]
21,583
all-21584
[ "goType", "returns", "the", "Go", "type", "name", "for", "the", "given", "thrift", "type", "." ]
[ "func", "(", "s", "*", "State", ")", "goType", "(", "thriftType", "*", "parser", ".", "<mask>", ")", "string", "{", "return", "s", ".", "goTypePrefix", "(", "\"", "\"", ",", "thriftType", ")", "\n", "}" ]
21,584
all-21585
[ "GetPrivateImageFile", "is", "similar", "to", "GetImageFile", "but", "allows", "passing", "a", "secret", "download", "token" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetPrivateImageFile", "(", "fingerprint", "string", ",", "secret", "string", ",", "req", "ImageFileRequest", ")", "(", "*", "ImageFileResponse", ",", "error", ")", "{", "// Sanity checks", "if", "req", ".", "MetaFile", "==", "nil", "&&", "req", ".", "RootfsFile", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "uri", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "fingerprint", ")", ")", "\n\n", "var", "err", "error", "\n", "uri", ",", "err", "=", "r", ".", "setQueryAttributes", "(", "uri", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Attempt to download from host", "if", "secret", "==", "\"", "\"", "&&", "shared", ".", "PathExists", "(", "\"", "\"", ")", "&&", "os", ".", "Geteuid", "(", ")", "==", "0", "{", "unixURI", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "uri", ")", "\n\n", "// Setup the HTTP client", "devlxdHTTP", ",", "err", ":=", "unixHTTPClient", "(", "nil", ",", "\"", "\"", ")", "\n", "if", "err", "==", "nil", "{", "resp", ",", "err", ":=", "lxdDownloadImage", "(", "fingerprint", ",", "unixURI", ",", "r", ".", "httpUserAgent", ",", "devlxdHTTP", ",", "req", ")", "\n", "if", "err", "==", "nil", "{", "return", "resp", ",", "nil", "\n", "}", "\n", "}", "\n", "}", "\n\n", "// Build the URL", "uri", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "httpHost", ",", "uri", ")", "\n", "if", "<mask>", "!=", "\"", "\"", "{", "uri", ",", "err", "=", "setQueryParam", "(", "uri", ",", "\"", "\"", ",", "secret", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "return", "lxdDownloadImage", "(", "fingerprint", ",", "uri", ",", "r", ".", "httpUserAgent", ",", "r", ".", "http", ",", "req", ")", "\n", "}" ]
21,585
all-21586
[ "AllFieldsEmpty", "checks", "to", "see", "if", "all", "fields", "in", "a", "given", "struct", "are", "zero", "values", ".", "It", "does", "not", "recurse", "so", "finer", "-", "grained", "checking", "should", "be", "done", "for", "deep", "accuracy", "when", "necessary", ".", "It", "also", "does", "not", "dereference", "pointers", "except", "if", "the", "value", "itself", "is", "a", "pointer", "and", "is", "not", "nil", "." ]
[ "func", "AllFieldsEmpty", "(", "v", "interface", "{", "}", ")", "bool", "{", "if", "v", "==", "nil", "{", "return", "true", "\n", "}", "\n\n", "t", ":=", "reflect", ".", "TypeOf", "(", "v", ")", "\n", "if", "t", ".", "Kind", "(", ")", "!=", "reflect", ".", "Struct", "&&", "(", "t", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "&&", "t", ".", "Elem", "(", ")", ".", "Kind", "(", ")", "!=", "reflect", ".", "Struct", ")", "{", "if", "reflect", ".", "Zero", "(", "t", ")", ".", "Interface", "(", ")", "!=", "reflect", ".", "ValueOf", "(", "v", ")", ".", "Interface", "(", ")", "{", "return", "false", "\n", "}", "\n", "return", "true", "\n", "}", "\n", "if", "t", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "t", "=", "t", ".", "Elem", "(", ")", "\n", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "t", ".", "NumField", "(", ")", ";", "i", "++", "{", "var", "fv", "reflect", ".", "Value", "\n", "if", "reflect", ".", "ValueOf", "(", "v", ")", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "fv", "=", "reflect", ".", "ValueOf", "(", "v", ")", ".", "Elem", "(", ")", ".", "Field", "(", "i", ")", "\n", "}", "else", "{", "fv", "=", "reflect", ".", "ValueOf", "(", "v", ")", ".", "Elem", "(", ")", ".", "<mask>", "(", "i", ")", "\n", "}", "\n\n", "ft", ":=", "t", ".", "Field", "(", "i", ")", ".", "Type", "\n", "fz", ":=", "reflect", ".", "Zero", "(", "ft", ")", "\n", "switch", "ft", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Map", ",", "reflect", ".", "Slice", ":", "if", "fv", ".", "Len", "(", ")", ">", "0", "{", "return", "false", "\n", "}", "\n", "default", ":", "if", "fz", ".", "Interface", "(", ")", "!=", "fv", ".", "Interface", "(", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
21,586
all-21587
[ "SetPreviewWidgetActive", "is", "a", "wrapper", "around", "gtk_file_chooser_set_preview_widget_active", "()", "." ]
[ "func", "(", "v", "*", "FileChooser", ")", "SetPreviewWidgetActive", "(", "<mask>", "bool", ")", "{", "C", ".", "gtk_file_chooser_set_preview_widget_active", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "active", ")", ")", "\n", "}" ]
21,587
all-21588
[ "NewMicrosoftClientFromEnv", "creates", "a", "Microsoft", "client", "based", "on", "environment", "variables", "." ]
[ "func", "NewMicrosoftClientFromEnv", "(", ")", "(", "Client", ",", "error", ")", "{", "container", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "MicrosoftContainerEnvVar", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "MicrosoftContainerEnvVar", ")", "\n", "}", "\n", "id", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "MicrosoftIDEnvVar", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "MicrosoftIDEnvVar", ")", "\n", "}", "\n", "secret", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "MicrosoftSecretEnvVar", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "MicrosoftSecretEnvVar", ")", "\n", "}", "\n", "return", "NewMicrosoftClient", "(", "<mask>", ",", "id", ",", "secret", ")", "\n", "}" ]
21,588
all-21589
[ "RsyncSend", "sets", "up", "the", "sending", "half", "of", "an", "rsync", "to", "recursively", "send", "the", "directory", "pointed", "to", "by", "path", "over", "the", "websocket", "." ]
[ "func", "RsyncSend", "(", "name", "string", ",", "path", "string", ",", "conn", "*", "websocket", ".", "Conn", ",", "readWrapper", "func", "(", "io", ".", "ReadCloser", ")", "io", ".", "ReadCloser", ",", "features", "[", "]", "string", ",", "bwlimit", "string", ",", "execPath", "string", ")", "error", "{", "cmd", ",", "dataSocket", ",", "stderr", ",", "err", ":=", "rsyncSendSetup", "(", "<mask>", ",", "path", ",", "bwlimit", ",", "execPath", ",", "features", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "dataSocket", "!=", "nil", "{", "defer", "dataSocket", ".", "Close", "(", ")", "\n", "}", "\n\n", "readPipe", ":=", "io", ".", "ReadCloser", "(", "dataSocket", ")", "\n", "if", "readWrapper", "!=", "nil", "{", "readPipe", "=", "readWrapper", "(", "dataSocket", ")", "\n", "}", "\n\n", "readDone", ",", "writeDone", ":=", "shared", ".", "WebsocketMirror", "(", "conn", ",", "dataSocket", ",", "readPipe", ",", "nil", ",", "nil", ")", "\n\n", "chError", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n", "go", "func", "(", ")", "{", "err", "=", "cmd", ".", "Wait", "(", ")", "\n", "if", "err", "!=", "nil", "{", "dataSocket", ".", "Close", "(", ")", "\n", "readPipe", ".", "Close", "(", ")", "\n", "}", "\n", "chError", "<-", "err", "\n", "}", "(", ")", "\n\n", "output", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "stderr", ")", "\n", "if", "err", "!=", "nil", "{", "cmd", ".", "Process", ".", "Kill", "(", ")", "\n", "}", "\n\n", "err", "=", "<-", "chError", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Errorf", "(", "\"", "\"", ",", "path", ",", "err", ",", "string", "(", "output", ")", ")", "\n", "}", "\n\n", "<-", "readDone", "\n", "<-", "writeDone", "\n\n", "return", "err", "\n", "}" ]
21,589
all-21590
[ "GetPointer", "is", "a", "wrapper", "around", "g_value_get_pointer", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetPointer", "(", ")", "unsafe", ".", "Pointer", "{", "return", "unsafe", ".", "Pointer", "(", "C", ".", "g_value_get_pointer", "(", "v", ".", "native", "(", ")", ")", ")", "\n", "}" ]
21,590
all-21591
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventFrameRequestedNavigation", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage63", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
21,591
all-21592
[ "NewSetDirCommand", "returns", "the", "CLI", "command", "for", "setDir", "." ]
[ "func", "NewSetDirCommand", "(", ")", "cli", ".", "Command", "{", "return", "cli", ".", "Command", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "ArgsUsage", ":", "\"", "\"", ",", "Flags", ":", "[", "]", "cli", ".", "Flag", "{", "cli", ".", "IntFlag", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "0", ",", "Usage", ":", "\"", "\"", "}", ",", "}", ",", "Action", ":", "func", "(", "c", "*", "cli", ".", "Context", ")", "error", "{", "mkdirCommandFunc", "(", "c", ",", "mustNewKeyAPI", "(", "c", ")", ",", "<mask>", ".", "PrevIgnore", ")", "\n", "return", "nil", "\n", "}", ",", "}", "\n", "}" ]
21,592
all-21593
[ "BearingTo", "returns", "the", "bearing", "from", "p1", "to", "p2" ]
[ "func", "BearingTo", "(", "p1", ",", "p2", "<mask>", ")", "float64", "{", "dLon", ":=", "toRadians", "(", "p2", ".", "Lon", "(", ")", "-", "p1", ".", "Lon", "(", ")", ")", "\n\n", "lat1", ":=", "toRadians", "(", "p1", ".", "Lat", "(", ")", ")", "\n", "lat2", ":=", "toRadians", "(", "p2", ".", "Lat", "(", ")", ")", "\n\n", "y", ":=", "math", ".", "Sin", "(", "dLon", ")", "*", "math", ".", "Cos", "(", "lat2", ")", "\n", "x", ":=", "math", ".", "Cos", "(", "lat1", ")", "*", "math", ".", "Sin", "(", "lat2", ")", "-", "math", ".", "Sin", "(", "lat1", ")", "*", "math", ".", "Cos", "(", "lat2", ")", "*", "math", ".", "Cos", "(", "dLon", ")", "\n", "brng", ":=", "toDegrees", "(", "math", ".", "Atan2", "(", "y", ",", "x", ")", ")", "\n\n", "return", "brng", "\n", "}" ]
21,593
all-21594
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventFrameResized", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage62", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
21,594
all-21595
[ "String", "returns", "the", "human", "-", "friendly", "version", "of", "this", "dependency", "." ]
[ "func", "(", "d", "*", "KVKeysQuery", ")", "String", "(", ")", "string", "{", "prefix", ":=", "d", ".", "prefix", "\n", "if", "d", ".", "dc", "!=", "\"", "\"", "{", "prefix", "=", "<mask>", "+", "\"", "\"", "+", "d", ".", "dc", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "prefix", ")", "\n", "}" ]
21,595
all-21596
[ "Create", "implements", "Create", "method", "of", "PlatformService", "interface" ]
[ "func", "(", "s", "*", "platformService", ")", "Create", "(", "opts", "appTypes", ".", "PlatformOptions", ")", "error", "{", "p", ":=", "appTypes", ".", "Platform", "{", "Name", ":", "opts", ".", "Name", "}", "\n", "if", "err", ":=", "s", ".", "validate", "(", "p", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", ":=", "s", ".", "storage", ".", "Insert", "(", "p", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "opts", ".", "ImageName", ",", "err", "=", "servicemanager", ".", "PlatformImage", ".", "NewImage", "(", "opts", ".", "Name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "builder", ".", "PlatformAdd", "(", "opts", ")", "\n", "if", "err", "!=", "nil", "{", "if", "imgErr", ":=", "servicemanager", ".", "PlatformImage", ".", "DeleteImages", "(", "opts", ".", "Name", ")", ";", "imgErr", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "imgErr", ")", "\n", "}", "\n", "dbErr", ":=", "s", ".", "storage", ".", "Delete", "(", "p", ")", "\n", "if", "dbErr", "!=", "nil", "{", "return", "tsuruErrors", ".", "NewMultiError", "(", "errors", ".", "Wrapf", "(", "dbErr", ",", "\"", "\"", ")", ",", "<mask>", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", ",", ")", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "return", "servicemanager", ".", "PlatformImage", ".", "AppendImage", "(", "opts", ".", "Name", ",", "opts", ".", "ImageName", ")", "\n", "}" ]
21,596
all-21597
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "RequestDatabaseReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,597
all-21598
[ "GetClient", "looks", "up", "the", "client", "endpoints", "for", "a", "service", "and", "domain", "." ]
[ "func", "GetClient", "(", "service", ",", "domain", "string", ",", "serviceName", "string", ")", "(", "*", "SRVClients", ",", "error", ")", "{", "var", "urls", "[", "]", "*", "url", ".", "URL", "\n", "var", "srvs", "[", "]", "*", "net", ".", "SRV", "\n\n", "updateURLs", ":=", "func", "(", "service", ",", "scheme", "string", ")", "error", "{", "_", ",", "addrs", ",", "err", ":=", "lookupSRV", "(", "service", ",", "\"", "\"", ",", "domain", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "_", ",", "srv", ":=", "range", "addrs", "{", "urls", "=", "append", "(", "urls", ",", "&", "url", ".", "URL", "{", "Scheme", ":", "scheme", ",", "Host", ":", "net", ".", "JoinHostPort", "(", "srv", ".", "Target", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "srv", ".", "Port", ")", ")", ",", "}", ")", "\n", "}", "\n", "srvs", "=", "append", "(", "srvs", ",", "addrs", "...", ")", "\n", "return", "nil", "\n", "}", "\n\n", "errHTTPS", ":=", "updateURLs", "(", "GetSRVService", "(", "service", ",", "serviceName", ",", "\"", "\"", ")", ",", "\"", "\"", ")", "\n", "errHTTP", ":=", "updateURLs", "(", "GetSRVService", "(", "<mask>", ",", "serviceName", ",", "\"", "\"", ")", ",", "\"", "\"", ")", "\n\n", "if", "errHTTPS", "!=", "nil", "&&", "errHTTP", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "errHTTPS", ",", "errHTTP", ")", "\n", "}", "\n\n", "endpoints", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "urls", ")", ")", "\n", "for", "i", ":=", "range", "urls", "{", "endpoints", "[", "i", "]", "=", "urls", "[", "i", "]", ".", "String", "(", ")", "\n", "}", "\n", "return", "&", "SRVClients", "{", "Endpoints", ":", "endpoints", ",", "SRVs", ":", "srvs", "}", ",", "nil", "\n", "}" ]
21,598
all-21599
[ "fill", "all", "or", "part", "of", "buffer", "object", "s", "data", "store", "with", "a", "fixed", "value" ]
[ "func", "ClearNamedBufferSubData", "(", "buffer", "uint32", ",", "internalformat", "uint32", ",", "<mask>", "int", ",", "size", "int", ",", "format", "uint32", ",", "xtype", "uint32", ",", "data", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall9", "(", "gpClearNamedBufferSubData", ",", "7", ",", "uintptr", "(", "buffer", ")", ",", "uintptr", "(", "internalformat", ")", ",", "uintptr", "(", "offset", ")", ",", "uintptr", "(", "size", ")", ",", "uintptr", "(", "format", ")", ",", "uintptr", "(", "xtype", ")", ",", "uintptr", "(", "data", ")", ",", "0", ",", "0", ")", "\n", "}" ]
21,599
all-21600
[ "<source", "-", "name", ">", "::", "=", "<", "(", "positive", "length", ")", "number", ">", "<identifier", ">", "identifier", "::", "=", "<", "(", "unqualified", "source", "code", "identifier", ")", ">" ]
[ "func", "(", "st", "*", "state", ")", "sourceName", "(", ")", "AST", "{", "val", ":=", "st", ".", "number", "(", ")", "\n", "if", "val", "<=", "0", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "st", ".", "str", ")", "<", "val", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "id", ":=", "st", ".", "str", "[", ":", "val", "]", "\n", "st", ".", "advance", "(", "val", ")", "\n\n", "// Look for GCC encoding of anonymous namespace, and make it", "// more friendly.", "const", "anonPrefix", "=", "\"", "\"", "\n", "if", "strings", ".", "HasPrefix", "(", "id", ",", "anonPrefix", ")", "&&", "len", "(", "id", ")", ">", "len", "(", "anonPrefix", ")", "+", "2", "{", "c1", ":=", "id", "[", "len", "(", "anonPrefix", ")", "]", "\n", "c2", ":=", "id", "[", "len", "(", "anonPrefix", ")", "+", "1", "]", "\n", "if", "(", "c1", "==", "'.'", "||", "c1", "==", "'_'", "||", "c1", "==", "'$'", ")", "&&", "c2", "==", "'N'", "{", "id", "=", "\"", "\"", "\n", "}", "\n", "}", "\n\n", "n", ":=", "&", "<mask>", "{", "Name", ":", "id", "}", "\n", "return", "n", "\n", "}" ]