id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
8,100
all-8101
[ "Add", "adds", "a", "value", "to", "the", "series", "and", "updates", "the", "moving", "average", "." ]
[ "func", "(", "e", "*", "SimpleEWMA", ")", "Add", "(", "<mask>", "float64", ")", "{", "if", "e", ".", "value", "==", "0", "{", "// this is a proxy for \"uninitialized\"", "e", ".", "value", "=", "value", "\n", "}", "else", "{", "e", ".", "value", "=", "(", "value", "*", "DECAY", ")", "+", "(", "e", ".", "value", "*", "(", "1", "-", "DECAY", ")", ")", "\n", "}", "\n", "}" ]
8,101
all-8102
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventDownloadWillBegin", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage67", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
8,102
all-8103
[ "assignsTo", "returns", "true", "if", "any", "of", "the", "code", "in", "scope", "assigns", "to", "or", "takes", "the", "address", "of", "x", "." ]
[ "func", "assignsTo", "(", "x", "*", "ast", ".", "Ident", ",", "scope", "[", "]", "ast", ".", "Stmt", ")", "bool", "{", "assigned", ":=", "false", "\n", "ff", ":=", "func", "(", "n", "interface", "{", "}", ")", "{", "if", "assigned", "{", "return", "\n", "}", "\n", "switch", "n", ":=", "n", ".", "(", "type", ")", "{", "case", "*", "ast", ".", "UnaryExpr", ":", "// use of &x", "if", "n", ".", "Op", "==", "<mask>", ".", "AND", "&&", "refersTo", "(", "n", ".", "X", ",", "x", ")", "{", "assigned", "=", "true", "\n", "return", "\n", "}", "\n", "case", "*", "ast", ".", "AssignStmt", ":", "for", "_", ",", "l", ":=", "range", "n", ".", "Lhs", "{", "if", "refersTo", "(", "l", ",", "x", ")", "{", "assigned", "=", "true", "\n", "return", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "for", "_", ",", "n", ":=", "range", "scope", "{", "if", "assigned", "{", "break", "\n", "}", "\n", "walk", "(", "n", ",", "ff", ")", "\n", "}", "\n", "return", "assigned", "\n", "}" ]
8,103
all-8104
[ "Set", "sets", "the", "environment", "key", "to", "value", "." ]
[ "func", "(", "e", "*", "EnvVar", ")", "Set", "(", "key", ",", "value", "string", ")", "{", "keyVal", ":=", "key", "+", "\"", "\"", "+", "value", "\n", "for", "i", ",", "v", ":=", "range", "*", "e", "{", "env", ":=", "strings", ".", "SplitN", "(", "v", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "env", ")", "<", "2", "{", "<mask>", "\n", "}", "\n", "if", "env", "[", "0", "]", "==", "key", "{", "(", "*", "e", ")", "[", "i", "]", "=", "keyVal", "\n", "return", "\n", "}", "\n", "}", "\n", "*", "e", "=", "append", "(", "*", "e", ",", "keyVal", ")", "\n", "}" ]
8,104
all-8105
[ "/", "*", "NewButton", "creates", "a", "new", "Button", ".", "view", "-", "is", "a", "View", "that", "manages", "the", "control", "parent", "-", "is", "container", "that", "keeps", "the", "control", ".", "The", "same", "View", "can", "be", "a", "view", "and", "a", "parent", "at", "the", "same", "time", ".", "width", "and", "heigth", "-", "are", "minimal", "size", "of", "the", "control", ".", "title", "-", "button", "title", ".", "scale", "-", "the", "way", "of", "scaling", "the", "control", "when", "the", "parent", "is", "resized", ".", "Use", "DoNotScale", "constant", "if", "the", "control", "should", "keep", "its", "original", "size", "." ]
[ "func", "CreateButton", "(", "parent", "Control", ",", "width", ",", "height", "int", ",", "title", "string", ",", "scale", "int", ")", "*", "Button", "{", "b", ":=", "new", "(", "Button", ")", "\n", "b", ".", "BaseControl", "=", "NewBaseControl", "(", ")", "\n\n", "b", ".", "parent", "=", "parent", "\n", "b", ".", "align", "=", "AlignCenter", "\n\n", "if", "height", "==", "AutoSize", "{", "height", "=", "4", "\n", "}", "\n", "if", "width", "==", "AutoSize", "{", "<mask>", "=", "xs", ".", "Len", "(", "title", ")", "+", "2", "+", "1", "\n", "}", "\n\n", "if", "height", "<", "4", "{", "height", "=", "4", "\n", "}", "\n", "if", "width", "<", "6", "{", "width", "=", "6", "\n", "}", "\n\n", "b", ".", "SetTitle", "(", "title", ")", "\n", "b", ".", "SetSize", "(", "width", ",", "height", ")", "\n", "b", ".", "SetConstraints", "(", "width", ",", "height", ")", "\n", "b", ".", "SetScale", "(", "scale", ")", "\n\n", "if", "parent", "!=", "nil", "{", "parent", ".", "AddChild", "(", "b", ")", "\n", "}", "\n\n", "return", "b", "\n", "}" ]
8,105
all-8106
[ "SaveService", "persists", "service", "data", "into", "etcd" ]
[ "func", "(", "c", "etcdClient", ")", "SaveService", "(", "service", "*", "Service", ")", "error", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "c", ".", "ctx", ",", "etcdTimeout", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "value", ",", "err", ":=", "json", ".", "Marshal", "(", "&", "service", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "_", ",", "err", "=", "c", ".", "client", ".", "Put", "(", "ctx", ",", "service", ".", "Key", ",", "string", "(", "<mask>", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,106
all-8107
[ "Div", "returns", "the", "vector", "v", "/", "k", "." ]
[ "func", "(", "v", "Vec", ")", "Div", "(", "k", "float64", ")", "Vec", "{", "<mask>", "Vec", "{", "v", ".", "X", "/", "k", ",", "v", ".", "Y", "/", "k", "}", "\n", "}" ]
8,107
all-8108
[ "Getopt", "reads", "environment", "variables", ".", "If", "not", "found", "will", "return", "a", "supplied", "default", "value" ]
[ "func", "Getopt", "(", "name", ",", "dfault", "string", ")", "string", "{", "value", ":=", "os", ".", "Getenv", "(", "name", ")", "\n", "if", "value", "==", "\"", "\"", "{", "value", "=", "dfault", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
8,108
all-8109
[ "GetFirewallRule", "gets", "a", "firewall", "rule" ]
[ "func", "(", "c", "*", "Client", ")", "GetFirewallRule", "(", "dcID", "string", ",", "serverID", "string", ",", "nicID", "string", ",", "fwID", "string", ")", "(", "*", "FirewallRule", ",", "error", ")", "{", "url", ":=", "fwrulePath", "(", "dcID", ",", "serverID", ",", "nicID", ",", "fwID", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "FirewallRule", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "<mask>", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
8,109
all-8110
[ "String", "returns", "the", "formatted", "representation", "of", "the", "combination", "of", "all", "internal", "InclusiveRange", "instances" ]
[ "func", "(", "l", "*", "InclusiveRanges", ")", "String", "(", ")", "string", "{", "var", "buf", "strings", ".", "Builder", "\n", "for", "i", ",", "b", ":=", "range", "l", ".", "blocks", "{", "if", "i", ">", "0", "{", "buf", ".", "WriteString", "(", "`,`", ")", "\n", "}", "\n", "buf", ".", "WriteString", "(", "b", ".", "String", "(", ")", ")", "\n", "}", "\n", "return", "buf", ".", "<mask>", "(", ")", "\n", "}" ]
8,110
all-8111
[ "GetTaskCredentials", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockManager", ")", "GetTaskCredentials", "(", "arg0", "string", ")", "(", "credentials", ".", "TaskIAMRoleCredentials", ",", "bool", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "credentials", ".", "TaskIAMRoleCredentials", ")", "\n", "ret1", ",", "_", ":=", "<mask>", "[", "1", "]", ".", "(", "bool", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
8,111
all-8112
[ "addTaskScopedVolumes", "adds", "the", "task", "scoped", "volume", "into", "task", "resources", "and", "updates", "container", "dependency" ]
[ "func", "(", "task", "*", "Task", ")", "addTaskScopedVolumes", "(", "ctx", "context", ".", "<mask>", ",", "dockerClient", "dockerapi", ".", "DockerClient", ",", "vol", "*", "TaskVolume", ")", "error", "{", "volumeConfig", ":=", "vol", ".", "Volume", ".", "(", "*", "taskresourcevolume", ".", "DockerVolumeConfig", ")", "\n", "volumeResource", ",", "err", ":=", "taskresourcevolume", ".", "NewVolumeResource", "(", "ctx", ",", "vol", ".", "Name", ",", "task", ".", "volumeName", "(", "vol", ".", "Name", ")", ",", "volumeConfig", ".", "Scope", ",", "volumeConfig", ".", "Autoprovision", ",", "volumeConfig", ".", "Driver", ",", "volumeConfig", ".", "DriverOpts", ",", "volumeConfig", ".", "Labels", ",", "dockerClient", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "vol", ".", "Volume", "=", "&", "volumeResource", ".", "VolumeConfig", "\n", "task", ".", "AddResource", "(", "resourcetype", ".", "DockerVolumeKey", ",", "volumeResource", ")", "\n", "task", ".", "updateContainerVolumeDependency", "(", "vol", ".", "Name", ")", "\n", "return", "nil", "\n", "}" ]
8,112
all-8113
[ "GetShowLegend", "returns", "the", "ShowLegend", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TimeseriesDefinition", ")", "GetShowLegend", "(", ")", "bool", "{", "if", "t", "==", "nil", "||", "t", ".", "ShowLegend", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "t", ".", "ShowLegend", "\n", "}" ]
8,113
all-8114
[ "InsertSectionWithoutLabel", "is", "a", "wrapper", "around", "g_menu_insert_section", "()", "with", "label", "set", "to", "null", "." ]
[ "func", "(", "v", "*", "Menu", ")", "InsertSectionWithoutLabel", "(", "<mask>", "int", ",", "section", "*", "MenuModel", ")", "{", "C", ".", "g_menu_insert_section", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "position", ")", ",", "nil", ",", "section", ".", "native", "(", ")", ")", "\n", "}" ]
8,114
all-8115
[ "Run", "begins", "monitoring", "of", "channels", ".", "In", "case", "of", "error", "-", "doesn", "t", "restarts", "automatically", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "Run", "(", ")", "error", "{", "m", ".", "logger", ".", "Info", "(", "\"", "\"", ")", "\n\n", "for", "{", "if", "err", ":=", "m", ".", "processRound", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "time", ".", "Sleep", "(", "<mask>", ".", "Duration", "(", "m", ".", "interval", ")", "*", "time", ".", "Millisecond", ")", "\n", "}", "\n", "}" ]
8,115
all-8116
[ "History", "returns", "an", "array", "of", "QApair", "of", "upto", "100", "interactions", "that", "have", "happened", "in", "Session", "." ]
[ "func", "(", "s", "*", "<mask>", ")", "History", "(", ")", "QAPairs", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "var", "qa", "[", "]", "QAPair", "\n", "for", "i", ":=", "1", ";", ";", "i", "++", "{", "if", "v", ",", "ok", ":=", "s", ".", "Decoded", "[", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "i", ")", "]", ".", "(", "string", ")", ";", "ok", "&&", "v", "!=", "\"", "\"", "{", "qa", "=", "append", "(", "[", "]", "QAPair", "{", "{", "s", ".", "Decoded", "[", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "i", ")", "]", ".", "(", "string", ")", ",", "s", ".", "Decoded", "[", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "i", ")", "]", ".", "(", "string", ")", "}", "}", ",", "qa", "...", ")", "\n", "}", "else", "{", "return", "qa", "\n", "}", "\n", "}", "\n", "}" ]
8,116
all-8117
[ "/", "*", "RFC", "7208", ":" ]
[ "func", "(", "s", "*", "SPF", ")", "incVoidLookupCount", "(", "amt", "int", ")", "error", "{", "s", ".", "voidLookupCount", "=", "s", ".", "voidLookupCount", "+", "amt", "\n", "if", "s", ".", "voidLookupCount", ">=", "VoidLookupLimit", "{", "return", "&", "PermError", "{", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "s", ".", "<mask>", ",", "VoidLookupLimit", ")", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,117
all-8118
[ "Logs", "returns", "a", "copy", "of", "logs", "accumulated", "in", "the", "span", "so", "far" ]
[ "func", "(", "s", "*", "MockSpan", ")", "Logs", "(", ")", "[", "]", "MockLogRecord", "{", "s", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "RUnlock", "(", ")", "\n", "logs", ":=", "<mask>", "(", "[", "]", "MockLogRecord", ",", "len", "(", "s", ".", "logs", ")", ")", "\n", "copy", "(", "logs", ",", "s", ".", "logs", ")", "\n", "return", "logs", "\n", "}" ]
8,118
all-8119
[ "IsActive", "is", "a", "wrapper", "around", "gtk_window_is_active", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "IsActive", "(", ")", "bool", "{", "c", ":=", "C", ".", "gtk_window_is_active", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
8,119
all-8120
[ "Returns", "an", "map", "[", "string", "]", "float64" ]
[ "func", "(", "t", "Typed", ")", "StringFloat", "(", "key", "string", ")", "map", "[", "string", "]", "float64", "{", "raw", ",", "ok", ":=", "t", ".", "getmap", "(", "key", ")", "\n", "if", "ok", "==", "false", "{", "return", "nil", "\n", "}", "\n", "m", ":=", "make", "(", "map", "[", "string", "]", "float64", ",", "len", "(", "raw", ")", ")", "\n", "for", "k", ",", "value", ":=", "<mask>", "raw", "{", "switch", "t", ":=", "value", ".", "(", "type", ")", "{", "case", "float64", ":", "m", "[", "k", "]", "=", "t", "\n", "case", "string", ":", "f", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "t", ",", "10", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", "\n", "}", "\n", "m", "[", "k", "]", "=", "f", "\n", "default", ":", "return", "nil", "\n", "}", "\n", "}", "\n", "return", "m", "\n", "}" ]
8,120
all-8121
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "NavigateToHistoryEntryParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage25", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
8,121
all-8122
[ "Read", "fills", "specified", "byte", "array", "with", "random", "data", ".", "Always", "return", "parameter", "array", "length", "and", "no", "errors", "." ]
[ "func", "(", "s", "*", "Random", ")", "Read", "(", "b", "[", "]", "<mask>", ")", "(", "n", "int", ",", "err", "error", ")", "{", "s", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "for", "i", ",", "_", ":=", "range", "b", "{", "b", "[", "i", "]", "=", "s", ".", "readByte", "(", ")", "\n", "}", "\n\n", "return", "len", "(", "b", ")", ",", "nil", "\n", "}" ]
8,122
all-8123
[ "Start", "the", "CollectorClient", "and", "the", "harvester", "thread", "that", "sends", "application", "performance", "data", "to", "New", "Relic", "once", "a", "minute", "." ]
[ "func", "doInit", "(", "license", "string", ",", "appName", "string", ",", "language", "string", ",", "languageVersion", "string", ")", "(", "int", ",", "error", ")", "{", "clicense", ":=", "C", ".", "CString", "(", "license", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "clicense", ")", ")", "\n\n", "cappName", ":=", "C", ".", "CString", "(", "appName", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cappName", ")", ")", "\n\n", "clang", ":=", "C", ".", "CString", "(", "\"", "\"", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "clang", ")", ")", "\n\n", "clangVersion", ":=", "C", ".", "CString", "(", "runtime", ".", "Version", "(", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "clangVersion", ")", ")", "\n\n", "errno", ":=", "C", ".", "newrelic_init", "(", "clicense", ",", "cappName", ",", "clang", ",", "clangVersion", ")", "\n", "return", "errNo", "(", "errno", ")", "\n", "}" ]
8,123
all-8124
[ "SetHideTitlebarWhenMaximized", "is", "a", "wrapper", "around", "gtk_window_set_hide_titlebar_when_maximized", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "SetHideTitlebarWhenMaximized", "(", "<mask>", "bool", ")", "{", "C", ".", "gtk_window_set_hide_titlebar_when_maximized", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "setting", ")", ")", "\n", "}" ]
8,124
all-8125
[ "AlignText", "calculates", "the", "initial", "position", "of", "the", "text", "output", "depending", "on", "str", "length", "and", "available", "width", ".", "The", "str", "is", "truncated", "in", "case", "of", "its", "lenght", "greater", "than", "width", ".", "Function", "returns", "shift", "that", "should", "be", "added", "to", "original", "label", "position", "before", "output", "instead", "of", "padding", "the", "string", "with", "spaces", ".", "The", "reason", "is", "to", "make", "possible", "to", "draw", "a", "label", "aligned", "but", "with", "transparent", "beginning", "and", "ending", ".", "If", "you", "do", "not", "need", "transparency", "you", "can", "add", "spaces", "manually", "using", "the", "returned", "shift", "value" ]
[ "func", "AlignText", "(", "str", "string", ",", "width", "int", ",", "align", "Align", ")", "(", "shift", "int", ",", "out", "string", ")", "{", "length", ":=", "xs", ".", "Len", "(", "str", ")", "\n\n", "if", "length", ">=", "width", "{", "return", "0", ",", "CutText", "(", "str", ",", "width", ")", "\n", "}", "\n\n", "if", "align", "==", "AlignRight", "{", "return", "<mask>", "-", "length", ",", "str", "\n", "}", "else", "if", "align", "==", "AlignCenter", "{", "return", "(", "width", "-", "length", ")", "/", "2", ",", "str", "\n", "}", "\n\n", "return", "0", ",", "str", "\n", "}" ]
8,125
all-8126
[ "ContainingNetworks", "returns", "the", "list", "of", "RangerEntry", "(", "s", ")", "the", "given", "ip", "is", "contained", "in", "in", "ascending", "prefix", "order", "." ]
[ "func", "(", "p", "*", "prefixTrie", ")", "ContainingNetworks", "(", "<mask>", "net", ".", "IP", ")", "(", "[", "]", "RangerEntry", ",", "error", ")", "{", "nn", ":=", "rnet", ".", "NewNetworkNumber", "(", "ip", ")", "\n", "if", "nn", "==", "nil", "{", "return", "nil", ",", "ErrInvalidNetworkNumberInput", "\n", "}", "\n", "return", "p", ".", "containingNetworks", "(", "nn", ")", "\n", "}" ]
8,126
all-8127
[ "Do", "executes", "Input", ".", "synthesizeScrollGesture", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SynthesizeScrollGestureParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSynthesizeScrollGesture", ",", "p", ",", "nil", ")", "\n", "}" ]
8,127
all-8128
[ "resourceVSphereVirtualMachineCreateBareWithSDRS", "runs", "the", "creation", "part", "of", "resourceVSphereVirtualMachineCreateBare", "through", "storage", "DRS", ".", "It", "s", "designed", "to", "be", "run", "when", "a", "storage", "cluster", "is", "specified", "versus", "simply", "specifying", "datastores", "." ]
[ "func", "resourceVSphereVirtualMachineCreateBareWithSDRS", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ",", "fo", "*", "object", ".", "Folder", ",", "spec", "types", ".", "VirtualMachineConfigSpec", ",", "pool", "*", "object", ".", "ResourcePool", ",", "hs", "*", "object", ".", "HostSystem", ",", ")", "(", "*", "object", ".", "VirtualMachine", ",", "error", ")", "{", "client", ":=", "meta", ".", "(", "*", "VSphereClient", ")", ".", "vimClient", "\n", "if", "err", ":=", "viapi", ".", "ValidateVirtualCenter", "(", "client", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereVirtualMachineIDString", "(", "d", ")", ")", "\n", "pod", ",", "err", ":=", "storagepod", ".", "FromID", "(", "client", ",", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "vm", ",", "err", ":=", "storagepod", ".", "CreateVM", "(", "client", ",", "fo", ",", "<mask>", ",", "pool", ",", "hs", ",", "pod", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pod", ".", "Name", "(", ")", ",", "err", ")", "\n", "}", "\n\n", "return", "vm", ",", "nil", "\n", "}" ]
8,128
all-8129
[ "SetYAlign", "is", "a", "wrapper", "around", "gtk_label_set_yalign", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetYAlign", "(", "n", "float64", ")", "{", "C", ".", "gtk_label_set_yalign", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gfloat", "(", "n", ")", ")", "\n", "}" ]
8,129
all-8130
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "ScatterplotDefinition", ")", "HasType", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
8,130
all-8131
[ "DeleteCollection", "deletes", "a", "collection", "of", "objects", "." ]
[ "func", "(", "c", "*", "FakeProwJobs", ")", "DeleteCollection", "(", "options", "*", "v1", ".", "DeleteOptions", ",", "listOptions", "v1", ".", "ListOptions", ")", "error", "{", "<mask>", ":=", "testing", ".", "NewDeleteCollectionAction", "(", "prowjobsResource", ",", "c", ".", "ns", ",", "listOptions", ")", "\n\n", "_", ",", "err", ":=", "c", ".", "Fake", ".", "Invokes", "(", "action", ",", "&", "prowjobsv1", ".", "ProwJobList", "{", "}", ")", "\n", "return", "err", "\n", "}" ]
8,131
all-8132
[ "HasEventSize", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "HasEventSize", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "EventSize", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
8,132
all-8133
[ "ReadVariable", "reads", "variables", "from", "the", "virtual", "machine", "state", ".", "This", "includes", "the", "virtual", "machine", "configuration", "environment", "variables", "in", "the", "guest", "and", "VMware", "Guest", "Variables", "Parameters", ":", "varType", ":", "The", "type", "of", "variable", "to", "read", ".", "The", "currently", "supported", "values", "are", ":", "*", "VM_GUEST_VARIABLE", ":", "A", "Guest", "Variable", ".", "This", "is", "a", "runtime", "-", "only", "value", ";", "it", "is", "never", "stored", "persistently", ".", "This", "is", "the", "same", "guest", "variable", "that", "is", "exposed", "through", "the", "VMControl", "APIs", "and", "is", "a", "simple", "way", "to", "pass", "runtime", "values", "in", "and", "out", "of", "the", "guest", ".", "*", "VM_CONFIG_RUNTIME_ONLY", ":", "The", "configuration", "state", "of", "the", "virtual", "machine", ".", "This", "is", "the", ".", "vmx", "file", "that", "is", "stored", "on", "the", "host", ".", "You", "can", "read", "this", "and", "it", "will", "return", "the", "persistent", "data", ".", "If", "you", "write", "to", "this", "it", "will", "only", "be", "a", "runtime", "change", "so", "changes", "will", "be", "lost", "when", "the", "VM", "powers", "off", ".", "*", "GUEST_ENVIRONMENT_VARIABLE", ":", "An", "environment", "variable", "in", "the", "guest", "of", "the", "VM", ".", "On", "a", "Windows", "NT", "series", "guest", "writing", "these", "values", "is", "saved", "persistently", "so", "they", "are", "immediately", "visible", "to", "every", "process", ".", "On", "a", "Linux", "or", "Windows", "9X", "guest", "writing", "these", "values", "is", "not", "persistent", "so", "they", "are", "only", "visible", "to", "the", "VMware", "tools", "process", ".", "name", ":", "The", "name", "of", "the", "variable", ".", "Remarks", ":", "*", "You", "must", "call", "VM", ".", "LoginInGuest", "()", "before", "calling", "this", "function", "to", "read", "a", "GUEST_ENVIRONMENT_VARIABLE", "value", ".", "*", "You", "do", "not", "have", "to", "call", "VM", ".", "LoginInGuest", "()", "to", "use", "this", "function", "to", "read", "a", "VM_GUEST_VARIABLE", "or", "a", "VVM_CONFIG_RUNTIME_ONLY", "value", ".", "Since", "Workstation", "6", ".", "0" ]
[ "func", "(", "v", "*", "VM", ")", "ReadVariable", "(", "varType", "GuestVarType", ",", "name", "string", ")", "(", "string", ",", "error", ")", "{", "var", "jobHandle", "C", ".", "VixHandle", "=", "C", ".", "VIX_INVALID_HANDLE", "\n", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n", "<mask>", "readValue", "*", "C", ".", "char", "\n\n", "vname", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "vname", ")", ")", "\n\n", "jobHandle", "=", "C", ".", "VixVM_ReadVariable", "(", "v", ".", "handle", ",", "C", ".", "int", "(", "varType", ")", ",", "vname", ",", "0", ",", "// options", "nil", ",", "// callbackProc", "nil", ")", "// clientData", "\n\n", "defer", "C", ".", "Vix_ReleaseHandle", "(", "jobHandle", ")", "\n\n", "err", "=", "C", ".", "read_variable", "(", "jobHandle", ",", "&", "readValue", ")", "\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "\"", "\"", ",", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n", "defer", "C", ".", "Vix_FreeBuffer", "(", "unsafe", ".", "Pointer", "(", "readValue", ")", ")", "\n\n", "return", "C", ".", "GoString", "(", "readValue", ")", ",", "nil", "\n", "}" ]
8,133
all-8134
[ "WithPayload", "adds", "the", "payload", "to", "the", "order", "Vm", "by", "filter", "o", "k", "response" ]
[ "func", "(", "o", "*", "OrderVMByFilterOK", ")", "WithPayload", "(", "payload", "*", "<mask>", ".", "VMResponse", ")", "*", "OrderVMByFilterOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
8,134
all-8135
[ "title", ":", "change", "service", "documentation", "path", ":", "/", "services", "/", "{", "name", "}", "/", "doc", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "method", ":", "PUT", "responses", ":", "200", ":", "Documentation", "updated", "401", ":", "Unauthorized", "403", ":", "Forbidden", "(", "team", "is", "not", "the", "owner", "or", "service", "with", "instances", ")" ]
[ "func", "serviceAddDoc", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "<mask>", ")", "(", "err", "error", ")", "{", "serviceName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "s", ",", "err", ":=", "getService", "(", "serviceName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermServiceUpdateDoc", ",", "contextsForServiceProvision", "(", "&", "s", ")", "...", ",", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "s", ".", "Doc", "=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "serviceTarget", "(", "s", ".", "Name", ")", ",", "Kind", ":", "permission", ".", "PermServiceUpdateDoc", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermServiceReadEvents", ",", "contextsForServiceProvision", "(", "&", "s", ")", "...", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "return", "service", ".", "Update", "(", "s", ")", "\n", "}" ]
8,135
all-8136
[ "newClientFromFlags", "creates", "a", "CRD", "rest", "client", "from", "provided", "flags", "." ]
[ "func", "(", "o", "*", "KubernetesClientOptions", ")", "newCRDClient", "(", "t", "Type", ")", "(", "*", "Client", ",", "error", ")", "{", "config", ",", "scheme", ",", "err", ":=", "createRESTConfig", "(", "o", ".", "kubeConfig", ",", "t", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "err", "=", "registerResource", "(", "config", ",", "t", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "// creates the client", "<mask>", "restClient", "*", "rest", ".", "RESTClient", "\n", "restClient", ",", "err", "=", "rest", ".", "RESTClientFor", "(", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "rc", ":=", "Client", "{", "cl", ":", "restClient", ",", "ns", ":", "o", ".", "namespace", ",", "t", ":", "t", ",", "codec", ":", "runtime", ".", "NewParameterCodec", "(", "scheme", ")", "}", "\n", "return", "&", "rc", ",", "nil", "\n", "}" ]
8,136
all-8137
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventDomStorageItemUpdated", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomstorage6", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
8,137
all-8138
[ "===", "increase", "(", "node", "ValueTypeMatrix", ")", "Vector", "===" ]
[ "func", "funcIncrease", "(", "vals", "[", "]", "<mask>", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "return", "extrapolatedRate", "(", "vals", ",", "args", ",", "enh", ",", "true", ",", "false", ")", "\n", "}" ]
8,138
all-8139
[ "Update", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockManager", ")", "Update", "(", "arg0", "context", ".", "Context", ",", "arg1", "string", ",", "arg2", "*", "task", ".", "<mask>", ",", "arg3", "string", ")", "error", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ",", "arg2", ",", "arg3", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "error", ")", "\n", "return", "ret0", "\n", "}" ]
8,139
all-8140
[ "GetRowAtIndex", "is", "a", "wrapper", "around", "gtk_list_box_get_row_at_index", "()", "." ]
[ "func", "(", "v", "*", "ListBox", ")", "GetRowAtIndex", "(", "index", "int", ")", "*", "ListBoxRow", "{", "c", ":=", "C", ".", "gtk_list_box_get_row_at_index", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "<mask>", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "wrapListBoxRow", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", "\n", "}" ]
8,140
all-8141
[ "GetStackedOk", "returns", "a", "tuple", "with", "the", "Stacked", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinitionRequest", ")", "GetStackedOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "g", "==", "nil", "||", "g", ".", "Stacked", "==", "nil", "{", "return", "false", ",", "false", "\n", "}", "\n", "return", "*", "g", ".", "Stacked", ",", "<mask>", "\n", "}" ]
8,141
all-8142
[ "PrependText", "is", "a", "wrapper", "around", "gtk_combo_box_text_prepend_text", "()", "." ]
[ "func", "(", "v", "*", "ComboBoxText", ")", "PrependText", "(", "<mask>", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "text", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_combo_box_text_prepend_text", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
8,142
all-8143
[ "Blocks", "until", "there", "is", "a", "token", "available", ".", "Not", "safe", "for", "concurrent", "use", "by", "multiple", "goroutines", "." ]
[ "func", "(", "tb", "*", "tokenBucket", ")", "wait", "(", ")", "{", "// If earliest unspent token is in the future, sleep until then", "time", ".", "Sleep", "(", "<mask>", ".", "Until", "(", "tb", ".", "earliestUnspentToken", ")", ")", "\n\n", "// Alternatively, enforce bucket capacity if necessary", "capacityToken", ":=", "tb", ".", "capacityToken", "(", ")", "\n", "if", "tb", ".", "earliestUnspentToken", ".", "Before", "(", "capacityToken", ")", "{", "tb", ".", "earliestUnspentToken", "=", "capacityToken", "\n", "}", "\n\n", "// 'Remove' a token from the bucket", "tb", ".", "earliestUnspentToken", "=", "tb", ".", "earliestUnspentToken", ".", "Add", "(", "tb", ".", "tokenInterval", ")", "\n", "}" ]
8,143
all-8144
[ "query", "the", "name", "of", "an", "active", "shader", "subroutine", "uniform" ]
[ "func", "GetActiveSubroutineUniformName", "(", "program", "uint32", ",", "shadertype", "uint32", ",", "index", "uint32", ",", "bufsize", "int32", ",", "<mask>", "*", "int32", ",", "name", "*", "uint8", ")", "{", "C", ".", "glowGetActiveSubroutineUniformName", "(", "gpGetActiveSubroutineUniformName", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLenum", ")", "(", "shadertype", ")", ",", "(", "C", ".", "GLuint", ")", "(", "index", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "bufsize", ")", ",", "(", "*", "C", ".", "GLsizei", ")", "(", "unsafe", ".", "Pointer", "(", "length", ")", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ")", "\n", "}" ]
8,144
all-8145
[ "Timeout", "provides", "an", "Option", "for", "specifying", "a", "timeout", "in", "seconds", "." ]
[ "func", "Timeout", "(", "seconds", "int", ")", "Option", "{", "return", "func", "(", "c", "*", "config", ")", "{", "c", ".", "Timeout", "=", "time", ".", "Duration", "(", "<mask>", ")", "*", "time", ".", "Second", "\n", "}", "\n", "}" ]
8,145
all-8146
[ "Init", "associates", "the", "iterator", "with", "a", "skiplist", "and", "resets", "all", "state", "." ]
[ "func", "(", "it", "*", "Iterator", ")", "Init", "(", "list", "*", "Skiplist", ")", "{", "<mask>", ".", "list", "=", "list", "\n", "it", ".", "arena", "=", "list", ".", "arena", "\n", "it", ".", "nd", "=", "nil", "\n", "it", ".", "value", "=", "0", "\n", "}" ]
8,146
all-8147
[ "RegisterContainerInstance", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockECSClient", ")", "RegisterContainerInstance", "(", "arg0", "string", ",", "arg1", "[", "]", "*", "ecs", ".", "<mask>", ",", "arg2", "[", "]", "*", "ecs", ".", "Tag", ",", "arg3", "string", ",", "arg4", "[", "]", "*", "ecs", ".", "PlatformDevice", ")", "(", "string", ",", "string", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ",", "arg2", ",", "arg3", ",", "arg4", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "string", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "string", ")", "\n", "ret2", ",", "_", ":=", "ret", "[", "2", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", ",", "ret2", "\n", "}" ]
8,147
all-8148
[ "title", ":", "docker", "healing", "history", "path", ":", "/", "docker", "/", "healing", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "Ok", "204", ":", "No", "content", "400", ":", "Invalid", "data", "401", ":", "Unauthorized" ]
[ "func", "healingHistoryHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "if", "!", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermHealingRead", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "filter", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "filter", "!=", "\"", "\"", "&&", "filter", "!=", "\"", "\"", "&&", "filter", "!=", "\"", "\"", "{", "return", "&", "tsuruErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "\"", "\"", ",", "}", "\n", "}", "\n", "history", ",", "err", ":=", "healer", ".", "ListHealingHistory", "(", "filter", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "history", ")", "==", "0", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusNoContent", ")", "\n", "return", "nil", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "<mask>", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "history", ")", "\n", "}" ]
8,148
all-8149
[ "RemoveColumn", "()", "is", "a", "wrapper", "around", "gtk_grid_remove_column", "()", "." ]
[ "func", "(", "v", "*", "Grid", ")", "RemoveColumn", "(", "<mask>", "int", ")", "{", "C", ".", "gtk_grid_remove_column", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "position", ")", ")", "\n", "}" ]
8,149
all-8150
[ "setSecret", "sets", "a", "value", "in", "a", "map", "of", "secrets", "." ]
[ "func", "(", "a", "*", "<mask>", ")", "setSecret", "(", "secretPath", "string", ",", "secretValue", "[", "]", "byte", ")", "{", "a", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "Unlock", "(", ")", "\n", "a", ".", "secretsMap", "[", "secretPath", "]", "=", "secretValue", "\n", "}" ]
8,150
all-8151
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "update", "Vm", "params" ]
[ "func", "(", "o", "*", "UpdateVMParams", ")", "WithTimeout", "(", "timeout", "<mask>", ".", "Duration", ")", "*", "UpdateVMParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
8,151
all-8152
[ "NewValidator", "creates", "a", "new", "validator", "with", "the", "provided", "configuration", "." ]
[ "func", "NewValidator", "(", "config", "<mask>", ",", "extractor", "RequestTokenExtractor", ")", "*", "JWTValidator", "{", "if", "extractor", "==", "nil", "{", "extractor", "=", "RequestTokenExtractorFunc", "(", "FromHeader", ")", "\n", "}", "\n", "return", "&", "JWTValidator", "{", "config", ",", "extractor", "}", "\n", "}" ]
8,152
all-8153
[ "Write", "sets", "the", "context", "s", "written", "flag", "before", "writing", "the", "response", "." ]
[ "func", "(", "w", "contextWriter", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "w", ".", "<mask>", ".", "written", "=", "true", "\n", "return", "w", ".", "ResponseWriter", ".", "Write", "(", "p", ")", "\n", "}" ]
8,153
all-8154
[ "WithObjectID", "JavaScript", "object", "id", "of", "the", "node", "wrapper", "." ]
[ "func", "(", "p", "SetFileInputFilesParams", ")", "WithObjectID", "(", "objectID", "runtime", ".", "RemoteObjectID", ")", "*", "SetFileInputFilesParams", "{", "p", ".", "ObjectID", "=", "objectID", "\n", "<mask>", "&", "p", "\n", "}" ]
8,154
all-8155
[ "Do", "executes", "Tracing", ".", "end", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "EndParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandEnd", ",", "nil", ",", "nil", ")", "\n", "}" ]
8,155
all-8156
[ "PowerState", "returns", "power", "state", "of", "the", "virtual", "machine", "." ]
[ "func", "(", "v", "*", "VM", ")", "PowerState", "(", ")", "(", "VMPowerState", ",", "error", ")", "{", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n", "var", "state", "C", ".", "VixPowerState", "=", "0x0", "\n\n", "err", "=", "C", ".", "get_property", "(", "v", ".", "<mask>", ",", "C", ".", "VIX_PROPERTY_VM_POWER_STATE", ",", "unsafe", ".", "Pointer", "(", "&", "state", ")", ")", "\n\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "VMPowerState", "(", "0x0", ")", ",", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "return", "VMPowerState", "(", "state", ")", ",", "nil", "\n", "}" ]
8,156
all-8157
[ "StringMarshalJSON", "marshals", "data", "to", "an", "indented", "string", "." ]
[ "func", "StringMarshalJSON", "(", "data", "<mask>", "{", "}", ",", "indent", "string", ")", "string", "{", "buffer", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "data", ",", "\"", "\"", ",", "indent", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "string", "(", "buffer", ")", "\n", "}" ]
8,157
all-8158
[ "getVersion", "returns", "the", "Versions", "of", "the", "given", "member", "via", "its", "peerURLs", ".", "Returns", "the", "last", "error", "if", "it", "fails", "to", "get", "the", "version", "." ]
[ "func", "getVersion", "(", "lg", "*", "zap", ".", "Logger", ",", "m", "*", "membership", ".", "Member", ",", "rt", "http", ".", "RoundTripper", ")", "(", "*", "version", ".", "Versions", ",", "error", ")", "{", "cc", ":=", "&", "http", ".", "Client", "{", "Transport", ":", "rt", ",", "}", "\n", "var", "(", "err", "error", "\n", "resp", "*", "http", ".", "Response", "\n", ")", "\n\n", "for", "_", ",", "u", ":=", "range", "m", ".", "PeerURLs", "{", "addr", ":=", "u", "+", "\"", "\"", "\n", "resp", ",", "err", "=", "cc", ".", "Get", "(", "addr", ")", "\n", "if", "err", "!=", "nil", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "addr", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "m", ".", "ID", ".", "String", "(", ")", ")", ",", "zap", ".", "Error", "(", "err", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Warningf", "(", "\"", "\"", ",", "u", ",", "m", ".", "ID", ",", "err", ")", "\n", "}", "\n", "continue", "\n", "}", "\n", "<mask>", "b", "[", "]", "byte", "\n", "b", ",", "err", "=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "addr", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "m", ".", "ID", ".", "String", "(", ")", ")", ",", "zap", ".", "Error", "(", "err", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Warningf", "(", "\"", "\"", ",", "u", ",", "m", ".", "ID", ",", "err", ")", "\n", "}", "\n", "continue", "\n", "}", "\n", "var", "vers", "version", ".", "Versions", "\n", "if", "err", "=", "json", ".", "Unmarshal", "(", "b", ",", "&", "vers", ")", ";", "err", "!=", "nil", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "addr", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "m", ".", "ID", ".", "String", "(", ")", ")", ",", "zap", ".", "Error", "(", "err", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Warningf", "(", "\"", "\"", ",", "u", ",", "m", ".", "ID", ",", "err", ")", "\n", "}", "\n", "continue", "\n", "}", "\n", "return", "&", "vers", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}" ]
8,158
all-8159
[ "GetHost", "returns", "the", "Host", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "e", "*", "<mask>", ")", "GetHost", "(", ")", "string", "{", "if", "e", "==", "nil", "||", "e", ".", "Host", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "e", ".", "Host", "\n", "}" ]
8,159
all-8160
[ "GenPostgres", "generates", "a", "postgres", "DSN", "from", "the", "passed", "URL", "." ]
[ "func", "GenPostgres", "(", "u", "*", "URL", ")", "(", "string", ",", "error", ")", "{", "host", ",", "port", ",", "dbname", ":=", "hostname", "(", "u", ".", "Host", ")", ",", "hostport", "(", "u", ".", "Host", ")", ",", "strings", ".", "TrimPrefix", "(", "u", ".", "Path", ",", "\"", "\"", ")", "\n", "if", "host", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "ErrRelativePathNotSupported", "\n", "}", "\n\n", "// resolve path", "if", "u", ".", "Proto", "==", "\"", "\"", "{", "if", "<mask>", "==", "\"", "\"", "{", "dbname", "=", "\"", "\"", "+", "dbname", "\n", "}", "\n\n", "host", ",", "port", ",", "dbname", "=", "resolveDir", "(", "stdpath", ".", "Join", "(", "host", ",", "dbname", ")", ")", "\n", "}", "\n\n", "q", ":=", "u", ".", "Query", "(", ")", "\n", "q", ".", "Set", "(", "\"", "\"", ",", "host", ")", "\n", "q", ".", "Set", "(", "\"", "\"", ",", "port", ")", "\n", "q", ".", "Set", "(", "\"", "\"", ",", "dbname", ")", "\n\n", "// add user/pass", "if", "u", ".", "User", "!=", "nil", "{", "q", ".", "Set", "(", "\"", "\"", ",", "u", ".", "User", ".", "Username", "(", ")", ")", "\n", "pass", ",", "_", ":=", "u", ".", "User", ".", "Password", "(", ")", "\n", "q", ".", "Set", "(", "\"", "\"", ",", "pass", ")", "\n", "}", "\n\n", "// save host, port, dbname", "if", "u", ".", "hostPortDB", "==", "nil", "{", "u", ".", "hostPortDB", "=", "[", "]", "string", "{", "host", ",", "port", ",", "dbname", "}", "\n", "}", "\n\n", "return", "genOptions", "(", "q", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "true", ")", ",", "nil", "\n", "}" ]
8,160
all-8161
[ "Do", "executes", "Profiler", ".", "stop", "against", "the", "provided", "context", ".", "returns", ":", "profile", "-", "Recorded", "profile", "." ]
[ "func", "(", "p", "*", "StopParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "profile", "*", "Profile", ",", "err", "error", ")", "{", "// execute", "var", "res", "StopReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandStop", ",", "nil", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Profile", ",", "nil", "\n", "}" ]
8,161
all-8162
[ "generate", "query", "object", "names" ]
[ "func", "GenQueries", "(", "n", "int32", ",", "<mask>", "*", "uint32", ")", "{", "C", ".", "glowGenQueries", "(", "gpGenQueries", ",", "(", "C", ".", "GLsizei", ")", "(", "n", ")", ",", "(", "*", "C", ".", "GLuint", ")", "(", "unsafe", ".", "Pointer", "(", "ids", ")", ")", ")", "\n", "}" ]
8,162
all-8163
[ "Init", "validates", "the", "provided", "config" ]
[ "func", "(", "h", "*", "Github", ")", "Init", "(", ")", "error", "{", "//apply defaults", "if", "h", ".", "User", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "h", ".", "Repo", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "h", ".", "Asset", "==", "nil", "{", "h", ".", "Asset", "=", "h", ".", "defaultAsset", "\n", "}", "\n", "h", ".", "releaseURL", "=", "\"", "\"", "+", "h", ".", "User", "+", "\"", "\"", "+", "h", ".", "Repo", "+", "\"", "\"", "\n", "if", "h", ".", "Interval", "==", "0", "{", "h", ".", "Interval", "=", "5", "*", "time", ".", "Minute", "\n", "}", "else", "if", "h", ".", "Interval", "<", "1", "*", "<mask>", ".", "Minute", "{", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,163
all-8164
[ "NewCache", "creates", "a", "new", "instance", "of", "Cache", "and", "defines", "the", "default", "lifetime", "for", "new", "cached", "items", "." ]
[ "func", "NewCache", "(", "d", "time", ".", "Duration", ")", "*", "Cache", "{", "return", "&", "Cache", "{", "values", ":", "make", "(", "<mask>", "[", "string", "]", "*", "cacheItem", ")", ",", "lifetime", ":", "d", ",", "}", "\n", "}" ]
8,164
all-8165
[ "title", ":", "change", "password", "path", ":", "/", "users", "/", "password", "method", ":", "PUT", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "responses", ":", "200", ":", "Ok", "400", ":", "Invalid", "data", "401", ":", "Unauthorized", "403", ":", "Forbidden", "404", ":", "Not", "found" ]
[ "func", "changePassword", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "managed", ",", "ok", ":=", "app", ".", "AuthScheme", ".", "(", "auth", ".", "ManagedScheme", ")", "\n", "if", "!", "ok", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "nonManagedSchemeMsg", "}", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "userTarget", "(", "t", ".", "GetUserName", "(", ")", ")", ",", "Kind", ":", "permission", ".", "PermUserUpdatePassword", ",", "Owner", ":", "t", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermUserReadEvents", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxUser", ",", "t", ".", "GetUserName", "(", ")", ")", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "oldPassword", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "newPassword", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "confirmPassword", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "if", "oldPassword", "==", "\"", "\"", "||", "newPassword", "==", "\"", "\"", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "<mask>", ":", "\"", "\"", ",", "}", "\n", "}", "\n", "if", "newPassword", "!=", "confirmPassword", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "\"", "\"", ",", "}", "\n", "}", "\n", "err", "=", "managed", ".", "ChangePassword", "(", "t", ",", "oldPassword", ",", "newPassword", ")", "\n", "if", "err", "!=", "nil", "{", "return", "handleAuthError", "(", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,165
all-8166
[ "addAndStartStatsContainer", "add", "the", "container", "into", "stats", "engine", "and", "start", "collecting", "the", "container", "stats" ]
[ "func", "(", "engine", "*", "DockerStatsEngine", ")", "addAndStartStatsContainer", "(", "containerID", "string", ")", "{", "engine", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "engine", ".", "lock", ".", "Unlock", "(", ")", "\n", "statsContainer", ",", "err", ":=", "<mask>", ".", "addContainerUnsafe", "(", "containerID", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "containerID", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "if", "engine", ".", "disableMetrics", "||", "statsContainer", "==", "nil", "{", "return", "\n", "}", "\n\n", "statsContainer", ".", "StartStatsCollection", "(", ")", "\n", "}" ]
8,166
all-8167
[ "/", "*", "Set3D", "sets", "a", "particular", "element", "in", "them", "matrix" ]
[ "func", "(", "m", "*", "Mat", ")", "Set3D", "(", "x", ",", "y", ",", "z", "int", ",", "value", "Scalar", ")", "{", "C", ".", "cvSet3D", "(", "unsafe", ".", "Pointer", "(", "m", ")", ",", "C", ".", "int", "(", "x", ")", ",", "C", ".", "int", "(", "y", ")", ",", "C", ".", "int", "(", "z", ")", ",", "(", "C", ".", "CvScalar", ")", "(", "<mask>", ")", ")", "\n", "}" ]
8,167
all-8168
[ "NewMockEngine", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockEngine", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockEngine", "{", "mock", ":=", "&", "MockEngine", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockEngineMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
8,168
all-8169
[ "copy", "a", "block", "of", "pixels", "from", "one", "framebuffer", "object", "to", "another" ]
[ "func", "BlitNamedFramebuffer", "(", "readFramebuffer", "uint32", ",", "drawFramebuffer", "uint32", ",", "srcX0", "int32", ",", "srcY0", "int32", ",", "srcX1", "int32", ",", "srcY1", "int32", ",", "dstX0", "int32", ",", "dstY0", "int32", ",", "dstX1", "int32", ",", "dstY1", "int32", ",", "mask", "uint32", ",", "<mask>", "uint32", ")", "{", "C", ".", "glowBlitNamedFramebuffer", "(", "gpBlitNamedFramebuffer", ",", "(", "C", ".", "GLuint", ")", "(", "readFramebuffer", ")", ",", "(", "C", ".", "GLuint", ")", "(", "drawFramebuffer", ")", ",", "(", "C", ".", "GLint", ")", "(", "srcX0", ")", ",", "(", "C", ".", "GLint", ")", "(", "srcY0", ")", ",", "(", "C", ".", "GLint", ")", "(", "srcX1", ")", ",", "(", "C", ".", "GLint", ")", "(", "srcY1", ")", ",", "(", "C", ".", "GLint", ")", "(", "dstX0", ")", ",", "(", "C", ".", "GLint", ")", "(", "dstY0", ")", ",", "(", "C", ".", "GLint", ")", "(", "dstX1", ")", ",", "(", "C", ".", "GLint", ")", "(", "dstY1", ")", ",", "(", "C", ".", "GLbitfield", ")", "(", "mask", ")", ",", "(", "C", ".", "GLenum", ")", "(", "filter", ")", ")", "\n", "}" ]
8,169
all-8170
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "SyntheticsTest", ")", "HasType", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Type", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
8,170
all-8171
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "BreakLocation", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger49", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,171
all-8172
[ "Open", "creates", "pubsub", "hub", "connected", "to", "redis", "server", "." ]
[ "func", "Open", "(", "<mask>", "...", "string", ")", "(", "pubsub", ".", "Hub", ",", "error", ")", "{", "redisURL", ":=", "getRedisURL", "(", "URL", "...", ")", "\n", "conn", ",", "err", ":=", "redisurl", ".", "ConnectToURL", "(", "redisURL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "hub", "{", "conn", ":", "conn", ",", "redisURL", ":", "redisURL", ",", "subs", ":", "make", "(", "map", "[", "*", "sub", "]", "struct", "{", "}", ")", ",", "}", ",", "nil", "\n", "}" ]
8,172
all-8173
[ "ToolButtonNew", "is", "a", "wrapper", "around", "gtk_tool_button_new", "()", "." ]
[ "func", "ToolButtonNew", "(", "iconWidget", "IWidget", ",", "label", "string", ")", "(", "*", "ToolButton", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "<mask>", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "w", ":=", "nullableWidget", "(", "iconWidget", ")", "\n", "c", ":=", "C", ".", "gtk_tool_button_new", "(", "w", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapToolButton", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
8,173
all-8174
[ "Do", "executes", "DOMDebugger", ".", "removeInstrumentationBreakpoint", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "RemoveInstrumentationBreakpointParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandRemoveInstrumentationBreakpoint", ",", "p", ",", "nil", ")", "\n", "}" ]
8,174
all-8175
[ "GetCertificates", "returns", "a", "list", "of", "certificates" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetCertificates", "(", ")", "(", "[", "]", "api", ".", "Certificate", ",", "error", ")", "{", "certificates", ":=", "[", "]", "api", ".", "Certificate", "{", "}", "\n\n", "// Fetch the raw value", "_", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "\"", "\"", ",", "&", "certificates", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "<mask>", "\n", "}", "\n\n", "return", "certificates", ",", "nil", "\n", "}" ]
8,175
all-8176
[ "Set", "link", "layer", "address", "ie", ".", "MAC", "Address", ".", "This", "is", "identical", "to", "running", ":", "ip", "link", "set", "dev", "$name", "address", "$macaddress" ]
[ "func", "NetworkSetMacAddress", "(", "iface", "*", "net", ".", "Interface", ",", "macaddr", "string", ")", "error", "{", "s", ",", "err", ":=", "getNetlinkSocket", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "s", ".", "Close", "(", ")", "\n\n", "hwaddr", ",", "err", ":=", "net", ".", "ParseMAC", "(", "macaddr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "var", "(", "MULTICAST", "byte", "=", "0x1", "\n", ")", "\n\n", "if", "hwaddr", "[", "0", "]", "&", "0x1", "==", "MULTICAST", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "macaddr", ")", "\n", "}", "\n\n", "wb", ":=", "newNetlinkRequest", "(", "syscall", ".", "RTM_SETLINK", ",", "syscall", ".", "NLM_F_ACK", ")", "\n\n", "msg", ":=", "newIfInfomsg", "(", "syscall", ".", "AF_UNSPEC", ")", "\n", "<mask>", ".", "Index", "=", "int32", "(", "iface", ".", "Index", ")", "\n", "msg", ".", "Change", "=", "DEFAULT_CHANGE", "\n", "wb", ".", "AddData", "(", "msg", ")", "\n\n", "macdata", ":=", "make", "(", "[", "]", "byte", ",", "6", ")", "\n", "copy", "(", "macdata", ",", "hwaddr", ")", "\n", "data", ":=", "newRtAttr", "(", "IFLA_ADDRESS", ",", "macdata", ")", "\n", "wb", ".", "AddData", "(", "data", ")", "\n\n", "if", "err", ":=", "s", ".", "Send", "(", "wb", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "s", ".", "HandleAck", "(", "wb", ".", "Seq", ")", "\n", "}" ]
8,176
all-8177
[ "Vec2Lerp", "performs", "a", "linear", "interpolation", "between", "two", "vectors", ".", "v1", "toward", "v2", "dest", "[", "out", "]", "The", "result", "vector", ".", "v1", "[", "in", "]", "The", "starting", "vector", ".", "v2", "[", "in", "]", "The", "destination", "vector", ".", "t", "[", "in", "]", "The", "interpolation", "factor", ".", "[", "Limits", ":", "0", "<", "=", "value", "<", "=", "1", ".", "0", "]" ]
[ "func", "Vec2Lerp", "(", "<mask>", ",", "v1", ",", "v2", "Vec2", ",", "t", "float32", ")", "{", "dest", "[", "0", "]", "=", "v1", "[", "0", "]", "+", "(", "v2", "[", "0", "]", "-", "v1", "[", "0", "]", ")", "*", "t", "\n", "dest", "[", "1", "]", "=", "v1", "[", "1", "]", "+", "(", "v2", "[", "1", "]", "-", "v1", "[", "1", "]", ")", "*", "t", "\n", "}" ]
8,177
all-8178
[ "SetAppliedStatus", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskResource", ")", "SetAppliedStatus", "(", "arg0", "status0", ".", "ResourceStatus", ")", "bool", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "bool", ")", "\n", "return", "ret0", "\n", "}" ]
8,178
all-8179
[ "WindowSetDefaultIcon", "is", "a", "wrapper", "around", "gtk_window_set_default_icon", "()", "." ]
[ "func", "WindowSetDefaultIcon", "(", "icon", "*", "gdk", ".", "Pixbuf", ")", "{", "iconPtr", ":=", "(", "*", "C", ".", "GdkPixbuf", ")", "(", "unsafe", ".", "Pointer", "(", "<mask>", ".", "Native", "(", ")", ")", ")", "\n", "C", ".", "gtk_window_set_default_icon", "(", "iconPtr", ")", "\n", "}" ]
8,179
all-8180
[ "RestoreReader", "restores", "cluster", "state", "from", "a", "reader", "containing", "marshaled", "ops", ".", "Such", "as", "those", "written", "by", "ExtractWriter", "." ]
[ "func", "(", "c", "APIClient", ")", "RestoreReader", "(", "r", "io", ".", "Reader", ")", "(", "retErr", "error", ")", "{", "restoreClient", ",", "err", ":=", "c", ".", "AdminAPIClient", ".", "Restore", "(", "c", ".", "Ctx", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "_", ",", "err", ":=", "restoreClient", ".", "CloseAndRecv", "(", ")", ";", "err", "!=", "nil", "&&", "retErr", "==", "nil", "{", "retErr", "=", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "}", "(", ")", "\n", "reader", ":=", "pbutil", ".", "NewReader", "(", "r", ")", "\n", "op", ":=", "&", "admin", ".", "Op", "{", "}", "\n", "for", "{", "if", "err", ":=", "reader", ".", "Read", "(", "op", ")", ";", "err", "!=", "nil", "{", "if", "err", "==", "<mask>", ".", "EOF", "{", "break", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "if", "err", ":=", "restoreClient", ".", "Send", "(", "&", "admin", ".", "RestoreRequest", "{", "Op", ":", "op", "}", ")", ";", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,180
all-8181
[ "IsCommitNotFoundErr", "returns", "true", "if", "err", "has", "an", "error", "message", "that", "matches", "ErrCommitNotFound" ]
[ "func", "IsCommitNotFoundErr", "(", "err", "error", ")", "bool", "{", "if", "err", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "commitNotFoundRe", ".", "MatchString", "(", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", ".", "Error", "(", ")", ")", "\n", "}" ]
8,181
all-8182
[ "getNumNodes", "attempts", "to", "retrieve", "the", "number", "of", "nodes", "in", "the", "current", "k8s", "cluster" ]
[ "func", "getNumNodes", "(", "kubeClient", "*", "kube", ".", "Clientset", ")", "(", "int", ",", "error", ")", "{", "nodeList", ",", "err", ":=", "kubeClient", ".", "CoreV1", "(", ")", ".", "Nodes", "(", ")", ".", "<mask>", "(", "metav1", ".", "ListOptions", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "len", "(", "nodeList", ".", "Items", ")", "==", "0", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "len", "(", "nodeList", ".", "Items", ")", ",", "nil", "\n", "}" ]
8,182
all-8183
[ "ProwJobs", "returns", "a", "ProwJobInformer", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "ProwJobs", "(", ")", "ProwJobInformer", "{", "return", "&", "prowJobInformer", "{", "factory", ":", "v", ".", "factory", ",", "namespace", ":", "v", ".", "namespace", ",", "tweakListOptions", ":", "v", ".", "tweakListOptions", "}", "\n", "}" ]
8,183
all-8184
[ "draw", "multiple", "instances", "of", "a", "set", "of", "elements", "with", "offset", "applied", "to", "instanced", "attributes" ]
[ "func", "DrawElementsInstancedBaseInstance", "(", "mode", "uint32", ",", "<mask>", "int32", ",", "xtype", "uint32", ",", "indices", "unsafe", ".", "Pointer", ",", "instancecount", "int32", ",", "baseinstance", "uint32", ")", "{", "syscall", ".", "Syscall6", "(", "gpDrawElementsInstancedBaseInstance", ",", "6", ",", "uintptr", "(", "mode", ")", ",", "uintptr", "(", "count", ")", ",", "uintptr", "(", "xtype", ")", ",", "uintptr", "(", "indices", ")", ",", "uintptr", "(", "instancecount", ")", ",", "uintptr", "(", "baseinstance", ")", ")", "\n", "}" ]
8,184
all-8185
[ "NewClient", "initializing", "Bugsnag", "client", ".", "Bugsnag", "client", "that", "automatic", "error", "sender", "to", "remote", "server", ".", "We", "use", "this", "service", "to", "collect", "anonymous", "information", "about", "the", "error", "and", "panic", ".", "Service", "is", "activated", "if", "exist", "entry", "key", "=", "error", ".", "sendremote", "and", "value", "=", "true", "in", "the", "database", "settings", "table", "." ]
[ "func", "NewClient", "(", "cfg", "*", "Config", ",", "db", "*", "reform", ".", "DB", ",", "log", "Log", ",", "version", "string", ")", "(", "*", "Client", ",", "error", ")", "{", "if", "log", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "excludedPackagesMap", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n\n", "for", "_", ",", "pkg", ":=", "range", "cfg", ".", "ExcludedPackages", "{", "excludedPackagesMap", "[", "pkg", "]", "=", "true", "\n", "}", "\n\n", "pkgSlice", ",", "err", ":=", "pkgList", "(", "excludedPackagesMap", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "bugsnag", ".", "Configure", "(", "bugsnag", ".", "Configuration", "{", "APIKey", ":", "currentAPIKey", ",", "Logger", ":", "log", ",", "PanicHandler", ":", "func", "(", ")", "{", "}", ",", "// we use our panic processor", "ProjectPackages", ":", "pkgSlice", ",", "ReleaseStage", ":", "cfg", ".", "ReleaseStage", ",", "NotifyReleaseStages", ":", "[", "]", "string", "{", "production", ",", "staging", "}", ",", "AppVersion", ":", "version", ",", "}", ")", "\n\n", "cli", ":=", "new", "(", "Client", ")", "\n", "cli", ".", "db", "=", "db", "\n", "cli", ".", "logger", "=", "log", "\n", "cli", ".", "notifier", "=", "bugsnag", ".", "New", "(", "<mask>", "(", "cfg", ".", "UserID", ")", ")", "\n\n", "//check enable service", "e", ":=", "cli", ".", "allowed", "(", ")", "\n", "cli", ".", "enable", "=", "e", "\n", "enable", "=", "e", "\n", "notifier", "=", "cli", ".", "notifier", "\n", "return", "cli", ",", "nil", "\n", "}" ]
8,185
all-8186
[ "SetBackend", "replaces", "the", "backend", "currently", "set", "with", "the", "given", "new", "logging", "backend", "." ]
[ "func", "SetBackend", "(", "backends", "...", "Backend", ")", "LeveledBackend", "{", "<mask>", "backend", "Backend", "\n", "if", "len", "(", "backends", ")", "==", "1", "{", "backend", "=", "backends", "[", "0", "]", "\n", "}", "else", "{", "backend", "=", "MultiLogger", "(", "backends", "...", ")", "\n", "}", "\n\n", "defaultBackend", "=", "AddModuleLevel", "(", "backend", ")", "\n", "return", "defaultBackend", "\n", "}" ]
8,186
all-8187
[ "ApplyChanges", "propagates", "changes", "to", "the", "dns", "provider" ]
[ "func", "(", "im", "*", "NoopRegistry", ")", "ApplyChanges", "(", "<mask>", "*", "plan", ".", "Changes", ")", "error", "{", "return", "im", ".", "provider", ".", "ApplyChanges", "(", "changes", ")", "\n", "}" ]
8,187
all-8188
[ "CloseAfterContext", "schedules", "the", "process", "to", "close", "after", "the", "given", "context", "is", "done", ".", "It", "is", "the", "equivalent", "of", ":", "func", "CloseAfterContext", "(", "p", "goprocess", ".", "Process", "ctx", "context", ".", "Context", ")", "{", "go", "func", "()", "{", "<", "-", "ctx", ".", "Done", "()", "p", ".", "Close", "()", "}", "()", "}" ]
[ "func", "CloseAfterContext", "(", "p", "goprocess", ".", "Process", ",", "ctx", "context", ".", "<mask>", ")", "{", "if", "p", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "ctx", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// context.Background(). if ctx.Done() is nil, it will never be done.", "// we check for this to avoid wasting a goroutine forever.", "if", "ctx", ".", "Done", "(", ")", "==", "nil", "{", "return", "\n", "}", "\n\n", "go", "func", "(", ")", "{", "<-", "ctx", ".", "Done", "(", ")", "\n", "p", ".", "Close", "(", ")", "\n", "}", "(", ")", "\n", "}" ]
8,188
all-8189
[ "determine", "if", "a", "name", "corresponds", "to", "a", "sampler", "object" ]
[ "func", "IsSampler", "(", "sampler", "uint32", ")", "bool", "{", "ret", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpIsSampler", ",", "1", ",", "uintptr", "(", "sampler", ")", ",", "0", ",", "0", ")", "\n", "return", "<mask>", "!=", "0", "\n", "}" ]
8,189
all-8190
[ "UpdateLan", "does", "a", "partial", "update", "to", "a", "lan", "using", "json", "from", "[]", "byte", "json", "returns", "a", "Instance", "struct" ]
[ "func", "(", "c", "*", "Client", ")", "UpdateLan", "(", "dcid", "string", ",", "lanid", "string", ",", "obj", "LanProperties", ")", "(", "*", "Lan", ",", "error", ")", "{", "url", ":=", "lanPath", "(", "dcid", ",", "lanid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "Lan", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Patch", "(", "<mask>", ",", "obj", ",", "ret", ",", "http", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
8,190
all-8191
[ "ProjectExists", "checks", "if", "a", "project", "with", "the", "given", "key", "exists", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ProjectExists", "(", "<mask>", "string", ")", "(", "bool", ",", "error", ")", "{", "_", ",", "err", ":=", "c", ".", "ProjectID", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "ErrNoSuchObject", "{", "return", "false", ",", "nil", "\n", "}", "\n", "return", "false", ",", "err", "\n", "}", "\n\n", "return", "true", ",", "nil", "\n", "}" ]
8,191
all-8192
[ "Type", "of", "flag", "one", "of", "string", "[]", "string", "int", "map", "or", "file" ]
[ "func", "flagType", "(", "param", "*", "gen", ".", "ActionParam", ")", "string", "{", "path", ":=", "param", ".", "QueryName", "\n", "if", "_", ",", "ok", ":=", "param", ".", "Type", ".", "(", "*", "gen", ".", "ArrayDataType", ")", ";", "ok", "{", "return", "\"", "\"", "\n", "}", "else", "if", "_", ",", "ok", ":=", "param", ".", "Type", ".", "(", "*", "gen", ".", "EnumerableDataType", ")", ";", "ok", "{", "return", "\"", "\"", "\n", "}", "else", "if", "_", ",", "ok", ":=", "param", ".", "Type", ".", "(", "*", "gen", ".", "SourceUploadDataType", ")", ";", "ok", "{", "return", "\"", "\"", "\n", "}", "else", "if", "_", ",", "ok", ":=", "param", ".", "Type", ".", "(", "*", "gen", ".", "UploadDataType", ")", ";", "ok", "{", "return", "\"", "\"", "\n", "}", "\n", "b", ",", "ok", ":=", "param", ".", "<mask>", ".", "(", "*", "gen", ".", "BasicDataType", ")", "\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", "+", "path", ")", "\n", "}", "\n", "return", "string", "(", "*", "b", ")", "\n", "}" ]
8,192
all-8193
[ "GetQuery", "returns", "the", "Query", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "g", "*", "GraphDefinitionRequest", ")", "GetQuery", "(", ")", "string", "{", "if", "g", "==", "nil", "||", "g", ".", "Query", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "g", ".", "<mask>", "\n", "}" ]
8,193
all-8194
[ "Return", "the", "full", "path", "of", "a", "container", "template", "." ]
[ "func", "getContainerTemplatePath", "(", "c", "container", ",", "filename", "string", ")", "(", "string", ",", "error", ")", "{", "if", "strings", ".", "Contains", "(", "<mask>", ",", "\"", "\"", ")", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "filepath", ".", "Join", "(", "c", ".", "Path", "(", ")", ",", "\"", "\"", ",", "filename", ")", ",", "nil", "\n", "}" ]
8,194
all-8195
[ "waitDeletes", "efficiently", "waits", "until", "all", "keys", "matching", "the", "prefix", "and", "no", "greater", "than", "the", "create", "revision", "." ]
[ "func", "waitDeletes", "(", "ctx", "context", ".", "Context", ",", "client", "*", "v3", ".", "Client", ",", "pfx", "string", ",", "maxCreateRev", "int64", ")", "(", "*", "pb", ".", "ResponseHeader", ",", "error", ")", "{", "getOpts", ":=", "<mask>", "(", "v3", ".", "WithLastCreate", "(", ")", ",", "v3", ".", "WithMaxCreateRev", "(", "maxCreateRev", ")", ")", "\n", "for", "{", "resp", ",", "err", ":=", "client", ".", "Get", "(", "ctx", ",", "pfx", ",", "getOpts", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "len", "(", "resp", ".", "Kvs", ")", "==", "0", "{", "return", "resp", ".", "Header", ",", "nil", "\n", "}", "\n", "lastKey", ":=", "string", "(", "resp", ".", "Kvs", "[", "0", "]", ".", "Key", ")", "\n", "if", "err", "=", "waitDelete", "(", "ctx", ",", "client", ",", "lastKey", ",", "resp", ".", "Header", ".", "Revision", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "}" ]
8,195
all-8196
[ "GetRoleName", "returns", "the", "RoleName", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "i", "*", "IntegrationAWSAccount", ")", "GetRoleName", "(", ")", "string", "{", "if", "i", "==", "nil", "||", "i", ".", "RoleName", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "<mask>", "*", "i", ".", "RoleName", "\n", "}" ]
8,196
all-8197
[ "GetConnection", "returns", "an", "active", "connection", "to", "this", "peer", ".", "If", "no", "active", "connections", "are", "found", "it", "will", "create", "a", "new", "outbound", "connection", "and", "return", "it", "." ]
[ "func", "(", "p", "*", "Peer", ")", "GetConnection", "(", "ctx", "context", ".", "Context", ")", "(", "*", "Connection", ",", "error", ")", "{", "if", "activeConn", ",", "ok", ":=", "p", ".", "getActiveConn", "(", ")", ";", "ok", "{", "return", "activeConn", ",", "nil", "\n", "}", "\n\n", "// Lock here to restrict new connection creation attempts to one goroutine", "p", ".", "newConnLock", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "newConnLock", ".", "Unlock", "(", ")", "\n\n", "// Check active connections again in case someone else got ahead of us.", "if", "activeConn", ",", "ok", ":=", "p", ".", "getActiveConn", "(", ")", ";", "<mask>", "{", "return", "activeConn", ",", "nil", "\n", "}", "\n\n", "// No active connections, make a new outgoing connection.", "return", "p", ".", "Connect", "(", "ctx", ")", "\n", "}" ]
8,197
all-8198
[ "intersection", "calculates", "the", "intersection", "of", "given", "two", "lines", "." ]
[ "func", "intersection", "(", "l1", ",", "l2", "line", ")", "(", "float64", ",", "float64", ",", "bool", ")", "{", "// https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line", "denom", ":=", "(", "l1", ".", "X1", "-", "l1", ".", "X2", ")", "*", "(", "l2", ".", "Y1", "-", "l2", ".", "Y2", ")", "-", "(", "l1", ".", "Y1", "-", "l1", ".", "Y2", ")", "*", "(", "l2", ".", "X1", "-", "l2", ".", "X2", ")", "\n", "tNum", ":=", "(", "l1", ".", "X1", "-", "l2", ".", "X1", ")", "*", "(", "l2", ".", "Y1", "-", "l2", ".", "Y2", ")", "-", "(", "l1", ".", "Y1", "-", "l2", ".", "Y1", ")", "*", "(", "l2", ".", "X1", "-", "l2", ".", "X2", ")", "\n", "uNum", ":=", "-", "(", "(", "l1", ".", "X1", "-", "l1", ".", "X2", ")", "*", "(", "l1", ".", "Y1", "-", "l2", ".", "Y1", ")", "-", "(", "l1", ".", "Y1", "-", "l1", ".", "Y2", ")", "*", "(", "l1", ".", "X1", "-", "l2", ".", "X1", ")", ")", "\n\n", "if", "denom", "==", "0", "{", "return", "0", ",", "0", ",", "<mask>", "\n", "}", "\n\n", "t", ":=", "tNum", "/", "denom", "\n", "if", "t", ">", "1", "||", "t", "<", "0", "{", "return", "0", ",", "0", ",", "false", "\n", "}", "\n\n", "u", ":=", "uNum", "/", "denom", "\n", "if", "u", ">", "1", "||", "u", "<", "0", "{", "return", "0", ",", "0", ",", "false", "\n", "}", "\n\n", "x", ":=", "l1", ".", "X1", "+", "t", "*", "(", "l1", ".", "X2", "-", "l1", ".", "X1", ")", "\n", "y", ":=", "l1", ".", "Y1", "+", "t", "*", "(", "l1", ".", "Y2", "-", "l1", ".", "Y1", ")", "\n", "return", "x", ",", "y", ",", "true", "\n", "}" ]
8,198
all-8199
[ "ListNics", "returns", "a", "Nics", "struct", "collection" ]
[ "func", "(", "c", "*", "Client", ")", "ListNics", "(", "dcid", ",", "srvid", "string", ")", "(", "*", "Nics", ",", "error", ")", "{", "url", ":=", "nicColPath", "(", "dcid", ",", "srvid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "Nics", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "<mask>", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
8,199
all-8200
[ "Fatalln", "records", "the", "log", "with", "fatal", "level", "and", "exits" ]
[ "func", "Fatalln", "(", "args", "...", "interface", "{", "}", ")", "{", "logger", ".", "Output", "(", "2", ",", "LevelFatal", ",", "fmt", ".", "Sprintln", "(", "args", "...", ")", ")", "\n", "<mask>", ".", "Exit", "(", "1", ")", "\n", "}" ]