id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
900
all-901
[ "ParseReference", "converts", "a", "string", "which", "should", "not", "start", "with", "the", "ImageTransport", ".", "Name", "prefix", "into", "an", "ImageReference", "." ]
[ "func", "(", "t", "openshiftTransport", ")", "ParseReference", "(", "<mask>", "string", ")", "(", "types", ".", "ImageReference", ",", "error", ")", "{", "return", "ParseReference", "(", "reference", ")", "\n", "}" ]
901
all-902
[ "resourceVSphereDatastoreClusterApplyFolderChange", "applies", "any", "changes", "to", "a", "StoragePod", "s", "folder", "location", "." ]
[ "func", "resourceVSphereDatastoreClusterApplyFolderChange", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ",", "pod", "*", "<mask>", ".", "StoragePod", ",", ")", "(", "*", "object", ".", "StoragePod", ",", "error", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereDatastoreClusterIDString", "(", "d", ")", ",", "pod", ".", "InventoryPath", ",", ")", "\n\n", "var", "changed", "bool", "\n", "var", "err", "error", "\n\n", "if", "d", ".", "HasChange", "(", "\"", "\"", ")", "{", "f", ":=", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", "\n", "client", ":=", "meta", ".", "(", "*", "VSphereClient", ")", ".", "vimClient", "\n", "if", "err", "=", "storagepod", ".", "MoveToFolder", "(", "client", ",", "pod", ",", "f", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "f", ",", "err", ")", "\n", "}", "\n", "changed", "=", "true", "\n", "}", "\n\n", "if", "changed", "{", "// Update the pod so that we have the new inventory path for logging and", "// other things", "pod", ",", "err", "=", "resourceVSphereDatastoreClusterGetPod", "(", "d", ",", "meta", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereDatastoreClusterIDString", "(", "d", ")", ",", "pod", ".", "InventoryPath", ",", ")", "\n", "}", "\n\n", "return", "pod", ",", "nil", "\n", "}" ]
902
all-903
[ "On", "adds", "[", "LEFT", "]", "JOIN", "...", "ON", "clause", "to", "the", "Condition", "and", "returns", "it", "for", "method", "chain", "." ]
[ "func", "(", "jc", "*", "JoinCondition", ")", "On", "(", "larg", "interface", "{", "}", ",", "args", "...", "string", ")", "*", "Condition", "{", "var", "lcolumn", "string", "\n", "switch", "rv", ":=", "reflect", ".", "ValueOf", "(", "larg", ")", ";", "rv", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "String", ":", "lcolumn", "=", "rv", ".", "String", "(", ")", "\n", "default", ":", "for", "rv", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "rv", "=", "rv", ".", "Elem", "(", ")", "\n", "}", "\n", "if", "rv", ".", "Kind", "(", ")", "!=", "reflect", ".", "Struct", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "rv", ".", "Type", "(", ")", ")", ")", "\n", "}", "\n", "jc", ".", "leftTableName", "=", "jc", ".", "db", ".", "tableName", "(", "rv", ".", "Type", "(", ")", ")", "\n", "lcolumn", ",", "args", "=", "args", "[", "0", "]", ",", "args", "[", "1", ":", "]", "\n", "}", "\n", "switch", "len", "(", "args", ")", "{", "case", "0", ":", "jc", ".", "left", ",", "jc", ".", "op", ",", "jc", ".", "right", "=", "lcolumn", ",", "\"", "\"", ",", "lcolumn", "\n", "case", "2", ":", "jc", ".", "<mask>", ",", "jc", ".", "op", ",", "jc", ".", "right", "=", "lcolumn", ",", "args", "[", "0", "]", ",", "args", "[", "1", "]", "\n", "default", ":", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "len", "(", "args", ")", "+", "1", ")", ")", "\n", "}", "\n", "c", ":=", "newCondition", "(", "jc", ".", "db", ")", "\n", "c", ".", "parts", "=", "append", "(", "c", ".", "parts", ",", "part", "{", "clause", ":", "jc", ".", "clause", ",", "expr", ":", "jc", ",", "priority", ":", "-", "100", ",", "}", ")", "\n", "return", "c", "\n", "}" ]
903
all-904
[ "Send", "sends", "the", "given", "message", "through", "the", "connection", "." ]
[ "func", "(", "c", "*", "Conn", ")", "send", "(", "msg", "interface", "{", "}", ")", "error", "{", "if", "!", "c", ".", "connected", ".", "Load", "(", ")", ".", "(", "bool", ")", "{", "return", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "websocket", ".", "JSON", ".", "Send", "(", "c", ".", "ws", ".", "Load", "(", ")", ".", "(", "*", "websocket", ".", "Conn", ")", ",", "msg", ")", "\n", "}" ]
904
all-905
[ "Expect", "is", "used", "to", "make", "assertions", ".", "See", "documentation", "for", "Expect", "." ]
[ "func", "(", "g", "*", "WithT", ")", "Expect", "(", "actual", "interface", "{", "}", ",", "extra", "...", "<mask>", "{", "}", ")", "Assertion", "{", "return", "assertion", ".", "New", "(", "actual", ",", "testingtsupport", ".", "BuildTestingTGomegaFailWrapper", "(", "g", ".", "t", ")", ",", "0", ",", "extra", "...", ")", "\n", "}" ]
905
all-906
[ "GetValueOk", "returns", "a", "tuple", "with", "the", "Value", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinitionMarker", ")", "GetValueOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "g", "==", "nil", "||", "g", ".", "Value", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "g", ".", "Value", ",", "true", "\n", "}" ]
906
all-907
[ "StartStatusCheck", "starts", "a", "periodic", "status", "checker", "." ]
[ "func", "(", "r", "*", "Server", ")", "StartStatusCheck", "(", ")", "{", "// Initialize the last changed timestamp", "r", ".", "hasStatusChanged", "(", ")", "\n\n", "r", ".", "statusDone", "=", "make", "(", "chan", "int", ")", "\n", "<mask>", "func", "(", ")", "{", "for", "{", "select", "{", "case", "<-", "r", ".", "statusDone", ":", "return", "\n", "case", "<-", "time", ".", "After", "(", "time", ".", "Minute", ")", ":", "if", "r", ".", "hasStatusChanged", "(", ")", "{", "r", ".", "flushCache", "(", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n", "}" ]
907
all-908
[ "Reset", "sets", "the", "Backoff", "to", "its", "initial", "conditions", "ready", "to", "start", "over", "." ]
[ "func", "(", "b", "*", "Backoff", ")", "Reset", "(", ")", "{", "b", ".", "<mask>", "=", "0", "\n", "b", ".", "LastDuration", "=", "0", "\n", "b", ".", "NextDuration", "=", "b", ".", "getNextDuration", "(", ")", "\n", "}" ]
908
all-909
[ "AllPeriodics", "returns", "all", "prow", "periodic", "jobs", "." ]
[ "func", "(", "c", "*", "JobConfig", ")", "AllPeriodics", "(", ")", "[", "]", "Periodic", "{", "var", "listPeriodic", "func", "(", "ps", "[", "]", "Periodic", ")", "[", "]", "Periodic", "\n", "listPeriodic", "=", "func", "(", "ps", "[", "]", "Periodic", ")", "[", "]", "Periodic", "{", "<mask>", "res", "[", "]", "Periodic", "\n", "for", "_", ",", "p", ":=", "range", "ps", "{", "res", "=", "append", "(", "res", ",", "p", ")", "\n", "}", "\n", "return", "res", "\n", "}", "\n\n", "return", "listPeriodic", "(", "c", ".", "Periodics", ")", "\n", "}" ]
909
all-910
[ "SetScheme", "sets", "the", "scheme", "of", "this", "URI", "." ]
[ "func", "(", "u", "*", "URI", ")", "SetScheme", "(", "scheme", "string", ")", "error", "{", "m", ":=", "schemeRegexp", ".", "FindStringSubmatch", "(", "scheme", ")", "\n", "if", "m", "==", "nil", "{", "return", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "u", ".", "scheme", "=", "scheme", "\n", "return", "nil", "\n", "}" ]
910
all-911
[ "ServerBaseContext", "wraps", "an", "http", ".", "Handler", "to", "set", "the", "request", "context", "to", "the", "baseCtx", "." ]
[ "func", "ServerBaseContext", "(", "baseCtx", "context", ".", "Context", ",", "h", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "fn", ":=", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n", "baseCtx", ":=", "baseCtx", "\n\n", "// Copy over default net/http server context keys", "if", "v", ",", "ok", ":=", "ctx", ".", "Value", "(", "http", ".", "ServerContextKey", ")", ".", "(", "*", "http", ".", "Server", ")", ";", "ok", "{", "baseCtx", "=", "context", ".", "WithValue", "(", "baseCtx", ",", "http", ".", "ServerContextKey", ",", "v", ")", "\n", "}", "\n", "if", "v", ",", "<mask>", ":=", "ctx", ".", "Value", "(", "http", ".", "LocalAddrContextKey", ")", ".", "(", "net", ".", "Addr", ")", ";", "ok", "{", "baseCtx", "=", "context", ".", "WithValue", "(", "baseCtx", ",", "http", ".", "LocalAddrContextKey", ",", "v", ")", "\n", "}", "\n\n", "h", ".", "ServeHTTP", "(", "w", ",", "r", ".", "WithContext", "(", "baseCtx", ")", ")", "\n", "}", ")", "\n", "return", "fn", "\n", "}" ]
911
all-912
[ "ImageImport", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockClient", ")", "ImageImport", "(", "arg0", "context", ".", "<mask>", ",", "arg1", "types", ".", "ImageImportSource", ",", "arg2", "string", ",", "arg3", "types", ".", "ImageImportOptions", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ",", "arg2", ",", "arg3", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "io", ".", "ReadCloser", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
912
all-913
[ "ProfileContainersGet", "gets", "the", "names", "of", "the", "containers", "associated", "with", "the", "profile", "with", "the", "given", "name", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ProfileContainersGet", "(", "project", ",", "<mask>", "string", ")", "(", "map", "[", "string", "]", "[", "]", "string", ",", "error", ")", "{", "err", ":=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "enabled", ",", "err", ":=", "tx", ".", "ProjectHasProfiles", "(", "project", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "enabled", "{", "project", "=", "\"", "\"", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "q", ":=", "`SELECT containers.name, projects.name FROM containers\n\t\tJOIN containers_profiles ON containers.id == containers_profiles.container_id\n\t\tJOIN projects ON projects.id == containers.project_id\n\t\tWHERE containers_profiles.profile_id ==\n\t\t (SELECT profiles.id FROM profiles\n\t\t JOIN projects ON projects.id == profiles.project_id\n\t\t WHERE profiles.name=? AND projects.name=?)\n\t\tAND containers.type == 0`", "\n\n", "results", ":=", "map", "[", "string", "]", "[", "]", "string", "{", "}", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "profile", ",", "project", "}", "\n", "var", "name", "string", "\n", "outfmt", ":=", "[", "]", "interface", "{", "}", "{", "name", ",", "name", "}", "\n\n", "output", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "q", ",", "inargs", ",", "outfmt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "_", ",", "r", ":=", "range", "output", "{", "if", "results", "[", "r", "[", "1", "]", ".", "(", "string", ")", "]", "==", "nil", "{", "results", "[", "r", "[", "1", "]", ".", "(", "string", ")", "]", "=", "[", "]", "string", "{", "}", "\n", "}", "\n\n", "results", "[", "r", "[", "1", "]", ".", "(", "string", ")", "]", "=", "append", "(", "results", "[", "r", "[", "1", "]", ".", "(", "string", ")", "]", ",", "r", "[", "0", "]", ".", "(", "string", ")", ")", "\n", "}", "\n\n", "return", "results", ",", "nil", "\n", "}" ]
913
all-914
[ "NewInfo", "returns", "a", "info", "describing", "the", "named", "file", "." ]
[ "func", "NewInfo", "(", "name", "string", ")", "(", "*", "info", ",", "error", ")", "{", "i", ",", "err", ":=", "os", ".", "Stat", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "info", "{", "i", "}", ",", "nil", "\n", "}" ]
914
all-915
[ "NewMockCNIClient", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockCNIClient", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockCNIClient", "{", "mock", ":=", "&", "MockCNIClient", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockCNIClientMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
915
all-916
[ "newArchive50", "creates", "a", "new", "fileBlockReader", "for", "a", "Version", "5", "archive", "." ]
[ "func", "newArchive50", "(", "r", "*", "bufio", ".", "Reader", ",", "password", "string", ")", "fileBlockReader", "{", "a", ":=", "new", "(", "archive50", ")", "\n", "a", ".", "v", "=", "r", "\n", "a", ".", "pass", "=", "[", "]", "byte", "(", "<mask>", ")", "\n", "a", ".", "buf", "=", "make", "(", "[", "]", "byte", ",", "100", ")", "\n", "return", "a", "\n", "}" ]
916
all-917
[ "Start", "provides", "a", "mock", "function", "with", "given", "fields", ":", "_a0", "_a1", "_a2", "_a3", "_a4", "_a5" ]
[ "func", "(", "_m", "*", "Storage", ")", "Start", "(", "_a0", "context", ".", "Context", ",", "_a1", "string", ",", "_a2", "string", ",", "_a3", "string", ",", "_a4", "string", ",", "_a5", "map", "[", "string", "]", "string", ")", "(", "*", "mnemosynerpc", ".", "Session", ",", "error", ")", "{", "<mask>", ":=", "_m", ".", "Called", "(", "_a0", ",", "_a1", ",", "_a2", ",", "_a3", ",", "_a4", ",", "_a5", ")", "\n\n", "var", "r0", "*", "mnemosynerpc", ".", "Session", "\n", "if", "rf", ",", "ok", ":=", "ret", ".", "Get", "(", "0", ")", ".", "(", "func", "(", "context", ".", "Context", ",", "string", ",", "string", ",", "string", ",", "string", ",", "map", "[", "string", "]", "string", ")", "*", "mnemosynerpc", ".", "Session", ")", ";", "ok", "{", "r0", "=", "rf", "(", "_a0", ",", "_a1", ",", "_a2", ",", "_a3", ",", "_a4", ",", "_a5", ")", "\n", "}", "else", "{", "if", "ret", ".", "Get", "(", "0", ")", "!=", "nil", "{", "r0", "=", "ret", ".", "Get", "(", "0", ")", ".", "(", "*", "mnemosynerpc", ".", "Session", ")", "\n", "}", "\n", "}", "\n\n", "var", "r1", "error", "\n", "if", "rf", ",", "ok", ":=", "ret", ".", "Get", "(", "1", ")", ".", "(", "func", "(", "context", ".", "Context", ",", "string", ",", "string", ",", "string", ",", "string", ",", "map", "[", "string", "]", "string", ")", "error", ")", ";", "ok", "{", "r1", "=", "rf", "(", "_a0", ",", "_a1", ",", "_a2", ",", "_a3", ",", "_a4", ",", "_a5", ")", "\n", "}", "else", "{", "r1", "=", "ret", ".", "Error", "(", "1", ")", "\n", "}", "\n\n", "return", "r0", ",", "r1", "\n", "}" ]
917
all-918
[ "Insert", "is", "a", "wrapper", "around", "g_menu_insert", "()", "." ]
[ "func", "(", "v", "*", "Menu", ")", "Insert", "(", "<mask>", "int", ",", "label", ",", "detailed_action", "string", ")", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "label", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n\n", "cstr2", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "detailed_action", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr2", ")", ")", "\n\n", "C", ".", "g_menu_insert", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "position", ")", ",", "cstr1", ",", "cstr2", ")", "\n", "}" ]
918
all-919
[ "FromBase64ToHex", "return", "hex", "of", "base", "64", "encoded", "." ]
[ "func", "FromBase64ToHex", "(", "s", "Base64String", ")", "(", "string", ",", "error", ")", "{", "b", ",", "err", ":=", "ToBytes", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "<mask>", ".", "EncodeToString", "(", "b", ")", ",", "nil", "\n", "}" ]
919
all-920
[ "useLine", "is", "like", "cobra", ".", "Command", ".", "UseLine", "but", "tweaked", "to", "use", "commandPath", "." ]
[ "func", "useLine", "(", "c", "*", "cobra", ".", "Command", ")", "string", "{", "<mask>", "useline", "string", "\n", "if", "c", ".", "HasParent", "(", ")", "{", "useline", "=", "commandPath", "(", "c", ".", "Parent", "(", ")", ")", "+", "\"", "\"", "+", "c", ".", "Use", "\n", "}", "else", "{", "useline", "=", "c", ".", "Use", "\n", "}", "\n", "if", "c", ".", "DisableFlagsInUseLine", "{", "return", "useline", "\n", "}", "\n", "if", "c", ".", "HasAvailableFlags", "(", ")", "&&", "!", "strings", ".", "Contains", "(", "useline", ",", "\"", "\"", ")", "{", "useline", "+=", "\"", "\"", "\n", "}", "\n", "return", "useline", "\n", "}" ]
920
all-921
[ "Calculates", "the", "per", "-", "element", "bit", "-", "wise", "disjunction", "of", "an", "array", "and", "a", "scalar", "." ]
[ "func", "OrScalar", "(", "src", "*", "IplImage", ",", "<mask>", "Scalar", ",", "dst", "*", "IplImage", ")", "{", "OrScalarWithMask", "(", "src", ",", "value", ",", "dst", ",", "nil", ")", "\n", "}" ]
921
all-922
[ "ParseReference", "converts", "a", "string", "which", "should", "not", "start", "with", "the", "ImageTransport", ".", "Name", "prefix", "into", "an", "ImageReference", "." ]
[ "func", "(", "s", "stubTransport", ")", "ParseReference", "(", "<mask>", "string", ")", "(", "types", ".", "ImageReference", ",", "error", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "`The transport \"%s:\" is not supported in this build`", ",", "string", "(", "s", ")", ")", "\n", "}" ]
922
all-923
[ "WithRoute", "adds", "the", "route", "to", "the", "put", "apps", "app", "routes", "route", "params" ]
[ "func", "(", "o", "*", "PutAppsAppRoutesRouteParams", ")", "WithRoute", "(", "route", "string", ")", "*", "PutAppsAppRoutesRouteParams", "{", "o", ".", "SetRoute", "(", "<mask>", ")", "\n", "return", "o", "\n", "}" ]
923
all-924
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "TakePreciseCoverageParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler5", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
924
all-925
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ProfileSnapshotReturns", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree7", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
925
all-926
[ "GetEvaluationDuration", "returns", "the", "time", "in", "seconds", "it", "took", "to", "evaluate", "the", "rule", "group", "." ]
[ "func", "(", "g", "*", "Group", ")", "GetEvaluationDuration", "(", ")", "<mask>", ".", "Duration", "{", "g", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "g", ".", "mtx", ".", "Unlock", "(", ")", "\n", "return", "g", ".", "evaluationDuration", "\n", "}" ]
926
all-927
[ "===", "Scalar", "(", "node", "ValueTypeVector", ")", "Scalar", "===" ]
[ "func", "funcScalar", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "v", ":=", "vals", "[", "0", "]", ".", "(", "Vector", ")", "\n", "if", "len", "(", "v", ")", "!=", "1", "{", "return", "append", "(", "enh", ".", "out", ",", "Sample", "{", "Point", ":", "Point", "{", "V", ":", "math", ".", "NaN", "(", ")", "}", ",", "}", ")", "\n", "}", "\n", "return", "append", "(", "enh", ".", "out", ",", "Sample", "{", "<mask>", ":", "Point", "{", "V", ":", "v", "[", "0", "]", ".", "V", "}", ",", "}", ")", "\n", "}" ]
927
all-928
[ "checkRulesGoVersion", "checks", "whether", "a", "compatible", "version", "of", "rules_go", "is", "being", "used", "in", "the", "workspace", ".", "A", "message", "will", "be", "logged", "if", "an", "incompatible", "version", "is", "found", ".", "Note", "that", "we", "can", "t", "always", "determine", "the", "version", "of", "rules_go", "in", "use", ".", "Also", "if", "we", "find", "an", "incompatible", "version", "we", "shouldn", "t", "bail", "out", "since", "the", "incompatibility", "may", "not", "matter", "in", "the", "current", "workspace", "." ]
[ "func", "checkRulesGoVersion", "(", "repoRoot", "string", ")", "{", "const", "message", "=", "`Gazelle may not be compatible with this version of rules_go.\nUpdate io_bazel_rules_go to a newer version in your WORKSPACE file.`", "\n\n", "rulesGoPath", ",", "err", ":=", "repo", ".", "FindExternalRepo", "(", "repoRoot", ",", "config", ".", "RulesGoRepoName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "defBzlPath", ":=", "filepath", ".", "Join", "(", "rulesGoPath", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "defBzlContent", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "defBzlPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "versionRe", ":=", "regexp", ".", "MustCompile", "(", "`(?m)^RULES_GO_VERSION = ['\"]([0-9.]*)['\"]`", ")", "\n", "match", ":=", "versionRe", ".", "FindSubmatch", "(", "defBzlContent", ")", "\n", "if", "match", "==", "nil", "{", "log", ".", "Printf", "(", "\"", "\\n", "\"", ",", "config", ".", "RulesGoRepoName", ",", "message", ")", "\n", "return", "\n", "}", "\n", "vstr", ":=", "string", "(", "<mask>", "[", "1", "]", ")", "\n", "v", ",", "err", ":=", "version", ".", "ParseVersion", "(", "vstr", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\\n", "\"", ",", "vstr", ",", "config", ".", "RulesGoRepoName", ",", "message", ")", "\n", "}", "\n", "if", "v", ".", "Compare", "(", "minimumRulesGoVersion", ")", "<", "0", "{", "log", ".", "Printf", "(", "\"", "\\n", "\"", ",", "v", ",", "minimumRulesGoVersion", ",", "message", ")", "\n", "}", "\n", "}" ]
928
all-929
[ "addedBlockingPresubmits", "determines", "new", "blocking", "presubmits", "based", "on", "a", "config", "update", ".", "New", "blocking", "presubmits", "are", "either", "brand", "-", "new", "presubmits", "or", "extant", "presubmits", "that", "are", "now", "reporting", ".", "Previous", "presubmits", "that", "reported", "but", "were", "optional", "that", "are", "no", "longer", "optional", "require", "no", "action", "as", "their", "contexts", "will", "already", "exist", "on", "PRs", "." ]
[ "func", "addedBlockingPresubmits", "(", "old", ",", "new", "map", "[", "string", "]", "[", "]", "config", ".", "Presubmit", ")", "map", "[", "string", "]", "[", "]", "config", ".", "Presubmit", "{", "added", ":=", "map", "[", "string", "]", "[", "]", "config", ".", "Presubmit", "{", "}", "\n\n", "for", "repo", ",", "oldPresubmits", ":=", "range", "old", "{", "added", "[", "repo", "]", "=", "[", "]", "config", ".", "Presubmit", "{", "}", "\n", "for", "_", ",", "newPresubmit", ":=", "range", "new", "[", "repo", "]", "{", "if", "!", "newPresubmit", ".", "ContextRequired", "(", ")", "||", "newPresubmit", ".", "NeedsExplicitTrigger", "(", ")", "{", "continue", "\n", "}", "\n", "var", "found", "bool", "\n", "for", "_", ",", "oldPresubmit", ":=", "range", "oldPresubmits", "{", "if", "oldPresubmit", ".", "Name", "==", "newPresubmit", ".", "Name", "{", "if", "oldPresubmit", ".", "SkipReport", "&&", "!", "newPresubmit", ".", "SkipReport", "{", "added", "[", "repo", "]", "=", "append", "(", "added", "[", "repo", "]", ",", "newPresubmit", ")", "\n", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "repo", ",", "\"", "\"", ":", "oldPresubmit", ".", "Name", ",", "}", ")", ".", "Debug", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "oldPresubmit", ".", "RunIfChanged", "!=", "newPresubmit", ".", "RunIfChanged", "{", "added", "[", "repo", "]", "=", "append", "(", "<mask>", "[", "repo", "]", ",", "newPresubmit", ")", "\n", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "repo", ",", "\"", "\"", ":", "oldPresubmit", ".", "Name", ",", "}", ")", ".", "Debug", "(", "\"", "\"", ")", "\n", "}", "\n", "found", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "!", "found", "{", "added", "[", "repo", "]", "=", "append", "(", "added", "[", "repo", "]", ",", "newPresubmit", ")", "\n", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "repo", ",", "\"", "\"", ":", "newPresubmit", ".", "Name", ",", "}", ")", ".", "Debug", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "var", "numAdded", "int", "\n", "for", "_", ",", "presubmits", ":=", "range", "added", "{", "numAdded", "+=", "len", "(", "presubmits", ")", "\n", "}", "\n", "logrus", ".", "Infof", "(", "\"", "\"", ",", "numAdded", ")", "\n", "return", "added", "\n", "}" ]
929
all-930
[ "GetTitle", "()", "is", "a", "wrapper", "around", "gtk_native_dialog_get_title", "()", "." ]
[ "func", "(", "v", "*", "NativeDialog", ")", "GetTitle", "(", ")", "(", "string", ",", "error", ")", "{", "<mask>", "stringReturn", "(", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "gtk_native_dialog_get_title", "(", "v", ".", "native", "(", ")", ")", ")", ")", "\n", "}" ]
930
all-931
[ "CheckCompact", "ensures", "that", "historical", "data", "before", "given", "revision", "has", "been", "compacted", "." ]
[ "func", "(", "m", "*", "Member", ")", "CheckCompact", "(", "rev", "int64", ")", "error", "{", "cli", ",", "err", ":=", "m", ".", "CreateEtcdClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ",", "m", ".", "EtcdClientEndpoint", ")", "\n", "}", "\n", "defer", "cli", ".", "Close", "(", ")", "\n\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "5", "*", "time", ".", "Second", ")", "\n", "wch", ":=", "cli", ".", "Watch", "(", "ctx", ",", "\"", "\\x00", "\"", ",", "clientv3", ".", "WithFromKey", "(", ")", ",", "clientv3", ".", "WithRev", "(", "rev", "-", "1", ")", ")", "\n", "wr", ",", "ok", ":=", "<-", "wch", "\n", "cancel", "(", ")", "\n\n", "if", "!", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "m", ".", "EtcdClientEndpoint", ")", "\n", "}", "\n", "if", "wr", ".", "CompactRevision", "!=", "rev", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "wr", ".", "CompactRevision", ",", "<mask>", ",", "m", ".", "EtcdClientEndpoint", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
931
all-932
[ "LogMessage", "creates", "a", "message", "that", "complies", "with", "fmt", ".", "Stringer", "but", "also", "includes", "a", "message", "and", "key", "/", "value", "pairs", "for", "structured", "logging", ".", "Use", "it", "in", "trace", ".", "LazyLog", ":", "t", ".", "LazyLog", "(", "trace", ".", "LogMessage", "(", "found", "trace", ".", "KeyValue", "(", "file", "name", "))", "false", ")" ]
[ "func", "LogMessage", "(", "<mask>", "string", ",", "keyvals", "...", "keyval", ")", "*", "logmessage", "{", "return", "&", "logmessage", "{", "m", ":", "message", ",", "kv", ":", "keyvals", "}", "\n", "}" ]
932
all-933
[ "PeekFront", "returns", "the", "entry", "logically", "stored", "at", "the", "front", "of", "this", "list", "without", "removing", "it", "." ]
[ "func", "(", "list", "*", "LinkedList", ")", "PeekFront", "(", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "list", ".", "key", ".", "RLock", "(", ")", "\n", "defer", "list", ".", "<mask>", ".", "RUnlock", "(", ")", "\n\n", "if", "list", ".", "first", "==", "nil", "{", "return", "nil", ",", "false", "\n", "}", "\n", "return", "list", ".", "first", ".", "payload", ",", "true", "\n", "}" ]
933
all-934
[ "Function", "for", "debug", "printing" ]
[ "func", "stringifyHTTPResponseBody", "(", "r", "*", "http", ".", "Response", ")", "(", "body", "string", ")", "{", "if", "r", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "buf", ":=", "new", "(", "bytes", ".", "<mask>", ")", "\n", "buf", ".", "ReadFrom", "(", "r", ".", "Body", ")", "\n", "body", "=", "buf", ".", "String", "(", ")", "\n", "return", "body", "\n\n", "}" ]
934
all-935
[ "Ping", "sends", "a", "ping", "message", "to", "the", "given", "hostPort", "and", "waits", "for", "a", "response", "." ]
[ "func", "(", "ch", "*", "Channel", ")", "Ping", "(", "ctx", "context", ".", "<mask>", ",", "hostPort", "string", ")", "error", "{", "peer", ":=", "ch", ".", "RootPeers", "(", ")", ".", "GetOrAdd", "(", "hostPort", ")", "\n", "conn", ",", "err", ":=", "peer", ".", "GetConnection", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "conn", ".", "ping", "(", "ctx", ")", "\n", "}" ]
935
all-936
[ "define", "an", "array", "of", "edge", "flags" ]
[ "func", "EdgeFlagPointer", "(", "stride", "int32", ",", "pointer", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall", "(", "gpEdgeFlagPointer", ",", "2", ",", "uintptr", "(", "stride", ")", ",", "uintptr", "(", "<mask>", ")", ",", "0", ")", "\n", "}" ]
936
all-937
[ "MutateCreateAccount", "for", "NativeAmount", "sets", "the", "CreateAccountOp", "s", "StartingBalance", "field" ]
[ "func", "(", "m", "NativeAmount", ")", "MutateCreateAccount", "(", "o", "*", "xdr", ".", "CreateAccountOp", ")", "(", "err", "error", ")", "{", "o", ".", "StartingBalance", ",", "err", "=", "<mask>", ".", "Parse", "(", "m", ".", "Amount", ")", "\n", "return", "\n", "}" ]
937
all-938
[ "Subscribe", "subscribes", "to", "a", "topic", ".", "Returns", "error", "if", "fn", "is", "not", "a", "function", "." ]
[ "func", "(", "bus", "*", "EventBus", ")", "Subscribe", "(", "topic", "string", ",", "fn", "<mask>", "{", "}", ")", "error", "{", "return", "bus", ".", "doSubscribe", "(", "topic", ",", "fn", ",", "&", "eventHandler", "{", "reflect", ".", "ValueOf", "(", "fn", ")", ",", "false", ",", "false", ",", "false", ",", "sync", ".", "Mutex", "{", "}", ",", "}", ")", "\n", "}" ]
938
all-939
[ "MenuButtonNew", "is", "a", "wrapper", "around", "gtk_menu_button_new", "()", "." ]
[ "func", "MenuButtonNew", "(", ")", "(", "*", "MenuButton", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_menu_button_new", "(", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapMenuButton", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
939
all-940
[ "HasFollowRedirects", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "SyntheticsOptions", ")", "HasFollowRedirects", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "FollowRedirects", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
940
all-941
[ "ToServerListQuery", "formats", "a", "ListOpts", "into", "a", "query", "string", "." ]
[ "func", "(", "opts", "ListOpts", ")", "ToServerListQuery", "(", ")", "(", "string", ",", "error", ")", "{", "q", ",", "err", ":=", "gophercloud", ".", "BuildQueryString", "(", "opts", ")", "\n", "return", "q", ".", "<mask>", "(", ")", ",", "err", "\n", "}" ]
941
all-942
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventFrameStoppedLoading", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage60", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
942
all-943
[ "CONTRACT", ":", "by", "the", "time", "this", "is", "called", "len", "(", "bz", ")", ">", "=", "_n", "Returns", "true", "so", "you", "can", "write", "one", "-", "liners", "." ]
[ "func", "slide", "(", "bz", "*", "[", "]", "byte", ",", "n", "*", "int", ",", "_n", "int", ")", "bool", "{", "if", "_n", "<", "0", "||", "_n", ">", "len", "(", "*", "bz", ")", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "len", "(", "*", "bz", ")", ",", "_n", ")", ")", "\n", "}", "\n", "*", "bz", "=", "(", "*", "bz", ")", "[", "_n", ":", "]", "\n", "if", "n", "!=", "nil", "{", "*", "n", "+=", "_n", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
943
all-944
[ "EscapeHTML", "is", "alias", "for", "html", ".", "EscapeString", "." ]
[ "func", "EscapeHTML", "(", "s", "string", ")", "string", "{", "if", "Verbose", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "<mask>", ".", "EscapeString", "(", "s", ")", "\n", "}" ]
944
all-945
[ "ReverseBytes", "returns", "the", "buf", "in", "the", "opposite", "order" ]
[ "func", "ReverseBytes", "(", "buf", "[", "]", "byte", ")", "[", "]", "byte", "{", "var", "res", "[", "]", "byte", "\n", "if", "len", "(", "buf", ")", "==", "0", "{", "return", "res", "\n", "}", "\n\n", "// Walk till mid-way, swapping bytes from each end:", "// b[i] and b[len-i-1]", "blen", ":=", "len", "(", "buf", ")", "\n", "res", "=", "make", "(", "[", "]", "byte", ",", "blen", ")", "\n", "mid", ":=", "blen", "/", "2", "\n", "for", "left", ":=", "0", ";", "left", "<=", "mid", ";", "left", "++", "{", "right", ":=", "blen", "-", "left", "-", "1", "\n", "res", "[", "left", "]", "=", "buf", "[", "right", "]", "\n", "<mask>", "[", "right", "]", "=", "buf", "[", "left", "]", "\n", "}", "\n", "return", "res", "\n", "}" ]
945
all-946
[ "Do", "executes", "ServiceWorker", ".", "unregister", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "UnregisterParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandUnregister", ",", "p", ",", "nil", ")", "\n", "}" ]
946
all-947
[ "GetTaskHealthMetrics", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockEngine", ")", "GetTaskHealthMetrics", "(", ")", "(", "*", "ecstcs", ".", "HealthMetadata", ",", "[", "]", "*", "ecstcs", ".", "TaskHealth", ",", "error", ")", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "ecstcs", ".", "HealthMetadata", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "[", "]", "*", "ecstcs", ".", "TaskHealth", ")", "\n", "ret2", ",", "_", ":=", "ret", "[", "2", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", ",", "ret2", "\n", "}" ]
947
all-948
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniformMatrix3fv", "(", "program", "uint32", ",", "location", "int32", ",", "count", "int32", ",", "transpose", "bool", ",", "<mask>", "*", "float32", ")", "{", "C", ".", "glowProgramUniformMatrix3fv", "(", "gpProgramUniformMatrix3fv", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ",", "(", "C", ".", "GLboolean", ")", "(", "boolToInt", "(", "transpose", ")", ")", ",", "(", "*", "C", ".", "GLfloat", ")", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ")", "\n", "}" ]
948
all-949
[ "StoragePoolsGetDrivers", "returns", "the", "names", "of", "all", "storage", "volumes", "attached", "to", "a", "given", "storage", "pool", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "StoragePoolsGetDrivers", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "poolDriver", "string", "\n", "query", ":=", "\"", "\"", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "}", "\n", "outargs", ":=", "[", "]", "interface", "{", "}", "{", "poolDriver", "}", "\n\n", "result", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "query", ",", "inargs", ",", "outargs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "]", "string", "{", "}", ",", "err", "\n", "}", "\n\n", "if", "len", "(", "result", ")", "==", "0", "{", "return", "[", "]", "string", "{", "}", ",", "ErrNoSuchObject", "\n", "}", "\n\n", "drivers", ":=", "[", "]", "string", "{", "}", "\n", "for", "_", ",", "driver", ":=", "range", "result", "{", "drivers", "=", "<mask>", "(", "drivers", ",", "driver", "[", "0", "]", ".", "(", "string", ")", ")", "\n", "}", "\n\n", "return", "drivers", ",", "nil", "\n", "}" ]
949
all-950
[ "GetContainerInstanceArn", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockAuditLogger", ")", "GetContainerInstanceArn", "(", ")", "string", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "string", ")", "\n", "return", "ret0", "\n", "}" ]
950
all-951
[ "WebpackCheck", "will", "compare", "the", "current", "default", "Buffalo", "webpack", ".", "config", ".", "js", "against", "the", "applications", "webpack", ".", "config", ".", "js", ".", "If", "they", "are", "different", "you", "have", "the", "option", "to", "overwrite", "the", "existing", "webpack", ".", "config", ".", "js", "file", "with", "the", "new", "one", "." ]
[ "func", "WebpackCheck", "(", "r", "*", "Runner", ")", "error", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n\n", "if", "!", "r", ".", "App", ".", "WithWebpack", "{", "return", "nil", "\n", "}", "\n\n", "<mask>", ":=", "webpack", ".", "Templates", "\n\n", "f", ",", "err", ":=", "box", ".", "FindString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "tmpl", ",", "err", ":=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Parse", "(", "f", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "bb", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "err", "=", "tmpl", ".", "Execute", "(", "bb", ",", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "&", "webpack", ".", "Options", "{", "App", ":", "r", ".", "App", ",", "}", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "b", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "string", "(", "b", ")", "==", "bb", ".", "String", "(", ")", "{", "return", "nil", "\n", "}", "\n\n", "if", "!", "ask", "(", "\"", "\\n", "\"", ")", "{", "fmt", ".", "Println", "(", "\"", "\\t", "\"", ")", "\n", "return", "nil", "\n", "}", "\n\n", "wf", ",", "err", ":=", "os", ".", "Create", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "_", ",", "err", "=", "wf", ".", "Write", "(", "bb", ".", "Bytes", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "wf", ".", "Close", "(", ")", "\n", "}" ]
951
all-952
[ "rewriteImport", "rewrites", "any", "import", "of", "path", "oldPath", "to", "path", "newPath", "." ]
[ "func", "rewriteImport", "(", "f", "*", "ast", ".", "<mask>", ",", "oldPath", ",", "newPath", "string", ")", "(", "rewrote", "bool", ")", "{", "for", "_", ",", "imp", ":=", "range", "f", ".", "Imports", "{", "if", "importPath", "(", "imp", ")", "==", "oldPath", "{", "rewrote", "=", "true", "\n", "// record old End, because the default is to compute", "// it using the length of imp.Path.Value.", "imp", ".", "EndPos", "=", "imp", ".", "End", "(", ")", "\n", "imp", ".", "Path", ".", "Value", "=", "strconv", ".", "Quote", "(", "newPath", ")", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
952
all-953
[ "CreateSnapshot", "makes", "a", "snapshot", "which", "can", "be", "retrieved", "with", "Snapshot", "()", "and", "can", "be", "used", "to", "reconstruct", "the", "state", "at", "that", "point", ".", "If", "any", "configuration", "changes", "have", "been", "made", "since", "the", "last", "compaction", "the", "result", "of", "the", "last", "ApplyConfChange", "must", "be", "passed", "in", "." ]
[ "func", "(", "ms", "*", "MemoryStorage", ")", "CreateSnapshot", "(", "i", "uint64", ",", "cs", "*", "pb", ".", "ConfState", ",", "<mask>", "[", "]", "byte", ")", "(", "pb", ".", "Snapshot", ",", "error", ")", "{", "ms", ".", "Lock", "(", ")", "\n", "defer", "ms", ".", "Unlock", "(", ")", "\n", "if", "i", "<=", "ms", ".", "snapshot", ".", "Metadata", ".", "Index", "{", "return", "pb", ".", "Snapshot", "{", "}", ",", "ErrSnapOutOfDate", "\n", "}", "\n\n", "offset", ":=", "ms", ".", "ents", "[", "0", "]", ".", "Index", "\n", "if", "i", ">", "ms", ".", "lastIndex", "(", ")", "{", "raftLogger", ".", "Panicf", "(", "\"", "\"", ",", "i", ",", "ms", ".", "lastIndex", "(", ")", ")", "\n", "}", "\n\n", "ms", ".", "snapshot", ".", "Metadata", ".", "Index", "=", "i", "\n", "ms", ".", "snapshot", ".", "Metadata", ".", "Term", "=", "ms", ".", "ents", "[", "i", "-", "offset", "]", ".", "Term", "\n", "if", "cs", "!=", "nil", "{", "ms", ".", "snapshot", ".", "Metadata", ".", "ConfState", "=", "*", "cs", "\n", "}", "\n", "ms", ".", "snapshot", ".", "Data", "=", "data", "\n", "return", "ms", ".", "snapshot", ",", "nil", "\n", "}" ]
953
all-954
[ "newImageSource", "returns", "an", "ImageSource", "for", "reading", "from", "an", "existing", "directory", ".", "newImageSource", "untars", "the", "file", "and", "saves", "it", "in", "a", "temp", "directory" ]
[ "func", "newImageSource", "(", "ctx", "context", ".", "Context", ",", "sys", "*", "<mask>", ".", "SystemContext", ",", "ref", "ociArchiveReference", ")", "(", "types", ".", "ImageSource", ",", "error", ")", "{", "tempDirRef", ",", "err", ":=", "createUntarTempDir", "(", "ref", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "unpackedSrc", ",", "err", ":=", "tempDirRef", ".", "ociRefExtracted", ".", "NewImageSource", "(", "ctx", ",", "sys", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", ":=", "tempDirRef", ".", "deleteTempDir", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "tempDirRef", ".", "tempDirectory", ")", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "ociArchiveImageSource", "{", "ref", ":", "ref", ",", "unpackedSrc", ":", "unpackedSrc", ",", "tempDirRef", ":", "tempDirRef", "}", ",", "nil", "\n", "}" ]
954
all-955
[ "Forwarder", "returns", "a", "forwarder", "type", "with", "the", "given", "from", "and", "dest" ]
[ "func", "(", "dom", "*", "<mask>", ")", "Forwarder", "(", "name", ",", "to", "string", ")", "*", "Forwarder", "{", "return", "&", "Forwarder", "{", "Domain", ":", "dom", ",", "Name", ":", "name", ",", "To", ":", "to", "}", "\n", "}" ]
955
all-956
[ "Get", "implements", "ClientInterface" ]
[ "func", "(", "c", "*", "dummyClient", ")", "Get", "(", "name", "string", ")", "(", "<mask>", ",", "error", ")", "{", "obj", ",", "ok", ":=", "c", ".", "objects", "[", "name", "]", "\n", "if", "ok", "{", "return", "obj", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}" ]
956
all-957
[ "GetTokens", "gets", "tokens", "for", "an", "OAuth", "user", "specifying", "a", "grantType", "(", "i", ".", "e", "authorization_code", ")" ]
[ "func", "(", "o", "OAuth", ")", "GetTokens", "(", "code", "string", ",", "grantType", "string", ")", "(", "*", "oauthTokens", ",", "error", ")", "{", "postVars", ":=", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "grantType", ",", "\"", "\"", ":", "o", ".", "RedirectUri", ",", "\"", "\"", ":", "o", ".", "ClientId", ",", "\"", "\"", ":", "o", ".", "ClientSecret", ",", "}", "\n\n", "if", "grantType", "==", "\"", "\"", "{", "postVars", "[", "\"", "\"", "]", "=", "<mask>", "\n", "}", "else", "{", "postVars", "[", "\"", "\"", "]", "=", "code", "\n", "}", "\n", "holder", ":=", "tokensHolder", "{", "}", "\n", "err", ":=", "o", ".", "Rpc", ".", "Request", "(", "\"", "\"", ",", "\"", "\"", ",", "postVars", ",", "&", "holder", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "tokens", ":=", "oauthTokens", "{", "AccessToken", ":", "holder", ".", "AccessToken", ",", "RefreshToken", ":", "holder", ".", "RefreshToken", ",", "ExpireTime", ":", "time", ".", "Now", "(", ")", ".", "UTC", "(", ")", ".", "Unix", "(", ")", "+", "holder", ".", "ExpiresIn", ",", "}", "\n\n", "return", "&", "tokens", ",", "nil", "\n", "}" ]
957
all-958
[ "Report", "is", "creating", "/", "updating", "/", "removing", "reports", "in", "GitHub", "based", "on", "the", "state", "of", "the", "provided", "ProwJob", "." ]
[ "func", "Report", "(", "ghc", "GitHubClient", ",", "reportTemplate", "*", "template", ".", "Template", ",", "pj", "prowapi", ".", "ProwJob", ",", "validTypes", "[", "]", "prowapi", ".", "ProwJobType", ")", "error", "{", "if", "ghc", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pj", ".", "ObjectMeta", ".", "Name", ")", "\n", "}", "\n\n", "if", "!", "ShouldReport", "(", "pj", ",", "validTypes", ")", "{", "return", "nil", "\n", "}", "\n\n", "refs", ":=", "pj", ".", "Spec", ".", "Refs", "\n", "// we are not reporting for batch jobs, we can consider support that in the future", "if", "len", "(", "refs", ".", "Pulls", ")", ">", "1", "{", "return", "nil", "\n", "}", "\n\n", "if", "err", ":=", "reportStatus", "(", "ghc", ",", "pj", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Report manually aborted Jenkins jobs and jobs with invalid pod specs alongside", "// test successes/failures.", "if", "!", "pj", ".", "Complete", "(", ")", "{", "return", "nil", "\n", "}", "\n\n", "if", "len", "(", "refs", ".", "Pulls", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "ics", ",", "err", ":=", "ghc", ".", "ListIssueComments", "(", "refs", ".", "Org", ",", "refs", ".", "Repo", ",", "refs", ".", "Pulls", "[", "0", "]", ".", "Number", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "botName", ",", "err", ":=", "ghc", ".", "BotName", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "deletes", ",", "entries", ",", "updateID", ":=", "parseIssueComments", "(", "pj", ",", "botName", ",", "ics", ")", "\n", "for", "_", ",", "<mask>", ":=", "range", "deletes", "{", "if", "err", ":=", "ghc", ".", "DeleteComment", "(", "refs", ".", "Org", ",", "refs", ".", "Repo", ",", "delete", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "entries", ")", ">", "0", "{", "comment", ",", "err", ":=", "createComment", "(", "reportTemplate", ",", "pj", ",", "entries", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "updateID", "==", "0", "{", "if", "err", ":=", "ghc", ".", "CreateComment", "(", "refs", ".", "Org", ",", "refs", ".", "Repo", ",", "refs", ".", "Pulls", "[", "0", "]", ".", "Number", ",", "comment", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "else", "{", "if", "err", ":=", "ghc", ".", "EditComment", "(", "refs", ".", "Org", ",", "refs", ".", "Repo", ",", "updateID", ",", "comment", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
958
all-959
[ "Registers", "Handler", "with", "the", "EventController", ".", "Takes", "a", "string", "for", "the", "unique", "name", "(", "key", ")", "and", "the", "handler", "that", "conforms", "the", "to", "Handler", "interface", ".", "The", "name", "(", "key", ")", "is", "used", "to", "unregister", "or", "check", "if", "registered", "." ]
[ "func", "(", "e", "*", "EventController", ")", "RegisterHandler", "(", "n", "string", ",", "h", "<mask>", ")", "error", "{", "e", ".", "lazyLoadHandler", "(", ")", "\n\n", "if", "e", ".", "IsHandlerRegistered", "(", "n", ")", "{", "return", "errors", ".", "New", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "n", ")", ")", "\n", "}", "\n", "e", ".", "handlerMutex", ".", "Lock", "(", ")", "\n", "e", ".", "Handlers", "[", "n", "]", "=", "h", "\n", "e", ".", "handlerMutex", ".", "Unlock", "(", ")", "\n\n", "return", "nil", "\n", "}" ]
959
all-960
[ "If", "qs", "exists", "then", "return", "it", "with", "a", "leadin", "?", "apache", "log", "style", "." ]
[ "func", "(", "u", "*", "accessLogUtil", ")", "ApacheQueryString", "(", ")", "string", "{", "if", "u", ".", "R", ".", "URL", ".", "RawQuery", "!=", "\"", "\"", "{", "return", "\"", "\"", "+", "u", ".", "R", ".", "<mask>", ".", "RawQuery", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
960
all-961
[ "DelNetwork", "indicates", "an", "expected", "call", "of", "DelNetwork" ]
[ "func", "(", "mr", "*", "MockCNIMockRecorder", ")", "DelNetwork", "(", "arg0", ",", "arg1", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockCNI", ")", "(", "nil", ")", ".", "DelNetwork", ")", ",", "arg0", ",", "arg1", ")", "\n", "}" ]
961
all-962
[ "Pull", "attempts", "a", "git", "pull", ".", "It", "retries", "at", "most", "numRetries", "times", "if", "error", "occurs" ]
[ "func", "(", "r", "*", "Repo", ")", "Pull", "(", ")", "error", "{", "r", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "Unlock", "(", ")", "\n\n", "// prevent a pull if the last one was less than 5 seconds ago", "if", "gos", ".", "TimeSince", "(", "r", ".", "lastPull", ")", "<", "5", "*", "<mask>", ".", "Second", "{", "return", "nil", "\n", "}", "\n\n", "// keep last commit hash for comparison later", "lastCommit", ":=", "r", ".", "lastCommit", "\n\n", "var", "err", "error", "\n", "// Attempt to pull at most numRetries times", "for", "i", ":=", "0", ";", "i", "<", "numRetries", ";", "i", "++", "{", "if", "err", "=", "r", ".", "pull", "(", ")", ";", "err", "==", "nil", "{", "break", "\n", "}", "\n", "Logger", "(", ")", ".", "Println", "(", "err", ")", "\n", "}", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// check if there are new changes,", "// then execute post pull command", "if", "r", ".", "lastCommit", "==", "lastCommit", "{", "Logger", "(", ")", ".", "Println", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n", "return", "r", ".", "execThen", "(", ")", "\n", "}" ]
962
all-963
[ "Getpid", "indicates", "an", "expected", "call", "of", "Getpid" ]
[ "func", "(", "mr", "*", "MockOSMockRecorder", ")", "Getpid", "(", ")", "*", "gomock", ".", "Call", "{", "<mask>", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockOS", ")", "(", "nil", ")", ".", "Getpid", ")", ")", "\n", "}" ]
963
all-964
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GVariantBuilder", "." ]
[ "func", "(", "v", "*", "VariantBuilder", ")", "native", "(", ")", "*", "C", ".", "GVariantBuilder", "{", "if", "v", "==", "nil", "||", "v", ".", "GVariantBuilder", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GVariantBuilder", ")", "\n", "<mask>", "C", ".", "toGVariantBuilder", "(", "p", ")", "\n", "}" ]
964
all-965
[ "MoveProjectCard", "moves", "a", "specific", "project", "card", "to", "a", "specified", "column", "in", "the", "same", "project", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "projects", "/", "cards", "/", "#move", "-", "a", "-", "project", "-", "card" ]
[ "func", "(", "c", "*", "Client", ")", "MoveProjectCard", "(", "projectCardID", "int", ",", "newColumnID", "int", ")", "error", "{", "c", ".", "log", "(", "\"", "\"", ",", "projectCardID", ",", "newColumnID", ")", "\n", "_", ",", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "<mask>", ":", "http", ".", "MethodPost", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "projectCardID", ")", ",", "accept", ":", "\"", "\"", ",", "// allow the description field -- https://developer.github.com/changes/2018-02-22-label-description-search-preview/", "requestBody", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "newColumnID", ")", ",", "exitCodes", ":", "[", "]", "int", "{", "201", "}", ",", "}", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
965
all-966
[ "Mount", "mounts", "a", "http", ".", "Handler", "(", "or", "Buffalo", "app", ")", "and", "passes", "through", "all", "requests", "to", "it", ".", "func", "muxer", "()", "http", ".", "Handler", "{", "f", ":", "=", "func", "(", "res", "http", ".", "ResponseWriter", "req", "*", "http", ".", "Request", ")", "{", "fmt", ".", "Fprintf", "(", "res", "%s", "-", "%s", "req", ".", "Method", "req", ".", "URL", ".", "String", "()", ")", "}", "mux", ":", "=", "mux", ".", "NewRouter", "()", "mux", ".", "HandleFunc", "(", "/", "foo", "f", ")", ".", "Methods", "(", "GET", ")", "mux", ".", "HandleFunc", "(", "/", "bar", "f", ")", ".", "Methods", "(", "POST", ")", "mux", ".", "HandleFunc", "(", "/", "baz", "/", "baz", "f", ")", ".", "Methods", "(", "DELETE", ")", "return", "mux", "}", "a", ".", "Mount", "(", "/", "admin", "muxer", "()", ")", "$", "curl", "-", "X", "DELETE", "http", ":", "//", "localhost", ":", "3000", "/", "admin", "/", "baz", "/", "baz" ]
[ "func", "(", "a", "*", "App", ")", "Mount", "(", "p", "string", ",", "h", "http", ".", "Handler", ")", "{", "prefix", ":=", "<mask>", ".", "Join", "(", "a", ".", "Prefix", ",", "p", ")", "\n", "path", ":=", "path", ".", "Join", "(", "p", ",", "\"", "\"", ")", "\n", "a", ".", "ANY", "(", "path", ",", "WrapHandler", "(", "http", ".", "StripPrefix", "(", "prefix", ",", "h", ")", ")", ")", "\n", "}" ]
966
all-967
[ "New", "generator", "for", "creating", "a", "Buffalo", "application" ]
[ "func", "New", "(", "opts", "*", "<mask>", ")", "(", "*", "genny", ".", "Group", ",", "error", ")", "{", "gg", ":=", "&", "genny", ".", "Group", "{", "}", "\n\n", "// add the root generator", "g", ",", "err", ":=", "rootGenerator", "(", "opts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "gg", ",", "err", "\n", "}", "\n", "gg", ".", "Add", "(", "g", ")", "\n\n", "app", ":=", "opts", ".", "App", "\n\n", "if", "app", ".", "WithModules", "{", "g", ",", "err", ":=", "gomods", ".", "Init", "(", "app", ".", "PackagePkg", ",", "app", ".", "Root", ")", "\n", "if", "err", "!=", "nil", "{", "return", "gg", ",", "err", "\n", "}", "\n", "g", ".", "Command", "(", "gogen", ".", "Get", "(", "\"", "\"", "+", "runtime", ".", "Version", ")", ")", "\n", "g", ".", "Command", "(", "gogen", ".", "Get", "(", "\"", "\"", ")", ")", "\n\n", "gg", ".", "Add", "(", "g", ")", "\n", "}", "\n\n", "plugs", ",", "err", ":=", "plugdeps", ".", "List", "(", "app", ")", "\n", "if", "err", "!=", "nil", "&&", "(", "errors", ".", "Cause", "(", "err", ")", "!=", "plugdeps", ".", "ErrMissingConfig", ")", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "opts", ".", "Docker", "!=", "nil", "{", "// add the docker generator", "g", ",", "err", "=", "docker", ".", "New", "(", "opts", ".", "Docker", ")", "\n", "if", "err", "!=", "nil", "{", "return", "gg", ",", "err", "\n", "}", "\n", "gg", ".", "Add", "(", "g", ")", "\n", "}", "\n\n", "if", "opts", ".", "Pop", "!=", "nil", "{", "// add the pop generator", "gg2", ",", "err", ":=", "pop", ".", "New", "(", "opts", ".", "Pop", ")", "\n", "if", "err", "!=", "nil", "{", "return", "gg", ",", "err", "\n", "}", "\n", "gg", ".", "Merge", "(", "gg2", ")", "\n\n", "// add the plugin", "plugs", ".", "Add", "(", "plugdeps", ".", "Plugin", "{", "Binary", ":", "\"", "\"", ",", "GoGet", ":", "\"", "\"", ",", "}", ")", "\n", "}", "\n\n", "if", "opts", ".", "CI", "!=", "nil", "{", "// add the CI generator", "g", ",", "err", "=", "ci", ".", "New", "(", "opts", ".", "CI", ")", "\n", "if", "err", "!=", "nil", "{", "return", "gg", ",", "err", "\n", "}", "\n", "gg", ".", "Add", "(", "g", ")", "\n", "}", "\n\n", "if", "opts", ".", "Refresh", "!=", "nil", "{", "g", ",", "err", "=", "refresh", ".", "New", "(", "opts", ".", "Refresh", ")", "\n", "if", "err", "!=", "nil", "{", "return", "gg", ",", "err", "\n", "}", "\n", "gg", ".", "Add", "(", "g", ")", "\n", "}", "\n\n", "// ---", "// install all of the plugins", "iopts", ":=", "&", "install", ".", "Options", "{", "App", ":", "app", ",", "Plugins", ":", "plugs", ".", "List", "(", ")", ",", "}", "\n", "if", "app", ".", "WithSQLite", "{", "iopts", ".", "Tags", "=", "meta", ".", "BuildTags", "{", "\"", "\"", "}", "\n", "}", "\n\n", "ig", ",", "err", ":=", "install", ".", "New", "(", "iopts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "gg", ",", "err", "\n", "}", "\n", "gg", ".", "Merge", "(", "ig", ")", "\n\n", "// DEP/MODS/go get should be last", "if", "app", ".", "WithDep", "{", "// init dep", "di", ",", "err", ":=", "depgen", ".", "Init", "(", "\"", "\"", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "gg", ",", "err", "\n", "}", "\n", "gg", ".", "Add", "(", "di", ")", "\n", "}", "\n\n", "if", "!", "app", ".", "WithDep", "&&", "!", "app", ".", "WithModules", "{", "g", ":=", "genny", ".", "New", "(", ")", "\n", "g", ".", "Command", "(", "gogen", ".", "Get", "(", "\"", "\"", ",", "\"", "\"", ")", ")", "\n", "gg", ".", "Add", "(", "g", ")", "\n", "}", "\n\n", "if", "app", ".", "WithModules", "{", "g", ",", "err", ":=", "gomods", ".", "Tidy", "(", "app", ".", "Root", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "gg", ",", "err", "\n", "}", "\n", "gg", ".", "Add", "(", "g", ")", "\n", "}", "\n\n", "return", "gg", ",", "nil", "\n", "}" ]
967
all-968
[ "AttributeValue", "returns", "the", "named", "attribute", "for", "the", "node", "." ]
[ "func", "(", "n", "*", "Node", ")", "AttributeValue", "(", "<mask>", "string", ")", "string", "{", "n", ".", "RLock", "(", ")", "\n", "defer", "n", ".", "RUnlock", "(", ")", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "n", ".", "Attributes", ")", ";", "i", "+=", "2", "{", "if", "n", ".", "Attributes", "[", "i", "]", "==", "name", "{", "return", "n", ".", "Attributes", "[", "i", "+", "1", "]", "\n", "}", "\n", "}", "\n\n", "return", "\"", "\"", "\n", "}" ]
968
all-969
[ "HasTickEdge", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "n", "*", "NoteDefinition", ")", "HasTickEdge", "(", ")", "bool", "{", "if", "n", "!=", "nil", "&&", "n", ".", "TickEdge", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
969
all-970
[ "SetConsoleScreenBufferSize", "sets", "the", "size", "of", "the", "console", "screen", "buffer", ".", "See", "https", ":", "//", "msdn", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/", "library", "/", "windows", "/", "desktop", "/", "ms686044", "(", "v", "=", "vs", ".", "85", ")", ".", "aspx", "." ]
[ "func", "SetConsoleScreenBufferSize", "(", "handle", "uintptr", ",", "coord", "COORD", ")", "error", "{", "r1", ",", "r2", ",", "err", ":=", "setConsoleScreenBufferSizeProc", ".", "Call", "(", "<mask>", ",", "coordToPointer", "(", "coord", ")", ")", "\n", "use", "(", "coord", ")", "\n", "return", "checkError", "(", "r1", ",", "r2", ",", "err", ")", "\n", "}" ]
970
all-971
[ "EntryNewWithBuffer", "()", "is", "a", "wrapper", "around", "gtk_entry_new_with_buffer", "()", "." ]
[ "func", "EntryNewWithBuffer", "(", "buffer", "*", "EntryBuffer", ")", "(", "*", "<mask>", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_entry_new_with_buffer", "(", "buffer", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapEntry", "(", "obj", ")", ",", "nil", "\n", "}" ]
971
all-972
[ "NotFound", "resets", "response", "and", "sets", "404", "Not", "Found", "response", "status", "code", "." ]
[ "func", "(", "ctx", "*", "RequestCtx", ")", "NotFound", "(", ")", "{", "ctx", ".", "<mask>", ".", "Reset", "(", ")", "\n", "ctx", ".", "SetStatusCode", "(", "StatusNotFound", ")", "\n", "ctx", ".", "SetBodyString", "(", "\"", "\"", ")", "\n", "}" ]
972
all-973
[ "HasTextAlign", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "n", "*", "NoteDefinition", ")", "HasTextAlign", "(", ")", "bool", "{", "if", "n", "!=", "nil", "&&", "n", ".", "TextAlign", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
973
all-974
[ "render", "primitives", "from", "array", "data" ]
[ "func", "DrawArrays", "(", "<mask>", "uint32", ",", "first", "int32", ",", "count", "int32", ")", "{", "syscall", ".", "Syscall", "(", "gpDrawArrays", ",", "3", ",", "uintptr", "(", "mode", ")", ",", "uintptr", "(", "first", ")", ",", "uintptr", "(", "count", ")", ")", "\n", "}" ]
974
all-975
[ "ApplyTransition", "calls", "the", "function", "required", "to", "move", "to", "the", "specified", "status" ]
[ "func", "(", "cgroup", "*", "CgroupResource", ")", "ApplyTransition", "(", "nextState", "resourcestatus", ".", "ResourceStatus", ")", "error", "{", "transitionFunc", ",", "ok", ":=", "cgroup", ".", "statusToTransitions", "[", "nextState", "]", "\n", "if", "!", "<mask>", "{", "seelog", ".", "Errorf", "(", "\"", "\"", ",", "cgroup", ".", "taskARN", ",", "cgroup", ".", "GetName", "(", ")", ",", "cgroup", ".", "StatusString", "(", "nextState", ")", ")", "\n", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "cgroup", ".", "GetName", "(", ")", ",", "cgroup", ".", "StatusString", "(", "nextState", ")", ")", "\n", "}", "\n", "return", "transitionFunc", "(", ")", "\n", "}" ]
975
all-976
[ "Serve", "accepts", "an", "incoming", "TELNET", "client", "connection", "on", "the", "net", ".", "Listener", "listener", "." ]
[ "func", "(", "server", "*", "Server", ")", "Serve", "(", "listener", "net", ".", "Listener", ")", "error", "{", "defer", "listener", ".", "Close", "(", ")", "\n\n\n", "logger", ":=", "server", ".", "logger", "(", ")", "\n\n\n", "handler", ":=", "server", ".", "Handler", "\n", "if", "nil", "==", "handler", "{", "//@TODO: Should this be a \"ShellHandler\" instead, that gives a shell-like experience by default", "// If this is changd, then need to change the comment in the \"type Server struct\" definition.", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n", "<mask>", "=", "EchoHandler", "\n", "}", "\n\n\n", "for", "{", "// Wait for a new TELNET client connection.", "logger", ".", "Debugf", "(", "\"", "\"", ",", "listener", ".", "Addr", "(", ")", ")", "\n", "conn", ",", "err", ":=", "listener", ".", "Accept", "(", ")", "\n", "if", "err", "!=", "nil", "{", "//@TODO: Could try to recover from certain kinds of errors. Maybe waiting a while before trying again.", "return", "err", "\n", "}", "\n", "logger", ".", "Debugf", "(", "\"", "\"", ",", "conn", ".", "RemoteAddr", "(", ")", ")", "\n\n", "// Handle the new TELNET client connection by spawning", "// a new goroutine.", "go", "server", ".", "handle", "(", "conn", ",", "handler", ")", "\n", "logger", ".", "Debugf", "(", "\"", "\"", ",", "conn", ".", "RemoteAddr", "(", ")", ")", "\n", "}", "\n", "}" ]
976
all-977
[ "HasIsAdmin", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "CreatedBy", ")", "HasIsAdmin", "(", ")", "bool", "{", "if", "c", "!=", "nil", "&&", "c", ".", "IsAdmin", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
977
all-978
[ "CONTRACT", ":", "rv", ".", "CanAddr", "()", "is", "true", "." ]
[ "func", "(", "cdc", "*", "Codec", ")", "decodeReflectBinaryByteArray", "(", "bz", "[", "]", "byte", ",", "info", "*", "TypeInfo", ",", "rv", "reflect", ".", "<mask>", ",", "fopts", "FieldOptions", ")", "(", "n", "int", ",", "err", "error", ")", "{", "if", "!", "rv", ".", "CanAddr", "(", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "printLog", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "defer", "func", "(", ")", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "}", "(", ")", "\n", "}", "\n", "ert", ":=", "info", ".", "Type", ".", "Elem", "(", ")", "\n", "if", "ert", ".", "Kind", "(", ")", "!=", "reflect", ".", "Uint8", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "length", ":=", "info", ".", "Type", ".", "Len", "(", ")", "\n", "if", "len", "(", "bz", ")", "<", "length", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "length", ")", "\n", "}", "\n\n", "// Read byte-length prefixed byteslice.", "var", "byteslice", ",", "_n", "=", "[", "]", "byte", "(", "nil", ")", ",", "int", "(", "0", ")", "\n", "byteslice", ",", "_n", ",", "err", "=", "DecodeByteSlice", "(", "bz", ")", "\n", "if", "slide", "(", "&", "bz", ",", "&", "n", ",", "_n", ")", "&&", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "if", "len", "(", "byteslice", ")", "!=", "length", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "length", ",", "len", "(", "byteslice", ")", ")", "\n", "return", "\n", "}", "\n\n", "// Copy read byteslice to rv array.", "reflect", ".", "Copy", "(", "rv", ",", "reflect", ".", "ValueOf", "(", "byteslice", ")", ")", "\n", "return", "\n", "}" ]
978
all-979
[ "DeviceIsGrabbed", "()", "is", "a", "wrapper", "around", "gdk_display_device_is_grabbed", "()", "." ]
[ "func", "(", "v", "*", "Display", ")", "DeviceIsGrabbed", "(", "device", "*", "Device", ")", "bool", "{", "c", ":=", "C", ".", "gdk_display_device_is_grabbed", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "native", "(", ")", ")", "\n", "return", "gobool", "(", "c", ")", "\n", "}" ]
979
all-980
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StopSamplingReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
980
all-981
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetInfoParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoSysteminfo4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
981
all-982
[ "query", "information", "about", "an", "active", "uniform", "block" ]
[ "func", "GetActiveUniformBlockiv", "(", "<mask>", "uint32", ",", "uniformBlockIndex", "uint32", ",", "pname", "uint32", ",", "params", "*", "int32", ")", "{", "C", ".", "glowGetActiveUniformBlockiv", "(", "gpGetActiveUniformBlockiv", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLuint", ")", "(", "uniformBlockIndex", ")", ",", "(", "C", ".", "GLenum", ")", "(", "pname", ")", ",", "(", "*", "C", ".", "GLint", ")", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
982
all-983
[ "NewMockInfoLogger", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockInfoLogger", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockInfoLogger", "{", "mock", ":=", "&", "MockInfoLogger", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockInfoLoggerMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
983
all-984
[ "SetColors", "sets", "all", "colors", "values", "in", "the", "RGBA", "." ]
[ "func", "(", "c", "*", "RGBA", ")", "SetColors", "(", "r", ",", "g", ",", "b", ",", "a", "float64", ")", "{", "c", ".", "rgba", ".", "red", "=", "C", ".", "gdouble", "(", "r", ")", "\n", "c", ".", "rgba", ".", "<mask>", "=", "C", ".", "gdouble", "(", "g", ")", "\n", "c", ".", "rgba", ".", "blue", "=", "C", ".", "gdouble", "(", "b", ")", "\n", "c", ".", "rgba", ".", "alpha", "=", "C", ".", "gdouble", "(", "a", ")", "\n", "}" ]
984
all-985
[ "Write", "meta", "-", "info", "to", "specified", "place" ]
[ "func", "(", "fb", "*", "fileBlock", ")", "writeTo", "(", "writer", "io", ".", "WriteSeeker", ",", "offset", "int64", ")", "error", "{", "_", ",", "err", ":=", "writer", ".", "Seek", "(", "offset", ",", "os", ".", "SEEK_SET", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "binary", ".", "Write", "(", "<mask>", ",", "binary", ".", "LittleEndian", ",", "*", "fb", ")", "\n", "}" ]
985
all-986
[ "GetID", "()", "is", "a", "wrapper", "around", "g_settings_schema_get_id", "()", "." ]
[ "func", "(", "v", "*", "SettingsSchema", ")", "GetID", "(", ")", "string", "{", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "C", ".", "g_settings_schema_get_id", "(", "v", ".", "native", "(", ")", ")", ")", ")", "\n", "}" ]
986
all-987
[ "indexesOutsideRange", "returns", "the", "indexes", "of", "times", "in", "results", "that", "are", "outside", "of", "[", "start", "end", ")", ".", "indexesOutsideRange", "panics", "if", "start", "is", "later", "than", "end", "." ]
[ "func", "indexesOutsideRange", "(", "start", "time", ".", "Time", ",", "end", "time", ".", "Time", ",", "results", "[", "]", "<mask>", ".", "Time", ")", "[", "]", "int", "{", "if", "start", ".", "After", "(", "end", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "indexes", ":=", "make", "(", "[", "]", "int", ",", "0", ",", "len", "(", "results", ")", ")", "\n", "for", "i", ",", "result", ":=", "range", "results", "{", "if", "result", ".", "Equal", "(", "end", ")", "||", "result", ".", "After", "(", "end", ")", "{", "indexes", "=", "append", "(", "indexes", ",", "i", ")", "\n", "}", "\n", "if", "result", ".", "Before", "(", "start", ")", "{", "indexes", "=", "append", "(", "indexes", ",", "i", ")", "\n", "}", "\n", "}", "\n", "return", "indexes", "\n", "}" ]
987
all-988
[ "Identical", "to", "os", ".", "Environ", "but", "limited", "to", "the", "environment", "variable", "equivalents", "for", "the", "flags", "your", "program", "cares", "about", "." ]
[ "func", "Environ", "(", ")", "[", "]", "string", "{", "s", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n\n", "FlagSet", ".", "VisitAll", "(", "func", "(", "f", "*", "<mask>", ".", "Flag", ")", "{", "if", "value", ",", "ok", ":=", "getenv", "(", "f", ".", "Name", ")", ";", "ok", "{", "s", "=", "append", "(", "s", ",", "flagAsEnv", "(", "f", ".", "Name", ")", "+", "\"", "\"", "+", "value", ")", "\n", "}", "\n", "}", ")", "\n\n", "return", "s", "\n", "}" ]
988
all-989
[ "ReadInt32", "returns", "an", "int32", "read", "from", "address", "a", "of", "the", "inferior", "." ]
[ "func", "(", "p", "*", "<mask>", ")", "ReadInt32", "(", "a", "Address", ")", "int32", "{", "return", "int32", "(", "p", ".", "ReadUint32", "(", "a", ")", ")", "\n", "}" ]
989
all-990
[ "Value", "satisfy", "driver", ".", "Valuer", "interface", "." ]
[ "func", "(", "b", "Bag", ")", "Value", "(", ")", "(", "driver", ".", "<mask>", ",", "error", ")", "{", "buf", ":=", "bytes", ".", "NewBuffer", "(", "nil", ")", "\n", "err", ":=", "gob", ".", "NewEncoder", "(", "buf", ")", ".", "Encode", "(", "b", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "buf", ".", "Bytes", "(", ")", ",", "nil", "\n", "}" ]
990
all-991
[ "Validate", "checks", "all", "things", "are", "well", "and", "constructs", "the", "CLI", "args", "to", "the", "message", "service" ]
[ "func", "(", "m", "*", "PactReificationRequest", ")", "Validate", "(", ")", "error", "{", "m", ".", "Args", "=", "[", "]", "string", "{", "}", "\n\n", "body", ",", "err", ":=", "json", ".", "Marshal", "(", "m", ".", "Message", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "m", ".", "Args", "=", "append", "(", "m", ".", "Args", ",", "[", "]", "string", "{", "\"", "\"", ",", "string", "(", "<mask>", ")", ",", "}", "...", ")", "\n\n", "return", "nil", "\n", "}" ]
991
all-992
[ "Set", "sets", "key", "=", "value", "argument", "." ]
[ "func", "(", "a", "*", "Args", ")", "<mask>", "(", "key", ",", "value", "string", ")", "{", "a", ".", "args", "=", "setArg", "(", "a", ".", "args", ",", "key", ",", "value", ",", "argsHasValue", ")", "\n", "}" ]
992
all-993
[ "SetAuthors", "is", "a", "wrapper", "around", "gtk_about_dialog_set_authors", "()", "." ]
[ "func", "(", "v", "*", "AboutDialog", ")", "SetAuthors", "(", "authors", "[", "]", "string", ")", "{", "cauthors", ":=", "C", ".", "make_strings", "(", "C", ".", "int", "(", "len", "(", "authors", ")", "+", "1", ")", ")", "\n", "for", "i", ",", "<mask>", ":=", "range", "authors", "{", "cstr", ":=", "C", ".", "CString", "(", "author", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "set_string", "(", "cauthors", ",", "C", ".", "int", "(", "i", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}", "\n\n", "C", ".", "set_string", "(", "cauthors", ",", "C", ".", "int", "(", "len", "(", "authors", ")", ")", ",", "nil", ")", "\n", "C", ".", "gtk_about_dialog_set_authors", "(", "v", ".", "native", "(", ")", ",", "cauthors", ")", "\n", "C", ".", "destroy_strings", "(", "cauthors", ")", "\n", "}" ]
993
all-994
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "<mask>", ")", "Locator", "(", "api", "*", "API", ")", "*", "ImageLocator", "{", "for", "_", ",", "l", ":=", "range", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "ImageLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
994
all-995
[ "Shutdown", "executes", "grpc", ".", "Server", ".", "GracefulStop", "method", "." ]
[ "func", "(", "s", "*", "Server", ")", "Shutdown", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "s", ".", "Server", ".", "GracefulStop", "(", ")", "\n", "return", "\n", "}" ]
995
all-996
[ "StopObsessingOverSvc", "creates", "a", "new", "STOP_OBSESSING_OVER_SVC", "Nagios", "command", ".", "Disables", "processing", "of", "service", "checks", "via", "the", "OCSP", "command", "for", "the", "specified", "service", "." ]
[ "func", "StopObsessingOverSvc", "(", "host_name", "<mask>", ",", "service_description", "string", ",", ")", "*", "livestatus", ".", "Command", "{", "return", "livestatus", ".", "NewCommand", "(", "\"", "\"", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "host_name", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "service_description", ")", ",", ")", "\n", "}" ]
996
all-997
[ "ImageList", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockClient", ")", "ImageList", "(", "arg0", "context", ".", "Context", ",", "arg1", "types", ".", "ImageListOptions", ")", "(", "[", "]", "types", ".", "ImageSummary", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "[", "]", "<mask>", ".", "ImageSummary", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
997
all-998
[ "ContainsDiskType", "-" ]
[ "func", "(", "s", "*", "CloudConfigManifest", ")", "ContainsDiskType", "(", "diskTypeName", "string", ")", "(", "result", "bool", ")", "{", "<mask>", "=", "false", "\n", "for", "_", ",", "diskType", ":=", "range", "s", ".", "DiskTypes", "{", "if", "diskType", ".", "Name", "==", "diskTypeName", "{", "result", "=", "true", "\n", "return", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
998
all-999
[ "Seek", "to", "a", "specified", "key", "or", "the", "next", "bigger", "one", "if", "an", "item", "with", "key", "does", "not", "exist", "." ]
[ "func", "(", "it", "*", "Iterator", ")", "Seek", "(", "bs", "[", "]", "byte", ")", "{", "itm", ":=", "it", ".", "snap", ".", "db", ".", "newItem", "(", "bs", ",", "false", ")", "\n", "<mask>", ".", "iter", ".", "Seek", "(", "unsafe", ".", "Pointer", "(", "itm", ")", ")", "\n", "it", ".", "skipUnwanted", "(", ")", "\n", "}" ]
999
all-1000
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "CallFunctionOnParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime47", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]