id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
21,200
all-21201
[ "GetUnits", "returns", "the", "internal", "list", "of", "units", "converted", "to", "bind", ".", "Unit", "." ]
[ "func", "(", "app", "*", "App", ")", "GetUnits", "(", ")", "(", "[", "]", "bind", ".", "Unit", ",", "error", ")", "{", "provUnits", ",", "err", ":=", "app", ".", "Units", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "units", ":=", "<mask>", "(", "[", "]", "bind", ".", "Unit", ",", "len", "(", "provUnits", ")", ")", "\n", "for", "i", ":=", "range", "provUnits", "{", "units", "[", "i", "]", "=", "&", "provUnits", "[", "i", "]", "\n", "}", "\n", "return", "units", ",", "nil", "\n", "}" ]
21,201
all-21202
[ "TracerFromRegistrar", "returns", "an", "OpenTracing", "Tracer", "embedded", "in", "the", "Registrar", "assuming", "that", "Registrar", "has", "a", "Tracer", "()", "method", ".", "Otherwise", "it", "returns", "default", "Global", "Tracer", "." ]
[ "func", "TracerFromRegistrar", "(", "registrar", "Registrar", ")", "opentracing", ".", "Tracer", "{", "if", "tracerProvider", ",", "ok", ":=", "registrar", ".", "(", "tracerProvider", ")", ";", "<mask>", "{", "return", "tracerProvider", ".", "Tracer", "(", ")", "\n", "}", "\n", "return", "opentracing", ".", "GlobalTracer", "(", ")", "\n", "}" ]
21,202
all-21203
[ "NewClient", "creates", "a", "new", "Livestatus", "client", "instance", "." ]
[ "func", "NewClient", "(", "network", ",", "address", "string", ")", "*", "Client", "{", "return", "NewClientWithDialer", "(", "<mask>", ",", "address", ",", "new", "(", "net", ".", "Dialer", ")", ")", "\n", "}" ]
21,203
all-21204
[ "ReloadData", "reloads", "configuration", "file", "from", "memory" ]
[ "func", "(", "c", "*", "ConfigFile", ")", "ReloadData", "(", "in", "io", ".", "Reader", ")", "(", "err", "error", ")", "{", "var", "cfg", "*", "ConfigFile", "\n", "if", "len", "(", "c", ".", "fileNames", ")", "!=", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "cfg", ",", "err", "=", "LoadFromReader", "(", "<mask>", ")", "\n", "if", "err", "==", "nil", "{", "*", "c", "=", "*", "cfg", "\n", "}", "\n", "return", "err", "\n", "}" ]
21,204
all-21205
[ "HasServiceName", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "ServicePDRequest", ")", "HasServiceName", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "ServiceName", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
21,205
all-21206
[ "==", "Lookup", "lookUp", "parses", "the", "shadowed", "group", "line", "searching", "a", "value", "into", "the", "field", ".", "Returns", "nil", "if", "it", "isn", "t", "found", "." ]
[ "func", "(", "*", "GShadow", ")", "lookUp", "(", "line", "string", ",", "f", "field", ",", "value", "interface", "{", "}", ")", "interface", "{", "}", "{", "_field", ":=", "f", ".", "(", "gshadowField", ")", "\n", "_value", ":=", "value", ".", "(", "string", ")", "\n", "allField", ":=", "strings", ".", "Split", "(", "line", ",", "\"", "\"", ")", "\n", "arrayField", ":=", "make", "(", "map", "[", "int", "]", "[", "]", "string", ")", "\n\n", "arrayField", "[", "2", "]", "=", "strings", ".", "Split", "(", "allField", "[", "2", "]", ",", "\"", "\"", ")", "\n", "arrayField", "[", "3", "]", "=", "strings", ".", "Split", "(", "allField", "[", "3", "]", ",", "\"", "\"", ")", "\n\n", "// Check fields", "var", "isField", "bool", "\n", "if", "GS_NAME", "&", "_field", "!=", "0", "&&", "allField", "[", "0", "]", "==", "_value", "{", "isField", "=", "<mask>", "\n", "}", "else", "if", "GS_PASSWD", "&", "_field", "!=", "0", "&&", "allField", "[", "1", "]", "==", "_value", "{", "isField", "=", "true", "\n", "}", "else", "if", "GS_ADMIN", "&", "_field", "!=", "0", "&&", "checkGroup", "(", "arrayField", "[", "2", "]", ",", "_value", ")", "{", "isField", "=", "true", "\n", "}", "else", "if", "GS_MEMBER", "&", "_field", "!=", "0", "&&", "checkGroup", "(", "arrayField", "[", "3", "]", ",", "_value", ")", "{", "isField", "=", "true", "\n", "}", "else", "if", "GS_ALL", "&", "_field", "!=", "0", "{", "isField", "=", "true", "\n", "}", "\n\n", "if", "isField", "{", "return", "&", "GShadow", "{", "allField", "[", "0", "]", ",", "allField", "[", "1", "]", ",", "arrayField", "[", "2", "]", ",", "arrayField", "[", "3", "]", ",", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,206
all-21207
[ "define", "an", "array", "of", "fog", "coordinates" ]
[ "func", "FogCoordPointer", "(", "xtype", "uint32", ",", "stride", "int32", ",", "pointer", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall", "(", "gpFogCoordPointer", ",", "3", ",", "uintptr", "(", "xtype", ")", ",", "uintptr", "(", "stride", ")", ",", "uintptr", "(", "<mask>", ")", ")", "\n", "}" ]
21,207
all-21208
[ "GetAlertIdOk", "returns", "a", "tuple", "with", "the", "AlertId", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "a", "*", "AlertValueDefinition", ")", "GetAlertIdOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "a", "==", "nil", "||", "a", ".", "AlertId", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "a", ".", "AlertId", ",", "<mask>", "\n", "}" ]
21,208
all-21209
[ "GetIterFromString", "()", "is", "a", "wrapper", "around", "gtk_tree_model_get_iter_from_string", "()", "." ]
[ "func", "(", "v", "*", "TreeModel", ")", "GetIterFromString", "(", "path", "string", ")", "(", "*", "TreeIter", ",", "error", ")", "{", "<mask>", "iter", "C", ".", "GtkTreeIter", "\n", "cstr", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "c", ":=", "C", ".", "gtk_tree_model_get_iter_from_string", "(", "v", ".", "native", "(", ")", ",", "&", "iter", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "if", "!", "gobool", "(", "c", ")", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "t", ":=", "&", "TreeIter", "{", "iter", "}", "\n", "return", "t", ",", "nil", "\n", "}" ]
21,209
all-21210
[ "waitForDuration", "waits", "for", "the", "specified", "duration", "of", "time", ".", "If", "the", "wait", "is", "interrupted", "it", "returns", "a", "false", "value", ".", "Else", "it", "returns", "true", "indicating", "completion", "of", "wait", "time", "." ]
[ "func", "(", "acsSession", "*", "session", ")", "waitForDuration", "(", "<mask>", "time", ".", "Duration", ")", "bool", "{", "reconnectTimer", ":=", "time", ".", "NewTimer", "(", "delay", ")", "\n", "select", "{", "case", "<-", "reconnectTimer", ".", "C", ":", "return", "true", "\n", "case", "<-", "acsSession", ".", "ctx", ".", "Done", "(", ")", ":", "reconnectTimer", ".", "Stop", "(", ")", "\n", "return", "false", "\n", "}", "\n", "}" ]
21,210
all-21211
[ "Info", "logs", "msg", "to", "all", "added", "loggers", "at", "LogLevel", ".", "LevelInfo" ]
[ "func", "(", "b", "*", "Base", ")", "Info", "(", "<mask>", "string", ")", "error", "{", "return", "b", ".", "Log", "(", "LevelInfo", ",", "nil", ",", "msg", ")", "\n", "}" ]
21,211
all-21212
[ "IterParent", "is", "a", "wrapper", "around", "gtk_tree_model_iter_parent", "()", "." ]
[ "func", "(", "v", "*", "TreeModel", ")", "IterParent", "(", "iter", ",", "<mask>", "*", "TreeIter", ")", "bool", "{", "c", ":=", "C", ".", "gtk_tree_model_iter_parent", "(", "v", ".", "native", "(", ")", ",", "iter", ".", "native", "(", ")", ",", "child", ".", "native", "(", ")", ")", "\n", "return", "gobool", "(", "c", ")", "\n", "}" ]
21,212
all-21213
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ScriptCoverage", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler15", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,213
all-21214
[ "RootForSpec", "determines", "the", "root", "GCS", "path", "for", "storing", "artifacts", "about", "the", "provided", "job", "." ]
[ "func", "RootForSpec", "(", "spec", "*", "downwardapi", ".", "JobSpec", ")", "string", "{", "switch", "<mask>", ".", "Type", "{", "case", "prowapi", ".", "PeriodicJob", ",", "prowapi", ".", "PostsubmitJob", ":", "return", "path", ".", "Join", "(", "NonPRLogs", ",", "spec", ".", "Job", ")", "\n", "case", "prowapi", ".", "PresubmitJob", ",", "prowapi", ".", "BatchJob", ":", "return", "path", ".", "Join", "(", "PRLogs", ",", "\"", "\"", ",", "spec", ".", "Job", ")", "\n", "default", ":", "logrus", ".", "Errorf", "(", "\"", "\"", ",", "spec", ".", "Type", ")", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
21,214
all-21215
[ "WriteHeader", "sets", "the", "status", "code", "for", "a", "response" ]
[ "func", "(", "w", "*", "Response", ")", "WriteHeader", "(", "i", "int", ")", "{", "w", ".", "<mask>", "=", "i", "\n", "w", ".", "ResponseWriter", ".", "WriteHeader", "(", "i", ")", "\n", "}" ]
21,215
all-21216
[ "WriteObject", "implements", "ObjectStream", "." ]
[ "func", "(", "t", "*", "bufferedObjectStream", ")", "WriteObject", "(", "obj", "<mask>", "{", "}", ")", "error", "{", "t", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "err", ":=", "t", ".", "codec", ".", "WriteObject", "(", "t", ".", "w", ",", "obj", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "t", ".", "w", ".", "Flush", "(", ")", "\n", "}" ]
21,216
all-21217
[ "ResValue", "satisfies", "the", "Res", "interface", "for", "Num" ]
[ "func", "(", "n", "Num", ")", "<mask>", "(", ")", "string", "{", "if", "math", ".", "IsInf", "(", "float64", "(", "n", ")", ",", "0", ")", "{", "if", "math", ".", "IsInf", "(", "float64", "(", "n", ")", ",", "1", ")", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "float64", "(", "n", ")", ")", "\n", "}" ]
21,217
all-21218
[ "PeekEvent", "()", "is", "a", "wrapper", "around", "gdk_display_peek_event", "()", "." ]
[ "func", "(", "v", "*", "Display", ")", "PeekEvent", "(", ")", "(", "*", "Event", ",", "error", ")", "{", "c", ":=", "C", ".", "gdk_display_peek_event", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "//The finalizer is not on the glib.Object but on the event.", "e", ":=", "&", "<mask>", "{", "c", "}", "\n", "runtime", ".", "SetFinalizer", "(", "e", ",", "(", "*", "Event", ")", ".", "free", ")", "\n", "return", "e", ",", "nil", "\n", "}" ]
21,218
all-21219
[ "FileCopy", "copies", "file", "source", "to", "destination", "dest", ".", "Based", "on", "Jaybill", "McCarthy", "s", "code", "which", "can", "be", "found", "at", "http", ":", "//", "jayblog", ".", "jaybill", ".", "com", "/", "post", "/", "id", "/", "26" ]
[ "func", "FileCopy", "(", "source", "string", ",", "dest", "string", ")", "(", "err", "error", ")", "{", "sourceFile", ",", "err", ":=", "<mask>", ".", "Open", "(", "source", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "sourceFile", ".", "Close", "(", ")", "\n", "destFile", ",", "err", ":=", "os", ".", "Create", "(", "dest", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "destFile", ".", "Close", "(", ")", "\n", "_", ",", "err", "=", "io", ".", "Copy", "(", "destFile", ",", "sourceFile", ")", "\n", "if", "err", "==", "nil", "{", "si", ",", "err", ":=", "os", ".", "Stat", "(", "source", ")", "\n", "if", "err", "==", "nil", "{", "err", "=", "os", ".", "Chmod", "(", "dest", ",", "si", ".", "Mode", "(", ")", ")", "\n", "}", "\n", "}", "\n", "return", "err", "\n", "}" ]
21,219
all-21220
[ "AppendEllipsis", "appends", "a", "new", "ellipsis", "node", "to", "the", "list", "if", "none", "already", "exists", "at", "the", "end", ".", "If", "cs", "is", "non", "-", "zero", "it", "coalesces", "the", "statistics", "with", "the", "previous", "diffStats", "." ]
[ "func", "(", "s", "*", "textList", ")", "AppendEllipsis", "(", "ds", "diffStats", ")", "{", "hasStats", ":=", "ds", "!=", "diffStats", "{", "}", "\n", "if", "len", "(", "*", "s", ")", "==", "0", "||", "!", "(", "*", "s", ")", "[", "len", "(", "*", "s", ")", "-", "1", "]", ".", "<mask>", ".", "Equal", "(", "textEllipsis", ")", "{", "if", "hasStats", "{", "*", "s", "=", "append", "(", "*", "s", ",", "textRecord", "{", "Value", ":", "textEllipsis", ",", "Comment", ":", "ds", "}", ")", "\n", "}", "else", "{", "*", "s", "=", "append", "(", "*", "s", ",", "textRecord", "{", "Value", ":", "textEllipsis", "}", ")", "\n", "}", "\n", "return", "\n", "}", "\n", "if", "hasStats", "{", "(", "*", "s", ")", "[", "len", "(", "*", "s", ")", "-", "1", "]", ".", "Comment", "=", "(", "*", "s", ")", "[", "len", "(", "*", "s", ")", "-", "1", "]", ".", "Comment", ".", "(", "diffStats", ")", ".", "Append", "(", "ds", ")", "\n", "}", "\n", "}" ]
21,220
all-21221
[ "reserve", "transform", "feedback", "object", "names" ]
[ "func", "GenTransformFeedbacks", "(", "n", "int32", ",", "ids", "*", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpGenTransformFeedbacks", ",", "2", ",", "uintptr", "(", "n", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ",", "0", ")", "\n", "}" ]
21,221
all-21222
[ "PostCheck", "posts", "the", "result", "of", "a", "check", "run", "to", "the", "server" ]
[ "func", "(", "client", "*", "Client", ")", "PostCheck", "(", "check", "Check", ")", "error", "{", "return", "<mask>", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "check", ",", "nil", ")", "\n", "}" ]
21,222
all-21223
[ "WithReferrer", "referrer", "URL", "." ]
[ "func", "(", "p", "NavigateParams", ")", "WithReferrer", "(", "referrer", "<mask>", ")", "*", "NavigateParams", "{", "p", ".", "Referrer", "=", "referrer", "\n", "return", "&", "p", "\n", "}" ]
21,223
all-21224
[ "diskCapacityInGiB", "reports", "the", "supplied", "disk", "s", "capacity", "by", "first", "checking", "CapacityInBytes", "and", "then", "falling", "back", "to", "CapacityInKB", "if", "that", "value", "is", "unavailable", ".", "This", "helps", "correct", "some", "situations", "where", "the", "former", "value", "s", "data", "gets", "cleared", "which", "seems", "to", "happen", "on", "upgrades", "." ]
[ "func", "diskCapacityInGiB", "(", "disk", "*", "<mask>", ".", "VirtualDisk", ")", "int", "{", "if", "disk", ".", "CapacityInBytes", ">", "0", "{", "return", "int", "(", "structure", ".", "ByteToGiB", "(", "disk", ".", "CapacityInBytes", ")", ".", "(", "int64", ")", ")", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "object", ".", "VirtualDeviceList", "{", "}", ".", "Name", "(", "disk", ")", ",", ")", "\n", "return", "int", "(", "structure", ".", "ByteToGiB", "(", "disk", ".", "CapacityInKB", "*", "1024", ")", ".", "(", "int64", ")", ")", "\n", "}" ]
21,224
all-21225
[ "setScreenSize", "must", "be", "called", "from", "the", "main", "thread", "." ]
[ "func", "(", "u", "*", "UserInterface", ")", "setScreenSize", "(", "<mask>", ",", "height", "int", ",", "scale", "float64", ",", "fullscreen", "bool", ",", "vsync", "bool", ")", "bool", "{", "if", "u", ".", "width", "==", "width", "&&", "u", ".", "height", "==", "height", "&&", "u", ".", "scale", "==", "scale", "&&", "u", ".", "isFullscreen", "(", ")", "==", "fullscreen", "&&", "u", ".", "vsync", "==", "vsync", "{", "return", "false", "\n", "}", "\n", "u", ".", "forceSetScreenSize", "(", "width", ",", "height", ",", "scale", ",", "fullscreen", ",", "vsync", ")", "\n", "return", "true", "\n", "}" ]
21,225
all-21226
[ "Exec", "executes", "a", "command", "setting", "both", "standard", "input", "output", "and", "error", "." ]
[ "func", "Exec", "(", "cmd", "string", ",", "args", "...", "string", ")", "error", "{", "c", ":=", "exec", ".", "Command", "(", "cmd", ",", "args", "...", ")", "\n", "c", ".", "Stdin", "=", "<mask>", ".", "Stdin", "\n", "c", ".", "Stdout", "=", "os", ".", "Stdout", "\n", "c", ".", "Stderr", "=", "os", ".", "Stderr", "\n\n", "if", "err", ":=", "c", ".", "Run", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,226
all-21227
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventTargetDestroyed", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget14", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,227
all-21228
[ "Write", "writes", "response", "to", "w", ".", "Write", "doesn", "t", "flush", "response", "to", "w", "for", "performance", "reasons", ".", "See", "also", "WriteTo", "." ]
[ "func", "(", "resp", "*", "<mask>", ")", "Write", "(", "w", "*", "bufio", ".", "Writer", ")", "error", "{", "sendBody", ":=", "!", "resp", ".", "mustSkipBody", "(", ")", "\n\n", "if", "resp", ".", "bodyStream", "!=", "nil", "{", "return", "resp", ".", "writeBodyStream", "(", "w", ",", "sendBody", ")", "\n", "}", "\n\n", "body", ":=", "resp", ".", "bodyBytes", "(", ")", "\n", "bodyLen", ":=", "len", "(", "body", ")", "\n", "if", "sendBody", "||", "bodyLen", ">", "0", "{", "resp", ".", "Header", ".", "SetContentLength", "(", "bodyLen", ")", "\n", "}", "\n", "if", "err", ":=", "resp", ".", "Header", ".", "Write", "(", "w", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "sendBody", "{", "if", "_", ",", "err", ":=", "w", ".", "Write", "(", "body", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,228
all-21229
[ "Panics", "if", "error", "." ]
[ "func", "(", "cdc", "*", "Codec", ")", "MustUnmarshalBinaryBare", "(", "bz", "[", "]", "byte", ",", "ptr", "<mask>", "{", "}", ")", "{", "err", ":=", "cdc", ".", "UnmarshalBinaryBare", "(", "bz", ",", "ptr", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "}" ]
21,229
all-21230
[ "Store", "a", "font", "to", "this", "cache" ]
[ "func", "(", "cache", "*", "SyncFolderFontCache", ")", "<mask>", "(", "fontData", "FontData", ",", "font", "*", "truetype", ".", "Font", ")", "{", "cache", ".", "Lock", "(", ")", "\n", "cache", ".", "fonts", "[", "cache", ".", "namer", "(", "fontData", ")", "]", "=", "font", "\n", "cache", ".", "Unlock", "(", ")", "\n", "}" ]
21,230
all-21231
[ "WaitConditionNegate", "negates", "the", "most", "recent", "wait", "condition", "." ]
[ "func", "(", "q", "*", "Query", ")", "WaitConditionNegate", "(", ")", "*", "Query", "{", "q", ".", "headers", "=", "<mask>", "(", "q", ".", "headers", ",", "\"", "\"", ")", "\n", "return", "q", "\n", "}" ]
21,231
all-21232
[ "String", "looks", "up", "the", "value", "of", "a", "string", "flag", "returns", "if", "no", "string", "flag", "exists" ]
[ "func", "(", "f", "Flags", ")", "String", "(", "<mask>", "string", ")", "string", "{", "return", "f", ".", "C", ".", "String", "(", "name", ")", "\n", "}" ]
21,232
all-21233
[ "MarshalJSON", "calls", "json", ".", "RawMessage", "method", "of", "the", "same", "name", ".", "Required", "since", "TriggerHookRequest", "is", "of", "type", "json", ".", "RawMessage", "..." ]
[ "func", "(", "this", "*", "TriggerHookRequest", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "x", ":=", "json", ".", "RawMessage", "(", "*", "this", ")", "\n", "return", "(", "&", "x", ")", ".", "MarshalJSON", "(", ")", "\n", "}" ]
21,233
all-21234
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "PrintToPDFReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage22", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,234
all-21235
[ "Do", "executes", "Page", ".", "captureScreenshot", "against", "the", "provided", "context", ".", "returns", ":", "data", "-", "Base64", "-", "encoded", "image", "data", "." ]
[ "func", "(", "p", "*", "CaptureScreenshotParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "data", "[", "]", "byte", ",", "err", "error", ")", "{", "// execute", "var", "res", "CaptureScreenshotReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandCaptureScreenshot", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// decode", "var", "dec", "[", "]", "byte", "\n", "dec", ",", "err", "=", "base64", ".", "StdEncoding", ".", "DecodeString", "(", "res", ".", "Data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "dec", ",", "nil", "\n", "}" ]
21,235
all-21236
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "m", "*", "MetricMetadata", ")", "GetType", "(", ")", "string", "{", "if", "m", "==", "nil", "||", "m", ".", "Type", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "m", ".", "<mask>", "\n", "}" ]
21,236
all-21237
[ "Parse", "parses", "a", "file", "." ]
[ "func", "Parse", "(", "filename", "string", ",", "r", "io", ".", "Reader", ")", "(", "[", "]", "*", "Group", ",", "error", ")", "{", "n", ":=", "0", "\n", "groups", ":=", "make", "(", "[", "]", "*", "Group", ",", "0", ")", "\n", "scanner", ":=", "bufio", ".", "NewScanner", "(", "r", ")", "\n\n", "// whether we're at the point of expectations or", "// not.", "settingExpectations", ":=", "false", "\n\n", "var", "currentGroup", "*", "Group", "\n", "var", "currentRequest", "*", "Request", "\n\n", "for", "scanner", ".", "Scan", "(", ")", "{", "n", "++", "\n", "line", ",", "err", ":=", "ParseLine", "(", "n", ",", "scanner", ".", "Bytes", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "switch", "line", ".", "Type", "{", "case", "LineTypeGroupHeading", ":", "// new group", "if", "currentGroup", "!=", "nil", "{", "if", "currentRequest", "!=", "nil", "{", "currentGroup", ".", "Requests", "=", "append", "(", "currentGroup", ".", "Requests", ",", "currentRequest", ")", "\n", "currentRequest", "=", "nil", "\n", "}", "\n", "groups", "=", "append", "(", "groups", ",", "currentGroup", ")", "\n", "}", "\n", "title", ",", "err", ":=", "getok", "(", "line", ".", "Regexp", ".", "FindSubmatch", "(", "line", ".", "Bytes", ")", ",", "1", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "&", "ErrLine", "{", "N", ":", "n", ",", "Err", ":", "err", "}", "\n", "}", "\n", "currentGroup", "=", "&", "Group", "{", "Filename", ":", "filename", ",", "Title", ":", "title", ",", "}", "\n", "case", "LineTypeRequest", ":", "// new request", "if", "currentGroup", "==", "nil", "{", "return", "nil", ",", "&", "ErrLine", "{", "N", ":", "n", ",", "Err", ":", "errMissingGroupHeader", "}", "\n", "}", "\n", "if", "currentRequest", "!=", "nil", "{", "currentGroup", ".", "Requests", "=", "append", "(", "currentGroup", ".", "Requests", ",", "currentRequest", ")", "\n", "}", "\n", "settingExpectations", "=", "false", "\n", "var", "err", "error", "\n", "currentRequest", "=", "&", "Request", "{", "}", "\n", "matches", ":=", "line", ".", "Regexp", ".", "FindSubmatch", "(", "line", ".", "Bytes", ")", "\n", "if", "currentRequest", ".", "Method", ",", "err", "=", "getok", "(", "matches", ",", "1", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "&", "ErrLine", "{", "N", ":", "n", ",", "Err", ":", "err", "}", "\n", "}", "\n", "if", "currentRequest", ".", "Path", ",", "err", "=", "getok", "(", "matches", ",", "2", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "&", "ErrLine", "{", "N", ":", "n", ",", "Err", ":", "err", "}", "\n", "}", "\n", "case", "LineTypeCodeBlock", ":", "if", "currentRequest", "==", "nil", "{", "return", "nil", ",", "&", "ErrLine", "{", "N", ":", "n", ",", "Err", ":", "errUnexpectedCodeblock", "}", "\n", "}", "\n\n", "var", "bodyType", "string", "\n", "if", "len", "(", "<mask>", ".", "Bytes", ")", ">", "3", "{", "bodyType", "=", "string", "(", "line", ".", "Bytes", "[", "3", ":", "]", ")", "\n", "}", "\n\n", "var", "lines", "Lines", "\n", "var", "err", "error", "\n", "n", ",", "lines", ",", "err", "=", "scancodeblock", "(", "n", ",", "scanner", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "&", "ErrLine", "{", "N", ":", "n", ",", "Err", ":", "err", "}", "\n", "}", "\n", "if", "settingExpectations", "{", "currentRequest", ".", "ExpectedBody", "=", "lines", "\n", "currentRequest", ".", "ExpectedBodyType", "=", "bodyType", "\n", "}", "else", "{", "currentRequest", ".", "Body", "=", "lines", "\n", "currentRequest", ".", "BodyType", "=", "bodyType", "\n", "}", "\n\n", "case", "LineTypeDetail", ":", "if", "currentRequest", "==", "nil", "&&", "currentGroup", "==", "nil", "{", "return", "nil", ",", "&", "ErrLine", "{", "N", ":", "n", ",", "Err", ":", "errUnexpectedDetails", "}", "\n", "}", "\n", "if", "currentRequest", "==", "nil", "{", "currentGroup", ".", "Details", "=", "append", "(", "currentGroup", ".", "Details", ",", "line", ")", "\n", "continue", "\n", "}", "\n", "if", "settingExpectations", "{", "currentRequest", ".", "ExpectedDetails", "=", "append", "(", "currentRequest", ".", "ExpectedDetails", ",", "line", ")", "\n", "}", "else", "{", "currentRequest", ".", "Details", "=", "append", "(", "currentRequest", ".", "Details", ",", "line", ")", "\n", "}", "\n", "case", "LineTypeParam", ":", "if", "currentRequest", "==", "nil", "&&", "currentGroup", "==", "nil", "{", "return", "nil", ",", "&", "ErrLine", "{", "N", ":", "n", ",", "Err", ":", "errUnexpectedParams", "}", "\n", "}", "\n", "if", "settingExpectations", "{", "return", "nil", ",", "&", "ErrLine", "{", "N", ":", "n", ",", "Err", ":", "errUnexpectedParams", "}", "\n", "}", "\n", "currentRequest", ".", "Params", "=", "append", "(", "currentRequest", ".", "Params", ",", "line", ")", "\n", "case", "LineTypeSeparator", ":", "settingExpectations", "=", "true", "\n", "}", "\n\n", "}", "\n\n", "if", "currentGroup", "==", "nil", "{", "return", "nil", ",", "&", "ErrLine", "{", "N", ":", "n", ",", "Err", ":", "errMissingGroupHeader", "}", "\n", "}", "\n", "if", "currentRequest", "!=", "nil", "{", "currentGroup", ".", "Requests", "=", "append", "(", "currentGroup", ".", "Requests", ",", "currentRequest", ")", "\n", "}", "\n", "groups", "=", "append", "(", "groups", ",", "currentGroup", ")", "\n\n", "return", "groups", ",", "nil", "\n", "}" ]
21,237
all-21238
[ "GetMenuByID", "is", "a", "wrapper", "around", "gtk_application_get_menu_by_id", "()", "." ]
[ "func", "(", "v", "*", "Application", ")", "GetMenuByID", "(", "id", "string", ")", "*", "glib", ".", "Menu", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "id", ")", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n\n", "c", ":=", "C", ".", "gtk_application_get_menu_by_id", "(", "v", ".", "native", "(", ")", ",", "cstr1", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "&", "glib", ".", "Menu", "{", "glib", ".", "MenuModel", "{", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "}", "}", "\n", "}" ]
21,238
all-21239
[ "Ensures", "that", "sufficient", "peers", "are", "connected", ".", "(", "continuous", ")" ]
[ "func", "(", "r", "*", "PEXReactor", ")", "ensurePeersRoutine", "(", ")", "{", "// Randomize when routine starts", "ensurePeersPeriodMs", ":=", "r", ".", "ensurePeersPeriod", ".", "Nanoseconds", "(", ")", "/", "1e6", "\n", "time", ".", "Sleep", "(", "time", ".", "Duration", "(", "rand", ".", "Int63n", "(", "ensurePeersPeriodMs", ")", ")", "*", "time", ".", "Millisecond", ")", "\n\n", "// fire once immediately.", "r", ".", "ensurePeers", "(", ")", "\n\n", "// fire periodically", "ticker", ":=", "time", ".", "NewTicker", "(", "r", ".", "ensurePeersPeriod", ")", "\n\n", "for", "{", "select", "{", "case", "<-", "ticker", ".", "C", ":", "r", ".", "ensurePeers", "(", ")", "\n", "<mask>", "<-", "r", ".", "Quit", ":", "ticker", ".", "Stop", "(", ")", "\n", "return", "\n", "}", "\n", "}", "\n", "}" ]
21,239
all-21240
[ "GetManageStatusShowTitleOk", "returns", "a", "tuple", "with", "the", "ManageStatusShowTitle", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetManageStatusShowTitleOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "ManageStatusShowTitle", "==", "nil", "{", "return", "false", ",", "false", "\n", "}", "\n", "return", "*", "w", ".", "ManageStatusShowTitle", ",", "<mask>", "\n", "}" ]
21,240
all-21241
[ "CreateField", "creates", "a", "field", "on", "the", "server", "using", "the", "given", "Field", "struct", "." ]
[ "func", "(", "c", "*", "Client", ")", "CreateField", "(", "field", "*", "Field", ")", "error", "{", "span", ":=", "c", ".", "tracer", ".", "StartSpan", "(", "\"", "\"", ")", "\n", "defer", "span", ".", "Finish", "(", ")", "\n\n", "data", ":=", "[", "]", "byte", "(", "field", ".", "options", ".", "String", "(", ")", ")", "\n", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "field", ".", "index", ".", "name", ",", "field", ".", "name", ")", "\n", "<mask>", ",", "_", ",", "err", ":=", "c", ".", "httpRequest", "(", "\"", "\"", ",", "path", ",", "data", ",", "nil", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "if", "response", "!=", "nil", "&&", "response", ".", "StatusCode", "==", "409", "{", "return", "ErrFieldExists", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,241
all-21242
[ "The", "zfs", ".", "pool_name", "config", "key", "is", "node", "-", "specific", "and", "needs", "to", "be", "linked", "to", "nodes", "." ]
[ "func", "updateFromV6", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "// Fetch the IDs of all existing nodes.", "nodeIDs", ",", "err", ":=", "query", ".", "SelectIntegers", "(", "tx", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Fetch the IDs of all existing zfs pools.", "poolIDs", ",", "err", ":=", "query", ".", "SelectIntegers", "(", "tx", ",", "`\nSELECT id FROM storage_pools WHERE driver='zfs'\n`", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "for", "_", ",", "poolID", ":=", "range", "poolIDs", "{", "// Fetch the config for this zfs pool and check if it has the zfs.pool_name key", "config", ",", "err", ":=", "query", ".", "SelectConfig", "(", "tx", ",", "\"", "\"", ",", "\"", "\"", ",", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "<mask>", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "poolName", ",", "ok", ":=", "config", "[", "\"", "\"", "]", "\n", "if", "!", "ok", "{", "continue", "// This zfs storage pool does not have a zfs.pool_name config", "\n", "}", "\n\n", "// Delete the current zfs.pool_name key", "_", ",", "err", "=", "tx", ".", "Exec", "(", "`\nDELETE FROM storage_pools_config WHERE key='zfs.pool_name' AND storage_pool_id=? AND node_id IS NULL\n`", ",", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Add zfs.pool_name config entry for each node", "for", "_", ",", "nodeID", ":=", "range", "nodeIDs", "{", "_", ",", "err", ":=", "tx", ".", "Exec", "(", "`\nINSERT INTO storage_pools_config(storage_pool_id, node_id, key, value)\n VALUES(?, ?, 'zfs.pool_name', ?)\n`", ",", "poolID", ",", "nodeID", ",", "poolName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
21,242
all-21243
[ "In", "returns", "true", "if", "(", "x", "y", ")", "is", "in", "the", "sprite", "and", "false", "otherwise", "." ]
[ "func", "(", "s", "*", "Sprite", ")", "In", "(", "x", ",", "y", "int", ")", "bool", "{", "// Check the actual color (alpha) value at the specified position", "// so that the result of In becomes natural to users.", "//", "// Note that this is not a good manner to use At for logic", "// since color from At might include some errors on some machines.", "// As this is not so important logic, it's ok to use it so far.", "return", "s", ".", "<mask>", ".", "At", "(", "x", "-", "s", ".", "x", ",", "y", "-", "s", ".", "y", ")", ".", "(", "color", ".", "RGBA", ")", ".", "A", ">", "0", "\n", "}" ]
21,243
all-21244
[ "SetBg", "sets", "background", "color" ]
[ "func", "(", "i", "*", "IrcText", ")", "SetBg", "(", "c", "int", ")", "*", "IrcText", "{", "i", ".", "bgColor", "=", "c", "\n", "<mask>", "i", "\n", "}" ]
21,244
all-21245
[ "RouterHandler", "implements", "the", "httprouter", ".", "Handle", "for", "integration", "with", "github", ".", "com", "/", "julienschmidt", "/", "httprouter" ]
[ "func", "(", "a", "*", "Auth", ")", "RouterHandler", "(", "h", "httprouter", ".", "Handle", ")", "httprouter", ".", "Handle", "{", "return", "httprouter", ".", "Handle", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "ps", "httprouter", ".", "Params", ")", "{", "// Let secure process the request. If it returns an error,", "// that indicates the request should not continue.", "if", "err", ":=", "a", ".", "Process", "(", "w", ",", "r", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "h", "(", "w", ",", "r", ",", "<mask>", ")", "\n", "}", ")", "\n", "}" ]
21,245
all-21246
[ "convertFromDetectedCharset", "attempts", "to", "detect", "the", "character", "set", "for", "the", "given", "part", "and", "returns", "an", "io", ".", "Reader", "that", "will", "convert", "from", "that", "charset", "to", "UTF", "-", "8", ".", "If", "the", "charset", "cannot", "be", "detected", "this", "method", "adds", "a", "warning", "to", "the", "part", "and", "automatically", "falls", "back", "to", "using", "convertFromStatedCharset", "and", "returns", "the", "reader", "from", "that", "method", "." ]
[ "func", "(", "p", "*", "Part", ")", "convertFromDetectedCharset", "(", "r", "io", ".", "Reader", ")", "(", "io", ".", "Reader", ",", "error", ")", "{", "// Attempt to detect character set from part content.", "var", "cd", "*", "chardet", ".", "Detector", "\n", "switch", "p", ".", "ContentType", "{", "case", "\"", "\"", ":", "cd", "=", "chardet", ".", "NewHtmlDetector", "(", ")", "\n", "default", ":", "cd", "=", "chardet", ".", "NewTextDetector", "(", ")", "\n", "}", "\n\n", "buf", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "WithStack", "(", "err", ")", "\n", "}", "\n\n", "cs", ",", "err", ":=", "cd", ".", "DetectBest", "(", "buf", ")", "\n", "switch", "err", "{", "case", "nil", ":", "// Carry on", "case", "chardet", ".", "NotDetectedError", ":", "p", ".", "addWarning", "(", "ErrorCharsetDeclaration", ",", "\"", "\"", ",", "err", ")", "\n", "default", ":", "return", "nil", ",", "errors", ".", "WithStack", "(", "err", ")", "\n", "}", "\n\n", "// Restore r.", "r", "=", "bytes", ".", "NewReader", "(", "buf", ")", "\n\n", "if", "cs", "==", "nil", "||", "<mask>", ".", "Confidence", "<", "minCharsetConfidence", "{", "// Low confidence, use declared character set.", "return", "p", ".", "convertFromStatedCharset", "(", "r", ")", ",", "nil", "\n", "}", "\n\n", "// Confidence exceeded our threshold, use detected character set.", "if", "p", ".", "Charset", "!=", "\"", "\"", "&&", "!", "strings", ".", "EqualFold", "(", "cs", ".", "Charset", ",", "p", ".", "Charset", ")", "{", "p", ".", "addWarning", "(", "ErrorCharsetDeclaration", ",", "\"", "\"", ",", "p", ".", "Charset", ",", "cs", ".", "Charset", ",", "cs", ".", "Confidence", ")", "\n", "}", "\n\n", "reader", ",", "err", ":=", "coding", ".", "NewCharsetReader", "(", "cs", ".", "Charset", ",", "r", ")", "\n", "if", "err", "!=", "nil", "{", "// Failed to get a conversion reader.", "p", ".", "addWarning", "(", "ErrorCharsetConversion", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "else", "{", "r", "=", "reader", "\n", "p", ".", "OrigCharset", "=", "p", ".", "Charset", "\n", "p", ".", "Charset", "=", "cs", ".", "Charset", "\n", "}", "\n\n", "return", "r", ",", "nil", "\n", "}" ]
21,246
all-21247
[ "New", "creates", "a", "new", "instance", "of", "Templates", "and", "parses", "provided", "files", "and", "strings", "." ]
[ "func", "New", "(", "opts", "...", "Option", ")", "(", "t", "*", "Templates", ",", "err", "error", ")", "{", "functions", ":=", "template", ".", "FuncMap", "{", "}", "\n", "for", "name", ",", "fn", ":=", "range", "defaultFunctions", "{", "functions", "[", "name", "]", "=", "fn", "\n", "}", "\n", "o", ":=", "&", "Options", "{", "fileFindFunc", ":", "func", "(", "f", "string", ")", "string", "{", "return", "f", "\n", "}", ",", "fileReadFunc", ":", "ioutil", ".", "ReadFile", ",", "files", ":", "map", "[", "string", "]", "[", "]", "string", "{", "}", ",", "functions", ":", "functions", ",", "delimOpen", ":", "\"", "\"", ",", "delimClose", ":", "\"", "\"", ",", "logf", ":", "log", ".", "Printf", ",", "}", "\n", "for", "_", ",", "opt", ":=", "range", "opts", "{", "opt", "(", "o", ")", "\n", "}", "\n\n", "t", "=", "&", "Templates", "{", "templates", ":", "map", "[", "string", "]", "*", "template", ".", "Template", "{", "}", ",", "contentType", ":", "o", ".", "contentType", ",", "logf", ":", "o", ".", "logf", ",", "}", "\n", "for", "name", ",", "strings", ":=", "range", "o", ".", "strings", "{", "tpl", ",", "err", ":=", "parseStrings", "(", "template", ".", "New", "(", "\"", "\"", ")", ".", "Funcs", "(", "o", ".", "functions", ")", ".", "Delims", "(", "o", ".", "delimOpen", ",", "o", ".", "delimClose", ")", ",", "strings", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "t", ".", "templates", "[", "name", "]", "=", "tpl", "\n", "}", "\n", "for", "name", ",", "files", ":=", "range", "o", ".", "files", "{", "fs", ":=", "[", "]", "string", "{", "}", "\n", "for", "_", ",", "f", ":=", "range", "files", "{", "<mask>", "=", "append", "(", "fs", ",", "o", ".", "fileFindFunc", "(", "f", ")", ")", "\n", "}", "\n", "tpl", ",", "err", ":=", "parseFiles", "(", "o", ".", "fileReadFunc", ",", "template", ".", "New", "(", "\"", "\"", ")", ".", "Funcs", "(", "o", ".", "functions", ")", ".", "Delims", "(", "o", ".", "delimOpen", ",", "o", ".", "delimClose", ")", ",", "fs", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "t", ".", "templates", "[", "name", "]", "=", "tpl", "\n", "}", "\n", "return", "\n", "}" ]
21,247
all-21248
[ "Campaign", "causes", "this", "RawNode", "to", "transition", "to", "candidate", "state", "." ]
[ "func", "(", "rn", "*", "RawNode", ")", "Campaign", "(", ")", "error", "{", "return", "rn", ".", "raft", ".", "Step", "(", "pb", ".", "Message", "{", "<mask>", ":", "pb", ".", "MsgHup", ",", "}", ")", "\n", "}" ]
21,248
all-21249
[ "pushNumberValue", "pushes", "the", "number", "resulting", "from", "an", "arithmetic", "operation", ".", "At", "least", "one", "operand", "must", "be", "a", "proxy", "for", "this", "function", "to", "be", "called", ".", "See", "the", "main", "documentation", "for", "the", "conversion", "rules", "." ]
[ "func", "pushNumberValue", "(", "L", "*", "lua", ".", "State", ",", "a", "interface", "{", "}", ",", "t1", ",", "t2", "reflect", ".", "<mask>", ")", "{", "v", ":=", "reflect", ".", "ValueOf", "(", "a", ")", "\n", "isComplex", ":=", "unsizedKind", "(", "v", ")", "==", "reflect", ".", "Complex128", "\n", "mt", ":=", "cNumberMeta", "\n", "if", "isComplex", "{", "mt", "=", "cComplexMeta", "\n", "}", "\n", "if", "t1", "==", "t2", "||", "isPredeclaredType", "(", "t2", ")", "{", "makeValueProxy", "(", "L", ",", "v", ".", "Convert", "(", "t1", ")", ",", "mt", ")", "\n", "}", "else", "if", "isPredeclaredType", "(", "t1", ")", "{", "makeValueProxy", "(", "L", ",", "v", ".", "Convert", "(", "t2", ")", ",", "mt", ")", "\n", "}", "else", "if", "isComplex", "{", "complexType", ":=", "reflect", ".", "TypeOf", "(", "0i", ")", "\n", "makeValueProxy", "(", "L", ",", "v", ".", "Convert", "(", "complexType", ")", ",", "cComplexMeta", ")", "\n", "}", "else", "{", "L", ".", "PushNumber", "(", "valueToNumber", "(", "L", ",", "v", ")", ")", "\n", "}", "\n", "}" ]
21,249
all-21250
[ "Transaction", "executes", "the", "given", "function", "within", "a", "database", "transaction", "." ]
[ "func", "Transaction", "(", "db", "*", "sql", ".", "<mask>", ",", "f", "func", "(", "*", "sql", ".", "Tx", ")", "error", ")", "error", "{", "tx", ",", "err", ":=", "db", ".", "Begin", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "err", "=", "f", "(", "tx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "rollback", "(", "tx", ",", "err", ")", "\n", "}", "\n\n", "err", "=", "tx", ".", "Commit", "(", ")", "\n", "if", "err", "==", "sql", ".", "ErrTxDone", "{", "err", "=", "nil", "// Ignore duplicate commits/rollbacks", "\n", "}", "\n", "return", "err", "\n", "}" ]
21,250
all-21251
[ "GetMetadata", "indicates", "an", "expected", "call", "of", "GetMetadata" ]
[ "func", "(", "mr", "*", "MockEC2MetadataClientMockRecorder", ")", "GetMetadata", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockEC2MetadataClient", ")", "(", "nil", ")", ".", "GetMetadata", ")", ",", "arg0", ")", "\n", "}" ]
21,251
all-21252
[ "InjectEntrypoint", "will", "make", "the", "entrypoint", "binary", "in", "the", "tools", "volume", "the", "container", "s", "entrypoint", "which", "will", "output", "to", "the", "log", "volume", "." ]
[ "func", "InjectEntrypoint", "(", "c", "*", "coreapi", ".", "Container", ",", "timeout", ",", "gracePeriod", "time", ".", "Duration", ",", "prefix", ",", "previousMarker", "string", ",", "exitZero", "bool", ",", "log", ",", "tools", "coreapi", ".", "VolumeMount", ")", "(", "*", "wrapper", ".", "Options", ",", "error", ")", "{", "wrapperOptions", ":=", "&", "<mask>", ".", "Options", "{", "Args", ":", "append", "(", "c", ".", "Command", ",", "c", ".", "Args", "...", ")", ",", "ProcessLog", ":", "processLog", "(", "log", ",", "prefix", ")", ",", "MarkerFile", ":", "markerFile", "(", "log", ",", "prefix", ")", ",", "MetadataFile", ":", "metadataFile", "(", "log", ",", "prefix", ")", ",", "}", "\n", "// TODO(fejta): use flags", "entrypointConfigEnv", ",", "err", ":=", "entrypoint", ".", "Encode", "(", "entrypoint", ".", "Options", "{", "ArtifactDir", ":", "artifactsDir", "(", "log", ")", ",", "GracePeriod", ":", "gracePeriod", ",", "Options", ":", "wrapperOptions", ",", "Timeout", ":", "timeout", ",", "AlwaysZero", ":", "exitZero", ",", "PreviousMarker", ":", "previousMarker", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "c", ".", "Command", "=", "[", "]", "string", "{", "entrypointLocation", "(", "tools", ")", "}", "\n", "c", ".", "Args", "=", "nil", "\n", "c", ".", "Env", "=", "append", "(", "c", ".", "Env", ",", "kubeEnv", "(", "map", "[", "string", "]", "string", "{", "entrypoint", ".", "JSONConfigEnvVar", ":", "entrypointConfigEnv", "}", ")", "...", ")", "\n", "c", ".", "VolumeMounts", "=", "append", "(", "c", ".", "VolumeMounts", ",", "log", ",", "tools", ")", "\n", "return", "wrapperOptions", ",", "nil", "\n", "}" ]
21,252
all-21253
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetFlattenedDocumentReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom42", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,253
all-21254
[ "WithPierce", "whether", "or", "not", "iframes", "and", "shadow", "roots", "should", "be", "traversed", "when", "returning", "the", "subtree", "(", "default", "is", "false", ")", ".", "Reports", "listeners", "for", "all", "contexts", "if", "pierce", "is", "enabled", "." ]
[ "func", "(", "p", "GetEventListenersParams", ")", "WithPierce", "(", "pierce", "bool", ")", "*", "GetEventListenersParams", "{", "p", ".", "Pierce", "=", "pierce", "\n", "<mask>", "&", "p", "\n", "}" ]
21,254
all-21255
[ "lockAndFlushAll", "is", "like", "flushAll", "but", "locks", "l", ".", "mu", "first", "." ]
[ "func", "(", "l", "*", "<mask>", ")", "lockAndFlushAll", "(", ")", "{", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "l", ".", "flushAll", "(", ")", "\n", "l", ".", "mu", ".", "Unlock", "(", ")", "\n", "}" ]
21,255
all-21256
[ "recordWrite", "records", "that", "a", "directory", "has", "been", "modified", "and", "that", "its", "build", "file", "should", "be", "updated", "the", "next", "time", "gazelle", "runs", "." ]
[ "func", "recordWrite", "(", "path", "string", ")", "{", "dirSetMutex", ".", "Lock", "(", ")", "\n", "defer", "dirSetMutex", ".", "Unlock", "(", ")", "\n", "dirSet", "[", "<mask>", "]", "=", "true", "\n", "}" ]
21,256
all-21257
[ "ToMessage", "generates", "a", "PubSub", "Message", "from", "a", "PeriodicProwJobEvent", "." ]
[ "func", "(", "pe", "*", "PeriodicProwJobEvent", ")", "ToMessage", "(", ")", "(", "*", "pubsub", ".", "Message", ",", "error", ")", "{", "data", ",", "err", ":=", "json", ".", "Marshal", "(", "pe", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "message", ":=", "pubsub", ".", "<mask>", "{", "Data", ":", "data", ",", "Attributes", ":", "map", "[", "string", "]", "string", "{", "prowEventType", ":", "periodicProwJobEvent", ",", "}", ",", "}", "\n", "return", "&", "message", ",", "nil", "\n", "}" ]
21,257
all-21258
[ "killCgroupProcesses", "freezes", "then", "iterates", "over", "all", "the", "processes", "inside", "the", "manager", "s", "cgroups", "sending", "a", "SIGKILL", "to", "each", "process", "then", "waiting", "for", "them", "to", "exit", "." ]
[ "func", "killCgroupProcesses", "(", "m", "cgroups", ".", "Manager", ")", "error", "{", "var", "procs", "[", "]", "*", "os", ".", "Process", "\n", "if", "err", ":=", "m", ".", "Freeze", "(", "configs", ".", "Frozen", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "Warn", "(", "err", ")", "\n", "}", "\n", "pids", ",", "err", ":=", "m", ".", "GetPids", "(", ")", "\n", "if", "err", "!=", "nil", "{", "m", ".", "Freeze", "(", "configs", ".", "Thawed", ")", "\n", "return", "err", "\n", "}", "\n", "for", "_", ",", "pid", ":=", "range", "pids", "{", "if", "p", ",", "err", ":=", "os", ".", "FindProcess", "(", "pid", ")", ";", "err", "==", "nil", "{", "procs", "=", "<mask>", "(", "procs", ",", "p", ")", "\n", "if", "err", ":=", "p", ".", "Kill", "(", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "Warn", "(", "err", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "m", ".", "Freeze", "(", "configs", ".", "Thawed", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "Warn", "(", "err", ")", "\n", "}", "\n", "for", "_", ",", "p", ":=", "range", "procs", "{", "if", "_", ",", "err", ":=", "p", ".", "Wait", "(", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "Warn", "(", "err", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,258
all-21259
[ "Append", "point" ]
[ "func", "(", "p", "*", "Points", ")", "Append", "(", "onePoint", "Point", ")", "*", "Points", "{", "p", ".", "Data", "=", "<mask>", "(", "p", ".", "Data", ",", "onePoint", ")", "\n", "return", "p", "\n", "}" ]
21,259
all-21260
[ "New", "article" ]
[ "func", "New", "(", "c", "*", "gin", ".", "<mask>", ")", "{", "article", ":=", "models", ".", "Article", "{", "}", "\n\n", "c", ".", "HTML", "(", "http", ".", "StatusOK", ",", "\"", "\"", ",", "gin", ".", "H", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "article", ",", "}", ")", "\n", "}" ]
21,260
all-21261
[ "Build", "constructs", "a", "double", "array", "from", "given", "keywords", "." ]
[ "func", "Build", "(", "keywords", "[", "]", "string", ")", "(", "DoubleArray", ",", "error", ")", "{", "s", ":=", "len", "(", "keywords", ")", "\n", "if", "s", "==", "0", "{", "return", "DoubleArray", "{", "}", ",", "nil", "\n", "}", "\n", "ids", ":=", "make", "(", "[", "]", "int", ",", "s", ",", "s", ")", "\n", "for", "i", ":=", "range", "<mask>", "{", "ids", "[", "i", "]", "=", "i", "+", "1", "\n", "}", "\n", "return", "BuildWithIDs", "(", "keywords", ",", "ids", ")", "\n", "}" ]
21,261
all-21262
[ "Exec", "executes", "the", "XPath", "expression", "xp", "against", "the", "tree", "t", "with", "the", "namespace", "mappings", "ns", "and", "returns", "the", "result", "as", "a", "stringer", "." ]
[ "func", "(", "xp", "XPathExec", ")", "Exec", "(", "t", "tree", ".", "Node", ",", "opts", "...", "FuncOpts", ")", "(", "tree", ".", "Result", ",", "error", ")", "{", "o", ":=", "&", "Opts", "{", "NS", ":", "make", "(", "map", "[", "string", "]", "string", ")", ",", "Funcs", ":", "make", "(", "map", "[", "xml", ".", "Name", "]", "tree", ".", "Wrap", ")", ",", "Vars", ":", "<mask>", "(", "map", "[", "string", "]", "tree", ".", "Result", ")", ",", "}", "\n", "for", "_", ",", "i", ":=", "range", "opts", "{", "i", "(", "o", ")", "\n", "}", "\n", "return", "execxp", ".", "Exec", "(", "xp", ".", "n", ",", "t", ",", "o", ".", "NS", ",", "o", ".", "Funcs", ",", "o", ".", "Vars", ")", "\n", "}" ]
21,262
all-21263
[ "flattenClusterDasVmConfigInfo", "saves", "a", "ClusterDasVmConfigInfo", "into", "the", "supplied", "ResourceData", "." ]
[ "func", "flattenClusterDasVMConfigInfo", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ",", "obj", "*", "types", ".", "ClusterDasVmConfigInfo", ")", "error", "{", "client", ",", "err", ":=", "resourceVSphereHAVMOverrideClient", "(", "meta", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "version", ":=", "viapi", ".", "ParseVersionFromClient", "(", "client", ")", "\n\n", "// Set ha_vm_monitoring_use_cluster_defaults here as it's not included in the", "// base vsphere_compute_cluster resource.", "if", "err", ":=", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "DasSettings", ".", "VmToolsMonitoringSettings", ".", "ClusterSettings", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "flattenClusterDasVMSettings", "(", "d", ",", "obj", ".", "DasSettings", ",", "<mask>", ")", "\n", "}" ]
21,263
all-21264
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetMetadataReturns", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb11", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
21,264
all-21265
[ "WithApp", "adds", "the", "app", "to", "the", "get", "apps", "app", "routes", "route", "params" ]
[ "func", "(", "o", "*", "GetAppsAppRoutesRouteParams", ")", "WithApp", "(", "app", "<mask>", ")", "*", "GetAppsAppRoutesRouteParams", "{", "o", ".", "SetApp", "(", "app", ")", "\n", "return", "o", "\n", "}" ]
21,265
all-21266
[ "GetContainerBackup", "returns", "a", "Backup", "struct", "for", "the", "provided", "container", "and", "backup", "names" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetContainerBackup", "(", "containerName", "string", ",", "name", "string", ")", "(", "*", "api", ".", "ContainerBackup", ",", "string", ",", "error", ")", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "nil", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "// Fetch the raw value", "backup", ":=", "api", ".", "ContainerBackup", "{", "}", "\n", "etag", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ".", "QueryEscape", "(", "containerName", ")", ",", "url", ".", "QueryEscape", "(", "name", ")", ")", ",", "nil", ",", "\"", "\"", ",", "&", "backup", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "&", "backup", ",", "etag", ",", "nil", "\n", "}" ]
21,266
all-21267
[ "List", "implements", "ClientInterface" ]
[ "func", "(", "c", "*", "dummyClient", ")", "List", "(", "opts", "v1", ".", "ListOptions", ")", "(", "Collection", ",", "error", ")", "{", "var", "items", "[", "]", "Object", "\n", "for", "_", ",", "i", ":=", "range", "c", ".", "objects", "{", "items", "=", "append", "(", "<mask>", ",", "i", ")", "\n", "}", "\n", "r", ":=", "c", ".", "NewCollection", "(", ")", "\n", "r", ".", "SetItems", "(", "items", ")", "\n", "return", "r", ",", "nil", "\n", "}" ]
21,267
all-21268
[ "ListPRCommits", "lists", "commits", "for", "a", "given", "PR", "." ]
[ "func", "(", "f", "*", "FakeClient", ")", "ListPRCommits", "(", "org", ",", "repo", "<mask>", ",", "prNumber", "int", ")", "(", "[", "]", "github", ".", "RepositoryCommit", ",", "error", ")", "{", "k", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "prNumber", ")", "\n", "return", "f", ".", "CommitMap", "[", "k", "]", ",", "nil", "\n", "}" ]
21,268
all-21269
[ "HasLineWidth", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TimeseriesRequestStyle", ")", "HasLineWidth", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "LineWidth", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
21,269
all-21270
[ "NewLexer", "creates", "a", "new", "Lexer", "reading", "from", "io", ".", "Reader", ".", "This", "Lexer", "has", "a", "DefaultTokenizer", "according", "to", "posix", "and", "whitespacesplit", "rules", "." ]
[ "func", "NewLexer", "(", "r", "<mask>", ".", "Reader", ",", "posix", ",", "whitespacesplit", "bool", ")", "*", "Lexer", "{", "return", "&", "Lexer", "{", "reader", ":", "bufio", ".", "NewReader", "(", "r", ")", ",", "tokenizer", ":", "&", "DefaultTokenizer", "{", "}", ",", "posix", ":", "posix", ",", "whitespacesplit", ":", "whitespacesplit", ",", "}", "\n", "}" ]
21,270
all-21271
[ "GetSyntheticsBrowserDevices", "get", "all", "test", "devices", "(", "for", "browser", ")" ]
[ "func", "(", "client", "*", "Client", ")", "GetSyntheticsBrowserDevices", "(", ")", "(", "[", "]", "SyntheticsDevice", ",", "error", ")", "{", "<mask>", "out", "struct", "{", "Devices", "[", "]", "SyntheticsDevice", "`json:\"devices,omitempty\"`", "\n", "}", "\n\n", "if", "err", ":=", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "&", "out", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "out", ".", "Devices", ",", "nil", "\n", "}" ]
21,271
all-21272
[ "Get", "takes", "name", "of", "the", "app", "and", "returns", "the", "corresponding", "app", "object", "and", "an", "error", "if", "there", "is", "any", "." ]
[ "func", "(", "c", "*", "apps", ")", "Get", "(", "name", "string", ",", "options", "meta_v1", ".", "GetOptions", ")", "(", "result", "*", "v1", ".", "App", ",", "err", "error", ")", "{", "result", "=", "&", "v1", ".", "App", "{", "}", "\n", "err", "=", "c", ".", "client", ".", "Get", "(", ")", ".", "Namespace", "(", "c", ".", "ns", ")", ".", "<mask>", "(", "\"", "\"", ")", ".", "Name", "(", "name", ")", ".", "VersionedParams", "(", "&", "options", ",", "scheme", ".", "ParameterCodec", ")", ".", "Do", "(", ")", ".", "Into", "(", "result", ")", "\n", "return", "\n", "}" ]
21,272
all-21273
[ "RegisterOptional", "register", "a", "new", "migration", "that", "will", "not", "run", "automatically", "when", "calling", "the", "Run", "funcition", "." ]
[ "func", "RegisterOptional", "(", "<mask>", "string", ",", "fn", "MigrateFunc", ")", "error", "{", "return", "register", "(", "name", ",", "true", ",", "fn", ")", "\n", "}" ]
21,273
all-21274
[ "ForRepo", "returns", "the", "tide", "queries", "that", "apply", "to", "a", "repo", "." ]
[ "func", "(", "qm", "*", "QueryMap", ")", "ForRepo", "(", "org", ",", "repo", "string", ")", "TideQueries", "{", "res", ":=", "TideQueries", "(", "nil", ")", "\n", "fullName", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ")", "\n\n", "qm", ".", "Lock", "(", ")", "\n", "defer", "qm", ".", "Unlock", "(", ")", "\n\n", "if", "qs", ",", "ok", ":=", "qm", ".", "cache", "[", "fullName", "]", ";", "ok", "{", "return", "append", "(", "res", ",", "qs", "...", ")", "// Return a copy.", "\n", "}", "\n", "// Cache miss. Need to determine relevant queries.", "for", "_", ",", "query", ":=", "range", "qm", ".", "queries", "{", "if", "query", ".", "ForRepo", "(", "org", ",", "repo", ")", "{", "res", "=", "append", "(", "res", ",", "query", ")", "\n", "}", "\n", "}", "\n", "qm", ".", "cache", "[", "fullName", "]", "=", "<mask>", "\n", "return", "res", "\n", "}" ]
21,274
all-21275
[ "RootPath", "returns", "a", "path", "of", "the", "root", "package", "." ]
[ "func", "RootPath", "(", ")", "string", "{", "_", ",", "file", ",", "_", ",", "<mask>", ":=", "runtime", ".", "Caller", "(", "0", ")", "\n", "if", "!", "ok", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "filepath", ".", "Dir", "(", "filepath", ".", "Dir", "(", "file", ")", ")", "\n", "}" ]
21,275
all-21276
[ "DatumTagPrefix", "hashes", "a", "pipeline", "salt", "to", "a", "string", "of", "a", "fixed", "size", "for", "use", "as", "the", "prefix", "for", "datum", "output", "trees", ".", "This", "prefix", "allows", "us", "to", "do", "garbage", "collection", "correctly", "." ]
[ "func", "DatumTagPrefix", "(", "salt", "string", ")", "string", "{", "// We need to hash the salt because UUIDs are not necessarily", "// random in every bit.", "h", ":=", "sha256", ".", "New", "(", ")", "\n", "h", ".", "Write", "(", "[", "]", "<mask>", "(", "salt", ")", ")", "\n", "return", "hex", ".", "EncodeToString", "(", "h", ".", "Sum", "(", "nil", ")", ")", "[", ":", "4", "]", "\n", "}" ]
21,276
all-21277
[ "Eval", "runs", "a", "single", "evaluation", "cycle", "in", "which", "all", "rules", "are", "evaluated", "sequentially", "." ]
[ "func", "(", "g", "*", "Group", ")", "Eval", "(", "ctx", "context", ".", "Context", ",", "ts", "time", ".", "Time", ")", "{", "for", "i", ",", "rule", ":=", "range", "g", ".", "rules", "{", "select", "{", "case", "<-", "g", ".", "done", ":", "return", "\n", "default", ":", "}", "\n\n", "func", "(", "i", "int", ",", "rule", "Rule", ")", "{", "sp", ",", "ctx", ":=", "opentracing", ".", "StartSpanFromContext", "(", "ctx", ",", "\"", "\"", ")", "\n", "sp", ".", "SetTag", "(", "\"", "\"", ",", "rule", ".", "Name", "(", ")", ")", "\n", "defer", "func", "(", "t", "time", ".", "Time", ")", "{", "sp", ".", "Finish", "(", ")", "\n\n", "since", ":=", "<mask>", ".", "Since", "(", "t", ")", "\n", "g", ".", "metrics", ".", "evalDuration", ".", "Observe", "(", "since", ".", "Seconds", "(", ")", ")", "\n", "rule", ".", "SetEvaluationDuration", "(", "since", ")", "\n", "rule", ".", "SetEvaluationTimestamp", "(", "t", ")", "\n", "}", "(", "time", ".", "Now", "(", ")", ")", "\n\n", "g", ".", "metrics", ".", "evalTotal", ".", "Inc", "(", ")", "\n\n", "vector", ",", "err", ":=", "rule", ".", "Eval", "(", "ctx", ",", "ts", ",", "g", ".", "opts", ".", "QueryFunc", ",", "g", ".", "opts", ".", "ExternalURL", ")", "\n", "if", "err", "!=", "nil", "{", "// Canceled queries are intentional termination of queries. This normally", "// happens on shutdown and thus we skip logging of any errors here.", "if", "_", ",", "ok", ":=", "err", ".", "(", "promql", ".", "ErrQueryCanceled", ")", ";", "!", "ok", "{", "level", ".", "Warn", "(", "g", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "rule", ",", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "g", ".", "metrics", ".", "evalFailures", ".", "Inc", "(", ")", "\n", "return", "\n", "}", "\n\n", "if", "ar", ",", "ok", ":=", "rule", ".", "(", "*", "AlertingRule", ")", ";", "ok", "{", "ar", ".", "sendAlerts", "(", "ctx", ",", "ts", ",", "g", ".", "opts", ".", "ResendDelay", ",", "g", ".", "interval", ",", "g", ".", "opts", ".", "NotifyFunc", ")", "\n", "}", "\n", "var", "(", "numOutOfOrder", "=", "0", "\n", "numDuplicates", "=", "0", "\n", ")", "\n\n", "app", ",", "err", ":=", "g", ".", "opts", ".", "Appendable", ".", "Appender", "(", ")", "\n", "if", "err", "!=", "nil", "{", "level", ".", "Warn", "(", "g", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "seriesReturned", ":=", "make", "(", "map", "[", "string", "]", "labels", ".", "Labels", ",", "len", "(", "g", ".", "seriesInPreviousEval", "[", "i", "]", ")", ")", "\n", "for", "_", ",", "s", ":=", "range", "vector", "{", "if", "_", ",", "err", ":=", "app", ".", "Add", "(", "s", ".", "Metric", ",", "s", ".", "T", ",", "s", ".", "V", ")", ";", "err", "!=", "nil", "{", "switch", "err", "{", "case", "storage", ".", "ErrOutOfOrderSample", ":", "numOutOfOrder", "++", "\n", "level", ".", "Debug", "(", "g", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", ",", "\"", "\"", ",", "s", ")", "\n", "case", "storage", ".", "ErrDuplicateSampleForTimestamp", ":", "numDuplicates", "++", "\n", "level", ".", "Debug", "(", "g", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", ",", "\"", "\"", ",", "s", ")", "\n", "default", ":", "level", ".", "Warn", "(", "g", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", ",", "\"", "\"", ",", "s", ")", "\n", "}", "\n", "}", "else", "{", "seriesReturned", "[", "s", ".", "Metric", ".", "String", "(", ")", "]", "=", "s", ".", "Metric", "\n", "}", "\n", "}", "\n", "if", "numOutOfOrder", ">", "0", "{", "level", ".", "Warn", "(", "g", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "numOutOfOrder", ")", "\n", "}", "\n", "if", "numDuplicates", ">", "0", "{", "level", ".", "Warn", "(", "g", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "numDuplicates", ")", "\n", "}", "\n\n", "for", "metric", ",", "lset", ":=", "range", "g", ".", "seriesInPreviousEval", "[", "i", "]", "{", "if", "_", ",", "ok", ":=", "seriesReturned", "[", "metric", "]", ";", "!", "ok", "{", "// Series no longer exposed, mark it stale.", "_", ",", "err", "=", "app", ".", "Add", "(", "lset", ",", "timestamp", ".", "FromTime", "(", "ts", ")", ",", "math", ".", "Float64frombits", "(", "value", ".", "StaleNaN", ")", ")", "\n", "switch", "err", "{", "case", "nil", ":", "case", "storage", ".", "ErrOutOfOrderSample", ",", "storage", ".", "ErrDuplicateSampleForTimestamp", ":", "// Do not count these in logging, as this is expected if series", "// is exposed from a different rule.", "default", ":", "level", ".", "Warn", "(", "g", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "metric", ",", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "app", ".", "Commit", "(", ")", ";", "err", "!=", "nil", "{", "level", ".", "Warn", "(", "g", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", ")", "\n", "}", "else", "{", "g", ".", "seriesInPreviousEval", "[", "i", "]", "=", "seriesReturned", "\n", "}", "\n", "}", "(", "i", ",", "rule", ")", "\n", "}", "\n", "}" ]
21,277
all-21278
[ "Analyze", "iterate", "through", "all", "resources", "and", "initializes", "the", "Resources", "and", "ParamTypes", "fields", "of", "the", "APIAnalyzer", "struct", "accordingly", "." ]
[ "func", "(", "a", "*", "APIAnalyzer", ")", "Analyze", "(", ")", "*", "gen", ".", "APIDescriptor", "{", "a", ".", "AnalyzeAliases", "(", ")", "\n", "var", "descriptor", "=", "&", "<mask>", ".", "APIDescriptor", "{", "Resources", ":", "make", "(", "map", "[", "string", "]", "*", "gen", ".", "Resource", ")", ",", "Types", ":", "make", "(", "map", "[", "string", "]", "*", "gen", ".", "ObjectDataType", ")", ",", "}", "\n", "var", "rawResourceNames", "=", "make", "(", "[", "]", "string", ",", "len", "(", "a", ".", "rawResources", ")", ")", "\n", "var", "idx", "=", "0", "\n", "for", "n", ":=", "range", "a", ".", "rawResources", "{", "rawResourceNames", "[", "idx", "]", "=", "n", "\n", "idx", "++", "\n", "}", "\n", "sort", ".", "Strings", "(", "rawResourceNames", ")", "\n", "for", "_", ",", "name", ":=", "range", "rawResourceNames", "{", "var", "resource", "=", "a", ".", "rawResources", "[", "name", "]", "\n", "a", ".", "AnalyzeResource", "(", "name", ",", "resource", ",", "descriptor", ")", "\n", "}", "\n", "descriptor", ".", "FinalizeTypeNames", "(", "a", ".", "rawTypes", ")", "\n", "return", "descriptor", "\n", "}" ]
21,278
all-21279
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventMediaQueryResultChanged", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss54", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
21,279
all-21280
[ "gtk_action_bar_pack_start", "(", "GtkActionBar", "*", "action_bar", "GtkWidget", "*", "child", ")" ]
[ "func", "(", "a", "*", "ActionBar", ")", "PackStart", "(", "child", "IWidget", ")", "{", "C", ".", "gtk_action_bar_pack_start", "(", "a", ".", "native", "(", ")", ",", "<mask>", ".", "toWidget", "(", ")", ")", "\n", "}" ]
21,280
all-21281
[ "ContainerList", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockClient", ")", "ContainerList", "(", "arg0", "context", ".", "Context", ",", "arg1", "types", ".", "ContainerListOptions", ")", "(", "[", "]", "types", ".", "<mask>", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "[", "]", "types", ".", "Container", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
21,281
all-21282
[ "ClientConfig", "is", "a", "modified", "copy", "of", "k8s", ".", "io", "/", "kubernetes", "/", "pkg", "/", "client", "/", "unversioned", "/", "clientcmd", ".", "DirectClientConfig", ".", "ClientConfig", ".", "ClientConfig", "implements", "ClientConfig" ]
[ "func", "(", "config", "*", "directClientConfig", ")", "ClientConfig", "(", ")", "(", "*", "restConfig", ",", "error", ")", "{", "if", "err", ":=", "config", ".", "ConfirmUsable", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "configAuthInfo", ":=", "config", ".", "getAuthInfo", "(", ")", "\n", "configClusterInfo", ":=", "config", ".", "getCluster", "(", ")", "\n\n", "clientConfig", ":=", "&", "restConfig", "{", "}", "\n", "clientConfig", ".", "Host", "=", "configClusterInfo", ".", "Server", "\n", "if", "u", ",", "err", ":=", "<mask>", ".", "ParseRequestURI", "(", "clientConfig", ".", "Host", ")", ";", "err", "==", "nil", "&&", "u", ".", "Opaque", "==", "\"", "\"", "&&", "len", "(", "u", ".", "Path", ")", ">", "1", "{", "u", ".", "RawQuery", "=", "\"", "\"", "\n", "u", ".", "Fragment", "=", "\"", "\"", "\n", "clientConfig", ".", "Host", "=", "u", ".", "String", "(", ")", "\n", "}", "\n\n", "// only try to read the auth information if we are secure", "if", "isConfigTransportTLS", "(", "*", "clientConfig", ")", "{", "var", "err", "error", "\n\n", "// mergo is a first write wins for map value and a last writing wins for interface values", "// NOTE: This behavior changed with https://github.com/imdario/mergo/commit/d304790b2ed594794496464fadd89d2bb266600a.", "// Our mergo.Merge version is older than this change.", "// REMOVED: Support for interactive fallback.", "userAuthPartialConfig", ",", "err", ":=", "getUserIdentificationPartialConfig", "(", "configAuthInfo", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "mergo", ".", "Merge", "(", "clientConfig", ",", "userAuthPartialConfig", ")", "\n\n", "serverAuthPartialConfig", ",", "err", ":=", "getServerIdentificationPartialConfig", "(", "configAuthInfo", ",", "configClusterInfo", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "mergo", ".", "Merge", "(", "clientConfig", ",", "serverAuthPartialConfig", ")", "\n", "}", "\n\n", "return", "clientConfig", ",", "nil", "\n", "}" ]
21,282
all-21283
[ "DirectionTo", "returns", "the", "direction", "from", "p1", "to", "p2" ]
[ "func", "DirectionTo", "(", "p1", ",", "p2", "Point", ")", "Direction", "{", "bearing", ":=", "BearingTo", "(", "p1", ",", "p2", ")", "\n\n", "index", ":=", "bearing", "-", "22.5", "\n\n", "if", "index", "<", "0", "{", "<mask>", "+=", "360", "\n", "}", "\n", "indexInt", ":=", "int", "(", "index", "/", "45.0", ")", "\n\n", "return", "Direction", "(", "indexInt", ")", "\n", "}" ]
21,283
all-21284
[ "FetchGraph", "retrieves", "graph", "with", "passed", "cid", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchGraph", "(", "cid", "CIDType", ")", "(", "*", "Graph", ",", "error", ")", "{", "if", "cid", "==", "nil", "||", "*", "cid", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "graphCID", ":=", "string", "(", "*", "cid", ")", "\n\n", "matched", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "GraphCIDRegex", ",", "graphCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "graphCID", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "graphCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "result", ")", ")", "\n", "}", "\n\n", "graph", ":=", "new", "(", "Graph", ")", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "graph", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "<mask>", ",", "nil", "\n", "}" ]
21,284
all-21285
[ "SetLayer", "sets", "v", ".", "layer", "to", "l", ".", "Reference", ":", "https", ":", "//", "developer", ".", "apple", ".", "com", "/", "documentation", "/", "appkit", "/", "nsview", "/", "1483298", "-", "layer", "." ]
[ "func", "(", "v", "<mask>", ")", "SetLayer", "(", "l", "ca", ".", "Layer", ")", "{", "C", ".", "View_SetLayer", "(", "v", ".", "view", ",", "l", ".", "Layer", "(", ")", ")", "\n", "}" ]
21,285
all-21286
[ "SetTrackVisitedLinks", "is", "a", "wrapper", "around", "gtk_label_set_track_visited_links", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetTrackVisitedLinks", "(", "trackLinks", "bool", ")", "{", "C", ".", "gtk_label_set_track_visited_links", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "trackLinks", ")", ")", "\n", "}" ]
21,286
all-21287
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "TakePreciseCoverageParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoProfiler5", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
21,287
all-21288
[ "AddNodesToLoadBalancer", "adds", "nodes", "to", "an", "existing", "load", "balancer", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "AddNodesToLoadBalancer", "(", "loadBalancerID", "string", ",", "nodes", "[", "]", "LoadBalancerNode", ")", "(", "*", "LoadBalancer", ",", "error", ")", "{", "lb", ":=", "new", "(", "LoadBalancer", ")", "\n", "_", ",", "err", ":=", "c", ".", "MakeApiRequest", "(", "\"", "\"", ",", "\"", "\"", "+", "loadBalancerID", "+", "\"", "\"", ",", "nodes", ",", "&", "lb", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "lb", ",", "nil", "\n", "}" ]
21,288
all-21289
[ "UnmarshalJSON", "unmarshals", "this", "object", "from", "a", "JSON", "structure" ]
[ "func", "(", "m", "*", "Task", ")", "UnmarshalJSON", "(", "raw", "[", "]", "byte", ")", "error", "{", "var", "aO0", "NewTask", "\n", "if", "err", ":=", "swag", ".", "ReadJSON", "(", "raw", ",", "&", "aO0", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "m", ".", "NewTask", "=", "aO0", "\n\n", "<mask>", "aO1", "TaskAllOf1", "\n", "if", "err", ":=", "swag", ".", "ReadJSON", "(", "raw", ",", "&", "aO1", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "m", ".", "TaskAllOf1", "=", "aO1", "\n\n", "return", "nil", "\n", "}" ]
21,289
all-21290
[ "NewHealth", "creates", "a", "new", "health", "request", "multiplexer", "and", "starts", "serving", "the", "liveness", "endpoint", "on", "the", "given", "port" ]
[ "func", "NewHealth", "(", ")", "*", "Health", "{", "healthMux", ":=", "http", ".", "NewServeMux", "(", ")", "\n", "healthMux", ".", "HandleFunc", "(", "\"", "\"", ",", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "<mask>", ")", "{", "fmt", ".", "Fprint", "(", "w", ",", "\"", "\"", ")", "}", ")", "\n", "go", "func", "(", ")", "{", "logrus", ".", "WithError", "(", "http", ".", "ListenAndServe", "(", "\"", "\"", "+", "strconv", ".", "Itoa", "(", "healthPort", ")", ",", "healthMux", ")", ")", ".", "Fatal", "(", "\"", "\"", ")", "\n", "}", "(", ")", "\n", "return", "&", "Health", "{", "healthMux", ":", "healthMux", ",", "}", "\n", "}" ]
21,290
all-21291
[ "Stop", "the", "worker" ]
[ "func", "(", "w", "Simple", ")", "Stop", "(", ")", "<mask>", "{", "w", ".", "Logger", ".", "Info", "(", "\"", "\"", ")", "\n", "w", ".", "cancel", "(", ")", "\n", "return", "nil", "\n", "}" ]
21,291
all-21292
[ "flattenDVSSecurityPolicy", "reads", "various", "fields", "from", "a", "DVSSecurityPolicy", "into", "the", "passed", "in", "ResourceData", "." ]
[ "func", "flattenDVSSecurityPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "<mask>", ".", "DVSSecurityPolicy", ")", "error", "{", "if", "obj", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "structure", ".", "SetBoolPolicy", "(", "d", ",", "\"", "\"", ",", "obj", ".", "AllowPromiscuous", ")", "\n", "structure", ".", "SetBoolPolicy", "(", "d", ",", "\"", "\"", ",", "obj", ".", "MacChanges", ")", "\n", "structure", ".", "SetBoolPolicy", "(", "d", ",", "\"", "\"", ",", "obj", ".", "ForgedTransmits", ")", "\n", "return", "nil", "\n", "}" ]
21,292
all-21293
[ "String", "returns", "a", "string", "representation", "of", "v", "like", "(", "3", "4", ")", "." ]
[ "func", "(", "v", "Vec", ")", "<mask>", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "X", ",", "v", ".", "Y", ")", "\n", "}" ]
21,293
all-21294
[ "Seek", "implements", "y", ".", "Interface" ]
[ "func", "(", "s", "*", "UniIterator", ")", "Seek", "(", "key", "[", "]", "byte", ")", "{", "if", "!", "s", ".", "reversed", "{", "s", ".", "iter", ".", "Seek", "(", "<mask>", ")", "\n", "}", "else", "{", "s", ".", "iter", ".", "SeekForPrev", "(", "key", ")", "\n", "}", "\n", "}" ]
21,294
all-21295
[ "SlicesDeepEqual", "checks", "if", "slice1", "and", "slice2", "are", "equal", "disregarding", "order", "." ]
[ "func", "SlicesDeepEqual", "(", "slice1", ",", "slice2", "interface", "{", "}", ")", "bool", "{", "s1", ":=", "reflect", ".", "ValueOf", "(", "slice1", ")", "\n", "s2", ":=", "reflect", ".", "ValueOf", "(", "slice2", ")", "\n\n", "if", "s1", ".", "Len", "(", ")", "!=", "s2", ".", "Len", "(", ")", "{", "return", "false", "\n", "}", "\n", "if", "s1", ".", "Len", "(", ")", "==", "0", "{", "return", "true", "\n", "}", "\n\n", "s2found", ":=", "<mask>", "(", "[", "]", "int", ",", "s2", ".", "Len", "(", ")", ")", "\n", "OuterLoop", ":", "for", "i", ":=", "0", ";", "i", "<", "s1", ".", "Len", "(", ")", ";", "i", "++", "{", "s1el", ":=", "s1", ".", "Slice", "(", "i", ",", "i", "+", "1", ")", "\n", "for", "j", ":=", "0", ";", "j", "<", "s2", ".", "Len", "(", ")", ";", "j", "++", "{", "if", "s2found", "[", "j", "]", "==", "1", "{", "// We already counted this s2 element", "continue", "\n", "}", "\n", "s2el", ":=", "s2", ".", "Slice", "(", "j", ",", "j", "+", "1", ")", "\n", "if", "reflect", ".", "DeepEqual", "(", "s1el", ".", "Interface", "(", ")", ",", "s2el", ".", "Interface", "(", ")", ")", "{", "s2found", "[", "j", "]", "=", "1", "\n", "continue", "OuterLoop", "\n", "}", "\n", "}", "\n", "// Couldn't find something unused equal to s1", "return", "false", "\n", "}", "\n", "return", "true", "\n", "}" ]
21,295
all-21296
[ "GetIterAtMark", "()", "is", "a", "wrapper", "around", "gtk_text_buffer_get_iter_at_mark", "()", "." ]
[ "func", "(", "v", "*", "TextBuffer", ")", "GetIterAtMark", "(", "mark", "*", "TextMark", ")", "*", "TextIter", "{", "var", "iter", "C", ".", "GtkTextIter", "\n", "C", ".", "gtk_text_buffer_get_iter_at_mark", "(", "v", ".", "native", "(", ")", ",", "&", "iter", ",", "(", "*", "C", ".", "GtkTextMark", ")", "(", "<mask>", ")", ")", "\n", "return", "(", "*", "TextIter", ")", "(", "&", "iter", ")", "\n", "}" ]
21,296
all-21297
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetManifestForFrameReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache1", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
21,297
all-21298
[ "resourceVSphereDatastoreClusterVMAntiAffinityRuleFindEntry", "attempts", "to", "locate", "an", "existing", "VM", "anti", "-", "affinity", "rule", "in", "a", "datastore", "cluster", "s", "configuration", "by", "key", ".", "It", "s", "used", "by", "the", "resource", "s", "read", "functionality", "and", "tests", ".", "nil", "is", "returned", "if", "the", "entry", "cannot", "be", "found", "." ]
[ "func", "resourceVSphereDatastoreClusterVMAntiAffinityRuleFindEntry", "(", "pod", "*", "object", ".", "StoragePod", ",", "key", "int32", ",", ")", "(", "*", "types", ".", "ClusterAntiAffinityRuleSpec", ",", "error", ")", "{", "props", ",", "err", ":=", "storagepod", ".", "Properties", "(", "pod", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "for", "_", ",", "info", ":=", "range", "props", ".", "PodStorageDrsEntry", ".", "StorageDrsConfig", ".", "PodConfig", ".", "Rule", "{", "if", "<mask>", ".", "GetClusterRuleInfo", "(", ")", ".", "Key", "==", "key", "{", "if", "vmAntiAffinityRuleInfo", ",", "ok", ":=", "info", ".", "(", "*", "types", ".", "ClusterAntiAffinityRuleSpec", ")", ";", "ok", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "key", ",", "pod", ".", "Name", "(", ")", ")", "\n", "return", "vmAntiAffinityRuleInfo", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "key", ",", "pod", ".", "Name", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "key", ",", "pod", ".", "Name", "(", ")", ")", "\n", "return", "nil", ",", "nil", "\n", "}" ]
21,298
all-21299
[ "send", "to", "connection", "ensure", "only", "1", "concurrent", "sender" ]
[ "func", "(", "c", "*", "conn", ")", "send", "(", "upd", "*", "update", ")", "error", "{", "c", ".", "sendingMut", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "sendingMut", ".", "Unlock", "(", ")", "\n", "//send (transports responsiblity to enforce timeouts)", "return", "c", ".", "transport", ".", "<mask>", "(", "upd", ")", "\n", "}" ]
21,299
all-21300
[ "ReadB", "reads", "and", "returns", "a", "byte", "." ]
[ "func", "(", "r", "*", "Reader", ")", "ReadB", "(", ")", "byte", "{", "// ReadB as sig differs from ReadByte (vet issues)", "if", "r", ".", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "<mask>", "b", "byte", "\n", "b", ",", "r", ".", "err", "=", "r", ".", "rd", ".", "ReadByte", "(", ")", "\n", "r", ".", "cnt", "++", "\n", "return", "b", "\n", "}" ]