id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
4,400
all-4401
[ "FilterAttrTopN", "creates", "a", "TopN", "query", "with", "the", "given", "item", "count", "row", "attribute", "name", "and", "filter", "values", "for", "that", "field", "The", "attrName", "and", "attrValues", "arguments", "work", "together", "to", "only", "return", "Rows", "which", "have", "the", "attribute", "specified", "by", "attrName", "with", "one", "of", "the", "values", "specified", "in", "attrValues", "." ]
[ "func", "(", "f", "*", "<mask>", ")", "FilterAttrTopN", "(", "n", "uint64", ",", "row", "*", "PQLRowQuery", ",", "attrName", "string", ",", "attrValues", "...", "interface", "{", "}", ")", "*", "PQLRowQuery", "{", "return", "f", ".", "filterAttrTopN", "(", "n", ",", "row", ",", "attrName", ",", "attrValues", "...", ")", "\n", "}" ]
4,401
all-4402
[ "ForLocalInspectionWithPreparedStmts", "is", "the", "same", "as", "ForLocalInspection", "but", "it", "also", "prepares", "the", "statements", "used", "in", "auto", "-", "generated", "database", "code", "." ]
[ "func", "ForLocalInspectionWithPreparedStmts", "(", "db", "*", "sql", ".", "DB", ")", "(", "*", "Cluster", ",", "error", ")", "{", "c", ":=", "ForLocalInspection", "(", "db", ")", "\n\n", "stmts", ",", "err", ":=", "cluster", ".", "PrepareStmts", "(", "c", ".", "db", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "<mask>", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "c", ".", "stmts", "=", "stmts", "\n\n", "return", "c", ",", "nil", "\n", "}" ]
4,402
all-4403
[ "Del", "deletes", "header", "with", "the", "given", "key", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "Del", "(", "<mask>", "string", ")", "{", "h", ".", "parseRawHeaders", "(", ")", "\n", "k", ":=", "getHeaderKeyBytes", "(", "&", "h", ".", "bufKV", ",", "key", ",", "h", ".", "disableNormalizing", ")", "\n", "h", ".", "del", "(", "k", ")", "\n", "}" ]
4,403
all-4404
[ "legacyEndpointsFromService", "tries", "to", "retrieve", "Endpoints", "from", "Services", "annotated", "with", "legacy", "annotations", "." ]
[ "func", "legacyEndpointsFromService", "(", "svc", "*", "v1", ".", "Service", ",", "compatibility", "string", ")", "[", "]", "*", "endpoint", ".", "Endpoint", "{", "<mask>", "compatibility", "{", "case", "\"", "\"", ":", "return", "legacyEndpointsFromMateService", "(", "svc", ")", "\n", "case", "\"", "\"", ":", "return", "legacyEndpointsFromMoleculeService", "(", "svc", ")", "\n", "}", "\n\n", "return", "[", "]", "*", "endpoint", ".", "Endpoint", "{", "}", "\n", "}" ]
4,404
all-4405
[ "WithRoute", "adds", "the", "route", "to", "the", "delete", "apps", "app", "routes", "route", "params" ]
[ "func", "(", "o", "*", "DeleteAppsAppRoutesRouteParams", ")", "WithRoute", "(", "route", "string", ")", "*", "DeleteAppsAppRoutesRouteParams", "{", "o", ".", "SetRoute", "(", "<mask>", ")", "\n", "return", "o", "\n", "}" ]
4,405
all-4406
[ "NextEvent", "will", "return", "the", "next", "notification", "from", "the", "backend", "as", "it", "occurs", "and", "will", "send", "it", "to", "the", "correct", "channel", "." ]
[ "func", "(", "s", "*", "Session", ")", "NextEvent", "(", "channel", "NotificationsChannel", ",", "lastEventID", "string", ")", "*", "Error", "{", "currentURL", ":=", "s", ".", "URL", "+", "\"", "\"", "\n", "if", "lastEventID", "!=", "\"", "\"", "{", "currentURL", "+=", "\"", "\"", "+", "lastEventID", "\n", "}", "\n\n", "request", ",", "err", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "currentURL", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NewBambouError", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "response", ",", "berr", ":=", "s", ".", "<mask>", "(", "request", ",", "nil", ")", "\n", "if", "berr", "!=", "nil", "{", "return", "berr", "\n", "}", "\n", "defer", "response", ".", "Body", ".", "Close", "(", ")", "\n\n", "notification", ":=", "NewNotification", "(", ")", "\n", "if", "err", ":=", "json", ".", "NewDecoder", "(", "response", ".", "Body", ")", ".", "Decode", "(", "notification", ")", ";", "err", "!=", "nil", "{", "return", "NewBambouError", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "if", "len", "(", "notification", ".", "Events", ")", ">", "0", "{", "channel", "<-", "notification", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
4,406
all-4407
[ "GetOperations", "retrieves", "the", "Operations", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "TransactionMeta", ")", "GetOperations", "(", ")", "(", "result", "[", "]", "OperationMeta", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "V", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "Operations", "\n", "<mask>", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
4,407
all-4408
[ "keyIsExpired", "deletes", "the", "key", "from", "cache", "if", "it", "is", "expired" ]
[ "func", "(", "mkc", "*", "memoryKeyCacher", ")", "keyIsExpired", "(", "keyID", "string", ")", "bool", "{", "if", "time", ".", "Now", "(", ")", ".", "After", "(", "mkc", ".", "entries", "[", "keyID", "]", ".", "addedAt", ".", "Add", "(", "mkc", ".", "maxKeyAge", ")", ")", "{", "<mask>", "(", "mkc", ".", "entries", ",", "keyID", ")", "\n", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
4,408
all-4409
[ "GetUser", "fetches", "a", "user", "if", "authenticated", "and", "exists" ]
[ "func", "GetUser", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "w", ".", "Header", "(", ")", ".", "<mask>", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "// Get username from path", "a", ":=", "strings", ".", "Split", "(", "r", ".", "URL", ".", "Path", ",", "\"", "\"", ")", "\n", "id", ",", "_", ":=", "strconv", ".", "Atoi", "(", "a", "[", "len", "(", "a", ")", "-", "1", "]", ")", "\n\n", "user", ",", "err", ":=", "userRepository", ".", "ByID", "(", "id", ")", "\n", "if", "err", "!=", "nil", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusNotFound", ")", "\n", "}", "else", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusOK", ")", "\n", "resBody", ",", "_", ":=", "json", ".", "Marshal", "(", "user", ")", "\n", "w", ".", "Write", "(", "resBody", ")", "\n", "}", "\n", "}" ]
4,409
all-4410
[ "post", "puts", "a", "watch", "response", "on", "the", "watcher", "s", "proxy", "stream", "channel" ]
[ "func", "(", "w", "*", "watcher", ")", "post", "(", "wr", "*", "pb", ".", "WatchResponse", ")", "bool", "{", "select", "{", "case", "w", ".", "wps", ".", "watchCh", "<-", "wr", ":", "case", "<-", "time", ".", "After", "(", "50", "*", "<mask>", ".", "Millisecond", ")", ":", "w", ".", "wps", ".", "cancel", "(", ")", "\n", "return", "false", "\n", "}", "\n", "return", "true", "\n", "}" ]
4,410
all-4411
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ProfileNode", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoProfiler16", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
4,411
all-4412
[ "SeekPathMatch", "seeks", "an", "entry", "which", "matches", "path", "or", "returns", "nil", "nil", "when", "no", "match", "is", "found", ".", "Returned", "key", "may", "be", "path", "or", "a", "matching", "dynamic", "path", ".", "Matches", "are", "exclusive", "if", "the", "set", "of", "keys", "are", "conflict", "free", "(", "see", "SeekPathConflict", ")", "." ]
[ "func", "SeekPathMatch", "(", "c", "*", "bolt", ".", "Cursor", ",", "path", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "[", "]", "byte", ")", "{", "// Validation", "if", "len", "(", "path", ")", "==", "0", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "if", "path", "[", "0", "]", "!=", "'/'", "{", "return", "nil", ",", "nil", "\n", "}", "\n\n", "// Exact match fast-path", "if", "k", ",", "v", ":=", "c", ".", "Seek", "(", "path", ")", ";", "bytes", ".", "Equal", "(", "k", ",", "path", ")", "{", "return", "k", ",", "v", "\n", "}", "\n\n", "// Prefix scan", "prefixBuf", ":=", "bytes", ".", "NewBuffer", "(", "make", "(", "[", "]", "byte", ",", "0", ",", "len", "(", "path", ")", ")", ")", "\n", "for", "{", "// Match slash", "prefixBuf", ".", "WriteByte", "(", "'/'", ")", "\n", "prefix", ":=", "prefixBuf", ".", "Bytes", "(", ")", "\n", "k", ",", "v", ":=", "c", ".", "Seek", "(", "prefix", ")", "\n", "if", "!", "bytes", ".", "HasPrefix", "(", "k", ",", "prefix", ")", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "// Advance past '/'", "path", "=", "path", "[", "1", ":", "]", "\n\n", "// Exact match required for trailing slash.", "if", "len", "(", "path", ")", "==", "0", "{", "if", "len", "(", "k", ")", "==", "len", "(", "prefix", ")", "{", "return", "k", ",", "v", "\n", "}", "\n", "return", "nil", ",", "nil", "\n", "}", "\n\n", "// Advance cursor past exact match to first prefix match.", "if", "len", "(", "k", ")", "==", "len", "(", "prefix", ")", "{", "k", ",", "v", "=", "c", ".", "Next", "(", ")", "\n", "if", "!", "bytes", ".", "HasPrefix", "(", "k", ",", "prefix", ")", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "}", "\n\n", "// Find end of element.", "i", ":=", "bytes", ".", "IndexByte", "(", "path", ",", "'/'", ")", "\n", "last", ":=", "i", "<", "0", "\n\n", "switch", "k", "[", "len", "(", "prefix", ")", "]", "{", "case", "'*'", ":", "return", "k", ",", "v", "\n\n", "case", "':'", ":", "// Append variable path element to prefix", "ki", ":=", "bytes", ".", "IndexByte", "(", "k", "[", "len", "(", "prefix", ")", ":", "]", ",", "'/'", ")", "\n", "if", "ki", "<", "0", "{", "prefixBuf", ".", "Write", "(", "k", "[", "len", "(", "<mask>", ")", ":", "]", ")", "\n", "}", "else", "{", "prefixBuf", ".", "Write", "(", "k", "[", "len", "(", "prefix", ")", ":", "len", "(", "prefix", ")", "+", "ki", "]", ")", "\n", "}", "\n\n", "if", "last", "{", "// Exact match required for last element.", "prefix", "=", "prefixBuf", ".", "Bytes", "(", ")", "\n", "if", "k", ",", "v", "=", "c", ".", "Seek", "(", "prefix", ")", ";", "bytes", ".", "Equal", "(", "k", ",", "prefix", ")", "{", "return", "k", ",", "v", "\n", "}", "\n", "return", "nil", ",", "nil", "\n", "}", "\n\n", "default", ":", "// Append path component to prefix.", "if", "last", "{", "prefixBuf", ".", "Write", "(", "path", ")", "\n", "}", "else", "{", "prefixBuf", ".", "Write", "(", "path", "[", ":", "i", "]", ")", "\n", "}", "\n\n", "prefix", "=", "prefixBuf", ".", "Bytes", "(", ")", "\n", "k", ",", "v", "=", "c", ".", "Seek", "(", "prefix", ")", "\n\n", "if", "last", "{", "// Exact match required for last element.", "if", "bytes", ".", "Equal", "(", "k", ",", "prefix", ")", "{", "return", "k", ",", "v", "\n", "}", "\n", "return", "nil", ",", "nil", "\n", "}", "\n\n", "// Prefix match required for other elements.", "if", "!", "bytes", ".", "HasPrefix", "(", "k", ",", "prefix", ")", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "}", "\n\n", "// Advance past element.", "path", "=", "path", "[", "i", ":", "]", "\n", "}", "\n", "}" ]
4,412
all-4413
[ "SetHeader", "sets", "given", "header", "name", "to", "the", "given", "value", ".", "If", "the", "header", "exists", "already", "all", "existing", "values", "are", "replaced", "." ]
[ "func", "(", "e", "*", "Envelope", ")", "SetHeader", "(", "name", "string", ",", "value", "[", "]", "string", ")", "error", "{", "if", "name", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "for", "i", ",", "v", ":=", "range", "value", "{", "if", "i", "==", "0", "{", "e", ".", "<mask>", ".", "Set", "(", "name", ",", "mime", ".", "BEncoding", ".", "Encode", "(", "\"", "\"", ",", "v", ")", ")", "\n", "continue", "\n", "}", "\n", "e", ".", "header", ".", "Add", "(", "name", ",", "mime", ".", "BEncoding", ".", "Encode", "(", "\"", "\"", ",", "v", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
4,413
all-4414
[ "Normalize", "all", "auth", "types", "into", "a", "uniform", "dockerAuths", "type", ".", "On", "error", "any", "appropriate", "information", "will", "be", "logged", "and", "an", "empty", "dockerAuths", "will", "be", "returned" ]
[ "func", "parseAuthData", "(", "authType", "string", ",", "authData", "json", ".", "RawMessage", ")", "dockerAuths", "{", "intermediateAuthData", ":=", "make", "(", "dockerAuths", ")", "\n", "switch", "authType", "{", "case", "\"", "\"", ":", "err", ":=", "json", ".", "Unmarshal", "(", "authData", ",", "&", "intermediateAuthData", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "dockerAuths", "{", "}", "\n", "}", "\n", "case", "\"", "\"", ":", "var", "base64dAuthInfo", "dockercfgData", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "authData", ",", "&", "base64dAuthInfo", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "dockerAuths", "{", "}", "\n", "}", "\n\n", "for", "registry", ",", "auth", ":=", "range", "base64dAuthInfo", "{", "data", ",", "err", ":=", "base64", ".", "StdEncoding", ".", "DecodeString", "(", "auth", ".", "Auth", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "registry", ")", "\n", "continue", "\n", "}", "\n\n", "usernamePass", ":=", "strings", ".", "SplitN", "(", "string", "(", "data", ")", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "usernamePass", ")", "!=", "2", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "registry", ")", "\n", "continue", "\n", "}", "\n", "intermediateAuthData", "[", "registry", "]", "=", "types", ".", "AuthConfig", "{", "Username", ":", "usernamePass", "[", "0", "]", ",", "Password", ":", "usernamePass", "[", "1", "]", ",", "}", "\n", "}", "\n", "case", "\"", "\"", ":", "// not set; no warn", "return", "dockerAuths", "{", "}", "\n", "default", ":", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "authType", ")", "\n", "return", "dockerAuths", "{", "}", "\n", "}", "\n\n", "// Normalize intermediate registry keys into not having a schema", "<mask>", ":=", "make", "(", "dockerAuths", ")", "\n", "for", "key", ",", "val", ":=", "range", "intermediateAuthData", "{", "output", "[", "stripRegistrySchema", "(", "key", ")", "]", "=", "val", "\n", "}", "\n", "return", "output", "\n", "}" ]
4,414
all-4415
[ "run", "starts", "async", "log", "records", "processing", "." ]
[ "func", "(", "logger", "*", "Logger", ")", "run", "(", ")", "{", "defer", "func", "(", ")", "{", "logger", ".", "WaitForUnprocessedRecords", "(", ")", "\n", "logger", ".", "closeHandlers", "(", ")", "\n", "}", "(", ")", "\n", "recordLoop", ":", "for", "{", "select", "{", "case", "<mask>", ":=", "<-", "logger", ".", "recordChannel", ":", "record", ".", "process", "(", "logger", ")", "\n", "case", "state", ":=", "<-", "logger", ".", "stateChannel", ":", "switch", "state", "{", "case", "stopped", ":", "break", "recordLoop", "\n", "case", "paused", ":", "stateLoop", ":", "for", "{", "select", "{", "case", "state", ":=", "<-", "logger", ".", "stateChannel", ":", "switch", "state", "{", "case", "stopped", ":", "break", "recordLoop", "\n", "case", "running", ":", "break", "stateLoop", "\n", "default", ":", "continue", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
4,415
all-4416
[ "NewCheckBundle", "returns", "new", "CheckBundle", "(", "with", "defaults", "if", "applicable", ")" ]
[ "func", "NewCheckBundle", "(", ")", "*", "CheckBundle", "{", "return", "&", "CheckBundle", "{", "Config", ":", "make", "(", "CheckBundleConfig", ",", "config", ".", "DefaultConfigOptionsSize", ")", ",", "MetricLimit", ":", "config", ".", "DefaultCheckBundleMetricLimit", ",", "Period", ":", "config", ".", "DefaultCheckBundlePeriod", ",", "Timeout", ":", "config", ".", "DefaultCheckBundleTimeout", ",", "<mask>", ":", "config", ".", "DefaultCheckBundleStatus", ",", "}", "\n", "}" ]
4,416
all-4417
[ "GtkWidget", "*", "gtk_popover_get_default_widget", "(", "GtkPopover", "*", "popover", ")", ";" ]
[ "func", "(", "p", "*", "Popover", ")", "GetDefaultWidget", "(", ")", "*", "Widget", "{", "w", ":=", "C", ".", "gtk_popover_get_default_widget", "(", "p", ".", "native", "(", ")", ")", "\n", "if", "w", "==", "nil", "{", "<mask>", "nil", "\n", "}", "\n", "return", "&", "Widget", "{", "glib", ".", "InitiallyUnowned", "{", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "w", ")", ")", "}", "}", "\n", "}" ]
4,417
all-4418
[ "IsGamepadButtonPressed", "returns", "the", "boolean", "indicating", "the", "given", "button", "of", "the", "gamepad", "(", "id", ")", "is", "pressed", "or", "not", ".", "IsGamepadButtonPressed", "is", "concurrent", "-", "safe", ".", "The", "relationships", "between", "physical", "buttons", "and", "buttion", "IDs", "depend", "on", "environments", ".", "There", "can", "be", "differences", "even", "between", "Chrome", "and", "Firefox", ".", "IsGamepadButtonPressed", "always", "returns", "false", "on", "mobiles", "." ]
[ "func", "IsGamepadButtonPressed", "(", "<mask>", "int", ",", "button", "GamepadButton", ")", "bool", "{", "return", "uiDriver", "(", ")", ".", "Input", "(", ")", ".", "IsGamepadButtonPressed", "(", "id", ",", "driver", ".", "GamepadButton", "(", "button", ")", ")", "\n", "}" ]
4,418
all-4419
[ "NewEndpointCommand", "returns", "the", "cobra", "command", "for", "endpoint", "." ]
[ "func", "NewEndpointCommand", "(", ")", "*", "cobra", ".", "Command", "{", "ec", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "}", "\n\n", "ec", ".", "PersistentFlags", "(", ")", ".", "BoolVar", "(", "&", "epClusterEndpoints", ",", "\"", "\"", ",", "<mask>", ",", "\"", "\"", ")", "\n", "ec", ".", "AddCommand", "(", "newEpHealthCommand", "(", ")", ")", "\n", "ec", ".", "AddCommand", "(", "newEpStatusCommand", "(", ")", ")", "\n", "ec", ".", "AddCommand", "(", "newEpHashKVCommand", "(", ")", ")", "\n\n", "return", "ec", "\n", "}" ]
4,419
all-4420
[ "FieldByName", "returns", "the", "field", "with", "the", "given", "name", "if", "any", "." ]
[ "func", "(", "m", "*", "Mapping", ")", "FieldByName", "(", "name", "string", ")", "*", "Field", "{", "for", "_", ",", "field", ":=", "range", "m", ".", "Fields", "{", "if", "field", ".", "Name", "==", "name", "{", "return", "<mask>", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
4,420
all-4421
[ "QuoteMeta", "returns", "a", "string", "that", "quotes", "all", "regular", "expression", "metacharacters", "inside", "the", "argument", "text", ";", "the", "returned", "string", "is", "a", "regular", "expression", "matching", "the", "literal", "text", ".", "For", "example", "QuoteMeta", "(", "[", "foo", "]", ")", "returns", "\\", "[", "foo", "\\", "]", "." ]
[ "func", "QuoteMeta", "(", "s", "string", ")", "string", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "2", "*", "len", "(", "s", ")", ")", "\n\n", "// A byte loop is correct because all metacharacters are ASCII.", "j", ":=", "0", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "s", ")", ";", "i", "++", "{", "if", "<mask>", "(", "int", "(", "s", "[", "i", "]", ")", ")", "{", "b", "[", "j", "]", "=", "'\\\\'", "\n", "j", "++", "\n", "}", "\n", "b", "[", "j", "]", "=", "s", "[", "i", "]", "\n", "j", "++", "\n", "}", "\n", "return", "string", "(", "b", "[", "0", ":", "j", "]", ")", "\n", "}" ]
4,421
all-4422
[ "largeDataPagedQuery", "builds", "a", "job", "and", "inserts", "it", "into", "the", "job", "queue", "allowing", "the", "flexibility", "to", "set", "the", "custom", "AllowLargeResults", "flag", "for", "the", "job" ]
[ "func", "(", "c", "*", "<mask>", ")", "largeDataPagedQuery", "(", "service", "*", "bigquery", ".", "Service", ",", "pageSize", "int", ",", "dataset", ",", "project", ",", "queryStr", "string", ",", "dataChan", "chan", "Data", ")", "(", "[", "]", "[", "]", "interface", "{", "}", ",", "[", "]", "string", ",", "error", ")", "{", "c", ".", "printDebug", "(", "\"", "\"", ")", "\n", "ts", ":=", "time", ".", "Now", "(", ")", "\n", "// start query", "tableRef", ":=", "bigquery", ".", "TableReference", "{", "DatasetId", ":", "dataset", ",", "ProjectId", ":", "project", ",", "TableId", ":", "c", ".", "tempTableName", "}", "\n", "jobConfigQuery", ":=", "bigquery", ".", "JobConfigurationQuery", "{", "}", "\n\n", "datasetRef", ":=", "&", "bigquery", ".", "DatasetReference", "{", "DatasetId", ":", "dataset", ",", "ProjectId", ":", "project", ",", "}", "\n\n", "jobConfigQuery", ".", "AllowLargeResults", "=", "true", "\n", "jobConfigQuery", ".", "Query", "=", "queryStr", "\n", "jobConfigQuery", ".", "DestinationTable", "=", "&", "tableRef", "\n", "jobConfigQuery", ".", "DefaultDataset", "=", "datasetRef", "\n", "if", "!", "c", ".", "flattenResults", "{", "c", ".", "printDebug", "(", "\"", "\"", ")", "\n", "// need a pointer to bool", "f", ":=", "false", "\n", "jobConfigQuery", ".", "FlattenResults", "=", "&", "f", "\n", "}", "\n", "jobConfigQuery", ".", "WriteDisposition", "=", "\"", "\"", "\n", "jobConfigQuery", ".", "CreateDisposition", "=", "\"", "\"", "\n\n", "jobConfig", ":=", "bigquery", ".", "JobConfiguration", "{", "}", "\n\n", "jobConfig", ".", "Query", "=", "&", "jobConfigQuery", "\n\n", "job", ":=", "bigquery", ".", "Job", "{", "}", "\n", "job", ".", "Configuration", "=", "&", "jobConfig", "\n\n", "jobInsert", ":=", "service", ".", "Jobs", ".", "Insert", "(", "project", ",", "&", "job", ")", "\n", "runningJob", ",", "jerr", ":=", "jobInsert", ".", "Do", "(", ")", "\n\n", "if", "jerr", "!=", "nil", "{", "c", ".", "printDebug", "(", "\"", "\"", ",", "jerr", ")", "\n", "if", "dataChan", "!=", "nil", "{", "dataChan", "<-", "Data", "{", "Err", ":", "jerr", "}", "\n", "}", "\n", "return", "nil", ",", "nil", ",", "jerr", "\n", "}", "\n\n", "var", "qr", "*", "bigquery", ".", "GetQueryResultsResponse", "\n", "var", "rows", "[", "]", "[", "]", "interface", "{", "}", "\n", "var", "headers", "[", "]", "string", "\n", "var", "err", "error", "\n\n", "// Periodically, job references are not created, but errors are also not thrown.", "// In this scenario, retry up to 5 times to get a job reference before giving up.", "for", "i", ":=", "1", ";", ";", "i", "++", "{", "r", ":=", "service", ".", "Jobs", ".", "GetQueryResults", "(", "project", ",", "runningJob", ".", "JobReference", ".", "JobId", ")", "\n", "r", ".", "TimeoutMs", "(", "c", ".", "RequestTimeout", ")", "\n", "qr", ",", "err", "=", "r", ".", "Do", "(", ")", "\n\n", "headers", ",", "rows", "=", "c", ".", "headersAndRows", "(", "qr", ".", "Schema", ",", "qr", ".", "Rows", ")", "\n\n", "if", "i", ">=", "maxRequestRetry", "||", "qr", ".", "JobReference", "!=", "nil", "||", "err", "!=", "nil", "{", "if", "i", ">", "1", "{", "c", ".", "printDebug", "(", "\"", "\"", ",", "i", ")", "\n", "}", "\n", "break", "\n", "}", "\n", "}", "\n\n", "if", "err", "==", "nil", "&&", "qr", ".", "JobReference", "==", "nil", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "err", "!=", "nil", "{", "c", ".", "printDebug", "(", "\"", "\"", ",", "err", ")", "\n", "if", "dataChan", "!=", "nil", "{", "dataChan", "<-", "Data", "{", "Err", ":", "err", "}", "\n", "}", "\n", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "rows", ",", "headers", ",", "err", "=", "c", ".", "processPagedQuery", "(", "qr", ".", "JobReference", ",", "qr", ".", "PageToken", ",", "dataChan", ",", "headers", ",", "rows", ")", "\n", "c", ".", "printDebug", "(", "\"", "\"", ",", "time", ".", "Now", "(", ")", ".", "Sub", "(", "ts", ")", ".", "Seconds", "(", ")", ",", "\"", "\"", ")", "\n\n", "return", "rows", ",", "headers", ",", "err", "\n", "}" ]
4,422
all-4423
[ "BackwardLines", "is", "a", "wrapper", "around", "gtk_text_iter_backward_lines", "()", "." ]
[ "func", "(", "v", "*", "TextIter", ")", "BackwardLines", "(", "v1", "int", ")", "bool", "{", "<mask>", "gobool", "(", "C", ".", "gtk_text_iter_backward_lines", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "v1", ")", ")", ")", "\n", "}" ]
4,423
all-4424
[ "Wrap", "wraps", "the", "logger", "in", "a", "Namespaced", "logger", "and", "enables", "the", "specified", "namespaces", ".", "See", "SetNamespaces", "for", "information", "on", "how", "to", "set", "the", "namspaces" ]
[ "func", "Wrap", "(", "ctx", "<mask>", ".", "Interface", ",", "namespaces", "...", "string", ")", "*", "Namespaced", "{", "return", "&", "Namespaced", "{", "Interface", ":", "ctx", ",", "namespaces", ":", "&", "ns", "{", "namespaces", ":", "namespaces", ",", "}", ",", "}", "\n", "}" ]
4,424
all-4425
[ "RegisterFailHandlerWithT", "ensures", "that", "the", "given", "types", ".", "TWithHelper", "and", "fail", "handler", "are", "used", "globally", "." ]
[ "func", "RegisterFailHandlerWithT", "(", "t", "<mask>", ".", "TWithHelper", ",", "handler", "types", ".", "GomegaFailHandler", ")", "{", "if", "handler", "==", "nil", "{", "globalFailWrapper", "=", "nil", "\n", "return", "\n", "}", "\n\n", "globalFailWrapper", "=", "&", "types", ".", "GomegaFailWrapper", "{", "Fail", ":", "handler", ",", "TWithHelper", ":", "t", ",", "}", "\n", "}" ]
4,425
all-4426
[ "GetHTML", "returns", "the", "HTML", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetHTML", "(", ")", "string", "{", "if", "w", "==", "nil", "||", "w", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "w", ".", "HTML", "\n", "}" ]
4,426
all-4427
[ "Snapshot", "is", "used", "to", "manually", "force", "Raft", "to", "take", "a", "snapshot", ".", "Returns", "a", "future", "that", "can", "be", "used", "to", "block", "until", "complete", "and", "that", "contains", "a", "function", "that", "can", "be", "used", "to", "open", "the", "snapshot", "." ]
[ "func", "(", "r", "*", "Raft", ")", "Snapshot", "(", ")", "SnapshotFuture", "{", "<mask>", ":=", "&", "userSnapshotFuture", "{", "}", "\n", "future", ".", "init", "(", ")", "\n", "select", "{", "case", "r", ".", "userSnapshotCh", "<-", "future", ":", "return", "future", "\n", "case", "<-", "r", ".", "shutdownCh", ":", "future", ".", "respond", "(", "ErrRaftShutdown", ")", "\n", "return", "future", "\n", "}", "\n", "}" ]
4,427
all-4428
[ "Retrieves", "a", "Task", "s", "PIDMode" ]
[ "func", "(", "<mask>", "*", "Task", ")", "getPIDMode", "(", ")", "string", "{", "task", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "task", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "task", ".", "PIDMode", "\n", "}" ]
4,428
all-4429
[ "ServeFileContent", "serves", "given", "file", "as", "content", "to", "response", "." ]
[ "func", "(", "ctx", "*", "Context", ")", "ServeFileContent", "(", "file", "string", ",", "names", "...", "string", ")", "{", "var", "name", "string", "\n", "if", "len", "(", "names", ")", ">", "0", "{", "name", "=", "names", "[", "0", "]", "\n", "}", "else", "{", "name", "=", "path", ".", "Base", "(", "file", ")", "\n", "}", "\n\n", "f", ",", "err", ":=", "os", ".", "Open", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "if", "Env", "==", "PROD", "{", "http", ".", "Error", "(", "ctx", ".", "Resp", ",", "\"", "\"", ",", "500", ")", "\n", "}", "else", "{", "http", ".", "Error", "(", "ctx", ".", "Resp", ",", "err", ".", "Error", "(", ")", ",", "500", ")", "\n", "}", "\n", "return", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n\n", "ctx", ".", "setRawContentHeader", "(", ")", "\n", "http", ".", "ServeContent", "(", "ctx", ".", "Resp", ",", "ctx", ".", "Req", ".", "<mask>", ",", "name", ",", "time", ".", "Now", "(", ")", ",", "f", ")", "\n", "}" ]
4,429
all-4430
[ "PromptCmd", "represents", "the", "kubicorn", "interactive", "prompt", "." ]
[ "func", "PromptCmd", "(", ")", "*", "cobra", ".", "Command", "{", "var", "promptCmd", "=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Long", ":", "`Use this command to use the Kubicron API via a shell prompt.\n\t\n\tThis command will open a prompt using go-prompt (with auto-completion) to\n\tallow you to run commands interactively from the shell.\n\tCurrently this doesn't work on Windows systems`", ",", "Run", ":", "func", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "if", "len", "(", "args", ")", ">", "0", "{", "logger", ".", "Critical", "(", "\"", "\"", ")", "\n", "os", ".", "Exit", "(", "1", ")", "\n", "}", "\n\n", "if", "err", ":=", "runPrompt", "(", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Critical", "(", "err", ".", "Error", "(", ")", ")", "\n", "<mask>", ".", "Exit", "(", "1", ")", "\n", "}", "\n", "}", ",", "}", "\n\n", "initializePrompt", "(", ")", "\n\n", "return", "promptCmd", "\n", "}" ]
4,430
all-4431
[ "command", "creates", "an", "exec", ".", "Cmd", "with", "Stderr", "piped", "to", "os", ".", "Stderr", "and", "returns", "the", "args" ]
[ "func", "<mask>", "(", "bin", "string", ",", "args", "...", "string", ")", "(", "[", "]", "string", ",", "*", "exec", ".", "Cmd", ")", "{", "cmd", ":=", "exec", ".", "Command", "(", "bin", ",", "args", "...", ")", "\n", "cmd", ".", "Stderr", "=", "os", ".", "Stderr", "\n", "return", "append", "(", "[", "]", "string", "{", "bin", "}", ",", "args", "...", ")", ",", "cmd", "\n", "}" ]
4,431
all-4432
[ "SetLength", "()", "is", "a", "wrapper", "around", "gtk_print_settings_set_length", "()", "." ]
[ "func", "(", "ps", "*", "PrintSettings", ")", "SetLength", "(", "key", "string", ",", "<mask>", "float64", ",", "unit", "Unit", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "key", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_print_settings_set_length", "(", "ps", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "C", ".", "gdouble", "(", "value", ")", ",", "C", ".", "GtkUnit", "(", "unit", ")", ")", "\n", "}" ]
4,432
all-4433
[ "Start", "an", "HTTP", "server", "for", "the", "endpoint", "associated", "with", "the", "given", "code", "." ]
[ "func", "(", "e", "*", "Endpoints", ")", "serveHTTP", "(", "kind", "kind", ")", "{", "listener", ":=", "e", ".", "listeners", "[", "kind", "]", "\n\n", "if", "listener", "==", "nil", "{", "return", "\n", "}", "\n\n", "ctx", ":=", "log", ".", "Ctx", "{", "\"", "\"", ":", "listener", ".", "Addr", "(", ")", "}", "\n", "if", "e", ".", "inherited", "[", "kind", "]", "{", "ctx", "[", "\"", "\"", "]", "=", "true", "\n", "}", "\n\n", "message", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "descriptions", "[", "kind", "]", ")", "\n", "logger", ".", "Info", "(", "message", ",", "ctx", ")", "\n\n", "server", ":=", "e", ".", "servers", "[", "<mask>", "]", "\n\n", "// Defer the creation of the tomb, so Down() doesn't wait on it unless", "// we actually have spawned at least a server.", "if", "e", ".", "tomb", "==", "nil", "{", "e", ".", "tomb", "=", "&", "tomb", ".", "Tomb", "{", "}", "\n", "}", "\n\n", "e", ".", "tomb", ".", "Go", "(", "func", "(", ")", "error", "{", "server", ".", "Serve", "(", "listener", ")", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
4,433
all-4434
[ "MakeUniq", "makes", "a", "unique", "name", "given", "a", "prefix", "and", "a", "set", "of", "names", "." ]
[ "func", "MakeUniq", "(", "<mask>", "string", ",", "taken", "[", "]", "string", ")", "string", "{", "idx", ":=", "1", "\n", "uniq", ":=", "base", "\n", "inuse", ":=", "true", "\n", "for", "inuse", "{", "inuse", "=", "false", "\n", "for", "_", ",", "gn", ":=", "range", "taken", "{", "if", "gn", "==", "uniq", "{", "inuse", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "inuse", "{", "idx", "++", "\n", "uniq", "=", "base", "+", "strconv", ".", "Itoa", "(", "idx", ")", "\n", "}", "\n", "}", "\n", "return", "uniq", "\n", "}" ]
4,434
all-4435
[ "GetPullRequest", "gets", "a", "pull", "request", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "pulls", "/", "#get", "-", "a", "-", "single", "-", "pull", "-", "request" ]
[ "func", "(", "c", "*", "Client", ")", "GetPullRequest", "(", "org", ",", "repo", "string", ",", "number", "int", ")", "(", "*", "PullRequest", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "repo", ",", "number", ")", "\n", "var", "pr", "PullRequest", "\n", "_", ",", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "// allow the description and draft fields", "// https://developer.github.com/changes/2018-02-22-label-description-search-preview/", "// https://developer.github.com/changes/2019-02-14-draft-pull-requests/", "accept", ":", "\"", "\"", ",", "method", ":", "<mask>", ".", "MethodGet", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "number", ")", ",", "exitCodes", ":", "[", "]", "int", "{", "200", "}", ",", "}", ",", "&", "pr", ")", "\n", "return", "&", "pr", ",", "err", "\n", "}" ]
4,435
all-4436
[ "DumpProfile", "dumps", "the", "profile", "to", "the", "given", "file", "destination", ".", "If", "the", "destination", "is", "-", "it", "instead", "writes", "to", "stdout", "." ]
[ "func", "DumpProfile", "(", "destination", "string", ",", "profile", "[", "]", "*", "cover", ".", "Profile", ")", "error", "{", "var", "output", "io", ".", "Writer", "\n", "if", "destination", "==", "\"", "\"", "{", "<mask>", "=", "os", ".", "Stdout", "\n", "}", "else", "{", "f", ",", "err", ":=", "os", ".", "Create", "(", "destination", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "destination", ",", "err", ")", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n", "output", "=", "f", "\n", "}", "\n", "err", ":=", "cov", ".", "DumpProfile", "(", "profile", ",", "output", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
4,436
all-4437
[ "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", "(", "w", "*", "WidgetConditionalFormat", ")", "GetValueOk", "(", ")", "(", "float64", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "Value", "==", "nil", "{", "return", "0", ",", "false", "\n", "}", "\n", "return", "*", "w", ".", "<mask>", ",", "true", "\n", "}" ]
4,437
all-4438
[ "GetTimer", "gets", "(", "and", "creates", "if", "necessary", ")", "the", "Timer", "for", "a", "given", "code", "section", "." ]
[ "func", "(", "t", "*", "TimerGroup", ")", "GetTimer", "(", "name", "fmt", ".", "Stringer", ")", "*", "Timer", "{", "if", "<mask>", ",", "exists", ":=", "t", ".", "timers", "[", "name", "]", ";", "exists", "{", "return", "timer", "\n", "}", "\n", "timer", ":=", "&", "Timer", "{", "name", ":", "name", ",", "created", ":", "time", ".", "Now", "(", ")", ",", "}", "\n", "t", ".", "timers", "[", "name", "]", "=", "timer", "\n", "return", "timer", "\n", "}" ]
4,438
all-4439
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Frame", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
4,439
all-4440
[ "GetDesiredStatus", "safely", "returns", "the", "desired", "status", "of", "the", "task" ]
[ "func", "(", "cgroup", "*", "CgroupResource", ")", "GetDesiredStatus", "(", ")", "resourcestatus", ".", "ResourceStatus", "{", "cgroup", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "cgroup", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "cgroup", ".", "desiredStatusUnsafe", "\n", "}" ]
4,440
all-4441
[ "Run", "runs", "the", "query", "in", "the", "given", "context", "." ]
[ "func", "(", "q", "*", "Query", ")", "Run", "(", "c", "context", ".", "Context", ")", "*", "Iterator", "{", "if", "q", ".", "err", "!=", "nil", "{", "return", "&", "Iterator", "{", "err", ":", "q", ".", "err", "}", "\n", "}", "\n", "t", ":=", "&", "Iterator", "{", "c", ":", "c", ",", "limit", ":", "q", ".", "<mask>", ",", "count", ":", "q", ".", "count", ",", "q", ":", "q", ",", "prevCC", ":", "q", ".", "start", ",", "}", "\n", "var", "req", "pb", ".", "Query", "\n", "if", "err", ":=", "q", ".", "toProto", "(", "&", "req", ",", "internal", ".", "FullyQualifiedAppID", "(", "c", ")", ")", ";", "err", "!=", "nil", "{", "t", ".", "err", "=", "err", "\n", "return", "t", "\n", "}", "\n", "if", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "&", "req", ",", "&", "t", ".", "res", ")", ";", "err", "!=", "nil", "{", "t", ".", "err", "=", "err", "\n", "return", "t", "\n", "}", "\n", "offset", ":=", "q", ".", "offset", "-", "t", ".", "res", ".", "GetSkippedResults", "(", ")", "\n", "var", "count", "int32", "\n", "if", "t", ".", "count", ">", "0", "&&", "(", "t", ".", "limit", "<", "0", "||", "t", ".", "count", "<", "t", ".", "limit", ")", "{", "count", "=", "t", ".", "count", "\n", "}", "else", "{", "count", "=", "t", ".", "limit", "\n", "}", "\n", "for", "offset", ">", "0", "&&", "t", ".", "res", ".", "GetMoreResults", "(", ")", "{", "t", ".", "prevCC", "=", "t", ".", "res", ".", "CompiledCursor", "\n", "if", "err", ":=", "callNext", "(", "t", ".", "c", ",", "&", "t", ".", "res", ",", "offset", ",", "count", ")", ";", "err", "!=", "nil", "{", "t", ".", "err", "=", "err", "\n", "break", "\n", "}", "\n", "skip", ":=", "t", ".", "res", ".", "GetSkippedResults", "(", ")", "\n", "if", "skip", "<", "0", "{", "t", ".", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "break", "\n", "}", "\n", "offset", "-=", "skip", "\n", "}", "\n", "if", "offset", "<", "0", "{", "t", ".", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "t", "\n", "}" ]
4,441
all-4442
[ "NewClient", "returns", "a", "new", "SCRAM", "-", "*", "client", "with", "the", "provided", "hash", "algorithm", ".", "For", "SCRAM", "-", "SHA", "-", "1", "for", "example", "use", ":", "client", ":", "=", "scram", ".", "NewClient", "(", "sha1", ".", "New", "user", "pass", ")" ]
[ "func", "NewClient", "(", "newHash", "func", "(", ")", "<mask>", ".", "Hash", ",", "user", ",", "pass", "string", ")", "*", "Client", "{", "c", ":=", "&", "Client", "{", "newHash", ":", "newHash", ",", "user", ":", "user", ",", "pass", ":", "pass", ",", "}", "\n", "c", ".", "out", ".", "Grow", "(", "256", ")", "\n", "c", ".", "authMsg", ".", "Grow", "(", "256", ")", "\n", "return", "c", "\n", "}" ]
4,442
all-4443
[ "IsReady", "gives", "a", "boolean", "response", "that", "informs", "the", "caller", "if", "the", "websocket", "connection", "is", "fully", "established", "." ]
[ "func", "(", "cs", "*", "ClientServerImpl", ")", "IsReady", "(", ")", "bool", "{", "cs", ".", "writeLock", ".", "RLock", "(", ")", "\n", "defer", "cs", ".", "writeLock", ".", "RUnlock", "(", ")", "\n\n", "return", "cs", ".", "<mask>", "!=", "nil", "\n", "}" ]
4,443
all-4444
[ "ParseReference", "converts", "a", "string", "which", "should", "not", "start", "with", "the", "ImageTransport", ".", "Name", "prefix", "into", "an", "ImageReference", "." ]
[ "func", "(", "t", "ociTransport", ")", "ParseReference", "(", "reference", "string", ")", "(", "<mask>", ".", "ImageReference", ",", "error", ")", "{", "return", "ParseReference", "(", "reference", ")", "\n", "}" ]
4,444
all-4445
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "<mask>", ")", "Locator", "(", "api", "*", "API", ")", "*", "RouteLocator", "{", "for", "_", ",", "l", ":=", "range", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "RouteLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
4,445
all-4446
[ "SetUint64", "implements", "the", "StableStore", "interface", "." ]
[ "func", "(", "i", "*", "InmemStore", ")", "SetUint64", "(", "key", "[", "]", "byte", ",", "val", "uint64", ")", "error", "{", "i", ".", "l", ".", "Lock", "(", ")", "\n", "defer", "i", ".", "l", ".", "Unlock", "(", ")", "\n", "i", ".", "kvInt", "[", "string", "(", "<mask>", ")", "]", "=", "val", "\n", "return", "nil", "\n", "}" ]
4,446
all-4447
[ "WaitForSingleObject", "waits", "for", "the", "passed", "handle", "to", "be", "signaled", ".", "It", "returns", "true", "if", "the", "handle", "was", "signaled", ";", "false", "otherwise", ".", "See", "https", ":", "//", "msdn", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/", "library", "/", "windows", "/", "desktop", "/", "ms687032", "(", "v", "=", "vs", ".", "85", ")", ".", "aspx", "." ]
[ "func", "WaitForSingleObject", "(", "handle", "uintptr", ",", "msWait", "uint32", ")", "(", "bool", ",", "error", ")", "{", "r1", ",", "_", ",", "err", ":=", "waitForSingleObjectProc", ".", "Call", "(", "handle", ",", "uintptr", "(", "uint32", "(", "msWait", ")", ")", ")", "\n", "switch", "r1", "{", "case", "WAIT_ABANDONED", ",", "WAIT_TIMEOUT", ":", "return", "false", ",", "nil", "\n", "case", "WAIT_SIGNALED", ":", "return", "<mask>", ",", "nil", "\n", "}", "\n", "use", "(", "msWait", ")", "\n", "return", "false", ",", "err", "\n", "}" ]
4,447
all-4448
[ "WithDepth", "the", "maximum", "depth", "at", "which", "Node", "children", "should", "be", "retrieved", "defaults", "to", "1", ".", "Use", "-", "1", "for", "the", "entire", "subtree", "or", "provide", "an", "integer", "larger", "than", "0", "." ]
[ "func", "(", "p", "GetEventListenersParams", ")", "WithDepth", "(", "<mask>", "int64", ")", "*", "GetEventListenersParams", "{", "p", ".", "Depth", "=", "depth", "\n", "return", "&", "p", "\n", "}" ]
4,448
all-4449
[ "Params", "returns", "value", "of", "given", "param", "name", ".", "e", ".", "g", ".", "ctx", ".", "Params", "(", ":", "uid", ")", "or", "ctx", ".", "Params", "(", "uid", ")" ]
[ "func", "(", "ctx", "*", "Context", ")", "Params", "(", "name", "string", ")", "string", "{", "if", "len", "(", "name", ")", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "if", "len", "(", "name", ")", ">", "1", "&&", "name", "[", "0", "]", "!=", "':'", "{", "name", "=", "\"", "\"", "+", "name", "\n", "}", "\n", "return", "ctx", ".", "params", "[", "<mask>", "]", "\n", "}" ]
4,449
all-4450
[ "Usage", "$", "go", "-", "bindata", "data", "/", "$", "go", "build", "&&", ".", "/", "bindata" ]
[ "func", "main", "(", ")", "{", "r", ":=", "gin", ".", "Default", "(", ")", "\n\n", "r", ".", "Use", "(", "static", ".", "Serve", "(", "\"", "\"", ",", "BinaryFileSystem", "(", "\"", "\"", ")", ")", ")", "\n", "r", ".", "<mask>", "(", "\"", "\"", ",", "func", "(", "c", "*", "gin", ".", "Context", ")", "{", "c", ".", "String", "(", "200", ",", "\"", "\"", ")", "\n", "}", ")", "\n", "// Listen and Server in 0.0.0.0:8080", "r", ".", "Run", "(", "\"", "\"", ")", "\n", "}" ]
4,450
all-4451
[ "DropTable", "removes", "the", "table", "from", "database", ".", "If", "table", "isn", "t", "direct", "/", "indirect", "struct", "it", "returns", "error", "." ]
[ "func", "(", "db", "*", "DB", ")", "DropTable", "(", "table", "interface", "{", "}", ")", "error", "{", "_", ",", "_", ",", "tableName", ",", "err", ":=", "db", ".", "tableValueOf", "(", "\"", "\"", ",", "table", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "query", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ".", "dialect", ".", "Quote", "(", "tableName", ")", ")", "\n", "stmt", ",", "err", ":=", "db", ".", "prepare", "(", "query", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "stmt", ".", "Close", "(", ")", "\n", "if", "_", ",", "err", "=", "stmt", ".", "Exec", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
4,451
all-4452
[ "gboolean", "g_action_parse_detailed_name", "(", "const", "gchar", "*", "detailed_name", "gchar", "**", "action_name", "GVariant", "**", "target_value", "GError", "**", "error", ")", ";", "gchar", "*", "g_action_print_detailed_name", "(", "const", "gchar", "*", "action_name", "GVariant", "*", "target_value", ")", ";", "native", "()", "returns", "a", "pointer", "to", "the", "underlying", "GAction", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "native", "(", ")", "*", "C", ".", "GAction", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "C", ".", "toGAction", "(", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", ")", "\n", "}" ]
4,452
all-4453
[ "Run", "executes", "overseer", "if", "an", "error", "is", "encountered", "overseer", "fallsback", "to", "running", "the", "program", "directly", "(", "unless", "Required", "is", "set", ")", "." ]
[ "func", "Run", "(", "c", "Config", ")", "{", "err", ":=", "runErr", "(", "&", "c", ")", "\n", "if", "err", "!=", "nil", "{", "if", "c", ".", "Required", "{", "log", ".", "Fatalf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "else", "if", "c", ".", "Debug", "||", "!", "c", ".", "NoWarn", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "c", ".", "Program", "(", "DisabledState", ")", "\n", "return", "\n", "}", "\n", "<mask>", ".", "Exit", "(", "0", ")", "\n", "}" ]
4,453
all-4454
[ "Err", "returns", "a", "non", "-", "nil", "error", "value", "after", "Done", "is", "closed", "successive", "calls", "to", "Err", "return", "the", "same", "error", ".", "If", "Done", "is", "not", "yet", "closed", "Err", "returns", "nil", ".", "If", "Done", "is", "closed", "Err", "returns", "a", "non", "-", "nil", "error", "explaining", "why", ":", "Canceled", "if", "the", "context", "was", "canceled", "(", "via", "server", "Shutdown", ")", "or", "DeadlineExceeded", "if", "the", "context", "s", "deadline", "passed", "." ]
[ "func", "(", "ctx", "*", "RequestCtx", ")", "Err", "(", ")", "error", "{", "select", "{", "case", "<-", "ctx", ".", "s", ".", "done", ":", "return", "context", ".", "Canceled", "\n", "<mask>", ":", "return", "nil", "\n", "}", "\n", "}" ]
4,454
all-4455
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "StyleSheetHeader", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
4,455
all-4456
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetWebLifecycleStateParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage6", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
4,456
all-4457
[ "HasOptions", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "HasOptions", "(", ")", "bool", "{", "if", "m", "!=", "nil", "&&", "m", ".", "Options", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
4,457
all-4458
[ "State", "returns", "a", "slice", "of", "Notifications", "representing", "the", "files", "being", "watched", "and", "their", "last", "event", "." ]
[ "func", "(", "w", "*", "Watcher", ")", "State", "(", ")", "(", "state", "[", "]", "Notification", ")", "{", "state", "=", "make", "(", "[", "]", "Notification", ",", "0", ")", "\n", "if", "w", ".", "paths", "==", "nil", "{", "return", "\n", "}", "\n", "for", "_", ",", "wi", ":=", "range", "w", ".", "paths", "{", "state", "=", "<mask>", "(", "state", ",", "*", "wi", ".", "Notification", "(", ")", ")", "\n", "}", "\n", "return", "\n", "}" ]
4,458
all-4459
[ "ImageSourceInsert", "inserts", "a", "new", "image", "source", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImageSourceInsert", "(", "id", "int", ",", "server", "string", ",", "protocol", "string", ",", "certificate", "string", ",", "alias", "string", ")", "error", "{", "stmt", ":=", "`INSERT INTO images_source (image_id, server, protocol, certificate, alias) values (?, ?, ?, ?, ?)`", "\n\n", "protocolInt", ":=", "-", "1", "\n", "for", "protoInt", ",", "protoString", ":=", "range", "ImageSourceProtocol", "{", "if", "protoString", "==", "protocol", "{", "protocolInt", "=", "protoInt", "\n", "}", "\n", "}", "\n\n", "if", "protocolInt", "==", "-", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "protocol", ")", "\n", "}", "\n\n", "err", ":=", "<mask>", "(", "c", ".", "db", ",", "stmt", ",", "id", ",", "server", ",", "protocolInt", ",", "certificate", ",", "alias", ")", "\n", "return", "err", "\n", "}" ]
4,459
all-4460
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetContentQuadsReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom48", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
4,460
all-4461
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetDOMBreakpointParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger3", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
4,461
all-4462
[ "RegisterConfigConverter", "is", "used", "to", "register", "a", "new", "Masonable", "interface", "In", ":", "name", "-", "identifier", "for", "Masonable", "implementation", "fn", "-", "function", "that", "will", "parse", "the", "configuration", "string", "and", "return", "a", "Masonable", "interface", "Out", ":", "nil", "on", "success", "error", "otherwise" ]
[ "func", "(", "m", "*", "Mason", ")", "RegisterConfigConverter", "(", "name", "string", ",", "fn", "ConfigConverter", ")", "error", "{", "_", ",", "ok", ":=", "m", ".", "configConverters", "[", "<mask>", "]", "\n", "if", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "m", ".", "configConverters", "[", "name", "]", "=", "fn", "\n", "return", "nil", "\n", "}" ]
4,462
all-4463
[ "Offset", "determines", "the", "numerical", "offset", "for", "the", "given", "field" ]
[ "func", "(", "t", "*", "TupleType", ")", "Offset", "(", "<mask>", "string", ")", "(", "offset", "int", ",", "exists", "bool", ")", "{", "offset", ",", "exists", "=", "t", ".", "fields", "[", "field", "]", "\n", "return", "\n", "}" ]
4,463
all-4464
[ "HasAcceptEncoding", "returns", "true", "if", "the", "header", "contains", "the", "given", "Accept", "-", "Encoding", "value", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "HasAcceptEncoding", "(", "acceptEncoding", "string", ")", "bool", "{", "h", ".", "bufKV", ".", "value", "=", "<mask>", "(", "h", ".", "bufKV", ".", "value", "[", ":", "0", "]", ",", "acceptEncoding", "...", ")", "\n", "return", "h", ".", "HasAcceptEncodingBytes", "(", "h", ".", "bufKV", ".", "value", ")", "\n", "}" ]
4,464
all-4465
[ "Capabilities", "indicates", "an", "expected", "call", "of", "Capabilities" ]
[ "func", "(", "mr", "*", "MockCNIClientMockRecorder", ")", "Capabilities", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockCNIClient", ")", "(", "nil", ")", ".", "Capabilities", ")", ",", "arg0", ")", "\n", "}" ]
4,465
all-4466
[ "NewConsumer", "configures", "a", "new", "consumer", "instance", "." ]
[ "func", "NewConsumer", "(", "config", "ConsumerConfig", ")", "(", "c", "*", "Consumer", ",", "err", "error", ")", "{", "if", "err", "=", "config", ".", "validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "config", ".", "defaults", "(", ")", "\n\n", "c", "=", "&", "Consumer", "{", "msgs", ":", "make", "(", "chan", "Message", ",", "config", ".", "MaxInFlight", ")", ",", "done", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "<mask>", ":", "config", ".", "Topic", ",", "channel", ":", "config", ".", "Channel", ",", "address", ":", "config", ".", "Address", ",", "lookup", ":", "append", "(", "[", "]", "string", "{", "}", ",", "config", ".", "Lookup", "...", ")", ",", "maxInFlight", ":", "config", ".", "MaxInFlight", ",", "identify", ":", "setIdentifyDefaults", "(", "config", ".", "Identify", ")", ",", "dialTimeout", ":", "config", ".", "DialTimeout", ",", "readTimeout", ":", "config", ".", "ReadTimeout", ",", "writeTimeout", ":", "config", ".", "WriteTimeout", ",", "conns", ":", "make", "(", "map", "[", "string", "]", "(", "chan", "<-", "Command", ")", ")", ",", "}", "\n\n", "return", "\n", "}" ]
4,466
all-4467
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EmulateNetworkConditionsParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork58", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
4,467
all-4468
[ "Warn", "logs", "a", "message", "(", "with", "optional", "context", ")", "at", "the", "WARNING", "log", "level" ]
[ "func", "Warn", "(", "<mask>", "string", ",", "ctx", "...", "interface", "{", "}", ")", "{", "if", "Log", "!=", "nil", "{", "Log", ".", "Warn", "(", "msg", ",", "ctx", "...", ")", "\n", "}", "\n", "}" ]
4,468
all-4469
[ "ClientPreServiceUnsuspend", "activates", "service", "." ]
[ "func", "(", "w", "*", "Worker", ")", "ClientPreServiceUnsuspend", "(", "job", "*", "data", ".", "Job", ")", "error", "{", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "job", ")", "\n\n", "ch", ",", "err", ":=", "w", ".", "relatedChannel", "(", "logger", ",", "job", ",", "data", ".", "JobClientPreServiceUnsuspend", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "ch", ")", "\n\n", "ch", ".", "ServiceStatus", "=", "data", ".", "ServiceActivating", "\n", "changedTime", ":=", "time", ".", "Now", "(", ")", "\n", "ch", ".", "ServiceChangedTime", "=", "&", "changedTime", "\n", "return", "w", ".", "saveRecord", "(", "logger", ",", "w", ".", "<mask>", ".", "Querier", ",", "ch", ")", "\n", "}" ]
4,469
all-4470
[ "String", "prints", "out", "the", "disk", "sub", "-", "resource", "s", "information", "including", "the", "ID", "at", "time", "of", "instantiation", "the", "path", "of", "the", "disk", "and", "the", "current", "device", "key", "and", "address", "." ]
[ "func", "(", "r", "*", "DiskSubresource", ")", "String", "(", ")", "string", "{", "p", ":=", "diskPathOrName", "(", "r", ".", "<mask>", ")", "\n", "if", "p", "==", "\"", "\"", "{", "p", "=", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "Subresource", ".", "String", "(", ")", ",", "p", ")", "\n", "}" ]
4,470
all-4471
[ "Scan", "reads", "from", "src", "into", "an", "Int64" ]
[ "func", "(", "t", "*", "Int64", ")", "Scan", "(", "src", "interface", "{", "}", ")", "error", "{", "val", ",", "<mask>", ":=", "src", ".", "(", "int64", ")", "\n", "if", "!", "ok", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "*", "t", "=", "Int64", "(", "val", ")", "\n", "return", "nil", "\n", "}" ]
4,471
all-4472
[ "ParamsFloat64", "returns", "params", "result", "in", "int64", "type", ".", "e", ".", "g", ".", "ctx", ".", "ParamsFloat64", "(", ":", "uid", ")" ]
[ "func", "(", "ctx", "*", "Context", ")", "ParamsFloat64", "(", "<mask>", "string", ")", "float64", "{", "v", ",", "_", ":=", "strconv", ".", "ParseFloat", "(", "ctx", ".", "Params", "(", "name", ")", ",", "64", ")", "\n", "return", "v", "\n", "}" ]
4,472
all-4473
[ "GetLogoIconName", "is", "a", "wrapper", "around", "gtk_about_dialog_get_logo_icon_name", "()", "." ]
[ "func", "(", "v", "*", "AboutDialog", ")", "GetLogoIconName", "(", ")", "string", "{", "c", ":=", "C", ".", "gtk_about_dialog_get_logo_icon_name", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", "\n", "}" ]
4,473
all-4474
[ "Gets", "a", "single", "uint64", "value", "from", "the", "specified", "cgroup", "file", "." ]
[ "func", "getCgroupParamUint", "(", "cgroupPath", ",", "cgroupFile", "string", ")", "(", "uint64", ",", "error", ")", "{", "contents", ",", "<mask>", ":=", "ioutil", ".", "ReadFile", "(", "filepath", ".", "Join", "(", "cgroupPath", ",", "cgroupFile", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "return", "parseUint", "(", "strings", ".", "TrimSpace", "(", "string", "(", "contents", ")", ")", ",", "10", ",", "64", ")", "\n", "}" ]
4,474
all-4475
[ "GoStr", "takes", "a", "null", "-", "terminated", "string", "returned", "by", "OpenGL", "and", "constructs", "a", "corresponding", "Go", "string", "." ]
[ "func", "GoStr", "(", "cstr", "*", "uint8", ")", "string", "{", "str", ":=", "\"", "\"", "\n", "for", "{", "if", "*", "cstr", "==", "0", "{", "<mask>", "\n", "}", "\n", "str", "+=", "string", "(", "*", "cstr", ")", "\n", "cstr", "=", "(", "*", "uint8", ")", "(", "unsafe", ".", "Pointer", "(", "uintptr", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "+", "1", ")", ")", "\n", "}", "\n", "return", "str", "\n", "}" ]
4,475
all-4476
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CompileScriptReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime44", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
4,476
all-4477
[ "This", "helper", "complements", "a", "PUT", "/", "PATCH", "request", "config", "with", "node", "-", "specific", "value", "as", "taken", "from", "the", "db", "." ]
[ "func", "storagePoolClusterFillWithNodeConfig", "(", "dbConfig", ",", "reqConfig", "map", "[", "string", "]", "string", ")", "map", "[", "string", "]", "string", "{", "config", ":=", "util", ".", "CopyConfig", "(", "reqConfig", ")", "\n", "for", "_", ",", "key", ":=", "range", "db", ".", "StoragePoolNodeConfigKeys", "{", "config", "[", "key", "]", "=", "dbConfig", "[", "<mask>", "]", "\n", "}", "\n", "return", "config", "\n", "}" ]
4,477
all-4478
[ "IsGamepadButtonJustReleased", "returns", "a", "boolean", "value", "indicating", "whether", "the", "given", "gamepad", "button", "of", "the", "gamepad", "id", "is", "released", "just", "in", "the", "current", "frame", ".", "IsGamepadButtonJustReleased", "is", "concurrent", "safe", "." ]
[ "func", "IsGamepadButtonJustReleased", "(", "id", "int", ",", "button", "ebiten", ".", "GamepadButton", ")", "bool", "{", "theInputState", ".", "m", ".", "RLock", "(", ")", "\n", "prev", ":=", "0", "\n", "if", "_", ",", "ok", ":=", "theInputState", ".", "prevGamepadButtonDurations", "[", "id", "]", ";", "ok", "{", "prev", "=", "theInputState", ".", "prevGamepadButtonDurations", "[", "id", "]", "[", "button", "]", "\n", "}", "\n", "current", ":=", "0", "\n", "if", "_", ",", "ok", ":=", "theInputState", ".", "gamepadButtonDurations", "[", "id", "]", ";", "ok", "{", "current", "=", "theInputState", ".", "gamepadButtonDurations", "[", "id", "]", "[", "button", "]", "\n", "}", "\n", "theInputState", ".", "m", ".", "RUnlock", "(", ")", "\n", "return", "<mask>", "==", "0", "&&", "prev", ">", "0", "\n", "}" ]
4,478
all-4479
[ "APIVersion", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockDockerClient", ")", "APIVersion", "(", ")", "(", "dockerclient", ".", "DockerVersion", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "dockerclient", ".", "DockerVersion", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
4,479
all-4480
[ "NewAPIServer", "creates", "an", "APIServer", "." ]
[ "func", "NewAPIServer", "(", "env", "*", "serviceenv", ".", "ServiceEnv", ",", "etcdPrefix", "string", ",", "namespace", "string", ",", "workerImage", "string", ",", "workerSidecarImage", "string", ",", "workerImagePullPolicy", "string", ",", "storageRoot", "string", ",", "storageBackend", "string", ",", "storageHostPath", "string", ",", "iamRole", "string", ",", "imagePullSecret", "string", ",", "noExposeDockerSocket", "bool", ",", "reporter", "*", "metrics", ".", "Reporter", ",", "workerUsesRoot", "bool", ",", "workerGrpcPort", "uint16", ",", "port", "uint16", ",", "pprofPort", "uint16", ",", "httpPort", "uint16", ",", "peerPort", "uint16", ",", ")", "(", "ppsclient", ".", "APIServer", ",", "error", ")", "{", "apiServer", ":=", "&", "apiServer", "{", "Logger", ":", "log", ".", "NewLogger", "(", "\"", "\"", ")", ",", "env", ":", "env", ",", "etcdPrefix", ":", "etcdPrefix", ",", "namespace", ":", "namespace", ",", "workerImage", ":", "workerImage", ",", "workerSidecarImage", ":", "workerSidecarImage", ",", "workerImagePullPolicy", ":", "workerImagePullPolicy", ",", "storageRoot", ":", "storageRoot", ",", "storageBackend", ":", "storageBackend", ",", "storageHostPath", ":", "storageHostPath", ",", "iamRole", ":", "iamRole", ",", "imagePullSecret", ":", "imagePullSecret", ",", "noExposeDockerSocket", ":", "noExposeDockerSocket", ",", "reporter", ":", "reporter", ",", "workerUsesRoot", ":", "workerUsesRoot", ",", "pipelines", ":", "ppsdb", ".", "Pipelines", "(", "env", ".", "GetEtcdClient", "(", ")", ",", "etcdPrefix", ")", ",", "<mask>", ":", "ppsdb", ".", "Jobs", "(", "env", ".", "GetEtcdClient", "(", ")", ",", "etcdPrefix", ")", ",", "monitorCancels", ":", "make", "(", "map", "[", "string", "]", "func", "(", ")", ")", ",", "workerGrpcPort", ":", "workerGrpcPort", ",", "port", ":", "port", ",", "pprofPort", ":", "pprofPort", ",", "httpPort", ":", "httpPort", ",", "peerPort", ":", "peerPort", ",", "}", "\n", "apiServer", ".", "validateKube", "(", ")", "\n", "go", "apiServer", ".", "master", "(", ")", "\n", "return", "apiServer", ",", "nil", "\n", "}" ]
4,480
all-4481
[ "invalidate", "the", "content", "of", "some", "or", "all", "of", "a", "framebuffer", "s", "attachments" ]
[ "func", "InvalidateFramebuffer", "(", "<mask>", "uint32", ",", "numAttachments", "int32", ",", "attachments", "*", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpInvalidateFramebuffer", ",", "3", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "numAttachments", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "attachments", ")", ")", ")", "\n", "}" ]
4,481
all-4482
[ "PathCmder", "returns", "a", "Cmder", "that", "runs", "the", "command", "at", "the", "supplied", "path", "with", "the", "specified", "prependedArgs", "provided", "as", "arguments", "to", "the", "executable", "before", "all", "of", "the", "other", "arguments", "that", "are", "added", ".", "The", "path", "should", "resolve", "to", "the", "executable", "that", "should", "be", "run", ":", "for", "example", "/", "usr", "/", "bin", "/", "git", ".", "The", "prependedArgs", "will", "be", "combined", "with", "the", "arguments", "provided", "to", "the", "Run", "method", "for", "any", "given", "execution", "." ]
[ "func", "PathCmder", "(", "pathToExecutable", "string", ",", "prependedArgs", "...", "string", ")", "Cmder", "{", "return", "&", "<mask>", "{", "pathToExecutable", ":", "pathToExecutable", ",", "prependedArgs", ":", "prependedArgs", ",", "}", "\n", "}" ]
4,482
all-4483
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "MakeSnapshotReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree10", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
4,483
all-4484
[ "ParseRefs", "parses", "a", "human", "-", "provided", "string", "into", "the", "repo", "that", "should", "be", "cloned", "and", "the", "refs", "that", "need", "to", "be", "checked", "out", "once", "it", "is", ".", "The", "format", "is", ":", "org", "repo", "=", "base", "-", "ref", "[", ":", "base", "-", "sha", "]", "[", "pull", "-", "id", "[", ":", "pull", "-", "sha", "[", ":", "pull", "-", "ref", "]]]", "...", "For", "the", "base", "ref", "and", "pull", "IDs", "a", "SHA", "may", "optionally", "be", "provided", "or", "may", "be", "omitted", "for", "the", "latest", "available", "SHA", ".", "Examples", ":", "kubernetes", "test", "-", "infra", "=", "master", "kubernetes", "test", "-", "infra", "=", "master", ":", "abcde12", "kubernetes", "test", "-", "infra", "=", "master", ":", "abcde12", "34", "kubernetes", "test", "-", "infra", "=", "master", ":", "abcde12", "34", ":", "fghij56", "kubernetes", "test", "-", "infra", "=", "master", "34", ":", "fghij56", "kubernetes", "test", "-", "infra", "=", "master", ":", "abcde12", "34", ":", "fghij56", "78", "gerrit", "test", "-", "infra", "=", "master", ":", "abcde12", "34", ":", "fghij56", ":", "refs", "/", "changes", "/", "00", "/", "123", "/", "1" ]
[ "func", "ParseRefs", "(", "value", "string", ")", "(", "*", "prowapi", ".", "Refs", ",", "error", ")", "{", "gitRef", ":=", "&", "prowapi", ".", "Refs", "{", "}", "\n", "values", ":=", "strings", ".", "SplitN", "(", "value", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "values", ")", "!=", "2", "{", "return", "gitRef", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "value", ")", "\n", "}", "\n", "info", ":=", "values", "[", "0", "]", "\n", "allRefs", ":=", "values", "[", "1", "]", "\n\n", "infoValues", ":=", "strings", ".", "SplitN", "(", "info", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "infoValues", ")", "!=", "2", "{", "return", "gitRef", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}", "\n", "gitRef", ".", "Org", "=", "infoValues", "[", "0", "]", "\n", "gitRef", ".", "Repo", "=", "infoValues", "[", "1", "]", "\n\n", "refValues", ":=", "strings", ".", "Split", "(", "allRefs", ",", "\"", "\"", ")", "\n", "if", "len", "(", "refValues", ")", "==", "1", "&&", "refValues", "[", "0", "]", "==", "\"", "\"", "{", "return", "gitRef", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "value", ")", "\n", "}", "\n", "baseRefParts", ":=", "strings", ".", "Split", "(", "refValues", "[", "0", "]", ",", "\"", "\"", ")", "\n", "if", "len", "(", "baseRefParts", ")", "!=", "1", "&&", "len", "(", "baseRefParts", ")", "!=", "2", "{", "return", "gitRef", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "refValues", "[", "0", "]", ")", "\n", "}", "\n", "gitRef", ".", "BaseRef", "=", "baseRefParts", "[", "0", "]", "\n", "if", "len", "(", "baseRefParts", ")", "==", "2", "{", "gitRef", ".", "BaseSHA", "=", "baseRefParts", "[", "1", "]", "\n", "}", "\n", "for", "_", ",", "refValue", ":=", "range", "refValues", "[", "1", ":", "]", "{", "refParts", ":=", "strings", ".", "Split", "(", "refValue", ",", "\"", "\"", ")", "\n", "if", "len", "(", "refParts", ")", "==", "0", "||", "len", "(", "refParts", ")", ">", "3", "{", "return", "gitRef", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "refValue", ")", "\n", "}", "\n", "pullNumber", ",", "err", ":=", "strconv", ".", "Atoi", "(", "refParts", "[", "0", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "gitRef", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "refValue", ",", "err", ")", "\n", "}", "\n", "pullRef", ":=", "prowapi", ".", "Pull", "{", "Number", ":", "pullNumber", ",", "}", "\n", "if", "len", "(", "refParts", ")", ">", "1", "{", "pullRef", ".", "SHA", "=", "refParts", "[", "1", "]", "\n", "}", "\n", "if", "len", "(", "refParts", ")", ">", "2", "{", "pullRef", ".", "Ref", "=", "refParts", "[", "2", "]", "\n", "}", "\n", "gitRef", ".", "Pulls", "=", "append", "(", "gitRef", ".", "Pulls", ",", "pullRef", ")", "\n", "}", "\n\n", "return", "gitRef", ",", "nil", "\n", "}" ]
4,484
all-4485
[ "NewGetCommand", "returns", "the", "cobra", "command", "for", "get", "." ]
[ "func", "NewGetCommand", "(", ")", "*", "cobra", ".", "Command", "{", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Run", ":", "getCommandFunc", ",", "}", "\n\n", "cmd", ".", "Flags", "(", ")", ".", "StringVar", "(", "&", "getConsistency", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "StringVar", "(", "&", "getSortOrder", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "StringVar", "(", "&", "getSortTarget", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "Int64Var", "(", "&", "getLimit", ",", "\"", "\"", ",", "0", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "BoolVar", "(", "&", "getPrefix", ",", "\"", "\"", ",", "false", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "BoolVar", "(", "&", "getFromKey", ",", "\"", "\"", ",", "false", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "Int64Var", "(", "&", "getRev", ",", "\"", "\"", ",", "0", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "BoolVar", "(", "&", "getKeysOnly", ",", "\"", "\"", ",", "<mask>", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "BoolVar", "(", "&", "printValueOnly", ",", "\"", "\"", ",", "false", ",", "`Only write values when using the \"simple\" output format`", ")", "\n", "return", "cmd", "\n", "}" ]
4,485
all-4486
[ "Batch", "sets", "the", "batch", "size", "used", "when", "fetching", "documents", "from", "the", "database", ".", "It", "s", "possible", "to", "change", "this", "setting", "on", "a", "per", "-", "session", "basis", "as", "well", "using", "the", "Batch", "method", "of", "Session", ".", "The", "default", "batch", "size", "is", "defined", "by", "the", "database", "itself", ".", "As", "of", "this", "writing", "MongoDB", "will", "use", "an", "initial", "size", "of", "min", "(", "100", "docs", "4MB", ")", "on", "the", "first", "batch", "and", "4MB", "on", "remaining", "ones", "." ]
[ "func", "(", "q", "*", "Query", ")", "Batch", "(", "n", "int", ")", "*", "Query", "{", "if", "n", "==", "1", "{", "// Server interprets 1 as -1 and closes the cursor (!?)", "n", "=", "2", "\n", "}", "\n", "q", ".", "m", ".", "Lock", "(", ")", "\n", "q", ".", "op", ".", "<mask>", "=", "int32", "(", "n", ")", "\n", "q", ".", "m", ".", "Unlock", "(", ")", "\n", "return", "q", "\n", "}" ]
4,486
all-4487
[ "CopyConfig", "creates", "a", "new", "map", "with", "a", "copy", "of", "the", "given", "config", "." ]
[ "func", "CopyConfig", "(", "config", "map", "[", "string", "]", "string", ")", "map", "[", "string", "]", "string", "{", "copy", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "for", "key", ",", "value", ":=", "<mask>", "config", "{", "copy", "[", "key", "]", "=", "value", "\n", "}", "\n", "return", "copy", "\n", "}" ]
4,487
all-4488
[ "SetWindowBounds", "set", "position", "and", "/", "or", "size", "of", "the", "browser", "window", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "Browser#method", "-", "setWindowBounds", "parameters", ":", "windowID", "-", "Browser", "window", "id", ".", "bounds", "-", "New", "window", "bounds", ".", "The", "minimized", "maximized", "and", "fullscreen", "states", "cannot", "be", "combined", "with", "left", "top", "width", "or", "height", ".", "Leaves", "unspecified", "fields", "unchanged", "." ]
[ "func", "SetWindowBounds", "(", "windowID", "WindowID", ",", "bounds", "*", "Bounds", ")", "*", "SetWindowBoundsParams", "{", "<mask>", "&", "SetWindowBoundsParams", "{", "WindowID", ":", "windowID", ",", "Bounds", ":", "bounds", ",", "}", "\n", "}" ]
4,488
all-4489
[ "Cmds", "returns", "a", "list", "of", "cobra", "commands", "for", "authenticating", "and", "authorizing", "users", "in", "an", "auth", "-", "enabled", "Pachyderm", "cluster", "." ]
[ "func", "Cmds", "(", "noMetrics", ",", "noPortForwarding", "*", "bool", ")", "[", "]", "*", "cobra", ".", "Command", "{", "var", "commands", "[", "]", "*", "cobra", ".", "Command", "\n\n", "auth", ":=", "&", "cobra", ".", "Command", "{", "Short", ":", "\"", "\"", ",", "Long", ":", "\"", "\"", ",", "}", "\n\n", "commands", "=", "append", "(", "commands", ",", "cmdutil", ".", "CreateAlias", "(", "auth", ",", "\"", "\"", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "ActivateCmd", "(", "noMetrics", ",", "noPortForwarding", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "DeactivateCmd", "(", "noMetrics", ",", "noPortForwarding", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "LoginCmd", "(", "noMetrics", ",", "noPortForwarding", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "LogoutCmd", "(", ")", ")", "\n", "commands", "=", "<mask>", "(", "commands", ",", "WhoamiCmd", "(", "noMetrics", ",", "noPortForwarding", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "CheckCmd", "(", "noMetrics", ",", "noPortForwarding", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "SetScopeCmd", "(", "noMetrics", ",", "noPortForwarding", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "GetCmd", "(", "noMetrics", ",", "noPortForwarding", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "ListAdminsCmd", "(", "noMetrics", ",", "noPortForwarding", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "ModifyAdminsCmd", "(", "noMetrics", ",", "noPortForwarding", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "GetAuthTokenCmd", "(", "noMetrics", ",", "noPortForwarding", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "UseAuthTokenCmd", "(", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "GetConfigCmd", "(", "noPortForwarding", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "SetConfigCmd", "(", "noPortForwarding", ")", ")", "\n\n", "return", "commands", "\n", "}" ]
4,489
all-4490
[ "GetTextAlignOk", "returns", "a", "tuple", "with", "the", "TextAlign", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinition", ")", "GetTextAlignOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "g", "==", "nil", "||", "g", ".", "TextAlign", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "g", ".", "TextAlign", ",", "<mask>", "\n", "}" ]
4,490
all-4491
[ "do", "will", "get", "creds", "for", "the", "specified", "cluster", "and", "add", "them", "to", "the", "stdin", "secret" ]
[ "func", "do", "(", "o", "options", ")", "error", "{", "// Refresh credentials if requested", "if", "o", ".", "getClientCert", "{", "if", "err", ":=", "getCredentials", "(", "o", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "// Create the new cluster entry", "d", ",", "err", ":=", "describeCluster", "(", "o", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "newCluster", ":=", "kube", ".", "Cluster", "{", "Endpoint", ":", "\"", "\"", "+", "d", ".", "Endpoint", ",", "ClusterCACertificate", ":", "d", ".", "Auth", ".", "ClusterCACertificate", ",", "ClientKey", ":", "d", ".", "Auth", ".", "ClientKey", ",", "ClientCertificate", ":", "d", ".", "Auth", ".", "ClientCertificate", ",", "}", "\n\n", "// Try to use this entry", "if", "!", "o", ".", "skipCheck", "{", "c", ",", "err", ":=", "kube", ".", "NewClient", "(", "&", "newCluster", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "_", ",", "err", "=", "c", ".", "ListPods", "(", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "// Just print this entry if requested", "if", "o", ".", "printEntry", "{", "data", ",", "err", ":=", "kube", ".", "MarshalClusterMap", "(", "map", "[", "string", "]", "kube", ".", "Cluster", "{", "o", ".", "alias", ":", "newCluster", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "o", ".", "alias", ",", "err", ")", "\n", "}", "\n", "fmt", ".", "Println", "(", "string", "(", "<mask>", ")", ")", "\n", "return", "nil", "\n", "}", "\n\n", "// Append the new entry to the current secret", "// First read in the secret from stdin", "b", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "os", ".", "Stdin", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "var", "s", "coreapi", ".", "Secret", "\n", "if", "err", ":=", "yaml", ".", "Unmarshal", "(", "b", ",", "&", "s", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Now decode the {alias: cluster} map and print out current keys", "clusters", ",", "err", ":=", "kube", ".", "UnmarshalClusterMap", "(", "s", ".", "Data", "[", "\"", "\"", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "var", "existing", "[", "]", "string", "\n", "for", "a", ":=", "range", "clusters", "{", "existing", "=", "append", "(", "existing", ",", "a", ")", "\n", "}", "\n", "logrus", ".", "Infof", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "existing", ",", "\"", "\"", ")", ")", "\n\n", "// Add new key", "_", ",", "ok", ":=", "clusters", "[", "o", ".", "alias", "]", "\n", "if", "ok", "&&", "!", "o", ".", "overwrite", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "o", ".", "alias", ")", "\n", "}", "\n", "clusters", "[", "o", ".", "alias", "]", "=", "newCluster", "\n", "logrus", ".", "Infof", "(", "\"", "\"", ",", "o", ".", "alias", ")", "\n\n", "// Marshal the {alias: cluster} map back into secret data", "data", ",", "err", ":=", "kube", ".", "MarshalClusterMap", "(", "clusters", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "if", "o", ".", "printData", "{", "// Just print the data outside of the secret", "fmt", ".", "Println", "(", "string", "(", "data", ")", ")", "\n", "return", "nil", "\n", "}", "\n\n", "// Output the new secret", "s", ".", "Data", "[", "\"", "\"", "]", "=", "data", "\n", "buf", ",", "err", ":=", "yaml", ".", "Marshal", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "fmt", ".", "Println", "(", "string", "(", "buf", ")", ")", "\n", "return", "nil", "\n", "}" ]
4,491
all-4492
[ "NewCertPool", "creates", "x509", "certPool", "with", "provided", "CA", "files", "." ]
[ "func", "NewCertPool", "(", "CAFiles", "[", "]", "string", ")", "(", "*", "x509", ".", "CertPool", ",", "error", ")", "{", "certPool", ":=", "x509", ".", "NewCertPool", "(", ")", "\n\n", "for", "_", ",", "CAFile", ":=", "range", "CAFiles", "{", "pemByte", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "CAFile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "{", "<mask>", "block", "*", "pem", ".", "Block", "\n", "block", ",", "pemByte", "=", "pem", ".", "Decode", "(", "pemByte", ")", "\n", "if", "block", "==", "nil", "{", "break", "\n", "}", "\n", "cert", ",", "err", ":=", "x509", ".", "ParseCertificate", "(", "block", ".", "Bytes", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "certPool", ".", "AddCert", "(", "cert", ")", "\n", "}", "\n", "}", "\n\n", "return", "certPool", ",", "nil", "\n", "}" ]
4,492
all-4493
[ "GetExternalize", "retrieves", "the", "Externalize", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "ScpStatementPledges", ")", "GetExternalize", "(", ")", "(", "<mask>", "ScpStatementExternalize", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "Externalize", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
4,493
all-4494
[ "Start", "begins", "a", "Crossdock", "client", "in", "the", "background", "." ]
[ "func", "(", "c", "*", "Client", ")", "Start", "(", ")", "error", "{", "if", "err", ":=", "c", ".", "listen", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "go", "func", "(", ")", "{", "<mask>", ".", "Serve", "(", "c", ".", "listener", ",", "c", ".", "mux", ")", "\n", "}", "(", ")", "\n", "return", "nil", "\n", "}" ]
4,494
all-4495
[ "func", "When", "(", "cachedHandler", "*", "nethttp", ".", "Handler", "claimFuncs", "validFuncs", ")", "|", "We", "could", "have", "something", "like", "this", "but", "this", "wouldn", "t", "work", "for", "XXXFunc", "&", "fasthttp", "because", "they", "just", "returns", "a", "function", "|", "Cache", "accepts", "two", "parameters", "first", "is", "the", "http", ".", "Handler", "which", "you", "want", "to", "cache", "its", "result", "the", "second", "is", "optional", "the", "cache", "Entry", "s", "expiration", "duration", "if", "the", "expiration", "<", "=", "2", "seconds", "then", "expiration", "is", "taken", "by", "the", "cache", "-", "control", "s", "maxage", "header", "returns", "an", "http", ".", "Handler", "which", "you", "can", "use", "as", "your", "default", "router", "or", "per", "-", "route", "handler", "All", "type", "of", "responses", "are", "cached", "templates", "json", "text", "anything", ".", "You", "can", "add", "validators", "with", "this", "function" ]
[ "func", "Cache", "(", "bodyHandler", "http", ".", "Handler", ",", "expiration", "<mask>", ".", "Duration", ")", "*", "nethttp", ".", "Handler", "{", "return", "nethttp", ".", "NewHandler", "(", "bodyHandler", ",", "expiration", ")", "\n", "}" ]
4,495
all-4496
[ "NewEditField", "creates", "a", "new", "EditField", "control", "view", "-", "is", "a", "View", "that", "manages", "the", "control", "parent", "-", "is", "container", "that", "keeps", "the", "control", ".", "The", "same", "View", "can", "be", "a", "view", "and", "a", "parent", "at", "the", "same", "time", ".", "width", "-", "is", "minimal", "width", "of", "the", "control", ".", "text", "-", "text", "to", "edit", ".", "scale", "-", "the", "way", "of", "scaling", "the", "control", "when", "the", "parent", "is", "resized", ".", "Use", "DoNotScale", "constant", "if", "the", "control", "should", "keep", "its", "original", "size", "." ]
[ "func", "CreateEditField", "(", "parent", "Control", ",", "width", "int", ",", "text", "string", ",", "scale", "int", ")", "*", "EditField", "{", "e", ":=", "new", "(", "EditField", ")", "\n", "e", ".", "BaseControl", "=", "NewBaseControl", "(", ")", "\n", "e", ".", "onChange", "=", "nil", "\n", "e", ".", "SetTitle", "(", "text", ")", "\n", "e", ".", "SetEnabled", "(", "true", ")", "\n\n", "if", "width", "==", "AutoSize", "{", "width", "=", "xs", ".", "Len", "(", "text", ")", "+", "1", "\n", "}", "\n\n", "e", ".", "SetSize", "(", "width", ",", "1", ")", "\n", "e", ".", "cursorPos", "=", "xs", ".", "Len", "(", "text", ")", "\n", "e", ".", "offset", "=", "0", "\n", "e", ".", "parent", "=", "parent", "\n", "e", ".", "readonly", "=", "false", "\n", "e", ".", "SetScale", "(", "scale", ")", "\n\n", "e", ".", "SetConstraints", "(", "<mask>", ",", "1", ")", "\n\n", "e", ".", "end", "(", ")", "\n\n", "if", "parent", "!=", "nil", "{", "parent", ".", "AddChild", "(", "e", ")", "\n", "}", "\n\n", "return", "e", "\n", "}" ]
4,496
all-4497
[ "CaptureMetrics", "wraps", "the", "given", "hnd", "executes", "it", "with", "the", "given", "w", "and", "r", "and", "returns", "the", "metrics", "it", "captured", "from", "it", "." ]
[ "func", "CaptureMetrics", "(", "hnd", "http", ".", "Handler", ",", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ")", "Metrics", "{", "return", "CaptureMetricsFn", "(", "w", ",", "func", "(", "ww", "http", ".", "ResponseWriter", ")", "{", "hnd", ".", "ServeHTTP", "(", "ww", ",", "r", ")", "\n", "}", ")", "\n", "}" ]
4,497
all-4498
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventScreencastVisibilityChanged", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage51", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
4,498
all-4499
[ "This", "is", "intended", "for", "use", "in", "development", "+", "debugging", "and", "not", "intended", "to", "be", "a", "production", "error", "message", ".", "it", "also", "allows", "FieldError", "to", "be", "used", "as", "an", "Error", "interface" ]
[ "func", "(", "e", "*", "FieldError", ")", "Error", "(", ")", "string", "{", "if", "e", ".", "IsPlaceholderErr", "{", "buff", ":=", "<mask>", ".", "NewBufferString", "(", "\"", "\"", ")", "\n\n", "if", "e", ".", "IsSliceOrArray", "{", "for", "j", ",", "err", ":=", "range", "e", ".", "SliceOrArrayErrs", "{", "buff", ".", "WriteString", "(", "\"", "\\n", "\"", ")", "\n", "buff", ".", "WriteString", "(", "fmt", ".", "Sprintf", "(", "sliceErrMsg", ",", "e", ".", "Field", ",", "j", ",", "\"", "\\n", "\"", "+", "err", ".", "Error", "(", ")", ")", ")", "\n", "}", "\n\n", "}", "else", "if", "e", ".", "IsMap", "{", "for", "key", ",", "err", ":=", "range", "e", ".", "MapErrs", "{", "buff", ".", "WriteString", "(", "fmt", ".", "Sprintf", "(", "mapErrMsg", ",", "e", ".", "Field", ",", "key", ",", "\"", "\\n", "\"", "+", "err", ".", "Error", "(", ")", ")", ")", "\n", "}", "\n", "}", "\n\n", "return", "strings", ".", "TrimSpace", "(", "buff", ".", "String", "(", ")", ")", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "fieldErrMsg", ",", "e", ".", "Field", ",", "e", ".", "Tag", ")", "\n", "}" ]
4,499
all-4500
[ "check", "whether", "request", "satisfies", "the", "quota", ".", "If", "there", "is", "not", "enough", "space", "ignore", "request", "and", "raise", "the", "free", "space", "alarm", "." ]
[ "func", "(", "qa", "*", "quotaAlarmer", ")", "check", "(", "ctx", "context", ".", "Context", ",", "r", "<mask>", "{", "}", ")", "error", "{", "if", "qa", ".", "q", ".", "Available", "(", "r", ")", "{", "return", "nil", "\n", "}", "\n", "req", ":=", "&", "pb", ".", "AlarmRequest", "{", "MemberID", ":", "uint64", "(", "qa", ".", "id", ")", ",", "Action", ":", "pb", ".", "AlarmRequest_ACTIVATE", ",", "Alarm", ":", "pb", ".", "AlarmType_NOSPACE", ",", "}", "\n", "qa", ".", "a", ".", "Alarm", "(", "ctx", ",", "req", ")", "\n", "return", "rpctypes", ".", "ErrGRPCNoSpace", "\n", "}" ]