id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
24,100
all-24101
[ "newExchange", "creates", "and", "adds", "a", "new", "message", "exchange", "to", "this", "set" ]
[ "func", "(", "mexset", "*", "messageExchangeSet", ")", "newExchange", "(", "ctx", "context", ".", "Context", ",", "framePool", "FramePool", ",", "msgType", "messageType", ",", "msgID", "uint32", ",", "bufferSize", "int", ")", "(", "*", "messageExchange", ",", "error", ")", "{", "if", "mexset", ".", "log", ".", "Enabled", "(", "LogLevelDebug", ")", "{", "mexset", ".", "log", ".", "Debugf", "(", "\"", "\"", ",", "mexset", ".", "name", ",", "msgType", ",", "msgID", ")", "\n", "}", "\n\n", "mex", ":=", "&", "messageExchange", "{", "msgType", ":", "msgType", ",", "msgID", ":", "msgID", ",", "ctx", ":", "ctx", ",", "recvCh", ":", "<mask>", "(", "chan", "*", "Frame", ",", "bufferSize", ")", ",", "errCh", ":", "newErrNotifier", "(", ")", ",", "mexset", ":", "mexset", ",", "framePool", ":", "framePool", ",", "}", "\n\n", "mexset", ".", "Lock", "(", ")", "\n", "addErr", ":=", "mexset", ".", "addExchange", "(", "mex", ")", "\n", "mexset", ".", "Unlock", "(", ")", "\n\n", "if", "addErr", "!=", "nil", "{", "logger", ":=", "mexset", ".", "log", ".", "WithFields", "(", "LogField", "{", "\"", "\"", ",", "mex", ".", "msgID", "}", ",", "LogField", "{", "\"", "\"", ",", "mex", ".", "msgType", "}", ",", "LogField", "{", "\"", "\"", ",", "mexset", ".", "name", "}", ",", ")", "\n", "if", "addErr", "==", "errMexSetShutdown", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "}", "else", "if", "addErr", "==", "errDuplicateMex", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", ",", "addErr", "\n", "}", "\n\n", "mexset", ".", "onAdded", "(", ")", "\n\n", "// TODO(mmihic): Put into a deadline ordered heap so we can garbage collected expired exchanges", "return", "mex", ",", "nil", "\n", "}" ]
24,101
all-24102
[ "PrintFunc", "outputs", "Print", "log", "returned", "from", "the", "function" ]
[ "func", "(", "g", "*", "Glg", ")", "PrintFunc", "(", "f", "func", "(", ")", "string", ")", "error", "{", "if", "g", ".", "isModeEnable", "(", "PRINT", ")", "{", "return", "g", ".", "<mask>", "(", "PRINT", ",", "\"", "\"", ",", "f", "(", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
24,102
all-24103
[ "Uniq", "returns", "a", "slice", "containing", "the", "unique", "strings", "found", "in", "items" ]
[ "func", "Uniq", "(", "items", "[", "]", "string", ")", "(", "uniqItems", "[", "]", "string", ")", "{", "sort", ".", "Strings", "(", "items", ")", "\n\n", "lastitem", ":=", "\"", "\"", "\n", "for", "_", ",", "<mask>", ":=", "range", "items", "{", "if", "item", "!=", "lastitem", "{", "uniqItems", "=", "append", "(", "uniqItems", ",", "item", ")", "\n", "lastitem", "=", "item", "\n", "}", "\n", "}", "\n\n", "return", "\n", "}" ]
24,103
all-24104
[ "FocusCell", "()", "is", "a", "wrapper", "around", "gtk_tree_view_column_focus_cell", "()", "." ]
[ "func", "(", "v", "*", "TreeViewColumn", ")", "FocusCell", "(", "cell", "*", "CellRenderer", ")", "{", "C", ".", "gtk_tree_view_column_focus_cell", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "native", "(", ")", ")", "\n", "}" ]
24,104
all-24105
[ "CertificateSubjContainsTLD", "checks", "whether", "the", "provided", "Certificate", "has", "a", "Subject", "Common", "Name", "or", "DNS", "Subject", "Alternate", "Name", "that", "ends", "in", "the", "provided", "TLD", "label", ".", "If", "IsInTLDMap", "(", "label", ")", "returns", "false", "then", "CertificateSubjInTLD", "will", "return", "false", "." ]
[ "func", "CertificateSubjInTLD", "(", "c", "*", "x509", ".", "Certificate", ",", "label", "string", ")", "bool", "{", "label", "=", "strings", ".", "ToLower", "(", "label", ")", "\n", "if", "strings", ".", "HasPrefix", "(", "label", ",", "\"", "\"", ")", "{", "label", "=", "label", "[", "1", ":", "]", "\n", "}", "\n", "if", "!", "IsInTLDMap", "(", "label", ")", "{", "return", "false", "\n", "}", "\n", "for", "_", ",", "name", ":=", "range", "append", "(", "c", ".", "DNSNames", ",", "c", ".", "Subject", ".", "CommonName", ")", "{", "if", "strings", ".", "HasSuffix", "(", "name", ",", "\"", "\"", "+", "<mask>", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
24,105
all-24106
[ "HasExposedPorts", "returns", "whether", "current", "container", "has", "exposed", "ports", "." ]
[ "func", "(", "s", "*", "Container", ")", "HasExposedPorts", "(", ")", "bool", "{", "nodes", ",", "err", ":=", "s", ".", "NetworkNodes", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n\n", "for", "_", ",", "v", ":=", "<mask>", "nodes", "{", "if", "v", ".", "Port", ">", "0", "||", "len", "(", "v", ".", "Protocol", ")", ">", "0", "{", "return", "true", "\n", "}", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
24,106
all-24107
[ "A", "bit", "-", "mask", "representing", "the", "state", "of", "the", "modifier", "keys", "(", "e", ".", "g", ".", "Control", "Shift", "and", "Alt", ")", "and", "the", "pointer", "buttons", ".", "See", "gdk", ".", "ModifierType", "constants", "." ]
[ "func", "(", "v", "*", "EventMotion", ")", "State", "(", ")", "ModifierType", "{", "c", ":=", "v", ".", "native", "(", ")", ".", "<mask>", "\n", "return", "ModifierType", "(", "c", ")", "\n", "}" ]
24,107
all-24108
[ "MarshalBinary", "interface", "implementation" ]
[ "func", "(", "m", "*", "AppsWrapper", ")", "MarshalBinary", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "if", "m", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "swag", ".", "WriteJSON", "(", "m", ")", "\n", "}" ]
24,108
all-24109
[ "userAddCommandFunc", "executes", "the", "user", "add", "command", "." ]
[ "func", "userAddCommandFunc", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "if", "len", "(", "args", ")", "!=", "1", "{", "ExitWithError", "(", "ExitBadArgs", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "var", "password", "string", "\n", "var", "user", "string", "\n\n", "if", "passwordFromFlag", "!=", "\"", "\"", "{", "user", "=", "args", "[", "0", "]", "\n", "password", "=", "passwordFromFlag", "\n", "}", "else", "{", "splitted", ":=", "strings", ".", "SplitN", "(", "args", "[", "0", "]", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "splitted", ")", "<", "2", "{", "user", "=", "args", "[", "0", "]", "\n", "if", "!", "passwordInteractive", "{", "fmt", ".", "Scanf", "(", "\"", "\"", ",", "&", "password", ")", "\n", "}", "else", "{", "password", "=", "readPasswordInteractive", "(", "args", "[", "0", "]", ")", "\n", "}", "\n", "}", "else", "{", "<mask>", "=", "splitted", "[", "0", "]", "\n", "password", "=", "splitted", "[", "1", "]", "\n", "if", "len", "(", "user", ")", "==", "0", "{", "ExitWithError", "(", "ExitBadArgs", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "resp", ",", "err", ":=", "mustClientFromCmd", "(", "cmd", ")", ".", "Auth", ".", "UserAdd", "(", "context", ".", "TODO", "(", ")", ",", "user", ",", "password", ")", "\n", "if", "err", "!=", "nil", "{", "ExitWithError", "(", "ExitError", ",", "err", ")", "\n", "}", "\n\n", "display", ".", "UserAdd", "(", "user", ",", "*", "resp", ")", "\n", "}" ]
24,109
all-24110
[ "PeakHeader", "get", "only", "header", "part", "from", "tail", "segment", "from", "stack", "without", "remove" ]
[ "func", "(", "s", "*", "Stack", ")", "PeakHeader", "(", ")", "(", "header", "[", "]", "byte", ",", "err", "error", ")", "{", "if", "s", ".", "depth", "==", "0", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "s", ".", "guard", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "<mask>", ".", "Unlock", "(", ")", "\n", "s", ".", "lastAccess", "=", "time", ".", "Now", "(", ")", "\n", "file", ",", "err", ":=", "s", ".", "getFile", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "header", "=", "make", "(", "[", "]", "byte", ",", "s", ".", "currentBlock", ".", "HeaderSize", ")", "\n", "// Read header", "_", ",", "err", "=", "file", ".", "ReadAt", "(", "header", ",", "int64", "(", "s", ".", "currentBlock", ".", "HeaderPoint", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "header", ",", "nil", "\n", "}" ]
24,110
all-24111
[ "Close", "removes", "resources", "associated", "with", "an", "initialized", "ImageDestination", "if", "any", "." ]
[ "func", "(", "d", "*", "ostreeImageDestination", ")", "Close", "(", ")", "error", "{", "if", "d", ".", "repo", "!=", "nil", "{", "C", ".", "g_object_unref", "(", "C", ".", "gpointer", "(", "d", ".", "repo", ")", ")", "\n", "}", "\n", "return", "<mask>", ".", "RemoveAll", "(", "d", ".", "tmpDirPath", ")", "\n", "}" ]
24,111
all-24112
[ "RestServer", "creates", "an", "http", ".", "Server", "capable", "of", "handling", "requests", "against", "the", "LXD", "REST", "API", "endpoint", "." ]
[ "func", "RestServer", "(", "d", "*", "Daemon", ")", "*", "http", ".", "Server", "{", "/* Setup the web server */", "mux", ":=", "mux", ".", "NewRouter", "(", ")", "\n", "mux", ".", "StrictSlash", "(", "false", ")", "\n\n", "mux", ".", "HandleFunc", "(", "\"", "\"", ",", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "SyncResponse", "(", "true", ",", "[", "]", "string", "{", "\"", "\"", "}", ")", ".", "Render", "(", "w", ")", "\n", "}", ")", "\n\n", "for", "endpoint", ",", "f", ":=", "range", "d", ".", "gateway", ".", "HandlerFuncs", "(", ")", "{", "mux", ".", "HandleFunc", "(", "endpoint", ",", "f", ")", "\n", "}", "\n\n", "for", "_", ",", "c", ":=", "range", "api10", "{", "d", ".", "createCmd", "(", "mux", ",", "\"", "\"", ",", "c", ")", "\n", "}", "\n\n", "for", "_", ",", "c", ":=", "range", "apiInternal", "{", "d", ".", "createCmd", "(", "mux", ",", "\"", "\"", ",", "c", ")", "\n", "}", "\n\n", "mux", ".", "NotFoundHandler", "=", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "logger", ".", "Info", "(", "\"", "\"", ",", "log", ".", "Ctx", "{", "\"", "\"", ":", "r", ".", "<mask>", "}", ")", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "NotFound", "(", "nil", ")", ".", "Render", "(", "w", ")", "\n", "}", ")", "\n\n", "return", "&", "http", ".", "Server", "{", "Handler", ":", "&", "lxdHttpServer", "{", "r", ":", "mux", ",", "d", ":", "d", "}", "}", "\n", "}" ]
24,112
all-24113
[ "Config", "returns", "the", "agent", "current", "Configuration", "." ]
[ "func", "(", "pa", "*", "ConfigAgent", ")", "Config", "(", ")", "*", "<mask>", "{", "pa", ".", "mut", ".", "Lock", "(", ")", "\n", "defer", "pa", ".", "mut", ".", "Unlock", "(", ")", "\n", "return", "pa", ".", "configuration", "\n", "}" ]
24,113
all-24114
[ "Removes", "given", "channel", "called", "by", "Channel", ".", "Close", "." ]
[ "func", "(", "hub", "*", "hub", ")", "remove", "(", "cn", "*", "<mask>", ")", "{", "hub", ".", "Lock", "(", ")", "\n", "defer", "hub", ".", "Unlock", "(", ")", "\n", "cn", ",", "ok", ":=", "hub", ".", "channels", "[", "cn", ".", "name", "]", "\n", "if", "!", "ok", "{", "return", "\n", "}", "\n", "delete", "(", "hub", ".", "channels", ",", "cn", ".", "name", ")", "\n", "return", "\n", "}" ]
24,114
all-24115
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "InheritedStyleEntry", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss34", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
24,115
all-24116
[ "Repaint", "draws", "the", "control", "on", "its", "View", "surface" ]
[ "func", "(", "e", "*", "EditField", ")", "Draw", "(", ")", "{", "if", "e", ".", "hidden", "{", "return", "\n", "}", "\n\n", "PushAttributes", "(", ")", "\n", "defer", "PopAttributes", "(", ")", "\n\n", "x", ",", "y", ":=", "e", ".", "Pos", "(", ")", "\n", "w", ",", "_", ":=", "e", ".", "Size", "(", ")", "\n\n", "parts", ":=", "[", "]", "rune", "(", "SysObject", "(", "ObjEdit", ")", ")", "\n", "chLeft", ",", "chRight", ":=", "string", "(", "parts", "[", "0", "]", ")", ",", "string", "(", "parts", "[", "1", "]", ")", "\n", "chStar", ":=", "\"", "\"", "\n", "if", "len", "(", "parts", ")", ">", "3", "{", "chStar", "=", "string", "(", "parts", "[", "3", "]", ")", "\n", "}", "\n\n", "var", "textOut", "string", "\n", "curOff", ":=", "0", "\n", "if", "e", ".", "<mask>", "==", "0", "&&", "xs", ".", "Len", "(", "e", ".", "title", ")", "<", "e", ".", "width", "{", "if", "e", ".", "showStars", "{", "textOut", "=", "strings", ".", "Repeat", "(", "chStar", ",", "xs", ".", "Len", "(", "e", ".", "title", ")", ")", "\n", "}", "else", "{", "textOut", "=", "e", ".", "title", "\n", "}", "\n", "}", "else", "{", "fromIdx", ":=", "0", "\n", "toIdx", ":=", "0", "\n", "if", "e", ".", "offset", "==", "0", "{", "toIdx", "=", "e", ".", "width", "-", "1", "\n", "if", "e", ".", "showStars", "{", "textOut", "=", "strings", ".", "Repeat", "(", "chStar", ",", "toIdx", ")", "+", "chRight", "\n", "}", "else", "{", "textOut", "=", "xs", ".", "Slice", "(", "e", ".", "title", ",", "0", ",", "toIdx", ")", "+", "chRight", "\n", "}", "\n", "curOff", "=", "-", "e", ".", "offset", "\n", "}", "else", "{", "curOff", "=", "1", "-", "e", ".", "offset", "\n", "fromIdx", "=", "e", ".", "offset", "\n", "if", "e", ".", "width", "-", "1", "<=", "xs", ".", "Len", "(", "e", ".", "title", ")", "-", "e", ".", "offset", "{", "toIdx", "=", "e", ".", "offset", "+", "e", ".", "width", "-", "2", "\n", "if", "e", ".", "showStars", "{", "textOut", "=", "chLeft", "+", "strings", ".", "Repeat", "(", "chStar", ",", "toIdx", "-", "fromIdx", ")", "+", "chRight", "\n", "}", "else", "{", "textOut", "=", "chLeft", "+", "xs", ".", "Slice", "(", "e", ".", "title", ",", "fromIdx", ",", "toIdx", ")", "+", "chRight", "\n", "}", "\n", "}", "else", "{", "if", "e", ".", "showStars", "{", "textOut", "=", "chLeft", "+", "strings", ".", "Repeat", "(", "chStar", ",", "xs", ".", "Len", "(", "e", ".", "title", ")", "-", "fromIdx", ")", "\n", "}", "else", "{", "textOut", "=", "chLeft", "+", "xs", ".", "Slice", "(", "e", ".", "title", ",", "fromIdx", ",", "-", "1", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "fg", ",", "bg", ":=", "RealColor", "(", "e", ".", "fg", ",", "e", ".", "Style", "(", ")", ",", "ColorEditText", ")", ",", "RealColor", "(", "e", ".", "bg", ",", "e", ".", "Style", "(", ")", ",", "ColorEditBack", ")", "\n", "if", "!", "e", ".", "Enabled", "(", ")", "{", "fg", ",", "bg", "=", "RealColor", "(", "e", ".", "fg", ",", "e", ".", "Style", "(", ")", ",", "ColorDisabledText", ")", ",", "RealColor", "(", "e", ".", "fg", ",", "e", ".", "Style", "(", ")", ",", "ColorDisabledBack", ")", "\n", "}", "else", "if", "e", ".", "Active", "(", ")", "{", "fg", ",", "bg", "=", "RealColor", "(", "e", ".", "fg", ",", "e", ".", "Style", "(", ")", ",", "ColorEditActiveText", ")", ",", "RealColor", "(", "e", ".", "bg", ",", "e", ".", "Style", "(", ")", ",", "ColorEditActiveBack", ")", "\n", "}", "\n\n", "SetTextColor", "(", "fg", ")", "\n", "SetBackColor", "(", "bg", ")", "\n", "FillRect", "(", "x", ",", "y", ",", "w", ",", "1", ",", "' '", ")", "\n", "DrawRawText", "(", "x", ",", "y", ",", "textOut", ")", "\n", "if", "e", ".", "Active", "(", ")", "{", "SetCursorPos", "(", "e", ".", "cursorPos", "+", "e", ".", "x", "+", "curOff", ",", "e", ".", "y", ")", "\n", "}", "\n", "}" ]
24,116
all-24117
[ "Length", "returns", "the", "number", "of", "elements", "present", "in", "the", "LinkedList", "." ]
[ "func", "(", "list", "*", "LinkedList", ")", "Length", "(", ")", "uint", "{", "list", ".", "key", ".", "RLock", "(", ")", "\n", "defer", "list", ".", "key", ".", "RUnlock", "(", ")", "\n\n", "return", "list", ".", "<mask>", "\n", "}" ]
24,117
all-24118
[ "SetRightMargin", "()", "is", "a", "wrapper", "around", "gtk_page_setup_set_right_margin", "()", "." ]
[ "func", "(", "ps", "*", "PageSetup", ")", "SetRightMargin", "(", "margin", "float64", ",", "unit", "Unit", ")", "{", "C", ".", "gtk_page_setup_set_right_margin", "(", "ps", ".", "native", "(", ")", ",", "C", ".", "gdouble", "(", "<mask>", ")", ",", "C", ".", "GtkUnit", "(", "unit", ")", ")", "\n", "}" ]
24,118
all-24119
[ "PutFileRecords", "returns", "a", "collection", "of", "putFileRecords" ]
[ "func", "PutFileRecords", "(", "etcdClient", "*", "etcd", ".", "Client", ",", "etcdPrefix", "string", ")", "col", ".", "Collection", "{", "return", "col", ".", "NewCollection", "(", "etcdClient", ",", "<mask>", ".", "Join", "(", "etcdPrefix", ",", "putFileRecordsPrefix", ")", ",", "nil", ",", "&", "pfs", ".", "PutFileRecords", "{", "}", ",", "nil", ",", "nil", ",", ")", "\n", "}" ]
24,119
all-24120
[ "newPeriodic", "creates", "a", "new", "instance", "of", "Periodic", "compactor", "that", "purges", "the", "log", "older", "than", "h", "Duration", "." ]
[ "func", "newPeriodic", "(", "lg", "*", "zap", ".", "Logger", ",", "<mask>", "clockwork", ".", "Clock", ",", "h", "time", ".", "Duration", ",", "rg", "RevGetter", ",", "c", "Compactable", ")", "*", "Periodic", "{", "pc", ":=", "&", "Periodic", "{", "lg", ":", "lg", ",", "clock", ":", "clock", ",", "period", ":", "h", ",", "rg", ":", "rg", ",", "c", ":", "c", ",", "revs", ":", "make", "(", "[", "]", "int64", ",", "0", ")", ",", "}", "\n", "pc", ".", "ctx", ",", "pc", ".", "cancel", "=", "context", ".", "WithCancel", "(", "context", ".", "Background", "(", ")", ")", "\n", "return", "pc", "\n", "}" ]
24,120
all-24121
[ "RunsAgainstChanges", "returns", "true", "if", "any", "of", "the", "changed", "input", "paths", "match", "the", "run_if_changed", "regex", "." ]
[ "func", "(", "cm", "RegexpChangeMatcher", ")", "RunsAgainstChanges", "(", "changes", "[", "]", "string", ")", "bool", "{", "for", "_", ",", "<mask>", ":=", "range", "changes", "{", "if", "cm", ".", "reChanges", ".", "MatchString", "(", "change", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
24,121
all-24122
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetIgnoreCertificateErrorsParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoSecurity1", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
24,122
all-24123
[ "This", "is", "only", "for", "classic", "App", "Engine", "adapters", "." ]
[ "func", "ClassicContextFromContext", "(", "ctx", "netcontext", ".", "<mask>", ")", "(", "appengine", ".", "Context", ",", "error", ")", "{", "c", ":=", "fromContext", "(", "ctx", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "errNotAppEngineContext", "\n", "}", "\n", "return", "c", ",", "nil", "\n", "}" ]
24,123
all-24124
[ "Internal", "fast", "path", "for", "Frame", "()", "when", "we", "know", "we", "have", "an", "int", "frame" ]
[ "func", "(", "s", "*", "FileSequence", ")", "frameInt", "(", "frame", "int", ")", "string", "{", "var", "zframe", "string", "\n", "if", "s", ".", "frameSet", "!=", "nil", "{", "zframe", "=", "zfillInt", "(", "frame", ",", "s", ".", "zfill", ")", "\n", "}", "\n", "<mask>", "buf", "strings", ".", "Builder", "\n", "buf", ".", "WriteString", "(", "s", ".", "dir", ")", "\n", "buf", ".", "WriteString", "(", "s", ".", "basename", ")", "\n", "buf", ".", "WriteString", "(", "zframe", ")", "\n", "buf", ".", "WriteString", "(", "s", ".", "ext", ")", "\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
24,124
all-24125
[ "Returns", "an", "float", "or", "panics" ]
[ "func", "(", "t", "Typed", ")", "FloatMust", "(", "<mask>", "string", ")", "float64", "{", "f", ",", "exists", ":=", "t", ".", "FloatIf", "(", "key", ")", "\n", "if", "exists", "==", "false", "{", "panic", "(", "\"", "\"", "+", "key", ")", "\n", "}", "\n", "return", "f", "\n", "}" ]
24,125
all-24126
[ "SortContainerMetrics", "sorts", "a", "slice", "of", "containerMetrics", "by", "InstanceIndex", ".", "The", "input", "slice", "is", "sorted", ";", "the", "return", "value", "is", "simply", "a", "pointer", "to", "the", "same", "slice", "." ]
[ "func", "SortContainerMetrics", "(", "messages", "[", "]", "*", "events", ".", "ContainerMetric", ")", "[", "]", "*", "events", ".", "ContainerMetric", "{", "<mask>", ".", "Sort", "(", "containerMetricSlice", "(", "messages", ")", ")", "\n", "return", "messages", "\n", "}" ]
24,126
all-24127
[ "IsEnabledFor", "returns", "true", "if", "the", "logger", "is", "enabled", "for", "the", "given", "level", "." ]
[ "func", "(", "l", "*", "Logger", ")", "IsEnabledFor", "(", "level", "Level", ")", "bool", "{", "return", "defaultBackend", ".", "IsEnabledFor", "(", "level", ",", "l", ".", "<mask>", ")", "\n", "}" ]
24,127
all-24128
[ "ToFloat32Or", "parses", "as", "a", "float32", "or", "returns", "defaultValue", "on", "error", "." ]
[ "func", "ToFloat32Or", "(", "s", "<mask>", ",", "defaultValue", "float32", ")", "float32", "{", "f", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "s", ",", "32", ")", "\n", "if", "err", "!=", "nil", "{", "return", "defaultValue", "\n", "}", "\n", "return", "float32", "(", "f", ")", "\n", "}" ]
24,128
all-24129
[ "defaultServerURL", "is", "a", "modified", "copy", "of", "k8s", ".", "io", "/", "kubernets", "/", "pkg", "/", "client", "/", "restclient", ".", "DefaultServerURL", ".", "DefaultServerURL", "converts", "a", "host", "host", ":", "port", "or", "URL", "string", "to", "the", "default", "base", "server", "API", "path", "to", "use", "with", "a", "Client", "at", "a", "given", "API", "version", "following", "the", "standard", "conventions", "for", "a", "Kubernetes", "API", "." ]
[ "func", "defaultServerURL", "(", "host", "string", ",", "defaultTLS", "bool", ")", "(", "*", "url", ".", "URL", ",", "error", ")", "{", "if", "host", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "base", ":=", "host", "\n", "hostURL", ",", "err", ":=", "url", ".", "Parse", "(", "base", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "hostURL", ".", "Scheme", "==", "\"", "\"", "{", "scheme", ":=", "\"", "\"", "\n", "if", "defaultTLS", "{", "scheme", "=", "\"", "\"", "\n", "}", "\n", "hostURL", ",", "err", "=", "<mask>", ".", "Parse", "(", "scheme", "+", "base", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "hostURL", ".", "Path", "!=", "\"", "\"", "&&", "hostURL", ".", "Path", "!=", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "base", ")", "\n", "}", "\n", "}", "\n\n", "// REMOVED: versionedAPIPath computation.", "return", "hostURL", ",", "nil", "\n", "}" ]
24,129
all-24130
[ "String", "returns", "the", "name", "of", "e" ]
[ "func", "(", "e", "TrustLineFlags", ")", "String", "(", ")", "string", "{", "<mask>", ",", "_", ":=", "trustLineFlagsMap", "[", "int32", "(", "e", ")", "]", "\n", "return", "name", "\n", "}" ]
24,130
all-24131
[ "MonoRMS", "converts", "the", "buffer", "to", "mono", "and", "apply", "an", "RMS", "treatment", ".", "rms", "=", "sqrt", "(", "(", "1", "/", "n", ")", "*", "(", "x12", "+", "x22", "+", "…", "+", "xn2", ")", ")", "multiplying", "by", "1", "/", "n", "effectively", "assigns", "equal", "weights", "to", "all", "the", "terms", "making", "it", "a", "rectangular", "window", ".", "Other", "window", "equations", "can", "be", "used", "instead", "which", "would", "favor", "terms", "in", "the", "middle", "of", "the", "window", ".", "This", "results", "in", "even", "greater", "accuracy", "of", "the", "RMS", "value", "since", "brand", "new", "samples", "(", "or", "old", "ones", "at", "the", "end", "of", "the", "window", ")", "have", "less", "influence", "over", "the", "signal’s", "power", ".", ")", "TODO", ":", "use", "a", "sine", "wave", "at", "amplitude", "of", "1", ":", "rectication", "+", "average", "=", "1", ".", "4", "(", "1", "/", "square", "root", "of", "2", ")" ]
[ "func", "MonoRMS", "(", "b", "*", "audio", ".", "FloatBuffer", ",", "windowSize", "int", ")", "error", "{", "if", "b", "==", "nil", "{", "return", "audio", ".", "ErrInvalidBuffer", "\n", "}", "\n", "if", "len", "(", "b", ".", "Data", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "<mask>", ":=", "[", "]", "float64", "{", "}", "\n", "winBuf", ":=", "make", "(", "[", "]", "float64", ",", "windowSize", ")", "\n", "windowSizeF", ":=", "float64", "(", "windowSize", ")", "\n\n", "processWindow", ":=", "func", "(", "idx", "int", ")", "{", "total", ":=", "0.0", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "winBuf", ")", ";", "i", "++", "{", "total", "+=", "winBuf", "[", "idx", "]", "*", "winBuf", "[", "idx", "]", "\n", "}", "\n", "v", ":=", "math", ".", "Sqrt", "(", "(", "1.0", "/", "windowSizeF", ")", "*", "total", ")", "\n", "out", "=", "append", "(", "out", ",", "v", ")", "\n", "}", "\n\n", "nbrChans", ":=", "1", "\n", "if", "b", ".", "Format", "!=", "nil", "{", "nbrChans", "=", "b", ".", "Format", ".", "NumChannels", "\n", "}", "\n\n", "var", "windowIDX", "int", "\n", "// process each frame, convert it to mono and them RMS it", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "b", ".", "Data", ")", ";", "i", "++", "{", "v", ":=", "b", ".", "Data", "[", "i", "]", "\n", "if", "nbrChans", ">", "1", "{", "for", "j", ":=", "1", ";", "j", "<", "nbrChans", ";", "j", "++", "{", "i", "++", "\n", "v", "+=", "b", ".", "Data", "[", "i", "]", "\n", "}", "\n", "v", "/=", "float64", "(", "nbrChans", ")", "\n", "}", "\n", "winBuf", "[", "windowIDX", "]", "=", "v", "\n", "windowIDX", "++", "\n", "if", "windowIDX", "==", "windowSize", "||", "i", "==", "(", "len", "(", "b", ".", "Data", ")", "-", "1", ")", "{", "windowIDX", "=", "0", "\n", "processWindow", "(", "windowIDX", ")", "\n", "}", "\n", "}", "\n\n", "if", "b", ".", "Format", "!=", "nil", "{", "b", ".", "Format", ".", "NumChannels", "=", "1", "\n", "b", ".", "Format", ".", "SampleRate", "/=", "windowSize", "\n", "}", "\n", "b", ".", "Data", "=", "out", "\n", "return", "nil", "\n", "}" ]
24,131
all-24132
[ "Schema2FromManifest", "creates", "a", "Schema2", "manifest", "instance", "from", "a", "manifest", "blob", "." ]
[ "func", "Schema2FromManifest", "(", "manifest", "[", "]", "<mask>", ")", "(", "*", "Schema2", ",", "error", ")", "{", "s2", ":=", "Schema2", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "manifest", ",", "&", "s2", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "s2", ",", "nil", "\n", "}" ]
24,132
all-24133
[ "SetTimestamp", "creates", "a", "Set", "query", "with", "timestamp", ".", "Set", "assigns", "a", "value", "of", "1", "to", "a", "column", "in", "the", "binary", "matrix", "thus", "associating", "the", "given", "row", "in", "the", "given", "field", "with", "the", "given", "column", "." ]
[ "func", "(", "f", "*", "Field", ")", "SetTimestamp", "(", "rowIDOrKey", ",", "colIDOrKey", "interface", "{", "}", ",", "timestamp", "<mask>", ".", "Time", ")", "*", "PQLBaseQuery", "{", "rowStr", ",", "colStr", ",", "err", ":=", "formatRowColIDKey", "(", "rowIDOrKey", ",", "colIDOrKey", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NewPQLBaseQuery", "(", "\"", "\"", ",", "f", ".", "index", ",", "err", ")", "\n", "}", "\n", "text", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "colStr", ",", "f", ".", "name", ",", "rowStr", ",", "timestamp", ".", "Format", "(", "timeFormat", ")", ")", "\n", "q", ":=", "NewPQLBaseQuery", "(", "text", ",", "f", ".", "index", ",", "nil", ")", "\n", "q", ".", "hasKeys", "=", "f", ".", "options", ".", "keys", "||", "f", ".", "index", ".", "options", ".", "keys", "\n", "return", "q", "\n", "}" ]
24,133
all-24134
[ "bicTransportScope", "returns", "a", "BICTransportScope", "appropriate", "for", "ref", "." ]
[ "func", "bicTransportScope", "(", "ref", "dockerReference", ")", "<mask>", ".", "BICTransportScope", "{", "// Blobs can be reused across the whole registry.", "return", "types", ".", "BICTransportScope", "{", "Opaque", ":", "reference", ".", "Domain", "(", "ref", ".", "ref", ")", "}", "\n", "}" ]
24,134
all-24135
[ "lintReversedIPAddressLabels", "lints", "the", "given", "name", "as", "either", "a", "reversed", "IPv4", "or", "IPv6", "address", "under", "the", "respective", "ARPA", "zone", "based", "on", "the", "address", "class", ".", "An", "error", "is", "returned", "if", "there", "aren", "t", "enough", "labels", "in", "the", "name", "after", "removing", "the", "relevant", "arpa", "suffix", "." ]
[ "func", "lintReversedIPAddressLabels", "(", "name", "string", ",", "ipv6", "bool", ")", "error", "{", "numRequiredLabels", ":=", "rdnsIPv4Labels", "\n", "zoneSuffix", ":=", "rdnsIPv4Suffix", "\n\n", "if", "ipv6", "{", "numRequiredLabels", "=", "rdnsIPv6Labels", "\n", "zoneSuffix", "=", "rdnsIPv6Suffix", "\n", "}", "\n\n", "// Strip off the zone suffix to get only the reversed IP address", "ipName", ":=", "strings", ".", "TrimSuffix", "(", "name", ",", "zoneSuffix", ")", "\n\n", "// A well encoded IPv4 or IPv6 reverse DNS name will have the correct number", "// of labels to express the address", "ipLabels", ":=", "strings", ".", "Split", "(", "ipName", ",", "\"", "\"", ")", "\n", "if", "len", "(", "ipLabels", ")", "!=", "numRequiredLabels", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", "+", "\"", "\"", ",", "name", ",", "len", "(", "ipLabels", ")", ",", "numRequiredLabels", ",", "zoneSuffix", ")", "\n", "}", "\n\n", "// Reverse the IP labels and try to parse an IP address", "var", "ip", "net", ".", "IP", "\n", "if", "ipv6", "{", "ip", "=", "reversedLabelsToIPv6", "(", "ipLabels", ")", "\n", "}", "else", "{", "ip", "=", "reversedLabelsToIPv4", "(", "ipLabels", ")", "\n", "}", "\n\n", "// If the result isn't an IP then a warning should be generated", "if", "<mask>", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "numRequiredLabels", ",", "name", ")", "\n", "}", "\n\n", "// Otherwise return no error - checking the actual value of the IP is left to", "// `lint_subject_contains_reserved_arpa_ip.go`.", "return", "nil", "\n", "}" ]
24,135
all-24136
[ "WithLogFunc", "sets", "the", "function", "that", "will", "perform", "message", "logging", ".", "Default", "is", "log", ".", "Printf", "." ]
[ "func", "WithLogFunc", "(", "logf", "func", "(", "format", "string", ",", "a", "...", "<mask>", "{", "}", ")", ")", "Option", "{", "return", "func", "(", "o", "*", "Options", ")", "{", "o", ".", "logf", "=", "logf", "}", "\n", "}" ]
24,136
all-24137
[ "Do", "executes", "Emulation", ".", "setPageScaleFactor", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetPageScaleFactorParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetPageScaleFactor", ",", "p", ",", "nil", ")", "\n", "}" ]
24,137
all-24138
[ "NewContainerStateChangeEvent", "creates", "a", "new", "container", "state", "change", "event" ]
[ "func", "NewContainerStateChangeEvent", "(", "task", "*", "apitask", ".", "<mask>", ",", "cont", "*", "apicontainer", ".", "Container", ",", "reason", "string", ")", "(", "ContainerStateChange", ",", "error", ")", "{", "var", "event", "ContainerStateChange", "\n", "contKnownStatus", ":=", "cont", ".", "GetKnownStatus", "(", ")", "\n", "if", "!", "contKnownStatus", ".", "ShouldReportToBackend", "(", "cont", ".", "GetSteadyStateStatus", "(", ")", ")", "{", "return", "event", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "contKnownStatus", ")", "\n", "}", "\n", "if", "cont", ".", "IsInternal", "(", ")", "{", "return", "event", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "cont", ".", "Name", ")", "\n", "}", "\n", "if", "cont", ".", "GetSentStatus", "(", ")", ">=", "contKnownStatus", "{", "return", "event", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "contKnownStatus", ".", "String", "(", ")", ",", "cont", ".", "Name", ",", "task", ".", "Arn", ")", "\n", "}", "\n\n", "if", "reason", "==", "\"", "\"", "&&", "cont", ".", "ApplyingError", "!=", "nil", "{", "reason", "=", "cont", ".", "ApplyingError", ".", "Error", "(", ")", "\n", "}", "\n", "event", "=", "ContainerStateChange", "{", "TaskArn", ":", "task", ".", "Arn", ",", "ContainerName", ":", "cont", ".", "Name", ",", "Status", ":", "contKnownStatus", ".", "BackendStatus", "(", "cont", ".", "GetSteadyStateStatus", "(", ")", ")", ",", "ExitCode", ":", "cont", ".", "GetKnownExitCode", "(", ")", ",", "PortBindings", ":", "cont", ".", "GetKnownPortBindings", "(", ")", ",", "Reason", ":", "reason", ",", "Container", ":", "cont", ",", "}", "\n\n", "return", "event", ",", "nil", "\n", "}" ]
24,138
all-24139
[ "SetTooltipColumn", "is", "a", "wrapper", "around", "gtk_icon_view_set_tooltip_column", "()", "." ]
[ "func", "(", "v", "*", "IconView", ")", "SetTooltipColumn", "(", "column", "int", ")", "{", "C", ".", "gtk_icon_view_set_tooltip_column", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "<mask>", ")", ")", "\n", "}" ]
24,139
all-24140
[ "UnaryServerInterceptor", "applies", "fn", "to", "errors", "returned", "by", "server", "." ]
[ "func", "UnaryServerInterceptor", "(", "fn", "ConvertFunc", ")", "grpc", ".", "UnaryServerInterceptor", "{", "return", "func", "(", "ctx", "context", ".", "<mask>", ",", "req", "interface", "{", "}", ",", "info", "*", "grpc", ".", "UnaryServerInfo", ",", "handler", "grpc", ".", "UnaryHandler", ")", "(", "resp", "interface", "{", "}", ",", "err", "error", ")", "{", "resp", ",", "err", "=", "handler", "(", "ctx", ",", "req", ")", "\n", "return", "resp", ",", "fn", "(", "err", ")", "\n", "}", "\n", "}" ]
24,140
all-24141
[ "respWithMetadata", "is", "a", "short", "wrapper", "to", "return", "the", "given", "interface", "with", "fake", "response", "metadata", "for", "non", "-", "Consul", "dependencies", "." ]
[ "func", "respWithMetadata", "(", "i", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "*", "ResponseMetadata", ",", "error", ")", "{", "return", "i", ",", "&", "ResponseMetadata", "{", "LastContact", ":", "0", ",", "LastIndex", ":", "uint64", "(", "<mask>", ".", "Now", "(", ")", ".", "Unix", "(", ")", ")", ",", "}", ",", "nil", "\n", "}" ]
24,141
all-24142
[ "FlushJob", "calls", "f", "with", "all", "the", "jobs", "which", "were", "triggered", "by", "commits", ".", "If", "toPipelines", "is", "non", "-", "nil", "then", "only", "the", "jobs", "between", "commits", "and", "those", "pipelines", "in", "the", "DAG", "will", "be", "returned", "." ]
[ "func", "(", "c", "APIClient", ")", "FlushJob", "(", "commits", "[", "]", "*", "pfs", ".", "Commit", ",", "toPipelines", "[", "]", "string", ",", "f", "func", "(", "*", "pps", ".", "JobInfo", ")", "error", ")", "error", "{", "req", ":=", "&", "pps", ".", "FlushJobRequest", "{", "Commits", ":", "commits", ",", "}", "\n", "for", "_", ",", "pipeline", ":=", "range", "toPipelines", "{", "req", ".", "ToPipelines", "=", "append", "(", "req", ".", "ToPipelines", ",", "NewPipeline", "(", "pipeline", ")", ")", "\n", "}", "\n", "client", ",", "err", ":=", "c", ".", "PpsAPIClient", ".", "FlushJob", "(", "c", ".", "Ctx", "(", ")", ",", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "for", "{", "jobInfo", ",", "err", ":=", "<mask>", ".", "Recv", "(", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "EOF", "{", "return", "nil", "\n", "}", "\n", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "if", "err", ":=", "f", "(", "jobInfo", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}" ]
24,142
all-24143
[ "optionOrDefault", "defaults", "to", "a", "value", "if", "option", "is", "the", "zero", "value" ]
[ "func", "optionOrDefault", "(", "option", ",", "defaultValue", "time", ".", "Duration", ")", "time", ".", "Duration", "{", "if", "option", "==", "0", "{", "return", "defaultValue", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
24,143
all-24144
[ "Add", "implements", "storage", ".", "Appender", "." ]
[ "func", "(", "t", "*", "timestampTracker", ")", "Add", "(", "_", "labels", ".", "Labels", ",", "ts", "int64", ",", "v", "float64", ")", "(", "uint64", ",", "error", ")", "{", "t", ".", "samples", "++", "\n", "if", "<mask>", ">", "t", ".", "highestTimestamp", "{", "t", ".", "highestTimestamp", "=", "ts", "\n", "}", "\n", "return", "0", ",", "nil", "\n", "}" ]
24,144
all-24145
[ "WithMinRepeatCount", "the", "maximum", "number", "of", "times", "to", "replay", "the", "snapshot", "(", "1", "if", "not", "specified", ")", "." ]
[ "func", "(", "p", "ProfileSnapshotParams", ")", "WithMinRepeatCount", "(", "minRepeatCount", "int64", ")", "*", "ProfileSnapshotParams", "{", "p", ".", "MinRepeatCount", "=", "minRepeatCount", "\n", "<mask>", "&", "p", "\n", "}" ]
24,145
all-24146
[ "NetworkConfigAdd", "adds", "a", "new", "entry", "in", "the", "networks_config", "table" ]
[ "func", "(", "c", "*", "ClusterTx", ")", "NetworkConfigAdd", "(", "networkID", ",", "nodeID", "int64", ",", "config", "<mask>", "[", "string", "]", "string", ")", "error", "{", "return", "networkConfigAdd", "(", "c", ".", "tx", ",", "networkID", ",", "nodeID", ",", "config", ")", "\n", "}" ]
24,146
all-24147
[ "ClearMilestone", "removes", "the", "milestone" ]
[ "func", "(", "f", "*", "FakeClient", ")", "ClearMilestone", "(", "org", ",", "repo", "<mask>", ",", "issueNum", "int", ")", "error", "{", "f", ".", "Milestone", "=", "0", "\n", "return", "nil", "\n", "}" ]
24,147
all-24148
[ "ReturnWriter", "returns", "a", "gzip", ".", "Writer", "to", "the", "pool", "that", "can", "late", "be", "reused", "via", "GetWriter", ".", "Don", "t", "close", "the", "writer", "Flush", "will", "be", "called", "before", "returning", "it", "to", "the", "pool", "." ]
[ "func", "(", "pool", "*", "GzipPool", ")", "ReturnWriter", "(", "<mask>", "*", "gzip", ".", "Writer", ")", "{", "writer", ".", "Close", "(", ")", "\n", "pool", ".", "pool", ".", "Put", "(", "writer", ")", "\n", "}" ]
24,148
all-24149
[ "DeepCopyInto", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "writing", "into", "out", ".", "in", "must", "be", "non", "-", "nil", "." ]
[ "func", "(", "in", "*", "ProwJobSpec", ")", "DeepCopyInto", "(", "out", "*", "ProwJobSpec", ")", "{", "*", "out", "=", "*", "in", "\n", "if", "in", ".", "Refs", "!=", "nil", "{", "in", ",", "out", ":=", "&", "in", ".", "Refs", ",", "&", "out", ".", "Refs", "\n", "*", "out", "=", "new", "(", "Refs", ")", "\n", "(", "*", "in", ")", ".", "DeepCopyInto", "(", "*", "out", ")", "\n", "}", "\n", "if", "in", ".", "ExtraRefs", "!=", "nil", "{", "in", ",", "out", ":=", "&", "in", ".", "ExtraRefs", ",", "&", "out", ".", "ExtraRefs", "\n", "*", "out", "=", "make", "(", "[", "]", "Refs", ",", "len", "(", "*", "in", ")", ")", "\n", "for", "i", ":=", "range", "*", "in", "{", "(", "*", "in", ")", "[", "i", "]", ".", "DeepCopyInto", "(", "&", "(", "*", "out", ")", "[", "i", "]", ")", "\n", "}", "\n", "}", "\n", "if", "in", ".", "PodSpec", "!=", "nil", "{", "in", ",", "out", ":=", "&", "in", ".", "PodSpec", ",", "&", "out", ".", "PodSpec", "\n", "*", "out", "=", "new", "(", "corev1", ".", "PodSpec", ")", "\n", "(", "*", "in", ")", ".", "DeepCopyInto", "(", "*", "out", ")", "\n", "}", "\n", "if", "in", ".", "BuildSpec", "!=", "nil", "{", "in", ",", "out", ":=", "&", "in", ".", "BuildSpec", ",", "&", "out", ".", "BuildSpec", "\n", "*", "out", "=", "new", "(", "v1alpha1", ".", "BuildSpec", ")", "\n", "(", "*", "in", ")", ".", "DeepCopyInto", "(", "*", "out", ")", "\n", "}", "\n", "if", "in", ".", "JenkinsSpec", "!=", "nil", "{", "<mask>", ",", "out", ":=", "&", "in", ".", "JenkinsSpec", ",", "&", "out", ".", "JenkinsSpec", "\n", "*", "out", "=", "new", "(", "JenkinsSpec", ")", "\n", "*", "*", "out", "=", "*", "*", "in", "\n", "}", "\n", "if", "in", ".", "PipelineRunSpec", "!=", "nil", "{", "in", ",", "out", ":=", "&", "in", ".", "PipelineRunSpec", ",", "&", "out", ".", "PipelineRunSpec", "\n", "*", "out", "=", "new", "(", "pipelinev1alpha1", ".", "PipelineRunSpec", ")", "\n", "(", "*", "in", ")", ".", "DeepCopyInto", "(", "*", "out", ")", "\n", "}", "\n", "if", "in", ".", "DecorationConfig", "!=", "nil", "{", "in", ",", "out", ":=", "&", "in", ".", "DecorationConfig", ",", "&", "out", ".", "DecorationConfig", "\n", "*", "out", "=", "new", "(", "DecorationConfig", ")", "\n", "(", "*", "in", ")", ".", "DeepCopyInto", "(", "*", "out", ")", "\n", "}", "\n", "return", "\n", "}" ]
24,149
all-24150
[ "RunAPIChecks", "runs", "a", "test", "suite", "to", "check", "a", "Tracer", "against", "the", "OpenTracing", "API", ".", "It", "is", "provided", "a", "function", "that", "will", "be", "executed", "to", "create", "and", "destroy", "a", "tracer", "for", "each", "test", "in", "the", "suite", "and", "the", "given", "APICheckOption", "functional", "options", "opts", "." ]
[ "func", "RunAPIChecks", "(", "t", "*", "testing", ".", "T", ",", "newTracer", "func", "(", ")", "(", "tracer", "opentracing", ".", "Tracer", ",", "closer", "func", "(", ")", ")", ",", "opts", "...", "APICheckOption", ",", ")", "{", "s", ":=", "&", "APICheckSuite", "{", "newTracer", ":", "newTracer", "}", "\n", "for", "_", ",", "opt", ":=", "<mask>", "opts", "{", "opt", "(", "s", ")", "\n", "}", "\n", "suite", ".", "Run", "(", "t", ",", "s", ")", "\n", "}" ]
24,150
all-24151
[ "BackwardVisibleLines", "is", "a", "wrapper", "around", "gtk_text_iter_backward_visible_lines", "()", "." ]
[ "func", "(", "v", "*", "TextIter", ")", "BackwardVisibleLines", "(", "v1", "int", ")", "bool", "{", "<mask>", "gobool", "(", "C", ".", "gtk_text_iter_backward_visible_lines", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "v1", ")", ")", ")", "\n", "}" ]
24,151
all-24152
[ "logFailedRegistrationRetry", "logs", "either", "a", "warning", "or", "info", "depending", "on", "the", "number", "of", "consecutiveFailures", ".", "If", "consecutiveFailures", ">", "maxAdvertiseFailures", "then", "we", "log", "a", "warning", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "logFailedRegistrationRetry", "(", "errLogger", "tchannel", ".", "Logger", ",", "consecutiveFailures", "uint", ")", "{", "logFn", ":=", "errLogger", ".", "Info", "\n", "if", "consecutiveFailures", ">", "maxAdvertiseFailures", "{", "logFn", "=", "errLogger", ".", "Warn", "\n", "}", "\n\n", "logFn", "(", "\"", "\"", ")", "\n", "}" ]
24,152
all-24153
[ "resultMetric", "returns", "the", "metric", "for", "the", "given", "sample", "(", "s", ")", "based", "on", "the", "Vector", "binary", "operation", "and", "the", "matching", "options", "." ]
[ "func", "resultMetric", "(", "lhs", ",", "rhs", "labels", ".", "Labels", ",", "op", "ItemType", ",", "matching", "*", "VectorMatching", ",", "enh", "*", "EvalNodeHelper", ")", "labels", ".", "Labels", "{", "if", "enh", ".", "resultMetric", "==", "nil", "{", "enh", ".", "resultMetric", "=", "make", "(", "map", "[", "uint64", "]", "labels", ".", "Labels", ",", "len", "(", "enh", ".", "out", ")", ")", "\n", "}", "\n", "// op and matching are always the same for a given node, so", "// there's no need to include them in the hash key.", "// If the lhs and rhs are the same then the xor would be 0,", "// so add in one side to protect against that.", "lh", ":=", "lhs", ".", "Hash", "(", ")", "\n", "h", ":=", "(", "lh", "^", "rhs", ".", "Hash", "(", ")", ")", "+", "lh", "\n", "if", "ret", ",", "ok", ":=", "enh", ".", "resultMetric", "[", "h", "]", ";", "ok", "{", "return", "ret", "\n", "}", "\n\n", "lb", ":=", "labels", ".", "NewBuilder", "(", "lhs", ")", "\n\n", "if", "shouldDropMetricName", "(", "op", ")", "{", "lb", ".", "Del", "(", "labels", ".", "MetricName", ")", "\n", "}", "\n\n", "if", "matching", ".", "Card", "==", "CardOneToOne", "{", "if", "matching", ".", "On", "{", "Outer", ":", "for", "_", ",", "l", ":=", "range", "lhs", "{", "for", "_", ",", "n", ":=", "range", "matching", ".", "MatchingLabels", "{", "if", "l", ".", "Name", "==", "n", "{", "<mask>", "Outer", "\n", "}", "\n", "}", "\n", "lb", ".", "Del", "(", "l", ".", "Name", ")", "\n", "}", "\n", "}", "else", "{", "lb", ".", "Del", "(", "matching", ".", "MatchingLabels", "...", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "ln", ":=", "range", "matching", ".", "Include", "{", "// Included labels from the `group_x` modifier are taken from the \"one\"-side.", "if", "v", ":=", "rhs", ".", "Get", "(", "ln", ")", ";", "v", "!=", "\"", "\"", "{", "lb", ".", "Set", "(", "ln", ",", "v", ")", "\n", "}", "else", "{", "lb", ".", "Del", "(", "ln", ")", "\n", "}", "\n", "}", "\n\n", "ret", ":=", "lb", ".", "Labels", "(", ")", "\n", "enh", ".", "resultMetric", "[", "h", "]", "=", "ret", "\n", "return", "ret", "\n", "}" ]
24,153
all-24154
[ "AddComments", "appends", "the", "comment", "to", "the", "list", "of", "comments", "for", "the", "section", "." ]
[ "func", "(", "c", "*", "Config", ")", "AddComment", "(", "sect", ",", "comment", "string", ")", "{", "if", "sect", "==", "\"", "\"", "{", "c", ".", "comments", "=", "<mask>", "(", "c", ".", "comments", ",", "comment", ")", "\n", "return", "\n", "}", "\n\n", "for", "i", ",", "s", ":=", "range", "c", ".", "sections", "{", "if", "s", ".", "name", "==", "sect", "{", "c", ".", "sections", "[", "i", "]", ".", "comments", "=", "append", "(", "s", ".", "comments", ",", "comment", ")", "\n", "return", "\n", "}", "\n", "}", "\n\n", "c", ".", "sections", "=", "append", "(", "c", ".", "sections", ",", "section", "{", "name", ":", "sect", ",", "comments", ":", "[", "]", "string", "{", "comment", "}", ",", "}", ")", "\n", "}" ]
24,154
all-24155
[ "Slice", "is", "splitting", "input", "byte", "array", "into", "slice", "of", "subarrays", ".", "Each", "of", "count", "length", "." ]
[ "func", "Slice", "(", "arr", "[", "]", "byte", ",", "count", "int", ")", "[", "]", "[", "]", "byte", "{", "sliceCount", ":=", "len", "(", "arr", ")", "/", "count", "\n", "result", ":=", "make", "(", "[", "]", "[", "]", "byte", ",", "sliceCount", ")", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "sliceCount", ";", "i", "++", "{", "start", ":=", "i", "*", "count", "\n", "end", ":=", "i", "*", "count", "+", "<mask>", "\n\n", "result", "[", "i", "]", "=", "arr", "[", "start", ":", "end", "]", "\n", "}", "\n\n", "return", "result", "\n", "}" ]
24,155
all-24156
[ "Put", "md5", "file", "in", ".", "md5", "subdirectory", "of", "bucket", "where", "the", "file", "is", "stored", "e", ".", "g", ".", "the", "md5", "for", "https", ":", "//", "mybucket", ".", "s3", ".", "amazonaws", ".", "com", "/", "gof3r", "will", "be", "stored", "in", "https", ":", "//", "mybucket", ".", "s3", ".", "amazonaws", ".", "com", "/", ".", "md5", "/", "gof3r", ".", "md5" ]
[ "func", "(", "p", "*", "putter", ")", "putMd5", "(", ")", "(", "err", "error", ")", "{", "calcMd5", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ".", "md5", ".", "Sum", "(", "nil", ")", ")", "\n", "md5Reader", ":=", "strings", ".", "NewReader", "(", "calcMd5", ")", "\n", "md5Path", ":=", "fmt", ".", "Sprint", "(", "\"", "\"", ",", "p", ".", "url", ".", "<mask>", ",", "\"", "\"", ")", "\n", "md5Url", ",", "err", ":=", "p", ".", "b", ".", "url", "(", "md5Path", ",", "p", ".", "c", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "logger", ".", "debugPrintln", "(", "\"", "\"", ",", "calcMd5", ")", "\n", "logger", ".", "debugPrintln", "(", "\"", "\"", ",", "md5Path", ")", "\n", "r", ",", "err", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "md5Url", ".", "String", "(", ")", ",", "md5Reader", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "p", ".", "b", ".", "Sign", "(", "r", ")", "\n", "resp", ",", "err", ":=", "p", ".", "c", ".", "Client", ".", "Do", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "defer", "checkClose", "(", "resp", ".", "Body", ",", "err", ")", "\n", "if", "resp", ".", "StatusCode", "!=", "200", "{", "return", "newRespError", "(", "resp", ")", "\n", "}", "\n", "return", "\n", "}" ]
24,156
all-24157
[ "GetModifiedAtOk", "returns", "a", "tuple", "with", "the", "ModifiedAt", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "b", "*", "Board", ")", "GetModifiedAtOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "b", "==", "nil", "||", "b", ".", "ModifiedAt", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "b", ".", "ModifiedAt", ",", "<mask>", "\n", "}" ]
24,157
all-24158
[ "GetNamed", "is", "a", "wrapper", "around", "gtk_css_provider_get_named", "()", "." ]
[ "func", "CssProviderGetNamed", "(", "name", "string", ",", "variant", "string", ")", "(", "*", "CssProvider", ",", "error", ")", "{", "cname", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cname", ")", ")", "\n", "cvariant", ":=", "C", ".", "CString", "(", "variant", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cvariant", ")", ")", "\n\n", "c", ":=", "C", ".", "gtk_css_provider_get_named", "(", "(", "*", "C", ".", "gchar", ")", "(", "cname", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cvariant", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapCssProvider", "(", "obj", ")", ",", "nil", "\n", "}" ]
24,158
all-24159
[ "Offering", "gets", "offering", "message", "through", "tor", "net", "." ]
[ "func", "(", "c", "*", "Client", ")", "Offering", "(", "hash", "data", ".", "HexString", ")", "(", "<mask>", ".", "Base64String", ",", "error", ")", "{", "return", "c", ".", "requestWithPayload", "(", "\"", "\"", ",", "string", "(", "hash", ")", ")", "\n", "}" ]
24,159
all-24160
[ "SearchUsers", "returns", "users", "matching", "a", "filter", "(", "search", "queries", "are", "not", "suppoted", "by", "the", "user", "endpoint", ")", ".", "Pass", "nil", "as", "filter", "for", "all", "users", "available", "to", "the", "API", "Token", "." ]
[ "func", "(", "a", "*", "API", ")", "SearchUsers", "(", "filterCriteria", "*", "SearchFilterType", ")", "(", "*", "[", "]", "User", ",", "error", ")", "{", "q", ":=", "url", ".", "Values", "{", "}", "\n\n", "if", "filterCriteria", "!=", "nil", "&&", "len", "(", "*", "filterCriteria", ")", ">", "0", "{", "for", "filter", ",", "criteria", ":=", "range", "*", "filterCriteria", "{", "for", "_", ",", "val", ":=", "range", "criteria", "{", "q", ".", "Add", "(", "filter", ",", "val", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "q", ".", "Encode", "(", ")", "==", "\"", "\"", "{", "return", "a", ".", "FetchUsers", "(", ")", "\n", "}", "\n\n", "reqURL", ":=", "<mask>", ".", "URL", "{", "Path", ":", "config", ".", "UserPrefix", ",", "RawQuery", ":", "q", ".", "Encode", "(", ")", ",", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "reqURL", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "var", "users", "[", "]", "User", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "users", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "users", ",", "nil", "\n", "}" ]
24,160
all-24161
[ "Request", "generates", "a", "random", "/", "fake", "GDPR", "request" ]
[ "func", "(", "c", "*", "Controller", ")", "Request", "(", ")", "error", "{", "req", ":=", "&", "gdpr", ".", "Request", "{", "ApiVersion", ":", "gdpr", ".", "ApiVersion", ",", "SubjectRequestId", ":", "uuid", ".", "NewV4", "(", ")", ".", "String", "(", ")", ",", "SubjectIdentities", ":", "[", "]", "gdpr", ".", "Identity", "{", "gdpr", ".", "Identity", "{", "Type", ":", "gdpr", ".", "IDENTITY_EMAIL", ",", "Format", ":", "gdpr", ".", "FORMAT_RAW", ",", "Value", ":", "\"", "\"", ",", "}", ",", "}", ",", "SubjectRequestType", ":", "gdpr", ".", "SUBJECT_ERASURE", ",", "StatusCallbackUrls", ":", "[", "]", "string", "{", "\"", "\"", ",", "}", ",", "}", "\n", "resp", ",", "err", ":=", "c", ".", "<mask>", ".", "Request", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "c", ".", "responses", "[", "resp", ".", "SubjectRequestId", "]", "=", "resp", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "resp", ".", "SubjectRequestId", ")", "\n", "return", "nil", "\n", "}" ]
24,161
all-24162
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetRealtimeDataParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoWebaudio1", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
24,162
all-24163
[ "HasDeletedAt", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "SyntheticsTest", ")", "HasDeletedAt", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "DeletedAt", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
24,163
all-24164
[ "DelByName", "removes", "the", "format", "by", "the", "specified", "name", "returns", "true", "when", "an", "item", "was", "actually", "removed" ]
[ "func", "(", "f", "*", "defaultFormats", ")", "DelByName", "(", "name", "string", ")", "bool", "{", "f", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "Unlock", "(", ")", "\n\n", "nme", ":=", "f", ".", "normalizeName", "(", "name", ")", "\n\n", "for", "i", ",", "v", ":=", "range", "f", ".", "data", "{", "if", "v", ".", "Name", "==", "nme", "{", "f", ".", "data", "[", "i", "]", "=", "knownFormat", "{", "}", "// release", "\n", "f", ".", "data", "=", "append", "(", "f", ".", "data", "[", ":", "i", "]", ",", "f", ".", "data", "[", "i", "+", "1", ":", "]", "...", ")", "\n", "return", "true", "\n", "}", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
24,164
all-24165
[ "Create", "a", "new", "connection", "and", "run", "Connect", "()" ]
[ "func", "Connect", "(", "config", "*", "Config", ")", "(", "*", "Connection", ",", "error", ")", "{", "conn", ":=", "&", "Connection", "{", "Config", ":", "config", ",", "Context", ":", "&", "Context", "{", "}", ",", "}", "\n\n", "err", ":=", "conn", ".", "Connect", "(", ")", "\n\n", "return", "<mask>", ",", "err", "\n", "}" ]
24,165
all-24166
[ "----------------------------------------", "Other" ]
[ "func", "DecodeBool", "(", "bz", "[", "]", "byte", ")", "(", "b", "bool", ",", "n", "int", ",", "err", "error", ")", "{", "const", "size", "int", "=", "1", "\n", "if", "len", "(", "bz", ")", "<", "size", "{", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "switch", "bz", "[", "0", "]", "{", "case", "0", ":", "b", "=", "false", "\n", "case", "1", ":", "b", "=", "true", "\n", "default", ":", "err", "=", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "n", "=", "size", "\n", "return", "\n", "}" ]
24,166
all-24167
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "HasType", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "Type", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
24,167
all-24168
[ "Copy", "copies", "a", "byte", "slice", "and", "returns", "the", "copied", "slice", "." ]
[ "func", "Copy", "(", "a", "[", "]", "byte", ")", "[", "]", "byte", "{", "b", ":=", "<mask>", "(", "[", "]", "byte", ",", "len", "(", "a", ")", ")", "\n", "copy", "(", "b", ",", "a", ")", "\n", "return", "b", "\n", "}" ]
24,168
all-24169
[ "Simple", "authentication", "middleware" ]
[ "func", "IsAuthenticated", "(", "h", "<mask>", ".", "HandlerFunc", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "if", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "==", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "getAuthToken", "(", ")", ")", "{", "h", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", "else", "{", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "w", ".", "WriteHeader", "(", "http", ".", "StatusUnauthorized", ")", "\n", "}", "\n", "}", "\n", "}" ]
24,169
all-24170
[ "Adopt", "()", ":", "non", "-", "standard", ".", "For", "efficiency", "s", "sake", "(", "possibly", ")", "take", "ownership", "of", "already", "allocated", "slice", "offered", "in", "me", ".", "If", "me", "is", "large", "we", "will", "adopt", "it", "and", "we", "will", "potentially", "then", "write", "to", "the", "me", "buffer", ".", "If", "we", "already", "have", "a", "bigger", "buffer", "copy", "me", "into", "the", "existing", "buffer", "instead", ".", "Side", "-", "effect", ":", "may", "change", "b", ".", "Use", "among", "other", "internal", "state", "changes", "." ]
[ "func", "(", "b", "*", "AtomicFixedSizeRingBuf", ")", "Adopt", "(", "me", "[", "]", "byte", ")", "{", "b", ".", "tex", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "tex", ".", "Unlock", "(", ")", "\n\n", "n", ":=", "len", "(", "<mask>", ")", "\n", "if", "n", ">", "b", ".", "N", "{", "b", ".", "A", "[", "0", "]", "=", "me", "\n", "b", ".", "A", "[", "1", "]", "=", "make", "(", "[", "]", "byte", ",", "n", ",", "n", ")", "\n", "b", ".", "N", "=", "n", "\n", "b", ".", "Use", "=", "0", "\n", "b", ".", "Beg", "=", "0", "\n", "b", ".", "readable", "=", "n", "\n", "}", "else", "{", "// we already have a larger buffer, reuse it.", "copy", "(", "b", ".", "A", "[", "0", "]", ",", "me", ")", "\n", "b", ".", "Use", "=", "0", "\n", "b", ".", "Beg", "=", "0", "\n", "b", ".", "readable", "=", "n", "\n", "}", "\n", "}" ]
24,170
all-24171
[ "flushDaemon", "periodically", "flushes", "the", "log", "file", "buffers", "." ]
[ "func", "(", "l", "*", "Log", ")", "flushDaemon", "(", ")", "{", "for", "_", "=", "range", "<mask>", ".", "NewTicker", "(", "flushInterval", ")", ".", "C", "{", "l", ".", "lockAndFlushAll", "(", ")", "\n", "}", "\n", "}" ]
24,171
all-24172
[ "title", ":", "update", "platform", "path", ":", "/", "platforms", "/", "{", "name", "}", "method", ":", "PUT", "produce", ":", "application", "/", "x", "-", "json", "-", "stream", "responses", ":", "200", ":", "Platform", "updated", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "platformUpdate", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "name", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "file", ",", "_", ",", "_", ":=", "r", ".", "FormFile", "(", "\"", "\"", ")", "\n", "if", "file", "!=", "nil", "{", "defer", "file", ".", "Close", "(", ")", "\n", "}", "\n", "args", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "key", ",", "values", ":=", "range", "r", ".", "Form", "{", "args", "[", "<mask>", "]", "=", "values", "[", "0", "]", "\n", "}", "\n", "canUpdatePlatform", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermPlatformUpdate", ")", "\n", "if", "!", "canUpdatePlatform", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "keepAliveWriter", ":=", "io", ".", "NewKeepAliveWriter", "(", "w", ",", "30", "*", "time", ".", "Second", ",", "\"", "\"", ")", "\n", "defer", "keepAliveWriter", ".", "Stop", "(", ")", "\n", "writer", ":=", "&", "io", ".", "SimpleJsonMessageEncoderWriter", "{", "Encoder", ":", "json", ".", "NewEncoder", "(", "keepAliveWriter", ")", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypePlatform", ",", "Value", ":", "name", "}", ",", "Kind", ":", "permission", ".", "PermPlatformUpdate", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermPlatformReadEvents", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "evt", ".", "SetLogWriter", "(", "writer", ")", "\n", "ctx", ",", "cancel", ":=", "evt", ".", "CancelableContext", "(", "context", ".", "Background", "(", ")", ")", "\n", "err", "=", "servicemanager", ".", "Platform", ".", "Update", "(", "appTypes", ".", "PlatformOptions", "{", "Name", ":", "name", ",", "Args", ":", "args", ",", "Input", ":", "file", ",", "Output", ":", "evt", ",", "Ctx", ":", "ctx", ",", "}", ")", "\n", "cancel", "(", ")", "\n", "if", "err", "==", "appTypes", ".", "ErrPlatformNotFound", "{", "return", "&", "tErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "writer", ".", "Write", "(", "[", "]", "byte", "(", "\"", "\\n", "\"", ")", ")", "\n", "return", "nil", "\n", "}" ]
24,172
all-24173
[ "IterChildren", "is", "a", "wrapper", "around", "gtk_tree_model_iter_children", "()", "." ]
[ "func", "(", "v", "*", "TreeModel", ")", "IterChildren", "(", "iter", ",", "child", "*", "TreeIter", ")", "bool", "{", "var", "cIter", ",", "cChild", "*", "C", ".", "GtkTreeIter", "\n", "if", "iter", "!=", "nil", "{", "cIter", "=", "iter", ".", "native", "(", ")", "\n", "}", "\n", "cChild", "=", "<mask>", ".", "native", "(", ")", "\n", "c", ":=", "C", ".", "gtk_tree_model_iter_children", "(", "v", ".", "native", "(", ")", ",", "cChild", ",", "cIter", ")", "\n", "return", "gobool", "(", "c", ")", "\n", "}" ]
24,173
all-24174
[ "UnmarshalText", "hydrates", "this", "instance", "from", "text" ]
[ "func", "(", "u", "*", "UUID3", ")", "UnmarshalText", "(", "data", "[", "]", "byte", ")", "error", "{", "// validation is performed later on", "*", "u", "=", "UUID3", "(", "string", "(", "<mask>", ")", ")", "\n", "return", "nil", "\n", "}" ]
24,174
all-24175
[ "GetPullRequestPatch", "gets", "the", "patch", "version", "of", "a", "pull", "request", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "media", "/", "#commits", "-", "commit", "-", "comparison", "-", "and", "-", "pull", "-", "requests" ]
[ "func", "(", "c", "*", "Client", ")", "GetPullRequestPatch", "(", "org", ",", "repo", "string", ",", "number", "int", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "repo", ",", "number", ")", "\n", "_", ",", "patch", ",", "err", ":=", "c", ".", "requestRaw", "(", "&", "request", "{", "<mask>", ":", "\"", "\"", ",", "method", ":", "http", ".", "MethodGet", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "number", ")", ",", "exitCodes", ":", "[", "]", "int", "{", "200", "}", ",", "}", ")", "\n", "return", "patch", ",", "err", "\n", "}" ]
24,175
all-24176
[ "Watch", "function", "returns", "a", "Watcher", ".", "If", "recursive", "is", "true", "the", "first", "change", "after", "index", "under", "key", "will", "be", "sent", "to", "the", "event", "channel", "of", "the", "watcher", ".", "If", "recursive", "is", "false", "the", "first", "change", "after", "index", "at", "key", "will", "be", "sent", "to", "the", "event", "channel", "of", "the", "watcher", ".", "If", "index", "is", "zero", "watch", "will", "start", "from", "the", "current", "index", "+", "1", "." ]
[ "func", "(", "wh", "*", "watcherHub", ")", "watch", "(", "key", "string", ",", "recursive", ",", "stream", "bool", ",", "index", ",", "storeIndex", "uint64", ")", "(", "Watcher", ",", "*", "v2error", ".", "Error", ")", "{", "reportWatchRequest", "(", ")", "\n", "event", ",", "err", ":=", "wh", ".", "EventHistory", ".", "scan", "(", "key", ",", "recursive", ",", "index", ")", "\n\n", "if", "err", "!=", "nil", "{", "err", ".", "Index", "=", "storeIndex", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "w", ":=", "&", "watcher", "{", "eventChan", ":", "make", "(", "chan", "*", "Event", ",", "100", ")", ",", "// use a buffered channel", "recursive", ":", "recursive", ",", "stream", ":", "stream", ",", "sinceIndex", ":", "<mask>", ",", "startIndex", ":", "storeIndex", ",", "hub", ":", "wh", ",", "}", "\n\n", "wh", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "wh", ".", "mutex", ".", "Unlock", "(", ")", "\n", "// If the event exists in the known history, append the EtcdIndex and return immediately", "if", "event", "!=", "nil", "{", "ne", ":=", "event", ".", "Clone", "(", ")", "\n", "ne", ".", "EtcdIndex", "=", "storeIndex", "\n", "w", ".", "eventChan", "<-", "ne", "\n", "return", "w", ",", "nil", "\n", "}", "\n\n", "l", ",", "ok", ":=", "wh", ".", "watchers", "[", "key", "]", "\n\n", "var", "elem", "*", "list", ".", "Element", "\n\n", "if", "ok", "{", "// add the new watcher to the back of the list", "elem", "=", "l", ".", "PushBack", "(", "w", ")", "\n", "}", "else", "{", "// create a new list and add the new watcher", "l", "=", "list", ".", "New", "(", ")", "\n", "elem", "=", "l", ".", "PushBack", "(", "w", ")", "\n", "wh", ".", "watchers", "[", "key", "]", "=", "l", "\n", "}", "\n\n", "w", ".", "remove", "=", "func", "(", ")", "{", "if", "w", ".", "removed", "{", "// avoid removing it twice", "return", "\n", "}", "\n", "w", ".", "removed", "=", "true", "\n", "l", ".", "Remove", "(", "elem", ")", "\n", "atomic", ".", "AddInt64", "(", "&", "wh", ".", "count", ",", "-", "1", ")", "\n", "reportWatcherRemoved", "(", ")", "\n", "if", "l", ".", "Len", "(", ")", "==", "0", "{", "delete", "(", "wh", ".", "watchers", ",", "key", ")", "\n", "}", "\n", "}", "\n\n", "atomic", ".", "AddInt64", "(", "&", "wh", ".", "count", ",", "1", ")", "\n", "reportWatcherAdded", "(", ")", "\n\n", "return", "w", ",", "nil", "\n", "}" ]
24,176
all-24177
[ "StringWithinTransport", "returns", "a", "string", "representation", "of", "the", "reference", "which", "MUST", "be", "such", "that", "reference", ".", "Transport", "()", ".", "ParseReference", "(", "reference", ".", "StringWithinTransport", "()", ")", "returns", "an", "equivalent", "reference", ".", "NOTE", ":", "The", "returned", "string", "is", "not", "promised", "to", "be", "equal", "to", "the", "original", "input", "to", "ParseReference", ";", "e", ".", "g", ".", "default", "attribute", "values", "omitted", "by", "the", "user", "may", "be", "filled", "in", "in", "the", "return", "value", "or", "vice", "versa", ".", "WARNING", ":", "Do", "not", "use", "the", "return", "value", "in", "the", "UI", "to", "describe", "an", "image", "it", "does", "not", "contain", "the", "Transport", "()", ".", "Name", "()", "prefix", "." ]
[ "func", "(", "<mask>", "archiveReference", ")", "StringWithinTransport", "(", ")", "string", "{", "if", "ref", ".", "destinationRef", "==", "nil", "{", "return", "ref", ".", "path", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ref", ".", "path", ",", "ref", ".", "destinationRef", ".", "String", "(", ")", ")", "\n", "}" ]
24,177
all-24178
[ "AddItem", "add", "a", "new", "radio", "button", "to", "group" ]
[ "func", "(", "c", "*", "RadioGroup", ")", "AddItem", "(", "r", "*", "Radio", ")", "{", "c", ".", "<mask>", "=", "append", "(", "c", ".", "items", ",", "r", ")", "\n", "r", ".", "SetGroup", "(", "c", ")", "\n", "}" ]
24,178
all-24179
[ "Copy", "()", "is", "a", "wrapper", "around", "gtk_paper_size_copy", "()", "." ]
[ "func", "(", "<mask>", "*", "PaperSize", ")", "Copy", "(", ")", "(", "*", "PaperSize", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_paper_size_copy", "(", "ps", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "t", ":=", "&", "PaperSize", "{", "c", "}", "\n", "runtime", ".", "SetFinalizer", "(", "t", ",", "(", "*", "PaperSize", ")", ".", "free", ")", "\n", "return", "t", ",", "nil", "\n", "}" ]
24,179
all-24180
[ "Format", "formats", "the", "node", "." ]
[ "func", "(", "node", "*", "DDL", ")", "Format", "(", "buf", "*", "TrackedBuffer", ")", "{", "switch", "node", ".", "Action", "{", "case", "CreateStr", ":", "if", "node", ".", "TableSpec", "==", "nil", "{", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Action", ",", "node", ".", "NewName", ")", "\n", "}", "else", "{", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Action", ",", "node", ".", "NewName", ",", "node", ".", "TableSpec", ")", "\n", "}", "\n", "case", "DropStr", ":", "exists", ":=", "\"", "\"", "\n", "if", "node", ".", "IfExists", "{", "exists", "=", "\"", "\"", "\n", "}", "\n", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Action", ",", "exists", ",", "node", ".", "Table", ")", "\n", "case", "RenameStr", ":", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Action", ",", "node", ".", "Table", ",", "node", ".", "NewName", ")", "\n", "case", "AlterStr", ":", "if", "node", ".", "PartitionSpec", "!=", "nil", "{", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Action", ",", "node", ".", "Table", ",", "node", ".", "PartitionSpec", ")", "\n", "}", "else", "{", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Action", ",", "node", ".", "Table", ")", "\n", "}", "\n", "case", "CreateVindexStr", ":", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Action", ",", "node", ".", "VindexSpec", ".", "Name", ",", "node", ".", "VindexSpec", ")", "\n", "case", "AddColVindexStr", ":", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Table", ",", "node", ".", "Action", ",", "node", ".", "VindexSpec", ".", "Name", ")", "\n", "for", "i", ",", "col", ":=", "<mask>", "node", ".", "VindexCols", "{", "if", "i", "!=", "0", "{", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "col", ")", "\n", "}", "else", "{", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "col", ")", "\n", "}", "\n", "}", "\n", "buf", ".", "Myprintf", "(", "\"", "\"", ")", "\n", "if", "node", ".", "VindexSpec", ".", "Type", ".", "String", "(", ")", "!=", "\"", "\"", "{", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "VindexSpec", ")", "\n", "}", "\n", "case", "DropColVindexStr", ":", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Table", ",", "node", ".", "Action", ",", "node", ".", "VindexSpec", ".", "Name", ")", "\n", "default", ":", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Action", ",", "node", ".", "Table", ")", "\n", "}", "\n", "}" ]
24,180
all-24181
[ "Authenticate", "creates", "a", "Rackspace", "-", "specific", "Gophercloud", "client", "." ]
[ "func", "(", "c", "*", "Client", ")", "Authenticate", "(", "d", "*", "openstack", ".", "Driver", ")", "error", "{", "if", "c", ".", "Provider", "!=", "nil", "{", "return", "nil", "\n", "}", "\n\n", "log", ".", "Debug", "(", "\"", "\"", ",", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "d", ".", "Username", ",", "}", ")", "\n\n", "apiKey", ":=", "c", ".", "driver", ".", "APIKey", "\n", "opts", ":=", "gophercloud", ".", "AuthOptions", "{", "Username", ":", "d", ".", "Username", ",", "APIKey", ":", "apiKey", ",", "}", "\n\n", "provider", ",", "err", ":=", "rackspace", ".", "NewClient", "(", "rackspace", ".", "RackspaceUSIdentity", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "provider", ".", "UserAgent", ".", "Prepend", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ".", "APIVersion", ")", ")", "\n\n", "err", "=", "rackspace", ".", "Authenticate", "(", "provider", ",", "opts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "c", ".", "Provider", "=", "provider", "\n\n", "return", "nil", "\n", "}" ]
24,181
all-24182
[ "GetRecordsForSerial", "retrieves", "from", "memory", "the", "last", "known", "recordset", "for", "the", "(", "zone", "serial", ")", "tuple" ]
[ "func", "(", "snap", "*", "ZoneSnapshot", ")", "GetRecordsForSerial", "(", "zone", "string", ",", "serial", "int", ")", "[", "]", "*", "endpoint", ".", "Endpoint", "{", "lastSerial", ",", "ok", ":=", "snap", ".", "serials", "[", "<mask>", "]", "\n", "if", "!", "ok", "{", "// no mapping", "return", "nil", "\n", "}", "\n\n", "if", "lastSerial", "!=", "serial", "{", "// outdated mapping", "return", "nil", "\n", "}", "\n\n", "endpoints", ",", "ok", ":=", "snap", ".", "endpoints", "[", "zone", "]", "\n", "if", "!", "ok", "{", "// probably a bug", "return", "nil", "\n", "}", "\n\n", "return", "endpoints", "\n", "}" ]
24,182
all-24183
[ "Add", "an", "item", "to", "the", "cache", "replacing", "any", "existing", "item", ".", "If", "the", "duration", "is", "0", "(", "DefaultExpiration", ")", "the", "cache", "s", "default", "expiration", "time", "is", "used", ".", "If", "it", "is", "-", "1", "(", "NoExpiration", ")", "the", "item", "never", "expires", "." ]
[ "func", "(", "c", "*", "cache", ")", "Set", "(", "k", "string", ",", "x", "interface", "{", "}", ",", "d", "time", ".", "Duration", ")", "{", "// \"Inlining\" of set", "var", "e", "int64", "\n", "if", "d", "==", "DefaultExpiration", "{", "d", "=", "c", ".", "defaultExpiration", "\n", "}", "\n", "if", "d", ">", "0", "{", "e", "=", "time", ".", "Now", "(", ")", ".", "Add", "(", "d", ")", ".", "UnixNano", "(", ")", "\n", "}", "\n", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "c", ".", "items", "[", "k", "]", "=", "Item", "{", "<mask>", ":", "x", ",", "Expiration", ":", "e", ",", "}", "\n", "// TODO: Calls to mu.Unlock are currently not deferred because defer", "// adds ~200 ns (as of go1.)", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "}" ]
24,183
all-24184
[ "GetNoGroupHosts", "returns", "the", "NoGroupHosts", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "h", "*", "HostmapDefinition", ")", "GetNoGroupHosts", "(", ")", "bool", "{", "if", "h", "==", "nil", "||", "h", ".", "NoGroupHosts", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "h", ".", "NoGroupHosts", "\n", "}" ]
24,184
all-24185
[ "Monotonic", "returns", "a", "time", "duration", "from", "some", "fixed", "point", "in", "the", "past", "." ]
[ "func", "Monotonic", "(", ")", "time", ".", "Duration", "{", "sec", ",", "nsec", ":=", "monotime", "(", ")", "\n", "return", "<mask>", ".", "Duration", "(", "sec", "*", "1000000000", "+", "int64", "(", "nsec", ")", ")", "\n", "}" ]
24,185
all-24186
[ "matchingConfigs", "filters", "irrelevant", "RequireMtchingLabel", "configs", "from", "the", "list", "of", "all", "configs", ".", "branch", "should", "be", "empty", "for", "Issues", "and", "non", "-", "empty", "for", "PRs", ".", "label", "should", "be", "omitted", "in", "the", "case", "of", "open", "and", "reopen", "actions", "." ]
[ "func", "matchingConfigs", "(", "org", ",", "repo", ",", "branch", ",", "label", "string", ",", "allConfigs", "[", "]", "plugins", ".", "RequireMatchingLabel", ")", "[", "]", "plugins", ".", "RequireMatchingLabel", "{", "var", "filtered", "[", "]", "plugins", ".", "RequireMatchingLabel", "\n", "for", "_", ",", "cfg", ":=", "<mask>", "allConfigs", "{", "// Check if the config applies to this issue type.", "if", "(", "branch", "==", "\"", "\"", "&&", "!", "cfg", ".", "Issues", ")", "||", "(", "branch", "!=", "\"", "\"", "&&", "!", "cfg", ".", "PRs", ")", "{", "continue", "\n", "}", "\n", "// Check if the config applies to this 'org[/repo][/branch]'.", "if", "org", "!=", "cfg", ".", "Org", "||", "(", "cfg", ".", "Repo", "!=", "\"", "\"", "&&", "cfg", ".", "Repo", "!=", "repo", ")", "||", "(", "cfg", ".", "Branch", "!=", "\"", "\"", "&&", "branch", "!=", "\"", "\"", "&&", "cfg", ".", "Branch", "!=", "branch", ")", "{", "continue", "\n", "}", "\n", "// If we are reacting to a label event, see if it is relevant.", "if", "label", "!=", "\"", "\"", "&&", "!", "cfg", ".", "Re", ".", "MatchString", "(", "label", ")", "{", "continue", "\n", "}", "\n", "filtered", "=", "append", "(", "filtered", ",", "cfg", ")", "\n", "}", "\n", "return", "filtered", "\n", "}" ]
24,186
all-24187
[ "ListShares", "lists", "all", "shares" ]
[ "func", "(", "c", "*", "Client", ")", "ListShares", "(", "grpid", "string", ")", "(", "*", "Shares", ",", "error", ")", "{", "url", ":=", "umGroupShares", "(", "grpid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "<mask>", ":=", "&", "Shares", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
24,187
all-24188
[ "NewLexer", "creates", "a", "new", "scanner", "from", "the", "input" ]
[ "func", "NewLexer", "(", "name", ",", "input", "string", ",", "h", "Handler", ")", "*", "Lexer", "{", "return", "&", "Lexer", "{", "Name", ":", "name", ",", "input", ":", "input", "+", "\"", "\\n", "\"", ",", "<mask>", ":", "lexText", ",", "handler", ":", "h", ",", "}", "\n", "}" ]
24,188
all-24189
[ "/", "*", "AddVM", "adds", "a", "new", "vm", "to", "the", "pool" ]
[ "func", "(", "a", "*", "Client", ")", "AddVM", "(", "params", "*", "AddVMParams", ")", "(", "*", "AddVMOK", ",", "error", ")", "{", "// TODO: Validate the params before sending", "if", "params", "==", "nil", "{", "params", "=", "NewAddVMParams", "(", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "transport", ".", "Submit", "(", "&", "runtime", ".", "ClientOperation", "{", "ID", ":", "\"", "\"", ",", "Method", ":", "\"", "\"", ",", "PathPattern", ":", "\"", "\"", ",", "ProducesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "ConsumesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Schemes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Params", ":", "params", ",", "Reader", ":", "&", "AddVMReader", "{", "formats", ":", "a", ".", "formats", "}", ",", "<mask>", ":", "params", ".", "Context", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ".", "(", "*", "AddVMOK", ")", ",", "nil", "\n\n", "}" ]
24,189
all-24190
[ "AddEdit", "is", "a", "convenience", "function", "to", "add", "a", "new", "edit", "to", "a", "window", ".", "Capacity", "and", "width", "determine", "the", "maxima", "of", "the", "returned", "value", ".", "It", "wraps", "the", "AddWidget", "call", ".", "AddEdit", "must", "be", "called", "from", "queue", "." ]
[ "func", "(", "w", "*", "Window", ")", "AddEdit", "(", "x", ",", "y", ",", "width", "int", ",", "target", "*", "string", ")", "*", "Edit", "{", "// we can ignore error for builtins", "e", ",", "_", ":=", "w", ".", "AddWidget", "(", "WidgetEdit", ",", "x", ",", "y", ")", "\n", "edit", ":=", "e", ".", "(", "*", "Edit", ")", "\n", "edit", ".", "<mask>", "=", "width", "\n\n", "// save current sizes to detect actual window resizes", "edit", ".", "prevX", "=", "w", ".", "x", "\n", "edit", ".", "prevY", "=", "w", ".", "y", "\n\n", "edit", ".", "Resize", "(", ")", "\n\n", "// cursor", "edit", ".", "cx", "=", "-", "1", "\n", "edit", ".", "cy", "=", "-", "1", "\n\n", "// set target string", "edit", ".", "SetText", "(", "target", ",", "true", ")", "\n\n", "// flip attributes", "a", ":=", "defaultAttributes", "(", ")", "\n", "a2", ":=", "Attributes", "{", "Fg", ":", "a", ".", "Bg", ",", "Bg", ":", "a", ".", "Fg", ",", "}", "\n", "edit", ".", "SetAttributes", "(", "a2", ")", "\n\n", "return", "edit", "\n", "}" ]
24,190
all-24191
[ "HasOrderDirection", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinitionRequest", ")", "HasOrderDirection", "(", ")", "bool", "{", "if", "g", "!=", "nil", "&&", "g", ".", "OrderDirection", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
24,191
all-24192
[ "Get", "gets", "a", "hashtree", "node", "." ]
[ "func", "Get", "(", "rs", "[", "]", "io", ".", "ReadCloser", ",", "filePath", "string", ")", "(", "*", "NodeProto", ",", "error", ")", "{", "filePath", "=", "clean", "(", "filePath", ")", "\n", "var", "fileNode", "*", "NodeProto", "\n", "if", "err", ":=", "nodes", "(", "rs", ",", "func", "(", "path", "string", ",", "node", "*", "NodeProto", ")", "error", "{", "if", "path", "==", "filePath", "{", "fileNode", "=", "<mask>", "\n", "}", "\n", "return", "nil", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "fileNode", "==", "nil", "{", "return", "nil", ",", "errorf", "(", "PathNotFound", ",", "\"", "\\\"", "\\\"", "\"", ",", "filePath", ")", "\n", "}", "\n", "return", "fileNode", ",", "nil", "\n", "}" ]
24,192
all-24193
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SignedExchangeError", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork8", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
24,193
all-24194
[ "HasPermission", "check", "roles", "has", "permission", "for", "mode", "or", "not" ]
[ "func", "(", "permission", "Permission", ")", "HasPermission", "(", "mode", "PermissionMode", ",", "roles", "...", "interface", "{", "}", ")", "bool", "{", "var", "roleNames", "[", "]", "string", "\n", "for", "_", ",", "role", ":=", "range", "roles", "{", "if", "r", ",", "ok", ":=", "role", ".", "(", "string", ")", ";", "<mask>", "{", "roleNames", "=", "append", "(", "roleNames", ",", "r", ")", "\n", "}", "else", "if", "roler", ",", "ok", ":=", "role", ".", "(", "Roler", ")", ";", "ok", "{", "roleNames", "=", "append", "(", "roleNames", ",", "roler", ".", "GetRoles", "(", ")", "...", ")", "\n", "}", "else", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "role", ")", "\n", "return", "false", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "permission", ".", "DeniedRoles", ")", "!=", "0", "{", "if", "DeniedRoles", ":=", "permission", ".", "DeniedRoles", "[", "mode", "]", ";", "DeniedRoles", "!=", "nil", "{", "if", "includeRoles", "(", "DeniedRoles", ",", "roleNames", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n", "}", "\n\n", "// return true if haven't define allowed roles", "if", "len", "(", "permission", ".", "AllowedRoles", ")", "==", "0", "{", "return", "true", "\n", "}", "\n\n", "if", "AllowedRoles", ":=", "permission", ".", "AllowedRoles", "[", "mode", "]", ";", "AllowedRoles", "!=", "nil", "{", "if", "includeRoles", "(", "AllowedRoles", ",", "roleNames", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
24,194
all-24195
[ "Write", "delegates", "p", "to", "a", "running", "instance", "of", "BatchingWriter", "and", "spawns", "new", "instances", "as", "required", "." ]
[ "func", "(", "w", "*", "BatchingWriter", ")", "Write", "(", "bpConf", "influxdb", ".", "BatchPointsConfig", ",", "p", "*", "influxdb", ".", "Point", ")", "error", "{", "log", ":=", "w", ".", "log", ".", "WithField", "(", "\"", "\"", ",", "bpConf", ")", "\n\n", "w", ".", "pointChanMutex", ".", "RLock", "(", ")", "\n", "ch", ",", "ok", ":=", "w", ".", "pointChans", "[", "bpConf", "]", "\n", "w", ".", "pointChanMutex", ".", "RUnlock", "(", ")", "\n", "if", "!", "ok", "{", "w", ".", "pointChanMutex", ".", "Lock", "(", ")", "\n", "ch", ",", "ok", "=", "w", ".", "pointChans", "[", "bpConf", "]", "\n", "if", "!", "ok", "{", "w", ".", "mutex", ".", "Lock", "(", ")", "\n", "w", ".", "active", "++", "\n", "w", ".", "limit", "++", "\n", "w", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "ch", "=", "make", "(", "chan", "*", "batchPoint", ")", "\n", "w", ".", "pointChans", "[", "bpConf", "]", "=", "ch", "\n", "go", "writeInBatches", "(", "log", ",", "w", ".", "writer", ",", "bpConf", ",", "w", ".", "scalingInterval", ",", "ch", ",", "true", ")", "\n", "}", "\n", "w", ".", "pointChanMutex", ".", "Unlock", "(", ")", "\n", "}", "\n\n", "point", ":=", "&", "batchPoint", "{", "Point", ":", "p", ",", "errch", ":", "make", "(", "chan", "error", ",", "1", ")", ",", "}", "\n", "select", "{", "case", "ch", "<-", "point", ":", "case", "<-", "<mask>", ".", "After", "(", "w", ".", "scalingInterval", ")", ":", "w", ".", "mutex", ".", "Lock", "(", ")", "\n", "if", "w", ".", "active", "<", "w", ".", "limit", "{", "w", ".", "active", "++", "\n", "go", "writeInBatches", "(", "w", ".", "log", ",", "w", ".", "writer", ",", "bpConf", ",", "w", ".", "scalingInterval", ",", "ch", ",", "false", ")", "\n", "}", "\n", "w", ".", "mutex", ".", "Unlock", "(", ")", "\n", "ch", "<-", "point", "\n", "}", "\n", "return", "<-", "point", ".", "errch", "\n", "}" ]
24,195
all-24196
[ "Zones", "returns", "the", "list", "of", "hosted", "zones", "." ]
[ "func", "(", "p", "*", "LinodeProvider", ")", "Zones", "(", ")", "(", "[", "]", "*", "linodego", ".", "<mask>", ",", "error", ")", "{", "zones", ",", "err", ":=", "p", ".", "fetchZones", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "zones", ",", "nil", "\n", "}" ]
24,196
all-24197
[ "NewClusterProxy", "takes", "optional", "prefix", "to", "fetch", "grpc", "-", "proxy", "member", "endpoints", ".", "The", "returned", "channel", "is", "closed", "when", "there", "is", "grpc", "-", "proxy", "endpoint", "registered", "and", "the", "client", "s", "context", "is", "canceled", "so", "the", "register", "loop", "returns", "." ]
[ "func", "NewClusterProxy", "(", "c", "*", "clientv3", ".", "Client", ",", "advaddr", "string", ",", "prefix", "string", ")", "(", "pb", ".", "ClusterServer", ",", "<-", "chan", "struct", "{", "}", ")", "{", "cp", ":=", "&", "clusterProxy", "{", "clus", ":", "c", ".", "Cluster", ",", "ctx", ":", "c", ".", "Ctx", "(", ")", ",", "gr", ":", "&", "naming", ".", "GRPCResolver", "{", "Client", ":", "c", "}", ",", "advaddr", ":", "advaddr", ",", "prefix", ":", "prefix", ",", "umap", ":", "make", "(", "map", "[", "string", "]", "gnaming", ".", "Update", ")", ",", "}", "\n\n", "donec", ":=", "<mask>", "(", "chan", "struct", "{", "}", ")", "\n", "if", "advaddr", "!=", "\"", "\"", "&&", "prefix", "!=", "\"", "\"", "{", "go", "func", "(", ")", "{", "defer", "close", "(", "donec", ")", "\n", "cp", ".", "resolve", "(", "prefix", ")", "\n", "}", "(", ")", "\n", "return", "cp", ",", "donec", "\n", "}", "\n\n", "close", "(", "donec", ")", "\n", "return", "cp", ",", "donec", "\n", "}" ]
24,197
all-24198
[ "title", ":", "token", "update", "path", ":", "/", "tokens", "/", "{", "token_id", "}", "method", ":", "PUT", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "Token", "updated", "401", ":", "Unauthorized", "404", ":", "Token", "not", "found" ]
[ "func", "tokenUpdate", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "var", "args", "authTypes", ".", "TeamTokenUpdateArgs", "\n", "err", "=", "ParseInput", "(", "r", ",", "&", "args", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "args", ".", "TokenID", "=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "teamToken", ",", "err", ":=", "servicemanager", ".", "TeamToken", ".", "FindByTokenID", "(", "args", ".", "TokenID", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "authTypes", ".", "ErrTeamTokenNotFound", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", ",", "}", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermTeamTokenUpdate", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxTeam", ",", "teamToken", ".", "Team", ")", ",", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "teamTarget", "(", "teamToken", ".", "Team", ")", ",", "Kind", ":", "permission", ".", "PermTeamTokenUpdate", ",", "Owner", ":", "t", ",", "CustomData", ":", "<mask>", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermTeamReadEvents", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxTeam", ",", "teamToken", ".", "Team", ")", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "teamToken", ",", "err", "=", "servicemanager", ".", "TeamToken", ".", "Update", "(", "args", ",", "t", ")", "\n", "if", "err", "==", "authTypes", ".", "ErrTeamTokenNotFound", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", ",", "}", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "teamToken", ")", "\n", "}" ]
24,198
all-24199
[ "Create", "creates", "any", "isolation", "segments", "that", "do", "not", "yet", "exist" ]
[ "func", "(", "u", "*", "Updater", ")", "Remove", "(", ")", "error", "{", "desired", ",", "err", ":=", "u", ".", "allDesiredSegments", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "current", ",", "err", ":=", "u", ".", "Client", ".", "ListIsolationSegments", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "c", ":=", "classify", "(", "desired", ",", "current", ")", "\n", "for", "i", ":=", "range", "c", ".", "extra", "{", "err", ":=", "u", ".", "<mask>", "(", "&", "c", ".", "extra", "[", "i", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
24,199
all-24200
[ "/", "*", "Initializes", "preallocated", "CvMatND", "header" ]
[ "func", "(", "mat", "*", "MatND", ")", "InitMatNDHeader", "(", "sizes", "[", "]", "int", ",", "type_", "int", ",", "data", "unsafe", ".", "Pointer", ")", "{", "dims", ":=", "C", ".", "int", "(", "len", "(", "sizes", ")", ")", "\n", "sizes_c", ":=", "make", "(", "[", "]", "C", ".", "int", ",", "len", "(", "sizes", ")", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "sizes", ")", ";", "i", "++", "{", "sizes_c", "[", "i", "]", "=", "C", ".", "int", "(", "sizes", "[", "i", "]", ")", "\n", "}", "\n\n", "C", ".", "cvInitMatNDHeader", "(", "(", "*", "C", ".", "CvMatND", ")", "(", "mat", ")", ",", "dims", ",", "(", "*", "C", ".", "int", ")", "(", "&", "sizes_c", "[", "0", "]", ")", ",", "C", ".", "int", "(", "type_", ")", ",", "<mask>", ",", ")", "\n", "}" ]