id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
14,800
all-14801
[ "==", "Lookup", "lookUp", "parses", "the", "group", "line", "searching", "a", "value", "into", "the", "field", ".", "Returns", "nil", "if", "it", "is", "not", "found", "." ]
[ "func", "(", "*", "Group", ")", "lookUp", "(", "line", "string", ",", "f", "field", ",", "value", "interface", "{", "}", ")", "interface", "{", "}", "{", "_field", ":=", "f", ".", "(", "groupField", ")", "\n", "allField", ":=", "strings", ".", "Split", "(", "line", ",", "\"", "\"", ")", "\n", "arrayField", ":=", "<mask>", "(", "map", "[", "int", "]", "[", "]", "string", ")", "\n", "intField", ":=", "make", "(", "map", "[", "int", "]", "int", ")", "\n\n", "arrayField", "[", "3", "]", "=", "strings", ".", "Split", "(", "allField", "[", "3", "]", ",", "\"", "\"", ")", "\n\n", "// Check integers", "var", "err", "error", "\n", "if", "intField", "[", "2", "]", ",", "err", "=", "strconv", ".", "Atoi", "(", "allField", "[", "2", "]", ")", ";", "err", "!=", "nil", "{", "panic", "(", "atoiError", "{", "_GROUP_FILE", ",", "line", ",", "\"", "\"", "}", ")", "\n", "}", "\n\n", "// Check fields", "var", "isField", "bool", "\n", "if", "G_NAME", "&", "_field", "!=", "0", "&&", "allField", "[", "0", "]", "==", "value", ".", "(", "string", ")", "{", "isField", "=", "true", "\n", "}", "else", "if", "G_PASSWD", "&", "_field", "!=", "0", "&&", "allField", "[", "1", "]", "==", "value", ".", "(", "string", ")", "{", "isField", "=", "true", "\n", "}", "else", "if", "G_GID", "&", "_field", "!=", "0", "&&", "intField", "[", "2", "]", "==", "value", ".", "(", "int", ")", "{", "isField", "=", "true", "\n", "}", "else", "if", "G_MEMBER", "&", "_field", "!=", "0", "&&", "checkGroup", "(", "arrayField", "[", "3", "]", ",", "value", ".", "(", "string", ")", ")", "{", "isField", "=", "true", "\n", "}", "else", "if", "G_ALL", "&", "_field", "!=", "0", "{", "isField", "=", "true", "\n", "}", "\n\n", "if", "isField", "{", "return", "&", "Group", "{", "Name", ":", "allField", "[", "0", "]", ",", "password", ":", "allField", "[", "1", "]", ",", "GID", ":", "intField", "[", "2", "]", ",", "UserList", ":", "arrayField", "[", "3", "]", ",", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
14,801
all-14802
[ "SetProject", "sets", "the", "project", "quota", "ID", "for", "the", "given", "path" ]
[ "func", "SetProject", "(", "path", "string", ",", "id", "uint32", ")", "error", "{", "// Call ioctl through CGo", "cPath", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cPath", ")", ")", "\n\n", "if", "C", ".", "quota_set_path", "(", "cPath", ",", "C", ".", "uint32_t", "(", "<mask>", ")", ")", "!=", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "id", ",", "path", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
14,802
all-14803
[ "RepeatEntropy", "calculates", "the", "entropy", "for", "repeating", "entropy" ]
[ "func", "RepeatEntropy", "(", "match", "<mask>", ".", "Match", ")", "float64", "{", "cardinality", ":=", "CalcBruteForceCardinality", "(", "match", ".", "Token", ")", "\n", "entropy", ":=", "math", ".", "Log2", "(", "cardinality", "*", "float64", "(", "len", "(", "match", ".", "Token", ")", ")", ")", "\n\n", "return", "entropy", "\n", "}" ]
14,803
all-14804
[ "AllPresubmits", "returns", "all", "prow", "presubmit", "jobs", "in", "repos", ".", "if", "repos", "is", "empty", "return", "all", "presubmits", "." ]
[ "func", "(", "c", "*", "JobConfig", ")", "AllPresubmits", "(", "repos", "[", "]", "string", ")", "[", "]", "Presubmit", "{", "var", "res", "[", "]", "Presubmit", "\n\n", "for", "repo", ",", "v", ":=", "range", "c", ".", "Presubmits", "{", "if", "len", "(", "repos", ")", "==", "0", "{", "res", "=", "append", "(", "res", ",", "v", "...", ")", "\n", "}", "else", "{", "for", "_", ",", "r", ":=", "<mask>", "repos", "{", "if", "r", "==", "repo", "{", "res", "=", "append", "(", "res", ",", "v", "...", ")", "\n", "break", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "res", "\n", "}" ]
14,804
all-14805
[ "=====", "Actions", "POST", "/", "api", "/", "scenarios", "/", ":", "scenario_id", "/", "instance_combinations", "/", ":", "instance_combination_id", "/", "reserved_instance_purchases", "Create", "a", "new", "ReservedInstancePurchase", ".", "This", "is", "not", "actually", "purchased", "in", "the", "cloud", "and", "is", "only", "used", "for", "cost", "simulation", "purposes", "." ]
[ "func", "(", "loc", "*", "ReservedInstancePurchaseLocator", ")", "Create", "(", "autoRenew", "bool", ",", "duration", "int", ",", "offeringType", "string", ",", "quantity", "int", ",", "startDate", "*", "time", ".", "Time", ",", "options", "rsapi", ".", "APIParams", ")", "(", "*", "ReservedInstancePurchaseLocator", ",", "error", ")", "{", "var", "res", "*", "ReservedInstancePurchaseLocator", "\n", "if", "offeringType", "==", "\"", "\"", "{", "return", "res", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "params", "rsapi", ".", "APIParams", "\n", "params", "=", "rsapi", ".", "APIParams", "{", "}", "\n", "var", "viewOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "viewOpt", "!=", "nil", "{", "params", "[", "\"", "\"", "]", "=", "viewOpt", "\n", "}", "\n", "var", "p", "rsapi", ".", "APIParams", "\n", "p", "=", "rsapi", ".", "APIParams", "{", "\"", "\"", ":", "autoRenew", ",", "\"", "\"", ":", "duration", ",", "\"", "\"", ":", "offeringType", ",", "\"", "\"", ":", "quantity", ",", "\"", "\"", ":", "startDate", ",", "}", "\n", "uri", ",", "err", ":=", "loc", ".", "ActionPath", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "req", ",", "err", ":=", "loc", ".", "api", ".", "BuildHTTPRequest", "(", "uri", ".", "HTTPMethod", ",", "uri", ".", "Path", ",", "APIVersion", ",", "params", ",", "p", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "resp", ",", "err", ":=", "loc", ".", "api", ".", "PerformRequest", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "resp", ".", "StatusCode", "<", "200", "||", "resp", ".", "StatusCode", ">", "299", "{", "respBody", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "<mask>", ":=", "string", "(", "respBody", ")", "\n", "if", "sr", "!=", "\"", "\"", "{", "sr", "=", "\"", "\"", "+", "sr", "\n", "}", "\n", "return", "res", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "resp", ".", "Status", ",", "sr", ")", "\n", "}", "\n", "location", ":=", "resp", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "len", "(", "location", ")", "==", "0", "{", "return", "res", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "else", "{", "return", "&", "ReservedInstancePurchaseLocator", "{", "Href", "(", "location", ")", ",", "loc", ".", "api", "}", ",", "nil", "\n", "}", "\n", "}" ]
14,805
all-14806
[ "operate", "on", "the", "accumulation", "buffer" ]
[ "func", "Accum", "(", "op", "uint32", ",", "value", "float32", ")", "{", "syscall", ".", "Syscall", "(", "gpAccum", ",", "2", ",", "uintptr", "(", "op", ")", ",", "uintptr", "(", "math", ".", "Float32bits", "(", "<mask>", ")", ")", ",", "0", ")", "\n", "}" ]
14,806
all-14807
[ "findSig", "searches", "for", "the", "RAR", "signature", "and", "version", "at", "the", "beginning", "of", "a", "file", ".", "It", "searches", "no", "more", "than", "maxSfxSize", "bytes", "." ]
[ "func", "findSig", "(", "br", "*", "bufio", ".", "Reader", ")", "(", "int", ",", "error", ")", "{", "for", "n", ":=", "0", ";", "n", "<=", "maxSfxSize", ";", "{", "b", ",", "err", ":=", "br", ".", "ReadSlice", "(", "sigPrefix", "[", "0", "]", ")", "\n", "n", "+=", "len", "(", "b", ")", "\n", "if", "err", "==", "bufio", ".", "ErrBufferFull", "{", "continue", "\n", "}", "else", "if", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "EOF", "{", "err", "=", "errNoSig", "\n", "}", "\n", "return", "0", ",", "err", "\n", "}", "\n\n", "b", ",", "err", "=", "br", ".", "Peek", "(", "len", "(", "sigPrefix", "[", "1", ":", "]", ")", "+", "2", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "EOF", "{", "err", "=", "errNoSig", "\n", "}", "\n", "return", "0", ",", "err", "\n", "}", "\n", "if", "!", "bytes", ".", "HasPrefix", "(", "b", ",", "[", "]", "byte", "(", "sigPrefix", "[", "1", ":", "]", ")", ")", "{", "continue", "\n", "}", "\n", "b", "=", "b", "[", "len", "(", "sigPrefix", ")", "-", "1", ":", "]", "\n\n", "var", "ver", "int", "\n", "switch", "{", "case", "b", "[", "0", "]", "==", "0", ":", "ver", "=", "fileFmt15", "\n", "case", "b", "[", "0", "]", "==", "1", "&&", "b", "[", "1", "]", "==", "0", ":", "<mask>", "=", "fileFmt50", "\n", "default", ":", "continue", "\n", "}", "\n", "_", ",", "_", "=", "br", ".", "ReadSlice", "(", "'\\x00'", ")", "\n\n", "return", "ver", ",", "nil", "\n", "}", "\n", "return", "0", ",", "errNoSig", "\n", "}" ]
14,807
all-14808
[ "Contains", "returns", "true", "if", "a", "given", "value", "is", "a", "valid", "value", "within", "the", "total", "range", "." ]
[ "func", "(", "l", "*", "InclusiveRanges", ")", "Contains", "(", "value", "int", ")", "bool", "{", "for", "_", ",", "b", ":=", "<mask>", "l", ".", "blocks", "{", "if", "b", ".", "Contains", "(", "value", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
14,808
all-14809
[ "Do", "executes", "DOM", ".", "markUndoableState", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "MarkUndoableStateParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandMarkUndoableState", ",", "nil", ",", "nil", ")", "\n", "}" ]
14,809
all-14810
[ "Next", "advances", "to", "the", "next", "position", ".", "If", "there", "are", "no", "following", "nodes", "then", "Valid", "()", "will", "be", "false", "after", "this", "call", "." ]
[ "func", "(", "it", "*", "Iterator", ")", "Next", "(", ")", "{", "next", ":=", "it", ".", "list", ".", "getNext", "(", "it", ".", "<mask>", ",", "0", ")", "\n", "it", ".", "setNode", "(", "next", ",", "false", ")", "\n", "}" ]
14,810
all-14811
[ "Labels", "is", "an", "option", "that", "sets", "the", "labels", "to", "send", "with", "each", "log", "entry", "." ]
[ "func", "Labels", "(", "labels", "<mask>", "[", "string", "]", "string", ")", "Option", "{", "return", "func", "(", "sh", "*", "StackdriverHook", ")", "error", "{", "sh", ".", "labels", "=", "labels", "\n", "return", "nil", "\n", "}", "\n", "}" ]
14,811
all-14812
[ "TaskARNByV3EndpointID", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskEngineState", ")", "TaskARNByV3EndpointID", "(", "arg0", "string", ")", "(", "string", ",", "bool", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "string", ")", "\n", "ret1", ",", "_", ":=", "<mask>", "[", "1", "]", ".", "(", "bool", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
14,812
all-14813
[ "SupplierWithPrependedArgs", "returns", "a", "new", "Supplier", "that", "invokes", "the", "provided", "supplier", "and", "returns", "the", "result", "of", "calling", "RunnerWithPrependedArgs", "on", "the", "returned", "runner", "with", "the", "result", "of", "applying", "the", "provided", "argsFunc", "function", "to", "the", "provided", "command", "." ]
[ "func", "SupplierWithPrependedArgs", "(", "s", "CmderSupplier", ",", "argsFunc", "func", "(", "cmd", "Cmd", ")", "[", "]", "string", ")", "CmderSupplier", "{", "return", "func", "(", "cmd", "Cmd", ")", "(", "Cmder", ",", "error", ")", "{", "r", ",", "err", ":=", "s", "(", "cmd", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "<mask>", "\n", "}", "\n", "return", "CmderWithPrependedArgs", "(", "r", ",", "argsFunc", "(", "cmd", ")", "...", ")", ",", "nil", "\n", "}", "\n", "}" ]
14,813
all-14814
[ "Do", "executes", "DOMDebugger", ".", "removeDOMBreakpoint", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "RemoveDOMBreakpointParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandRemoveDOMBreakpoint", ",", "p", ",", "nil", ")", "\n", "}" ]
14,814
all-14815
[ "printMarkdownDash", "-", "Prints", "dash", "in", "middle", "of", "table", "." ]
[ "func", "(", "t", "*", "Table", ")", "printMarkdownDash", "(", ")", "{", "r", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "_", ",", "name", ":=", "range", "t", ".", "Fields", "{", "r", "[", "<mask>", "]", "=", "strings", ".", "Repeat", "(", "\"", "\"", ",", "t", ".", "fieldSizes", "[", "name", "]", "-", "2", ")", "\n", "}", "\n", "fmt", ".", "Println", "(", "t", ".", "rowString", "(", "r", ")", ")", "\n", "}" ]
14,815
all-14816
[ "retrieve", "information", "about", "attachments", "of", "a", "bound", "framebuffer", "object" ]
[ "func", "GetFramebufferAttachmentParameteriv", "(", "<mask>", "uint32", ",", "attachment", "uint32", ",", "pname", "uint32", ",", "params", "*", "int32", ")", "{", "syscall", ".", "Syscall6", "(", "gpGetFramebufferAttachmentParameteriv", ",", "4", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "attachment", ")", ",", "uintptr", "(", "pname", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
14,816
all-14817
[ "For", "serving", "statistics" ]
[ "func", "(", "t", "*", "Timer", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "req", ".", "ParseForm", "(", ")", "\n", "sortBy", ":=", "req", ".", "Form", ".", "Get", "(", "\"", "\"", ")", "\n\n", "stats", ":=", "&", "Stats", "{", "}", "\n", "stats", ".", "SortBy", "=", "strings", ".", "ToLower", "(", "sortBy", ")", "\n", "stats", ".", "Generated", "=", "time", ".", "Now", "(", ")", "\n", "stats", ".", "UpTime", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "stats", ".", "Generated", ".", "Sub", "(", "t", ".", "Since", ")", ")", "\n", "// Read access OK for map?", "stats", ".", "<mask>", "=", "make", "(", "[", "]", "*", "Stat", ",", "0", ",", "len", "(", "t", ".", "routes", ")", ")", "\n", "for", "k", ",", "v", ":=", "range", "t", ".", "routes", "{", "stat", ":=", "&", "Stat", "{", "}", "\n", "stat", ".", "Route", "=", "k", "\n", "stat", ".", "Count", "=", "v", ".", "Count", "\n", "stat", ".", "Tot", "=", "v", ".", "Tot", "\n", "stat", ".", "Avg", "=", "time", ".", "Duration", "(", "int64", "(", "v", ".", "Tot", ")", "/", "v", ".", "Count", ")", "\n", "stat", ".", "AvgAfter", "=", "time", ".", "Duration", "(", "int64", "(", "v", ".", "AfterTot", ")", "/", "v", ".", "Count", ")", "\n", "stat", ".", "AvgBefore", "=", "time", ".", "Duration", "(", "int64", "(", "v", ".", "BeforeTot", ")", "/", "v", ".", "Count", ")", "\n", "stat", ".", "Max", "=", "v", ".", "Max", "\n", "stat", ".", "Min", "=", "v", ".", "Min", "\n", "stats", ".", "Result", "=", "append", "(", "stats", ".", "Result", ",", "stat", ")", "\n", "}", "\n", "sort", ".", "Sort", "(", "sort", ".", "Reverse", "(", "stats", ")", ")", "\n", "jsonData", ",", "_", ":=", "json", ".", "Marshal", "(", "stats", ")", "\n", "w", ".", "Write", "(", "jsonData", ")", "\n", "}" ]
14,817
all-14818
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RestartFrameReturns", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger25", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
14,818
all-14819
[ "SetText", "sets", "the", "edit", "text", ".", "if", "end", "is", "set", "to", "true", "the", "cursor", "and", "text", "will", "be", "set", "to", "the", "end", "of", "the", "string", ".", "This", "will", "not", "be", "displayed", "immediately", ".", "SetText", "shall", "be", "called", "from", "queue", "context", "." ]
[ "func", "(", "e", "*", "Edit", ")", "SetText", "(", "s", "*", "string", ",", "end", "bool", ")", "{", "e", ".", "target", "=", "s", "\n", "e", ".", "<mask>", "=", "[", "]", "rune", "(", "*", "s", ")", "\n", "e", ".", "at", "=", "0", "\n\n", "// send synthesized key to position cursor and text", "ev", ":=", "termbox", ".", "Event", "{", "}", "\n", "if", "end", "{", "ev", ".", "Key", "=", "termbox", ".", "KeyCtrlE", "\n", "}", "else", "{", "ev", ".", "Key", "=", "termbox", ".", "KeyCtrlA", "\n", "}", "\n", "e", ".", "KeyHandler", "(", "ev", ")", "\n", "}" ]
14,819
all-14820
[ "FetchRuleSetGroups", "retrieves", "all", "rule", "set", "groups", "available", "to", "API", "Token", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchRuleSetGroups", "(", ")", "(", "*", "[", "]", "RuleSetGroup", ",", "error", ")", "{", "result", ",", "err", ":=", "a", ".", "Get", "(", "config", ".", "RuleSetGroupPrefix", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "<mask>", "rulesetGroups", "[", "]", "RuleSetGroup", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "rulesetGroups", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "rulesetGroups", ",", "nil", "\n", "}" ]
14,820
all-14821
[ "Recall", "gets", "the", "current", "value", "for", "the", "given", "dependency", "in", "the", "Brain", "." ]
[ "func", "(", "b", "*", "Brain", ")", "Recall", "(", "d", "dep", ".", "Dependency", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "b", ".", "RLock", "(", ")", "\n", "defer", "b", ".", "RUnlock", "(", ")", "\n\n", "// If we have not received data for this dependency, return now.", "if", "_", ",", "ok", ":=", "b", ".", "receivedData", "[", "d", ".", "String", "(", ")", "]", ";", "!", "ok", "{", "return", "nil", ",", "<mask>", "\n", "}", "\n\n", "return", "b", ".", "data", "[", "d", ".", "String", "(", ")", "]", ",", "true", "\n", "}" ]
14,821
all-14822
[ "Remove", "any", "stale", "socket", "file", "at", "the", "given", "path", "." ]
[ "func", "socketUnixRemoveStale", "(", "path", "string", ")", "error", "{", "// If there's no socket file at all, there's nothing to do.", "if", "!", "<mask>", ".", "PathExists", "(", "path", ")", "{", "return", "nil", "\n", "}", "\n\n", "logger", ".", "Debugf", "(", "\"", "\"", ")", "\n", "err", ":=", "os", ".", "Remove", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
14,822
all-14823
[ "CamelCase", "converts", "strings", "to", "their", "camel", "case", "equivalent" ]
[ "func", "CamelCase", "(", "src", "string", ")", "string", "{", "byteSrc", ":=", "[", "]", "byte", "(", "src", ")", "\n", "chunks", ":=", "camelingRegex", ".", "FindAll", "(", "byteSrc", ",", "-", "1", ")", "\n", "for", "idx", ",", "val", ":=", "<mask>", "chunks", "{", "if", "idx", ">", "0", "{", "chunks", "[", "idx", "]", "=", "bytes", ".", "Title", "(", "val", ")", "\n", "}", "\n", "}", "\n", "return", "string", "(", "bytes", ".", "Join", "(", "chunks", ",", "nil", ")", ")", "\n", "}" ]
14,823
all-14824
[ "updateContainerVolumeDependency", "adds", "the", "volume", "resource", "to", "container", "dependency" ]
[ "func", "(", "<mask>", "*", "Task", ")", "updateContainerVolumeDependency", "(", "name", "string", ")", "{", "// Find all the container that depends on the volume", "for", "_", ",", "container", ":=", "range", "task", ".", "Containers", "{", "for", "_", ",", "mountpoint", ":=", "range", "container", ".", "MountPoints", "{", "if", "mountpoint", ".", "SourceVolume", "==", "name", "{", "container", ".", "BuildResourceDependency", "(", "name", ",", "resourcestatus", ".", "ResourceCreated", ",", "apicontainerstatus", ".", "ContainerPulled", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
14,824
all-14825
[ "GetSingleCommit", "returns", "a", "single", "commit", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "repos", "/", "#get" ]
[ "func", "(", "c", "*", "Client", ")", "GetSingleCommit", "(", "org", ",", "repo", ",", "SHA", "string", ")", "(", "SingleCommit", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "repo", ",", "SHA", ")", "\n", "var", "commit", "SingleCommit", "\n", "_", ",", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "method", ":", "<mask>", ".", "MethodGet", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "SHA", ")", ",", "exitCodes", ":", "[", "]", "int", "{", "200", "}", ",", "}", ",", "&", "commit", ")", "\n", "return", "commit", ",", "err", "\n", "}" ]
14,825
all-14826
[ "SetBottomMargin", "()", "is", "a", "wrapper", "around", "gtk_page_setup_set_bottom_margin", "()", "." ]
[ "func", "(", "ps", "*", "PageSetup", ")", "SetBottomMargin", "(", "<mask>", "float64", ",", "unit", "Unit", ")", "{", "C", ".", "gtk_page_setup_set_bottom_margin", "(", "ps", ".", "native", "(", ")", ",", "C", ".", "gdouble", "(", "margin", ")", ",", "C", ".", "GtkUnit", "(", "unit", ")", ")", "\n", "}" ]
14,826
all-14827
[ "Returns", "the", "information", "log", "for", "a", "shader", "object" ]
[ "func", "GetShaderInfoLog", "(", "shader", "uint32", ",", "bufSize", "int32", ",", "length", "*", "int32", ",", "infoLog", "*", "uint8", ")", "{", "C", ".", "glowGetShaderInfoLog", "(", "gpGetShaderInfoLog", ",", "(", "C", ".", "GLuint", ")", "(", "shader", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "bufSize", ")", ",", "(", "*", "C", ".", "GLsizei", ")", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "infoLog", ")", ")", ")", "\n", "}" ]
14,827
all-14828
[ "OK", "checks", "if", "SyslogFacility", "is", "valid", "." ]
[ "func", "(", "s", "SyslogFacility", ")", "<mask>", "(", ")", "(", "ok", "bool", ")", "{", "_", ",", "ok", "=", "syslogPriorities", "[", "strings", ".", "ToLower", "(", "s", ".", "String", "(", ")", ")", "]", "\n", "return", "\n", "}" ]
14,828
all-14829
[ "WithLongitude", "mock", "longitude", "." ]
[ "func", "(", "p", "SetGeolocationOverrideParams", ")", "WithLongitude", "(", "longitude", "float64", ")", "*", "SetGeolocationOverrideParams", "{", "p", ".", "Longitude", "=", "longitude", "\n", "<mask>", "&", "p", "\n", "}" ]
14,829
all-14830
[ "Register", "function", "adds", "JSON", "and", "Thrift", "handlers", "to", "the", "server", "channel", "ch" ]
[ "func", "(", "b", "*", "Behavior", ")", "Register", "(", "ch", "*", "tchannel", ".", "<mask>", ")", "{", "b", ".", "registerThrift", "(", "ch", ")", "\n", "b", ".", "registerJSON", "(", "ch", ")", "\n", "}" ]
14,830
all-14831
[ "Resume", "resumes", "the", "transaction", "with", "id", ".", "It", "returns", "mgo", ".", "ErrNotFound", "if", "the", "transaction", "is", "not", "found", ".", "Otherwise", "it", "has", "the", "same", "semantics", "of", "the", "Run", "method", "after", "the", "transaction", "is", "inserted", "." ]
[ "func", "(", "r", "*", "Runner", ")", "Resume", "(", "id", "bson", ".", "ObjectId", ")", "(", "err", "error", ")", "{", "t", ",", "err", ":=", "r", ".", "load", "(", "id", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "!", "t", ".", "<mask>", "(", ")", "{", "debugf", "(", "\"", "\"", ",", "t", ",", "t", ".", "State", ")", "\n", "if", "err", ":=", "flush", "(", "r", ",", "t", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "if", "t", ".", "State", "==", "taborted", "{", "return", "ErrAborted", "\n", "}", "else", "if", "t", ".", "State", "!=", "tapplied", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "t", ",", "t", ".", "State", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
14,831
all-14832
[ "return", "parameters", "of", "a", "query", "object", "target" ]
[ "func", "GetQueryiv", "(", "target", "uint32", ",", "pname", "uint32", ",", "params", "*", "int32", ")", "{", "C", ".", "glowGetQueryiv", "(", "gpGetQueryiv", ",", "(", "C", ".", "GLenum", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLenum", ")", "(", "pname", ")", ",", "(", "*", "C", ".", "GLint", ")", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
14,832
all-14833
[ "GossipUnicast", "implements", "Gossip", "relaying", "msg", "to", "dst", "which", "must", "be", "a", "member", "of", "the", "channel", "." ]
[ "func", "(", "c", "*", "gossipChannel", ")", "GossipUnicast", "(", "dstPeerName", "PeerName", ",", "<mask>", "[", "]", "byte", ")", "error", "{", "return", "c", ".", "relayUnicast", "(", "dstPeerName", ",", "gobEncode", "(", "c", ".", "name", ",", "c", ".", "ourself", ".", "Name", ",", "dstPeerName", ",", "msg", ")", ")", "\n", "}" ]
14,833
all-14834
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "PressureLevel", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "PressureLevel", "(", "in", ".", "<mask>", "(", ")", ")", "{", "case", "PressureLevelModerate", ":", "*", "t", "=", "PressureLevelModerate", "\n", "case", "PressureLevelCritical", ":", "*", "t", "=", "PressureLevelCritical", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
14,834
all-14835
[ "askServerForName", "makes", "a", "request", "to", "a", "specific", "DNS", "server", "for", "a", "specific", "name", "(", "and", "qtype", ")", ".", "Retries", "with", "TCP", "in", "the", "event", "of", "response", "truncation", "but", "otherwise", "just", "sends", "back", "whatever", "the", "server", "gave", "whether", "that", "be", "a", "valid", "-", "looking", "response", "or", "an", "error", "." ]
[ "func", "askServerForName", "(", "name", "string", ",", "queryType", "uint16", ",", "client", "*", "dns", ".", "<mask>", ",", "servAddr", "string", ",", "edns", "bool", ")", "(", "*", "dns", ".", "Msg", ",", "error", ")", "{", "msg", ":=", "&", "dns", ".", "Msg", "{", "}", "\n\n", "msg", ".", "SetQuestion", "(", "dns", ".", "Fqdn", "(", "name", ")", ",", "queryType", ")", "\n", "if", "edns", "{", "msg", ".", "SetEdns0", "(", "dns", ".", "DefaultMsgSize", ",", "false", ")", "\n", "}", "\n\n", "response", ",", "_", ",", "err", ":=", "client", ".", "Exchange", "(", "msg", ",", "servAddr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "response", ".", "Truncated", "{", "if", "client", ".", "Net", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "client", ".", "Net", "=", "\"", "\"", "\n", "return", "askServerForName", "(", "name", ",", "queryType", ",", "client", ",", "servAddr", ",", "false", ")", "\n", "}", "\n\n", "return", "response", ",", "nil", "\n", "}" ]
14,835
all-14836
[ "ReadStruct", "reads", "the", "given", "Thrift", "struct", ".", "It", "pools", "TProtocols", "." ]
[ "func", "ReadStruct", "(", "<mask>", "io", ".", "Reader", ",", "s", "thrift", ".", "TStruct", ")", "error", "{", "wp", ":=", "getProtocolReader", "(", "reader", ")", "\n", "err", ":=", "s", ".", "Read", "(", "wp", ".", "protocol", ")", "\n", "thriftProtocolPool", ".", "Put", "(", "wp", ")", "\n", "return", "err", "\n", "}" ]
14,836
all-14837
[ "handleBadge", "handles", "requests", "to", "get", "a", "badge", "for", "one", "or", "more", "jobs", "The", "url", "must", "look", "like", "this", "where", "jobs", "is", "a", "comma", "-", "separated", "list", "of", "globs", ":", "/", "badge", ".", "svg?jobs", "=", "<glob", ">", "[", "<glob2", ">", "]", "Examples", ":", "-", "/", "badge", ".", "svg?jobs", "=", "pull", "-", "kubernetes", "-", "bazel", "-", "build", "-", "/", "badge", ".", "svg?jobs", "=", "pull", "-", "kubernetes", "-", "*", "-", "/", "badge", ".", "svg?jobs", "=", "pull", "-", "kubernetes", "-", "e2e", "*", "pull", "-", "kubernetes", "-", "*", "pull", "-", "kubernetes", "-", "integration", "-", "*" ]
[ "func", "handleBadge", "(", "ja", "*", "jobs", ".", "JobAgent", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "<mask>", ")", "{", "setHeadersNoCaching", "(", "w", ")", "\n", "wantJobs", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "wantJobs", "==", "\"", "\"", "{", "http", ".", "Error", "(", "w", ",", "\"", "\"", ",", "http", ".", "StatusBadRequest", ")", "\n", "return", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "allJobs", ":=", "ja", ".", "ProwJobs", "(", ")", "\n", "_", ",", "_", ",", "svg", ":=", "renderBadge", "(", "pickLatestJobs", "(", "allJobs", ",", "wantJobs", ")", ")", "\n", "w", ".", "Write", "(", "svg", ")", "\n", "}", "\n", "}" ]
14,837
all-14838
[ "HasMax", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinitionMarker", ")", "HasMax", "(", ")", "bool", "{", "if", "g", "!=", "nil", "&&", "g", ".", "Max", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
14,838
all-14839
[ "draw", "fills", "and", "/", "or", "strokes", "paths" ]
[ "func", "(", "gc", "*", "GraphicContext", ")", "draw", "(", "<mask>", "string", ",", "alpha", "uint32", ",", "paths", "...", "*", "draw2d", ".", "Path", ")", "{", "paths", "=", "append", "(", "paths", ",", "gc", ".", "Current", ".", "Path", ")", "\n", "for", "_", ",", "p", ":=", "range", "paths", "{", "ConvertPath", "(", "p", ",", "gc", ".", "pdf", ")", "\n", "}", "\n", "a", ":=", "float64", "(", "alpha", ")", "/", "alphaMax", "\n", "current", ",", "blendMode", ":=", "gc", ".", "pdf", ".", "GetAlpha", "(", ")", "\n", "if", "a", "!=", "current", "{", "gc", ".", "pdf", ".", "SetAlpha", "(", "a", ",", "blendMode", ")", "\n", "}", "\n", "gc", ".", "pdf", ".", "DrawPath", "(", "style", ")", "\n", "}" ]
14,839
all-14840
[ "Singlep", "retrieces", "the", "only", "element", "from", "a", "list", "that", "matches", "a", "criteria", ".", "If", "no", "match", "is", "found", "or", "two", "or", "more", "are", "found", "Singlep", "returns", "nil", "and", "an", "error", "." ]
[ "func", "Singlep", "(", "iter", "Enumerable", ",", "pred", "Predicate", ")", "(", "retval", "<mask>", "{", "}", ",", "err", "error", ")", "{", "iter", "=", "Where", "(", "iter", ",", "pred", ")", "\n", "return", "Single", "(", "iter", ")", "\n", "}" ]
14,840
all-14841
[ "CreateProgram", "returns", "a", "new", "program", "in", "SSA", "form", "given", "a", "program", "loaded", "from", "source", ".", "An", "SSA", "package", "is", "created", "for", "each", "transitively", "error", "-", "free", "package", "of", "lprog", ".", "Code", "for", "bodies", "of", "functions", "is", "not", "built", "until", "Build", "is", "called", "on", "the", "result", ".", "mode", "controls", "diagnostics", "and", "checking", "during", "SSA", "construction", "." ]
[ "func", "CreateProgram", "(", "lprog", "*", "loader", ".", "Program", ",", "mode", "ssa", ".", "BuilderMode", ")", "*", "ssa", ".", "Program", "{", "prog", ":=", "ssa", ".", "NewProgram", "(", "lprog", ".", "Fset", ",", "mode", ")", "\n\n", "for", "_", ",", "info", ":=", "range", "lprog", ".", "AllPackages", "{", "if", "<mask>", ".", "TransitivelyErrorFree", "{", "prog", ".", "CreatePackage", "(", "info", ".", "Pkg", ",", "info", ".", "Files", ",", "&", "info", ".", "Info", ",", "info", ".", "Importable", ")", "\n", "}", "\n", "}", "\n\n", "return", "prog", "\n", "}" ]
14,841
all-14842
[ "selectContext", "allows", "the", "user", "to", "choose", "a", "context", "This", "may", "involve", "creating", "a", "cluster" ]
[ "func", "selectContext", "(", "co", "contextOptions", ")", "(", "string", ",", "error", ")", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "// get cluster context", "_", ",", "cfg", ",", "err", ":=", "contextConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Fatal", "(", "\"", "\"", ")", "\n", "}", "\n", "// list contexts and ask to user to choose a context", "options", ":=", "map", "[", "int", "]", "string", "{", "}", "\n\n", "var", "ctxs", "[", "]", "string", "\n", "for", "ctx", ":=", "range", "cfg", ".", "Contexts", "{", "ctxs", "=", "append", "(", "ctxs", ",", "ctx", ")", "\n", "}", "\n", "sort", ".", "Strings", "(", "ctxs", ")", "\n", "for", "idx", ",", "ctx", ":=", "range", "ctxs", "{", "options", "[", "idx", "]", "=", "ctx", "\n", "if", "ctx", "==", "cfg", ".", "CurrentContext", "{", "fmt", ".", "Printf", "(", "\"", "\"", ",", "idx", ",", "ctx", ")", "\n", "}", "else", "{", "fmt", ".", "Printf", "(", "\"", "\"", ",", "idx", ",", "ctx", ")", "\n", "}", "\n", "fmt", ".", "Println", "(", ")", "\n", "}", "\n", "fmt", ".", "Println", "(", ")", "\n", "choice", ":=", "co", ".", "context", "\n", "switch", "{", "case", "choice", "!=", "\"", "\"", ":", "fmt", ".", "Println", "(", "\"", "\"", "+", "choice", "+", "\"", "\"", ")", "\n", "case", "co", ".", "create", "!=", "\"", "\"", "||", "co", ".", "reuse", "!=", "\"", "\"", ":", "choice", "=", "\"", "\"", "\n", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "default", ":", "fmt", ".", "Print", "(", "\"", "\"", ")", "\n", "fmt", ".", "Scanln", "(", "&", "choice", ")", "\n", "}", "\n\n", "if", "choice", "==", "\"", "\"", "||", "choice", "==", "\"", "\"", "||", "<mask>", "==", "\"", "\"", "||", "choice", "==", "\"", "\"", "{", "ctx", ",", "err", ":=", "createContext", "(", "co", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "ctx", ",", "nil", "\n", "}", "\n\n", "if", "_", ",", "ok", ":=", "cfg", ".", "Contexts", "[", "choice", "]", ";", "ok", "{", "return", "choice", ",", "nil", "\n", "}", "\n\n", "idx", ",", "err", ":=", "strconv", ".", "Atoi", "(", "choice", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "choice", ")", "\n", "}", "\n\n", "if", "ctx", ",", "ok", ":=", "options", "[", "idx", "]", ";", "ok", "{", "return", "ctx", ",", "nil", "\n", "}", "\n\n", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "idx", ")", "\n", "}" ]
14,842
all-14843
[ "GetSystemInfo", "retrieves", "and", "returns", "miscellaneous", "system", "information", "about", "the", "Rundeck", "server", "and", "the", "machine", "it", "s", "running", "on", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "GetSystemInfo", "(", ")", "(", "*", "SystemInfo", ",", "error", ")", "{", "sysInfo", ":=", "&", "SystemInfo", "{", "}", "\n", "err", ":=", "c", ".", "get", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", ",", "nil", ",", "sysInfo", ")", "\n", "return", "sysInfo", ",", "err", "\n", "}" ]
14,843
all-14844
[ "AgentAfterOfferingDelete", "set", "offering", "status", "to", "remove" ]
[ "func", "(", "w", "*", "Worker", ")", "AgentAfterOfferingDelete", "(", "job", "*", "data", ".", "<mask>", ")", "error", "{", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "job", ")", "\n\n", "offering", ",", "err", ":=", "w", ".", "relatedOffering", "(", "logger", ",", "job", ",", "data", ".", "JobAgentAfterOfferingDelete", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "offering", ".", "Status", "=", "data", ".", "OfferRemoved", "\n\n", "if", "err", ":=", "w", ".", "saveRecord", "(", "logger", ",", "w", ".", "db", ".", "Querier", ",", "offering", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "agent", ",", "err", ":=", "w", ".", "account", "(", "logger", ",", "offering", ".", "Agent", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "w", ".", "addJob", "(", "logger", ",", "nil", ",", "data", ".", "JobAccountUpdateBalances", ",", "data", ".", "JobAccount", ",", "agent", ".", "ID", ")", "\n", "}" ]
14,844
all-14845
[ "HasTitle", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "b", "*", "Board", ")", "HasTitle", "(", ")", "bool", "{", "if", "b", "!=", "nil", "&&", "b", ".", "Title", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
14,845
all-14846
[ "title", ":", "list", "default", "roles", "path", ":", "/", "role", "/", "default", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "Ok", "401", ":", "Unauthorized" ]
[ "func", "listDefaultRoles", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "if", "!", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleDefaultCreate", ")", "&&", "!", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleDefaultDelete", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "roles", ",", "err", ":=", "permission", ".", "ListRolesWithEvents", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "<mask>", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "roles", ")", "\n", "}" ]
14,846
all-14847
[ "load", "is", "a", "modified", "copy", "of", "k8s", ".", "io", "/", "kubernetes", "/", "pkg", "/", "client", "/", "unversioned", "/", "clientcmd", ".", "Load", "Load", "takes", "a", "byte", "slice", "and", "deserializes", "the", "contents", "into", "Config", "object", ".", "Encapsulates", "deserialization", "without", "assuming", "the", "source", "is", "a", "file", "." ]
[ "func", "load", "(", "data", "[", "]", "byte", ")", "(", "*", "clientcmdConfig", ",", "error", ")", "{", "config", ":=", "clientcmdNewConfig", "(", ")", "\n", "// if there's no data in a file, return the default object instead of failing (DecodeInto reject empty input)", "if", "len", "(", "data", ")", "==", "0", "{", "return", "config", ",", "nil", "\n", "}", "\n", "// Note: This does absolutely no kind/version checking or conversions.", "<mask>", ",", "err", ":=", "yaml", ".", "YAMLToJSON", "(", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "config", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "config", ",", "nil", "\n", "}" ]
14,847
all-14848
[ "Unicast", "returns", "the", "next", "hop", "on", "the", "unicast", "route", "to", "the", "named", "peer", "based", "on", "established", "and", "symmetric", "connections", "." ]
[ "func", "(", "r", "*", "routes", ")", "Unicast", "(", "name", "PeerName", ")", "(", "PeerName", ",", "bool", ")", "{", "r", ".", "RLock", "(", ")", "\n", "defer", "r", ".", "RUnlock", "(", ")", "\n", "hop", ",", "<mask>", ":=", "r", ".", "unicast", "[", "name", "]", "\n", "return", "hop", ",", "found", "\n", "}" ]
14,848
all-14849
[ "SliceIndexOf", "gets", "the", "indx", "of", "val", "in", "slice", ".", "Returns", "-", "1", "if", "not", "found", "." ]
[ "func", "SliceIndexOf", "(", "slice", "[", "]", "string", ",", "val", "string", ")", "int", "{", "if", "<mask>", "==", "nil", "{", "return", "-", "1", "\n", "}", "\n\n", "for", "i", ",", "it", ":=", "range", "slice", "{", "if", "it", "==", "val", "{", "return", "i", "\n", "}", "\n", "}", "\n", "return", "-", "1", "\n", "}" ]
14,849
all-14850
[ "Delete", "implements", "ClientInterface" ]
[ "func", "(", "c", "*", "dummyClient", ")", "Delete", "(", "name", "string", ",", "options", "*", "v1", ".", "DeleteOptions", ")", "error", "{", "_", ",", "ok", ":=", "c", ".", "objects", "[", "name", "]", "\n", "if", "<mask>", "{", "delete", "(", "c", ".", "objects", ",", "name", ")", "\n", "return", "nil", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}" ]
14,850
all-14851
[ "WriteMessage", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockClientServer", ")", "WriteMessage", "(", "arg0", "[", "]", "byte", ")", "error", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "error", ")", "\n", "return", "ret0", "\n", "}" ]
14,851
all-14852
[ "CompletionCmd", "represents", "the", "completion", "command" ]
[ "func", "CompletionCmd", "(", ")", "*", "cobra", ".", "Command", "{", "return", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Long", ":", "`completion is used to output completion code for bash and zsh shells.\n\t\n\tBefore using completion features, you have to source completion code\n\tfrom your .profile. This is done by adding following line to one of above files:\n\t\tsource <(kubicorn completion SHELL)\n\tValid arguments for SHELL are: \"bash\" and \"zsh\".\n\tNotes:\n\t1) zsh completions requires zsh 5.2 or newer.\n\t\t\n\t2) macOS users have to install bash-completion framework to utilize\n\tcompletion features. This can be done using homebrew:\n\t\tbrew install bash-completion\n\tOnce installed, you must load bash_completion by adding following\n\tline to your .profile or .bashrc/.zshrc:\n\t\tsource $(brew --prefix)/etc/bash_completion`", ",", "RunE", ":", "func", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "error", "{", "if", "logger", ".", "Fabulous", "{", "cmd", ".", "SetOutput", "(", "logger", ".", "FabulousWriter", ")", "\n", "}", "\n\n", "if", "viper", ".", "GetString", "(", "keyTrueColor", ")", "!=", "\"", "\"", "{", "cmd", ".", "SetOutput", "(", "logger", ".", "FabulousWriter", ")", "\n", "}", "\n\n", "<mask>", "len", "(", "args", ")", "{", "case", "0", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "default", ":", "switch", "args", "[", "0", "]", "{", "case", "\"", "\"", ":", "return", "runBashGeneration", "(", ")", "\n", "case", "\"", "\"", ":", "return", "runZshGeneration", "(", ")", "\n", "default", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}", ",", "}", "\n", "}" ]
14,852
all-14853
[ "BackwardCursorPositions", "is", "a", "wrapper", "around", "gtk_text_iter_backward_cursor_positions", "()", "." ]
[ "func", "(", "v", "*", "TextIter", ")", "BackwardCursorPositions", "(", "v1", "int", ")", "bool", "{", "<mask>", "gobool", "(", "C", ".", "gtk_text_iter_backward_cursor_positions", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "v1", ")", ")", ")", "\n", "}" ]
14,853
all-14854
[ "Call", "--", "generic", "call", "to", "the", "inkeeper", "endpoint" ]
[ "func", "(", "s", "*", "IkClient", ")", "Call", "(", "path", "string", ",", "query", "interface", "{", "}", ",", "jsonResp", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "res", ",", "err", ":=", "goreq", ".", "Request", "{", "Insecure", ":", "true", ",", "Uri", ":", "s", ".", "URI", "+", "\"", "\"", "+", "path", ",", "BasicAuthUsername", ":", "s", ".", "User", ",", "BasicAuthPassword", ":", "s", ".", "Password", ",", "QueryString", ":", "query", "}", ".", "Do", "(", ")", "\n", "if", "err", "==", "nil", "{", "if", "isStatusOK", "(", "res", ".", "StatusCode", ")", "{", "err", "=", "res", ".", "<mask>", ".", "FromJsonTo", "(", "jsonResp", ")", "\n\n", "}", "else", "{", "strerr", ",", "_", ":=", "res", ".", "Body", ".", "ToString", "(", ")", "\n", "err", "=", "errors", ".", "New", "(", "strerr", ")", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
14,854
all-14855
[ "UnmarshalJSON", "overrides", "the", "logic", "for", "parsing", "the", "JSON", "-", "encoded", "ResourceStatus", "data" ]
[ "func", "(", "as", "*", "ASMSecretStatus", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "if", "strings", ".", "ToLower", "(", "string", "(", "b", ")", ")", "==", "\"", "\"", "{", "*", "as", "=", "ASMSecretStatusNone", "\n", "return", "nil", "\n", "}", "\n\n", "if", "b", "[", "0", "]", "!=", "'\"'", "||", "b", "[", "len", "(", "b", ")", "-", "1", "]", "!=", "'\"'", "{", "*", "as", "=", "ASMSecretStatusNone", "\n", "return", "errors", ".", "New", "(", "\"", "\"", "+", "string", "(", "b", ")", ")", "\n", "}", "\n\n", "strStatus", ":=", "string", "(", "b", "[", "1", ":", "len", "(", "b", ")", "-", "1", "]", ")", "\n", "stat", ",", "ok", ":=", "asmSecretStatusMap", "[", "strStatus", "]", "\n", "if", "!", "ok", "{", "*", "<mask>", "=", "ASMSecretStatusNone", "\n", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "*", "as", "=", "stat", "\n", "return", "nil", "\n", "}" ]
14,855
all-14856
[ "Expect", "returns", "the", "first", "line", "containing", "the", "given", "string", "." ]
[ "func", "(", "ep", "*", "ExpectProcess", ")", "Expect", "(", "s", "string", ")", "(", "string", ",", "error", ")", "{", "return", "ep", ".", "ExpectFunc", "(", "func", "(", "txt", "string", ")", "bool", "{", "<mask>", "strings", ".", "Contains", "(", "txt", ",", "s", ")", "}", ")", "\n", "}" ]
14,856
all-14857
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "Uniform3f", "(", "<mask>", "int32", ",", "v0", "float32", ",", "v1", "float32", ",", "v2", "float32", ")", "{", "syscall", ".", "Syscall6", "(", "gpUniform3f", ",", "4", ",", "uintptr", "(", "location", ")", ",", "uintptr", "(", "math", ".", "Float32bits", "(", "v0", ")", ")", ",", "uintptr", "(", "math", ".", "Float32bits", "(", "v1", ")", ")", ",", "uintptr", "(", "math", ".", "Float32bits", "(", "v2", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
14,857
all-14858
[ "Return", "a", "TLS", "configuration", "suitable", "for", "establishing", "inter", "-", "node", "network", "connections", "using", "the", "cluster", "certificate", "." ]
[ "func", "tlsClientConfig", "(", "info", "*", "shared", ".", "CertInfo", ")", "(", "*", "tls", ".", "Config", ",", "error", ")", "{", "keypair", ":=", "info", ".", "KeyPair", "(", ")", "\n", "ca", ":=", "info", ".", "CA", "(", ")", "\n", "config", ":=", "shared", ".", "InitTLSConfig", "(", ")", "\n", "config", ".", "Certificates", "=", "[", "]", "tls", ".", "Certificate", "{", "keypair", "}", "\n", "config", ".", "RootCAs", "=", "x509", ".", "NewCertPool", "(", ")", "\n", "if", "ca", "!=", "nil", "{", "config", ".", "RootCAs", ".", "AddCert", "(", "<mask>", ")", "\n", "}", "\n", "// Since the same cluster keypair is used both as server and as client", "// cert, let's add it to the CA pool to make it trusted.", "cert", ",", "err", ":=", "x509", ".", "ParseCertificate", "(", "keypair", ".", "Certificate", "[", "0", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "cert", ".", "IsCA", "=", "true", "\n", "cert", ".", "KeyUsage", "=", "x509", ".", "KeyUsageCertSign", "\n", "config", ".", "RootCAs", ".", "AddCert", "(", "cert", ")", "\n\n", "if", "cert", ".", "DNSNames", "!=", "nil", "{", "config", ".", "ServerName", "=", "cert", ".", "DNSNames", "[", "0", "]", "\n", "}", "\n", "return", "config", ",", "nil", "\n", "}" ]
14,858
all-14859
[ "TextContent", "indicates", "whether", "the", "content", "is", "text", "based", "on", "its", "content", "type", ".", "This", "value", "determines", "what", "content", "transfer", "encoding", "scheme", "to", "use", "." ]
[ "func", "(", "p", "*", "<mask>", ")", "TextContent", "(", ")", "bool", "{", "if", "p", ".", "ContentType", "==", "\"", "\"", "{", "// RFC 2045: no CT is equivalent to \"text/plain; charset=us-ascii\"", "return", "true", "\n", "}", "\n", "return", "strings", ".", "HasPrefix", "(", "p", ".", "ContentType", ",", "\"", "\"", ")", "||", "strings", ".", "HasPrefix", "(", "p", ".", "ContentType", ",", "ctMultipartPrefix", ")", "\n", "}" ]
14,859
all-14860
[ "Set", "is", "required", "for", "kingpin", "interfaces", "to", "allow", "command", "line", "params", "to", "be", "set", "to", "our", "map", "datatype" ]
[ "func", "(", "o", "*", "ListUintptrOption", ")", "Set", "(", "value", "string", ")", "error", "{", "val", ":=", "UintptrOption", "{", "}", "\n", "val", ".", "<mask>", "(", "value", ")", "\n", "*", "o", "=", "append", "(", "*", "o", ",", "val", ")", "\n", "return", "nil", "\n", "}" ]
14,860
all-14861
[ "IsHostname", "returns", "true", "when", "the", "string", "is", "a", "valid", "hostname" ]
[ "func", "IsHostname", "(", "str", "string", ")", "bool", "{", "if", "!", "rxHostname", ".", "MatchString", "(", "str", ")", "{", "return", "false", "\n", "}", "\n\n", "// the sum of all label octets and label lengths is limited to 255.", "if", "len", "(", "str", ")", ">", "255", "{", "return", "false", "\n", "}", "\n\n", "// Each node has a label, which is zero to 63 octets in length", "parts", ":=", "strings", ".", "Split", "(", "str", ",", "\"", "\"", ")", "\n", "valid", ":=", "true", "\n", "for", "_", ",", "p", ":=", "range", "parts", "{", "if", "len", "(", "p", ")", ">", "63", "{", "<mask>", "=", "false", "\n", "}", "\n", "}", "\n", "return", "valid", "\n", "}" ]
14,861
all-14862
[ "Encode", "serializes", "our", "complete", "state", "to", "a", "slice", "of", "byte", "-", "slices", ".", "In", "this", "simple", "example", "we", "use", "a", "single", "gob", "-", "encoded", "buffer", ":", "see", "https", ":", "//", "golang", ".", "org", "/", "pkg", "/", "encoding", "/", "gob", "/" ]
[ "func", "(", "st", "*", "state", ")", "Encode", "(", ")", "[", "]", "[", "]", "<mask>", "{", "st", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "st", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "var", "buf", "bytes", ".", "Buffer", "\n", "if", "err", ":=", "gob", ".", "NewEncoder", "(", "&", "buf", ")", ".", "Encode", "(", "st", ".", "set", ")", ";", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "[", "]", "[", "]", "byte", "{", "buf", ".", "Bytes", "(", ")", "}", "\n", "}" ]
14,862
all-14863
[ "Dial", "establishes", "a", "new", "session", "to", "the", "cluster", "identified", "by", "the", "given", "seed", "server", "(", "s", ")", ".", "The", "session", "will", "enable", "communication", "with", "all", "of", "the", "servers", "in", "the", "cluster", "so", "the", "seed", "servers", "are", "used", "only", "to", "find", "out", "about", "the", "cluster", "topology", ".", "Dial", "will", "timeout", "after", "10", "seconds", "if", "a", "server", "isn", "t", "reached", ".", "The", "returned", "session", "will", "timeout", "operations", "after", "one", "minute", "by", "default", "if", "servers", "aren", "t", "available", ".", "To", "customize", "the", "timeout", "see", "DialWithTimeout", "SetSyncTimeout", "and", "SetSocketTimeout", ".", "This", "method", "is", "generally", "called", "just", "once", "for", "a", "given", "cluster", ".", "Further", "sessions", "to", "the", "same", "cluster", "are", "then", "established", "using", "the", "New", "or", "Copy", "methods", "on", "the", "obtained", "session", ".", "This", "will", "make", "them", "share", "the", "underlying", "cluster", "and", "manage", "the", "pool", "of", "connections", "appropriately", ".", "Once", "the", "session", "is", "not", "useful", "anymore", "Close", "must", "be", "called", "to", "release", "the", "resources", "appropriately", ".", "The", "seed", "servers", "must", "be", "provided", "in", "the", "following", "format", ":", "[", "mongodb", ":", "//", "]", "[", "user", ":", "pass" ]
[ "func", "Dial", "(", "url", "string", ")", "(", "*", "<mask>", ",", "error", ")", "{", "session", ",", "err", ":=", "DialWithTimeout", "(", "url", ",", "10", "*", "time", ".", "Second", ")", "\n", "if", "err", "==", "nil", "{", "session", ".", "SetSyncTimeout", "(", "1", "*", "time", ".", "Minute", ")", "\n", "session", ".", "SetSocketTimeout", "(", "1", "*", "time", ".", "Minute", ")", "\n", "}", "\n", "return", "session", ",", "err", "\n", "}" ]
14,863
all-14864
[ "writeKey", "writes", "k", "to", "the", "specified", "path", "in", "PEM", "format", ".", "If", "file", "does", "not", "exists", "it", "will", "be", "created", "with", "0600", "mod", "." ]
[ "func", "writeKey", "(", "path", "string", ",", "k", "*", "ecdsa", ".", "PrivateKey", ")", "error", "{", "f", ",", "err", ":=", "<mask>", ".", "OpenFile", "(", "path", ",", "os", ".", "O_WRONLY", "|", "os", ".", "O_CREATE", "|", "os", ".", "O_TRUNC", ",", "0600", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "bytes", ",", "err", ":=", "x509", ".", "MarshalECPrivateKey", "(", "k", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "b", ":=", "&", "pem", ".", "Block", "{", "Type", ":", "ecPrivateKey", ",", "Bytes", ":", "bytes", "}", "\n", "if", "err", ":=", "pem", ".", "Encode", "(", "f", ",", "b", ")", ";", "err", "!=", "nil", "{", "f", ".", "Close", "(", ")", "\n", "return", "err", "\n", "}", "\n", "return", "f", ".", "Close", "(", ")", "\n", "}" ]
14,864
all-14865
[ "Merge", "two", "descriptors", "together", "make", "sure", "there", "are", "no", "duplicate", "resource", "names", "and", "that", "common", "types", "are", "compatible", "." ]
[ "func", "(", "d", "*", "APIDescriptor", ")", "Merge", "(", "other", "*", "APIDescriptor", ")", "error", "{", "if", "d", ".", "Version", "!=", "other", ".", "Version", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "for", "_", ",", "name", ":=", "range", "d", ".", "ResourceNames", "{", "for", "_", ",", "otherName", ":=", "range", "other", ".", "ResourceNames", "{", "if", "name", "==", "otherName", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "for", "_", ",", "name", ":=", "range", "d", ".", "TypeNames", "{", "for", "i", ",", "otherName", ":=", "range", "other", ".", "TypeNames", "{", "if", "name", "==", "otherName", "{", "newName", ":=", "MakeUniq", "(", "otherName", ",", "append", "(", "d", ".", "TypeNames", ",", "other", ".", "TypeNames", "...", ")", ")", "\n", "first", ":=", "other", ".", "TypeNames", "[", ":", "i", "]", "\n", "last", ":=", "append", "(", "[", "]", "string", "{", "newName", "}", ",", "other", ".", "TypeNames", "[", "i", "+", "1", ":", "]", "...", ")", "\n", "other", ".", "TypeNames", "=", "append", "(", "first", ",", "last", "...", ")", "\n", "typ", ":=", "other", ".", "Types", "[", "name", "]", "\n", "delete", "(", "other", ".", "Types", ",", "name", ")", "\n", "typ", ".", "TypeName", "=", "newName", "\n", "other", ".", "Types", "[", "newName", "]", "=", "typ", "\n", "}", "\n", "}", "\n", "}", "\n", "for", "name", ",", "<mask>", ":=", "range", "other", ".", "Resources", "{", "d", ".", "Resources", "[", "name", "]", "=", "resource", "\n", "}", "\n", "for", "name", ",", "typ", ":=", "range", "other", ".", "Types", "{", "d", ".", "Types", "[", "name", "]", "=", "typ", "\n", "}", "\n", "d", ".", "ResourceNames", "=", "append", "(", "d", ".", "ResourceNames", ",", "other", ".", "ResourceNames", "...", ")", "\n", "d", ".", "TypeNames", "=", "append", "(", "d", ".", "TypeNames", ",", "other", ".", "TypeNames", "...", ")", "\n", "return", "nil", "\n", "}" ]
14,865
all-14866
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetHighlightObjectForTestParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay16", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
14,866
all-14867
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetShowHitTestBordersParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoOverlay3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
14,867
all-14868
[ "Finish", "waits", "until", "all", "workers", "have", "finished", "working", ".", "It", "would", "return", "any", "error", "passed", "by", "Done", "." ]
[ "func", "(", "t", "*", "Throttle", ")", "Finish", "(", ")", "error", "{", "t", ".", "wg", ".", "Wait", "(", ")", "\n", "<mask>", "(", "t", ".", "ch", ")", "\n", "close", "(", "t", ".", "errCh", ")", "\n", "for", "err", ":=", "range", "t", ".", "errCh", "{", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
14,868
all-14869
[ "ParseProtocolHeader", "returns", "the", "number", "of", "bytes", "to", "read", "for", "the", "content", "length", "and", "the", "protocol", "version", ".", "The", "upper", "2", "bits", "represent", "the", "number", "of", "bytes", "in", "the", "content", "length", "(", "0", "-", "3", "bits", "=", "2", "**", "n", ")", ".", "The", "lower", "6", "bits", "are", "the", "protocol", "version", "which", "determines", "how", "the", "bytes", "are", "interpreted", "." ]
[ "func", "ParseProtocolHeader", "(", "header", "uint8", ")", "(", "lenBytes", "uint8", ",", "version", "uint8", ")", "{", "<mask>", "=", "header", "&", "ProtocolVersionMask", "\n", "lenBytes", "=", "1", "<<", "(", "(", "header", "&", "ProtocolSizeEnumMask", ")", ">>", "6", ")", "\n", "return", "\n", "}" ]
14,869
all-14870
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "UniformMatrix2x4fv", "(", "location", "int32", ",", "<mask>", "int32", ",", "transpose", "bool", ",", "value", "*", "float32", ")", "{", "syscall", ".", "Syscall6", "(", "gpUniformMatrix2x4fv", ",", "4", ",", "uintptr", "(", "location", ")", ",", "uintptr", "(", "count", ")", ",", "boolToUintptr", "(", "transpose", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
14,870
all-14871
[ "AddAttachment", "adds", "the", "attachment", "to", "the", "list", "of", "attachments", "the", "Message", "has", "." ]
[ "func", "(", "m", "*", "<mask>", ")", "AddAttachment", "(", "name", ",", "contentType", "string", ",", "r", "io", ".", "Reader", ")", "error", "{", "m", ".", "Attachments", "=", "append", "(", "m", ".", "Attachments", ",", "Attachment", "{", "Name", ":", "name", ",", "ContentType", ":", "contentType", ",", "Reader", ":", "r", ",", "Embedded", ":", "false", ",", "}", ")", "\n\n", "return", "nil", "\n", "}" ]
14,871
all-14872
[ "LookupInGroup", "looks", "up", "a", "group", "by", "the", "given", "values", ".", "The", "count", "determines", "the", "number", "of", "fields", "to", "return", ":", "n", ">", "0", ":", "at", "most", "n", "fields", "n", "==", "0", ":", "the", "result", "is", "nil", "(", "zero", "fields", ")", "n", "<", "0", ":", "all", "fields" ]
[ "func", "LookupInGroup", "(", "field", "groupField", ",", "<mask>", "interface", "{", "}", ",", "n", "int", ")", "(", "[", "]", "*", "Group", ",", "error", ")", "{", "iEntries", ",", "err", ":=", "lookUp", "(", "&", "Group", "{", "}", ",", "field", ",", "value", ",", "n", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// == Convert to type group", "valueSlice", ":=", "reflect", ".", "ValueOf", "(", "iEntries", ")", "\n", "entries", ":=", "make", "(", "[", "]", "*", "Group", ",", "valueSlice", ".", "Len", "(", ")", ")", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "valueSlice", ".", "Len", "(", ")", ";", "i", "++", "{", "entries", "[", "i", "]", "=", "valueSlice", ".", "Index", "(", "i", ")", ".", "Interface", "(", ")", ".", "(", "*", "Group", ")", "\n", "}", "\n\n", "return", "entries", ",", "err", "\n", "}" ]
14,872
all-14873
[ "Using", "the", "EZ", "API", "posts", "a", "value", "to", "a", "stat", "at", "a", "specific", "time", "using", "DefaultReporter", "." ]
[ "func", "PostEZValueTime", "(", "statName", ",", "ezkey", "string", ",", "value", "float64", ",", "timestamp", "int64", ")", "error", "{", "return", "DefaultReporter", ".", "PostEZValueTime", "(", "statName", ",", "ezkey", ",", "<mask>", ",", "timestamp", ")", "\n", "}" ]
14,873
all-14874
[ "getSignaturesFromAPIExtension", "implements", "GetSignatures", "()", "using", "the", "X", "-", "Registry", "-", "Supports", "-", "Signatures", "API", "extension", "." ]
[ "func", "(", "s", "*", "dockerImageSource", ")", "getSignaturesFromAPIExtension", "(", "ctx", "context", ".", "Context", ",", "instanceDigest", "*", "digest", ".", "Digest", ")", "(", "[", "]", "[", "]", "<mask>", ",", "error", ")", "{", "manifestDigest", ",", "err", ":=", "s", ".", "manifestDigest", "(", "ctx", ",", "instanceDigest", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "parsedBody", ",", "err", ":=", "s", ".", "c", ".", "getExtensionsSignatures", "(", "ctx", ",", "s", ".", "ref", ",", "manifestDigest", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "sigs", "[", "]", "[", "]", "byte", "\n", "for", "_", ",", "sig", ":=", "range", "parsedBody", ".", "Signatures", "{", "if", "sig", ".", "Version", "==", "extensionSignatureSchemaVersion", "&&", "sig", ".", "Type", "==", "extensionSignatureTypeAtomic", "{", "sigs", "=", "append", "(", "sigs", ",", "sig", ".", "Content", ")", "\n", "}", "\n", "}", "\n", "return", "sigs", ",", "nil", "\n", "}" ]
14,874
all-14875
[ "RequestLoggerFunc", "is", "the", "default", "implementation", "of", "the", "RequestLogger", ".", "By", "default", "it", "will", "log", "a", "uniq", "request_id", "the", "HTTP", "Method", "of", "the", "request", "the", "path", "that", "was", "requested", "the", "duration", "(", "time", ")", "it", "took", "to", "process", "the", "request", "the", "size", "of", "the", "response", "(", "and", "the", "human", "size", ")", "and", "the", "status", "code", "of", "the", "response", "." ]
[ "func", "RequestLoggerFunc", "(", "h", "Handler", ")", "Handler", "{", "return", "func", "(", "c", "Context", ")", "error", "{", "var", "irid", "interface", "{", "}", "\n", "if", "irid", "=", "c", ".", "Session", "(", ")", ".", "Get", "(", "\"", "\"", ")", ";", "irid", "==", "nil", "{", "irid", "=", "randx", ".", "String", "(", "10", ")", "\n", "c", ".", "Session", "(", ")", ".", "Set", "(", "\"", "\"", ",", "irid", ")", "\n", "c", ".", "Session", "(", ")", ".", "Save", "(", ")", "\n", "}", "\n", "rid", ":=", "irid", ".", "(", "string", ")", "+", "\"", "\"", "+", "randx", ".", "String", "(", "10", ")", "\n", "c", ".", "Set", "(", "\"", "\"", ",", "<mask>", ")", "\n", "c", ".", "LogField", "(", "\"", "\"", ",", "rid", ")", "\n\n", "start", ":=", "time", ".", "Now", "(", ")", "\n", "defer", "func", "(", ")", "{", "ws", ",", "ok", ":=", "c", ".", "Response", "(", ")", ".", "(", "*", "Response", ")", "\n", "if", "!", "ok", "{", "ws", "=", "&", "Response", "{", "ResponseWriter", ":", "c", ".", "Response", "(", ")", "}", "\n", "ws", ".", "Status", "=", "200", "\n", "}", "\n", "req", ":=", "c", ".", "Request", "(", ")", "\n", "ct", ":=", "httpx", ".", "ContentType", "(", "req", ")", "\n", "if", "ct", "!=", "\"", "\"", "{", "c", ".", "LogField", "(", "\"", "\"", ",", "ct", ")", "\n", "}", "\n", "c", ".", "LogFields", "(", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "req", ".", "Method", ",", "\"", "\"", ":", "req", ".", "URL", ".", "String", "(", ")", ",", "\"", "\"", ":", "time", ".", "Since", "(", "start", ")", ",", "\"", "\"", ":", "ws", ".", "Size", ",", "\"", "\"", ":", "humanize", ".", "Bytes", "(", "uint64", "(", "ws", ".", "Size", ")", ")", ",", "\"", "\"", ":", "ws", ".", "Status", ",", "}", ")", "\n", "c", ".", "Logger", "(", ")", ".", "Info", "(", "req", ".", "URL", ".", "String", "(", ")", ")", "\n", "}", "(", ")", "\n", "return", "h", "(", "c", ")", "\n", "}", "\n", "}" ]
14,875
all-14876
[ "GetIssues", "gets", "all", "the", "issues", "in", "a", "repo", "that", "meet", "the", "list", "options", "." ]
[ "func", "(", "c", "*", "Client", ")", "GetIssues", "(", "org", ",", "repo", "string", ",", "opts", "*", "github", ".", "IssueListByRepoOptions", ")", "(", "[", "]", "*", "github", ".", "Issue", ",", "error", ")", "{", "issues", ",", "err", ":=", "c", ".", "depaginate", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ")", ",", "&", "opts", ".", "ListOptions", ",", "func", "(", ")", "(", "[", "]", "interface", "{", "}", ",", "*", "github", ".", "Response", ",", "error", ")", "{", "page", ",", "resp", ",", "err", ":=", "c", ".", "issueService", ".", "ListByRepo", "(", "context", ".", "Background", "(", ")", ",", "org", ",", "repo", ",", "opts", ")", "\n\n", "var", "interfaceList", "[", "]", "interface", "{", "}", "\n", "if", "err", "==", "nil", "{", "interfaceList", "=", "make", "(", "[", "]", "interface", "{", "}", ",", "0", ",", "len", "(", "<mask>", ")", ")", "\n", "for", "_", ",", "issue", ":=", "range", "page", "{", "interfaceList", "=", "append", "(", "interfaceList", ",", "issue", ")", "\n", "}", "\n", "}", "\n", "return", "interfaceList", ",", "resp", ",", "err", "\n", "}", ",", ")", "\n\n", "result", ":=", "make", "(", "[", "]", "*", "github", ".", "Issue", ",", "0", ",", "len", "(", "issues", ")", ")", "\n", "for", "_", ",", "issue", ":=", "range", "issues", "{", "result", "=", "append", "(", "result", ",", "issue", ".", "(", "*", "github", ".", "Issue", ")", ")", "\n", "}", "\n", "return", "result", ",", "err", "\n", "}" ]
14,876
all-14877
[ "Teardown", "stops", "the", "Pact", "Mock", "Server", ".", "This", "usually", "is", "called", "on", "completion", "of", "each", "test", "suite", "." ]
[ "func", "(", "p", "*", "Pact", ")", "Teardown", "(", ")", "*", "Pact", "{", "log", ".", "Println", "(", "\"", "\"", ")", "\n", "if", "p", ".", "Server", "!=", "nil", "{", "server", ",", "err", ":=", "p", ".", "pactClient", ".", "StopServer", "(", "p", ".", "Server", ")", "\n\n", "if", "err", "!=", "nil", "{", "<mask>", ".", "Println", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "p", ".", "Server", "=", "server", "\n", "}", "\n", "return", "p", "\n", "}" ]
14,877
all-14878
[ "HasColorPreference", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "HasColorPreference", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "ColorPreference", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
14,878
all-14879
[ "labelIndex", "returns", "the", "index", "for", "the", "label", "if", "it", "exists", "in", "the", "slice", ".", "if", "it", "does", "not", "exist", "in", "the", "slice", "it", "appends", "the", "label", "lb", "to", "the", "end", "of", "the", "slice", "and", "returns", "the", "index", "." ]
[ "func", "labelIndex", "(", "labels", "*", "bpfLabels", ",", "lb", "string", ")", "uint32", "{", "var", "id", "uint32", "\n", "for", "id", "=", "0", ";", "<mask>", "<", "uint32", "(", "len", "(", "*", "labels", ")", ")", ";", "id", "++", "{", "if", "strings", ".", "EqualFold", "(", "lb", ",", "(", "*", "labels", ")", "[", "id", "]", ".", "label", ")", "{", "return", "id", "\n", "}", "\n", "}", "\n", "*", "labels", "=", "append", "(", "*", "labels", ",", "bpfLabel", "{", "lb", ",", "0xffffffff", "}", ")", "\n", "return", "id", "\n", "}" ]
14,879
all-14880
[ "Read", "wraps", "csv", ".", "Reader", ".", "Read", "creating", "a", "map", "of", "column", "name", "to", "field", "value", ".", "If", "the", "line", "has", "fewer", "columns", "than", "Reader", ".", "Columns", "the", "map", "will", "not", "contain", "keys", "for", "these", "columns", ";", "thus", "we", "can", "distinguish", "between", "missing", "columns", "and", "columns", "with", "empty", "values", ".", "If", "the", "line", "has", "more", "columns", "than", "Reader", ".", "Columns", "Reader", ".", "Read", "()", "ignores", "them", "." ]
[ "func", "(", "r", "*", "Reader", ")", "Read", "(", ")", "(", "record", "map", "[", "string", "]", "string", ",", "err", "error", ")", "{", "<mask>", "rawRecord", "[", "]", "string", "\n", "rawRecord", ",", "err", "=", "r", ".", "Reader", ".", "Read", "(", ")", "\n", "length", ":=", "min", "(", "len", "(", "rawRecord", ")", ",", "len", "(", "r", ".", "Columns", ")", ")", "\n", "record", "=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "index", ":=", "0", ";", "index", "<", "length", ";", "index", "++", "{", "column", ":=", "r", ".", "Columns", "[", "index", "]", "\n", "if", "_", ",", "exists", ":=", "record", "[", "column", "]", ";", "exists", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "column", ")", "\n", "}", "\n", "record", "[", "column", "]", "=", "rawRecord", "[", "index", "]", "\n", "}", "\n", "return", "\n", "}" ]
14,880
all-14881
[ "Decode", "writes", "the", "uncompressed", "values", "from", "src", "to", "dst", ".", "It", "returns", "the", "number", "of", "values", "written", "or", "an", "error", "." ]
[ "func", "DecodeAll", "(", "dst", ",", "src", "[", "]", "uint64", ")", "(", "value", "int", ",", "err", "error", ")", "{", "j", ":=", "0", "\n", "for", "_", ",", "v", ":=", "<mask>", "src", "{", "sel", ":=", "v", ">>", "60", "\n", "if", "sel", ">=", "16", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "sel", ")", "\n", "}", "\n", "selector", "[", "sel", "]", ".", "unpack", "(", "v", ",", "(", "*", "[", "240", "]", "uint64", ")", "(", "unsafe", ".", "Pointer", "(", "&", "dst", "[", "j", "]", ")", ")", ")", "\n", "j", "+=", "selector", "[", "sel", "]", ".", "n", "\n", "}", "\n", "return", "j", ",", "nil", "\n", "}" ]
14,881
all-14882
[ "createSCSIController", "creates", "a", "new", "SCSI", "controller", "of", "the", "specified", "type", "and", "sharing", "mode", "." ]
[ "func", "createSCSIController", "(", "l", "*", "object", ".", "VirtualDeviceList", ",", "ct", "string", ",", "st", "string", ")", "(", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", ",", "error", ")", "{", "nc", ",", "err", ":=", "l", ".", "CreateSCSIController", "(", "ct", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "nc", ".", "(", "<mask>", ".", "BaseVirtualSCSIController", ")", ".", "GetVirtualSCSIController", "(", ")", ".", "SharedBus", "=", "types", ".", "VirtualSCSISharing", "(", "st", ")", "\n", "cspec", ",", "err", ":=", "object", ".", "VirtualDeviceList", "{", "nc", "}", ".", "ConfigSpec", "(", "types", ".", "VirtualDeviceConfigSpecOperationAdd", ")", "\n", "*", "l", "=", "applyDeviceChange", "(", "*", "l", ",", "cspec", ")", "\n", "return", "cspec", ",", "err", "\n", "}" ]
14,882
all-14883
[ "Perform", "a", "request", "to", "the", "/", "internal", "/", "cluster", "/", "accept", "endpoint", "to", "check", "if", "a", "new", "mode", "can", "be", "accepted", "into", "the", "cluster", "and", "obtain", "joining", "information", "such", "as", "the", "cluster", "private", "certificate", "." ]
[ "func", "clusterAcceptMember", "(", "<mask>", "lxd", ".", "ContainerServer", ",", "name", ",", "address", "string", ",", "schema", ",", "apiExt", "int", ",", "pools", "[", "]", "api", ".", "StoragePool", ",", "networks", "[", "]", "api", ".", "Network", ")", "(", "*", "internalClusterPostAcceptResponse", ",", "error", ")", "{", "req", ":=", "internalClusterPostAcceptRequest", "{", "Name", ":", "name", ",", "Address", ":", "address", ",", "Schema", ":", "schema", ",", "API", ":", "apiExt", ",", "StoragePools", ":", "pools", ",", "Networks", ":", "networks", ",", "}", "\n", "info", ":=", "&", "internalClusterPostAcceptResponse", "{", "}", "\n", "resp", ",", "_", ",", "err", ":=", "client", ".", "RawQuery", "(", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "err", "=", "resp", ".", "MetadataAsStruct", "(", "&", "info", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "info", ",", "nil", "\n", "}" ]
14,883
all-14884
[ "TypePrecisionScale", "returns", "the", "type", "precision", "and", "scale", "(", "decimal", "types", ")", "of", "the", "field", ".", "see", "https", ":", "//", "golang", ".", "org", "/", "pkg", "/", "database", "/", "sql", "/", "driver", "/", "#RowsColumnTypePrecisionScale" ]
[ "func", "(", "f", "*", "ParameterField", ")", "TypePrecisionScale", "(", ")", "(", "int64", ",", "int64", ",", "bool", ")", "{", "if", "f", ".", "tc", ".", "isDecimalType", "(", ")", "{", "return", "int64", "(", "f", ".", "<mask>", ")", ",", "int64", "(", "f", ".", "fraction", ")", ",", "true", "\n", "}", "\n", "return", "0", ",", "0", ",", "false", "\n", "}" ]
14,884
all-14885
[ "native", "()", "returns", "a", "pointer", "to", "the", "underlying", "GObject", "as", "a", "GtkPrintOperationPreview", "." ]
[ "func", "(", "v", "*", "PrintOperationPreview", ")", "native", "(", ")", "*", "C", ".", "GtkPrintOperationPreview", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "<mask>", "C", ".", "toGtkPrintOperationPreview", "(", "p", ")", "\n", "}" ]
14,885
all-14886
[ "title", ":", "remove", "user", "path", ":", "/", "users", "method", ":", "DELETE", "responses", ":", "200", ":", "User", "removed", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "removeUser", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "email", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "email", "==", "\"", "\"", "{", "email", "=", "t", ".", "GetUserName", "(", ")", "\n", "}", "\n", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermUserDelete", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxUser", ",", "email", ")", ",", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "userTarget", "(", "email", ")", ",", "Kind", ":", "permission", ".", "PermUserDelete", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermUserReadEvents", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxUser", ",", "email", ")", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "u", ",", "err", ":=", "auth", ".", "GetUserByEmail", "(", "email", ")", "\n", "if", "err", "!=", "nil", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "appNames", ",", "err", ":=", "deployableApps", "(", "u", ",", "make", "(", "map", "[", "string", "]", "*", "permission", ".", "Role", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "manager", ":=", "repository", ".", "Manager", "(", ")", "\n", "for", "_", ",", "name", ":=", "range", "appNames", "{", "manager", ".", "RevokeAccess", "(", "name", ",", "u", ".", "Email", ")", "\n", "}", "\n", "if", "err", ":=", "manager", ".", "RemoveUser", "(", "u", ".", "Email", ")", ";", "err", "!=", "nil", "{", "<mask>", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "app", ".", "AuthScheme", ".", "Remove", "(", "u", ")", "\n", "}" ]
14,886
all-14887
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetBestEffortCoverageReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler19", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
14,887
all-14888
[ "SetKnownStatus", "safely", "sets", "the", "currently", "known", "status", "of", "the", "resource" ]
[ "func", "(", "vol", "*", "VolumeResource", ")", "SetKnownStatus", "(", "status", "resourcestatus", ".", "ResourceStatus", ")", "{", "vol", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "vol", ".", "<mask>", ".", "Unlock", "(", ")", "\n\n", "vol", ".", "knownStatusUnsafe", "=", "status", "\n", "}" ]
14,888
all-14889
[ "ActivateControl", "makes", "control", "active", "and", "disables", "all", "other", "children", "of", "the", "parent", ".", "Returns", "true", "if", "control", "was", "found", "and", "activated" ]
[ "func", "ActivateControl", "(", "parent", ",", "control", "Control", ")", "bool", "{", "DeactivateControls", "(", "parent", ")", "\n", "res", ":=", "false", "\n", "ctrl", ":=", "FindChild", "(", "parent", ",", "<mask>", ")", "\n", "if", "ctrl", "!=", "nil", "{", "res", "=", "true", "\n", "if", "!", "ctrl", ".", "Active", "(", ")", "{", "ctrl", ".", "ProcessEvent", "(", "Event", "{", "Type", ":", "EventActivate", ",", "X", ":", "1", "}", ")", "\n", "ctrl", ".", "SetActive", "(", "true", ")", "\n", "}", "\n", "}", "\n\n", "return", "res", "\n", "}" ]
14,889
all-14890
[ "stateHandlerMiddleware", "responds", "to", "the", "various", "states", "that", "are", "given", "during", "provider", "verification", "statehandler", "accepts", "a", "state", "object", "from", "the", "verifier", "and", "executes", "any", "state", "handlers", "associated", "with", "the", "provider", ".", "It", "will", "not", "execute", "further", "middleware", "if", "it", "is", "the", "designted", "state", "request" ]
[ "func", "stateHandlerMiddleware", "(", "stateHandlers", "types", ".", "StateHandlers", ")", "proxy", ".", "Middleware", "{", "return", "func", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "if", "r", ".", "URL", ".", "Path", "==", "\"", "\"", "{", "var", "s", "*", "types", ".", "ProviderState", "\n", "decoder", ":=", "json", ".", "NewDecoder", "(", "r", ".", "<mask>", ")", "\n", "decoder", ".", "Decode", "(", "&", "s", ")", "\n\n", "// Setup any provider state", "for", "_", ",", "state", ":=", "range", "s", ".", "States", "{", "sf", ",", "stateFound", ":=", "stateHandlers", "[", "state", "]", "\n\n", "if", "!", "stateFound", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "state", ")", "\n", "}", "else", "{", "// Execute state handler", "if", "err", ":=", "sf", "(", ")", ";", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "state", ",", "err", ")", "\n", "w", ".", "WriteHeader", "(", "http", ".", "StatusInternalServerError", ")", "\n", "return", "\n", "}", "\n", "}", "\n", "}", "\n\n", "w", ".", "WriteHeader", "(", "http", ".", "StatusOK", ")", "\n", "return", "\n", "}", "\n\n", "log", ".", "Println", "(", "\"", "\"", ",", "r", ".", "RequestURI", ")", "\n\n", "// Pass through to application", "next", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", ")", "\n", "}", "\n", "}" ]
14,890
all-14891
[ "GetTime", "returns", "the", "Time", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TimeseriesDefinition", ")", "GetTime", "(", ")", "WidgetTime", "{", "if", "t", "==", "nil", "||", "t", ".", "Time", "==", "nil", "{", "<mask>", "WidgetTime", "{", "}", "\n", "}", "\n", "return", "*", "t", ".", "Time", "\n", "}" ]
14,891
all-14892
[ "Network", "I", "/", "O", "limits" ]
[ "func", "(", "c", "*", "containerLXC", ")", "setNetworkPriority", "(", ")", "error", "{", "// Check that the container is running", "if", "!", "c", ".", "IsRunning", "(", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Don't bother if the cgroup controller doesn't exist", "if", "!", "c", ".", "state", ".", "OS", ".", "CGroupNetPrioController", "{", "return", "nil", "\n", "}", "\n\n", "// Extract the current priority", "networkPriority", ":=", "c", ".", "expandedConfig", "[", "\"", "\"", "]", "\n", "if", "networkPriority", "==", "\"", "\"", "{", "networkPriority", "=", "\"", "\"", "\n", "}", "\n\n", "networkInt", ",", "err", ":=", "strconv", ".", "Atoi", "(", "networkPriority", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Get all the interfaces", "netifs", ",", "err", ":=", "net", ".", "Interfaces", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Check that we at least succeeded to set an entry", "success", ":=", "false", "\n", "var", "last_error", "error", "\n", "for", "_", ",", "netif", ":=", "range", "netifs", "{", "err", "=", "c", ".", "CGroupSet", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "netif", ".", "<mask>", ",", "networkInt", ")", ")", "\n", "if", "err", "==", "nil", "{", "success", "=", "true", "\n", "}", "else", "{", "last_error", "=", "err", "\n", "}", "\n", "}", "\n\n", "if", "!", "success", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "last_error", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
14,892
all-14893
[ "SetAddr", "sets", "the", "servers", "address", "if", "it", "hasn", "t", "already", "been", "set" ]
[ "func", "(", "s", "*", "TLS", ")", "SetAddr", "(", "addr", "string", ")", "{", "if", "s", ".", "Server", ".", "Addr", "==", "\"", "\"", "{", "s", ".", "<mask>", ".", "Addr", "=", "addr", "\n", "}", "\n", "}" ]
14,893
all-14894
[ "ReadAllLogs", "returns", "all", "log", "messages", "of", "the", "provided", "log", "type", ".", "For", "example", "page", ".", "ReadAllLogs", "(", "browser", ")", "returns", "browser", "console", "logs", "such", "as", "JavaScript", "logs", "and", "errors", ".", "All", "logs", "since", "the", "session", "was", "created", "are", "returned", ".", "Valid", "log", "types", "may", "be", "obtained", "using", "the", "LogTypes", "method", "." ]
[ "func", "(", "p", "*", "Page", ")", "ReadAllLogs", "(", "logType", "string", ")", "(", "[", "]", "Log", ",", "error", ")", "{", "if", "_", ",", "err", ":=", "p", ".", "ReadNewLogs", "(", "logType", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "append", "(", "[", "]", "<mask>", "(", "nil", ")", ",", "p", ".", "logs", "[", "logType", "]", "...", ")", ",", "nil", "\n", "}" ]
14,894
all-14895
[ "URL", "returns", "the", "current", "page", "URL", "." ]
[ "func", "(", "p", "*", "Page", ")", "URL", "(", ")", "(", "string", ",", "error", ")", "{", "url", ",", "err", ":=", "p", ".", "<mask>", ".", "GetURL", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "url", ",", "nil", "\n", "}" ]
14,895
all-14896
[ "GetUseDragWindow", "is", "a", "wrapper", "around", "gtk_tool_item_get_use_drag_window", "()", "." ]
[ "func", "(", "v", "*", "ToolItem", ")", "GetUseDragWindow", "(", ")", "bool", "{", "c", ":=", "C", ".", "gtk_tool_item_get_use_drag_window", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
14,896
all-14897
[ "GetURIs", "is", "a", "wrapper", "around", "gtk_file_chooser_get_uris", "()", "." ]
[ "func", "(", "v", "FileChooser", ")", "GetURIs", "(", ")", "(", "*", "glib", ".", "SList", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_file_chooser_get_uris", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "glib", ".", "WrapSList", "(", "uintptr", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
14,897
all-14898
[ "NewServerMux", "returns", "a", "new", "Handler", "." ]
[ "func", "NewServerMux", "(", ")", "(", "mux", "*", "ServerMux", ")", "{", "nf", ":=", "struct", "{", "View", "view", ".", "View", "\n", "Handler", "HandlerFunc", "\n", "}", "{", "<mask>", ".", "Simple", "(", "view", ".", "ContentTypePlain", ",", "view", ".", "CharSetUTF8", ")", ",", "defaultNotFound", "}", "\n", "return", "&", "ServerMux", "{", "NewRouters", "(", ")", ",", "nil", ",", "nil", ",", "nil", ",", "nf", "}", "\n", "}" ]
14,898
all-14899
[ "Start", "watching", "a", "service", "." ]
[ "func", "(", "d", "*", "Discovery", ")", "watchService", "(", "ctx", "<mask>", ".", "Context", ",", "ch", "chan", "<-", "[", "]", "*", "targetgroup", ".", "Group", ",", "name", "string", ")", "{", "srv", ":=", "&", "consulService", "{", "discovery", ":", "d", ",", "client", ":", "d", ".", "client", ",", "name", ":", "name", ",", "tags", ":", "d", ".", "watchedTags", ",", "labels", ":", "model", ".", "LabelSet", "{", "serviceLabel", ":", "model", ".", "LabelValue", "(", "name", ")", ",", "datacenterLabel", ":", "model", ".", "LabelValue", "(", "d", ".", "clientDatacenter", ")", ",", "}", ",", "tagSeparator", ":", "d", ".", "tagSeparator", ",", "logger", ":", "d", ".", "logger", ",", "}", "\n\n", "go", "func", "(", ")", "{", "ticker", ":=", "time", ".", "NewTicker", "(", "d", ".", "refreshInterval", ")", "\n", "var", "lastIndex", "uint64", "\n", "catalog", ":=", "srv", ".", "client", ".", "Catalog", "(", ")", "\n", "for", "{", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "ticker", ".", "Stop", "(", ")", "\n", "return", "\n", "default", ":", "srv", ".", "watch", "(", "ctx", ",", "ch", ",", "catalog", ",", "&", "lastIndex", ")", "\n", "<-", "ticker", ".", "C", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n", "}" ]
14,899
all-14900
[ "InsertPage", "is", "a", "wrapper", "around", "gtk_assistant_insert_page", "()", "." ]
[ "func", "(", "v", "*", "Assistant", ")", "InsertPage", "(", "page", "IWidget", ",", "position", "int", ")", "int", "{", "c", ":=", "C", ".", "gtk_assistant_insert_page", "(", "v", ".", "native", "(", ")", ",", "page", ".", "toWidget", "(", ")", ",", "C", ".", "gint", "(", "<mask>", ")", ")", "\n", "return", "int", "(", "c", ")", "\n", "}" ]