id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
7,100
all-7101
[ "openLast", "opens", "the", "last", "wal", "file", "for", "read", "and", "write", "." ]
[ "func", "openLast", "(", "lg", "*", "zap", ".", "Logger", ",", "dirpath", "string", ")", "(", "*", "fileutil", ".", "LockedFile", ",", "error", ")", "{", "names", ",", "err", ":=", "readWALNames", "(", "lg", ",", "dirpath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "last", ":=", "filepath", ".", "Join", "(", "dirpath", ",", "<mask>", "[", "len", "(", "names", ")", "-", "1", "]", ")", "\n", "return", "fileutil", ".", "LockFile", "(", "last", ",", "os", ".", "O_RDWR", ",", "fileutil", ".", "PrivateFileMode", ")", "\n", "}" ]
7,101
all-7102
[ "PushNoteToChannel", "pushes", "a", "note", "with", "title", "and", "body", "to", "a", "specific", "PushBullet", "channel", "." ]
[ "func", "(", "c", "*", "Client", ")", "PushNoteToChannel", "(", "tag", "string", ",", "title", ",", "body", "string", ")", "error", "{", "data", ":=", "Note", "{", "Tag", ":", "<mask>", ",", "Type", ":", "\"", "\"", ",", "Title", ":", "title", ",", "Body", ":", "body", ",", "}", "\n", "return", "c", ".", "Push", "(", "\"", "\"", ",", "data", ")", "\n", "}" ]
7,102
all-7103
[ "NewMockClientCreator", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockClientCreator", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockClientCreator", "{", "mock", ":=", "&", "MockClientCreator", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockClientCreatorMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
7,103
all-7104
[ "Body", "sets", "the", "request", "body", "to", "the", "given", "reader", "." ]
[ "func", "(", "r", "*", "RequestBuilder", ")", "Body", "(", "body", "io", ".", "Reader", ")", "*", "RequestBuilder", "{", "r", ".", "body", "=", "<mask>", "\n", "return", "r", "\n", "}" ]
7,104
all-7105
[ "SetClip", "is", "a", "wrapper", "around", "gtk_widget_set_clip", "()", "." ]
[ "func", "(", "v", "*", "Widget", ")", "SetClip", "(", "<mask>", "*", "Allocation", ")", "{", "C", ".", "gtk_widget_set_clip", "(", "v", ".", "native", "(", ")", ",", "clip", ".", "native", "(", ")", ")", "\n", "}" ]
7,105
all-7106
[ "GetShowBorder", "()", "is", "a", "wrapper", "around", "gtk_notebook_get_show_border", "()", "." ]
[ "func", "(", "v", "*", "Notebook", ")", "GetShowBorder", "(", ")", "bool", "{", "c", ":=", "C", ".", "gtk_notebook_get_show_border", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
7,106
all-7107
[ "HandleEvent", "is", "a", "wrapper", "around", "gtk_search_bar_handle_event", "()" ]
[ "func", "(", "v", "*", "SearchBar", ")", "HandleEvent", "(", "event", "*", "gdk", ".", "<mask>", ")", "{", "e", ":=", "(", "*", "C", ".", "GdkEvent", ")", "(", "unsafe", ".", "Pointer", "(", "event", ".", "Native", "(", ")", ")", ")", "\n", "C", ".", "gtk_search_bar_handle_event", "(", "v", ".", "native", "(", ")", ",", "e", ")", "\n", "}" ]
7,107
all-7108
[ "isManifestInvalidError", "returns", "true", "iff", "err", "from", "client", ".", "HandleErrorReponse", "is", "a", "“manifest", "invalid”", "error", "." ]
[ "func", "isManifestInvalidError", "(", "err", "error", ")", "bool", "{", "errors", ",", "ok", ":=", "err", ".", "(", "errcode", ".", "Errors", ")", "\n", "if", "!", "ok", "||", "len", "(", "errors", ")", "==", "0", "{", "return", "false", "\n", "}", "\n", "err", "=", "errors", "[", "0", "]", "\n", "ec", ",", "ok", ":=", "err", ".", "(", "errcode", ".", "ErrorCoder", ")", "\n", "if", "!", "ok", "{", "return", "false", "\n", "}", "\n\n", "switch", "ec", ".", "ErrorCode", "(", ")", "{", "// ErrorCodeManifestInvalid is returned by OpenShift with acceptschema2=false.", "case", "v2", ".", "ErrorCodeManifestInvalid", ":", "return", "true", "\n", "// ErrorCodeTagInvalid is returned by docker/distribution (at least as of commit ec87e9b6971d831f0eff752ddb54fb64693e51cd)", "// when uploading to a tag (because it can’t find a matching tag inside the manifest)", "<mask>", "v2", ".", "ErrorCodeTagInvalid", ":", "return", "true", "\n", "// ErrorCodeUnsupported with 'Invalid JSON syntax' is returned by AWS ECR when", "// uploading an OCI manifest that is (correctly, according to the spec) missing", "// a top-level media type. See libpod issue #1719", "// FIXME: remove this case when ECR behavior is fixed", "case", "errcode", ".", "ErrorCodeUnsupported", ":", "return", "strings", ".", "Contains", "(", "err", ".", "Error", "(", ")", ",", "\"", "\"", ")", "\n", "default", ":", "return", "false", "\n", "}", "\n", "}" ]
7,108
all-7109
[ "Panic", "application", "but", "deinit", "first", "so", "that", "the", "terminal", "will", "not", "be", "corrupt", "." ]
[ "func", "Panic", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "termbox", ".", "Close", "(", ")", "\n", "msg", ":=", "fmt", ".", "Sprintf", "(", "<mask>", ",", "args", "...", ")", "\n", "panic", "(", "msg", ")", "\n", "}" ]
7,109
all-7110
[ "Parse", "discovers", "the", "given", "parameters", "structure", "and", "associates", "the", "structure", "s", "field", "names", "with", "their", "values", "into", "the", "Params", "structure", "." ]
[ "func", "(", "p", "*", "Params", ")", "Parse", "(", "pvalue", "*", "reflect", ".", "Value", ")", "error", "{", "vtype", ":=", "pvalue", ".", "Type", "(", ")", ".", "Elem", "(", ")", "\n\n", "for", "idx", ":=", "0", ";", "idx", "<", "vtype", ".", "NumField", "(", ")", ";", "idx", "++", "{", "field", ":=", "vtype", ".", "Field", "(", "idx", ")", "\n\n", "value", ":=", "pvalue", ".", "Elem", "(", ")", ".", "Field", "(", "idx", ")", "\n\n", "if", "value", ".", "Kind", "(", ")", "==", "reflect", ".", "Slice", "{", "value", ".", "Set", "(", "reflect", ".", "MakeSlice", "(", "value", ".", "<mask>", "(", ")", ",", "0", ",", "0", ")", ")", "\n", "}", "\n\n", "parameter", ":=", "NewParameter", "(", "field", ".", "Name", ",", "value", ")", "\n", "if", "err", ":=", "parameter", ".", "DiscoverProperties", "(", "field", ".", "Tag", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "p", ".", "Set", "(", "parameter", ".", "Name", ",", "parameter", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "parameter", ".", "Alias", "!=", "\"", "\"", "{", "if", "err", ":=", "p", ".", "Set", "(", "parameter", ".", "Alias", ",", "parameter", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "p", ".", "Listing", "=", "append", "(", "p", ".", "Listing", ",", "parameter", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,110
all-7111
[ "Returns", "true", "if", "AppArmor", "stacking", "support", "is", "available", "." ]
[ "func", "appArmorCanStack", "(", ")", "bool", "{", "contentBytes", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n\n", "if", "string", "(", "contentBytes", ")", "!=", "\"", "\\n", "\"", "{", "return", "false", "\n", "}", "\n\n", "contentBytes", ",", "err", "=", "ioutil", ".", "ReadFile", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n\n", "content", ":=", "string", "(", "contentBytes", ")", "\n\n", "parts", ":=", "strings", ".", "Split", "(", "strings", ".", "TrimSpace", "(", "content", ")", ",", "\"", "\"", ")", "\n\n", "if", "len", "(", "parts", ")", "==", "0", "{", "logger", ".", "Warn", "(", "\"", "\"", ",", "log", ".", "Ctx", "{", "\"", "\"", ":", "content", "}", ")", "\n", "return", "false", "\n", "}", "\n\n", "major", ",", "err", ":=", "strconv", ".", "Atoi", "(", "<mask>", "[", "0", "]", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Warn", "(", "\"", "\"", ",", "log", ".", "Ctx", "{", "\"", "\"", ":", "content", "}", ")", "\n", "return", "false", "\n", "}", "\n\n", "minor", ":=", "0", "\n", "if", "len", "(", "parts", ")", "==", "2", "{", "minor", ",", "err", "=", "strconv", ".", "Atoi", "(", "parts", "[", "1", "]", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Warn", "(", "\"", "\"", ",", "log", ".", "Ctx", "{", "\"", "\"", ":", "content", "}", ")", "\n", "return", "false", "\n", "}", "\n", "}", "\n\n", "return", "major", ">=", "1", "&&", "minor", ">=", "2", "\n", "}" ]
7,111
all-7112
[ "ConvertErrorStatus", "creates", "an", "error", "that", "implements", "ErrorStatus", "based", "off", "an", "error" ]
[ "func", "ConvertErrorStatus", "(", "status", "int", ",", "err", "error", ")", "error", "{", "return", "&", "errStatus", "{", "error", ":", "err", ",", "<mask>", ":", "status", ",", "}", "\n", "}" ]
7,112
all-7113
[ "revokeUserCredentials", "revokes", "the", "Pachyderm", "authentication", "token", "userToken", "using", "the", "vault", "plugin", "s", "Admin", "credentials", "." ]
[ "func", "revokeUserCredentials", "(", "ctx", "<mask>", ".", "Context", ",", "pachdAddress", "string", ",", "userToken", "string", ",", "adminToken", "string", ")", "error", "{", "// Setup a single use client w the given admin token / address", "client", ",", "err", ":=", "pclient", ".", "NewFromAddress", "(", "pachdAddress", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "client", ".", "Close", "(", ")", "// avoid leaking connections", "\n\n", "client", "=", "client", ".", "WithCtx", "(", "ctx", ")", "\n", "client", ".", "SetAuthToken", "(", "adminToken", ")", "\n", "_", ",", "err", "=", "client", ".", "AuthAPIClient", ".", "RevokeAuthToken", "(", "client", ".", "Ctx", "(", ")", ",", "&", "auth", ".", "RevokeAuthTokenRequest", "{", "Token", ":", "userToken", ",", "}", ")", "\n", "return", "err", "\n", "}" ]
7,113
all-7114
[ "Snapshot", "returns", "a", "Distribution" ]
[ "func", "(", "r", "*", "Reservoir", ")", "Snapshot", "(", ")", "Distribution", "{", "h", ":=", "newHistogram", "(", "defaultHistogramSize", ")", "\n", "r", ".", "m", ".", "Lock", "(", ")", "\n", "h", "=", "r", ".", "hist", ".", "Copy", "(", "h", ")", "\n", "r", ".", "m", ".", "Unlock", "(", ")", "\n", "<mask>", "h", "\n", "}" ]
7,114
all-7115
[ "Generate", "random", "number", "in", "[", "0", "n", ")" ]
[ "func", "GenerateRandomInt", "(", "<mask>", ",", "max", "int", ")", "int", "{", "return", "int", "(", "GenerateRandomInt64", "(", "int64", "(", "min", ")", ",", "int64", "(", "max", ")", ")", ")", "\n", "}" ]
7,115
all-7116
[ "gets", "the", "pull", "commit", "hash", "from", "metadata" ]
[ "func", "getPullCommitHash", "(", "pull", "string", ")", "(", "string", ",", "error", ")", "{", "match", ":=", "pullCommitRe", ".", "FindStringSubmatch", "(", "pull", ")", "\n", "if", "len", "(", "<mask>", ")", "!=", "2", "{", "expected", ":=", "\"", "\"", "\n", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pull", ",", "expected", ")", "\n", "}", "\n", "return", "match", "[", "1", "]", ",", "nil", "\n", "}" ]
7,116
all-7117
[ "Find", "a", "task", "by", "index", "path", "returning", "the", "highest", "-", "rank", "task", "with", "that", "path", ".", "If", "no", "task", "exists", "for", "the", "given", "path", "this", "API", "end", "-", "point", "will", "respond", "with", "a", "404", "status", ".", "See", "#findTask" ]
[ "func", "(", "index", "*", "Index", ")", "FindTask", "(", "indexPath", "string", ")", "(", "*", "IndexedTaskResponse", ",", "error", ")", "{", "<mask>", ":=", "tcclient", ".", "Client", "(", "*", "index", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "indexPath", ")", ",", "new", "(", "IndexedTaskResponse", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "IndexedTaskResponse", ")", ",", "err", "\n", "}" ]
7,117
all-7118
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "DescribeNodeParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom73", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,118
all-7119
[ "Render", "implements", "the", "Render", "interface", ".", "This", "is", "called", "from", "queue", "context", "so", "be", "careful", "to", "not", "use", "blocking", "calls", "." ]
[ "func", "(", "e", "*", "Edit", ")", "Render", "(", ")", "{", "if", "e", ".", "visibility", "==", "VisibilityHide", "{", "e", ".", "clear", "(", ")", "\n", "return", "\n", "}", "\n\n", "filler", ":=", "\"", "\"", "\n", "l", ":=", "e", ".", "display", "[", "e", ".", "at", ":", "]", "\n", "if", "len", "(", "l", ")", ">", "e", ".", "trueW", "{", "l", "=", "e", ".", "display", "[", "e", ".", "<mask>", ":", "e", ".", "at", "+", "e", ".", "trueW", "]", "\n", "}", "else", "{", "// just erase right hand side", "filler", "=", "strings", ".", "Repeat", "(", "\"", "\"", ",", "e", ".", "trueW", "-", "len", "(", "l", ")", ")", "\n", "}", "\n", "e", ".", "w", ".", "printf", "(", "e", ".", "trueX", ",", "e", ".", "trueY", ",", "e", ".", "attr", ",", "\"", "\"", ",", "string", "(", "l", ")", ",", "filler", ")", "\n", "}" ]
7,119
all-7120
[ "appendVertices", "appends", "vertices", "to", "the", "queue", "." ]
[ "func", "(", "q", "*", "commandQueue", ")", "appendVertices", "(", "vertices", "[", "]", "float32", ")", "{", "if", "len", "(", "q", ".", "vertices", ")", "<", "q", ".", "nvertices", "+", "len", "(", "vertices", ")", "{", "n", ":=", "q", ".", "nvertices", "+", "len", "(", "vertices", ")", "-", "len", "(", "q", ".", "vertices", ")", "\n", "q", ".", "vertices", "=", "<mask>", "(", "q", ".", "vertices", ",", "make", "(", "[", "]", "float32", ",", "n", ")", "...", ")", "\n", "}", "\n", "copy", "(", "q", ".", "vertices", "[", "q", ".", "nvertices", ":", "]", ",", "vertices", ")", "\n", "q", ".", "nvertices", "+=", "len", "(", "vertices", ")", "\n", "}" ]
7,120
all-7121
[ "SetMultipartFormBoundary", "sets", "the", "following", "Content", "-", "Type", ":", "multipart", "/", "form", "-", "data", ";", "boundary", "=", "...", "where", "...", "is", "substituted", "by", "the", "given", "boundary", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "SetMultipartFormBoundary", "(", "boundary", "string", ")", "{", "h", ".", "parseRawHeaders", "(", ")", "\n\n", "b", ":=", "h", ".", "bufKV", ".", "value", "[", ":", "0", "]", "\n", "b", "=", "append", "(", "b", ",", "strMultipartFormData", "...", ")", "\n", "b", "=", "append", "(", "b", ",", "';'", ",", "' '", ")", "\n", "b", "=", "append", "(", "b", ",", "strBoundary", "...", ")", "\n", "b", "=", "<mask>", "(", "b", ",", "'='", ")", "\n", "b", "=", "append", "(", "b", ",", "boundary", "...", ")", "\n", "h", ".", "bufKV", ".", "value", "=", "b", "\n\n", "h", ".", "SetContentTypeBytes", "(", "h", ".", "bufKV", ".", "value", ")", "\n", "}" ]
7,121
all-7122
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "PositionTickInfo", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoProfiler18", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
7,122
all-7123
[ "DrawTextVertical", "draws", "the", "part", "of", "text", "that", "is", "inside", "the", "current", "clipping", "rectangle", ".", "DrawTextVertical", "always", "paints", "colorized", "string", ".", "If", "you", "want", "to", "draw", "raw", "string", "then", "use", "DrawRawTextVertical", "function" ]
[ "func", "DrawTextVertical", "(", "x", ",", "y", "int", ",", "text", "string", ")", "{", "PushAttributes", "(", ")", "\n", "defer", "PopAttributes", "(", ")", "\n\n", "defText", ",", "defBack", ":=", "TextColor", "(", ")", ",", "BackColor", "(", ")", "\n", "firstdrawn", ":=", "InClipRect", "(", "x", ",", "y", ")", "\n\n", "parser", ":=", "NewColorParser", "(", "<mask>", ",", "defText", ",", "defBack", ")", "\n", "elem", ":=", "parser", ".", "NextElement", "(", ")", "\n", "for", "elem", ".", "Type", "!=", "ElemEndOfText", "{", "if", "elem", ".", "Type", "==", "ElemPrintable", "{", "SetTextColor", "(", "elem", ".", "Fg", ")", "\n", "SetBackColor", "(", "elem", ".", "Bg", ")", "\n", "drawn", ":=", "PutChar", "(", "x", ",", "y", ",", "elem", ".", "Ch", ")", "\n", "y", "+=", "1", "\n", "if", "firstdrawn", "&&", "!", "drawn", "{", "break", "\n", "}", "\n", "}", "\n\n", "elem", "=", "parser", ".", "NextElement", "(", ")", "\n", "}", "\n", "}" ]
7,123
all-7124
[ "Move", "moves", "the", "cursor", "over", "in", "relative", "terms", "by", "shift", "indices", "." ]
[ "func", "(", "c", "*", "Cursor", ")", "Move", "(", "shift", "int", ")", "{", "// delete the current cursor", "c", ".", "Position", "=", "c", ".", "Position", "+", "<mask>", "\n", "c", ".", "correctPosition", "(", ")", "\n", "}" ]
7,124
all-7125
[ "Recursively", "record", "all", "type", "declarations" ]
[ "func", "(", "p", "*", "ParamAnalyzer", ")", "recordTypes", "(", "root", "gen", ".", "DataType", ")", "{", "if", "o", ",", "ok", ":=", "root", ".", "(", "*", "gen", ".", "ObjectDataType", ")", ";", "ok", "{", "if", "_", ",", "found", ":=", "p", ".", "ParamTypes", "[", "o", ".", "TypeName", "]", ";", "!", "found", "{", "p", ".", "ParamTypes", "[", "o", ".", "TypeName", "]", "=", "o", "\n", "for", "_", ",", "f", ":=", "range", "o", ".", "Fields", "{", "p", ".", "recordTypes", "(", "f", ".", "Type", ")", "\n", "}", "\n", "}", "\n", "}", "else", "if", "a", ",", "ok", ":=", "root", ".", "(", "*", "<mask>", ".", "ArrayDataType", ")", ";", "ok", "{", "p", ".", "recordTypes", "(", "a", ".", "ElemType", ".", "Type", ")", "\n", "}", "\n", "}" ]
7,125
all-7126
[ "FindByLink", "finds", "exactly", "one", "anchor", "element", "by", "its", "text", "content", "." ]
[ "func", "(", "s", "*", "selectable", ")", "FindByLink", "(", "text", "string", ")", "*", "Selection", "{", "return", "newSelection", "(", "s", ".", "session", ",", "s", ".", "selectors", ".", "Append", "(", "target", ".", "Link", ",", "<mask>", ")", ".", "Single", "(", ")", ")", "\n", "}" ]
7,126
all-7127
[ "NewInflationResult", "creates", "a", "new", "InflationResult", "." ]
[ "func", "NewInflationResult", "(", "<mask>", "InflationResultCode", ",", "value", "interface", "{", "}", ")", "(", "result", "InflationResult", ",", "err", "error", ")", "{", "result", ".", "Code", "=", "code", "\n", "switch", "InflationResultCode", "(", "code", ")", "{", "case", "InflationResultCodeInflationSuccess", ":", "tv", ",", "ok", ":=", "value", ".", "(", "[", "]", "InflationPayout", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "Payouts", "=", "&", "tv", "\n", "default", ":", "// void", "}", "\n", "return", "\n", "}" ]
7,127
all-7128
[ "GetProperty", "is", "a", "wrapper", "around", "g_object_get_property", "()", "." ]
[ "func", "(", "v", "*", "Object", ")", "GetProperty", "(", "name", "string", ")", "(", "<mask>", "{", "}", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n\n", "t", ",", "err", ":=", "v", ".", "GetPropertyType", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "p", ",", "err", ":=", "ValueInit", "(", "t", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "C", ".", "g_object_get_property", "(", "v", ".", "GObject", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "p", ".", "native", "(", ")", ")", "\n", "return", "p", ".", "GoValue", "(", ")", "\n", "}" ]
7,128
all-7129
[ "TimeoutHandler", "creates", "RequestHandler", "which", "returns", "StatusRequestTimeout", "error", "with", "the", "given", "msg", "to", "the", "client", "if", "h", "didn", "t", "return", "during", "the", "given", "duration", ".", "The", "returned", "handler", "may", "return", "StatusTooManyRequests", "error", "with", "the", "given", "msg", "to", "the", "client", "if", "there", "are", "more", "than", "Server", ".", "Concurrency", "concurrent", "handlers", "h", "are", "running", "at", "the", "moment", "." ]
[ "func", "TimeoutHandler", "(", "h", "RequestHandler", ",", "timeout", "<mask>", ".", "Duration", ",", "msg", "string", ")", "RequestHandler", "{", "if", "timeout", "<=", "0", "{", "return", "h", "\n", "}", "\n\n", "return", "func", "(", "ctx", "*", "RequestCtx", ")", "{", "concurrencyCh", ":=", "ctx", ".", "s", ".", "concurrencyCh", "\n", "select", "{", "case", "concurrencyCh", "<-", "struct", "{", "}", "{", "}", ":", "default", ":", "ctx", ".", "Error", "(", "msg", ",", "StatusTooManyRequests", ")", "\n", "return", "\n", "}", "\n\n", "ch", ":=", "ctx", ".", "timeoutCh", "\n", "if", "ch", "==", "nil", "{", "ch", "=", "make", "(", "chan", "struct", "{", "}", ",", "1", ")", "\n", "ctx", ".", "timeoutCh", "=", "ch", "\n", "}", "\n", "go", "func", "(", ")", "{", "h", "(", "ctx", ")", "\n", "ch", "<-", "struct", "{", "}", "{", "}", "\n", "<-", "concurrencyCh", "\n", "}", "(", ")", "\n", "ctx", ".", "timeoutTimer", "=", "initTimer", "(", "ctx", ".", "timeoutTimer", ",", "timeout", ")", "\n", "select", "{", "case", "<-", "ch", ":", "case", "<-", "ctx", ".", "timeoutTimer", ".", "C", ":", "ctx", ".", "TimeoutError", "(", "msg", ")", "\n", "}", "\n", "stopTimer", "(", "ctx", ".", "timeoutTimer", ")", "\n", "}", "\n", "}" ]
7,129
all-7130
[ "newSizeHistogram", "returns", "a", "new", "instance", "of", "keyValueSizeHistogram", "with", "properly", "initialized", "fields", "." ]
[ "func", "newSizeHistogram", "(", ")", "*", "sizeHistogram", "{", "// TODO(ibrahim): find appropriate bin size.", "keyBins", ":=", "createHistogramBins", "(", "1", ",", "16", ")", "\n", "valueBins", ":=", "createHistogramBins", "(", "1", ",", "30", ")", "\n", "return", "&", "sizeHistogram", "{", "keySizeHistogram", ":", "histogramData", "{", "bins", ":", "keyBins", ",", "countPerBin", ":", "make", "(", "[", "]", "int64", ",", "len", "(", "keyBins", ")", "+", "1", ")", ",", "max", ":", "math", ".", "MinInt64", ",", "min", ":", "math", ".", "MaxInt64", ",", "<mask>", ":", "0", ",", "}", ",", "valueSizeHistogram", ":", "histogramData", "{", "bins", ":", "valueBins", ",", "countPerBin", ":", "make", "(", "[", "]", "int64", ",", "len", "(", "valueBins", ")", "+", "1", ")", ",", "max", ":", "math", ".", "MinInt64", ",", "min", ":", "math", ".", "MaxInt64", ",", "sum", ":", "0", ",", "}", ",", "}", "\n", "}" ]
7,130
all-7131
[ "NewOrdered", "creates", "a", "new", "ordered", "hashtree", "." ]
[ "func", "NewOrdered", "(", "root", "string", ")", "*", "Ordered", "{", "root", "=", "clean", "(", "root", ")", "\n", "o", ":=", "&", "Ordered", "{", "}", "\n", "n", ":=", "&", "node", "{", "path", ":", "\"", "\"", ",", "nodeProto", ":", "&", "NodeProto", "{", "Name", ":", "\"", "\"", ",", "DirNode", ":", "&", "DirectoryNodeProto", "{", "}", ",", "}", ",", "hash", ":", "sha256", ".", "New", "(", ")", ",", "}", "\n", "o", ".", "fs", "=", "append", "(", "o", ".", "fs", ",", "n", ")", "\n", "o", ".", "dirStack", "=", "append", "(", "o", ".", "dirStack", ",", "n", ")", "\n", "o", ".", "MkdirAll", "(", "root", ")", "\n", "o", ".", "root", "=", "<mask>", "\n", "return", "o", "\n", "}" ]
7,131
all-7132
[ "/", "*", "Reshape", "changes", "shape", "of", "the", "image", "without", "copying", "data", ".", "A", "value", "of", "0", "means", "that", "channels", "or", "rows", "remain", "unchanged", "." ]
[ "func", "(", "img", "*", "IplImage", ")", "Reshape", "(", "channels", ",", "rows", ",", "_type", "int", ")", "*", "Mat", "{", "total", ":=", "img", ".", "Width", "(", ")", "*", "img", ".", "Height", "(", ")", "\n", "header", ":=", "CreateMat", "(", "<mask>", ",", "total", "/", "rows", ",", "_type", ")", "\n", "n", ":=", "C", ".", "cvReshape", "(", "unsafe", ".", "Pointer", "(", "img", ")", ",", "(", "*", "C", ".", "CvMat", ")", "(", "header", ")", ",", "C", ".", "int", "(", "channels", ")", ",", "C", ".", "int", "(", "rows", ")", ")", "\n", "return", "(", "*", "Mat", ")", "(", "n", ")", "\n", "}" ]
7,132
all-7133
[ "Add1", "()", "is", "a", "wrapper", "around", "gtk_paned_add1", "()", "." ]
[ "func", "(", "v", "*", "Paned", ")", "Add1", "(", "<mask>", "IWidget", ")", "{", "C", ".", "gtk_paned_add1", "(", "v", ".", "native", "(", ")", ",", "child", ".", "toWidget", "(", ")", ")", "\n", "}" ]
7,133
all-7134
[ "mergeConfig", "merges", "two", "JobConfig", "together", "It", "will", "try", "to", "merge", ":", "-", "Presubmits", "-", "Postsubmits", "-", "Periodics", "-", "PodPresets" ]
[ "func", "(", "c", "*", "Config", ")", "mergeJobConfig", "(", "jc", "JobConfig", ")", "error", "{", "// Merge everything", "// *** Presets ***", "c", ".", "Presets", "=", "append", "(", "c", ".", "Presets", ",", "jc", ".", "Presets", "...", ")", "\n\n", "// validate no duplicated preset key-value pairs", "validLabels", ":=", "map", "[", "string", "]", "bool", "{", "}", "\n", "for", "_", ",", "preset", ":=", "range", "c", ".", "Presets", "{", "for", "label", ",", "val", ":=", "<mask>", "preset", ".", "Labels", "{", "pair", ":=", "label", "+", "\"", "\"", "+", "val", "\n", "if", "_", ",", "ok", ":=", "validLabels", "[", "pair", "]", ";", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pair", ")", "\n", "}", "\n", "validLabels", "[", "pair", "]", "=", "true", "\n", "}", "\n", "}", "\n\n", "// *** Periodics ***", "c", ".", "Periodics", "=", "append", "(", "c", ".", "Periodics", ",", "jc", ".", "Periodics", "...", ")", "\n\n", "// *** Presubmits ***", "if", "c", ".", "Presubmits", "==", "nil", "{", "c", ".", "Presubmits", "=", "make", "(", "map", "[", "string", "]", "[", "]", "Presubmit", ")", "\n", "}", "\n", "for", "repo", ",", "jobs", ":=", "range", "jc", ".", "Presubmits", "{", "c", ".", "Presubmits", "[", "repo", "]", "=", "append", "(", "c", ".", "Presubmits", "[", "repo", "]", ",", "jobs", "...", ")", "\n", "}", "\n\n", "// *** Postsubmits ***", "if", "c", ".", "Postsubmits", "==", "nil", "{", "c", ".", "Postsubmits", "=", "make", "(", "map", "[", "string", "]", "[", "]", "Postsubmit", ")", "\n", "}", "\n", "for", "repo", ",", "jobs", ":=", "range", "jc", ".", "Postsubmits", "{", "c", ".", "Postsubmits", "[", "repo", "]", "=", "append", "(", "c", ".", "Postsubmits", "[", "repo", "]", ",", "jobs", "...", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
7,134
all-7135
[ "CallPeer", "makes", "a", "JSON", "call", "using", "the", "given", "peer", "." ]
[ "func", "CallPeer", "(", "ctx", "<mask>", ",", "peer", "*", "tchannel", ".", "Peer", ",", "serviceName", ",", "method", "string", ",", "arg", ",", "resp", "interface", "{", "}", ")", "error", "{", "call", ",", "err", ":=", "peer", ".", "BeginCall", "(", "ctx", ",", "serviceName", ",", "method", ",", "&", "tchannel", ".", "CallOptions", "{", "Format", ":", "tchannel", ".", "JSON", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "wrapCall", "(", "ctx", ",", "call", ",", "method", ",", "arg", ",", "resp", ")", "\n", "}" ]
7,135
all-7136
[ "KeyValue", "creates", "a", "Key", "/", "Value", "pair", "that", "is", "suitable", "for", "use", "in", "the", "LogMessage", "()", "function" ]
[ "func", "KeyValue", "(", "key", "string", ",", "val", "interface", "{", "}", ")", "keyval", "{", "return", "keyval", "{", "key", ":", "<mask>", ",", "val", ":", "val", "}", "\n", "}" ]
7,136
all-7137
[ "GetMetricQuery", "returns", "the", "MetricQuery", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "s", "*", "ScatterplotRequest", ")", "GetMetricQuery", "(", ")", "<mask>", "{", "if", "s", "==", "nil", "||", "s", ".", "MetricQuery", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "s", ".", "MetricQuery", "\n", "}" ]
7,137
all-7138
[ "assign", "emits", "to", "fn", "code", "to", "initialize", "the", "lvalue", "loc", "with", "the", "value", "of", "expression", "e", ".", "If", "isZero", "is", "true", "assign", "assumes", "that", "loc", "holds", "the", "zero", "value", "for", "its", "type", ".", "This", "is", "equivalent", "to", "loc", ".", "store", "(", "fn", "b", ".", "expr", "(", "fn", "e", "))", "but", "may", "generate", "better", "code", "in", "some", "cases", "e", ".", "g", ".", "for", "composite", "literals", "in", "an", "addressable", "location", ".", "If", "sb", "is", "not", "nil", "assign", "generates", "code", "to", "evaluate", "expression", "e", "but", "not", "to", "update", "loc", ".", "Instead", "the", "necessary", "stores", "are", "appended", "to", "the", "storebuf", "sb", "so", "that", "they", "can", "be", "executed", "later", ".", "This", "allows", "correct", "in", "-", "place", "update", "of", "existing", "variables", "when", "the", "RHS", "is", "a", "composite", "literal", "that", "may", "reference", "parts", "of", "the", "LHS", "." ]
[ "func", "(", "b", "*", "builder", ")", "assign", "(", "fn", "*", "Function", ",", "loc", "lvalue", ",", "e", "ast", ".", "Expr", ",", "isZero", "bool", ",", "sb", "*", "storebuf", ")", "{", "// Can we initialize it in place?", "if", "e", ",", "ok", ":=", "unparen", "(", "e", ")", ".", "(", "*", "ast", ".", "CompositeLit", ")", ";", "ok", "{", "// A CompositeLit never evaluates to a pointer,", "// so if the type of the location is a pointer,", "// an &-operation is implied.", "if", "_", ",", "<mask>", ":=", "loc", ".", "(", "blank", ")", ";", "!", "ok", "{", "// avoid calling blank.typ()", "if", "isPointer", "(", "loc", ".", "typ", "(", ")", ")", "{", "ptr", ":=", "b", ".", "addr", "(", "fn", ",", "e", ",", "true", ")", ".", "address", "(", "fn", ")", "\n", "// copy address", "if", "sb", "!=", "nil", "{", "sb", ".", "store", "(", "loc", ",", "ptr", ")", "\n", "}", "else", "{", "loc", ".", "store", "(", "fn", ",", "ptr", ")", "\n", "}", "\n", "return", "\n", "}", "\n", "}", "\n\n", "if", "_", ",", "ok", ":=", "loc", ".", "(", "*", "address", ")", ";", "ok", "{", "if", "isInterface", "(", "loc", ".", "typ", "(", ")", ")", "{", "// e.g. var x interface{} = T{...}", "// Can't in-place initialize an interface value.", "// Fall back to copying.", "}", "else", "{", "// x = T{...} or x := T{...}", "addr", ":=", "loc", ".", "address", "(", "fn", ")", "\n", "if", "sb", "!=", "nil", "{", "b", ".", "compLit", "(", "fn", ",", "addr", ",", "e", ",", "isZero", ",", "sb", ")", "\n", "}", "else", "{", "var", "sb", "storebuf", "\n", "b", ".", "compLit", "(", "fn", ",", "addr", ",", "e", ",", "isZero", ",", "&", "sb", ")", "\n", "sb", ".", "emit", "(", "fn", ")", "\n", "}", "\n\n", "// Subtle: emit debug ref for aggregate types only;", "// slice and map are handled by store ops in compLit.", "switch", "loc", ".", "typ", "(", ")", ".", "Underlying", "(", ")", ".", "(", "type", ")", "{", "case", "*", "types", ".", "Struct", ",", "*", "types", ".", "Array", ":", "emitDebugRef", "(", "fn", ",", "e", ",", "addr", ",", "true", ")", "\n", "}", "\n\n", "return", "\n", "}", "\n", "}", "\n", "}", "\n\n", "// simple case: just copy", "rhs", ":=", "b", ".", "expr", "(", "fn", ",", "e", ")", "\n", "if", "sb", "!=", "nil", "{", "sb", ".", "store", "(", "loc", ",", "rhs", ")", "\n", "}", "else", "{", "loc", ".", "store", "(", "fn", ",", "rhs", ")", "\n", "}", "\n", "}" ]
7,138
all-7139
[ "export", "FileSequence_String" ]
[ "func", "FileSequence_String", "(", "id", "FileSeqId", ")", "*", "C", ".", "char", "{", "fs", ",", "ok", ":=", "sFileSeqs", ".", "Get", "(", "id", ")", "\n", "// caller must free string", "if", "!", "ok", "{", "return", "C", ".", "CString", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "C", ".", "CString", "(", "<mask>", ".", "String", "(", ")", ")", "\n", "}" ]
7,139
all-7140
[ "SelectRange", "is", "a", "wrapper", "around", "gtk_text_buffer_select_range", "." ]
[ "func", "(", "v", "*", "TextBuffer", ")", "SelectRange", "(", "start", ",", "<mask>", "*", "TextIter", ")", "{", "C", ".", "gtk_text_buffer_select_range", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "GtkTextIter", ")", "(", "start", ")", ",", "(", "*", "C", ".", "GtkTextIter", ")", "(", "end", ")", ")", "\n", "}" ]
7,140
all-7141
[ "The", "node", "ID", "of", "the", "source", "of", "this", "Msg", ".", "Returns", "nil", "if", "it", "isn", "t", "present", ".", "TODO", ":", "Can", "we", "verify", "Msgs", "more", "aggressively", "so", "this", "is", "guaranteed", "to", "return", "a", "valid", "ID", "for", "a", "checked", "Msg?" ]
[ "func", "(", "m", "Msg", ")", "SenderID", "(", ")", "*", "ID", "{", "switch", "m", ".", "Y", "{", "case", "\"", "\"", ":", "if", "m", ".", "A", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "&", "m", ".", "A", ".", "ID", "\n", "case", "\"", "\"", ":", "if", "m", ".", "R", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "&", "m", ".", "R", ".", "<mask>", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,141
all-7142
[ "Body", "returns", "response", "body", ".", "The", "returned", "body", "is", "valid", "until", "the", "response", "modification", "." ]
[ "func", "(", "resp", "*", "<mask>", ")", "Body", "(", ")", "[", "]", "byte", "{", "if", "resp", ".", "bodyStream", "!=", "nil", "{", "bodyBuf", ":=", "resp", ".", "bodyBuffer", "(", ")", "\n", "bodyBuf", ".", "Reset", "(", ")", "\n", "_", ",", "err", ":=", "copyZeroAlloc", "(", "bodyBuf", ",", "resp", ".", "bodyStream", ")", "\n", "resp", ".", "closeBodyStream", "(", ")", "\n", "if", "err", "!=", "nil", "{", "bodyBuf", ".", "SetString", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "\n", "return", "resp", ".", "bodyBytes", "(", ")", "\n", "}" ]
7,142
all-7143
[ "Labels", "returns", "the", "labels", "to", "apply", "to", "the", "issue", "created", "for", "this", "cluster", "on", "github", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "Labels", "(", ")", "[", "]", "string", "{", "labels", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n\n", "topTests", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "c", ".", "Tests", ")", ")", "\n", "for", "i", ",", "test", ":=", "<mask>", "c", ".", "topTestsFailed", "(", "len", "(", "c", ".", "Tests", ")", ")", "{", "topTests", "[", "i", "]", "=", "test", ".", "Name", "\n", "}", "\n", "for", "sig", ":=", "range", "c", ".", "filer", ".", "creator", ".", "TestsSIGs", "(", "topTests", ")", "{", "labels", "=", "append", "(", "labels", ",", "\"", "\"", "+", "sig", ")", "\n", "}", "\n\n", "return", "labels", "\n", "}" ]
7,143
all-7144
[ "/", "*", "Identify", "the", "beginning", "of", "a", "segment", "that", "performs", "an", "external", "service", "." ]
[ "func", "SegmentExternalBegin", "(", "<mask>", ",", "parent", "int64", ",", "host", ",", "name", "string", ")", "(", "int64", ",", "error", ")", "{", "cname", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cname", ")", ")", "\n\n", "chost", ":=", "C", ".", "CString", "(", "host", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "chost", ")", ")", "\n\n", "return", "errNoLong", "(", "C", ".", "newrelic_segment_external_begin", "(", "C", ".", "long", "(", "id", ")", ",", "C", ".", "long", "(", "parent", ")", ",", "chost", ",", "cname", ")", ")", "\n", "}" ]
7,144
all-7145
[ "UUIDsForMOIDs", "returns", "a", "MOIDForUUIDResults", "for", "a", "list", "of", "MOIDs", ".", "If", "one", "MOID", "cannot", "be", "found", "an", "error", "is", "returned", ".", "There", "are", "no", "partial", "results", "returned", "." ]
[ "func", "UUIDsForMOIDs", "(", "client", "*", "govmomi", ".", "Client", ",", "moids", "[", "]", "string", ")", "(", "MOIDForUUIDResults", ",", "error", ")", "{", "var", "<mask>", "MOIDForUUIDResults", "\n", "for", "_", ",", "uuid", ":=", "range", "moids", "{", "result", ",", "err", ":=", "UUIDForMOID", "(", "client", ",", "uuid", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "results", "=", "append", "(", "results", ",", "result", ")", "\n", "}", "\n", "return", "results", ",", "nil", "\n", "}" ]
7,145
all-7146
[ "PrintFunc", "outputs", "Print", "log", "returned", "from", "the", "function" ]
[ "func", "PrintFunc", "(", "f", "func", "(", ")", "string", ")", "error", "{", "if", "isModeEnable", "(", "PRINT", ")", "{", "return", "glg", ".", "<mask>", "(", "PRINT", ",", "\"", "\"", ",", "f", "(", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,146
all-7147
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "m", "*", "Metric", ")", "GetType", "(", ")", "string", "{", "if", "m", "==", "nil", "||", "m", ".", "Type", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "m", ".", "<mask>", "\n", "}" ]
7,147
all-7148
[ "RawWebsocket", "allows", "directly", "connection", "to", "LXD", "API", "websockets", "This", "should", "only", "be", "used", "by", "internal", "LXD", "tools", "." ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "RawWebsocket", "(", "path", "string", ")", "(", "*", "websocket", ".", "Conn", ",", "error", ")", "{", "return", "r", ".", "websocket", "(", "<mask>", ")", "\n", "}" ]
7,148
all-7149
[ "resolveTCPAddrs", "is", "a", "convenience", "wrapper", "for", "net", ".", "ResolveTCPAddr", ".", "resolveTCPAddrs", "return", "a", "new", "set", "of", "url", ".", "URLs", "in", "which", "all", "DNS", "hostnames", "are", "resolved", "." ]
[ "func", "resolveTCPAddrs", "(", "ctx", "context", ".", "Context", ",", "lg", "*", "zap", ".", "Logger", ",", "urls", "[", "]", "[", "]", "url", ".", "URL", ")", "(", "[", "]", "[", "]", "url", ".", "URL", ",", "error", ")", "{", "newurls", ":=", "make", "(", "[", "]", "[", "]", "url", ".", "URL", ",", "0", ")", "\n", "for", "_", ",", "us", ":=", "range", "urls", "{", "nus", ":=", "make", "(", "[", "]", "url", ".", "URL", ",", "len", "(", "us", ")", ")", "\n", "for", "i", ",", "u", ":=", "range", "us", "{", "nu", ",", "err", ":=", "url", ".", "Parse", "(", "u", ".", "<mask>", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "u", ".", "String", "(", ")", ",", "err", ")", "\n", "}", "\n", "nus", "[", "i", "]", "=", "*", "nu", "\n", "}", "\n", "for", "i", ",", "u", ":=", "range", "nus", "{", "h", ",", "err", ":=", "resolveURL", "(", "ctx", ",", "lg", ",", "u", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "u", ".", "String", "(", ")", ",", "err", ")", "\n", "}", "\n", "if", "h", "!=", "\"", "\"", "{", "nus", "[", "i", "]", ".", "Host", "=", "h", "\n", "}", "\n", "}", "\n", "newurls", "=", "append", "(", "newurls", ",", "nus", ")", "\n", "}", "\n", "return", "newurls", ",", "nil", "\n", "}" ]
7,149
all-7150
[ "/", "*", "ProcessEvent", "processes", "all", "events", "come", "from", "the", "control", "parent", ".", "If", "a", "control", "processes", "an", "event", "it", "should", "return", "true", ".", "If", "the", "method", "returns", "false", "it", "means", "that", "the", "control", "do", "not", "want", "or", "cannot", "process", "the", "event", "and", "the", "caller", "sends", "the", "event", "to", "the", "control", "parent" ]
[ "func", "(", "l", "*", "TextView", ")", "ProcessEvent", "(", "event", "Event", ")", "bool", "{", "if", "!", "l", ".", "Active", "(", ")", "||", "!", "l", ".", "Enabled", "(", ")", "{", "return", "false", "\n", "}", "\n\n", "switch", "event", ".", "Type", "{", "case", "EventKey", ":", "switch", "event", ".", "Key", "{", "case", "term", ".", "KeyHome", ":", "l", ".", "home", "(", ")", "\n", "return", "true", "\n", "case", "term", ".", "KeyEnd", ":", "l", ".", "end", "(", ")", "\n", "return", "true", "\n", "case", "term", ".", "KeyArrowUp", ":", "l", ".", "moveUp", "(", "1", ")", "\n", "return", "true", "\n", "case", "term", ".", "KeyArrowDown", ":", "l", ".", "moveDown", "(", "1", ")", "\n", "return", "true", "\n", "case", "term", ".", "KeyArrowLeft", ":", "l", ".", "moveLeft", "(", ")", "\n", "return", "true", "\n", "case", "<mask>", ".", "KeyArrowRight", ":", "l", ".", "moveRight", "(", ")", "\n", "return", "true", "\n", "case", "term", ".", "KeyPgup", ":", "l", ".", "moveUp", "(", "l", ".", "outputHeight", "(", ")", ")", "\n", "case", "term", ".", "KeyPgdn", ":", "l", ".", "moveDown", "(", "l", ".", "outputHeight", "(", ")", ")", "\n", "default", ":", "return", "false", "\n", "}", "\n", "case", "EventMouse", ":", "return", "l", ".", "processMouseClick", "(", "event", ")", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
7,150
all-7151
[ "Close", "closes", "current", "connection", "to", "Sentinel", "." ]
[ "func", "(", "s", "*", "Sentinel", ")", "Close", "(", ")", "error", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "s", ".", "<mask>", "(", ")", "\n", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "nil", "\n", "}" ]
7,151
all-7152
[ "Finish", "finishes", "the", "table", "by", "appending", "the", "index", "." ]
[ "func", "(", "b", "*", "Builder", ")", "Finish", "(", ")", "[", "]", "byte", "{", "bf", ":=", "bbloom", ".", "New", "(", "float64", "(", "b", ".", "keyCount", ")", ",", "0.01", ")", "\n", "var", "klen", "[", "2", "]", "byte", "\n", "key", ":=", "make", "(", "[", "]", "byte", ",", "1024", ")", "\n", "for", "{", "if", "_", ",", "err", ":=", "b", ".", "keyBuf", ".", "Read", "(", "klen", "[", ":", "]", ")", ";", "err", "==", "io", ".", "EOF", "{", "break", "\n", "}", "else", "if", "err", "!=", "nil", "{", "y", ".", "Check", "(", "err", ")", "\n", "}", "\n", "kl", ":=", "int", "(", "binary", ".", "BigEndian", ".", "Uint16", "(", "klen", "[", ":", "]", ")", ")", "\n", "if", "cap", "(", "key", ")", "<", "kl", "{", "key", "=", "make", "(", "[", "]", "byte", ",", "2", "*", "int", "(", "kl", ")", ")", "// 2 * uint16 will overflow", "\n", "}", "\n", "key", "=", "key", "[", ":", "kl", "]", "\n", "y", ".", "Check2", "(", "b", ".", "keyBuf", ".", "Read", "(", "key", ")", ")", "\n", "bf", ".", "Add", "(", "key", ")", "\n", "}", "\n\n", "b", ".", "finishBlock", "(", ")", "// This will never start a new block.", "\n", "index", ":=", "b", ".", "blockIndex", "(", ")", "\n", "b", ".", "buf", ".", "Write", "(", "index", ")", "\n\n", "// Write bloom filter.", "bdata", ":=", "bf", ".", "JSONMarshal", "(", ")", "\n", "n", ",", "err", ":=", "b", ".", "buf", ".", "Write", "(", "bdata", ")", "\n", "y", ".", "Check", "(", "err", ")", "\n", "var", "buf", "[", "4", "]", "byte", "\n", "<mask>", ".", "BigEndian", ".", "PutUint32", "(", "buf", "[", ":", "]", ",", "uint32", "(", "n", ")", ")", "\n", "b", ".", "buf", ".", "Write", "(", "buf", "[", ":", "]", ")", "\n\n", "return", "b", ".", "buf", ".", "Bytes", "(", ")", "\n", "}" ]
7,152
all-7153
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "WebSocketRequest", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork1", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
7,153
all-7154
[ "OnStart", "implements", "BaseService" ]
[ "func", "(", "r", "*", "PEXReactor", ")", "OnStart", "(", ")", "error", "{", "r", ".", "BaseReactor", ".", "OnStart", "(", ")", "\n", "r", ".", "<mask>", ".", "Start", "(", ")", "\n", "go", "r", ".", "ensurePeersRoutine", "(", ")", "\n", "go", "r", ".", "flushMsgCountByPeer", "(", ")", "\n", "return", "nil", "\n", "}" ]
7,154
all-7155
[ "WithScale", "scale", "to", "apply", "to", "resulting", "view", "image", "." ]
[ "func", "(", "p", "SetDeviceMetricsOverrideParams", ")", "WithScale", "(", "<mask>", "float64", ")", "*", "SetDeviceMetricsOverrideParams", "{", "p", ".", "Scale", "=", "scale", "\n", "return", "&", "p", "\n", "}" ]
7,155
all-7156
[ "Records", "returns", "the", "list", "of", "records", "." ]
[ "func", "(", "p", "designateProvider", ")", "Records", "(", ")", "(", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "error", ")", "{", "var", "result", "[", "]", "*", "endpoint", ".", "Endpoint", "\n", "managedZones", ",", "err", ":=", "p", ".", "getZones", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "for", "zoneID", ":=", "range", "managedZones", "{", "err", "=", "p", ".", "client", ".", "ForEachRecordSet", "(", "zoneID", ",", "func", "(", "recordSet", "*", "recordsets", ".", "RecordSet", ")", "error", "{", "if", "recordSet", ".", "<mask>", "!=", "endpoint", ".", "RecordTypeA", "&&", "recordSet", ".", "Type", "!=", "endpoint", ".", "RecordTypeTXT", "&&", "recordSet", ".", "Type", "!=", "endpoint", ".", "RecordTypeCNAME", "{", "return", "nil", "\n", "}", "\n", "for", "_", ",", "record", ":=", "range", "recordSet", ".", "Records", "{", "ep", ":=", "endpoint", ".", "NewEndpoint", "(", "recordSet", ".", "Name", ",", "recordSet", ".", "Type", ",", "record", ")", "\n", "ep", ".", "Labels", "[", "designateRecordSetID", "]", "=", "recordSet", ".", "ID", "\n", "ep", ".", "Labels", "[", "designateZoneID", "]", "=", "recordSet", ".", "ZoneID", "\n", "ep", ".", "Labels", "[", "designateOriginalRecords", "]", "=", "strings", ".", "Join", "(", "recordSet", ".", "Records", ",", "\"", "\\000", "\"", ")", "\n", "result", "=", "append", "(", "result", ",", "ep", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "return", "result", ",", "nil", "\n", "}" ]
7,156
all-7157
[ "Count", "loads", "the", "row", "count", "for", "the", "provided", "dataset", ".", "tablename" ]
[ "func", "(", "c", "*", "Client", ")", "Count", "(", "dataset", ",", "project", ",", "datasetTable", "string", ")", "int64", "{", "qstr", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "datasetTable", ")", "\n", "<mask>", ",", "err", ":=", "c", ".", "SyncQuery", "(", "dataset", ",", "project", ",", "qstr", ",", "1", ")", "\n", "if", "err", "==", "nil", "{", "if", "len", "(", "res", ")", ">", "0", "{", "val", ",", "_", ":=", "strconv", ".", "ParseInt", "(", "res", "[", "0", "]", "[", "0", "]", ".", "(", "string", ")", ",", "10", ",", "64", ")", "\n", "return", "val", "\n", "}", "\n", "}", "\n", "return", "0", "\n", "}" ]
7,157
all-7158
[ "hasLocalMember", "checks", "that", "the", "cluster", "at", "least", "contains", "the", "local", "server", "." ]
[ "func", "(", "c", "*", "ServerConfig", ")", "hasLocalMember", "(", ")", "error", "{", "if", "urls", ":=", "c", ".", "InitialPeerURLsMap", "[", "c", ".", "<mask>", "]", ";", "urls", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "c", ".", "Name", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,158
all-7159
[ "SubscribeAsync", "subscribes", "to", "a", "topic", "with", "an", "asynchronous", "callback", "Transactional", "determines", "whether", "subsequent", "callbacks", "for", "a", "topic", "are", "run", "serially", "(", "true", ")", "or", "concurrently", "(", "false", ")", "Returns", "error", "if", "fn", "is", "not", "a", "function", "." ]
[ "func", "(", "bus", "*", "EventBus", ")", "SubscribeAsync", "(", "topic", "string", ",", "fn", "interface", "{", "}", ",", "transactional", "bool", ")", "error", "{", "return", "bus", ".", "doSubscribe", "(", "topic", ",", "fn", ",", "&", "eventHandler", "{", "reflect", ".", "ValueOf", "(", "fn", ")", ",", "false", ",", "<mask>", ",", "transactional", ",", "sync", ".", "Mutex", "{", "}", ",", "}", ")", "\n", "}" ]
7,159
all-7160
[ "notify", "function", "notifies", "the", "watcher", ".", "If", "the", "watcher", "interests", "in", "the", "given", "path", "the", "function", "will", "return", "true", "." ]
[ "func", "(", "w", "*", "watcher", ")", "notify", "(", "e", "*", "Event", ",", "originalPath", "bool", ",", "deleted", "bool", ")", "bool", "{", "// watcher is interested the path in three cases and under one condition", "// the condition is that the event happens after the watcher's sinceIndex", "// 1. the path at which the event happens is the path the watcher is watching at.", "// For example if the watcher is watching at \"/foo\" and the event happens at \"/foo\",", "// the watcher must be interested in that event.", "// 2. the watcher is a recursive watcher, it interests in the event happens after", "// its watching path. For example if watcher A watches at \"/foo\" and it is a recursive", "// one, it will interest in the event happens at \"/foo/bar\".", "// 3. when we delete a directory, we need to force notify all the watchers who watches", "// at the file we need to delete.", "// For example a watcher is watching at \"/foo/bar\". And we deletes \"/foo\". The watcher", "// should get notified even if \"/foo\" is not the path it is watching.", "if", "(", "w", ".", "recursive", "||", "originalPath", "||", "deleted", ")", "&&", "e", ".", "Index", "(", ")", ">=", "w", ".", "sinceIndex", "{", "// We cannot block here if the eventChan capacity is full, otherwise", "// etcd will hang. eventChan capacity is full when the rate of", "// notifications are higher than our send rate.", "// If this happens, we close the channel.", "<mask>", "{", "case", "w", ".", "eventChan", "<-", "e", ":", "default", ":", "// We have missed a notification. Remove the watcher.", "// Removing the watcher also closes the eventChan.", "w", ".", "remove", "(", ")", "\n", "}", "\n", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
7,160
all-7161
[ "splitN", "creates", "N", "Enumerators", "each", "will", "be", "a", "subset", "of", "the", "original", "Enumerator", "and", "will", "have", "distinct", "populations", "from", "one", "another", "." ]
[ "func", "(", "iter", "Enumerator", ")", "splitN", "(", "operation", "Transform", ",", "n", "uint", ")", "[", "]", "Enumerator", "{", "results", ",", "cast", ":=", "make", "(", "[", "]", "chan", "interface", "{", "}", ",", "n", ",", "n", ")", ",", "make", "(", "[", "]", "Enumerator", ",", "n", ",", "n", ")", "\n\n", "for", "i", ":=", "uint", "(", "0", ")", ";", "i", "<", "n", ";", "i", "++", "{", "results", "[", "i", "]", "=", "make", "(", "chan", "interface", "{", "}", ")", "\n", "cast", "[", "i", "]", "=", "results", "[", "i", "]", "\n", "}", "\n\n", "go", "func", "(", ")", "{", "for", "i", ":=", "uint", "(", "0", ")", ";", "i", "<", "n", ";", "i", "++", "{", "go", "func", "(", "addr", "uint", ")", "{", "defer", "close", "(", "results", "[", "addr", "]", ")", "\n", "for", "{", "read", ",", "ok", ":=", "<-", "iter", "\n", "if", "!", "ok", "{", "return", "\n", "}", "\n", "<mask>", "[", "addr", "]", "<-", "operation", "(", "read", ")", "\n", "}", "\n", "}", "(", "i", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "return", "cast", "\n", "}" ]
7,161
all-7162
[ "TODO", ":", "This", "could", "use", "a", "unit", "test", "." ]
[ "func", "parseSwarm", "(", "hostURL", "string", ",", "h", "*", "host", ".", "Host", ")", "(", "string", ",", "error", ")", "{", "swarmOptions", ":=", "h", ".", "HostOptions", ".", "SwarmOptions", "\n\n", "if", "!", "swarmOptions", ".", "Master", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "h", ".", "Name", ")", "\n", "}", "\n\n", "u", ",", "err", ":=", "url", ".", "Parse", "(", "swarmOptions", ".", "Host", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "<mask>", ":=", "strings", ".", "Split", "(", "u", ".", "Host", ",", "\"", "\"", ")", "\n", "swarmPort", ":=", "parts", "[", "1", "]", "\n\n", "// get IP of machine to replace in case swarm host is 0.0.0.0", "mURL", ",", "err", ":=", "url", ".", "Parse", "(", "hostURL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "mParts", ":=", "strings", ".", "Split", "(", "mURL", ".", "Host", ",", "\"", "\"", ")", "\n", "machineIP", ":=", "mParts", "[", "0", "]", "\n\n", "hostURL", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "machineIP", ",", "swarmPort", ")", "\n\n", "return", "hostURL", ",", "nil", "\n", "}" ]
7,162
all-7163
[ "Sign", "creates", "a", "signature", "for", "buf", "returning", "it", "as", "a", "URL", "-", "safe", "base64", "encoded", "byte", "slice", "." ]
[ "func", "(", "hs", "*", "HmacSigner", ")", "Sign", "(", "buf", "[", "]", "<mask>", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "sig", ",", "err", ":=", "hs", ".", "SignBytes", "(", "buf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "enc", ":=", "make", "(", "[", "]", "byte", ",", "b64", ".", "EncodedLen", "(", "len", "(", "sig", ")", ")", ")", "\n", "b64", ".", "Encode", "(", "enc", ",", "sig", ")", "\n\n", "return", "enc", ",", "nil", "\n", "}" ]
7,163
all-7164
[ "CopyState", "copies", "the", "alerting", "rule", "and", "staleness", "related", "state", "from", "the", "given", "group", ".", "Rules", "are", "matched", "based", "on", "their", "name", "and", "labels", ".", "If", "there", "are", "duplicates", "the", "first", "is", "matched", "with", "the", "first", "second", "with", "the", "second", "etc", "." ]
[ "func", "(", "g", "*", "Group", ")", "CopyState", "(", "from", "*", "Group", ")", "{", "g", ".", "evaluationDuration", "=", "from", ".", "evaluationDuration", "\n\n", "ruleMap", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "int", ",", "len", "(", "from", ".", "rules", ")", ")", "\n\n", "for", "fi", ",", "fromRule", ":=", "range", "from", ".", "rules", "{", "nameAndLabels", ":=", "nameAndLabels", "(", "fromRule", ")", "\n", "l", ":=", "ruleMap", "[", "nameAndLabels", "]", "\n", "ruleMap", "[", "nameAndLabels", "]", "=", "append", "(", "l", ",", "fi", ")", "\n", "}", "\n\n", "for", "i", ",", "rule", ":=", "range", "g", ".", "rules", "{", "nameAndLabels", ":=", "nameAndLabels", "(", "rule", ")", "\n", "indexes", ":=", "ruleMap", "[", "nameAndLabels", "]", "\n", "if", "len", "(", "indexes", ")", "==", "0", "{", "continue", "\n", "}", "\n", "fi", ":=", "indexes", "[", "0", "]", "\n", "g", ".", "seriesInPreviousEval", "[", "i", "]", "=", "from", ".", "seriesInPreviousEval", "[", "fi", "]", "\n", "ruleMap", "[", "nameAndLabels", "]", "=", "indexes", "[", "1", ":", "]", "\n\n", "ar", ",", "ok", ":=", "rule", ".", "(", "*", "AlertingRule", ")", "\n", "if", "!", "ok", "{", "continue", "\n", "}", "\n", "far", ",", "<mask>", ":=", "from", ".", "rules", "[", "fi", "]", ".", "(", "*", "AlertingRule", ")", "\n", "if", "!", "ok", "{", "continue", "\n", "}", "\n\n", "for", "fp", ",", "a", ":=", "range", "far", ".", "active", "{", "ar", ".", "active", "[", "fp", "]", "=", "a", "\n", "}", "\n", "}", "\n", "}" ]
7,164
all-7165
[ "removeExpired", "remove", "all", "expired", "values", "from", "current", "Cache", "instance", "list", ".", "Returns", "the", "locking", "status", "of", "current", "instance", "." ]
[ "func", "(", "s", "*", "Cache", ")", "removeExpired", "(", ")", "raiqub", ".", "LockStatus", "{", "writeLocked", ":=", "false", "\n", "s", ".", "RLock", "(", ")", "\n", "for", "i", ":=", "range", "s", ".", "<mask>", "{", "if", "s", ".", "values", "[", "i", "]", ".", "IsExpired", "(", ")", "{", "if", "!", "writeLocked", "{", "s", ".", "RUnlock", "(", ")", "\n", "s", ".", "Lock", "(", ")", "\n", "writeLocked", "=", "true", "\n", "}", "\n", "delete", "(", "s", ".", "values", ",", "i", ")", "\n", "}", "\n", "}", "\n\n", "if", "writeLocked", "{", "return", "raiqub", ".", "WriteLocked", "\n", "}", "else", "{", "return", "raiqub", ".", "ReadLocked", "\n", "}", "\n", "}" ]
7,165
all-7166
[ "NewMockECRFactory", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockECRFactory", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockECRFactory", "{", "mock", ":=", "&", "MockECRFactory", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockECRFactoryMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
7,166
all-7167
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetScrollbarsHiddenParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation4", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,167
all-7168
[ "Fatalf", "logging" ]
[ "func", "(", "l", "*", "MyLogger", ")", "Fatalf", "(", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "log", ".", "Panicf", "(", "<mask>", ",", "args", "...", ")", "\n", "}" ]
7,168
all-7169
[ "MutateManageOffer", "for", "Rate", "sets", "the", "ManageOfferOp", "s", "selling", "buying", "and", "price", "fields" ]
[ "func", "(", "m", "Rate", ")", "MutateManageOffer", "(", "o", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "switch", "o", ":=", "o", ".", "(", "type", ")", "{", "default", ":", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "case", "*", "xdr", ".", "ManageOfferOp", ":", "o", ".", "Selling", ",", "err", "=", "m", ".", "Selling", ".", "ToXdrObject", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "o", ".", "Buying", ",", "err", "=", "m", ".", "Buying", ".", "ToXdrObject", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "o", ".", "Price", ",", "err", "=", "price", ".", "Parse", "(", "string", "(", "m", ".", "Price", ")", ")", "\n", "case", "*", "xdr", ".", "CreatePassiveOfferOp", ":", "o", ".", "Selling", ",", "err", "=", "m", ".", "Selling", ".", "ToXdrObject", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "o", ".", "Buying", ",", "err", "=", "m", ".", "Buying", ".", "ToXdrObject", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "o", ".", "Price", ",", "err", "=", "<mask>", ".", "Parse", "(", "string", "(", "m", ".", "Price", ")", ")", "\n", "}", "\n", "return", "\n", "}" ]
7,169
all-7170
[ "MarkDay", "is", "a", "wrapper", "around", "gtk_calendar_mark_day", "()", "." ]
[ "func", "(", "v", "*", "Calendar", ")", "MarkDay", "(", "day", "uint", ")", "{", "C", ".", "gtk_calendar_mark_day", "(", "v", ".", "native", "(", ")", ",", "C", ".", "guint", "(", "<mask>", ")", ")", "\n", "}" ]
7,170
all-7171
[ "ConnectSignals", "is", "a", "wrapper", "around", "gtk_builder_connect_signals_full", "()", "." ]
[ "func", "(", "b", "*", "Builder", ")", "ConnectSignals", "(", "signals", "map", "[", "string", "]", "<mask>", "{", "}", ")", "{", "builderSignals", ".", "Lock", "(", ")", "\n", "builderSignals", ".", "m", "[", "b", ".", "native", "(", ")", "]", "=", "signals", "\n", "builderSignals", ".", "Unlock", "(", ")", "\n\n", "C", ".", "_gtk_builder_connect_signals_full", "(", "b", ".", "native", "(", ")", ")", "\n", "}" ]
7,171
all-7172
[ "ReceiveIssue", "creates", "a", "fake", "opened", "event" ]
[ "func", "(", "o", "*", "FakeOpenPluginWrapper", ")", "ReceiveIssue", "(", "issue", "sql", ".", "Issue", ")", "[", "]", "Point", "{", "if", "_", ",", "ok", ":=", "o", ".", "alreadyOpen", "[", "issue", ".", "ID", "]", ";", "!", "<mask>", "{", "// Create/Add fake \"opened\" events", "heap", ".", "Push", "(", "&", "o", ".", "openEvents", ",", "sql", ".", "IssueEvent", "{", "Event", ":", "\"", "\"", ",", "IssueID", ":", "issue", ".", "ID", ",", "Actor", ":", "&", "issue", ".", "User", ",", "EventCreatedAt", ":", "issue", ".", "IssueCreatedAt", ",", "}", ")", "\n", "o", ".", "alreadyOpen", "[", "issue", ".", "ID", "]", "=", "true", "\n", "}", "\n\n", "return", "o", ".", "plugin", ".", "ReceiveIssue", "(", "issue", ")", "\n", "}" ]
7,172
all-7173
[ "NewGraphicContext", "creates", "a", "new", "Graphic", "context", "from", "an", "image", "." ]
[ "func", "NewGraphicContext", "(", "img", "draw", ".", "Image", ")", "*", "GraphicContext", "{", "var", "painter", "Painter", "\n", "switch", "selectImage", ":=", "img", ".", "(", "type", ")", "{", "<mask>", "*", "image", ".", "RGBA", ":", "painter", "=", "raster", ".", "NewRGBAPainter", "(", "selectImage", ")", "\n", "default", ":", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "NewGraphicContextWithPainter", "(", "img", ",", "painter", ")", "\n", "}" ]
7,173
all-7174
[ "Send", "implements", "TCPSender", "by", "encoding", "the", "msg", "." ]
[ "func", "(", "sender", "*", "gobTCPSender", ")", "Send", "(", "msg", "[", "]", "<mask>", ")", "error", "{", "return", "sender", ".", "encoder", ".", "Encode", "(", "msg", ")", "\n", "}" ]
7,174
all-7175
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "Type", ")", "UnmarshalEasyJSON", "(", "<mask>", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "Type", "(", "in", ".", "String", "(", ")", ")", "{", "case", "TypeCSSTransition", ":", "*", "t", "=", "TypeCSSTransition", "\n", "case", "TypeCSSAnimation", ":", "*", "t", "=", "TypeCSSAnimation", "\n", "case", "TypeWebAnimation", ":", "*", "t", "=", "TypeWebAnimation", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
7,175
all-7176
[ "Do", "executes", "Page", ".", "stopLoading", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "StopLoadingParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandStopLoading", ",", "nil", ",", "nil", ")", "\n", "}" ]
7,176
all-7177
[ "monitorDiskAndEvict", "loops", "monitoring", "the", "disk", "evicting", "cache", "entries", "when", "the", "disk", "passes", "either", "minPercentBlocksFree", "until", "the", "disk", "is", "above", "evictUntilPercentBlocksFree" ]
[ "func", "monitorDiskAndEvict", "(", "c", "*", "diskcache", ".", "Cache", ",", "interval", "time", ".", "Duration", ",", "minPercentBlocksFree", ",", "evictUntilPercentBlocksFree", "float64", ",", ")", "{", "diskRoot", ":=", "c", ".", "DiskRoot", "(", ")", "\n", "// forever check if usage is past thresholds and evict", "ticker", ":=", "time", ".", "NewTicker", "(", "interval", ")", "\n", "for", ";", "true", ";", "<-", "ticker", ".", "C", "{", "blocksFree", ",", "_", ",", "_", ",", "err", ":=", "diskutil", ".", "GetDiskUsage", "(", "diskRoot", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "continue", "\n", "}", "\n", "logger", ":=", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "blocksFree", ",", "}", ")", "\n", "logger", ".", "Info", "(", "\"", "\"", ")", "\n", "// if we are past the threshold, start evicting", "if", "blocksFree", "<", "minPercentBlocksFree", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "// get all cache entries and sort by lastaccess", "// so we can pop entries until we have evicted enough", "files", ":=", "c", ".", "GetEntries", "(", ")", "\n", "sort", ".", "Slice", "(", "files", ",", "func", "(", "i", ",", "j", "int", ")", "bool", "{", "return", "files", "[", "i", "]", ".", "LastAccess", ".", "Before", "(", "files", "[", "j", "]", ".", "LastAccess", ")", "\n", "}", ")", "\n", "// evict until we pass the safe threshold so we don't thrash at the eviction trigger", "for", "blocksFree", "<", "evictUntilPercentBlocksFree", "{", "if", "len", "(", "files", ")", "<", "1", "{", "logger", ".", "Fatal", "(", "\"", "\"", ")", "\n", "}", "\n", "// pop entry and delete", "var", "entry", "diskcache", ".", "EntryInfo", "\n", "entry", ",", "files", "=", "files", "[", "0", "]", ",", "files", "[", "1", ":", "]", "\n", "err", "=", "c", ".", "Delete", "(", "c", ".", "PathToKey", "(", "entry", ".", "Path", ")", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "entry", ".", "<mask>", ")", "\n", "}", "else", "{", "promMetrics", ".", "FilesEvicted", ".", "Inc", "(", ")", "\n", "promMetrics", ".", "LastEvictedAccessAge", ".", "Set", "(", "time", ".", "Now", "(", ")", ".", "Sub", "(", "entry", ".", "LastAccess", ")", ".", "Hours", "(", ")", ")", "\n", "}", "\n", "// get new disk usage", "blocksFree", ",", "_", ",", "_", ",", "err", "=", "diskutil", ".", "GetDiskUsage", "(", "diskRoot", ")", "\n", "logger", "=", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "blocksFree", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "continue", "\n", "}", "\n", "}", "\n", "logger", ".", "Info", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}" ]
7,177
all-7178
[ "GetStringPolicy", "reads", "a", "ResourceData", "and", "returns", "an", "appropriate", "StringPolicy", "for", "the", "state", "of", "the", "definition", ".", "nil", "is", "returned", "if", "it", "does", "not", "exist", "." ]
[ "func", "GetStringPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "key", "string", ")", "*", "<mask>", ".", "StringPolicy", "{", "v", ",", "e", ":=", "d", ".", "GetOkExists", "(", "key", ")", "\n", "if", "e", "{", "return", "StringPolicy", "(", "v", ".", "(", "string", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,178
all-7179
[ "/", "1", ".", "0", "/", "storage", "-", "pools", "/", "{", "pool", "}", "/", "volumes", "/", "{", "type", "}", "/", "{", "name", "}", "Get", "storage", "volume", "of", "a", "given", "volume", "type", "on", "a", "given", "storage", "pool", "." ]
[ "func", "storagePoolVolumeTypeGet", "(", "d", "*", "Daemon", ",", "r", "*", "http", ".", "Request", ",", "volumeTypeName", "string", ")", "Response", "{", "project", ":=", "projectParam", "(", "r", ")", "\n\n", "// Get the name of the storage volume.", "var", "volumeName", "string", "\n", "fields", ":=", "strings", ".", "Split", "(", "mux", ".", "Vars", "(", "r", ")", "[", "\"", "\"", "]", ",", "\"", "\"", ")", "\n\n", "if", "len", "(", "fields", ")", "==", "3", "&&", "fields", "[", "1", "]", "==", "\"", "\"", "{", "// Handle volume snapshots", "volumeName", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "fields", "[", "0", "]", ",", "shared", ".", "SnapshotDelimiter", ",", "fields", "[", "2", "]", ")", "\n", "}", "else", "if", "len", "(", "<mask>", ")", ">", "1", "{", "volumeName", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "fields", "[", "0", "]", ",", "shared", ".", "SnapshotDelimiter", ",", "fields", "[", "1", "]", ")", "\n", "}", "else", "if", "len", "(", "fields", ")", ">", "0", "{", "// Handle volume", "volumeName", "=", "fields", "[", "0", "]", "\n", "}", "else", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "mux", ".", "Vars", "(", "r", ")", "[", "\"", "\"", "]", ")", ")", "\n", "}", "\n\n", "// Get the name of the storage pool the volume is supposed to be", "// attached to.", "poolName", ":=", "mux", ".", "Vars", "(", "r", ")", "[", "\"", "\"", "]", "\n\n", "// Convert the volume type name to our internal integer representation.", "volumeType", ",", "err", ":=", "storagePoolVolumeTypeNameToType", "(", "volumeTypeName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "BadRequest", "(", "err", ")", "\n", "}", "\n", "// Check that the storage volume type is valid.", "if", "!", "shared", ".", "IntInSlice", "(", "volumeType", ",", "supportedVolumeTypes", ")", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "volumeTypeName", ")", ")", "\n", "}", "\n\n", "// Get the ID of the storage pool the storage volume is supposed to be", "// attached to.", "poolID", ",", "err", ":=", "d", ".", "cluster", ".", "StoragePoolGetID", "(", "poolName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "response", ":=", "ForwardedResponseIfTargetIsRemote", "(", "d", ",", "r", ")", "\n", "if", "response", "!=", "nil", "{", "return", "response", "\n", "}", "\n\n", "response", "=", "ForwardedResponseIfVolumeIsRemote", "(", "d", ",", "r", ",", "poolID", ",", "volumeName", ",", "volumeType", ")", "\n", "if", "response", "!=", "nil", "{", "return", "response", "\n", "}", "\n\n", "// Get the storage volume.", "_", ",", "volume", ",", "err", ":=", "d", ".", "cluster", ".", "StoragePoolNodeVolumeGetType", "(", "volumeName", ",", "volumeType", ",", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "volumeUsedBy", ",", "err", ":=", "storagePoolVolumeUsedByGet", "(", "d", ".", "State", "(", ")", ",", "project", ",", "volume", ".", "Name", ",", "volume", ".", "Type", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n", "volume", ".", "UsedBy", "=", "volumeUsedBy", "\n\n", "etag", ":=", "[", "]", "interface", "{", "}", "{", "volumeName", ",", "volume", ".", "Type", ",", "volume", ".", "Config", "}", "\n\n", "return", "SyncResponseETag", "(", "true", ",", "volume", ",", "etag", ")", "\n", "}" ]
7,179
all-7180
[ "JSONUnmarshal", "decodes", "data", "into", "v", "and", "returns", "json", ".", "SyntaxError", "and", "json", ".", "UnmarshalTypeError", "formated", "with", "additional", "information", "." ]
[ "func", "JSONUnmarshal", "(", "data", "[", "]", "byte", ",", "v", "interface", "{", "}", ")", "error", "{", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "v", ")", ";", "err", "!=", "nil", "{", "switch", "e", ":=", "err", ".", "(", "type", ")", "{", "case", "*", "json", ".", "SyntaxError", ":", "line", ",", "col", ":=", "getLineColFromOffset", "(", "data", ",", "e", ".", "Offset", ")", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "e", ",", "line", ",", "col", ")", "\n", "case", "*", "json", ".", "UnmarshalTypeError", ":", "line", ",", "<mask>", ":=", "getLineColFromOffset", "(", "data", ",", "e", ".", "Offset", ")", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "e", ".", "Type", ",", "e", ".", "Value", ",", "line", ",", "col", ")", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,180
all-7181
[ "Delete", "all", "items", "from", "the", "cache", "." ]
[ "func", "(", "c", "*", "cache", ")", "Flush", "(", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "c", ".", "items", "=", "<mask>", "[", "string", "]", "Item", "{", "}", "\n", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "}" ]
7,181
all-7182
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ViolationSetting", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoLog", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
7,182
all-7183
[ "Valid", "returns", "whether", "the", "MergeIterator", "is", "at", "a", "valid", "element", "." ]
[ "func", "(", "s", "*", "MergeIterator", ")", "Valid", "(", ")", "bool", "{", "if", "s", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "len", "(", "s", ".", "h", ")", "==", "0", "{", "return", "<mask>", "\n", "}", "\n", "return", "s", ".", "h", "[", "0", "]", ".", "itr", ".", "Valid", "(", ")", "\n", "}" ]
7,183
all-7184
[ "PostForm", "posts", "urlencoded", "form", "with", "values", "and", "returns", "the", "result", "c", ".", "PostForm", "(", "c", ".", "Endpoint", "(", "users", ")", "url", ".", "Values", "{", "name", ":", "[]", "string", "{", "John", "}}", ")" ]
[ "func", "(", "c", "*", "Client", ")", "PostForm", "(", "ctx", "context", ".", "Context", ",", "endpoint", "string", ",", "vals", "url", ".", "Values", ",", "files", "...", "<mask>", ")", "(", "*", "Response", ",", "error", ")", "{", "// If the sanitizer is enabled, make sure the requested path is safe.", "if", "c", ".", "sanitizerEnabled", "{", "err", ":=", "isPathSafe", "(", "endpoint", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "return", "c", ".", "RoundTrip", "(", "func", "(", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "if", "len", "(", "files", ")", "==", "0", "{", "req", ",", "err", ":=", "http", ".", "NewRequest", "(", "http", ".", "MethodPost", ",", "endpoint", ",", "strings", ".", "NewReader", "(", "vals", ".", "Encode", "(", ")", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "req", "=", "req", ".", "WithContext", "(", "ctx", ")", "\n", "req", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "c", ".", "addAuth", "(", "req", ")", "\n", "return", "c", ".", "client", ".", "Do", "(", "req", ")", "\n", "}", "\n\n", "var", "buf", "bytes", ".", "Buffer", "\n", "buf", ".", "Grow", "(", "bufferSize", ")", "\n\n", "// Cache file reads in case we reach the memory limit", "// and need to rewind", "buffers", ":=", "newBuffersFromFiles", "(", "files", ")", "\n", "writer", ":=", "multipart", ".", "NewWriter", "(", "&", "limitWriter", "{", "&", "buf", ",", "bufferSize", "}", ")", "\n", "err", ":=", "writeForm", "(", "writer", ",", "vals", ",", "buffers", "...", ")", "\n", "writer", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "&&", "err", "!=", "errShortWrite", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "err", "==", "errShortWrite", "{", "// Switch to io.Pipe as the data is larger than the memory limit", "for", "i", ":=", "range", "buffers", "{", "buffers", "[", "i", "]", ".", "rewind", "(", ")", "\n", "}", "\n", "return", "c", ".", "writeWithPipe", "(", "endpoint", ",", "vals", ",", "buffers", "...", ")", "\n", "}", "\n\n", "req", ",", "err", ":=", "http", ".", "NewRequest", "(", "http", ".", "MethodPost", ",", "endpoint", ",", "&", "buf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "req", "=", "req", ".", "WithContext", "(", "ctx", ")", "\n", "req", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "`multipart/form-data;boundary=\"%v\"`", ",", "writer", ".", "Boundary", "(", ")", ")", ")", "\n", "c", ".", "addAuth", "(", "req", ")", "\n", "return", "c", ".", "client", ".", "Do", "(", "req", ")", "\n", "}", ")", "\n", "}" ]
7,184
all-7185
[ "GetEvent", "()", "is", "a", "wrapper", "around", "gdk_display_get_event", "()", "." ]
[ "func", "(", "v", "*", "Display", ")", "GetEvent", "(", ")", "(", "*", "Event", ",", "error", ")", "{", "c", ":=", "C", ".", "gdk_display_get_event", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "//The finalizer is not on the glib.Object but on the event.", "e", ":=", "&", "<mask>", "{", "c", "}", "\n", "runtime", ".", "SetFinalizer", "(", "e", ",", "(", "*", "Event", ")", ".", "free", ")", "\n", "return", "e", ",", "nil", "\n", "}" ]
7,185
all-7186
[ "GetSecondsOk", "returns", "a", "tuple", "with", "the", "Seconds", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "p", "*", "Period", ")", "GetSecondsOk", "(", ")", "(", "json", ".", "Number", ",", "bool", ")", "{", "if", "p", "==", "nil", "||", "p", ".", "Seconds", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "p", ".", "Seconds", ",", "<mask>", "\n", "}" ]
7,186
all-7187
[ "RemoveNetworkAdapter", "deletes", "network", "adapter", "from", "VMX", "file", "that", "matches", "the", "ID", "in", "adapter", ".", "Id", "." ]
[ "func", "(", "v", "*", "VM", ")", "RemoveNetworkAdapter", "(", "adapter", "*", "NetworkAdapter", ")", "error", "{", "isVMRunning", ",", "err", ":=", "v", ".", "IsRunning", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "isVMRunning", "{", "return", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "100000", ",", "<mask>", ":", "\"", "\"", ",", "}", "\n", "}", "\n\n", "vmxPath", ",", "err", ":=", "v", ".", "VmxPath", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "vmx", ",", "err", ":=", "readVmx", "(", "vmxPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "device", ":=", "\"", "\"", "+", "adapter", ".", "ID", "\n\n", "for", "key", ":=", "range", "vmx", "{", "if", "strings", ".", "HasPrefix", "(", "key", ",", "device", ")", "{", "delete", "(", "vmx", ",", "key", ")", "\n", "}", "\n", "}", "\n\n", "vmx", "[", "device", "+", "\"", "\"", "]", "=", "\"", "\"", "\n\n", "err", "=", "writeVmx", "(", "vmxPath", ",", "vmx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
7,187
all-7188
[ "GetBool", "returns", "a", "boolean", "value", "for", "a", "specific", "column", "." ]
[ "func", "(", "r", "Record", ")", "GetBool", "(", "<mask>", "string", ")", "(", "bool", ",", "error", ")", "{", "v", ",", "err", ":=", "r", ".", "getKey", "(", "reflect", ".", "Float64", ",", "column", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n\n", "return", "v", "==", "1.0", ",", "nil", "\n", "}" ]
7,188
all-7189
[ "Expand", "until", "there", "are", "no", "more", "expansions", "to", "do" ]
[ "func", "(", "tokens", "Tokens", ")", "Expand", "(", ")", "(", "result", "Tokens", ",", "err", "error", ")", "{", "var", "updated", "bool", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "tokens", ")", ";", "i", "++", "{", "var", "start", "int", "\n", "quote", ":=", "Token", "{", "symbolToken", ",", "\"", "\"", "}", "\n", "if", "*", "tokens", "[", "i", "]", "!=", "quote", "{", "result", "=", "append", "(", "result", ",", "tokens", "[", "i", "]", ")", "\n", "}", "else", "{", "updated", "=", "true", "\n", "for", "start", "=", "i", "+", "1", ";", "*", "tokens", "[", "start", "]", "==", "quote", ";", "start", "++", "{", "result", "=", "append", "(", "result", ",", "tokens", "[", "start", "]", ")", "\n", "}", "\n", "if", "tokens", "[", "i", "+", "1", "]", ".", "typ", "==", "openToken", "{", "if", "i", ",", "err", "=", "tokens", ".", "findClose", "(", "start", "+", "1", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "else", "{", "i", "=", "<mask>", "\n", "}", "\n", "result", "=", "append", "(", "result", ",", "&", "Token", "{", "openToken", ",", "\"", "\"", "}", ",", "&", "Token", "{", "symbolToken", ",", "\"", "\"", "}", ")", "\n", "result", "=", "append", "(", "result", ",", "tokens", "[", "start", ":", "i", "+", "1", "]", "...", ")", "\n", "result", "=", "append", "(", "result", ",", "&", "Token", "{", "closeToken", ",", "\"", "\"", "}", ")", "\n", "}", "\n", "}", "\n", "if", "updated", "{", "result", ",", "err", "=", "result", ".", "Expand", "(", ")", "\n", "}", "\n", "return", "\n", "}" ]
7,189
all-7190
[ "MustSetOptionsOp", "retrieves", "the", "SetOptionsOp", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "OperationBody", ")", "MustSetOptionsOp", "(", ")", "SetOptionsOp", "{", "val", ",", "ok", ":=", "u", ".", "GetSetOptionsOp", "(", ")", "\n\n", "if", "!", "<mask>", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
7,190
all-7191
[ "handleMessages", "processes", "refresh", "credentials", "messages", "in", "the", "buffer", "in", "-", "order" ]
[ "func", "(", "refreshHandler", "*", "refreshCredentialsHandler", ")", "handleMessages", "(", ")", "{", "for", "{", "<mask>", "{", "case", "message", ":=", "<-", "refreshHandler", ".", "messageBuffer", ":", "refreshHandler", ".", "handleSingleMessage", "(", "message", ")", "\n", "case", "<-", "refreshHandler", ".", "ctx", ".", "Done", "(", ")", ":", "return", "\n", "}", "\n", "}", "\n", "}" ]
7,191
all-7192
[ "Warnf", "logs", "at", "the", "WARNING", "log", "level", "using", "a", "standard", "printf", "format", "string" ]
[ "func", "Warnf", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "if", "Log", "!=", "nil", "{", "Log", ".", "Warn", "(", "fmt", ".", "Sprintf", "(", "<mask>", ",", "args", "...", ")", ")", "\n", "}", "\n", "}" ]
7,192
all-7193
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "CachedResponseType", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "CachedResponseType", "(", "in", ".", "<mask>", "(", ")", ")", "{", "case", "CachedResponseTypeBasic", ":", "*", "t", "=", "CachedResponseTypeBasic", "\n", "case", "CachedResponseTypeCors", ":", "*", "t", "=", "CachedResponseTypeCors", "\n", "case", "CachedResponseTypeDefault", ":", "*", "t", "=", "CachedResponseTypeDefault", "\n", "case", "CachedResponseTypeError", ":", "*", "t", "=", "CachedResponseTypeError", "\n", "case", "CachedResponseTypeOpaqueResponse", ":", "*", "t", "=", "CachedResponseTypeOpaqueResponse", "\n", "case", "CachedResponseTypeOpaqueRedirect", ":", "*", "t", "=", "CachedResponseTypeOpaqueRedirect", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
7,193
all-7194
[ "Write", "marshals", "and", "writes", "VMX", "file", "to", "disk" ]
[ "func", "(", "vmxfile", "*", "VMXFile", ")", "Write", "(", ")", "error", "{", "file", ",", "err", ":=", "os", ".", "Create", "(", "vmxfile", ".", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "file", ".", "Close", "(", ")", "\n\n", "data", ",", "err", ":=", "vmx", ".", "Marshal", "(", "vmxfile", ".", "model", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "_", ",", "err", "=", "<mask>", ".", "Write", "(", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
7,194
all-7195
[ "Repeat", "emits", "n", "copies", "of", "s", "." ]
[ "func", "Repeat", "(", "s", "string", ",", "n", "int", ")", "<mask>", "{", "return", "FilterFunc", "(", "func", "(", "arg", "Arg", ")", "error", "{", "for", "i", ":=", "0", ";", "i", "<", "n", ";", "i", "++", "{", "arg", ".", "Out", "<-", "s", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
7,195
all-7196
[ "GetImageAliases", "returns", "the", "list", "of", "available", "aliases", "as", "ImageAliasesEntry", "structs" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetImageAliases", "(", ")", "(", "[", "]", "api", ".", "ImageAliasesEntry", ",", "error", ")", "{", "aliases", ":=", "[", "]", "api", ".", "ImageAliasesEntry", "{", "}", "\n\n", "// Fetch the raw value", "_", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "\"", "\"", ",", "&", "aliases", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "<mask>", "aliases", ",", "nil", "\n", "}" ]
7,196
all-7197
[ "Skip", "skips", "cnt", "bytes", "from", "reading", "." ]
[ "func", "(", "r", "*", "Reader", ")", "Skip", "(", "cnt", "int", ")", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "<mask>", "n", "int", "\n", "n", ",", "r", ".", "err", "=", "r", ".", "rd", ".", "Discard", "(", "cnt", ")", "\n", "r", ".", "cnt", "+=", "n", "\n", "}" ]
7,197
all-7198
[ "output", "writes", "the", "data", "to", "the", "log", "files", "and", "releases", "the", "buffer", "." ]
[ "func", "(", "l", "*", "<mask>", ")", "output", "(", "s", "Severity", ",", "buf", "*", "buffer", ",", "file", "string", ",", "line", "int", ")", "{", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "if", "l", ".", "traceLocation", ".", "isSet", "(", ")", "{", "if", "l", ".", "traceLocation", ".", "match", "(", "file", ",", "line", ")", "{", "buf", ".", "Write", "(", "stacks", "(", "false", ",", "l", ".", "maxStackBufSize", ")", ")", "\n", "}", "\n", "}", "\n", "data", ":=", "buf", ".", "Bytes", "(", ")", "\n", "if", "l", ".", "toStderr", "{", "os", ".", "Stderr", ".", "Write", "(", "data", ")", "\n", "}", "else", "{", "if", "l", ".", "alsoToStderr", "||", "s", ">=", "l", ".", "stderrThreshold", ".", "get", "(", ")", "{", "os", ".", "Stderr", ".", "Write", "(", "data", ")", "\n", "}", "\n", "if", "l", ".", "file", "[", "s", "]", "==", "nil", "{", "if", "err", ":=", "l", ".", "createFiles", "(", "s", ")", ";", "err", "!=", "nil", "{", "os", ".", "Stderr", ".", "Write", "(", "data", ")", "// Make sure the message appears somewhere.", "\n", "l", ".", "exit", "(", "err", ")", "\n", "}", "\n", "}", "\n", "switch", "s", "{", "case", "FatalLog", ":", "l", ".", "file", "[", "FatalLog", "]", ".", "Write", "(", "data", ")", "\n", "fallthrough", "\n", "case", "ErrorLog", ":", "l", ".", "file", "[", "ErrorLog", "]", ".", "Write", "(", "data", ")", "\n", "fallthrough", "\n", "case", "WarningLog", ":", "l", ".", "file", "[", "WarningLog", "]", ".", "Write", "(", "data", ")", "\n", "fallthrough", "\n", "case", "InfoLog", ":", "l", ".", "file", "[", "InfoLog", "]", ".", "Write", "(", "data", ")", "\n", "}", "\n", "}", "\n", "if", "s", "==", "FatalLog", "{", "// Make sure we see the trace for the current goroutine on standard error.", "if", "!", "l", ".", "toStderr", "{", "os", ".", "Stderr", ".", "Write", "(", "stacks", "(", "false", ",", "l", ".", "maxStackBufSize", ")", ")", "\n", "}", "\n", "// Write the stack trace for all goroutines to the files.", "trace", ":=", "stacks", "(", "true", ",", "l", ".", "maxStackBufSize", ")", "\n", "logExitFunc", "=", "func", "(", "error", ")", "{", "}", "// If we get a write error, we'll still exit below.", "\n", "for", "log", ":=", "FatalLog", ";", "log", ">=", "InfoLog", ";", "log", "--", "{", "if", "f", ":=", "l", ".", "file", "[", "log", "]", ";", "f", "!=", "nil", "{", "// Can be nil if -logtostderr is set.", "f", ".", "Write", "(", "trace", ")", "\n", "}", "\n", "}", "\n", "l", ".", "mu", ".", "Unlock", "(", ")", "\n", "timeoutFlush", "(", "l", ",", "10", "*", "time", ".", "Second", ")", "\n", "os", ".", "Exit", "(", "255", ")", "// C++ uses -1, which is silly because it's anded with 255 anyway.", "\n", "}", "\n", "l", ".", "putBuffer", "(", "buf", ")", "\n", "l", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "stats", ":=", "l", ".", "severityStats", "[", "s", "]", ";", "stats", "!=", "nil", "{", "atomic", ".", "AddInt64", "(", "&", "stats", ".", "lines", ",", "1", ")", "\n", "atomic", ".", "AddInt64", "(", "&", "stats", ".", "bytes", ",", "int64", "(", "len", "(", "data", ")", ")", ")", "\n", "}", "\n", "}" ]
7,198
all-7199
[ "NetworkRename", "renames", "a", "network", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "NetworkRename", "(", "oldName", "string", ",", "newName", "string", ")", "error", "{", "<mask>", ",", "_", ",", "err", ":=", "c", ".", "NetworkGet", "(", "oldName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "_", ",", "err", "=", "tx", ".", "tx", ".", "Exec", "(", "\"", "\"", ",", "newName", ",", "id", ")", "\n", "return", "err", "\n", "}", ")", "\n\n", "return", "err", "\n", "}" ]
7,199
all-7200
[ "DepthMatchAll", "performs", "a", "depth", "first", "search", "of", "the", "Part", "tree", "and", "returns", "all", "parts", "that", "causes", "the", "given", "matcher", "to", "return", "true" ]
[ "func", "(", "p", "*", "Part", ")", "DepthMatchAll", "(", "matcher", "PartMatcher", ")", "[", "]", "*", "Part", "{", "root", ":=", "p", "\n", "matches", ":=", "make", "(", "[", "]", "*", "<mask>", ",", "0", ",", "10", ")", "\n", "for", "{", "if", "matcher", "(", "p", ")", "{", "matches", "=", "append", "(", "matches", ",", "p", ")", "\n", "}", "\n", "c", ":=", "p", ".", "FirstChild", "\n", "if", "c", "!=", "nil", "{", "p", "=", "c", "\n", "}", "else", "{", "for", "p", ".", "NextSibling", "==", "nil", "{", "if", "p", "==", "root", "{", "return", "matches", "\n", "}", "\n", "p", "=", "p", ".", "Parent", "\n", "}", "\n", "p", "=", "p", ".", "NextSibling", "\n", "}", "\n", "}", "\n", "}" ]