id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
18,500
all-18501
[ "createComment", "take", "a", "ProwJob", "and", "a", "list", "of", "entries", "generated", "with", "createEntry", "and", "returns", "a", "nicely", "formatted", "comment", ".", "It", "may", "fail", "if", "template", "execution", "fails", "." ]
[ "func", "createComment", "(", "reportTemplate", "*", "template", ".", "Template", ",", "pj", "prowapi", ".", "ProwJob", ",", "entries", "[", "]", "string", ")", "(", "string", ",", "error", ")", "{", "plural", ":=", "\"", "\"", "\n", "if", "len", "(", "entries", ")", ">", "1", "{", "plural", "=", "\"", "\"", "\n", "}", "\n", "var", "b", "bytes", ".", "Buffer", "\n", "if", "reportTemplate", "!=", "nil", "{", "if", "err", ":=", "reportTemplate", ".", "Execute", "(", "&", "b", ",", "&", "pj", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "}", "\n", "lines", ":=", "[", "]", "string", "{", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pj", ".", "Spec", ".", "Refs", ".", "Pulls", "[", "0", "]", ".", "Author", ",", "plural", ")", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "}", "\n", "lines", "=", "append", "(", "lines", ",", "entries", "...", ")", "\n", "if", "reportTemplate", "!=", "nil", "{", "lines", "=", "append", "(", "lines", ",", "\"", "\"", ",", "b", ".", "String", "(", ")", ")", "\n", "}", "\n", "lines", "=", "<mask>", "(", "lines", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "plugins", ".", "AboutThisBot", ",", "\"", "\"", ",", "commentTag", ",", "}", "...", ")", "\n", "return", "strings", ".", "Join", "(", "lines", ",", "\"", "\\n", "\"", ")", ",", "nil", "\n", "}" ]
18,501
all-18502
[ "Walk", "traverses", "an", "AST", "in", "depth", "-", "first", "order", ":", "It", "starts", "by", "calling", "v", ".", "Visit", "(", "node", "path", ")", ";", "node", "must", "not", "be", "nil", ".", "If", "the", "visitor", "w", "returned", "by", "v", ".", "Visit", "(", "node", "path", ")", "is", "not", "nil", "and", "the", "visitor", "returns", "no", "error", "Walk", "is", "invoked", "recursively", "with", "visitor", "w", "for", "each", "of", "the", "non", "-", "nil", "children", "of", "node", "followed", "by", "a", "call", "of", "w", ".", "Visit", "(", "nil", ")", "returning", "an", "error", "As", "the", "tree", "is", "descended", "the", "path", "of", "previous", "nodes", "is", "provided", "." ]
[ "func", "Walk", "(", "v", "Visitor", ",", "node", "Node", ",", "path", "[", "]", "Node", ")", "error", "{", "var", "err", "error", "\n", "if", "v", ",", "err", "=", "v", ".", "Visit", "(", "node", ",", "path", ")", ";", "v", "==", "nil", "||", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "path", "=", "append", "(", "path", ",", "<mask>", ")", "\n\n", "switch", "n", ":=", "node", ".", "(", "type", ")", "{", "case", "*", "EvalStmt", ":", "if", "err", ":=", "Walk", "(", "v", ",", "n", ".", "Expr", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "case", "Expressions", ":", "for", "_", ",", "e", ":=", "range", "n", "{", "if", "err", ":=", "Walk", "(", "v", ",", "e", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "case", "*", "AggregateExpr", ":", "if", "n", ".", "Param", "!=", "nil", "{", "if", "err", ":=", "Walk", "(", "v", ",", "n", ".", "Param", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "Walk", "(", "v", ",", "n", ".", "Expr", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "case", "*", "BinaryExpr", ":", "if", "err", ":=", "Walk", "(", "v", ",", "n", ".", "LHS", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "Walk", "(", "v", ",", "n", ".", "RHS", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "case", "*", "Call", ":", "if", "err", ":=", "Walk", "(", "v", ",", "n", ".", "Args", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "case", "*", "SubqueryExpr", ":", "if", "err", ":=", "Walk", "(", "v", ",", "n", ".", "Expr", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "case", "*", "ParenExpr", ":", "if", "err", ":=", "Walk", "(", "v", ",", "n", ".", "Expr", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "case", "*", "UnaryExpr", ":", "if", "err", ":=", "Walk", "(", "v", ",", "n", ".", "Expr", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "case", "*", "MatrixSelector", ",", "*", "NumberLiteral", ",", "*", "StringLiteral", ",", "*", "VectorSelector", ":", "// nothing to do", "default", ":", "panic", "(", "errors", ".", "Errorf", "(", "\"", "\"", ",", "node", ")", ")", "\n", "}", "\n\n", "_", ",", "err", "=", "v", ".", "Visit", "(", "nil", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
18,502
all-18503
[ "void", "cvPutText", "(", "CvArr", "*", "img", "const", "char", "*", "text", "CvPoint", "org", "const", "CvFont", "*", "font", "CvScalar", "color", ")" ]
[ "func", "(", "this", "*", "Font", ")", "PutText", "(", "image", "*", "IplImage", ",", "text", "string", ",", "pt1", "Point", ",", "<mask>", "Scalar", ")", "{", "C", ".", "cvPutText", "(", "unsafe", ".", "Pointer", "(", "image", ")", ",", "C", ".", "CString", "(", "text", ")", ",", "C", ".", "cvPoint", "(", "C", ".", "int", "(", "pt1", ".", "X", ")", ",", "C", ".", "int", "(", "pt1", ".", "Y", ")", ")", ",", "&", "this", ".", "font", ",", "(", "C", ".", "CvScalar", ")", "(", "color", ")", ",", ")", "\n", "}" ]
18,503
all-18504
[ "Reads", "souce", "file", "lines", "from", "disk", "if", "not", "cached", "already", "." ]
[ "func", "getSourceLines", "(", "file", "string", ")", "[", "]", "[", "]", "byte", "{", "fileSources", ".", "Lock", "(", ")", "\n", "defer", "fileSources", ".", "Unlock", "(", ")", "\n", "if", "fileSources", ".", "<mask>", "==", "nil", "{", "fileSources", ".", "lines", "=", "map", "[", "string", "]", "[", "]", "[", "]", "byte", "{", "}", "\n", "}", "\n", "if", "lines", ",", "ok", ":=", "fileSources", ".", "lines", "[", "file", "]", ";", "ok", "{", "return", "lines", "\n", "}", "\n", "text", ",", "_", ":=", "ioutil", ".", "ReadFile", "(", "file", ")", "\n", "fileSources", ".", "lines", "[", "file", "]", "=", "bytes", ".", "Split", "(", "text", ",", "[", "]", "byte", "{", "'\\n'", "}", ")", "\n", "return", "fileSources", ".", "lines", "[", "file", "]", "\n", "}" ]
18,504
all-18505
[ "Set", "is", "a", "wrapper", "around", "g_object_set", "()", ".", "However", "unlike", "g_object_set", "()", "this", "function", "only", "sets", "one", "name", "value", "pair", ".", "Make", "multiple", "calls", "to", "this", "function", "to", "set", "multiple", "properties", "." ]
[ "func", "(", "v", "*", "Object", ")", "<mask>", "(", "name", "string", ",", "value", "interface", "{", "}", ")", "error", "{", "return", "v", ".", "SetProperty", "(", "name", ",", "value", ")", "\n", "/*\n\t\tcstr := C.CString(name)\n\t\tdefer C.free(unsafe.Pointer(cstr))\n\n\t\tif _, ok := value.(Object); ok {\n\t\t\tvalue = value.(Object).GObject\n\t\t}\n\n\t\t// Can't call g_object_set() as it uses a variable arg list, use a\n\t\t// wrapper instead\n\t\tvar p unsafe.Pointer\n\t\tswitch v := value.(type) {\n\t\tcase bool:\n\t\t\tc := gbool(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase int8:\n\t\t\tc := C.gint8(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase int16:\n\t\t\tc := C.gint16(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase int32:\n\t\t\tc := C.gint32(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase int64:\n\t\t\tc := C.gint64(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase int:\n\t\t\tc := C.gint(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase uint8:\n\t\t\tc := C.guchar(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase uint16:\n\t\t\tc := C.guint16(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase uint32:\n\t\t\tc := C.guint32(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase uint64:\n\t\t\tc := C.guint64(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase uint:\n\t\t\tc := C.guint(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase uintptr:\n\t\t\tp = unsafe.Pointer(C.gpointer(v))\n\n\t\tcase float32:\n\t\t\tc := C.gfloat(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase float64:\n\t\t\tc := C.gdouble(v)\n\t\t\tp = unsafe.Pointer(&c)\n\n\t\tcase string:\n\t\t\tcstr := C.CString(v)\n\t\t\tdefer C.g_free(C.gpointer(unsafe.Pointer(cstr)))\n\t\t\tp = unsafe.Pointer(&cstr)\n\n\t\tdefault:\n\t\t\tif pv, ok := value.(unsafe.Pointer); ok {\n\t\t\t\tp = pv\n\t\t\t} else {\n\t\t\t\tval := reflect.ValueOf(value)\n\t\t\t\tswitch val.Kind() {\n\t\t\t\tcase reflect.Int, reflect.Int8, reflect.Int16,\n\t\t\t\t\treflect.Int32, reflect.Int64:\n\t\t\t\t\tc := C.int(val.Int())\n\t\t\t\t\tp = unsafe.Pointer(&c)\n\n\t\t\t\tcase reflect.Uintptr, reflect.Ptr, reflect.UnsafePointer:\n\t\t\t\t\tp = unsafe.Pointer(C.gpointer(val.Pointer()))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif p == nil {\n\t\t\treturn errors.New(\"Unable to perform type conversion\")\n\t\t}\n\t\tC._g_object_set_one(C.gpointer(v.GObject), (*C.gchar)(cstr), p)\n\t\treturn nil*/", "}" ]
18,505
all-18506
[ "HasFields", "returns", "true", "if", "the", "given", "field", "exists", "in", "the", "index", "." ]
[ "func", "(", "idx", "*", "Index", ")", "HasField", "(", "fieldName", "string", ")", "bool", "{", "_", ",", "ok", ":=", "idx", ".", "fields", "[", "fieldName", "]", "\n", "return", "<mask>", "\n", "}" ]
18,506
all-18507
[ "Array", "returns", "the", "position", "of", "the", "end", "of", "the", "array", "that", "begins", "at", "the", "position", "specified" ]
[ "func", "Array", "(", "in", "[", "]", "byte", ",", "pos", "int", ")", "(", "int", ",", "error", ")", "{", "pos", ",", "err", ":=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "if", "v", ":=", "in", "[", "pos", "]", ";", "v", "!=", "'['", "{", "return", "0", ",", "newError", "(", "pos", ",", "v", ")", "\n", "}", "\n", "pos", "++", "\n\n", "// clean initial spaces", "pos", ",", "err", "=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "if", "in", "[", "<mask>", "]", "==", "']'", "{", "return", "pos", "+", "1", ",", "nil", "\n", "}", "\n\n", "for", "{", "// data", "pos", ",", "err", "=", "Any", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "pos", ",", "err", "=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "switch", "in", "[", "pos", "]", "{", "case", "','", ":", "pos", "++", "\n", "case", "']'", ":", "return", "pos", "+", "1", ",", "nil", "\n", "}", "\n", "}", "\n", "}" ]
18,507
all-18508
[ "GetPolicy", "returns", "the", "protection", "policy", "for", "the", "branch", "after", "merging", "in", "presubmits", "." ]
[ "func", "(", "c", "*", "Config", ")", "GetPolicy", "(", "org", ",", "repo", ",", "branch", "string", ",", "b", "Branch", ")", "(", "*", "<mask>", ",", "error", ")", "{", "policy", ":=", "b", ".", "Policy", "\n\n", "// Automatically require contexts from prow which must always be present", "if", "prowContexts", ",", "_", ",", "_", ":=", "BranchRequirements", "(", "org", ",", "repo", ",", "branch", ",", "c", ".", "Presubmits", ")", ";", "len", "(", "prowContexts", ")", ">", "0", "{", "// Error if protection is disabled", "if", "policy", ".", "Protect", "!=", "nil", "&&", "!", "*", "policy", ".", "Protect", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "ps", ":=", "Policy", "{", "RequiredStatusChecks", ":", "&", "ContextPolicy", "{", "Contexts", ":", "prowContexts", ",", "}", ",", "}", "\n", "// Require protection by default if ProtectTested is true", "if", "c", ".", "BranchProtection", ".", "ProtectTested", "{", "yes", ":=", "true", "\n", "ps", ".", "Protect", "=", "&", "yes", "\n", "}", "\n", "policy", "=", "policy", ".", "Apply", "(", "ps", ")", "\n", "}", "\n\n", "if", "policy", ".", "Protect", "!=", "nil", "&&", "!", "*", "policy", ".", "Protect", "{", "// Ensure that protection is false => no protection settings", "var", "old", "*", "bool", "\n", "old", ",", "policy", ".", "Protect", "=", "policy", ".", "Protect", ",", "old", "\n", "switch", "{", "case", "policy", ".", "defined", "(", ")", "&&", "c", ".", "BranchProtection", ".", "AllowDisabledPolicies", ":", "logrus", ".", "Warnf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "branch", ")", "\n", "policy", "=", "Policy", "{", "Protect", ":", "policy", ".", "Protect", ",", "}", "\n", "case", "policy", ".", "defined", "(", ")", ":", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "branch", ")", "\n", "}", "\n", "policy", ".", "Protect", "=", "old", "\n", "}", "\n\n", "if", "!", "policy", ".", "defined", "(", ")", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "&", "policy", ",", "nil", "\n", "}" ]
18,508
all-18509
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EnableParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoInspector3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,509
all-18510
[ "Method", "takes", "one", "map", "as", "a", "paramater", ".", "Keys", "of", "this", "map", "are", "HTTP", "method", "mapping", "to", "HandlerFunc", "(", "s", ")", "." ]
[ "func", "Method", "(", "m", "map", "[", "string", "]", "HandlerFunc", ")", "HandlerFunc", "{", "f", ":=", "func", "(", "ctx", "*", "Context", ")", "error", "{", "h", ",", "ok", ":=", "m", "[", "ctx", ".", "Request", ".", "Method", "]", "\n", "if", "ok", "{", "return", "h", "(", "ctx", ")", "\n", "}", "\n", "ctx", ".", "Response", ".", "<mask>", "=", "http", ".", "StatusMethodNotAllowed", "\n", "return", "nil", "\n", "}", "\n", "return", "f", "\n", "}" ]
18,510
all-18511
[ "ServeHTTP", "logs", "the", "method", "and", "remote", "address", "of", "the", "request", "." ]
[ "func", "(", "lh", "LoggingHandler", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ")", "{", "seelog", ".", "Debug", "(", "\"", "\"", ",", "\"", "\"", ",", "r", ".", "Method", ",", "\"", "\"", ",", "r", ".", "RemoteAddr", ")", "\n", "lh", ".", "h", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}" ]
18,511
all-18512
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkAppChooserWidget", "." ]
[ "func", "(", "v", "*", "AppChooserWidget", ")", "native", "(", ")", "*", "C", ".", "GtkAppChooserWidget", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "<mask>", "nil", "\n", "}", "\n\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "return", "C", ".", "toGtkAppChooserWidget", "(", "p", ")", "\n", "}" ]
18,512
all-18513
[ "HasHost", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "m", "*", "Metric", ")", "HasHost", "(", ")", "bool", "{", "if", "m", "!=", "nil", "&&", "m", ".", "Host", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
18,513
all-18514
[ "ParseWaitConfig", "parses", "a", "string", "of", "the", "format", "minimum", "(", ":", "maximum", ")", "into", "a", "WaitConfig", "." ]
[ "func", "ParseWaitConfig", "(", "s", "string", ")", "(", "*", "WaitConfig", ",", "error", ")", "{", "s", "=", "strings", ".", "TrimSpace", "(", "s", ")", "\n", "if", "len", "(", "s", ")", "<", "1", "{", "return", "nil", ",", "ErrWaitStringEmpty", "\n", "}", "\n\n", "parts", ":=", "strings", ".", "Split", "(", "s", ",", "\"", "\"", ")", "\n\n", "<mask>", "min", ",", "max", "time", ".", "Duration", "\n", "var", "err", "error", "\n\n", "switch", "len", "(", "parts", ")", "{", "case", "1", ":", "min", ",", "err", "=", "time", ".", "ParseDuration", "(", "strings", ".", "TrimSpace", "(", "parts", "[", "0", "]", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "max", "=", "4", "*", "min", "\n", "case", "2", ":", "min", ",", "err", "=", "time", ".", "ParseDuration", "(", "strings", ".", "TrimSpace", "(", "parts", "[", "0", "]", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "max", ",", "err", "=", "time", ".", "ParseDuration", "(", "strings", ".", "TrimSpace", "(", "parts", "[", "1", "]", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "default", ":", "return", "nil", ",", "ErrWaitInvalidFormat", "\n", "}", "\n\n", "if", "min", "<", "0", "||", "max", "<", "0", "{", "return", "nil", ",", "ErrWaitNegative", "\n", "}", "\n\n", "if", "max", "<", "min", "{", "return", "nil", ",", "ErrWaitMinLTMax", "\n", "}", "\n\n", "var", "c", "WaitConfig", "\n", "c", ".", "Min", "=", "TimeDuration", "(", "min", ")", "\n", "c", ".", "Max", "=", "TimeDuration", "(", "max", ")", "\n\n", "return", "&", "c", ",", "nil", "\n", "}" ]
18,514
all-18515
[ "Reader", "will", "open", "the", "path", "for", "reading", "returning", "an", "IsNotExist", "()", "error", "when", "missing" ]
[ "func", "(", "o", "opener", ")", "Reader", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "(", "<mask>", ".", "ReadCloser", ",", "error", ")", "{", "g", ",", "err", ":=", "o", ".", "openGCS", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "g", "==", "nil", "{", "return", "os", ".", "Open", "(", "path", ")", "\n", "}", "\n", "return", "g", ".", "NewReader", "(", "ctx", ")", "\n", "}" ]
18,515
all-18516
[ "Commit", "implements", "storage", ".", "Appender", "." ]
[ "func", "(", "t", "*", "timestampTracker", ")", "Commit", "(", ")", "error", "{", "t", ".", "<mask>", ".", "samplesIn", ".", "incr", "(", "t", ".", "samples", ")", "\n\n", "samplesIn", ".", "Add", "(", "float64", "(", "t", ".", "samples", ")", ")", "\n", "highestTimestamp", ".", "Set", "(", "float64", "(", "t", ".", "highestTimestamp", "/", "1000", ")", ")", "\n", "return", "nil", "\n", "}" ]
18,516
all-18517
[ "MarkOffset", "stashes", "the", "provided", "message", "offset" ]
[ "func", "(", "s", "*", "OffsetStash", ")", "MarkOffset", "(", "msg", "*", "sarama", ".", "ConsumerMessage", ",", "metadata", "string", ")", "{", "s", ".", "MarkPartitionOffset", "(", "msg", ".", "<mask>", ",", "msg", ".", "Partition", ",", "msg", ".", "Offset", ",", "metadata", ")", "\n", "}" ]
18,517
all-18518
[ "/", "*", "GetVMByCid", "finds", "vm", "by", "ID" ]
[ "func", "(", "a", "*", "Client", ")", "GetVMByCid", "(", "params", "*", "GetVMByCidParams", ")", "(", "*", "GetVMByCidOK", ",", "error", ")", "{", "// TODO: Validate the params before sending", "if", "params", "==", "nil", "{", "params", "=", "NewGetVMByCidParams", "(", ")", "\n", "}", "\n\n", "<mask>", ",", "err", ":=", "a", ".", "transport", ".", "Submit", "(", "&", "runtime", ".", "ClientOperation", "{", "ID", ":", "\"", "\"", ",", "Method", ":", "\"", "\"", ",", "PathPattern", ":", "\"", "\"", ",", "ProducesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "ConsumesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Schemes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Params", ":", "params", ",", "Reader", ":", "&", "GetVMByCidReader", "{", "formats", ":", "a", ".", "formats", "}", ",", "Context", ":", "params", ".", "Context", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ".", "(", "*", "GetVMByCidOK", ")", ",", "nil", "\n\n", "}" ]
18,518
all-18519
[ "Value", "follows", "the", "y", ".", "Iterator", "interface" ]
[ "func", "(", "itr", "*", "Iterator", ")", "Value", "(", ")", "(", "ret", "y", ".", "ValueStruct", ")", "{", "ret", ".", "Decode", "(", "itr", ".", "bi", ".", "<mask>", "(", ")", ")", "\n", "return", "\n", "}" ]
18,519
all-18520
[ "Trace", "formats", "message", "using", "the", "default", "formats", "for", "its", "operands", "prepends", "the", "prefix", "as", "necessary", "and", "writes", "to", "log", "with", "LevelTrace", ".", "This", "is", "part", "of", "the", "Logger", "interface", "implementation", "." ]
[ "func", "(", "l", "*", "slog", ")", "Trace", "(", "args", "...", "<mask>", "{", "}", ")", "{", "lvl", ":=", "l", ".", "Level", "(", ")", "\n", "if", "lvl", "<=", "LevelTrace", "{", "l", ".", "b", ".", "print", "(", "\"", "\"", ",", "l", ".", "tag", ",", "args", "...", ")", "\n", "}", "\n", "}" ]
18,520
all-18521
[ "Package", "compress", "/", "bzip2", "implements", "only", "decompression", "so", "we", "ll", "fake", "it", "by", "running", "bzip2", "in", "another", "process", "." ]
[ "func", "newBzip2Writer", "(", "w", "io", ".", "Writer", ")", "(", "wc", "io", ".", "WriteCloser", ",", "err", "error", ")", "{", "<mask>", "bw", "bzip2Writer", "\n", "bw", ".", "c", "=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "bw", ".", "c", ".", "Stdout", "=", "w", "\n\n", "if", "bw", ".", "w", ",", "err", "=", "bw", ".", "c", ".", "StdinPipe", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "err", "=", "bw", ".", "c", ".", "Start", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "bw", ",", "nil", "\n", "}" ]
18,521
all-18522
[ "StartGeneric", "starts", "a", "generic", "segment", "." ]
[ "func", "(", "t", "*", "tx", ")", "StartGeneric", "(", "<mask>", "string", ")", "error", "{", "t", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "id", ",", "err", ":=", "t", ".", "Tracer", ".", "BeginGenericSegment", "(", "t", ".", "id", ",", "t", ".", "ss", ".", "Peek", "(", ")", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "t", ".", "ss", ".", "Push", "(", "id", ")", "\n", "return", "nil", "\n", "}" ]
18,522
all-18523
[ "makeAddressable", "returns", "a", "value", "that", "is", "always", "addressable", ".", "It", "returns", "the", "input", "verbatim", "if", "it", "is", "already", "addressable", "otherwise", "it", "creates", "a", "new", "value", "and", "returns", "an", "addressable", "copy", "." ]
[ "func", "makeAddressable", "(", "v", "reflect", ".", "<mask>", ")", "reflect", ".", "Value", "{", "if", "v", ".", "CanAddr", "(", ")", "{", "return", "v", "\n", "}", "\n", "vc", ":=", "reflect", ".", "New", "(", "v", ".", "Type", "(", ")", ")", ".", "Elem", "(", ")", "\n", "vc", ".", "Set", "(", "v", ")", "\n", "return", "vc", "\n", "}" ]
18,523
all-18524
[ "buildPackage", "extracts", "metadata", "from", "the", ".", "proto", "files", "in", "a", "directory", "and", "constructs", "possibly", "several", "packages", "then", "selects", "a", "package", "to", "generate", "a", "proto_library", "rule", "for", "." ]
[ "func", "buildPackages", "(", "pc", "*", "ProtoConfig", ",", "dir", ",", "rel", "string", ",", "protoFiles", ",", "genFiles", "[", "]", "string", ")", "[", "]", "*", "Package", "{", "packageMap", ":=", "make", "(", "map", "[", "string", "]", "*", "Package", ")", "\n", "for", "_", ",", "name", ":=", "range", "protoFiles", "{", "info", ":=", "protoFileInfo", "(", "dir", ",", "name", ")", "\n", "key", ":=", "info", ".", "PackageName", "\n", "if", "pc", ".", "groupOption", "!=", "\"", "\"", "{", "for", "_", ",", "opt", ":=", "range", "info", ".", "Options", "{", "if", "opt", ".", "Key", "==", "pc", ".", "groupOption", "{", "key", "=", "opt", ".", "Value", "\n", "break", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "packageMap", "[", "key", "]", "==", "nil", "{", "packageMap", "[", "key", "]", "=", "newPackage", "(", "info", ".", "PackageName", ")", "\n", "}", "\n", "packageMap", "[", "key", "]", ".", "addFile", "(", "<mask>", ")", "\n", "}", "\n\n", "switch", "pc", ".", "Mode", "{", "case", "DefaultMode", ":", "pkg", ",", "err", ":=", "selectPackage", "(", "dir", ",", "rel", ",", "packageMap", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Print", "(", "err", ")", "\n", "}", "\n", "if", "pkg", "==", "nil", "{", "return", "nil", "// empty rule created in generateEmpty", "\n", "}", "\n", "for", "_", ",", "name", ":=", "range", "genFiles", "{", "pkg", ".", "addGenFile", "(", "dir", ",", "name", ")", "\n", "}", "\n", "return", "[", "]", "*", "Package", "{", "pkg", "}", "\n\n", "case", "PackageMode", ":", "pkgs", ":=", "make", "(", "[", "]", "*", "Package", ",", "0", ",", "len", "(", "packageMap", ")", ")", "\n", "for", "_", ",", "pkg", ":=", "range", "packageMap", "{", "pkgs", "=", "append", "(", "pkgs", ",", "pkg", ")", "\n", "}", "\n", "return", "pkgs", "\n\n", "default", ":", "return", "nil", "\n", "}", "\n", "}" ]
18,524
all-18525
[ "Execute", "-", "creates", "private", "domains" ]
[ "func", "(", "c", "*", "SharePrivateDomainsCommand", ")", "Execute", "(", "[", "]", "string", ")", "error", "{", "var", "cfMgmt", "*", "CFMgmt", "\n", "<mask>", "err", "error", "\n", "if", "cfMgmt", ",", "err", "=", "InitializePeekManagers", "(", "c", ".", "BaseCFConfigCommand", ",", "c", ".", "Peek", ")", ";", "err", "==", "nil", "{", "err", "=", "cfMgmt", ".", "PrivateDomainManager", ".", "SharePrivateDomains", "(", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
18,525
all-18526
[ "Debugf", "logging" ]
[ "func", "(", "l", "*", "StdLevelLogger", ")", "Debugf", "(", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "logfFunc", "(", "DebugLevel", ",", "l", ".", "<mask>", ",", "msg", ",", "args", "...", ")", "\n", "}" ]
18,526
all-18527
[ "IterNext", "()", "is", "a", "wrapper", "around", "gtk_tree_model_iter_next", "()", "." ]
[ "func", "(", "v", "*", "TreeModel", ")", "IterNext", "(", "iter", "*", "TreeIter", ")", "bool", "{", "c", ":=", "C", ".", "gtk_tree_model_iter_next", "(", "v", ".", "native", "(", ")", ",", "iter", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
18,527
all-18528
[ "NewConfig", "function", "cnstructs", "a", "new", "Config", "struct", "with", "filename", ".", "You", "have", "to", "call", "Read", "()", "function", "to", "let", "it", "read", "from", "the", "file", ".", "Otherwise", "you", "will", "get", "empty", "string", "(", "i", ".", "e", ".", ")", "when", "you", "are", "calling", "Get", "()", "function", ".", "Another", "usage", "is", "that", "you", "call", "NewConfig", "()", "function", "and", "then", "call", "Add", "()", "/", "Set", "()", "function", "to", "add", "new", "key", "-", "values", "to", "the", "configuration", ".", "Finally", "you", "can", "call", "Write", "()", "function", "to", "write", "the", "new", "configuration", "to", "the", "file", "." ]
[ "func", "NewConfig", "(", "filename", "string", ")", "*", "Config", "{", "c", ":=", "new", "(", "Config", ")", "\n", "c", ".", "filename", "=", "filename", "\n", "c", ".", "config", "=", "make", "(", "<mask>", "[", "string", "]", "map", "[", "string", "]", "string", ")", "\n", "return", "c", "\n", "}" ]
18,528
all-18529
[ "Set", "sets", "a", "value", "for", "an", "option", "in", "a", "section", ".", "If", "the", "option", "exists", "it", "s", "value", "will", "be", "overwritten", ".", "If", "the", "option", "does", "not", "exist", "it", "will", "be", "added", ".", "If", "the", "section", "does", "not", "exist", "it", "will", "be", "added", "and", "the", "option", "added", "to", "it", "." ]
[ "func", "(", "c", "*", "Config", ")", "Set", "(", "sectionName", ",", "key", ",", "value", "string", ")", "{", "for", "i", ",", "sect", ":=", "range", "c", ".", "sections", "{", "if", "sect", ".", "name", "==", "sectionName", "{", "for", "j", ",", "opt", ":=", "range", "sect", ".", "<mask>", "{", "if", "opt", ".", "name", "==", "key", "{", "c", ".", "sections", "[", "i", "]", ".", "options", "[", "j", "]", ".", "value", "=", "value", "\n", "return", "\n", "}", "\n", "}", "\n", "c", ".", "sections", "[", "i", "]", ".", "options", "=", "append", "(", "sect", ".", "options", ",", "option", "{", "key", ",", "value", "}", ")", "\n", "return", "\n", "}", "\n", "}", "\n\n", "c", ".", "sections", "=", "append", "(", "c", ".", "sections", ",", "section", "{", "name", ":", "sectionName", ",", "options", ":", "[", "]", "option", "{", "{", "key", ",", "value", "}", "}", ",", "}", ")", "\n", "}" ]
18,529
all-18530
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetBrowserSamplingProfileParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoMemory13", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
18,530
all-18531
[ "appsToTargetGroups", "takes", "an", "array", "of", "Marathon", "apps", "and", "converts", "them", "into", "target", "groups", "." ]
[ "func", "appsToTargetGroups", "(", "apps", "*", "appList", ")", "map", "[", "string", "]", "*", "targetgroup", ".", "Group", "{", "tgroups", ":=", "map", "[", "string", "]", "*", "targetgroup", ".", "Group", "{", "}", "\n", "for", "_", ",", "a", ":=", "range", "apps", ".", "Apps", "{", "group", ":=", "createTargetGroup", "(", "&", "a", ")", "\n", "tgroups", "[", "group", ".", "<mask>", "]", "=", "group", "\n", "}", "\n", "return", "tgroups", "\n", "}" ]
18,531
all-18532
[ "Ok", "Response", "json" ]
[ "func", "(", "ctx", "*", "Context", ")", "Ok", "(", "data", "interface", "{", "}", ")", "{", "if", "ctx", ".", "written", "==", "true", "{", "log", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "\"", ":", "ctx", ".", "Request", ".", "URL", ".", "Path", "}", ")", ".", "Warnln", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "ctx", ".", "written", "=", "true", "\n", "<mask>", "json", "=", "jsoniter", ".", "ConfigCompatibleWithStandardLibrary", "\n", "b", ",", "_", ":=", "json", ".", "Marshal", "(", "&", "ResFormat", "{", "Ok", ":", "true", ",", "Data", ":", "data", "}", ")", "\n", "ctx", ".", "ResponseWriter", ".", "WriteHeader", "(", "http", ".", "StatusOK", ")", "\n", "ctx", ".", "ResponseWriter", ".", "Write", "(", "b", ")", "\n", "}" ]
18,532
all-18533
[ "Do", "executes", "DOM", ".", "getRelayoutBoundary", "against", "the", "provided", "context", ".", "returns", ":", "nodeID", "-", "Relayout", "boundary", "node", "id", "for", "the", "given", "node", "." ]
[ "func", "(", "p", "*", "GetRelayoutBoundaryParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "nodeID", "cdp", ".", "NodeID", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetRelayoutBoundaryReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetRelayoutBoundary", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "NodeID", ",", "nil", "\n", "}" ]
18,533
all-18534
[ "SetContent", "sets", "the", "regular", "expresion", "that", "should", "match", "the", "content", "of", "the", "object", "." ]
[ "func", "(", "x", "*", "Exception", ")", "SetContent", "(", "content", "string", ")", "error", "{", "contentRegexp", ",", "err", ":=", "regexp", ".", "Compile", "(", "\"", "\"", "+", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "x", ".", "Content", "=", "contentRegexp", "\n", "return", "nil", "\n", "}" ]
18,534
all-18535
[ "Value", "converts", "Duration", "to", "a", "primitive", "value", "ready", "to", "be", "written", "to", "a", "database", "." ]
[ "func", "(", "d", "Duration", ")", "Value", "(", ")", "(", "driver", ".", "Value", ",", "error", ")", "{", "return", "<mask>", ".", "Value", "(", "int64", "(", "d", ")", ")", ",", "nil", "\n", "}" ]
18,535
all-18536
[ "ENIByMac", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskEngineState", ")", "ENIByMac", "(", "arg0", "string", ")", "(", "*", "eni", ".", "ENIAttachment", ",", "bool", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "eni", ".", "ENIAttachment", ")", "\n", "ret1", ",", "_", ":=", "<mask>", "[", "1", "]", ".", "(", "bool", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
18,536
all-18537
[ "Create", "a", "new", "DNS", "server", ".", "Domain", "is", "an", "unqualified", "domain", "that", "will", "be", "used", "as", "the", "TLD", "." ]
[ "func", "NewDNSServer", "(", "domain", "string", ")", "*", "DNSServer", "{", "return", "&", "DNSServer", "{", "Domain", ":", "domain", "+", "\"", "\"", ",", "aRecords", ":", "map", "[", "string", "]", "net", ".", "IP", "{", "}", ",", "srvRecords", ":", "map", "[", "string", "]", "[", "]", "SRVRecord", "{", "}", ",", "aMutex", ":", "<mask>", ".", "RWMutex", "{", "}", ",", "srvMutex", ":", "sync", ".", "RWMutex", "{", "}", ",", "}", "\n", "}" ]
18,537
all-18538
[ "Header", "returns", "a", "copy", "of", "MailBuilder", "with", "the", "specified", "value", "added", "to", "the", "named", "header", "." ]
[ "func", "(", "p", "MailBuilder", ")", "<mask>", "(", "name", ",", "value", "string", ")", "MailBuilder", "{", "// Copy existing header map", "h", ":=", "textproto", ".", "MIMEHeader", "{", "}", "\n", "for", "k", ",", "v", ":=", "range", "p", ".", "header", "{", "h", "[", "k", "]", "=", "v", "\n", "}", "\n", "h", ".", "Add", "(", "name", ",", "value", ")", "\n", "p", ".", "header", "=", "h", "\n", "return", "p", "\n", "}" ]
18,538
all-18539
[ "PathForRefs", "determines", "the", "full", "path", "to", "where", "refs", "should", "be", "cloned" ]
[ "func", "PathForRefs", "(", "baseDir", "string", ",", "refs", "prowapi", ".", "Refs", ")", "string", "{", "<mask>", "clonePath", "string", "\n", "if", "refs", ".", "PathAlias", "!=", "\"", "\"", "{", "clonePath", "=", "refs", ".", "PathAlias", "\n", "}", "else", "{", "clonePath", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "refs", ".", "Org", ",", "refs", ".", "Repo", ")", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "baseDir", ",", "clonePath", ")", "\n", "}" ]
18,539
all-18540
[ "appendStats", "is", "used", "to", "emit", "stats", "about", "an", "AppendEntries", "invocation", "." ]
[ "func", "appendStats", "(", "peer", "string", ",", "<mask>", "time", ".", "Time", ",", "logs", "float32", ")", "{", "metrics", ".", "MeasureSince", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "peer", "}", ",", "start", ")", "\n", "metrics", ".", "IncrCounter", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "peer", "}", ",", "logs", ")", "\n", "}" ]
18,540
all-18541
[ "NewBasicAuthConnector", "creates", "a", "connector", "for", "basic", "authentication", "." ]
[ "func", "NewBasicAuthConnector", "(", "<mask>", ",", "username", ",", "password", "string", ")", "*", "Connector", "{", "c", ":=", "newConnector", "(", ")", "\n", "c", ".", "host", "=", "host", "\n", "c", ".", "username", "=", "username", "\n", "c", ".", "password", "=", "password", "\n", "return", "c", "\n", "}" ]
18,541
all-18542
[ "Handles", "message", "speed", "throtling" ]
[ "func", "(", "bot", "*", "Bot", ")", "handleOutgoingMessages", "(", ")", "{", "for", "s", ":=", "range", "bot", ".", "outgoing", "{", "bot", ".", "Debug", "(", "\"", "\"", ",", "\"", "\"", ",", "s", ")", "\n", "_", ",", "err", ":=", "fmt", ".", "Fprint", "(", "bot", ".", "con", ",", "s", "+", "\"", "\\r", "\\n", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "bot", ".", "Error", "(", "\"", "\"", ",", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n", "<mask>", ".", "Sleep", "(", "bot", ".", "ThrottleDelay", ")", "\n", "}", "\n", "}" ]
18,542
all-18543
[ "GetDbDriver", "returns", "the", "DB", "driver", "that", "was", "registered", "with", "a", "specific", "name" ]
[ "func", "GetDbDriver", "(", "<mask>", "string", ")", "(", "*", "DbDriver", ",", "error", ")", "{", "driver", ",", "ok", ":=", "dbDrivers", "[", "name", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "return", "&", "driver", ",", "nil", "\n", "}" ]
18,543
all-18544
[ "Step", "processes", "the", "incoming", "data", "from", "the", "server", "and", "makes", "the", "next", "round", "of", "data", "for", "the", "server", "available", "via", "Client", ".", "Out", ".", "Step", "returns", "false", "if", "there", "are", "no", "errors", "and", "more", "data", "is", "still", "expected", "." ]
[ "func", "(", "c", "*", "Client", ")", "Step", "(", "in", "[", "]", "byte", ")", "bool", "{", "c", ".", "out", ".", "Reset", "(", ")", "\n", "if", "c", ".", "<mask>", ">", "2", "||", "c", ".", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n", "c", ".", "step", "++", "\n", "switch", "c", ".", "step", "{", "case", "1", ":", "c", ".", "err", "=", "c", ".", "step1", "(", "in", ")", "\n", "case", "2", ":", "c", ".", "err", "=", "c", ".", "step2", "(", "in", ")", "\n", "case", "3", ":", "c", ".", "err", "=", "c", ".", "step3", "(", "in", ")", "\n", "}", "\n", "return", "c", ".", "step", ">", "2", "||", "c", ".", "err", "!=", "nil", "\n", "}" ]
18,544
all-18545
[ "JsonKeys", "takes", "an", "arbitrary", "byte", "array", "representing", "a", "json", "stringified", "object", "and", "returns", "all", "the", "keys", "of", "that", "object", "." ]
[ "func", "JsonKeys", "(", "b", "[", "]", "byte", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "keyMap", "map", "[", "string", "]", "interface", "{", "}", "\n\n", "err", ":=", "json", ".", "Unmarshal", "(", "b", ",", "&", "keyMap", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "]", "string", "{", "}", ",", "err", "\n", "}", "\n\n", "keys", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "keyMap", ")", ")", "\n", "ndx", ":=", "0", "\n", "for", "k", ":=", "range", "keyMap", "{", "<mask>", "[", "ndx", "]", "=", "k", "\n", "ndx", "++", "\n", "}", "\n", "return", "keys", ",", "nil", "\n", "}" ]
18,545
all-18546
[ "GetComparatorOk", "returns", "a", "tuple", "with", "the", "Comparator", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "DashboardConditionalFormat", ")", "GetComparatorOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "d", "==", "nil", "||", "d", ".", "Comparator", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "d", ".", "Comparator", ",", "<mask>", "\n", "}" ]
18,546
all-18547
[ "Watch", "a", "collection", "returning", "the", "current", "content", "of", "the", "collection", "as", "well", "as", "any", "future", "additions", "." ]
[ "func", "(", "c", "*", "readonlyCollection", ")", "Watch", "(", "opts", "...", "<mask>", ".", "OpOption", ")", "(", "watch", ".", "Watcher", ",", "error", ")", "{", "return", "watch", ".", "NewWatcher", "(", "c", ".", "ctx", ",", "c", ".", "etcdClient", ",", "c", ".", "prefix", ",", "c", ".", "prefix", ",", "c", ".", "template", ",", "opts", "...", ")", "\n", "}" ]
18,547
all-18548
[ "native", "()", "returns", "a", "pointer", "to", "the", "underlying", "GMenuModel", "." ]
[ "func", "(", "v", "*", "MenuModel", ")", "native", "(", ")", "*", "C", ".", "GMenuModel", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "<mask>", "nil", "\n", "}", "\n", "return", "C", ".", "toGMenuModel", "(", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", ")", "\n", "}" ]
18,548
all-18549
[ "checkMain", "verifies", "that", "there", "is", "a", "single", "main", "function", ".", "It", "also", "returns", "a", "list", "of", "all", "Go", "source", "files", "in", "the", "app", "." ]
[ "func", "checkMain", "(", "ctxt", "*", "build", ".", "Context", ")", "(", "bool", ",", "[", "]", "string", ",", "error", ")", "{", "pkg", ",", "err", ":=", "ctxt", ".", "ImportDir", "(", "*", "rootDir", ",", "0", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "!", "pkg", ".", "IsCommand", "(", ")", "{", "errorf", "(", "\"", "\\\"", "\\\"", "\\n", "\"", ",", "pkg", ".", "Name", ")", "\n", "}", "\n", "// Search for a \"func main\"", "var", "hasMain", "bool", "\n", "<mask>", "appFiles", "[", "]", "string", "\n", "for", "_", ",", "f", ":=", "range", "pkg", ".", "GoFiles", "{", "n", ":=", "filepath", ".", "Join", "(", "*", "rootDir", ",", "f", ")", "\n", "appFiles", "=", "append", "(", "appFiles", ",", "n", ")", "\n", "if", "hasMain", ",", "err", "=", "readFile", "(", "n", ")", ";", "err", "!=", "nil", "{", "return", "false", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "n", ",", "err", ")", "\n", "}", "\n", "}", "\n", "return", "hasMain", ",", "appFiles", ",", "nil", "\n", "}" ]
18,549
all-18550
[ "/", "*", "yopla" ]
[ "func", "(", "n", "ACFullname", ")", "TinyName", "(", ")", "string", "{", "split", ":=", "strings", ".", "Split", "(", "n", ".", "Name", "(", ")", ",", "\"", "\"", ")", "\n", "return", "<mask>", "[", "len", "(", "split", ")", "-", "1", "]", "\n", "}" ]
18,550
all-18551
[ "FetchIssues", "from", "GitHub", "until", "latest", "time" ]
[ "func", "(", "client", "*", "Client", ")", "FetchIssues", "(", "latest", "time", ".", "Time", ",", "c", "chan", "*", "github", ".", "Issue", ")", "{", "opt", ":=", "&", "github", ".", "IssueListByRepoOptions", "{", "Since", ":", "latest", ",", "Sort", ":", "\"", "\"", ",", "State", ":", "\"", "\"", ",", "Direction", ":", "\"", "\"", "}", "\n\n", "githubClient", ",", "err", ":=", "client", ".", "getGitHubClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "close", "(", "c", ")", "\n", "glog", ".", "Error", "(", "err", ")", "\n", "return", "\n", "}", "\n\n", "count", ":=", "0", "\n", "for", "{", "client", ".", "limitsCheckAndWait", "(", ")", "\n\n", "issues", ",", "resp", ",", "err", ":=", "githubClient", ".", "Issues", ".", "ListByRepo", "(", "context", ".", "Background", "(", ")", ",", "client", ".", "Org", ",", "client", ".", "Project", ",", "opt", ",", ")", "\n", "if", "err", "!=", "nil", "{", "close", "(", "c", ")", "\n", "glog", ".", "Error", "(", "err", ")", "\n", "return", "\n", "}", "\n\n", "for", "_", ",", "issue", ":=", "range", "issues", "{", "c", "<-", "issue", "\n", "<mask>", "++", "\n", "}", "\n\n", "if", "resp", ".", "NextPage", "==", "0", "{", "break", "\n", "}", "\n", "opt", ".", "ListOptions", ".", "Page", "=", "resp", ".", "NextPage", "\n", "}", "\n\n", "glog", ".", "Infof", "(", "\"", "\"", ",", "count", ",", "latest", ")", "\n", "close", "(", "c", ")", "\n", "}" ]
18,551
all-18552
[ "ChildAccountLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "ChildAccountLocator", "(", "href", "string", ")", "*", "ChildAccountLocator", "{", "<mask>", "&", "ChildAccountLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
18,552
all-18553
[ "WithCondition", "expression", "to", "use", "as", "a", "breakpoint", "condition", ".", "When", "specified", "debugger", "will", "only", "stop", "on", "the", "breakpoint", "if", "this", "expression", "evaluates", "to", "true", "." ]
[ "func", "(", "p", "SetBreakpointByURLParams", ")", "WithCondition", "(", "condition", "string", ")", "*", "SetBreakpointByURLParams", "{", "p", ".", "Condition", "=", "<mask>", "\n", "return", "&", "p", "\n", "}" ]
18,553
all-18554
[ "GetText", "()", "is", "a", "wrapper", "around", "gtk_entry_get_text", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetText", "(", ")", "(", "string", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_entry_get_text", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "\"", "\"", ",", "nilPtrErr", "\n", "}", "\n", "return", "goString", "(", "c", ")", ",", "nil", "\n", "}" ]
18,554
all-18555
[ "Push", "adds", "an", "element", "at", "the", "end", "of", "the", "queue", "." ]
[ "func", "(", "queue", "*", "queue", ")", "Push", "(", "element", "interface", "{", "}", ")", "{", "if", "queue", ".", "size", "==", "queue", ".", "cap", "{", "queue", ".", "resize", "(", "queue", ".", "cap", "*", "2", ")", "\n", "}", "\n\n", "<mask>", ".", "elements", "[", "queue", ".", "end", "%", "int64", "(", "queue", ".", "cap", ")", "]", "=", "element", "\n", "queue", ".", "end", "++", "\n", "queue", ".", "size", "++", "\n", "}" ]
18,555
all-18556
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetNodeForLocationReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom38", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,556
all-18557
[ "DeleteRuleSetGroupByCID", "deletes", "rule", "set", "group", "with", "passed", "cid", "." ]
[ "func", "(", "a", "*", "API", ")", "DeleteRuleSetGroupByCID", "(", "cid", "CIDType", ")", "(", "bool", ",", "error", ")", "{", "if", "cid", "==", "nil", "||", "*", "cid", "==", "\"", "\"", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "groupCID", ":=", "string", "(", "*", "cid", ")", "\n\n", "<mask>", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "RuleSetGroupCIDRegex", ",", "groupCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "groupCID", ")", "\n", "}", "\n\n", "_", ",", "err", "=", "a", ".", "Delete", "(", "groupCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n\n", "return", "true", ",", "nil", "\n", "}" ]
18,557
all-18558
[ "KVFromBytes", "extracts", "key", "-", "value", "pair", "from", "item", "bytes", "returned", "by", "iterator" ]
[ "func", "KVFromBytes", "(", "bs", "[", "]", "byte", ")", "(", "k", ",", "v", "[", "]", "<mask>", ")", "{", "klen", ":=", "int", "(", "binary", ".", "LittleEndian", ".", "Uint16", "(", "bs", "[", "0", ":", "2", "]", ")", ")", "\n", "return", "bs", "[", "2", ":", "2", "+", "klen", "]", ",", "bs", "[", "2", "+", "klen", ":", "]", "\n", "}" ]
18,558
all-18559
[ "InstanceUsagePeriodLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "InstanceUsagePeriodLocator", "(", "href", "<mask>", ")", "*", "InstanceUsagePeriodLocator", "{", "return", "&", "InstanceUsagePeriodLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
18,559
all-18560
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetApplicationCacheForFrameParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache6", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,560
all-18561
[ "dst", "must", "be", "a", "pointer", "type" ]
[ "func", "convertString", "(", "src", "string", ",", "dst", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "switch", "v", ":=", "dst", ".", "(", "type", ")", "{", "case", "*", "bool", ":", "*", "v", ",", "err", "=", "strconv", ".", "ParseBool", "(", "src", ")", "\n", "case", "*", "string", ":", "*", "v", "=", "src", "\n", "case", "*", "int", ":", "var", "tmp", "int64", "\n", "// this is a cheat, we only know int is at least 32 bits", "// but we have to make a compromise here", "tmp", ",", "err", "=", "strconv", ".", "ParseInt", "(", "src", ",", "10", ",", "32", ")", "\n", "*", "v", "=", "int", "(", "tmp", ")", "\n", "case", "*", "int8", ":", "var", "tmp", "int64", "\n", "tmp", ",", "err", "=", "strconv", ".", "ParseInt", "(", "src", ",", "10", ",", "8", ")", "\n", "*", "v", "=", "int8", "(", "tmp", ")", "\n", "<mask>", "*", "int16", ":", "var", "tmp", "int64", "\n", "tmp", ",", "err", "=", "strconv", ".", "ParseInt", "(", "src", ",", "10", ",", "16", ")", "\n", "*", "v", "=", "int16", "(", "tmp", ")", "\n", "case", "*", "int32", ":", "var", "tmp", "int64", "\n", "tmp", ",", "err", "=", "strconv", ".", "ParseInt", "(", "src", ",", "10", ",", "32", ")", "\n", "*", "v", "=", "int32", "(", "tmp", ")", "\n", "case", "*", "int64", ":", "var", "tmp", "int64", "\n", "tmp", ",", "err", "=", "strconv", ".", "ParseInt", "(", "src", ",", "10", ",", "64", ")", "\n", "*", "v", "=", "int64", "(", "tmp", ")", "\n", "case", "*", "uint", ":", "var", "tmp", "uint64", "\n", "// this is a cheat, we only know uint is at least 32 bits", "// but we have to make a compromise here", "tmp", ",", "err", "=", "strconv", ".", "ParseUint", "(", "src", ",", "10", ",", "32", ")", "\n", "*", "v", "=", "uint", "(", "tmp", ")", "\n", "case", "*", "uint8", ":", "var", "tmp", "uint64", "\n", "tmp", ",", "err", "=", "strconv", ".", "ParseUint", "(", "src", ",", "10", ",", "8", ")", "\n", "*", "v", "=", "uint8", "(", "tmp", ")", "\n", "case", "*", "uint16", ":", "var", "tmp", "uint64", "\n", "tmp", ",", "err", "=", "strconv", ".", "ParseUint", "(", "src", ",", "10", ",", "16", ")", "\n", "*", "v", "=", "uint16", "(", "tmp", ")", "\n", "case", "*", "uint32", ":", "var", "tmp", "uint64", "\n", "tmp", ",", "err", "=", "strconv", ".", "ParseUint", "(", "src", ",", "10", ",", "32", ")", "\n", "*", "v", "=", "uint32", "(", "tmp", ")", "\n", "case", "*", "uint64", ":", "var", "tmp", "uint64", "\n", "tmp", ",", "err", "=", "strconv", ".", "ParseUint", "(", "src", ",", "10", ",", "64", ")", "\n", "*", "v", "=", "uint64", "(", "tmp", ")", "\n", "// hmm, collides with uint8", "// case *byte:", "// \ttmp := []byte(src)", "// \tif len(tmp) == 1 {", "// \t\t*v = tmp[0]", "// \t} else {", "// \t\terr = fmt.Errorf(\"Cannot convert string %q to byte, length: %d\", src, len(tmp))", "// \t}", "// hmm, collides with int32", "// case *rune:", "// \ttmp := []rune(src)", "// \tif len(tmp) == 1 {", "// \t\t*v = tmp[0]", "// \t} else {", "// \t\terr = fmt.Errorf(\"Cannot convert string %q to rune, lengt: %d\", src, len(tmp))", "// \t}", "case", "*", "float32", ":", "var", "tmp", "float64", "\n", "tmp", ",", "err", "=", "strconv", ".", "ParseFloat", "(", "src", ",", "32", ")", "\n", "*", "v", "=", "float32", "(", "tmp", ")", "\n", "case", "*", "float64", ":", "var", "tmp", "float64", "\n", "tmp", ",", "err", "=", "strconv", ".", "ParseFloat", "(", "src", ",", "64", ")", "\n", "*", "v", "=", "float64", "(", "tmp", ")", "\n", "default", ":", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "src", ",", "dst", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
18,561
all-18562
[ "Run", "the", "http", "server", ".", "Listening", "on", "os", ".", "GetEnv", "(", "PORT", ")", "or", "3000", "by", "default", "." ]
[ "func", "(", "m", "*", "Martini", ")", "Run", "(", ")", "{", "port", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "port", "==", "\"", "\"", "{", "port", "=", "\"", "\"", "\n", "}", "\n\n", "host", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n\n", "logger", ":=", "m", ".", "Injector", ".", "Get", "(", "reflect", ".", "TypeOf", "(", "m", ".", "logger", ")", ")", ".", "Interface", "(", ")", ".", "(", "*", "log", ".", "Logger", ")", "\n\n", "logger", ".", "Printf", "(", "\"", "\\n", "\"", ",", "host", ",", "port", ",", "Env", ")", "\n", "logger", ".", "Fatalln", "(", "<mask>", ".", "ListenAndServe", "(", "host", "+", "\"", "\"", "+", "port", ",", "m", ")", ")", "\n", "}" ]
18,562
all-18563
[ "LoadPublicKey", "loads", "a", "public", "key", "from", "PEM", "/", "DER", "-", "encoded", "data", "." ]
[ "func", "LoadPublicKey", "(", "data", "[", "]", "byte", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "input", ":=", "data", "\n\n", "block", ",", "_", ":=", "pem", ".", "Decode", "(", "data", ")", "\n", "if", "block", "!=", "nil", "{", "input", "=", "block", ".", "Bytes", "\n", "}", "\n\n", "// Try to load SubjectPublicKeyInfo", "pub", ",", "err0", ":=", "x509", ".", "ParsePKIXPublicKey", "(", "input", ")", "\n", "if", "err0", "==", "nil", "{", "return", "pub", ",", "nil", "\n", "}", "\n\n", "cert", ",", "err1", ":=", "x509", ".", "ParseCertificate", "(", "input", ")", "\n", "if", "err1", "==", "nil", "{", "return", "<mask>", ".", "PublicKey", ",", "nil", "\n", "}", "\n\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err0", ",", "err1", ")", "\n", "}" ]
18,563
all-18564
[ "ConvertToUTF8String", "uses", "the", "provided", "charset", "to", "decode", "a", "slice", "of", "bytes", "into", "a", "normal", "UTF", "-", "8", "string", "." ]
[ "func", "ConvertToUTF8String", "(", "charset", "string", ",", "textBytes", "[", "]", "byte", ")", "(", "string", ",", "error", ")", "{", "if", "strings", ".", "ToLower", "(", "charset", ")", "==", "utf8", "{", "return", "string", "(", "textBytes", ")", ",", "nil", "\n", "}", "\n", "csentry", ",", "ok", ":=", "encodings", "[", "strings", ".", "ToLower", "(", "charset", ")", "]", "\n", "if", "!", "ok", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "charset", ")", "\n", "}", "\n", "input", ":=", "bytes", ".", "NewReader", "(", "textBytes", ")", "\n", "reader", ":=", "transform", ".", "NewReader", "(", "<mask>", ",", "csentry", ".", "e", ".", "NewDecoder", "(", ")", ")", "\n", "output", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "reader", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "string", "(", "output", ")", ",", "nil", "\n", "}" ]
18,564
all-18565
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "i", "*", "ImageDefinition", ")", "GetType", "(", ")", "string", "{", "if", "i", "==", "nil", "||", "i", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "i", ".", "Type", "\n", "}" ]
18,565
all-18566
[ "truncate", "contains", "the", "DT", "function", "from", "the", "RFC", ";", "this", "is", "used", "to", "deterministically", "select", "a", "sequence", "of", "4", "bytes", "from", "the", "HMAC", "counter", "hash", "." ]
[ "func", "truncate", "(", "in", "[", "]", "byte", ")", "int64", "{", "offset", ":=", "int", "(", "<mask>", "[", "len", "(", "in", ")", "-", "1", "]", "&", "0xF", ")", "\n", "p", ":=", "in", "[", "offset", ":", "offset", "+", "4", "]", "\n", "var", "binCode", "int32", "\n", "binCode", "=", "int32", "(", "(", "p", "[", "0", "]", "&", "0x7f", ")", ")", "<<", "24", "\n", "binCode", "+=", "int32", "(", "(", "p", "[", "1", "]", "&", "0xff", ")", ")", "<<", "16", "\n", "binCode", "+=", "int32", "(", "(", "p", "[", "2", "]", "&", "0xff", ")", ")", "<<", "8", "\n", "binCode", "+=", "int32", "(", "(", "p", "[", "3", "]", "&", "0xff", ")", ")", "\n", "return", "int64", "(", "binCode", ")", "&", "0x7FFFFFFF", "\n", "}" ]
18,566
all-18567
[ "RunWithMatchf", "is", "like", "RunWithMatch", "but", "formats", "its", "arguments", "according", "to", "the", "format", ".", "Analogous", "to", "Printf", "()", "." ]
[ "func", "RunWithMatchf", "(", "format", "string", ",", "args", "...", "<mask>", "{", "}", ")", "(", "[", "]", "byte", ",", "bool", ",", "error", ")", "{", "return", "RunWithMatch", "(", "fmt", ".", "Sprintf", "(", "format", ",", "args", "...", ")", ")", "\n", "}" ]
18,567
all-18568
[ "EditOrgHook", "updates", "an", "existing", "hook", "with", "new", "info", "(", "events", "/", "url", "/", "secret", ")", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "orgs", "/", "hooks", "/", "#edit", "-", "a", "-", "hook" ]
[ "func", "(", "c", "*", "Client", ")", "EditOrgHook", "(", "org", "string", ",", "id", "int", ",", "req", "HookRequest", ")", "error", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "<mask>", ")", "\n", "return", "c", ".", "editHook", "(", "org", ",", "nil", ",", "id", ",", "req", ")", "\n", "}" ]
18,568
all-18569
[ "SetActiveCustomItem", "()", "is", "a", "wrapper", "around", "gtk_app_chooser_button_set_active_custom_item", "()", "." ]
[ "func", "(", "v", "*", "AppChooserButton", ")", "SetActiveCustomItem", "(", "name", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "<mask>", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_app_chooser_button_set_active_custom_item", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
18,569
all-18570
[ "MarshalJSON", "implements", "json", ".", "Marshaler", ".", "It", "will", "encode", "null", "if", "this", "Bool", "is", "null", "." ]
[ "func", "(", "b", "Bool", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "if", "!", "b", ".", "Valid", "{", "return", "[", "]", "byte", "(", "\"", "\"", ")", ",", "nil", "\n", "}", "\n", "if", "!", "b", ".", "Bool", "{", "return", "[", "]", "byte", "(", "\"", "\"", ")", ",", "nil", "\n", "}", "\n", "return", "[", "]", "byte", "(", "\"", "\"", ")", ",", "nil", "\n", "}" ]
18,570
all-18571
[ "CurrentMark", "returns", "the", "mark", "stored", "at", "the", "top", "of", "the", "mark", "stack" ]
[ "func", "(", "st", "*", "State", ")", "CurrentMark", "(", ")", "int", "{", "x", ",", "err", ":=", "st", ".", "markstack", ".", "Top", "(", ")", "\n", "if", "<mask>", "!=", "nil", "{", "x", "=", "0", "\n", "}", "\n", "return", "x", ".", "(", "int", ")", "\n", "}" ]
18,571
all-18572
[ "Endpoints", "lists", "the", "registered", "endpoints", "for", "the", "client", "." ]
[ "func", "(", "c", "*", "Client", ")", "Endpoints", "(", ")", "[", "]", "string", "{", "// copy the slice; protect original endpoints from being changed", "c", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "RUnlock", "(", ")", "\n", "eps", ":=", "<mask>", "(", "[", "]", "string", ",", "len", "(", "c", ".", "cfg", ".", "Endpoints", ")", ")", "\n", "copy", "(", "eps", ",", "c", ".", "cfg", ".", "Endpoints", ")", "\n", "return", "eps", "\n", "}" ]
18,572
all-18573
[ "HasId", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "SyntheticsDevice", ")", "HasId", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Id", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
18,573
all-18574
[ "GetProjects", "returns", "a", "list", "of", "available", "Project", "structs" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetProjects", "(", ")", "(", "[", "]", "api", ".", "Project", ",", "error", ")", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "projects", ":=", "[", "]", "api", ".", "Project", "{", "}", "\n\n", "// Fetch the raw value", "_", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "\"", "\"", ",", "&", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "projects", ",", "nil", "\n", "}" ]
18,574
all-18575
[ "SetAddressHeader", "sets", "an", "address", "to", "the", "given", "header", "field", "." ]
[ "func", "(", "m", "*", "Message", ")", "SetAddressHeader", "(", "field", ",", "address", ",", "name", "string", ")", "{", "m", ".", "header", "[", "field", "]", "=", "[", "]", "string", "{", "m", ".", "FormatAddress", "(", "<mask>", ",", "name", ")", "}", "\n", "}" ]
18,575
all-18576
[ "GetReqID", "returns", "a", "request", "ID", "from", "the", "given", "context", "if", "one", "is", "present", ".", "Returns", "the", "empty", "string", "if", "a", "request", "ID", "cannot", "be", "found", "." ]
[ "func", "GetReqID", "(", "ctx", "context", ".", "<mask>", ")", "string", "{", "if", "ctx", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "if", "reqID", ",", "ok", ":=", "ctx", ".", "Value", "(", "RequestIDKey", ")", ".", "(", "string", ")", ";", "ok", "{", "return", "reqID", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
18,576
all-18577
[ "UpdateUser", "updates", "user", "information" ]
[ "func", "(", "c", "*", "Client", ")", "UpdateUser", "(", "userid", "string", ",", "obj", "<mask>", ")", "(", "*", "User", ",", "error", ")", "{", "url", ":=", "umUsersPath", "(", "userid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "User", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Put", "(", "url", ",", "obj", ",", "ret", ",", "http", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
18,577
all-18578
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CompositingReasonsReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree19", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
18,578
all-18579
[ "FindLabelsForFile", "returns", "a", "set", "of", "labels", "which", "should", "be", "applied", "to", "PRs", "modifying", "files", "under", "the", "given", "path", "." ]
[ "func", "(", "o", "*", "RepoOwners", ")", "FindLabelsForFile", "(", "path", "string", ")", "sets", ".", "<mask>", "{", "return", "o", ".", "entriesForFile", "(", "path", ",", "o", ".", "labels", ",", "false", ")", "\n", "}" ]
18,579
all-18580
[ "manifestSchema1FromComponents", "builds", "a", "new", "manifestSchema1", "from", "the", "supplied", "data", "." ]
[ "func", "manifestSchema1FromComponents", "(", "<mask>", "reference", ".", "Named", ",", "fsLayers", "[", "]", "manifest", ".", "Schema1FSLayers", ",", "history", "[", "]", "manifest", ".", "Schema1History", ",", "architecture", "string", ")", "(", "genericManifest", ",", "error", ")", "{", "m", ",", "err", ":=", "manifest", ".", "Schema1FromComponents", "(", "ref", ",", "fsLayers", ",", "history", ",", "architecture", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "manifestSchema1", "{", "m", ":", "m", "}", ",", "nil", "\n", "}" ]
18,580
all-18581
[ "GetTransferAllUserCommentsOk", "returns", "a", "tuple", "with", "the", "TransferAllUserComments", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "ChannelSlackRequest", ")", "GetTransferAllUserCommentsOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "c", "==", "nil", "||", "c", ".", "TransferAllUserComments", "==", "nil", "{", "return", "false", ",", "<mask>", "\n", "}", "\n", "return", "*", "c", ".", "TransferAllUserComments", ",", "true", "\n", "}" ]
18,581
all-18582
[ "There", "are", "multiple", "classes", "of", "endings", "that", "must", "be", "preceded", "by", "а", "(", "a", ")", "or", "я", "(", "ia", ")", "in", "RV", "in", "order", "to", "be", "removed", "." ]
[ "func", "precededByARinRV", "(", "word", "*", "snowballword", ".", "SnowballWord", ",", "suffixLen", "int", ")", "bool", "{", "idx", ":=", "len", "(", "word", ".", "RS", ")", "-", "suffixLen", "-", "1", "\n", "if", "idx", ">=", "word", ".", "RVstart", "&&", "(", "<mask>", ".", "RS", "[", "idx", "]", "==", "'а' ", "| ", "ord.", "R", "S[", "i", "dx]", " ", "= ", "я') ", "{", "", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
18,582
all-18583
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetPartialAXTreeReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility5", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
18,583
all-18584
[ "New", "returns", "a", "client", "that", "uses", "RL10", "authentication", ".", "accountId", "host", "and", "auth", "arguments", "are", "not", "used", ".", "If", "no", "HTTP", "client", "is", "specified", "then", "the", "default", "client", "is", "used", "." ]
[ "func", "New", "(", "host", "string", ",", "auth", "rsapi", ".", "Authenticator", ")", "*", "API", "{", "return", "fromAPI", "(", "rsapi", ".", "New", "(", "<mask>", ",", "auth", ")", ")", "\n", "}" ]
18,584
all-18585
[ "EditCmd", "represents", "edit", "command" ]
[ "func", "EditCmd", "(", ")", "*", "cobra", ".", "Command", "{", "var", "eo", "=", "&", "cli", ".", "EditOptions", "{", "}", "\n", "var", "editCmd", "=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Long", ":", "`Use this command to edit a state.`", ",", "Run", ":", "func", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "switch", "len", "(", "args", ")", "{", "case", "0", ":", "eo", ".", "Name", "=", "viper", ".", "GetString", "(", "keyKubicornName", ")", "\n", "case", "1", ":", "eo", ".", "Name", "=", "args", "[", "0", "]", "\n", "default", ":", "logger", ".", "Critical", "(", "\"", "\"", ")", "\n", "os", ".", "Exit", "(", "1", ")", "\n", "}", "\n\n", "if", "err", ":=", "runEdit", "(", "eo", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Critical", "(", "err", ".", "Error", "(", ")", ")", "\n", "os", ".", "Exit", "(", "1", ")", "\n", "}", "\n\n", "}", ",", "}", "\n\n", "fs", ":=", "editCmd", ".", "Flags", "(", ")", "\n\n", "bindCommonStateStoreFlags", "(", "&", "eo", ".", "StateStoreOptions", ",", "fs", ")", "\n", "bindCommonAwsFlags", "(", "&", "eo", ".", "AwsOptions", ",", "fs", ")", "\n\n", "<mask>", ".", "StringVarP", "(", "&", "eo", ".", "Editor", ",", "keyEditor", ",", "\"", "\"", ",", "viper", ".", "GetString", "(", "keyEditor", ")", ",", "descEditor", ")", "\n", "fs", ".", "StringVar", "(", "&", "eo", ".", "GitRemote", ",", "keyGitConfig", ",", "viper", ".", "GetString", "(", "keyGitConfig", ")", ",", "descGitConfig", ")", "\n\n", "return", "editCmd", "\n", "}" ]
18,585
all-18586
[ "BatchUpdate", "updates", "multiple", "rows", "by", "id" ]
[ "func", "(", "s", "RethinkStore", ")", "BatchUpdate", "(", "ids", "[", "]", "interface", "{", "}", ",", "data", "[", "]", "interface", "{", "}", ",", "<mask>", "string", ",", "opts", "ObjectStoreOptions", ")", "(", "err", "error", ")", "{", "_", ",", "err", "=", "r", ".", "DB", "(", "s", ".", "Database", ")", ".", "Table", "(", "store", ")", ".", "GetAll", "(", "ids", "...", ")", ".", "Update", "(", "func", "(", "row", "r", ".", "Term", ")", "interface", "{", "}", "{", "lenArgs", ":=", "len", "(", "ids", ")", "*", "2", "\n", "args", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "lenArgs", "+", "1", ")", "\n", "for", "k", ",", "v", ":=", "range", "ids", "{", "first", ":=", "k", "*", "2", "\n", "second", ":=", "first", "+", "1", "\n", "args", "[", "first", "]", "=", "row", ".", "Field", "(", "\"", "\"", ")", ".", "Eq", "(", "v", ".", "(", "string", ")", ")", "\n", "args", "[", "second", "]", "=", "data", "[", "k", "]", "\n", "}", "\n", "args", "[", "lenArgs", "]", "=", "nil", "\n", "return", "r", ".", "Branch", "(", "args", "...", ")", "\n", "}", ",", "r", ".", "UpdateOpts", "{", "Durability", ":", "\"", "\"", "}", ")", ".", "RunWrite", "(", "s", ".", "Session", ")", "\n", "// if res.Updated < len(ids) {", "// \terr = ErrNotAllDeleted", "// }", "return", "\n", "}" ]
18,586
all-18587
[ "Delete", "removes", "key", "forever", "but", "we", "must", "present", "the", "proper", "passphrase", "before", "deleting", "it", "(", "for", "security", ")", ".", "A", "passphrase", "of", "yes", "is", "used", "to", "delete", "stored", "references", "to", "offline", "and", "Ledger", "/", "HW", "wallet", "keys" ]
[ "func", "(", "kb", "dbKeybase", ")", "Delete", "(", "name", ",", "passphrase", "string", ")", "error", "{", "// verify we have the proper password before deleting", "info", ",", "err", ":=", "kb", ".", "Get", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "switch", "info", ".", "(", "<mask>", ")", "{", "case", "localInfo", ":", "linfo", ":=", "info", ".", "(", "localInfo", ")", "\n", "_", ",", "err", "=", "unarmorDecryptPrivKey", "(", "linfo", ".", "PrivKeyArmor", ",", "passphrase", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "kb", ".", "db", ".", "DeleteSync", "(", "infoKey", "(", "name", ")", ")", "\n", "return", "nil", "\n", "case", "ledgerInfo", ":", "case", "offlineInfo", ":", "if", "passphrase", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "kb", ".", "db", ".", "DeleteSync", "(", "infoKey", "(", "name", ")", ")", "\n", "return", "nil", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,587
all-18588
[ "ClientMapFromFile", "reads", "the", "file", "at", "clustersPath", "and", "attempts", "to", "load", "a", "map", "of", "cluster", "aliases", "to", "authenticated", "clients", "to", "the", "respective", "clusters", ".", "The", "file", "at", "clustersPath", "is", "expected", "to", "be", "a", "yaml", "map", "from", "strings", "to", "Cluster", "structs", "OR", "it", "may", "simply", "be", "a", "single", "Cluster", "struct", "which", "will", "be", "assigned", "the", "alias", "$DefaultClusterAlias", ".", "If", "the", "file", "is", "an", "alias", "map", "it", "must", "include", "the", "alias", "$DefaultClusterAlias", "." ]
[ "func", "ClientMapFromFile", "(", "clustersPath", ",", "namespace", "string", ")", "(", "map", "[", "string", "]", "*", "Client", ",", "error", ")", "{", "data", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "clustersPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "raw", ",", "err", ":=", "UnmarshalClusterMap", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "foundDefault", ":=", "false", "\n", "result", ":=", "map", "[", "string", "]", "*", "Client", "{", "}", "\n", "for", "alias", ",", "config", ":=", "range", "raw", "{", "client", ",", "err", ":=", "newClient", "(", "&", "config", ",", "namespace", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "alias", ",", "clustersPath", ",", "err", ")", "\n", "}", "\n", "result", "[", "alias", "]", "=", "client", "\n", "if", "alias", "==", "DefaultClusterAlias", "{", "foundDefault", "=", "true", "\n", "}", "\n", "}", "\n", "if", "!", "foundDefault", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "DefaultClusterAlias", ",", "clustersPath", ")", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
18,588
all-18589
[ "Make", "sure", "the", "local", "WriteHeader", "is", "called", "and", "call", "the", "parent", "Write", ".", "Provided", "in", "order", "to", "implement", "the", "http", ".", "ResponseWriter", "interface", "." ]
[ "func", "(", "w", "*", "jsonIndentResponseWriter", ")", "Write", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "if", "!", "w", ".", "wroteHeader", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusOK", ")", "\n", "}", "\n", "<mask>", ":=", "w", ".", "ResponseWriter", ".", "(", "http", ".", "ResponseWriter", ")", "\n", "return", "writer", ".", "Write", "(", "b", ")", "\n", "}" ]
18,589
all-18590
[ "PutFloat64", "writes", "a", "64", "-", "bit", "float", "(", "or", "double", "in", "some", "languages", ")", "for", "the", "given", "string", "field", ".", "The", "field", "type", "must", "be", "Float64Field", "otherwise", "an", "error", "is", "returned", ".", "The", "type", "code", "is", "written", "first", "then", "the", "value", ".", "Upon", "success", "the", "number", "of", "bytes", "written", "is", "returned", "along", "with", "a", "nil", "error", "." ]
[ "func", "(", "b", "*", "TupleBuilder", ")", "PutFloat64", "(", "field", "string", ",", "value", "float64", ")", "(", "wrote", "uint64", ",", "err", "error", ")", "{", "// field type should be", "if", "err", "=", "b", ".", "typeCheck", "(", "field", ",", "Float64Field", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "// write value", "// length check performed by xbinary", "wrote", ",", "err", "=", "xbinary", ".", "LittleEndian", ".", "PutFloat64", "(", "b", ".", "buffer", ",", "b", ".", "<mask>", "+", "1", ",", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "// write type code", "b", ".", "buffer", "[", "b", ".", "pos", "]", "=", "byte", "(", "DoubleCode", ".", "OpCode", ")", "\n\n", "// set field offset", "b", ".", "offsets", "[", "field", "]", "=", "b", ".", "pos", "\n\n", "// incr pos", "b", ".", "pos", "+=", "9", "\n\n", "return", "9", ",", "nil", "\n", "}" ]
18,590
all-18591
[ "Event", "()", "is", "a", "wrapper", "around", "gtk_text_tag_event", "()", "." ]
[ "func", "(", "v", "*", "TextTag", ")", "Event", "(", "eventObject", "*", "glib", ".", "Object", ",", "event", "*", "gdk", ".", "Event", ",", "iter", "*", "TextIter", ")", "bool", "{", "ok", ":=", "C", ".", "gtk_text_tag_event", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "GObject", ")", "(", "unsafe", ".", "Pointer", "(", "eventObject", ".", "Native", "(", ")", ")", ")", ",", "(", "*", "C", ".", "GdkEvent", ")", "(", "unsafe", ".", "Pointer", "(", "event", ".", "Native", "(", ")", ")", ")", ",", "(", "*", "C", ".", "GtkTextIter", ")", "(", "iter", ")", ",", ")", "\n", "return", "gobool", "(", "<mask>", ")", "\n", "}" ]
18,591
all-18592
[ "close", "is", "the", "internal", "close", "function", "called", "by", "ContextCloser", ".", "Close" ]
[ "func", "(", "c", "*", "singleConn", ")", "Close", "(", ")", "error", "{", "c", ".", "eventMu", ".", "Lock", "(", ")", "\n", "if", "c", ".", "event", "!=", "nil", "{", "evt", ":=", "c", ".", "event", "\n", "c", ".", "<mask>", "=", "nil", "\n", "defer", "evt", ".", "Close", "(", ")", "\n", "}", "\n", "c", ".", "eventMu", ".", "Unlock", "(", ")", "\n\n", "// close underlying connection", "return", "c", ".", "maconn", ".", "Close", "(", ")", "\n", "}" ]
18,592
all-18593
[ "Fetch", "queries", "the", "Consul", "API", "defined", "by", "the", "given", "client", "and", "returns", "a", "slice", "of", "strings", "representing", "the", "datacenters" ]
[ "func", "(", "d", "*", "CatalogDatacentersQuery", ")", "Fetch", "(", "clients", "*", "ClientSet", ",", "opts", "*", "QueryOptions", ")", "(", "interface", "{", "}", ",", "*", "ResponseMetadata", ",", "error", ")", "{", "opts", "=", "opts", ".", "Merge", "(", "&", "QueryOptions", "{", "}", ")", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "d", ",", "&", "url", ".", "URL", "{", "Path", ":", "\"", "\"", ",", "RawQuery", ":", "opts", ".", "String", "(", ")", ",", "}", ")", "\n\n", "// This is pretty ghetto, but the datacenters endpoint does not support", "// blocking queries, so we are going to \"fake it until we make it\". When we", "// first query, the LastIndex will be \"0\", meaning we should immediately", "// return data, but future calls will include a LastIndex. If we have a", "// LastIndex in the query metadata, sleep for 15 seconds before asking Consul", "// again.", "//", "// This is probably okay given the frequency in which datacenters actually", "// change, but is technically not edge-triggering.", "if", "opts", ".", "WaitIndex", "!=", "0", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "d", ",", "CatalogDatacentersQuerySleepTime", ")", "\n\n", "select", "{", "case", "<-", "d", ".", "stopCh", ":", "return", "nil", ",", "nil", ",", "ErrStopped", "\n", "case", "<-", "time", ".", "After", "(", "CatalogDatacentersQuerySleepTime", ")", ":", "}", "\n", "}", "\n\n", "<mask>", ",", "err", ":=", "clients", ".", "Consul", "(", ")", ".", "Catalog", "(", ")", ".", "Datacenters", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "d", ".", "String", "(", ")", ")", "\n", "}", "\n\n", "// If the user opted in for skipping \"down\" datacenters, figure out which", "// datacenters are down.", "if", "d", ".", "ignoreFailing", "{", "dcs", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "result", ")", ")", "\n", "for", "_", ",", "dc", ":=", "range", "result", "{", "if", "_", ",", "_", ",", "err", ":=", "clients", ".", "Consul", "(", ")", ".", "Catalog", "(", ")", ".", "Services", "(", "&", "api", ".", "QueryOptions", "{", "Datacenter", ":", "dc", ",", "AllowStale", ":", "false", ",", "RequireConsistent", ":", "true", ",", "}", ")", ";", "err", "==", "nil", "{", "dcs", "=", "append", "(", "dcs", ",", "dc", ")", "\n", "}", "\n", "}", "\n", "result", "=", "dcs", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "d", ",", "len", "(", "result", ")", ")", "\n\n", "sort", ".", "Strings", "(", "result", ")", "\n\n", "return", "respWithMetadata", "(", "result", ")", "\n", "}" ]
18,593
all-18594
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventBackgroundServiceEventReceived", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice5", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,594
all-18595
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "DeleteCacheParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCachestorage8", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,595
all-18596
[ "Start", "the", "worker" ]
[ "func", "(", "w", "*", "Simple", ")", "Start", "(", "ctx", "context", ".", "<mask>", ")", "error", "{", "w", ".", "Logger", ".", "Info", "(", "\"", "\"", ")", "\n", "w", ".", "ctx", ",", "w", ".", "cancel", "=", "context", ".", "WithCancel", "(", "ctx", ")", "\n", "return", "nil", "\n", "}" ]
18,596
all-18597
[ "Destroy", "destroys", "a", "ZFS", "zpool", "by", "name", "." ]
[ "func", "(", "z", "*", "Zpool", ")", "Destroy", "(", ")", "error", "{", "_", ",", "err", ":=", "zpool", "(", "\"", "\"", ",", "z", ".", "<mask>", ")", "\n", "return", "err", "\n", "}" ]
18,597
all-18598
[ "AlignColorizedText", "does", "the", "same", "as", "AlignText", "does", "but", "it", "preserves", "the", "color", "of", "the", "letters", "by", "adding", "correct", "color", "tags", "to", "the", "line", "beginning", ".", "Note", ":", "function", "is", "ineffective", "and", "a", "bit", "slow", "-", "do", "not", "use", "it", "everywhere" ]
[ "func", "AlignColorizedText", "(", "str", "string", ",", "width", "int", ",", "align", "Align", ")", "(", "int", ",", "string", ")", "{", "rawText", ":=", "UnColorizeText", "(", "str", ")", "\n", "length", ":=", "xs", ".", "Len", "(", "rawText", ")", "\n\n", "if", "length", "<=", "width", "{", "shift", ",", "_", ":=", "AlignText", "(", "rawText", ",", "<mask>", ",", "align", ")", "\n", "return", "shift", ",", "str", "\n", "}", "\n\n", "skip", ":=", "0", "\n", "if", "align", "==", "AlignRight", "{", "skip", "=", "length", "-", "width", "\n", "}", "else", "if", "align", "==", "AlignCenter", "{", "skip", "=", "(", "length", "-", "width", ")", "/", "2", "\n", "}", "\n\n", "fgChanged", ",", "bgChanged", ":=", "false", ",", "false", "\n", "curr", ":=", "0", "\n", "parser", ":=", "NewColorParser", "(", "str", ",", "term", ".", "ColorBlack", ",", "term", ".", "ColorBlack", ")", "\n", "out", ":=", "\"", "\"", "\n", "for", "curr", "<", "skip", "+", "width", "{", "elem", ":=", "parser", ".", "NextElement", "(", ")", "\n\n", "if", "elem", ".", "Type", "==", "ElemEndOfText", "{", "break", "\n", "}", "\n\n", "if", "elem", ".", "Type", "==", "ElemPrintable", "{", "curr", "++", "\n", "if", "curr", "==", "skip", "+", "1", "{", "if", "fgChanged", "{", "out", "+=", "\"", "\"", "+", "ColorToString", "(", "elem", ".", "Fg", ")", "+", "\"", "\"", "\n", "}", "\n", "if", "bgChanged", "{", "out", "+=", "\"", "\"", "+", "ColorToString", "(", "elem", ".", "Bg", ")", "+", "\"", "\"", "\n", "}", "\n", "out", "+=", "string", "(", "elem", ".", "Ch", ")", "\n", "}", "else", "if", "curr", ">", "skip", "+", "1", "{", "out", "+=", "string", "(", "elem", ".", "Ch", ")", "\n", "}", "\n", "}", "else", "if", "elem", ".", "Type", "==", "ElemTextColor", "{", "fgChanged", "=", "true", "\n", "if", "curr", ">", "skip", "+", "1", "{", "out", "+=", "\"", "\"", "+", "ColorToString", "(", "elem", ".", "Fg", ")", "+", "\"", "\"", "\n", "}", "\n", "}", "else", "if", "elem", ".", "Type", "==", "ElemBackColor", "{", "bgChanged", "=", "true", "\n", "if", "curr", ">", "skip", "+", "1", "{", "out", "+=", "\"", "\"", "+", "ColorToString", "(", "elem", ".", "Bg", ")", "+", "\"", "\"", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "0", ",", "out", "\n", "}" ]
18,598
all-18599
[ "getSystemHandler", "on", "Windows", "does", "nothing", "." ]
[ "func", "getSystemHandler", "(", "syslog", "string", ",", "debug", "bool", ",", "format", "<mask>", ".", "Format", ")", "log", ".", "Handler", "{", "return", "nil", "\n", "}" ]
18,599
all-18600
[ "CouldRun", "determines", "if", "the", "postsubmit", "could", "run", "against", "a", "specific", "base", "ref" ]
[ "func", "(", "ps", "Postsubmit", ")", "CouldRun", "(", "baseRef", "string", ")", "bool", "{", "return", "<mask>", ".", "Brancher", ".", "ShouldRun", "(", "baseRef", ")", "\n", "}" ]